diff options
author | Peter Carbonetto | 2017-10-09 16:23:05 -0500 |
---|---|---|
committer | GitHub | 2017-10-09 16:23:05 -0500 |
commit | ab2a1830659ac970d97c107f145105fb410eb219 (patch) | |
tree | 14d3cab14fca4b68eb0916992344b8248a380a61 /test | |
parent | 1e99b37e42edb7981b44f1409cc3e55a47057878 (diff) | |
parent | 86323ccaf26ad0a3b706a67a0014dd04b9965823 (diff) | |
download | pangemma-ab2a1830659ac970d97c107f145105fb410eb219.tar.gz |
Merge pull request #92 from genenetwork/gemma-master
Fixed for a number of outstanding issues.
Diffstat (limited to 'test')
-rwxr-xr-x | test/dev_test_suite.sh | 20 | ||||
-rwxr-xr-x | test/lengthy_test_suite.sh | 55 | ||||
-rwxr-xr-x | test/test_suite.sh | 20 |
3 files changed, 78 insertions, 17 deletions
diff --git a/test/dev_test_suite.sh b/test/dev_test_suite.sh index 9e49251..0fc4423 100755 --- a/test/dev_test_suite.sh +++ b/test/dev_test_suite.sh @@ -2,7 +2,6 @@ gemma=../bin/gemma - # Related to https://github.com/genetics-statistics/GEMMA/issues/78 testBXDStandardRelatednessMatrixKSingularError() { outn=BXDerr @@ -32,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 \ @@ -40,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 "80498" `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() { @@ -65,10 +65,12 @@ testCenteredRelatednessMatrixKLOCO1() { testUnivariateLinearMixedModelLOCO1() { outn=mouse_hs1940_CD8_LOCO1_lmm rm -f output/$outn.* - $gemma -g ../example/mouse_hs1940.geno.txt.gz -p ../example/mouse_hs1940.pheno.txt \ + $gemma -g ../example/mouse_hs1940.geno.txt.gz \ + -p ../example/mouse_hs1940.pheno.txt \ -n 1 \ -loco 1 \ - -a ../example/mouse_hs1940.anno.txt -k ./output/mouse_hs1940_LOCO1.cXX.txt \ + -a ../example/mouse_hs1940.anno.txt \ + -k ./output/mouse_hs1940_LOCO1.cXX.txt \ -snps ../example/mouse_hs1940_snps.txt -lmm \ -nind 400 \ -debug \ @@ -78,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..231475e --- /dev/null +++ b/test/lengthy_test_suite.sh @@ -0,0 +1,55 @@ +#!/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() { + echo "Long running test!" + # 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 44eb14c..350fc27 100755 --- a/test/test_suite.sh +++ b/test/test_suite.sh @@ -30,13 +30,13 @@ 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() { $gemma -g ../example/mouse_hs1940.geno.txt.gz \ -p ../example/mouse_hs1940.pheno.txt \ - -gk -o mouse_hs1940 + -gk -o mouse_hs1940 -debug assertEquals 0 $? outfn=output/mouse_hs1940.cXX.txt assertEquals "1940" `wc -l < $outfn` @@ -52,13 +52,14 @@ testUnivariateLinearMixedModel() { -a ../example/mouse_hs1940.anno.txt \ -k ./output/mouse_hs1940.cXX.txt \ -lmm \ - -o mouse_hs1940_CD8_lmm + -o mouse_hs1940_CD8_lmm \ + -debug assertEquals 0 $? 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() { @@ -67,7 +68,8 @@ testMultivariateLinearMixedModel() { -n 1 6 \ -a ../example/mouse_hs1940.anno.txt \ -k ./output/mouse_hs1940.cXX.txt \ - -lmm -o mouse_hs1940_CD8MCH_lmm + -lmm -o mouse_hs1940_CD8MCH_lmm \ + -debug assertEquals 0 $? outfn=output/mouse_hs1940_CD8MCH_lmm.assoc.txt @@ -81,7 +83,8 @@ testPlinkStandardRelatednessMatrixK() { outfn=output/$testname.sXX.txt rm -f $outfn $gemma -bfile $datadir/HLC \ - -gk 2 -o $testname + -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` @@ -97,11 +100,12 @@ testPlinkMultivariateLinearMixedModel() { -lmm 1 \ -maf 0.1 \ -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` |