[Bioperl-l] proposed changes to RangeI.pm

Chris Mungall cjm at fruitfly.org
Wed Sep 17 09:59:36 EDT 2003


both intersection() and union() are documented as returning a (start, end,
strand) triple. in actual fact, intersection returns a RangeI compliant
object, and union() returns either a RangeI object or a triple depending
on wantarray()

I have fixed things so that both intersection() and union() return either
RangeI or triple depending on wantarray() - following the principle of
least surprise - and documented this. The test suite passes.

This will break code like this:

 $h = { 'range' => $sf->intersection($sf2) }

since wantarray will be true here; however, this code violates the
previously documented interface anyway.

I have also added a new method disconnected_ranges() to RangeI

I could easily migrate this method somewhere else, but it seems to belong
with other geometrical methods such as intersection and union

here is the pod docs:


    Title   : disconnected_ranges
    Usage   : my @disc_ranges = Bio::Range->disconnected_ranges(@ranges);

    Function: finds the minimal set of ranges such that each input range
              is fully contained by at least one output range, and none of
              the output ranges overlap
    Args    : a list of ranges
    Returns : a list of objects of the same type as the input (conforms to
RangeI)

=cut


is this a good time to check these changes in?



More information about the Bioperl-l mailing list