Question: The assignment is to write a Python program named interleave.py to read in paired Illumina reads from two files (left and right reads) Aip02.R1.fastq and
The assignment is to write a Python program named interleave.py to read in paired Illumina reads from two files (left and right reads) Aip02.R1.fastq and Aip02.R2.fastq . Output the results to an interleaved fasta file named Interleaved.fasta. You should use BioPython to parse the FASTQ file, and you can assume that you will always have the same number of reads in the R1 and R2 fastq files. Read 1 on the R1 file is the mate of Read 1 in the R2 file. using zip function to zip the two file together.
Here is my thoughts :
#!/usr/bin/env python3
# Import Seq, SeqRecord, and SeqIO
from Bio import SeqIO
# Import itertools to take a slice of list
import itertools
# The first parameter to SeqIO.parse is the file location
# The second parameter is the file type
leftReads = SeqIO.parse("/scratch/AiptasiaMiSeq/fastq/Aip02.R1.fastq", "fastq")
rightReads = SeqIO.parse("/scratch/AiptasiaMiSeq/fastq/Aip02.R2.fastq", "fastq")
A=zip(leftReads,rightReads)
SeqIO.write(A, "interleaved.fastq", "fastq")
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
