File: audit_summary_stats.pl

package info (click to toggle)
trinityrnaseq 2.11.0%2Bdfsg-6
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 417,528 kB
  • sloc: perl: 48,420; cpp: 17,749; java: 12,695; python: 3,124; sh: 1,030; ansic: 983; makefile: 688; xml: 62
file content (46 lines) | stat: -rwxr-xr-x 1,023 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/usr/bin/env perl

use strict;
use warnings;

my $usage = "usage: $0 file.audit_summary\n\n";

my $filename = $ARGV[0] or die $usage;

main: {

    my %yes_no_counter;
    my $total_reco = 0;
    my $total_ref = 0;
    my $total_FL = 0;

    open (my $fh, $filename) or die $!;
    while (<$fh>) {
        if (/ref_fa/) { next; }
        chomp;
        my @x = split(/\t/);
        my $yes_or_no = $x[4];
        
        $yes_no_counter{$yes_or_no}++;

        my $num_reco = $x[3];
        $total_reco += $num_reco;

        my $num_ref = $x[1];
        $total_ref += $num_ref;
        
        my $num_FL = $x[2];
        $total_FL += $num_FL;

    }
    close $fh;
    
    my $num_yes = $yes_no_counter{YES} || 0;
    my $num_no = $yes_no_counter{NO} ||0;

    my $num_additional = $total_reco - $total_FL;
    print join("\t", "#YES", "#NO", "#FL", "#TOT_Trans", "#Ref", "#additional") . "\n";
    print join("\t", $num_yes, $num_no, $total_FL, $total_reco, $total_ref, $num_additional) . "\n";
    
    exit(0);
}