getTrainData: getTrainData

Description Usage Arguments Details Value Examples

View source: R/getMethods.R

Description

Fetch the training data

Usage

1
2
getTrainData(object, views = "all", features = "all",
  as.data.frame = FALSE)

Arguments

object

a MOFAmodel object.

views

character vector with the view name(s), or numeric vector with the view index(es). Default is "all".

features

list of character vectors with the feature names or list of numeric vectors with the feature indices. Default is "all"

as.data.frame

logical indicating whether to return a long data frame instead of a list of matrices. Default is FALSE.

Details

By default this function returns a list where each element is a data matrix with dimensionality (D,N) where D is the number of features and N is the number of samples.
Alternatively, if as.data.frame is TRUE, the function returns a long-formatted data frame with columns (view,feature,sample,value).

Value

A list with one numeric matrix per view, containing the parsed data used to fit the MOFA model.

Examples

1
2
3
4
5
6
7
8
9
data("scMT_data", package = "MOFAdata")
MOFAobject <- createMOFAobject(scMT_data)
trainData_scMT <- getTrainData(MOFAobject, as.data.frame = FALSE)
(trainData_scMT[["RNA expression"]])[1:10,1:10]

data("CLL_data", package = "MOFAdata")
MOFAobject <- createMOFAobject(CLL_data)
trainData_CLL <- getTrainData(MOFAobject, as.data.frame = TRUE)
head(trainData_CLL)

bioFAM/MOFA documentation built on Oct. 3, 2020, 12:53 a.m.