scde.expression.difference: Test for expression differences between two sets of cells

Description Usage Arguments Value Examples

View source: R/functions.R

Description

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

Usage

1
2
3
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:

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
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)

scde documentation built on Nov. 8, 2020, 6:19 p.m.