Skip to content

Commit

Permalink
Exclude missing data from available loci window avg function
Browse files Browse the repository at this point in the history
  • Loading branch information
lczech committed Jul 16, 2024
1 parent dfd51b4 commit 7c49b5e
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions lib/genesis/population/function/window_average.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,9 @@ enum class WindowAveragePolicy
* settings. This can be useful when SNP calling was applied beforehand.
*
* Technically, this simply uses the sum of the variant filter stats to get the number of
* positions that have been processed in total. As the stats get incremented each time a position
* is processed, this sum reflects every entry that was exposed to some filter and not already
* completely removed, via e.g., region filters.
* positions that have been processed in total, except for any missing data.
* As the stats get incremented each time a position is processed, this sum reflects every entry
* that was exposed to some filter and not already completely removed, via e.g., region filters.
*/
kAvailableLoci,

Expand Down Expand Up @@ -160,7 +160,10 @@ inline double window_average_denominator(
return window_length;
}
case WindowAveragePolicy::kAvailableLoci: {
return variant_filter_stats.sum();
auto const missing = variant_filter_stats_category_counts(
variant_filter_stats, VariantFilterTagCategory::kMissingInvalid
);
return variant_filter_stats.sum() - missing;
}
case WindowAveragePolicy::kValidLoci: {
// Here, we use the number of positions that passed all total variant filters
Expand Down

0 comments on commit 7c49b5e

Please sign in to comment.