[Genabel-commits] r1096 - pkg/ProbABEL/examples

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Mon Feb 11 23:20:12 CET 2013


Author: lckarssen
Date: 2013-02-11 23:20:11 +0100 (Mon, 11 Feb 2013)
New Revision: 1096

Modified:
   pkg/ProbABEL/examples/example_bt.sh
   pkg/ProbABEL/examples/example_mms.sh
   pkg/ProbABEL/examples/example_qt.sh
Log:
Improved the example/test scripts. Now by default the output is redirected to /dev/null when running the test scripts. If the first command line argument is "verbose" then the full ProbABEL output is shown. This makes the output of e.g. make check easier to decipher. 
This also introduces the run_diff funtion in each of the test scripts. 

Note that there is still some work in progress here. 


Modified: pkg/ProbABEL/examples/example_bt.sh
===================================================================
--- pkg/ProbABEL/examples/example_bt.sh	2013-02-11 07:49:02 UTC (rev 1095)
+++ pkg/ProbABEL/examples/example_bt.sh	2013-02-11 22:20:11 UTC (rev 1096)
@@ -1,3 +1,22 @@
+#!/bin/sh
+# This script runs checks on ProbABEL's palinear module for
+# quantitative traits.
+
+run_diff()
+{
+    # This function is run after each check. It needs two arguments:
+    # $1: first file to compare
+    # $2: second file to compare
+    if diff "$1" "$2"; then
+        echo -e "\t\tOK"
+    else
+        echo -e "\t\tFAILED"
+        exit 1
+    fi
+}
+
+
+# ---- The checks start here ----
 echo "analysing BT"
 if [ -z ${srcdir} ]; then
     srcdir="."
@@ -3,4 +22,12 @@
 fi
 
+# Redirect all output to file descriptor 3 to /dev/null except if
+# the first argument is "verbose" then redirect handle 3 to stdout
+exec 3>/dev/null
+if [ "$1" = "verbose" ]; then
+    echo "Verbose mode ON"
+    exec 3>&1
+fi
+
 ../src/palogist \
     -p ${srcdir}/logist_data.txt \
@@ -9,7 +36,8 @@
     -i ${srcdir}/test.mlinfo \
     -m ${srcdir}/test.map \
     -c 19 \
-    -o logist
+    -o logist \
+    >& 3
 
 ../src/palogist \
     -p ${srcdir}/logist_data.txt \
@@ -17,10 +45,11 @@
     -i ${srcdir}/test.mlinfo \
     -m ${srcdir}/test.map \
     -c 19 \
-    -o logist_fv
+    -o logist_fv \
+    >& 3
 
 echo "BT check: dose vs. dose_fv"
-diff logist_add.out.txt logist_fv_add.out.txt
+run_diff logist_add.out.txt logist_fv_add.out.txt
 
 ../src/palogist \
     -p ${srcdir}/logist_data.txt \
@@ -29,7 +58,8 @@
     -m ${srcdir}/test.map \
     --ngpreds=2 \
     -c 19 \
-    -o logist_prob
+    -o logist_prob \
+    >& 3
 
 ../src/palogist \
     -p ${srcdir}/logist_data.txt \
@@ -38,10 +68,13 @@
     -m ${srcdir}/test.map \
     --ngpreds=2 \
     -c 19 \
-    -o logist_prob_fv
+    -o logist_prob_fv \
+    >& 3
 
-echo "BT check: prob vs. prob_fv"
-diff logist_prob_add.out.txt logist_prob_fv_add.out.txt
+for model in add domin over_domin recess 2df; do
+    echo -n "BT check ($model model): prob vs. prob_fv"
+    run_diff logist_prob_${model}.out.txt logist_prob_fv_${model}.out.txt
+done
 
 # Commented out because of slightly different output formats. We need
 # something smart here.

Modified: pkg/ProbABEL/examples/example_mms.sh
===================================================================
--- pkg/ProbABEL/examples/example_mms.sh	2013-02-11 07:49:02 UTC (rev 1095)
+++ pkg/ProbABEL/examples/example_mms.sh	2013-02-11 22:20:11 UTC (rev 1096)
@@ -1,15 +1,42 @@
-echo "analysis using MMSCORE"
+#!/bin/sh
+# This script runs checks on ProbABEL's palinear module for
+# quantitative traits combined with the mmscore option.
+
+run_diff()
+{
+    # This function is run after each check. It needs two arguments:
+    # $1: first file to compare
+    # $2: second file to compare
+    if diff "$1" "$2"; then
+        echo -e "\t\tOK"
+    else
+        echo -e "\t\tFAILED"
+        exit 1
+    fi
+}
+
+
+# ---- The checks start here ----
+echo "analysis using MMScore"
 if [ -z ${srcdir} ]; then
     srcdir="."
 fi
 
