Skip to content

Commit

Permalink
Reorder sample deletion count filter
Browse files Browse the repository at this point in the history
  • Loading branch information
lczech committed May 7, 2024
1 parent d4488fd commit a8283ab
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 26 deletions.
30 changes: 15 additions & 15 deletions lib/genesis/population/filter/sample_counts_filter_numerical.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,21 @@ bool apply_sample_counts_filter_numerical(
transform_zero_out_by_max_count( sample, params.max_count );
}

// Check deletions.
if(
params.deletions_count_limit > 0
&& sample.d_count > 0
&& sample.d_count >= params.deletions_count_limit
) {
// if( params.clear_filtered ) {
// sample.clear();
// }

sample.status.set( SampleCountsFilterTag::kAboveDeletionsCountLimit );
++stats[SampleCountsFilterTag::kAboveDeletionsCountLimit];
return false;
}

// Empty?
auto const sum = nucleotide_sum( sample );
if( sum == 0 ) {
Expand Down Expand Up @@ -166,21 +181,6 @@ bool apply_sample_counts_filter_numerical(
return false;
}

// Check deletions.
if(
params.deletions_count_limit > 0
&& sample.d_count > 0
&& sample.d_count >= params.deletions_count_limit
) {
// if( params.clear_filtered ) {
// sample.clear();
// }

sample.status.set( SampleCountsFilterTag::kAboveDeletionsCountLimit );
++stats[SampleCountsFilterTag::kAboveDeletionsCountLimit];
return false;
}

// -------------------------------------------
// SNP vs Invariant
// -------------------------------------------
Expand Down
22 changes: 11 additions & 11 deletions lib/genesis/population/filter/sample_counts_filter_numerical.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,17 @@ struct SampleCountsFilterNumericalParams
*/
size_t max_count = 0;

/**
* @brief Maximum number of deletions at a position before being filtered out.
*
* If this is set to a value greater than 0, and the number of deletions at the position
* (determined by the SampleCounts::d_count) is equal to or greater than this value,
* the sample is filtered out by setting its status accordingly.
*
* @see SampleCountsFilterTag::kAboveDeletionsCountLimit
*/
size_t deletions_count_limit = 0;

/**
* @brief Minimum coverage expected for a SampleCounts to be considered covered.
*
Expand All @@ -162,17 +173,6 @@ struct SampleCountsFilterNumericalParams
*/
size_t max_coverage = 0;

/**
* @brief Maximum number of deletions at a position before being filtered out.
*
* If this is set to a value greater than 0, and the number of deletions at the position
* (determined by the SampleCounts::d_count) is equal to or greater than this value,
* the sample is filtered out by setting its status accordingly.
*
* @see SampleCountsFilterTag::kAboveDeletionsCountLimit
*/
size_t deletions_count_limit = 0;

// -------------------------------------------
// SNP vs Invariant
// -------------------------------------------
Expand Down

0 comments on commit a8283ab

Please sign in to comment.