From e3207cbb0068e1f9580ae5c9c585bc3a2b2c6ca6 Mon Sep 17 00:00:00 2001 From: Pjotr Prins Date: Fri, 5 Dec 2025 11:23:47 +0100 Subject: Output is on par with earlier gemma - only allele values are missing --- src/mathfunc.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/mathfunc.cpp') diff --git a/src/mathfunc.cpp b/src/mathfunc.cpp index f132e6e..c82872e 100644 --- a/src/mathfunc.cpp +++ b/src/mathfunc.cpp @@ -666,12 +666,14 @@ std::tuple compute_ratio(size_t ni_total, const gsl_vect return {n_0,n_1,n_2}; } -double compute_maf(size_t ni_total, size_t ni_test, size_t n_miss, const double *gs) { +double compute_maf(size_t ni_total, size_t ni_test, size_t n_miss, const double *gs, const vector &indicator) { double maf = 0.0; for (size_t i = 0; i < ni_total; ++i) { // read genotypes - double geno = gs[i]; - maf += geno; // 0..2 range + if (indicator[i]) { + double geno = gs[i]; + maf += geno; // 0..2 range + } } maf /= 2.0 * (double)(ni_test - n_miss); // Assumption is that geno value is between 0 and 2. FIXME return maf; -- cgit 1.4.1