#! /usr/bin/perl -w # Given a positive file (.pos), an output file from rmark-time.pl and # an output (.out) file of an rmark benchmark, determine the # family-specific and summary MER (minimum error rates). The output # file must be sorted properly by score (E-value or bit score), with # better scores preceding worse scores. # # Example usage: sort -g cmsearch.out | perl mer.pl rmark3.pos cmsearch.time # # Command-line options: # -E : set maximum E-value to consider as # -T : set minimum bit score to consider as # #use strict; my $usage = "Usage: perl mer.pl | \n"; use Getopt::Std; getopts('E:T:'); my $E_set = 0; my $T_set = 0; my $maxE = 100000; my $minT = -100000; if (defined $opt_E) { $E_set = 1; $maxE = $opt_E; } if (defined $opt_T) { $T_set = 1; $minT = $opt_T; } my $posfile = shift; my $timefile = shift; if (! -e $posfile) { die "$posfile doesn't exist"; } if (! -e $timefile) { die "$timefile doesn't exist"; } my ($line, $fam, $tmp, $fn, $fp, $mer, $fam_strlen, $sc, $match, $strand, $mer_fp, $mer_fn, $mer_sc); my ($fam_sum_mer, $fam_sum_mer_fp, $fam_sum_mer_fn); my @fields = (); my %fam_nposH = (); my %fam_merH = (); my %fam_mer_fnH = (); my %fam_mer_fpH = (); my %fam_mer_scH = (); my %fam_fpH = (); my %fam_fnH = (); my $npos = 0; my $class; my %seen_matchHH = (); my $prv_sc; my $seen_sc = 0; my $sc_should_increase = 0; my $sc_should_decrease = 0; # read time file, if there's a line like this #total 0.36 hours == 21.86 minutes == 1311.43 seconds # extract the total hours, we'll print this at the end of the MER summary line open(TIME, $timefile); my $totaltime = "0"; while($line =