From d2f7a4d862f830fe8da87fa0d43f9c5d03f6ade7 Mon Sep 17 00:00:00 2001 From: Roman Hillje Date: Wed, 17 Jun 2020 09:38:57 +0200 Subject: [PATCH 1/6] Fixes #15. --- R/getEnrichedPathways.R | 70 +++++++++++++++++++++++++++-------------- 1 file changed, 46 insertions(+), 24 deletions(-) diff --git a/R/getEnrichedPathways.R b/R/getEnrichedPathways.R index e7d83da..deba6f1 100755 --- a/R/getEnrichedPathways.R +++ b/R/getEnrichedPathways.R @@ -165,20 +165,31 @@ getEnrichedPathways <- function( results_by_sample[[i]] <- results_by_sample[[i]] %>% dplyr::mutate(sample = i) } - ## merge samples into single table - results_by_sample <- do.call(rbind, results_by_sample) %>% - dplyr::select('sample', 'db', dplyr::everything()) %>% - dplyr::mutate( - sample = factor(.data$sample, levels = intersect(sample_names, - .data$sample)), - db = factor(.data$db, databases) + ## check if all databases returned empty lists + if ( length(results_by_sample) == 0 ) { + results_by_sample <- 'no_markers_found' + message( + paste0( + '[', format(Sys.time(), '%H:%M:%S'), '] 0 pathways passed the ', + 'thresholds across all samples and databases.' + ) ) - message( - paste0( - '[', format(Sys.time(), '%H:%M:%S'), '] ', nrow(results_by_sample), - ' pathways passed the thresholds across all samples and databases.' + } else { + ## merge samples into single table + results_by_sample <- do.call(rbind, results_by_sample) %>% + dplyr::select('sample', 'db', dplyr::everything()) %>% + dplyr::mutate( + sample = factor(.data$sample, levels = intersect(sample_names, + .data$sample)), + db = factor(.data$db, databases) + ) + message( + paste0( + '[', format(Sys.time(), '%H:%M:%S'), '] ', nrow(results_by_sample), + ' pathways passed the thresholds across all samples and databases.' + ) ) - ) + } } else if ( object@misc$marker_genes$by_sample == 'no_markers_found' ) { message( @@ -301,20 +312,31 @@ getEnrichedPathways <- function( results_by_cluster[[i]] <- results_by_cluster[[i]] %>% dplyr::mutate(cluster = i) } - ## merge clusters into single table - results_by_cluster <- do.call(rbind, results_by_cluster) %>% - dplyr::select(.data$cluster, .data$db, dplyr::everything()) %>% - dplyr::mutate( - cluster = factor(.data$cluster, levels = intersect(cluster_names, - .data$cluster)), - db = factor(.data$db, databases) + ## check if all databases returned empty lists + if ( length(results_by_cluster) == 0 ) { + results_by_cluster <- 'no_markers_found' + message( + paste0( + '[', format(Sys.time(), '%H:%M:%S'), '] 0 pathways passed the ', + 'thresholds across all samples and databases.' + ) ) - message( - paste0( - '[', format(Sys.time(), '%H:%M:%S'), '] ', nrow(results_by_cluster), - ' pathways passed the thresholds across all clusters and databases.' + } else { + ## merge clusters into single table + results_by_cluster <- do.call(rbind, results_by_cluster) %>% + dplyr::select(.data$cluster, .data$db, dplyr::everything()) %>% + dplyr::mutate( + cluster = factor(.data$cluster, levels = intersect(cluster_names, + .data$cluster)), + db = factor(.data$db, databases) + ) + message( + paste0( + '[', format(Sys.time(), '%H:%M:%S'), '] ', nrow(results_by_cluster), + ' pathways passed the thresholds across all clusters and databases.' + ) ) - ) + } } else if ( object@misc$marker_genes$by_cluster == 'no_markers_found' ) { message( From 15543057e320396d57aad8d7aa736cc2120e9e24 Mon Sep 17 00:00:00 2001 From: Roman Hillje Date: Wed, 17 Jun 2020 11:10:23 +0200 Subject: [PATCH 2/6] Update to v1.2.2. --- DESCRIPTION | 2 +- NEWS.md | 6 ++++++ inst/NEWS | 8 ++++++++ inst/shiny/v1.2/about/server.R | 2 +- 4 files changed, 16 insertions(+), 2 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 0f07df9..d39681d 100755 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: cerebroApp Title: Interactive visualization of scRNA-seq data with Cerebro -Version: 1.2.1 +Version: 1.2.2 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 de73afb..451e0c2 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,9 @@ +# cerebroApp 1.2.2 + +## Hotfixes + +- `getEnrichedPathways()` no longer results in an error when marker genes are present but no database returns any enriched pathways, e.g. because there are too few marker genes. Thanks to @turkeyri for pointing it out and suggesting a solution! + # cerebroApp 1.2.1 ## New features diff --git a/inst/NEWS b/inst/NEWS index 3f888da..c4aba8b 100644 --- a/inst/NEWS +++ b/inst/NEWS @@ -1,6 +1,14 @@ \name{NEWS} \title{News for Package \pkg{cerebroApp}} +\section{Changes in version 1.2.2}{ +\itemize{ + \item Hotfixes: + \itemize{ + \item \texttt{getEnrichedPathways()} no longer results in an error when marker genes are present but no database returns any enriched pathways, e.g. because there are too few marker genes. Thanks to \href{@turkeyri}{https://github.com/turkeyri} for pointing it out and suggesting a solution! + } +}} + \section{Changes in version 1.2.1}{ \itemize{ \item New features: diff --git a/inst/shiny/v1.2/about/server.R b/inst/shiny/v1.2/about/server.R index 0e78619..63685cf 100644 --- a/inst/shiny/v1.2/about/server.R +++ b/inst/shiny/v1.2/about/server.R @@ -5,7 +5,7 @@ output[["about"]] <- renderText({ paste0( 'Version of cerebroApp
', - 'v1.2.1
+ 'v1.2.2

