getCovariates: getCovariates

Description Usage Arguments Value Examples

View source: R/getMethods.R

Description

This function extracts covariates from the colData in the input MultiAssayExperiment object.
Note that if you did not use MultiAssayExperiment to create your createMOFAobject, this function will not work.

Usage

1
getCovariates(object, covariate)

Arguments

object

a MOFAmodel object.

covariate

names of the covariate

Value

a vector containing the covariate

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
# Example on the CLL data
library(MultiAssayExperiment)
data("CLL_data", package = "MOFAdata")
data("CLL_covariates", package = "MOFAdata")
# Create MultiAssayExperiment object 
mae_CLL <- MultiAssayExperiment(CLL_data, colData=CLL_covariates)
MOFAobject  <- createMOFAobject(mae_CLL)
# Extract covariates from the colData of a MultiAssayExperiment
gender <- getCovariates(MOFAobject, "Gender")
diagnosis <- getCovariates(MOFAobject, "Diagnosis")
# Example on the scMT data
data("scMT_data", package = "MOFAdata")
MOFAobject  <- createMOFAobject(scMT_data)
# Extract covariates from the colData of a MultiAssayExperiment
culture <- getCovariates(MOFAobject, "culture")
# Extract covariates from the phenoData of the RNA assay
cdr <- getCovariates(MOFAobject, "cellular_detection_rate")

MOFA documentation built on Feb. 11, 2021, 2:01 a.m.