diff --git a/.gitignore b/.gitignore index 7612fc4..9870a2e 100755 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,5 @@ cerebroApp_*.tar.gz vignettes/*.crb docs tests +.Rproj.user +*.Rproj diff --git a/DESCRIPTION b/DESCRIPTION index 71a8884..66030f1 100755 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: cerebroApp Title: Interactive visualization of scRNA-seq data with Cerebro -Version: 1.3.0 +Version: 1.3.1 Authors@R: person("Roman", "Hillje", email = "roman.hillje@googlemail.com", role = c("aut", "cre")) Description: Cerebro is a Shiny application that allows to interactively visualize scRNA-seq data. Data must be exported from a Seurat object using the helper functions which also allows to perform analysis such as pathway enrichment analysis based on marker genes of samples and/or clusters. diff --git a/NEWS.md b/NEWS.md index d687894..24c20af 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,31 @@ +# cerebroApp 1.3.1 + +Despite the minor version bump, this update contains substantial performance improvements in the Shiny app, specifically in the projections. + +## Major changes + +- Projections in the "Overview" and "Gene (set) expression" are now updated using the `Plotly.react()` Javascript function instead of redrawn from scratch inside R when changing the input variables. For the user, that means that (1) plots are drawn much quicker and (2) the current zoom/pan settings are maintained when switching plot parameters (coloring variable, point size/opacity, etc). + +## Minor changes + +- It is now possible to define several settings related to the projections shown in the "Overview" and "Gene (set) expression" tabs. For example, you can change the default point size and opacity, the default percentage of cells to show, and whether or not hover info should be activated in the projections. These settings are optional but useful when hosting a known data sets in `closed` mode, e.g. because you want to decrease the point size in a large data set. The respective parameters can be found in the description of the `launchCerebroV1.3()` function. +- Hover/tooltip info for cells in projections can be deactivated through a checkbox on the "About" tab. Deactivating hover info increases performance of projections. +- Hover/tooltip info for cells in the gene expression projection no longer contain the gene expression value. This is because preparing the hover info is an expensive computation with little return. As a result of removing the gene expression value, the hover info does not need to be recalculated every time a gene is added to or removed from the list of genes to show expression for. For the same reason, when plotting a trajectory, the state and pseudotime are not added to the hover info either. +- Internally, data for plotting in projections is rearranged, stored in different variables, and the final output is debounced to avoid unnecessary redrawing of the projections on initialization. +- The feature to show expression of multiple genes in separate panels has been matured. Up to 9 genes can be shown in a 3x3 panel matrix but all share the same color scale. While cells can be selected in any of the panels, the expression levels shown in the other UI element, e.g. table of selected cells or expression by group, refers to the mean expression of all selected genes (not just the one the cells were selected in). +- When coloring cells in projections by a caterogical variable, e.g. cell type, the dots in the legend are now larger and independent from the selected point size. +- Tables are now rendered server-side to improve performance for large tables. +- Cellular barcodes in tables of selected cells are formatted in monospace font. +- Columns in meta data tables, e.g. table of cells selected in projections, which are identified to contain percentage on a 0-100 scale are changed to a 0-1 scale to prevent non-sensical values such as 500%. +- Add comma to Y axis and hover info in bar chart of selected cells in projection ("Overview" tab). +- The `crb_file_to_load` parameter of the `launchCerebroV1.3()` function (or as part of `Cerebro.options`) can now be set to the name of a `Cerebro_v1.3` object. That means you can load the data set before launching Cerebro (with `readRDS()`) and make Cerebro initialize itself with it. This is particularly useful when hosting Cerebro in `closed` mode, preventing that each user session has to read the data set from disk. +- Update author info in "About" tab. + +## Fixes + +- Colors assigned to groups in bar chart of selected cells in projection ("Overview" tab) sometimes did not match those shown in the projection. This only applied to categorical grouping variables that are not registered as grouping variables. +- Update Enrichr API for `getEnrichedPathways()` function. Make it configurable in case of further changes to the API. + # cerebroApp 1.3.0 Because this is a relatively big release, I have prepared a dedicated article with release notes for cerebroApp v1.3 that you can find in the navigation bar. diff --git a/R/getEnrichedPathways.R b/R/getEnrichedPathways.R index a69ca26..7419ff9 100755 --- a/R/getEnrichedPathways.R +++ b/R/getEnrichedPathways.R @@ -19,7 +19,7 @@ #' @param URL_API URL to send requests to (Enrichr API). Allows to overwrite #' default URL with an alternative taken from the Enrichr website in case the #' original is out-of-service; defaults to -#' 'http://amp.pharm.mssm.edu/Enrichr/enrich'. +#' 'http://maayanlab.cloud/Enrichr'. #' #' @return #' Seurat object with Enrichr results for all provided grouping variables, @@ -34,7 +34,7 @@ #' databases = c('GO_Biological_Process_2018','GO_Cellular_Component_2018'), #' adj_p_cutoff = 0.01, #' max_terms = 100, -#' URL_API = 'http://amp.pharm.mssm.edu/Enrichr/enrich' +#' URL_API = 'http://maayanlab.cloud/Enrichr' #' ) #' #' @import dplyr @@ -60,7 +60,7 @@ getEnrichedPathways <- function( ), adj_p_cutoff = 0.05, max_terms = 100, - URL_API = 'http://amp.pharm.mssm.edu/Enrichr/enrich' + URL_API = 'http://maayanlab.cloud/Enrichr' ) { ##--------------------------------------------------------------------------## diff --git a/R/launchCerebroV1.3.R b/R/launchCerebroV1.3.R index 1899b9b..5945dc5 100644 --- a/R/launchCerebroV1.3.R +++ b/R/launchCerebroV1.3.R @@ -16,6 +16,15 @@ #' @param welcome_message \code{string} with custom welcome message to display #' in the "Load data" tab. Can contain HTML formatting, e.g. #' \code{'

Hi!

'}. Defaults to \code{NULL}. +#' @param projections_default_point_size Default point size in projections. This +#' value can be changed in the UI; defaults to 5. +#' @param projections_default_point_opacity Default point opacity in +#' projections. This value can be changed in the UI; defaults to 1.0. +#' @param projections_default_percentage_cells_to_show Default percentage of +#' cells to show in projections. This value can be changed in the UI; defaults +#' to 100. +#' @param projections_show_hover_info Show hover infos in projections. This +#" setting can be changed in the UI; defaults to TRUE. #' @param ... Further parameters that are used by \code{shiny::runApp}, e.g. #' \code{host} or \code{port}. #' @@ -59,11 +68,15 @@ launchCerebroV1.3 <- function( maxFileSize = 800, crb_file_to_load = NULL, welcome_message = NULL, + projections_default_point_size = 5, + projections_default_point_opacity = 1.0, + projections_default_percentage_cells_to_show = 100, + projections_show_hover_info = TRUE, ... ){ ##--------------------------------------------------------------------------## - ## Check validity of 'mode' parameter. + ## Check validity of input parameters. ##--------------------------------------------------------------------------## if ( mode %in% c('open','closed') == FALSE ) { stop( @@ -71,6 +84,39 @@ launchCerebroV1.3 <- function( call. = FALSE ) } + if ( + projections_default_point_size < 0 || + projections_default_point_size > 20 + ) { + stop( + "'projections_default_point_size' parameter must be between 1 and 20", + call. = FALSE + ) + } + if ( + projections_default_point_opacity < 0 || + projections_default_point_opacity > 1 + ) { + stop( + "'projections_default_point_opacity' parameter must be between 0 and 1", + call. = FALSE + ) + } + if ( + projections_default_percentage_cells_to_show < 0 || + projections_default_percentage_cells_to_show > 100 + ) { + stop( + "'projections_default_percentage_cells_to_show' parameter must be between 0 and 100", + call. = FALSE + ) + } + if ( projections_show_hover_info %in% c(TRUE, FALSE) == FALSE ) { + stop( + "'projections_show_hover_info' parameter must be set to either TRUE or FALSE.", + call. = FALSE + ) + } ##--------------------------------------------------------------------------## ## Create global variable with options that need to be available inside the @@ -80,7 +126,11 @@ launchCerebroV1.3 <- function( "mode" = mode, "crb_file_to_load" = crb_file_to_load, "welcome_message" = welcome_message, - "cerebro_root" = system.file(package = "cerebroApp") + "cerebro_root" = system.file(package = "cerebroApp"), + "projections_default_point_size" = projections_default_point_size, + "projections_default_point_opacity" = projections_default_point_opacity, + "projections_default_percentage_cells_to_show" = projections_default_percentage_cells_to_show, + "projections_show_hover_info" = projections_show_hover_info ) ##--------------------------------------------------------------------------## diff --git a/R/send_enrichr_query.r b/R/send_enrichr_query.r index 865bf8d..84ced5b 100644 --- a/R/send_enrichr_query.r +++ b/R/send_enrichr_query.r @@ -8,7 +8,7 @@ #' score between 0 and 1 in the other. #' @param databases Databases to search. #' @param URL_API URL to send requests to (Enrichr API). -#' See http://amp.pharm.mssm.edu/Enrichr/ for available databases. +#' See https://maayanlab.cloud/Enrichr/#stats for available databases. #' #' @return #' Returns a data frame of enrichment terms, p-values, ... @@ -33,7 +33,7 @@ ## send request with gene names temp <- httr::POST( - url = URL_API, + url = paste0(URL_API, "/enrich"), body = list( list = paste(genes, collapse = '\n') ) @@ -44,7 +44,7 @@ ## send request with gene names and scores temp <- httr::POST( - url = URL_API, + url = paste0(URL_API, "/enrich"), body = list( list = paste(paste(genes[,1], genes[,2], sep = ','), collapse = '\n') ) @@ -61,7 +61,7 @@ } ## - httr::GET(url = 'http://amp.pharm.mssm.edu/Enrichr/share') + httr::GET(url = paste0(URL_API, "/share")) ## dfSAF <- options()$stringsAsFactors @@ -79,7 +79,7 @@ ## r <- httr::GET( - url = 'http://amp.pharm.mssm.edu/Enrichr/export', + url = paste0(URL_API, "/export"), query = list( file = 'API', backgroundType = x diff --git a/inst/shiny/v1.3/about/server.R b/inst/shiny/v1.3/about/server.R index 3bef0aa..f06fe0a 100644 --- a/inst/shiny/v1.3/about/server.R +++ b/inst/shiny/v1.3/about/server.R @@ -2,6 +2,7 @@ ## Tab: About. ##----------------------------------------------------------------------------## +## output[["about"]] <- renderText({ paste0( 'Version of cerebroApp
@@ -9,8 +10,6 @@ output[["about"]] <- renderText({
Author
Roman Hillje
- Department of Experimental Oncology
- IEO, European Institute of Oncology IRCCS, Milan

Links