I'm trying to convert a FASTQ (generated from a Illumina Miseq mate paired genome sequence) file to FASTA and eventually convert that to Genbank using an annotated reference sequence. I'm following instrucitons from the Biopython Tutorial. Here's my code and error.
from Bio import SeqIO
records = SeqIO.parse("~/Users/ryanjhope/Documents/PhD/DNA_Sequences/Genome/C. aceto_∆pyrE_∆bcd_Deepseq/YZ1_S11_L001_R1_001.fastq", "fastq")
count = SeqIO.write(records, "~/Users/ryanjhope/Documents/PhD/DNA_Sequences/Genome/C. aceto_∆pyrE_∆bcd_Deepseq/∆bcdpseudo.fasta", "fasta")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/ryanjhope/Documents/anaconda/lib/python2.7/site-packages/Bio/SeqIO/__init__.py", line 468, in write
with as_handle(handle, mode) as fp:
File "/Users/ryanjhope/Documents/anaconda/lib/python2.7/contextlib.py", line 17, in __enter__
return self.gen.next()
File "/Users/ryanjhope/Documents/anaconda/lib/python2.7/site-packages/Bio/File.py", line 90, in as_handle
with open(handleish, mode, **kwargs) as fp:
IOError: [Errno 2] No such file or directory: '~/Users/ryanjhope/Documents/PhD/DNA_Sequences/Genome/C. aceto_\xe2\x88\x86pyrE_\xe2\x88\x86bcd_Deepseq/\xe2\x88\x86bcdpseudo.fasta'
The traceback is your friend:
IOError: [Errno 2] No such file or directory: '~/Users/ryanjhope ...
and further up:
File "/Users/ryanjhope/Documents/anaconda/lib/python2.7/site-packages/Bio/File.py", line 90, in as_handle
This is '~/Users/
vs. '/Users/`
Changes these lines:
records = SeqIO.parse("~/Users/ryanjhope/Documents/PhD/DNA_Sequences/Genome/C. aceto_∆pyrE_∆bcd_Deepseq/YZ1_S11_L001_R1_001.fastq", "fastq")
count = SeqIO.write(records, "~/Users/ryanjhope/Documents/PhD/DNA_Sequences/Genome/C. aceto_∆pyrE_∆bcd_Deepseq/∆bcdpseudo.fasta", "fasta")
into:
records = SeqIO.parse("/Users/ryanjhope/Documents/PhD/DNA_Sequences/Genome/C. aceto_∆pyrE_∆bcd_Deepseq/YZ1_S11_L001_R1_001.fastq", "fastq")
count = SeqIO.write(records, "/Users/ryanjhope/Documents/PhD/DNA_Sequences/Genome/C. aceto_∆pyrE_∆bcd_Deepseq/∆bcdpseudo.fasta", "fasta")
and try again.