NAME
Bio::RangeI - Range interface
SYNOPSIS
#Do not run this module directly
DESCRIPTION
This provides a standard BioPerl range interface that should be implemented by any object that wants to be treated as a range. This serves purely as an abstract base class for implementers and can not be instantiated.
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 greater 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
CONTRIBUTORS
Juha Muilu ([email protected]) Sendu Bala ([email protected]) Malcolm Cook ([email protected]) Stephen Montgomery (sm8 at sanger.ac.uk)
APPENDIX
The rest of the documentation details each of the object methods. Internal methods are usually preceded with a _
Abstract methods
These methods must be implemented in all subclasses.
start
Title : startUsage : $start = $range->start();Function: get/set the start of this rangeReturns : the start of this rangeArgs : optionally allows the start to be setusing $range->start($start)
end
Title : endUsage : $end = $range->end();Function: get/set the end of this rangeReturns : the end of this rangeArgs : optionally allows the end to be setusing $range->end($end)
length
Title : lengthUsage : $length = $range->length();Function: get/set the length of this rangeReturns : the length of this rangeArgs : optionally allows the length to be setusing $range->length($length)
strand
Title : strandUsage : $strand = $range->strand();Function: get/set the strand of this rangeReturns : the strandedness (-1, 0, +1)Args : optionally allows the strand to be setusing $range->strand($strand)
Boolean Methods
These methods return true or false. They throw an error if start and end are not defined.
$range->overlaps($otherRange) && print "Ranges overlap\n";
overlaps
Title : overlapsUsage : if($r1->overlaps($r2)) { do stuff }Function: tests if $r2 overlaps $r1Args : arg #1 = a range to compare this one to (mandatory)arg #2 = optional strand-testing arg ('strong', 'weak', 'ignore')Returns : true if the ranges overlap, false otherwise
contains
Title : containsUsage : if($r1->contains($r2) { do stuff }Function: tests whether $r1 totally contains $r2Args : arg #1 = a range to compare this one to (mandatory)alternatively, integer scalar to testarg #2 = optional strand-testing arg ('strong', 'weak', 'ignore')Returns : true if the argument is totally contained within this range
equals
Title : equalsUsage : if($r1->equals($r2))Function: test whether $r1 has the same start, end, length as $r2Args : arg #1 = a range to compare this one to (mandatory)arg #2 = optional strand-testing arg ('strong', 'weak', 'ignore')Returns : true if they are describing the same range
Geometrical methods
These methods do things to the geometry of ranges, and return Bio::RangeI compliant objects or triplets (start, stop, strand) from which new ranges could be built.
intersection
Title : intersectionUsage : ($start, $end, $strand) = $r1->intersection($r2); OR($start, $end, $strand) = Bio::Range->intersection(\@ranges); ORmy $containing_range = $r1->intersection($r2); ORmy $containing_range = Bio::Range->intersection(\@ranges);Function: gives the range that is contained by all rangesReturns : undef if they do not overlap or if @ranges has only asingle range, else returns the range that they dooverlap. In scalar contex, the return value is an object ofthe same class as the calling one. In array context thereturn value is a three element array.Args : arg #1 = [REQUIRED] a Bio::RangeI to compare this one to,or an array ref of rangesarg #2 = optional strand-testing arg ('strong', 'weak', 'ignore')
union
Title : unionUsage : ($start, $end, $strand) = $r1->union($r2);: ($start, $end, $strand) = Bio::Range->union(@ranges);my $newrange = Bio::Range->union(@ranges);Function: finds the minimal Range that contains all of the RangesArgs : a Range or list of Range objectsReturns : the range containing all of the range. In scalar contex,the return value is an object of the same class as thecalling one. In array context the return value is athree element array.
overlap_extent
Title : overlap_extentUsage : ($a_unique,$common,$b_unique) = $a->overlap_extent($b)Function: Provides actual amount of overlap between two differentrangesExample :Returns : array of values containing the length unique to the callingrange, the length common to both, and the length unique tothe argument rangeArgs : a range
disconnected_ranges
Title : disconnected_rangesUsage : my @disc_ranges = Bio::Range->disconnected_ranges(@ranges);Function: finds the minimal set of ranges such that each input rangeis fully contained by at least one output range, and none ofthe output ranges overlapArgs : a list of rangesReturns : a list of objects of the same type as the input(conforms to RangeI)
offsetStranded
Title : offsetStrandedUsage : $rnge->ofsetStranded($fiveprime_offset, $threeprime_offset)Function : destructively modifies RangeI implementing object tooffset its start and stop coordinates by values $fiveprime_offset and$threeprime_offset (positive values being in the strand direction).Args : two integer offsets: $fiveprime_offset and $threeprime_offsetReturns : $self, offset accordingly.
subtract
Title : subtractUsage : my @subtracted = $r1->subtract($r2)Function: Subtract range r2 from range r1Args : arg #1 = a range to subtract from this one (mandatory)arg #2 = strand option ('strong', 'weak', 'ignore') (optional)Returns : undef if they do not overlap or r2 contains this RangeI,or an arrayref of Range objects (this is an array since someinstances where the subtract range is enclosed within this rangewill result in the creation of two new disjoint ranges)