Learn R Programming

MAST (version 0.931)

FromMatrix: Construct a SingleCellAssay from a matrix or array of expression

Description

If the gene expression measurements are already in a rectangular form, then this function allows an easy way to construct a SingleCellAssay object while still doing some sanity checking of inputs.

Usage

FromMatrix(class, exprsArray, cData, fData)

Arguments

class

What class of object are we constructing?

exprsArray

matrix or array, rows are cells, columns are genes

cData

cellData data.frame or AnnotatedDataFrame

fData

featureData data.frame or AnnotatedDataFrame

Value

an object of class class

Examples

Run this code
# NOT RUN {
ncells <- 10
ngenes <- 5
fData <- data.frame(primerid=LETTERS[1:ngenes])
cData <- data.frame(wellKey=seq_len(ncells))
mat <- matrix(rnorm(ncells*ngenes), ncol=ngenes)
sca <- FromMatrix('SingleCellAssay', mat, cData, fData)
stopifnot(inherits(sca, 'SingleCellAssay'))
##If there are mandatory keywords expected by a class, you'll have to manually set them yourself
cData$ncells <- 1
fd <- FromMatrix('FluidigmAssay', mat, cData, fData)
stopifnot(inherits(fd, 'FluidigmAssay'))
# }

Run the code above in your browser using DataLab