From 8078963eaca44d1ea4428273fc455788496deace Mon Sep 17 00:00:00 2001 From: George Chen <72078254+jiajic@users.noreply.github.com> Date: Wed, 22 May 2024 17:38:26 -0400 Subject: [PATCH] chore: document `detectSpatialCorFeats()` and `detectSpatialCorFeatsMatrix()` together --- NAMESPACE | 1 - R/spatial_genes.R | 268 ++++++++++++++--------------- man/detectSpatialCorFeats.Rd | 71 ++++++-- man/detectSpatialCorFeatsMatrix.Rd | 73 -------- man/detectSpatialCorGenes.Rd | 74 -------- 5 files changed, 183 insertions(+), 304 deletions(-) delete mode 100644 man/detectSpatialCorFeatsMatrix.Rd delete mode 100644 man/detectSpatialCorGenes.Rd diff --git a/NAMESPACE b/NAMESPACE index 02aa123e7..bbe6fefac 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -151,7 +151,6 @@ export(crossSectionPlot) export(crossSectionPlot3D) export(detectSpatialCorFeats) export(detectSpatialCorFeatsMatrix) -export(detectSpatialCorGenes) export(detectSpatialPatterns) export(dimCellPlot) export(dimCellPlot2D) diff --git a/R/spatial_genes.R b/R/spatial_genes.R index 7b97c9aa7..bcfadc3c7 100644 --- a/R/spatial_genes.R +++ b/R/spatial_genes.R @@ -3228,16 +3228,25 @@ do_spatial_grid_averaging <- function(expression_matrix, -#' @title detectSpatialCorFeatsMatrix -#' @name detectSpatialCorFeatsMatrix -#' @description Detect genes that are spatially correlated +#' @title Detect spatially correlated features +#' @name detectSpatialCorFeats +#' @description Detect features that are spatially correlated. Functions for +#' starting from either a gobject (`detectSpatialCorFeats()`) or individual +#' pieces of data (`detectSpatialCorFeatsMatrix()`) are provided. +#' @param gobject giotto object +#' @param spat_unit spatial unit +#' @param feat_type feature type +#' @param expression_values gene expression values to use #' @param expression_matrix provided expression matrix -#' @param method method to use for spatial averaging +#' @param spat_loc_name name for spatial locations +#' @param spatial_locs provided spatial locations +#' @param spatial_network_name name of spatial network to use #' @param spatial_network provided spatial network +#' @param spatial_grid_name name of spatial grid to use #' @param spatial_grid provided spatial grid -#' @param spatial_locs provided spatial locations +#' @param method method to use for spatial averaging #' @param subset_feats subset of features to use -#' @param network_smoothing smoothing factor beteen 0 and 1 +#' @param network_smoothing smoothing factor between 0 and 1 #' (has automatic default, see details) #' @param min_cells_per_grid minimum number of cells to consider a grid #' @param cor_method correlation method @@ -3257,25 +3266,54 @@ do_spatial_grid_averaging <- function(expression_matrix, #' Setting \eqn{b = 0} means no smoothing and \eqn{b = 1} means no #' contribution from its own expression. #' -#' The `spatCorObject` can be further explored with `showSpatialCorGenes()` +#' The `spatCorObject` can be further explored with `showSpatialCorFeats()` #' @seealso \code{\link{showSpatialCorFeats}} #' @md #' @examples #' g <- GiottoData::loadGiottoMini("visium") #' -#' detectSpatialCorFeatsMatrix(expression_matrix = getExpression( -#' g, output = "matrix"), method = "network", -#' spatial_network = getSpatialNetwork(g, output = "networkDT")) +#' # Perform with data in a gobject +#' detectSpatialCorFeats(g, method = "network") +#' +#' # This analysis can also be performed with data outside of the gobject +#' detectSpatialCorFeatsMatrix( +#' expression_matrix = getExpression( +#' g, output = "matrix"), +#' method = "network", +#' spatial_network = getSpatialNetwork(g, output = "networkDT") +#' ) +#' +NULL + + + +#' @rdname detectSpatialCorFeats #' @export -detectSpatialCorFeatsMatrix <- function(expression_matrix, - method = c("grid", "network"), - spatial_network, - spatial_grid, - spatial_locs, - subset_feats = NULL, - network_smoothing = NULL, - min_cells_per_grid = 4, - cor_method = c("pearson", "kendall", "spearman")) { +detectSpatialCorFeats <- function( + gobject, + spat_unit = NULL, + feat_type = NULL, + spat_loc_name = "raw", + method = c("grid", "network"), + expression_values = c("normalized", "scaled", "custom"), + subset_feats = NULL, + spatial_network_name = "Delaunay_network", + network_smoothing = NULL, + spatial_grid_name = "spatial_grid", + min_cells_per_grid = 4, + cor_method = c("pearson", "kendall", "spearman") +) { + # set default spat_unit and feat_type + spat_unit <- set_default_spat_unit( + gobject = gobject, + spat_unit = spat_unit + ) + feat_type <- set_default_feat_type( + gobject = gobject, + spat_unit = spat_unit, + feat_type = feat_type + ) + ## correlation method to be used cor_method <- match.arg( cor_method, choices = c("pearson", "kendall", "spearman")) @@ -3283,10 +3321,46 @@ detectSpatialCorFeatsMatrix <- function(expression_matrix, ## method to be used method <- match.arg(method, choices = c("grid", "network")) + # get expression matrix + values <- match.arg( + expression_values, + unique(c("normalized", "scaled", "custom", expression_values))) + expr_values <- getExpression( + gobject = gobject, + spat_unit = spat_unit, + feat_type = feat_type, + values = values, + output = "matrix" + ) + + if (!is.null(subset_feats)) { + expr_values <- expr_values[rownames(expr_values) %in% subset_feats, ] + } + + + + # get spatial locations + spatial_locs <- getSpatialLocations( + gobject, + spat_unit = spat_unit, + name = spat_loc_name, + output = "data.table", + copy_obj = TRUE + ) + ## spatial averaging or smoothing if (method == "grid") { + # get spatial grid + spatial_grid <- getSpatialGrid( + gobject = gobject, + spat_unit = spat_unit, + feat_type = feat_type, + name = spatial_grid_name, + return_grid_Obj = FALSE + ) + loc_av_expr_matrix <- do_spatial_grid_averaging( - expression_matrix = as.matrix(expression_matrix), + expression_matrix = as.matrix(expr_values), spatial_grid = spatial_grid, spatial_locs = spatial_locs, subset_feats = subset_feats, @@ -3296,8 +3370,8 @@ detectSpatialCorFeatsMatrix <- function(expression_matrix, # data.table variables feat_ID <- variable <- NULL - cor_spat_matrix <- cor_flex(t_flex( - as.matrix(loc_av_expr_matrix)), method = cor_method) + cor_spat_matrix <- cor_flex(t_flex(as.matrix( + loc_av_expr_matrix)), method = cor_method) cor_spat_matrixDT <- data.table::as.data.table(cor_spat_matrix) cor_spat_matrixDT[, feat_ID := rownames(cor_spat_matrix)] cor_spat_DT <- data.table::melt.data.table( @@ -3307,8 +3381,16 @@ detectSpatialCorFeatsMatrix <- function(expression_matrix, } if (method == "network") { + # get spatial network + spatial_network <- getSpatialNetwork( + gobject = gobject, + spat_unit = spat_unit, + name = spatial_network_name, + output = "networkDT" + ) + knn_av_expr_matrix <- do_spatial_knn_smoothing( - expression_matrix = as.matrix(expression_matrix), + expression_matrix = as.matrix(expr_values), spatial_network = spatial_network, subset_feats = subset_feats, b = network_smoothing @@ -3316,6 +3398,7 @@ detectSpatialCorFeatsMatrix <- function(expression_matrix, + cor_spat_matrix <- cor_flex(t_flex(as.matrix( knn_av_expr_matrix)), method = cor_method) cor_spat_matrixDT <- data.table::as.data.table(cor_spat_matrix) @@ -3333,13 +3416,6 @@ detectSpatialCorFeatsMatrix <- function(expression_matrix, ## 2. perform expression correlation at single-cell level without ## spatial information - - # matrix - expr_values <- expression_matrix - if (!is.null(subset_feats)) { - expr_values <- expr_values[rownames(expr_values) %in% subset_feats, ] - } - cor_matrix <- cor_flex(t_flex(expr_values), method = cor_method) cor_matrixDT <- data.table::as.data.table(cor_matrix) cor_matrixDT[, feat_ID := rownames(cor_matrix)] @@ -3357,9 +3433,9 @@ detectSpatialCorFeatsMatrix <- function(expression_matrix, doubleDT[, cordiff := spat_cor - expr_cor] # difference in rank scores - doubleDT[, spatrank := data.table::frank( + doubleDT[, spatrank := frank( -spat_cor, ties.method = "first"), by = feat_ID] - doubleDT[, exprrank := data.table::frank( + doubleDT[, exprrank := frank( -expr_cor, ties.method = "first"), by = feat_ID] doubleDT[, rankdiff := spatrank - exprrank] @@ -3373,73 +3449,23 @@ detectSpatialCorFeatsMatrix <- function(expression_matrix, cor_clusters = list() ) - class(spatCorObject) <- append(class(spatCorObject), "spatCorObject") + class(spatCorObject) <- append("spatCorObject", class(spatCorObject)) return(spatCorObject) } - -#' @title detectSpatialCorFeats -#' @name detectSpatialCorFeats -#' @description Detect features that are spatially correlated -#' @param gobject giotto object -#' @param spat_unit spatial unit -#' @param feat_type feature type -#' @param spat_loc_name name for spatial locations -#' @param method method to use for spatial averaging -#' @param expression_values gene expression values to use -#' @param subset_feats subset of feats to use -#' @param spatial_network_name name of spatial network to use -#' @param network_smoothing smoothing factor beteen 0 and 1 -#' (default: automatic) -#' @param spatial_grid_name name of spatial grid to use -#' @param min_cells_per_grid minimum number of cells to consider a grid -#' @param cor_method correlation method -#' @returns returns a spatial correlation object: "spatCorObject" -#' @details -#' For method = network, it expects a fully connected spatial network. You -#' can make sure to create a -#' fully connected network by setting minimal_k > 0 in the -#' \code{\link{createSpatialNetwork}} function. -#' \itemize{ -#' \item{1. grid-averaging: }{average gene expression values within a predefined spatial grid} -#' \item{2. network-averaging: }{smoothens the gene expression matrix by averaging the expression within one cell -#' by using the neighbours within the predefined spatial network. b is a smoothening factor -#' that defaults to 1 - 1/k, where k is the median number of k-neighbors in the -#' selected spatial network. Setting b = 0 means no smoothing and b = 1 means no contribution -#' from its own expression.} -#' } -#' The spatCorObject can be further explored with showSpatialCorFeats() -#' @seealso \code{\link{showSpatialCorFeats}} -#' @examples -#' g <- GiottoData::loadGiottoMini("visium") -#' -#' detectSpatialCorFeats(g, method = "network") +#' @rdname detectSpatialCorFeats #' @export -detectSpatialCorFeats <- function(gobject, - spat_unit = NULL, - feat_type = NULL, - spat_loc_name = "raw", +detectSpatialCorFeatsMatrix <- function(expression_matrix, method = c("grid", "network"), - expression_values = c("normalized", "scaled", "custom"), + spatial_network, + spatial_grid, + spatial_locs, subset_feats = NULL, - spatial_network_name = "Delaunay_network", network_smoothing = NULL, - spatial_grid_name = "spatial_grid", min_cells_per_grid = 4, cor_method = c("pearson", "kendall", "spearman")) { - # set default spat_unit and feat_type - spat_unit <- set_default_spat_unit( - gobject = gobject, - spat_unit = spat_unit - ) - feat_type <- set_default_feat_type( - gobject = gobject, - spat_unit = spat_unit, - feat_type = feat_type - ) - ## correlation method to be used cor_method <- match.arg( cor_method, choices = c("pearson", "kendall", "spearman")) @@ -3447,45 +3473,10 @@ detectSpatialCorFeats <- function(gobject, ## method to be used method <- match.arg(method, choices = c("grid", "network")) - # get expression matrix - values <- match.arg( - expression_values, - unique(c("normalized", "scaled", "custom", expression_values))) - expr_values <- getExpression( - gobject = gobject, - spat_unit = spat_unit, - feat_type = feat_type, - values = values, - output = "matrix" - ) - - if (!is.null(subset_feats)) { - expr_values <- expr_values[rownames(expr_values) %in% subset_feats, ] - } - - - - # get spatial locations - spatial_locs <- getSpatialLocations(gobject, - spat_unit = spat_unit, - name = spat_loc_name, - output = "data.table", - copy_obj = TRUE - ) - ## spatial averaging or smoothing if (method == "grid") { - # get spatial grid - spatial_grid <- getSpatialGrid( - gobject = gobject, - spat_unit = spat_unit, - feat_type = feat_type, - name = spatial_grid_name, - return_grid_Obj = FALSE - ) - loc_av_expr_matrix <- do_spatial_grid_averaging( - expression_matrix = as.matrix(expr_values), + expression_matrix = as.matrix(expression_matrix), spatial_grid = spatial_grid, spatial_locs = spatial_locs, subset_feats = subset_feats, @@ -3495,8 +3486,8 @@ detectSpatialCorFeats <- function(gobject, # data.table variables feat_ID <- variable <- NULL - cor_spat_matrix <- cor_flex(t_flex(as.matrix( - loc_av_expr_matrix)), method = cor_method) + cor_spat_matrix <- cor_flex(t_flex( + as.matrix(loc_av_expr_matrix)), method = cor_method) cor_spat_matrixDT <- data.table::as.data.table(cor_spat_matrix) cor_spat_matrixDT[, feat_ID := rownames(cor_spat_matrix)] cor_spat_DT <- data.table::melt.data.table( @@ -3506,16 +3497,8 @@ detectSpatialCorFeats <- function(gobject, } if (method == "network") { - # get spatial network - spatial_network <- getSpatialNetwork( - gobject = gobject, - spat_unit = spat_unit, - name = spatial_network_name, - output = "networkDT" - ) - knn_av_expr_matrix <- do_spatial_knn_smoothing( - expression_matrix = as.matrix(expr_values), + expression_matrix = as.matrix(expression_matrix), spatial_network = spatial_network, subset_feats = subset_feats, b = network_smoothing @@ -3523,7 +3506,6 @@ detectSpatialCorFeats <- function(gobject, - cor_spat_matrix <- cor_flex(t_flex(as.matrix( knn_av_expr_matrix)), method = cor_method) cor_spat_matrixDT <- data.table::as.data.table(cor_spat_matrix) @@ -3541,6 +3523,13 @@ detectSpatialCorFeats <- function(gobject, ## 2. perform expression correlation at single-cell level without ## spatial information + + # matrix + expr_values <- expression_matrix + if (!is.null(subset_feats)) { + expr_values <- expr_values[rownames(expr_values) %in% subset_feats, ] + } + cor_matrix <- cor_flex(t_flex(expr_values), method = cor_method) cor_matrixDT <- data.table::as.data.table(cor_matrix) cor_matrixDT[, feat_ID := rownames(cor_matrix)] @@ -3558,9 +3547,9 @@ detectSpatialCorFeats <- function(gobject, doubleDT[, cordiff := spat_cor - expr_cor] # difference in rank scores - doubleDT[, spatrank := frank( + doubleDT[, spatrank := data.table::frank( -spat_cor, ties.method = "first"), by = feat_ID] - doubleDT[, exprrank := frank( + doubleDT[, exprrank := data.table::frank( -expr_cor, ties.method = "first"), by = feat_ID] doubleDT[, rankdiff := spatrank - exprrank] @@ -3574,7 +3563,7 @@ detectSpatialCorFeats <- function(gobject, cor_clusters = list() ) - class(spatCorObject) <- append("spatCorObject", class(spatCorObject)) + class(spatCorObject) <- append(class(spatCorObject), "spatCorObject") return(spatCorObject) } @@ -3583,6 +3572,7 @@ detectSpatialCorFeats <- function(gobject, + #' @title showSpatialCorFeats #' @name showSpatialCorFeats #' @description Shows and filters spatially correlated features diff --git a/man/detectSpatialCorFeats.Rd b/man/detectSpatialCorFeats.Rd index 4cba6edaf..834197249 100644 --- a/man/detectSpatialCorFeats.Rd +++ b/man/detectSpatialCorFeats.Rd @@ -2,7 +2,8 @@ % Please edit documentation in R/spatial_genes.R \name{detectSpatialCorFeats} \alias{detectSpatialCorFeats} -\title{detectSpatialCorFeats} +\alias{detectSpatialCorFeatsMatrix} +\title{Detect spatially correlated features} \usage{ detectSpatialCorFeats( gobject, @@ -18,6 +19,18 @@ detectSpatialCorFeats( min_cells_per_grid = 4, cor_method = c("pearson", "kendall", "spearman") ) + +detectSpatialCorFeatsMatrix( + expression_matrix, + method = c("grid", "network"), + spatial_network, + spatial_grid, + spatial_locs, + subset_feats = NULL, + network_smoothing = NULL, + min_cells_per_grid = 4, + cor_method = c("pearson", "kendall", "spearman") +) } \arguments{ \item{gobject}{giotto object} @@ -32,44 +45,68 @@ detectSpatialCorFeats( \item{expression_values}{gene expression values to use} -\item{subset_feats}{subset of feats to use} +\item{subset_feats}{subset of features to use} \item{spatial_network_name}{name of spatial network to use} -\item{network_smoothing}{smoothing factor beteen 0 and 1 -(default: automatic)} +\item{network_smoothing}{smoothing factor between 0 and 1 +(has automatic default, see details)} \item{spatial_grid_name}{name of spatial grid to use} \item{min_cells_per_grid}{minimum number of cells to consider a grid} \item{cor_method}{correlation method} + +\item{expression_matrix}{provided expression matrix} + +\item{spatial_network}{provided spatial network} + +\item{spatial_grid}{provided spatial grid} + +\item{spatial_locs}{provided spatial locations} } \value{ -returns a spatial correlation object: "spatCorObject" +returns a spatial correlation object: \code{spatCorObject} } \description{ -Detect features that are spatially correlated +Detect features that are spatially correlated. Functions for +starting from either a gobject (\code{detectSpatialCorFeats()}) or individual +pieces of data (\code{detectSpatialCorFeatsMatrix()}) are provided. } \details{ -For method = network, it expects a fully connected spatial network. You -can make sure to create a +For \code{method = network}, it expects a fully connected spatial network. +You can make sure to create a fully connected network by setting minimal_k > 0 in the - \code{\link{createSpatialNetwork}} function. -\itemize{ - \item{1. grid-averaging: }{average gene expression values within a predefined spatial grid} - \item{2. network-averaging: }{smoothens the gene expression matrix by averaging the expression within one cell - by using the neighbours within the predefined spatial network. b is a smoothening factor - that defaults to 1 - 1/k, where k is the median number of k-neighbors in the - selected spatial network. Setting b = 0 means no smoothing and b = 1 means no contribution - from its own expression.} +\code{\link{createSpatialNetwork}} function. +\enumerate{ +\item \strong{grid-averaging:} average gene expression values within a predefined +spatial grid +\item \strong{network-averaging:} smoothens the gene expression matrix by +averaging the expression within one cell by using the neighbours within +the predefined spatial network. \eqn{b} is a smoothening factor passed by +\code{network_smoothing} param that defaults to \eqn{1 - 1/k}, where \eqn{k} +is the median number of k-neighbors in the selected spatial network. +Setting \eqn{b = 0} means no smoothing and \eqn{b = 1} means no +contribution from its own expression. } -The spatCorObject can be further explored with showSpatialCorFeats() + +The \code{spatCorObject} can be further explored with \code{showSpatialCorFeats()} } \examples{ g <- GiottoData::loadGiottoMini("visium") +# Perform with data in a gobject detectSpatialCorFeats(g, method = "network") + +# This analysis can also be performed with data outside of the gobject +detectSpatialCorFeatsMatrix( + expression_matrix = getExpression( + g, output = "matrix"), + method = "network", + spatial_network = getSpatialNetwork(g, output = "networkDT") +) + } \seealso{ \code{\link{showSpatialCorFeats}} diff --git a/man/detectSpatialCorFeatsMatrix.Rd b/man/detectSpatialCorFeatsMatrix.Rd deleted file mode 100644 index 515557f80..000000000 --- a/man/detectSpatialCorFeatsMatrix.Rd +++ /dev/null @@ -1,73 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/spatial_genes.R -\name{detectSpatialCorFeatsMatrix} -\alias{detectSpatialCorFeatsMatrix} -\title{detectSpatialCorFeatsMatrix} -\usage{ -detectSpatialCorFeatsMatrix( - expression_matrix, - method = c("grid", "network"), - spatial_network, - spatial_grid, - spatial_locs, - subset_feats = NULL, - network_smoothing = NULL, - min_cells_per_grid = 4, - cor_method = c("pearson", "kendall", "spearman") -) -} -\arguments{ -\item{expression_matrix}{provided expression matrix} - -\item{method}{method to use for spatial averaging} - -\item{spatial_network}{provided spatial network} - -\item{spatial_grid}{provided spatial grid} - -\item{spatial_locs}{provided spatial locations} - -\item{subset_feats}{subset of features to use} - -\item{network_smoothing}{smoothing factor beteen 0 and 1 -(has automatic default, see details)} - -\item{min_cells_per_grid}{minimum number of cells to consider a grid} - -\item{cor_method}{correlation method} -} -\value{ -returns a spatial correlation object: \code{spatCorObject} -} -\description{ -Detect genes that are spatially correlated -} -\details{ -For \code{method = network}, it expects a fully connected spatial network. -You can make sure to create a -fully connected network by setting minimal_k > 0 in the -\code{\link{createSpatialNetwork}} function. -\enumerate{ -\item \strong{grid-averaging:} average gene expression values within a predefined -spatial grid -\item \strong{network-averaging:} smoothens the gene expression matrix by -averaging the expression within one cell by using the neighbours within -the predefined spatial network. \eqn{b} is a smoothening factor passed by -\code{network_smoothing} param that defaults to \eqn{1 - 1/k}, where \eqn{k} -is the median number of k-neighbors in the selected spatial network. -Setting \eqn{b = 0} means no smoothing and \eqn{b = 1} means no -contribution from its own expression. -} - -The \code{spatCorObject} can be further explored with \code{showSpatialCorGenes()} -} -\examples{ -g <- GiottoData::loadGiottoMini("visium") - -detectSpatialCorFeatsMatrix(expression_matrix = getExpression( -g, output = "matrix"), method = "network", -spatial_network = getSpatialNetwork(g, output = "networkDT")) -} -\seealso{ -\code{\link{showSpatialCorFeats}} -} diff --git a/man/detectSpatialCorGenes.Rd b/man/detectSpatialCorGenes.Rd deleted file mode 100644 index 6c5a2ce6b..000000000 --- a/man/detectSpatialCorGenes.Rd +++ /dev/null @@ -1,74 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/spatial_genes.R -\name{detectSpatialCorGenes} -\alias{detectSpatialCorGenes} -\title{detectSpatialCorGenes} -\usage{ -detectSpatialCorGenes( - gobject, - feat_type = NULL, - spat_unit = NULL, - method = c("grid", "network"), - expression_values = c("normalized", "scaled", "custom"), - subset_feats = NULL, - subset_genes = NULL, - spatial_network_name = "Delaunay_network", - network_smoothing = NULL, - spatial_grid_name = "spatial_grid", - min_cells_per_grid = 4, - cor_method = c("pearson", "kendall", "spearman") -) -} -\arguments{ -\item{gobject}{giotto object} - -\item{feat_type}{feature type} - -\item{spat_unit}{spatial unit} - -\item{method}{method to use for spatial averaging} - -\item{expression_values}{gene expression values to use} - -\item{subset_feats}{subset of feats to use} - -\item{subset_genes}{deprecated, use \code{subset_feats}} - -\item{spatial_network_name}{name of spatial network to use} - -\item{network_smoothing}{smoothing factor beteen 0 and 1 -(default: automatic)} - -\item{spatial_grid_name}{name of spatial grid to use} - -\item{min_cells_per_grid}{minimum number of cells to consider a grid} - -\item{cor_method}{correlation method} -} -\value{ -returns a spatial correlation object: "spatCorObject" -} -\description{ -Detect genes that are spatially correlated -} -\details{ -For method = network, it expects a fully connected spatial network. You -can make sure to create a -fully connected network by setting minimal_k > 0 in the -\code{\link{createSpatialNetwork}} function. -\itemize{ - \item{1. grid-averaging: }{average gene expression values within a - predefined spatial grid} - \item{2. network-averaging: }{smoothens the gene expression matrix by - averaging the expression within one cell - by using the neighbours within the predefined spatial network. b is a - smoothening factor that defaults to 1 - 1/k, where k is the median - number of k-neighbors in the selected spatial network. Setting b = 0 - means no smoothing and b = 1 means no contribution - from its own expression.} -} -The spatCorObject can be further explored with showSpatialCorGenes() -} -\seealso{ -\code{\link{showSpatialCorGenes}} -}