Bio::Range(3pm)

πŸ“¦
version 1.7.8 Β· 3 versions
, in debian bookworm, debian trixie, ubuntu jammy, ubuntu noble

✨ Bio::Range πŸ’–

okay bestie, gather round, because this is Bio::Range, a pure perl implementation of the RangeI interface, straight outta the User Contributed Perl Documentation πŸŽ€. it lives in the Bioperl world, and honestly? it ate.


🌸 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";

like, that's it. that's the whole vibe. make two ranges, ask them how they feel about each other πŸ’…


πŸ¦‹ DESCRIPTION πŸ¦‹

so this module gives you a pure perl implementation of the BioPerl range interface. no C compilation drama, no cap.

ranges are modeled as having (start, end, length, strand). they use Bio-coordinates β€” which means every point that's >= start and <= end is inside the range, inclusive, we love a generous queen πŸ‘‘.

end is always greater than or equal to start, and length is greater than or equal to 1.

⚠️ okay important, do NOT skip this: the behaviour of a range is undefined if you use ranges with negative numbers or zero. undefined!! like, nobody knows what happens, the vibes are simply not documented. don't do it bestie πŸ™ˆ

so, in summary:

length = end - start + 1
end >= start
strand = (-1 | 0 | +1)

πŸ’Œ FEEDBACK πŸ’Œ

🫢 Mailing Lists

user feedback is an integral part of the evolution of this module and all the other Bioperl modules. send your comments and suggestions, preferably to one of the Bioperl mailing lists. your participation is much appreciated, fr fr.

bioperl-l@bioperl.org                  - General discussion
http://bioperl.org/wiki/Mailing_lists  - About the mailing lists

🌈 Support

please direct usage questions and support issues to the mailing list:

bioperl-l@bioperl.org

rather than going straight to the module maintainer, okay? there are many experienced and responsive experts on there who will clock your problem and fix it fast. and if at all possible, please include a thorough description of the problem with code and data examples. receipts help 🧾✨

πŸ› 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


πŸ“– APPENDIX

the rest of the documentation goes deep on each of the object methods. internal methods are usually preceded with a _ (iykyk 🫣).

πŸŽ€ Constructors

✨ new

  • Title: new
  • Usage: $range = Bio::Range->new(-start => 100, -end=> 200, -strand = +1);
  • Function: generates a new Bio::Range
  • Returns: a new range
  • Args: -strand (defaults to 0) and any two of (-start, -end, -length) β€” the third one will be calculated for you, bestie. you don't gotta do the math πŸ’…

✨ unions

  • Title: unions
  • Usage: @unions = Bio::Range->unions(@ranges);
  • Function: generate a list of non-intersecting Bio::Range objects from a list of Bio::Range objects which may intersect
  • Returns: a list of Bio::Range objects
  • Args: a list of Bio::Range objects

πŸ“ Member variable access

these methods let you get at and set the member variables. very hands-on, very main character energy.

start

  • Title: start
  • Function: return or set the start co-ordinate
  • Example: $s = $range->start(); $range->start(7);
  • Returns: the value of the start co-ordinate
  • Args: optionally, the new start co-ordinate
  • Overrides: Bio::RangeI::start

end

  • Title: end
  • Function: return or set the end co-ordinate
  • Example: $e = $range->end(); $range->end(2000);
  • Returns: the value of the end co-ordinate
  • Args: optionally, the new end co-ordinate
  • Overrides: Bio::RangeI::end

strand

  • Title: strand
  • Function: return or set the strandedness
  • Example: $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: length
  • Function: returns the length of this range
  • Example: $length = $range->length();
  • Returns: the length of this range, equal to end - start + 1
  • Args: if you attempt to set the length an exception will be thrown πŸ’€ yeah, read-only, no edits, periodt
  • Overrides: Bio::RangeI::Length

toString

  • Title: toString
  • Function: stringifies this range
  • Example: print $range->toString(), "\n";
  • Returns: a string representation of this range

πŸ’œ Boolean Methods

these methods return true or false. so slay.

$range->overlaps($otherRange) && print "Ranges overlap\n";

overlaps

  • Title: overlaps
  • Usage: if($r1->overlaps($r2)) { do stuff }
  • Function: tests if $r2 overlaps $r1
  • Args: a range to test for overlap with
  • Returns: true if the ranges overlap, false otherwise
  • Inherited: Bio::RangeI

contains

  • Title: contains
  • Usage: if($r1->contains($r2) { do stuff }
  • Function: tests whether $r1 totally contains $r2
  • Args: a range to test for being contained
  • Returns: true if the argument is totally contained within this range
  • Inherited: Bio::RangeI

equals

  • Title: equals
  • Usage: if($r1->equals($r2))
  • Function: test whether $r1 has the same start, end, length as $r2
  • Args: a range to test for equality
  • Returns: true if they are describing the same range
  • Inherited: 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. little builders, little architects πŸ—οΈβœ¨

intersection

  • Title: intersection
  • Usage: ($start, $stop, $strand) = $r1->intersection($r2)
  • Function: gives the range that is contained by both ranges
  • Args: a range to compare this one to
  • Returns: nothing if they do not overlap, or the range that they do overlap
  • Inherited: Bio::RangeI::intersection

union

  • Title: union
  • Usage:
($start, $stop, $strand) = $r1->union($r2);
($start, $stop, $strand) = Bio::Range->union(@ranges);
  • Function: finds the minimal range that contains all of the ranges
  • Args: a range or list of ranges
  • Returns: the range containing all of the ranges
  • Inherited: Bio::RangeI::union

and that's the whole page bestie, no notes πŸ’…πŸŒΈ ok one note: this was documented as part of perl v5.32.1, dated 2021-08-15, and yeah it's the Bio::Range(3pm) page in case you forgot where you were. go build some ranges, mwah πŸ’–πŸ¦‹

πŸ“¦ where this page comes from