[Genabel-commits] r891 - branches/ProbABEL-refactoring/ProbABEL/src
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Thu Apr 12 23:31:31 CEST 2012
Author: maartenk
Date: 2012-04-12 23:31:30 +0200 (Thu, 12 Apr 2012)
New Revision: 891
Modified:
branches/ProbABEL-refactoring/ProbABEL/src/main.cpp
branches/ProbABEL-refactoring/ProbABEL/src/phedata.cpp
branches/ProbABEL-refactoring/ProbABEL/src/reg1.h
branches/ProbABEL-refactoring/ProbABEL/src/utilities.cpp
Log:
-removed some unneeded includes
- made scope of some variables smaller
Modified: branches/ProbABEL-refactoring/ProbABEL/src/main.cpp
===================================================================
--- branches/ProbABEL-refactoring/ProbABEL/src/main.cpp 2012-04-11 12:16:02 UTC (rev 890)
+++ branches/ProbABEL-refactoring/ProbABEL/src/main.cpp 2012-04-12 21:31:30 UTC (rev 891)
@@ -34,8 +34,8 @@
#include <iomanip>
#include <stdio.h>
#include <vector>
-#include <sstream>
+
#include "mematrix.h"
#include "mematri1.h"
#include "data.h"
Modified: branches/ProbABEL-refactoring/ProbABEL/src/phedata.cpp
===================================================================
--- branches/ProbABEL-refactoring/ProbABEL/src/phedata.cpp 2012-04-11 12:16:02 UTC (rev 890)
+++ branches/ProbABEL-refactoring/ProbABEL/src/phedata.cpp 2012-04-12 21:31:30 UTC (rev 891)
@@ -193,8 +193,8 @@
{
infile >> tmp;
}
-
- int k = 0;
+ //TODO: remove this unused variable if there is not a reason to keep it
+ //int k = 0;
int m = 0;
for (int i = 0; i < npeople; i++)
if (allmeasured[i] == 1)
Modified: branches/ProbABEL-refactoring/ProbABEL/src/reg1.h
===================================================================
--- branches/ProbABEL-refactoring/ProbABEL/src/reg1.h 2012-04-11 12:16:02 UTC (rev 890)
+++ branches/ProbABEL-refactoring/ProbABEL/src/reg1.h 2012-04-12 21:31:30 UTC (rev 891)
@@ -33,7 +33,8 @@
}
mematrix<double> apply_model(mematrix<double> &X, int model, int interaction,
- int ngpreds, bool is_interaction_excluded ,bool iscox = false, int nullmodel = 0)
+ int ngpreds, bool is_interaction_excluded, bool iscox = false,
+ int nullmodel = 0)
// model 0 = 2 df
// model 1 = additive 1 df
// model 2 = dominant 1 df
@@ -74,11 +75,12 @@
}
}
//________________________
- int col_new;
+
if (is_interaction_excluded)
{
mematrix<double> nX_without_interact_phe;
nX_without_interact_phe.reinit(nX.nrow, nX.ncol - 1);
+ int col_new;
for (int row = 0; row < nX.nrow; row++)
{
//Han Chen
@@ -133,9 +135,10 @@
}
//________________________
- int col_new = -1;
+
if (is_interaction_excluded)
{
+ int col_new;
mematrix<double> nX_without_interact_phe;
nX_without_interact_phe.reinit(nX.nrow, nX.ncol - 1);
for (int row = 0; row < nX.nrow; row++)
@@ -203,11 +206,12 @@
* nX[i * nX.ncol + c1]; //Maksim: interaction with SNP
}
//Han Chen
- int col_new = -1;
+
if (is_interaction_excluded)
{
mematrix<double> nX_without_interact_phe;
nX_without_interact_phe.reinit(nX.nrow, nX.ncol - 1);
+ int col_new;
for (int row = 0; row < nX.nrow; row++)
{
col_new = -1;
@@ -396,8 +400,8 @@
}
//fprintf(stdout,"estimate: %i %i %i %i\n",rdata.nids,(rdata.X).nrow,(rdata.X).ncol,(rdata.Y).ncol);
- mematrix<double> X = apply_model(rdata.X, model, interaction, ngpreds,rdata.is_interaction_excluded,
- false, nullmodel);
+ mematrix<double> X = apply_model(rdata.X, model, interaction, ngpreds,
+ rdata.is_interaction_excluded, false, nullmodel);
int length_beta = X.ncol;
beta.reinit(length_beta, 1);
@@ -636,8 +640,8 @@
//for (int i=0;i<rdatain.nids;i++) if (rdata.masked_data[i]==0) resid[j++]=residin[i];
mematrix<double> oX = rdata.extract_genotypes();
- mematrix<double> X = apply_model(oX, model, interaction, ngpreds,rdata.is_interaction_excluded, false,
- nullmodel);
+ mematrix<double> X = apply_model(oX, model, interaction, ngpreds,
+ rdata.is_interaction_excluded, false, nullmodel);
beta.reinit(X.ncol, 1);
sebeta.reinit(X.ncol, 1);
double N = double(resid.nrow);
@@ -750,8 +754,8 @@
}
- mematrix<double> X = apply_model(rdata.X, model, interaction, ngpreds,rdata.is_interaction_excluded,
- false, nullmodel);
+ mematrix<double> X = apply_model(rdata.X, model, interaction, ngpreds,
+ rdata.is_interaction_excluded, false, nullmodel);
int length_beta = X.ncol;
beta.reinit(length_beta, 1);
sebeta.reinit(length_beta, 1);
@@ -800,9 +804,8 @@
fprintf(stdout,"tXInv %f %f %f\n",tX.get(0,0),tX.get(1,0),tX.get(2,0));
if (X.ncol==4) fprintf(stdout,"X[4] %f\n",tX.get(3,0));
*/
-
- double N;
-
+ //TODO: remove this unused variable if there is not a reason to keep it
+ //double N;
niter = 0;
double delta = 1.;
double prevlik = 0.;
@@ -832,7 +835,7 @@
tmp.print();
}
mematrix<double> tXWX = tmp * (X);
- N = tXWX.get(0, 0);
+ //N = tXWX.get(0, 0);
if (verbose)
{
@@ -965,8 +968,8 @@
mematrix<double> invvarmatrix, int nullmodel = 0)
{
mematrix<double> oX = rdata.extract_genotypes();
- mematrix<double> X = apply_model(oX, model, interaction, ngpreds,rdata.is_interaction_excluded, false,
- nullmodel);
+ mematrix<double> X = apply_model(oX, model, interaction, ngpreds,
+ rdata.is_interaction_excluded, false, nullmodel);
beta.reinit(X.ncol, 1);
sebeta.reinit(X.ncol, 1);
double N = double(resid.nrow);
Modified: branches/ProbABEL-refactoring/ProbABEL/src/utilities.cpp
===================================================================
--- branches/ProbABEL-refactoring/ProbABEL/src/utilities.cpp 2012-04-11 12:16:02 UTC (rev 890)
+++ branches/ProbABEL-refactoring/ProbABEL/src/utilities.cpp 2012-04-12 21:31:30 UTC (rev 891)
@@ -5,9 +5,6 @@
* Author: mkooyman
*/
#include <string>
-#include <cstdarg>
-#include <cstdio>
-#include <cstdlib>
void report_error(const char * format, ...)
{
va_list args;
More information about the Genabel-commits
mailing list