ssgsea: ssGSEA

Description Usage Arguments Value Examples

View source: R/pseudobulking.R

Description

This function runs ssGSEA as implemented here: https://gist.github.com/gaoce/39e0907146c752c127728ad74e123b33

Usage

1
ssgsea(X, gene_sets, alpha = 0.25, scale = T, norm = F, single = T)

Arguments

X

matrix. Rows are genes. Columns are samples. Row names are symbols.

gene_sets

list. Each element is a string vector with gene symbols.

alpha

numeric. Parameter for ssGSEA, the default is 0.25

scale

logical. If True, normalize the scores by number of genes in the gene sets.

norm

logical. If True, normalize the scores by the absolute difference between max and min values.

single

logical. If True, use ssGSEA algorithm, otherwise use GSEA.

Value

matrix containing enrichment scroes. Rows are gene sets, columns are samples.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
# Create a fake matrix
m = 100
n = 100
set.seed(1)
X = matrix(rnorm(m*n), m, n)
# Assign 'gene symbols' to row names
rownames(X) = 1:m
# Create 3 gene sets
gene_sets = list(a = sample(m, 5), b = sample(m, 5), c = sample(m, 5))
system.time(assign('a', GSVA::gsva(X, gene_sets, method = 'ssgsea')))
system.time(assign('b', ssgsea(X, gene_sets, scale = F, norm = T)))
identical(a, b)

scfurl/m3addon documentation built on Aug. 9, 2021, 5:30 p.m.