[BioPython] blastcl3

Srinivas Iyyer srini_iyyer_bio at yahoo.com
Tue Dec 30 00:39:15 UTC 2008


Dear Group, 
I am using netblast blastcl3 to blast my small fasta sequences to human genome. 

blastcl3 -p blastn -i test.fa -d gpipe/9606/all_contig  -o test.out


Above is my command. I want to be able to parse the output which is a text based format. 

I used this:
from Bio.Blast import NCBIWWW
import Bio.Blast.Record
blast_out = open('test.out','r')
parser = NCBIWWW.BlastParser()
blastRecord = parser.parse(blast_out)

I hit error and is reported below. 

Instad I did the following:

from Bio.Blast import NCBIWWW
from Bio.Blast import NCBIXML

fasta_string = open("test.fa").read()
result_handle = NCBIWWW.qblast("blastn", "gpipe/9606/all_contig", fasta_string)
blast_records = NCBIXML.parse(result_handle)
blast_records = list(blast_records)
Treaceback (most recent call last):
  File"<stdin>", line 1, in <module>
StopIteration

Instead:

if I say :
for item in blast_records:
   print i

I get IndexError: list index out of range.

what should I do?
could any one help me please.
thanks
Srini










Error for :blastRecord = parser.parse(blast_out)


>>> blastRecord = parser.parse(blast_out)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python2.5/site-packages/Bio/Blast/NCBIWWW.py", line 51, in parse
    self._scanner.feed(handle, self._consumer)
  File "/usr/local/lib/python2.5/site-packages/Bio/Blast/NCBIWWW.py", line 103, in feed
    has_re=re.compile(r'<b>.?BLAST'))
  File "/usr/local/lib/python2.5/site-packages/Bio/ParserSupport.py", line 334, in read_and_call_until
    line = safe_readline(uhandle)
  File "/usr/local/lib/python2.5/site-packages/Bio/ParserSupport.py", line 410, in safe_readline
    raise ValueError, "Unexpected end of stream."
ValueError: Unexpected end of stream.



      



More information about the Biopython mailing list