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)
网友评论