[Genabel-commits] r1023 - branches/ProbABEL-refactoring/ProbABEL/src
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Thu Nov 15 10:05:13 CET 2012
Author: lckarssen
Date: 2012-11-15 10:05:12 +0100 (Thu, 15 Nov 2012)
New Revision: 1023
Modified:
branches/ProbABEL-refactoring/ProbABEL/src/coxph_data.cpp
branches/ProbABEL-refactoring/ProbABEL/src/phedata.h
branches/ProbABEL-refactoring/ProbABEL/src/regdata.cpp
Log:
Ported the changes of r910 and r933 from trunk to the ProbABEL-refactoring branch.
These were the original SVN log messages:
r933:
Added copyright message for the Nijmegen bug fix also to the current branch.
r910:
ProbABEL:
"Forward port" of the fix from rev. 902 in the ProbABEL-pacoxph branch where the behaviour for pacoxph was fixed for .prob files (ngpreds=2).
WARNING: NOT WELL TESTED YET BECAUSE pacoxph STILL RUNS VERY SLOW SINCE THE ADDITION OF FILEVECTOR STUFF.
Modified: branches/ProbABEL-refactoring/ProbABEL/src/coxph_data.cpp
===================================================================
--- branches/ProbABEL-refactoring/ProbABEL/src/coxph_data.cpp 2012-11-15 07:45:09 UTC (rev 1022)
+++ branches/ProbABEL-refactoring/ProbABEL/src/coxph_data.cpp 2012-11-15 09:05:12 UTC (rev 1023)
@@ -92,12 +92,12 @@
sstat[i] = int((phed.Y).get(i, 1));
if (sstat[i] != 1 && sstat[i] != 0)
{
- fprintf(stderr,
- "coxph_data: status not 0/1 (right order: id, fuptime, status ...) %d \n",
- phed.noutcomes);
+ std::cerr << "coxph_data: status not 0/1 (correct order: id, fuptime, status ...)"
+ << endl;
exit(1);
}
}
+
for (int j = 0; j < phed.ncov; j++)
for (int i = 0; i < nids; i++)
X.put((phed.X).get(i, j), i, j);
@@ -163,25 +163,37 @@
}
void coxph_data::update_snp(gendata &gend, int snpnum)
{
- // note this sorts by "order"!!!
+ /**
+ * This is the main part of the fix of bug #1846
+ * (C) of the fix:
+ * UMC St Radboud Nijmegen,
+ * Dept of Epidemiology & Biostatistics,
+ * led by Prof. B. Kiemeney
+ *
+ * Note this sorts by "order"!!!
+ * Here we deal with transposed X, hence last two arguments are swapped
+ * compared to the other 'update_snp'
+ * Also, the starting column-1 is not necessary for cox X therefore
+ * 'ncov-j' changes to 'ncov-j-1'
+ **/
for (int j = 0; j < ngpreds; j++)
{
float snpdata[nids];
for (int i = 0; i < nids; i++)
masked_data[i] = 0;
+
gend.get_var(snpnum * ngpreds + j, snpdata);
+
for (int i = 0; i < nids; i++)
{
- X.put(snpdata[i], (ncov - ngpreds + j), order[i]);
+ X.put(snpdata[i], (ncov - j - 1), order[i]);
if (isnan(snpdata[i]))
masked_data[order[i]] = 1;
}
}
- // for (int i=0;i<nids;i++)
- // for (int j=0;j<ngpreds;j++)
- // X.put((gend.G).get(i,(snpnum*ngpreds+j)),(ncov-ngpreds+j),order[i]);
}
+
coxph_data::~coxph_data()
{
delete[] coxph_data::masked_data;
Modified: branches/ProbABEL-refactoring/ProbABEL/src/phedata.h
===================================================================
--- branches/ProbABEL-refactoring/ProbABEL/src/phedata.h 2012-11-15 07:45:09 UTC (rev 1022)
+++ branches/ProbABEL-refactoring/ProbABEL/src/phedata.h 2012-11-15 09:05:12 UTC (rev 1023)
@@ -43,8 +43,8 @@
int noutcomes;
int ncov;
unsigned short int * allmeasured;
- mematrix<double> X;
- mematrix<double> Y;
+ mematrix<double> X; /* Will contain the values of the covariate(s) */
+ mematrix<double> Y; /* Will contain the values of the outcome(s) */
std::string * idnames;
std::string model;
std::string * model_terms;
Modified: branches/ProbABEL-refactoring/ProbABEL/src/regdata.cpp
===================================================================
--- branches/ProbABEL-refactoring/ProbABEL/src/regdata.cpp 2012-11-15 07:45:09 UTC (rev 1022)
+++ branches/ProbABEL-refactoring/ProbABEL/src/regdata.cpp 2012-11-15 09:05:12 UTC (rev 1023)
@@ -95,10 +95,12 @@
float snpdata[nids];
for (int i = 0; i < nids; i++)
masked_data[i] = 0;
+
gend.get_var(snpnum * ngpreds + j, snpdata);
+
for (int i = 0; i < nids; i++)
{
- X.put(snpdata[i], i, (ncov + 1 - j - 1));
+ X.put(snpdata[i], i, (ncov - j));
if (isnan(snpdata[i]))
masked_data[i] = 1;
}
More information about the Genabel-commits
mailing list