+# Redirect all output to file descriptor 3 to /dev/null except if
+# the first argument is "verbose" then redirect handle 3 to stdout
+exec 3>/dev/null
+if [ "$1" = "verbose" ]; then
+    exec 3>&1
+fi
+
 ../src/palinear \
     -p ${srcdir}/mmscore_pheno.PHE \
     -i ${srcdir}/mmscore_gen.mlinfo \
     -d ${srcdir}/mmscore_gen.mldose \
     --sep="," \
     -o mmscore \
-    --mmscore ${srcdir}/mmscore_InvSigma_aj.sex.age.dat
+    --mmscore ${srcdir}/mmscore_InvSigma_aj.sex.age.dat \
+    >& 3
 
 ../src/palinear \
     -p ${srcdir}/mmscore_pheno.PHE \
@@ -17,7 +44,8 @@
     -d ${srcdir}/mmscore_gen.dose.fvi \
     --sep="," \
     -o mmscore_fv \
-    --mmscore ${srcdir}/mmscore_InvSigma_aj.sex.age.dat
+    --mmscore ${srcdir}/mmscore_InvSigma_aj.sex.age.dat \
+    >& 3
 
 echo "mmscore check: dose vs. dose_fv"
 diff mmscore_add.out.txt mmscore_fv_add.out.txt
@@ -29,7 +57,8 @@
     -d ${srcdir}/mmscore_gen.mlprob \
     --ngpreds=2 --sep="," \
     -o mmscore_prob \
-    --mmscore ${srcdir}/mmscore_InvSigma_aj.sex.age.dat
+    --mmscore ${srcdir}/mmscore_InvSigma_aj.sex.age.dat \
+    >& 3
 
 ../src/palinear \
     -p ${srcdir}/mmscore_pheno.PHE \
@@ -37,10 +66,13 @@
     -d ${srcdir}/mmscore_gen.prob.fvi \
     --ngpreds=2 --sep="," \
     -o mmscore_prob_fv \
-    --mmscore ${srcdir}/mmscore_InvSigma_aj.sex.age.dat
+    --mmscore ${srcdir}/mmscore_InvSigma_aj.sex.age.dat \
+    >& 3
 
-echo "mmscore check: prob vs. prob_fv"
-diff mmscore_prob_add.out.txt mmscore_prob_fv_add.out.txt
+for model in add domin over_domin recess 2df; do
+    echo -n "mmscore check ($model model): prob vs. prob_fv"
+    run_diff mmscore_prob_${model}.out.txt mmscore_prob_fv_${model}.out.txt
+done
 
 # Commented out because of slightly different output formats. We need
 # something smart here.

Modified: pkg/ProbABEL/examples/example_qt.sh
===================================================================
--- pkg/ProbABEL/examples/example_qt.sh	2013-02-11 07:49:02 UTC (rev 1095)
+++ pkg/ProbABEL/examples/example_qt.sh	2013-02-11 22:20:11 UTC (rev 1096)
@@ -22,6 +22,13 @@
     srcdir="."
 fi
 
+# Redirect all output to file descriptor 3 to /dev/null except if
+# the first argument is "verbose" then redirect handle 3 to stdout
+exec 3>/dev/null
+if [ "$1" = "verbose" ]; then
+    exec 3>&1
+fi
+
 echo "base analysis"
 ../src/palinear \
     -p ${srcdir}/height.txt \
@@ -29,7 +36,8 @@
     -i ${srcdir}/test.mlinfo \
     -m ${srcdir}/test.map \
     -c 19 \
-    -o height_base
+    -o height_base \
+    >& 3
 
 ../src/palinear \
     -p ${srcdir}/height.txt \
@@ -37,7 +45,8 @@
     -i ${srcdir}/test.mlinfo \
     -m ${srcdir}/test.map \
     -c 19 \
-    -o height_base_fv
+    -o height_base_fv \
+    >& 3
 
 echo -n "QT check: dose vs. dose_fv"
 run_diff height_base_add.out.txt height_base_fv_add.out.txt
@@ -69,14 +78,16 @@
     -i ${srcdir}/test.mlinfo \
     -m ${srcdir}/test.map \
     -c 19 --interaction=1 \
-    -o height_int1
+    -o height_int1 \
+    >& 3
 ../src/palinear \
     -p ${srcdir}/height.txt \
     -d ${srcdir}/test.dose.fvi \
     -i ${srcdir}/test.mlinfo \
     -m ${srcdir}/test.map \
     -c 19 --interaction=1 \
-    -o height_int1_fv
+    -o height_int1_fv \
+    >& 3
 
 echo -n "QT check: interactions: dose vs. dose_fv"
 run_diff height_int1_add.out.txt height_int1_fv_add.out.txt
@@ -89,14 +100,16 @@
     -i ${srcdir}/test.mlinfo \
     -m ${srcdir}/test.map \
     -c 19 --robust \
-    -o height_robust
+    -o height_robust \
+    >& 3
 ../src/palinear \
     -p ${srcdir}/height.txt \
     -d ${srcdir}/test.dose.fvi \
     -i ${srcdir}/test.mlinfo \
     -m ${srcdir}/test.map \
     -c 19 --robust \
