您可以利用 Entrez.elink,请求与核苷酸序列的 UID 对应的蛋白质序列的 UID:
from Bio import Entrez
from Bio import SeqIO
email = 'seb@free.fr'
term = 'NM_207618.2' #fro example, accession/version
### first step, we search for the nucleotide sequence of interest
h_search = Entrez.esearch(
db='nucleotide', email=email, term=term)
record = Entrez.read(h_search)
h_search.close()
### second step, we fetch the UID of that nt sequence
handle_nt = Entrez.efetch(
db='nucleotide', email=email,
id=record['IdList'][0], rettype='fasta') # here is the UID
### third and most important, we 'link' the UID of the nucleotide
# sequence to the corresponding protein from the appropriate database
results = Entrez.read(Entrez.elink(
dbfrom='nucleotide', linkname='nucleotide_protein',
email=email, id=record['IdList'][0]))
### last, we fetch the amino acid sequence
handle_aa = Entrez.efetch(
db='protein', email=email,
id=results[0]['LinkSetDb'][0]['Link'][0]['Id'], # here is the key...
rettype='fasta')