我在从数据库下载完整的记录时遇到了问题。我使用:
from Bio import Entrez
from Bio import SeqIO
with Entrez.efetch(db="nuccore", rettype="gb", retmode="full", id="NC_007384") as handle:
seq_record = SeqIO.read(handle, "gb")
print(seq_record)
这给了我一个简短的gb文件版本,因此命令:
seq_record.features
不返回功能。
相比之下,当我对GenBank ID执行相同的操作时,没有问题:
with Entrez.efetch(db="nuccore", rettype="gb", retmode="full", id="CP014768.1") as handle:
seq_record = SeqIO.read(handle, "gb")
print(seq_record)
之后,我可以从列表seq_record.features中提取每个带注释的特征。
有没有办法使用Efetch下载完整的RefSeq记录?
发布于 2019-03-28 16:14:07
您需要使用style="withparts"
或将rettype
更改为gbwithparts
来获取所有功能。此table包含一些信息。
>>> from Bio import Entrez
>>> from Bio import SeqIO
>>> Entrez.email = 'someone@email.com'
>>> with Entrez.efetch(db="nuccore", rettype="gb", retmode="full", id="NC_007384") as handle:
... seq_record = SeqIO.read(handle, "gb")
...
>>> len(seq_record.features)
1
>>> with Entrez.efetch(db="nuccore", rettype="gbwithparts", retmode="full", id="NC_007384") as handle:
... seq_record = SeqIO.read(handle, "gb")
...
>>> len(seq_record.features)
10616
>>> with Entrez.efetch(db="nuccore", rettype="gb", style="withparts", retmode="full", id="NC_007384") as handle:
... seq_record = SeqIO.read(handle, "gb")
...
>>> len(seq_record.features)
10616
https://stackoverflow.com/questions/55266054
复制