Created
January 21, 2022 15:51
-
-
Save millerh1/2fbd127d5575cce5d99ffab6b3029f19 to your computer and use it in GitHub Desktop.
Gene set membership matrix generator
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(msigdbr) | |
library(dplyr) | |
msigdbr(category = "C8") %>% | |
dplyr::select(gs_name, gene_symbol) %>% | |
distinct(gs_name, gene_symbol) %>% | |
mutate(val = 1) %>% | |
pivot_wider( | |
id_cols = gs_name, names_from = gene_symbol, | |
values_from = val, | |
values_fill = 0 | |
) %>% | |
tibble::column_to_rownames("gs_name") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Values are 0 or 1 depending on membership of each gene in each gene set