convertFromPhyloseq: Create a 'TreeSummarizedExperiment' object from a phyloseq...

View source: R/convertFromPhyloseq.R

convertFromPhyloseqR Documentation

Create a TreeSummarizedExperiment object from a phyloseq object

Description

Create a TreeSummarizedExperiment object from a phyloseq object

Create a phyloseq object from a TreeSummarizedExperiment object

Usage

convertFromPhyloseq(x)

convertToPhyloseq(x, ...)

## S4 method for signature 'SummarizedExperiment'
convertToPhyloseq(x, assay.type = "counts", assay_name = NULL, ...)

## S4 method for signature 'TreeSummarizedExperiment'
convertToPhyloseq(x, tree.name = tree_name, tree_name = "phylo", ...)

Arguments

x

a TreeSummarizedExperiment object

...

Additional arguments. Not used currently.

assay.type

Character scalar. Specifies the name of assay used. (Default: "counts")

assay_name

Deprecated. Use assay.type instead.

tree.name

Character scalar. Specifies the name of the tree to be included in the phyloseq object that is created, (Default: "phylo")

tree_name

Deprecated. Use tree.name instead.

Details

convertFromPhyloseq converts phyloseq objects into TreeSummarizedExperiment objects. All data stored in a phyloseq object is transferred.

convertToPhyloseq creates a phyloseq object from a TreeSummarizedExperiment object. By using assay.type, it is possible to specify which table from assay is added to the phyloseq object.

Value

convertFromPhyloseq returns an object of class TreeSummarizedExperiment

convertToPhyloseq returns an object of class phyloseq

Author(s)

Leo Lahti and Tuomas Borman. Contact: microbiome.github.io

Examples


### Coerce a phyloseq object to a TreeSE object
if (requireNamespace("phyloseq")) {
    data(GlobalPatterns, package="phyloseq")
    convertFromPhyloseq(GlobalPatterns)
    data(enterotype, package="phyloseq")
    convertFromPhyloseq(enterotype)
    data(esophagus, package="phyloseq")
    convertFromPhyloseq(esophagus)
}

### Coerce a TreeSE object to a phyloseq object
# Get tse object
data(GlobalPatterns)
tse <- GlobalPatterns

# Create a phyloseq object from it
phy <- convertToPhyloseq(tse)
phy

# By default the chosen table is counts, but if there are other tables,
# they can be chosen with assay.type.

# Counts relative abundances table
tse <- transformAssay(tse, method = "relabundance")
phy2 <- convertToPhyloseq(tse, assay.type = "relabundance")
phy2


FelixErnst/mia documentation built on Aug. 13, 2024, 12:47 a.m.