[Genabel-commits] r1197 - pkg/ProbABEL/examples
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Thu Apr 25 19:45:14 CEST 2013
Author: lckarssen
Date: 2013-04-25 19:45:14 +0200 (Thu, 25 Apr 2013)
New Revision: 1197
Added:
pkg/ProbABEL/examples/run_diff.sh
Modified:
pkg/ProbABEL/examples/example_bt.sh
pkg/ProbABEL/examples/example_mms.sh
pkg/ProbABEL/examples/example_qt.sh
Log:
- Moved the run_diff function in the ProbABEL test/example scripts to a separate file and include that file in each test script.
- The run_diff function now prints the OK/FAILED messages nicely in the same column => better layout when running e.g. make check.
- The run_diff function accepts more options, including a message (which was echo-ed separately before) and options that are passed on to the diff command. This allows us to pass e.g. the -I option to diff which we can use to disregard the header line in some checks (even though the output of some analyses are the same (numerically), the headers are still different in some cases.
Modified: pkg/ProbABEL/examples/example_bt.sh
===================================================================
--- pkg/ProbABEL/examples/example_bt.sh 2013-04-17 10:11:37 UTC (rev 1196)
+++ pkg/ProbABEL/examples/example_bt.sh 2013-04-25 17:45:14 UTC (rev 1197)
@@ -2,21 +2,8 @@
# This script runs checks on ProbABEL's palogist module for
# binary 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
-}
+. ./run_diff.sh
-
-# ---- The checks start here ----
echo "analysing BT"
if [ -z ${srcdir} ]; then
srcdir="."
@@ -47,9 +34,11 @@
-o logist_fv \
>& 3
-echo "BT check: dose vs. dose_fv"
-run_diff logist_add.out.txt logist_fv_add.out.txt
+run_diff logist_add.out.txt \
+ logist_fv_add.out.txt \
+ "BT check: dose vs. dose_fv"
+
../src/palogist \
-p ${srcdir}/logist_data.txt \
-d ${srcdir}/test.mlprob \
@@ -71,8 +60,9 @@
>& 3
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
+ run_diff logist_prob_${model}.out.txt \
+ logist_prob_fv_${model}.out.txt \
+ "BT check ($model model): prob vs. prob_fv"
done
# Commented out because of slightly different output formats. We need
Modified: pkg/ProbABEL/examples/example_mms.sh
===================================================================
--- pkg/ProbABEL/examples/example_mms.sh 2013-04-17 10:11:37 UTC (rev 1196)
+++ pkg/ProbABEL/examples/example_mms.sh 2013-04-25 17:45:14 UTC (rev 1197)
@@ -2,21 +2,8 @@
# 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
-}
+. ./run_diff.sh
-
-# ---- The checks start here ----
echo "analysis using MMScore"
if [ -z ${srcdir} ]; then
srcdir="."
@@ -47,10 +34,12 @@
--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
+run_diff mmscore_add.out.txt \
+ mmscore_fv_add.out.txt \
+ "mmscore check: dose vs. dose_fv"
+
../src/palinear \
-p ${srcdir}/mmscore_pheno.PHE \
-i ${srcdir}/mmscore_gen.mlinfo \
@@ -70,8 +59,9 @@
>& 3
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
+ run_diff mmscore_prob_${model}.out.txt \
+ mmscore_prob_fv_${model}.out.txt \
+ "mmscore check ($model model): prob vs. prob_fv"
done
# Commented out because of slightly different output formats. We need
Modified: pkg/ProbABEL/examples/example_qt.sh
===================================================================
--- pkg/ProbABEL/examples/example_qt.sh 2013-04-17 10:11:37 UTC (rev 1196)
+++ pkg/ProbABEL/examples/example_qt.sh 2013-04-25 17:45:14 UTC (rev 1197)
@@ -2,21 +2,8 @@
# 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
-}
+. ./run_diff.sh
-
-# ---- The checks start here ----
echo "analysing QT"
if [ -z ${srcdir} ]; then
srcdir="."
@@ -47,8 +34,10 @@
-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
+#echo -n "QT check: dose vs. dose_fv"
+run_diff height_base_add.out.txt \
+ height_base_fv_add.out.txt \
+ "QT check: dose vs. dose_fv"
echo "Option --allcov"
@@ -68,8 +57,9 @@
-o height_allcov_fv \
>& 3
-echo -n "QT check: allcov: dose vs. dose_fv"
-run_diff height_allcov_add.out.txt height_allcov_fv_add.out.txt
+run_diff height_allcov_add.out.txt \
+ height_allcov_fv_add.out.txt \
+ "QT check: allcov: dose vs. dose_fv"
echo "Option --interaction=1"
@@ -90,8 +80,9 @@
-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
+run_diff height_int1_add.out.txt \
+ height_int1_fv_add.out.txt \
+ "QT check: interactions: dose vs. dose_fv"
echo "Option --robust"
@@ -112,8 +103,9 @@
-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
+run_diff height_robust_add.out.txt \
+ height_robust_fv_add.out.txt \
+ "QT check: robust: dose vs. dose_fv"
echo "Option --robust --interaction=1"
@@ -134,8 +126,9 @@
-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
+run_diff height_robust_int1_add.out.txt \
+ height_robust_int1_fv_add.out.txt \
+ "QT check: robust & interaction: dose vs. dose_fv"
echo "Option --ngp=2, mlprob file"
@@ -156,12 +149,16 @@
-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
+# Remove header from the outputs, because they differ
+run_diff height_base_add.out.txt \
+ height_ngp2_add.out.txt \
+ "QT check: dose vs. prob (additive model)" -I SNP
+
for model in add domin over_domin recess 2df; do
- echo -n "QT check ($model model): prob vs. prob_fv"
- run_diff height_ngp2_${model}.out.txt height_ngp2_fv_${model}.out.txt
+ run_diff height_ngp2_${model}.out.txt \
+ height_ngp2_fv_${model}.out.txt \
+ "QT check ($model model): prob vs. prob_fv"
done
@@ -184,8 +181,9 @@
>& 3
for model in add domin over_domin recess 2df; do
- echo -n "QT check --allcov ($model model): prob vs. prob_fv"
- run_diff height_ngp2_allcov_${model}.out.txt height_ngp2_allcov_fv_${model}.out.txt
+ run_diff height_ngp2_allcov_${model}.out.txt \
+ height_ngp2_allcov_fv_${model}.out.txt \
+ "QT check --allcov ($model model): prob vs. prob_fv"
done
@@ -208,8 +206,9 @@
>& 3
for model in add domin over_domin recess 2df; do
- echo -n "QT check --interactions ($model model): prob vs. prob_fv"
- run_diff height_ngp2_int1_${model}.out.txt height_ngp2_int1_fv_${model}.out.txt
+ run_diff height_ngp2_int1_${model}.out.txt \
+ height_ngp2_int1_fv_${model}.out.txt \
+ "QT check --interactions ($model model): prob vs. prob_fv"
done
@@ -232,8 +231,9 @@
>& 3
for model in add domin over_domin recess 2df; do
- echo -n "QT check --robust ($model model): prob vs. prob_fv"
- run_diff height_ngp2_robust_${model}.out.txt height_ngp2_robust_fv_${model}.out.txt
+ run_diff height_ngp2_robust_${model}.out.txt \
+ height_ngp2_robust_fv_${model}.out.txt \
+ "QT check --robust ($model model): prob vs. prob_fv"
done
@@ -256,6 +256,7 @@
>& 3
for model in add domin over_domin recess 2df; do
- echo -n "QT check --robust --interactions ($model model): prob vs. prob_fv"
- run_diff height_ngp2_robust_int1_${model}.out.txt height_ngp2_robust_int1_fv_${model}.out.txt
+ run_diff height_ngp2_robust_int1_${model}.out.txt \
+ height_ngp2_robust_int1_fv_${model}.out.txt \
+ "QT check --robust --interactions ($model model): prob vs. prob_fv"
done
Added: pkg/ProbABEL/examples/run_diff.sh
===================================================================
--- pkg/ProbABEL/examples/run_diff.sh (rev 0)
+++ pkg/ProbABEL/examples/run_diff.sh 2013-04-25 17:45:14 UTC (rev 1197)
@@ -0,0 +1,27 @@
+# This file contains a function used in the various example/test scripts
+
+run_diff()
+{
+ # This function is run after each check. It needs two arguments:
+ # $1: first file to compare
+ # $2: second file to compare
+ # $3: start message to print on the output line before OK or FAILED
+ # $4-: any arguments to pass to the diff command
+ file1=$1
+ file2=$2
+ name=""
+ if [ ${#} -ge 3 ]; then
+ name=$3
+ shift 3
+ args=$@
+ fi
+
+ blanks=" "
+
+ if diff "$file1" "$file2" $args; then
+ echo -e "${name}${blanks:${#name}} OK"
+ else
+ echo -e "\t\tFAILED"
+ exit 1
+ fi
+}
More information about the Genabel-commits
mailing list