Skip to content

Instantly share code, notes, and snippets.

@jmberros
jmberros / country_from_nuccore_accessions.py
Last active August 25, 2023 06:13
Get the country field for the given nuccore accession numbers.
from Bio import Entrez
# Read the accessions from a file
accessions_file = 'accessions.txt'
with open(accessions_file) as f:
ids = f.read().split('\n')
# Fetch the entries from Entrez
Entrez.email = 'name@example.org' # Insert your email here
handle = Entrez.efetch('nuccore', id=ids, retmode='xml')