Filter monomorphic markers. This filter will remove from the dataset markers with just one genotype phenotype:
genotypes are ALL homozygotes REF/REF (pp)
genotypes are ALL heterozygotes REF/ALT, ALT/REF (pq or qp)
genotypes are ALL homozygotes ALT/ALT (qq)
Filter targets: SNPs
Statistics: the number of genotype phenotypes
Used internally in radiator and might be of interest for users who wants to keep only polymorphic markers in their dataset.
filter_monomorphic(
data,
filter.monomorphic = TRUE,
parallel.core = parallel::detectCores() - 1,
verbose = FALSE,
...
)(4 options) A file or object generated by radiator:
tidy data
Genomic Data Structure (GDS)
How to get GDS and tidy data ?
Look into tidy_genomic_data,
read_vcf or
tidy_vcf.
(optional, logical)
Default: filter.monomorphic = TRUE.
(optional) The number of core used for parallel
execution during import.
Default: parallel.core = parallel::detectCores() - 1.
(optional, logical) When verbose = TRUE
the function is a little more chatty during execution.
Default: verbose = TRUE.
(optional) Advance mode that allows to pass further arguments for fine-tuning the function. Also used for legacy arguments (see details or special section)
A list with the filtered input, whitelist and blacklist of markers..
Important distinction — genotype-level monomorphism
filter_monomorphic evaluates monomorphism based on the actual
genotypes stored inside a GDS file. A marker is considered monomorphic when
all non-missing individuals display the same genotype phenotype.
Internally, this is assessed using the variant-level alternate allele dosage
($dosage_alt):
This captures cases such as:
all REF/REF (dosage = 0)
all REF/ALT (dosage = 1)
all ALT/ALT (dosage = 2)
Even if the allele frequency in the population is neither 0 nor 1 (e.g., all individuals are REF/ALT heterozygotes), the variant is still considered genotype-monomorphic.
This is a genotype-level definition of polymorphism, which is more conservative and more appropriate for downstream population genomics.
Consequently, filter_monomorphic will often identify additional
monomorphic markers that were not removed earlier by
filter_monomorphic_vcf, which uses allele-level logic.
This discrepancy is by design.
Why results differ between filter_monomorphic_vcf and
filter_monomorphic
These functions intentionally implement two different biological definitions:
filter_monomorphic_vcf removes sites that are
allele-monomorphic, based on INFO/AC and INFO/AN.
filter_monomorphic removes sites that are
genotype-monomorphic, based on the distribution of genotype
phenotypes in the GDS.
A variant can contain both REF and ALT alleles (allele-level polymorphism)
but still have only one genotype phenotype across all individuals.
Therefore, it is expected and correct that
filter_monomorphic may remove additional markers.