Debian Codegraph @

easel/miniapps/esl-construct.itest.pl

raw
1 #! /usr/bin/perl
2
3 # Integrated test of the esl-construct miniapp.
4 #
5 # Usage: ./esl-construct.itest.pl <esl-construct binary> <tmpfile prefix>
6 # Example: ./esl-construct.itest.pl ./esl-construct foo
7 #
8 # EPN, Tue Feb 2 13:19:44 2010
9
10 $eslconstruct= shift;
11 $tmppfx = shift;
12
13 if (! -x "$eslconstruct") { die "FAIL: didn't find esl-construct binary $eslconstruct"; }
14
15 open(ALIFILE, ">$tmppfx.1") || die "FAIL: couldn't open $tmppfx.1 for writing alifile";
16 print ALIFILE << "EOF";
17 # STOCKHOLM 1.0
18 #=GF AU Infernal 0.1
19
20 simpex-1 --AGA-CUUCG-GUCGCUCG-UAACAG
21 #=GR simpex-1 SS ..:<<-<____->>>-<<-<.___>>>
22 simpex-2 aaAAUACGUCGGCUG-AAUACCCAGUA
23 #=GR simpex-2 SS ..::<<<____>->>--<-.<___>>:
24 simpex-3 --ACGUUUUG-GAACGGG-U-CCAACC
25 #=GR simpex-3 SS ..::<<<____>->>-<<-<.___>>>
26 #=GC SS_cons ..::<<<____>->>-<<-<.___>>>
27 #=GC RF ..AAgaCUUCGGAucgggCg.AcAccc
28 //
29 EOF
30 close ALIFILE;
31
32 open(ALIFILE, ">$tmppfx.2") || die "FAIL: couldn't open $tmppfx.1 for writing alifile";
33 print ALIFILE << "EOF";
34 # STOCKHOLM 1.0
35 #=GF AU Infernal 0.1
36
37 simpex-1 --AGA-CUUCG-GUCGCUCG-UAACAG
38 simpex-2 aaAAUACGUCGGCUG-AAUACCCAGUA
39 simpex-3 --ACGUUUUG-GAACGGG-U-CCAACC
40 #=GC SS_cons ..::<<<____>->>-<<-<.___>>>
41 #=GC RF ..AAgaCUUCGGAucgggCg.AcAccc
42 //
43 EOF
44 close ALIFILE;
45
46 open(ALIFILE, ">$tmppfx.3") || die "FAIL: couldn't open $tmppfx.1 for writing alifile";
47 print ALIFILE << "EOF";
48 # STOCKHOLM 1.0
49 #=GF AU Infernal 0.1
50
51 simpex-1 --AGA-CUUCG-GUCGCUCG-UAACAG
52 #=GR simpex-1 SS ..:<<-<____->>>-<<-<.___>>>
53 simpex-2 aaAAUACGUCGGCUG-AAUACCCAGUA
54 #=GR simpex-2 SS ..::<<<____>->>--<-.<___>>:
55 simpex-3 --ACGUUUUG-GAACGGG-U-CCAACC
56 #=GR simpex-3 SS ..::<<<____>->>-<<-<.___>>>
57 //
58 EOF
59 close ALIFILE;
60
61 $output = `$eslconstruct -h`;
62 if ($? != 0) { die "FAIL: esl-construct failed unexpectedly"; }
63 if ($output !~ /Usage: esl-construct/) { die "FAIL: help output not right"; }
64
65 $output = `$eslconstruct $tmppfx.1 2>&1`;
66 if ($? != 0) { die "FAIL: esl-construct failed unexpectedly"; }
67 if ($output !~ / simpex-2 5 4 4 1/) { die "FAIL: structure stats calculated incorrectly"; }
68 if ($output !~ /SS\_cons\(consensus\) 6 6 6 0/) { die "FAIL: structure stats calculated incorrectly"; }
69 if ($output !~ /13\/ 17 \(0.765\) overlap/) { die "FAIL: structure stats calculated incorrectly"; }
70
71 $output = `$eslconstruct $tmppfx.2 2>&1`;
72 if ($? != 0) { die "FAIL: esl-construct failed unexpectedly"; }
73 if ($output !~ /SS\_cons\(consensus\) 6 6 6 0/) { die "FAIL: structure stats calculated incorrectly"; }
74
75 $output = `$eslconstruct $tmppfx.3 3>&1`;
76 if ($? != 0) { die "FAIL: esl-construct failed unexpectedly"; }
77 if ($output !~ /simpex-2 5/) { die "FAIL: structure stats calculated incorrectly"; }
78
79
80 $output = `$eslconstruct -a $tmppfx.1 2>&1`;
81 if ($? != 0) { die "FAIL: esl-construct failed unexpectedly"; }
82 if ($output !~ /More than 1 right mates for left mate 7 7: 12 bp exists in 2\/ 3 seqs/) { die "FAIL: structure stats calculated incorrectly"; }
83 if ($output !~ /More than 1 right mates for left mate 7 7: 13 bp exists in 1\/ 3 seqs/) { die "FAIL: structure stats calculated incorrectly"; }
84 if ($output !~ /More than 1 left mates for right mate 25 20: 25 bp exists in 2\/ 3 seqs/) { die "FAIL: structure stats calculated incorrectly"; }
85 if ($output !~ /More than 1 left mates for right mate 25 21: 25 bp exists in 1\/ 3 seqs/) { die "FAIL: structure stats calculated incorrectly"; }
86
87 $output = `$eslconstruct -v $tmppfx.1 2>&1`;
88 if ($? != 0) { die "FAIL: esl-construct failed unexpectedly"; }
89 if ($output !~ / simpex-2 5 4 4 1/) { die "FAIL: structure stats calculated incorrectly"; }
90 if ($output !~ /SS\_cons\(consensus\) 6 6 6 0/) { die "FAIL: structure stats calculated incorrectly"; }
91 if ($output !~ /13\/ 17 \(0.76\d+\) overlap/) { die "FAIL: structure stats calculated incorrectly"; }
92 if ($output !~ /ali: 1 seq 0 \(simpex-1\) bp 5: 14 conflicts with consensus bp 5: 15/) { die "FAIL: structure stats calculated incorrectly"; }
93
94
95 system("$eslconstruct -o $tmppfx.stk -x $tmppfx.1 > /dev/null");
96 if ($? != 0) { die "FAIL: esl-construct failed unexpectedly"; }
97 $output = `cat $tmppfx.stk`;
98 if ($output !~ /\#=GC SS_cons ::::::::::::::::<<_______>>/) { die "FAIL: consensus structure calculated incorrectly"; }
99
100 system("$eslconstruct -o $tmppfx.stk -r $tmppfx.1 > /dev/null");
101 if ($? != 0) { die "FAIL: esl-construct failed unexpectedly"; }
102 $output = `cat $tmppfx.stk`;
103 if ($output !~ /\#=GC SS_cons :::::<_______>::<<_______>>/) { die "FAIL: consensus structure calculated incorrectly"; }
104
105 system("$eslconstruct -o $tmppfx.stk -c $tmppfx.1 > /dev/null");
106 if ($? != 0) { die "FAIL: esl-construct failed unexpectedly"; }
107 $output = `cat $tmppfx.stk`;
108 if ($output !~ /#=GC SS_cons ::::<<<____>->>:<<-<____>>>/) { die "FAIL: consensus stucture calculated incorrectly"; }
109
110 system("$eslconstruct -o $tmppfx.stk -c --rfc $tmppfx.1 > /dev/null");
111 if ($? != 0) { die "FAIL: esl-construct failed unexpectedly"; }
112 $output = `cat $tmppfx.stk`;
113 if ($output !~ /#=GC SS_cons ::::<<<____>->>:<<-<____>>>/) { die "FAIL: consensus stucture calculated incorrectly"; }
114 if ($output !~ /#=GC RF --ACGUUUUG-GAACGGG-U-CCAACC/) { die "FAIL: consensus stucture calculated incorrectly"; }
115
116 system("$eslconstruct -o $tmppfx.stk --indi simpex-2 $tmppfx.1 > /dev/null");
117 if ($? != 0) { die "FAIL: esl-construct failed unexpectedly"; }
118 $output = `cat $tmppfx.stk`;
119 if ($output !~ /\#=GC SS_cons ::::<<<____>->>::<--<___>>:/) { die "FAIL: consensus stucture calculated incorrectly"; }
120
121 system("$eslconstruct -o $tmppfx.stk --indi simpex-2 --rfindi $tmppfx.1 > /dev/null");
122 if ($? != 0) { die "FAIL: esl-construct failed unexpectedly"; }
123 $output = `cat $tmppfx.stk`;
124 if ($output !~ /\#=GC SS_cons ::::<<<____>->>::<--<___>>:/) { die "FAIL: consensus stucture calculated incorrectly"; }
125 if ($output !~ /\#=GC RF AAAAUACGUCGGCUG-AAUACCCAGUA/) { die "FAIL: consensus stucture calculated incorrectly"; }
126
127 system("$eslconstruct -o $tmppfx.stk --ffreq 0.6 $tmppfx.1 > /dev/null");
128 if ($? != 0) { die "FAIL: esl-construct failed unexpectedly"; }
129 $output = `cat $tmppfx.stk`;
130 if ($output !~ /#=GC SS_cons ::::<<<____>->>:<<-<____>>>/) { die "FAIL: consensus stucture calculated incorrectly"; }
131
132 system("$eslconstruct -o $tmppfx.stk --ffreq 0.7 $tmppfx.1 > /dev/null");
133 if ($? != 0) { die "FAIL: esl-construct failed unexpectedly"; }
134 $output = `cat $tmppfx.stk`;
135 if ($output !~ /#=GC SS_cons :::::::::::::::::<_______>:/) { die "FAIL: consensus stucture calculated incorrectly"; }
136
137 system("$eslconstruct -o $tmppfx.stk --fmin $tmppfx.1 > /dev/null");
138 if ($? != 0) { die "FAIL: esl-construct failed unexpectedly"; }
139 $output = `cat $tmppfx.stk`;
140 if ($output !~ /#=GC SS_cons ::::<<<____>->>:<<-<____>>>/) { die "FAIL: consensus stucture calculated incorrectly"; }
141
142 system("$eslconstruct -l $tmppfx.list -o $tmppfx.stk --fmin $tmppfx.1 > /dev/null");
143 if ($? != 0) { die "FAIL: esl-construct failed unexpectedly"; }
144 $output = `cat $tmppfx.list`;
145 if ($output !~ /simpex-1/) { die "FAIL: consensus stucture calculated incorrectly"; }
146 if ($output !~ /simpex-2/) { die "FAIL: consensus stucture calculated incorrectly"; }
147
148 system("$eslconstruct --lmax 1 -l $tmppfx.list -o $tmppfx.stk --fmin $tmppfx.1 > /dev/null");
149 if ($? != 0) { die "FAIL: esl-construct failed unexpectedly"; }
150 $output = `cat $tmppfx.list`;
151 if ($output !~ /simpex-1/) { die "FAIL: consensus stucture calculated incorrectly"; }
152 if ($output =~ /simpex-2/) { die "FAIL: consensus stucture calculated incorrectly"; }
153
154 print "ok\n";
155 unlink "$tmppfx.1";
156 unlink "$tmppfx.2";
157 unlink "$tmppfx.3";
158 unlink "$tmppfx.stk";
159 unlink "$tmppfx.list";
160 exit 0;