R/AllGenerics.R, R/exporters.R
export-methods.RdThere are a few very popular external tools for microbiome analysis, including QIIME2 and mothur. However, R does not currently provide any class to accommodate those data formats. When exporting data from mia to external tools, the best approach is therefore to break a data container into its building blocks (assays, side information, trees, etc.).
Thanks to exportRaw, exportQIIME2 and exportMothur,
it is now possible to export a
TreeSummarizedExperiment object as
raw elements or near-ready QIIME2 and mothur formats, respectively. This way,
migrating from mia to an external system is still a bad idea, but at least it
is fairly straightforward.
exportRaw(x, ...)
exportQIIME2(x, ...)
exportMothur(x, ...)
# S4 method for class 'TreeSummarizedExperiment'
exportRaw(
x,
dpath,
rowdata.file = "rowdata",
coldata.file = "coldata",
assay.dir = "assays",
rowtree.dir = "row_trees",
coltree.dir = "col_trees",
dimred.dir = "dim_reds",
altexp.dir = "alt_exps"
)
# S4 method for class 'TreeSummarizedExperiment'
exportQIIME2(x, dpath, assay.type = "counts", tree.name = "phylo")
# S4 method for class 'TreeSummarizedExperiment'
exportMothur(
x,
dpath,
assay.type = "counts",
tree.name = "phylo",
group.var = NULL
)a TreeSummarizedExperiment
object.
Unused.
Character scalar.
Character scalar. (Default: "rowdata")
Character scalar. (Default: "coldata")
Character scalar. (Default: "assays")
Character scalar. (Default: "row_trees")
Character scalar. (Default: "col_trees")
Character scalar. (Default: "dim_reds")
Character scalar. (Default: "alt_exps")
Character scalar. (Default: "counts")
Character scalar. (Default: "phylo")
Character scalar. (Default: NULL)
Directory at dpath with components of x each stored
as a file in the proper format.
The output directory contains the elements of x. For
exportQIIME2 and exportMothur, data will need some more
processing using the target tool. For some tips, check the rbiom package
vignettes on converting data:
https://cmmr.github.io/rbiom/articles/convert.html
library(TreeSummarizedExperiment)
tse <- makeTSE()
assayNames(tse) <- "counts"
names(rowData(tse))[1] <- "Genus"
# Export raw TreeSE components in custom directory
exportRaw(tse, "out")
# Export TreeSE components in near-ready QIIME2 format
exportQIIME2(tse, "qiime2_dir")
# Export TreeSE components in near-ready mothur format
exportMothur(tse, "mothur_dir")