Skip to content

Commit 5fbf99e

Browse files
committed
msigdb updates
1 parent 410930d commit 5fbf99e

31 files changed

Lines changed: 84 additions & 65 deletions

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Depends: R (>= 3.6.0)
1212
License: GPL-3 + file LICENSE
1313
URL: https://github.com/montilab/hypeR
1414
Encoding: UTF-8
15-
RoxygenNote: 7.2.3
15+
RoxygenNote: 7.3.1
1616
LazyData: false
1717
Imports:
1818
ggplot2,

R/db_msig.R

Lines changed: 36 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ msigdb_check_species <- function(species="") {
4242

4343
#' Get msigdbr available genesets
4444
#'
45-
#' @param species A species to determine gene symbols (refer to ?msigdbr::msigdbr for avilable species)
45+
#' @param species A species to determine gene symbols (refer to ?msigdbr::msigdbr for available species)
4646
#' @return A dataframe of available genesets
4747
#'
4848
#' @examples
@@ -60,10 +60,10 @@ msigdb_available <- function(species="Homo sapiens") {
6060

6161
# Gene set categories
6262
msigdbr(species=species) %>%
63-
dplyr::select(gs_cat, gs_subcat) %>%
63+
dplyr::select(gs_collection, gs_subcollection) %>%
6464
unique() %>%
65-
dplyr::arrange(gs_cat, gs_subcat) %>%
66-
magrittr::set_colnames(c("Category", "Subcategory"))
65+
dplyr::arrange(gs_collection, gs_subcollection) %>%
66+
magrittr::set_colnames(c("Collection", "Subcollection"))
6767
}
6868

6969
#' Print msigdb gsets information
@@ -96,7 +96,7 @@ msigdb_info <- function() {
9696
cat("|------------------------------------------------------------------|\n")
9797
cat("| Available Genesets |\n")
9898
cat("|------------------------------------------------------------------|\n")
99-
cat("| Category Subcategory | Description |\n")
99+
cat("| Collection Subcollection | Description |\n")
100100
cat("|------------------------------------------------------------------|\n")
101101
cat("| C1 | Positional |\n")
102102
cat("| C2 CGP | Chemical and Genetic Perturbations |\n")
@@ -122,30 +122,46 @@ msigdb_info <- function() {
122122

123123
#' Download data from msigdb in the form of a named list
124124
#'
125-
#' @param species A species to determine gene symbols (refer to ?msigdbr::msigdbr for avilable species)
126-
#' @param category Geneset category (refer to ?msigdbr::msigdbr for avilable categories)
127-
#' @param subcategory Geneset subcategory (refer to ?msigdbr::msigdbr for avilable subcategories)
125+
#' @param species A species to determine gene symbols (refer to ?msigdbr::msigdbr for available species)
126+
#' @param collection Geneset collection (refer to ?msigdbr::msigdbr_collections for available categories)
127+
#' @param subcollection Geneset subcollection (refer to ?msigdbr::msigdbr_collections for available subcategories)
128128
#' @return A list of genesets
129129
#'
130130
#' @examples
131-
#' HALLMARK <- msigdb_download("Homo sapiens", "H", "")
131+
#' HALLMARK_HUMAN <- msigdb_download("Homo sapiens", "H")
132+
#' HALLMARK_MOUSE <- msigdb_download("Mus musculus", "MH")
132133
#'
133134
#' @importFrom magrittr %>%
134135
#' @importFrom dplyr select
135136
#' @importFrom msigdbr msigdbr
136137
#' @export
137-
msigdb_download <- function(species, category, subcategory="") {
138+
msigdb_download <- function(species, collection, subcollection=NULL) {
138139

139140
# Check species
140141
msigdb_check_species(species)
141142

142-
response <- msigdbr(species, category, subcategory)
143+
if(species == "Homo sapiens") {
144+
db_species = "HS"
145+
} else if (species == "Mus musculus") {
146+
db_species = "MM"
147+
} else {
148+
# For non-human species msigdb will use gene orthologs from the human database.
149+
db_species == "HS"
150+
}
151+
152+
response <- msigdbr(species = species,
153+
db_species = db_species,
154+
collection = collection,
155+
subcollection = subcollection)
143156
if (nrow(response) == 0) {
144157
stop("No data found: Please review available species and genesets\n", msigdb_info())
145158
}
146159

147160
# Download genesets
148-
mdf <- msigdbr(species, category, subcategory) %>%
161+
mdf <- msigdbr(species = species,
162+
collection = collection,
163+
db_species = db_species,
164+
subcollection = subcollection) %>%
149165
dplyr::select(gs_name, gene_symbol) %>%
150166
dplyr::distinct()
151167

@@ -156,19 +172,20 @@ msigdb_download <- function(species, category, subcategory="") {
156172

157173
#' Download data from msigdb in the form of a gsets object
158174
#'
159-
#' @param species A species to determine gene symbols (refer to ?msigdbr::msigdbr for avilable species)
160-
#' @param category Geneset category (refer to ?msigdbr::msigdbr for avilable categories)
161-
#' @param subcategory Geneset subcategory (refer to ?msigdbr::msigdbr for avilable subcategories)
175+
#' @param species A species to determine gene symbols (refer to ?msigdbr::msigdbr_species for available species)
176+
#' @param collection Geneset collection (refer to ?msigdbr::msigdbr_collections for available categories)
177+
#' @param subcollection Geneset subcollection (refer to ?msigdbr::msigdbr_collections for available subcategories)
162178
#' @param clean Use true to clean labels of genesets
163179
#' @return A gsets object
164180
#'
165181
#' @examples
166-
#' HALLMARK <- msigdb_gsets("Homo sapiens", "H", "")
182+
#' HALLMARK_HUMAN <- msigdb_gsets("Homo sapiens", "H")
183+
#' HALLMARK_MOUSE <- msigdb_gsets("Mus musculus", "MH")
167184
#'
168185
#' @export
169-
msigdb_gsets <- function(species, category, subcategory="", clean=FALSE) {
170-
genesets <- msigdb_download(species, category, subcategory)
171-
name <- ifelse(subcategory == "", category, paste(category, subcategory, sep="."))
186+
msigdb_gsets <- function(species, collection, subcollection=NULL, clean=FALSE) {
187+
genesets <- msigdb_download(species, collection, subcollection)
188+
name <- ifelse(is.null(subcollection), collection, paste(collection, subcollection, sep="."))
172189
version <- msigdb_version()
173190
gsets$new(genesets, name=name, version=version, clean=clean)
174191
}

R/hyp_dots.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@
235235
#' @return A ggplot object
236236
#'
237237
#' @examples
238-
#' genesets <- msigdb_gsets("Homo sapiens", "C2", "CP:KEGG")
238+
#' genesets <- msigdb_gsets("Homo sapiens", "C2", "CP:KEGG_LEGACY")
239239
#'
240240
#' signature <- c("IDH3B","DLST","PCK2","CS","PDHB","PCK1","PDHA1","LOC642502",
241241
#' "PDHA2","LOC283398","FH","SDHD","OGDH","SDHB","IDH3A","SDHC",

R/hyp_emap.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@
107107
#' @return A visNetwork object
108108
#'
109109
#' @examples
110-
#' genesets <- msigdb_gsets("Homo sapiens", "C2", "CP:KEGG")
110+
#' genesets <- msigdb_gsets("Homo sapiens", "C2", "CP:KEGG_LEGACY")
111111
#'
112112
#' signature <- c("IDH3B","DLST","PCK2","CS","PDHB","PCK1","PDHA1","LOC642502",
113113
#' "PDHA2","LOC283398","FH","SDHD","OGDH","SDHB","IDH3A","SDHC",

R/hyp_show.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
#' @return A reactable table
66
#'
77
#' @examples
8-
#' genesets <- msigdb_gsets("Homo sapiens", "C2", "CP:KEGG")
8+
#' genesets <- msigdb_gsets("Homo sapiens", "C2", "CP:KEGG_LEGACY")
99
#'
1010
#' signature <- c("IDH3B","DLST","PCK2","CS","PDHB","PCK1","PDHA1","LOC642502",
1111
#' "PDHA2","LOC283398","FH","SDHD","OGDH","SDHB","IDH3A","SDHC",

R/hyp_to_excel.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
#' @return NULL
88
#'
99
#' @examples
10-
#' genesets <- msigdb_gsets("Homo sapiens", "C2", "CP:KEGG")
10+
#' genesets <- msigdb_gsets("Homo sapiens", "C2", "CP:KEGG_LEGACY")
1111
#'
1212
#' signature <- c("IDH3B","DLST","PCK2","CS","PDHB","PCK1","PDHA1","LOC642502",
1313
#' "PDHA2","LOC283398","FH","SDHD","OGDH","SDHB","IDH3A","SDHC",

R/hyp_to_table.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
#' @return NULL
99
#'
1010
#' @examples
11-
#' genesets <- msigdb_gsets("Homo sapiens", "C2", "CP:KEGG")
11+
#' genesets <- msigdb_gsets("Homo sapiens", "C2", "CP:KEGG_LEGACY")
1212
#'
1313
#' signature <- c("IDH3B","DLST","PCK2","CS","PDHB","PCK1","PDHA1","LOC642502",
1414
#' "PDHA2","LOC283398","FH","SDHD","OGDH","SDHB","IDH3A","SDHC",

R/hype.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
#' @return A hyp object
1414
#'
1515
#' @examples
16-
#' genesets <- msigdb_gsets("Homo sapiens", "C2", "CP:KEGG")
16+
#' genesets <- msigdb_gsets("Homo sapiens", "C2", "CP:KEGG_LEGACY")
1717
#'
1818
#' signature <- c("IDH3B","DLST","PCK2","CS","PDHB","PCK1","PDHA1","LOC642502",
1919
#' "PDHA2","LOC283398","FH","SDHD","OGDH","SDHB","IDH3A","SDHC",

R/reactable.R

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
#' @param hyp_hmap_args A list of keyword arguments passed to hyp_hmap
99
#'
1010
#' @examples
11-
#' genesets <- msigdb_gsets("Homo sapiens", "C2", "CP:KEGG")$genesets[1:5]
11+
#' genesets <- msigdb_gsets("Homo sapiens", "C2", "CP:KEGG_LEGACY")$genesets[1:5]
1212
#'
1313
#' signature <- c("IDH3B","DLST","PCK2","CS","PDHB","PCK1","PDHA1","LOC642502",
1414
#' "PDHA2","LOC283398","FH","SDHD","OGDH","SDHB","IDH3A","SDHC",
@@ -76,7 +76,7 @@ rctbl_hyp <- function(hyp,
7676
#' @param hyp_hmap_args A list of keyword arguments passed to hyp_hmap
7777
#'
7878
#' @examples
79-
#' genesets <- msigdb_gsets("Homo sapiens", "C2", "CP:KEGG")$genesets[1:5]
79+
#' genesets <- msigdb_gsets("Homo sapiens", "C2", "CP:KEGG_LEGACY")$genesets[1:5]
8080
#'
8181
#' experiment <- list("S1"=c("IDH3B","DLST","PCK2","CS","PDHB","PCK1","PDHA1","LOC642502"),
8282
#' "S2"=c("PDHA2","LOC283398","FH","SDHD","OGDH","SDHB","IDH3A","SDHC"))
@@ -132,7 +132,7 @@ rctbl_mhyp <- function(mhyp,
132132
#' @param ... Arguments passed to table generators
133133
#'
134134
#' @examples
135-
#' genesets <- msigdb_gsets("Homo sapiens", "C2", "CP:KEGG")$genesets[1:5]
135+
#' genesets <- msigdb_gsets("Homo sapiens", "C2", "CP:KEGG_LEGACY")$genesets[1:5]
136136
#'
137137
#' experiment <- list("S1"=c("IDH3B","DLST","PCK2","CS","PDHB","PCK1","PDHA1","LOC642502"),
138138
#' "S2"=c("PDHA2","LOC283398","FH","SDHD","OGDH","SDHB","IDH3A","SDHC"))

R/utils.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#' @param x A vector of labels
44
#'
55
#' @examples
6-
#' HALLMARK <- msigdb_download("Homo sapiens", "H", "")
6+
#' HALLMARK <- msigdb_download("Homo sapiens", "H")
77
#' names(HALLMARK) <- clean_genesets(names(HALLMARK))
88
#' head(names(HALLMARK))
99
#'

0 commit comments

Comments
 (0)