Mercurial > repos > geert-vandeweyer > coverage_report
comparison CoverageReport.pl @ 24:fd788f9db899 draft
Added (default) option to collapse repetitive bed files
author | geert-vandeweyer |
---|---|
date | Thu, 12 Feb 2015 08:51:37 -0500 |
parents | 95062840f80f |
children | 6cb012c8497a |
comparison
equal
deleted
inserted
replaced
23:a718420c834e | 24:fd788f9db899 |
---|---|
26 # m : (m)inimal Coverage threshold | 26 # m : (m)inimal Coverage threshold |
27 # f : fraction of average as threshold | 27 # f : fraction of average as threshold |
28 # n : sample (n)ame. | 28 # n : sample (n)ame. |
29 | 29 |
30 | 30 |
31 getopts('b:t:o:z:rsSALm:n:f:', \%opts) ; | 31 getopts('b:t:o:z:rsSALm:n:f:T', \%opts) ; |
32 | 32 |
33 # make output directory in (tmp) working dir | 33 # make output directory in (tmp) working dir |
34 our $wd = "/tmp/Coverage.".int(rand(1000)); | 34 our $wd = "/tmp/Coverage.".int(rand(1000)); |
35 while (-d $wd) { | 35 while (-d $wd) { |
36 $wd = "/tmp/Coverage.".int(rand(1000)); | 36 $wd = "/tmp/Coverage.".int(rand(1000)); |
37 | |
37 } | 38 } |
38 system("mkdir $wd"); | 39 system("mkdir $wd"); |
39 | 40 |
40 ## variables | 41 ## variables |
41 our %commandsrun = (); | 42 our %commandsrun = (); |
71 if (exists($opts{'z'})) { | 72 if (exists($opts{'z'})) { |
72 $tarfile = $opts{'z'}; | 73 $tarfile = $opts{'z'}; |
73 } | 74 } |
74 else { | 75 else { |
75 $tarfile = "$wd/Results.tar.gz"; | 76 $tarfile = "$wd/Results.tar.gz"; |
77 } | |
78 | |
79 ## 0. Collapse overlapping target regions. | |
80 if (defined($opts{'T'})) { | |
81 my $targets = $opts{'t'}; | |
82 my $tmptargets = "$wd/collapsedtargets.bed"; | |
83 system("sort -k1,1 -k2,2n $targets > $wd/sorted.targets.bed"); | |
84 system("bedtools merge -s -scores max -nms -i $wd/sorted.targets.bed > $tmptargets"); | |
85 $opts{'t'} = $tmptargets; | |
76 } | 86 } |
77 | 87 |
78 # 1. Global Summary => default | 88 # 1. Global Summary => default |
79 &GlobalSummary($opts{'b'}, $opts{'t'}); | 89 &GlobalSummary($opts{'b'}, $opts{'t'}); |
80 | 90 |