[Biopython] NCBI Blast, what an I going wrong

Vincent Davis vincent at vincentdavis.net
Sun Feb 10 20:41:42 UTC 2013


Peter,
I verified the file,
I miss understood the " if you
expect just one query's results" I was reading this as meaning that there
would be more than one hit.
I figured this was a stupid mistake.

Thanks
Vincent



Vincent Davis
720-301-3003


On Sun, Feb 10, 2013 at 1:35 PM, Peter Cock <p.j.a.cock at googlemail.com>wrote:

> On Sun, Feb 10, 2013 at 8:16 PM, Vincent Davis <vincent at vincentdavis.net>
> wrote:
> > I am having trouble with NCBIWWW.qblast  I can get the the example to
> work.
> > Maybe I need help with reading :-)
> >
> > >From the documentation
> > result_handle = NCBIWWW.qblast("blastn", "nt", "8332116")
> > save_file = open("temp.xml", "w")
> > save_file.write(result_handle.read())
> > save_file.close()
> > result_handle.close()
> > result_handle = open("temp.xml")
> > blast_record = NCBIXML.parse(result_handle)
> >
> > The temp.xml looks correct but I can get nothing from blast_record. I
> have
> > tried passing the directly to NCBIXML.parse and still no luck.
> >
> > How would I for example get the first hit "gi|224094601" ?
> >
> > Vincent Davis
>
> Hi Vincent,
>
> Well, first I would check that the BLAST results were downloaded
> ok - can you open the temp.xml file in a text editor (e.g. WordPad
> on Windows)? Can you see the hits you are expecting?
>
> Second, the parse function is for iterating over the file - if you
> expect just one query's results, try:
>
> blast_record = NCBIXML.read(result_handle)
>
> Peter
>



More information about the Biopython mailing list