1 #ifndef GENESIS_POPULATION_FILTER_SAMPLE_COUNTS_FILTER_POSITIONAL_H_
2 #define GENESIS_POPULATION_FILTER_SAMPLE_COUNTS_FILTER_POSITIONAL_H_
49 namespace population {
65 template<
class GenomeMaskType>
67 std::vector<std::shared_ptr<GenomeMaskType>>
const& sample_masks,
69 bool complement =
false
76 throw std::invalid_argument(
77 "Can only use SampleCountsFilterTag::kMaskedPosition or "
78 "SampleCountsFilterTag::kMaskedRegion as tags for "
79 "make_sample_counts_filter_by_region_tagging()."
85 return [sample_masks, tag, complement](
Variant& variant )
90 if( sample_masks.size() != variant.samples.size() ) {
91 throw std::invalid_argument(
92 "Inconsistent number of samples, with make_sample_counts_filter_by_region_tagging() "
93 "using " +
std::to_string( sample_masks.size() ) +
" sample masks, but Variant "
94 "has " +
std::to_string( variant.samples.size() ) +
" samples present."
97 if( ! variant.status.passing() ) {
103 for(
size_t i = 0; i < sample_masks.size(); ++i ) {
104 if( ! sample_masks[i] ) {
107 if( ! variant.samples[i].status.passing() ) {
110 auto const& regions = *sample_masks[i];
111 auto const keep = complement ^
is_covered( regions, variant );
113 variant.samples[i].status.set( tag );
122 #endif // include guard