Skip to contents

Wrapper function that runs the three core functions of the 'geneSetSimplifyR' workflow with default parameters.

To read more about the individual functions see their corresponding help pages: initializeList, clusterGeneSets, labelClusters

Usage

geneSetSimplifyR(
  geneSetsList,
  geneSetsDF = NULL,
  resolution = c(0.1, 0.3, 0.6, 1.1, 1.6, 2.1, 2.6, 3.1, 4.1, 5.1),
  verbose = TRUE,
  cluster_algo = "louvain",
  clusterArgs = list(),
  elbow_method = "distance",
  K = NA,
  removeFirstWord = FALSE,
  stopWords = geneSetSimplifyR::stopWords,
  nLabels = 10
)

Arguments

geneSetsList

A list containing the gene sets to be analyzed. The name of each element in the list should be a gene set and each element should contain the genes belonging to that gene set. Alternatively, the path to a GMT file with the gene sets.

geneSetsDF

Optional data.frame with gene sets and enrichment scores that can be useful for downstream visualization (both for effect size and direction and if multiple conditions are analyzed). Should have a column named 'pathway' containing the gene sets and a column named 'enrichment_score' (or 'NES') with the enrichment scores from GSEA analysis for each gene set. Optionally have a column named 'pval' (or 'pvalue') with the p-value of each gene set, and a column named 'source' indicating the source of each gene set. This allows for analysis of multi-conditional data throughout the entire workflow and is also supported by many plotting functions. See initializeList and the vignette for more info.

resolution

Vector with the desired clustering resolutions to use. Higher number usually results in more clusters.

verbose

a logic indicating whether to print progress statements. Defaults to TRUE.

cluster_algo

Clustering method applied to the SNN graph, passed to clusterGeneSets(). Either the name of a registered method (see listClusterMethods; 'louvain' by default), a gsClusterMethod from clusterMethod, or a function.

clusterArgs

Named list of extra arguments passed on to the clustering method.

elbow_method

Method passed to clusterGeneSets() for selecting the number of LSI dimensions. Options: 'distance'(default), 'zscore'.

K

Number of nearest neighbors for the KNN graph, passed to clusterGeneSets(). NA (default) uses round(sqrt(N)) for N gene sets.

removeFirstWord

Logical. If TRUE, strip the first word (everything before the first underscore) from each gene-set name before generating cluster labels. Useful for MSigDB-style names where the first token is an author or database prefix (e.g. "GOBP", "GOMF", "HALLMARK"). Default: FALSE.

stopWords

Words ignored when labeling clusters, passed to labelClusters(). Defaults to the shipped stopWords.

nLabels

Number of top labels to keep per cluster, passed to labelClusters(). Default 10.

Value

'gsList' object with labeled clusters for all clustered resolutions.

Examples

gsListObject <- geneSetSimplifyR(
  geneSetsList = exampleGeneSets,
  geneSetsDF = exampleEnrichment,
  verbose = FALSE
)
gsListObject
#> A gsList object with 197 gene sets from 2 source(s) clustered into 4 labeled clusters.
#> Metadata:
#>   algorithm: louvain
#>   k (KNN): 14
#>   LSI elbow cutoff: 11
#>   selected resolution: 0.1
#>   n pathways: 197