minimap2/tex/eval2roc.pl

34 lines
580 B
Perl
Raw Normal View History

2017-08-02 03:12:49 +08:00
#!/usr/bin/perl
use strict;
use warnings;
use Getopt::Std;
2017-08-03 07:52:31 +08:00
my %opts = (n=>33088, s=>100);
2017-08-02 03:12:49 +08:00
getopts('n:', \%opts);
my $pseudo = .5;
my $tot = $pseudo;
my $err = $pseudo;
2017-08-03 07:52:31 +08:00
my $tot_last_out = -$opts{s};
my $state = 0;
my $mapq = 0;
2017-08-02 03:12:49 +08:00
while (<>) {
chomp;
if (/^Q\t(\d+)\t(\d+)\t(\d+)/) {
$tot += $2;
$err += $3;
2017-08-03 07:52:31 +08:00
if ($tot - $tot_last_out >= $opts{s}) {
print join("\t", $1, $err/$tot, $tot / $opts{n}), "\n";
$tot_last_out = $tot;
$state = 0;
} else {
$state = 1;
$mapq = $1;
}
2017-08-02 03:12:49 +08:00
}
}
2017-08-03 07:52:31 +08:00
if ($state) {
print join("\t", $mapq, $err/$tot, $tot / $opts{n}), "\n";
}