Bio::RangeI(3pm)
π Bio::RangeI β the Range interface β¨
Okay bestie, pull up a chair, because this is Bio::RangeI(3pm), and yes it ships in User Contributed Perl Documentation. It's giving abstract-interface energy, and we're gonna read it together π«Ά
πΈ SYNOPSIS πΈ
#Do not run this module directly
Like. Do NOT run it directly. It's not that kind of module, babe π
π¦ DESCRIPTION π¦
So here's the tea β: this thing provides a standard BioPerl range interface β and literally any object that wants to be treated like a range should implement it. That's the whole assignment.
It's purely an abstract base class for implementers, which means it cannot be instantiated. No Bio::RangeI->new for you, bestie, sorry, the vibes are abstract-only π
Ranges are modeled as having (start, end, length, strand). They use Bio-coordinates β meaning every point that's >= start and <= end lives inside the range. end is always greater-than or equal-to start, and length is always greater than or equal to 1.
β οΈ Big important warning energy: the behaviour of a range is undefined if ranges with negative numbers or zero are used. Undefined. Not "kinda weird", not "a little off" β undefined fr fr π
So, in summary:
length = end - start + 1
end >= start
strand = (-1 | 0 | +1)
That's the entire personality. Iconic. π
π FEEDBACK π
π¬ Mailing Lists
User feedback is, like, an integral part of the evolution of this and other Bioperl modules. So send your comments and suggestions β preferably to one of the Bioperl mailing lists. Your participation is much appreciated, no cap π₯Ή
bioperl-l@bioperl.org - General discussion
http://bioperl.org/wiki/Mailing_lists - About the mailing lists
π« Support
Please direct usage questions or support issues to the mailing list:
bioperl-l@bioperl.org
...rather than to the module maintainer directly, okay? The reason is lowkey wholesome: there are many experienced and responsive experts on that list who will be able to look at your problem and quickly address it. Please include a thorough description of the problem with code and data examples if at all possible β the more context, the faster the slay β¨
π Reporting Bugs
Report bugs to the Bioperl bug tracking system so we can keep track of the bugs and their resolutions. 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 (
muilu@ebi.ac.uk) - Sendu Bala (
bix@sendu.me.uk) - Malcolm Cook (
mec@stowers-institute.org) - Stephen Montgomery (
sm8 at sanger.ac.uk)
π APPENDIX π
The rest of this documentation goes into detail on each of the object methods. Heads up: internal methods are usually preceded with a _ (iykyk) π
π Abstract methods π
These methods must be implemented in all subclasses. No skipping, bestie, this is the whole deal.
start
- Usage:
$start = $range->start(); - What it does: gets or sets the start of this range.
- Returns: the start of this range.
- Args: you can optionally set the start using
$range->start($start).
end
- Usage:
$end = $range->end(); - What it does: gets or sets the end of this range.
- Returns: the end of this range.
- Args: you can optionally set the end using
$range->end($end).
length
- Usage:
$length = $range->length(); - What it does: gets or sets the length of this range.
- Returns: the length of this range.
- Args: you can optionally set the length using
$range->length($length).
strand
- Usage:
$strand = $range->strand(); - What it does: gets or sets the strand of this range.
- Returns: the strandedness (
-1,0,+1). - Args: you can optionally set the strand using
$range->strand($strand).
β Boolean Methods β
These methods return true or false, and they throw an error if start and end are not defined. So define them, okay? π€
$range->overlaps($otherRange) && print "Ranges overlap\n";
overlaps
- Usage:
if($r1->overlaps($r2)) { do stuff } - What it does: tests if
$r2overlaps$r1. - Args:
- 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
- Usage:
if($r1->contains($r2) { do stuff } - What it does: tests whether
$r1totally contains$r2. - Args:
- arg #1 = a range to compare this one to (mandatory) β or, alternatively, an integer scalar to test
- arg #2 = optional strand-testing arg (
'strong','weak','ignore')
- Returns: true if the argument is totally contained within this range.
equals
- Usage:
if($r1->equals($r2)) - What it does: tests whether
$r1has the same start, end and length as$r2. - Args:
- 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 they return Bio::RangeI compliant objects or triplets (start, stop, strand) from which new ranges could be built. Math but make it cute π
intersection
Title : intersection
Usage : ($start, $end, $strand) = $r1->intersection($r2); OR
($start, $end, $strand) = Bio::Range->intersection(\@ranges); OR
my $containing_range = $r1->intersection($r2); OR
my $containing_range = Bio::Range->intersection(\@ranges);
Function: gives the range that is contained by all ranges
Returns : undef if they do not overlap or if @ranges has only a
single range, else returns the range that they do
overlap. In scalar contex, the return value is an object of
the same class as the calling one. In array context the
return value is a three element array.
Args : arg #1 = [REQUIRED] a Bio::RangeI to compare this one to,
or an array ref of ranges
arg #2 = optional strand-testing arg ('strong', 'weak', 'ignore')
union
Title : union
Usage : ($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 Ranges
Args : a Range or list of Range objects
Returns : the range containing all of the range. In scalar contex,
the return value is an object of the same class as the
calling one. In array context the return value is a
three element array.
overlap_extent
Title : overlap_extent
Usage : ($a_unique,$common,$b_unique) = $a->overlap_extent($b)
Function: Provides actual amount of overlap between two different
ranges
Example :
Returns : array of values containing the length unique to the calling
range, the length common to both, and the length unique to
the argument range
Args : a range
(Yes, the Example line is empty in the original. She contains multitudes, and also nothing. π)
disconnected_ranges
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)
offsetStranded
Title : offsetStranded
Usage : $rnge->ofsetStranded($fiveprime_offset, $threeprime_offset)
Function : destructively modifies RangeI implementing object to
offset 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_offset
Returns : $self, offset accordingly.
π Not me pointing out that the Usage line literally spells itofsetStrandedwhile the Title saysoffsetStrandedβ I'm keeping it exactly as written, bestie, because that's the whole point.
subtract
Title : subtract
Usage : my @subtracted = $r1->subtract($r2)
Function: Subtract range r2 from range r1
Args : 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 some
instances where the subtract range is enclosed within this range
will result in the creation of two new disjoint ranges)
And that's the whole page, babes π This was Bio::RangeI(3pm), generated by perl v5.32.1 and dated 2021-08-15. Periodt. Go implement your abstract methods, drink some water, and remember: end >= start or it's over for you πβ¨π¦
π¦ where this page comes from
- debian bookworm: libbio-perl-perl 1.7.8-1 Β· Perl
- debian trixie: libbio-perl-perl 1.7.8-1 Β· Perl
- ubuntu jammy: libbio-perl-perl 1.7.8-1 Β· Perl
- ubuntu noble: libbio-perl-perl 1.7.8-1 Β· Perl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms