|
A library for working with phylogenetic and population genetic data.
v0.27.0
|
|
Go to the documentation of this file.
37 namespace population {
50 bool tolerate_deletions
55 auto const stat =
status( smp, min_coverage, max_coverage, min_count, tolerate_deletions );
56 return predicate( stat );
61 for(
auto const& smp : variant.
samples ) {
62 auto const stat =
status( smp, min_coverage, max_coverage, min_count, tolerate_deletions );
63 true_cnt +=
static_cast<size_t>( predicate( stat ));
66 return true_cnt == variant.
samples.size();
70 throw std::invalid_argument(
"Invalid SampleFilterType." );
80 if( sample.
a_count < min_count ) {
83 if( sample.
c_count < min_count ) {
86 if( sample.
g_count < min_count ) {
89 if( sample.
t_count < min_count ) {
96 for(
auto& sample : variant.
samples ) {
103 if( max_count == 0 ) {
108 if( sample.
a_count > max_count ) {
111 if( sample.
c_count > max_count ) {
114 if( sample.
g_count > max_count ) {
117 if( sample.
t_count > max_count ) {
124 for(
auto& sample : variant.
samples ) {
133 if( sample.
a_count < min_count || ( max_count > 0 && sample.
a_count > max_count )) {
136 if( sample.
c_count < min_count || ( max_count > 0 && sample.
c_count > max_count )) {
139 if( sample.
g_count < min_count || ( max_count > 0 && sample.
g_count > max_count )) {
142 if( sample.
t_count < min_count || ( max_count > 0 && sample.
t_count > max_count )) {
149 for(
auto& sample : variant.
samples ) {
@ kConjunction
The filter returns true only if all of the BaseCounts samples in the Variant return true for a given ...
size_t t_count
Count of all T nucleotides that are present in the sample.
size_t g_count
Count of all G nucleotides that are present in the sample.
size_t a_count
Count of all A nucleotides that are present in the sample.
SampleFilterType
Select how Variant filter functions that evaluate properties of the Variant::samples (BaseCounts) obj...
@ kMerge
The filter is applied to the merged BaseCounts of all samples in the Variant.
bool filter_by_status(std::function< bool(BaseCountsStatus const &)> predicate, Variant const &variant, SampleFilterType type, size_t min_coverage, size_t max_coverage, size_t min_count, bool tolerate_deletions)
Filter a Variant based on a predicate that is applied to the result of a status() call on the BaseCou...
std::vector< BaseCounts > samples
BaseCounts merge(BaseCounts const &p1, BaseCounts const &p2)
Merge the counts of two BaseCountss.
A single variant at a position in a chromosome, along with BaseCounts for a set of samples.
size_t c_count
Count of all C nucleotides that are present in the sample.
Container namespace for all symbols of genesis in order to keep them separate when used as a library.
BaseCountsStatus status(BaseCounts const &sample, size_t min_coverage, size_t max_coverage, size_t min_count, bool tolerate_deletions)
Compute a simple status with useful properties from the counts of a BaseCounts.
One set of nucleotide base counts, for example for a given sample that represents a pool of sequenced...
void transform_zero_out_by_min_max_count(BaseCounts &sample, size_t min_count, size_t max_count)
Transform a BaseCounts sample by setting any nucleotide count (A, C, G, T) to zero if min_count is no...
void transform_zero_out_by_min_count(BaseCounts &sample, size_t min_count)
Transform a BaseCounts sample by setting any nucleotide count (A, C, G, T) to zero if min_count is no...
@ kDisjunction
The filter returns true if any of the BaseCounts samples in the Variant return true for a given predi...
void transform_zero_out_by_max_count(BaseCounts &sample, size_t max_count)
Transform a BaseCounts sample by setting any nucleotide count (A, C, G, T) to zero if max_count is ex...