NAME
Bio::Gonzales::Range::Overlap - find overlapping ranges
SYNOPSIS
use 5.010;
use Bio::Gonzales::Range::Overlap;
use Data::Dumper;
my @ranges1 = (
[ 0, 5, 'some', 'information' ],
[ 6, 8, 'some', 'other', 'information' ],
[ 7, 10, 'nonsense', 'information' ],
[ 11, 100, { 'very' => 'complicated', "data" => 'structure' } ],
);
my $ro = Bio::Gonzales::Range::Overlap->new;
#build query db from 1st set of intervals
for my $r (@ranges1) {
$ro->insert(@$r);
}
# in this case (from and to are elements 0 and 1)
# insert could be called with all ranges
#$ro->insert(\@ranges1);
my @ranges2 = ( [ 8, 10 ], [ 1, 3 ], [99,200],);
# query the db with ranges
for my $r (@ranges2) {
say "Range (" . join(",", @$r) . ") overlaps with:";
say Dumper $ro->overlaps_with(@$r);
}
DESCRIPTION
A @range
has the form ($from, $to, @additional elements)
. Lists of ranges have the form ([$from, $to, @add_elems], [$from, $to, @add_elems], ...)
.
OPTIONS
METHODS
- $ro->insert(@range)
- $ro->insert(\@list_of_ranges)
- \@ranges_contained_in_given_range = $ro->contained_in(@range)
- \@ranges_that_overlap_with_given_range = $ro->overlaps_with(@range)
SEE ALSO
- Bio::Gonzales::Matrix::IO for reading in ranges from files
- Bio::Gonzales::Range::GroupedOverlap for grouped ranges such as genes that are grouped by chromosomes.
AUTHOR
jw bargsten, <jwb at cpan dot org>