scoreSingleSamples: Generates single sample gene set scores across a datasets by...

Description Usage Arguments Details Value Single Sample Scoring Methods Examples

View source: R/scoreSingleSamples.R

Description

It is common to assess the activity of a gene set in a given sample. There are many ways to do that, and this method is analogous to the multiGSEA() function in that it enables the user to run a multitude of single-sample-gene-set-scoring algorithms over a target expression matrix using a GeneSetDb() object.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
scoreSingleSamples(
  gdb,
  y,
  methods = "ewm",
  as.matrix = FALSE,
  drop.sd = 1e-04,
  verbose = FALSE,
  recenter = FALSE,
  rescale = FALSE,
  ...,
  as.dt = FALSE
)

Arguments

gdb

A GeneSetDb

y

An expression matrix to score genesets against

methods

A character vector that enumerates the scoring methods you want to run over the samples. Please reference the "Single Sample Scoring Methods" section for more information.

as.matrix

Return results as a list of matrices instead of a melted data.frame? Defaults to FALSE.

drop.sd

Genes with a standard deviation across columns in y that is less than this value will be dropped.

verbose

make some noise? Defaults to FALSE.

recenter, rescale

If TRUE, the scores computed by each method are centered and scaled using the scale function. These variables correspond to the center and scale parameters in the scale function. Defaults to FALSE.

...

these parameters are passed down into the the individual single sample scoring funcitons to customize them further.

as.dt

If FALSE (default), the data.frame like thing that this funciton returns will be set to a data.frame. Set this to TRUE to keep this object as a data.table

Details

Please refer to the "Generating Single Sample Gene Set Scores" of the multiGSEA vignette for further exposition.

Value

A long data.frame with sample_id,method,score values per row. If as.matrix=TRUE, a matrix with as many rows as geneSets(gdb) and as many columns as ncol(x)

Single Sample Scoring Methods

The following methods are currenly provided.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
library(reshape2)
gdb <- exampleGeneSetDb()
vm <- exampleExpressionSet()
scores <- scoreSingleSamples(
  gdb, vm, methods = c("ewm", "ssgsea", "gsva", "ewz", "zscore"),
  center = TRUE, scale = TRUE, ssgsea.norm = TRUE)

sw <- reshape2::dcast(scores, name + sample_id ~ method, value.var='score')

corplot(sw[, c("ewm", "ssgsea", "gsva", "ewz", "zscore")],
        title = "Single Sample Score Comparison")

# I think the eigenWeighteZscore is just ewm with un(center|scale) = FALSE

zs <- scoreSingleSamples(
  gdb, vm, methods = c('ewm', 'ewz', 'zscore'), summary = "mean",
  center = TRUE, scale = TRUE, uncenter = FALSE, unscale = FALSE)
zw <- reshape2::dcast(zs, name + sample_id ~ method, value.var='score')
corplot(zw[, c("ewm", "ewz", "zscore")], title = "EW zscores")

lianos/multiGSEA documentation built on Nov. 17, 2020, 1:26 p.m.