FromMatrix {MAST} | R Documentation

## 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(exprsArray, cData, fData, class = "SingleCellAssay")

### Arguments

`exprsArray` | matrix or array, columns are cells, rows are genes
`cData` | cellData an object that can be coerced to a DataFrame, ie, data.frame, AnnotatedDataFrame. Must have as many rows as `ncol(exprsArray)`
`fData` | featureData an object that can be coerced to a DataFrame, ie, data.frame, AnnotatedDataFrame. Must have as many rows as `nrow(exprsArray)`.
`class` | desired subclass of object. Default `SingleCellAssay`.

### Value

an object of class `class`

### Examples

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

[Package MAST version 1.4.1 Index]