| 1 | #! /bin/shscip-shell filesystem . . `/bin/sh`. |
| 2 | |
| 3 | # Usage: ./i1-hmmbuild.sh <hmmbuild binary> <MSA file> <tmpfile prefix for filenames> |
| 4 | # |
| 5 | # Verifies that hmmbuild builds HMMs reproducibly (no stochastic run-to-run variation by default). |
| 6 | # |
| 7 | if testscip-shell system . . test. ! $# -eq 3; then |
| 8 | echoscip-shell system . . echo. "Usage: $0 <hmmbuild binary> <MSA file> <tmpfile prefix>" |
| 9 | exit 1 |
| 10 | fi |
| 11 | |
| 12 | hmmbuild=$1; if testscip-shell system . . test. ! -x $hmmbuild; then echoscip-shell system . . echo. "FAIL: $hmmbuild not executable"; exit 1; fi |
| 13 | alifile=$2; if testscip-shell system . . test. ! -r $alifile; then echoscip-shell system . . echo. "FAIL: $alifile not readable"; exit 1; fi |
| 14 | |
| 15 | hmmfile1=$3.1.hmm |
| 16 | hmmfile2=$3.2.hmm |
| 17 | outfile1=$3.1.out |
| 18 | outfile2=$3.2.out |
| 19 | diffile1=$3.1 |
| 20 | diffile2=$3.2 |
| 21 | |
| 22 | # By default: no stochastic variation |
| 23 | $hmmbuild $hmmfile1 $alifile > $outfile1; if testscip-shell system . . test. $? -ne 0; then echoscip-shell system . . echo. "FAIL: crash"; exit 1; fi |
| 24 | $hmmbuild $hmmfile2 $alifile > $outfile2; if testscip-shell system . . test. $? -ne 0; then echoscip-shell system . . echo. "FAIL: crash"; exit 1; fi |
| 25 | |
| 26 | catscip-shell system . . cat. $outfile1 | grepscip-shell system . . grep. -v "^#" > $diffile1 |
| 27 | catscip-shell system . . cat. $outfile2 | grepscip-shell system . . grep. -v "^#" > $diffile2 |
| 28 | diffscip-shell system . . diff. $diffile1 $diffile2 > /dev/nullscip-shell filesystem . . `/dev/null`. |
| 29 | if testscip-shell system . . test. $? -ne 0 |
| 30 | then |
| 31 | echoscip-shell system . . echo. "FAIL: output files differ" |
| 32 | exit 1 |
| 33 | fi |
| 34 | |
| 35 | catscip-shell system . . cat. $hmmfile1| grepscip-shell system . . grep. -v "^DATE" > $diffile1 |
| 36 | catscip-shell system . . cat. $hmmfile2| grepscip-shell system . . grep. -v "^DATE" > $diffile2 |
| 37 | diffscip-shell system . . diff. $diffile1 $diffile2 > /dev/nullscip-shell filesystem . . `/dev/null`. |
| 38 | if testscip-shell system . . test. $? -ne 0 |
| 39 | then |
| 40 | echoscip-shell system . . echo. "FAIL: HMM files differ" |
| 41 | exit 1 |
| 42 | fi |
| 43 | |
| 44 | # With different seeds: HMM files will differ because of statistical fits |
| 45 | $hmmbuild --seed 1 $hmmfile1 $alifile > $outfile1; if testscip-shell system . . test. $? -ne 0; then echoscip-shell system . . echo. "FAIL: crash"; exit 1; fi |
| 46 | $hmmbuild --seed 2 $hmmfile2 $alifile > $outfile2; if testscip-shell system . . test. $? -ne 0; then echoscip-shell system . . echo. "FAIL: crash"; exit 1; fi |
| 47 | |
| 48 | catscip-shell system . . cat. $hmmfile1| grepscip-shell system . . grep. -v "^DATE" > $diffile1 |
| 49 | catscip-shell system . . cat. $hmmfile2| grepscip-shell system . . grep. -v "^DATE" > $diffile2 |
| 50 | diffscip-shell system . . diff. $diffile1 $diffile2 > /dev/nullscip-shell filesystem . . `/dev/null`. |
| 51 | if testscip-shell system . . test. $? -eq 0 |
| 52 | then |
| 53 | echoscip-shell system . . echo. "FAIL: HMM files identical, despite different rng seeds" |
| 54 | exit 1 |
| 55 | fi |
| 56 | |
| 57 | echoscip-shell system . . echo. "ok" |
| 58 | |
| 59 | rmscip-shell system . . rm. $hmmfile1 $hmmfile2 |
| 60 | rmscip-shell system . . rm. $outfile1 $outfile2 |
| 61 | rmscip-shell system . . rm. $diffile1 $diffile2 |
| 62 | exit 0 |
| 63 | |
| 64 | |
| 65 | |
| 66 | |
| 67 |