Debian Codegraph @

hmmer/profmark/x-hmmsearch-max

raw
1 #! /usr/bin/perl -w
2
3 # Do a piece of a profmark benchmark, for hmmsearch --max.
4 #
5 # This script is normally called by pmark_master.pl; its command line
6 # syntax is tied to pmark_master.pl.
7 #
8 # Usage: x-hmmsearch-max <top_builddir> <top_srcdir> <resultdir> <tblfile> <msafile> <fafile> <outfile>
9 # Example: ./x-hmmsearch-max ~/releases/hmmer-3.0/build-icc-mpi ~/releases/hmmer-3.0 testdir test.tbl pmark.msa test.fa test.out
10 #
11 # SRE, Tue Apr 20 10:39:31 2010 [Janelia]
12 # SVN $Id$
13
14 BEGIN {
15 $top_builddir = shift;
16 $top_srcdir = shift;
17 $resultdir = shift;
18 $tblfile = shift;
19 $msafile = shift;
20 $fafile = shift;
21 $outfile = shift;
22 }
23
24 $hmmbuild = "$top_builddir/src/hmmbuild";
25 $hmmsearch = "$top_builddir/src/hmmsearch";
26 $buildopts = "";
27 $searchopts = "--max -E 200 --cpu 1";
28
29 if (! -d $top_builddir) { die "didn't find build directory $top_builddir"; }
30 if (! -d $top_srcdir) { die "didn't find src directory $top_srcdir"; }
31 if (! -x $hmmbuild) { die "didn't find executable $hmmbuild"; }
32 if (! -x $hmmsearch) { die "didn't find executable $hmmsearch"; }
33 if (! -e $resultdir) { die "$resultdir doesn't exist"; }
34
35 open(OUTFILE,">$outfile") || die "failed to open $outfile";
36 open(TABLE, "$tblfile") || die "failed to open $tblfile";
37 while (<TABLE>)
38 {
39 ($msaname) = split;
40
41 $output = `esl-afetch -o $resultdir/$msaname.sto $msafile $msaname`;
42 if ($? != 0) { die "FAILED: esl-afetch -o $resultdir/$msaname.sto $msafile $msaname"; }
43
44 $output = `$hmmbuild $buildopts $resultdir/$msaname.hmm $resultdir/$msaname.sto`;
45 if ($? != 0) { die "FAILED: $hmmbuild $buildopts $resultdir/$msaname.hmm $resultdir/$msaname.sto"; }
46
47 $status = system("$hmmsearch $searchopts --tblout $resultdir/$msaname.tmp $resultdir/$msaname.hmm $fafile > /dev/null");
48 if ($status != 0) { die "FAILED: $hmmsearch $searchopts --tblout $resultdir/$msaname.tmp $resultdir/$msaname.hmm $fafile"; }
49
50 open(OUTPUT, "$resultdir/$msaname.tmp") || die "FAILED: to open $resultdir/$msaname.tmp tabular output file";
51 while (<OUTPUT>)
52 {
53 if (/^\#/) { next; }
54 @fields = split(' ', $_, 7);
55 $target = $fields[0];
56 $pval = $fields[4];
57 $bitscore = $fields[5];
58 printf OUTFILE "%g %.1f %s %s\n", $pval, $bitscore, $target, $msaname;
59 }
60
61 unlink "$resultdir/$msaname.hmm";
62 unlink "$resultdir/$msaname.sto";
63 unlink "$resultdir/$msaname.tmp";
64 }
65 close TABLE;
66 close OUTFILE;
67
68
69
70
71
72