This function provides a flexible way to filter unwanted otu_ids from the taxmap object and from the observations of a MicrobiomeR formatted object.

otu_id_filter(obj, .f_transform = NULL, .f_filter = NULL,
  .f_condition = NULL, validated = FALSE, ...)

Arguments

obj

A Taxmap object.

.f_transform

A function used for transforming the data. Default: NULL

.f_filter

A function used for summarising the data like 'sum' or 'mean'. Default: NULL

.f_condition

A function that takes the summarised data and applied a condition like x > 10000. Default: NULL

validated

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

Value

Returns a taxmap object with otu_ids that pass the filters.

Details

Get the otu_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

See also

Examples

# NOT RUN {
if(interactive()){
# Below is the code for the otu_prevelence_filter function.
# It's a good example of how to use the otu_id_filter function.
library(MicrobiomeR)
otu_proportion_filter <- function(obj, otu_percentage = 0.00005, validated = FALSE) {
    mo_clone <- obj$clone()
    mo_clone <- validate_MicrobiomeR_format(obj = mo_clone,
                                            valid_formats = c("raw_format", "basic_format"),
                                            force_format = TRUE,
                                            validated = validated,
                                            min_or_max = min)
    # Filter OTU ids
    mo_clone <- otu_id_filter(obj = mo_clone,
                              .f_transform = ~./sum(.),
                              .f_filter = ~mean(.),
                              .f_condition = ~.> otu_percentage)
return(mo_clone)
}
 }
# }