File: eval2roc.pl

package info (click to toggle)
minimap2 2.17%2Bdfsg-12
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 1,204 kB
  • sloc: ansic: 8,653; javascript: 2,301; makefile: 130; python: 91; sh: 42; perl: 29
file content (33 lines) | stat: -rwxr-xr-x 580 bytes parent folder | download | duplicates (4)
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
#!/usr/bin/perl

use strict;
use warnings;
use Getopt::Std;

my %opts = (n=>33088, s=>100);
getopts('n:', \%opts);

my $pseudo = .5;
my $tot = $pseudo;
my $err = $pseudo;
my $tot_last_out = -$opts{s};
my $state = 0;
my $mapq = 0;
while (<>) {
	chomp;
	if (/^Q\t(\d+)\t(\d+)\t(\d+)/) {
		$tot += $2;
		$err += $3;
		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;
		}
	}
}
if ($state) {
	print join("\t", $mapq, $err/$tot, $tot / $opts{n}), "\n";
}