Debian Codegraph @

testsuite/bug-i12.pl

raw
1 #! /usr/bin/perl
2
3 # bug i12 - Mishandling basepair emit scores in all *outside* funcs.
4 # EPN, Thu Nov 8 08:47:08 2007
5 #
6 # This bug has existed in outside() and voutside() since the 0.1
7 # release, but never manifested itself. It's invisible to the
8 # almighty eye of valgrind. It only shows itself when trying to
9 # get posterior probabilities from a different Outside function,
10 # in the case of this example: IOutside(), to which EPN propagated
11 # the bug from outside(). For this simple example, we have to use
12 # the posterior checking --checkpost option to actually see it.
13 # But in some cases it will crash cmalign without --checkpost.
14 # An example is described in
15 # ~/nawrockie/notebook/7_1108_inf_bug_outside_ambig_bps/00LOG.
16 #
17 # i12.1 = simple example alignment (1 seq)
18 # i12.2 = sequence to align (must contain an ambiguity code).
19
20 $usage = "perl bug-i12.pl <cmbuild> <cmalign>\n";
21 if ($#ARGV != 1) { die "Wrong argument number.\n$usage"; }
22
23 $cmbuild = shift;
24 $cmalign = shift;
25 $ok = 1;
26
27 # Make our test alignment file, i12.1
28 #
29 open (OUT, ">i12.1") || die;
30 print OUT <<END;
31 # STOCKHOLM 1.0
32
33 human ACG
34 #=GC SS_cons <:>
35 #=GC RF xxx
36 //
37 END
38 close OUT;
39
40 # Make our test sequence file, i12.2
41 #
42 open (OUT, ">i12.2") || die;
43 print OUT <<END;
44 >seq
45 CGN
46 END
47 close OUT;
48
49 if ($ok) {
50 system("$cmbuild -F --hand i12.cm i12.1 > /dev/null 2> /dev/null");
51 if ($? != 0) { $ok = 0; }
52 }
53 if ($ok) {
54 system("$cmalign --notrunc i12.cm i12.2 > /dev/null 2> /dev/null");
55 if ($? != 0) { $ok = 0; }
56 }
57
58 foreach $tmpfile ("i12.1", "i12.2", "i12.cm") {
59 unlink $tmpfile if -e $tmpfile;
60 }
61
62 if ($ok) { print "ok\n"; exit 0; }
63 else { print "FAILED\n"; exit 1; }
64
65