Debian Codegraph @

hmmer/testsuite/i7-hmmbuild-fragments.pl

raw
1 #! /usr/bin/perl
2
3 # Test the ability of hmmbuild to deal with crappy alignments
4 # of lots of sequence fragments.
5 #
6 # Usage: ./i7-hmmbuild-fragments.pl <hmmbuild binary> <tmpfile prefix>
7 # Example: ./i7-hmmbuild-fragments.pl ../src/hmmbuild tmpfoo
8 #
9 # SRE, Tue Jun 16 13:37:05 2009
10
11
12 $hmmbuild = shift;
13 $tmppfx = shift;
14
15 if (! -x "$hmmbuild") { die "FAIL: didn't find hmmalign binary $hmmalign\n"; }
16 open (TMPFILE, ">$tmppfx.sto") || die "FAIL: couldn't open $tmppfx.sto for writing\n";
17 print TMPFILE << "EOF";
18 # STOCKHOLM 1.0
19
20 #=GF ID test
21
22 seq1 ACDEFGHIKL------------------------------
23 seq2 ----------MNPQRSTVWY--------------------
24 seq3 --------------------ACDEFGHIKL----------
25 seq4 ------------------------------MNPQRSTVWY
26 //
27 EOF
28 close TMPFILE;
29
30
31 $output = `$hmmbuild -O $tmppfx.sto2 $tmppfx.hmm $tmppfx.sto 2>&1`;
32 if ($? != 0) { die "FAIL: hmmbuild failed unexpectedly\n"; }
33
34 $output =~ /1\s+test\s+4\s+40\s+(\d+)/;
35 if ($1 != 40) { die "FAIL: should've built a M=40 model\n"; }
36
37
38 $output = `$hmmbuild --fragthresh 0.0 $tmppfx.hmm $tmppfx.sto 2>&1`;
39 if ($? == 0) { die "FAIL: hmmbuild should have failed but didn't\n"; }
40
41
42 print "ok\n";
43 unlink "$tmppfx.sto";
44 unlink "$tmppfx.sto2";
45 unlink "$tmppfx.hmm";
46 exit 0;