[BioPython] parsing the blastoutput and printing the alingment

Muthuraman, Manickam manickam.muthuraman at wur.nl
Wed Jun 14 20:22:56 UTC 2006


I am new to python 

I am getting error in parsing blastoutput more over the same problem was been addressed by Michiel De Hoon but i could not clear...here is the error what i am getting.

first i got error when i typed b_record=b_parser.parse(blast_out) as michiel suggested i changed to 
b_record=b_parser.parse(blast_out)
Traceback (most recent call last):
  File "<input>", line 1, in ?
  File "/usr/lib/python2.4/site-packages/Bio/Blast/NCBIXML.py", line 112, in parse
    self._parser.parse(handler)
  File "/usr/lib/python2.4/xml/sax/expatreader.py", line 107, in parse
    xmlreader.IncrementalParser.parse(self, source)
  File "/usr/lib/python2.4/xml/sax/xmlreader.py", line 123, in parse
    self.feed(buffer)
  File "/usr/lib/python2.4/xml/sax/expatreader.py", line 211, in feed
    self._err_handler.fatalError(exc)
  File "/usr/lib/python2.4/xml/sax/handler.py", line 38, in fatalError
    raise exception
SAXParseException: my_blast.out:1:4: not well-formed (invalid token)
blast_out=open('my_blast.out','r')
from Bio.Blast import NCBIStandalone
from Bio.Blast import NCBIXML
b_parser=NCBIXML.BlastParser()
b_iterator1=NCBIStandalone.Iterator(blast_out,b_parser)
for alignment in b_iterator1.alignments:
    for hsp in alignment.hsps:
        print 'seq:',alignment.title
    
Traceback (most recent call last):
  File "<input>", line 1, in ?
AttributeError: Iterator instance has no attribute 'alignments'


how do i print the title.alignment and so on.....from the blast output file
thanks in advance
-- 
Manickam(melaimanik)




More information about the Biopython mailing list