Mercurial > repos > jvolkening > b2b_fq_deinterleave
annotate summarize_run.pl @ 0:b42eb9ff6a8c draft
planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/b2b_utils commit 9260aa02a5f703bce63d2db5b69003df9be371ac
author | jvolkening |
---|---|
date | Fri, 08 Mar 2024 00:47:53 +0000 |
parents | |
children |
rev | line source |
---|---|
0
b42eb9ff6a8c
planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/b2b_utils commit 9260aa02a5f703bce63d2db5b69003df9be371ac
jvolkening
parents:
diff
changeset
|
1 #!/usr/bin/perl |
b42eb9ff6a8c
planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/b2b_utils commit 9260aa02a5f703bce63d2db5b69003df9be371ac
jvolkening
parents:
diff
changeset
|
2 |
b42eb9ff6a8c
planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/b2b_utils commit 9260aa02a5f703bce63d2db5b69003df9be371ac
jvolkening
parents:
diff
changeset
|
3 use strict; |
b42eb9ff6a8c
planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/b2b_utils commit 9260aa02a5f703bce63d2db5b69003df9be371ac
jvolkening
parents:
diff
changeset
|
4 use warnings; |
b42eb9ff6a8c
planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/b2b_utils commit 9260aa02a5f703bce63d2db5b69003df9be371ac
jvolkening
parents:
diff
changeset
|
5 |
b42eb9ff6a8c
planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/b2b_utils commit 9260aa02a5f703bce63d2db5b69003df9be371ac
jvolkening
parents:
diff
changeset
|
6 use Getopt::Long; |
b42eb9ff6a8c
planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/b2b_utils commit 9260aa02a5f703bce63d2db5b69003df9be371ac
jvolkening
parents:
diff
changeset
|
7 use BioX::Seq::Stream; |
b42eb9ff6a8c
planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/b2b_utils commit 9260aa02a5f703bce63d2db5b69003df9be371ac
jvolkening
parents:
diff
changeset
|
8 use List::Util qw/sum/; |
b42eb9ff6a8c
planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/b2b_utils commit 9260aa02a5f703bce63d2db5b69003df9be371ac
jvolkening
parents:
diff
changeset
|
9 |
b42eb9ff6a8c
planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/b2b_utils commit 9260aa02a5f703bce63d2db5b69003df9be371ac
jvolkening
parents:
diff
changeset
|
10 my $fn_raw1; |
b42eb9ff6a8c
planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/b2b_utils commit 9260aa02a5f703bce63d2db5b69003df9be371ac
jvolkening
parents:
diff
changeset
|
11 my $fn_raw2; |
b42eb9ff6a8c
planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/b2b_utils commit 9260aa02a5f703bce63d2db5b69003df9be371ac
jvolkening
parents:
diff
changeset
|
12 my $fn_filt1; |
b42eb9ff6a8c
planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/b2b_utils commit 9260aa02a5f703bce63d2db5b69003df9be371ac
jvolkening
parents:
diff
changeset
|
13 my $fn_filt2; |
b42eb9ff6a8c
planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/b2b_utils commit 9260aa02a5f703bce63d2db5b69003df9be371ac
jvolkening
parents:
diff
changeset
|
14 my $fn_bedgraph; |
b42eb9ff6a8c
planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/b2b_utils commit 9260aa02a5f703bce63d2db5b69003df9be371ac
jvolkening
parents:
diff
changeset
|
15 my $fn_qc1; |
b42eb9ff6a8c
planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/b2b_utils commit 9260aa02a5f703bce63d2db5b69003df9be371ac
jvolkening
parents:
diff
changeset
|
16 my $fn_qc2; |
b42eb9ff6a8c
planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/b2b_utils commit 9260aa02a5f703bce63d2db5b69003df9be371ac
jvolkening
parents:
diff
changeset
|
17 my $fn_consensus; |
b42eb9ff6a8c
planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/b2b_utils commit 9260aa02a5f703bce63d2db5b69003df9be371ac
jvolkening
parents:
diff
changeset
|
18 my $fn_out; |
b42eb9ff6a8c
planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/b2b_utils commit 9260aa02a5f703bce63d2db5b69003df9be371ac
jvolkening
parents:
diff
changeset
|
19 my $n_threads = 1; |
b42eb9ff6a8c
planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/b2b_utils commit 9260aa02a5f703bce63d2db5b69003df9be371ac
jvolkening
parents:
diff
changeset
|
20 |
b42eb9ff6a8c
planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/b2b_utils commit 9260aa02a5f703bce63d2db5b69003df9be371ac
jvolkening
parents:
diff
changeset
|
21 GetOptions( |
b42eb9ff6a8c
planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/b2b_utils commit 9260aa02a5f703bce63d2db5b69003df9be371ac
jvolkening
parents:
diff
changeset
|
22 'raw_1=s' => \$fn_raw1, |
b42eb9ff6a8c
planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/b2b_utils commit 9260aa02a5f703bce63d2db5b69003df9be371ac
jvolkening
parents:
diff
changeset
|
23 'raw_2=s' => \$fn_raw2, |
b42eb9ff6a8c
planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/b2b_utils commit 9260aa02a5f703bce63d2db5b69003df9be371ac
jvolkening
parents:
diff
changeset
|
24 'filt_1=s' => \$fn_filt1, |
b42eb9ff6a8c
planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/b2b_utils commit 9260aa02a5f703bce63d2db5b69003df9be371ac
jvolkening
parents:
diff
changeset
|
25 'filt_2=s' => \$fn_filt2, |
b42eb9ff6a8c
planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/b2b_utils commit 9260aa02a5f703bce63d2db5b69003df9be371ac
jvolkening
parents:
diff
changeset
|
26 'bedgraph=s' => \$fn_bedgraph, |
b42eb9ff6a8c
planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/b2b_utils commit 9260aa02a5f703bce63d2db5b69003df9be371ac
jvolkening
parents:
diff
changeset
|
27 'fastqc_1=s' => \$fn_qc1, |
b42eb9ff6a8c
planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/b2b_utils commit 9260aa02a5f703bce63d2db5b69003df9be371ac
jvolkening
parents:
diff
changeset
|
28 'fastqc_2=s' => \$fn_qc2, |
b42eb9ff6a8c
planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/b2b_utils commit 9260aa02a5f703bce63d2db5b69003df9be371ac
jvolkening
parents:
diff
changeset
|
29 'consensus=s' => \$fn_consensus, |
b42eb9ff6a8c
planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/b2b_utils commit 9260aa02a5f703bce63d2db5b69003df9be371ac
jvolkening
parents:
diff
changeset
|
30 'out=s' => \$fn_out, |
b42eb9ff6a8c
planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/b2b_utils commit 9260aa02a5f703bce63d2db5b69003df9be371ac
jvolkening
parents:
diff
changeset
|
31 'threads=i' => \$n_threads, |
b42eb9ff6a8c
planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/b2b_utils commit 9260aa02a5f703bce63d2db5b69003df9be371ac
jvolkening
parents:
diff
changeset
|
32 ); |
b42eb9ff6a8c
planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/b2b_utils commit 9260aa02a5f703bce63d2db5b69003df9be371ac
jvolkening
parents:
diff
changeset
|
33 |
b42eb9ff6a8c
planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/b2b_utils commit 9260aa02a5f703bce63d2db5b69003df9be371ac
jvolkening
parents:
diff
changeset
|
34 my @counts; |
b42eb9ff6a8c
planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/b2b_utils commit 9260aa02a5f703bce63d2db5b69003df9be371ac
jvolkening
parents:
diff
changeset
|
35 for ($fn_raw1, $fn_raw2, $fn_filt1, $fn_filt2) { |
b42eb9ff6a8c
planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/b2b_utils commit 9260aa02a5f703bce63d2db5b69003df9be371ac
jvolkening
parents:
diff
changeset
|
36 open my $in, '-|', 'wc', '-l', $_; |
b42eb9ff6a8c
planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/b2b_utils commit 9260aa02a5f703bce63d2db5b69003df9be371ac
jvolkening
parents:
diff
changeset
|
37 my $ret = <$in>; |
b42eb9ff6a8c
planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/b2b_utils commit 9260aa02a5f703bce63d2db5b69003df9be371ac
jvolkening
parents:
diff
changeset
|
38 close $in; |
b42eb9ff6a8c
planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/b2b_utils commit 9260aa02a5f703bce63d2db5b69003df9be371ac
jvolkening
parents:
diff
changeset
|
39 chomp $ret; |
b42eb9ff6a8c
planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/b2b_utils commit 9260aa02a5f703bce63d2db5b69003df9be371ac
jvolkening
parents:
diff
changeset
|
40 my ($count, $fn) = split ' ', $ret; |
b42eb9ff6a8c
planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/b2b_utils commit 9260aa02a5f703bce63d2db5b69003df9be371ac
jvolkening
parents:
diff
changeset
|
41 die "line length not multiple of four for $_\n" |
b42eb9ff6a8c
planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/b2b_utils commit 9260aa02a5f703bce63d2db5b69003df9be371ac
jvolkening
parents:
diff
changeset
|
42 if ($count % 4); |
b42eb9ff6a8c
planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/b2b_utils commit 9260aa02a5f703bce63d2db5b69003df9be371ac
jvolkening
parents:
diff
changeset
|
43 push @counts, $count/4; |
b42eb9ff6a8c
planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/b2b_utils commit 9260aa02a5f703bce63d2db5b69003df9be371ac
jvolkening
parents:
diff
changeset
|
44 } |
b42eb9ff6a8c
planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/b2b_utils commit 9260aa02a5f703bce63d2db5b69003df9be371ac
jvolkening
parents:
diff
changeset
|
45 |
b42eb9ff6a8c
planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/b2b_utils commit 9260aa02a5f703bce63d2db5b69003df9be371ac
jvolkening
parents:
diff
changeset
|
46 |
b42eb9ff6a8c
planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/b2b_utils commit 9260aa02a5f703bce63d2db5b69003df9be371ac
jvolkening
parents:
diff
changeset
|
47 die "raw pair count mismatch\n" if ($counts[0] != $counts[1]); |
b42eb9ff6a8c
planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/b2b_utils commit 9260aa02a5f703bce63d2db5b69003df9be371ac
jvolkening
parents:
diff
changeset
|
48 die "filtered pair count mismatch\n" if ($counts[2] != $counts[3]); |
b42eb9ff6a8c
planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/b2b_utils commit 9260aa02a5f703bce63d2db5b69003df9be371ac
jvolkening
parents:
diff
changeset
|
49 |
b42eb9ff6a8c
planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/b2b_utils commit 9260aa02a5f703bce63d2db5b69003df9be371ac
jvolkening
parents:
diff
changeset
|
50 # read fragment stats from STDIN |
b42eb9ff6a8c
planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/b2b_utils commit 9260aa02a5f703bce63d2db5b69003df9be371ac
jvolkening
parents:
diff
changeset
|
51 my @lens; |
b42eb9ff6a8c
planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/b2b_utils commit 9260aa02a5f703bce63d2db5b69003df9be371ac
jvolkening
parents:
diff
changeset
|
52 while (<STDIN>) { |
b42eb9ff6a8c
planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/b2b_utils commit 9260aa02a5f703bce63d2db5b69003df9be371ac
jvolkening
parents:
diff
changeset
|
53 chomp $_; |
b42eb9ff6a8c
planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/b2b_utils commit 9260aa02a5f703bce63d2db5b69003df9be371ac
jvolkening
parents:
diff
changeset
|
54 push @lens, $_; |
b42eb9ff6a8c
planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/b2b_utils commit 9260aa02a5f703bce63d2db5b69003df9be371ac
jvolkening
parents:
diff
changeset
|
55 } |
b42eb9ff6a8c
planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/b2b_utils commit 9260aa02a5f703bce63d2db5b69003df9be371ac
jvolkening
parents:
diff
changeset
|
56 |
b42eb9ff6a8c
planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/b2b_utils commit 9260aa02a5f703bce63d2db5b69003df9be371ac
jvolkening
parents:
diff
changeset
|
57 my $frag_mean = int( sum(@lens)/scalar(@lens)+0.5 ); |
b42eb9ff6a8c
planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/b2b_utils commit 9260aa02a5f703bce63d2db5b69003df9be371ac
jvolkening
parents:
diff
changeset
|
58 my $frag_sd = int( sqrt( sum( map {($_ - $frag_mean)**2} @lens)/(scalar(@lens)-1) )+0.5 ); |
b42eb9ff6a8c
planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/b2b_utils commit 9260aa02a5f703bce63d2db5b69003df9be371ac
jvolkening
parents:
diff
changeset
|
59 |
b42eb9ff6a8c
planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/b2b_utils commit 9260aa02a5f703bce63d2db5b69003df9be371ac
jvolkening
parents:
diff
changeset
|
60 # extract FastQC data |
b42eb9ff6a8c
planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/b2b_utils commit 9260aa02a5f703bce63d2db5b69003df9be371ac
jvolkening
parents:
diff
changeset
|
61 #warn "extracting FastQC stats...\n"; |
b42eb9ff6a8c
planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/b2b_utils commit 9260aa02a5f703bce63d2db5b69003df9be371ac
jvolkening
parents:
diff
changeset
|
62 |
b42eb9ff6a8c
planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/b2b_utils commit 9260aa02a5f703bce63d2db5b69003df9be371ac
jvolkening
parents:
diff
changeset
|
63 my @five_nums; |
b42eb9ff6a8c
planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/b2b_utils commit 9260aa02a5f703bce63d2db5b69003df9be371ac
jvolkening
parents:
diff
changeset
|
64 for my $fn ($fn_qc1, $fn_qc2) { |
b42eb9ff6a8c
planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/b2b_utils commit 9260aa02a5f703bce63d2db5b69003df9be371ac
jvolkening
parents:
diff
changeset
|
65 open my $in, '<', $fn; |
b42eb9ff6a8c
planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/b2b_utils commit 9260aa02a5f703bce63d2db5b69003df9be371ac
jvolkening
parents:
diff
changeset
|
66 |
b42eb9ff6a8c
planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/b2b_utils commit 9260aa02a5f703bce63d2db5b69003df9be371ac
jvolkening
parents:
diff
changeset
|
67 my $in_data = 0; |
b42eb9ff6a8c
planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/b2b_utils commit 9260aa02a5f703bce63d2db5b69003df9be371ac
jvolkening
parents:
diff
changeset
|
68 my @data; |
b42eb9ff6a8c
planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/b2b_utils commit 9260aa02a5f703bce63d2db5b69003df9be371ac
jvolkening
parents:
diff
changeset
|
69 LINE: |
b42eb9ff6a8c
planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/b2b_utils commit 9260aa02a5f703bce63d2db5b69003df9be371ac
jvolkening
parents:
diff
changeset
|
70 while (my $line = <$in>) { |
b42eb9ff6a8c
planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/b2b_utils commit 9260aa02a5f703bce63d2db5b69003df9be371ac
jvolkening
parents:
diff
changeset
|
71 chomp $line; |
b42eb9ff6a8c
planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/b2b_utils commit 9260aa02a5f703bce63d2db5b69003df9be371ac
jvolkening
parents:
diff
changeset
|
72 if ($in_data) { |
b42eb9ff6a8c
planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/b2b_utils commit 9260aa02a5f703bce63d2db5b69003df9be371ac
jvolkening
parents:
diff
changeset
|
73 if ($line =~ /^>>END_MODULE/) { |
b42eb9ff6a8c
planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/b2b_utils commit 9260aa02a5f703bce63d2db5b69003df9be371ac
jvolkening
parents:
diff
changeset
|
74 last LINE; |
b42eb9ff6a8c
planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/b2b_utils commit 9260aa02a5f703bce63d2db5b69003df9be371ac
jvolkening
parents:
diff
changeset
|
75 } |
b42eb9ff6a8c
planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/b2b_utils commit 9260aa02a5f703bce63d2db5b69003df9be371ac
jvolkening
parents:
diff
changeset
|
76 next if ($line =~ /^#/); |
b42eb9ff6a8c
planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/b2b_utils commit 9260aa02a5f703bce63d2db5b69003df9be371ac
jvolkening
parents:
diff
changeset
|
77 my ($score, $count) = split ' ', $line; |
b42eb9ff6a8c
planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/b2b_utils commit 9260aa02a5f703bce63d2db5b69003df9be371ac
jvolkening
parents:
diff
changeset
|
78 push @data, [$score,$count]; |
b42eb9ff6a8c
planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/b2b_utils commit 9260aa02a5f703bce63d2db5b69003df9be371ac
jvolkening
parents:
diff
changeset
|
79 } |
b42eb9ff6a8c
planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/b2b_utils commit 9260aa02a5f703bce63d2db5b69003df9be371ac
jvolkening
parents:
diff
changeset
|
80 elsif ($line =~ /^>>Per sequence quality scores/) { |
b42eb9ff6a8c
planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/b2b_utils commit 9260aa02a5f703bce63d2db5b69003df9be371ac
jvolkening
parents:
diff
changeset
|
81 $in_data = 1; |
b42eb9ff6a8c
planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/b2b_utils commit 9260aa02a5f703bce63d2db5b69003df9be371ac
jvolkening
parents:
diff
changeset
|
82 } |
b42eb9ff6a8c
planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/b2b_utils commit 9260aa02a5f703bce63d2db5b69003df9be371ac
jvolkening
parents:
diff
changeset
|
83 } |
b42eb9ff6a8c
planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/b2b_utils commit 9260aa02a5f703bce63d2db5b69003df9be371ac
jvolkening
parents:
diff
changeset
|
84 |
b42eb9ff6a8c
planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/b2b_utils commit 9260aa02a5f703bce63d2db5b69003df9be371ac
jvolkening
parents:
diff
changeset
|
85 push @five_nums, data_to_5( @data ); |
b42eb9ff6a8c
planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/b2b_utils commit 9260aa02a5f703bce63d2db5b69003df9be371ac
jvolkening
parents:
diff
changeset
|
86 } |
b42eb9ff6a8c
planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/b2b_utils commit 9260aa02a5f703bce63d2db5b69003df9be371ac
jvolkening
parents:
diff
changeset
|
87 |
b42eb9ff6a8c
planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/b2b_utils commit 9260aa02a5f703bce63d2db5b69003df9be371ac
jvolkening
parents:
diff
changeset
|
88 # Count contigs |
b42eb9ff6a8c
planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/b2b_utils commit 9260aa02a5f703bce63d2db5b69003df9be371ac
jvolkening
parents:
diff
changeset
|
89 |
b42eb9ff6a8c
planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/b2b_utils commit 9260aa02a5f703bce63d2db5b69003df9be371ac
jvolkening
parents:
diff
changeset
|
90 my $p = BioX::Seq::Stream->new($fn_consensus); |
b42eb9ff6a8c
planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/b2b_utils commit 9260aa02a5f703bce63d2db5b69003df9be371ac
jvolkening
parents:
diff
changeset
|
91 my %n_contigs; |
b42eb9ff6a8c
planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/b2b_utils commit 9260aa02a5f703bce63d2db5b69003df9be371ac
jvolkening
parents:
diff
changeset
|
92 my @names; |
b42eb9ff6a8c
planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/b2b_utils commit 9260aa02a5f703bce63d2db5b69003df9be371ac
jvolkening
parents:
diff
changeset
|
93 while (my $seq = $p->next_seq) { |
b42eb9ff6a8c
planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/b2b_utils commit 9260aa02a5f703bce63d2db5b69003df9be371ac
jvolkening
parents:
diff
changeset
|
94 |
b42eb9ff6a8c
planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/b2b_utils commit 9260aa02a5f703bce63d2db5b69003df9be371ac
jvolkening
parents:
diff
changeset
|
95 my $id = $seq->id; |
b42eb9ff6a8c
planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/b2b_utils commit 9260aa02a5f703bce63d2db5b69003df9be371ac
jvolkening
parents:
diff
changeset
|
96 push @names, $id; |
b42eb9ff6a8c
planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/b2b_utils commit 9260aa02a5f703bce63d2db5b69003df9be371ac
jvolkening
parents:
diff
changeset
|
97 while ($seq =~ /[^Nn]+/g) { |
b42eb9ff6a8c
planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/b2b_utils commit 9260aa02a5f703bce63d2db5b69003df9be371ac
jvolkening
parents:
diff
changeset
|
98 ++$n_contigs{$id}; |
b42eb9ff6a8c
planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/b2b_utils commit 9260aa02a5f703bce63d2db5b69003df9be371ac
jvolkening
parents:
diff
changeset
|
99 } |
b42eb9ff6a8c
planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/b2b_utils commit 9260aa02a5f703bce63d2db5b69003df9be371ac
jvolkening
parents:
diff
changeset
|
100 } |
b42eb9ff6a8c
planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/b2b_utils commit 9260aa02a5f703bce63d2db5b69003df9be371ac
jvolkening
parents:
diff
changeset
|
101 |
b42eb9ff6a8c
planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/b2b_utils commit 9260aa02a5f703bce63d2db5b69003df9be371ac
jvolkening
parents:
diff
changeset
|
102 # Parse assembly depth info |
b42eb9ff6a8c
planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/b2b_utils commit 9260aa02a5f703bce63d2db5b69003df9be371ac
jvolkening
parents:
diff
changeset
|
103 #warn "calculating coverage stats...\n"; |
b42eb9ff6a8c
planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/b2b_utils commit 9260aa02a5f703bce63d2db5b69003df9be371ac
jvolkening
parents:
diff
changeset
|
104 |
b42eb9ff6a8c
planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/b2b_utils commit 9260aa02a5f703bce63d2db5b69003df9be371ac
jvolkening
parents:
diff
changeset
|
105 open my $in, '<', $fn_bedgraph; |
b42eb9ff6a8c
planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/b2b_utils commit 9260aa02a5f703bce63d2db5b69003df9be371ac
jvolkening
parents:
diff
changeset
|
106 |
b42eb9ff6a8c
planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/b2b_utils commit 9260aa02a5f703bce63d2db5b69003df9be371ac
jvolkening
parents:
diff
changeset
|
107 my %cov_5nums; |
b42eb9ff6a8c
planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/b2b_utils commit 9260aa02a5f703bce63d2db5b69003df9be371ac
jvolkening
parents:
diff
changeset
|
108 my %counts; |
b42eb9ff6a8c
planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/b2b_utils commit 9260aa02a5f703bce63d2db5b69003df9be371ac
jvolkening
parents:
diff
changeset
|
109 my $last_end; |
b42eb9ff6a8c
planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/b2b_utils commit 9260aa02a5f703bce63d2db5b69003df9be371ac
jvolkening
parents:
diff
changeset
|
110 my $last_contig; |
b42eb9ff6a8c
planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/b2b_utils commit 9260aa02a5f703bce63d2db5b69003df9be371ac
jvolkening
parents:
diff
changeset
|
111 my $head = <$in>; |
b42eb9ff6a8c
planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/b2b_utils commit 9260aa02a5f703bce63d2db5b69003df9be371ac
jvolkening
parents:
diff
changeset
|
112 while (my $line = <$in>) { |
b42eb9ff6a8c
planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/b2b_utils commit 9260aa02a5f703bce63d2db5b69003df9be371ac
jvolkening
parents:
diff
changeset
|
113 chomp $line; |
b42eb9ff6a8c
planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/b2b_utils commit 9260aa02a5f703bce63d2db5b69003df9be371ac
jvolkening
parents:
diff
changeset
|
114 my ($contig,$start,$end,$depth) = split "\t", $line; |
b42eb9ff6a8c
planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/b2b_utils commit 9260aa02a5f703bce63d2db5b69003df9be371ac
jvolkening
parents:
diff
changeset
|
115 $last_contig //= $contig; |
b42eb9ff6a8c
planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/b2b_utils commit 9260aa02a5f703bce63d2db5b69003df9be371ac
jvolkening
parents:
diff
changeset
|
116 if ($contig ne $last_contig) { |
b42eb9ff6a8c
planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/b2b_utils commit 9260aa02a5f703bce63d2db5b69003df9be371ac
jvolkening
parents:
diff
changeset
|
117 |
b42eb9ff6a8c
planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/b2b_utils commit 9260aa02a5f703bce63d2db5b69003df9be371ac
jvolkening
parents:
diff
changeset
|
118 my @depths = sort {$a <=> $b} keys %counts; |
b42eb9ff6a8c
planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/b2b_utils commit 9260aa02a5f703bce63d2db5b69003df9be371ac
jvolkening
parents:
diff
changeset
|
119 my @data; |
b42eb9ff6a8c
planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/b2b_utils commit 9260aa02a5f703bce63d2db5b69003df9be371ac
jvolkening
parents:
diff
changeset
|
120 for (@depths) { |
b42eb9ff6a8c
planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/b2b_utils commit 9260aa02a5f703bce63d2db5b69003df9be371ac
jvolkening
parents:
diff
changeset
|
121 push @data, [$_, $counts{$_}]; |
b42eb9ff6a8c
planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/b2b_utils commit 9260aa02a5f703bce63d2db5b69003df9be371ac
jvolkening
parents:
diff
changeset
|
122 } |
b42eb9ff6a8c
planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/b2b_utils commit 9260aa02a5f703bce63d2db5b69003df9be371ac
jvolkening
parents:
diff
changeset
|
123 $cov_5nums{$last_contig} = data_to_5( @data ); |
b42eb9ff6a8c
planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/b2b_utils commit 9260aa02a5f703bce63d2db5b69003df9be371ac
jvolkening
parents:
diff
changeset
|
124 $last_contig = $contig; |
b42eb9ff6a8c
planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/b2b_utils commit 9260aa02a5f703bce63d2db5b69003df9be371ac
jvolkening
parents:
diff
changeset
|
125 %counts = (); |
b42eb9ff6a8c
planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/b2b_utils commit 9260aa02a5f703bce63d2db5b69003df9be371ac
jvolkening
parents:
diff
changeset
|
126 $last_end = undef; |
b42eb9ff6a8c
planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/b2b_utils commit 9260aa02a5f703bce63d2db5b69003df9be371ac
jvolkening
parents:
diff
changeset
|
127 } |
b42eb9ff6a8c
planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/b2b_utils commit 9260aa02a5f703bce63d2db5b69003df9be371ac
jvolkening
parents:
diff
changeset
|
128 |
b42eb9ff6a8c
planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/b2b_utils commit 9260aa02a5f703bce63d2db5b69003df9be371ac
jvolkening
parents:
diff
changeset
|
129 if (defined($last_end) && $last_end < $start) { |
b42eb9ff6a8c
planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/b2b_utils commit 9260aa02a5f703bce63d2db5b69003df9be371ac
jvolkening
parents:
diff
changeset
|
130 $counts{0} += $start - $last_end; |
b42eb9ff6a8c
planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/b2b_utils commit 9260aa02a5f703bce63d2db5b69003df9be371ac
jvolkening
parents:
diff
changeset
|
131 } |
b42eb9ff6a8c
planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/b2b_utils commit 9260aa02a5f703bce63d2db5b69003df9be371ac
jvolkening
parents:
diff
changeset
|
132 $counts{$depth} += $end - $start; |
b42eb9ff6a8c
planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/b2b_utils commit 9260aa02a5f703bce63d2db5b69003df9be371ac
jvolkening
parents:
diff
changeset
|
133 $last_end = $end; |
b42eb9ff6a8c
planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/b2b_utils commit 9260aa02a5f703bce63d2db5b69003df9be371ac
jvolkening
parents:
diff
changeset
|
134 } |
b42eb9ff6a8c
planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/b2b_utils commit 9260aa02a5f703bce63d2db5b69003df9be371ac
jvolkening
parents:
diff
changeset
|
135 my @depths = sort {$a <=> $b} keys %counts; |
b42eb9ff6a8c
planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/b2b_utils commit 9260aa02a5f703bce63d2db5b69003df9be371ac
jvolkening
parents:
diff
changeset
|
136 my @data; |
b42eb9ff6a8c
planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/b2b_utils commit 9260aa02a5f703bce63d2db5b69003df9be371ac
jvolkening
parents:
diff
changeset
|
137 for (@depths) { |
b42eb9ff6a8c
planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/b2b_utils commit 9260aa02a5f703bce63d2db5b69003df9be371ac
jvolkening
parents:
diff
changeset
|
138 push @data, [$_, $counts{$_}]; |
b42eb9ff6a8c
planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/b2b_utils commit 9260aa02a5f703bce63d2db5b69003df9be371ac
jvolkening
parents:
diff
changeset
|
139 } |
b42eb9ff6a8c
planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/b2b_utils commit 9260aa02a5f703bce63d2db5b69003df9be371ac
jvolkening
parents:
diff
changeset
|
140 $cov_5nums{$last_contig} = data_to_5( @data ); |
b42eb9ff6a8c
planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/b2b_utils commit 9260aa02a5f703bce63d2db5b69003df9be371ac
jvolkening
parents:
diff
changeset
|
141 |
b42eb9ff6a8c
planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/b2b_utils commit 9260aa02a5f703bce63d2db5b69003df9be371ac
jvolkening
parents:
diff
changeset
|
142 open my $out, '>', $fn_out; |
b42eb9ff6a8c
planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/b2b_utils commit 9260aa02a5f703bce63d2db5b69003df9be371ac
jvolkening
parents:
diff
changeset
|
143 print {$out} join("\t", |
b42eb9ff6a8c
planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/b2b_utils commit 9260aa02a5f703bce63d2db5b69003df9be371ac
jvolkening
parents:
diff
changeset
|
144 '#id', |
b42eb9ff6a8c
planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/b2b_utils commit 9260aa02a5f703bce63d2db5b69003df9be371ac
jvolkening
parents:
diff
changeset
|
145 'raw_read_pairs', |
b42eb9ff6a8c
planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/b2b_utils commit 9260aa02a5f703bce63d2db5b69003df9be371ac
jvolkening
parents:
diff
changeset
|
146 'filt_read_pairs', |
b42eb9ff6a8c
planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/b2b_utils commit 9260aa02a5f703bce63d2db5b69003df9be371ac
jvolkening
parents:
diff
changeset
|
147 'frag_len_mean', |
b42eb9ff6a8c
planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/b2b_utils commit 9260aa02a5f703bce63d2db5b69003df9be371ac
jvolkening
parents:
diff
changeset
|
148 'frag_len_sd', |
b42eb9ff6a8c
planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/b2b_utils commit 9260aa02a5f703bce63d2db5b69003df9be371ac
jvolkening
parents:
diff
changeset
|
149 'forward_qual', |
b42eb9ff6a8c
planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/b2b_utils commit 9260aa02a5f703bce63d2db5b69003df9be371ac
jvolkening
parents:
diff
changeset
|
150 'reverse_qual', |
b42eb9ff6a8c
planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/b2b_utils commit 9260aa02a5f703bce63d2db5b69003df9be371ac
jvolkening
parents:
diff
changeset
|
151 'n_contigs', |
b42eb9ff6a8c
planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/b2b_utils commit 9260aa02a5f703bce63d2db5b69003df9be371ac
jvolkening
parents:
diff
changeset
|
152 'coverage_depth', |
b42eb9ff6a8c
planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/b2b_utils commit 9260aa02a5f703bce63d2db5b69003df9be371ac
jvolkening
parents:
diff
changeset
|
153 ), "\n"; |
b42eb9ff6a8c
planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/b2b_utils commit 9260aa02a5f703bce63d2db5b69003df9be371ac
jvolkening
parents:
diff
changeset
|
154 for my $id (@names) { |
b42eb9ff6a8c
planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/b2b_utils commit 9260aa02a5f703bce63d2db5b69003df9be371ac
jvolkening
parents:
diff
changeset
|
155 print {$out} join("\t", |
b42eb9ff6a8c
planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/b2b_utils commit 9260aa02a5f703bce63d2db5b69003df9be371ac
jvolkening
parents:
diff
changeset
|
156 $id, |
b42eb9ff6a8c
planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/b2b_utils commit 9260aa02a5f703bce63d2db5b69003df9be371ac
jvolkening
parents:
diff
changeset
|
157 $counts[0], |
b42eb9ff6a8c
planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/b2b_utils commit 9260aa02a5f703bce63d2db5b69003df9be371ac
jvolkening
parents:
diff
changeset
|
158 $counts[2], |
b42eb9ff6a8c
planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/b2b_utils commit 9260aa02a5f703bce63d2db5b69003df9be371ac
jvolkening
parents:
diff
changeset
|
159 $frag_mean, |
b42eb9ff6a8c
planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/b2b_utils commit 9260aa02a5f703bce63d2db5b69003df9be371ac
jvolkening
parents:
diff
changeset
|
160 $frag_sd, |
b42eb9ff6a8c
planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/b2b_utils commit 9260aa02a5f703bce63d2db5b69003df9be371ac
jvolkening
parents:
diff
changeset
|
161 $five_nums[0], |
b42eb9ff6a8c
planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/b2b_utils commit 9260aa02a5f703bce63d2db5b69003df9be371ac
jvolkening
parents:
diff
changeset
|
162 $five_nums[1], |
b42eb9ff6a8c
planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/b2b_utils commit 9260aa02a5f703bce63d2db5b69003df9be371ac
jvolkening
parents:
diff
changeset
|
163 $n_contigs{$id}, |
b42eb9ff6a8c
planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/b2b_utils commit 9260aa02a5f703bce63d2db5b69003df9be371ac
jvolkening
parents:
diff
changeset
|
164 $cov_5nums{$id}, |
b42eb9ff6a8c
planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/b2b_utils commit 9260aa02a5f703bce63d2db5b69003df9be371ac
jvolkening
parents:
diff
changeset
|
165 ), "\n"; |
b42eb9ff6a8c
planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/b2b_utils commit 9260aa02a5f703bce63d2db5b69003df9be371ac
jvolkening
parents:
diff
changeset
|
166 } |
b42eb9ff6a8c
planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/b2b_utils commit 9260aa02a5f703bce63d2db5b69003df9be371ac
jvolkening
parents:
diff
changeset
|
167 close $out; |
b42eb9ff6a8c
planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/b2b_utils commit 9260aa02a5f703bce63d2db5b69003df9be371ac
jvolkening
parents:
diff
changeset
|
168 |
b42eb9ff6a8c
planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/b2b_utils commit 9260aa02a5f703bce63d2db5b69003df9be371ac
jvolkening
parents:
diff
changeset
|
169 exit; |
b42eb9ff6a8c
planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/b2b_utils commit 9260aa02a5f703bce63d2db5b69003df9be371ac
jvolkening
parents:
diff
changeset
|
170 |
b42eb9ff6a8c
planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/b2b_utils commit 9260aa02a5f703bce63d2db5b69003df9be371ac
jvolkening
parents:
diff
changeset
|
171 |
b42eb9ff6a8c
planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/b2b_utils commit 9260aa02a5f703bce63d2db5b69003df9be371ac
jvolkening
parents:
diff
changeset
|
172 sub data_to_5 { |
b42eb9ff6a8c
planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/b2b_utils commit 9260aa02a5f703bce63d2db5b69003df9be371ac
jvolkening
parents:
diff
changeset
|
173 |
b42eb9ff6a8c
planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/b2b_utils commit 9260aa02a5f703bce63d2db5b69003df9be371ac
jvolkening
parents:
diff
changeset
|
174 my (@data) = @_; |
b42eb9ff6a8c
planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/b2b_utils commit 9260aa02a5f703bce63d2db5b69003df9be371ac
jvolkening
parents:
diff
changeset
|
175 my $total = sum map {$_->[1]} @data; |
b42eb9ff6a8c
planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/b2b_utils commit 9260aa02a5f703bce63d2db5b69003df9be371ac
jvolkening
parents:
diff
changeset
|
176 my @five_num; |
b42eb9ff6a8c
planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/b2b_utils commit 9260aa02a5f703bce63d2db5b69003df9be371ac
jvolkening
parents:
diff
changeset
|
177 my $curr = 0; |
b42eb9ff6a8c
planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/b2b_utils commit 9260aa02a5f703bce63d2db5b69003df9be371ac
jvolkening
parents:
diff
changeset
|
178 for my $i (0..$#data) { |
b42eb9ff6a8c
planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/b2b_utils commit 9260aa02a5f703bce63d2db5b69003df9be371ac
jvolkening
parents:
diff
changeset
|
179 $curr += $data[$i]->[1]; |
b42eb9ff6a8c
planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/b2b_utils commit 9260aa02a5f703bce63d2db5b69003df9be371ac
jvolkening
parents:
diff
changeset
|
180 for my $j (0..4) { |
b42eb9ff6a8c
planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/b2b_utils commit 9260aa02a5f703bce63d2db5b69003df9be371ac
jvolkening
parents:
diff
changeset
|
181 next if (defined $five_num[$j]); |
b42eb9ff6a8c
planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/b2b_utils commit 9260aa02a5f703bce63d2db5b69003df9be371ac
jvolkening
parents:
diff
changeset
|
182 my $quant = $j/4; |
b42eb9ff6a8c
planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/b2b_utils commit 9260aa02a5f703bce63d2db5b69003df9be371ac
jvolkening
parents:
diff
changeset
|
183 if ($curr/$total > $quant) { |
b42eb9ff6a8c
planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/b2b_utils commit 9260aa02a5f703bce63d2db5b69003df9be371ac
jvolkening
parents:
diff
changeset
|
184 $five_num[$j] = $data[$i]->[0]; |
b42eb9ff6a8c
planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/b2b_utils commit 9260aa02a5f703bce63d2db5b69003df9be371ac
jvolkening
parents:
diff
changeset
|
185 } |
b42eb9ff6a8c
planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/b2b_utils commit 9260aa02a5f703bce63d2db5b69003df9be371ac
jvolkening
parents:
diff
changeset
|
186 elsif ($curr/$total == $quant) { |
b42eb9ff6a8c
planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/b2b_utils commit 9260aa02a5f703bce63d2db5b69003df9be371ac
jvolkening
parents:
diff
changeset
|
187 $five_num[$j] = $i < $#data |
b42eb9ff6a8c
planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/b2b_utils commit 9260aa02a5f703bce63d2db5b69003df9be371ac
jvolkening
parents:
diff
changeset
|
188 ? int(($data[$i]->[0]+$data[$i+1]->[0])/2) |
b42eb9ff6a8c
planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/b2b_utils commit 9260aa02a5f703bce63d2db5b69003df9be371ac
jvolkening
parents:
diff
changeset
|
189 : $data[$i]->[0]; |
b42eb9ff6a8c
planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/b2b_utils commit 9260aa02a5f703bce63d2db5b69003df9be371ac
jvolkening
parents:
diff
changeset
|
190 } |
b42eb9ff6a8c
planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/b2b_utils commit 9260aa02a5f703bce63d2db5b69003df9be371ac
jvolkening
parents:
diff
changeset
|
191 } |
b42eb9ff6a8c
planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/b2b_utils commit 9260aa02a5f703bce63d2db5b69003df9be371ac
jvolkening
parents:
diff
changeset
|
192 } |
b42eb9ff6a8c
planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/b2b_utils commit 9260aa02a5f703bce63d2db5b69003df9be371ac
jvolkening
parents:
diff
changeset
|
193 return join('|',@five_num); |
b42eb9ff6a8c
planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/b2b_utils commit 9260aa02a5f703bce63d2db5b69003df9be371ac
jvolkening
parents:
diff
changeset
|
194 |
b42eb9ff6a8c
planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/b2b_utils commit 9260aa02a5f703bce63d2db5b69003df9be371ac
jvolkening
parents:
diff
changeset
|
195 } |