MultiAssayExperiment: Construct a 'MultiAssayExperiment' object

Description Usage Arguments Value See Also Examples

View source: R/MultiAssayExperiment-class.R

Description

The constructor function for the MultiAssayExperiment-class combines multiple data elements from the different hierarchies of data (study, experiments, and samples). It can create instances where neither a sampleMap or a colData set is provided. Please see the MultiAssayExperiment API documentation for more information.

Usage

1
2
3
4
5
MultiAssayExperiment(experiments = ExperimentList(),
  colData = S4Vectors::DataFrame(),
  sampleMap = S4Vectors::DataFrame(assay = factor(), primary =
  character(), colname = character()), metadata = list(),
  drops = list())

Arguments

experiments

A list or ExperimentList of all combined experiments

colData

A DataFrame or data.frame of characteristics for all biological units

sampleMap

A DataFrame or data.frame of assay names, sample identifiers, and colname samples

metadata

An optional argument of "ANY" class (usually list) for content describing the experiments

drops

A list of unmatched information (included after subsetting)

Value

A MultiAssayExperiment object that can store experiment and phenotype data

See Also

MultiAssayExperiment-class

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
## Run the example ExperimentList
example("ExperimentList")

## Create sample maps for each experiment
exprmap <- data.frame(
    primary = c("Jack", "Jill", "Barbara", "Bob"),
    colname = c("array1", "array2", "array3", "array4"),
    stringsAsFactors = FALSE)

methylmap <- data.frame(
    primary = c("Jack", "Jack", "Jill", "Barbara", "Bob"),
    colname = c("methyl1", "methyl2", "methyl3", "methyl4", "methyl5"),
    stringsAsFactors = FALSE)

rnamap <- data.frame(
    primary = c("Jack", "Jill", "Bob", "Barbara"),
    colname = c("samparray1", "samparray2", "samparray3", "samparray4"),
    stringsAsFactors = FALSE)

gistmap <- data.frame(
    primary = c("Jack", "Bob", "Jill"),
    colname = c("samp0", "samp1", "samp2"),
    stringsAsFactors = FALSE)

## Combine as a named list and convert to a DataFrame
maplist <- list(Affy = exprmap, Methyl450k = methylmap,
    RNASeqGene = rnamap, GISTIC = gistmap)

## Create a sampleMap
sampMap <- listToMap(maplist)
## Create an example phenotype data
colDat <- data.frame(sex = c("M", "F", "M", "F"), age = 38:41,
    row.names = c("Jack", "Jill", "Bob", "Barbara"))

## Create a MultiAssayExperiment instance
mae <- MultiAssayExperiment(experiments = ExpList, colData = colDat,
    sampleMap = sampMap)

Example output

ExprmL> ## Create an empty ExperimentList instance
ExprmL> ExperimentList()
ExperimentList class object of length 0:  

ExprmL> ## Create array matrix and AnnotatedDataFrame to create an ExpressionSet class
ExprmL> arraydat <- matrix(seq(101, 108), ncol = 4,
ExprmL+                    dimnames = list(
ExprmL+                      c("ENST00000294241", "ENST00000355076"),
ExprmL+                      c("array1", "array2", "array3", "array4")
ExprmL+                    ))

ExprmL> arraypdat <- as(data.frame(
ExprmL+     slope53 = rnorm(4),
ExprmL+     row.names = c("array1", "array2", "array3", "array4")),
ExprmL+     "AnnotatedDataFrame")

ExprmL> ## ExpressionSet constructor
ExprmL> exprdat <- Biobase::ExpressionSet(assayData = arraydat, phenoData = arraypdat)

ExprmL> ## Create a sample methylation dataset
ExprmL> methyldat <- matrix(1:10, ncol = 5, dimnames = list(
ExprmL+     c("ENST00000355076", "ENST00000383706"),
ExprmL+     c("methyl1", "methyl2", "methyl3",
ExprmL+       "methyl4", "methyl5")))

ExprmL> ## Create a sample RNASeqGene dataset
ExprmL> rnadat <- structure(c(46851, 5, 19, 13, 2197, 507, 84318, 126, 17, 21,
ExprmL+                       23979, 614), .Dim = 3:4, .Dimnames =
ExprmL+                         list(c("XIST", "RPS4Y1", "KDM5D"),
ExprmL+                              c("samparray1", "samparray2", "samparray3",
ExprmL+                                "samparray4")))

ExprmL> ## Combine to a named list and call the ExperimentList constructor function
ExprmL> ExpList <- list(Affy = exprdat, Methyl450k = methyldat, RNASeqGene = rnadat)

ExprmL> ## Use the ExperimentList constructor
ExprmL> myExperimentList <- ExperimentList(ExpList)
harmonizing input:
  removing 3 sampleMap rows not in names(experiments)

MultiAssayExperiment documentation built on Oct. 31, 2019, 10:41 a.m.