[Genabel-commits] r1519 - in pkg/ProbABEL: . checks checks/R-tests

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Mon Dec 30 18:39:17 CET 2013


Author: lckarssen
Date: 2013-12-30 18:39:17 +0100 (Mon, 30 Dec 2013)
New Revision: 1519

Modified:
   pkg/ProbABEL/Makefile.am
   pkg/ProbABEL/checks/Makefile.am
   pkg/ProbABEL/checks/R-tests/Makefile.am
   pkg/ProbABEL/checks/R-tests/run_models_in_R_pacox.R
   pkg/ProbABEL/checks/R-tests/run_models_in_R_palinear.R
   pkg/ProbABEL/checks/R-tests/run_models_in_R_palogist.R
   pkg/ProbABEL/checks/test_bt.sh
   pkg/ProbABEL/checks/test_cox.sh
   pkg/ProbABEL/checks/test_mms.sh
   pkg/ProbABEL/checks/test_qt.sh
   pkg/ProbABEL/configure.ac
Log:
Finally got the ProbABEL R-tests to work in a general 'make distcheck' setting. 
Now, when you run 'make check' or 'make distcheck' and R is installed, these tests that compare ProbABEL output to R output are also included. 

NOTE: the test for palogist is set to XFAIL, which means we expect it to fail. For some reasons (DANGER!) the logistic regressions results are different for some of the SNPs (not only the problematic ones). 


Modified: pkg/ProbABEL/Makefile.am
===================================================================
--- pkg/ProbABEL/Makefile.am	2013-12-30 14:48:15 UTC (rev 1518)
+++ pkg/ProbABEL/Makefile.am	2013-12-30 17:39:17 UTC (rev 1519)
@@ -1,4 +1,4 @@
 ## Process this file with automake to produce Makefile.in
 
 AUTOMAKE_OPTIONS = foreign
-SUBDIRS = src doc checks examples
+SUBDIRS = src doc checks examples checks/R-tests

Modified: pkg/ProbABEL/checks/Makefile.am
===================================================================
--- pkg/ProbABEL/checks/Makefile.am	2013-12-30 14:48:15 UTC (rev 1518)
+++ pkg/ProbABEL/checks/Makefile.am	2013-12-30 17:39:17 UTC (rev 1519)
@@ -52,8 +52,8 @@
 check_SCRIPTS +=  test_cox.sh
 endif
 
-
-
+AM_TESTS_ENVIRONMENT= \
+	PA_BINDIR=$(top_builddir)/src
 TESTS = $(check_SCRIPTS)
 
 EXTRA_DIST = $(verified_results) $(input_files) $(check_SCRIPTS)

Modified: pkg/ProbABEL/checks/R-tests/Makefile.am
===================================================================
--- pkg/ProbABEL/checks/R-tests/Makefile.am	2013-12-30 14:48:15 UTC (rev 1518)
+++ pkg/ProbABEL/checks/R-tests/Makefile.am	2013-12-30 17:39:17 UTC (rev 1519)
@@ -2,9 +2,9 @@
 
 AUTOMAKE_OPTIONS = foreign color-tests
 
-R_test_files =  run_models_in_R_palinear.R	\
- run_models_in_R_palogist.R			\
- run_models_in_R_pacox.R			\
+R_test_files = run_models_in_R_palinear.R run_model_linear.R	\
+ run_models_in_R_palogist.R run_model_logist.R			\
+ run_models_in_R_pacox.R run_model_coxph.R			\
  initial_checks.R
 
 check_SCRIPTS =
@@ -23,11 +23,81 @@
 
 
 testsdir = $(pkgdatadir)/checks/R-tests
-dist_tests_DATA = $(R_test_files) $(check_SCRIPTS)
-#dist_tests_SCRIPTS = $(check_SCRIPTS)
+AM_TESTS_ENVIRONMENT= \
+	PA_BINDIR=$(top_builddir)/src
+TESTS = $(check_SCRIPTS)
 
-TESTS_ENVIRONMENT = bash
+## The palogist R test still doesn't run correctly.
+XFAIL_TESTS = run_R_test_palogist.sh
 
