[Genabel-commits] r1746 - pkg/ProbABEL/src

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Tue May 27 11:56:08 CEST 2014


Author: lckarssen
Date: 2014-05-27 11:56:07 +0200 (Tue, 27 May 2014)
New Revision: 1746

Modified:
   pkg/ProbABEL/src/reg1.cpp
   pkg/ProbABEL/src/regdata.cpp
Log:
Added some explanatory comments on the way probability data is stored in the design matrix.


Modified: pkg/ProbABEL/src/reg1.cpp
===================================================================
--- pkg/ProbABEL/src/reg1.cpp	2014-05-26 22:38:56 UTC (rev 1745)
+++ pkg/ProbABEL/src/reg1.cpp	2014-05-27 09:56:07 UTC (rev 1746)
@@ -79,8 +79,9 @@
             nX.reinit(X.nrow, X.ncol + ngpreds);
             int csnp_p1 = nX.ncol - 2 * ngpreds;
             int c1 = nX.ncol - ngpreds;
-            // The following two variables are only used when
-            // ngpreds == 2
+            // The following two variables are only used when ngpreds
+            // == 2. Note that the order of the two probabilities is
+            // swapped w.r.t. the file (see regdata::update_snp())!
             int csnp_p2 = nX.ncol - 3;
             int c2 = nX.ncol - 1;
 
@@ -173,9 +174,11 @@
         nX.reinit(X.nrow, (X.ncol - 1));
     }
 
+    // Note that the order of the two probabilities is swapped
+    // w.r.t. the file (see regdata::update_snp())!
     // column with Prob(A1A2)
     int c1 = X.ncol - 2;
-    // column with Prob(A1A1). Note the order is swapped cf the file!
+    // column with Prob(A1A1)
     int c2 = X.ncol - 1;
 
     for (int i = 0; i < X.nrow; i++){

Modified: pkg/ProbABEL/src/regdata.cpp
===================================================================
--- pkg/ProbABEL/src/regdata.cpp	2014-05-26 22:38:56 UTC (rev 1745)
+++ pkg/ProbABEL/src/regdata.cpp	2014-05-27 09:56:07 UTC (rev 1746)
@@ -156,7 +156,10 @@
  * regdata::X.
  *
  * Adds the genetic information for a new SNP to the design
- * matrix.
+ * matrix. NOTE: For probability data, the order of the two
+ * probabilities is reversed compared to the way they are stored in
+ * the input file. Mach stores the probabilities as \f$P_{A_1A_1}\f$
+ * \f$P_{A_1A_2}\f$.
  *
  * @param gend Object that contains the genetic data from which the
  * dosages/probabilities will be added to the design matrix.
@@ -170,7 +173,9 @@
     freq = 0.0;
 
     // Add genotypic data (dosage or probabilities) to the design
-    // matrix X
+    // matrix X. Start filling from the last column, so for
+    // probability data (ngpreds==2) the order of the two
+    // probabilities is reversed.
     for (int j = 0; j < ngpreds; j++)
     {
         double *snpdata = new double[nids];



More information about the Genabel-commits mailing list