Learn R Programming

parafac4microbiome (version 1.1.2)

importPhyloseq: Import Phyloseq object for PARAFAC modelling

Description

Import Phyloseq object for PARAFAC modelling

Usage

importPhyloseq(phyloseqObject, subjectIDs, thirdMode)

Value

List object containing:

  • 'data': data cube

  • 'mode1': metadata of the subject mode

  • 'mode2': taxonomy information

  • 'mode3': metadata of the third mode

Arguments

phyloseqObject

Phyloseq object containing at least an otu table and sample data, preferably also taxonomic information.

subjectIDs

Column name in sam_data corresponding to the subject IDs.

thirdMode

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

Examples

Run this code
if (FALSE) { # rlang::is_installed("phyloseq")
library(phyloseq)
data(GlobalPatterns)
GP = GlobalPatterns

# Add custom subject IDs to the sample data to make this example work
alteredSampleData = sample_data(GP)
alteredSampleData$subjectID = c(1,2,3,1,2,1,2,3,1,2,1,2,1,2,3,1,2,3,1,2,3,4,5,1,2,3)
df = phyloseq(otu_table(GP), tax_table(GP), alteredSampleData)

# Make a data cube with SampleType (soil, feces, etc.) as the third mode.
result = importPhyloseq(df, subjectIDs = "subjectID", thirdMode="SampleType")
}

Run the code above in your browser using DataLab