Run Giotto as a temporary backend for nearest-network clustering and return
the complete Giotto object together with extracted cluster results. The input
Seurat object is not modified.
Usage
RunGiottoCluster(
srt,
assay = NULL,
layer = "data",
features = NULL,
image = NULL,
coord.cols = c("x", "y"),
method = c("leiden", "louvain"),
dims = 1:20,
k = 20,
resolution = 1,
cluster_colname = "Giotto_cluster",
tool_name = "GiottoCluster",
store_giotto = TRUE,
conversion_params = list(),
preprocess_params = list(),
network_params = list(),
cluster_params = list(),
verbose = TRUE,
seed = 11
)Arguments
- srt
A Seurat object.
- assay
Which assay to use. If
NULL, the default assay of the Seurat object will be used. When the object also containsChromatinAssay, the default assay and additionalChromatinAssaywill be preprocessed sequentially.- layer
Assay layer used as the expression matrix.
- features
Features used for PCA and clustering. If
NULL, current variable features are used, falling back to all assay features.- image
Name of the Seurat spatial image used by the spatial workflow. If
NULL, the first image is used when present.- coord.cols
Metadata coordinate columns used by the spatial workflow when no image is available.
- method
Giotto clustering method.
- dims
Dimensions used to build the Giotto nearest-neighbor network.
- k
Number of nearest neighbors used by Giotto.
- resolution
Resolution passed to Giotto clustering.
- cluster_colname
Result column name recorded in returned parameters. This function does not write to
srt@meta.data.- tool_name
Result name recorded in returned parameters. This function does not write to
srt@tools.- store_giotto
Deprecated compatibility argument. The complete Giotto object is always returned in the
giottoelement.- conversion_params
Additional parameters passed to
Giotto::createGiottoObject().- preprocess_params
Additional parameters passed to
Giotto::runPCA().- network_params
Additional parameters passed to
Giotto::createNearestNetwork().- cluster_params
Additional parameters passed to Giotto clustering.
- verbose
Whether to print the message. Default is
TRUE.- seed
Random seed for reproducibility. Default is
11.
Value
A giotto2_result list containing the full Giotto object,
cluster assignments, Giotto metadata, parameters, features, and cells.
Examples
data(visium_human_pancreas_sub)
spatial <- visium_human_pancreas_sub
giotto_clusters <- list(
clusters = data.frame(
cluster = paste0("cluster_", (seq_len(ncol(spatial)) - 1) %% 3 + 1),
row.names = colnames(spatial)
),
parameters = list(
cluster_colname = "Giotto_cluster",
coord.cols = c("x", "y"),
k = 8,
resolution = 0.4
)
)
class(giotto_clusters) <- c("giotto2_cluster", "giotto2_result", "list")
head(giotto_clusters$clusters)
#> cluster
#> TGGTATCGGTCTGTAT-1 cluster_1
#> ATTATCTCGACAGATC-1 cluster_2
#> TGAGATCAAATACTCA-1 cluster_3
#> CTGGTCCTAACTTGGC-1 cluster_1
#> ATAGTCTTTGACGTGC-1 cluster_2
#> GGGTGGTCCAGCCTGT-1 cluster_3
GiottoPlot(
giotto_clusters,
srt = spatial,
overlay_image = FALSE,
coord.cols = c("x", "y")
)
if (
isTRUE(check_r("giotto-suite/Giotto", verbose = FALSE))
) {
spatial <- Seurat::NormalizeData(spatial, assay = "Spatial", verbose = FALSE)
spatial <- Seurat::FindVariableFeatures(
spatial,
assay = "Spatial",
nfeatures = 300,
verbose = FALSE
)
giotto_clusters <- RunGiottoCluster(
spatial,
assay = "Spatial",
layer = "data",
dims = 1:10,
k = 8,
resolution = 0.4,
coord.cols = c("x", "y")
)
head(giotto_clusters$clusters)
}
#> Error in check_r("giotto-suite/Giotto", verbose = FALSE): could not find function "check_r"