Learn R Programming

parafac4microbiome (version 1.1.2)

importTreeSummarizedExperiment: Import TreeSummarizedExperiment object for PARAFAC modelling

Description

Import TreeSummarizedExperiment object for PARAFAC modelling

Usage

importTreeSummarizedExperiment(
  treeObject,
  subjectIDs,
  thirdMode,
  taxa_are_rows
)

Value

List object containing:

  • 'data': data cube

  • 'mode1': metadata of the subject mode

  • 'mode2': taxonomy information

  • 'mode3': metadata of the third mode

Arguments

treeObject

TreeSummarizedExperiment object containing at least an OTU table and sample information, preferably also taxonomic information.

subjectIDs

Column name in the sample information corresponding to the subject IDs.

thirdMode

Column name in the sample information corresponding to the study design aspect to put in the third mode of the data cube.

taxa_are_rows

Boolean specifying if the taxa are in the rows of the OTU table (TRUE) or not (FALSE).

Examples

Run this code
if (FALSE) { # rlang::is_installed("TreeSummarizedExperiment")
library(TreeSummarizedExperiment)

fakeOTU = t(rTensor::k_unfold(rTensor::as.tensor(Fujita2023$data), 2)@data)
fakeTaxa = as.matrix(Fujita2023$mode2)
fakeSam = as.data.frame(cbind(rep(1:8, 110), rep(1:110, each=8)))
colnames(fakeSam) = c("replicate.id", "timepoint")

fakeTreeObj = TreeSummarizedExperiment(assays = list(Count = fakeOTU),
                                      rowData = fakeSam,
                                      colData = fakeTaxa)
dataset = importTreeSummarizedExperiment(fakeTreeObj,
                                         subjectIDs="replicate.id",
                                         thirdMode="timepoint",
                                         taxa_are_rows=FALSE)
}

Run the code above in your browser using DataLab