Bioperl: Alignment Thoughts

Lincoln Stein lstein@cshl.org
Thu, 28 Jan 1999 14:56:04 -0500


Before people point out that you can't pass an object as the index to
a tied array -- yes, I just realized that.  But the object interface
can still be array-like, for example, it can have at(), splice() and
push() methods.  Also, non-sequence objects, like HMMs, can implement
Alignable, allowing them to participate in the API.

Lincoln

Lincoln Stein writes:
 > Ewan's proposal is really very thought provoking.  After reading
 > through it, I thought of an API that might be a useful avenue to
 > pursue.
 > 
 > The Alignment class (or whatever we want to call it) should appear to
 > be array-like to the application programmer.  Conceptually, the
 > alignment uses the indexing system of the fully-gapped consensus
 > sequence, without necessarily generating a consensus.  One nice way to
 > implement Alignment objects would be a tied array.
 > 
 > To create an Alignment, you pass it a series of Alignable objects,
 > which implement an Alignable "interface" (Multiple inheritance
 > anyone?)  Wouldn't it be neat if Alignable implemented array tieing as
 > well?
 > 
 > When you index into an Alignment object, what value do you get?  You
 > get an AlignmentIndex object, which contains all the information
 > needed to recover the state of each Alignable within the Alignment.
 > When you index into an Alignable, you get an Alignment::Info object,
 > or some such.
 > 
 > Conceptually:
 > 
 > 	tie (@sequence1,Alignable::Sequence,...);
 >         tie (@sequence2,Alignable::Sequence,...);
 > 	tie (@alignment,Alignment::CLUSTALW,$sequence1,$sequence2);
 > 	$index  = $alignment[32];
 > 	$info1  = $sequence1[$index];
 > 	$info2  = $sequence2[$index];
 > 	$start  = $info1->start;
 > 	$end    = $info1->end;
 > 	$type   = $info1->type;
 > 
 > All the smarts is now moved into the AlignmentIndex object, which can
 > be treated as an opaque object that the programmer just passes around.
 > 
 > One of the nice things about the Alignment tie interface is that it
 > should be possible to implement push(), pop(), splice() and so forth
 > by passing AlignmentIndex objects to those operators, allowing the
 > alignment to be edited in an (almost) natural way.
 > 
 > Lincoln
 > 
 > -- 
 > ========================================================================
 > Lincoln D. Stein                           Cold Spring Harbor Laboratory
 > lstein@cshl.org			                  Cold Spring Harbor, NY
 > Positions available at my lab: see http://stein.cshl.org/#hire
 > ========================================================================
 > =========== Bioperl Project Mailing List Message Footer =======
 > Project URL: http://bio.perl.org/
 > For info about how to (un)subscribe, where messages are archived, etc:
 > http://www.techfak.uni-bielefeld.de/bcd/Perl/Bio/vsns-bcd-perl.html
 > ====================================================================
-- 
========================================================================
Lincoln D. Stein                           Cold Spring Harbor Laboratory
lstein@cshl.org			                  Cold Spring Harbor, NY
========================================================================
=========== Bioperl Project Mailing List Message Footer =======
Project URL: http://bio.perl.org/
For info about how to (un)subscribe, where messages are archived, etc:
http://www.techfak.uni-bielefeld.de/bcd/Perl/Bio/vsns-bcd-perl.html
====================================================================