[Biopython-dev] [Fwd: Question to code]

Frank Kauff fkauff at duke.edu
Wed Feb 16 17:23:32 EST 2005


Eirik,

Try if the code works with

b_results = NCBIWWW.qblast('blastn', 'nr', f_record).read()

instead of 

> b_results = NCBIWWW.blast('blastn', 'nr', f_record).read()
> 

I think that issue appeared a couple of months ago on the biopython list, essentially saying that
qblast is the blast NCBI wants people to use for blast scripts? After that, qblast method was added
to NCBIWWW, and it's what I'm using in my blast scripts.

Hope this helps,
Frank

On Wed, 2005-02-16 at 14:02 -0800, Iddo Friedberg wrote:
> OK, this is a real bug. NCBIWWW seems to be broken.
> 
> I'm having a looksee, but I'd like someone more versed in this than me 
> to do so.
> 
> Thanks,
> 
> Iddo
> 
> 
> 
> -------- Original Message --------
> Subject: 	Question to code
> Date: 	Wed, 16 Feb 2005 15:19:57 +0100
> From: 	Eirik Sønneland <eirik.sonneland at student.umb.no>
> To: 	idoerg
> 
> 
> 
> Dear Freidberg,
> 
> I've been having problems parsing my output from NCBI using the example 
> code given in Biopython Cookbook. Therefore I tried to follow your code 
> described in "Genome Informatics 14(2003). Still I get an error message 
> connected to the parsing. Could you please give a hint on what is wrong? 
> Is this a bug?? Code and output as follows:
> 
> Code:
> 
> from Bio.Blast import NCBIWWW
> from Bio import Fasta
> 
> file_for_blast = open('Fastaformat.txt', 'r')
> f_iterator = Fasta.Iterator(file_for_blast)
> f_record = f_iterator.next()
> 
> b_results = NCBIWWW.blast('blastn', 'nr', f_record).read()
> 
> b_record = NCBIWWW.BlastParser().parse_str(b_results)
> 
> Output(Have cut out the beginning, only pasted the last part of output):
> 
> 
>  Score = 40.1 bits (20), Expect = 6.3
>  Identities = 20/20 (100%)
>  Strand = Plus / Minus
> 
>                                  
> Query: 29     ctgcagctcgggctcctgcc 48
>               ||||||||||||||||||||
> Sbjct: 150928 ctgcagctcgggctcctgcc 150909
> </PRE>
> 
> 
> <form>
> 
> <PRE>
> Lambda     K      H
>     1.37    0.711     1.31
> 
> Gapped
> Lambda     K      H
>     1.37    0.711     1.31
> 
> Matrix: blastn matrix:1 -3
> Gap Penalties: Existence: 5, Extension: 2
> Number of Sequences: 2894376
> Number of Hits to DB: 6,089,259
> Number of extensions: 328661
> Number of successful extensions: 6259
> Number of sequences better than 10.0: 2
> Number of HSP's better than 10.0 without gapping: 2
> Number of HSP's gapped: 6259
> Number of HSP's successfully gapped: 2
> Number of extra gapped extensions for HSPs above 10.0: 6255
> Length of query: 600
> Length of database: 13,294,103,689
> Length adjustment: 22
> Effective length of query: 578
> Effective length of database: 13,230,427,417
> Effective search space: 7647187047026
> Effective search space used: 7647187047026
> A: 0
> X1: 11 (21.8 bits)
> X2: 15 (30.0 bits)
> X3: 25 (50.0 bits)
> S1: 14 (25.0 bits)
> S2: 20 (40.1 bits)
> 
> 
> </form>
> 
> Traceback (most recent call last):
>   File "C:\Python24\MyWorkspace.py", line 50, in -toplevel-
>     b_record = NCBIWWW.BlastParser().parse_str(b_results)
>   File "C:\Python24\Lib\site-packages\Bio\ParserSupport.py", line 52, in 
> parse_str
>     return self.parse(File.StringHandle(string))
>   File "C:\Python24\Lib\site-packages\Bio\Blast\NCBIWWW.py", line 47, in 
> parse
>     self._scanner.feed(handle, self._consumer)
>   File "C:\Python24\Lib\site-packages\Bio\Blast\NCBIWWW.py", line 99, in 
> feed
>     self._scan_rounds(uhandle, consumer)
>   File "C:\Python24\Lib\site-packages\Bio\Blast\NCBIWWW.py", line 242, 
> in _scan_rounds
>     self._scan_alignments(uhandle, consumer)
>   File "C:\Python24\Lib\site-packages\Bio\Blast\NCBIWWW.py", line 322, 
> in _scan_alignments
>     raise SyntaxError, "Cannot resolve location at line:\n%s" % line1
> SyntaxError: Cannot resolve location at line:
> </form>
> 
>  >>>
> 
> Thanks!
> 
> Regards,
> Eirik
> 
> 
-- 
Frank Kauff
Dept. of Biology
Duke University
Box 90338
Durham, NC 27708
USA

Phone 919-660-7382
Fax 919-660-7293
Web http://www.lutzonilab.net/member/frankkauff.shtml







More information about the Biopython-dev mailing list