[BioPython] Parstin a remote Blast output

Peter biopython at maubp.freeserve.co.uk
Wed May 21 18:42:10 EDT 2008


On Wed, May 21, 2008 at 6:04 PM, Raul Guerra <colochera at gmail.com> wrote:
> Hi Peter,
>
> Thank you for all your help, it is greatly appreciated. I am sorry that I
> keep asking about how to parse the blast. About why I tried to use the plain
> text parser, I googled around and found a BioPython CookBook (I know now
> that it is an older version of yours) and tried the code in it.

That would explain why you started out doing things "the old way".  We
could try writing to the website hosting the old tutorial/cookbook and
see if they could update it...

> About NCBIXML, I overwrote the file
> "/usr/lib/python2.5/site-packages/Bio/Blast/NCBIXML.py" with the one in CVS
> following the link
>
> http://cvs.biopython.org/cgi-bin/viewcvs/viewcvs.cgi/biopython/Bio/Blast/NCBIXML.py?cvsroot=biopython

OK, that should be able to parse the latest XML files from the NCBI
except for the slight catch I had forgotten about (see below)

> However, a new problem comes up. When I run the code,
>
>                 result_handle = NCBIWWW.qblast("blastp", "nr", fastaStr,
> entrez_query='%s [ORGN]'%organism)
>                 for record in NCBIXML.parse(result_handle) :
>                     print record
>
> where organism is "Chlamydomonas"
> and fastaStr is
>>NP_013762_Nup116
> MFGVSRGAFPSAT....

Here is a short version using the GI number of this sequence,

from Bio.Blast import NCBIWWW, NCBIXML
handle = NCBIWWW.qblast("blastp", "nr", "6323691", "Chlamydomonas[ORGN]")
for record in NCBIXML.parse(handle) : print record

This seems to work for me.  With hindsight, it would have been safer
just to have got the whole of Biopython from CVS, but I think you also
need to update this file
/usr/lib/python2.5/site-packages/Bio/Blast/Record.py with the latest
from CVS:

http://cvs.biopython.org/cgi-bin/viewcvs/viewcvs.cgi/biopython/Bio/Blast/Record.py?cvsroot=biopython

I'd forgotten about this related change - sorry.

Peter


More information about the BioPython mailing list