Skip to contents

This function is directly analogous to the genefilter function for microarray filtering, but is used for filtering OTUs from phyloseq objects. It applies an arbitrary set of functions — as a function list, for instance, created by filterfun — as across-sample criteria, one OTU at a time. It takes as input a phyloseq object, and returns a logical vector indicating whether or not each OTU passed the criteria. Alternatively, if the "prune" option is set to FALSE, it returns the already-trimmed version of the phyloseq object.

Usage

step_filter_taxa(rec, .f, id = rand_id("filter_taxa"))

# S4 method for class 'Recipe'
step_filter_taxa(rec, .f, id = rand_id("filter_taxa"))

Arguments

rec

A Recipe object. The step will be added to the sequence of operations for this Recipe.

.f

A function or list of functions that take a vector of abundance values and return a logical. Some canned useful function types are included in the genefilter-package.

id

A character string that is unique to this step to identify it.

Value

An object of class Recipe

Examples

data(metaHIV_phy)

## Init Recipe
rec <- recipe(metaHIV_phy, "RiskGroup2", "Phylum")
rec
#> ── DAR Recipe ──────────────────────────────────────────────────────────────────
#> Inputs:
#> 
#>       phyloseq object with 451 taxa and 156 samples 
#>       variable of interes RiskGroup2 (class: character, levels: hts, msm, pwid) 
#>       taxonomic level Phylum 
#> 
#> 

## Define filter taxa step with default parameters
rec <- 
  step_filter_taxa(rec, .f = "function(x) sum(x > 0) >= (0.03 * length(x))")
  
rec
#> ── DAR Recipe ──────────────────────────────────────────────────────────────────
#> Inputs:
#> 
#>       phyloseq object with 451 taxa and 156 samples 
#>       variable of interes RiskGroup2 (class: character, levels: hts, msm, pwid) 
#>       taxonomic level Phylum 
#> 
#> Preporcessing steps:
#> 
#>       step_filter_taxa() id = filter_taxa__Beaver_Tail 
#> 
#> DA steps:
#>