This function filters observations by their prevalence across samples.

otu_prevalence_filter(obj, minimum_abundance = 5,
  rel_sample_percentage = 0.5, validated = FALSE)

Arguments

obj

A Taxmap object.

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 otu_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). The phyloseq workflow calls for a minimum abundance of 5 across This filtering method is considered unsupervised, because it solely relies on the data in this experiment (OTU ids).

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
    )

# OTU prevalence filter
metacoder_obj <- otu_prevalence_filter(obj = metacoder_obj, validated = TRUE)
 }
# }