I have a weird problem. I am trying to download a number of assemblies from Genbank using Entrez.eftech. Here is my code:
from Bio import Entrez, SeqIO import csv, sys, os, time, shutil import httplib, urllib2 Entrez.email="email@example.com" def download_genomes(): #Search for all bacterial assemblies in the assembly database and get their ids search_term= "bacteria[orgn] AND all[filter]" handle=Entrez.esearch(db="assembly", retmax=500000, term=search_term) genome_id=Entrez.read(handle)['IdList'] print "Fetched Id list..." for id in genome_id: while True: try: #Fetch the enrty corresponding to the id record=Entrez.efetch(db='assembly', id=id, rettype='fasta', retmode='text') time.sleep(3) seq_record=Entrez.efetch(db='assembly', id=id, rettype='gbwithparts', retmode='text') seq_meta=SeqIO.read(seq_record, "genbank") . . . #Skipped rest of the code which writes downloaded files to spec. dirs and so on
However, when running this, get a
HTTP Error 400: Bad request for every id. When trying out the ids manually in Genbank, the enrty is found. Does somebody know what could be going on here? I would apprechiate the help!