diff options
Diffstat (limited to 'test/dev_test_suite.sh')
-rwxr-xr-x | test/dev_test_suite.sh | 79 |
1 files changed, 68 insertions, 11 deletions
diff --git a/test/dev_test_suite.sh b/test/dev_test_suite.sh index 0fc4423..0d3d8a0 100755 --- a/test/dev_test_suite.sh +++ b/test/dev_test_suite.sh @@ -1,29 +1,31 @@ #!/usr/bin/env bash gemma=../bin/gemma +# gemmaopts="-debug -strict" +gemmaopts="-debug" # Related to https://github.com/genetics-statistics/GEMMA/issues/78 testBXDStandardRelatednessMatrixKSingularError() { outn=BXDerr rm -f output/$outn.* - $gemma -g ../example/BXD_geno.txt.gz \ + $gemma $gemmaopts \ + -g ../example/BXD_geno.txt.gz \ -p ../example/BXD_pheno.txt \ -c ../example/BXD_covariates.txt \ -a ../example/BXD_snps.txt \ -gk \ - -debug -o $outn + -o $outn assertEquals 22 $? # should show singular error } testBXDStandardRelatednessMatrixK() { outn=BXD rm -f output/$outn.* - $gemma -g ../example/BXD_geno.txt.gz \ + $gemma $gemmaopts -g ../example/BXD_geno.txt.gz \ -p ../example/BXD_pheno.txt \ -c ../example/BXD_covariates2.txt \ -a ../example/BXD_snps.txt \ -gk \ - -debug \ -o $outn assertEquals 0 $? outfn=output/$outn.cXX.txt @@ -31,28 +33,43 @@ testBXDStandardRelatednessMatrixK() { assertEquals "-116.11" `perl -nle 'foreach $x (split(/\s+/,$_)) { $sum += sprintf("%.2f",(substr($x,,0,6))) } END { printf "%.2f",$sum }' $outfn` } +testBXDLMLikelihoodRatio() { + outn=BXD_LM_LR + $gemma $gemmaopts -g ../example/BXD_geno.txt.gz \ + -p ../example/BXD_pheno.txt \ + -c ../example/BXD_covariates2.txt \ + -a ../example/BXD_snps.txt \ + -k ./output/BXD.cXX.txt \ + -lm 4 -maf 0.1 \ + -o $outn + assertEquals 0 $? + + outfn=output/$outn.assoc.txt + assertEquals "95134" `wc -w < $outfn` + assertEquals "3089042886.28" `perl -nle 'foreach $x (split(/\s+/,$_)) { $sum += sprintf("%.2f",(substr($x,,0,6))) } END { printf "%.2f",$sum }' $outfn` +} + testBXDLMMLikelihoodRatio() { outn=BXD_LMM_LR - $gemma -g ../example/BXD_geno.txt.gz \ + $gemma $gemmaopts -g ../example/BXD_geno.txt.gz \ -p ../example/BXD_pheno.txt \ -c ../example/BXD_covariates2.txt \ -a ../example/BXD_snps.txt \ -k ./output/BXD.cXX.txt \ -lmm 2 -maf 0.1 \ - -debug \ -o $outn assertEquals 0 $? outfn=output/$outn.assoc.txt - assertEquals "80498" `wc -w < $outfn` + assertEquals "73180" `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() { outn=mouse_hs1940_LOCO1 rm -f output/$outn.* - $gemma -g ../example/mouse_hs1940.geno.txt.gz -p ../example/mouse_hs1940.pheno.txt \ - -a ../example/mouse_hs1940.anno.txt -snps ../example/mouse_hs1940_snps.txt -nind 400 -loco 1 -gk -debug -o $outn + $gemma $gemmaopts -g ../example/mouse_hs1940.geno.txt.gz -p ../example/mouse_hs1940.pheno.txt \ + -a ../example/mouse_hs1940.anno.txt -snps ../example/mouse_hs1940_snps.txt -nind 400 -loco 1 -gk -o $outn assertEquals 0 $? grep "total computation time" < output/$outn.log.txt outfn=output/$outn.cXX.txt @@ -65,7 +82,7 @@ testCenteredRelatednessMatrixKLOCO1() { testUnivariateLinearMixedModelLOCO1() { outn=mouse_hs1940_CD8_LOCO1_lmm rm -f output/$outn.* - $gemma -g ../example/mouse_hs1940.geno.txt.gz \ + $gemma $gemmaopts -g ../example/mouse_hs1940.geno.txt.gz \ -p ../example/mouse_hs1940.pheno.txt \ -n 1 \ -loco 1 \ @@ -73,7 +90,47 @@ testUnivariateLinearMixedModelLOCO1() { -k ./output/mouse_hs1940_LOCO1.cXX.txt \ -snps ../example/mouse_hs1940_snps.txt -lmm \ -nind 400 \ - -debug \ + -o $outn + assertEquals 0 $? + grep "total computation time" < output/$outn.log.txt + assertEquals 0 $? + outfn=output/$outn.assoc.txt + assertEquals "68" `wc -l < $outfn` + assertEquals "15465346.22" `perl -nle 'foreach $x (split(/\s+/,$_)) { $sum += sprintf("%.2f",(substr($x,,0,6))) } END { printf "%.2f",$sum }' $outfn` +} + +testPlinkCenteredRelatednessMatrixKLOCO1() { + return 0 + outn=mouse_hs1940_Plink_LOCO1 + rm -f output/$outn.* + $gemma $gemmaopts -bfile ../example/mouse_hs1940 \ + -a ../example/mouse_hs1940.anno.txt \ + -snps ../example/mouse_hs1940_snps.txt \ + -nind 400 \ + -loco 1 \ + -gk \ + -o $outn + assertEquals 0 $? + grep "total computation time" < output/$outn.log.txt + outfn=output/$outn.cXX.txt + assertEquals 0 $? + assertEquals "400" `wc -l < $outfn` + assertEquals "0.312" `head -c 5 $outfn` + assertEquals "71.03" `perl -nle 'foreach $x (split(/\s+/,$_)) { $sum += sprintf("%.2f",(substr($x,,0,6))) } END { printf "%.2f",$sum }' $outfn` +} + + +testPlinkUnivariateLinearMixedModelLOCO1() { + return 0 + outn=mouse_hs1940_CD8_Plink_LOCO1_lmm + rm -f output/$outn.* + $gemma $gemmaopts -bfile ../example/mouse_hs1940 \ + -n 1 \ + -loco 1 \ + -k ./output/mouse_hs1940_Plink_LOCO1.cXX.txt \ + -a ../example/mouse_hs1940.anno.txt \ + -snps ../example/mouse_hs1940_snps.txt -lmm \ + -nind 400 \ -o $outn assertEquals 0 $? grep "total computation time" < output/$outn.log.txt |