Can't get accession number using Entrez.

0

I have the following Python code in which I am trying to get the sequence of a TMV replicase gene:

# Lookup ID
search = Entrez.esearch(db='gene', term='Tobacco mosaic virus[Orgn] replicase', idtype="acc")
read = Entrez.read(search)
idlist = read["IdList"]

# Get sequence
search = Entrez.efetch(db='gene', id=idlist[0], retmode="text", rettype="gb")
read = SeqIO.read(search, "genbank")
sequence = read.seq

However, using idtype="acc" doesn't give me an accession number. Instead, I get 1494081, the ID for the gene in the gene database.

When I then try and fetch it in the gene database it throws ValueError: No records found in handle.

I've also tried fetching with the nucleotide database but without the accession number the ID leads to the wrong thing.


python


search


entrez

• 34 views



Source link