-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
171 additions
and
73 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
Package: msigdbr | ||
Type: Package | ||
Title: MSigDB Gene Sets for Multiple Organisms in a Tidy Data Format | ||
Version: 7.0.1 | ||
Version: 7.1.1 | ||
Authors@R: person("Igor", "Dolgalev", email = "[email protected]", role = c("aut", "cre")) | ||
Description: Provides the 'Molecular Signatures Database' (MSigDB) gene sets | ||
typically used with the 'Gene Set Enrichment Analysis' (GSEA) software | ||
|
@@ -27,5 +27,5 @@ Suggests: | |
knitr, | ||
rmarkdown | ||
Roxygen: list(markdown = TRUE) | ||
RoxygenNote: 6.1.1 | ||
RoxygenNote: 7.1.0 | ||
VignetteBuilder: knitr |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,70 +1,82 @@ | ||
|
||
#' List the species available in the msigdbr package | ||
#' | ||
#' @return a vector of possible species | ||
#' @return A vector of possible species. | ||
#' | ||
#' @importFrom dplyr pull | ||
#' @export | ||
#' | ||
#' @examples | ||
#' msigdbr_show_species() | ||
msigdbr_show_species <- function() { | ||
|
||
msigdbr_orthologs %>% pull(.data$species_name) %>% unique() %>% sort() | ||
|
||
msigdbr_orthologs %>% | ||
pull(.data$species_name) %>% | ||
unique() %>% | ||
sort() | ||
} | ||
|
||
#' Retrieve the msigdbr data frame | ||
#' | ||
#' @param species species name, such as Homo sapiens, Mus musculus, etc. | ||
#' @param category collection, such as H, C1, C2, C3, C4, C5, C6, C7. | ||
#' @param subcategory sub-collection, such as CGP, MIR, BP, etc. | ||
#' @param species Species name, such as Homo sapiens or Mus musculus. The available species can be retrieved with `msigdbr_show_species()`. | ||
#' @param category MSigDB collection abbreviation, such as H, C1, C2, C3, C4, C5, C6, C7. | ||
#' @param subcategory MSigDB sub-collection abbreviation, such as CGP or BP. | ||
#' | ||
#' @return A data frame of gene sets with one gene per row. | ||
#' | ||
#' @references \url{https://www.gsea-msigdb.org/gsea/msigdb/collections.jsp} | ||
#' | ||
#' @return a data frame of gene sets with one gene per row | ||
#' @import tibble | ||
#' @importFrom dplyr filter inner_join arrange select | ||
#' @export | ||
#' | ||
#' @examples | ||
#' # all human gene sets | ||
#' m = msigdbr(species = "Homo sapiens") | ||
#' # get all human gene sets | ||
#' \donttest{msigdbr(species = "Homo sapiens")} | ||
#' | ||
#' # mouse C2 (curated) CGP (chemical and genetic perturbations) gene sets | ||
#' m = msigdbr(species = "Mus musculus", category = "C2", subcategory = "CGP") | ||
#' # get mouse C2 (curated) CGP (chemical and genetic perturbations) gene sets | ||
#' \donttest{msigdbr(species = "Mus musculus", category = "C2", subcategory = "CGP")} | ||
#' | ||
#' # check all the available categories and sub-categories | ||
#' \donttest{msigdbr() %>% dplyr::distinct(gs_cat, gs_subcat) %>% dplyr::arrange(gs_cat, gs_subcat)} | ||
msigdbr <- function(species = "Homo sapiens", category = NULL, subcategory = NULL) { | ||
|
||
# filter by species | ||
orthologs_subset = filter(msigdbr_orthologs, .data$species_name == species) | ||
|
||
# confirm that only one species is specified | ||
if (length(species) > 1) { | ||
stop("please specify only one species at a time") | ||
} | ||
|
||
# filter orthologs by species | ||
orthologs_subset <- filter(msigdbr_orthologs, .data$species_name == species) | ||
|
||
# confirm that the species exists in the database | ||
if (nrow(orthologs_subset) == 0) { | ||
stop("species does not exist in the database: ", species) | ||
} | ||
|
||
genesets_subset = msigdbr_genesets | ||
genesets_subset <- msigdbr_genesets | ||
|
||
# filter by category | ||
if (is.character(category)) { | ||
if (length(category) > 1) { | ||
stop("please specify only one category at a time") | ||
} | ||
genesets_subset = filter(genesets_subset, .data$gs_cat == category) | ||
genesets_subset <- filter(genesets_subset, .data$gs_cat == category) | ||
} | ||
|
||
# filter by sub-category | ||
if (is.character(subcategory)) { | ||
if (length(subcategory) > 1) { | ||
stop("please specify only one subcategory at a time") | ||
} | ||
genesets_subset = filter(genesets_subset, .data$gs_subcat == subcategory) | ||
genesets_subset <- filter(genesets_subset, .data$gs_subcat == subcategory) | ||
} | ||
|
||
# combine gene sets and genes | ||
genesets_subset <- inner_join(genesets_subset, msigdbr_genes, by = "gs_id") | ||
|
||
# combine gene sets and orthologs | ||
genesets_subset %>% | ||
inner_join(orthologs_subset, by = "human_entrez_gene") %>% | ||
arrange(.data$gs_name, .data$human_gene_symbol) %>% | ||
select(-.data$human_entrez_gene, -.data$num_sources) | ||
|
||
} | ||
|
||
|
Binary file not shown.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
## Test environments | ||
* local R installation, R 4.0.0 | ||
* ubuntu 16.04 (on travis-ci), R 4.0.0 | ||
* win-builder (devel) | ||
|
||
## R CMD check results | ||
|
||
0 errors | 0 warnings | 1 note | ||
|
||
## revdepcheck results | ||
|
||
We checked 5 reverse dependencies, comparing R CMD check results across CRAN and dev versions of this package. | ||
|
||
* We saw 0 new problems | ||
* We failed to check 0 packages | ||
|
||
## Resubmission | ||
|
||
This is a resubmission. In this version I have: | ||
|
||
* Addressed the elapsed time notes. |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.