Skip to content

Commit 0b3c311

Browse files
authored
Merge pull request #7 from jlab/fix_stefanstyletests
Fix stefanstyletests
2 parents 28f48e2 + a32ff3a commit 0b3c311

9 files changed

Lines changed: 1010 additions & 1001 deletions

File tree

Misc/Applications/lib/foldGrammars/Testing.pm

Lines changed: 36 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ our @knotinframe_ALLMODES = ($Settings::MODE_KIF);
2424
our @pAliKiss_ALLMODES = ($Settings::MODE_MFE, $Settings::MODE_SUBOPT, $Settings::MODE_ENFORCE, $Settings::MODE_LOCAL, $Settings::MODE_SHAPES, $Settings::MODE_PROBS);
2525

2626
our $pAliKiss = {
27-
' ' => { values => [$inputFileDir.'t-box.aln',$inputFileDir.'tRNA_example_ungap.aln',$inputFileDir.'trp_attenuator.aln'],
28-
secondValues => ["'.........................................(((...)))((((.....................................))))..........................................................................'","'(((((((..(((..((...))....)))..((((.......))))......(((((.......)))))))))))).'","'.((....(((.((((.....)))).))).......))...............'"],
27+
' ' => { values => [$inputFileDir.'t-box.aln',$inputFileDir.'tRNA_example_ungap.aln',$inputFileDir.'trp_attenuator.aln'],
28+
secondValues => ["'.........................................(((...)))((((.....................................))))..........................................................................'","'(((((((..(((..((...))....)))..((((.......))))......(((((.......)))))))))))).'","'.((....(((.((((.....)))).))).......))...............'"],
2929
valueSelection => $VALUE_SELECTION_RANDOM,
3030
modes => \@pAliKiss_ALLMODES},
3131

@@ -56,8 +56,8 @@ our $pAliKiss = {
5656
};
5757

5858
our $RNAalishapes = {
59-
' ' => { values => [$inputFileDir.'t-box.aln',$inputFileDir.'tRNA_example_ungap.aln',$inputFileDir.'trp_attenuator.aln'],
60-
secondValues => ["'.........................................(((...)))((((.....................................))))..........................................................................'","'(((((((..(((..((...))....)))..((((.......))))......(((((.......)))))))))))).'","'.((....(((.((((.....)))).))).......))...............'"],
59+
' ' => { values => [$inputFileDir.'t-box.aln',$inputFileDir.'tRNA_example_ungap.aln',$inputFileDir.'trp_attenuator.aln'],
60+
secondValues => ["'.........................................(((...)))((((.....................................))))..........................................................................'","'(((((((..(((..((...))....)))..((((.......))))......(((((.......)))))))))))).'","'.((....(((.((((.....)))).))).......))...............'"],
6161
valueSelection => $VALUE_SELECTION_RANDOM,
6262
modes => \@RNAalishapes_ALLMODES},
6363

@@ -89,8 +89,8 @@ our $RNAalishapes = {
8989
};
9090

9191
our $pKiss = {
92-
' ' => { values => ['ACCCUACUGUGCUAACCGAACCAGAUAACGGUACAGUAGGGGUAAAUUCUCCGCAUUCGGUGCGGAAAA','AAGGGCGUCGUCGCCCCGAGUCGUAGCAGUUGACUACUGUUAUGU','gGGCCGGGCGCGGUGGCGCGCGCCUGUAGUCCCAGCUACUCGGGAGGCUC'],
93-
secondValues => ["'.[[[[[[[[[[[[..........{{....]]]]]]]]]]]]........<<<<<<<}}.>>>>>>>...'","'..[[[[[.{{.]]]]].....<<<<<<<<<}}...>>>>>>>>>.'","'....[[[[[[[[.{{{{.]]]]]]]]...<<<<.}}}}...>>>>.....'"],
92+
' ' => { values => ['ACCCUACUGUGCUAACCGAACCAGAUAACGGUACAGUAGGGGUAAAUUCUCCGCAUUCGGUGCGGAAAA','AAGGGCGUCGUCGCCCCGAGUCGUAGCAGUUGACUACUGUUAUGU','gGGCCGGGCGCGGUGGCGCGCGCCUGUAGUCCCAGCUACUCGGGAGGCUC'],
93+
secondValues => ["'.[[[[[[[[[[[[..........{{....]]]]]]]]]]]]........<<<<<<<}}.>>>>>>>...'","'..[[[[[.{{.]]]]].....<<<<<<<<<}}...>>>>>>>>>.'","'....[[[[[[[[.{{{{.]]]]]]]]...<<<<.}}}}...>>>>.....'"],
9494
valueSelection => $VALUE_SELECTION_RANDOM,
9595
modes => \@pKiss_ALLMODES},
9696

@@ -115,11 +115,11 @@ our $pKiss = {
115115
};
116116

117117
our $RNAshapes = {
118-
' ' => { values => ['ACCCUACUGUGCUAACCGAACCAGAUAACGGUACAGUAGGGGUAAAUUCUCCGCAUUCGGUGCGGAAAA','AAGGGCGUCGUCGCCCCGAGUCGUAGCAGUUGACUACUGUUAUGU','gGGCCGGGCGCGGUGGCGCGCGCCUGUAGUCCCAGCUACUCGGGAGGCUC'],
119-
secondValues => ["'.((((((((((((................))))))))))))........(((((((...)))))))...'","'..(((((....))))).....(((((((((.....))))))))).'","'.((.((.((((....)))).)))).....((((........)))).....'"],
118+
' ' => { values => ['ACCCUACUGUGCUAACCGAACCAGAUAACGGUACAGUAGGGGUAAAUUCUCCGCAUUCGGUGCGGAAAA','AAGGGCGUCGUCGCCCCGAGUCGUAGCAGUUGACUACUGUUAUGU','gGGCCGGGCGCGGUGGCGCGCGCCUGUAGUCCCAGCUACUCGGGAGGCUC'],
119+
secondValues => ["'.((((((((((((................))))))))))))........(((((((...)))))))...'","'..(((((....))))).....(((((((((.....))))))))).'","'.((.((.((((....)))).)))).....((((........)))).....'"],
120120
valueSelection => $VALUE_SELECTION_RANDOM,
121121
modes => \@RNAshapes_ALLMODES},
122-
122+
123123
'mode' => {modes => \@RNAshapes_ALLMODES, values => \@RNAshapes_ALLMODES, valueSelection => $VALUE_SELECTION_ALL},
124124
'windowSize' => {modes => [$Settings::MODE_MFE, $Settings::MODE_SUBOPT, $Settings::MODE_SHAPES, $Settings::MODE_PROBS, $Settings::MODE_SAMPLE], values => [undef, undef, 40, 100], valueSelection => $VALUE_SELECTION_ALL},
125125
'windowIncrement' => {modes => [$Settings::MODE_MFE, $Settings::MODE_SUBOPT, $Settings::MODE_SHAPES, $Settings::MODE_PROBS, $Settings::MODE_SAMPLE], values => [10, 20, 30], valueSelection => $VALUE_SELECTION_RANDOM},
@@ -146,8 +146,8 @@ our $RNAshapes = {
146146
};
147147

148148
our $Knotinframe = {
149-
' ' => { values => [$inputFileDir.'knotinframe_test.fas'],
150-
secondValues => [],
149+
' ' => { values => [$inputFileDir.'knotinframe_test.fas'],
150+
secondValues => [],
151151
valueSelection => $VALUE_SELECTION_RANDOM,
152152
modes => \@knotinframe_ALLMODES},
153153

@@ -163,12 +163,12 @@ our $Knotinframe = {
163163

164164
sub permutate {
165165
my ($refHash_parameter, $refList_permutations) = @_;
166-
166+
167167
my @availParameters = ();
168168
foreach my $param (sort {$a cmp $b} keys(%{$refHash_parameter})) {
169169
push @availParameters, $param if ($refHash_parameter->{$param}->{valueSelection} eq $VALUE_SELECTION_ALL);
170170
}
171-
171+
172172
if (@availParameters > 0) {
173173
my @newPermutations = ();
174174
my $parameter = $availParameters[0];
@@ -200,16 +200,16 @@ sub addRandomParameters {
200200
if (Utils::contains($refHash_parameter->{$parameter}->{modes}, $refHash_call->{mode})) {
201201
next if ((($parameter eq 'absoluteDeviation') && ($refHash_call->{call} =~ m/relativeDeviation/)) || (($parameter eq 'relativeDeviation') && ($refHash_call->{call} =~ m/absoluteDeviation/)));
202202
my @values = @{$refHash_parameter->{$parameter}->{values}};
203-
203+
204204
if (exists $refHash_call->{allowLP}) {
205205
@values = (1) if ($parameter eq 'absoluteDeviation' || $parameter eq 'relativeDeviation'); #otherwise tests will have to high runtime
206206
@values = (0.01) if ($parameter eq 'lowProbFilter'); #otherwise tests will have to high runtime
207207
@values = (5) if ($parameter eq 'shapeLevel');
208208
}
209-
209+
210210
@values = (2) if ($parameter eq 'minHairpinLength' && $refHash_call->{mode} eq $Settings::MODE_ABSTRACT);
211211
$refHash_call->{call} =~ s/--allowLP=1// if ($refHash_call->{mode} eq $Settings::MODE_CAST);
212-
212+
213213
my $randomIndex = int(rand scalar(@values));
214214
my $value = $values[$randomIndex];
215215
$value = substr($value, 0, 30) if (($parameter eq ' ') && ($refHash_call->{call} =~ m/\-\-mode=probing/)); #prevent too long sequences to avoid too large pareto fronts
@@ -238,10 +238,15 @@ sub addRandomParameters {
238238

239239
sub evaluateTest {
240240
my ($testname, $truth, $TMPDIR, $testIndex, $refList_failedTests) = @_;
241-
241+
242242
my $status = 'failed';
243243
if (-e "Truth/".$truth) {
244-
my $diffResult = Utils::execute("diff -I \"^#CMD:\" Truth/$truth $TMPDIR/$truth"); chomp $diffResult;
244+
# Replace concrete prefix file paths from executed test file with generic ROOTDIR and BGAPDIR strings.
245+
# Thus, recording truth on one system and testing at another should not result in different CMD lines.
246+
# ToDo: Binaries are compiled in an arch dependent subdirectory, e.g. x86_64-linux-gnu, which will surely differ on systems like OSX!
247+
Utils::execute(Settings::getBinary('cat')." $TMPDIR/$truth | ".Settings::getBinary('sed')." \"s#$Settings::rootDir#ROOTDIR#g\" | ".Settings::getBinary('sed')." \"s#$Settings::bgapDir#BGAPDIR#g\" > $TMPDIR/${truth}_noprefix");
248+
249+
my $diffResult = Utils::execute(Settings::getBinary('diff')." -I \"^Cluster info \(\" Truth/${truth} $TMPDIR/${truth}_noprefix"); chomp $diffResult;
245250
if ($diffResult eq "") {
246251
$status = 'passed';
247252
} else {
@@ -250,36 +255,40 @@ sub evaluateTest {
250255
} else {
251256
print "truth file 'Truth/$truth' does not exist!\n";
252257
}
253-
258+
254259
if ($status eq 'passed') {
255260
print "==-== test ".$testIndex.") '".$testname."' PASSED ==-==\n\n";
256261
} else {
257262
print "==-== test ".$testIndex.") '".$testname."' FAILED ==-==\n\n";
258263
push @{$refList_failedTests}, $testname;
259264
}
260-
265+
261266
$testIndex++;
262-
267+
263268
return $testIndex;
264269
}
265270

266271
sub printStatistics {
267272
my ($testIndex, $refList_failedTests) = @_;
268-
273+
269274
my $maxLen = 30;
270275
foreach my $test (@{$refList_failedTests}) {
271276
$maxLen = length($test) if (length($test) > $maxLen);
272277
}
273-
274-
print "=" x ($maxLen+6+4)."\n";
278+
279+
print "=" x ($maxLen+6+4)."\n";
275280
print "|| PASSED: ".sprintf("% 3i", $testIndex-1-scalar(@{$refList_failedTests}))." | FAILED: ".sprintf("% 3i", scalar(@{$refList_failedTests})).(" " x ($maxLen - 26))."||\n";
276281
if (@{$refList_failedTests} > 0) {
277-
print "|| follwing tests failed:".(" " x ($maxLen-17))."||\n";
282+
print "|| follwing tests failed:".(" " x ($maxLen-17))."||\n";
278283
foreach my $testname (@{$refList_failedTests}) {
279284
print "|| - '$testname'".(" " x ($maxLen-length($testname)+1))."||\n";
280285
}
281286
}
282-
print "=" x ($maxLen+6+4)."\n";
287+
print "=" x ($maxLen+6+4)."\n";
288+
289+
if (@{$refList_failedTests} > 0) {
290+
exit(1);
291+
}
283292
}
284293

285-
1;
294+
1;

Misc/Test-Suite/StefanStyle/Truth/knotinframe.run.out

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#CMD: perl -I ../../Applications/lib/ x86_64-linux-gnu/knotinframe --binPath='x86_64-linux-gnu/x86_64-linux-gnu/' --mode=kif --minenergydifference=-8.71 --minknottedenergy=-10 /vol/fold-grammars/src/Misc/Test-Suite/StefanStyle/knotinframe_test.fas --numberoutputs=15 --param=/vol/gapc/share/gapc/librna/rna_turner2004.par --temperature=17 --windowincrement=40 --windowsize=120
1+
#CMD: perl -I ../../Applications/lib/ x86_64-linux-gnu/knotinframe --binPath='x86_64-linux-gnu/x86_64-linux-gnu/' --mode=kif --minenergydifference=-8.71 --minknottedenergy=-10 ROOTDIR/Misc/Test-Suite/StefanStyle/knotinframe_test.fas --numberoutputs=15 --param=BGAPDIR/share/gapc/librna/rna_turner2004.par --temperature=17 --windowincrement=40 --windowsize=120
22
>pol_m_vir_hastr
33
Rank: 1
44
Slippery sequence: CCCTTTT
@@ -31,7 +31,7 @@
3131
-11.63 ...(((...)))...((((...(((((...((...))...)))))........))))... nested structure
3232

3333

34-
#CMD: perl -I ../../Applications/lib/ x86_64-linux-gnu/knotinframe --binPath='x86_64-linux-gnu/x86_64-linux-gnu/' --mode=kif --minenergydifference=-8.71 --minknottedenergy=-7.4 /vol/fold-grammars/src/Misc/Test-Suite/StefanStyle/knotinframe_test.fas --numberoutputs=5 --param=/vol/gapc/share/gapc/librna/rna_turner2004.par --temperature=25.9 --windowincrement=20 --windowsize=160
34+
#CMD: perl -I ../../Applications/lib/ x86_64-linux-gnu/knotinframe --binPath='x86_64-linux-gnu/x86_64-linux-gnu/' --mode=kif --minenergydifference=-8.71 --minknottedenergy=-7.4 ROOTDIR/Misc/Test-Suite/StefanStyle/knotinframe_test.fas --numberoutputs=5 --param=BGAPDIR/share/gapc/librna/rna_turner2004.par --temperature=25.9 --windowincrement=20 --windowsize=160
3535
>pol_m_vir_hastr
3636
Rank: 1
3737
Slippery sequence: CCCTTTT
@@ -64,7 +64,7 @@
6464
-8.84 ...........((.((....(((((.....((...))....)))))......)).))... nested structure
6565

6666

67-
#CMD: perl -I ../../Applications/lib/ x86_64-linux-gnu/knotinframe --binPath='x86_64-linux-gnu/x86_64-linux-gnu/' --mode=kif --minenergydifference=-8.71 --minknottedenergy=-5 /vol/fold-grammars/src/Misc/Test-Suite/StefanStyle/knotinframe_test.fas --numberoutputs=5 --param=/vol/gapc/share/gapc/librna/rna_turner2004.par --temperature=17 --windowincrement=20 --windowsize=80
67+
#CMD: perl -I ../../Applications/lib/ x86_64-linux-gnu/knotinframe --binPath='x86_64-linux-gnu/x86_64-linux-gnu/' --mode=kif --minenergydifference=-8.71 --minknottedenergy=-5 ROOTDIR/Misc/Test-Suite/StefanStyle/knotinframe_test.fas --numberoutputs=5 --param=BGAPDIR/share/gapc/librna/rna_turner2004.par --temperature=17 --windowincrement=20 --windowsize=80
6868
>pol_m_vir_hastr
6969
Rank: 1
7070
Slippery sequence: CCCTTTT
@@ -97,7 +97,7 @@
9797
-11.63 ...(((...)))...((((...(((((...((...))...)))))........))))... nested structure
9898

9999

100-
#CMD: perl -I ../../Applications/lib/ x86_64-linux-gnu/knotinframe --binPath='x86_64-linux-gnu/x86_64-linux-gnu/' --mode=kif --minenergydifference=-10.34 --minknottedenergy=-10 /vol/fold-grammars/src/Misc/Test-Suite/StefanStyle/knotinframe_test.fas --numberoutputs=15 --param=/vol/gapc/share/gapc/librna/rna_turner2004.par --temperature=25.9 --windowincrement=20 --windowsize=80
100+
#CMD: perl -I ../../Applications/lib/ x86_64-linux-gnu/knotinframe --binPath='x86_64-linux-gnu/x86_64-linux-gnu/' --mode=kif --minenergydifference=-10.34 --minknottedenergy=-10 ROOTDIR/Misc/Test-Suite/StefanStyle/knotinframe_test.fas --numberoutputs=15 --param=BGAPDIR/share/gapc/librna/rna_turner2004.par --temperature=25.9 --windowincrement=20 --windowsize=80
101101
>pol_m_vir_hastr
102102
Rank: 1
103103
Slippery sequence: CCCTTTT
@@ -130,7 +130,7 @@
130130
-8.84 ...........((.((....(((((.....((...))....)))))......)).))... nested structure
131131

132132

133-
#CMD: perl -I ../../Applications/lib/ x86_64-linux-gnu/knotinframe --binPath='x86_64-linux-gnu/x86_64-linux-gnu/' --mode=kif --minenergydifference=-10.34 --minknottedenergy=-7.4 /vol/fold-grammars/src/Misc/Test-Suite/StefanStyle/knotinframe_test.fas --numberoutputs=15 --param=/vol/gapc/share/gapc/librna/rna_turner2004.par --temperature=37 --windowincrement=20 --windowsize=160
133+
#CMD: perl -I ../../Applications/lib/ x86_64-linux-gnu/knotinframe --binPath='x86_64-linux-gnu/x86_64-linux-gnu/' --mode=kif --minenergydifference=-10.34 --minknottedenergy=-7.4 ROOTDIR/Misc/Test-Suite/StefanStyle/knotinframe_test.fas --numberoutputs=15 --param=BGAPDIR/share/gapc/librna/rna_turner2004.par --temperature=37 --windowincrement=20 --windowsize=160
134134
>pol_m_vir_hastr
135135
Rank: 1
136136
Slippery sequence: CCCTTTT
@@ -163,7 +163,7 @@
163163
-6.20 ...........((.((....(((((................)))))......)).))... nested structure
164164

165165

166-
#CMD: perl -I ../../Applications/lib/ x86_64-linux-gnu/knotinframe --binPath='x86_64-linux-gnu/x86_64-linux-gnu/' --mode=kif --minenergydifference=-10.34 --minknottedenergy=-5 /vol/fold-grammars/src/Misc/Test-Suite/StefanStyle/knotinframe_test.fas --numberoutputs=15 --param=/vol/gapc/share/gapc/librna/rna_turner2004.par --temperature=25.9 --windowincrement=20 --windowsize=120
166+
#CMD: perl -I ../../Applications/lib/ x86_64-linux-gnu/knotinframe --binPath='x86_64-linux-gnu/x86_64-linux-gnu/' --mode=kif --minenergydifference=-10.34 --minknottedenergy=-5 ROOTDIR/Misc/Test-Suite/StefanStyle/knotinframe_test.fas --numberoutputs=15 --param=BGAPDIR/share/gapc/librna/rna_turner2004.par --temperature=25.9 --windowincrement=20 --windowsize=120
167167
>pol_m_vir_hastr
168168
Rank: 1
169169
Slippery sequence: CCCTTTT

0 commit comments

Comments
 (0)