Debian Codegraph @

testsuite/bug-i14.pl

raw
1 #! /usr/bin/perl
2
3 # bug i14 - cmalign HMM banded optimal accuracy alignment seg faults
4 # in certain cases when aligning to --enone built models.
5 #
6 # EPN, Fri Jun 12 16:49:11 2009
7 #
8 # In rare cases when aligning to a CM using HMM banded optimal accuracy,
9 # the optimal parse, the parse that maximizes the summed posterior labelling
10 # of all emitted residues, requires making an illegal transition.
11 # Specifically a transition from a v,j,d subtree where d==0 and
12 # j and d are perfectly legal (within the hmm bands) to a y,j,d
13 # subtree where d = 0 that is ILLEGAL in that j is outside the
14 # j band on y, or d=0 is outside the d band for y and j.
15 # This caused a seg fault in version 1.0 of infernal.
16 #
17 # The 'fix' for this is not perfect, but does remove the seg fault
18 # behavior. Now the alignment forces the illegal parse tree to
19 # become legal, which does not cause any problems because d=0, that
20 # is, no residues are emitted from the illegal subtree.
21 #
22 # However, it is unnerving that an illegal parse is being allowed
23 # and manifests itself only in the trace file (--tfile <x>) by
24 # showing an illegal parse and a EL end in global mode. The specific
25 # reason for this is due to the way the optimal accuracy algorithm
26 # is implemented (cells get initialized to EL) and is explained
27 # more in ~nawrockie/notebook/9_0612_inf_bug_cmalign_enone.
28 #
29 #
30 # bug-i14.sto = Brian's training alignment.
31 # bug-i14.fa = Brian's 8 sequences to align, crashes on seq 8, only
32 # crashes if all 8 are present.
33
34 $usage = "perl bug-i14.pl <cmbuild> <cmalign> <path to bug-i14.sto> <path to bug-i14.fa>\n";
35 if ($#ARGV != 3) { die "Wrong argument number.\n$usage"; }
36
37 $cmbuild = shift;
38 $cmalign = shift;
39 $alifile = shift;
40 $seqfile = shift;
41 $ok = 1;
42
43 if ($ok) {
44 system("$cmbuild --wnone --enone -F i14.cm $alifile > /dev/null 2> /dev/null");
45 if ($? != 0) { $ok = 0; }
46 }
47 if ($ok) {
48 system("$cmalign --notrunc i14.cm $seqfile > /dev/null 2> /dev/null");
49 if ($? != 0) { $ok = 0; }
50 }
51
52 foreach $tmpfile ("i14.cm") {
53 unlink $tmpfile if -e $tmpfile;
54 }
55
56 if ($ok) { print "ok\n"; exit 0; }
57 else { print "FAILED\n"; exit 1; }
58
59