diff --git a/regression/MultipleTraitLinearRegressionScoreTest.cpp b/regression/MultipleTraitLinearRegressionScoreTest.cpp index e9b6d3c..6db7e44 100644 --- a/regression/MultipleTraitLinearRegressionScoreTest.cpp +++ b/regression/MultipleTraitLinearRegressionScoreTest.cpp @@ -6,8 +6,8 @@ #include "gsl/gsl_cdf.h" // use gsl_cdf_chisq_Q -#include "Eigen/Dense" #include "Eigen/Cholesky" // ldlt +#include "Eigen/Dense" #include "Formula.h" @@ -134,8 +134,9 @@ bool MultipleTraitLinearRegressionScoreTest::FitNullModel( std::vector phenoCol; std::vector covCol; - // NOTE: need to handle (1) no covariates (2) after removing missing values, - // there is no value to test + // NOTE: need to handle two corner cases: + // (1) no covariates + // (2) after removing missing values, there is no value to test for (int i = 0; i < w.nTest; ++i) { phenoName = tests.getPhenotype(i); phenoCol.clear(); @@ -168,7 +169,7 @@ bool MultipleTraitLinearRegressionScoreTest::FitNullModel( continue; } } - w.missingIndex[i][j] = false; + w.missingIndex[i][j] = false; } removeRow(w.missingIndex[i], &w.Y[i]); removeRow(w.missingIndex[i], &w.Z[i]); @@ -179,8 +180,10 @@ bool MultipleTraitLinearRegressionScoreTest::FitNullModel( // calcualte Uzy, inv(Z'Z) if (w.hasCovariate[i]) { - w.ZZinv[i].noalias() = (w.Z[i].transpose() * w.Z[i]).ldlt().solve( - EMat::Identity(w.Z[i].cols(), w.Z[i].cols())); + w.ZZinv[i].noalias() = + (w.Z[i].transpose() * w.Z[i]) + .ldlt() + .solve(EMat::Identity(w.Z[i].cols(), w.Z[i].cols())); w.Uyz[i].noalias() = w.Z[i].transpose() * w.Y[i]; w.sigma2[i] = (w.Y[i].transpose() * w.Y[i] - w.Uyz[i].transpose() * w.ZZinv[i] * w.Uyz[i])(0, 0) / diff --git a/src/DataLoader.cpp b/src/DataLoader.cpp index 8032f0f..bbba491 100644 --- a/src/DataLoader.cpp +++ b/src/DataLoader.cpp @@ -378,7 +378,9 @@ int DataLoader::loadMultiplePhenotype(const std::string& multiplePhenotype, textMat.readFile(FLAG_multiplePheno, TextMatrix::HAS_HEADER); if (textMat.nrow() == 0 || which(textMat.header(), "pheno") < 0 || which(textMat.header(), "covar") < 0) { - logger->warn("Wrong multiple phenotype analysis file (no correct headers)"); + logger->warn( + "Wrong multiple phenotype analysis file (no correct headers: \"pheno " + "covar\")"); exit(1); }