From 210a8ec0746dc0606c1319d3ad2d5bcd7ae66429 Mon Sep 17 00:00:00 2001 From: Pjotr Prins Date: Mon, 28 Sep 2020 10:04:08 +0100 Subject: Display mean --- src/gemma_io.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'src/gemma_io.cpp') 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 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 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)); } -- cgit v1.2.3