This function provides a flexible way to filter unwanted taxon_ids from the taxmap object and from the observations of a MicrobiomeR formatted object.
taxon_id_filter(
obj,
.f_transform = NULL,
.f_filter = NULL,
.f_condition = NULL,
validated = FALSE,
...
)A Taxmap object.
A function used for transforming the data. Default: NULL
A function used for summarising the data like 'sum' or 'mean'. Default: NULL
A function that takes the summarised data and applied a condition like x > 10000. Default: NULL
This parameter provides a way to override validation steps. Use carefully. Default: FALSE
An optional list of parameters to use in the .f_filter function specified
Returns a Taxmap object with taxon_ids that pass the filters.
Get the taxon_ids to keep by using purr and the user supplied transform and filter + condition formulas. The purr package allows the use of anonymous functions as described in the link below:
https://jennybc.github.io/purrr-tutorial/ls03_map-function-syntax.html#anonymous_function,_formula
validate_MicrobiomeR_format, transposer, transformer
Other Basic Metacoder Filters:
otu_id_filter(),
sample_id_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 taxa filter - Remove the low taxon_ids
metacoder_obj <- taxon_id_filter(obj = metacoder_obj,
.f_filter = ~sum(.),
.f_condition = ~.>= 2000, validated = TRUE)
}
} # }