File: i1-build-variation.sh

package info (click to toggle)
hmmer 3.2.1%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 23,380 kB
  • sloc: ansic: 119,305; perl: 8,791; sh: 3,266; makefile: 1,871; python: 598
file content (67 lines) | stat: -rwxr-xr-x 1,828 bytes parent folder | download | duplicates (12)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#! /bin/sh

# Usage: ./i1-hmmbuild.sh <hmmbuild binary> <MSA file> <tmpfile prefix for filenames>
#
# Verifies that hmmbuild builds HMMs reproducibly (no stochastic run-to-run variation by default).
#
if test ! $# -eq 3; then 
  echo "Usage: $0 <hmmbuild binary> <MSA file> <tmpfile prefix>"
  exit 1
fi

hmmbuild=$1;  if test ! -x $hmmbuild;   then echo "FAIL: $hmmbuild not executable";  exit 1; fi
alifile=$2;   if test ! -r $alifile;    then echo "FAIL: $alifile not readable";     exit 1; fi

hmmfile1=$3.1.hmm
hmmfile2=$3.2.hmm
outfile1=$3.1.out
outfile2=$3.2.out
diffile1=$3.1
diffile2=$3.2

# By default: no stochastic variation
$hmmbuild $hmmfile1 $alifile > $outfile1;  if test $? -ne 0; then echo "FAIL: crash"; exit 1; fi
$hmmbuild $hmmfile2 $alifile > $outfile2;  if test $? -ne 0; then echo "FAIL: crash"; exit 1; fi

cat $outfile1 | grep -v "^#" > $diffile1
cat $outfile2 | grep -v "^#" > $diffile2
diff $diffile1 $diffile2 > /dev/null
if test $? -ne 0 
then 
   echo "FAIL: output files differ"
   exit 1
fi

cat $hmmfile1| grep -v "^DATE" > $diffile1
cat $hmmfile2| grep -v "^DATE" > $diffile2
diff $diffile1 $diffile2 > /dev/null
if test $? -ne 0 
then 
   echo "FAIL: HMM files differ"
   exit 1
fi

# With different seeds: HMM files will differ because of statistical fits
$hmmbuild --seed 1 $hmmfile1 $alifile > $outfile1;  if test $? -ne 0; then echo "FAIL: crash"; exit 1; fi
$hmmbuild --seed 2 $hmmfile2 $alifile > $outfile2;  if test $? -ne 0; then echo "FAIL: crash"; exit 1; fi

cat $hmmfile1| grep -v "^DATE" > $diffile1
cat $hmmfile2| grep -v "^DATE" > $diffile2
diff $diffile1 $diffile2 > /dev/null
if test $? -eq 0 
then 
   echo "FAIL: HMM files identical, despite different rng seeds"
   exit 1
fi

echo "ok"

rm $hmmfile1 $hmmfile2
rm $outfile1 $outfile2
rm $diffile1 $diffile2
exit 0