This function filters observations at a specific rank by their prevalence across samples.
taxa_prevalence_filter(
obj,
rank,
minimum_abundance = 5,
rel_sample_percentage = 0.5,
validated = FALSE
)A Taxmap object.
The rank being analyzed for prevalence across samples.
The minimum abundance needed per observation per sample. Default: 5
The percentage of samples per observation that meet the minimum abundance. Default: 0.5
This parameter provides a way to override validation steps. Use carefully. Default: FALSE
Returns a taxmap object that contains taxon_ids that have passed the above filter.
The taxa_prevalence_filter filters taxon_ids that do not appear more than a certain amount of times (minimum abundance) in a certain percentage of samples (rel_sample_percentage) at the specified agglomerated rank (rank). The phyloseq workflow calls for a minimum abundance of 5 across %50 of the samples. This method is considered supervised, because the filtering is done based on taxonomic annotation (taxon_ids), which is assigned based on a reference database (SILVA or GreenGenes).
Other Advanced Metacoder Filters:
agglomerate_taxmap(),
cov_filter(),
otu_prevalence_filter(),
otu_proportion_filter()
if (FALSE) { # \dontrun{
if(interactive()){
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
)
}
} # }