From 13e9fcb83050e1db8e374e9d50a48c591ea8bbe7 Mon Sep 17 00:00:00 2001 From: George Chen <72078254+jiajic@users.noreply.github.com> Date: Tue, 28 May 2024 15:11:12 -0400 Subject: [PATCH] Reapply "Merge branch 'dev' into dev2" This reverts commit 961dc22b0e7eb149974c06d2d2282c34ed6d3439. --- .github/workflows/dev_check.yml | 1 + R/vis_spatial.R | 11 ++++++++++- R/vis_spatial_in_situ.R | 1 + man/addGiottoImageToSpatPlot.Rd | 2 +- man/create_cluster_dendrogram.Rd | 2 +- man/dimCellPlot.Rd | 4 ++-- man/dimFeatPlot2D.Rd | 2 +- man/dimPlot.Rd | 4 ++-- man/plotHeatmap.Rd | 2 +- man/plotMetaDataHeatmap.Rd | 2 +- man/plotPCA.Rd | 2 +- man/plotPCA_2D.Rd | 2 +- man/plotTSNE.Rd | 2 +- man/plotTSNE_2D.Rd | 2 +- man/plotUMAP.Rd | 2 +- man/plotUMAP_2D.Rd | 2 +- man/plotUMAP_3D.Rd | 2 +- man/plotly_grid.Rd | 2 +- man/showClusterDendrogram.Rd | 2 +- man/showClusterHeatmap.Rd | 2 +- man/spatCellPlot.Rd | 4 ++-- man/spatDimCellPlot.Rd | 2 +- man/spatDimCellPlot2D.Rd | 2 +- man/spatDimFeatPlot2D.Rd | 2 +- man/spatDimPlot.Rd | 4 ++-- man/spatFeatPlot2D.Rd | 2 +- man/spatFeatPlot2D_single.Rd | 2 +- man/spatPlot.Rd | 9 +++++++++ man/violinPlot.Rd | 2 +- 29 files changed, 50 insertions(+), 30 deletions(-) diff --git a/.github/workflows/dev_check.yml b/.github/workflows/dev_check.yml index 7d28c0c..6fa6420 100644 --- a/.github/workflows/dev_check.yml +++ b/.github/workflows/dev_check.yml @@ -45,6 +45,7 @@ jobs: any::ggalluvial any::ggforce any::ggraph + any::hexbin - name: Set up dependencies (GiottoUtils) run: | diff --git a/R/vis_spatial.R b/R/vis_spatial.R index 526acf3..c2c1a78 100644 --- a/R/vis_spatial.R +++ b/R/vis_spatial.R @@ -771,6 +771,15 @@ spatPlot2D <- function( #' color_as_factor = FALSE, #' gradient_style = "sequential" #' ) +#' +#' +#' # load another dataset with 3D data +#' starmap <- GiottoData::loadGiottoData("starmap", verbose = FALSE) +#' +#' # default is to rescale plot as a 3D cube +#' spatPlot3D(starmap, cell_color = "leiden_clus") +#' # real scaling +#' spatPlot3D(g, cell_color = "leiden_clus", axis_scale = "real") #' @export #' @seealso \code{\link{spatPlot3D}} spatPlot <- function(...) { @@ -5251,7 +5260,7 @@ dimPlot3D <- function(gobject, #' @returns plotly #' @examples #' g <- GiottoData::loadGiottoMini("starmap") -#' plotUMAP_3D(g) +#' plotUMAP_3D(g, dim_reduction_name = "3D_umap") #' #' @export plotUMAP_3D <- function(gobject, diff --git a/R/vis_spatial_in_situ.R b/R/vis_spatial_in_situ.R index 0b910c9..8187a52 100644 --- a/R/vis_spatial_in_situ.R +++ b/R/vis_spatial_in_situ.R @@ -636,6 +636,7 @@ spatInSituPlotHex <- function( polygon_line_size <- polygon_size } + package_check("hexbin") if (is.null(feats)) { stop("You need to select features (feats) and modify diff --git a/man/addGiottoImageToSpatPlot.Rd b/man/addGiottoImageToSpatPlot.Rd index 3dcaa61..1cbe545 100644 --- a/man/addGiottoImageToSpatPlot.Rd +++ b/man/addGiottoImageToSpatPlot.Rd @@ -30,7 +30,7 @@ an updated spatial ggplot object Add a giotto image to a spatial ggplot object post creation } \examples{ -g <- GiottoData::loadGiottoMini("visium") +g <- GiottoData::loadGiottoMini("visium", verbose = FALSE) my_giottoimage <- GiottoClass::createGiottoImage(g, mg_object = system.file("image.png", package = "GiottoVisuals"), diff --git a/man/create_cluster_dendrogram.Rd b/man/create_cluster_dendrogram.Rd index a999953..a44539f 100644 --- a/man/create_cluster_dendrogram.Rd +++ b/man/create_cluster_dendrogram.Rd @@ -59,7 +59,7 @@ for the 'col' params then they will be assumed as 1. clus_col, 2. var_col, 3. val_col } \examples{ -g <- GiottoData::loadGiottoMini("visium") +g <- GiottoData::loadGiottoMini("visium", verbose = FALSE) g_expression <- head(GiottoClass::getExpression(g, output = "matrix")) g_expression_df <- as.data.frame(as.matrix(g_expression)) diff --git a/man/dimCellPlot.Rd b/man/dimCellPlot.Rd index 8eed044..f317fa8 100644 --- a/man/dimCellPlot.Rd +++ b/man/dimCellPlot.Rd @@ -183,13 +183,13 @@ Visualize cells according to dimension reduction coordinates. Description of parameters. For 3D plots see \code{\link{dimPlot3D}} } \examples{ -g <- GiottoData::loadGiottoMini("visium") +g <- GiottoData::loadGiottoMini("visium", verbose = FALSE) dimCellPlot2D( g, spat_enr_names = "cluster_metagene", cell_annotation_values = as.character(seq(4)) ) -g <- GiottoData::loadGiottoMini("visium") +g <- GiottoData::loadGiottoMini("visium", verbose = FALSE) dimCellPlot(g, cell_annotation_values = "leiden_clus") } diff --git a/man/dimFeatPlot2D.Rd b/man/dimFeatPlot2D.Rd index e3a1753..935e4d0 100644 --- a/man/dimFeatPlot2D.Rd +++ b/man/dimFeatPlot2D.Rd @@ -142,7 +142,7 @@ coordinates Description of parameters. } \examples{ -g <- GiottoData::loadGiottoMini("visium") +g <- GiottoData::loadGiottoMini("visium", verbose = FALSE) dimFeatPlot2D(g, feats = c("Gna12", "Ccnd2", "Btbd17")) } diff --git a/man/dimPlot.Rd b/man/dimPlot.Rd index 667e3b1..033cd18 100644 --- a/man/dimPlot.Rd +++ b/man/dimPlot.Rd @@ -234,9 +234,9 @@ plotly (dimplot3D only) Visualize cells according to dimension reduction coordinates } \examples{ -g <- GiottoData::loadGiottoMini("visium") +g <- GiottoData::loadGiottoMini("visium", verbose = FALSE) dimPlot2D(g) -g <- GiottoData::loadGiottoMini("visium") +g <- GiottoData::loadGiottoMini("visium", verbose = FALSE) dimPlot(g) } \seealso{ diff --git a/man/plotHeatmap.Rd b/man/plotHeatmap.Rd index d28a6de..5868711 100644 --- a/man/plotHeatmap.Rd +++ b/man/plotHeatmap.Rd @@ -118,7 +118,7 @@ If you want to display many features there are 2 ways to proceed: } } \examples{ -g <- GiottoData::loadGiottoMini("visium") +g <- GiottoData::loadGiottoMini("visium", verbose = FALSE) plotHeatmap(g, feats = c("Gm19935", "Gna12", "Ccnd2", "Btbd17"), cluster_column = "leiden_clus") diff --git a/man/plotMetaDataHeatmap.Rd b/man/plotMetaDataHeatmap.Rd index dd0f72a..d595c67 100644 --- a/man/plotMetaDataHeatmap.Rd +++ b/man/plotMetaDataHeatmap.Rd @@ -123,7 +123,7 @@ is by default on the z-scores. Other options are the original values or z-scores rescaled per feature (-1 to 1). } \examples{ -g <- GiottoData::loadGiottoMini("visium") +g <- GiottoData::loadGiottoMini("visium", verbose = FALSE) plotMetaDataHeatmap(g, metadata_cols = "leiden_clus", selected_feats = c("Gna12", "Ccnd2", "Btbd17", "Gm19935")) diff --git a/man/plotPCA.Rd b/man/plotPCA.Rd index 2d2c678..0d54342 100644 --- a/man/plotPCA.Rd +++ b/man/plotPCA.Rd @@ -89,7 +89,7 @@ Description of parameters, see \code{\link{dimPlot2D}}. For 3D plots see \code{\link{plotPCA_3D}} } \examples{ -g <- GiottoData::loadGiottoMini("visium") +g <- GiottoData::loadGiottoMini("visium", verbose = FALSE) plotPCA(g) } diff --git a/man/plotPCA_2D.Rd b/man/plotPCA_2D.Rd index f0591a9..ef0a6f2 100644 --- a/man/plotPCA_2D.Rd +++ b/man/plotPCA_2D.Rd @@ -94,7 +94,7 @@ Description of parameters, see \code{\link{dimPlot2D}}. For 3D plots see \code{\link{plotPCA_3D}} } \examples{ -g <- GiottoData::loadGiottoMini("visium") +g <- GiottoData::loadGiottoMini("visium", verbose = FALSE) plotPCA_2D(g) } diff --git a/man/plotTSNE.Rd b/man/plotTSNE.Rd index 3e9afa7..ea5ec02 100644 --- a/man/plotTSNE.Rd +++ b/man/plotTSNE.Rd @@ -89,7 +89,7 @@ Description of parameters, see \code{\link{dimPlot2D}}. For 3D plots see \code{\link{plotTSNE_3D}} } \examples{ -g <- GiottoData::loadGiottoMini("visium") +g <- GiottoData::loadGiottoMini("visium", verbose = FALSE) plotTSNE(g) } diff --git a/man/plotTSNE_2D.Rd b/man/plotTSNE_2D.Rd index 7c1f2bf..58ca03e 100644 --- a/man/plotTSNE_2D.Rd +++ b/man/plotTSNE_2D.Rd @@ -94,7 +94,7 @@ Description of parameters, see \code{\link{dimPlot2D}}. For 3D plots see \code{\link{plotTSNE_3D}} } \examples{ -g <- GiottoData::loadGiottoMini("visium") +g <- GiottoData::loadGiottoMini("visium", verbose = FALSE) plotTSNE_2D(g) } diff --git a/man/plotUMAP.Rd b/man/plotUMAP.Rd index aae42a9..50a4fb8 100644 --- a/man/plotUMAP.Rd +++ b/man/plotUMAP.Rd @@ -85,7 +85,7 @@ ggplot Short wrapper for UMAP visualization } \examples{ -g <- GiottoData::loadGiottoMini("visium") +g <- GiottoData::loadGiottoMini("visium", verbose = FALSE) plotUMAP(g) } diff --git a/man/plotUMAP_2D.Rd b/man/plotUMAP_2D.Rd index 6674726..e1150c3 100644 --- a/man/plotUMAP_2D.Rd +++ b/man/plotUMAP_2D.Rd @@ -94,7 +94,7 @@ Description of parameters, see \code{\link{dimPlot2D}}. For 3D plots see \code{\link{plotUMAP_3D}} } \examples{ -g <- GiottoData::loadGiottoMini("visium") +g <- GiottoData::loadGiottoMini("visium", verbose = FALSE) plotUMAP_2D(g) } \seealso{ diff --git a/man/plotUMAP_3D.Rd b/man/plotUMAP_3D.Rd index a10e961..9d93fca 100644 --- a/man/plotUMAP_3D.Rd +++ b/man/plotUMAP_3D.Rd @@ -68,7 +68,7 @@ Description of parameters. } \examples{ g <- GiottoData::loadGiottoMini("starmap") -plotUMAP_3D(g) +plotUMAP_3D(g, dim_reduction_name = "3D_umap") } \seealso{ diff --git a/man/plotly_grid.Rd b/man/plotly_grid.Rd index 6107166..1bf6328 100644 --- a/man/plotly_grid.Rd +++ b/man/plotly_grid.Rd @@ -30,7 +30,7 @@ edges in spatial grid as data.table() provide grid segment to draw in plot_ly() } \examples{ -g <- GiottoData::loadGiottoMini("visium") +g <- GiottoData::loadGiottoMini("visium", verbose = FALSE) library(GiottoClass) g <- createSpatialGrid(gobject = g, diff --git a/man/showClusterDendrogram.Rd b/man/showClusterDendrogram.Rd index 6801566..91cedfd 100644 --- a/man/showClusterDendrogram.Rd +++ b/man/showClusterDendrogram.Rd @@ -83,7 +83,7 @@ Creates dendrogram for selected clusters. Expression correlation dendrogram for selected clusters. } \examples{ -g <- GiottoData::loadGiottoMini("visium") +g <- GiottoData::loadGiottoMini("visium", verbose = FALSE) showClusterDendrogram(g, cluster_column = "leiden_clus") } diff --git a/man/showClusterHeatmap.Rd b/man/showClusterHeatmap.Rd index 3c0e494..3c56b42 100644 --- a/man/showClusterHeatmap.Rd +++ b/man/showClusterHeatmap.Rd @@ -152,7 +152,7 @@ Creates heatmap based on identified clusters Correlation heatmap of selected clusters. } \examples{ -g <- GiottoData::loadGiottoMini("visium") +g <- GiottoData::loadGiottoMini("visium", verbose = FALSE) showClusterHeatmap(g, cluster_column = "leiden_clus") } diff --git a/man/spatCellPlot.Rd b/man/spatCellPlot.Rd index 45bd5c4..1808ef3 100644 --- a/man/spatCellPlot.Rd +++ b/man/spatCellPlot.Rd @@ -212,10 +212,10 @@ Visualize cells according to spatial coordinates Description of parameters. } \examples{ -g <- GiottoData::loadGiottoMini("visium") +g <- GiottoData::loadGiottoMini("visium", verbose = FALSE) spatCellPlot2D(g, cell_annotation_values = "leiden_clus") -g <- GiottoData::loadGiottoMini("visium") +g <- GiottoData::loadGiottoMini("visium", verbose = FALSE) spatCellPlot(g, cell_annotation_values = "leiden_clus") } diff --git a/man/spatDimCellPlot.Rd b/man/spatDimCellPlot.Rd index ca09818..ac56647 100644 --- a/man/spatDimCellPlot.Rd +++ b/man/spatDimCellPlot.Rd @@ -116,7 +116,7 @@ AND dimension reduction coordinates in 2D Description of parameters. } \examples{ -g <- GiottoData::loadGiottoMini("visium") +g <- GiottoData::loadGiottoMini("visium", verbose = FALSE) spatDimCellPlot(g, cell_annotation_values = "leiden_clus") } diff --git a/man/spatDimCellPlot2D.Rd b/man/spatDimCellPlot2D.Rd index e9ffe69..4ed5957 100644 --- a/man/spatDimCellPlot2D.Rd +++ b/man/spatDimCellPlot2D.Rd @@ -276,7 +276,7 @@ AND dimension reduction coordinates in 2D Description of parameters. } \examples{ -g <- GiottoData::loadGiottoMini("visium") +g <- GiottoData::loadGiottoMini("visium", verbose = FALSE) spatDimCellPlot2D(g, cell_annotation_values = "leiden_clus") } diff --git a/man/spatDimFeatPlot2D.Rd b/man/spatDimFeatPlot2D.Rd index 07e3510..a4f4288 100644 --- a/man/spatDimFeatPlot2D.Rd +++ b/man/spatDimFeatPlot2D.Rd @@ -214,7 +214,7 @@ coordinates in ggplot mode Description of parameters. } \examples{ -g <- GiottoData::loadGiottoMini("visium") +g <- GiottoData::loadGiottoMini("visium", verbose = FALSE) spatDimFeatPlot2D(g, feats = c("Gna12", "Ccnd2", "Btbd17")) } diff --git a/man/spatDimPlot.Rd b/man/spatDimPlot.Rd index 1ad271b..5079ceb 100644 --- a/man/spatDimPlot.Rd +++ b/man/spatDimPlot.Rd @@ -280,10 +280,10 @@ coordinates 2D Description of parameters. } \examples{ -g <- GiottoData::loadGiottoMini("visium") +g <- GiottoData::loadGiottoMini("visium", verbose = FALSE) spatDimPlot2D(g) -g <- GiottoData::loadGiottoMini("visium") +g <- GiottoData::loadGiottoMini("visium", verbose = FALSE) spatDimPlot(g) } diff --git a/man/spatFeatPlot2D.Rd b/man/spatFeatPlot2D.Rd index 7676ef3..44f132a 100644 --- a/man/spatFeatPlot2D.Rd +++ b/man/spatFeatPlot2D.Rd @@ -180,7 +180,7 @@ spatial coordinates Description of parameters. } \examples{ -g <- GiottoData::loadGiottoMini("visium") +g <- GiottoData::loadGiottoMini("visium", verbose = FALSE) spatFeatPlot2D(g, feats = "Gna12") } diff --git a/man/spatFeatPlot2D_single.Rd b/man/spatFeatPlot2D_single.Rd index 5534e8a..328c1c5 100644 --- a/man/spatFeatPlot2D_single.Rd +++ b/man/spatFeatPlot2D_single.Rd @@ -177,7 +177,7 @@ spatial coordinates Description of parameters. } \examples{ -g <- GiottoData::loadGiottoMini("visium") +g <- GiottoData::loadGiottoMini("visium", verbose = FALSE) spatFeatPlot2D_single(g, feats = c("Gna12", "Ccnd2", "Btbd17")) } diff --git a/man/spatPlot.Rd b/man/spatPlot.Rd index fc8b451..f453ba0 100644 --- a/man/spatPlot.Rd +++ b/man/spatPlot.Rd @@ -306,6 +306,15 @@ spatPlot2D(g, color_as_factor = FALSE, gradient_style = "sequential" ) + + +# load another dataset with 3D data +starmap <- GiottoData::loadGiottoData("starmap", verbose = FALSE) + +# default is to rescale plot as a 3D cube +spatPlot3D(starmap, cell_color = "leiden_clus") +# real scaling +spatPlot3D(g, cell_color = "leiden_clus", axis_scale = "real") } \seealso{ \code{\link{spatPlot3D}} diff --git a/man/violinPlot.Rd b/man/violinPlot.Rd index 7d0abb6..292d1fd 100644 --- a/man/violinPlot.Rd +++ b/man/violinPlot.Rd @@ -74,7 +74,7 @@ ggplot Creates violinplot for selected clusters } \examples{ -g <- GiottoData::loadGiottoMini("visium") +g <- GiottoData::loadGiottoMini("visium", verbose = FALSE) violinPlot(g, feats = c("Gna12", "Ccnd2", "Btbd17"), cluster_column = "leiden_clus")