Bioperl: Alignment Thoughts

Lincoln Stein
Thu, 28 Jan 1999 14:54:21 -0200

Ewan's proposal is really very thought provoking.  After reading
through it, I thought of an API that might be a useful avenue to

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

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.


	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 D. Stein                           Cold Spring Harbor Laboratory			                  Cold Spring Harbor, NY
Positions available at my lab: see
=========== Bioperl Project Mailing List Message Footer =======
Project URL:
For info about how to (un)subscribe, where messages are archived, etc: