[Bioperl-l] SearchIO and legacy parser minute overview

Steve Chervitz sac@bioperl.org
Tue, 14 May 2002 01:32:36 -0700 (PDT)


--- Jason Stajich <jason@cgt.mc.duke.edu> wrote:
>
> [snip]
>
> On Mon, 13 May 2002, Andy Nunberg wrote:
> 
> > Jason, what would be the simplest way for me to determine what methods
> > are available to a Bio::SearchIO Blast object for hits and hsps? My
> > biggest confusion is inheritance and I need to read more on OOP since
> > I have done none in the past.
> >
> > Is your module comparable to Psiblast parsed object in terms of
> > gaps,strands, frames etc??
> >
> Yep they both should implement the same interface so all the functionality
> you are searching for is present in both classes.  I personally think mine
> is pretty easy to use and and the Generic(Hit/HSP/Result) objects that it
> creates are easy to read through while SteveC's delayed parsing is a bit
> scary to walk through.   They should be essentially the same but Steve's
> objects deviate from the the interface a bit so they're not completely
> interchangeable.

I would say "extend" instead of "deviate from" since my modules conform to the
interface and provide additional functionality. So my objects should be able to
substitute for Jason's, but not vice versa if you call methods not defined in
the interfaces (ResultI, HitI, HSPI).

A goal of mine is to modify my modules so they inherit from Jason's generic
objects, so we can re-use more code. This will also entail removing the lazy
parsing stuff, which seems more trouble that it's worth.

> I'm not that familiar with what is in the tables in the old Tools::Blast
> but we built some simplified objects to write out basic table information
> in the Bio::SearchIO::Writer classes.  For example if you wanted to output
> a simple table from the HSPs just use the following.  Unfortunately Steve

Here's how the new writer modules relate to the old table() functions in
Bio::Tools::Blast:

* The Bio::Tools::Blast::table() functionality is now provided by
Bio::SearchIO::Writer::HSPTableWriter.

* The Bio::Tools::Blast::table_tiled() functionality is now provided by
Bio::SearchIO::Writer::HitTableWriter.

The docs for these writer modules specify the content of the columns in the
tables they generate. View the docs at 
http://doc.bioperl.org/releases/bioperl-1.0/ or by executing perldoc on the
module file. 

You can pick and choose which columns you want (as in Jason's example below).
If you don't provide a -columns parameter when creating the writer object,
you'll get all columns.

> and I did not connect very well on this implementation so this code uses
> stuff that is specific to his BlastHit/BlastHSP objects created with the
> 'psiblast' format using methods that are not in the interface.  So you
> can't use my implementation at this point.  I'll try and get this
> corrected later on.

Yes, this was an oversight. What we need are some generic writers that work
with what's available in the HitI and HSPI interfaces. It might be better to
just modify the writers work with both generic and non-generic objects. 

Steve

> 
>     use Bio::SearchIO;
>     use Bio::SearchIO::Writer::HSPTableWriter;
> 
>     my $in = Bio::SearchIO->new(-file => $file, -format => 'psiblast');
> 
>     my $writer = Bio::SearchIO::Writer::HSPTableWriter->new(
>                                   -columns => [qw(
>                                                   query_name
>                                                   query_length
>                                                   hit_name
>                                                   hit_length
>                                                   rank
>                                                   frac_identical_query
>                                                   expect
>                                                   )]  );
> 
>     my $out = Bio::SearchIO->new( -writer => $writer,
> 				  -file   => ">searchio.out" );
>     my $first = 1;
>     while ( my $result = $in->next_result() ) {
>         $out->write_result($result, $first);
> 	$first = 0;
>     }
> 
> 
> -jason
> 
>  > Andy
> > *******************************************************************
> > Andy Nunberg, Ph.D
> > Computational Biologist
> > Orion Genomics, LLC
> > (314) 615-6989
> > http://www.oriongenomics.com
> >
> 
> -- 
> Jason Stajich
> Duke University
> jason at cgt.mc.duke.edu
> 
> 
> _______________________________________________
> Bioperl-l mailing list
> Bioperl-l@bioperl.org
> http://bioperl.org/mailman/listinfo/bioperl-l


=====
Steve Chervitz
sac@bioperl.org

__________________________________________________
Do You Yahoo!?
LAUNCH - Your Yahoo! Music Experience
http://launch.yahoo.com