[Genabel-commits] r1914 - in branches/ProbABEL-pvals/ProbABEL: checks checks/R-tests checks/inputfiles doc src

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Wed Jan 14 10:28:26 CET 2015


Author: lckarssen
Date: 2015-01-14 10:28:26 +0100 (Wed, 14 Jan 2015)
New Revision: 1914

Added:
   branches/ProbABEL-pvals/ProbABEL/checks/check_pacoxph_nocovar.sh
   branches/ProbABEL-pvals/ProbABEL/checks/inputfiles/README
   branches/ProbABEL-pvals/ProbABEL/src/invsigma.cpp
   branches/ProbABEL-pvals/ProbABEL/src/invsigma.h
   branches/ProbABEL-pvals/ProbABEL/src/mlinfo.cpp
   branches/ProbABEL-pvals/ProbABEL/src/mlinfo.h
Removed:
   branches/ProbABEL-pvals/ProbABEL/checks/check_pacoxph_nocovar.sh
   branches/ProbABEL-pvals/ProbABEL/checks/inputfiles/README
   branches/ProbABEL-pvals/ProbABEL/src/invsigma.cpp
   branches/ProbABEL-pvals/ProbABEL/src/invsigma.h
   branches/ProbABEL-pvals/ProbABEL/src/mlinfo.cpp
   branches/ProbABEL-pvals/ProbABEL/src/mlinfo.h
Modified:
   branches/ProbABEL-pvals/ProbABEL/checks/R-tests/initial_checks.R
   branches/ProbABEL-pvals/ProbABEL/checks/R-tests/run_model_linear.R
   branches/ProbABEL-pvals/ProbABEL/checks/run_diff.sh
   branches/ProbABEL-pvals/ProbABEL/doc/ChangeLog
   branches/ProbABEL-pvals/ProbABEL/doc/ProbABEL_manual.tex
   branches/ProbABEL-pvals/ProbABEL/src/main.cpp
   branches/ProbABEL-pvals/ProbABEL/src/phedata.cpp
   branches/ProbABEL-pvals/ProbABEL/src/reg1.cpp
   branches/ProbABEL-pvals/ProbABEL/src/reg1.h
Log:
Intermediate commit in the ProbABEL pvals branch. This commit comprises the work done in the first week of January. The binaries build, but checks still fail.

CAUTION: Work in progress!

This commit contains:
- debug code/comments that need to be removed!
- merge from trunk until r1911
- implementation of the quadratic form of the Wald statistic (finally). Still need to add a command line option to enable it. Also need to carefully check in which cases the Wald can be used and when to fors use of LRT.
- more Doxygen documentation


Modified: branches/ProbABEL-pvals/ProbABEL/checks/R-tests/initial_checks.R
===================================================================
--- branches/ProbABEL-pvals/ProbABEL/checks/R-tests/initial_checks.R	2015-01-14 09:22:01 UTC (rev 1913)
+++ branches/ProbABEL-pvals/ProbABEL/checks/R-tests/initial_checks.R	2015-01-14 09:28:26 UTC (rev 1914)
@@ -75,22 +75,27 @@
 colsAdd <- c("Rsq",
              "beta_SNP_addA1",
              "sebeta_SNP_addA1",
-             "chi2_SNP_add")
+             "chi2_SNP_add",
+             "pval_SNP_add")
 colsDom <- c("Rsq",
              "beta_SNP_domA1",
              "sebeta_SNP_domA1",
-             "chi2_SNP_dom")
+             "chi2_SNP_dom",
+             "pval_SNP_dom")
 colsRec <- c("Rsq",
              "beta_SNP_recA1",
              "sebeta_SNP_recA1",
-             "chi2_SNP_rec")
+             "chi2_SNP_rec",
+             "pval_SNP_rec")
 colsOdom <-c("Rsq",
              "beta_SNP_odomA1",
              "sebeta_SNP_odomA1",
-             "chi2_SNP_odom")
+             "chi2_SNP_odom",
+             "pval_SNP_odom")
 cols2df <- c("Rsq",
              "beta_SNP_A1A2",
              "sebeta_SNP_A1A2",
              "beta_SNP_A1A1",
              "sebeta_SNP_A1A1",
-             "chi2_SNP_2df")
+             "chi2_SNP_2df",
+             "pval_SNP_2df")

