[BioPython] Help a clueless newbie with BLAST queries?

dubious dubious@2xtreme.net
Sat, 2 Jun 2001 17:14:31 -0700


On Saturday 02 June 2001 16:51, you wrote:
> > 1)The parser (b_parser) craps out with an "unexpected end of stream"
> >
> > 	save_handle = copy.deepcopy(b_results)
> > 	print 'writing from handle copy to output file\n'
> > 	save_file.write(save_handle.read())
>
> You can't actually copy a handle like this.  Since you're already reading
> the contents of the handle, the blast parser has nothing left to read and
> complains.

I wasn't too sure about that section - I literally cut-and-pasted it from
the tutorial because the comment in the tutorial said I'd want to. :-)

I did at one point try commenting that whole "save b_results to a file"
section [for my purposes, I really only need the parsed results at the 
moment anyway], but unfortunately it still gave me the "unexpected end of 
stream" error.

I don't feel TOO bad, though - I noticed the example script supplied
for doing queries to NCBI over WWW ALSO gives me the 
"unexpected end of stream" at the result-parsing step as-is. (Well, not
literally - I did change it so that the input file is sys.stdin rather than a
specific filename, but otherwise the same script)

I also tried the CVS version of biopython, but got the same results
there, too.

> Instead of copying, try to do:
> results = b_results.read()
> save_file.write(results)
> ...
> b_parser.parse_str(results)

I'll give this a try - thanks!
Still learning python - I've played with Python code a total of
about 6 hours, at most, at this point.

> > 2)I can't seem to get the optional settings to work (I'm trying to limit
> > the number of 'hits' returned from the BLAST search).  Setting
> > alignment=10 and descriptions=10 in the NCBIWWW.blast instantiation
> > seems
> > to be ignored, and trying to set an "expect" value causes the script to
> > die with "no PID found".
>
> I'll look into this... may take longer...

I'm beginning to wonder if NCBI changed the layout yet again...

Oh, and a quick question about setting the expect value - when I set it, am
I setting it to a string or a numeric value?  (i.e. should I do expect='0' or 
expect=0 [both gave me the "no PID found" error, but that doesn't change
the fact that I'm not really sure what I'm doing anway...)?  For that matter
what do I specifically set it to if I want lower than what the NCBI results 
show as being "e-175", for example?)

Thanks again for the help!
-- 
"Given the pace of technology, I propose we leave math to the machines
and go play outside." - Calvin