[Bioperl-l] results problem with StandAloneBlast

Chris Fields cjfields at uiuc.edu
Mon Jun 5 16:30:41 UTC 2006


If you want flexibility or added functionality then you can always
contribute a patch, such as adding an option for filehandles, IO::String,
pipes/forks, or whatever you wish.  Or you could suggest such to the module
maintainer, Torsten, and then it's his choice whether he wants to make it a
priority to implement it.  Simply stating this is 'one of things I don't
like about the bioperl tool system' isn't productive here.   It hasn't been
a top priority to implement something along those lines since the module
works for them as is, so if you want these options you'll have to add them,
and add the appropriate tests.

As for the seek issue, the file handle you get by using '$blast_report-fh()'
isn't the raw input file stream but is a tied filehandle of a stream of
ResultI objects:
==================================
Jason's version:
# seek called on the >>internal<< filehandle (from Bio::Root::IO)
# this is the raw data input stream from a file, so should work
seek($searchio->_fh, 0);
==================================
Your version:
# seek called on SearchIO object filehandle
my $blast_report = $factory->blastall($ref_seq_objs);
# this is a tied filehandle for an output stream of objects from SearchIO,
# NOT the raw input stream
my $blast_fh = $blast_report->fh();
while (<$blast_fh>) {
	# a stream of Bio::Search::Result::BlastResult objects 
} 
# can't use seek on a tied filehandle, won't work unless 
# SEEK class method is implemented (and it's not)
seek($blast_fh, 0, 0); 
==================================

There's a good deal in Programming Perl about tied filehandles.  You'll
notice that Bio::SearchIO implements TIEHANDLE, READLINE, DESTROY, and PRINT
methods, but not SEEK since we've never needed it.  You can always add one
if you want but I really don't see the point based on reasons Jason and I
outlined before.

Seems there is not much overall documentation on newFh or $blast_report->fh,
but I believe it's analogous to the SeqIO version which is covered a bit in
the bptutorial file, now on the wiki:

http://www.bioperl.org/wiki/Bptutorial.pl#III.2.1_Transforming_sequence_file
s_.28SeqIO.29

$in  = Bio::SeqIO->newFh(-file => "inputfilename" ,
                          -format => 'fasta');
$out = Bio::SeqIO->newFh(-format => 'embl');
print $out $_ while <$in>;

Wouldn't hurt if someone wants to add a bit more about these to the SearchIO
HOWTO.

Chris

> -----Original Message-----
> From: bioperl-l-bounces at lists.open-bio.org [mailto:bioperl-l-
> bounces at lists.open-bio.org] On Behalf Of Sendu Bala
> Sent: Monday, June 05, 2006 9:13 AM
> To: bioperl-l at lists.open-bio.org
> Subject: Re: [Bioperl-l] results problem with StandAloneBlast
> 
> Jason Stajich wrote:
> > It depends on how you have run StandAloneBlast -- if the stream you are
> > dealing with is not a file, but a datastream as in the STDOUT from
> > BLAST, then the seek won't work (as it wouldn't work for a zcat on
> > gzipped file).  I think the default StandAloneBlast behavior is to
> > operate on a STDOUT stream so seeking won't work no matter what.
> 
> As far as I can see, when you say blastall() on a StandAloneBlast, it
> eventually does:
> 
> if ($self->_READMETHOD =~ /^(Blast|SearchIO)/i )  {
>      $blast_obj = Bio::SearchIO->new(-file=>$outfile,
> 			            -format => 'blast' );
> }
> 
> So seeking should work? Tools like StandAloneBlast creating temp files
> for their results prior to parsing is actually one of things I don't
> like about the bioperl tool system.
> _______________________________________________
> Bioperl-l mailing list
> Bioperl-l at lists.open-bio.org
> http://lists.open-bio.org/mailman/listinfo/bioperl-l




More information about the Bioperl-l mailing list