[BioPython] Connecting to Genbank

Brad Chapman chapmanb at uga.edu
Wed Nov 26 13:46:33 EST 2003


Hi Glen, Peter;

Glen:
> > >       I have just resurrected an old script ( about six months old) 
> > > that queries Genbank for sequence information using the gi number. 
> > > The scrips gets the gi information by calling
> > >
> > > Gi_list=Genbank.search_for("gi|number")
> > >
> > > Then sequence information is extracted from Gi_list. The problem is 
> > > that although this used to work it now it doesn't. It doesn't throw 
> > > an exception either just keeps going. Has something changed with 
> > > Genbank.

Peter:
> > Could you send us the accession number where the problem occurs? 

Glen:
> >          No gi number that I have tried works there appears to be no 
> > connection you can try gi|15834378 but the same sort of call works 
> > with BioPerl.

The problem with the supplied GI number is that it is a protein
sequence and by default search_for uses the nucleotide database. If
you use the protein database things should work fine:

>>> from Bio import GenBank
>>> gi_list = GenBank.search_for("gi|15834378", database = "protein")
>>> gi_list
['15834378']

If you use a nucleotide sequence (ala gi|38446359) the default works
fine:

>>> gi_list = GenBank.search_for("gi|38446359")
>>> gi_list
['38446359']

So probably the best solution is to explicitly supply a database for 
your searches.

Hopefully this helps!
Brad


More information about the BioPython mailing list