TreeSummarizedExperiment
objectR/convertToPhyloseq.R
convertToPhyloseq.Rd
Create a phyloseq object from a TreeSummarizedExperiment
object
convertToPhyloseq(x, ...)
# S4 method for class 'SummarizedExperiment'
convertToPhyloseq(x, assay.type = "counts", assay_name = NULL, ...)
# S4 method for class 'TreeSummarizedExperiment'
convertToPhyloseq(x, tree.name = tree_name, tree_name = "phylo", ...)
a
TreeSummarizedExperiment
object
Additional arguments. Not used currently.
Character scalar
. Specifies the name of assay
used. (Default: "counts"
)
Deprecated. Use assay.type
instead.
Character scalar
. Specifies the name of the
tree to be included in the phyloseq object that is created,
(Default: "phylo"
)
Deprecated. Use tree.name
instead.
convertToPhyloseq
returns an object of class
phyloseq
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.
### 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
#> phyloseq-class experiment-level object
#> otu_table() OTU Table: [ 19216 taxa and 26 samples ]
#> sample_data() Sample Data: [ 26 samples by 7 sample variables ]
#> tax_table() Taxonomy Table: [ 19216 taxa by 7 taxonomic ranks ]
#> phy_tree() Phylogenetic Tree: [ 19216 tips and 19215 internal nodes ]
# 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
#> phyloseq-class experiment-level object
#> otu_table() OTU Table: [ 19216 taxa and 26 samples ]
#> sample_data() Sample Data: [ 26 samples by 7 sample variables ]
#> tax_table() Taxonomy Table: [ 19216 taxa by 7 taxonomic ranks ]
#> phy_tree() Phylogenetic Tree: [ 19216 tips and 19215 internal nodes ]