[BioPython] Problems with NCBIXML.py

Peter biopython at maubp.freeserve.co.uk
Fri Oct 26 16:04:40 UTC 2007


Bruno Santos wrote:
> Peter Said:
>> Unless you want to keep the XML file for other analysis, it might be 
>> simpler to parse the output from blast directly with Biopython - 
>> avoiding having the large XML file on disk.
> 
> But if even I don't want to save the results to an XML I still have to do
> the <blast_results = result_handle.read() #Catch the results> step right?
> And my problem is in this step not in writing to the file. 
> Or I can use the result_handle directly, because I was reading the biopython
> documentation but it's not very clear.

The intention is something like this:

result_handle, error_handle = NCBIStandalone.blastall(my_blast_exe,
"blastn",my_blast_db, my_blast_file)

blast_records = NCBIXML.parse(result_handle)
for record in blast_records :
    #do stuff

The bit about saving the results to a file and loading that to give a 
new handle is optional, but very handy if you need to look at the raw 
file by hand.  Perhaps that section of the tutorial could be a little 
clearer ...

Peter




More information about the Biopython mailing list