Skip to content

Commit

Permalink
Merge pull request #33 from sigven/aug2023
Browse files Browse the repository at this point in the history
Data update and citation fix
  • Loading branch information
sigven committed Aug 16, 2023
2 parents 5fba21f + 8d75c1c commit f48003a
Show file tree
Hide file tree
Showing 53 changed files with 1,164 additions and 1,687 deletions.
26 changes: 10 additions & 16 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Package: oncoEnrichR
Type: Package
Title: Cancer-dedicated gene set interpretation
Version: 1.4.1
Date: 2023-06-17
Date: 2023-08-16
Authors@R: person(given = "Sigve", family = "Nakken", role = c("aut", "cre"),
email = "sigven@ifi.uio.no",
comment = c(ORCID = "0000-0001-8468-2050"))
Expand All @@ -27,33 +27,27 @@ Description: oncoEnrichR performs annotation and prioritization of genesets
report and an Excel workbook in which the user can interrogate the various
types of annotations and analyses performed with the query geneset.
Depends:
R (>= 4.1), GSEABase (>= 1.54.0)
R (>= 4.1), GSEABase
biocViews:
Imports: dplyr,
assertthat,
jsonlite,
assertable,
clusterProfiler,
DT,
gganatogram,
ggpubr,
openxlsx,
stringi,
stringr,
tidyr,
glue,
googledrive,
visNetwork (>= 2.0.9),
SummarizedExperiment (>= 1.22.0),
DT (>= 0.18),
visNetwork,
SummarizedExperiment,
plotly,
pals (>= 1.7),
org.Hs.eg.db,
clusterProfiler,
igraph (>= 1.2.6),
lgr,
gganatogram,
RCurl,
R.cache,
maftools,
rlang,
maftools (>= 2.8.0),
ggpubr (>= 0.4.0),
assertable,
TissueEnrich,
textclean (>= 0.9.3)
Suggests:
Expand Down
1 change: 0 additions & 1 deletion NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,5 @@ importFrom(GSEABase,ENSEMBLIdentifier)
importFrom(GSEABase,EntrezIdentifier)
importFrom(GSEABase,GeneSet)
importFrom(GSEABase,SymbolIdentifier)
importFrom(RCurl,url.exists)
importFrom(rlang,":=")
importFrom(rlang,.data)
22 changes: 11 additions & 11 deletions R/cell_tissue.R
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@ gene_tissue_cell_spec_cat <-
query_genes_df <-
data.frame('entrezgene' = qgenes, stringsAsFactors = F) |>
dplyr::inner_join(genedb, by = "entrezgene",
multiple = "all") |>
relationship = "many-to-many") |>
dplyr::distinct()

} else {
stopifnot(is.character(qgenes))
query_genes_df <- query_genes_df |>
dplyr::inner_join(genedb, by = "symbol",
multiple = "all") |>
relationship = "many-to-many") |>
dplyr::distinct()
}
etype <- "tissue"
Expand Down Expand Up @@ -77,7 +77,7 @@ gene_tissue_cell_spec_cat <-
c("symbol",
"ensembl_gene_id",
"name")),
by = "ensembl_gene_id", multiple = "all")
by = "ensembl_gene_id", relationship = "many-to-many")
)


Expand Down Expand Up @@ -127,7 +127,7 @@ gene_tissue_cell_spec_cat <-
if (nrow(dplyr::inner_join(
df,
specificity_groups_target,
by = "category", multiple = "all")) == 0) {
by = "category", relationship = "many-to-many")) == 0) {
specificity_groups_target <-
specificity_groups_target |>
dplyr::bind_rows(df)
Expand Down Expand Up @@ -171,7 +171,7 @@ gene_tissue_cell_spec_cat <-
query_genes_df,
c("symbol",
"ensembl_gene_id")),
by = "ensembl_gene_id", multiple = "all") |>
by = "ensembl_gene_id", relationship = "many-to-many") |>
dplyr::mutate(exp = round(log2(.data$nTPM + 1), digits = 3)) |>
dplyr::mutate(exp_measure = "log2(nTPM + 1)")
)
Expand All @@ -186,7 +186,7 @@ gene_tissue_cell_spec_cat <-
query_genes_df,
c("symbol",
"ensembl_gene_id")),
by = "ensembl_gene_id", multiple = "all") |>
by = "ensembl_gene_id", relationship = "many-to-many") |>
dplyr::mutate(exp = round(log2(.data$nTPM + 1), digits = 3)) |>
dplyr::mutate(exp_measure = "log2(nTPM + 1)")
)
Expand Down Expand Up @@ -246,7 +246,7 @@ gene_tissue_cell_enrichment <-
"symbol",
"name",
"cancer_max_rank")),
by = "entrezgene", multiple = "all")
by = "entrezgene", relationship = "many-to-many")