+EXTRA_DIST = $(check_SCRIPTS) $(R_test_files)
 
 
-TESTS = $(check_SCRIPTS)
+##################################################
+# Files that need to be cleaned up after testing
+##################################################
+
+cleanfiles_bt = logist_add.out.txt logist_fv_add.out.txt	\
+logist_prob_2df.out.txt logist_prob_fv_2df.out.txt		\
+logist_prob_fv_domin.out.txt logist_prob_add.out.txt		\
+logist_prob_fv_add.out.txt logist_prob_over_domin.out.txt	\
+logist_prob_domin.out.txt logist_prob_fv_recess.out.txt		\
+logist_prob_fv_over_domin.out.txt logist_prob_recess.out.txt
+
+cleanfiles_qt = linear_base_add.out.txt linear_base_fv_add.out.txt	\
+linear_allcov_add.out.txt linear_allcov_fv_add.out.txt			\
+linear_int1_add.out.txt linear_int1_fv_add.out.txt			\
+linear_robust_add.out.txt linear_robust_fv_add.out.txt			\
+linear_robust_int1_add.out.txt linear_robust_int1_fv_add.out.txt	\
+linear_ngp2_add.out.txt linear_ngp2_fv_add.out.txt			\
+linear_ngp2_domin.out.txt linear_ngp2_fv_domin.out.txt			\
+linear_ngp2_over_domin.out.txt linear_ngp2_fv_over_domin.out.txt	\
+linear_ngp2_recess.out.txt linear_ngp2_fv_recess.out.txt		\
+linear_ngp2_2df.out.txt linear_ngp2_fv_2df.out.txt			\
+linear_ngp2_allcov_add.out.txt linear_ngp2_allcov_fv_add.out.txt	\
+linear_ngp2_allcov_domin.out.txt linear_ngp2_allcov_fv_domin.out.txt	\
+linear_ngp2_allcov_over_domin.out.txt					\
+linear_ngp2_allcov_fv_over_domin.out.txt				\
+linear_ngp2_allcov_recess.out.txt linear_ngp2_allcov_fv_recess.out.txt	\
+linear_ngp2_allcov_recess.out.txt linear_ngp2_allcov_fv_recess.out.txt	\
+linear_ngp2_int1_add.out.txt linear_ngp2_int1_fv_add.out.txt		\
+linear_ngp2_int1_domin.out.txt linear_ngp2_int1_fv_domin.out.txt	\
+linear_ngp2_int1_over_domin.out.txt					\
+linear_ngp2_int1_fv_over_domin.out.txt linear_ngp2_int1_recess.out.txt	\
+linear_ngp2_int1_fv_recess.out.txt linear_ngp2_int1_2df.out.txt		\
+linear_ngp2_int1_fv_2df.out.txt linear_ngp2_robust_add.out.txt		\
+linear_ngp2_robust_fv_add.out.txt linear_ngp2_robust_domin.out.txt	\
+linear_ngp2_robust_fv_domin.out.txt					\
+linear_ngp2_robust_over_domin.out.txt					\
+linear_ngp2_robust_fv_over_domin.out.txt				\
+linear_ngp2_robust_recess.out.txt linear_ngp2_robust_fv_recess.out.txt	\
+linear_ngp2_robust_2df.out.txt linear_ngp2_robust_fv_2df.out.txt	\
+linear_ngp2_robust_int1_add.out.txt					\
+linear_ngp2_robust_int1_fv_add.out.txt					\
+linear_ngp2_robust_int1_domin.out.txt					\
+linear_ngp2_robust_int1_fv_domin.out.txt				\
+linear_ngp2_robust_int1_over_domin.out.txt				\
+linear_ngp2_robust_int1_fv_over_domin.out.txt				\
+linear_ngp2_robust_int1_recess.out.txt					\
+linear_ngp2_robust_int1_fv_recess.out.txt				\
+linear_ngp2_robust_int1_2df.out.txt					\
+linear_ngp2_robust_int1_fv_2df.out.txt					\
+linear_ngp2_allcov_fv_2df.out.txt linear_ngp2_robust_fv_add.out.txt	\
+linear_ngp2_allcov_2df.out.txt
+
+cleanfiles_mms = mmscore_dose_add.out.txt mmscore_dose_fv_add.out.txt	\
+mmscore_prob_fv_over_domin.out.txt mmscore_prob_fv_domin.out.txt	\
+mmscore_prob_over_domin.out.txt mmscore_prob_fv_add.out.txt		\
+mmscore_prob_fv_recess.out.txt mmscore_prob_domin.out.txt		\
+mmscore_prob_recess.out.txt mmscore_prob_add.out.txt			\
+mmscore_prob_2df.out.txt mmscore_prob_fv_2df.out.txt
+
+cleanfiles_cox = coxph_dose_add.out.txt coxph_dose_fv_add.out.txt	\
+coxph_prob_fv_over_domin.out.txt coxph_prob_fv_domin.out.txt		\
+coxph_prob_over_domin.out.txt coxph_prob_fv_add.out.txt			\
+coxph_prob_fv_recess.out.txt coxph_prob_domin.out.txt			\
+coxph_prob_recess.out.txt coxph_prob_add.out.txt			\
+coxph_prob_2df.out.txt coxph_prob_fv_2df.out.txt
+
+CLEANFILES = $(cleanfiles_bt) $(cleanfiles_qt) $(cleanfiles_mms)	\
+ $(cleanfiles_cox)

