blib/script/gonz_overlap.pl untested

filter: Statementstmt 0.0% 0 / 49 Branchbran 0.0% 0 / 8 Conditioncond 0.0% 0 / 3 MC/DCmcdc n/a Subroutinesub 0.0% 0 / 8 Podpod n/a totaltotal 0.0% 0 / 68 CC 1 SCAR 6.9
CC
1
Cov
0%
BEGIN
2.0
BEGIN
2.0
BEGIN
2.0
CRAP 2.0
1 #!/usr/bin/env perl
2  
3 use warnings;
4 use strict;
5 use 5.010;
6  
7 use Bio::Gonzales::Range::GroupedOverlap;
8 use Data::Dumper;
9  
10 use Bio::Gonzales::Util::Cerial;
11  
12 use Pod::Usage;
13 use Getopt::Long;
14  
15 my %opt;
16 GetOptions( \%opt, 'acols=s', 'bcols=s') or pod2usage(2);
17  
18 my ( $a_f, $b_f ) = @ARGV;
19 pod2usage("$a_f is no file") unless ( -f $a_f );
20 pod2usage("$b_f is no file") unless ( -f $b_f );
21  
22  
23  
24 # g = grp, b=begin, e=end
25 my ($ag_idx, $ab_idx, $ae_idx, $aid_idx) = split /,/, $opt{a_cols};
26 my ($bg_idx, $bb_idx, $be_idx, $bid_idx) = split /,/, $opt{b_cols};
27  
28 my @ranges;
29  
30 my $a_fh = openod($a_f, '<');
31 while(<$a_fh>) {
32 my ($ag, $ab, $ae, $aid) = (split /\t/)[$ag_idx, $ab_idx, $ae_idx, $aid_idx];
33 ($ab, $ae) = ($ae, $ab) if ($ab > $ae);
34 push @ranges, [$ag, $ab, $ae, $aid_idx];
35 }
36 $a_fh->close;
37  
38 my $go = Bio::Gonzales::Range::GroupedOverlap->new(ranges => \@ranges);
39  
40 my $b_fh = openod($b_f, '<');
41 while(<$b_fh>) {
42 my ($bg, $bb, $be) = (split /\t/)[$bg_idx, $bb_idx, $be_idx];
43 ($bb, $be) = ($be, $bb) if ($bb > $be);
44  
45 my $z = $go->overlaps_with( $bg, $bb, $be);
46 die Dumper $z;
47 }
48 $b_fh->close;