if (resolution == "tissue") {
df <- df |>
Expand All @@ -271,14 +271,14 @@ gene_tissue_cell_enrichment <-
q <- bg |>
dplyr::select("ensembl_gene_id") |>
dplyr::inner_join(
df, by = "ensembl_gene_id", multiple = "all") |>
df, by = "ensembl_gene_id", relationship = "many-to-many") |>
dplyr::distinct()
query_ensembl <- q$ensembl_gene_id

specificities_per_gene <- bg |>
dplyr::filter(!is.na(.data$ensembl_gene_id)) |>
dplyr::inner_join(
df, by = "ensembl_gene_id", multiple = "all")
df, by = "ensembl_gene_id", relationship = "many-to-many")

if (nrow(specificities_per_gene) > 0) {

Expand Down Expand Up @@ -312,11 +312,11 @@ gene_tissue_cell_enrichment <-
dplyr::inner_join(
dplyr::select(
genedb, c("ensembl_gene_id", "entrezgene")),
by = "entrezgene", multiple = "all"
by = "entrezgene", relationship = "many-to-many"
)
bg <- bg |>
dplyr::inner_join(
df, by = "ensembl_gene_id", multiple = "all") |>
df, by = "ensembl_gene_id", relationship = "many-to-many") |>
dplyr::distinct()
background_ensembl <- bg$ensembl_gene_id

Expand Down
16 changes: 8 additions & 8 deletions R/disease_drug.R
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ target_disease_associations <-
validate_db_df(otdb_gene_rank, dbtype = "opentarget_disease_site_rank")

target_genes <- data.frame('symbol' = qgenes, stringsAsFactors = F) |>
dplyr::inner_join(genedb, by = "symbol", multiple = "all") |>
dplyr::inner_join(genedb, by = "symbol", relationship = "many-to-many") |>
dplyr::distinct()


Expand All @@ -32,7 +32,7 @@ target_disease_associations <-

target_assocs <- target_genes |>
dplyr::inner_join(otdb_all, by=c("ensembl_gene_id"),
multiple = "all")
relationship = "many-to-many")

result <- list()
result[['target']] <- target_genes
Expand Down Expand Up @@ -93,7 +93,7 @@ target_disease_associations <-
tmp[['cancer_assocs']] |>
dplyr::left_join(
otdb_global_cancer_rank, by = "ensembl_gene_id",
multiple = "all") |>
relationship = "many-to-many") |>
dplyr::select(c("symbol", "global_assoc_rank")) |>
dplyr::distinct() |>
dplyr::arrange(dplyr::desc(.data$global_assoc_rank)) |>
Expand All @@ -109,7 +109,7 @@ target_disease_associations <-
result[['assoc_pr_gene']][['cancer']] <- as.data.frame(
tmp[['cancer_assocs']] |>
dplyr::left_join(gene_targetset_cancer_rank,
by = "symbol", multiple = "all") |>
by = "symbol", relationship = "many-to-many") |>
dplyr::arrange(dplyr::desc(.data$targetset_cancer_rank),
dplyr::desc(.data$ot_association_score)) |>
dplyr::select(-c("primary_site")) |>
Expand Down Expand Up @@ -173,7 +173,7 @@ target_disease_associations <-
result[['assoc_pr_gene']][['other']] <- as.data.frame(
tmp[['disease_assocs']] |>
dplyr::left_join(gene_targetset_disease_rank,
by = "symbol", multiple = "all") |>
by = "symbol", relationship = "many-to-many") |>
dplyr::arrange(dplyr::desc(.data$targetset_disease_rank),
dplyr::desc(.data$ot_association_score)) |>