Author
Roman Hillje
From 907334bdfeb271e2157d75bce45922a9b405df77 Mon Sep 17 00:00:00 2001 From: Roman Hillje Date: Wed, 17 Jun 2020 11:27:34 +0200 Subject: [PATCH 3/6] Update vignette. --- vignettes/cerebroApp_workflow.Rmd | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vignettes/cerebroApp_workflow.Rmd b/vignettes/cerebroApp_workflow.Rmd index eeb9b2e..880e37f 100644 --- a/vignettes/cerebroApp_workflow.Rmd +++ b/vignettes/cerebroApp_workflow.Rmd @@ -288,8 +288,8 @@ monocle <- newCellDataSet( seurat@assays$RNA@data, phenoData = new('AnnotatedDataFrame', data = seurat@meta.data), featureData = new('AnnotatedDataFrame', data = data.frame( - gene_short_name = rownames(seurat@assays$RNA@data), - row.names = rownames(seurat@assays$RNA@data)) + gene_short_name = rownames(seurat@assays$RNA@counts), + row.names = rownames(seurat@assays$RNA@counts)) ) ) From cfc64f97277813bff19ac5f70c7f23fcd140a503 Mon Sep 17 00:00:00 2001 From: Roman Hillje Date: Wed, 17 Jun 2020 11:43:13 +0200 Subject: [PATCH 4/6] Update NEWS. --- NEWS.md | 2 +- inst/NEWS | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/NEWS.md b/NEWS.md index 451e0c2..6fecd34 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,6 +1,6 @@ # cerebroApp 1.2.2 -## Hotfixes +## Fixes - `getEnrichedPathways()` no longer results in an error when marker genes are present but no database returns any enriched pathways, e.g. because there are too few marker genes. Thanks to @turkeyri for pointing it out and suggesting a solution! diff --git a/inst/NEWS b/inst/NEWS index c4aba8b..086060c 100644 --- a/inst/NEWS +++ b/inst/NEWS @@ -3,7 +3,7 @@ \section{Changes in version 1.2.2}{ \itemize{ - \item Hotfixes: + \item Fixes: \itemize{ \item \texttt{getEnrichedPathways()} no longer results in an error when marker genes are present but no database returns any enriched pathways, e.g. because there are too few marker genes. Thanks to \href{@turkeyri}{https://github.com/turkeyri} for pointing it out and suggesting a solution! } From 6c8f361074d6381cabb4bcbc6b8c86e738bd7ad5 Mon Sep 17 00:00:00 2001 From: Roman Hillje Date: Wed, 17 Jun 2020 16:10:55 +0200 Subject: [PATCH 5/6] Fix incorrect display of cluster trees; remove HTML code from browser tab title. --- NEWS.md | 2 ++ inst/NEWS | 2 ++ inst/shiny/v1.1/clusters/server.R | 2 +- inst/shiny/v1.1/shiny_UI.R | 1 + inst/shiny/v1.2/clusters/server.R | 2 +- inst/shiny/v1.2/shiny_UI.R | 1 + 6 files changed, 8 insertions(+), 2 deletions(-) diff --git a/NEWS.md b/NEWS.md index 6fecd34..6fca296 100644 --- a/NEWS.md +++ b/NEWS.md @@ -2,6 +2,8 @@ ## Fixes +- The title in the browser tab now correctly says "Cerebro" instead of containing some HTML code. +- Cluster trees should now be displayed correctly. - `getEnrichedPathways()` no longer results in an error when marker genes are present but no database returns any enriched pathways, e.g. because there are too few marker genes. Thanks to @turkeyri for pointing it out and suggesting a solution! # cerebroApp 1.2.1 diff --git a/inst/NEWS b/inst/NEWS index 086060c..aa74e08 100644 --- a/inst/NEWS +++ b/inst/NEWS @@ -5,6 +5,8 @@ \itemize{ \item Fixes: \itemize{ + \item The title in the browser tab now correctly says "Cerebro" instead of containing some HTML code. + \item Cluster trees should now be displayed correctly. \item \texttt{getEnrichedPathways()} no longer results in an error when marker genes are present but no database returns any enriched pathways, e.g. because there are too few marker genes. Thanks to \href{@turkeyri}{https://github.com/turkeyri} for pointing it out and suggesting a solution! } }} diff --git a/inst/shiny/v1.1/clusters/server.R b/inst/shiny/v1.1/clusters/server.R index 2f5ea75..1a342ff 100644 --- a/inst/shiny/v1.1/clusters/server.R +++ b/inst/shiny/v1.1/clusters/server.R @@ -20,7 +20,7 @@ output[["clusters_tree_plot"]] <- renderPlot({ tree <- sample_data()$clusters$tree tree$tip.label <- paste0("Cluster ", tree$tip.label) colors_tree <- colors[1:length(tree$tip.label)] - ggplot(tree, aes(x, y)) + + ggtree::ggtree(tree, aes(x, y)) + scale_y_reverse() + ggtree::geom_tree() + ggtree::theme_tree() + diff --git a/inst/shiny/v1.1/shiny_UI.R b/inst/shiny/v1.1/shiny_UI.R index 604a834..e82992c 100644 --- a/inst/shiny/v1.1/shiny_UI.R +++ b/inst/shiny/v1.1/shiny_UI.R @@ -47,6 +47,7 @@ source(system.file("shiny/v1.1/about/UI.R", package = "cerebroApp"), local = TRU ## ##----------------------------------------------------------------------------## ui <- dashboardPage( + title = "Cerebro", dashboardHeader( title = span("Cerebro ", style = "color: white; font-size: 28px; font-weight: bold") ), diff --git a/inst/shiny/v1.2/clusters/server.R b/inst/shiny/v1.2/clusters/server.R index f556225..4b4a0d0 100644 --- a/inst/shiny/v1.2/clusters/server.R +++ b/inst/shiny/v1.2/clusters/server.R @@ -20,7 +20,7 @@ output[["clusters_tree_plot"]] <- renderPlot({ tree <- sample_data()$clusters$tree tree$tip.label <- paste0("Cluster ", tree$tip.label) colors_tree <- reactive_colors()$clusters - ggplot(tree, aes(x, y)) + + ggtree::ggtree(tree, aes(x, y)) + scale_y_reverse() + ggtree::geom_tree() + ggtree::theme_tree() + diff --git a/inst/shiny/v1.2/shiny_UI.R b/inst/shiny/v1.2/shiny_UI.R index 8ee89be..19d7047 100644 --- a/inst/shiny/v1.2/shiny_UI.R +++ b/inst/shiny/v1.2/shiny_UI.R @@ -48,6 +48,7 @@ source(system.file("shiny/v1.2/about/UI.R", package = "cerebroApp"), local = TRU ## ##----------------------------------------------------------------------------## ui <- dashboardPage( + title = "Cerebro", dashboardHeader( title = span("Cerebro ", style = "color: white; font-size: 28px; font-weight: bold") ), From de7b6d8496a716ef824b489e1e325475a1048069 Mon Sep 17 00:00:00 2001 From: Roman Hillje Date: Wed, 17 Jun 2020 18:02:51 +0200 Subject: [PATCH 6/6] Fix mistake that caused Cerebro logo to be deleted after first launch. --- inst/shiny/v1.2/about/server.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/inst/shiny/v1.2/about/server.R b/inst/shiny/v1.2/about/server.R index 63685cf..5a2a74a 100644 --- a/inst/shiny/v1.2/about/server.R +++ b/inst/shiny/v1.2/about/server.R @@ -64,5 +64,5 @@ output[["logo_Cerebro"]] <- renderImage({ alt = "Cerebro logo", align = "right" )}, - deleteFile = TRUE + deleteFile = FALSE )