Debian Codegraph @

hmmer/profmark/x-h2-ls

raw
1 #! /usr/bin/perl -w
2
3 # Do a piece of a profmark benchmark, for H2's hmmsearch (ls mode).
4 #
5 # This script is normally called by pmark_master.pl; its command line
6 # syntax is tied to pmark_master.pl.
7 #
8 # <top_builddir> = HMMER2 build directory (hmmbuild, hmmcalibrate, hmmsearch executables)
9 # <top_srcdir> = HMMER3 src directory (demotic scripts in easel/demotic)
10
11 # Usage: x-h2-ls <top_builddir> <top_srcdir> <resultdir> <tblfile> <msafile> <fafile> <outfile>
12 # Example: ./x-h2-ls ~/releases/hmmer-2.3.2 ~/src/hmmer testdir test.tbl pmark.msa test.fa test.out
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 use lib "${top_srcdir}/easel/demotic";
24 use demotic_h2;
25
26 $hmmbuild = "${top_builddir}/src/hmmbuild";
27 $hmmcalibrate = "${top_builddir}/src/hmmcalibrate";
28 $hmmsearch = "${top_builddir}/src/hmmsearch";
29 $buildopts = "";
30 $calibrateopts = "--cpu 1";
31 $searchopts = "-E 1000 --cpu 1";
32
33 if (! -d $top_builddir) { die "didn't find H2 build directory $top_builddir"; }
34 if (! -d $top_srcdir) { die "didn't find H3 source directory $top_builddir"; }
35 if (! -x $hmmbuild) { die "didn't find executable $hmmbuild"; }
36 if (! -x $hmmcalibrate) { die "didn't find executable $hmmbuild"; }
37 if (! -x $hmmsearch) { die "didn't find executable $hmmsearch"; }
38 if (! -e $resultdir) { die "$resultdir doesn't exist"; }
39
40 open(OUTFILE,">$outfile") || die "failed to open $outfile";
41 open(TABLE, "$tblfile") || die "failed to open $tblfile";
42 MSA:
43 while (<TABLE>)
44 {
45 ($msaname) = split;
46
47 $output = `esl-afetch -o $resultdir/$msaname.sto $msafile $msaname`;
48 if ($?) { print "FAILED: esl-afetch -o $resultdir/$msaname.sto $msafile $msaname\n"; next MSA; }
49
50 $output = `$hmmbuild $buildopts $resultdir/$msaname.hmm $resultdir/$msaname.sto`;
51 if ($?) { print "FAILED: $hmmbuild $buildopts $resultdir/$msaname.hmm $resultdir/$msaname.sto\n"; next MSA; }
52
53 $output = `$hmmcalibrate $calibrateopts $resultdir/$msaname.hmm`;
54 if ($?) { print "FAILED: $hmmcalibrate\n"; next MSA; }
55
56 if (! open(HMMSEARCH, "$hmmsearch $searchopts $resultdir/$msaname.hmm $fafile 2> /dev/null |"))
57 { print "FAILED: $hmmsearch $searchopts $resultdir/$msaname.hmm $fafile\n"; next MSA; }
58
59 if (! demotic_h2::parse(\*HMMSEARCH))
60 { print "FAILED: demotic h2 parser\n"; next MSA; }
61
62 for ($i = 0; $i < $demotic_h2::nhits; $i++)
63 {
64 printf OUTFILE ("%g\t%.1f\t%s\t%s\n",
65 $demotic_h2::hit_Eval[$i],
66 $demotic_h2::hit_bitscore[$i],
67 $demotic_h2::hit_target[$i],
68 $msaname);
69 }
70 close HMMSEARCH;
71
72 unlink "$resultdir/$msaname.hmm";
73 unlink "$resultdir/$msaname.sto";
74 }
75 close TABLE;
76 close OUTFILE;
77
78
79
80
81
82