[Biopython] NCBI Blast, what an I going wrong
Peter Cock
p.j.a.cock at googlemail.com
Sun Feb 10 20:35:20 UTC 2013
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