about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorPjotr Prins2025-11-27 13:42:10 +0100
committerPjotr Prins2025-11-27 13:42:10 +0100
commiteb037e2b78bc6bbeca8dde0c62f9d916e2a7bedc (patch)
treef46bf143b93efbffdb03a0a057f777626f558243 /src
parentfad3d64d66a4705b3da33a90480c7e24c35b9c44 (diff)
downloadpangemma-eb037e2b78bc6bbeca8dde0c62f9d916e2a7bedc.tar.gz
Introduce first test
Diffstat (limited to 'src')
-rw-r--r--src/gemma.cpp6
-rw-r--r--src/gemma_io.cpp2
-rw-r--r--src/param.cpp8
3 files changed, 10 insertions, 6 deletions
diff --git a/src/gemma.cpp b/src/gemma.cpp
index 38b4913..fdb19fd 100644
--- a/src/gemma.cpp
+++ b/src/gemma.cpp
@@ -1919,11 +1919,15 @@ void GEMMA::BatchRun(PARAM &cPar) {
 
     time_start = clock();
 
+    if (cPar.error == true) {
+      cout << "error! failed to prepare for calculating relatedness matrix. " << endl;
+      return;
+    }
     cPar.CalcKin(G);
 
     cPar.time_G = (clock() - time_start) / (double(CLOCKS_PER_SEC) * 60.0);
     if (cPar.error == true) {
-      cout << "error! fail to calculate relatedness matrix. " << endl;
+      cout << "error! failed to calculate relatedness matrix. " << endl;
       return;
     }
 
diff --git a/src/gemma_io.cpp b/src/gemma_io.cpp
index 99b04af..664a4bd 100644
--- a/src/gemma_io.cpp
+++ b/src/gemma_io.cpp
@@ -655,7 +655,7 @@ bool ReadFile_fam(const string &file_fam, vector<vector<int>> &indicator_pheno,
 ## Modified (Mutated) Parameters:
 
 1. **`indicator_idv`** (vector<int>&)
-   - Actually **not modified** - only read from to determine which individuals to include
+   - **Not modified** - only read from to determine which individuals to include
 
 2. **`indicator_snp`** (vector<int>&)
    - **Modified**: Cleared at the start (`indicator_snp.clear()`)
diff --git a/src/param.cpp b/src/param.cpp
index 9e55693..82121b9 100644
--- a/src/param.cpp
+++ b/src/param.cpp
@@ -318,7 +318,7 @@ void PARAM::ReadFiles(void) {
 
     trim_individuals(indicator_idv, ni_max);
     trim_individuals(indicator_cvt, ni_max);
-    // The following reads the geno file to get the SNPs
+    // The following reads the geno file to get the SNPs - only for BIMBAM
     if (is_bimbam && ReadFile_bimbam_geno(file_geno, setSnps, W2, indicator_idv, indicator_snp,
                                           maf_level, miss_level, hwe_level, r2_level, mapRS2chr,
                                           mapRS2bp, mapRS2cM, snpInfo, ns_test) == false) {
@@ -392,7 +392,7 @@ void PARAM::ReadFiles(void) {
     infile.clear();
   }
 
-  // Read genotype and phenotype file for multiple BIMBAM files.
+  // Read genotype and phenotype file for multiple BIMBAM files. Note this goes untested.
   if (!file_mgeno.empty()) {
 
     // Annotation file before genotype file.
@@ -1273,8 +1273,8 @@ void PARAM::ReadBIMBAMGenotypes(gsl_matrix *UtX, gsl_matrix *K, const bool calc_
       error = true;
     }
   } else {
-      // Read BIMBAM. Not supposed to be mdb
-      if (is_mdb || ReadFile_geno(file_geno, indicator_idv, indicator_snp, UtX, K, calc_K) == false) {
+      // Read BIMBAM
+      if (is_bimbam && ReadFile_geno(file_geno, indicator_idv, indicator_snp, UtX, K, calc_K) == false) {
       error = true;
     }
   }