diff --git a/404.html b/404.html index 25131cf..a34be4c 100644 --- a/404.html +++ b/404.html @@ -20,7 +20,7 @@ clustSIGNAL - 0.99.1 + 0.99.2 diff --git a/articles/clustSIGNAL.html b/articles/clustSIGNAL.html index 1fe27ea..9b2e8b6 100644 --- a/articles/clustSIGNAL.html +++ b/articles/clustSIGNAL.html @@ -20,7 +20,7 @@ clustSIGNAL - 0.99.1 + 0.99.2 @@ -54,7 +54,7 @@ clustSIGNAL tutorial Pratibha Panwar, Boyi Guo, Haowen Zhou, Stephanie Hicks, Shila Ghazanfar - 2024-10-07 + 2024-10-08 Source: vignettes/clustSIGNAL.Rmd clustSIGNAL.Rmd @@ -149,16 +149,16 @@ Running clustSIGNAL on one samplesamples <- "sample_id" cells <- "uniqueID" res_emb <- clustSIGNAL(spe, samples, cells, outputs = "a") -## [1] "Calculating PCA. Time 23:09:00" -## [1] "clustSIGNAL run started. Time 23:09:01" -## [1] "Initial nonspatial clustering performed. Clusters = 11 Time 23:09:01" -## [1] "Nonspatial subclustering performed. Subclusters = 52 Time 23:09:03" -## [1] "Regions defined. Time 23:09:06" -## [1] "Region domainness calculated. Time 23:09:06" -## [1] "Smoothing performed. NN = 30 Kernel = G Spread = 0.05 Time 23:10:02" -## [1] "Nonspatial clustering performed on smoothed data. Clusters = 14 Time 23:10:03" -## [1] "clustSIGNAL run completed. 23:10:03" -## Time difference of 1.061019 mins +## [1] "Calculating PCA. Time 00:22:28" +## [1] "clustSIGNAL run started. Time 00:22:28" +## [1] "Initial nonspatial clustering performed. Clusters = 11 Time 00:22:29" +## [1] "Nonspatial subclustering performed. Subclusters = 52 Time 00:22:31" +## [1] "Regions defined. Time 00:22:34" +## [1] "Region domainness calculated. Time 00:22:34" +## [1] "Smoothing performed. NN = 30 Kernel = G Spread = 0.05 Time 00:23:29" +## [1] "Nonspatial clustering performed on smoothed data. Clusters = 14 Time 00:23:31" +## [1] "clustSIGNAL run completed. 00:23:31" +## Time difference of 1.049867 mins 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 @@ -359,15 +359,15 @@ Generating entropy data onlyspe <- scater::runPCA(spe) spe <- clustSIGNAL::nsClustering(spe, samples = "sample_id", dimRed = "PCA", batch = FALSE, reclust = FALSE) -## [1] "Initial nonspatial clustering performed. Clusters = 11 Time 23:10:13" -## [1] "Nonspatial subclustering performed. Subclusters = 52 Time 23:10:15" +## [1] "Initial nonspatial clustering performed. Clusters = 11 Time 00:23:40" +## [1] "Nonspatial subclustering performed. Subclusters = 52 Time 00:23:43" outReg <- clustSIGNAL::neighbourDetect(spe, samples = "sample_id", NN = 30, cells = "uniqueID", sort = TRUE) -## [1] "Regions defined. Time 23:10:17" +## [1] "Regions defined. Time 00:23:45" spe <- entropyMeasure(spe, cells = "uniqueID", outReg$regXclust, threads = 1) -## [1] "Region domainness calculated. Time 23:10:18" +## [1] "Region domainness calculated. Time 00:23:45" head(spe$entropy) ## [1] 1.30331 0.56083 0.87851 0.97034 0.94808 0.35336 @@ -429,16 +429,16 @@ clustSIGNAL runsamples <- "samples" cells <- "Cell_ID" res_hyp <- clustSIGNAL(spe2, samples, cells, batch = TRUE, threads = 4, outputs = "a") -## [1] "Calculating PCA. Time 23:10:18" -## [1] "clustSIGNAL run started. Time 23:10:19" -## [1] "Initial nonspatial clustering performed. Clusters = 13 Time 23:10:22" -## [1] "Nonspatial subclustering performed. Subclusters = 57 Time 23:10:24" -## [1] "Regions defined. Time 23:10:27" -## [1] "Region domainness calculated. Time 23:10:29" -## [1] "Smoothing performed. NN = 30 Kernel = G Spread = 0.05 Time 23:10:50" -## [1] "Nonspatial clustering performed on smoothed data. Clusters = 11 Time 23:10:54" -## [1] "clustSIGNAL run completed. 23:10:54" -## Time difference of 35.37587 secs +## [1] "Calculating PCA. Time 00:23:45" +## [1] "clustSIGNAL run started. Time 00:23:46" +## [1] "Initial nonspatial clustering performed. Clusters = 13 Time 00:23:49" +## [1] "Nonspatial subclustering performed. Subclusters = 57 Time 00:23:51" +## [1] "Regions defined. Time 00:23:54" +## [1] "Region domainness calculated. Time 00:23:56" +## [1] "Smoothing performed. NN = 30 Kernel = G Spread = 0.05 Time 00:24:17" +## [1] "Nonspatial clustering performed on smoothed data. Clusters = 11 Time 00:24:20" +## [1] "clustSIGNAL run completed. 00:24:20" +## Time difference of 35.06137 secs spe2 <- res_hyp$spe_final spe2 @@ -624,7 +624,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.1 +## [7] distances_0.1.11 clustSIGNAL_0.99.2 ## [9] SpatialExperiment_1.14.0 SingleCellExperiment_1.26.0 ## [11] SummarizedExperiment_1.34.0 Biobase_2.64.0 ## [13] GenomicRanges_1.56.1 GenomeInfoDb_1.40.1 diff --git a/articles/index.html b/articles/index.html index 3caae22..34363d6 100644 --- a/articles/index.html +++ b/articles/index.html @@ -7,7 +7,7 @@ clustSIGNAL - 0.99.1 + 0.99.2 diff --git a/authors.html b/authors.html index e9aefc2..9b21b31 100644 --- a/authors.html +++ b/authors.html @@ -7,7 +7,7 @@ clustSIGNAL - 0.99.1 + 0.99.2 @@ -62,13 +62,13 @@ Citation Panwar P, Guo B, Zhao H, Hicks S, Ghazanfar S (2024). clustSIGNAL: clustSIGNAL: a spatial clustering method. -R package version 0.99.1, https://sydneybiox.github.io/clustSIGNAL/. +R package version 0.99.2, 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.1}, + note = {R package version 0.99.2}, url = {https://sydneybiox.github.io/clustSIGNAL/}, } diff --git a/index.html b/index.html index 60ae657..7f86a79 100644 --- a/index.html +++ b/index.html @@ -22,7 +22,7 @@ clustSIGNAL - 0.99.1 + 0.99.2 diff --git a/pkgdown.yml b/pkgdown.yml index fb1a5cb..58cdf79 100644 --- a/pkgdown.yml +++ b/pkgdown.yml @@ -3,7 +3,7 @@ pkgdown: 2.1.1 pkgdown_sha: ~ articles: clustSIGNAL: clustSIGNAL.html -last_built: 2024-10-07T23:08Z +last_built: 2024-10-08T00:21Z 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 8c1e4b2..de2f187 100644 --- a/reference/adaptiveSmoothing.html +++ b/reference/adaptiveSmoothing.html @@ -15,7 +15,7 @@ clustSIGNAL - 0.99.1 + 0.99.2 @@ -107,7 +107,7 @@ Examples# generated using the neighbourDetect() function spe <- adaptiveSmoothing(spe, nnCells, NN = 30, kernel = "G", spread = 0.05, threads = 1) -#> [1] "Smoothing performed. NN = 30 Kernel = G Spread = 0.05 Time 23:08:28" +#> [1] "Smoothing performed. NN = 30 Kernel = G Spread = 0.05 Time 00:21:56" spe #> class: SpatialExperiment #> dim: 351 1000 diff --git a/reference/clustSIGNAL.html b/reference/clustSIGNAL.html index 9741a11..dd0d369 100644 --- a/reference/clustSIGNAL.html +++ b/reference/clustSIGNAL.html @@ -11,7 +11,7 @@ clustSIGNAL - 0.99.1 + 0.99.2 @@ -157,18 +157,18 @@ Examplessamples = "sample_id" cells = "uniqueID" res_list <- clustSIGNAL(spe, samples, cells, outputs = "c") -#> [1] "Calculating PCA. Time 23:08:28" -#> [1] "clustSIGNAL run started. Time 23:08:28" -#> [1] "Initial nonspatial clustering performed. Clusters = 7 Time 23:08:28" +#> [1] "Calculating PCA. Time 00:21:57" +#> [1] "clustSIGNAL run started. Time 00:21:57" +#> [1] "Initial nonspatial clustering performed. Clusters = 7 Time 00:21: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. -#> [1] "Nonspatial subclustering performed. Subclusters = 18 Time 23:08:30" -#> [1] "Regions defined. Time 23:08:30" -#> [1] "Region domainness calculated. Time 23:08:30" -#> [1] "Smoothing performed. NN = 30 Kernel = G Spread = 0.05 Time 23:08:47" -#> [1] "Nonspatial clustering performed on smoothed data. Clusters = 9 Time 23:08:48" -#> [1] "clustSIGNAL run completed. 23:08:48" -#> Time difference of 19.50111 secs +#> [1] "Nonspatial subclustering performed. Subclusters = 18 Time 00:21:58" +#> [1] "Regions defined. Time 00:21:58" +#> [1] "Region domainness calculated. Time 00:21:58" +#> [1] "Smoothing performed. NN = 30 Kernel = G Spread = 0.05 Time 00:22:16" +#> [1] "Nonspatial clustering performed on smoothed data. Clusters = 9 Time 00:22:16" +#> [1] "clustSIGNAL run completed. 00:22:16" +#> Time difference of 19.33796 secs diff --git a/reference/dot-calculateProp.html b/reference/dot-calculateProp.html index a8d1337..6a63bdf 100644 --- a/reference/dot-calculateProp.html +++ b/reference/dot-calculateProp.html @@ -9,7 +9,7 @@ clustSIGNAL - 0.99.1 + 0.99.2 diff --git a/reference/dot-cellName.html b/reference/dot-cellName.html index f5da069..cf7162f 100644 --- a/reference/dot-cellName.html +++ b/reference/dot-cellName.html @@ -7,7 +7,7 @@ clustSIGNAL - 0.99.1 + 0.99.2 diff --git a/reference/dot-cellNameSort.html b/reference/dot-cellNameSort.html index d92a3a6..51215f3 100644 --- a/reference/dot-cellNameSort.html +++ b/reference/dot-cellNameSort.html @@ -11,7 +11,7 @@ clustSIGNAL - 0.99.1 + 0.99.2 diff --git a/reference/dot-clustNum.html b/reference/dot-clustNum.html index 51ad078..dd8a819 100644 --- a/reference/dot-clustNum.html +++ b/reference/dot-clustNum.html @@ -7,7 +7,7 @@ clustSIGNAL - 0.99.1 + 0.99.2 diff --git a/reference/dot-exp_kernel.html b/reference/dot-exp_kernel.html index 03c8522..d0cfec0 100644 --- a/reference/dot-exp_kernel.html +++ b/reference/dot-exp_kernel.html @@ -7,7 +7,7 @@ clustSIGNAL - 0.99.1 + 0.99.2 diff --git a/reference/dot-gauss_kernel.html b/reference/dot-gauss_kernel.html index 0a7bddf..b3d758d 100644 --- a/reference/dot-gauss_kernel.html +++ b/reference/dot-gauss_kernel.html @@ -7,7 +7,7 @@ clustSIGNAL - 0.99.1 + 0.99.2 diff --git a/reference/dot-generateBPParam.html b/reference/dot-generateBPParam.html index 8f47a06..0ce1be6 100644 --- a/reference/dot-generateBPParam.html +++ b/reference/dot-generateBPParam.html @@ -7,7 +7,7 @@ clustSIGNAL - 0.99.1 + 0.99.2 diff --git a/reference/dot-smoothedData.html b/reference/dot-smoothedData.html index 4b718e2..b9d0e3b 100644 --- a/reference/dot-smoothedData.html +++ b/reference/dot-smoothedData.html @@ -9,7 +9,7 @@ clustSIGNAL - 0.99.1 + 0.99.2 diff --git a/reference/entropyMeasure.html b/reference/entropyMeasure.html index 77577eb..bc27ab4 100644 --- a/reference/entropyMeasure.html +++ b/reference/entropyMeasure.html @@ -11,7 +11,7 @@ clustSIGNAL - 0.99.1 + 0.99.2 @@ -86,7 +86,7 @@ Examples# requires list containing cluster proportions of each region (regXclust), # generated using the neighbourDetect() function spe <- entropyMeasure(spe, cells = "uniqueID", regXclust, threads = 1) -#> [1] "Region domainness calculated. Time 23:08:49" +#> [1] "Region domainness calculated. Time 00:22:17" 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 19be8e0..aee6d52 100644 --- a/reference/example.html +++ b/reference/example.html @@ -15,7 +15,7 @@ clustSIGNAL - 0.99.1 + 0.99.2 diff --git a/reference/index.html b/reference/index.html index 7e5dbc9..3bd2358 100644 --- a/reference/index.html +++ b/reference/index.html @@ -7,7 +7,7 @@ clustSIGNAL - 0.99.1 + 0.99.2 diff --git a/reference/mEmbryo2.html b/reference/mEmbryo2.html index 09af9c7..2580407 100644 --- a/reference/mEmbryo2.html +++ b/reference/mEmbryo2.html @@ -13,7 +13,7 @@ clustSIGNAL - 0.99.1 + 0.99.2 diff --git a/reference/mHypothal.html b/reference/mHypothal.html index 49667cd..88b6004 100644 --- a/reference/mHypothal.html +++ b/reference/mHypothal.html @@ -19,7 +19,7 @@ clustSIGNAL - 0.99.1 + 0.99.2 diff --git a/reference/neighbourDetect.html b/reference/neighbourDetect.html index 666c790..b748a89 100644 --- a/reference/neighbourDetect.html +++ b/reference/neighbourDetect.html @@ -11,7 +11,7 @@ clustSIGNAL - 0.99.1 + 0.99.2 @@ -96,7 +96,7 @@ Examples out_list <- neighbourDetect(spe, samples = "sample_id", NN = 30, cells = "uniqueID", sort = TRUE) -#> [1] "Regions defined. Time 23:08:50" +#> [1] "Regions defined. Time 00:22:18" names(out_list) #> [1] "nnCells" "regXclust" diff --git a/reference/nsClustering.html b/reference/nsClustering.html index 48e596a..2b90ddd 100644 --- a/reference/nsClustering.html +++ b/reference/nsClustering.html @@ -15,7 +15,7 @@ clustSIGNAL - 0.99.1 + 0.99.2 @@ -106,9 +106,9 @@ Examples# reclust = TRUE for non-spatial clustering of adaptively smoothed counts spe <- nsClustering(spe, samples = "sample_id", dimRed = "PCA", batch = FALSE, reclust = FALSE) -#> [1] "Initial nonspatial clustering performed. Clusters = 7 Time 23:08:50" +#> [1] "Initial nonspatial clustering performed. Clusters = 7 Time 00:22:18" #> Warning: You're computing too large a percentage of total singular values, use a standard svd instead. -#> [1] "Nonspatial subclustering performed. Subclusters = 19 Time 23:08:51" +#> [1] "Nonspatial subclustering performed. Subclusters = 19 Time 00:22:19" head(spe$nsCluster) #> [1] 5 5 6 5 5 5 #> Levels: 1 2 3 4 5 6 7 diff --git a/search.json b/search.json index 2123ec7..d284cc2 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, NN specify neighbourhood size, kernel weight distribution use, spread distribution spread value, sort sort neighbourhood, threads specify number cpus use parallel runs, … additional parameters clustering steps. 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 23:09:00\" ## [1] \"clustSIGNAL run started. Time 23:09:01\" ## [1] \"Initial nonspatial clustering performed. Clusters = 11 Time 23:09:01\" ## [1] \"Nonspatial subclustering performed. Subclusters = 52 Time 23:09:03\" ## [1] \"Regions defined. Time 23:09:06\" ## [1] \"Region domainness calculated. Time 23:09:06\" ## [1] \"Smoothing performed. NN = 30 Kernel = G Spread = 0.05 Time 23:10:02\" ## [1] \"Nonspatial clustering performed on smoothed data. Clusters = 14 Time 23:10:03\" ## [1] \"clustSIGNAL run completed. 23:10:03\" ## Time difference of 1.061019 mins names(res_emb) ## [1] \"clusters\" \"neighbours\" \"spe_final\" head(res_emb$clusters, n = 3) ## Cells Clusters ## 1 embryo2_Pos29_cell100_z2 10 ## 2 embryo2_Pos29_cell101_z5 10 ## 3 embryo2_Pos29_cell104_z2 10 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.3668453 0.6469266 0.05075243"},{"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.10969 1.420308 # 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::nsClustering(spe, samples = \"sample_id\", dimRed = \"PCA\", batch = FALSE, reclust = FALSE) ## [1] \"Initial nonspatial clustering performed. Clusters = 11 Time 23:10:13\" ## [1] \"Nonspatial subclustering performed. Subclusters = 52 Time 23:10:15\" outReg <- clustSIGNAL::neighbourDetect(spe, samples = \"sample_id\", NN = 30, cells = \"uniqueID\", sort = TRUE) ## [1] \"Regions defined. Time 23:10:17\" spe <- entropyMeasure(spe, cells = \"uniqueID\", outReg$regXclust, threads = 1) ## [1] \"Region domainness calculated. Time 23:10:18\" head(spe$entropy) ## [1] 1.30331 0.56083 0.87851 0.97034 0.94808 0.35336"},{"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, batch = TRUE, threads = 4, outputs = \"a\") ## [1] \"Calculating PCA. Time 23:10:18\" ## [1] \"clustSIGNAL run started. Time 23:10:19\" ## [1] \"Initial nonspatial clustering performed. Clusters = 13 Time 23:10:22\" ## [1] \"Nonspatial subclustering performed. Subclusters = 57 Time 23:10:24\" ## [1] \"Regions defined. Time 23:10:27\" ## [1] \"Region domainness calculated. Time 23:10:29\" ## [1] \"Smoothing performed. NN = 30 Kernel = G Spread = 0.05 Time 23:10:50\" ## [1] \"Nonspatial clustering performed on smoothed data. Clusters = 11 Time 23:10:54\" ## [1] \"clustSIGNAL run completed. 23:10:54\" ## Time difference of 35.37587 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.410 0.611 0.0746 1.21 4.55 3.33 ## 2 7.-0.09 0.498 0.672 0.121 0.970 4.51 3.41 ## 3 7.0.16 0.532 0.679 0.102 1.17 4.48 3.34"},{"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.1 (2024-06-14) ## 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.1 ## [9] SpatialExperiment_1.14.0 SingleCellExperiment_1.26.0 ## [11] SummarizedExperiment_1.34.0 Biobase_2.64.0 ## [13] GenomicRanges_1.56.1 GenomeInfoDb_1.40.1 ## [15] IRanges_2.38.1 S4Vectors_0.42.1 ## [17] BiocGenerics_0.50.0 MatrixGenerics_1.16.0 ## [19] matrixStats_1.4.1 BiocStyle_2.32.1 ## ## loaded via a namespace (and not attached): ## [1] gridExtra_2.3 rlang_1.1.4 ## [3] magrittr_2.0.3 scater_1.32.1 ## [5] compiler_4.4.1 DelayedMatrixStats_1.26.0 ## [7] systemfonts_1.1.0 vctrs_0.6.5 ## [9] pkgconfig_2.0.3 crayon_1.5.3 ## [11] fastmap_1.2.0 magick_2.8.5 ## [13] XVector_0.44.0 labeling_0.4.3 ## [15] scuttle_1.14.0 utf8_1.2.4 ## [17] rmarkdown_2.28 UCSC.utils_1.0.0 ## [19] ggbeeswarm_0.7.2 ragg_1.3.3 ## [21] xfun_0.48 bluster_1.14.0 ## [23] zlibbioc_1.50.0 cachem_1.1.0 ## [25] beachmat_2.20.0 jsonlite_1.8.9 ## [27] highr_0.11 DelayedArray_0.30.1 ## [29] BiocParallel_1.38.0 irlba_2.3.5.1 ## [31] parallel_4.4.1 R6_2.5.1 ## [33] bslib_0.8.0 rlist_0.4.6.2 ## [35] jquerylib_0.1.4 Rcpp_1.0.13 ## [37] bookdown_0.40 knitr_1.48 ## [39] Matrix_1.7-0 igraph_2.0.3 ## [41] tidyselect_1.2.1 abind_1.4-8 ## [43] yaml_2.3.10 viridis_0.6.5 ## [45] codetools_0.2-20 lattice_0.22-6 ## [47] tibble_3.2.1 withr_3.0.1 ## [49] evaluate_1.0.0 desc_1.4.3 ## [51] pillar_1.9.0 BiocManager_1.30.25 ## [53] generics_0.1.3 sparseMatrixStats_1.16.0 ## [55] munsell_0.5.1 scales_1.3.0 ## [57] RhpcBLASctl_0.23-42 glue_1.8.0 ## [59] tools_4.4.1 BiocNeighbors_1.22.0 ## [61] data.table_1.16.0 ScaledMatrix_1.12.0 ## [63] fs_1.6.4 cowplot_1.1.3 ## [65] grid_4.4.1 colorspace_2.1-1 ## [67] GenomeInfoDbData_1.2.12 beeswarm_0.4.0 ## [69] BiocSingular_1.20.0 vipor_0.4.7 ## [71] cli_3.6.3 rsvd_1.0.5 ## [73] textshaping_0.4.0 fansi_1.0.6 ## [75] S4Arrays_1.4.1 viridisLite_0.4.2 ## [77] gtable_0.3.5 sass_0.4.9 ## [79] digest_0.6.37 SparseArray_1.4.8 ## [81] ggrepel_0.9.6 farver_2.1.2 ## [83] rjson_0.2.23 htmltools_0.5.8.1 ## [85] pkgdown_2.1.1 lifecycle_1.0.4 ## [87] 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.1, 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.1}, 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":"can install clustSIGNAL package GitHub :","code":"# 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. 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 values include - ‘n’ list data frame clusters matrix neighbourhood cell IDs, ‘s’ list data frame clusters final SpatialExperiment object, ‘’ list 3 outputs. … - additional options non-spatial clustering algorithms bluster package, e.g., KmeansParam options like centers iter.max, NNGraphParam options like k cluster.fun.","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\", cluster.fun = \"leiden\", 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 <- adaptiveSmoothing(spe, nnCells, NN = 30, kernel = \"G\", spread = 0.05, threads = 1) #> [1] \"Smoothing performed. NN = 30 Kernel = G Spread = 0.05 Time 23:08: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(7): uniqueID pos ... nsCluster nsSubcluster #> 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, NN = 30, kernel = \"G\", spread = 0.05, sort = TRUE, threads = 1, outputs = \"c\", ... )"},{"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. 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), \"n\" list dataframe clusters plus neighbourhood matrix, \"s\" list dataframe clusters plus final spatialExperiment object, \"\" list outputs. ... additional parameters TwoStepParam clustering methods. Include parameters like k number nearest neighbours cluster.fun selecting community detection method.","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. neighbours: matrix cell names names NN nearest neighbour cells. 3. 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\" \"pos\" #> [3] \"celltype_mapped_refined\" \"sample_id\" #> [5] \"entropy\" \"nsCluster\" #> [7] \"nsSubcluster\" # 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 23:08:28\" #> [1] \"clustSIGNAL run started. Time 23:08:28\" #> [1] \"Initial nonspatial clustering performed. Clusters = 7 Time 23:08:28\" #> 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 = 18 Time 23:08:30\" #> [1] \"Regions defined. Time 23:08:30\" #> [1] \"Region domainness calculated. Time 23:08:30\" #> [1] \"Smoothing performed. NN = 30 Kernel = G Spread = 0.05 Time 23:08:47\" #> [1] \"Nonspatial clustering performed on smoothed data. Clusters = 9 Time 23:08:48\" #> [1] \"clustSIGNAL run completed. 23:08:48\" #> Time difference of 19.50111 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 <- entropyMeasure(spe, cells = \"uniqueID\", regXclust, threads = 1) #> [1] \"Region domainness calculated. Time 23:08:49\" 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 <- neighbourDetect(spe, samples = \"sample_id\", NN = 30, cells = \"uniqueID\", sort = TRUE) #> [1] \"Regions defined. Time 23:08:50\" names(out_list) #> [1] \"nnCells\" \"regXclust\""},{"path":"https://sydneybiox.github.io/clustSIGNAL/reference/nsClustering.html","id":null,"dir":"Reference","previous_headings":"","what":"Non-spatial clustering — nsClustering","title":"Non-spatial clustering — nsClustering","text":"function containing two steps used different times clustSIGNAL workflow. initial non-spatial clustering sub-clustering step (reclust = FALSE) used generate groups ‘putative cell types’, whereas later non-spatial clustering step (reclust = TRUE) used cluster adaptively smoothed gene expression data.","code":""},{"path":"https://sydneybiox.github.io/clustSIGNAL/reference/nsClustering.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Non-spatial clustering — nsClustering","text":"","code":"nsClustering(spe, samples, dimRed, batch, reclust, ...)"},{"path":"https://sydneybiox.github.io/clustSIGNAL/reference/nsClustering.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Non-spatial clustering — nsClustering","text":"spe SpatialExperiment object. reclust = FALSE, object contain logcounts PCA, reculst = TRUE, object contain smoothed gene expression. samples character indicating name colData(spe) column containing sample names. 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. reclust logical parameter handled within method. ... additional parameters TwoStepParam clustering methods. Include parameters like k number nearest neighbours cluster.fun selecting community detection method. Default values k = 5, cluster.fun = \"louvain\".","code":""},{"path":"https://sydneybiox.github.io/clustSIGNAL/reference/nsClustering.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Non-spatial clustering — nsClustering","text":"SpatialExperiment object containing 'putative cell type' group allotted cell (reclust = FALSE) clusters generated smoothed data (reclust = TRUE).","code":""},{"path":"https://sydneybiox.github.io/clustSIGNAL/reference/nsClustering.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Non-spatial clustering — nsClustering","text":"","code":"data(example) # reclust = FALSE for non-spatial clustering of normalised counts # reclust = TRUE for non-spatial clustering of adaptively smoothed counts spe <- nsClustering(spe, samples = \"sample_id\", dimRed = \"PCA\", batch = FALSE, reclust = FALSE) #> [1] \"Initial nonspatial clustering performed. Clusters = 7 Time 23:08:50\" #> Warning: You're computing too large a percentage of total singular values, use a standard svd instead. #> [1] \"Nonspatial subclustering performed. Subclusters = 19 Time 23:08:51\" head(spe$nsCluster) #> [1] 5 5 6 5 5 5 #> Levels: 1 2 3 4 5 6 7 head(spe$nsSubcluster) #> embryo2_Pos29_cell110_z2 embryo2_Pos29_cell117_z2 embryo2_Pos29_cell128_z2 #> 5.2 5.2 6.3 #> embryo2_Pos29_cell134_z2 embryo2_Pos29_cell14_z2 embryo2_Pos29_cell141_z2 #> 5.2 5.2 5.2 #> 19 Levels: 1.1 1.2 2.1 2.2 2.3 3.1 3.2 3.3 4.1 4.2 4.3 5.1 5.2 5.3 6.1 ... 7.2"}] +[{"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, NN specify neighbourhood size, kernel weight distribution use, spread distribution spread value, sort sort neighbourhood, threads specify number cpus use parallel runs, … additional parameters clustering steps. 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:22:28\" ## [1] \"clustSIGNAL run started. Time 00:22:28\" ## [1] \"Initial nonspatial clustering performed. Clusters = 11 Time 00:22:29\" ## [1] \"Nonspatial subclustering performed. Subclusters = 52 Time 00:22:31\" ## [1] \"Regions defined. Time 00:22:34\" ## [1] \"Region domainness calculated. Time 00:22:34\" ## [1] \"Smoothing performed. NN = 30 Kernel = G Spread = 0.05 Time 00:23:29\" ## [1] \"Nonspatial clustering performed on smoothed data. Clusters = 14 Time 00:23:31\" ## [1] \"clustSIGNAL run completed. 00:23:31\" ## Time difference of 1.049867 mins names(res_emb) ## [1] \"clusters\" \"neighbours\" \"spe_final\" head(res_emb$clusters, n = 3) ## Cells Clusters ## 1 embryo2_Pos29_cell100_z2 10 ## 2 embryo2_Pos29_cell101_z5 10 ## 3 embryo2_Pos29_cell104_z2 10 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.3668453 0.6469266 0.05075243"},{"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.10969 1.420308 # 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::nsClustering(spe, samples = \"sample_id\", dimRed = \"PCA\", batch = FALSE, reclust = FALSE) ## [1] \"Initial nonspatial clustering performed. Clusters = 11 Time 00:23:40\" ## [1] \"Nonspatial subclustering performed. Subclusters = 52 Time 00:23:43\" outReg <- clustSIGNAL::neighbourDetect(spe, samples = \"sample_id\", NN = 30, cells = \"uniqueID\", sort = TRUE) ## [1] \"Regions defined. Time 00:23:45\" spe <- entropyMeasure(spe, cells = \"uniqueID\", outReg$regXclust, threads = 1) ## [1] \"Region domainness calculated. Time 00:23:45\" head(spe$entropy) ## [1] 1.30331 0.56083 0.87851 0.97034 0.94808 0.35336"},{"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, batch = TRUE, threads = 4, outputs = \"a\") ## [1] \"Calculating PCA. Time 00:23:45\" ## [1] \"clustSIGNAL run started. Time 00:23:46\" ## [1] \"Initial nonspatial clustering performed. Clusters = 13 Time 00:23:49\" ## [1] \"Nonspatial subclustering performed. Subclusters = 57 Time 00:23:51\" ## [1] \"Regions defined. Time 00:23:54\" ## [1] \"Region domainness calculated. Time 00:23:56\" ## [1] \"Smoothing performed. NN = 30 Kernel = G Spread = 0.05 Time 00:24:17\" ## [1] \"Nonspatial clustering performed on smoothed data. Clusters = 11 Time 00:24:20\" ## [1] \"clustSIGNAL run completed. 00:24:20\" ## Time difference of 35.06137 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.410 0.611 0.0746 1.21 4.55 3.33 ## 2 7.-0.09 0.498 0.672 0.121 0.970 4.51 3.41 ## 3 7.0.16 0.532 0.679 0.102 1.17 4.48 3.34"},{"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.1 (2024-06-14) ## 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.2 ## [9] SpatialExperiment_1.14.0 SingleCellExperiment_1.26.0 ## [11] SummarizedExperiment_1.34.0 Biobase_2.64.0 ## [13] GenomicRanges_1.56.1 GenomeInfoDb_1.40.1 ## [15] IRanges_2.38.1 S4Vectors_0.42.1 ## [17] BiocGenerics_0.50.0 MatrixGenerics_1.16.0 ## [19] matrixStats_1.4.1 BiocStyle_2.32.1 ## ## loaded via a namespace (and not attached): ## [1] gridExtra_2.3 rlang_1.1.4 ## [3] magrittr_2.0.3 scater_1.32.1 ## [5] compiler_4.4.1 DelayedMatrixStats_1.26.0 ## [7] systemfonts_1.1.0 vctrs_0.6.5 ## [9] pkgconfig_2.0.3 crayon_1.5.3 ## [11] fastmap_1.2.0 magick_2.8.5 ## [13] XVector_0.44.0 labeling_0.4.3 ## [15] scuttle_1.14.0 utf8_1.2.4 ## [17] rmarkdown_2.28 UCSC.utils_1.0.0 ## [19] ggbeeswarm_0.7.2 ragg_1.3.3 ## [21] xfun_0.48 bluster_1.14.0 ## [23] zlibbioc_1.50.0 cachem_1.1.0 ## [25] beachmat_2.20.0 jsonlite_1.8.9 ## [27] highr_0.11 DelayedArray_0.30.1 ## [29] BiocParallel_1.38.0 irlba_2.3.5.1 ## [31] parallel_4.4.1 R6_2.5.1 ## [33] bslib_0.8.0 rlist_0.4.6.2 ## [35] jquerylib_0.1.4 Rcpp_1.0.13 ## [37] bookdown_0.40 knitr_1.48 ## [39] Matrix_1.7-0 igraph_2.0.3 ## [41] tidyselect_1.2.1 abind_1.4-8 ## [43] yaml_2.3.10 viridis_0.6.5 ## [45] codetools_0.2-20 lattice_0.22-6 ## [47] tibble_3.2.1 withr_3.0.1 ## [49] evaluate_1.0.0 desc_1.4.3 ## [51] pillar_1.9.0 BiocManager_1.30.25 ## [53] generics_0.1.3 sparseMatrixStats_1.16.0 ## [55] munsell_0.5.1 scales_1.3.0 ## [57] RhpcBLASctl_0.23-42 glue_1.8.0 ## [59] tools_4.4.1 BiocNeighbors_1.22.0 ## [61] data.table_1.16.0 ScaledMatrix_1.12.0 ## [63] fs_1.6.4 cowplot_1.1.3 ## [65] grid_4.4.1 colorspace_2.1-1 ## [67] GenomeInfoDbData_1.2.12 beeswarm_0.4.0 ## [69] BiocSingular_1.20.0 vipor_0.4.7 ## [71] cli_3.6.3 rsvd_1.0.5 ## [73] textshaping_0.4.0 fansi_1.0.6 ## [75] S4Arrays_1.4.1 viridisLite_0.4.2 ## [77] gtable_0.3.5 sass_0.4.9 ## [79] digest_0.6.37 SparseArray_1.4.8 ## [81] ggrepel_0.9.6 farver_2.1.2 ## [83] rjson_0.2.23 htmltools_0.5.8.1 ## [85] pkgdown_2.1.1 lifecycle_1.0.4 ## [87] 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.2, 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.2}, 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":"can install clustSIGNAL package GitHub :","code":"# 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. 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 values include - ‘n’ list data frame clusters matrix neighbourhood cell IDs, ‘s’ list data frame clusters final SpatialExperiment object, ‘’ list 3 outputs. … - additional options non-spatial clustering algorithms bluster package, e.g., KmeansParam options like centers iter.max, NNGraphParam options like k cluster.fun.","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\", cluster.fun = \"leiden\", 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 <- adaptiveSmoothing(spe, nnCells, NN = 30, kernel = \"G\", spread = 0.05, threads = 1) #> [1] \"Smoothing performed. NN = 30 Kernel = G Spread = 0.05 Time 00:21:56\" 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(7): uniqueID pos ... nsCluster nsSubcluster #> 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, NN = 30, kernel = \"G\", spread = 0.05, sort = TRUE, threads = 1, outputs = \"c\", ... )"},{"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. 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), \"n\" list dataframe clusters plus neighbourhood matrix, \"s\" list dataframe clusters plus final spatialExperiment object, \"\" list outputs. ... additional parameters TwoStepParam clustering methods. Include parameters like k number nearest neighbours cluster.fun selecting community detection method.","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. neighbours: matrix cell names names NN nearest neighbour cells. 3. 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\" \"pos\" #> [3] \"celltype_mapped_refined\" \"sample_id\" #> [5] \"entropy\" \"nsCluster\" #> [7] \"nsSubcluster\" # 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:21:57\" #> [1] \"clustSIGNAL run started. Time 00:21:57\" #> [1] \"Initial nonspatial clustering performed. Clusters = 7 Time 00:21: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. #> [1] \"Nonspatial subclustering performed. Subclusters = 18 Time 00:21:58\" #> [1] \"Regions defined. Time 00:21:58\" #> [1] \"Region domainness calculated. Time 00:21:58\" #> [1] \"Smoothing performed. NN = 30 Kernel = G Spread = 0.05 Time 00:22:16\" #> [1] \"Nonspatial clustering performed on smoothed data. Clusters = 9 Time 00:22:16\" #> [1] \"clustSIGNAL run completed. 00:22:16\" #> Time difference of 19.33796 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 <- entropyMeasure(spe, cells = \"uniqueID\", regXclust, threads = 1) #> [1] \"Region domainness calculated. Time 00:22:17\" 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 <- neighbourDetect(spe, samples = \"sample_id\", NN = 30, cells = \"uniqueID\", sort = TRUE) #> [1] \"Regions defined. Time 00:22:18\" names(out_list) #> [1] \"nnCells\" \"regXclust\""},{"path":"https://sydneybiox.github.io/clustSIGNAL/reference/nsClustering.html","id":null,"dir":"Reference","previous_headings":"","what":"Non-spatial clustering — nsClustering","title":"Non-spatial clustering — nsClustering","text":"function containing two steps used different times clustSIGNAL workflow. initial non-spatial clustering sub-clustering step (reclust = FALSE) used generate groups ‘putative cell types’, whereas later non-spatial clustering step (reclust = TRUE) used cluster adaptively smoothed gene expression data.","code":""},{"path":"https://sydneybiox.github.io/clustSIGNAL/reference/nsClustering.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Non-spatial clustering — nsClustering","text":"","code":"nsClustering(spe, samples, dimRed, batch, reclust, ...)"},{"path":"https://sydneybiox.github.io/clustSIGNAL/reference/nsClustering.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Non-spatial clustering — nsClustering","text":"spe SpatialExperiment object. reclust = FALSE, object contain logcounts PCA, reculst = TRUE, object contain smoothed gene expression. samples character indicating name colData(spe) column containing sample names. 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. reclust logical parameter handled within method. ... additional parameters TwoStepParam clustering methods. Include parameters like k number nearest neighbours cluster.fun selecting community detection method. Default values k = 5, cluster.fun = \"louvain\".","code":""},{"path":"https://sydneybiox.github.io/clustSIGNAL/reference/nsClustering.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Non-spatial clustering — nsClustering","text":"SpatialExperiment object containing 'putative cell type' group allotted cell (reclust = FALSE) clusters generated smoothed data (reclust = TRUE).","code":""},{"path":"https://sydneybiox.github.io/clustSIGNAL/reference/nsClustering.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Non-spatial clustering — nsClustering","text":"","code":"data(example) # reclust = FALSE for non-spatial clustering of normalised counts # reclust = TRUE for non-spatial clustering of adaptively smoothed counts spe <- nsClustering(spe, samples = \"sample_id\", dimRed = \"PCA\", batch = FALSE, reclust = FALSE) #> [1] \"Initial nonspatial clustering performed. Clusters = 7 Time 00:22:18\" #> Warning: You're computing too large a percentage of total singular values, use a standard svd instead. #> [1] \"Nonspatial subclustering performed. Subclusters = 19 Time 00:22:19\" head(spe$nsCluster) #> [1] 5 5 6 5 5 5 #> Levels: 1 2 3 4 5 6 7 head(spe$nsSubcluster) #> embryo2_Pos29_cell110_z2 embryo2_Pos29_cell117_z2 embryo2_Pos29_cell128_z2 #> 5.2 5.2 6.3 #> embryo2_Pos29_cell134_z2 embryo2_Pos29_cell14_z2 embryo2_Pos29_cell141_z2 #> 5.2 5.2 5.2 #> 19 Levels: 1.1 1.2 2.1 2.2 2.3 3.1 3.2 3.3 4.1 4.2 4.3 5.1 5.2 5.3 6.1 ... 7.2"}]
vignettes/clustSIGNAL.Rmd
clustSIGNAL.Rmd
## [1] "Calculating PCA. Time 23:09:00" -## [1] "clustSIGNAL run started. Time 23:09:01" -## [1] "Initial nonspatial clustering performed. Clusters = 11 Time 23:09:01" -## [1] "Nonspatial subclustering performed. Subclusters = 52 Time 23:09:03" -## [1] "Regions defined. Time 23:09:06" -## [1] "Region domainness calculated. Time 23:09:06" -## [1] "Smoothing performed. NN = 30 Kernel = G Spread = 0.05 Time 23:10:02" -## [1] "Nonspatial clustering performed on smoothed data. Clusters = 14 Time 23:10:03" -## [1] "clustSIGNAL run completed. 23:10:03" -## Time difference of 1.061019 mins
## [1] "Calculating PCA. Time 00:22:28" +## [1] "clustSIGNAL run started. Time 00:22:28" +## [1] "Initial nonspatial clustering performed. Clusters = 11 Time 00:22:29" +## [1] "Nonspatial subclustering performed. Subclusters = 52 Time 00:22:31" +## [1] "Regions defined. Time 00:22:34" +## [1] "Region domainness calculated. Time 00:22:34" +## [1] "Smoothing performed. NN = 30 Kernel = G Spread = 0.05 Time 00:23:29" +## [1] "Nonspatial clustering performed on smoothed data. Clusters = 14 Time 00:23:31" +## [1] "clustSIGNAL run completed. 00:23:31" +## Time difference of 1.049867 mins
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 @@ -359,15 +359,15 @@
## [1] "Initial nonspatial clustering performed. Clusters = 11 Time 23:10:13" -## [1] "Nonspatial subclustering performed. Subclusters = 52 Time 23:10:15"
## [1] "Initial nonspatial clustering performed. Clusters = 11 Time 00:23:40" +## [1] "Nonspatial subclustering performed. Subclusters = 52 Time 00:23:43"
outReg <- clustSIGNAL::neighbourDetect(spe, samples = "sample_id", NN = 30, cells = "uniqueID", sort = TRUE)
## [1] "Regions defined. Time 23:10:17"
## [1] "Regions defined. Time 00:23:45"
spe <- entropyMeasure(spe, cells = "uniqueID", outReg$regXclust, threads = 1)
## [1] "Region domainness calculated. Time 23:10:18"
## [1] "Region domainness calculated. Time 00:23:45"
head(spe$entropy)
## [1] 1.30331 0.56083 0.87851 0.97034 0.94808 0.35336
## [1] "Calculating PCA. Time 23:10:18" -## [1] "clustSIGNAL run started. Time 23:10:19" -## [1] "Initial nonspatial clustering performed. Clusters = 13 Time 23:10:22"
## [1] "Nonspatial subclustering performed. Subclusters = 57 Time 23:10:24" -## [1] "Regions defined. Time 23:10:27" -## [1] "Region domainness calculated. Time 23:10:29" -## [1] "Smoothing performed. NN = 30 Kernel = G Spread = 0.05 Time 23:10:50" -## [1] "Nonspatial clustering performed on smoothed data. Clusters = 11 Time 23:10:54" -## [1] "clustSIGNAL run completed. 23:10:54" -## Time difference of 35.37587 secs
## [1] "Calculating PCA. Time 00:23:45" +## [1] "clustSIGNAL run started. Time 00:23:46" +## [1] "Initial nonspatial clustering performed. Clusters = 13 Time 00:23:49"
## [1] "Nonspatial subclustering performed. Subclusters = 57 Time 00:23:51" +## [1] "Regions defined. Time 00:23:54" +## [1] "Region domainness calculated. Time 00:23:56" +## [1] "Smoothing performed. NN = 30 Kernel = G Spread = 0.05 Time 00:24:17" +## [1] "Nonspatial clustering performed on smoothed data. Clusters = 11 Time 00:24:20" +## [1] "clustSIGNAL run completed. 00:24:20" +## Time difference of 35.06137 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.1, https://sydneybiox.github.io/clustSIGNAL/. +R package version 0.99.2, 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.1}, + note = {R package version 0.99.2}, url = {https://sydneybiox.github.io/clustSIGNAL/}, }