diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/debug.cpp | 5 | ||||
-rw-r--r-- | src/debug.h | 1 | ||||
-rw-r--r-- | src/gemma_io.cpp | 10 |
3 files changed, 12 insertions, 4 deletions
diff --git a/src/debug.cpp b/src/debug.cpp index ddd3c48..1014d6e 100644 --- a/src/debug.cpp +++ b/src/debug.cpp @@ -160,6 +160,11 @@ void write(const char *s, const char *msg) { cout << s << ": " << msg << endl; } +void write(const double d, const char *msg) { + if (!is_debug_data_mode()) return; + cout << d << ": " << msg << endl; +} + void write(const gsl_vector *v, const char *msg) { if (!is_debug_data_mode()) return; if (msg) cout << "// " << msg << endl; diff --git a/src/debug.h b/src/debug.h index 3b5760b..25ba673 100644 --- a/src/debug.h +++ b/src/debug.h @@ -58,6 +58,7 @@ void disable_segfpe(); { auto x = m * n; \ enforce_msg(x / m == n, "multiply integer overflow"); } +void write(const double d, const char *msg = ""); void write(const char *s, const char *msg = ""); void write(const gsl_vector *v, const char *msg = ""); void write(const gsl_matrix *m, const char *msg = ""); diff --git a/src/gemma_io.cpp b/src/gemma_io.cpp index 20f7ce3..9c10e62 100644 --- a/src/gemma_io.cpp +++ b/src/gemma_io.cpp @@ -1482,14 +1482,16 @@ bool BimbamKin(const string file_geno, const set<string> ksnps, token_i++; } - if (ns_test<1) - write(geno,"geno raw"); - geno_mean /= (double)(ni_total - n_miss); geno_var += geno_mean * geno_mean * (double)n_miss; geno_var /= (double)ni_total; geno_var -= geno_mean * geno_mean; + if (ns_test<1) { + write(geno,"geno raw"); + write(geno_mean,"geno mean"); + } + // impute missing values by plugging in the mean for (size_t i = 0; i < ni_total; ++i) { if (gsl_vector_get(geno_miss, i) == 0) { @@ -1504,7 +1506,7 @@ bool BimbamKin(const string file_geno, const set<string> ksnps, if (ns_test<1) write(geno,"geno mean"); // z-score the genotypes - if (k_mode == 2 && geno_var != 0) { // centering + if (k_mode == 2 && geno_var != 0) { // some confusion here gsl_vector_scale(geno, 1.0 / sqrt(geno_var)); } |