[Biopython] Fwd: BlastParsing gives Value Error: Invalid header?
Sarttu Bourvir
bpkth2012 at gmail.com
Wed Jan 25 16:14:50 UTC 2012
Hi,
I am new to both python and biopython.
What I'm trying to do is to parse a blast result xml file (myblast.xml),
attached here.
The code looks like this:
#!/usr/bin/env python
import sys
import re
import Bio
from Bio.Blast import NCBIWWW
from Bio.Blast import NCBIXML
from Bio.Seq import Seq
from Bio.SeqRecord import SeqRecord
from Bio.Blast import NCBIStandalone
infile = raw_input ("which file:")
result_handle = open(infile,'r')
blast_parser = NCBIStandalone.BlastParser()
blast_iterator = NCBIStandalone.Iterator(result_handle, blast_parser)
blast_record = blast_iterator.next()
for blast_record in blast_iterator:
E_VALUE_THRESH = 0.01
for alignment in blast_records.alignments:
for hsp in alignment.hsps:
if hsp.expect < E_VALUE_THRESH:
print '****Alignment****'
print 'sequence', alignment.title
print 'alignment length', alignment.length
When I try to run it,I get this:
Traceback (most recent call last):
File "Blastparsee.py", line 17, in <module>
blast_record = blast_iterator.next()
File "/usr/lib/pymodules/python2.6/Bio/Blast/NCBIStandalone.py", line
1645, in next
return self._parser.parse(File.StringHandle(data))
File "/usr/lib/pymodules/python2.6/Bio/Blast/NCBIStandalone.py", line
804, in parse
self._scanner.feed(handle, self._consumer)
File "/usr/lib/pymodules/python2.6/Bio/Blast/NCBIStandalone.py", line
100, in feed
self._scan_header(uhandle, consumer)
File "/usr/lib/pymodules/python2.6/Bio/Blast/NCBIStandalone.py", line
225, in _scan_header
raise ValueError("Invalid header?")
ValueError: Invalid header?
I attached the xml file I've been trying to blast. However, I get the same
error if I try using any other xml files from blast.
What's going on?
Thank you!
Cheers,
Sar
P.S. If this type of messages are not allowed on this e-mailing list I
apologize and promise to behave in the future!;)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: myblast.xml
Type: text/xml
Size: 586125 bytes
Desc: not available
URL: <http://lists.open-bio.org/pipermail/biopython/attachments/20120125/b60e9e9b/attachment-0002.xml>
More information about the Biopython
mailing list