scde.expression.difference {scde} | R Documentation

## Test for expression differences between two sets of cells

### Description

Use the individual cell error models to test for differential expression between two groups of cells.

### Usage

    scde.expression.difference(models, counts, prior, groups = NULL,
      batch = NULL, n.randomizations = 150, n.cores = 10,
      batch.models = models, return.posteriors = FALSE, verbose = 0)

### Arguments

`models` | models determined by `scde.error.models`
`counts` | read count matrix
`prior` | gene expression prior as determined by `scde.expression.prior`
`groups` | a factor determining the two groups of cells being compared. The factor entries should correspond to the rows of the model matrix. The factor should have two levels. NAs are allowed (cells will be omitted from comparison).
`batch` | a factor (corresponding to rows of the model matrix) specifying batch assignment of each cell, to perform batch correction
`n.randomizations` | number of bootstrap randomizations to be performed
`n.cores` | number of cores to utilize
`batch.models` | (optional) separate models for the batch data (if generated using batch-specific group argument). Normally the same models are used.
`return.posteriors` | whether joint posterior matrices should be returned
`verbose` | integer verbose level (1 for verbose)

### Value

#### default

a data frame with the following fields:

- lb, mle, ub lower bound, maximum likelihood estimate, and upper bound of the 95

  ce conservative estimate of expression-fold change (equals to the min(abs(c(lb, ub))), or 0 if the CI crosses the 0

  Z uncorrected Z-score of expression difference

  cZ expression difference Z-score corrected for multiple hypothesis testing using Holm procedure If batch correction has been performed (`batch` has been supplied), analogous data frames are returned in slots `$batch.adjusted` for batch-corrected results, and `$batch.effect` for the differences explained by batch effects alone.

#### return.posteriors = TRUE

A list is returned, with the default results data frame given in the `$results` slot. `difference.posterior` returns a matrix of estimated expression difference posteriors (rows - genes, columns correspond to different magnitudes of fold-change - log2 values are given in the column names) `joint.posteriors` a list of two joint posterior matrices (rows - genes, columns correspond to the expression levels, given by prior$x grid)

### Examples

    data(es.mef.small)
    cd <- clean.counts(es.mef.small, min.lib.size=1000, min.reads = 1, min.detected = 1)
    sg <- factor(gsub("(MEF|ESC).*", "\\1", colnames(cd)), levels = c("ESC", "MEF"))
    names(sg) <- colnames(cd)

    o.ifm <- scde.error.models(counts = cd, groups = sg, n.cores = 10, threshold.segmentation = TRUE)
    o.prior <- scde.expression.prior(models = o.ifm, counts = cd, length.out = 400, show.plot = FALSE)
    # make sure groups corresponds to the models (o.ifm)
    groups <- factor(gsub("(MEF|ESC).*", "\\1", rownames(o.ifm)), levels = c("ESC", "MEF"))
    names(groups) <- row.names(o.ifm)
    ediff <- scde.expression.difference(o.ifm, cd, o.prior, groups = groups, n.randomizations = 100, n.cores = n.cores, verbose = 1)

[Package scde version 2.8.0 Index]