mutate-phyloseq: Create, modify, and delete columns in the taxonomy table or...

mutate-phyloseqR Documentation

Create, modify, and delete columns in the taxonomy table or sample data

Description

These functions are wrappers around dplyr::mutate() and dplyr::transmute() that provide convenient ways to modify tax_table(x) and sample_data(x) as well as the sample and taxa names.

Usage

mutate_tax_table(x, ...)

## S4 method for signature 'taxonomyTable'
mutate_tax_table(x, ...)

## S4 method for signature 'phyloseq'
mutate_tax_table(x, ...)

transmute_tax_table(x, ...)

## S4 method for signature 'taxonomyTable'
transmute_tax_table(x, ...)

## S4 method for signature 'phyloseq'
transmute_tax_table(x, ...)

mutate_sample_data(x, ...)

## S4 method for signature 'sample_data'
mutate_sample_data(x, ...)

## S4 method for signature 'phyloseq'
mutate_sample_data(x, ...)

transmute_sample_data(x, ...)

## S4 method for signature 'sample_data'
transmute_sample_data(x, ...)

## S4 method for signature 'phyloseq'
transmute_sample_data(x, ...)

Arguments

x

A phyloseq, taxonomyTable, or sample_data object

...

Expressions passed to dplyr::mutate() or dplyr::transmute()

Details

When modifying the taxonomy table, the .otu column name can be used to set new taxa names. When modifying the sample data, the .sample column name can be used to set new taxa names.

The experimental arguments to dplyr::mutate() of .keep, .before, and .after are not currently supported and may result in errors or unexpected behavior.

Examples

data(GlobalPatterns)

ps <- GlobalPatterns %>%
  transmute_sample_data(SampleType, sample_sum = sample_sums(.)) %>%
  filter_sample_data(SampleType %in% c("Feces", "Skin", "Tongue")) %>%
  filter_tax_table(Kingdom == "Bacteria") %>%
  tax_glom("Phylum") %>%
  transmute_tax_table(Kingdom, Phylum, .otu = Phylum)
sample_data(ps)
tax_table(ps)

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