#! /usr/bin/perl # # Given a list file with 3-tuples for each series to plot # create a pdf of a ROC curve. # # Format of list file: # # # /.em.xy, /.em.mer and /.time must exist. # # is the second command line argument. # # Usage: perl rmark-Rroc.pl <1/0 yes/no draw error-bars> # Example usage: # > perl rmark-Rroc.pl -R rmark-2.list 1 rmark-2.pdf 0 RMARK3_results use Getopt::Std; getopts('RPLM:'); if (defined $opt_R) { $replace_underscores = 1; } if (defined $opt_P) { $paper_mode = 1; } if (defined $opt_L) { $lty_mode = 1; } if (defined $opt_M) { $perMb_mode = 1; $numMb = $opt_M; } my $usage = "Usage: perl rmark-Rroc.pl [OPTIONS] <1/0 yes/no draw error-bars> \n"; $usage .= "\nFormat of list file:\n\t \n\n"; $usage .= "\nExample:\n\tinf1p02-df r2-i1p02 green\n\n"; $usage .= "/.em$key.xy, /.em$key.mer and /.time must exist\n\n"; $usage .= "Options:\n\t"; $usage .= "-R : replace underscores in with spaces\n\t"; $usage .= "-P : run in 'paper' mode, create a smaller PDF for a Bioinformatics Applications Note\n\t"; $usage .= "-L : list file includes line types instead of colors\n\t"; $usage .= "-M : modify X-axis to FPs/query/Mb for a database of Mb\n\n"; if(scalar(@ARGV) != 5) { printf("$usage"); exit(1); } ($listfile, $key, $pdf, $do_errorbars, $main) = @ARGV; $n = 0; if($do_errorbars && $lty_mode) { die "ERROR -L is incompatible with error bars"; } if($replace_underscores) { $main =~ s/\_/ /g; } @R = (); $xlabel = "errors per query"; $ylabel = "fractional coverage of positives"; #push(@R, "xlimit<-c(0.001,20)\n"); if($perMb_mode) { push(@R, "xlimit<-c(0.001,1.0)\n"); } push(@R, "ylimit<-c(0,1)\n"); if($paper_mode) { push(@R, "postscript(\"$pdf\", height=5.5, width=9.3)\n"); } else { push(@R, "pdf(\"$pdf\", height=8.5, width=11)\n"); } open(LIST, $listfile) || die "ERROR, could not open $listfile"; @nametimemerA = (); while() { chomp $_; if(m/\S+/) { @fields = split(' ', $_, 3); if(scalar(@fields) != 3) { die "ERROR, format of $listfile invalid"; } ($name, $root, $color_or_lty) = @fields; $n++; @xA = (); @yA = (); @dy1A = (); @dy2A = (); $xyfile = $root . ".em" . $key . ".xy"; $merfile = $root . ".em" . $key . ".mer"; $sumfile = $root . ".sum"; $timefile = $root . ".time"; $sumfile = $root . ".em" . $key . ".sum"; if(! -e $xyfile) { $xyfile = $root . "/" . $xyfile; if(! -e $xyfile) { die "ERROR, $xyfile does not exist"; } } if(! -e $merfile) { $merfile = $root . "/" . $merfile; if(! -e $merfile) { die "ERROR, $merfile does not exist"; } } if(! -e $sumfile) { $sumfile = $root . "/" . $sumfile; if(! -e $sumfile) { die "ERROR, $sumfile does not exist"; } } if(! -e $timefile) { $timefile = $root . "/" . $timefile; if(! -e $timefile) { die "ERROR, $timefile does not exist"; } } # process time file open(TIME, $timefile) || die "ERROR, could not open time file $timefile"; while($line =