new file: cell2loc.py
[GalaxyCodeBases.git] / perl / etc / WoodyMiaoLin / Tiger / 75_1458coverage.pl
bloba6b2ecbf0010770ad7cd771b49d880eeaf1c34f5
1 #!/usr/bin/perl
2 use strict;
3 use warnings;
5 my $in1 = shift;
6 my $in2 = shift;
7 open I1, "<", "$in1";
8 open I2, "-|", "gzip -dc $in2";
10 my @notN;
11 while (<I1>) {
12 chomp;
13 push @notN, $_;
15 close I1;
16 #print STDERR "read $in1 complete!\n";
18 my $n75 = 0;
19 my $n1458 = 0;
20 my (@cover, @line, @depth);
21 while (<I2>) {
22 chomp;
23 my @a = split /\t/;
24 $line[$a[1]] = $_;
25 my $c = 0;
26 my @d;
27 foreach (9..11) {
28 my @b = split /:/, $a[$_];
29 push @d, $b[1];
30 if ($b[1] >= 3) {
31 ++$c;
34 $depth[$a[1]] = join ",", @d;
35 $cover[$a[1]] = 1 if $c == 3;
37 close I2;
38 #print STDERR "read $in2 complete!\n";
40 foreach (@notN) {
41 $line[$_] = "N/A" unless defined $line[$_];
42 $depth[$_] = "0,0,0" unless defined $depth[$_];
43 print "$_\t$depth[$_]\t$line[$_]\n" unless defined $cover[$_];