This function filters OTUs that have a variance higher than the specified CoV.
cov_filter(obj, coefficient_of_variation, validated = FALSE)Returns a taxmap object that contains otu_ids that have passed the above filter.
This function helps remove OTUs that have an unusually high variance using the coefficient of variation.
validate_MicrobiomeR_format, otu_id_filter
Other Advanced Metacoder Filters:
agglomerate_taxmap(),
otu_prevalence_filter(),
otu_proportion_filter(),
taxa_prevalence_filter()
if (FALSE) { # \dontrun{
if(interactive()){
# Use the cov_filter towards the end of your analysis
library(MicrobiomeR)
library(metacoder)
library(taxa)
# Convert Phyloseq object to taxmap object
metacoder_obj <- as_MicrobiomeR_format(obj = phyloseq_obj, format = "raw_format")
# Remove Archaea from the taxmap object
metacoder_obj <- filter_taxa(
obj = metacoder_obj,
taxon_names == "Archaea",
subtaxa = TRUE,
invert = TRUE)
# Ambiguous Annotation Filter - Remove taxonomies with ambiguous names
metacoder_obj <- filter_ambiguous_taxa(metacoder_obj, subtaxa = TRUE)
# Low Sample Filter - Remove the low samples
metacoder_obj <- sample_id_filter(obj = metacoder_obj,
.f_filter = ~sum(.),
.f_condition = ~.>= 20, validated = TRUE)
# Master Threshold Filter - Add the otu_proportions table and then filter OTUs based on min %
metacoder_obj <- otu_proportion_filter(
obj = metacoder_obj,
otu_percentage = 0.00001
)
# Taxa Prevalence Filter
# The default minimum abundance is 5 and the sample percentage is 0.5 (5%).
# Phylum
metacoder_obj <- taxa_prevalence_filter(
obj = metacoder_obj,
rank = "Phylum"
)
# Class
metacoder_obj <- taxa_prevalence_filter(
obj = metacoder_obj,
rank = "Class",
validated = TRUE
)
# OTU prevalence filter
metacoder_obj <- otu_prevalence_filter(obj = metacoder_obj, validated = TRUE)
# Coefficient of Variation Filter - Filter OTUs based on the coefficient of variation
metacoder_obj <- cov_filter(obj = metacoder_obj,
coefficient_of_variation = 3,
validated = TRUE)
}
} # }