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)

Arguments

obj

A Taxmap object.

rank

The rank being analyzed for prevalence across samples.

minimum_abundance

The minimum abundance needed per observation per sample. Default: 5

rel_sample_percentage

The percentage of samples per observation that meet the minimum abundance. Default: 0.5

validated

This parameter provides a way to override validation steps. Use carefully. Default: FALSE

Value

Returns a taxmap object that contains taxon_ids that have passed the above filter.

Details

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 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).

See also

Examples

# NOT RUN {
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
    )
 }
# }