FromFlatDF {MAST} | R Documentation

## Construct a SingleCellAssay (or derived subclass) from a 'flat' (melted) data.frame/data.table

### Description

SingleCellAssay are a generic container for such data and are simple wrappers around SummarizedExperiment objects. Subclasses exist that embue the container with additional attributes, eg FluidigmAssay.

### Usage

    FromFlatDF(
      dataframe,
      idvars,
      primerid,
      measurement,
      id = numeric(0),
      cellvars = NULL,
      featurevars = NULL,
      phenovars = NULL,
      class = "SingleCellAssay",
      check_sanity = TRUE,
      ...
    )

### Arguments

`dataframe` | A 'flattened' `data.frame` or `data.table` containing columns giving cell and feature identifiers and a measurement column
`idvars` | character vector naming columns that uniquely identify a cell
`primerid` | character vector of length 1 that names the column that identifies what feature (i.e. gene) was measured
`measurement` | character vector of length 1 that names the column containing the measurement
`id` | An identifier (eg, experiment name) for the resulting object
`cellvars` | Character vector naming columns containing additional cellular metadata
`featurevars` | Character vector naming columns containing additional feature metadata
`phenovars` | Character vector naming columns containing additional phenotype metadata
`class` | desired subclass of object. Default `SingleCellAssay`.
`check_sanity` | (default: `TRUE`) Set `FALSE` to override sanity checks that try to ensure that the default assay is log-transformed and has at least one exact zero. See defaultAssay for details on the "default assay" which is assumed to contain log transformed data.
`...` | additional arguments are ignored

### Value

SingleCellAssay, or derived, object

### Examples

    data(vbeta)
    colnames(vbeta)
    vbeta <- computeEtFromCt(vbeta)
    vbeta.fa <- FromFlatDF(vbeta, idvars=c("Subject.ID", "Chip.Number", "Well"),
    primerid='Gene', measurement='Et', ncells='Number.of.Cells',
    geneid="Gene",cellvars=c('Number.of.Cells', 'Population'),
    phenovars=c('Stim.Condition','Time'), id='vbeta all', class='FluidigmAssay')
    show(vbeta.fa)
    nrow(vbeta.fa)
    ncol(vbeta.fa)
    head(mcols(vbeta.fa)$primerid)
    table(colData(vbeta.fa)$Subject.ID)
    vbeta.sub <- subset(vbeta.fa, Subject.ID=='Sub01')
    show(vbeta.sub)

[Package MAST version 1.16.0 Index]