Converts a list of named gene sets (e.g., from getGMT()) into a sparse
binary matrix where rows are genes, columns are gene sets, and entries
are 1 if the gene is in the set.
gmtListToSparseMat(gmtList)A sparse binary matrix with genes as rows and gene sets as columns.
# define a simple nested GMT list
gmt1 <- list(
PathwayA = c("Gene1", "Gene2", "Gene3"),
PathwayB = c("Gene2", "Gene4")
)
gmt2 <- list(
PathwayC = c("Gene1", "Gene4"),
PathwayD = c("Gene3", "Gene5")
)
# combine into a nested list
nestedList <- list(gmt1 = gmt1, gmt2 = gmt2)
# convert to sparse matrix
sparseMat <- gmtListToSparseMat(nestedList)