Perform ssGSEA-based Subtyping Using Marker Gene Sets
Source:R/Classifier.ssGSEA.R
Classifier.ssGSEA.RdThis function performs single-sample Gene Set Enrichment Analysis (ssGSEA) to assign subtypes to samples based on marker gene sets. It calculates enrichment scores with permutation testing and predicts sample subtypes based on the most significant enrichment results.
Usage
Classifier.ssGSEA(
data.test,
marker.list,
dir.file = ".",
gct.filename = "data.gct",
number.perms = 100,
tolerate.mixed = FALSE,
method = c("internal", "GSVA", "external"),
seed = 12345
)Arguments
- data.test
A matrix or data frame representing the input expression data, where rows are genes and columns are samples.
- marker.list
A named list of marker gene sets, where each list element corresponds to a specific subtype or category of interest.
- dir.file
Character. Directory for saving the output files (default: '.'). Set to NULL to skip file output.
- gct.filename
Character. The filename for the generated GCT file (default: 'data.gct').
- number.perms
Integer. Number of permutations for ssGSEA analysis (default: 100).
- tolerate.mixed
Logical. Whether to allow "Mixed" predictions when multiple gene sets have the same minimum p-value (default: FALSE).
- method
Character. The ssGSEA implementation to use: "internal" (built-in), "GSVA" (requires GSVA package), or "external" (requires ssgsea.GBM.classification package). Default: "internal".
- seed
Integer. Random seed for reproducibility (default: 12345).
Value
A data frame with the following columns:
ID: Sample identifiers.Predict: Predicted subtype for each sample.Columns with
_pval: P-values for each marker gene set or subtype.
Details
The function:
Calculates ssGSEA enrichment scores for each marker gene set in every sample.
Performs permutation testing to estimate statistical significance.
Predicts subtypes by identifying the marker gene set with the most significant enrichment (smallest p-value).
If
tolerate.mixedis TRUE and multiple gene sets share the same minimum p-value, the sample is labeled as "Mixed".
References
Wang Q, Hu B, Hu X, Kim H, Squatrito M, Scarpace L, et al. Tumor Evolution of Glioma-Intrinsic Gene Expression Subtypes Associates with Immunological Changes in the Microenvironment. Cancer Cell. July 2017;32(1):42-56.e6.
Examples
# Simulated expression data
data.test <- matrix(rnorm(10000), nrow = 100, ncol = 100)
rownames(data.test) <- paste0("Gene", 1:100)
colnames(data.test) <- paste0("Sample", 1:100)
# Example marker list
marker.list <- list(
Subtype1 = c("Gene1", "Gene2", "Gene3"),
Subtype2 = c("Gene4", "Gene5", "Gene6")
)
# Run ssGSEA-based subtyping
result <- Classifier.ssGSEA(
data.test = data.test,
marker.list = marker.list,
number.perms = 50,
tolerate.mixed = TRUE
)
print(result)