about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/gemma.cpp3
-rw-r--r--src/gemma.h1
-rw-r--r--src/param.cpp11
-rw-r--r--src/param.h1
4 files changed, 12 insertions, 4 deletions
diff --git a/src/gemma.cpp b/src/gemma.cpp
index 0145563..69e338a 100644
--- a/src/gemma.cpp
+++ b/src/gemma.cpp
@@ -1911,7 +1911,8 @@ void GEMMA::BatchRun(PARAM &cPar) {
   }
 
   // Generate Kinship matrix (optionally using LOCO)
-  if (cPar.a_mode == M_KIN || cPar.a_mode == M_KIN2) {
+  // if (cPar.a_mode == M_KIN || cPar.a_mode == M_KIN2) {
+  if (is_kinship_compute(cPar.a_mode)) {
     cout << "Calculating Relatedness Matrix ... " << endl;
 
     if (cPar.is_mdb) {
diff --git a/src/gemma.h b/src/gemma.h
index b34a958..fa7c24d 100644
--- a/src/gemma.h
+++ b/src/gemma.h
@@ -64,6 +64,7 @@ public:
   void Assign(int argc, char **argv, PARAM &cPar);
   void BatchRun(PARAM &cPar);
   void WriteLog(int argc, char **argv, PARAM &cPar);
+  inline bool is_kinship_compute(uint a_mode) {  return (a_mode == M_KIN || a_mode == M_KIN2); }
 };
 
 #endif
diff --git a/src/param.cpp b/src/param.cpp
index a81d18f..45904cd 100644
--- a/src/param.cpp
+++ b/src/param.cpp
@@ -227,8 +227,6 @@ void PARAM::ReadFiles(void) {
       indicator_idv.push_back(k);
     }
 
-    ns_test = 0; // number of snps to test
-
     return;
   }
 
@@ -339,7 +337,14 @@ void PARAM::ReadFiles(void) {
   }
   // lmdb-type genotype file:
   if (is_mdb && !file_geno.empty()) {
-    ns_total = indicator_snp.size();
+    if (!file_kin.empty()) { // GWA
+      // Phenotype file before genotype file. Already done this(?!)
+      if (ReadFile_pheno(file_pheno, indicator_pheno, pheno, p_column) == false) {
+        error = true;
+      }
+      ProcessInclusionIndicators();
+      ns_total = indicator_snp.size();
+    }
   }
 
   // Read genotype file for multiple PLINK files.
diff --git a/src/param.h b/src/param.h
index 36c9a9f..046f543 100644
--- a/src/param.h
+++ b/src/param.h
@@ -371,6 +371,7 @@ public:
   void UpdateSNP(const map<string, double> &mapRS2wA);
 
   inline bool is_loco() { return !loco.empty(); }
+
 };
 
 size_t GetabIndex(const size_t a, const size_t b, const size_t n_cvt);