diff --git a/404.html b/404.html index 102297b..22e680b 100644 --- a/404.html +++ b/404.html @@ -20,7 +20,7 @@ clustSIGNAL - 0.99.4 + 0.99.5 diff --git a/articles/clustSIGNAL.html b/articles/clustSIGNAL.html index 2b76d60..6711b12 100644 --- a/articles/clustSIGNAL.html +++ b/articles/clustSIGNAL.html @@ -20,7 +20,7 @@ clustSIGNAL - 0.99.4 + 0.99.5 @@ -151,16 +151,16 @@ Running clustSIGNAL on one samplesamples <- "sample_id" cells <- "uniqueID" res_emb <- clustSIGNAL(spe, samples, cells, outputs = "a") -## [1] "Calculating PCA. Time 00:32:08" -## [1] "clustSIGNAL run started. Time 00:32:09" -## [1] "Initial nonspatial clustering performed. Clusters = 11 Time 00:32:09" -## [1] "Nonspatial subclustering performed. Subclusters = 50 Time 00:32:12" -## [1] "Regions defined. Time 00:32:14" -## [1] "Region domainness calculated. Time 00:32:14" -## [1] "Smoothing performed. NN = 30 Kernel = G Spread = 0.05 Time 00:32:51" -## [1] "Nonspatial clustering performed on smoothed data. Clusters = 16 Time 00:32:53" -## [1] "clustSIGNAL run completed. 00:32:53" -## Time difference of 45.32507 secs +## [1] "Calculating PCA. Time 01:11:53" +## [1] "clustSIGNAL run started. Time 01:11:54" +## [1] "Initial nonspatial clustering performed. Clusters = 11 Time 01:11:55" +## [1] "Nonspatial subclustering performed. Subclusters = 50 Time 01:11:57" +## [1] "Regions defined. Time 01:11:59" +## [1] "Region domainness calculated. Time 01:12:00" +## [1] "Smoothing performed. NN = 30 Kernel = G Spread = 0.05 Time 01:12:33" +## [1] "Nonspatial clustering performed on smoothed data. Clusters = 16 Time 01:12:35" +## [1] "clustSIGNAL run completed. 01:12:35" +## Time difference of 41.1917 secs This returns a list that can contain a dataframe of cluster names, a matrix of cell labels from each region’s neighbourhood, a final SpatialExperiment object, or a combination of these, depending on the @@ -363,15 +363,15 @@ Generating entropy data onlyspe <- clustSIGNAL::p1_clustering(spe, dimRed = "PCA", batch = FALSE, batch_by = "None", clustParams = list( 0, 0, 30, 5, "louvain")) -## [1] "Initial nonspatial clustering performed. Clusters = 11 Time 00:33:02" -## [1] "Nonspatial subclustering performed. Subclusters = 50 Time 00:33:05" +## [1] "Initial nonspatial clustering performed. Clusters = 11 Time 01:12:44" +## [1] "Nonspatial subclustering performed. Subclusters = 50 Time 01:12:46" outReg <- clustSIGNAL::neighbourDetect(spe, samples = "sample_id", NN = 30, cells = "uniqueID", sort = TRUE) -## [1] "Regions defined. Time 00:33:07" +## [1] "Regions defined. Time 01:12:48" spe <- entropyMeasure(spe, cells = "uniqueID", outReg$regXclust, threads = 1) -## [1] "Region domainness calculated. Time 00:33:08" +## [1] "Region domainness calculated. Time 01:12:48" head(spe$entropy) ## [1] 1.03701 0.42003 0.62749 0.76651 0.56651 0.21084 @@ -433,16 +433,16 @@ clustSIGNAL runsamples <- "samples" cells <- "Cell_ID" res_hyp <- clustSIGNAL(spe2, samples, cells, threads = 4, outputs = "a") -## [1] "Calculating PCA. Time 00:33:08" -## [1] "clustSIGNAL run started. Time 00:33:08" -## [1] "Initial nonspatial clustering performed. Clusters = 11 Time 00:33:09" -## [1] "Nonspatial subclustering performed. Subclusters = 52 Time 00:33:11" -## [1] "Regions defined. Time 00:33:14" -## [1] "Region domainness calculated. Time 00:33:16" -## [1] "Smoothing performed. NN = 30 Kernel = G Spread = 0.05 Time 00:33:33" -## [1] "Nonspatial clustering performed on smoothed data. Clusters = 11 Time 00:33:35" -## [1] "clustSIGNAL run completed. 00:33:35" -## Time difference of 26.87564 secs +## [1] "Calculating PCA. Time 01:12:49" +## [1] "clustSIGNAL run started. Time 01:12:49" +## [1] "Initial nonspatial clustering performed. Clusters = 11 Time 01:12:50" +## [1] "Nonspatial subclustering performed. Subclusters = 52 Time 01:12:52" +## [1] "Regions defined. Time 01:12:54" +## [1] "Region domainness calculated. Time 01:12:56" +## [1] "Smoothing performed. NN = 30 Kernel = G Spread = 0.05 Time 01:13:11" +## [1] "Nonspatial clustering performed on smoothed data. Clusters = 11 Time 01:13:13" +## [1] "clustSIGNAL run completed. 01:13:13" +## Time difference of 23.97924 secs spe2 <- res_hyp$spe_final spe2 @@ -631,7 +631,7 @@ Visualising entropy spread ## [1] scattermore_1.2 patchwork_1.3.0 ## [3] ggplot2_3.5.1 dplyr_1.1.4 ## [5] aricode_1.0.3 cluster_2.1.6 -## [7] distances_0.1.11 clustSIGNAL_0.99.4 +## [7] distances_0.1.11 clustSIGNAL_0.99.5 ## [9] SpatialExperiment_1.16.0 SingleCellExperiment_1.28.1 ## [11] SummarizedExperiment_1.36.0 Biobase_2.66.0 ## [13] GenomicRanges_1.58.0 GenomeInfoDb_1.42.0 diff --git a/articles/index.html b/articles/index.html index 66560ca..753d065 100644 --- a/articles/index.html +++ b/articles/index.html @@ -7,7 +7,7 @@ clustSIGNAL - 0.99.4 + 0.99.5 diff --git a/authors.html b/authors.html index 9483ac8..6c19cd6 100644 --- a/authors.html +++ b/authors.html @@ -7,7 +7,7 @@ clustSIGNAL - 0.99.4 + 0.99.5 @@ -63,13 +63,13 @@ Citation Panwar P, Guo B, Zhao H, Hicks S, Ghazanfar S (2024). clustSIGNAL: clustSIGNAL: a spatial clustering method. -R package version 0.99.4, https://sydneybiox.github.io/clustSIGNAL/. +R package version 0.99.5, https://sydneybiox.github.io/clustSIGNAL/. @Manual{, title = {clustSIGNAL: clustSIGNAL: a spatial clustering method}, author = {Pratibha Panwar and Boyi Guo and Haowen Zhao and Stephanie Hicks and Shila Ghazanfar}, year = {2024}, - note = {R package version 0.99.4}, + note = {R package version 0.99.5}, url = {https://sydneybiox.github.io/clustSIGNAL/}, } diff --git a/index.html b/index.html index 397a993..c0212ec 100644 --- a/index.html +++ b/index.html @@ -22,7 +22,7 @@ clustSIGNAL - 0.99.4 + 0.99.5 diff --git a/news/index.html b/news/index.html index b852ec8..745c517 100644 --- a/news/index.html +++ b/news/index.html @@ -7,7 +7,7 @@ clustSIGNAL - 0.99.4 + 0.99.5 @@ -33,6 +33,10 @@ Changelog Source: NEWS.md + +clustSIGNAL v0.99.5 (2024-11-28) +Fixed issue where absence of spatial coordinates was not throwing error at the beginning of the run. + clustSIGNAL v0.99.4 (2024-11-28) Corrected character check for output format type. diff --git a/pkgdown.yml b/pkgdown.yml index c5c88c2..13ea222 100644 --- a/pkgdown.yml +++ b/pkgdown.yml @@ -3,7 +3,7 @@ pkgdown: 2.1.1 pkgdown_sha: ~ articles: clustSIGNAL: clustSIGNAL.html -last_built: 2024-11-28T00:31Z +last_built: 2024-11-28T01:10Z urls: reference: https://sydneybiox.github.io/clustSIGNAL/reference article: https://sydneybiox.github.io/clustSIGNAL/articles diff --git a/reference/adaptiveSmoothing.html b/reference/adaptiveSmoothing.html index cfbf48f..37f936b 100644 --- a/reference/adaptiveSmoothing.html +++ b/reference/adaptiveSmoothing.html @@ -15,7 +15,7 @@ clustSIGNAL - 0.99.4 + 0.99.5 @@ -108,7 +108,7 @@ Examples# generated using the neighbourDetect() function spe <- clustSIGNAL::adaptiveSmoothing(spe, nnCells, NN = 30, kernel = "G", spread = 0.05, threads = 1) -#> [1] "Smoothing performed. NN = 30 Kernel = G Spread = 0.05 Time 00:31:41" +#> [1] "Smoothing performed. NN = 30 Kernel = G Spread = 0.05 Time 01:11:28" spe #> class: SpatialExperiment #> dim: 351 1000 diff --git a/reference/clustSIGNAL.html b/reference/clustSIGNAL.html index cf0fd96..2a2e8fb 100644 --- a/reference/clustSIGNAL.html +++ b/reference/clustSIGNAL.html @@ -11,7 +11,7 @@ clustSIGNAL - 0.99.4 + 0.99.5 @@ -162,18 +162,18 @@ Examplessamples = "sample_id" cells = "uniqueID" res_list <- clustSIGNAL(spe, samples, cells, outputs = "c") -#> [1] "Calculating PCA. Time 00:31:41" -#> [1] "clustSIGNAL run started. Time 00:31:41" -#> [1] "Initial nonspatial clustering performed. Clusters = 6 Time 00:31:41" +#> [1] "Calculating PCA. Time 01:11:29" +#> [1] "clustSIGNAL run started. Time 01:11:29" +#> [1] "Initial nonspatial clustering performed. Clusters = 6 Time 01:11:29" #> Warning: You're computing too large a percentage of total singular values, use a standard svd instead. #> Warning: You're computing too large a percentage of total singular values, use a standard svd instead. -#> [1] "Nonspatial subclustering performed. Subclusters = 17 Time 00:31:42" -#> [1] "Regions defined. Time 00:31:43" -#> [1] "Region domainness calculated. Time 00:31:43" -#> [1] "Smoothing performed. NN = 30 Kernel = G Spread = 0.05 Time 00:31:54" -#> [1] "Nonspatial clustering performed on smoothed data. Clusters = 9 Time 00:31:54" -#> [1] "clustSIGNAL run completed. 00:31:54" -#> Time difference of 13.52057 secs +#> [1] "Nonspatial subclustering performed. Subclusters = 17 Time 01:11:30" +#> [1] "Regions defined. Time 01:11:31" +#> [1] "Region domainness calculated. Time 01:11:31" +#> [1] "Smoothing performed. NN = 30 Kernel = G Spread = 0.05 Time 01:11:41" +#> [1] "Nonspatial clustering performed on smoothed data. Clusters = 9 Time 01:11:41" +#> [1] "clustSIGNAL run completed. 01:11:41" +#> Time difference of 12.57754 secs diff --git a/reference/dot-calculateProp.html b/reference/dot-calculateProp.html index 64ffe33..ed863b6 100644 --- a/reference/dot-calculateProp.html +++ b/reference/dot-calculateProp.html @@ -9,7 +9,7 @@ clustSIGNAL - 0.99.4 + 0.99.5 diff --git a/reference/dot-cellName.html b/reference/dot-cellName.html index d842d15..02c084a 100644 --- a/reference/dot-cellName.html +++ b/reference/dot-cellName.html @@ -7,7 +7,7 @@ clustSIGNAL - 0.99.4 + 0.99.5 diff --git a/reference/dot-cellNameSort.html b/reference/dot-cellNameSort.html index 0f6bb75..12238c1 100644 --- a/reference/dot-cellNameSort.html +++ b/reference/dot-cellNameSort.html @@ -11,7 +11,7 @@ clustSIGNAL - 0.99.4 + 0.99.5 diff --git a/reference/dot-clustNum.html b/reference/dot-clustNum.html index 1437c82..d83c9b0 100644 --- a/reference/dot-clustNum.html +++ b/reference/dot-clustNum.html @@ -7,7 +7,7 @@ clustSIGNAL - 0.99.4 + 0.99.5 diff --git a/reference/dot-exp_kernel.html b/reference/dot-exp_kernel.html index c60d15e..88d76b9 100644 --- a/reference/dot-exp_kernel.html +++ b/reference/dot-exp_kernel.html @@ -7,7 +7,7 @@ clustSIGNAL - 0.99.4 + 0.99.5 diff --git a/reference/dot-gauss_kernel.html b/reference/dot-gauss_kernel.html index 1ec3155..2095ffd 100644 --- a/reference/dot-gauss_kernel.html +++ b/reference/dot-gauss_kernel.html @@ -7,7 +7,7 @@ clustSIGNAL - 0.99.4 + 0.99.5 diff --git a/reference/dot-generateBPParam.html b/reference/dot-generateBPParam.html index e56a199..15715c1 100644 --- a/reference/dot-generateBPParam.html +++ b/reference/dot-generateBPParam.html @@ -7,7 +7,7 @@ clustSIGNAL - 0.99.4 + 0.99.5 diff --git a/reference/dot-smoothedData.html b/reference/dot-smoothedData.html index fc85a0f..569b531 100644 --- a/reference/dot-smoothedData.html +++ b/reference/dot-smoothedData.html @@ -9,7 +9,7 @@ clustSIGNAL - 0.99.4 + 0.99.5 diff --git a/reference/entropyMeasure.html b/reference/entropyMeasure.html index f318cb7..6652738 100644 --- a/reference/entropyMeasure.html +++ b/reference/entropyMeasure.html @@ -11,7 +11,7 @@ clustSIGNAL - 0.99.4 + 0.99.5 @@ -87,7 +87,7 @@ Examples# requires list containing cluster proportions of each region (regXclust), # generated using the neighbourDetect() function spe <- clustSIGNAL::entropyMeasure(spe, cells = "uniqueID", regXclust, threads = 1) -#> [1] "Region domainness calculated. Time 00:31:56" +#> [1] "Region domainness calculated. Time 01:11:42" head(spe$entropy) #> [1] 0.46900 0.21084 0.69984 0.35336 0.81185 0.35336 diff --git a/reference/example.html b/reference/example.html index 04f534a..a9882c0 100644 --- a/reference/example.html +++ b/reference/example.html @@ -15,7 +15,7 @@ clustSIGNAL - 0.99.4 + 0.99.5 diff --git a/reference/index.html b/reference/index.html index 848a1cf..f1cc59d 100644 --- a/reference/index.html +++ b/reference/index.html @@ -7,7 +7,7 @@ clustSIGNAL - 0.99.4 + 0.99.5 diff --git a/reference/mEmbryo2.html b/reference/mEmbryo2.html index 4a32e25..001f515 100644 --- a/reference/mEmbryo2.html +++ b/reference/mEmbryo2.html @@ -13,7 +13,7 @@ clustSIGNAL - 0.99.4 + 0.99.5 diff --git a/reference/mHypothal.html b/reference/mHypothal.html index 85c5ce7..d6bb60b 100644 --- a/reference/mHypothal.html +++ b/reference/mHypothal.html @@ -19,7 +19,7 @@ clustSIGNAL - 0.99.4 + 0.99.5 diff --git a/reference/neighbourDetect.html b/reference/neighbourDetect.html index 7032c54..47e28bb 100644 --- a/reference/neighbourDetect.html +++ b/reference/neighbourDetect.html @@ -11,7 +11,7 @@ clustSIGNAL - 0.99.4 + 0.99.5 @@ -97,7 +97,7 @@ Examples out_list <- clustSIGNAL::neighbourDetect(spe, samples = "sample_id", NN = 30, cells = "uniqueID", sort = TRUE) -#> [1] "Regions defined. Time 00:31:57" +#> [1] "Regions defined. Time 01:11:43" names(out_list) #> [1] "nnCells" "regXclust" diff --git a/reference/p1_clustering.html b/reference/p1_clustering.html index 8c770f1..ceb8771 100644 --- a/reference/p1_clustering.html +++ b/reference/p1_clustering.html @@ -9,7 +9,7 @@ clustSIGNAL - 0.99.4 + 0.99.5 @@ -94,11 +94,11 @@ Examplesspe <- clustSIGNAL::p1_clustering(spe, dimRed = "PCA", batch = FALSE, batch_by = "None", clustParams = list(0, 0, 30, 5, "louvain")) -#> [1] "Initial nonspatial clustering performed. Clusters = 7 Time 00:31:57" +#> [1] "Initial nonspatial clustering performed. Clusters = 7 Time 01:11:44" #> Warning: You're computing too large a percentage of total singular values, use a standard svd instead. #> Warning: You're computing too large a percentage of total singular values, use a standard svd instead. #> Warning: You're computing too large a percentage of total singular values, use a standard svd instead. -#> [1] "Nonspatial subclustering performed. Subclusters = 20 Time 00:31:58" +#> [1] "Nonspatial subclustering performed. Subclusters = 20 Time 01:11:45" head(spe$nsCluster) #> [1] 5 5 7 5 5 5 #> Levels: 1 2 3 4 5 6 7 diff --git a/reference/p2_clustering.html b/reference/p2_clustering.html index 28ab295..a4a6ba5 100644 --- a/reference/p2_clustering.html +++ b/reference/p2_clustering.html @@ -7,7 +7,7 @@ clustSIGNAL - 0.99.4 + 0.99.5 @@ -85,7 +85,7 @@ Examples# For non-spatial clustering of normalised counts spe <- clustSIGNAL::p2_clustering(spe, batch = FALSE, batch_by = "None", clustParams = list(0, 0, 30, 5, "louvain")) -#> [1] "Nonspatial clustering performed on smoothed data. Clusters = 9 Time 00:31:58" +#> [1] "Nonspatial clustering performed on smoothed data. Clusters = 9 Time 01:11:45" head(spe$clustSIGNAL) #> [1] 6 6 4 6 6 6 #> Levels: 1 2 3 4 5 6 7 8 9 diff --git a/search.json b/search.json index c84f109..d744762 100644 --- a/search.json +++ b/search.json @@ -1 +1 @@ -[{"path":"https://sydneybiox.github.io/clustSIGNAL/articles/clustSIGNAL.html","id":"overview","dir":"Articles","previous_headings":"","what":"Overview","title":"clustSIGNAL tutorial","text":"vignette, demonstrate perform spatially-resolved clustering clustSIGNAL. Following , explore clusters using pre-defined metrics like adjusted rand index (ARI), normalised mutual information (NMI), average silhouette width, well spatial plots. also display use entropy measures generated -product clustSIGNAL process understanding tissue structure sample. end, also explore multisample analysis clustSIGNAL.","code":"# load required packages library(clustSIGNAL) library(distances) library(cluster) library(aricode) library(dplyr) library(ggplot2) library(patchwork) library(scattermore)"},{"path":"https://sydneybiox.github.io/clustSIGNAL/articles/clustSIGNAL.html","id":"single-sample-analysis-with-clustsignal","dir":"Articles","previous_headings":"","what":"Single sample analysis with clustSIGNAL","title":"clustSIGNAL tutorial","text":", use SeqFISH mouse embryo dataset Lohoff et al, 2021 , contains spatial transcriptomics data 3 mouse embryos, 351 genes total 57,536 cells. vignette, subset data randomly selecting 5000 cells Embryo 2, excluding cells manually annotated ‘Low quality’. begin creating SpatialExperiment object gene expression cell information data subset, ensuring spatial coordinates stored spatialCoords within SpatialExperiment object. data already SpatialExperiment object, user can directly run clustSIGNAL, ensuring basic requirements like spatial coordinates normalized counts met. running clustSIGNAL, need know column names colData SpatialExperiment object contain sample cell labels. , sample labels ‘sample_id’ column, cell labels ‘uniqueID’ column.","code":"data(mEmbryo2) spe <- SpatialExperiment(assays = list(logcounts = me_expr), colData = me_data, spatialCoordsNames = c(\"X\", \"Y\")) spe ## class: SpatialExperiment ## dim: 351 5000 ## metadata(0): ## assays(1): logcounts ## rownames(351): Abcc4 Acp5 ... Zfp57 Zic3 ## rowData names(0): ## colnames(5000): embryo2_Pos29_cell100_z2 embryo2_Pos29_cell101_z5 ... ## embryo2_Pos50_cell97_z5 embryo2_Pos50_cell99_z5 ## colData names(4): uniqueID pos celltype_mapped_refined sample_id ## reducedDimNames(0): ## mainExpName: NULL ## altExpNames(0): ## spatialCoords names(2) : X Y ## imgData names(0): colnames(colData(spe)) ## [1] \"uniqueID\" \"pos\" ## [3] \"celltype_mapped_refined\" \"sample_id\""},{"path":"https://sydneybiox.github.io/clustSIGNAL/articles/clustSIGNAL.html","id":"running-clustsignal-on-one-sample","dir":"Articles","previous_headings":"","what":"Running clustSIGNAL on one sample","title":"clustSIGNAL tutorial","text":"Next, run clustSIGNAL using sample cell labels identified earlier. simplest clustSIGNAL run requires SpatialExperiment object, two variables holding colData column names containing sample cell labels, type output user like see. parameters can modified include dimRed specify low dimension data use, batch perform batch correction, batch_by indicate sample batches contributing batch effect, NN specify neighbourhood size, kernel weight distribution use, spread distribution spread value, sort sort neighbourhood, threads specify number cpus use parallel runs, clustParams specify clustering parameters. Furthermore, adaptively smoothed gene expression data generated clustSIGNAL useful downstream analyses accessible user choose output final SpatialExperiment object. returns list can contain dataframe cluster names, matrix cell labels region’s neighbourhood, final SpatialExperiment object, combination , depending choice ‘outputs’ selected. , output contains three data types. cluster dataframe contains cell labels cluster numbers allotted clustSIGNAL. final SpatialExperiment object contains adaptively smoothed gene expression data additional assay, well initial clusters, entropy values, clustSIGNAL clusters.","code":"set.seed(100) samples <- \"sample_id\" cells <- \"uniqueID\" res_emb <- clustSIGNAL(spe, samples, cells, outputs = \"a\") ## [1] \"Calculating PCA. Time 00:32:08\" ## [1] \"clustSIGNAL run started. Time 00:32:09\" ## [1] \"Initial nonspatial clustering performed. Clusters = 11 Time 00:32:09\" ## [1] \"Nonspatial subclustering performed. Subclusters = 50 Time 00:32:12\" ## [1] \"Regions defined. Time 00:32:14\" ## [1] \"Region domainness calculated. Time 00:32:14\" ## [1] \"Smoothing performed. NN = 30 Kernel = G Spread = 0.05 Time 00:32:51\" ## [1] \"Nonspatial clustering performed on smoothed data. Clusters = 16 Time 00:32:53\" ## [1] \"clustSIGNAL run completed. 00:32:53\" ## Time difference of 45.32507 secs names(res_emb) ## [1] \"clusters\" \"spe_final\" head(res_emb$clusters, n = 3) ## Cells Clusters ## 1 embryo2_Pos29_cell100_z2 13 ## 2 embryo2_Pos29_cell101_z5 13 ## 3 embryo2_Pos29_cell104_z2 13 spe <- res_emb$spe_final spe ## class: SpatialExperiment ## dim: 351 5000 ## metadata(0): ## assays(2): logcounts smoothed ## rownames(351): Abcc4 Acp5 ... Zfp57 Zic3 ## rowData names(0): ## colnames(5000): embryo2_Pos29_cell100_z2 embryo2_Pos29_cell101_z5 ... ## embryo2_Pos50_cell97_z5 embryo2_Pos50_cell99_z5 ## colData names(8): uniqueID pos ... entropy clustSIGNAL ## reducedDimNames(2): PCA PCA.smooth ## mainExpName: NULL ## altExpNames(0): ## spatialCoords names(2) : X Y ## imgData names(1): sample_id"},{"path":"https://sydneybiox.github.io/clustSIGNAL/articles/clustSIGNAL.html","id":"analysing-clustsignal-results","dir":"Articles","previous_headings":"","what":"Analysing clustSIGNAL results","title":"clustSIGNAL tutorial","text":"section, analyse results clustSIGNAL spatial plots clustering metrics.","code":""},{"path":"https://sydneybiox.github.io/clustSIGNAL/articles/clustSIGNAL.html","id":"visualising-clustsignal-clusters","dir":"Articles","previous_headings":"Analysing clustSIGNAL results","what":"Visualising clustSIGNAL clusters","title":"clustSIGNAL tutorial","text":"use spatial coordinates cells cluster labels entropy values visualize clustering output. spatial location () entropy distribution (B) clusters provide spatial context cells neighbourhoods, well compositions neighbourhoods. example, low entropy cluster 4 indicates cells cluster generally found homogeneous space, whereas high entropy cluster 7 cells indicates belong regions cell diversity. can also visualized spatial plot.","code":"colors <- c(\"#635547\", \"#8EC792\", \"#9e6762\", \"#FACB12\", \"#3F84AA\", \"#0F4A9C\", \"#ff891c\", \"#EF5A9D\", \"#C594BF\", \"#DFCDE4\", \"#139992\", \"#65A83E\", \"#8DB5CE\", \"#005579\", \"#C9EBFB\", \"#B51D8D\", \"#532C8A\", \"#8870ad\", \"#cc7818\", \"#FBBE92\", \"#EF4E22\", \"#f9decf\", \"#c9a997\", \"#C72228\", \"#f79083\", \"#F397C0\", \"#DABE99\", \"#c19f70\", \"#354E23\", \"#C3C388\", \"#647a4f\", \"#CDE088\", \"#f7f79e\", \"#F6BFCB\", \"#7F6874\", \"#989898\", \"#1A1A1A\", \"#FFFFFF\", \"#e6e6e6\", \"#77441B\", \"#F90026\", \"#A10037\", \"#DA5921\", \"#E1C239\", \"#9DD84A\") df_ent <- as.data.frame(colData(spe)) # spatial plot spt_clust <- df_ent %>% ggplot(aes(x = spatialCoords(spe)[, 1], y = -spatialCoords(spe)[, 2])) + geom_scattermore(pointsize = 3, aes(colour = clustSIGNAL)) + scale_color_manual(values = colors) + ggtitle(\"A\") + labs(x = \"x-coordinate\", y = \"y-coordinate\") + guides(color = guide_legend(title = \"Clusters\", override.aes = list(size = 3))) + theme_classic() + theme(text = element_text(size = 12)) # calculating median entropy of each cluster celltype_ent <- df_ent %>% group_by(as.character(clustSIGNAL)) %>% summarise(meanEntropy = median(entropy)) # reordering clusters by their median entropy # low to high median entropy cellOrder <- celltype_ent$meanEntropy names(cellOrder) <- celltype_ent$`as.character(clustSIGNAL)` cellOrder <- sort(cellOrder) df_ent$clustSIGNAL <- factor(df_ent$clustSIGNAL, levels = names(cellOrder)) # box plot of cluster entropy colors_ent <- colors[as.numeric(names(cellOrder))] box_clust <- df_ent %>% ggplot(aes(x = clustSIGNAL, y = entropy, fill = clustSIGNAL)) + geom_boxplot() + scale_fill_manual(values = colors_ent) + ggtitle(\"B\") + labs(x = \"clustSIGNAL clusters\", y = \"Entropy\") + theme_classic() + theme(legend.position = \"none\", text = element_text(size = 12), axis.text.x = element_text(angle = 90, vjust = 0.5, hjust = 1)) spt_clust + box_clust + patchwork::plot_layout(guides = \"collect\", widths = c(2, 3))"},{"path":"https://sydneybiox.github.io/clustSIGNAL/articles/clustSIGNAL.html","id":"cluster-metrics","dir":"Articles","previous_headings":"Analysing clustSIGNAL results","what":"Cluster metrics","title":"clustSIGNAL tutorial","text":"assess clustering efficiency clustSIGNAL using commonly used clustering metrics ARI, NMI, silhouette width. ARI NMI usable prior cell annotation information available, assume cell annotation ground truth. , ARI NMI measure similarity agreement (respectively) cluster labels obtained clustSIGNAL manual cell annotation labels. contrary, silhouette width reference-free evaluates well cell fits within assigned cluster compared clusters.","code":"# average silhouette width clusts <- as.numeric(as.character(spe$clustSIGNAL)) cXg_mat <- t(as.matrix(logcounts(spe))) distMat <- distances(cXg_mat) silCluster <- as.matrix(silhouette(clusts, distMat)) spe$rcSil <- silCluster[, 3] # ARI and NMI as.data.frame(colData(spe)) %>% summarise(ARI = aricode::ARI(celltype_mapped_refined, clustSIGNAL), NMI = aricode::NMI(celltype_mapped_refined, clustSIGNAL), ASW = mean(rcSil)) ## ARI NMI ASW ## 1 0.3420434 0.6281433 0.03767501"},{"path":"https://sydneybiox.github.io/clustSIGNAL/articles/clustSIGNAL.html","id":"entropy-spread-and-distribution","dir":"Articles","previous_headings":"Analysing clustSIGNAL results","what":"Entropy spread and distribution","title":"clustSIGNAL tutorial","text":"entropy values generated clustSIGNAL process can useful analyzing sample structure. entropy range can indicate whether tissue sample contains homogeneous domain-like structures. example, minimum entropy value 0, means cells placed completely homogeneous space looking neighbourhood size 30 cells (NN = 30 used generating entropy data). Moreover, mean entropy value low, can interpreted tissue least domain-like structures. spread () spatial distribution (B) region entropy measures can useful assessing tissue composition samples - low entropy regions homogeneous domain-like structure, whereas high entropy regions heterogeneous uniform distribution cells.","code":"# Data assessment - Overall entropy as.data.frame(colData(spe)) %>% summarise(min_Entropy = min(entropy), max_Entropy = max(entropy), mean_Entropy = mean(entropy)) ## min_Entropy max_Entropy mean_Entropy ## 1 0 3.05603 1.37066 # Histogram of entropy spread hst_ent <- as.data.frame(colData(spe)) %>% ggplot(aes(entropy)) + geom_histogram(binwidth = 0.05) + ggtitle(\"A\") + labs(x = \"Entropy\", y = \"Number of regions\") + theme_classic() + theme(text = element_text(size = 12)) # Spatial plot showing sample entropy distribution spt_ent <- as.data.frame(colData(spe)) %>% ggplot(aes(x = spatialCoords(spe)[, 1], y = -spatialCoords(spe)[, 2])) + geom_scattermore(pointsize = 3, aes(colour = entropy)) + scale_colour_gradient2(\"Entropy\", low = \"grey\", high = \"blue\") + scale_size_continuous(range = c(0, max(spe$entropy))) + ggtitle(\"B\") + labs(x = \"x-coordinate\", y = \"y-coordinate\") + theme_classic() + theme(text = element_text(size = 12)) hst_ent + spt_ent"},{"path":"https://sydneybiox.github.io/clustSIGNAL/articles/clustSIGNAL.html","id":"generating-entropy-data-only","dir":"Articles","previous_headings":"","what":"Generating entropy data only","title":"clustSIGNAL tutorial","text":"evaluate tissue structure using entropy values, can run clustSIGNAL entropy measurement step, without running complete method. entropy values added SpatialExperiment object can used assessing tissue structure.","code":"data(mEmbryo2) spe <- SpatialExperiment(assays = list(logcounts = me_expr), colData = me_data, spatialCoordsNames = c(\"X\", \"Y\")) set.seed(100) spe <- scater::runPCA(spe) spe <- clustSIGNAL::p1_clustering(spe, dimRed = \"PCA\", batch = FALSE, batch_by = \"None\", clustParams = list( 0, 0, 30, 5, \"louvain\")) ## [1] \"Initial nonspatial clustering performed. Clusters = 11 Time 00:33:02\" ## [1] \"Nonspatial subclustering performed. Subclusters = 50 Time 00:33:05\" outReg <- clustSIGNAL::neighbourDetect(spe, samples = \"sample_id\", NN = 30, cells = \"uniqueID\", sort = TRUE) ## [1] \"Regions defined. Time 00:33:07\" spe <- entropyMeasure(spe, cells = \"uniqueID\", outReg$regXclust, threads = 1) ## [1] \"Region domainness calculated. Time 00:33:08\" head(spe$entropy) ## [1] 1.03701 0.42003 0.62749 0.76651 0.56651 0.21084"},{"path":"https://sydneybiox.github.io/clustSIGNAL/articles/clustSIGNAL.html","id":"multisample-analysis-with-clustsignal","dir":"Articles","previous_headings":"","what":"Multisample analysis with clustSIGNAL","title":"clustSIGNAL tutorial","text":", use MERFISH mouse hypothalamic preoptic region dataset Moffitt et al, 2018, contains spatial transcriptomics data 181 samples, 155 genes total 1,027,080 cells. vignette, subset data selecting total 6000 random cells 3 samples - Animal 1 Bregma -0.09 (2080 cells), Animal 7 Bregma 0.16 (1936 cells), Animal 7 Bregma -0.09 (1984 cells), excluding cells manually annotated ‘ambiguous’ 20 genes assessed using different technology. start analysis creating SpatialExperiment object gene expression cell information data subset, ensuring spatial coordinates stored spatialCoords within SpatialExperiment object. , cell labels column ‘Cell_ID’ sample labels ‘samples’ column SpatialExperiment object.","code":"data(mHypothal) spe2 <- SpatialExperiment(assays = list(logcounts = mh_expr), colData = mh_data, spatialCoordsNames = c(\"X\", \"Y\")) spe2 ## class: SpatialExperiment ## dim: 135 6000 ## metadata(0): ## assays(1): logcounts ## rownames(135): Ace2 Adora2a ... Ttn Ttyh2 ## rowData names(0): ## colnames(6000): 74d3f69d-e8f2-4c33-a8ca-fac3eb65e55a ## 41158ddc-e70c-487b-b891-0cb3c8452555 ... ## 54145623-7071-482c-b9da-d0d2dd31274a ## 96bc85ce-b993-4fb1-8e0c-165f83f0cfd0 ## colData names(4): Cell_ID Cell_class sample_id samples ## reducedDimNames(0): ## mainExpName: NULL ## altExpNames(0): ## spatialCoords names(2) : X Y ## imgData names(0): colnames(colData(spe2)) ## [1] \"Cell_ID\" \"Cell_class\" \"sample_id\" \"samples\""},{"path":"https://sydneybiox.github.io/clustSIGNAL/articles/clustSIGNAL.html","id":"clustsignal-run","dir":"Articles","previous_headings":"Multisample analysis with clustSIGNAL","what":"clustSIGNAL run","title":"clustSIGNAL tutorial","text":"One important concepts take account running multisample analysis batch effects. gathering samples different sources different technologies/procedures, technical batch effects might introduced dataset. run clustSIGNAL batch correction mode simply setting batch = TRUE. method uses harmony internally batch correction.","code":"set.seed(110) samples <- \"samples\" cells <- \"Cell_ID\" res_hyp <- clustSIGNAL(spe2, samples, cells, threads = 4, outputs = \"a\") ## [1] \"Calculating PCA. Time 00:33:08\" ## [1] \"clustSIGNAL run started. Time 00:33:08\" ## [1] \"Initial nonspatial clustering performed. Clusters = 11 Time 00:33:09\" ## [1] \"Nonspatial subclustering performed. Subclusters = 52 Time 00:33:11\" ## [1] \"Regions defined. Time 00:33:14\" ## [1] \"Region domainness calculated. Time 00:33:16\" ## [1] \"Smoothing performed. NN = 30 Kernel = G Spread = 0.05 Time 00:33:33\" ## [1] \"Nonspatial clustering performed on smoothed data. Clusters = 11 Time 00:33:35\" ## [1] \"clustSIGNAL run completed. 00:33:35\" ## Time difference of 26.87564 secs spe2 <- res_hyp$spe_final spe2 ## class: SpatialExperiment ## dim: 135 6000 ## metadata(0): ## assays(2): logcounts smoothed ## rownames(135): Ace2 Adora2a ... Ttn Ttyh2 ## rowData names(0): ## colnames(6000): 74d3f69d-e8f2-4c33-a8ca-fac3eb65e55a ## 41158ddc-e70c-487b-b891-0cb3c8452555 ... ## 54145623-7071-482c-b9da-d0d2dd31274a ## 96bc85ce-b993-4fb1-8e0c-165f83f0cfd0 ## colData names(8): Cell_ID Cell_class ... entropy clustSIGNAL ## reducedDimNames(2): PCA PCA.smooth ## mainExpName: NULL ## altExpNames(0): ## spatialCoords names(2) : X Y ## imgData names(1): sample_id"},{"path":"https://sydneybiox.github.io/clustSIGNAL/articles/clustSIGNAL.html","id":"clustering-metrics","dir":"Articles","previous_headings":"Multisample analysis with clustSIGNAL","what":"Clustering metrics","title":"clustSIGNAL tutorial","text":"Clustering entropy results can calculated visualized sample. clustSIGNAL works well samples uniform distribution cells.","code":"samplesList <- levels(spe2[[samples]]) samplesList ## [1] \"1.-0.09\" \"7.-0.09\" \"7.0.16\" # calculating silhouette width per sample silWidthRC <- matrix(nrow = 0, ncol = 3) for (s in samplesList) { speX <- spe2[, spe2[[samples]] == s] clust_sub <- as.numeric(as.character(speX$clustSIGNAL)) cXg <- t(as.matrix(logcounts(speX))) distMat <- distances(cXg) silCluster <- as.matrix(silhouette(clust_sub, distMat)) silWidthRC <- rbind(silWidthRC, silCluster) } spe2$rcSil <- silWidthRC[, 3] as.data.frame(colData(spe2)) %>% group_by(samples) %>% summarise(ARI = aricode::ARI(Cell_class, clustSIGNAL), NMI = aricode::NMI(Cell_class, clustSIGNAL), ASW = mean(rcSil), min_Entropy = min(entropy), max_Entropy = max(entropy), mean_Entropy = mean(entropy)) ## # A tibble: 3 × 7 ## samples ARI NMI ASW min_Entropy max_Entropy mean_Entropy ## ## 1 1.-0.09 0.445 0.624 0.0807 1.32 4.42 3.30 ## 2 7.-0.09 0.511 0.679 0.115 0.970 4.64 3.30 ## 3 7.0.16 0.645 0.744 0.104 0.970 4.42 3.26"},{"path":"https://sydneybiox.github.io/clustSIGNAL/articles/clustSIGNAL.html","id":"visualizing-clustsignal-clusters","dir":"Articles","previous_headings":"Multisample analysis with clustSIGNAL","what":"Visualizing clustSIGNAL clusters","title":"clustSIGNAL tutorial","text":"clustSIGNAL performs clustering cells dataset one run, thereby generating clusters across multiple samples. user need map cluster labels samples. example, cluster 1 represents cell type three samples, without needing explicit mapping samples. spatial location (top) entropy distribution (bottom) clusters can compared multisample analysis, providing spatial context cluster cells neighbourhood compositions different samples.","code":"df_ent <- as.data.frame(colData(spe2)) # spatial plot spt_clust <- df_ent %>% ggplot(aes(x = spatialCoords(spe2)[, 1], y = -spatialCoords(spe2)[, 2])) + geom_scattermore(pointsize = 3, aes(colour = clustSIGNAL)) + scale_color_manual(values = colors) + facet_wrap(vars(samples), scales = \"free\", nrow = 1) + labs(x = \"x-coordinate\", y = \"y-coordinate\") + guides(color = guide_legend(title = \"Clusters\", override.aes = list(size = 3))) + theme_classic() + theme(text = element_text(size = 12), axis.text.x = element_text(angle = 90, vjust = 0.5)) box_clust <- list() for (s in samplesList) { df_ent_sub <- as.data.frame(colData(spe2)[spe2[[samples]] == s, ]) # calculating median entropy of each cluster in a sample celltype_ent <- df_ent_sub %>% group_by(as.character(clustSIGNAL)) %>% summarise(meanEntropy = median(entropy)) # reordering clusters by their median entropy # low to high median entropy cellOrder <- celltype_ent$meanEntropy names(cellOrder) <- celltype_ent$`as.character(clustSIGNAL)` cellOrder = sort(cellOrder) df_ent_sub$clustSIGNAL <- factor(df_ent_sub$clustSIGNAL, levels = names(cellOrder)) # box plot of cluster entropy colors_ent <- colors[as.numeric(names(cellOrder))] box_clust[[s]] <- df_ent_sub %>% ggplot(aes(x = clustSIGNAL, y = entropy, fill = clustSIGNAL)) + geom_boxplot() + scale_fill_manual(values = colors_ent) + facet_wrap(vars(samples), nrow = 1) + labs(x = \"clustSIGNAL clusters\", y = \"Entropy\") + ylim(0, NA) + theme_classic() + theme(strip.text = element_blank(), legend.position = \"none\", text = element_text(size = 12), axis.text.x = element_text(angle = 90, vjust = 0.5)) } spt_clust / (patchwork::wrap_plots(box_clust[1:3], nrow = 1) + plot_layout(axes = \"collect\")) + plot_layout(guides = \"collect\", heights = c(5, 3)) + plot_annotation( title = \"Spatial (top) and entropy (bottom) distributions of clusters\")"},{"path":"https://sydneybiox.github.io/clustSIGNAL/articles/clustSIGNAL.html","id":"visualising-entropy-spread-and-distribution","dir":"Articles","previous_headings":"Multisample analysis with clustSIGNAL","what":"Visualising entropy spread and distribution","title":"clustSIGNAL tutorial","text":"multisample analysis, spread () spatial distribution (B) region entropy measures can useful assessing comparing tissue structure samples.","code":"# Histogram of entropy spread hst_ent <- as.data.frame(colData(spe2)) %>% ggplot(aes(entropy)) + geom_histogram(binwidth = 0.05) + facet_wrap(vars(samples), nrow = 1) + labs(x = \"Entropy\", y = \"Number of regions\") + theme_classic() + theme(text = element_text(size = 12)) # Spatial plot showing sample entropy distribution spt_ent <- as.data.frame(colData(spe2)) %>% ggplot(aes(x = spatialCoords(spe2)[, 1], y = -spatialCoords(spe2)[, 2])) + geom_scattermore(pointsize = 3, aes(colour = entropy)) + scale_colour_gradient2(\"Entropy\", low = \"grey\", high = \"blue\") + scale_size_continuous(range = c(0, max(spe2$entropy))) + facet_wrap(vars(samples), scales = \"free\", nrow = 1) + labs(x = \"x-coordinate\", y = \"y-coordinate\") + theme_classic() + theme(strip.text = element_blank(), text = element_text(size = 12), axis.text.x = element_text(angle = 90, vjust = 0.5)) hst_ent / spt_ent + plot_layout(heights = c(3,5)) + plot_annotation( title = \"Entropy spread (top) and spatial distribution (bottom)\") sessionInfo() ## R version 4.4.2 (2024-10-31) ## Platform: x86_64-pc-linux-gnu ## Running under: Ubuntu 22.04.5 LTS ## ## Matrix products: default ## BLAS: /usr/lib/x86_64-linux-gnu/openblas-pthread/libblas.so.3 ## LAPACK: /usr/lib/x86_64-linux-gnu/openblas-pthread/libopenblasp-r0.3.20.so; LAPACK version 3.10.0 ## ## locale: ## [1] LC_CTYPE=C.UTF-8 LC_NUMERIC=C LC_TIME=C.UTF-8 ## [4] LC_COLLATE=C.UTF-8 LC_MONETARY=C.UTF-8 LC_MESSAGES=C.UTF-8 ## [7] LC_PAPER=C.UTF-8 LC_NAME=C LC_ADDRESS=C ## [10] LC_TELEPHONE=C LC_MEASUREMENT=C.UTF-8 LC_IDENTIFICATION=C ## ## time zone: UTC ## tzcode source: system (glibc) ## ## attached base packages: ## [1] stats4 stats graphics grDevices utils datasets methods ## [8] base ## ## other attached packages: ## [1] scattermore_1.2 patchwork_1.3.0 ## [3] ggplot2_3.5.1 dplyr_1.1.4 ## [5] aricode_1.0.3 cluster_2.1.6 ## [7] distances_0.1.11 clustSIGNAL_0.99.4 ## [9] SpatialExperiment_1.16.0 SingleCellExperiment_1.28.1 ## [11] SummarizedExperiment_1.36.0 Biobase_2.66.0 ## [13] GenomicRanges_1.58.0 GenomeInfoDb_1.42.0 ## [15] IRanges_2.40.0 S4Vectors_0.44.0 ## [17] BiocGenerics_0.52.0 MatrixGenerics_1.18.0 ## [19] matrixStats_1.4.1 BiocStyle_2.34.0 ## ## loaded via a namespace (and not attached): ## [1] gridExtra_2.3 rlang_1.1.4 magrittr_2.0.3 ## [4] scater_1.34.0 compiler_4.4.2 systemfonts_1.1.0 ## [7] vctrs_0.6.5 pkgconfig_2.0.3 crayon_1.5.3 ## [10] fastmap_1.2.0 magick_2.8.5 XVector_0.46.0 ## [13] labeling_0.4.3 scuttle_1.16.0 utf8_1.2.4 ## [16] rmarkdown_2.29 UCSC.utils_1.2.0 ggbeeswarm_0.7.2 ## [19] ragg_1.3.3 xfun_0.49 bluster_1.16.0 ## [22] zlibbioc_1.52.0 cachem_1.1.0 beachmat_2.22.0 ## [25] jsonlite_1.8.9 DelayedArray_0.32.0 BiocParallel_1.40.0 ## [28] irlba_2.3.5.1 parallel_4.4.2 R6_2.5.1 ## [31] bslib_0.8.0 rlist_0.4.6.2 jquerylib_0.1.4 ## [34] Rcpp_1.0.13-1 bookdown_0.41 knitr_1.49 ## [37] Matrix_1.7-1 igraph_2.1.1 tidyselect_1.2.1 ## [40] abind_1.4-8 yaml_2.3.10 viridis_0.6.5 ## [43] codetools_0.2-20 lattice_0.22-6 tibble_3.2.1 ## [46] withr_3.0.2 evaluate_1.0.1 desc_1.4.3 ## [49] pillar_1.9.0 BiocManager_1.30.25 generics_0.1.3 ## [52] munsell_0.5.1 scales_1.3.0 glue_1.8.0 ## [55] tools_4.4.2 BiocNeighbors_2.0.0 data.table_1.16.2 ## [58] ScaledMatrix_1.14.0 fs_1.6.5 cowplot_1.1.3 ## [61] grid_4.4.2 colorspace_2.1-1 GenomeInfoDbData_1.2.13 ## [64] beeswarm_0.4.0 BiocSingular_1.22.0 vipor_0.4.7 ## [67] cli_3.6.3 rsvd_1.0.5 textshaping_0.4.0 ## [70] fansi_1.0.6 S4Arrays_1.6.0 viridisLite_0.4.2 ## [73] gtable_0.3.6 sass_0.4.9 digest_0.6.37 ## [76] SparseArray_1.6.0 ggrepel_0.9.6 farver_2.1.2 ## [79] rjson_0.2.23 htmltools_0.5.8.1 pkgdown_2.1.1 ## [82] lifecycle_1.0.4 httr_1.4.7 harmony_1.2.1"},{"path":"https://sydneybiox.github.io/clustSIGNAL/authors.html","id":null,"dir":"","previous_headings":"","what":"Authors","title":"Authors and Citation","text":"Pratibha Panwar. Maintainer, author, contributor. Boyi Guo. Author. Haowen Zhao. Author. Stephanie Hicks. Author. Shila Ghazanfar. Author, contributor.","code":""},{"path":"https://sydneybiox.github.io/clustSIGNAL/authors.html","id":"citation","dir":"","previous_headings":"","what":"Citation","title":"Authors and Citation","text":"Panwar P, Guo B, Zhao H, Hicks S, Ghazanfar S (2024). clustSIGNAL: clustSIGNAL: spatial clustering method. R package version 0.99.4, https://sydneybiox.github.io/clustSIGNAL/.","code":"@Manual{, title = {clustSIGNAL: clustSIGNAL: a spatial clustering method}, author = {Pratibha Panwar and Boyi Guo and Haowen Zhao and Stephanie Hicks and Shila Ghazanfar}, year = {2024}, note = {R package version 0.99.4}, url = {https://sydneybiox.github.io/clustSIGNAL/}, }"},{"path":"https://sydneybiox.github.io/clustSIGNAL/index.html","id":"clustsignal","dir":"","previous_headings":"","what":"clustSIGNAL: a spatial clustering method","title":"clustSIGNAL: a spatial clustering method","text":"clustSIGNAL: clustering Spatially Informed Gene expression Neighbourhood Adapted Learning. R package perform spatially-resolved clustering spatial transcriptomics data. , calculate entropy measure “domainness” cell neighbourhoods use generate weight distributions perform adaptive smoothing gene expression. Homogeneous neighbourhoods low entropy, , smoothing performed cells neighbourhoods. Contrarily, heterogeneous neighbourhoods high entropy smoothed much smaller region. approach overcomes data sparsity gene expression also incorporates spatial context form cell arrangement information neighbourhood. resulting adaptively smoothed gene expression used downstream analyses like clustering. tutorial use clustSIGNAL, see vignette website.","code":""},{"path":"https://sydneybiox.github.io/clustSIGNAL/index.html","id":"installation","dir":"","previous_headings":"","what":"Installation","title":"clustSIGNAL: a spatial clustering method","text":"install clustSIGNAL via Bioconductor: install clustSIGNAL GitHub:","code":"library(BiocManager) BiocManager::install(\"clustSIGNAL\") # install.packages(\"devtools\") devtools::install_github(\"SydneyBioX/clustSIGNAL\")"},{"path":"https://sydneybiox.github.io/clustSIGNAL/index.html","id":"method-description","dir":"","previous_headings":"","what":"Method description","title":"clustSIGNAL: a spatial clustering method","text":"Figure: clustSIGNAL method overview. , present clustSIGNAL, spatial clustering method developed handle data sparsity considering variability cell arrangement tissue regions. core steps involved method sequential: 1. method starts non-spatial clustering subclustering (default louvain clustering) classify cells subclusters refer ‘putative cell type’ groups. 2. neighbourhood cell defined terms ‘putative cell type’ group composition. 3. cells neighbourhood also sorted rearranged neighbours belonging ‘putative cell type’ group index cell placed closer . 4. Neighbourhood “domainness” measured entropy, high entropy values indicate heterogeneous neighbourhoods low entropy values indicate homogeneous neighbourhoods. 5. entropy values used generate weight distributions specific neighbourhood. 6. gene expressions cells adaptively smoothed using entropy-guided weight distributions; cells heterogeneous neighbourhoods (high entropy) undergo smoothing smaller region, whereas cells homogeneous neighbourhoods (low entropy) undergo smoothing larger region. 7. Non-spatial clustering performed adaptively smoothed gene expression generate clustSIGNAL clusters represent cell types.","code":""},{"path":"https://sydneybiox.github.io/clustSIGNAL/index.html","id":"clustsignal-parameters","dir":"","previous_headings":"","what":"clustSIGNAL parameters","title":"clustSIGNAL: a spatial clustering method","text":"clustSIGNAL package uses SpatialExperiment object input. provide users number parameters explore experiment , well prior tested default values quick runs. clustSIGNAL can used single sample multisample analysis just one function call. list parameters offered possible values: spe - SpatialExperiment object cell spatial coordinates matrix normalized counts gene expression. samples - column name cell metadata containing sample names. cells - column name cell metadata containing cell IDs. dimRed - dimensionality reduction method name low embedding data. Default value “None”, case PCA calculated used low dimension data. batch - whether batch correction performed. Default value FALSE. batch_by - column name cell metadata containing groups perform batch correction. NN - neighbourhood size terms number nearest neighbours consider. Value > 1. Default value 30. kernel - type weight distribution use. Can Gaussian (default) exponential distribution. spread - value distribution parameter - standard deviation Gaussian distribution rate exponential distribution. Default value 0.05, recommended Gaussian distribution. exponential distribution, recommended value 20. sort - whether cell neighbourhoods sorted ‘putative cell type’ grouping. Default value True. threads - number cpus use parallel runs. Default value 1. outputs - choice output types. Default value ‘c’ data frame cell IDs cluster numbers. possible value “” list dataframe clusters plus final SpatialExperiment object. clustParams - parameter options TwoStepParam clustering methods bluster package. clustering parameters order - centers (centers) clustering KmeansParam, centers (centers) sub-clustering clusters KmeansParam, maximum iterations (iter.max) clustering KmeansParam, k values (k) clustering NNGraphParam, community detection method (cluster.fun) use NNGraphParam.","code":""},{"path":"https://sydneybiox.github.io/clustSIGNAL/index.html","id":"running-clustsignal","dir":"","previous_headings":"","what":"Running clustSIGNAL","title":"clustSIGNAL: a spatial clustering method","text":"running clustSIGNAL, important ensure SpatialExperiment object input spatial coordinates stored spatialCoords matrix. Otherwise, method throw error asking user provide spatial coordinates.","code":"# load required packages library(clustSIGNAL) data(example) # Here, the cell labels are in the column 'uniqueID' and sample labels are in 'sample_id' column. set.seed(100) res <- clustSIGNAL(spe, samples = \"sample_id\", cells = \"uniqueID\", outputs = \"a\")"},{"path":"https://sydneybiox.github.io/clustSIGNAL/reference/adaptiveSmoothing.html","id":null,"dir":"Reference","previous_headings":"","what":"Adaptive smoothing — adaptiveSmoothing","title":"Adaptive smoothing — adaptiveSmoothing","text":"function perform weighted, adaptive smoothing gene expression based heterogeneity cell neighbourhood. Heterogeneous neighbourhoods smoothed less higher weights given cells belonging initial group. Homogeneous neighbourhoods smoothed similar weights given cells.","code":""},{"path":"https://sydneybiox.github.io/clustSIGNAL/reference/adaptiveSmoothing.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Adaptive smoothing — adaptiveSmoothing","text":"","code":"adaptiveSmoothing(spe, nnCells, NN, kernel, spread, threads)"},{"path":"https://sydneybiox.github.io/clustSIGNAL/reference/adaptiveSmoothing.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Adaptive smoothing — adaptiveSmoothing","text":"spe SpatialExperiment object logcounts, PCA, 'putative cell type' groups, entropy outputs included. nnCells character matrix NN nearest neighbours - rows cells columns nearest neighbours ranged closest farthest neighbour. sort = TRUE, neighbours belonging 'putative cell type' group cell moved closer . NN integer number neighbourhood cells function consider. value must greater equal 1. Default value 30. kernel character type distribution used. two valid values \"G\" \"E\". G Gaussian distribution, E exponential distribution. Default value \"G\". spread numeric value distribution spread, represented standard deviation Gaussian distribution rate exponential distribution. Default value 0.05 Gaussian distribution 20 exponential distribution. threads numeric value number CPU cores used analysis. Default value set 1.","code":""},{"path":"https://sydneybiox.github.io/clustSIGNAL/reference/adaptiveSmoothing.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Adaptive smoothing — adaptiveSmoothing","text":"SpatialExperiment object including smoothed gene expression values another assay.","code":""},{"path":"https://sydneybiox.github.io/clustSIGNAL/reference/adaptiveSmoothing.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Adaptive smoothing — adaptiveSmoothing","text":"","code":"data(example) # requires matrix containing NN nearest neighbour cell labels (nnCells), # generated using the neighbourDetect() function spe <- clustSIGNAL::adaptiveSmoothing(spe, nnCells, NN = 30, kernel = \"G\", spread = 0.05, threads = 1) #> [1] \"Smoothing performed. NN = 30 Kernel = G Spread = 0.05 Time 00:31:41\" spe #> class: SpatialExperiment #> dim: 351 1000 #> metadata(0): #> assays(2): logcounts smoothed #> rownames(351): Abcc4 Acp5 ... Zfp57 Zic3 #> rowData names(0): #> colnames(1000): embryo2_Pos29_cell110_z2 embryo2_Pos29_cell117_z2 ... #> embryo2_Pos50_cell361_z5 embryo2_Pos50_cell372_z2 #> colData names(5): uniqueID sample_id entropy nsCluster initCluster #> reducedDimNames(1): PCA #> mainExpName: NULL #> altExpNames(0): #> spatialCoords names(2) : X Y #> imgData names(1): sample_id"},{"path":"https://sydneybiox.github.io/clustSIGNAL/reference/clustSIGNAL.html","id":null,"dir":"Reference","previous_headings":"","what":"clustSIGNAL — clustSIGNAL","title":"clustSIGNAL — clustSIGNAL","text":"clustering method cell type classification spatial transcriptomics data. tool generates uses adaptively smoothed, spatially informed gene expression data clustering.","code":""},{"path":"https://sydneybiox.github.io/clustSIGNAL/reference/clustSIGNAL.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"clustSIGNAL — clustSIGNAL","text":"","code":"clustSIGNAL( spe, samples, cells, dimRed = \"None\", batch = FALSE, batch_by = \"None\", NN = 30, kernel = \"G\", spread = 0.05, sort = TRUE, threads = 1, outputs = \"c\", clustParams = list(clust_c = 0, subclust_c = 0, iter.max = 30, k = 5, cluster.fun = \"louvain\") )"},{"path":"https://sydneybiox.github.io/clustSIGNAL/reference/clustSIGNAL.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"clustSIGNAL — clustSIGNAL","text":"spe SpatialExperiment object. samples character indicating name colData(spe) column containing sample names. cells character indicating name colData(spe) column containing cell IDs. dimRed character indicating name reduced dimensions use SpatialExperiment object (.e., reducedDimNames(spe)). Default value 'None'. batch logical parameter whether perform batch correction. Default value FALSE. batch_by character indicating name colData(spe) column containing batch names. NN integer number neighbourhood cells function consider. value must greater equal 1. Default value 30. kernel character type distribution used. two valid values \"G\" \"E\". G Gaussian distribution, E exponential distribution. Default value \"G\". spread numeric value distribution spread, represented standard deviation Gaussian distribution rate exponential distribution. Default value 0.05 Gaussian distribution 20 exponential distribution. sort logical parameter whether sort neighbourhood region description. Default value TRUE. threads numeric value number CPU cores used analysis. Default value set 1. outputs character type output return user. \"c\" data frame cell IDs respective cluster numbers (default) \"\" list dataframe clusters plus final SpatialExperiment object. clustParams list parameters TwoStepParam clustering methods. clustering parameters order - centers (centers) clustering KmeansParam, centers (centers) sub-clustering clusters KmeansParam, maximum iterations (iter.max) clustering KmeansParam, k values (k) clustering NNGraphParam, community detection method (cluster.fun) use NNGraphParam.","code":""},{"path":"https://sydneybiox.github.io/clustSIGNAL/reference/clustSIGNAL.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"clustSIGNAL — clustSIGNAL","text":"list outputs 1. clusters: data frame cell names cluster classification. 2. spe_final: SpatialExperiment object initial 'putative cell type' groups, entropy values, smoothed gene expression, post-smoothing clusters, silhouette widths included.","code":""},{"path":"https://sydneybiox.github.io/clustSIGNAL/reference/clustSIGNAL.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"clustSIGNAL — clustSIGNAL","text":"","code":"data(example) names(colData(spe)) #> [1] \"uniqueID\" \"sample_id\" \"entropy\" \"nsCluster\" \"initCluster\" # identify the column names with cell and sample labels samples = \"sample_id\" cells = \"uniqueID\" res_list <- clustSIGNAL(spe, samples, cells, outputs = \"c\") #> [1] \"Calculating PCA. Time 00:31:41\" #> [1] \"clustSIGNAL run started. Time 00:31:41\" #> [1] \"Initial nonspatial clustering performed. Clusters = 6 Time 00:31:41\" #> Warning: You're computing too large a percentage of total singular values, use a standard svd instead. #> Warning: You're computing too large a percentage of total singular values, use a standard svd instead. #> [1] \"Nonspatial subclustering performed. Subclusters = 17 Time 00:31:42\" #> [1] \"Regions defined. Time 00:31:43\" #> [1] \"Region domainness calculated. Time 00:31:43\" #> [1] \"Smoothing performed. NN = 30 Kernel = G Spread = 0.05 Time 00:31:54\" #> [1] \"Nonspatial clustering performed on smoothed data. Clusters = 9 Time 00:31:54\" #> [1] \"clustSIGNAL run completed. 00:31:54\" #> Time difference of 13.52057 secs"},{"path":"https://sydneybiox.github.io/clustSIGNAL/reference/dot-calculateProp.html","id":null,"dir":"Reference","previous_headings":"","what":"Cell neighbourhood composition — .calculateProp","title":"Cell neighbourhood composition — .calculateProp","text":"function calculate cell neighbourhood composition 'putative' cell types.","code":""},{"path":"https://sydneybiox.github.io/clustSIGNAL/reference/dot-calculateProp.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Cell neighbourhood composition — .calculateProp","text":"","code":".calculateProp(arr)"},{"path":"https://sydneybiox.github.io/clustSIGNAL/reference/dot-calculateProp.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Cell neighbourhood composition — .calculateProp","text":"arr vector 'putative cell type' assignments cell neighbourhood.","code":""},{"path":"https://sydneybiox.github.io/clustSIGNAL/reference/dot-calculateProp.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Cell neighbourhood composition — .calculateProp","text":"table 'putative cell type' proportions neighbourhood.","code":""},{"path":"https://sydneybiox.github.io/clustSIGNAL/reference/dot-cellName.html","id":null,"dir":"Reference","previous_headings":"","what":"Neighbour cell naming — .cellName","title":"Neighbour cell naming — .cellName","text":"function fetch cell IDs.","code":""},{"path":"https://sydneybiox.github.io/clustSIGNAL/reference/dot-cellName.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Neighbour cell naming — .cellName","text":"","code":".cellName(cell, Clust)"},{"path":"https://sydneybiox.github.io/clustSIGNAL/reference/dot-cellName.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Neighbour cell naming — .cellName","text":"cell vector neighbourhood cell indices. cell indices indicate row number cells sample metadata. Clust data frame initial cluster assignments cells sample.","code":""},{"path":"https://sydneybiox.github.io/clustSIGNAL/reference/dot-cellName.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Neighbour cell naming — .cellName","text":"data frame cell IDs neighbourhood cells.","code":""},{"path":"https://sydneybiox.github.io/clustSIGNAL/reference/dot-cellNameSort.html","id":null,"dir":"Reference","previous_headings":"","what":"Neighbour cell sorting — .cellNameSort","title":"Neighbour cell sorting — .cellNameSort","text":"function perform neighbourhood cell sorting. Neighbourhood cells belong 'putative cell type' central cell moved closer central cell.","code":""},{"path":"https://sydneybiox.github.io/clustSIGNAL/reference/dot-cellNameSort.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Neighbour cell sorting — .cellNameSort","text":"","code":".cellNameSort(cell, Clust)"},{"path":"https://sydneybiox.github.io/clustSIGNAL/reference/dot-cellNameSort.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Neighbour cell sorting — .cellNameSort","text":"cell vector neighbourhood cell indices. cell indices indicate row number cells sample metadata. Clust data frame initial cluster assignments cells sample.","code":""},{"path":"https://sydneybiox.github.io/clustSIGNAL/reference/dot-cellNameSort.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Neighbour cell sorting — .cellNameSort","text":"data frame cell IDs sorted neighbourhood cells.","code":""},{"path":"https://sydneybiox.github.io/clustSIGNAL/reference/dot-clustNum.html","id":null,"dir":"Reference","previous_headings":"","what":"Neighbour cell 'putative cell type' assignment — .clustNum","title":"Neighbour cell 'putative cell type' assignment — .clustNum","text":"function fetch 'putative cell type' assignments cell.","code":""},{"path":"https://sydneybiox.github.io/clustSIGNAL/reference/dot-clustNum.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Neighbour cell 'putative cell type' assignment — .clustNum","text":"","code":".clustNum(cell, subClust)"},{"path":"https://sydneybiox.github.io/clustSIGNAL/reference/dot-clustNum.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Neighbour cell 'putative cell type' assignment — .clustNum","text":"cell vector neighbourhood cell indices. cell indices indicate row number cells sample metadata. subClust data frame 'putative cell type' assignments cells sample.","code":""},{"path":"https://sydneybiox.github.io/clustSIGNAL/reference/dot-clustNum.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Neighbour cell 'putative cell type' assignment — .clustNum","text":"data frame 'putative cell type' assignments neighbourhood cells.","code":""},{"path":"https://sydneybiox.github.io/clustSIGNAL/reference/dot-exp_kernel.html","id":null,"dir":"Reference","previous_headings":"","what":"Exponential distribution weights — .exp_kernel","title":"Exponential distribution weights — .exp_kernel","text":"function generate weights exponential distribution.","code":""},{"path":"https://sydneybiox.github.io/clustSIGNAL/reference/dot-exp_kernel.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Exponential distribution weights — .exp_kernel","text":"","code":".exp_kernel(ed, NN, rate)"},{"path":"https://sydneybiox.github.io/clustSIGNAL/reference/dot-exp_kernel.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Exponential distribution weights — .exp_kernel","text":"ed numeric value entropy neighbourhood. NN integer number neighbourhood cells function consider. value must greater equal 1. Default value 30. rate numeric value rate exponential distribution.","code":""},{"path":"https://sydneybiox.github.io/clustSIGNAL/reference/dot-exp_kernel.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Exponential distribution weights — .exp_kernel","text":"matrix column contains weights related specific entropy values.","code":""},{"path":"https://sydneybiox.github.io/clustSIGNAL/reference/dot-gauss_kernel.html","id":null,"dir":"Reference","previous_headings":"","what":"Gaussian distribution weights — .gauss_kernel","title":"Gaussian distribution weights — .gauss_kernel","text":"function generate weights Gaussian distribution.","code":""},{"path":"https://sydneybiox.github.io/clustSIGNAL/reference/dot-gauss_kernel.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Gaussian distribution weights — .gauss_kernel","text":"","code":".gauss_kernel(ed, NN, sd)"},{"path":"https://sydneybiox.github.io/clustSIGNAL/reference/dot-gauss_kernel.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Gaussian distribution weights — .gauss_kernel","text":"ed numeric value entropy neighbourhood. NN integer number neighbourhood cells function consider. value must greater equal 1. Default value 30. sd numeric value standard deviation Gaussian distribution.","code":""},{"path":"https://sydneybiox.github.io/clustSIGNAL/reference/dot-gauss_kernel.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Gaussian distribution weights — .gauss_kernel","text":"matrix column contains weights related specific entropy values.","code":""},{"path":"https://sydneybiox.github.io/clustSIGNAL/reference/dot-generateBPParam.html","id":null,"dir":"Reference","previous_headings":"","what":"Generating BPParam object — .generateBPParam","title":"Generating BPParam object — .generateBPParam","text":"utility function generate BPPARAM object.","code":""},{"path":"https://sydneybiox.github.io/clustSIGNAL/reference/dot-generateBPParam.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Generating BPParam object — .generateBPParam","text":"","code":".generateBPParam(cores = 1)"},{"path":"https://sydneybiox.github.io/clustSIGNAL/reference/dot-generateBPParam.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Generating BPParam object — .generateBPParam","text":"cores Desired number cores BPPARAM object.","code":""},{"path":"https://sydneybiox.github.io/clustSIGNAL/reference/dot-generateBPParam.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Generating BPParam object — .generateBPParam","text":"BPPPARAM object.","code":""},{"path":"https://sydneybiox.github.io/clustSIGNAL/reference/dot-smoothedData.html","id":null,"dir":"Reference","previous_headings":"","what":"Smoothing per neighbourhood — .smoothedData","title":"Smoothing per neighbourhood — .smoothedData","text":"function perform weighted moving average gene expression neighbourhood.","code":""},{"path":"https://sydneybiox.github.io/clustSIGNAL/reference/dot-smoothedData.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Smoothing per neighbourhood — .smoothedData","text":"","code":".smoothedData(mat, weight)"},{"path":"https://sydneybiox.github.io/clustSIGNAL/reference/dot-smoothedData.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Smoothing per neighbourhood — .smoothedData","text":"mat gene expression matrix genes rows neighbourhood cells columns. weight column matrix weights, number rows equal number neighbourhood cells.","code":""},{"path":"https://sydneybiox.github.io/clustSIGNAL/reference/dot-smoothedData.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Smoothing per neighbourhood — .smoothedData","text":"column matrix smoothed gene expression.","code":""},{"path":"https://sydneybiox.github.io/clustSIGNAL/reference/entropyMeasure.html","id":null,"dir":"Reference","previous_headings":"","what":"Domainness measure — entropyMeasure","title":"Domainness measure — entropyMeasure","text":"function measure heterogeneity cell's neighbourhood terms entropy, homogeneous neighbourhoods low entropy heterogeneous neighbourhoods high entropy.","code":""},{"path":"https://sydneybiox.github.io/clustSIGNAL/reference/entropyMeasure.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Domainness measure — entropyMeasure","text":"","code":"entropyMeasure(spe, cells, regXclust, threads)"},{"path":"https://sydneybiox.github.io/clustSIGNAL/reference/entropyMeasure.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Domainness measure — entropyMeasure","text":"spe SpatialExperiment object logcounts, PCA, 'putative cell type' groups included. cells character vector cell IDs cell. Length vector must equal number cells spatialExperiment object (.e. number rows colData(spe)). regXclust list vectors cell's neighbourhood composition indicated proportion 'putative cell type' groups contains. threads numeric value number CPU cores used analysis.","code":""},{"path":"https://sydneybiox.github.io/clustSIGNAL/reference/entropyMeasure.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Domainness measure — entropyMeasure","text":"SpatialExperiment object including entropy values cell neighbourhood.","code":""},{"path":"https://sydneybiox.github.io/clustSIGNAL/reference/entropyMeasure.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Domainness measure — entropyMeasure","text":"","code":"data(example) # requires list containing cluster proportions of each region (regXclust), # generated using the neighbourDetect() function spe <- clustSIGNAL::entropyMeasure(spe, cells = \"uniqueID\", regXclust, threads = 1) #> [1] \"Region domainness calculated. Time 00:31:56\" head(spe$entropy) #> [1] 0.46900 0.21084 0.69984 0.35336 0.81185 0.35336"},{"path":"https://sydneybiox.github.io/clustSIGNAL/reference/example.html","id":null,"dir":"Reference","previous_headings":"","what":"Example data as SpatialExperiment object — example","title":"Example data as SpatialExperiment object — example","text":"example data generated mouse embryo spatial transcriptomics dataset 3 mouse embryos, 351 genes total 57536 cells. running examples, subset data selecting 1000 random cells embryo 2, excluding cells annotated 'low quality'. subsetting, 1000 cells embryo 2 351 genes.","code":""},{"path":"https://sydneybiox.github.io/clustSIGNAL/reference/example.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Example data as SpatialExperiment object — example","text":"","code":"data(example)"},{"path":"https://sydneybiox.github.io/clustSIGNAL/reference/example.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"Example data as SpatialExperiment object — example","text":"spe spatialExperiment object containing gene expression matrix normalised counts, rows indicate genes columns indicate cells. Also, contains data frame cell metadata including cell IDs, sample IDs, cell type annotations, x-y coordinates cells. nnCells matrix row corresponds cell spe object, columns correspond nearest neighbors. regXclust list element corresponds cell spe object, contains cluster composition proportions.","code":""},{"path":"https://sydneybiox.github.io/clustSIGNAL/reference/example.html","id":"source","dir":"Reference","previous_headings":"","what":"Source","title":"Example data as SpatialExperiment object — example","text":"Integration spatial single-cell transcriptomic data elucidates mouse organogenesis, Nature Biotechnology, 2021. Webpage: https://www.nature.com/articles/s41587-021-01006-2","code":""},{"path":"https://sydneybiox.github.io/clustSIGNAL/reference/mEmbryo2.html","id":null,"dir":"Reference","previous_headings":"","what":"Mouse Embryo Data — mEmbryo2","title":"Mouse Embryo Data — mEmbryo2","text":"dataset contains spatial transcriptomics data 3 mouse embryos, 351 genes total 57536 cells. vignettes, subset data randomly selecting 5000 cells embryo 2, excluding cells annotated 'low quality'.","code":""},{"path":"https://sydneybiox.github.io/clustSIGNAL/reference/mEmbryo2.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Mouse Embryo Data — mEmbryo2","text":"","code":"data(mEmbryo2)"},{"path":"https://sydneybiox.github.io/clustSIGNAL/reference/mEmbryo2.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"Mouse Embryo Data — mEmbryo2","text":"me_expr gene expression matrix normalised counts, rows indicate genes columns indicate cells. me_data data frame cell metadata including cell IDs, sample IDs, cell type annotations, x-y coordinates cells.","code":""},{"path":"https://sydneybiox.github.io/clustSIGNAL/reference/mEmbryo2.html","id":"source","dir":"Reference","previous_headings":"","what":"Source","title":"Mouse Embryo Data — mEmbryo2","text":"Integration spatial single-cell transcriptomic data elucidates mouse organogenesis, Nature Biotechnology, 2021. Webpage: https://www.nature.com/articles/s41587-021-01006-2","code":""},{"path":"https://sydneybiox.github.io/clustSIGNAL/reference/mHypothal.html","id":null,"dir":"Reference","previous_headings":"","what":"Mouse Hypothalamus Data — mHypothal","title":"Mouse Hypothalamus Data — mHypothal","text":"dataset contains spatial transcriptomics data 181 mouse hypothalamus samples, 155 genes total 1,027,080 cells. running vignettes, subset data selecting total 6000 cells 3 samples - Animal 1 Bregma -0.09 (2080 cells) Animal 7 Bregmas 0.16 (1936 cells) -0.09 (1984 cells), excluding cells annotated 'ambiguous', removed 20 genes assessed using different technology.","code":""},{"path":"https://sydneybiox.github.io/clustSIGNAL/reference/mHypothal.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Mouse Hypothalamus Data — mHypothal","text":"","code":"data(mHypothal)"},{"path":"https://sydneybiox.github.io/clustSIGNAL/reference/mHypothal.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"Mouse Hypothalamus Data — mHypothal","text":"mh_expr gene expression matrix normalised counts, rows indicate genes columns indicate cells. mh_data data frame cell metadata including cell IDs, sample IDs, cell type annotations, x-y coordinates cells.","code":""},{"path":"https://sydneybiox.github.io/clustSIGNAL/reference/mHypothal.html","id":"source","dir":"Reference","previous_headings":"","what":"Source","title":"Mouse Hypothalamus Data — mHypothal","text":"Molecular, Spatial Functional Single-Cell Profiling Hypothalamic Preoptic Region, Science, 2018. Webpage: https://www.science.org/doi/10.1126/science.aau5324","code":""},{"path":"https://sydneybiox.github.io/clustSIGNAL/reference/neighbourDetect.html","id":null,"dir":"Reference","previous_headings":"","what":"Cell neighbourhood detection — neighbourDetect","title":"Cell neighbourhood detection — neighbourDetect","text":"function identify neighbourhood cell. sort = TRUE, neighbourhoods also sorted cells belonging group central cell arranged closer .","code":""},{"path":"https://sydneybiox.github.io/clustSIGNAL/reference/neighbourDetect.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Cell neighbourhood detection — neighbourDetect","text":"","code":"neighbourDetect(spe, samples, NN, cells, sort)"},{"path":"https://sydneybiox.github.io/clustSIGNAL/reference/neighbourDetect.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Cell neighbourhood detection — neighbourDetect","text":"spe SpatialExperiment object logcounts, PCA, 'putative cell type' groups included. samples character vector sample names cells belong. Length vector must equal number cells spatialExperiment object (.e. number rows colData(spe)). NN integer number neighbourhood cells function consider. value must greater equal 1. Default value 30. cells character vector cell IDs cell. Length vector must equal number cells SpatialExperiment object (.e. number rows colData(spe)). sort logical parameter whether sort neighbourhood region description. Default value TRUE.","code":""},{"path":"https://sydneybiox.github.io/clustSIGNAL/reference/neighbourDetect.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Cell neighbourhood detection — neighbourDetect","text":"list containing two items: 1. nnCells, character matrix NN nearest neighbours - rows cells columns nearest neighbours ranged closest farthest neighbour. sort = TRUE, neighbours belonging 'putative cell type' group cell moved closer . 2. regXclust, list vectors cell's neighbourhood composition indicated proportion 'putative cell type' groups contains.","code":""},{"path":"https://sydneybiox.github.io/clustSIGNAL/reference/neighbourDetect.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Cell neighbourhood detection — neighbourDetect","text":"","code":"data(example) out_list <- clustSIGNAL::neighbourDetect(spe, samples = \"sample_id\", NN = 30, cells = \"uniqueID\", sort = TRUE) #> [1] \"Regions defined. Time 00:31:57\" names(out_list) #> [1] \"nnCells\" \"regXclust\""},{"path":"https://sydneybiox.github.io/clustSIGNAL/reference/p1_clustering.html","id":null,"dir":"Reference","previous_headings":"","what":"Initial non-spatial clustering — p1_clustering","title":"Initial non-spatial clustering — p1_clustering","text":"function perform initial non-spatial clustering sub-clustering normalised gene expression generate 'initial clusters'.","code":""},{"path":"https://sydneybiox.github.io/clustSIGNAL/reference/p1_clustering.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Initial non-spatial clustering — p1_clustering","text":"","code":"p1_clustering(spe, dimRed, batch, batch_by, clustParams)"},{"path":"https://sydneybiox.github.io/clustSIGNAL/reference/p1_clustering.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Initial non-spatial clustering — p1_clustering","text":"spe SpatialExperiment object. reclust = FALSE, object contain logcounts PCA, reculst = TRUE, object contain smoothed gene expression. dimRed character indicating name reduced dimensions use SpatialExperiment object (.e., reducedDimNames(spe)). Default value 'PCA'. batch logical parameter whether perform batch correction. Default value FALSE. batch_by character indicating name colData(spe) column containing batch names. clustParams list parameters TwoStepParam clustering methods. clustering parameters order - centers (centers) clustering KmeansParam, centers (centers) sub-clustering clusters KmeansParam, maximum iterations (iter.max) clustering KmeansParam, k values (k) clustering NNGraphParam, community detection method (cluster.fun) use NNGraphParam.","code":""},{"path":"https://sydneybiox.github.io/clustSIGNAL/reference/p1_clustering.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Initial non-spatial clustering — p1_clustering","text":"SpatialExperiment object containing 'initial cluster' groups allotted cell.","code":""},{"path":"https://sydneybiox.github.io/clustSIGNAL/reference/p1_clustering.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Initial non-spatial clustering — p1_clustering","text":"","code":"data(example) spe <- clustSIGNAL::p1_clustering(spe, dimRed = \"PCA\", batch = FALSE, batch_by = \"None\", clustParams = list(0, 0, 30, 5, \"louvain\")) #> [1] \"Initial nonspatial clustering performed. Clusters = 7 Time 00:31:57\" #> Warning: You're computing too large a percentage of total singular values, use a standard svd instead. #> Warning: You're computing too large a percentage of total singular values, use a standard svd instead. #> Warning: You're computing too large a percentage of total singular values, use a standard svd instead. #> [1] \"Nonspatial subclustering performed. Subclusters = 20 Time 00:31:58\" head(spe$nsCluster) #> [1] 5 5 7 5 5 5 #> Levels: 1 2 3 4 5 6 7 head(spe$initCluster) #> embryo2_Pos29_cell110_z2 embryo2_Pos29_cell117_z2 embryo2_Pos29_cell128_z2 #> 5.2 5.2 7.1 #> embryo2_Pos29_cell134_z2 embryo2_Pos29_cell14_z2 embryo2_Pos29_cell141_z2 #> 5.2 5.2 5.2 #> 20 Levels: 1.1 1.2 2.1 2.2 3.1 3.2 3.3 4.1 4.2 4.3 5.1 5.2 5.3 5.4 5.5 ... 7.3"},{"path":"https://sydneybiox.github.io/clustSIGNAL/reference/p2_clustering.html","id":null,"dir":"Reference","previous_headings":"","what":"Final non-spatial clustering — p2_clustering","title":"Final non-spatial clustering — p2_clustering","text":"function containing cluster adaptively smoothed gene expression data.","code":""},{"path":"https://sydneybiox.github.io/clustSIGNAL/reference/p2_clustering.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Final non-spatial clustering — p2_clustering","text":"","code":"p2_clustering(spe, batch, batch_by, clustParams)"},{"path":"https://sydneybiox.github.io/clustSIGNAL/reference/p2_clustering.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Final non-spatial clustering — p2_clustering","text":"spe SpatialExperiment object. reclust = FALSE, object contain logcounts PCA, reculst = TRUE, object contain smoothed gene expression. batch logical parameter whether perform batch correction. Default value FALSE. batch_by character indicating name colData(spe) column containing batch names. clustParams list parameters TwoStepParam clustering methods. clustering parameters order - centers (centers) clustering KmeansParam, centers (centers) sub-clustering clusters KmeansParam, maximum iterations (iter.max) clustering KmeansParam, k values (k) clustering NNGraphParam, community detection method (cluster.fun) use NNGraphParam.","code":""},{"path":"https://sydneybiox.github.io/clustSIGNAL/reference/p2_clustering.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Final non-spatial clustering — p2_clustering","text":"SpatialExperiment object containing clusters generated smoothed data.","code":""},{"path":"https://sydneybiox.github.io/clustSIGNAL/reference/p2_clustering.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Final non-spatial clustering — p2_clustering","text":"","code":"data(example) # For non-spatial clustering of normalised counts spe <- clustSIGNAL::p2_clustering(spe, batch = FALSE, batch_by = \"None\", clustParams = list(0, 0, 30, 5, \"louvain\")) #> [1] \"Nonspatial clustering performed on smoothed data. Clusters = 9 Time 00:31:58\" head(spe$clustSIGNAL) #> [1] 6 6 4 6 6 6 #> Levels: 1 2 3 4 5 6 7 8 9"},{"path":"https://sydneybiox.github.io/clustSIGNAL/news/index.html","id":"clustsignal-v0994-2024-11-28","dir":"Changelog","previous_headings":"","what":"clustSIGNAL v0.99.4 (2024-11-28)","title":"clustSIGNAL v0.99.4 (2024-11-28)","text":"Corrected character check output format type.","code":""},{"path":"https://sydneybiox.github.io/clustSIGNAL/news/index.html","id":"clustsignal-v0003-2024-10-31","dir":"Changelog","previous_headings":"","what":"clustSIGNAL v0.00.3 (2024-10-31)","title":"clustSIGNAL v0.00.3 (2024-10-31)","text":"Clustering parameter options added package Initial final clustering steps now separate functions Test units added package","code":""},{"path":"https://sydneybiox.github.io/clustSIGNAL/news/index.html","id":"clustsignal-v0002-2024-10-08","dir":"Changelog","previous_headings":"","what":"clustSIGNAL v0.00.2 (2024-10-08)","title":"clustSIGNAL v0.00.2 (2024-10-08)","text":"Updated parallel runs smoothing function faster runs","code":""},{"path":"https://sydneybiox.github.io/clustSIGNAL/news/index.html","id":"clustsignal-v0990-2024-09-19","dir":"Changelog","previous_headings":"","what":"clustSIGNAL v0.99.0 (2024-09-19)","title":"clustSIGNAL v0.99.0 (2024-09-19)","text":"Submitted Bioconductor.","code":""}] +[{"path":"https://sydneybiox.github.io/clustSIGNAL/articles/clustSIGNAL.html","id":"overview","dir":"Articles","previous_headings":"","what":"Overview","title":"clustSIGNAL tutorial","text":"vignette, demonstrate perform spatially-resolved clustering clustSIGNAL. Following , explore clusters using pre-defined metrics like adjusted rand index (ARI), normalised mutual information (NMI), average silhouette width, well spatial plots. also display use entropy measures generated -product clustSIGNAL process understanding tissue structure sample. end, also explore multisample analysis clustSIGNAL.","code":"# load required packages library(clustSIGNAL) library(distances) library(cluster) library(aricode) library(dplyr) library(ggplot2) library(patchwork) library(scattermore)"},{"path":"https://sydneybiox.github.io/clustSIGNAL/articles/clustSIGNAL.html","id":"single-sample-analysis-with-clustsignal","dir":"Articles","previous_headings":"","what":"Single sample analysis with clustSIGNAL","title":"clustSIGNAL tutorial","text":", use SeqFISH mouse embryo dataset Lohoff et al, 2021 , contains spatial transcriptomics data 3 mouse embryos, 351 genes total 57,536 cells. vignette, subset data randomly selecting 5000 cells Embryo 2, excluding cells manually annotated ‘Low quality’. begin creating SpatialExperiment object gene expression cell information data subset, ensuring spatial coordinates stored spatialCoords within SpatialExperiment object. data already SpatialExperiment object, user can directly run clustSIGNAL, ensuring basic requirements like spatial coordinates normalized counts met. running clustSIGNAL, need know column names colData SpatialExperiment object contain sample cell labels. , sample labels ‘sample_id’ column, cell labels ‘uniqueID’ column.","code":"data(mEmbryo2) spe <- SpatialExperiment(assays = list(logcounts = me_expr), colData = me_data, spatialCoordsNames = c(\"X\", \"Y\")) spe ## class: SpatialExperiment ## dim: 351 5000 ## metadata(0): ## assays(1): logcounts ## rownames(351): Abcc4 Acp5 ... Zfp57 Zic3 ## rowData names(0): ## colnames(5000): embryo2_Pos29_cell100_z2 embryo2_Pos29_cell101_z5 ... ## embryo2_Pos50_cell97_z5 embryo2_Pos50_cell99_z5 ## colData names(4): uniqueID pos celltype_mapped_refined sample_id ## reducedDimNames(0): ## mainExpName: NULL ## altExpNames(0): ## spatialCoords names(2) : X Y ## imgData names(0): colnames(colData(spe)) ## [1] \"uniqueID\" \"pos\" ## [3] \"celltype_mapped_refined\" \"sample_id\""},{"path":"https://sydneybiox.github.io/clustSIGNAL/articles/clustSIGNAL.html","id":"running-clustsignal-on-one-sample","dir":"Articles","previous_headings":"","what":"Running clustSIGNAL on one sample","title":"clustSIGNAL tutorial","text":"Next, run clustSIGNAL using sample cell labels identified earlier. simplest clustSIGNAL run requires SpatialExperiment object, two variables holding colData column names containing sample cell labels, type output user like see. parameters can modified include dimRed specify low dimension data use, batch perform batch correction, batch_by indicate sample batches contributing batch effect, NN specify neighbourhood size, kernel weight distribution use, spread distribution spread value, sort sort neighbourhood, threads specify number cpus use parallel runs, clustParams specify clustering parameters. Furthermore, adaptively smoothed gene expression data generated clustSIGNAL useful downstream analyses accessible user choose output final SpatialExperiment object. returns list can contain dataframe cluster names, matrix cell labels region’s neighbourhood, final SpatialExperiment object, combination , depending choice ‘outputs’ selected. , output contains three data types. cluster dataframe contains cell labels cluster numbers allotted clustSIGNAL. final SpatialExperiment object contains adaptively smoothed gene expression data additional assay, well initial clusters, entropy values, clustSIGNAL clusters.","code":"set.seed(100) samples <- \"sample_id\" cells <- \"uniqueID\" res_emb <- clustSIGNAL(spe, samples, cells, outputs = \"a\") ## [1] \"Calculating PCA. Time 01:11:53\" ## [1] \"clustSIGNAL run started. Time 01:11:54\" ## [1] \"Initial nonspatial clustering performed. Clusters = 11 Time 01:11:55\" ## [1] \"Nonspatial subclustering performed. Subclusters = 50 Time 01:11:57\" ## [1] \"Regions defined. Time 01:11:59\" ## [1] \"Region domainness calculated. Time 01:12:00\" ## [1] \"Smoothing performed. NN = 30 Kernel = G Spread = 0.05 Time 01:12:33\" ## [1] \"Nonspatial clustering performed on smoothed data. Clusters = 16 Time 01:12:35\" ## [1] \"clustSIGNAL run completed. 01:12:35\" ## Time difference of 41.1917 secs names(res_emb) ## [1] \"clusters\" \"spe_final\" head(res_emb$clusters, n = 3) ## Cells Clusters ## 1 embryo2_Pos29_cell100_z2 13 ## 2 embryo2_Pos29_cell101_z5 13 ## 3 embryo2_Pos29_cell104_z2 13 spe <- res_emb$spe_final spe ## class: SpatialExperiment ## dim: 351 5000 ## metadata(0): ## assays(2): logcounts smoothed ## rownames(351): Abcc4 Acp5 ... Zfp57 Zic3 ## rowData names(0): ## colnames(5000): embryo2_Pos29_cell100_z2 embryo2_Pos29_cell101_z5 ... ## embryo2_Pos50_cell97_z5 embryo2_Pos50_cell99_z5 ## colData names(8): uniqueID pos ... entropy clustSIGNAL ## reducedDimNames(2): PCA PCA.smooth ## mainExpName: NULL ## altExpNames(0): ## spatialCoords names(2) : X Y ## imgData names(1): sample_id"},{"path":"https://sydneybiox.github.io/clustSIGNAL/articles/clustSIGNAL.html","id":"analysing-clustsignal-results","dir":"Articles","previous_headings":"","what":"Analysing clustSIGNAL results","title":"clustSIGNAL tutorial","text":"section, analyse results clustSIGNAL spatial plots clustering metrics.","code":""},{"path":"https://sydneybiox.github.io/clustSIGNAL/articles/clustSIGNAL.html","id":"visualising-clustsignal-clusters","dir":"Articles","previous_headings":"Analysing clustSIGNAL results","what":"Visualising clustSIGNAL clusters","title":"clustSIGNAL tutorial","text":"use spatial coordinates cells cluster labels entropy values visualize clustering output. spatial location () entropy distribution (B) clusters provide spatial context cells neighbourhoods, well compositions neighbourhoods. example, low entropy cluster 4 indicates cells cluster generally found homogeneous space, whereas high entropy cluster 7 cells indicates belong regions cell diversity. can also visualized spatial plot.","code":"colors <- c(\"#635547\", \"#8EC792\", \"#9e6762\", \"#FACB12\", \"#3F84AA\", \"#0F4A9C\", \"#ff891c\", \"#EF5A9D\", \"#C594BF\", \"#DFCDE4\", \"#139992\", \"#65A83E\", \"#8DB5CE\", \"#005579\", \"#C9EBFB\", \"#B51D8D\", \"#532C8A\", \"#8870ad\", \"#cc7818\", \"#FBBE92\", \"#EF4E22\", \"#f9decf\", \"#c9a997\", \"#C72228\", \"#f79083\", \"#F397C0\", \"#DABE99\", \"#c19f70\", \"#354E23\", \"#C3C388\", \"#647a4f\", \"#CDE088\", \"#f7f79e\", \"#F6BFCB\", \"#7F6874\", \"#989898\", \"#1A1A1A\", \"#FFFFFF\", \"#e6e6e6\", \"#77441B\", \"#F90026\", \"#A10037\", \"#DA5921\", \"#E1C239\", \"#9DD84A\") df_ent <- as.data.frame(colData(spe)) # spatial plot spt_clust <- df_ent %>% ggplot(aes(x = spatialCoords(spe)[, 1], y = -spatialCoords(spe)[, 2])) + geom_scattermore(pointsize = 3, aes(colour = clustSIGNAL)) + scale_color_manual(values = colors) + ggtitle(\"A\") + labs(x = \"x-coordinate\", y = \"y-coordinate\") + guides(color = guide_legend(title = \"Clusters\", override.aes = list(size = 3))) + theme_classic() + theme(text = element_text(size = 12)) # calculating median entropy of each cluster celltype_ent <- df_ent %>% group_by(as.character(clustSIGNAL)) %>% summarise(meanEntropy = median(entropy)) # reordering clusters by their median entropy # low to high median entropy cellOrder <- celltype_ent$meanEntropy names(cellOrder) <- celltype_ent$`as.character(clustSIGNAL)` cellOrder <- sort(cellOrder) df_ent$clustSIGNAL <- factor(df_ent$clustSIGNAL, levels = names(cellOrder)) # box plot of cluster entropy colors_ent <- colors[as.numeric(names(cellOrder))] box_clust <- df_ent %>% ggplot(aes(x = clustSIGNAL, y = entropy, fill = clustSIGNAL)) + geom_boxplot() + scale_fill_manual(values = colors_ent) + ggtitle(\"B\") + labs(x = \"clustSIGNAL clusters\", y = \"Entropy\") + theme_classic() + theme(legend.position = \"none\", text = element_text(size = 12), axis.text.x = element_text(angle = 90, vjust = 0.5, hjust = 1)) spt_clust + box_clust + patchwork::plot_layout(guides = \"collect\", widths = c(2, 3))"},{"path":"https://sydneybiox.github.io/clustSIGNAL/articles/clustSIGNAL.html","id":"cluster-metrics","dir":"Articles","previous_headings":"Analysing clustSIGNAL results","what":"Cluster metrics","title":"clustSIGNAL tutorial","text":"assess clustering efficiency clustSIGNAL using commonly used clustering metrics ARI, NMI, silhouette width. ARI NMI usable prior cell annotation information available, assume cell annotation ground truth. , ARI NMI measure similarity agreement (respectively) cluster labels obtained clustSIGNAL manual cell annotation labels. contrary, silhouette width reference-free evaluates well cell fits within assigned cluster compared clusters.","code":"# average silhouette width clusts <- as.numeric(as.character(spe$clustSIGNAL)) cXg_mat <- t(as.matrix(logcounts(spe))) distMat <- distances(cXg_mat) silCluster <- as.matrix(silhouette(clusts, distMat)) spe$rcSil <- silCluster[, 3] # ARI and NMI as.data.frame(colData(spe)) %>% summarise(ARI = aricode::ARI(celltype_mapped_refined, clustSIGNAL), NMI = aricode::NMI(celltype_mapped_refined, clustSIGNAL), ASW = mean(rcSil)) ## ARI NMI ASW ## 1 0.3420434 0.6281433 0.03767501"},{"path":"https://sydneybiox.github.io/clustSIGNAL/articles/clustSIGNAL.html","id":"entropy-spread-and-distribution","dir":"Articles","previous_headings":"Analysing clustSIGNAL results","what":"Entropy spread and distribution","title":"clustSIGNAL tutorial","text":"entropy values generated clustSIGNAL process can useful analyzing sample structure. entropy range can indicate whether tissue sample contains homogeneous domain-like structures. example, minimum entropy value 0, means cells placed completely homogeneous space looking neighbourhood size 30 cells (NN = 30 used generating entropy data). Moreover, mean entropy value low, can interpreted tissue least domain-like structures. spread () spatial distribution (B) region entropy measures can useful assessing tissue composition samples - low entropy regions homogeneous domain-like structure, whereas high entropy regions heterogeneous uniform distribution cells.","code":"# Data assessment - Overall entropy as.data.frame(colData(spe)) %>% summarise(min_Entropy = min(entropy), max_Entropy = max(entropy), mean_Entropy = mean(entropy)) ## min_Entropy max_Entropy mean_Entropy ## 1 0 3.05603 1.37066 # Histogram of entropy spread hst_ent <- as.data.frame(colData(spe)) %>% ggplot(aes(entropy)) + geom_histogram(binwidth = 0.05) + ggtitle(\"A\") + labs(x = \"Entropy\", y = \"Number of regions\") + theme_classic() + theme(text = element_text(size = 12)) # Spatial plot showing sample entropy distribution spt_ent <- as.data.frame(colData(spe)) %>% ggplot(aes(x = spatialCoords(spe)[, 1], y = -spatialCoords(spe)[, 2])) + geom_scattermore(pointsize = 3, aes(colour = entropy)) + scale_colour_gradient2(\"Entropy\", low = \"grey\", high = \"blue\") + scale_size_continuous(range = c(0, max(spe$entropy))) + ggtitle(\"B\") + labs(x = \"x-coordinate\", y = \"y-coordinate\") + theme_classic() + theme(text = element_text(size = 12)) hst_ent + spt_ent"},{"path":"https://sydneybiox.github.io/clustSIGNAL/articles/clustSIGNAL.html","id":"generating-entropy-data-only","dir":"Articles","previous_headings":"","what":"Generating entropy data only","title":"clustSIGNAL tutorial","text":"evaluate tissue structure using entropy values, can run clustSIGNAL entropy measurement step, without running complete method. entropy values added SpatialExperiment object can used assessing tissue structure.","code":"data(mEmbryo2) spe <- SpatialExperiment(assays = list(logcounts = me_expr), colData = me_data, spatialCoordsNames = c(\"X\", \"Y\")) set.seed(100) spe <- scater::runPCA(spe) spe <- clustSIGNAL::p1_clustering(spe, dimRed = \"PCA\", batch = FALSE, batch_by = \"None\", clustParams = list( 0, 0, 30, 5, \"louvain\")) ## [1] \"Initial nonspatial clustering performed. Clusters = 11 Time 01:12:44\" ## [1] \"Nonspatial subclustering performed. Subclusters = 50 Time 01:12:46\" outReg <- clustSIGNAL::neighbourDetect(spe, samples = \"sample_id\", NN = 30, cells = \"uniqueID\", sort = TRUE) ## [1] \"Regions defined. Time 01:12:48\" spe <- entropyMeasure(spe, cells = \"uniqueID\", outReg$regXclust, threads = 1) ## [1] \"Region domainness calculated. Time 01:12:48\" head(spe$entropy) ## [1] 1.03701 0.42003 0.62749 0.76651 0.56651 0.21084"},{"path":"https://sydneybiox.github.io/clustSIGNAL/articles/clustSIGNAL.html","id":"multisample-analysis-with-clustsignal","dir":"Articles","previous_headings":"","what":"Multisample analysis with clustSIGNAL","title":"clustSIGNAL tutorial","text":", use MERFISH mouse hypothalamic preoptic region dataset Moffitt et al, 2018, contains spatial transcriptomics data 181 samples, 155 genes total 1,027,080 cells. vignette, subset data selecting total 6000 random cells 3 samples - Animal 1 Bregma -0.09 (2080 cells), Animal 7 Bregma 0.16 (1936 cells), Animal 7 Bregma -0.09 (1984 cells), excluding cells manually annotated ‘ambiguous’ 20 genes assessed using different technology. start analysis creating SpatialExperiment object gene expression cell information data subset, ensuring spatial coordinates stored spatialCoords within SpatialExperiment object. , cell labels column ‘Cell_ID’ sample labels ‘samples’ column SpatialExperiment object.","code":"data(mHypothal) spe2 <- SpatialExperiment(assays = list(logcounts = mh_expr), colData = mh_data, spatialCoordsNames = c(\"X\", \"Y\")) spe2 ## class: SpatialExperiment ## dim: 135 6000 ## metadata(0): ## assays(1): logcounts ## rownames(135): Ace2 Adora2a ... Ttn Ttyh2 ## rowData names(0): ## colnames(6000): 74d3f69d-e8f2-4c33-a8ca-fac3eb65e55a ## 41158ddc-e70c-487b-b891-0cb3c8452555 ... ## 54145623-7071-482c-b9da-d0d2dd31274a ## 96bc85ce-b993-4fb1-8e0c-165f83f0cfd0 ## colData names(4): Cell_ID Cell_class sample_id samples ## reducedDimNames(0): ## mainExpName: NULL ## altExpNames(0): ## spatialCoords names(2) : X Y ## imgData names(0): colnames(colData(spe2)) ## [1] \"Cell_ID\" \"Cell_class\" \"sample_id\" \"samples\""},{"path":"https://sydneybiox.github.io/clustSIGNAL/articles/clustSIGNAL.html","id":"clustsignal-run","dir":"Articles","previous_headings":"Multisample analysis with clustSIGNAL","what":"clustSIGNAL run","title":"clustSIGNAL tutorial","text":"One important concepts take account running multisample analysis batch effects. gathering samples different sources different technologies/procedures, technical batch effects might introduced dataset. run clustSIGNAL batch correction mode simply setting batch = TRUE. method uses harmony internally batch correction.","code":"set.seed(110) samples <- \"samples\" cells <- \"Cell_ID\" res_hyp <- clustSIGNAL(spe2, samples, cells, threads = 4, outputs = \"a\") ## [1] \"Calculating PCA. Time 01:12:49\" ## [1] \"clustSIGNAL run started. Time 01:12:49\" ## [1] \"Initial nonspatial clustering performed. Clusters = 11 Time 01:12:50\" ## [1] \"Nonspatial subclustering performed. Subclusters = 52 Time 01:12:52\" ## [1] \"Regions defined. Time 01:12:54\" ## [1] \"Region domainness calculated. Time 01:12:56\" ## [1] \"Smoothing performed. NN = 30 Kernel = G Spread = 0.05 Time 01:13:11\" ## [1] \"Nonspatial clustering performed on smoothed data. Clusters = 11 Time 01:13:13\" ## [1] \"clustSIGNAL run completed. 01:13:13\" ## Time difference of 23.97924 secs spe2 <- res_hyp$spe_final spe2 ## class: SpatialExperiment ## dim: 135 6000 ## metadata(0): ## assays(2): logcounts smoothed ## rownames(135): Ace2 Adora2a ... Ttn Ttyh2 ## rowData names(0): ## colnames(6000): 74d3f69d-e8f2-4c33-a8ca-fac3eb65e55a ## 41158ddc-e70c-487b-b891-0cb3c8452555 ... ## 54145623-7071-482c-b9da-d0d2dd31274a ## 96bc85ce-b993-4fb1-8e0c-165f83f0cfd0 ## colData names(8): Cell_ID Cell_class ... entropy clustSIGNAL ## reducedDimNames(2): PCA PCA.smooth ## mainExpName: NULL ## altExpNames(0): ## spatialCoords names(2) : X Y ## imgData names(1): sample_id"},{"path":"https://sydneybiox.github.io/clustSIGNAL/articles/clustSIGNAL.html","id":"clustering-metrics","dir":"Articles","previous_headings":"Multisample analysis with clustSIGNAL","what":"Clustering metrics","title":"clustSIGNAL tutorial","text":"Clustering entropy results can calculated visualized sample. clustSIGNAL works well samples uniform distribution cells.","code":"samplesList <- levels(spe2[[samples]]) samplesList ## [1] \"1.-0.09\" \"7.-0.09\" \"7.0.16\" # calculating silhouette width per sample silWidthRC <- matrix(nrow = 0, ncol = 3) for (s in samplesList) { speX <- spe2[, spe2[[samples]] == s] clust_sub <- as.numeric(as.character(speX$clustSIGNAL)) cXg <- t(as.matrix(logcounts(speX))) distMat <- distances(cXg) silCluster <- as.matrix(silhouette(clust_sub, distMat)) silWidthRC <- rbind(silWidthRC, silCluster) } spe2$rcSil <- silWidthRC[, 3] as.data.frame(colData(spe2)) %>% group_by(samples) %>% summarise(ARI = aricode::ARI(Cell_class, clustSIGNAL), NMI = aricode::NMI(Cell_class, clustSIGNAL), ASW = mean(rcSil), min_Entropy = min(entropy), max_Entropy = max(entropy), mean_Entropy = mean(entropy)) ## # A tibble: 3 × 7 ## samples ARI NMI ASW min_Entropy max_Entropy mean_Entropy ## ## 1 1.-0.09 0.445 0.624 0.0807 1.32 4.42 3.30 ## 2 7.-0.09 0.511 0.679 0.115 0.970 4.64 3.30 ## 3 7.0.16 0.645 0.744 0.104 0.970 4.42 3.26"},{"path":"https://sydneybiox.github.io/clustSIGNAL/articles/clustSIGNAL.html","id":"visualizing-clustsignal-clusters","dir":"Articles","previous_headings":"Multisample analysis with clustSIGNAL","what":"Visualizing clustSIGNAL clusters","title":"clustSIGNAL tutorial","text":"clustSIGNAL performs clustering cells dataset one run, thereby generating clusters across multiple samples. user need map cluster labels samples. example, cluster 1 represents cell type three samples, without needing explicit mapping samples. spatial location (top) entropy distribution (bottom) clusters can compared multisample analysis, providing spatial context cluster cells neighbourhood compositions different samples.","code":"df_ent <- as.data.frame(colData(spe2)) # spatial plot spt_clust <- df_ent %>% ggplot(aes(x = spatialCoords(spe2)[, 1], y = -spatialCoords(spe2)[, 2])) + geom_scattermore(pointsize = 3, aes(colour = clustSIGNAL)) + scale_color_manual(values = colors) + facet_wrap(vars(samples), scales = \"free\", nrow = 1) + labs(x = \"x-coordinate\", y = \"y-coordinate\") + guides(color = guide_legend(title = \"Clusters\", override.aes = list(size = 3))) + theme_classic() + theme(text = element_text(size = 12), axis.text.x = element_text(angle = 90, vjust = 0.5)) box_clust <- list() for (s in samplesList) { df_ent_sub <- as.data.frame(colData(spe2)[spe2[[samples]] == s, ]) # calculating median entropy of each cluster in a sample celltype_ent <- df_ent_sub %>% group_by(as.character(clustSIGNAL)) %>% summarise(meanEntropy = median(entropy)) # reordering clusters by their median entropy # low to high median entropy cellOrder <- celltype_ent$meanEntropy names(cellOrder) <- celltype_ent$`as.character(clustSIGNAL)` cellOrder = sort(cellOrder) df_ent_sub$clustSIGNAL <- factor(df_ent_sub$clustSIGNAL, levels = names(cellOrder)) # box plot of cluster entropy colors_ent <- colors[as.numeric(names(cellOrder))] box_clust[[s]] <- df_ent_sub %>% ggplot(aes(x = clustSIGNAL, y = entropy, fill = clustSIGNAL)) + geom_boxplot() + scale_fill_manual(values = colors_ent) + facet_wrap(vars(samples), nrow = 1) + labs(x = \"clustSIGNAL clusters\", y = \"Entropy\") + ylim(0, NA) + theme_classic() + theme(strip.text = element_blank(), legend.position = \"none\", text = element_text(size = 12), axis.text.x = element_text(angle = 90, vjust = 0.5)) } spt_clust / (patchwork::wrap_plots(box_clust[1:3], nrow = 1) + plot_layout(axes = \"collect\")) + plot_layout(guides = \"collect\", heights = c(5, 3)) + plot_annotation( title = \"Spatial (top) and entropy (bottom) distributions of clusters\")"},{"path":"https://sydneybiox.github.io/clustSIGNAL/articles/clustSIGNAL.html","id":"visualising-entropy-spread-and-distribution","dir":"Articles","previous_headings":"Multisample analysis with clustSIGNAL","what":"Visualising entropy spread and distribution","title":"clustSIGNAL tutorial","text":"multisample analysis, spread () spatial distribution (B) region entropy measures can useful assessing comparing tissue structure samples.","code":"# Histogram of entropy spread hst_ent <- as.data.frame(colData(spe2)) %>% ggplot(aes(entropy)) + geom_histogram(binwidth = 0.05) + facet_wrap(vars(samples), nrow = 1) + labs(x = \"Entropy\", y = \"Number of regions\") + theme_classic() + theme(text = element_text(size = 12)) # Spatial plot showing sample entropy distribution spt_ent <- as.data.frame(colData(spe2)) %>% ggplot(aes(x = spatialCoords(spe2)[, 1], y = -spatialCoords(spe2)[, 2])) + geom_scattermore(pointsize = 3, aes(colour = entropy)) + scale_colour_gradient2(\"Entropy\", low = \"grey\", high = \"blue\") + scale_size_continuous(range = c(0, max(spe2$entropy))) + facet_wrap(vars(samples), scales = \"free\", nrow = 1) + labs(x = \"x-coordinate\", y = \"y-coordinate\") + theme_classic() + theme(strip.text = element_blank(), text = element_text(size = 12), axis.text.x = element_text(angle = 90, vjust = 0.5)) hst_ent / spt_ent + plot_layout(heights = c(3,5)) + plot_annotation( title = \"Entropy spread (top) and spatial distribution (bottom)\") sessionInfo() ## R version 4.4.2 (2024-10-31) ## Platform: x86_64-pc-linux-gnu ## Running under: Ubuntu 22.04.5 LTS ## ## Matrix products: default ## BLAS: /usr/lib/x86_64-linux-gnu/openblas-pthread/libblas.so.3 ## LAPACK: /usr/lib/x86_64-linux-gnu/openblas-pthread/libopenblasp-r0.3.20.so; LAPACK version 3.10.0 ## ## locale: ## [1] LC_CTYPE=C.UTF-8 LC_NUMERIC=C LC_TIME=C.UTF-8 ## [4] LC_COLLATE=C.UTF-8 LC_MONETARY=C.UTF-8 LC_MESSAGES=C.UTF-8 ## [7] LC_PAPER=C.UTF-8 LC_NAME=C LC_ADDRESS=C ## [10] LC_TELEPHONE=C LC_MEASUREMENT=C.UTF-8 LC_IDENTIFICATION=C ## ## time zone: UTC ## tzcode source: system (glibc) ## ## attached base packages: ## [1] stats4 stats graphics grDevices utils datasets methods ## [8] base ## ## other attached packages: ## [1] scattermore_1.2 patchwork_1.3.0 ## [3] ggplot2_3.5.1 dplyr_1.1.4 ## [5] aricode_1.0.3 cluster_2.1.6 ## [7] distances_0.1.11 clustSIGNAL_0.99.5 ## [9] SpatialExperiment_1.16.0 SingleCellExperiment_1.28.1 ## [11] SummarizedExperiment_1.36.0 Biobase_2.66.0 ## [13] GenomicRanges_1.58.0 GenomeInfoDb_1.42.0 ## [15] IRanges_2.40.0 S4Vectors_0.44.0 ## [17] BiocGenerics_0.52.0 MatrixGenerics_1.18.0 ## [19] matrixStats_1.4.1 BiocStyle_2.34.0 ## ## loaded via a namespace (and not attached): ## [1] gridExtra_2.3 rlang_1.1.4 magrittr_2.0.3 ## [4] scater_1.34.0 compiler_4.4.2 systemfonts_1.1.0 ## [7] vctrs_0.6.5 pkgconfig_2.0.3 crayon_1.5.3 ## [10] fastmap_1.2.0 magick_2.8.5 XVector_0.46.0 ## [13] labeling_0.4.3 scuttle_1.16.0 utf8_1.2.4 ## [16] rmarkdown_2.29 UCSC.utils_1.2.0 ggbeeswarm_0.7.2 ## [19] ragg_1.3.3 xfun_0.49 bluster_1.16.0 ## [22] zlibbioc_1.52.0 cachem_1.1.0 beachmat_2.22.0 ## [25] jsonlite_1.8.9 DelayedArray_0.32.0 BiocParallel_1.40.0 ## [28] irlba_2.3.5.1 parallel_4.4.2 R6_2.5.1 ## [31] bslib_0.8.0 rlist_0.4.6.2 jquerylib_0.1.4 ## [34] Rcpp_1.0.13-1 bookdown_0.41 knitr_1.49 ## [37] Matrix_1.7-1 igraph_2.1.1 tidyselect_1.2.1 ## [40] abind_1.4-8 yaml_2.3.10 viridis_0.6.5 ## [43] codetools_0.2-20 lattice_0.22-6 tibble_3.2.1 ## [46] withr_3.0.2 evaluate_1.0.1 desc_1.4.3 ## [49] pillar_1.9.0 BiocManager_1.30.25 generics_0.1.3 ## [52] munsell_0.5.1 scales_1.3.0 glue_1.8.0 ## [55] tools_4.4.2 BiocNeighbors_2.0.0 data.table_1.16.2 ## [58] ScaledMatrix_1.14.0 fs_1.6.5 cowplot_1.1.3 ## [61] grid_4.4.2 colorspace_2.1-1 GenomeInfoDbData_1.2.13 ## [64] beeswarm_0.4.0 BiocSingular_1.22.0 vipor_0.4.7 ## [67] cli_3.6.3 rsvd_1.0.5 textshaping_0.4.0 ## [70] fansi_1.0.6 S4Arrays_1.6.0 viridisLite_0.4.2 ## [73] gtable_0.3.6 sass_0.4.9 digest_0.6.37 ## [76] SparseArray_1.6.0 ggrepel_0.9.6 farver_2.1.2 ## [79] rjson_0.2.23 htmltools_0.5.8.1 pkgdown_2.1.1 ## [82] lifecycle_1.0.4 httr_1.4.7 harmony_1.2.1"},{"path":"https://sydneybiox.github.io/clustSIGNAL/authors.html","id":null,"dir":"","previous_headings":"","what":"Authors","title":"Authors and Citation","text":"Pratibha Panwar. Maintainer, author, contributor. Boyi Guo. Author. Haowen Zhao. Author. Stephanie Hicks. Author. Shila Ghazanfar. Author, contributor.","code":""},{"path":"https://sydneybiox.github.io/clustSIGNAL/authors.html","id":"citation","dir":"","previous_headings":"","what":"Citation","title":"Authors and Citation","text":"Panwar P, Guo B, Zhao H, Hicks S, Ghazanfar S (2024). clustSIGNAL: clustSIGNAL: spatial clustering method. R package version 0.99.5, https://sydneybiox.github.io/clustSIGNAL/.","code":"@Manual{, title = {clustSIGNAL: clustSIGNAL: a spatial clustering method}, author = {Pratibha Panwar and Boyi Guo and Haowen Zhao and Stephanie Hicks and Shila Ghazanfar}, year = {2024}, note = {R package version 0.99.5}, url = {https://sydneybiox.github.io/clustSIGNAL/}, }"},{"path":"https://sydneybiox.github.io/clustSIGNAL/index.html","id":"clustsignal","dir":"","previous_headings":"","what":"clustSIGNAL: a spatial clustering method","title":"clustSIGNAL: a spatial clustering method","text":"clustSIGNAL: clustering Spatially Informed Gene expression Neighbourhood Adapted Learning. R package perform spatially-resolved clustering spatial transcriptomics data. , calculate entropy measure “domainness” cell neighbourhoods use generate weight distributions perform adaptive smoothing gene expression. Homogeneous neighbourhoods low entropy, , smoothing performed cells neighbourhoods. Contrarily, heterogeneous neighbourhoods high entropy smoothed much smaller region. approach overcomes data sparsity gene expression also incorporates spatial context form cell arrangement information neighbourhood. resulting adaptively smoothed gene expression used downstream analyses like clustering. tutorial use clustSIGNAL, see vignette website.","code":""},{"path":"https://sydneybiox.github.io/clustSIGNAL/index.html","id":"installation","dir":"","previous_headings":"","what":"Installation","title":"clustSIGNAL: a spatial clustering method","text":"install clustSIGNAL via Bioconductor: install clustSIGNAL GitHub:","code":"library(BiocManager) BiocManager::install(\"clustSIGNAL\") # install.packages(\"devtools\") devtools::install_github(\"SydneyBioX/clustSIGNAL\")"},{"path":"https://sydneybiox.github.io/clustSIGNAL/index.html","id":"method-description","dir":"","previous_headings":"","what":"Method description","title":"clustSIGNAL: a spatial clustering method","text":"Figure: clustSIGNAL method overview. , present clustSIGNAL, spatial clustering method developed handle data sparsity considering variability cell arrangement tissue regions. core steps involved method sequential: 1. method starts non-spatial clustering subclustering (default louvain clustering) classify cells subclusters refer ‘putative cell type’ groups. 2. neighbourhood cell defined terms ‘putative cell type’ group composition. 3. cells neighbourhood also sorted rearranged neighbours belonging ‘putative cell type’ group index cell placed closer . 4. Neighbourhood “domainness” measured entropy, high entropy values indicate heterogeneous neighbourhoods low entropy values indicate homogeneous neighbourhoods. 5. entropy values used generate weight distributions specific neighbourhood. 6. gene expressions cells adaptively smoothed using entropy-guided weight distributions; cells heterogeneous neighbourhoods (high entropy) undergo smoothing smaller region, whereas cells homogeneous neighbourhoods (low entropy) undergo smoothing larger region. 7. Non-spatial clustering performed adaptively smoothed gene expression generate clustSIGNAL clusters represent cell types.","code":""},{"path":"https://sydneybiox.github.io/clustSIGNAL/index.html","id":"clustsignal-parameters","dir":"","previous_headings":"","what":"clustSIGNAL parameters","title":"clustSIGNAL: a spatial clustering method","text":"clustSIGNAL package uses SpatialExperiment object input. provide users number parameters explore experiment , well prior tested default values quick runs. clustSIGNAL can used single sample multisample analysis just one function call. list parameters offered possible values: spe - SpatialExperiment object cell spatial coordinates matrix normalized counts gene expression. samples - column name cell metadata containing sample names. cells - column name cell metadata containing cell IDs. dimRed - dimensionality reduction method name low embedding data. Default value “None”, case PCA calculated used low dimension data. batch - whether batch correction performed. Default value FALSE. batch_by - column name cell metadata containing groups perform batch correction. NN - neighbourhood size terms number nearest neighbours consider. Value > 1. Default value 30. kernel - type weight distribution use. Can Gaussian (default) exponential distribution. spread - value distribution parameter - standard deviation Gaussian distribution rate exponential distribution. Default value 0.05, recommended Gaussian distribution. exponential distribution, recommended value 20. sort - whether cell neighbourhoods sorted ‘putative cell type’ grouping. Default value True. threads - number cpus use parallel runs. Default value 1. outputs - choice output types. Default value ‘c’ data frame cell IDs cluster numbers. possible value “” list dataframe clusters plus final SpatialExperiment object. clustParams - parameter options TwoStepParam clustering methods bluster package. clustering parameters order - centers (centers) clustering KmeansParam, centers (centers) sub-clustering clusters KmeansParam, maximum iterations (iter.max) clustering KmeansParam, k values (k) clustering NNGraphParam, community detection method (cluster.fun) use NNGraphParam.","code":""},{"path":"https://sydneybiox.github.io/clustSIGNAL/index.html","id":"running-clustsignal","dir":"","previous_headings":"","what":"Running clustSIGNAL","title":"clustSIGNAL: a spatial clustering method","text":"running clustSIGNAL, important ensure SpatialExperiment object input spatial coordinates stored spatialCoords matrix. Otherwise, method throw error asking user provide spatial coordinates.","code":"# load required packages library(clustSIGNAL) data(example) # Here, the cell labels are in the column 'uniqueID' and sample labels are in 'sample_id' column. set.seed(100) res <- clustSIGNAL(spe, samples = \"sample_id\", cells = \"uniqueID\", outputs = \"a\")"},{"path":"https://sydneybiox.github.io/clustSIGNAL/reference/adaptiveSmoothing.html","id":null,"dir":"Reference","previous_headings":"","what":"Adaptive smoothing — adaptiveSmoothing","title":"Adaptive smoothing — adaptiveSmoothing","text":"function perform weighted, adaptive smoothing gene expression based heterogeneity cell neighbourhood. Heterogeneous neighbourhoods smoothed less higher weights given cells belonging initial group. Homogeneous neighbourhoods smoothed similar weights given cells.","code":""},{"path":"https://sydneybiox.github.io/clustSIGNAL/reference/adaptiveSmoothing.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Adaptive smoothing — adaptiveSmoothing","text":"","code":"adaptiveSmoothing(spe, nnCells, NN, kernel, spread, threads)"},{"path":"https://sydneybiox.github.io/clustSIGNAL/reference/adaptiveSmoothing.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Adaptive smoothing — adaptiveSmoothing","text":"spe SpatialExperiment object logcounts, PCA, 'putative cell type' groups, entropy outputs included. nnCells character matrix NN nearest neighbours - rows cells columns nearest neighbours ranged closest farthest neighbour. sort = TRUE, neighbours belonging 'putative cell type' group cell moved closer . NN integer number neighbourhood cells function consider. value must greater equal 1. Default value 30. kernel character type distribution used. two valid values \"G\" \"E\". G Gaussian distribution, E exponential distribution. Default value \"G\". spread numeric value distribution spread, represented standard deviation Gaussian distribution rate exponential distribution. Default value 0.05 Gaussian distribution 20 exponential distribution. threads numeric value number CPU cores used analysis. Default value set 1.","code":""},{"path":"https://sydneybiox.github.io/clustSIGNAL/reference/adaptiveSmoothing.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Adaptive smoothing — adaptiveSmoothing","text":"SpatialExperiment object including smoothed gene expression values another assay.","code":""},{"path":"https://sydneybiox.github.io/clustSIGNAL/reference/adaptiveSmoothing.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Adaptive smoothing — adaptiveSmoothing","text":"","code":"data(example) # requires matrix containing NN nearest neighbour cell labels (nnCells), # generated using the neighbourDetect() function spe <- clustSIGNAL::adaptiveSmoothing(spe, nnCells, NN = 30, kernel = \"G\", spread = 0.05, threads = 1) #> [1] \"Smoothing performed. NN = 30 Kernel = G Spread = 0.05 Time 01:11:28\" spe #> class: SpatialExperiment #> dim: 351 1000 #> metadata(0): #> assays(2): logcounts smoothed #> rownames(351): Abcc4 Acp5 ... Zfp57 Zic3 #> rowData names(0): #> colnames(1000): embryo2_Pos29_cell110_z2 embryo2_Pos29_cell117_z2 ... #> embryo2_Pos50_cell361_z5 embryo2_Pos50_cell372_z2 #> colData names(5): uniqueID sample_id entropy nsCluster initCluster #> reducedDimNames(1): PCA #> mainExpName: NULL #> altExpNames(0): #> spatialCoords names(2) : X Y #> imgData names(1): sample_id"},{"path":"https://sydneybiox.github.io/clustSIGNAL/reference/clustSIGNAL.html","id":null,"dir":"Reference","previous_headings":"","what":"clustSIGNAL — clustSIGNAL","title":"clustSIGNAL — clustSIGNAL","text":"clustering method cell type classification spatial transcriptomics data. tool generates uses adaptively smoothed, spatially informed gene expression data clustering.","code":""},{"path":"https://sydneybiox.github.io/clustSIGNAL/reference/clustSIGNAL.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"clustSIGNAL — clustSIGNAL","text":"","code":"clustSIGNAL( spe, samples, cells, dimRed = \"None\", batch = FALSE, batch_by = \"None\", NN = 30, kernel = \"G\", spread = 0.05, sort = TRUE, threads = 1, outputs = \"c\", clustParams = list(clust_c = 0, subclust_c = 0, iter.max = 30, k = 5, cluster.fun = \"louvain\") )"},{"path":"https://sydneybiox.github.io/clustSIGNAL/reference/clustSIGNAL.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"clustSIGNAL — clustSIGNAL","text":"spe SpatialExperiment object. samples character indicating name colData(spe) column containing sample names. cells character indicating name colData(spe) column containing cell IDs. dimRed character indicating name reduced dimensions use SpatialExperiment object (.e., reducedDimNames(spe)). Default value 'None'. batch logical parameter whether perform batch correction. Default value FALSE. batch_by character indicating name colData(spe) column containing batch names. NN integer number neighbourhood cells function consider. value must greater equal 1. Default value 30. kernel character type distribution used. two valid values \"G\" \"E\". G Gaussian distribution, E exponential distribution. Default value \"G\". spread numeric value distribution spread, represented standard deviation Gaussian distribution rate exponential distribution. Default value 0.05 Gaussian distribution 20 exponential distribution. sort logical parameter whether sort neighbourhood region description. Default value TRUE. threads numeric value number CPU cores used analysis. Default value set 1. outputs character type output return user. \"c\" data frame cell IDs respective cluster numbers (default) \"\" list dataframe clusters plus final SpatialExperiment object. clustParams list parameters TwoStepParam clustering methods. clustering parameters order - centers (centers) clustering KmeansParam, centers (centers) sub-clustering clusters KmeansParam, maximum iterations (iter.max) clustering KmeansParam, k values (k) clustering NNGraphParam, community detection method (cluster.fun) use NNGraphParam.","code":""},{"path":"https://sydneybiox.github.io/clustSIGNAL/reference/clustSIGNAL.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"clustSIGNAL — clustSIGNAL","text":"list outputs 1. clusters: data frame cell names cluster classification. 2. spe_final: SpatialExperiment object initial 'putative cell type' groups, entropy values, smoothed gene expression, post-smoothing clusters, silhouette widths included.","code":""},{"path":"https://sydneybiox.github.io/clustSIGNAL/reference/clustSIGNAL.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"clustSIGNAL — clustSIGNAL","text":"","code":"data(example) names(colData(spe)) #> [1] \"uniqueID\" \"sample_id\" \"entropy\" \"nsCluster\" \"initCluster\" # identify the column names with cell and sample labels samples = \"sample_id\" cells = \"uniqueID\" res_list <- clustSIGNAL(spe, samples, cells, outputs = \"c\") #> [1] \"Calculating PCA. Time 01:11:29\" #> [1] \"clustSIGNAL run started. Time 01:11:29\" #> [1] \"Initial nonspatial clustering performed. Clusters = 6 Time 01:11:29\" #> Warning: You're computing too large a percentage of total singular values, use a standard svd instead. #> Warning: You're computing too large a percentage of total singular values, use a standard svd instead. #> [1] \"Nonspatial subclustering performed. Subclusters = 17 Time 01:11:30\" #> [1] \"Regions defined. Time 01:11:31\" #> [1] \"Region domainness calculated. Time 01:11:31\" #> [1] \"Smoothing performed. NN = 30 Kernel = G Spread = 0.05 Time 01:11:41\" #> [1] \"Nonspatial clustering performed on smoothed data. Clusters = 9 Time 01:11:41\" #> [1] \"clustSIGNAL run completed. 01:11:41\" #> Time difference of 12.57754 secs"},{"path":"https://sydneybiox.github.io/clustSIGNAL/reference/dot-calculateProp.html","id":null,"dir":"Reference","previous_headings":"","what":"Cell neighbourhood composition — .calculateProp","title":"Cell neighbourhood composition — .calculateProp","text":"function calculate cell neighbourhood composition 'putative' cell types.","code":""},{"path":"https://sydneybiox.github.io/clustSIGNAL/reference/dot-calculateProp.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Cell neighbourhood composition — .calculateProp","text":"","code":".calculateProp(arr)"},{"path":"https://sydneybiox.github.io/clustSIGNAL/reference/dot-calculateProp.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Cell neighbourhood composition — .calculateProp","text":"arr vector 'putative cell type' assignments cell neighbourhood.","code":""},{"path":"https://sydneybiox.github.io/clustSIGNAL/reference/dot-calculateProp.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Cell neighbourhood composition — .calculateProp","text":"table 'putative cell type' proportions neighbourhood.","code":""},{"path":"https://sydneybiox.github.io/clustSIGNAL/reference/dot-cellName.html","id":null,"dir":"Reference","previous_headings":"","what":"Neighbour cell naming — .cellName","title":"Neighbour cell naming — .cellName","text":"function fetch cell IDs.","code":""},{"path":"https://sydneybiox.github.io/clustSIGNAL/reference/dot-cellName.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Neighbour cell naming — .cellName","text":"","code":".cellName(cell, Clust)"},{"path":"https://sydneybiox.github.io/clustSIGNAL/reference/dot-cellName.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Neighbour cell naming — .cellName","text":"cell vector neighbourhood cell indices. cell indices indicate row number cells sample metadata. Clust data frame initial cluster assignments cells sample.","code":""},{"path":"https://sydneybiox.github.io/clustSIGNAL/reference/dot-cellName.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Neighbour cell naming — .cellName","text":"data frame cell IDs neighbourhood cells.","code":""},{"path":"https://sydneybiox.github.io/clustSIGNAL/reference/dot-cellNameSort.html","id":null,"dir":"Reference","previous_headings":"","what":"Neighbour cell sorting — .cellNameSort","title":"Neighbour cell sorting — .cellNameSort","text":"function perform neighbourhood cell sorting. Neighbourhood cells belong 'putative cell type' central cell moved closer central cell.","code":""},{"path":"https://sydneybiox.github.io/clustSIGNAL/reference/dot-cellNameSort.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Neighbour cell sorting — .cellNameSort","text":"","code":".cellNameSort(cell, Clust)"},{"path":"https://sydneybiox.github.io/clustSIGNAL/reference/dot-cellNameSort.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Neighbour cell sorting — .cellNameSort","text":"cell vector neighbourhood cell indices. cell indices indicate row number cells sample metadata. Clust data frame initial cluster assignments cells sample.","code":""},{"path":"https://sydneybiox.github.io/clustSIGNAL/reference/dot-cellNameSort.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Neighbour cell sorting — .cellNameSort","text":"data frame cell IDs sorted neighbourhood cells.","code":""},{"path":"https://sydneybiox.github.io/clustSIGNAL/reference/dot-clustNum.html","id":null,"dir":"Reference","previous_headings":"","what":"Neighbour cell 'putative cell type' assignment — .clustNum","title":"Neighbour cell 'putative cell type' assignment — .clustNum","text":"function fetch 'putative cell type' assignments cell.","code":""},{"path":"https://sydneybiox.github.io/clustSIGNAL/reference/dot-clustNum.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Neighbour cell 'putative cell type' assignment — .clustNum","text":"","code":".clustNum(cell, subClust)"},{"path":"https://sydneybiox.github.io/clustSIGNAL/reference/dot-clustNum.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Neighbour cell 'putative cell type' assignment — .clustNum","text":"cell vector neighbourhood cell indices. cell indices indicate row number cells sample metadata. subClust data frame 'putative cell type' assignments cells sample.","code":""},{"path":"https://sydneybiox.github.io/clustSIGNAL/reference/dot-clustNum.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Neighbour cell 'putative cell type' assignment — .clustNum","text":"data frame 'putative cell type' assignments neighbourhood cells.","code":""},{"path":"https://sydneybiox.github.io/clustSIGNAL/reference/dot-exp_kernel.html","id":null,"dir":"Reference","previous_headings":"","what":"Exponential distribution weights — .exp_kernel","title":"Exponential distribution weights — .exp_kernel","text":"function generate weights exponential distribution.","code":""},{"path":"https://sydneybiox.github.io/clustSIGNAL/reference/dot-exp_kernel.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Exponential distribution weights — .exp_kernel","text":"","code":".exp_kernel(ed, NN, rate)"},{"path":"https://sydneybiox.github.io/clustSIGNAL/reference/dot-exp_kernel.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Exponential distribution weights — .exp_kernel","text":"ed numeric value entropy neighbourhood. NN integer number neighbourhood cells function consider. value must greater equal 1. Default value 30. rate numeric value rate exponential distribution.","code":""},{"path":"https://sydneybiox.github.io/clustSIGNAL/reference/dot-exp_kernel.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Exponential distribution weights — .exp_kernel","text":"matrix column contains weights related specific entropy values.","code":""},{"path":"https://sydneybiox.github.io/clustSIGNAL/reference/dot-gauss_kernel.html","id":null,"dir":"Reference","previous_headings":"","what":"Gaussian distribution weights — .gauss_kernel","title":"Gaussian distribution weights — .gauss_kernel","text":"function generate weights Gaussian distribution.","code":""},{"path":"https://sydneybiox.github.io/clustSIGNAL/reference/dot-gauss_kernel.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Gaussian distribution weights — .gauss_kernel","text":"","code":".gauss_kernel(ed, NN, sd)"},{"path":"https://sydneybiox.github.io/clustSIGNAL/reference/dot-gauss_kernel.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Gaussian distribution weights — .gauss_kernel","text":"ed numeric value entropy neighbourhood. NN integer number neighbourhood cells function consider. value must greater equal 1. Default value 30. sd numeric value standard deviation Gaussian distribution.","code":""},{"path":"https://sydneybiox.github.io/clustSIGNAL/reference/dot-gauss_kernel.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Gaussian distribution weights — .gauss_kernel","text":"matrix column contains weights related specific entropy values.","code":""},{"path":"https://sydneybiox.github.io/clustSIGNAL/reference/dot-generateBPParam.html","id":null,"dir":"Reference","previous_headings":"","what":"Generating BPParam object — .generateBPParam","title":"Generating BPParam object — .generateBPParam","text":"utility function generate BPPARAM object.","code":""},{"path":"https://sydneybiox.github.io/clustSIGNAL/reference/dot-generateBPParam.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Generating BPParam object — .generateBPParam","text":"","code":".generateBPParam(cores = 1)"},{"path":"https://sydneybiox.github.io/clustSIGNAL/reference/dot-generateBPParam.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Generating BPParam object — .generateBPParam","text":"cores Desired number cores BPPARAM object.","code":""},{"path":"https://sydneybiox.github.io/clustSIGNAL/reference/dot-generateBPParam.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Generating BPParam object — .generateBPParam","text":"BPPPARAM object.","code":""},{"path":"https://sydneybiox.github.io/clustSIGNAL/reference/dot-smoothedData.html","id":null,"dir":"Reference","previous_headings":"","what":"Smoothing per neighbourhood — .smoothedData","title":"Smoothing per neighbourhood — .smoothedData","text":"function perform weighted moving average gene expression neighbourhood.","code":""},{"path":"https://sydneybiox.github.io/clustSIGNAL/reference/dot-smoothedData.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Smoothing per neighbourhood — .smoothedData","text":"","code":".smoothedData(mat, weight)"},{"path":"https://sydneybiox.github.io/clustSIGNAL/reference/dot-smoothedData.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Smoothing per neighbourhood — .smoothedData","text":"mat gene expression matrix genes rows neighbourhood cells columns. weight column matrix weights, number rows equal number neighbourhood cells.","code":""},{"path":"https://sydneybiox.github.io/clustSIGNAL/reference/dot-smoothedData.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Smoothing per neighbourhood — .smoothedData","text":"column matrix smoothed gene expression.","code":""},{"path":"https://sydneybiox.github.io/clustSIGNAL/reference/entropyMeasure.html","id":null,"dir":"Reference","previous_headings":"","what":"Domainness measure — entropyMeasure","title":"Domainness measure — entropyMeasure","text":"function measure heterogeneity cell's neighbourhood terms entropy, homogeneous neighbourhoods low entropy heterogeneous neighbourhoods high entropy.","code":""},{"path":"https://sydneybiox.github.io/clustSIGNAL/reference/entropyMeasure.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Domainness measure — entropyMeasure","text":"","code":"entropyMeasure(spe, cells, regXclust, threads)"},{"path":"https://sydneybiox.github.io/clustSIGNAL/reference/entropyMeasure.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Domainness measure — entropyMeasure","text":"spe SpatialExperiment object logcounts, PCA, 'putative cell type' groups included. cells character vector cell IDs cell. Length vector must equal number cells spatialExperiment object (.e. number rows colData(spe)). regXclust list vectors cell's neighbourhood composition indicated proportion 'putative cell type' groups contains. threads numeric value number CPU cores used analysis.","code":""},{"path":"https://sydneybiox.github.io/clustSIGNAL/reference/entropyMeasure.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Domainness measure — entropyMeasure","text":"SpatialExperiment object including entropy values cell neighbourhood.","code":""},{"path":"https://sydneybiox.github.io/clustSIGNAL/reference/entropyMeasure.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Domainness measure — entropyMeasure","text":"","code":"data(example) # requires list containing cluster proportions of each region (regXclust), # generated using the neighbourDetect() function spe <- clustSIGNAL::entropyMeasure(spe, cells = \"uniqueID\", regXclust, threads = 1) #> [1] \"Region domainness calculated. Time 01:11:42\" head(spe$entropy) #> [1] 0.46900 0.21084 0.69984 0.35336 0.81185 0.35336"},{"path":"https://sydneybiox.github.io/clustSIGNAL/reference/example.html","id":null,"dir":"Reference","previous_headings":"","what":"Example data as SpatialExperiment object — example","title":"Example data as SpatialExperiment object — example","text":"example data generated mouse embryo spatial transcriptomics dataset 3 mouse embryos, 351 genes total 57536 cells. running examples, subset data selecting 1000 random cells embryo 2, excluding cells annotated 'low quality'. subsetting, 1000 cells embryo 2 351 genes.","code":""},{"path":"https://sydneybiox.github.io/clustSIGNAL/reference/example.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Example data as SpatialExperiment object — example","text":"","code":"data(example)"},{"path":"https://sydneybiox.github.io/clustSIGNAL/reference/example.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"Example data as SpatialExperiment object — example","text":"spe spatialExperiment object containing gene expression matrix normalised counts, rows indicate genes columns indicate cells. Also, contains data frame cell metadata including cell IDs, sample IDs, cell type annotations, x-y coordinates cells. nnCells matrix row corresponds cell spe object, columns correspond nearest neighbors. regXclust list element corresponds cell spe object, contains cluster composition proportions.","code":""},{"path":"https://sydneybiox.github.io/clustSIGNAL/reference/example.html","id":"source","dir":"Reference","previous_headings":"","what":"Source","title":"Example data as SpatialExperiment object — example","text":"Integration spatial single-cell transcriptomic data elucidates mouse organogenesis, Nature Biotechnology, 2021. Webpage: https://www.nature.com/articles/s41587-021-01006-2","code":""},{"path":"https://sydneybiox.github.io/clustSIGNAL/reference/mEmbryo2.html","id":null,"dir":"Reference","previous_headings":"","what":"Mouse Embryo Data — mEmbryo2","title":"Mouse Embryo Data — mEmbryo2","text":"dataset contains spatial transcriptomics data 3 mouse embryos, 351 genes total 57536 cells. vignettes, subset data randomly selecting 5000 cells embryo 2, excluding cells annotated 'low quality'.","code":""},{"path":"https://sydneybiox.github.io/clustSIGNAL/reference/mEmbryo2.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Mouse Embryo Data — mEmbryo2","text":"","code":"data(mEmbryo2)"},{"path":"https://sydneybiox.github.io/clustSIGNAL/reference/mEmbryo2.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"Mouse Embryo Data — mEmbryo2","text":"me_expr gene expression matrix normalised counts, rows indicate genes columns indicate cells. me_data data frame cell metadata including cell IDs, sample IDs, cell type annotations, x-y coordinates cells.","code":""},{"path":"https://sydneybiox.github.io/clustSIGNAL/reference/mEmbryo2.html","id":"source","dir":"Reference","previous_headings":"","what":"Source","title":"Mouse Embryo Data — mEmbryo2","text":"Integration spatial single-cell transcriptomic data elucidates mouse organogenesis, Nature Biotechnology, 2021. Webpage: https://www.nature.com/articles/s41587-021-01006-2","code":""},{"path":"https://sydneybiox.github.io/clustSIGNAL/reference/mHypothal.html","id":null,"dir":"Reference","previous_headings":"","what":"Mouse Hypothalamus Data — mHypothal","title":"Mouse Hypothalamus Data — mHypothal","text":"dataset contains spatial transcriptomics data 181 mouse hypothalamus samples, 155 genes total 1,027,080 cells. running vignettes, subset data selecting total 6000 cells 3 samples - Animal 1 Bregma -0.09 (2080 cells) Animal 7 Bregmas 0.16 (1936 cells) -0.09 (1984 cells), excluding cells annotated 'ambiguous', removed 20 genes assessed using different technology.","code":""},{"path":"https://sydneybiox.github.io/clustSIGNAL/reference/mHypothal.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Mouse Hypothalamus Data — mHypothal","text":"","code":"data(mHypothal)"},{"path":"https://sydneybiox.github.io/clustSIGNAL/reference/mHypothal.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"Mouse Hypothalamus Data — mHypothal","text":"mh_expr gene expression matrix normalised counts, rows indicate genes columns indicate cells. mh_data data frame cell metadata including cell IDs, sample IDs, cell type annotations, x-y coordinates cells.","code":""},{"path":"https://sydneybiox.github.io/clustSIGNAL/reference/mHypothal.html","id":"source","dir":"Reference","previous_headings":"","what":"Source","title":"Mouse Hypothalamus Data — mHypothal","text":"Molecular, Spatial Functional Single-Cell Profiling Hypothalamic Preoptic Region, Science, 2018. Webpage: https://www.science.org/doi/10.1126/science.aau5324","code":""},{"path":"https://sydneybiox.github.io/clustSIGNAL/reference/neighbourDetect.html","id":null,"dir":"Reference","previous_headings":"","what":"Cell neighbourhood detection — neighbourDetect","title":"Cell neighbourhood detection — neighbourDetect","text":"function identify neighbourhood cell. sort = TRUE, neighbourhoods also sorted cells belonging group central cell arranged closer .","code":""},{"path":"https://sydneybiox.github.io/clustSIGNAL/reference/neighbourDetect.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Cell neighbourhood detection — neighbourDetect","text":"","code":"neighbourDetect(spe, samples, NN, cells, sort)"},{"path":"https://sydneybiox.github.io/clustSIGNAL/reference/neighbourDetect.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Cell neighbourhood detection — neighbourDetect","text":"spe SpatialExperiment object logcounts, PCA, 'putative cell type' groups included. samples character vector sample names cells belong. Length vector must equal number cells spatialExperiment object (.e. number rows colData(spe)). NN integer number neighbourhood cells function consider. value must greater equal 1. Default value 30. cells character vector cell IDs cell. Length vector must equal number cells SpatialExperiment object (.e. number rows colData(spe)). sort logical parameter whether sort neighbourhood region description. Default value TRUE.","code":""},{"path":"https://sydneybiox.github.io/clustSIGNAL/reference/neighbourDetect.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Cell neighbourhood detection — neighbourDetect","text":"list containing two items: 1. nnCells, character matrix NN nearest neighbours - rows cells columns nearest neighbours ranged closest farthest neighbour. sort = TRUE, neighbours belonging 'putative cell type' group cell moved closer . 2. regXclust, list vectors cell's neighbourhood composition indicated proportion 'putative cell type' groups contains.","code":""},{"path":"https://sydneybiox.github.io/clustSIGNAL/reference/neighbourDetect.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Cell neighbourhood detection — neighbourDetect","text":"","code":"data(example) out_list <- clustSIGNAL::neighbourDetect(spe, samples = \"sample_id\", NN = 30, cells = \"uniqueID\", sort = TRUE) #> [1] \"Regions defined. Time 01:11:43\" names(out_list) #> [1] \"nnCells\" \"regXclust\""},{"path":"https://sydneybiox.github.io/clustSIGNAL/reference/p1_clustering.html","id":null,"dir":"Reference","previous_headings":"","what":"Initial non-spatial clustering — p1_clustering","title":"Initial non-spatial clustering — p1_clustering","text":"function perform initial non-spatial clustering sub-clustering normalised gene expression generate 'initial clusters'.","code":""},{"path":"https://sydneybiox.github.io/clustSIGNAL/reference/p1_clustering.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Initial non-spatial clustering — p1_clustering","text":"","code":"p1_clustering(spe, dimRed, batch, batch_by, clustParams)"},{"path":"https://sydneybiox.github.io/clustSIGNAL/reference/p1_clustering.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Initial non-spatial clustering — p1_clustering","text":"spe SpatialExperiment object. reclust = FALSE, object contain logcounts PCA, reculst = TRUE, object contain smoothed gene expression. dimRed character indicating name reduced dimensions use SpatialExperiment object (.e., reducedDimNames(spe)). Default value 'PCA'. batch logical parameter whether perform batch correction. Default value FALSE. batch_by character indicating name colData(spe) column containing batch names. clustParams list parameters TwoStepParam clustering methods. clustering parameters order - centers (centers) clustering KmeansParam, centers (centers) sub-clustering clusters KmeansParam, maximum iterations (iter.max) clustering KmeansParam, k values (k) clustering NNGraphParam, community detection method (cluster.fun) use NNGraphParam.","code":""},{"path":"https://sydneybiox.github.io/clustSIGNAL/reference/p1_clustering.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Initial non-spatial clustering — p1_clustering","text":"SpatialExperiment object containing 'initial cluster' groups allotted cell.","code":""},{"path":"https://sydneybiox.github.io/clustSIGNAL/reference/p1_clustering.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Initial non-spatial clustering — p1_clustering","text":"","code":"data(example) spe <- clustSIGNAL::p1_clustering(spe, dimRed = \"PCA\", batch = FALSE, batch_by = \"None\", clustParams = list(0, 0, 30, 5, \"louvain\")) #> [1] \"Initial nonspatial clustering performed. Clusters = 7 Time 01:11:44\" #> Warning: You're computing too large a percentage of total singular values, use a standard svd instead. #> Warning: You're computing too large a percentage of total singular values, use a standard svd instead. #> Warning: You're computing too large a percentage of total singular values, use a standard svd instead. #> [1] \"Nonspatial subclustering performed. Subclusters = 20 Time 01:11:45\" head(spe$nsCluster) #> [1] 5 5 7 5 5 5 #> Levels: 1 2 3 4 5 6 7 head(spe$initCluster) #> embryo2_Pos29_cell110_z2 embryo2_Pos29_cell117_z2 embryo2_Pos29_cell128_z2 #> 5.2 5.2 7.1 #> embryo2_Pos29_cell134_z2 embryo2_Pos29_cell14_z2 embryo2_Pos29_cell141_z2 #> 5.2 5.2 5.2 #> 20 Levels: 1.1 1.2 2.1 2.2 3.1 3.2 3.3 4.1 4.2 4.3 5.1 5.2 5.3 5.4 5.5 ... 7.3"},{"path":"https://sydneybiox.github.io/clustSIGNAL/reference/p2_clustering.html","id":null,"dir":"Reference","previous_headings":"","what":"Final non-spatial clustering — p2_clustering","title":"Final non-spatial clustering — p2_clustering","text":"function containing cluster adaptively smoothed gene expression data.","code":""},{"path":"https://sydneybiox.github.io/clustSIGNAL/reference/p2_clustering.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Final non-spatial clustering — p2_clustering","text":"","code":"p2_clustering(spe, batch, batch_by, clustParams)"},{"path":"https://sydneybiox.github.io/clustSIGNAL/reference/p2_clustering.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Final non-spatial clustering — p2_clustering","text":"spe SpatialExperiment object. reclust = FALSE, object contain logcounts PCA, reculst = TRUE, object contain smoothed gene expression. batch logical parameter whether perform batch correction. Default value FALSE. batch_by character indicating name colData(spe) column containing batch names. clustParams list parameters TwoStepParam clustering methods. clustering parameters order - centers (centers) clustering KmeansParam, centers (centers) sub-clustering clusters KmeansParam, maximum iterations (iter.max) clustering KmeansParam, k values (k) clustering NNGraphParam, community detection method (cluster.fun) use NNGraphParam.","code":""},{"path":"https://sydneybiox.github.io/clustSIGNAL/reference/p2_clustering.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Final non-spatial clustering — p2_clustering","text":"SpatialExperiment object containing clusters generated smoothed data.","code":""},{"path":"https://sydneybiox.github.io/clustSIGNAL/reference/p2_clustering.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Final non-spatial clustering — p2_clustering","text":"","code":"data(example) # For non-spatial clustering of normalised counts spe <- clustSIGNAL::p2_clustering(spe, batch = FALSE, batch_by = \"None\", clustParams = list(0, 0, 30, 5, \"louvain\")) #> [1] \"Nonspatial clustering performed on smoothed data. Clusters = 9 Time 01:11:45\" head(spe$clustSIGNAL) #> [1] 6 6 4 6 6 6 #> Levels: 1 2 3 4 5 6 7 8 9"},{"path":"https://sydneybiox.github.io/clustSIGNAL/news/index.html","id":"clustsignal-v0995-2024-11-28","dir":"Changelog","previous_headings":"","what":"clustSIGNAL v0.99.5 (2024-11-28)","title":"clustSIGNAL v0.99.5 (2024-11-28)","text":"Fixed issue absence spatial coordinates throwing error beginning run.","code":""},{"path":"https://sydneybiox.github.io/clustSIGNAL/news/index.html","id":"clustsignal-v0994-2024-11-28","dir":"Changelog","previous_headings":"","what":"clustSIGNAL v0.99.4 (2024-11-28)","title":"clustSIGNAL v0.99.4 (2024-11-28)","text":"Corrected character check output format type.","code":""},{"path":"https://sydneybiox.github.io/clustSIGNAL/news/index.html","id":"clustsignal-v0003-2024-10-31","dir":"Changelog","previous_headings":"","what":"clustSIGNAL v0.00.3 (2024-10-31)","title":"clustSIGNAL v0.00.3 (2024-10-31)","text":"Clustering parameter options added package Initial final clustering steps now separate functions Test units added package","code":""},{"path":"https://sydneybiox.github.io/clustSIGNAL/news/index.html","id":"clustsignal-v0002-2024-10-08","dir":"Changelog","previous_headings":"","what":"clustSIGNAL v0.00.2 (2024-10-08)","title":"clustSIGNAL v0.00.2 (2024-10-08)","text":"Updated parallel runs smoothing function faster runs","code":""},{"path":"https://sydneybiox.github.io/clustSIGNAL/news/index.html","id":"clustsignal-v0990-2024-09-19","dir":"Changelog","previous_headings":"","what":"clustSIGNAL v0.99.0 (2024-09-19)","title":"clustSIGNAL v0.99.0 (2024-09-19)","text":"Submitted Bioconductor.","code":""}]
## [1] "Calculating PCA. Time 00:32:08" -## [1] "clustSIGNAL run started. Time 00:32:09" -## [1] "Initial nonspatial clustering performed. Clusters = 11 Time 00:32:09" -## [1] "Nonspatial subclustering performed. Subclusters = 50 Time 00:32:12" -## [1] "Regions defined. Time 00:32:14" -## [1] "Region domainness calculated. Time 00:32:14" -## [1] "Smoothing performed. NN = 30 Kernel = G Spread = 0.05 Time 00:32:51" -## [1] "Nonspatial clustering performed on smoothed data. Clusters = 16 Time 00:32:53" -## [1] "clustSIGNAL run completed. 00:32:53" -## Time difference of 45.32507 secs
## [1] "Calculating PCA. Time 01:11:53" +## [1] "clustSIGNAL run started. Time 01:11:54" +## [1] "Initial nonspatial clustering performed. Clusters = 11 Time 01:11:55" +## [1] "Nonspatial subclustering performed. Subclusters = 50 Time 01:11:57" +## [1] "Regions defined. Time 01:11:59" +## [1] "Region domainness calculated. Time 01:12:00" +## [1] "Smoothing performed. NN = 30 Kernel = G Spread = 0.05 Time 01:12:33" +## [1] "Nonspatial clustering performed on smoothed data. Clusters = 16 Time 01:12:35" +## [1] "clustSIGNAL run completed. 01:12:35" +## Time difference of 41.1917 secs
This returns a list that can contain a dataframe of cluster names, a matrix of cell labels from each region’s neighbourhood, a final SpatialExperiment object, or a combination of these, depending on the @@ -363,15 +363,15 @@
## [1] "Initial nonspatial clustering performed. Clusters = 11 Time 00:33:02" -## [1] "Nonspatial subclustering performed. Subclusters = 50 Time 00:33:05"
## [1] "Initial nonspatial clustering performed. Clusters = 11 Time 01:12:44" +## [1] "Nonspatial subclustering performed. Subclusters = 50 Time 01:12:46"
outReg <- clustSIGNAL::neighbourDetect(spe, samples = "sample_id", NN = 30, cells = "uniqueID", sort = TRUE)
## [1] "Regions defined. Time 00:33:07"
## [1] "Regions defined. Time 01:12:48"
spe <- entropyMeasure(spe, cells = "uniqueID", outReg$regXclust, threads = 1)
## [1] "Region domainness calculated. Time 00:33:08"
## [1] "Region domainness calculated. Time 01:12:48"
head(spe$entropy)
## [1] 1.03701 0.42003 0.62749 0.76651 0.56651 0.21084
## [1] "Calculating PCA. Time 00:33:08" -## [1] "clustSIGNAL run started. Time 00:33:08" -## [1] "Initial nonspatial clustering performed. Clusters = 11 Time 00:33:09"
## [1] "Nonspatial subclustering performed. Subclusters = 52 Time 00:33:11" -## [1] "Regions defined. Time 00:33:14" -## [1] "Region domainness calculated. Time 00:33:16" -## [1] "Smoothing performed. NN = 30 Kernel = G Spread = 0.05 Time 00:33:33" -## [1] "Nonspatial clustering performed on smoothed data. Clusters = 11 Time 00:33:35" -## [1] "clustSIGNAL run completed. 00:33:35" -## Time difference of 26.87564 secs
## [1] "Calculating PCA. Time 01:12:49" +## [1] "clustSIGNAL run started. Time 01:12:49" +## [1] "Initial nonspatial clustering performed. Clusters = 11 Time 01:12:50"
## [1] "Nonspatial subclustering performed. Subclusters = 52 Time 01:12:52" +## [1] "Regions defined. Time 01:12:54" +## [1] "Region domainness calculated. Time 01:12:56" +## [1] "Smoothing performed. NN = 30 Kernel = G Spread = 0.05 Time 01:13:11" +## [1] "Nonspatial clustering performed on smoothed data. Clusters = 11 Time 01:13:13" +## [1] "clustSIGNAL run completed. 01:13:13" +## Time difference of 23.97924 secs
spe2 <- res_hyp$spe_final spe2
Panwar P, Guo B, Zhao H, Hicks S, Ghazanfar S (2024). clustSIGNAL: clustSIGNAL: a spatial clustering method. -R package version 0.99.4, https://sydneybiox.github.io/clustSIGNAL/. +R package version 0.99.5, https://sydneybiox.github.io/clustSIGNAL/.
@Manual{, title = {clustSIGNAL: clustSIGNAL: a spatial clustering method}, author = {Pratibha Panwar and Boyi Guo and Haowen Zhao and Stephanie Hicks and Shila Ghazanfar}, year = {2024}, - note = {R package version 0.99.4}, + note = {R package version 0.99.5}, url = {https://sydneybiox.github.io/clustSIGNAL/}, }
NEWS.md