Debian Codegraph @

hmmer/testsuite/i3-seqsearch-variation.sh

raw symbols SCIP
1 #! /bin/sh
2 #
3 # Verify that phmmer/jackhmmer runs are reproducible (no stochastic variation),
4 # unless the RNG seed is deliberately varied.
5 #
6 # Example sequences here are carefully chosen to exercise stochastic clustering
7 # algorithm in domain postprocessing pipeline. [xref 2019/0410-h3-test-failures]
8 #
9 if test ! $# -eq 2; then
10 echo "Usage: $0 <phmmer/jackhmmer binary> <tmpfile prefix>"
11 exit 1
12 fi
13
14 prog=$1; if test ! -x $prog; then echo "FAIL: $prog not executable"; exit 1; fi
15 tmppfx=$2
16
17 # This is the 1st sequence in tutorial/fn3.sto
18 cat > ${tmppfx}.fa1 <<EOF
19 >LAR_DROME/418-503 P16621.2
20 SAPRNVQVRTLSSSTMVITWEPPETPNGQVTGYKVYYTTNSNQPEASWNSQMVDNSELTT
21 VSELTPHAIYTVRVQAYTSMGAGPMS
22 EOF
23
24 # This is a swissprot fragment that exercises stochastic clustering algorithm.
25 cat > ${tmppfx}.fa2 <<EOF
26 >sp|Q3UH53|SDK1_MOUSE/1564-1772 Protein sidekick-1 OS=Mus musculus OX=10090 GN=Sdk1 PE=1 SV=1
27 PGSVSATPHTTSSVLIQWQPPRDESLNGLLQGYRIYYRELESETGMSPEPKTLKSPSALR
28 AELTAQSSFKTVNSSSSLTTYELTHLKKYRRYEVIMTAYNIIGESPASVPVEVFVGEAAP
29 AMAPQNVQVTPLTASQLEVTWDPPPPESQNGNIQGYKVYYWEADSRNETEKMKVLFLPEP
30 VVKIKDLTSHTKYLISISAFNAAGDGPKS
31 EOF
32
33 # Running with default seed shows identical results... (a D=3 domain solution)
34 $prog ${tmppfx}.fa1 ${tmppfx}.fa2 > ${tmppfx}.out; if test $? -ne 0; then echo "FAIL: crash"; exit 1; fi
35 cat ${tmppfx}.out | grep -v "^#" > ${tmppfx}.out1
36 $prog ${tmppfx}.fa1 ${tmppfx}.fa2 > ${tmppfx}.out; if test $? -ne 0; then echo "FAIL: crash"; exit 1; fi
37 cat ${tmppfx}.out | grep -v "^#" > ${tmppfx}.out2
38 diff ${tmppfx}.out1 ${tmppfx}.out2 > /dev/null; if test $? -ne 0; then echo "FAIL: results differ"; exit 1; fi
39
40 # but running with different seeds shows different results. (D=3 and D=2 solutions)
41 $prog --seed 1 ${tmppfx}.fa1 ${tmppfx}.fa2 > ${tmppfx}.out; if test $? -ne 0; then echo "FAIL: crash"; exit 1; fi
42 cat ${tmppfx}.out | grep -v "^#" > ${tmppfx}.out3
43 $prog --seed 2 ${tmppfx}.fa1 ${tmppfx}.fa2 > ${tmppfx}.out; if test $? -ne 0; then echo "FAIL: crash"; exit 1; fi
44 cat ${tmppfx}.out | grep -v "^#" > ${tmppfx}.out4
45 diff ${tmppfx}.out3 ${tmppfx}.out4 > /dev/null; if test $? -eq 0; then echo "FAIL: results identical despite different RNG seeds"; exit 1; fi
46
47 rm ${tmppfx}.fa1 ${tmppfx}.fa2 ${tmppfx}.out ${tmppfx}.out1 ${tmppfx}.out2 ${tmppfx}.out3 ${tmppfx}.out4
48
49 echo "ok"
50 exit 0