Debian Codegraph @

hmmer/testsuite/i11-hmmalign-mapali.pl

raw
1 #! /usr/bin/perl
2
3 # Another test of the hmmalign --mapali option, after Elena reports
4 # bug #h73 in bad interaction of checksum calculation and marking
5 # fragments.
6 #
7 # Usage: ./i11-hmmalign-mapali.pl <builddir> <srcdir> <tmpfile prefix>
8 # Example: ./i11-hmmalign-mapali.pl .. .. tmpfoo
9 #
10 # SRE, Mon Dec 21 14:38:17 2009 [Janelia]
11
12 $builddir = shift;
13 $srcdir = shift;
14 $tmppfx = shift;
15
16 # Verify that we have all the executables we need for the test.
17 if (! -x "$builddir/src/hmmbuild") { die "FAIL: didn't find hmmbuild binary in $builddir/src\n"; }
18 if (! -x "$builddir/src/hmmalign") { die "FAIL: didn't find hmmalign binary in $builddir/src\n"; }
19
20
21 # Create our test files.
22 if (! open(ALI1, ">$tmppfx.sto")) { die "FAIL: couldn't open $tmppfx.sto for write\n"; }
23 if (! open(SEQ1, ">$tmppfx.fa")) { die "FAIL: couldn't open $tmppfx.sto for write\n"; }
24
25 print ALI1 <<"EOF";
26 # STOCKHOLM 1.0
27
28 # s6 is a fragment (by default hmmbuild definition)
29 # s7 contains D->I transition
30 # s8 contains I->D transition
31
32 s1 ACDEFG.HIK.LMNPQRSTVWY
33 s2 ACDEFG.HIK.LMNPQRSTVWY
34 s3 ACDEFG.HIK.LMNPQRSTVWY
35 s4 ACDEFG.HIK.LMNPQRSTVWY
36 s5 ACDEFG.HIK.LMNPQRSTVWY
37 s6 -----G.HIK.LM---------
38 s7 ACDEF-aHIK.LMNPQRSTVWY
39 s8 ACDEFG.HIKa.MNPQRSTVWY
40 //
41 EOF
42
43 print SEQ1 <<"EOF";
44 >test
45 CDEFGHIKLMNPQRSTVW
46 EOF
47
48 close ALI1;
49 close SEQ2;
50
51 $output = `$builddir/src/hmmbuild -O $tmppfx.sto2 $tmppfx.hmm $tmppfx.sto 2>&1`;
52 if ($? != 0) { die "FAIL: hmmbuild failed\n"; }
53
54 ($resave) = ($output =~ /processed alignment resaved to:\s+(\S+)/);
55 if ($resave ne "$tmppfx.sto2") { die "FAIL: -O option didn't generated a line in header\n"; }
56
57 $output = `cat $tmppfx.sto2`;
58 if ($? != 0) { die "FAIL: cat failed\n"; }
59
60 ($aseq6) = ($output =~ /\ns6\s+(\S+)/);
61 ($aseq7) = ($output =~ /\ns7\s+(\S+)/);
62 ($aseq8) = ($output =~ /\ns8\s+(\S+)/);
63 if ($aseq6 ne "~~~~~GHIKLM~~~~~~~~~") { die "FAIL: fragment wasn't marked in -O output\n"; }
64 if ($aseq7 ne "ACDEFAHIKLMNPQRSTVWY") { die "FAIL: D->I transition wasn't trace doctored properly?\n"; }
65 if ($aseq8 ne "ACDEFGHIKAMNPQRSTVWY") { die "FAIL: I->D transition wasn't trace doctored properly?\n"; }
66
67 $output = `$builddir/src/hmmalign --mapali $tmppfx.sto $tmppfx.hmm $tmppfx.fa 2>&1`;
68 if ($? != 0) { die "FAIL: hmmalign --mapali failed\n"; }
69
70 ($testseq) = ($output =~ /\ntest\s+(\S+)/);
71 if ($testseq ne "-CDEFG.HIK.LMNPQRSTVW-") { die "FAIL: test seq in unexpected alignment\n"; }
72
73 print "ok\n";
74 unlink "$tmppfx.sto";
75 unlink "$tmppfx.fa";
76 unlink "$tmppfx.sto2";
77 unlink "$tmppfx.hmm";
78 exit 0;
79
80
81