Skip to main content
 首页 » 编程设计

python之biopython 的 efetch 只返回任何数据库的第一个特征

2025年05月04日9sxdcgaq8080

知道为什么这段代码:

handle = Entrez.efetch(db="nuccore",  
         id=['556503834'], rettype="gb",  
         retmode="txt") 
print(handle.read()) 

不返回找到的完整功能 on the ncbi description ?仅返回第一个特征(我的目标是获取 CDS 特征)。

我尝试了其他数据库得出相同的结论。

请您参考如下方法:

将 rettype 更改为 "gbwithparts"

from Bio import Entrez 
Entrez.email = "your@mail.com" #put real mail 
 
handle = Entrez.efetch(db="nuccore", id=['556503834'],  
                   rettype="gbwithparts", retmode="txt") 
print(handle.read()) 

注意:可能需要几秒钟