diff options
author | Pjotr Prins | 2017-10-05 11:10:57 +0000 |
---|---|---|
committer | Pjotr Prins | 2017-10-05 11:12:30 +0000 |
commit | d672c81f7963180c4979aecf93b624d12d3f2ed2 (patch) | |
tree | 1db846138215f05da0b5c98da964aea72920dc26 /test | |
parent | 7b09fe8507962f20ccb1650b86408d40db1a0052 (diff) | |
download | pangemma-d672c81f7963180c4979aecf93b624d12d3f2ed2.tar.gz |
Addresses
https://github.com/genetics-statistics/GEMMA/issues/81
Diffstat (limited to 'test')
-rwxr-xr-x | test/dev_test_suite.sh | 13 | ||||
-rwxr-xr-x | test/lengthy_test_suite.sh | 54 | ||||
-rwxr-xr-x | test/test_suite.sh | 31 |
3 files changed, 65 insertions, 33 deletions
diff --git a/test/dev_test_suite.sh b/test/dev_test_suite.sh index 2bd432e..37f6b28 100755 --- a/test/dev_test_suite.sh +++ b/test/dev_test_suite.sh @@ -31,7 +31,8 @@ testBXDStandardRelatednessMatrixK() { assertEquals "-116.11" `perl -nle 'foreach $x (split(/\s+/,$_)) { $sum += sprintf("%.2f",(substr($x,,0,6))) } END { printf "%.2f",$sum }' $outfn` } -testBXDMultivariateLinearMixedModel() { +testBXDLMMLikelihoodRatio() { + outn=BXD_LMM_LR $gemma -g ../example/BXD_geno.txt.gz \ -p ../example/BXD_pheno.txt \ -c ../example/BXD_covariates2.txt \ @@ -39,12 +40,12 @@ testBXDMultivariateLinearMixedModel() { -k ./output/BXD.cXX.txt \ -lmm 2 -maf 0.1 \ -debug \ - -o BXD_mvlmm + -o $outn assertEquals 0 $? - outfn=output/BXD_mvlmm.assoc.txt - assertEquals "65862" `wc -w < $outfn` - assertEquals "3088489421.94" `perl -nle 'foreach $x (split(/\s+/,$_)) { $sum += sprintf("%.2f",(substr($x,,0,6))) } END { printf "%.2f",$sum }' $outfn` + outfn=output/$outn.assoc.txt + assertEquals "87816" `wc -w < $outfn` + assertEquals "3088458212.93" `perl -nle 'foreach $x (split(/\s+/,$_)) { $sum += sprintf("%.2f",(substr($x,,0,6))) } END { printf "%.2f",$sum }' $outfn` } testCenteredRelatednessMatrixKLOCO1() { @@ -79,7 +80,7 @@ testUnivariateLinearMixedModelLOCO1() { assertEquals 0 $? outfn=output/$outn.assoc.txt assertEquals "68" `wc -l < $outfn` - assertEquals "15465553.30" `perl -nle 'foreach $x (split(/\s+/,$_)) { $sum += sprintf("%.2f",(substr($x,,0,6))) } END { printf "%.2f",$sum }' $outfn` + assertEquals "15465346.22" `perl -nle 'foreach $x (split(/\s+/,$_)) { $sum += sprintf("%.2f",(substr($x,,0,6))) } END { printf "%.2f",$sum }' $outfn` } shunit2=`which shunit2` diff --git a/test/lengthy_test_suite.sh b/test/lengthy_test_suite.sh new file mode 100755 index 0000000..327b2b2 --- /dev/null +++ b/test/lengthy_test_suite.sh @@ -0,0 +1,54 @@ +#!/usr/bin/env bash +# +# Long running tests go here + +gemma=../bin/gemma + +testPlinkStandardRelatednessMatrixK() { + testname=testPlinkStandardRelatednessMatrixK + datadir=../example + outfn=output/$testname.sXX.txt + rm -f $outfn + $gemma -bfile $datadir/HLC \ + -gk 2 -o $testname \ + -debug + assertEquals 0 $? + assertEquals "427" `wc -l < $outfn` + assertEquals "-358.07" `perl -nle 'foreach $x (split(/\s+/,$_)) { $sum += sprintf("%.2f",(substr($x,,0,6))) } END { printf "%.2f",$sum }' $outfn` +} + +testPlinkMultivariateLinearMixedModelMultiplePhenotypes_Issue58() { + # This test passes, but takes over 30 minutes to run! + # n=2 is original pheno in fam file + # n=1 is causal1 + # n=3..12 is causal2 + # n=13..22 is causal3 + # -n 1 2 3 15 is independent + testname=testPlinkMultivariateLinearMixedModelMultiplePhenotypes + datadir=../example + $gemma -bfile $datadir/HLC \ + -p $datadir/HLC.simu.pheno.txt \ + -k output/testPlinkStandardRelatednessMatrixK.sXX.txt \ + -lmm 1 \ + -maf 0.1 \ + -n 1 2 3 15 \ + -c $datadir/HLC_covariates.txt \ + -debug \ + -o $testname + assertEquals 0 $? + outfn=output/$testname.assoc.txt + assertEquals "223243" `wc -l < $outfn` + assertEquals "89754977983.69" `perl -nle 'foreach $x (split(/\s+/,$_)) { $sum += sprintf("%.2f",(substr($x,,0,6))) } END { printf "%.2f",$sum }' $outfn` +} + +shunit2=`which shunit2` + +if [ -x "$shunit2" ]; then + echo run system shunit2 + . $shunit2 +elif [ -e ../contrib/shunit2-2.0.3/src/shell/shunit2 ]; then + echo run shunit2 provided in gemma repo + . ../contrib/shunit2-2.0.3/src/shell/shunit2 +else + echo "Can not find shunit2 - see INSTALL.md" +fi diff --git a/test/test_suite.sh b/test/test_suite.sh index fa66b7a..350fc27 100755 --- a/test/test_suite.sh +++ b/test/test_suite.sh @@ -30,7 +30,7 @@ testUnivariateLinearMixedModelFullLOCO1() { assertEquals 0 $? outfn=output/$outn.assoc.txt assertEquals "951" `wc -l < $outfn` - assertEquals "267509369.79" `perl -nle 'foreach $x (split(/\s+/,$_)) { $sum += sprintf("%.2f",(substr($x,,0,6))) } END { printf "%.2f",$sum }' $outfn` + assertEquals "267507851.98" `perl -nle 'foreach $x (split(/\s+/,$_)) { $sum += sprintf("%.2f",(substr($x,,0,6))) } END { printf "%.2f",$sum }' $outfn` } testCenteredRelatednessMatrixK() { @@ -58,8 +58,8 @@ testUnivariateLinearMixedModel() { grep "total computation time" < output/mouse_hs1940_CD8_lmm.log.txt assertEquals 0 $? outfn=output/mouse_hs1940_CD8_lmm.assoc.txt - assertEquals "118459" `wc -w < $outfn` - assertEquals "4038557453.62" `perl -nle 'foreach $x (split(/\s+/,$_)) { $sum += sprintf("%.2f",(substr($x,,0,6))) } END { printf "%.2f",$sum }' $outfn` + assertEquals "129228" `wc -w < $outfn` + assertEquals "4038540440.86" `perl -nle 'foreach $x (split(/\s+/,$_)) { $sum += sprintf("%.2f",(substr($x,,0,6))) } END { printf "%.2f",$sum }' $outfn` } testMultivariateLinearMixedModel() { @@ -105,30 +105,7 @@ testPlinkMultivariateLinearMixedModel() { assertEquals 0 $? outfn=output/$testname.assoc.txt assertEquals "223243" `wc -l < $outfn` - assertEquals "89756559859.06" `perl -nle 'foreach $x (split(/\s+/,$_)) { $sum += sprintf("%.2f",(substr($x,,0,6))) } END { printf "%.2f",$sum }' $outfn` -} - -testPlinkMultivariateLinearMixedModelMultiplePhenotypes_Issue58() { - # n=2 is original pheno in fam file - # n=1 is causal1 - # n=3..12 is causal2 - # n=13..22 is causal3 - # -n 1 2 3 15 is independent - testname=testPlinkMultivariateLinearMixedModelMultiplePhenotypes - datadir=../example - $gemma -bfile $datadir/HLC \ - -p $datadir/HLC.simu.pheno.txt \ - -k output/testPlinkStandardRelatednessMatrixK.sXX.txt \ - -lmm 1 \ - -maf 0.1 \ - -n 1 2 3 15 \ - -c $datadir/HLC_covariates.txt \ - -debug \ - -o $testname - assertEquals 0 $? - outfn=output/$testname.assoc.txt - assertEquals "223243" `wc -l < $outfn` - assertEquals "89756559859.06" `perl -nle 'foreach $x (split(/\s+/,$_)) { $sum += sprintf("%.2f",(substr($x,,0,6))) } END { printf "%.2f",$sum }' $outfn` + assertEquals "89757159113.77" `perl -nle 'foreach $x (split(/\s+/,$_)) { $sum += sprintf("%.2f",(substr($x,,0,6))) } END { printf "%.2f",$sum }' $outfn` } shunit2=`which shunit2` |