Debian Codegraph @

hmmer/testsuite/i2-search-variation.sh

raw symbols SCIP
1 #! /bin/sh
2 #
3 # Verify that hmmsearch/hmmscan runs are reproducible (no stochastic variation)
4 #
5 if test ! $# -eq 4; then
6 echo "Usage: $0 <hmmscan/hmmsearch binary> <query hmmfile> <target seqfile> <tmpfile prefix>"
7 exit 1
8 fi
9
10
11 prog=$1; if test ! -x $prog; then echo "FAIL: $prog not executable"; exit 1; fi
12 hmmfile=$2; if test ! -r $hmmfile; then echo "FAIL: $hmmfile not readable"; exit 1; fi
13 seqfile=$3; if test ! -r $seqfile; then echo "FAIL: $seqfile not readable"; exit 1; fi
14 tmppfx=$4
15
16 # Running with default seed shows identical results
17 $prog $hmmfile $seqfile > $tmppfx.out; if test $? -ne 0; then echo "FAIL: crash"; exit 1; fi
18 cat $tmppfx.out | grep -v "^#" > $tmppfx.out1
19 $prog $hmmfile $seqfile > $tmppfx.out; if test $? -ne 0; then echo "FAIL: crash"; exit 1; fi
20 cat $tmppfx.out | grep -v "^#" > $tmppfx.out2
21
22 diff $tmppfx.out1 $tmppfx.out2 > /dev/null
23 if test $? -ne 0
24 then
25 echo "FAIL: results differ"
26 exit 1
27 fi
28
29 # Running with different seeds shows stochastically differing results
30 $prog --seed 2 $hmmfile $seqfile > $tmppfx.out; if test $? -ne 0; then echo "FAIL: crash"; exit 1; fi
31 cat $tmppfx.out | grep -v "^#" > $tmppfx.out1
32 $prog --seed 3 $hmmfile $seqfile > $tmppfx.out; if test $? -ne 0; then echo "FAIL: crash"; exit 1; fi
33 cat $tmppfx.out | grep -v "^#" > $tmppfx.out2
34
35 diff $tmppfx.out1 $tmppfx.out2 > /dev/null
36 if test $? -eq 0
37 then
38 echo "FAIL: results are the same despite different rng seeds"
39 exit 1
40 fi
41
42 rm $tmppfx.out $tmppfx.out1 $tmppfx.out2
43
44 echo "ok"
45 exit 0
46