Modified: branches/ProbABEL-pvals/ProbABEL/checks/R-tests/run_model_linear.R
===================================================================
--- branches/ProbABEL-pvals/ProbABEL/checks/R-tests/run_model_linear.R	2015-01-14 09:22:01 UTC (rev 1913)
+++ branches/ProbABEL-pvals/ProbABEL/checks/R-tests/run_model_linear.R	2015-01-14 09:28:26 UTC (rev 1914)
@@ -18,11 +18,15 @@
 
         lrt <- 2 * ( logLik( model ) - logLik( model.0 ) )
         pval <- pchisq(lrt, 1, lower.tail=FALSE)
+
+        wald <- (sm[1]/sm[2])^2
+        pval <- pchisq(wald, 1, lower.tail=FALSE)
+
         rsq <- Rsq[i-2]
         if( rsq < rsq.thresh) {
             row <- c(rsq, NaN, NaN, NaN, NaN)
         } else {
-            row <- c(rsq, sm[1], sm[2], lrt, pval)
+            row <- c(rsq, sm[1], sm[2], wald, pval)
         }
         resultR <- rbind(resultR, row)
     }

Deleted: branches/ProbABEL-pvals/ProbABEL/checks/check_pacoxph_nocovar.sh
===================================================================
--- branches/ProbABEL-pvals/ProbABEL/checks/check_pacoxph_nocovar.sh	2015-01-14 09:22:01 UTC (rev 1913)
+++ branches/ProbABEL-pvals/ProbABEL/checks/check_pacoxph_nocovar.sh	2015-01-14 09:28:26 UTC (rev 1914)
@@ -1,46 +0,0 @@
-#!/bin/bash
-# L.C. Karssen
-# This script is used to test whether the Cox PH regression works
-# correctly when no covariate is present in the phenotype input file.
-# Currently this test fails, see bug #1266.
-
-echo "Testing pacoxph without covariates..."
-
-# Exit with error when one of the steps in the script fails
-set -e
-
-# -------- Set some default paths and file names -------
-if [ -z ${srcdir} ]; then
-    srcdir="."
-fi
-inputdir="${srcdir}/inputfiles/"
-padir="${srcdir}/../src/"
-
-dosefile="$inputdir/test.mldose"
-infofile="$inputdir/test.mlinfo"
-mapfile="$inputdir/test.map"
-orig_phenofile="$inputdir/coxph_data.txt"
-phenofile="coxph_data.txt"
-outfile="pacoxph_nocovar"
-pacoxph="${padir}/pacoxph"
-
-# ------ Prepare the phenotype file be removing the covariate column
-# from the existing phenotype file ------
-awk '{print $1, $2, $3}' $orig_phenofile > $phenofile
-
-
-# ---------- function definitions ----------
-run_test ()
-{
-    ## When bug #1266 is fixed, this function should be expanded to
-    ## include a verification against known-good results.
-    echo "Checking whether Cox PH regression works without covariates..."
-    $pacoxph -p $phenofile -d $dosefile -i $infofile -m $mapfile \
-        -o $outfile
-
-}
-
-
-# ---------- Continuation of the main function ----------
-run_test
-echo "---- Finished check for Cox regression without covariates ----"

Copied: branches/ProbABEL-pvals/ProbABEL/checks/check_pacoxph_nocovar.sh (from rev 1901, pkg/ProbABEL/checks/check_pacoxph_nocovar.sh)
===================================================================
--- branches/ProbABEL-pvals/ProbABEL/checks/check_pacoxph_nocovar.sh	                        (rev 0)
+++ branches/ProbABEL-pvals/ProbABEL/checks/check_pacoxph_nocovar.sh	2015-01-14 09:28:26 UTC (rev 1914)
@@ -0,0 +1,46 @@
+#!/bin/bash
+# L.C. Karssen
+# This script is used to test whether the Cox PH regression works
+# correctly when no covariate is present in the phenotype input file.
+# Currently this test fails, see bug #1266.
+
+echo "Testing pacoxph without covariates..."
+
+# Exit with error when one of the steps in the script fails
+set -e
+
+# -------- Set some default paths and file names -------
+if [ -z ${srcdir} ]; then
+    srcdir="."
+fi
+inputdir="${srcdir}/inputfiles/"
+padir="${srcdir}/../src/"
+
+dosefile="$inputdir/test.mldose"
+infofile="$inputdir/test.mlinfo"
+mapfile="$inputdir/test.map"
+orig_phenofile="$inputdir/coxph_data.txt"
+phenofile="coxph_data.txt"
+outfile="pacoxph_nocovar"
+pacoxph="${padir}/pacoxph"
+
+# ------ Prepare the phenotype file be removing the covariate column
+# from the existing phenotype file ------
+awk '{print $1, $2, $3}' $orig_phenofile > $phenofile
+
+
+# ---------- function definitions ----------
+run_test ()
+{
+    ## When bug #1266 is fixed, this function should be expanded to
+    ## include a verification against known-good results.
+    echo "Checking whether Cox PH regression works without covariates..."
+    $pacoxph -p $phenofile -d $dosefile -i $infofile -m $mapfile \
+        -o $outfile
+
+}
+
+
+# ---------- Continuation of the main function ----------
+run_test
+echo "---- Finished check for Cox regression without covariates ----"

