about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorPjotr Prins2022-08-06 10:22:25 +0200
committerPjotr Prins2022-08-06 10:22:25 +0200
commitfa4b648460e30834746e61404957a8a5e98113f2 (patch)
treef4e1b8d779ae1d396769deb9686ea6d4e8546b24 /src
parent9ea4215bd1c2dbd616049538180a67d5fb65766c (diff)
downloadpangemma-fa4b648460e30834746e61404957a8a5e98113f2.tar.gz
Add warning when genotypes not in range for mean BIMBAM
Diffstat (limited to 'src')
-rw-r--r--src/gemma_io.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/gemma_io.cpp b/src/gemma_io.cpp
index 962e0c0..bd687af 100644
--- a/src/gemma_io.cpp
+++ b/src/gemma_io.cpp
@@ -684,6 +684,9 @@ bool ReadFile_geno(const string &file_geno, const set<string> &setSnps,
   double maf, geno, geno_old;
   size_t n_miss;
   size_t n_0, n_1, n_2;
+  double min_g = std::numeric_limits<float>::max();
+  double max_g = std::numeric_limits<float>::min();
+
   int flag_poly;
 
   int ni_total = indicator_idv.size();
@@ -770,6 +773,8 @@ bool ReadFile_geno(const string &file_geno, const set<string> &setSnps,
       }
 
       gsl_vector_set(genotype, c_idv, geno);
+      if (geno < min_g) min_g = geno;
+      if (geno > max_g) max_g = geno;
 
       // going through genotypes with 0.0 < geno < 2.0
       if (flag_poly == 0) { // first init in marker
@@ -846,6 +851,11 @@ bool ReadFile_geno(const string &file_geno, const set<string> &setSnps,
     ns_test++;
   }
 
+  if (min_g != 0.0)
+    warning_msg("The minimum genotype value is not 0.0 - this is not the BIMBAM standard and will skew l_lme and effect sizes");
+  if (max_g != 2.0)
+    warning_msg("The maximum genotype value is not 2.0 - this is not the BIMBAM standard and will skew l_lme and effect sizes");
+
   gsl_vector_free(genotype);
   gsl_vector_free(genotype_miss);
   gsl_matrix_free(WtW);