-    -o height_robust_fv
+    -o height_robust_fv \
+    >& 3
 
 echo -n "QT check: robust: dose vs. dose_fv"
 run_diff height_robust_add.out.txt height_robust_fv_add.out.txt
@@ -109,14 +122,16 @@
     -i ${srcdir}/test.mlinfo \
     -m ${srcdir}/test.map \
     -c 19 --robust --interaction=1 \
-    -o height_robust_int1
+    -o height_robust_int1 \
+    >& 3
 ../src/palinear \
     -p ${srcdir}/height.txt \
     -d ${srcdir}/test.dose.fvi \
     -i ${srcdir}/test.mlinfo \
     -m ${srcdir}/test.map \
     -c 19 --robust --interaction=1 \
-    -o height_robust_int1_fv
+    -o height_robust_int1_fv \
+    >& 3
 
 echo -n "QT check: robust & interaction: dose vs. dose_fv"
 run_diff height_robust_int1_add.out.txt height_robust_int1_fv_add.out.txt
@@ -129,17 +144,19 @@
     -i ${srcdir}/test.mlinfo \
     -m ${srcdir}/test.map \
     -c 19 --ngp=2 \
-    -o height_ngp2
+    -o height_ngp2 \
+    >& 3
 ../src/palinear \
     -p ${srcdir}/height.txt \
     -d ${srcdir}/test.prob.fvi \
     -i ${srcdir}/test.mlinfo \
     -m ${srcdir}/test.map \
     -c 19 --ngp=2 \
-    -o height_ngp2_fv
+    -o height_ngp2_fv \
+    >& 3
 
-# echo -n "QT check: dose vs prob (additive model)"
-# run_diff height_base_add.out.txt height_ngp2_add.out.txt
+echo -n "QT check: dose vs prob (additive model)"
+run_diff height_base_add.out.txt height_ngp2_add.out.txt
 
 for model in add domin over_domin recess 2df; do
     echo -n "QT check ($model model): prob vs. prob_fv"
@@ -154,14 +171,16 @@
     -i ${srcdir}/test.mlinfo \
     -m ${srcdir}/test.map \
     -c 19 --ngp=2 --allcov \
-    -o height_ngp2_allcov
+    -o height_ngp2_allcov \
+    >& 3
 ../src/palinear \
     -p ${srcdir}/height.txt \
     -d ${srcdir}/test.prob.fvi \
     -i ${srcdir}/test.mlinfo \
     -m ${srcdir}/test.map \
     -c 19 --ngp=2 --allcov \
-    -o height_ngp2_allcov_fv
+    -o height_ngp2_allcov_fv \
+    >& 3
 
 for model in add domin over_domin recess 2df; do
     echo -n "QT check --allcov ($model model): prob vs. prob_fv"
@@ -176,14 +195,16 @@
     -i ${srcdir}/test.mlinfo \
     -m ${srcdir}/test.map \
     -c 19 --ngp=2 --interaction=1 \
-    -o height_ngp2_int1
+    -o height_ngp2_int1 \
+    >& 3
 ../src/palinear \
     -p ${srcdir}/height.txt \
     -d ${srcdir}/test.prob.fvi \
     -i ${srcdir}/test.mlinfo \
     -m ${srcdir}/test.map \
     -c 19 --ngp=2 --interaction=1 \
-    -o height_ngp2_int1_fv
+    -o height_ngp2_int1_fv \
+    >& 3
 
 for model in add domin over_domin recess 2df; do
     echo -n "QT check --interactions ($model model): prob vs. prob_fv"
@@ -198,14 +219,16 @@
     -i ${srcdir}/test.mlinfo \
     -m ${srcdir}/test.map \
     -c 19 --ngp=2 --robust \
-    -o height_ngp2_robust
+    -o height_ngp2_robust \
+    >& 3
 ../src/palinear \
     -p ${srcdir}/height.txt \
     -d ${srcdir}/test.prob.fvi \
     -i ${srcdir}/test.mlinfo \
     -m ${srcdir}/test.map \
     -c 19 --ngp=2 --robust \
-    -o height_ngp2_robust_fv
+    -o height_ngp2_robust_fv \
+    >& 3
 
 for model in add domin over_domin recess 2df; do
     echo -n "QT check --robust ($model model): prob vs. prob_fv"
@@ -220,14 +243,16 @@
     -i ${srcdir}/test.mlinfo \
     -m ${srcdir}/test.map \
     -c 19 --ngp=2 --robust --interaction=1 \
-    -o height_ngp2_robust_int1
+    -o height_ngp2_robust_int1 \
+    >& 3
 ../src/palinear \
     -p ${srcdir}/height.txt \
     -d ${srcdir}/test.prob.fvi \
     -i ${srcdir}/test.mlinfo \
     -m ${srcdir}/test.map \
     -c 19 --ngp=2 --robust --interaction=1 \
-    -o height_ngp2_robust_int1_fv
+    -o height_ngp2_robust_int1_fv \
+    >& 3
 
 for model in add domin over_domin recess 2df; do
     echo -n "QT check --robust --interactions ($model model): prob vs. prob_fv"



More information about the Genabel-commits mailing list