Bio::Gonzales::Range::Overlap - find overlapping ranges
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); }
A @range has the form ($from, $to, @additional elements). Lists of ranges have the form ([$from, $to, @add_elems], [$from, $to, @add_elems], ...).
@range
($from, $to, @additional elements)
([$from, $to, @add_elems], [$from, $to, @add_elems], ...)
jw bargsten, <jwb at cpan dot org>
<jwb at cpan dot org>
To install Bio::Gonzales, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Bio::Gonzales
CPAN shell
perl -MCPAN -e shell install Bio::Gonzales
For more information on module installation, please visit the detailed CPAN module installation guide.