Expand All @@ -198,7 +198,7 @@ target_disease_associations <-
result[['target']] <- result[['target']] |>
dplyr::left_join(
result[['assoc_pr_gene']][['cancer']],
by = "symbol", multiple = "all")
by = "symbol", relationship = "many-to-many")
} else {
result[['target']]$targetset_cancer_rank <- NA
result[['target']]$global_cancer_rank <- NA
Expand All @@ -210,7 +210,7 @@ target_disease_associations <-
result[['target']] <- result[['target']] |>
dplyr::left_join(
result[['assoc_pr_gene']][['other']],
by = "symbol", multiple = "all")
by = "symbol", relationship = "many-to-many")
} else {
result[['target']]$targetset_disease_rank <- NA
result[['target']]$ot_links <- NA
Expand Down Expand Up @@ -276,7 +276,7 @@ target_disease_associations <-
c("primary_site",
"ensembl_gene_id",
"tissue_assoc_rank")),
by = "ensembl_gene_id", multiple = "all"
by = "ensembl_gene_id", relationship = "many-to-many"
) |>
dplyr::select(-c("ensembl_gene_id")) |>
dplyr::distinct()
Expand Down
12 changes: 6 additions & 6 deletions R/enrich.R
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ get_go_enrichment <- function(query_entrez,
c("entrezgene",
"symbol")),
by=c("gene_id" = "entrezgene"),
multiple = "all") |>
relationship = "many-to-many") |>
dplyr::mutate(
entrez_url =
paste0("<a href='https://www.ncbi.nlm.nih.gov/gene/",
Expand All @@ -148,7 +148,7 @@ get_go_enrichment <- function(query_entrez,
c("go_id",
"gene_symbol_link",
"gene_symbol")),
by="go_id", multiple = "all") |>
by="go_id", relationship = "many-to-many") |>
dplyr::rename(exact_source = "go_id",
description = "go_description",
description_link = "go_description_link") |>
Expand Down Expand Up @@ -215,7 +215,7 @@ get_universal_enrichment <- function(query_entrez,
stopifnot(is.character(TERM2GENE$entrez_gene))

stopifnot(NROW(
dplyr::inner_join(TERM2NAME, TERM2GENE, by = "standard_name", multiple = "all")
dplyr::inner_join(TERM2NAME, TERM2GENE, by = "standard_name", relationship = "many-to-many")
) > 0)

enr <-
Expand Down Expand Up @@ -290,7 +290,7 @@ get_universal_enrichment <- function(query_entrez,
stopifnot(!is.null(TERM2SOURCE) | !is.data.frame(TERM2SOURCE))
stopifnot("standard_name" %in% colnames(TERM2SOURCE))
df <- df |>
dplyr::left_join(TERM2SOURCE, by="standard_name", multiple = "all") |>
dplyr::left_join(TERM2SOURCE, by="standard_name", relationship = "many-to-many") |>
dplyr::mutate(
description_link =
dplyr::if_else(
Expand Down Expand Up @@ -354,7 +354,7 @@ get_universal_enrichment <- function(query_entrez,
dplyr::mutate(gene_id = as.integer(.data$gene_id)) |>
dplyr::left_join(
dplyr::select(genedb, c("entrezgene", "symbol")),
by = c("gene_id" = "entrezgene"), multiple = "all") |>
by = c("gene_id" = "entrezgene"), relationship = "many-to-many") |>
dplyr::mutate(
entrez_url =
paste0("<a href='https://www.ncbi.nlm.nih.gov/gene/",
Expand All @@ -373,7 +373,7 @@ get_universal_enrichment <- function(query_entrez,
c("standard_name",
"gene_symbol_link",
"gene_symbol")),
by = "standard_name", multiple = "all")
by = "standard_name", relationship = "many-to-many")
}
if (!is.null(df)) {
df$setting_p_value_cutoff <- p_value_cutoff
Expand Down
8 changes: 4 additions & 4 deletions R/gene_fitness.R
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ get_fitness_lof_scores <- function(qgenes,
target_genes |>
dplyr::inner_join(
depmapdb[['fitness_scores']],
by = c("symbol"), multiple = "all") |>
by = c("symbol"), relationship = "many-to-many") |>
dplyr::arrange(.data$scaled_BF)
)
if (nrow(fitness_lof_hits) > 0) {
Expand Down Expand Up @@ -71,8 +71,8 @@ get_fitness_lof_scores <- function(qgenes,

fitness_lof_results[['targets']] <- fitness_lof_results[['targets']] |>
dplyr::left_join(gene_pr_tissue_stats,
by = c("symbol","tissue"), multiple = "all") |>
dplyr::left_join(gene_stats, by = "symbol", multiple = "all") |>
by = c("symbol","tissue"), relationship = "many-to-many") |>
dplyr::left_join(gene_stats, by = "symbol", relationship = "many-to-many") |>
dplyr::select(c("symbol",
"symbol_link_ps",
"model_name",
Expand Down Expand Up @@ -117,7 +117,7 @@ get_target_priority_scores <-

targets_crispr_priority <- as.data.frame(
depmapdb[['target_priority_scores']] |>
dplyr::inner_join(target_genes, by = c("symbol"), multiple = "all")
dplyr::inner_join(target_genes, by = c("symbol"), relationship = "many-to-many")
)

prioritized_targets[["n_pri_targets"]] <-
Expand Down
12 changes: 6 additions & 6 deletions R/ligand_receptor.R
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ annotate_ligand_receptor_interactions <- function(qgenes,
c("entrezgene",
"symbol")),
!is.na(.data$symbol)),
by = c("symbol"), multiple = "all") |>
by = c("symbol"), relationship = "many-to-many") |>
dplyr::filter(!is.na(.data$entrezgene)) |>
dplyr::inner_join(query_df, by = "symbol", multiple = "all")
dplyr::inner_join(query_df, by = "symbol", relationship = "many-to-many")
)

query_hits <- list()
Expand All @@ -43,7 +43,7 @@ annotate_ligand_receptor_interactions <- function(qgenes,
valid_query_hits <-
query_hits[['ligand']] |>
dplyr::inner_join(query_hits[['receptor']],
by = "interaction_id", multiple = "all")
by = "interaction_id", relationship = "many-to-many")

ligand_receptor_results <- list()
ligand_receptor_results[['cell_cell_contact']] <-
Expand All @@ -59,7 +59,7 @@ annotate_ligand_receptor_interactions <- function(qgenes,
ligand_receptor_db |>
dplyr::filter(.data$annotation == "Cell-Cell Contact") |>
dplyr::inner_join(valid_query_hits,
by = "interaction_id", multiple = "all")
by = "interaction_id", relationship = "many-to-many")
) |>
dplyr::select(-c("interaction_id",
"annotation",
Expand All @@ -71,7 +71,7 @@ annotate_ligand_receptor_interactions <- function(qgenes,
ligand_receptor_db |>
dplyr::filter(.data$annotation == "Secreted Signaling") |>
dplyr::inner_join(valid_query_hits,
by = "interaction_id", multiple = "all")
by = "interaction_id", relationship = "many-to-many")
) |>
dplyr::select(-c("interaction_id",
"annotation",
Expand All @@ -84,7 +84,7 @@ annotate_ligand_receptor_interactions <- function(qgenes,
ligand_receptor_db |>
dplyr::filter(.data$annotation == "ECM-Receptor") |>
dplyr::inner_join(valid_query_hits,
by = "interaction_id", multiple = "all")
by = "interaction_id", relationship = "many-to-many")
) |>
dplyr::select(-c("interaction_id",
"annotation",
Expand Down
Loading

0 comments on commit f48003a

Please sign in to comment.