我正在尝试更改以前的脚本,该脚本利用 biopython 获取有关物种门的信息。编写此脚本是为了一次检索一个物种的信息。我想修改脚本,以便我可以一次对 100 个生物执行此操作。这是初始代码
import sys
from Bio import Entrez
def get_tax_id(species):
"""to get data from ncbi taxomomy, we need to have the taxid. we can
get that by passing the species name to esearch, which will return
the tax id"""
species = species.replace(" ", "+").strip()
search = Entrez.esearch(term = species, db = "taxonomy", retmode = "xml")
record = Entrez.read(search)
return record['IdList'][0]
def get_tax_data(taxid):
"""once we have the taxid, we can fetch the record"""
search = Entrez.efetch(id = taxid, …
Run Code Online (Sandbox Code Playgroud)