[BioPython] parsing the blastoutput and printing the alingment

Peter biopython at maubp.freeserve.co.uk
Thu Jun 15 17:53:53 UTC 2006


I know you haven't got the XML parsing working get - but I thought I 
should point something else out...

Muthuraman, Manickam wrote:
> from Bio import Fasta
> file_for_blast=open('/home/manickam/Documents/m_cold.fasta','r')
> f_iterator=Fasta.Iterator(file_for_blast)
> f_record=f_iterator.next()

f_record will contain a single fasta record (the first entry in the file 
m_cold.fasta only).

> from Bio.Blast import NCBIWWW
> result_handle=NCBIWWW.qblast('blastp','nr',f_record, format_type="XML")

This will only run blast on the one record (i.e. the first fasta entry 
in m_cold.fasta), so the resulting XML file will only have blast results 
for this protein.

I'm not sure if you can use the online NCBI blast (i.e. NCBIWWW.qblast) 
to submit multiple queries...

You might want to install stand alone blast on your own machine - as 
this will accept multiple inputs.  You just tell it to read m_cold.fasta 
as its input file, and the resulting XML file will contain the results 
for each sequence in the fasta file.

Note that if you know in advance that the XML blast output is from a 
single input query, you don't need the NCBI iterator.

Peter




More information about the Biopython mailing list