BioPython: IOError: [Errno 2] No such file or directory

BioPython: IOError: [Errno 2] No such file or directory

我正在尝试将 FASTQ(从 Illumina Miseq mate 配对基因组序列生成)文件转换为 FASTA,并最终使用带注释的参考序列将其转换为 Genbank。我正在按照 Biopython 教程中的说明进行操作。这是我的代码和错误。

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'

回溯是你的朋友:

IOError: [Errno 2] No such file or directory: '~/Users/ryanjhope ...

再往上:

File "/Users/ryanjhope/Documents/anaconda/lib/python2.7/site-packages/Bio/File.py", line 90, in as_handle

这是 '~/Users/ 与 '/Users/`

更改这些行:

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")

进入:

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")

然后重试。