diff options
| author | Pjotr Prins | 2025-12-05 11:23:47 +0100 |
|---|---|---|
| committer | Pjotr Prins | 2025-12-05 11:23:47 +0100 |
| commit | e3207cbb0068e1f9580ae5c9c585bc3a2b2c6ca6 (patch) | |
| tree | 3e3b3f67f5f9c2ac5db5d96af6b9a3970222e25e /src/mathfunc.cpp | |
| parent | 9290aa8c65793ec7e0c5545781841212a62e0643 (diff) | |
| download | pangemma-e3207cbb0068e1f9580ae5c9c585bc3a2b2c6ca6.tar.gz | |
Output is on par with earlier gemma - only allele values are missing
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; |
