TreeSummarizedExperiment object to/from ‘BIOM’ resultsR/AllGenerics.R, R/convertFromBIOM.R
importBIOM.RdFor convenience, a few functions are available to convert BIOM, DADA2 and
phyloseq objects to
TreeSummarizedExperiment
objects, and
TreeSummarizedExperiment
objects to phyloseq objects.
convertToBIOM(x, assay.type = "counts", ...)
importBIOM(file, col.data = NULL, tree.file = NULL, ...)
convertFromBIOM(
x,
prefix.rm = removeTaxaPrefixes,
removeTaxaPrefixes = FALSE,
rank.from.prefix = rankFromPrefix,
rankFromPrefix = FALSE,
artifact.rm = remove.artifacts,
remove.artifacts = FALSE,
...
)
# S4 method for class 'SummarizedExperiment'
convertToBIOM(x, assay.type = "counts", ...)Character scaler. The name of assay.
(Default: "counts")
Additional arguments. Not used currently.
BIOM file location
NULL, a DataFrame-like object with sample names in
rownames, or a Character scalar defining the file path of the
sample metadata file (tsv). In the file, the first column must contain the
sample names. The sample names must match exactly the sample names of the
BIOM file. If provided, the sample metadata replaces the sample metadata
stored in the BIOM file. (Default: NULL)
NULL or Character scalar. Defines the file
path of a phylogenetic tree in Newick format. BIOM files do not include a
tree, so it must be imported from a separate file. The tip labels of the
tree must match the feature names, e.g., feature IDs when the tree and
the BIOM file are exported from the same QIIME 2 analysis.
(Default: NULL)
Logical scalar. Should
taxonomic prefixes be removed? The prefixes is removed only from detected
taxa columns meaning that rank.from.prefix should be enabled in the
most cases. (Default: FALSE)
Deprecated. Use prefix.rm instead.
Logical scalar. If file does not have
taxonomic ranks on feature table, should they be scraped from prefixes?
(Default: FALSE)
Deprecated.Use rank.from.prefix instead.
Logical scalar. If file have
some taxonomic character naming artifacts, should they be removed.
(default (Default: FALSE)
Deprecated. Use artifact.rm instead.
convertFromBIOM returns an object of class
TreeSummarizedExperiment
importBIOM returns an object of class
TreeSummarizedExperiment
convertFromBIOM coerces a biom
object to a
TreeSummarizedExperiment
object.
convertToBIOM coerces a
TreeSummarizedExperiment
object to a biom object.
importBIOM loads a BIOM file and creates a
TreeSummarizedExperiment
object from the BIOM object contained in the loaded file.
# Convert BIOM results to a TreeSE
# Load biom file
library(biomformat)
biom_file <- system.file("extdata", "rich_dense_otu_table.biom",
package = "biomformat")
# Make TreeSE from BIOM object
biom_object <- biomformat::read_biom(biom_file)
tse <- convertFromBIOM(biom_object)
# Convert TreeSE object to BIOM
biom <- convertToBIOM(tse)
# Load biom file
library(biomformat)
biom_file <- system.file(
"extdata", "rich_dense_otu_table.biom", package = "biomformat")
# Make TreeSE from biom file
tse <- importBIOM(biom_file)
# Get taxonomyRanks from prefixes and remove prefixes
tse <- importBIOM(
biom_file, rank.from.prefix = TRUE, prefix.rm = TRUE)
# Load another biom file
biom_file <- system.file(
"extdata", "Aggregated_humanization2.biom", package = "mia")
# Clean artifacts from taxonomic data
tse <- importBIOM(biom_file, artifact.rm = TRUE)