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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Thu Aug 21 07:57:38 CEST 2014


Author: maksim
Date: 2014-08-21 07:57:37 +0200 (Thu, 21 Aug 2014)
New Revision: 1803

Modified:
   pkg/ProbABEL/src/phedata.cpp
Log:
Fixed an issue with --interaction_only when ProbABEL reported wrong model (the same as for --intreaction) while analysis was done correctly for --interaction_only.

Modified: pkg/ProbABEL/src/phedata.cpp
===================================================================
--- pkg/ProbABEL/src/phedata.cpp	2014-08-15 12:59:56 UTC (rev 1802)
+++ pkg/ProbABEL/src/phedata.cpp	2014-08-21 05:57:37 UTC (rev 1803)
@@ -27,6 +27,7 @@
 #include <fstream>
 #include <cstdarg>
 #include <cstdlib>
+#include <cstring>
 
 using std::cout;
 using std::cerr;
@@ -66,6 +67,7 @@
     std::ifstream myfile(fname);
     char *line = new char[BFS];
     char *tmp  = new char[BFS];
+    char *interaction_cov_name  = new char[BFS];
     noutcomes = noutc;
     is_interaction_excluded = false;
 
@@ -146,6 +148,11 @@
     model_terms[n_model_terms++] = "mu";
 #endif
 
+
+
+
+
+
     if (nphenocols > noutcomes + 1)
     {
         infile >> tmp;
@@ -154,12 +161,18 @@
         for (int i = (2 + noutcomes); i < nphenocols; i++)
         {
             infile >> tmp;
+            std::cout << "nphenocols="<<nphenocols<<"\n";
+            std::cout<<"i="<<i<<", is_interaction_excluded="<<is_interaction_excluded<<", interaction="<<interaction<<", n_model_terms="<<n_model_terms<<"\n";
+            if(n_model_terms == interaction  && is_interaction_excluded)
+               {
+               strcpy(interaction_cov_name, tmp);
+               continue;
+               }
 
-            // if(iscox && ) {if(n_model_terms+1 == interaction-1) {continue;} }
-            // else      {if(n_model_terms+1 == interaction) {continue;} }
             model = model + " + ";
             model = model + tmp;
             model_terms[n_model_terms++] = tmp;
+            std::cout << "model="<<model<<"\n";
         }
     }
     model = model + " + SNP_A1";
@@ -167,29 +180,27 @@
     {
         if (iscox)
         {
-            model = model + " + " + model_terms[interaction - 1] + "*SNP_A1";
+           if(!is_interaction_excluded) model = model + " + " + model_terms[interaction - 1] + "*SNP_A1";
+           else model = model + " + " + interaction_cov_name + "*SNP_A1";
         }
         else
         {
-            model = model + " + " + model_terms[interaction] + "*SNP_A1";
+            if(!is_interaction_excluded) model = model + " + " + model_terms[interaction] + "*SNP_A1";
+            else model = model + " + " + interaction_cov_name + "*SNP_A1";
         }
     }
     model_terms[n_model_terms++] = "SNP_A1";
 
-    if (is_interaction_excluded) // exclude covariates from covariate names
-    {
-        if (iscox)
-        {
-            std::cout << "model is running without "
-                      << model_terms[interaction - 1] << ", term\n";
-        }
-        else
-        {
-            std::cout << "model is running without " << model_terms[interaction]
-                      << ", term\n";
-        }
-    }
 
+
+
+
+
+
+
+
+
+
 #if LOGISTIC
     std::cout << "Logistic ";
 #elif LINEAR



More information about the Genabel-commits mailing list