scde.posteriors {scde} | R Documentation

## Calculate joint expression magnitude posteriors across a set of cells

### Description

Calculates expression magnitude posteriors for the individual cells, and then uses bootstrap resampling to calculate a joint expression posterior for all the specified cells. Alternatively during batch-effect correction procedure, the joint posterior can be calculated for a random composition of cells of different groups (see `batch` and `composition` parameters).

### Usage

    scde.posteriors(models, counts, prior, n.randomizations = 100, batch = NULL,
      composition = NULL, return.individual.posteriors = FALSE,
      return.individual.posterior.modes = FALSE, ensemble.posterior = FALSE,
      n.cores = 20)

### Arguments

`models` | models models determined by `scde.error.models`
`counts` | read count matrix
`prior` | gene expression prior as determined by `scde.expression.prior`
`n.randomizations` | number of bootstrap iterations to perform
`batch` | a factor describing which batch group each cell (i.e. each row of `models` matrix) belongs to
`composition` | a vector describing the batch composition of a group to be sampled
`return.individual.posteriors` | whether expression posteriors of each cell should be returned
`return.individual.posterior.modes` | whether modes of expression posteriors of each cell should be returned
`ensemble.posterior` | Boolean of whether to calculate the ensemble posterior (sum of individual posteriors) instead of a joint (product) posterior. (default: FALSE)
`n.cores` | number of cores to utilize

### Value

#### default

a posterior probability matrix, with rows corresponding to genes, and columns to expression levels (as defined by `prior$x`)

#### return.individual.posterior.modes

a list is returned, with the `$jp` slot giving the joint posterior matrix, as described above. The `$modes` slot gives a matrix of individual expression posterior mode values on log scale (rows - genes, columns -cells)

#### return.individual.posteriors

a list is returned, with the `$post` slot giving a list of individual posterior matrices, in a form analogous to the joint posterior matrix, but reported on log scale

### Examples

    data(es.mef.small)
    cd <- clean.counts(es.mef.small, min.lib.size=1000, min.reads = 1, min.detected = 1)
    data(o.ifm)  # Load precomputed model. Use ?scde.error.models to see how o.ifm was generated
    o.prior <- scde.expression.prior(models = o.ifm, counts = cd, length.out = 400, show.plot = FALSE)
    # calculate joint posteriors
    jp <- scde.posteriors(o.ifm, cd, o.prior, n.cores = 1)

[Package scde version 2.16.0 Index]