|
A library for working with phylogenetic and population genetic data.
v0.27.0
|
|
Go to the documentation of this file. 1 #ifndef GENESIS_POPULATION_FUNCTIONS_FILTER_TRANSFORM_H_
2 #define GENESIS_POPULATION_FUNCTIONS_FILTER_TRANSFORM_H_
48 namespace population {
104 std::function<
bool(BaseCountsStatus
const&)> predicate,
105 Variant
const& variant,
107 size_t min_coverage = 0,
108 size_t max_coverage = 0,
109 size_t min_count = 0,
110 bool tolerate_deletions =
false
126 size_t min_coverage = 0,
127 size_t max_coverage = 0,
128 size_t min_count = 0,
129 bool tolerate_deletions =
false
131 return [=](
Variant const& variant ){
133 predicate, variant, type, min_coverage, max_coverage, min_count, tolerate_deletions
155 size_t min_coverage = 0,
156 size_t max_coverage = 0,
157 size_t min_count = 0,
158 bool tolerate_deletions =
false
164 variant, type, min_coverage, max_coverage, min_count, tolerate_deletions
180 size_t min_coverage = 0,
181 size_t max_coverage = 0,
182 size_t min_count = 0,
183 bool tolerate_deletions =
false
185 return [=](
Variant const& variant ){
187 variant, type, min_coverage, max_coverage, min_count, tolerate_deletions
207 size_t min_coverage = 0,
208 size_t max_coverage = 0,
209 size_t min_count = 0,
210 bool tolerate_deletions =
false
216 variant, type, min_coverage, max_coverage, min_count, tolerate_deletions
232 size_t min_coverage = 0,
233 size_t max_coverage = 0,
234 size_t min_count = 0,
235 bool tolerate_deletions =
false
237 return [=](
Variant const& variant ){
239 variant, type, min_coverage, max_coverage, min_count, tolerate_deletions
279 bool complement =
false
281 return [region, complement](
Variant const& variant ){
282 return complement ^
is_covered( region, variant );
294 std::shared_ptr<GenomeRegionList> regions,
295 bool complement =
false
298 throw std::invalid_argument(
299 "Can only used filter_by_region() with a valid shared pointer to a GenomeRegionList."
302 return [regions, complement](
Variant const& variant ){
303 return complement ^
is_covered( *regions, variant );
318 bool complement =
false,
319 bool copy_regions =
false
322 return [regions, complement](
Variant const& variant ){
323 return complement ^
is_covered( regions, variant );
326 return [®ions, complement](
Variant const& variant ){
327 return complement ^
is_covered( regions, variant );
412 #endif // include guard
@ kConjunction
The filter returns true only if all of the BaseCounts samples in the Variant return true for a given ...
bool is_biallelic
Is the Sample biallelic?
SampleFilterType
Select how Variant filter functions that evaluate properties of the Variant::samples (BaseCounts) obj...
List of regions in a genome, for each chromosome.
bool is_covered(GenomeRegion const ®ion, std::string const &chromosome, size_t position)
Test whether the chromosome/position is within a given genomic region.
@ 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...
bool is_snp
Does the Sample have two or more alleles?
A single variant at a position in a chromosome, along with BaseCounts for a set of samples.
Container namespace for all symbols of genesis in order to keep them separate when used as a library.
A region (between two positions) on a chromosome.
bool filter_is_snp(Variant const &variant, SampleFilterType type, size_t min_coverage=0, size_t max_coverage=0, size_t min_count=0, bool tolerate_deletions=false)
Filter a Variant based on whether the sample counts are SNPs, that is, more than one count in [ACGT] ...
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...
bool filter_is_biallelic_snp(Variant const &variant, SampleFilterType type, size_t min_coverage=0, size_t max_coverage=0, size_t min_count=0, bool tolerate_deletions=false)
Filter a Variant based on whether the sample counts are biallelic SNPs, that is, exactly two base cou...
std::function< bool(Variant const &)> filter_by_region(GenomeRegion const ®ion, bool complement=false)
Filter function to be used with VariantInputIterator to filter by a genome region.
bool is_covered
Is the Sample covered by enough reads/nucleotides?