[Genabel-commits] r1687 - in branches: . ProbABEL-pvals/ProbABEL ProbABEL-pvals/ProbABEL/checks ProbABEL-pvals/ProbABEL/checks/R-tests ProbABEL-pvals/ProbABEL/checks/verified_results ProbABEL-pvals/ProbABEL/examples ProbABEL-pvals/ProbABEL/examples/gtdata ProbABEL-pvals/ProbABEL/src
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Tue Apr 8 09:31:05 CEST 2014
Author: lckarssen
Date: 2014-04-08 09:31:04 +0200 (Tue, 08 Apr 2014)
New Revision: 1687
Added:
branches/ProbABEL-pvals/ProbABEL/src/fvlib
Removed:
branches/ProbABEL-0.50/
branches/ProbABEL-pvals/ProbABEL/src/fvlib
Modified:
branches/ProbABEL-pvals/ProbABEL/checks/R-tests/initial_checks.R
branches/ProbABEL-pvals/ProbABEL/checks/R-tests/run_models_in_R_pacox.R
branches/ProbABEL-pvals/ProbABEL/checks/R-tests/run_models_in_R_palinear.R
branches/ProbABEL-pvals/ProbABEL/checks/R-tests/run_models_in_R_palogist.R
branches/ProbABEL-pvals/ProbABEL/checks/run_diff.sh
branches/ProbABEL-pvals/ProbABEL/checks/test_bt.sh
branches/ProbABEL-pvals/ProbABEL/checks/test_cox.sh
branches/ProbABEL-pvals/ProbABEL/checks/test_mms.sh
branches/ProbABEL-pvals/ProbABEL/checks/test_qt.sh
branches/ProbABEL-pvals/ProbABEL/checks/verified_results/height_add.out.txt
branches/ProbABEL-pvals/ProbABEL/checks/verified_results/height_base_add.out.txt
branches/ProbABEL-pvals/ProbABEL/checks/verified_results/height_ngp2_add.out.txt
branches/ProbABEL-pvals/ProbABEL/checks/verified_results/height_ngp2_domin.out.txt
branches/ProbABEL-pvals/ProbABEL/checks/verified_results/height_ngp2_over_domin.out.txt
branches/ProbABEL-pvals/ProbABEL/checks/verified_results/height_ngp2_recess.out.txt
branches/ProbABEL-pvals/ProbABEL/configure.ac
branches/ProbABEL-pvals/ProbABEL/examples/gtdata/test.map
branches/ProbABEL-pvals/ProbABEL/examples/gtdata/test.mlinfo
branches/ProbABEL-pvals/ProbABEL/examples/mmscore.R
branches/ProbABEL-pvals/ProbABEL/src/cholesky.cpp
branches/ProbABEL-pvals/ProbABEL/src/command_line_settings.cpp
branches/ProbABEL-pvals/ProbABEL/src/command_line_settings.h
branches/ProbABEL-pvals/ProbABEL/src/coxph_data.cpp
branches/ProbABEL-pvals/ProbABEL/src/coxph_data.h
branches/ProbABEL-pvals/ProbABEL/src/data.cpp
branches/ProbABEL-pvals/ProbABEL/src/data.h
branches/ProbABEL-pvals/ProbABEL/src/gendata.cpp
branches/ProbABEL-pvals/ProbABEL/src/gendata.h
branches/ProbABEL-pvals/ProbABEL/src/main.cpp
branches/ProbABEL-pvals/ProbABEL/src/main_functions_dump.cpp
branches/ProbABEL-pvals/ProbABEL/src/maskedmatrix.cpp
branches/ProbABEL-pvals/ProbABEL/src/maskedmatrix.h
branches/ProbABEL-pvals/ProbABEL/src/probabel
branches/ProbABEL-pvals/ProbABEL/src/reg1.cpp
branches/ProbABEL-pvals/ProbABEL/src/reg1.h
branches/ProbABEL-pvals/ProbABEL/src/regdata.cpp
branches/ProbABEL-pvals/ProbABEL/src/regdata.h
Log:
Remove the ProbABEL 0.50 branch, as it has been integrated in trunk in SVN r1682.
Modified: branches/ProbABEL-pvals/ProbABEL/checks/R-tests/initial_checks.R
===================================================================
--- branches/ProbABEL-pvals/ProbABEL/checks/R-tests/initial_checks.R 2014-04-08 07:28:06 UTC (rev 1686)
+++ branches/ProbABEL-pvals/ProbABEL/checks/R-tests/initial_checks.R 2014-04-08 07:31:04 UTC (rev 1687)
@@ -65,26 +65,22 @@
## Define column names of the various ProbABEL output file headers
-colsAddDose <- c("Rsq",
- "beta_SNP_add",
- "sebeta_SNP_add",
- "chi2_SNP")
-colsAddProb <- c("Rsq",
- "beta_SNP_addA1",
- "sebeta_SNP_addA1",
- "chi2_SNP_A1")
+colsAdd <- c("Rsq",
+ "beta_SNP_addA1",
+ "sebeta_SNP_addA1",
+ "chi2_SNP_add")
colsDom <- c("Rsq",
"beta_SNP_domA1",
"sebeta_SNP_domA1",
- "chi2_SNP_domA1")
+ "chi2_SNP_dom")
colsRec <- c("Rsq",
"beta_SNP_recA1",
"sebeta_SNP_recA1",
- "chi2_SNP_recA1")
+ "chi2_SNP_rec")
colsOdom <-c("Rsq",
"beta_SNP_odomA1",
"sebeta_SNP_odomA1",
- "chi2_SNP_odomA1")
+ "chi2_SNP_odom")
cols2df <- c("Rsq",
"beta_SNP_A1A2",
"sebeta_SNP_A1A2",
Modified: branches/ProbABEL-pvals/ProbABEL/checks/R-tests/run_models_in_R_pacox.R
===================================================================
--- branches/ProbABEL-pvals/ProbABEL/checks/R-tests/run_models_in_R_pacox.R 2014-04-08 07:28:06 UTC (rev 1686)
+++ branches/ProbABEL-pvals/ProbABEL/checks/R-tests/run_models_in_R_pacox.R 2014-04-08 07:31:04 UTC (rev 1687)
@@ -31,9 +31,9 @@
cat("OK\n")
dose.add.PA <- read.table("coxph_dose_add.out.txt",
- head=TRUE)[, colsAddDose]
+ head=TRUE)[, colsAdd]
prob.add.PA <- read.table("coxph_prob_add.out.txt",
- head=TRUE)[, colsAddProb]
+ head=TRUE)[, colsAdd]
prob.dom.PA <- read.table("coxph_prob_domin.out.txt",
head=TRUE)[, colsDom]
prob.rec.PA <- read.table("coxph_prob_recess.out.txt",
@@ -59,7 +59,7 @@
## Additive model, dosages
snpdose <- "dose[, i]"
dose.add.R <- run.model(model.fn.0, model.fn, snpdose)
-colnames(dose.add.R) <- colsAddDose
+colnames(dose.add.R) <- colsAdd
rownames(dose.add.R) <- NULL
stopifnot( all.equal(dose.add.PA, dose.add.R, tol=tol) )
cat("additive ")
@@ -68,7 +68,7 @@
## Additive model, probabilities
snpprob <- "doseFromProb[, i]"
prob.add.R <- run.model(model.fn.0, model.fn, snpprob)
-colnames(prob.add.R) <- colsAddProb
+colnames(prob.add.R) <- colsAdd
rownames(prob.add.R) <- NULL
stopifnot( all.equal(prob.add.PA, prob.add.R, tol=tol) )
cat("additive ")
Modified: branches/ProbABEL-pvals/ProbABEL/checks/R-tests/run_models_in_R_palinear.R
===================================================================
--- branches/ProbABEL-pvals/ProbABEL/checks/R-tests/run_models_in_R_palinear.R 2014-04-08 07:28:06 UTC (rev 1686)
+++ branches/ProbABEL-pvals/ProbABEL/checks/R-tests/run_models_in_R_palinear.R 2014-04-08 07:31:04 UTC (rev 1687)
@@ -20,9 +20,9 @@
cat("OK\n")
dose.add.PA <- read.table("linear_base_add.out.txt",
- head=TRUE)[, colsAddDose]
+ head=TRUE)[, colsAdd]
prob.add.PA <- read.table("linear_ngp2_add.out.txt",
- head=TRUE)[, colsAddProb]
+ head=TRUE)[, colsAdd]
prob.dom.PA <- read.table("linear_ngp2_domin.out.txt",
head=TRUE)[, colsDom]
prob.rec.PA <- read.table("linear_ngp2_recess.out.txt",
@@ -36,7 +36,11 @@
## (SNP 6 in the info file). ProbABEL lists them all as 0.0, R lists
## them as:
prob.dom.PA[6, 2:4] <- c(NaN, NaN, 0.0)
+#for 2df model the last SNP is interchangeable: EIGEN calculates the beta for the other SNP than R. This causes the beta to have the wrong sign. This part of change the position of the snp beta(and swaps sign) and SE if beta and other SE are 0
+if (sum(abs(prob.2df.PA[6, 2:3]))==0){
+prob.2df.PA[6, 2:3] <-c(prob.2df.PA[6, 4]*-1,prob.2df.PA[6, 5])
prob.2df.PA[6, 4:5] <- c(NA, NA)
+}
####
## run analysis in R
@@ -53,7 +57,7 @@
## Additive model, dosages
snpdose <- "dose[, i]"
dose.add.R <- run.model(model.fn.0, model.fn, snpdose)
-colnames(dose.add.R) <- colsAddDose
+colnames(dose.add.R) <- colsAdd
rownames(dose.add.R) <- NULL
stopifnot( all.equal(dose.add.PA, dose.add.R, tol=tol) )
cat("additive ")
@@ -62,7 +66,7 @@
## Additive model, probabilities
snpprob <- "doseFromProb[, i]"
prob.add.R <- run.model(model.fn.0, model.fn, snpprob)
-colnames(prob.add.R) <- colsAddProb
+colnames(prob.add.R) <- colsAdd
rownames(prob.add.R) <- NULL
stopifnot( all.equal(prob.add.PA, prob.add.R, tol=tol) )
cat("additive ")
@@ -123,6 +127,7 @@
}
colnames(prob.2df.R) <- cols2df
rownames(prob.2df.R) <- NULL
+
stopifnot( all.equal(prob.2df.PA, prob.2df.R, tol=tol) )
cat("2df\n")
Modified: branches/ProbABEL-pvals/ProbABEL/checks/R-tests/run_models_in_R_palogist.R
===================================================================
--- branches/ProbABEL-pvals/ProbABEL/checks/R-tests/run_models_in_R_palogist.R 2014-04-08 07:28:06 UTC (rev 1686)
+++ branches/ProbABEL-pvals/ProbABEL/checks/R-tests/run_models_in_R_palogist.R 2014-04-08 07:31:04 UTC (rev 1687)
@@ -20,9 +20,9 @@
cat("OK\n")
dose.add.PA <- read.table("logist_add.out.txt",
- head=TRUE)[, colsAddDose]
+ head=TRUE)[, colsAdd]
prob.add.PA <- read.table("logist_prob_add.out.txt",
- head=TRUE)[, colsAddProb]
+ head=TRUE)[, colsAdd]
prob.dom.PA <- read.table("logist_prob_domin.out.txt",
head=TRUE)[, colsDom]
prob.rec.PA <- read.table("logist_prob_recess.out.txt",
@@ -52,7 +52,7 @@
## Additive model, dosages
snpdose <- "dose[, i]"
dose.add.R <- run.model(model.fn.0, model.fn, snpdose)
-colnames(dose.add.R) <- colsAddDose
+colnames(dose.add.R) <- colsAdd
rownames(dose.add.R) <- NULL
stopifnot( all.equal(dose.add.PA, dose.add.R, tol=tol) )
cat("additive ")
@@ -60,7 +60,7 @@
## Additive model, probabilities
snpprob <- "doseFromProb[, i]"
prob.add.R <- run.model(model.fn.0, model.fn, snpprob)
-colnames(prob.add.R) <- colsAddProb
+colnames(prob.add.R) <- colsAdd
rownames(prob.add.R) <- NULL
stopifnot( all.equal(prob.add.PA, prob.add.R, tol=tol) )
cat("additive ")
Modified: branches/ProbABEL-pvals/ProbABEL/checks/run_diff.sh
===================================================================
--- branches/ProbABEL-pvals/ProbABEL/checks/run_diff.sh 2014-04-08 07:28:06 UTC (rev 1686)
+++ branches/ProbABEL-pvals/ProbABEL/checks/run_diff.sh 2014-04-08 07:31:04 UTC (rev 1687)
@@ -8,19 +8,13 @@
# $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
+ name=$3
blanks=" "
- if diff $args "$file1" "$file2"; then
+ if diff "$file1" "$file2"; then
echo -e "${name}${blanks:${#name}} OK"
else
echo -e "${name}${blanks:${#name}} FAILED"
Modified: branches/ProbABEL-pvals/ProbABEL/checks/test_bt.sh
===================================================================
--- branches/ProbABEL-pvals/ProbABEL/checks/test_bt.sh 2014-04-08 07:28:06 UTC (rev 1686)
+++ branches/ProbABEL-pvals/ProbABEL/checks/test_bt.sh 2014-04-08 07:31:04 UTC (rev 1687)
@@ -78,10 +78,8 @@
run_diff logist_prob_add.out.txt \
logist_add.out.txt \
- "BT check: prob vs. dose" \
- -I beta_SNP
+ "BT check: prob vs. dose"
run_diff logist_prob_fv_add.out.txt \
logist_fv_add.out.txt \
- "BT check: prob_fv vs. dose_fv" \
- -I beta_SNP
+ "BT check: prob_fv vs. dose_fv"
Modified: branches/ProbABEL-pvals/ProbABEL/checks/test_cox.sh
===================================================================
--- branches/ProbABEL-pvals/ProbABEL/checks/test_cox.sh 2014-04-08 07:28:06 UTC (rev 1686)
+++ branches/ProbABEL-pvals/ProbABEL/checks/test_cox.sh 2014-04-08 07:31:04 UTC (rev 1687)
@@ -59,7 +59,7 @@
>& 3
run_diff coxph_dose_add.out.txt coxph_prob_add.out.txt \
- "pacoxph check: dose vs. prob" -I SNP
+ "pacoxph check: dose vs. prob"
$pacoxph \
Modified: branches/ProbABEL-pvals/ProbABEL/checks/test_mms.sh
===================================================================
--- branches/ProbABEL-pvals/ProbABEL/checks/test_mms.sh 2014-04-08 07:28:06 UTC (rev 1686)
+++ branches/ProbABEL-pvals/ProbABEL/checks/test_mms.sh 2014-04-08 07:31:04 UTC (rev 1687)
@@ -1,7 +1,6 @@
#!/bin/bash
# This script runs checks on ProbABEL's palinear module for
# quantitative traits combined with the mmscore option.
-
echo "Analysis using MMScore..."
scriptdir=$(dirname $0)
@@ -77,10 +76,8 @@
run_diff mmscore_prob_add.out.txt \
mmscore_dose_add.out.txt \
- "mmscore check: prob vs. dose" \
- -I SNP
+ "mmscore check: prob vs. dose"
run_diff mmscore_prob_fv_add.out.txt \
mmscore_dose_fv_add.out.txt \
- "mmscore check: prob_fv vs. dose_fv" \
- -I SNP
+ "mmscore check: prob_fv vs. dose_fv"
Modified: branches/ProbABEL-pvals/ProbABEL/checks/test_qt.sh
===================================================================
--- branches/ProbABEL-pvals/ProbABEL/checks/test_qt.sh 2014-04-08 07:28:06 UTC (rev 1686)
+++ branches/ProbABEL-pvals/ProbABEL/checks/test_qt.sh 2014-04-08 07:31:04 UTC (rev 1687)
@@ -164,7 +164,7 @@
# Remove header from the outputs, because they differ
run_diff linear_base_add.out.txt \
linear_ngp2_add.out.txt \
- "QT check: dose vs. prob (additive model)" -I SNP
+ "QT check: dose vs. prob (additive model)"
for model in add domin over_domin recess 2df; do
run_diff linear_ngp2_${model}.out.txt \
Modified: branches/ProbABEL-pvals/ProbABEL/checks/verified_results/height_add.out.txt
===================================================================
--- branches/ProbABEL-pvals/ProbABEL/checks/verified_results/height_add.out.txt 2014-04-08 07:28:06 UTC (rev 1686)
+++ branches/ProbABEL-pvals/ProbABEL/checks/verified_results/height_add.out.txt 2014-04-08 07:31:04 UTC (rev 1687)
@@ -1,4 +1,4 @@
-name A1 A2 Freq1 MAF Quality Rsq n Mean_predictor_allele chrom position beta_SNP_add sebeta_SNP_add chi2_SNP
+name A1 A2 Freq1 MAF Quality Rsq n Mean_predictor_allele chrom position beta_SNP_addA1 sebeta_SNP_addA1 chi2_SNP_add
rs7247199 GAC A 0.5847 0.415 0.9299 0.8666 182 0.333668 1 204938 20.3847 76.6302 0.0723394
rs8102643 C TGGT 0.5847 0.415 0.9308 0.8685 181 0.808177 1 207859 -25.7632 86.4877 0.0907169
rs8102615 T A 0.5006 0.4702 0.9375 0.8932 182 0.8665 2 211970 -40.7722 102.559 0.161525
Modified: branches/ProbABEL-pvals/ProbABEL/checks/verified_results/height_base_add.out.txt
===================================================================
--- branches/ProbABEL-pvals/ProbABEL/checks/verified_results/height_base_add.out.txt 2014-04-08 07:28:06 UTC (rev 1686)
+++ branches/ProbABEL-pvals/ProbABEL/checks/verified_results/height_base_add.out.txt 2014-04-08 07:31:04 UTC (rev 1687)
@@ -1,4 +1,4 @@
-name A1 A2 Freq1 MAF Quality Rsq n Mean_predictor_allele chrom position beta_SNP_add sebeta_SNP_add chi2_SNP
+name A1 A2 Freq1 MAF Quality Rsq n Mean_predictor_allele chrom position beta_SNP_addA1 sebeta_SNP_addA1 chi2_SNP_add
rs7247199 GAC A 0.5847 0.415 0.9299 0.8666 182 0.333668 19 204938 20.3847 76.6302 0.0723394
rs8102643 C TGGT 0.5847 0.415 0.9308 0.8685 181 0.808177 19 207859 -25.7632 86.4877 0.0907169
rs8102615 T A 0.5006 0.4702 0.9375 0.8932 182 0.8665 19 211970 -40.7722 102.559 0.161525
Modified: branches/ProbABEL-pvals/ProbABEL/checks/verified_results/height_ngp2_add.out.txt
===================================================================
--- branches/ProbABEL-pvals/ProbABEL/checks/verified_results/height_ngp2_add.out.txt 2014-04-08 07:28:06 UTC (rev 1686)
+++ branches/ProbABEL-pvals/ProbABEL/checks/verified_results/height_ngp2_add.out.txt 2014-04-08 07:31:04 UTC (rev 1687)
@@ -1,4 +1,4 @@
-name A1 A2 Freq1 MAF Quality Rsq n Mean_predictor_allele chrom position beta_SNP_addA1 sebeta_SNP_addA1 chi2_SNP_A1
+name A1 A2 Freq1 MAF Quality Rsq n Mean_predictor_allele chrom position beta_SNP_addA1 sebeta_SNP_addA1 chi2_SNP_add
rs7247199 GAC A 0.5847 0.415 0.9299 0.8666 182 0.333668 1 204938 20.3847 76.6302 0.0723394
rs8102643 C TGGT 0.5847 0.415 0.9308 0.8685 181 0.808177 1 207859 -25.7632 86.4877 0.0907169
rs8102615 T A 0.5006 0.4702 0.9375 0.8932 182 0.8665 2 211970 -40.7722 102.559 0.161525
Modified: branches/ProbABEL-pvals/ProbABEL/checks/verified_results/height_ngp2_domin.out.txt
===================================================================
--- branches/ProbABEL-pvals/ProbABEL/checks/verified_results/height_ngp2_domin.out.txt 2014-04-08 07:28:06 UTC (rev 1686)
+++ branches/ProbABEL-pvals/ProbABEL/checks/verified_results/height_ngp2_domin.out.txt 2014-04-08 07:31:04 UTC (rev 1687)
@@ -1,4 +1,4 @@
-name A1 A2 Freq1 MAF Quality Rsq n Mean_predictor_allele chrom position beta_SNP_domA1 sebeta_SNP_domA1 chi2_SNP_domA1
+name A1 A2 Freq1 MAF Quality Rsq n Mean_predictor_allele chrom position beta_SNP_domA1 sebeta_SNP_domA1 chi2_SNP_dom
rs7247199 GAC A 0.5847 0.415 0.9299 0.8666 182 0.333668 1 204938 33.0592 115.333 0.0839902
rs8102643 C TGGT 0.5847 0.415 0.9308 0.8685 181 0.808177 1 207859 -178.139 417.232 0.186313
rs8102615 T A 0.5006 0.4702 0.9375 0.8932 182 0.8665 2 211970 -272.156 640.298 0.18463
Modified: branches/ProbABEL-pvals/ProbABEL/checks/verified_results/height_ngp2_over_domin.out.txt
===================================================================
--- branches/ProbABEL-pvals/ProbABEL/checks/verified_results/height_ngp2_over_domin.out.txt 2014-04-08 07:28:06 UTC (rev 1686)
+++ branches/ProbABEL-pvals/ProbABEL/checks/verified_results/height_ngp2_over_domin.out.txt 2014-04-08 07:31:04 UTC (rev 1687)
@@ -1,4 +1,4 @@
-name A1 A2 Freq1 MAF Quality Rsq n Mean_predictor_allele chrom position beta_SNP_odomA1 sebeta_SNP_odomA1 chi2_SNP_odomA1
+name A1 A2 Freq1 MAF Quality Rsq n Mean_predictor_allele chrom position beta_SNP_odomA1 sebeta_SNP_odomA1 chi2_SNP_odom
rs7247199 GAC A 0.5847 0.415 0.9299 0.8666 182 0.333668 1 204938 80.0802 231.105 0.122726
rs8102643 C TGGT 0.5847 0.415 0.9308 0.8685 181 0.808177 1 207859 28.4969 142.757 0.0407436
rs8102615 T A 0.5006 0.4702 0.9375 0.8932 182 0.8665 2 211970 51.4168 142.042 0.133927
Modified: branches/ProbABEL-pvals/ProbABEL/checks/verified_results/height_ngp2_recess.out.txt
===================================================================
--- branches/ProbABEL-pvals/ProbABEL/checks/verified_results/height_ngp2_recess.out.txt 2014-04-08 07:28:06 UTC (rev 1686)
+++ branches/ProbABEL-pvals/ProbABEL/checks/verified_results/height_ngp2_recess.out.txt 2014-04-08 07:31:04 UTC (rev 1687)
@@ -1,4 +1,4 @@
-name A1 A2 Freq1 MAF Quality Rsq n Mean_predictor_allele chrom position beta_SNP_recA1 sebeta_SNP_recA1 chi2_SNP_recA1
+name A1 A2 Freq1 MAF Quality Rsq n Mean_predictor_allele chrom position beta_SNP_recA1 sebeta_SNP_recA1 chi2_SNP_rec
rs7247199 GAC A 0.5847 0.415 0.9299 0.8666 182 0.333668 1 204938 51.0131 227.445 0.051428
rs8102643 C TGGT 0.5847 0.415 0.9308 0.8685 181 0.808177 1 207859 -28.2737 108.063 0.0699893
rs8102615 T A 0.5006 0.4702 0.9375 0.8932 182 0.8665 2 211970 -45.9705 119.627 0.15093
Modified: branches/ProbABEL-pvals/ProbABEL/configure.ac
===================================================================
--- branches/ProbABEL-pvals/ProbABEL/configure.ac 2014-04-08 07:28:06 UTC (rev 1686)
+++ branches/ProbABEL-pvals/ProbABEL/configure.ac 2014-04-08 07:31:04 UTC (rev 1687)
@@ -21,7 +21,7 @@
AC_PROG_LN_S
if test -z "$CXXFLAGS"; then
# User did not set CXXFLAGS, so we can put in our own defaults
- CXXFLAGS="-g -O2"
+ CXXFLAGS="-g -O2 -DNDEBUG -Wextra"
fi
if test -z "$CPPFLAGS"; then
# User did not set CPPFLAGS, so we can put in our own defaults
Modified: branches/ProbABEL-pvals/ProbABEL/examples/gtdata/test.map
===================================================================
--- branches/ProbABEL-pvals/ProbABEL/examples/gtdata/test.map 2014-04-08 07:28:06 UTC (rev 1686)
+++ branches/ProbABEL-pvals/ProbABEL/examples/gtdata/test.map 2014-04-08 07:31:04 UTC (rev 1687)
@@ -4,3 +4,4 @@
rs8102615 211970 A T
rs8105536 212033 A G
rs2312724 217034 C T
+2:13212311 13212311 C A
Modified: branches/ProbABEL-pvals/ProbABEL/examples/gtdata/test.mlinfo
===================================================================
--- branches/ProbABEL-pvals/ProbABEL/examples/gtdata/test.mlinfo 2014-04-08 07:28:06 UTC (rev 1686)
+++ branches/ProbABEL-pvals/ProbABEL/examples/gtdata/test.mlinfo 2014-04-08 07:31:04 UTC (rev 1687)
@@ -4,3 +4,4 @@
rs8102615 T A 0.5006 0.4702 0.9375 0.8932
rs8105536 G A 0.5783 0.4213 0.9353 0.8832
rs2312724 T C 0.9122 0.0877 0.9841 0.9232
+2:13212311 C A 0.3443 0.3209 0.9432 0.9390
Modified: branches/ProbABEL-pvals/ProbABEL/examples/mmscore.R
===================================================================
--- branches/ProbABEL-pvals/ProbABEL/examples/mmscore.R 2014-04-08 07:28:06 UTC (rev 1686)
+++ branches/ProbABEL-pvals/ProbABEL/examples/mmscore.R 2014-04-08 07:31:04 UTC (rev 1687)
@@ -88,85 +88,5 @@
## 2) residuals of the phenotype, which will be the new phenotype that
## ProbABEL will analyse.
-## Mow, go to ProbABEL and start analysis
+## Now, go to ProbABEL and start analysis
-
-
-
-
-##____________________________________________________
-## The following part is for historic purposes only. It is not
-## necessary for using the --mmscore option of ProbABEL's palinear.
-
-## Create test file with genotypes
-
-data_cut <- data[, snps]
-gen_table <- as.numeric(data_cut)
-prob_table <- matrix()
-
-#Replace NA by mean for each snp. NA is forbiden in genotypes in ProbABEL input (!).
-#for(snpnum in 1:dim(gen_table)[2])
-# {
-# mean <- mean(gen_table[,snpnum], na.rm=T)
-# gen_table[is.na(gen_table[,snpnum]),snpnum] <- mean
-# }
-
-
-gen_table_df <- data.frame(gen_table)
-gen_table_df$MLDOSE <- gen_table_df[, 1]
-gen_table_df[,1] <- "MLDOSE"
-colnam <- colnames(gen_table_df)
-
-#colnam[-c(1:length(colnam)-1)] <- colnam[1]
-#colnam[1] <- "MLDOSE"
-
-colnam[length(colnam)] <- colnam[1]
-colnam[1] <- "MLDOSE"
-colnames(gen_table_df) <- colnam
-
-
-rownames <- rownames(gen_table_df)
-rownames <- paste("1->", rownames, sep="")
-rownames(gen_table_df) <- rownames
-
-write.table(file="mmscore_gen.mldose",
- gen_table_df,
- row.names=TRUE,
- col.names=FALSE,
- quote=FALSE,
- na="NaN")
-
-mlinfo <- data.frame(SNP=colnam[2:length(colnam)])
-mlinfo$Al1 <- "A"
-mlinfo$Al2 <- "B"
-mlinfo$Freq1 <- 0.5847
-mlinfo$MAF <- 0.5847
-mlinfo$Quality <- 0.5847
-mlinfo$Rsq <- 0.5847
-
-write.table(mlinfo, "mmscore_gen.mlinfo", row.names=FALSE, quote=FALSE)
-
-## arrange probability-file
-prob_table <- matrix(NA,
- ncol=(dim(gen_table_df)[2]-1) * 2,
- nrow=dim(gen_table_df)[1])
-j <- 1
-for (i in (1:(dim(gen_table_df)[2]-1))) {
- prob_table[,j] <- rep(0, dim(prob_table)[1])
- prob_table[gen_table_df[,i+1]==2, j] <- 1
- prob_table[is.na(gen_table_df[, i+1]), j] <- NA
- j <- j + 1
- prob_table[, j] <- rep(0,dim(prob_table)[1])
- prob_table[gen_table_df[, i+1]==1, j] <- 1
- prob_table[is.na(gen_table_df[, i+1]),j] <- NA
- j <- j + 1
-}
-prob_table_df <- data.frame(MLPROB="MLPROB", prob_table)
-rownames(prob_table_df) <- rownames(gen_table_df)
-
-write.table(file="mmscore_gen.mlprob",
- prob_table_df,
- row.names=TRUE,
- col.names=FILE,
- quote=FILE,
- na="NaN")
Modified: branches/ProbABEL-pvals/ProbABEL/src/cholesky.cpp
===================================================================
--- branches/ProbABEL-pvals/ProbABEL/src/cholesky.cpp 2014-04-08 07:28:06 UTC (rev 1686)
+++ branches/ProbABEL-pvals/ProbABEL/src/cholesky.cpp 2014-04-08 07:31:04 UTC (rev 1687)
@@ -100,8 +100,8 @@
}
int n = matrix.ncol;
- register double temp;
- register int i, j, k;
+ double temp;
+ int i, j, k;
/*
** invert the cholesky in the lower triangle
Modified: branches/ProbABEL-pvals/ProbABEL/src/command_line_settings.cpp
===================================================================
--- branches/ProbABEL-pvals/ProbABEL/src/command_line_settings.cpp 2014-04-08 07:28:06 UTC (rev 1686)
+++ branches/ProbABEL-pvals/ProbABEL/src/command_line_settings.cpp 2014-04-08 07:31:04 UTC (rev 1687)
@@ -120,12 +120,12 @@
{
return outfilename;
}
+//TODO(unknown) This function is not used. Remove in near future
+//char* cmdvars::getProgramName() const
+//{
+// return program_name;
+//}
-char* cmdvars::getProgramName() const
-{
- return program_name;
-}
-
int cmdvars::getRobust() const
{
return robust;
Modified: branches/ProbABEL-pvals/ProbABEL/src/command_line_settings.h
===================================================================
--- branches/ProbABEL-pvals/ProbABEL/src/command_line_settings.h 2014-04-08 07:28:06 UTC (rev 1686)
+++ branches/ProbABEL-pvals/ProbABEL/src/command_line_settings.h 2014-04-08 07:31:04 UTC (rev 1687)
@@ -116,7 +116,8 @@
int getNoutcomes() const;
int getNpeople() const;
string getOutfilename() const;
- char* getProgramName() const;
+//TODO(unknown) This function is not used. Remove in near future
+// char* getProgramName() const;
int getRobust() const;
int getScore() const;
string getSep() const;
Modified: branches/ProbABEL-pvals/ProbABEL/src/coxph_data.cpp
===================================================================
--- branches/ProbABEL-pvals/ProbABEL/src/coxph_data.cpp 2014-04-08 07:28:06 UTC (rev 1686)
+++ branches/ProbABEL-pvals/ProbABEL/src/coxph_data.cpp 2014-04-08 07:31:04 UTC (rev 1687)
@@ -81,10 +81,7 @@
freq = 0;
masked_data = new unsigned short int[nids];
- for (int i = 0; i < nids; i++)
- {
- masked_data[i] = obj.masked_data[i];
- }
+ std::copy(obj.masked_data, obj.masked_data+nids,masked_data);
}
coxph_data::coxph_data(phedata &phed, gendata &gend, const int snpnum)
@@ -94,11 +91,9 @@
nids = gend.nids;
masked_data = new unsigned short int[nids];
- for (int i = 0; i < nids; i++)
- {
- masked_data[i] = 0;
- }
+ std::fill(masked_data,masked_data+nids,0);
+
ngpreds = gend.ngpreds;
if (snpnum >= 0)
{
@@ -167,11 +162,12 @@
// sort by time
double *tmptime = new double[nids];
int *passed_sorted = new int[nids];
+ std::fill (passed_sorted,passed_sorted+nids,0);
+
for (int i = 0; i < nids; i++)
{
tmptime[i] = stime[i];
- passed_sorted[i] = 0;
}
qsort(tmptime, nids, sizeof(double), cmpfun);
@@ -239,9 +235,7 @@
for (int j = 0; j < ngpreds; j++) {
double *snpdata = new double[nids];
- for (int i = 0; i < nids; i++) {
- masked_data[i] = 0;
- }
+ std::fill (masked_data,masked_data+nids,0);
gend->get_var(snpnum * ngpreds + j, snpdata);
@@ -316,15 +310,9 @@
coxph_data to; // = coxph_data(*this);
// filter missing data
- int nmeasured = 0;
- for (int i = 0; i < nids; i++)
- {
- if (masked_data[i] == 0)
- {
- nmeasured++;
- }
- }
+ int nmeasured=std::count (masked_data, masked_data+nids, 0);
+
to.nids = nmeasured;
to.ncov = ncov;
to.ngpreds = ngpreds;
@@ -358,11 +346,7 @@
//delete [] to.masked_data;
to.masked_data = new unsigned short int[to.nids];
- for (int i = 0; i < to.nids; i++)
- {
- to.masked_data[i] = 0;
- }
-
+ std::fill(to.masked_data,to.masked_data+to.nids,0);
return (to);
}
@@ -379,7 +363,7 @@
}
-void coxph_reg::estimate(coxph_data &cdatain, const int verbose,
+void coxph_reg::estimate(coxph_data &cdatain,
int maxiter, double eps,
double tol_chol, const int model,
const int interaction, const int ngpreds,
Modified: branches/ProbABEL-pvals/ProbABEL/src/coxph_data.h
===================================================================
--- branches/ProbABEL-pvals/ProbABEL/src/coxph_data.h 2014-04-08 07:28:06 UTC (rev 1686)
+++ branches/ProbABEL-pvals/ProbABEL/src/coxph_data.h 2014-04-08 07:31:04 UTC (rev 1687)
@@ -89,7 +89,7 @@
int niter;
coxph_reg(coxph_data &cdatain);
- void estimate(coxph_data &cdatain, const int verbose, int maxiter,
+ void estimate(coxph_data &cdatain, int maxiter,
double eps, double tol_chol, const int model,
const int interaction, const int ngpreds, const bool iscox,
const int nullmodel, const mlinfo &snpinfo, const int cursnp);
Modified: branches/ProbABEL-pvals/ProbABEL/src/data.cpp
===================================================================
--- branches/ProbABEL-pvals/ProbABEL/src/data.cpp 2014-04-08 07:28:06 UTC (rev 1686)
+++ branches/ProbABEL-pvals/ProbABEL/src/data.cpp 2014-04-08 07:31:04 UTC (rev 1687)
@@ -47,49 +47,45 @@
#endif
#include "utilities.h"
+//TODO(unknown) This function is not used. Remove in near future
+//unsigned int Nmeasured(char * fname, int nphenocols, int npeople)
+//{
+//// first pass -- find unmeasured people
+// std::ifstream infile(fname);
+// if (!infile)
+// {
+// std::cerr << "Nmeasured: cannot open file " << fname << endl;
+// }
+// char tmp[100];
+//
+// for (int i = 0; i < nphenocols; i++)
+// {
+// infile >> tmp;
+// }
+//
+// unsigned short int * allmeasured = new unsigned short int[npeople];
+// int nids = 0;
+// for (int i = 0; i < npeople; i++)
+// {
+// allmeasured[i] = 1;
+// infile >> tmp;
+// for (int j = 1; j < nphenocols; j++)
+// {
+// infile >> tmp;
+// if (tmp[0] == 'N' || tmp[0] == 'n')
+// allmeasured[i] = 0;
+// }
+// if (allmeasured[i] == 1)
+// nids++;
+// }
+// infile.close();
+//
+// delete[] allmeasured;
+//
+// return (nids);
+//}
-unsigned int Nmeasured(char * fname, int nphenocols, int npeople)
-{
-//TODO: unused variables remove them for good if there is no reason to keep them
-//int ncov = nphenocols - 2;
-//int nids_all = npeople;
-// first pass -- find unmeasured people
- std::ifstream infile(fname);
- if (!infile)
- {
- std::cerr << "Nmeasured: cannot open file " << fname << endl;
- }
- char tmp[100];
-
- for (int i = 0; i < nphenocols; i++)
- {
- infile >> tmp;
- }
-
- unsigned short int * allmeasured = new unsigned short int[npeople];
- int nids = 0;
- for (int i = 0; i < npeople; i++)
- {
- allmeasured[i] = 1;
- infile >> tmp;
- for (int j = 1; j < nphenocols; j++)
- {
- infile >> tmp;
- if (tmp[0] == 'N' || tmp[0] == 'n')
- allmeasured[i] = 0;
- }
- if (allmeasured[i] == 1)
- nids++;
- }
- infile.close();
-
- delete[] allmeasured;
-
- return (nids);
-}
-
-
/**
* Read SNP information from an mlinfo file generated by the
* imputation software.
@@ -269,5 +265,3 @@
{
return matrix;
}
-
-//________________________________________Maksim_end
Modified: branches/ProbABEL-pvals/ProbABEL/src/data.h
===================================================================
--- branches/ProbABEL-pvals/ProbABEL/src/data.h 2014-04-08 07:28:06 UTC (rev 1686)
+++ branches/ProbABEL-pvals/ProbABEL/src/data.h 2014-04-08 07:31:04 UTC (rev 1687)
@@ -31,8 +31,8 @@
#include <string>
extern bool is_interaction_excluded;
-
-unsigned int Nmeasured(char * fname, int nphenocols, int npeople);
+//TODO(unknown) This function is not used. Remove in near future
+//unsigned int Nmeasured(char * fname, int nphenocols, int npeople);
#include "phedata.h"
#include "gendata.h"
@@ -80,4 +80,4 @@
~InvSigma();
};
-#endif /* DATA_H_ */
+#endif//DATA_H_
Deleted: branches/ProbABEL-pvals/ProbABEL/src/fvlib
===================================================================
--- branches/ProbABEL-pvals/ProbABEL/src/fvlib 2014-04-08 07:28:06 UTC (rev 1686)
+++ branches/ProbABEL-pvals/ProbABEL/src/fvlib 2014-04-08 07:31:04 UTC (rev 1687)
@@ -1 +0,0 @@
-link ../../filevector/fvlib
\ No newline at end of file
Copied: branches/ProbABEL-pvals/ProbABEL/src/fvlib (from rev 1683, pkg/ProbABEL/src/fvlib)
===================================================================
--- branches/ProbABEL-pvals/ProbABEL/src/fvlib (rev 0)
+++ branches/ProbABEL-pvals/ProbABEL/src/fvlib 2014-04-08 07:31:04 UTC (rev 1687)
@@ -0,0 +1 @@
+link ../../../tags/filevector/v.1.0.0/fvlib
\ No newline at end of file
Modified: branches/ProbABEL-pvals/ProbABEL/src/gendata.cpp
===================================================================
--- branches/ProbABEL-pvals/ProbABEL/src/gendata.cpp 2014-04-08 07:28:06 UTC (rev 1686)
+++ branches/ProbABEL-pvals/ProbABEL/src/gendata.cpp 2014-04-08 07:31:04 UTC (rev 1687)
@@ -28,6 +28,7 @@
#include <string>
#include <errno.h>
+#include <limits>
#include "gendata.h"
#include "fvlib/FileVector.h"
#if EIGEN
@@ -39,6 +40,69 @@
#endif
#include "utilities.h"
+
+void gendata::mldose_line_to_matrix(int k,const char *all_numbers,int amount_of_numbers){
+ int j = 0;
+ //check if not a null pointer
+ if (!*all_numbers){
+ perror("Error while reading genetic data (expected pointer to char but found a null pointer)");
+ exit(EXIT_FAILURE);
+ }
+ while (j<amount_of_numbers)
+ {
+ double result = 0;
+ //skip whitespace
+ while (*all_numbers == ' ')
+ {
+ all_numbers++;
+ }
+ //check NaN (right now checks only first character)
+ //TODO: make catching of NaN more rigid
+ if (*all_numbers == 'N')
+ {
+ result = std::numeric_limits<double>::quiet_NaN();
+ //skip other characters of NaN
+ while ((*all_numbers == 'a') | (*all_numbers == 'N'))
+ {
+ all_numbers++;
+ }
+ }
+ else
+ {
+ int sign = 0;
+ //set sign to -1 if negative: multiply by sign just before return
+ if (*all_numbers == '-')
+ {
+ all_numbers++;
+ sign = -1;
+ }
+ //read digits before dot
+ while (*all_numbers <= '9' && *all_numbers >= '0')
+ {
+ result = result * 10 + (*all_numbers++ - '0');
+ }
+ //read digit after dot
+ if (*all_numbers == '.')
+ {
+ double decimal_counter = 1.0;
+ all_numbers++;
+ while (*all_numbers <= '9' && *all_numbers >= '0')
+ {
+ decimal_counter *= 0.1;
+ result += (*all_numbers++ - '0') * decimal_counter;
+ }
+ }
+ //correct for negative number
+ if (sign == -1)
+ {
+ result = sign * result;
+ }
+ }
+ G.put(result, k, j);
+ j++;
+ }
+}
+
void gendata::get_var(int var, double * data)
{
// Read the genetic data for SNP 'var' and store in the array 'data'
@@ -165,17 +229,19 @@
DAG = NULL;
// int nids_all = npeople;
+
G.reinit(nids, (nsnps * ngpreds));
std::ifstream infile;
+ infile.open(fname);
- infile.open(fname);
if (!infile)
{
std::cerr << "gendata: cannot open file " << fname << endl;
}
std::string tmpid, tmpstr;
+ char inStr[8];
int k = 0;
for (unsigned int i = 0; i < npeople; i++)
@@ -191,7 +257,7 @@
size_t strpos = tmpstr.find("->");
if (strpos != string::npos)
{
- tmpid = tmpstr.substr(strpos+2, string::npos);
+ tmpid = tmpstr.substr(strpos + 2, string::npos);
}
else
{
@@ -200,8 +266,8 @@
if (tmpid != idnames[k])
{
cerr << "phenotype file and dose or probability file "
- << "did not match at line " << i + 2 << " (" << tmpid
- << " != " << idnames[k] << ")" << endl;
+ << "did not match at line " << i + 2 << " ("
+ << tmpid << " != " << idnames[k] << ")" << endl;
infile.close();
exit(1);
}
@@ -212,46 +278,58 @@
infile >> tmpstr;
}
- for (unsigned int j = 0; j < (nsnps * ngpreds); j++)
+ int oldstyle = 0;
+ if (oldstyle == 1)
{
- if (infile.good())
+ for (unsigned int j = 0; j < (nsnps * ngpreds); j++)
{
- infile >> tmpstr;
[TRUNCATED]
To get the complete diff run:
svnlook diff /svnroot/genabel -r 1687
More information about the Genabel-commits
mailing list