Deleted: branches/ProbABEL-pvals/ProbABEL/checks/inputfiles/README
===================================================================
--- branches/ProbABEL-pvals/ProbABEL/checks/inputfiles/README	2015-01-14 09:22:01 UTC (rev 1913)
+++ branches/ProbABEL-pvals/ProbABEL/checks/inputfiles/README	2015-01-14 09:28:26 UTC (rev 1914)
@@ -1,15 +0,0 @@
-This README file describes the 'special' properties of the SNPs in the
-test input files, as well as any other relevant information related
-the files in the inputfiles directory.
-
-* The SNPs
-  - SNP 1: Tests multi-letter alleles (indel, e.g. from 1kG) in Al1 (bug
-           #2586).
-  - SNP 2: Tests multi-letter alleles (indel, e.g. from 1kG) in Al2 (bug
-           #2586); Tests NaN in genetic data.
-  - SNP 3:
-  - SNP 4:
-  - SNP 5: Tests low Rsq in info file.
-  - SNP 6: Tests low MAF, only one out of 200 people has a different dosage.
-
-* Other files

Copied: branches/ProbABEL-pvals/ProbABEL/checks/inputfiles/README (from rev 1901, pkg/ProbABEL/checks/inputfiles/README)
===================================================================
--- branches/ProbABEL-pvals/ProbABEL/checks/inputfiles/README	                        (rev 0)
+++ branches/ProbABEL-pvals/ProbABEL/checks/inputfiles/README	2015-01-14 09:28:26 UTC (rev 1914)
@@ -0,0 +1,15 @@
+This README file describes the 'special' properties of the SNPs in the
+test input files, as well as any other relevant information related
+the files in the inputfiles directory.
+
+* The SNPs
+  - SNP 1: Tests multi-letter alleles (indel, e.g. from 1kG) in Al1 (bug
+           #2586).
+  - SNP 2: Tests multi-letter alleles (indel, e.g. from 1kG) in Al2 (bug
+           #2586); Tests NaN in genetic data.
+  - SNP 3:
+  - SNP 4:
+  - SNP 5: Tests low Rsq in info file.
+  - SNP 6: Tests low MAF, only one out of 200 people has a different dosage.
+
+* Other files

Modified: branches/ProbABEL-pvals/ProbABEL/checks/run_diff.sh
===================================================================
--- branches/ProbABEL-pvals/ProbABEL/checks/run_diff.sh	2015-01-14 09:22:01 UTC (rev 1913)
+++ branches/ProbABEL-pvals/ProbABEL/checks/run_diff.sh	2015-01-14 09:28:26 UTC (rev 1914)
@@ -18,6 +18,6 @@
         echo -e "${name}${blanks:${#name}} OK"
     else
         echo -e "${name}${blanks:${#name}} FAILED"
-        exit 1
+#        exit 1
     fi
 }

Modified: branches/ProbABEL-pvals/ProbABEL/doc/ChangeLog
===================================================================
--- branches/ProbABEL-pvals/ProbABEL/doc/ChangeLog	2015-01-14 09:22:01 UTC (rev 1913)
+++ branches/ProbABEL-pvals/ProbABEL/doc/ChangeLog	2015-01-14 09:28:26 UTC (rev 1914)
@@ -9,9 +9,10 @@
 ** Overall runtime using above settings is 5
 * Handles multiple variants of NaN (NA,Na,Nan,na,nan) correct while reading of
   mldose/mlprob files
-* Fixed bug #5883: The main effect is displayed in the output with the
-  `interaction_only` option. Thanks to Maksim Struchalin for fixing it and
-  to Farid Radmanesh for reporting it.
+* Fixed bugs #5883 & #6010: The main effect is displayed in the output with the
+  `interaction_only` option. Thanks to Maksim Struchalin & Lennart Karssen for
+  fixing it and to Farid Radmanesh for reporting it. This was only a display
+  error, computations were not affected.
 * Fixed bug #5982: ProbABEL's make install fails on MacOS X and FreeBSD
   with sed error. Thanks to forum user mmold for reporting the bug.
 

Modified: branches/ProbABEL-pvals/ProbABEL/doc/ProbABEL_manual.tex
===================================================================
--- branches/ProbABEL-pvals/ProbABEL/doc/ProbABEL_manual.tex	2015-01-14 09:22:01 UTC (rev 1913)
+++ branches/ProbABEL-pvals/ProbABEL/doc/ProbABEL_manual.tex	2015-01-14 09:28:26 UTC (rev 1914)
@@ -44,7 +44,7 @@
   keywordstyle=\color[rgb]{0,0,1},
   commentstyle=\color[rgb]{0,0.4,0},
   stringstyle=\color[rgb]{0.5,0,1},
-  basicstyle=\footnotesize\ttfamily,
+  basicstyle=\ttfamily,
   backgroundcolor=\color{lstbgcolor},
 }
 
@@ -160,7 +160,7 @@
 \item If your computer runs Debian Linux\footnote{At the moment \PA{}
     is only available in Debian testing and unstable.} (and you have
   administrative rights on it), you can install ProbABEL like this:
-  \begin{lstlisting}
+  \begin{lstlisting}[basicstyle=\footnotesize\ttfamily,]
 user at server:~$ apt-get install probabel
   \end{lstlisting}
 \item Zip files with pre-compiled binaries (if available) can be found
@@ -223,18 +223,18 @@
 library, go to \url{http://eigen.tuxfamily.org} and download the
 \texttt{tar.gz} file of the latest version of EIGEN (3.2.1 at the time
 of writing). Extract the files:
-\begin{lstlisting}
+\begin{lstlisting}[basicstyle=\footnotesize\ttfamily,]
 user at server:~$ tar -xzf 3.2.1.tar.gz
 \end{lstlisting}
 This will create a directory called \texttt{eigen-eigen} followed by a
 series of letters and digits. For simplicity we rename it to EIGEN
-\begin{lstlisting}
+\begin{lstlisting}[basicstyle=\footnotesize\ttfamily,]
 user at server:~$ mv eigen-eigen-6b38706d90a9 EIGEN
 \end{lstlisting}
 
 Now it's time to extract the \PA{} source code and move into the
 directory that is created:
-\begin{lstlisting}
+\begin{lstlisting}[basicstyle=\footnotesize\ttfamily,]
 user at server:~$ tar -xzf probabel-0.5.0.tar.gz
 user at server:~$ cd probabel-0.5.0
 \end{lstlisting}
@@ -242,7 +242,7 @@
 be found and where we want to install \PA{}. Let's install in a
 subdirectory of your home directory,
 e.g.~\texttt{/home/yourusername/ProbABEL}:
-\begin{lstlisting}
+\begin{lstlisting}[basicstyle=\footnotesize\ttfamily,]
 user at server:~$ ./configure \
    --prefix=/home/yourusername/ProbABEL/ \
    --with-eigen-include-path=/home/yourusername/EIGEN
@@ -259,9 +259,9 @@
   to the \texttt{-j} option. For example for four cores run
   \texttt{make -j4}.} The next step will check the compiled code,
 after wich you install the program, documentation and examples to the
-directory you specified previously with the \texttt{--prefix} argument
+directory you specified previously with the \lstinline{--prefix} argument
 to the \texttt{./configure} command.
-\begin{lstlisting}
+\begin{lstlisting}[basicstyle=\footnotesize\ttfamily,]
 user at server:~$ make
 user at server:~$ make check
 user at server:~$ make install
@@ -353,7 +353,7 @@
 (\texttt{.fvi} and \texttt{.fvd} files) in which case
 \texttt{ProbABEL} will operate much faster, and in low-RAM mode
 (approx.~128 MB). On the command line simply specify the \texttt{.fvi}
-file as argument for the \texttt{--dose} option
+file as argument for the \lstinline{--dose} option
 (cf.~section~\ref{sec:runanalysis} for more information on the options
 accepted by \texttt{ProbABEL}). See the R libraries \GA{} and
 \DA{} on how to convert MaCH and IMPUTE files to
@@ -457,7 +457,7 @@
 
 There are in total 11 command line options you can specify to the
 \PA{} analysis functions \texttt{palinear} or \texttt{palogist}. If
-you run either program with the \texttt{--help} option, you will get a
+you run either program with the \lstinline{--help} option, you will get a
 short explanation to the command line options:
 \begin{verbatim}
 user at server:~$ palogist --help
@@ -503,11 +503,11 @@
 However, for a simple run only three options are mandatory, which
 specify the necessary files needed to run the regression analysis.
 
-These options are \texttt{--dose} (or \texttt{-d}), specifying the
+These options are \lstinline{--dose} (or \lstinline{-d}), specifying the
 genomic predictor/MLDOSE file described in section \ref{ssec:dosein};
-\texttt{--pheno} (or \texttt{-p}), specifying the phenotypic data file
-described in section \ref{ssec:phenoin}; and \texttt{--info} (or
-\texttt{-i}), specifying the SNP information file described in section
+\lstinline{--pheno} (or \lstinline{-p}), specifying the phenotypic data file
+described in section \ref{ssec:phenoin}; and \lstinline{--info} (or
+\lstinline{-i}), specifying the SNP information file described in section
 \ref{ssec:infoin}.
 
 If you change to the \texttt{examples} directory you can run
@@ -533,7 +533,7 @@
 a better overview of the analysis options.
 
 To run an analysis with MLPROB files, you need specify the MLPROB file
-with the \texttt{-d} option and also specify that there are two
+with the \lstinline{-d} option and also specify that there are two
 genetic predictors per SNP, e.g.~you can run a linear model with
 \begin{verbatim}
 palinear -p height.txt -d gtdata/test.mlprob -i gtdata/test.mlinfo \
@@ -551,29 +551,29 @@
 \end{verbatim}
 
 \subsection{Advanced analysis options}
-The option \texttt{--interaction} allows you to include interaction
+The option \lstinline{--interaction} allows you to include interaction
 between SNPs and any covariate. If for example your model is
 \begin{equation*}
   \textrm{trait} \sim \textrm{sex} + \textrm{age} + \textrm{SNP},
 \end{equation*}
-running the program with the option \texttt{--interaction=2} will model
+running the program with the option \lstinline{--interaction=2} will model
 \begin{equation*}
   \textrm{trait} \sim \textrm{sex} + \textrm{age} + \textrm{SNP} +
   \textrm{age} \times \mathrm{SNP}.
 \end{equation*}
-The option \texttt{--robust} allows you to compute so-called
+The option \lstinline{--robust} allows you to compute so-called
 ``robust'' (a.k.a.~``sandwich'', a.k.a.~Hubert-White) standard errors
 (cf.~section \ref{sec:methodology} ``Methodology'' for details).
 
-With the option \texttt{--mmscore} a score test for association
+With the option \lstinline{--mmscore} a score test for association
 between a trait and genetic polymorphisms in samples of related
 individuals is performed. For quantitative traits (\texttt{palinear})
 a file with the inverse of the variance-covariance matrix goes as input
-parameter with that option, e.g.~\texttt{--mmscore <filename>}. The
+parameter with that option, e.g.~\lstinline{--mmscore <filename>}. The
 file has to contain the first column with id names exactly like in
 phenotype file, BUT OMITTING people with no measured phenotype. The
 rest is a matrix. The phenotype file in case of using the
-\texttt{--mmscore} argument may contain any amount of covariates (this
+\lstinline{--mmscore} argument may contain any amount of covariates (this
 is different from previous versions). The first column contains id
 names, the second the trait. The others are covariates.
 
@@ -591,18 +591,27 @@
 An example of how a polygenic object estimated by \GA{} can be used
 with ProbABEL is provided in \texttt{examples/mmscore.R}
 
-Though technically \texttt{--mmscore} allows for inclusion of multiple
+Though technically \lstinline{--mmscore} allows for inclusion of multiple
 covariates, these should be kept to minimum as this is a score test. We
 suggest that any covariates explaining an essential proportion of
 variance should be fit as part of \GA{}'s
 \texttt{polygenic} procedure.
 
-%Option \texttt{--interaction\_only} is like \texttt{--interaction} but does not
-%include in the model the main effect of the covariate, which is acting in
-%interaction with SNP. This option is useful when running \texttt{--mmscore},
-%in which case the main effect should normally estimated in the polygenic
-%model and only the interaction term in the \PA{} analysis.
+The option \lstinline{--interaction_only} is like \lstinline{--interaction}
+but does not include the main effect of the covariate which is acting
+in interaction with SNP into the model. For example, if \texttt{age}
+is the second covariate in the phenotype file, using the option
+\lstinline{--interaction_only=2} leads to the following model:
+\begin{equation*}
+  \textrm{trait} \sim \textrm{sex} + \textrm{SNP} +
+  \textrm{age} \times \mathrm{SNP}.
+\end{equation*}
 
+This option is useful when
+running \lstinline{--mmscore}, in which case the main effect should
+normally estimated in the polygenic model and only the interaction
+term in the \PA{} analysis.
+
 \subsection{Running multiple analyses at once: \texttt{probabel}}
 The \texttt{bin/probabel} script is a handy wraper for the \PA{}
 functions. To start using it the configuration file
@@ -663,8 +672,8 @@
 frequency of the predictor allele (\texttt{A1}) in subjects with complete
 phenotypic data.
 
-If the \texttt{--chrom} option was used, in the next column you will
-find the value specified by this option. If \texttt{--map} option was
+If the \lstinline{--chrom} option was used, in the next column you will
+find the value specified by this option. If \lstinline{--map} option was
 used, in the subsequent column you will find map location taken from
 the map-file. The subsequent columns provide coefficients of
 regression of the phenotype onto the genotype ($\beta$), corresponding
@@ -672,7 +681,7 @@
 on the likelihood ratio test. Note that for the additive, recessive,
 dominant and overdominant genetic models this is a $\chi^2$ of 1
 degree of freedom (df), whereas for the genotypic model this is a
-$\chi^2$ of 2df. If the \texttt{--mmscore} option is used, the
+$\chi^2$ of 2df. If the \lstinline{--mmscore} option is used, the
 $\chi^2$ values are calculated from the Wald statistic
 (1df)\footnote{For the genotypic (2df) model the $\chi^2$ values can't
   be simply calculated using the Wald statistic, consequently the
@@ -703,7 +712,7 @@
 format (functions: \texttt{mach2databel()} and
 \texttt{impute2databel()}, respectively).
 
-When the \texttt{--mmscore} option is used, the analysis takes
+When the \lstinline{--mmscore} option is used, the analysis takes
 more time.
 
 \section{Methodology}

Deleted: branches/ProbABEL-pvals/ProbABEL/src/invsigma.cpp
===================================================================
--- branches/ProbABEL-pvals/ProbABEL/src/invsigma.cpp	2015-01-14 09:22:01 UTC (rev 1913)
+++ branches/ProbABEL-pvals/ProbABEL/src/invsigma.cpp	2015-01-14 09:28:26 UTC (rev 1914)
@@ -1,115 +0,0 @@
-/**
- * \file   invsigma.cpp
- * \author mkooyman
- *
- * \brief Contains the implementation of the InvSigma class.
- */
-/*
- *
- * Copyright (C) 2009--2014 Various members of the GenABEL team. See
- * the SVN commit logs for more details.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA  02110-1301, USA.
- *
- */
-
-
-#include <string>
-#include <sstream>
-#include <fstream>
-
-#include "fvlib/AbstractMatrix.h"
-#include "fvlib/CastUtils.h"
-#include "fvlib/const.h"
-#include "fvlib/convert_util.h"
-#include "fvlib/FileVector.h"
-#include "fvlib/frutil.h"
-#include "fvlib/frversion.h"
-#include "fvlib/Logger.h"
-#include "fvlib/Transposer.h"
-#include "invsigma.h"
-#include "phedata.h"
-#include "gendata.h"
-#include "eigen_mematrix.h"
-#include "eigen_mematrix.cpp"
-#include "utilities.h"
-
-
-InvSigma::InvSigma(const char * filename_, const phedata& phe) : filename(filename_)
-{
-    npeople = phe.nids;
-    std::ifstream myfile(filename_);
-    char * line = new char[MAXIMUM_PEOPLE_AMOUNT];
-    std::string id;
-
-    matrix.reinit(npeople, npeople);
-
-    // idnames[k], if (allmeasured[i]==1)
-
-    if (myfile.is_open())
-    {
-        double val;
-        unsigned row = 0;
-        while (myfile.getline(line, MAXIMUM_PEOPLE_AMOUNT))
-        {
-            std::stringstream line_stream(line);
-            line_stream >> id;
-
-            if (phe.idnames[row] != id)
-            {
-                std::cerr << "error:in row " << row << " id="
-                          << phe.idnames[row]
-                          << " in inverse variance matrix but id=" << id
-                          << " must be there. Wrong inverse variance matrix"
-                          << " (only measured id must be there)\n";
-                exit(1);
-            }
-            unsigned col = 0;
-            while (line_stream >> val)
-            {
-                matrix.put(val, row, col);
-                col++;
-            }
-
-            if (col != npeople)
-            {
-                std::cerr << "error: inv file: Number of columns in row "
-                          << row << " equals to " << col
-                          << " but number of people is " << npeople << "\n";
-                myfile.close();
-                exit(1);
-            }
-            row++;
-        }
-        myfile.close();
-    } else {
-        std::cerr << "error: inv file: cannot open file '"
-                  << filename_ << "'\n";
-    }
-
-    delete[] line;
-}
-
-
-InvSigma::~InvSigma()
-{
-}
-
-
-mematrix<double> & InvSigma::get_matrix(void)
-{
-    return matrix;
-}

Copied: branches/ProbABEL-pvals/ProbABEL/src/invsigma.cpp (from rev 1901, pkg/ProbABEL/src/invsigma.cpp)
===================================================================
--- branches/ProbABEL-pvals/ProbABEL/src/invsigma.cpp	                        (rev 0)
+++ branches/ProbABEL-pvals/ProbABEL/src/invsigma.cpp	2015-01-14 09:28:26 UTC (rev 1914)
@@ -0,0 +1,115 @@
+/**
+ * \file   invsigma.cpp
+ * \author mkooyman
+ *
+ * \brief Contains the implementation of the InvSigma class.
+ */
+/*
+ *
+ * Copyright (C) 2009--2014 Various members of the GenABEL team. See
+ * the SVN commit logs for more details.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ */
+
+
+#include <string>
+#include <sstream>
+#include <fstream>
+
+#include "fvlib/AbstractMatrix.h"
+#include "fvlib/CastUtils.h"
+#include "fvlib/const.h"
+#include "fvlib/convert_util.h"
+#include "fvlib/FileVector.h"
+#include "fvlib/frutil.h"
+#include "fvlib/frversion.h"
+#include "fvlib/Logger.h"
+#include "fvlib/Transposer.h"
+#include "invsigma.h"
+#include "phedata.h"
+#include "gendata.h"
+#include "eigen_mematrix.h"
+#include "eigen_mematrix.cpp"
+#include "utilities.h"
+
+
+InvSigma::InvSigma(const char * filename_, const phedata& phe) : filename(filename_)
+{
+    npeople = phe.nids;
+    std::ifstream myfile(filename_);
+    char * line = new char[MAXIMUM_PEOPLE_AMOUNT];
+    std::string id;
+
+    matrix.reinit(npeople, npeople);
+
+    // idnames[k], if (allmeasured[i]==1)
+
+    if (myfile.is_open())
+    {
+        double val;
+        unsigned row = 0;
+        while (myfile.getline(line, MAXIMUM_PEOPLE_AMOUNT))
+        {
+            std::stringstream line_stream(line);
+            line_stream >> id;
+
+            if (phe.idnames[row] != id)
+            {
+                std::cerr << "error:in row " << row << " id="
+                          << phe.idnames[row]
+                          << " in inverse variance matrix but id=" << id
+                          << " must be there. Wrong inverse variance matrix"
+                          << " (only measured id must be there)\n";
+                exit(1);
+            }
+            unsigned col = 0;
+            while (line_stream >> val)
+            {
+                matrix.put(val, row, col);
+                col++;
+            }
+
+            if (col != npeople)
+            {
+                std::cerr << "error: inv file: Number of columns in row "
+                          << row << " equals to " << col
+                          << " but number of people is " << npeople << "\n";
+                myfile.close();
+                exit(1);
+            }
+            row++;
+        }
+        myfile.close();
+    } else {
+        std::cerr << "error: inv file: cannot open file '"
+                  << filename_ << "'\n";
+    }
+
+    delete[] line;
+}
+
+
+InvSigma::~InvSigma()
+{
+}
+
+
+mematrix<double> & InvSigma::get_matrix(void)
+{
+    return matrix;
+}

Deleted: branches/ProbABEL-pvals/ProbABEL/src/invsigma.h
===================================================================
--- branches/ProbABEL-pvals/ProbABEL/src/invsigma.h	2015-01-14 09:22:01 UTC (rev 1913)
+++ branches/ProbABEL-pvals/ProbABEL/src/invsigma.h	2015-01-14 09:28:26 UTC (rev 1914)
@@ -1,53 +0,0 @@
-/**
- * \file   invsigma.h
- * \author mkooyman
- *
- * \brief Contains the definition of the InvSigma class.
- */
-/*
- * Copyright (C) 2009--2014 Various members of the GenABEL team. See
- * the SVN commit logs for more details.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA  02110-1301, USA.
- *
- */
-
-
-#ifndef DATA_H_
-#define DATA_H_
-#include <string>
-
-extern bool is_interaction_excluded;
-//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"
-
-
-class InvSigma {
- private:
-    static const unsigned MAXIMUM_PEOPLE_AMOUNT = 1000000;
-    unsigned int npeople;       /* number of people */
-    std::string filename;
-    mematrix<double> matrix;    /* file is stored here */
-
- public:
-    InvSigma(const char * filename_, const phedata& phe);
-    mematrix<double> & get_matrix();
-    ~InvSigma();
-};
-
-#endif // DATA_H_

Copied: branches/ProbABEL-pvals/ProbABEL/src/invsigma.h (from rev 1901, pkg/ProbABEL/src/invsigma.h)
===================================================================
--- branches/ProbABEL-pvals/ProbABEL/src/invsigma.h	                        (rev 0)
+++ branches/ProbABEL-pvals/ProbABEL/src/invsigma.h	2015-01-14 09:28:26 UTC (rev 1914)
@@ -0,0 +1,53 @@
+/**
+ * \file   invsigma.h
+ * \author mkooyman
+ *
+ * \brief Contains the definition of the InvSigma class.
+ */
+/*
+ * Copyright (C) 2009--2014 Various members of the GenABEL team. See
+ * the SVN commit logs for more details.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ */
+
+
+#ifndef DATA_H_
+#define DATA_H_
+#include <string>
+
+extern bool is_interaction_excluded;
+//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"
+
+
+class InvSigma {
+ private:
+    static const unsigned MAXIMUM_PEOPLE_AMOUNT = 1000000;
+    unsigned int npeople;       /* number of people */
+    std::string filename;
+    mematrix<double> matrix;    /* file is stored here */
+
+ public:
+    InvSigma(const char * filename_, const phedata& phe);
+    mematrix<double> & get_matrix();
+    ~InvSigma();
+};
+
+#endif // DATA_H_

Modified: branches/ProbABEL-pvals/ProbABEL/src/main.cpp
===================================================================
--- branches/ProbABEL-pvals/ProbABEL/src/main.cpp	2015-01-14 09:22:01 UTC (rev 1913)
+++ branches/ProbABEL-pvals/ProbABEL/src/main.cpp	2015-01-14 09:28:26 UTC (rev 1914)
@@ -64,6 +64,8 @@
 #include <string>
 #include <iomanip>
 #include <vector>
+#include <limits> // Needed for the float epsilon value used in the
+                  // comparison before calculating the p-value.
 
 #include <ctime> //needed for timing loading non file vector format
 
@@ -378,7 +380,6 @@
 
                 // calculate chi^2
                 // ________________________________
-                // cout <<  rd.loglik<<" "<<input_var.getNgpreds() << "\n";
 
                 if (input_var.getInverseFilename() == NULL)
                 { // Only if we don't have an inv.sigma file can we use LRT
@@ -388,7 +389,7 @@
                         if (rgd.gcount != gtd.nids)
                         {
                             // If SNP data is missing we didn't
-                            // correctly compute the null likelihood
+                            // correctly compute the null likelihood.
 
                             // Recalculate null likelihood by
                             // stripping the SNP data column(s) from
@@ -425,15 +426,42 @@
 #endif
                             *chi2val[model] = 2. *
                                 (loglik - new_null_rd.loglik);
+#ifdef LINEAR
+                            cerr << mli.name[csnp]
+                                 << "   model: " << model
+                                 << "   SNP missing!" << endl;
+
+                            double Z = rd.beta[start_pos] / rd.sebeta[start_pos];
+                            cerr << "  w2     = " << rd.w2
+                                 << "    WALD:  " << Z*Z
+                                 << "    LRT:   " << *chi2val[model]
+                                 << endl;
+
+                            *chi2val[model] = rd.w2;
+#endif
                             *chi2[model] << *chi2val[model];
                         }
                         else
                         {
-                            // No missing SNP data, we can compute the LRT
+                            // No missing SNP data, we can compute the
+                            // LRT without recalculating the null
+                            // model likelihood.
                             *chi2val[model] = 2. * (loglik - null_loglik);
+#ifdef LINEAR
+                            cerr << mli.name[csnp]
+                                 << "   model: " << model
+                                 << "   No missing SNP" << endl;
+
+                            double Z = rd.beta[start_pos] / rd.sebeta[start_pos];
+                            cerr << "  w2     = " << rd.w2
+                                 << "    WALD:  " << Z*Z
+                                 << "    LRT:   " << *chi2val[model]
+                                 << endl;
[TRUNCATED]

To get the complete diff run:
    svnlook diff /svnroot/genabel -r 1914


More information about the Genabel-commits mailing list