resDS: resDS Formatting of DS analysis results

Description Usage Arguments Details Value Author(s) Examples

View source: R/resDS.R

Description

resDS provides a simple wrapper to format cluster-level differential testing results into an easily filterable table, and to optionally append gene expression frequencies by cluster-sample & -group, as well as cluster-sample-wise CPM.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
resDS(
  x,
  y,
  bind = c("row", "col"),
  frq = FALSE,
  cpm = FALSE,
  digits = 3,
  sep = "__",
  ...
)

Arguments

x

a SingleCellExperiment.

y

a list of DS testing results as returned by pbDS or mmDS.

bind

character string specifying the output format (see details).

frq

logical or a pre-computed list of expression frequencies as returned by calcExprFreqs.

cpm

logical specifying whether CPM by cluster-sample should be appendeded to the output result table(s).

digits

integer value specifying the number of significant digits to maintain.

sep

character string to use as separator when constructing new column names.

...

optional arguments passed to calcExprFreqs if frq = TRUE.

Details

When bind = "col", the list of DS testing results at y$table will be merge vertically (by column) into a single table in tidy format with column contrast/coef specifying the comparison.

Otherwise, when bind = "row", an identifier of the respective contrast or coefficient will be appended to the column names, and all tables will be merge horizontally (by row).

Expression frequencies pre-computed with calcExprFreqs may be provided with frq. Alternatively, when frq = TRUE, expression frequencies can be computed directly, and additional arguments may be passed to calcExprFreqs (see examples below).

Value

returns a 'data.frame'.

Author(s)

Helena L Crowell & Mark D Robinson

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
data(sce)

# compute pseudobulks (sum of counts)
pb <- aggregateData(sce, assay = "counts", fun = "sum")

# run DS analysis (edgeR on pseudobulks)
res <- pbDS(pb, method = "edgeR")

head(resDS(sce, res, bind = "row")) # tidy format
head(resDS(sce, res, bind = "col", digits = Inf))

# append CPMs & expression frequencies
head(resDS(sce, res, cpm = TRUE))
head(resDS(sce, res, frq = TRUE))

# pre-computed expression frequencies & append
frq <- calcExprFreqs(sce, assay = "counts", th = 0)
head(resDS(sce, res, frq = frq))

muscat documentation built on Nov. 8, 2020, 7:47 p.m.