transform_abundances: Transform the abundances in 'profile' sample by sample

View source: R/process_transform.R

transform_abundancesR Documentation

Transform the abundances in profile sample by sample

Description

Transform the abundances in profile sample by sample, which means the values of each sample will be transformed individually. It will change the data distribution of features. For instance, transforming left skew distribution into nearly norml distribution by using log function.

Usage

transform_abundances(
   object,
   transform = c("identity", "log10", "log10p",
            "log2", "log2p",
            "SquareRoot", "CubicRoot", "logit"),
   level = c(NULL, "Kingdom", "Phylum", "Class",
           "Order", "Family", "Genus",
           "Species", "Strain", "unique"))

Arguments

object

(Required). a otu_table, phyloseq, SummarizedExperiment or microbiomeMarker.

transform

transformation to apply, the options inclulde:

  • "identity", return the original data without any transformation.

  • "log10", the transformation is log10(object), and if the data contains zeros the transformation is log10(1 + object).

  • "log10p", the transformation is log10(1 + object).

  • "log2", the transformation is log2(object), and if the data contains zeros the transformation is log2(1 + object).

  • "log2p", the transformation is log2(1 + object).

  • "SquareRoot", the transformation is ⁠Square Root⁠.

  • "CubicRoot", the transformation is ⁠Cubic Root⁠.

  • "logit", the transformation is ⁠Zero-inflated Logit Transformation⁠ (Does not work well for microbiome data).

level

(Optional). character. Summarization level (from rank_names(pseq), default: NULL).

Value

A object matches the class of argument object with the transformed otu_table.

Author(s)

Created by Yang Cao; modified by Hua Zou (11/30/2022 Shenzhen China)

See Also

abundances()

Examples

## Not run: 
# phyloseq object
data("Zeybel_2022_gut")
transform_abundances(
  Zeybel_2022_gut,
  level = "Phylum",
  transform = "log10p")

# SummarizedExperiment object
data("Zeybel_2022_protein")
transform_abundances(
  Zeybel_2022_protein,
  transform = "log10p")

## End(Not run)


HuaZou/MicrobiomeAnalysis documentation built on May 13, 2024, 11:10 a.m.