diff options
Diffstat (limited to 'src/mathfunc.cpp')
| -rw-r--r-- | src/mathfunc.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
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<size_t, size_t, size_t> 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<int> &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; |
