[Genabel-commits] r1299 - in pkg/ProbABEL: . tests tests/R-tests
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Tue Aug 20 08:24:47 CEST 2013
Author: lckarssen
Date: 2013-08-20 08:24:47 +0200 (Tue, 20 Aug 2013)
New Revision: 1299
Added:
pkg/ProbABEL/tests/R-tests/Makefile.am
pkg/ProbABEL/tests/R-tests/initial_checks.R
pkg/ProbABEL/tests/R-tests/run_R_test_pacox.sh
pkg/ProbABEL/tests/R-tests/run_R_test_palinear.sh
pkg/ProbABEL/tests/R-tests/run_R_test_palogist.sh
Modified:
pkg/ProbABEL/configure.ac
pkg/ProbABEL/tests/Makefile.am
pkg/ProbABEL/tests/R-tests/
pkg/ProbABEL/tests/R-tests/run_models_in_R_pacox.R
pkg/ProbABEL/tests/R-tests/run_models_in_R_palinear.R
pkg/ProbABEL/tests/R-tests/run_models_in_R_palogist.R
Log:
Attempt to get the R-tests to run correctly when running 'make check'. That worked, however, when running 'make distcheck' the VPATH build failed (has to do with the separation of src path and build path). Therefore, I've removed the tests/R-test directory from /configure.ac and /Makefile.am for now.
At least this builds correctly and runs 'make distcheck' succesfully.
Copyright for this change is held by the Erasmus MC.
Modified: pkg/ProbABEL/configure.ac
===================================================================
--- pkg/ProbABEL/configure.ac 2013-08-19 11:04:24 UTC (rev 1298)
+++ pkg/ProbABEL/configure.ac 2013-08-20 06:24:47 UTC (rev 1299)
@@ -96,6 +96,7 @@
fi
AC_FUNC_FSEEKO
+
# Check for presence of sed. Needed to replace path to /etc in probabel.pl
AC_PROG_SED
@@ -107,9 +108,16 @@
if test -z "$PDFLATEX"; then
AC_MSG_WARN([Unable to create PDF version of the user manual])
fi
-
AM_CONDITIONAL([HAVE_PDFLATEX], test -n "$PDFLATEX")
+# Check for presence of R
+AC_CHECK_PROG(R, R, R)
+if test -z "$R"; then
+ AC_MSG_NOTICE([Unable to do tests comparing ProbABEL output against R output])
+fi
+AM_CONDITIONAL([HAVE_R], test -n "$R")
+
+
# Building of each of the three modules can be disabled on request
AC_ARG_ENABLE([palinear],
[AS_HELP_STRING([--disable-palinear], [disable building the palinear program])],
@@ -143,6 +151,7 @@
AM_CONDITIONAL([BUILD_pacoxph], test "x$pacoxph" = "xyes")
+
# Files to be generated by autotools
AC_CONFIG_FILES([
Makefile
@@ -151,5 +160,6 @@
examples/Makefile
tests/Makefile
])
+
# Create output files
AC_OUTPUT
Modified: pkg/ProbABEL/tests/Makefile.am
===================================================================
--- pkg/ProbABEL/tests/Makefile.am 2013-08-19 11:04:24 UTC (rev 1298)
+++ pkg/ProbABEL/tests/Makefile.am 2013-08-20 06:24:47 UTC (rev 1299)
@@ -32,6 +32,7 @@
other_files = probabel.pl probabel_config.cfg height.PHE test.mldose
+check_SCRIPTS =
testsdir = $(pkgdatadir)/tests
@@ -39,7 +40,7 @@
TESTS_ENVIRONMENT = bash
if BUILD_palinear
-check_SCRIPTS = $(tests_files)
+check_SCRIPTS += $(tests_files)
endif
TESTS = $(check_SCRIPTS)
Property changes on: pkg/ProbABEL/tests/R-tests
___________________________________________________________________
Added: svn:ignore
+ Makefile.in
Added: pkg/ProbABEL/tests/R-tests/Makefile.am
===================================================================
--- pkg/ProbABEL/tests/R-tests/Makefile.am (rev 0)
+++ pkg/ProbABEL/tests/R-tests/Makefile.am 2013-08-20 06:24:47 UTC (rev 1299)
@@ -0,0 +1,36 @@
+## Process this file with automake to produce Makefile.in
+
+AUTOMAKE_OPTIONS = foreign color-tests
+
+R_test_files = run_R_test_palinear.sh \
+ run_R_test_palogist.sh \
+ run_R_test_pacox.sh \
+ run_models_in_R_palinear.R \
+ run_models_in_R_palogist.R \
+ run_models_in_R_pacox.R \
+ initial_checks.R
+
+check_SCRIPTS =
+
+if HAVE_R
+if BUILD_palinear
+check_SCRIPTS += run_R_test_palinear.sh
+endif
+if BUILD_palogist
+check_SCRIPTS += run_R_test_palogist.sh
+endif
+if BUILD_pacoxph
+check_SCRIPTS += run_R_test_pacox.sh
+endif
+endif
+
+
+testsdir = $(pkgdatadir)/tests/R-tests
+dist_tests_DATA = $(R_test_files)
+
+
+TESTS_ENVIRONMENT = bash
+
+
+
+TESTS = $(check_SCRIPTS)
Added: pkg/ProbABEL/tests/R-tests/initial_checks.R
===================================================================
--- pkg/ProbABEL/tests/R-tests/initial_checks.R (rev 0)
+++ pkg/ProbABEL/tests/R-tests/initial_checks.R 2013-08-20 06:24:47 UTC (rev 1299)
@@ -0,0 +1,52 @@
+## This file contains the parts of the R code that are shared by the
+## three R-based checks for palinear, palogist and pacoxph,
+## respectively.
+
+## Set tolerance for comparing various outputs
+tol <- 1e-5
+
+
+####
+## load the data
+####
+example.path <- paste0(srcdir, "../../examples/")
+
+## load phenotypic data
+pheno <- read.table(paste0(example.path, pheno.file),
+ head=TRUE, string=FALSE)
+
+## load genetic DOSE data
+dose <- read.table(paste0(example.path, "test.mldose"),
+ head=FALSE, string=FALSE)
+## remove "1->" from the names of dose-IDs
+idNames <- dose[, 1]
+idNames <- sub("[0-9]+->", "", idNames)
+dose[, 1] <- idNames
+cat("Dose: check consistency of names\t\t")
+stopifnot( all.equal(dose[, 1], pheno[, 1], tol) )
+cat("OK\n")
+
+## load genetic PROB data
+prob <- read.table(paste0(example.path, "test.mlprob"),
+ head=FALSE, string=FALSE)
+## remove "1->" from the names of prob-IDs
+idNames <- prob[, 1]
+idNames <- sub("[0-9]+->", "", idNames)
+prob[, 1] <- idNames
+cat("Prob: check consistency of names\t\t")
+stopifnot( all.equal(prob[, 1], pheno[, 1], tol) )
+cat("OK\n")
+
+## check consistency DOSE <-> PROB
+doseFromProb <- matrix(NA, ncol=dim(dose)[2], nrow=dim(dose)[1])
+for (i in 3:dim(dose)[2]) {
+ indexHom <- 3 + ( i - 3 ) * 2
+ indexHet <- indexHom + 1
+ doseFromProb[, i] <- prob[, indexHom] * 2 + prob[, indexHet]
+}
+cat("Check consistency dose <-> prob gtdata\t\t")
+stopifnot( all.equal(dose[, 3:ncol(dose)],
+ as.data.frame(doseFromProb)[,3:ncol(doseFromProb)],
+ tol=tol )
+ )
+cat("OK\n")
Added: pkg/ProbABEL/tests/R-tests/run_R_test_pacox.sh
===================================================================
--- pkg/ProbABEL/tests/R-tests/run_R_test_pacox.sh (rev 0)
+++ pkg/ProbABEL/tests/R-tests/run_R_test_pacox.sh 2013-08-20 06:24:47 UTC (rev 1299)
@@ -0,0 +1,11 @@
+#!/bin/bash
+#
+# This script runs the R-based tests for Cox PH regression
+
+Rcommand="R --vanilla --slave"
+
+if [ -z ${srcdir} ]; then
+ srcdir="."
+fi
+
+$Rcommand -f ${srcdir}/run_models_in_R_pacox.R --args ${srcdir}/
Property changes on: pkg/ProbABEL/tests/R-tests/run_R_test_pacox.sh
___________________________________________________________________
Added: svn:executable
+ *
Added: pkg/ProbABEL/tests/R-tests/run_R_test_palinear.sh
===================================================================
--- pkg/ProbABEL/tests/R-tests/run_R_test_palinear.sh (rev 0)
+++ pkg/ProbABEL/tests/R-tests/run_R_test_palinear.sh 2013-08-20 06:24:47 UTC (rev 1299)
@@ -0,0 +1,11 @@
+#!/bin/bash
+#
+# This script runs the R-based tests for linear regression
+
+Rcommand="R --vanilla --slave"
+
+if [ -z ${srcdir} ]; then
+ srcdir="."
+fi
+
+$Rcommand -f ${srcdir}/run_models_in_R_palinear.R --args ${srcdir}/
Property changes on: pkg/ProbABEL/tests/R-tests/run_R_test_palinear.sh
___________________________________________________________________
Added: svn:executable
+ *
Added: pkg/ProbABEL/tests/R-tests/run_R_test_palogist.sh
===================================================================
--- pkg/ProbABEL/tests/R-tests/run_R_test_palogist.sh (rev 0)
+++ pkg/ProbABEL/tests/R-tests/run_R_test_palogist.sh 2013-08-20 06:24:47 UTC (rev 1299)
@@ -0,0 +1,11 @@
+#!/bin/bash
+#
+# This script runs the R-based tests for logistic regression
+
+Rcommand="R --vanilla --slave"
+
+if [ -z ${srcdir} ]; then
+ srcdir="."
+fi
+
+$Rcommand -f ${srcdir}/run_models_in_R_palogist.R --args ${srcdir}/
Property changes on: pkg/ProbABEL/tests/R-tests/run_R_test_palogist.sh
___________________________________________________________________
Added: svn:executable
+ *
Modified: pkg/ProbABEL/tests/R-tests/run_models_in_R_pacox.R
===================================================================
--- pkg/ProbABEL/tests/R-tests/run_models_in_R_pacox.R 2013-08-19 11:04:24 UTC (rev 1298)
+++ pkg/ProbABEL/tests/R-tests/run_models_in_R_pacox.R 2013-08-20 06:24:47 UTC (rev 1299)
@@ -1,59 +1,22 @@
cat("Checking Cox PH regression...\n")
library(survival)
-## Set tolerance for comparing various outputs
-tol <- 1e-5
+args <- commandArgs(TRUE)
+srcdir <- args[1]
-###
-# load the data
-###
-example.path <- "../../examples/"
+if (is.na(srcdir)) {
+ srcdir <- "./"
+}
-# load phenotypic data
-pheno <- read.table("../../examples/coxph_data.txt", head=TRUE,
- string=FALSE)
+pheno.file <- "coxph_data.txt"
-# load genetic DOSE data
-dose <- read.table("../../examples/test.mldose",
- head=FALSE, string=FALSE)
-# remove "1->" from the names of dose-IDs
-idNames <- dose[, 1]
-idNames <- sub("[0-9]+->", "", idNames)
-dose[, 1] <- idNames
-cat("Dose: check consistency of names\t\t")
-stopifnot( all.equal(dose[, 1], pheno[, 1], tol) )
-cat("OK\n")
+source(paste0(srcdir, "initial_checks.R"))
-# load genetic PROB data
-prob <- read.table("../../examples/test.mlprob",
- head=FALSE, string=FALSE)
-# remove "1->" from the names of prob-IDs
-idNames <- prob[, 1]
-idNames <- sub("[0-9]+->", "", idNames)
-prob[, 1] <- idNames
-cat("Prob: check consistency of names\t\t")
-stopifnot( all.equal(prob[, 1], pheno[, 1], tol) )
-cat("OK\n")
-
-# check consistency DOSE <-> PROB
-doseFromProb <- matrix(NA, ncol=dim(dose)[2], nrow=dim(dose)[1])
-for (i in 3:dim(dose)[2]) {
- indexHom <- 3 + ( i - 3 ) * 2
- indexHet <- indexHom + 1
- doseFromProb[, i] <- prob[, indexHom] * 2 + prob[, indexHet]
-}
-cat("Check consistency dose <-> prob gtdata\t\t")
-stopifnot( all.equal(dose[, 3:ncol(dose)],
- as.data.frame(doseFromProb)[,3:ncol(doseFromProb)],
- tol=tol )
- )
-cat("OK\n")
-
####
## Run ProbABEL to get the output data we want to compare/verify
####
cat("Running ProbABEL...\t\t\t\t")
-tmp <- system("cd ../../examples/; sh example_cox.sh; cd -",
+tmp <- system(paste0("cd ", example.path, "; bash example_cox.sh; cd -"),
intern=TRUE)
cat("OK\n")
Modified: pkg/ProbABEL/tests/R-tests/run_models_in_R_palinear.R
===================================================================
--- pkg/ProbABEL/tests/R-tests/run_models_in_R_palinear.R 2013-08-19 11:04:24 UTC (rev 1298)
+++ pkg/ProbABEL/tests/R-tests/run_models_in_R_palinear.R 2013-08-20 06:24:47 UTC (rev 1299)
@@ -1,93 +1,61 @@
-## Set tolerance for comparing various outputs
-tol <- 1e-5
+cat("Checking linear regression...\n")
-####
-## load the data
-####
+args <- commandArgs(TRUE)
+srcdir <- args[1]
-## load phenotypic data
-pheno <- read.table("../../examples/height.txt", head=TRUE, string=FALSE)
+if (is.na(srcdir)) {
+ srcdir <- "./"
+}
-## load genetic DOSE data
-dose <- read.table("../../examples/test.mldose", head=FALSE, string=FALSE)
-## remove "1->" from the names of dose-IDs
-idNames <- dose[, 1]
-idNames <- sub("[0-9]+->", "", idNames)
-dose[, 1] <- idNames
-cat("Dose: check consistency of names\t\t")
-stopifnot( all.equal(dose[, 1], pheno[, 1], tol) )
-cat("OK\n")
+pheno.file <- "height.txt"
-## load genetic PROB data
-prob <- read.table("../../examples/test.mlprob", head=FALSE, string=FALSE)
-## remove "1->" from the names of prob-IDs
-idNames <- prob[, 1]
-idNames <- sub("[0-9]+->", "", idNames)
-prob[, 1] <- idNames
-cat("Prob: check consistency of names\t\t")
-stopifnot( all.equal(prob[, 1], pheno[, 1], tol) )
-cat("OK\n")
+source(paste0(srcdir, "initial_checks.R"))
-## check consistency DOSE <-> PROB
-doseFromProb <- matrix(NA, ncol=dim(dose)[2], nrow=dim(dose)[1])
-for (i in 3:dim(dose)[2]) {
- indexHom <- 3 + ( i - 3 ) * 2
- indexHet <- indexHom + 1
- doseFromProb[, i] <- prob[, indexHom] * 2 + prob[, indexHet]
-}
-cat("Check consistency dose <-> prob\t\t\t")
-stopifnot( all.equal(dose[, 3:ncol(dose)],
- as.data.frame(doseFromProb)[,3:ncol(doseFromProb)],
- tol=tol )
- )
-cat("OK\n")
-
####
## Run ProbABEL to get the output data we want to compare/verify
####
cat("Running ProbABEL...\t\t\t\t")
-tmp <- system("cd ../../examples/; sh example_qt.sh; cd -",
+tmp <- system(paste0("cd ", example.path, "; bash example_qt.sh; cd -"),
intern=TRUE)
cat("OK\n")
-resPaAddDose <-
- read.table("../../examples/height_base_add.out.txt",
- head=TRUE)[,
- c("beta_SNP_add",
- "sebeta_SNP_add",
- "chi2_SNP")]
-resPaAddProb <-
- read.table("../../examples/height_ngp2_add.out.txt",
- head=TRUE)[,
- c("beta_SNP_addA1",
- "sebeta_SNP_addA1",
- "chi2_SNP_A1")]
-resPaDom <-
- read.table("../../examples/height_ngp2_domin.out.txt",
- head=TRUE)[,
- c("beta_SNP_domA1",
- "sebeta_SNP_domA1",
- "chi2_SNP_domA1")]
-resPaRec <-
- read.table("../../examples/height_ngp2_recess.out.txt",
- head=TRUE)[,
- c("beta_SNP_recA1",
- "sebeta_SNP_recA1",
- "chi2_SNP_recA1")]
-resPaOdom <-
- read.table("../../examples/height_ngp2_over_domin.out.txt",
- head=TRUE)[,
- c("beta_SNP_odomA1",
- "sebeta_SNP_odomA1",
- "chi2_SNP_odomA1")]
-resPa2df <-
- read.table("../../examples/height_ngp2_2df.out.txt",
- head=TRUE)[,
- c("beta_SNP_A1A2",
- "sebeta_SNP_A1A2",
- "beta_SNP_A1A1",
- "sebeta_SNP_A1A1",
- "chi2_SNP_2df")]
+resPaAddDose <- read.table(
+ paste0(example.path, "height_base_add.out.txt"),
+ head=TRUE)[,
+ c("beta_SNP_add",
+ "sebeta_SNP_add",
+ "chi2_SNP")]
+resPaAddProb <- read.table(
+ paste0(example.path, "height_ngp2_add.out.txt"),
+ head=TRUE)[, c("beta_SNP_addA1",
+ "sebeta_SNP_addA1",
+ "chi2_SNP_A1")]
+resPaDom <- read.table(
+ paste0(example.path, "height_ngp2_domin.out.txt"),
+ head=TRUE)[,
+ c("beta_SNP_domA1",
+ "sebeta_SNP_domA1",
+ "chi2_SNP_domA1")]
+resPaRec <- read.table(
+ paste0(example.path, "height_ngp2_recess.out.txt"),
+ head=TRUE)[,
+ c("beta_SNP_recA1",
+ "sebeta_SNP_recA1",
+ "chi2_SNP_recA1")]
+resPaOdom <- read.table(
+ paste0(example.path, "height_ngp2_over_domin.out.txt"),
+ head=TRUE)[,
+ c("beta_SNP_odomA1",
+ "sebeta_SNP_odomA1",
+ "chi2_SNP_odomA1")]
+resPa2df <- read.table(
+ paste0(example.path, "height_ngp2_2df.out.txt"),
+ head=TRUE)[,
+ c("beta_SNP_A1A2",
+ "sebeta_SNP_A1A2",
+ "beta_SNP_A1A1",
+ "sebeta_SNP_A1A1",
+ "chi2_SNP_2df")]
####
## run analysis in R
Modified: pkg/ProbABEL/tests/R-tests/run_models_in_R_palogist.R
===================================================================
--- pkg/ProbABEL/tests/R-tests/run_models_in_R_palogist.R 2013-08-19 11:04:24 UTC (rev 1298)
+++ pkg/ProbABEL/tests/R-tests/run_models_in_R_palogist.R 2013-08-20 06:24:47 UTC (rev 1299)
@@ -1,59 +1,22 @@
cat("Checking logistic regression...\n")
-## Set tolerance for comparing various outputs
-tol <- 1e-5
+args <- commandArgs(TRUE)
+srcdir <- args[1]
+if (is.na(srcdir)) {
+ srcdir <- "./"
+}
-####
-## load the data
-####
-example.path <- paste0("../../examples/")
+pheno.file <- "logist_data.txt"
-## load phenotypic data
-pheno <- read.table(paste0(example.path, "logist_data.txt"),
- head=TRUE, string=FALSE)
+source(paste0(srcdir, "initial_checks.R"))
-## load genetic DOSE data
-dose <- read.table(paste0(example.path, "test.mldose"),
- head=FALSE, string=FALSE)
-## remove "1->" from the names of dose-IDs
-idNames <- dose[, 1]
-idNames <- sub("[0-9]+->", "", idNames)
-dose[, 1] <- idNames
-cat("Dose: check consistency of names\t\t")
-stopifnot( all.equal(dose[, 1], pheno[, 1], tol) )
-cat("OK\n")
-## load genetic PROB data
-prob <- read.table(paste0(example.path, "test.mlprob"),
- head=FALSE, string=FALSE)
-## remove "1->" from the names of prob-IDs
-idNames <- prob[, 1]
-idNames <- sub("[0-9]+->", "", idNames)
-prob[, 1] <- idNames
-cat("Prob: check consistency of names\t\t")
-stopifnot( all.equal(prob[, 1], pheno[, 1], tol) )
-cat("OK\n")
-
-## check consistency DOSE <-> PROB
-doseFromProb <- matrix(NA, ncol=dim(dose)[2], nrow=dim(dose)[1])
-for (i in 3:dim(dose)[2]) {
- indexHom <- 3 + ( i - 3 ) * 2
- indexHet <- indexHom + 1
- doseFromProb[, i] <- prob[, indexHom] * 2 + prob[, indexHet]
-}
-cat("Check consistency dose <-> prob gtdata\t\t")
-stopifnot( all.equal(dose[, 3:ncol(dose)],
- as.data.frame(doseFromProb)[,3:ncol(doseFromProb)],
- tol=tol )
- )
-cat("OK\n")
-
####
## Run ProbABEL to get the output data we want to compare/verify
####
cat("Running ProbABEL...\t\t\t\t")
-tmp <- system(paste0("cd ", example.path, "; sh example_bt.sh; cd -"),
+tmp <- system(paste0("cd ", example.path, "; bash example_bt.sh; cd -"),
intern=TRUE)
cat("OK\n")
More information about the Genabel-commits
mailing list