小编use*_*216的帖子

尝试从 Biopython 获取分类信息

我正在尝试更改以前的脚本,该脚本利用 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)

iteration loops list bioinformatics biopython

5
推荐指数
1
解决办法
3201
查看次数

标签 统计

bioinformatics ×1

biopython ×1

iteration ×1

list ×1

loops ×1