美文网首页
根据NCBI序列ID对应到物种名称

根据NCBI序列ID对应到物种名称

作者: 九月_1012 | 来源:发表于2024-01-06 13:32 被阅读0次
    from Bio import Entrez
    
    def get_species_from_ncbi(sequence_id):
        Entrez.email = "XX@email.com"  # 设置您的电子邮件地址
        handle = Entrez.efetch(db="nucleotide", id=sequence_id, retmode="xml")
        records = Entrez.read(handle)
        handle.close()
    
        species = records[0]['GBSeq_organism']
        return species
    
    # 在此处输入您的ID列表文件名
    input_file = "XXXid_list.txt"
    
    with open(input_file, 'r') as file:
        id_list = file.readlines()
    
    species_list = []
    for sequence_id in id_list:
        sequence_id = sequence_id.strip()
        species_name = get_species_from_ncbi(sequence_id)
        species_list.append(species_name)
    
    for species_name in species_list:
        print(species_name)
    

    相关文章

      网友评论

          本文标题:根据NCBI序列ID对应到物种名称

          本文链接:https://www.haomeiwen.com/subject/ofswndtx.html