Skip to content

Commit

Permalink
code reformat
Browse files Browse the repository at this point in the history
  • Loading branch information
zhanxw committed Apr 25, 2016
1 parent 7b7d37d commit b51cd1e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
15 changes: 9 additions & 6 deletions regression/MultipleTraitLinearRegressionScoreTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down Expand Up @@ -134,8 +134,9 @@ bool MultipleTraitLinearRegressionScoreTest::FitNullModel(
std::vector<int> phenoCol;
std::vector<int> 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();
Expand Down Expand Up @@ -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]);
Expand All @@ -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) /
Expand Down
4 changes: 3 additions & 1 deletion src/DataLoader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down

0 comments on commit b51cd1e

Please sign in to comment.