Skip to content

Commit

Permalink
Clean up code
Browse files Browse the repository at this point in the history
  • Loading branch information
igordot committed Dec 21, 2024
1 parent 500741f commit bbab104
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 253 deletions.
14 changes: 0 additions & 14 deletions .travis.yml

This file was deleted.

12 changes: 0 additions & 12 deletions NAMESPACE
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
# Generated by roxygen2: do not edit by hand

export("%>%")
export(":=")
export(.data)
export(as_label)
export(as_name)
export(enquo)
export(enquos)
export(msigdbr)
export(msigdbr_collections)
export(msigdbr_show_species)
Expand All @@ -23,12 +17,6 @@ importFrom(dplyr,mutate)
importFrom(dplyr,rename)
importFrom(dplyr,select)
importFrom(magrittr,"%>%")
importFrom(rlang,":=")
importFrom(rlang,.data)
importFrom(rlang,as_label)
importFrom(rlang,as_name)
importFrom(rlang,enquo)
importFrom(rlang,enquos)
importFrom(tibble,as_tibble)
importFrom(tidyselect,any_of)
importFrom(tidyselect,everything)
43 changes: 21 additions & 22 deletions R/msigdbr.R
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
#' msigdbr(species = "Mus musculus", category = "C2", subcategory = "CGP")
#' }
msigdbr <- function(species = "Homo sapiens", category = NULL, subcategory = NULL) {

# confirm that only one species is specified
if (length(species) > 1) {
stop("please specify only one species at a time")
Expand Down Expand Up @@ -62,11 +61,9 @@ msigdbr <- function(species = "Homo sapiens", category = NULL, subcategory = NUL
}

# combine gene sets and genes
genesets_subset <-
genesets_subset %>%
inner_join(msigdbr_geneset_genes, by = "gs_id") %>%
inner_join(msigdbr_genes, by = "gene_id") %>%
select(-any_of(c("gene_id")))
genesets_subset <- inner_join(genesets_subset, msigdbr_geneset_genes, by = "gs_id")
genesets_subset <- inner_join(genesets_subset, msigdbr_genes, by = "gene_id", relationship = "many-to-many")
genesets_subset <- select(genesets_subset, !any_of(c("gene_id")))

# retrieve orthologs
if (species %in% c("Homo sapiens", "human")) {
Expand All @@ -82,7 +79,7 @@ msigdbr <- function(species = "Homo sapiens", category = NULL, subcategory = NUL
} else {
orthologs_subset <-
orthologs(genes = genesets_subset$human_ensembl_gene, species = species) %>%
select(-any_of(c("human_symbol", "human_entrez"))) %>%
select(!any_of(c("human_symbol", "human_entrez"))) %>%
rename(
human_ensembl_gene = "human_ensembl",
gene_symbol = "symbol",
Expand All @@ -94,19 +91,21 @@ msigdbr <- function(species = "Homo sapiens", category = NULL, subcategory = NUL
}

# combine gene sets and orthologs
genesets_subset %>%
inner_join(orthologs_subset, by = "human_ensembl_gene") %>%
arrange(.data$gs_name, .data$human_gene_symbol, .data$gene_symbol) %>%
select(
"gs_cat",
"gs_subcat",
"gs_name",
"gene_symbol",
"entrez_gene",
"ensembl_gene",
"human_gene_symbol",
"human_entrez_gene",
"human_ensembl_gene",
everything()
)
genesets_subset <- inner_join(genesets_subset, orthologs_subset, by = "human_ensembl_gene", relationship = "many-to-many")
genesets_subset <- arrange(genesets_subset, .data$gs_name, .data$human_gene_symbol, .data$gene_symbol)
genesets_subset <- select(
genesets_subset,
"gs_cat",
"gs_subcat",
"gs_name",
"gene_symbol",
"entrez_gene",
"ensembl_gene",
"human_gene_symbol",
"human_entrez_gene",
"human_ensembl_gene",
everything()
)

return(genesets_subset)
}
107 changes: 0 additions & 107 deletions R/utils-tidy-eval.R

This file was deleted.

98 changes: 0 additions & 98 deletions man/tidyeval.Rd

This file was deleted.

0 comments on commit bbab104

Please sign in to comment.