Debian Codegraph @

hmmer/profmark/rocplot.pl

raw
1 #! /usr/bin/perl
2
3 $nsearches = 2809;
4
5 require "getopts.pl";
6 &Getopts('n:X:x:');
7
8 if ($opt_n) { $nsearches = $opt_n; }
9 if ($opt_X) {
10 open(EXCLUDEFILE,$opt_X) || die;
11 while (<EXCLUDEFILE>) {
12 if (/^\s*(\S+)/) { $nsearches--; $excluded{$1} = 1; }
13 }
14 close EXCLUDEFILE;
15 }
16 if ($opt_x) { $nsearches--; $excluded{$opt_x} = 1; }
17
18
19 $fp = 0;
20 $tp = 0;
21 while (<>)
22 {
23 ($Eval, $bitscore, $target, $query) = split;
24
25 if ($excluded{$query}) { next; }
26
27 if ($target =~ /^decoy\d+$/) # a false positive
28 {
29 $fp++;
30 printf("%.4f %d\n", $fp / $nsearches, $tp);
31 }
32
33 if ($target =~ /^$query\//) # a true positive
34 {
35 $tp++;
36 }
37
38 if ($fp >= $nsearches * 10) { last; }
39 }
40
41 print "&\n";