Skip to content
Commits on Source (2)
This diff is collapsed.
from Bio import Entrez
Entrez.email = 'unknown@debian.org'
database = 'nucleotide'
fn = 'data/gingo.fasta'
query = [
'((chloroplast OR plastid) AND "complete genome" AND Embryophyta NOT (mi- tochondrion OR mitochondrial)) AND "Ginkgo biloba"'
]
# Fetch the query IDs
handle = Entrez.esearch(db=database, term=query)
record = Entrez.read(handle)
ids = record['IdList']
handle.close()
# Fetch the first result
ff = open(fn, 'w')
handle_fasta = Entrez.efetch(db=database, id=ids[0], rettype='fasta', retmode='text')
ff.write(handle_fasta.read().rstrip('\n'))
handle_fasta.close()