- or download this
sub merge {
my ($pre,$cur,$nex, $mindist) = @_;
...
my $decicion_to_merge = ...
if( $decicion_to_merge == 1 ){ ... merge the intervals ... }
}
- or download this
sub get_sorted_intervals_as_array {
my $atree = shift;
...
);
return @ret
}
- or download this
my @ints = get_sorted_intervals_as_array($tree);
for($i=1;$i<scalar(@ints)-1;$i++){
...
$nex = $ints[$i+1];
merge($pre, $cur, $nex, 1234); # 1234 user-specified distance
}
- or download this
my %Interval = (
'chromosome' => 'Chr1',
...
'type' => 'A',
'id' => 1
);
- or download this
sub can_merge {
my ($i1, $i2) = @_;
...
...
return $newi # return the new interval representing the merge
}