Modified: pkg/ProbABEL/checks/R-tests/run_models_in_R_pacox.R
===================================================================
--- pkg/ProbABEL/checks/R-tests/run_models_in_R_pacox.R	2013-12-30 14:48:15 UTC (rev 1518)
+++ pkg/ProbABEL/checks/R-tests/run_models_in_R_pacox.R	2013-12-30 17:39:17 UTC (rev 1519)
@@ -23,29 +23,22 @@
 ## Run ProbABEL to get the output data we want to compare/verify
 ####
 cat("Running ProbABEL...\t\t\t\t")
-tmp <- system(paste0("cd ", tests.path,
-                     "; bash test_cox.sh 2> /dev/null; cd -"),
+tmp <- system(paste0("bash ", tests.path, "test_cox.sh 2> /dev/null"),
               intern=TRUE)
 cat("OK\n")
 
-dose.add.PA <- read.table(
-    paste0(tests.path, "coxph_dose_add.out.txt"),
-    head=TRUE)[, colsAddDose]
-prob.add.PA <- read.table(
-    paste0(tests.path, "coxph_prob_add.out.txt"),
-    head=TRUE)[, colsAddProb]
-prob.dom.PA <- read.table(
-    paste0(tests.path, "coxph_prob_domin.out.txt"),
-    head=TRUE)[, colsDom]
-prob.rec.PA <- read.table(
-    paste0(tests.path, "coxph_prob_recess.out.txt"),
-    head=TRUE)[, colsRec]
-prob.odom.PA <- read.table(
-    paste0(tests.path, "coxph_prob_over_domin.out.txt"),
-    head=TRUE)[, colsOdom]
-prob.2df.PA <- read.table(
-    paste0(tests.path, "coxph_prob_2df.out.txt"),
-    head=TRUE)[, cols2df]
+dose.add.PA <- read.table("coxph_dose_add.out.txt",
+                          head=TRUE)[, colsAddDose]
+prob.add.PA <- read.table("coxph_prob_add.out.txt",
+                          head=TRUE)[, colsAddProb]
+prob.dom.PA <- read.table("coxph_prob_domin.out.txt",
+                          head=TRUE)[, colsDom]
+prob.rec.PA <- read.table("coxph_prob_recess.out.txt",
+                          head=TRUE)[, colsRec]
+prob.odom.PA <- read.table("coxph_prob_over_domin.out.txt",
+                           head=TRUE)[, colsOdom]
+prob.2df.PA <- read.table("coxph_prob_2df.out.txt",
+                          head=TRUE)[, cols2df]
 
 ####
 ## run analysis in R
@@ -54,7 +47,7 @@
 
 cat("Comparing R output with ProbABEL output\t\t")
 
-source("run_model_coxph.R")
+source(paste0(srcdir, "run_model_coxph.R"))
 
 model.fn.0 <-
     "coxph( Surv(fupt_chd, chd)[noNA] ~ sex[noNA] + age[noNA] + othercov[noNA] )"

Modified: pkg/ProbABEL/checks/R-tests/run_models_in_R_palinear.R
===================================================================
--- pkg/ProbABEL/checks/R-tests/run_models_in_R_palinear.R	2013-12-30 14:48:15 UTC (rev 1518)
+++ pkg/ProbABEL/checks/R-tests/run_models_in_R_palinear.R	2013-12-30 17:39:17 UTC (rev 1519)
@@ -15,28 +15,22 @@
 ## Run ProbABEL to get the output data we want to compare/verify
 ####
 cat("Running ProbABEL...\t\t\t\t")
-tmp <- system(paste0("cd ", tests.path, "; bash test_qt.sh; cd -"),
+tmp <- system(paste0("bash ", tests.path, "test_qt.sh"),
               intern=TRUE)
 cat("OK\n")
 
-dose.add.PA <- read.table(
-    paste0(tests.path, "linear_base_add.out.txt"),
-    head=TRUE)[, colsAddDose]
-prob.add.PA <- read.table(
-    paste0(tests.path, "linear_ngp2_add.out.txt"),
-    head=TRUE)[, colsAddProb]
-prob.dom.PA <- read.table(
-    paste0(tests.path, "linear_ngp2_domin.out.txt"),
-    head=TRUE)[, colsDom]
-prob.rec.PA <- read.table(
-    paste0(tests.path, "linear_ngp2_recess.out.txt"),
-    head=TRUE)[, colsRec]
-prob.odom.PA <- read.table(
-    paste0(tests.path, "linear_ngp2_over_domin.out.txt"),
-    head=TRUE)[, colsOdom]
-prob.2df.PA <- read.table(
-    paste0(tests.path, "linear_ngp2_2df.out.txt"),
-    head=TRUE)[, cols2df]
+dose.add.PA <- read.table("linear_base_add.out.txt",
+                          head=TRUE)[, colsAddDose]
+prob.add.PA <- read.table("linear_ngp2_add.out.txt",
+                          head=TRUE)[, colsAddProb]
+prob.dom.PA <- read.table("linear_ngp2_domin.out.txt",
+                          head=TRUE)[, colsDom]
+prob.rec.PA <- read.table("linear_ngp2_recess.out.txt",
+                          head=TRUE)[, colsRec]
+prob.odom.PA <- read.table("linear_ngp2_over_domin.out.txt",
+                           head=TRUE)[, colsOdom]
+prob.2df.PA <- read.table("linear_ngp2_2df.out.txt",
+                          head=TRUE)[, cols2df]
 
 ## Fix betas, sebetas, chi^2 for the case that there is no variation
 ## (SNP 6 in the info file). ProbABEL lists them all as 0.0, R lists
@@ -51,7 +45,7 @@
 
 cat("Comparing R output with ProbABEL output\t\t")
 
-source("run_model_linear.R")
+source(paste0(srcdir, "run_model_linear.R"))
 
 model.fn.0 <- "lm( height[noNA] ~ sex[noNA] + age[noNA] )"
 model.fn   <- "lm( height ~ sex + age + snp )"

Modified: pkg/ProbABEL/checks/R-tests/run_models_in_R_palogist.R
===================================================================
--- pkg/ProbABEL/checks/R-tests/run_models_in_R_palogist.R	2013-12-30 14:48:15 UTC (rev 1518)
+++ pkg/ProbABEL/checks/R-tests/run_models_in_R_palogist.R	2013-12-30 17:39:17 UTC (rev 1519)
@@ -15,29 +15,27 @@
 ## Run ProbABEL to get the output data we want to compare/verify
 ####
 cat("Running ProbABEL...\t\t\t\t")
-tmp <- system(paste0("cd ", tests.path, "; bash test_bt.sh; cd -"),
+tmp <- system(paste0("bash ", tests.path, "test_bt.sh"),
               intern=TRUE)
 cat("OK\n")
 
-dose.add.PA <- read.table(
-    paste0(tests.path, "logist_add.out.txt"),
-    head=TRUE)[, colsAddDose]
-prob.add.PA <- read.table(
-    paste0(tests.path, "logist_prob_add.out.txt"),
-    head=TRUE)[, colsAddProb]
-prob.dom.PA <- read.table(
-    paste0(tests.path, "logist_prob_domin.out.txt"),
-    head=TRUE)[, colsDom]
-prob.rec.PA <- read.table(
-    paste0(tests.path, "logist_prob_recess.out.txt"),
-    head=TRUE)[, colsRec]
-prob.odom.PA <- read.table(
-    paste0(tests.path, "logist_prob_over_domin.out.txt"),
-    head=TRUE)[, colsOdom]
-prob.2df.PA <- read.table(
-    paste0(tests.path, "logist_prob_2df.out.txt"),
-    head=TRUE)[, cols2df]
+dose.add.PA <- read.table("logist_add.out.txt",
+                          head=TRUE)[, colsAddDose]
+prob.add.PA <- read.table("logist_prob_add.out.txt",
+                          head=TRUE)[, colsAddProb]
+prob.dom.PA <- read.table("logist_prob_domin.out.txt",
+                          head=TRUE)[, colsDom]
+prob.rec.PA <- read.table("logist_prob_recess.out.txt",
+                          head=TRUE)[, colsRec]
+prob.odom.PA <- read.table("logist_prob_over_domin.out.txt",
+                           head=TRUE)[, colsOdom]
+prob.2df.PA <- read.table("logist_prob_2df.out.txt",
+                          head=TRUE)[, cols2df]
 
+## Fix chi^2 for the case that there is no variation (SNP 6 in the
+## info file). ProbABEL lists it as NaN, R lists it as:
+prob.dom.PA[6, 4] <- 0.0
+
 ####
 ## run analysis in R
 ####
@@ -45,7 +43,7 @@
 
 cat("Comparing R output with ProbABEL output\t\t")
 
-source("run_model_logist.R")
+source(paste0(srcdir, "run_model_logist.R"))
 
 model.fn.0 <-
     "glm( chd[noNA] ~ sex[noNA] + age[noNA] + othercov[noNA], family=binomial)"
@@ -105,10 +103,16 @@
         model   <- glm( chd ~ sex + age + othercov + prob[, indexHet] +
                        prob[, indexHom], family=binomial )
         smA1A2  <- summary(model)$coef[5, 1:2]
-        smA1A1  <- summary(model)$coef[6, 1:2]
+
+        if ( nrow(summary(model)$coeff) > 5 ) {
+            smA1A1 <- summary(model)$coef[6, 1:2]
+        } else {
+            smA1A1 <- c(NaN, NaN)
+        }
+
         lrt     <- 2 * ( logLik( model ) - logLik( model.0 ) )
 
-        rsq <- resPa2df[i-2, "Rsq"]
+        rsq <- prob.2df.PA[i-2, "Rsq"]
         if( rsq < rsq.thresh) {
             row <- c(rsq, NaN, NaN, NaN, NaN, NaN)
         } else {

Modified: pkg/ProbABEL/checks/test_bt.sh
===================================================================
--- pkg/ProbABEL/checks/test_bt.sh	2013-12-30 14:48:15 UTC (rev 1518)
+++ pkg/ProbABEL/checks/test_bt.sh	2013-12-30 17:39:17 UTC (rev 1519)
@@ -6,17 +6,18 @@
 
 scriptdir=$(dirname $0)
 
+if [ -z ${PA_BINDIR} ]; then
+    PA_BINDIR="${scriptdir}/../src/"
+fi
 if [ -z ${srcdir} ]; then
     srcdir="."
-    bindir=${scriptdir}/../src/
-else
-    bindir="../src/"
+    PA_BINDIR=${scriptdir}/../src/
 fi
 
 . ${scriptdir}/run_diff.sh
 
 inputdir=${scriptdir}/inputfiles
-palogist=${bindir}/palogist
+palogist=${PA_BINDIR}/palogist
 
 # Redirect all output to file descriptor 3 to /dev/null except if
 # the first argument is "verbose" then redirect handle 3 to stdout

Modified: pkg/ProbABEL/checks/test_cox.sh
===================================================================
--- pkg/ProbABEL/checks/test_cox.sh	2013-12-30 14:48:15 UTC (rev 1518)
+++ pkg/ProbABEL/checks/test_cox.sh	2013-12-30 17:39:17 UTC (rev 1519)
@@ -5,17 +5,18 @@
 
 scriptdir=$(dirname $0)
 
+if [ -z ${PA_BINDIR} ]; then
+    PA_BINDIR="${scriptdir}/../src/"
+fi
 if [ -z ${srcdir} ]; then
     srcdir="."
-    bindir=${scriptdir}/../src/
-else
-    bindir="../src/"
+    PA_BINDIR=${scriptdir}/../src/
 fi
 
 . ${scriptdir}/run_diff.sh
 
 inputdir=${scriptdir}/inputfiles
-pacoxph=${bindir}/pacoxph
+pacoxph=${PA_BINDIR}/pacoxph
 
 # Redirect all output to file descriptor 3 to /dev/null except if
 # the first argument is "verbose" then redirect handle 3 to stdout

Modified: pkg/ProbABEL/checks/test_mms.sh
===================================================================
--- pkg/ProbABEL/checks/test_mms.sh	2013-12-30 14:48:15 UTC (rev 1518)
+++ pkg/ProbABEL/checks/test_mms.sh	2013-12-30 17:39:17 UTC (rev 1519)
@@ -6,17 +6,18 @@
 
 scriptdir=$(dirname $0)
 
+if [ -z ${PA_BINDIR} ]; then
+    PA_BINDIR="${scriptdir}/../src/"
+fi
 if [ -z ${srcdir} ]; then
     srcdir="."
-    bindir=${scriptdir}/../src/
-else
-    bindir="../src/"
+    PA_BINDIR=${scriptdir}/../src/
 fi
 
 . ${scriptdir}/run_diff.sh
 
 inputdir=${scriptdir}/inputfiles
-palinear=${bindir}/palinear
+palinear=${PA_BINDIR}/palinear
 
 # Redirect all output to file descriptor 3 to /dev/null except if
 # the first argument is "verbose" then redirect handle 3 to stdout

Modified: pkg/ProbABEL/checks/test_qt.sh
===================================================================
--- pkg/ProbABEL/checks/test_qt.sh	2013-12-30 14:48:15 UTC (rev 1518)
+++ pkg/ProbABEL/checks/test_qt.sh	2013-12-30 17:39:17 UTC (rev 1519)
@@ -6,17 +6,18 @@
 
 scriptdir=$(dirname $0)
 
+if [ -z ${PA_BINDIR} ]; then
+    PA_BINDIR="${scriptdir}/../src/"
+fi
 if [ -z ${srcdir} ]; then
     srcdir="."
-    bindir=${scriptdir}/../src/
-else
-    bindir="../src/"
+    PA_BINDIR=${scriptdir}/../src/
 fi
 
 . ${scriptdir}/run_diff.sh
 
 inputdir=${scriptdir}/inputfiles
-palinear=${bindir}/palinear
+palinear=${PA_BINDIR}/palinear
 
 # Redirect all output to file descriptor 3 to /dev/null except if
 # the first argument is "verbose" then redirect handle 3 to stdout

Modified: pkg/ProbABEL/configure.ac
===================================================================
--- pkg/ProbABEL/configure.ac	2013-12-30 14:48:15 UTC (rev 1518)
+++ pkg/ProbABEL/configure.ac	2013-12-30 17:39:17 UTC (rev 1519)
@@ -179,6 +179,7 @@
         doc/Makefile
         examples/Makefile
         checks/Makefile
+        checks/R-tests/Makefile
 ])
 
 # Create output files



More information about the Genabel-commits mailing list