NAME
Bio::Range - Pure perl RangeI implementation
SYNOPSIS
$range = Bio::Range->new(-start=>10, -end=>30, -strand=>+1);$r2 = Bio::Range->new(-start=>15, -end=>200, -strand=>+1);print join(', ', $range->union($r2)), "\n";print join(', ', $range->intersection($r2)), "\n";print $range->overlaps($r2), "\n";print $range->contains($r2), "\n";
DESCRIPTION
This provides a pure perl implementation of the BioPerl range interface.
Ranges are modeled as having (start, end, length, strand). They use Bio-coordinates - all points >= start and <= end are within the range. End is always greater-than or equal-to start, and length is greather than or equal to 1. The behaviour of a range is undefined if ranges with negative numbers or zero are used.
So, in summary:
length = end - start + 1end >= startstrand = (-1 | 0 | +1)
FEEDBACK
Mailing Lists
User feedback is an integral part of the evolution of this and other Bioperl modules. Send your comments and suggestions preferably to one of the Bioperl mailing lists. Your participation is much appreciated.
[email protected] - General discussionhttp://bioperl.org/wiki/Mailing_lists - About the mailing lists
Support
Please direct usage questions or support issues to the mailing list:
rather than to the module maintainer directly. Many experienced and reponsive experts will be able look at the problem and quickly address it. Please include a thorough description of the problem with code and data examples if at all possible.
Reporting Bugs
Report bugs to the Bioperl bug tracking system to help us keep track the bugs and their resolution. Bug reports can be submitted via the web:
https://github.com/bioperl/bioperl-live/issues
AUTHOR - Heikki Lehvaslaiho
Email heikki-at-bioperl-dot-org
APPENDIX
The rest of the documentation details each of the object methods. Internal methods are usually preceded with a _
Constructors
new
Title : newUsage : $range = Bio::Range->new(-start => 100, -end=> 200, -strand = +1);Function: generates a new Bio::RangeReturns : a new rangeArgs : -strand (defaults to 0) and any two of (-start, -end, -length),the third will be calculated
unions
Title : unionsUsage : @unions = Bio::Range->unions(@ranges);Function: generate a list of non-intersecting Bio::Range objectsfrom a list of Bio::Range objects which may intersectReturns : a list of Bio::Range objectsArgs : a list of Bio::Range objects
Member variable access
These methods let you get at and set the member variables
start
Title : startFunction : return or set the start co-ordinateExample : $s = $range->start(); $range->start(7);Returns : the value of the start co-ordinateArgs : optionally, the new start co-ordinateOverrides: Bio::RangeI::start
end
Title : endFunction : return or set the end co-ordinateExample : $e = $range->end(); $range->end(2000);Returns : the value of the end co-ordinateArgs : optionally, the new end co-ordinateOverrides: Bio::RangeI::end
strand
Title : strandFunction : return or set the strandednessExample : $st = $range->strand(); $range->strand(-1);Returns : the value of the strandedness (-1, 0 or 1)Args : optionally, the new strand - (-1, 0, 1) or (-, ., +).Overrides: Bio::RangeI::strand
length
Title : lengthFunction : returns the length of this rangeExample : $length = $range->length();Returns : the length of this range, equal to end - start + 1Args : if you attempt to set the length an exception will be thrownOverrides: Bio::RangeI::Length
toString
Title : toStringFunction: stringifies this rangeExample : print $range->toString(), "\n";Returns : a string representation of this range
Boolean Methods
These methods return true or false.
$range->overlaps($otherRange) && print "Ranges overlap\n";
overlaps
Title : overlapsUsage : if($r1->overlaps($r2)) { do stuff }Function : tests if $r2 overlaps $r1Args : a range to test for overlap withReturns : true if the ranges overlap, false otherwiseInherited: Bio::RangeI
contains
Title : containsUsage : if($r1->contains($r2) { do stuff }Function : tests whether $r1 totally contains $r2Args : a range to test for being containedReturns : true if the argument is totally contained within this rangeInherited: Bio::RangeI
equals
Title : equalsUsage : if($r1->equals($r2))Function : test whether $r1 has the same start, end, length as $r2Args : a range to test for equalityReturns : true if they are describing the same rangeInherited: Bio::RangeI
Geometrical methods
These methods do things to the geometry of ranges, and return triplets (start, end, strand) from which new ranges could be built.
intersection
Title : intersectionUsage : ($start, $stop, $strand) = $r1->intersection($r2)Function : gives the range that is contained by both rangesArgs : a range to compare this one toReturns : nothing if they do not overlap, or the range that they do overlapInherited: Bio::RangeI::intersection
union
Title : unionUsage : ($start, $stop, $strand) = $r1->union($r2);: ($start, $stop, $strand) = Bio::Range->union(@ranges);Function : finds the minimal range that contains all of the rangesArgs : a range or list of rangesReturns : the range containing all of the rangesInherited: Bio::RangeI::union