aboutsummaryrefslogtreecommitdiff
path: root/src/gemma_io.cpp
diff options
context:
space:
mode:
authorPjotr Prins2020-09-28 10:04:08 +0100
committerPjotr Prins2020-09-28 10:04:08 +0100
commit210a8ec0746dc0606c1319d3ad2d5bcd7ae66429 (patch)
treeba2c66f40693c2582108548358faa3b6b30a7163 /src/gemma_io.cpp
parentfc5c1760bf8c09e90b27a0fd709d9bda6ed30a76 (diff)
downloadpangemma-210a8ec0746dc0606c1319d3ad2d5bcd7ae66429.tar.gz
Display mean
Diffstat (limited to 'src/gemma_io.cpp')
-rw-r--r--src/gemma_io.cpp10
1 files changed, 6 insertions, 4 deletions
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));
}