Debian Codegraph @

seagen/analysis/plotScoresSingly.pl

raw
1 #!/usr/local/bin/perl
2
3 #
4 # bzip2 -dc /raid/WORK/EMpaper/run1-nofiltering/all-scored-hits.sorted.bz2 | perl dumpScores.pl | perl plotScoresSingly.pl
5 #
6
7 use strict;
8 $| = 1;
9
10 my $tmppath = "/tmp";
11
12 # First line was blank. Don't know why.
13 #my $junk = <STDIN>;
14
15 while (!eof(STDIN)) {
16 $_ = <STDIN>;
17
18 my ($estid, $maxscore, $numhits, @vals) = split '\s+', $_;
19
20 open(A, "> $tmppath/hits-$estid.dat");
21 open(B, "> $tmppath/iden-$estid.dat");
22 open(C, "> $tmppath/covr-$estid.dat");
23 foreach my $h (@vals) {
24 my ($a, $b, $i, $c) = split ',', $h;
25
26 $a /= $maxscore;
27 print A "$a\n";
28
29 $i /= 100.0;
30 print B "$i\n";
31
32 $c /= 100.0;
33 print C "$c\n";
34 }
35 close(C);
36 close(B);
37 close(A);
38
39 my $output = substr("0000000000$estid", -6, 6);
40 my $direct = substr("0000000000$estid", -6, 3);
41
42 print "$output\r";
43
44 system("mkdir $direct") if (! -d "$direct");
45
46 open(O, "> $tmppath/plot-$estid.gpl");
47 print O "set terminal pbm color\n";
48 print O "set output\n";
49 print O "set pointsize 0.5\n";
50 print O "set xtics 10\n";
51 #print O "set size 1.5,1.5\n";
52 print O "plot [-5:200][0.0:1.2] ";
53 print O " 0.95 notitle lt 0, ";
54 print O " 0.80 notitle lt 0, ";
55 print O " 0.50 notitle lt 0, ";
56 print O " \"$tmppath/hits-$estid.dat\" using 1 notitle with linespoints 1, ";
57 print O " \"$tmppath/covr-$estid.dat\" using 1 notitle with points 3, ";
58 print O " \"$tmppath/iden-$estid.dat\" using 1 notitle with points 2\n";
59 close(O);
60
61 my $cmd = "";
62
63 $cmd = "gnuplot $tmppath/plot-$estid.gpl | ppmtogif -quiet > $direct/$output.gif";
64 $cmd .= " && rm -f";
65 $cmd .= " $tmppath/plot-$estid.gpl";
66 $cmd .= " $tmppath/hits-$estid.dat";
67 $cmd .= " $tmppath/iden-$estid.dat";
68 $cmd .= " $tmppath/covr-$estid.dat";
69 system("$cmd");
70 }
71 close(STDIN);