[BioPython] blastcl3
Brad Chapman
chapmanb at 50mail.com
Tue Dec 30 01:09:29 UTC 2008
Hi Srini;
> 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.
My first suggestion if you want to parse BLAST is to use the
XML output. Based on the NCBI documentation here:
ftp://ftp.ncbi.nlm.nih.gov/blast/documents/netblast.html
it appears as if the parameter you want is '-m 7'. XML output is
much more stable, and details on parsing it in Biopython are here:
http://biopython.org/DIST/docs/tutorial/Tutorial.html#htoc56
The error you report below makes it seem as if the output file is
empty but it is a bit tough to say. If parsing the XML output does
not work, you might want to double check the 'test.out' file to be
sure it looks decent, and if so attach it here so we can help more.
Hope this helps,
Brad
> 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.
>
>
>
>
> _______________________________________________
> BioPython mailing list - BioPython at lists.open-bio.org
> http://lists.open-bio.org/mailman/listinfo/biopython
More information about the Biopython
mailing list