From e8bcb23c4488fb9cd710da3a7aa234a8142f5a00 Mon Sep 17 00:00:00 2001 From: Boyi Guo Date: Wed, 8 Nov 2023 17:10:58 -0500 Subject: [PATCH 1/5] typo --- vignettes/more_than_visium.Rmd | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/vignettes/more_than_visium.Rmd b/vignettes/more_than_visium.Rmd index 598874e..143e7e2 100644 --- a/vignettes/more_than_visium.Rmd +++ b/vignettes/more_than_visium.Rmd @@ -113,7 +113,8 @@ make_escheR( # size = 2.8, # fun = sum, bins = 30) ``` -> Note 1: The strategy of binning to avoid overplotting is previously proposed in [`schex`](https://www.bioconductor.org/packages/release/bioc/html/schex.html). While we provide an impelmentation in `escheR`, we would caution our users that the binning strategy could lead to intermixing of cluster memberships. In our impelmentation, the majority membership of the datapoints belonging to a bin is selected as the label. Users should use the binning strategy under their own discretion, and interpret the visualization carefully. +> Note 1: The strategy of binning to avoid overplotting is previously proposed in [`schex`](https://www.bioconductor.org/packages/release/bioc/html/schex.html). While we provide an implementation in `escheR`, we would caution our users that the binning strategy could lead to intermixing of cluster memberships. In our implementation, the majority membership of the data points belonging to a bin is selected as the label of the bin. Users should use the binning strategy under their own discretion, and interpret the visualization carefully. + > Note 2: `add_fill_bin()` shoudl be applied after `add_ground_bin()` for the better visualization outcome. # Image-based `SpatialExperiment` Object From 8dc2c7d0e5fd4a883644561565fdb4007ce4f0a5 Mon Sep 17 00:00:00 2001 From: Boyi Guo Date: Thu, 9 Nov 2023 09:45:41 -0500 Subject: [PATCH 2/5] suggest hexbin package --- DESCRIPTION | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/DESCRIPTION b/DESCRIPTION index 534687a..d79830a 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -54,5 +54,6 @@ Suggests: scran, scater, scuttle, - Seurat + Seurat, + hexbin VignetteBuilder: knitr From 8cbafb9b97aaf85dc36f738c3014dfddfff4ecf2 Mon Sep 17 00:00:00 2001 From: Boyi Guo Date: Thu, 9 Nov 2023 09:46:58 -0500 Subject: [PATCH 3/5] remove useless code --- vignettes/more_than_visium.Rmd | 54 ++++------------------------------ 1 file changed, 5 insertions(+), 49 deletions(-) diff --git a/vignettes/more_than_visium.Rmd b/vignettes/more_than_visium.Rmd index 143e7e2..f584dfa 100644 --- a/vignettes/more_than_visium.Rmd +++ b/vignettes/more_than_visium.Rmd @@ -49,32 +49,9 @@ make_escheR( ``` # Hex Binning -```{r} +```{r bin_plot} spe$counts_MOBP <- counts(spe)[which(rowData(spe)$gene_name=="MOBP"),] spe$ground_truth <- factor(spe$ground_truth) -# Hex Binning version -# make_escheR( -# spe, -# dimred = "PCA" -# ) + -# # Create hex binning -# stat_summary_hex( -# aes(z = ground_truth, group = -1, color = after_stat(value), fill = after_stat(rep(NA_integer_, length(value))) -# ), -# linewidth = 1.2, -# fun = function(x){ -# # browser() -# ll <- data.frame(table(x)) -# as.character(ll[which.max(ll$Freq),"x"]) -# }, bins = 30 -# ) + -# # Create hex binning -# stat_summary_hex( -# aes(z = counts_MOBP, fill = after_stat(value)), -# color = "transparent", -# fun = sum, bins = 30) + -# scale_size_area - # Point Binning version make_escheR( @@ -82,36 +59,15 @@ make_escheR( dimred = "PCA" ) |> add_ground_bin( - var = "ground_truth") |> + var = "ground_truth" + ) |> add_fill_bin( var = "counts_MOBP" - ) + + ) + + # Customize aesthetics scale_fill_gradient(low = "white", high = "black", name = "MOBP Count")+ scale_color_discrete(name = "Spatial Domains") + theme_minimal() - -# -# stat_summary_hex( -# aes(z = ground_truth, group = -1, color = after_stat(value), fill = after_stat(rep(NA_integer_, length(value))) -# ), -# geom = "point", -# shape = 21, -# size = 3, -# stroke = 1, -# # linewidth = 1.2, -# fun = function(x){ -# # browser() -# ll <- data.frame(table(x)) -# as.character(ll[which.max(ll$Freq),"x"]) -# }, bins = 30 -# ) + -# stat_summary_hex( -# aes(z = counts_MOBP, fill = after_stat(value)), -# color = "transparent", -# geom = "point", -# shape = 21, -# size = 2.8, -# fun = sum, bins = 30) ``` > Note 1: The strategy of binning to avoid overplotting is previously proposed in [`schex`](https://www.bioconductor.org/packages/release/bioc/html/schex.html). While we provide an implementation in `escheR`, we would caution our users that the binning strategy could lead to intermixing of cluster memberships. In our implementation, the majority membership of the data points belonging to a bin is selected as the label of the bin. Users should use the binning strategy under their own discretion, and interpret the visualization carefully. From c932cece46a184f84436702630340ed26a3c7d78 Mon Sep 17 00:00:00 2001 From: Boyi Guo Date: Thu, 9 Nov 2023 09:51:41 -0500 Subject: [PATCH 4/5] version --- DESCRIPTION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DESCRIPTION b/DESCRIPTION index d79830a..304f826 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: escheR Title: Unified multi-dimensional visualizations with Gestalt principles -Version: 1.3.0 +Version: 1.3.1 Authors@R: c( person("Boyi", "Guo", email = "boyi.guo.work@gmail.com", role = c("aut", "cre"), From 58b8e4ca529ead8e02ea53d1ba569a88a5d571c6 Mon Sep 17 00:00:00 2001 From: Boyi Guo Date: Thu, 9 Nov 2023 09:54:50 -0500 Subject: [PATCH 5/5] Update news --- NEWS.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/NEWS.md b/NEWS.md index 1ac1525..73fd358 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,10 @@ +# escheR 1.3.1 +SIGNIFICANT USER-VISIBLE CHANGES +* Add functions `add_fill_bin` and `add_ground_bin` to provide hexgon binning strategy to mitigate the overplotting of data points +* Provide an example to use `add_fill_bin` and `add_ground_bin` with `make_escheR` to create hexgon binning plot + + + # escheR 1.2.0 SIGNIFICANT USER-VISIBLE CHANGES * Add generic functions to support `SingleCellExperiment` object by