filter_taxa: Filter taxa based on across-sample OTU abundance criteria

View source: R/transform-filter.R

filter_taxaR Documentation

Filter taxa based on across-sample OTU abundance criteria

Description

Variations of phyloseq::filter_taxa() that allows a purrr-style anonymous function.

Usage

filter_taxa(physeq, fun, prune = FALSE)

filter_taxa2(physeq, fun)

Arguments

physeq

phyloseq-class() or ape::phylo().

fun

A function or formula that can be converted to a function by purrr::as_mapper()

prune

A logical. If FALSE, then this function returns a logical vector specifying the taxa that passed the filter; if TRUE, then this function returns the pruned phyloseq object.

Details

filter_taxa() simply calls purrr::as_mapper() on fun and passes the resulting function on to phyloseq::filter_taxa(). filter_taxa2() also sets prune = TRUE, which is convenient when passing a phyloseq object in a pipe chain (see example).

Functions

  • filter_taxa2(): Sets prune = TRUE

See Also

phyloseq::filter_taxa() purrr::as_mapper()

Examples

data(GlobalPatterns)
# Filter low prevalence taxa and then convert to proportions
gp.prop <- GlobalPatterns %>%
  filter_taxa2(~ sum(. > 0) > 5) %>%
  transform_sample_counts(~ . / sum(.))

mikemc/speedyseq documentation built on April 22, 2024, 6:40 p.m.