[Bioperl-l] LocationI and CoordinatePolicy

Hilmar Lapp hilmarl@yahoo.com
Mon, 19 Feb 2001 01:54:40 -0800


I added the interface Bio::LocationI::CoordinatePolicyI and
provided 3 implementations: WidestCoordPolicy,
NarrowestCoordPolicy, and AvWidestCoordPolicy, implementing the
widest possible and narrowest possible range, respectively. The
third implements Ewan's suggestion, namely the average for BETWEEN
(10.15) and WITHIN (10^15) positions, and the widest range for all
others.

I also changed Bio::LocationI and all implementations to delegate
start()/end() computation to the currently active
CoordinatePolicyI object. By default all instances use the same
instance of CoordinatePolicyI, so the object penalty memory-wise
should be inexistant. 

For clarity I reiterate the requirements for the various start/end
methods on LocationI:

	o start() and end() return a positive integer number, unless
	a location has never been set (like in the old model)
	o {min,max}_{start,end} may return undef, 0, or a valid number
	o it is the task of the CoordinatePolicyI object to come up
	with a sensible and valid number out of a Location's min/max

Changing the policy by which start/end are calculated is a matter
of a single line of code (see the POD of CoordinatePolicyI).
Implementing your own policy isn't hard; there are only two
methods.

After fixing all the bugs I introduced all tests pass (the
different policies still need their own tests, anyone willing to
contribute that?). Unfortunately, there's again one exception:
LiveSeq.t. Heikki, I tried to find out what goes wrong, but I'm
relatively clueless. E.g. in line 411 of LiveSeq::IO::Loader
$start is undefined, but it is not crystal clear to me where that
comes from. I'm afraid you'll have to have a look at it :o

I hope the new Location model is hereby fully in place and settled
down.

	Hilmar	
-- 
-----------------------------------------------------------------
Hilmar Lapp                              email: hlapp@gmx.net
GNF, San Diego, Ca. 92122                phone: +1 858 812 1757
-----------------------------------------------------------------