-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstats.pl
executable file
·51 lines (40 loc) · 1003 Bytes
/
stats.pl
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
47
48
49
50
51
#!/usr/bin/perl
use strict;
use warnings;
use FindBin '$Bin';
use lib "$Bin";
use Common;
my $aseqs = &Common::aseqs();
my %xrefs = ();
my %ts = ();
my %other = ();
&Common::startTicker(20000);
my $cursor = $aseqs->find({});
while (my $aseq = $cursor->next()) {
$other{aseqs}++;
$other{aa} += $aseq->{l};
foreach my $xtype (keys %{ $aseq->{x} }) {
$xrefs{$xtype} += scalar(@{ $aseq->{x}->{$xtype} });
}
foreach my $tool (keys %{ $aseq->{t} }) {
my $ref = $aseq->{t}->{$tool};
my $n = (ref($ref) eq 'ARRAY') ? @$ref : 1;
$ts{$tool} += $n;
}
&Common::tick();
}
print "$other{aseqs} Aseqs\n";
print "$other{aa} amino acids\n";
print "\n";
foreach my $xtype (keys %xrefs) {
print "$xrefs{$xtype}\t$xtype\n";
}
my $total = 0;
map { $total += $xrefs{$_} } keys %xrefs;
print "$total total\n\n";
foreach my $type (keys %ts) {
print "$ts{$type}\t$type\n";
}
$total = 0;
map { $total += $ts{$_} } keys %ts;
print "$total total\n\n";