Skip to main content
3 of 3
edited tags
M__
  • 13k
  • 5
  • 29
  • 46

Entrez (Biopython) esearch and efetch not returning sequence as expected

I'm trying to use Entrez (through Biopython) to download the sequence of a TMV replicase gene.

I have the following code:

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

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

But when I run it it throws the exception on the SeqIO.read line: ValueError: No records found in handle.

The IDs provided in idlist are: ['1494081', '1494082'].