To run clustSIGNAL, we need the column names of sample and cell
+labels in the colData dataframe of the spatial experiment object. Here,
+the cell labels are in the column ‘uniqueID’ and sample labels are in
+‘embryo’ column.
The output variable is a list that can contain dataframe of cluster
+names, matrix of NN neighbours of each cell, final spe object, or a
+combination of these, depending on the choice of ‘outputs’ selected.
The spread (A) and spatial distribution (B) of region entropy
+measures can be very useful in assessing the tissue composition of
+samples - low entropy regions are more homogeneous with domain-like
+structure, whereas high entropy regions are heterogeneous with more
+uniform distribution of cells.
+
+
+
clustSIGNAL clusters visualisation
+
+
+df_ent=as.data.frame(colData(spe))
+
+# spatial plot
+spt_clust<-df_ent%>%
+ggplot(aes(x =spatialCoords(spe)[, 1],
+ y =-spatialCoords(spe)[, 2]))+
+geom_point(size =0.5, aes(colour =reCluster))+
+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(reCluster))%>%
+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(reCluster)`
+cellOrder=sort(cellOrder)
+df_ent$reCluster=factor(df_ent$reCluster, levels =names(cellOrder))
+# box plot of cluster entropy
+colors_ent=colors[as.numeric(names(cellOrder))]
+box_clust<-df_ent%>%
+ggplot(aes(x =reCluster, y =entropy, fill =reCluster))+
+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))
+
+
The spatial location (A) and entropy distribution (B) of the clusters
+provide spatial context of the cluster cells and their neighbourhoods,
+as well as the compositions of the neighbouhoods.
To run clustSIGNAL, we need the column names of sample and cell IDs
+in the colData dataframe of the spatial experiment object. Here, the
+cell IDs are in the column ‘Cell_ID’ and sample IDs are in ‘samples’
+column.
In multisample analysis, the spread (A) and spatial distribution (B)
+of region entropy measures can be useful in assessing and comparing the
+tissue structure in the samples.
+# spatial plot
+spt_clust<-df_ent%>%
+ggplot(aes(x =spatialCoords(spe)[, 1],
+ y =-spatialCoords(spe)[, 2]))+
+geom_point(size =0.5, aes(colour =reCluster))+
+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(sinsamplesList){
+df_ent_sub=as.data.frame(colData(spe)[spe[[samples]]==s, ])
+# calculating median entropy of each cluster in a sample
+celltype_ent=df_ent_sub%>%
+group_by(as.character(reCluster))%>%
+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(reCluster)`
+cellOrder=sort(cellOrder)
+df_ent_sub$reCluster=factor(df_ent_sub$reCluster, levels =names(cellOrder))
+
+# box plot of cluster entropy
+colors_ent=colors[as.numeric(names(cellOrder))]
+box_clust[[s]]<-df_ent_sub%>%
+ggplot(aes(x =reCluster, y =entropy, fill =reCluster))+
+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")
+
+
The spatial location (top) and entropy distribution (bottom) of the
+clusters can be compared in a multisample analysis, providing spatial
+context of the cluster cells and their neighbourhood compositions in the
+different samples.
c), person, person, person, person) (2024).
clustSIGNAL: clustSIGNAL: a spatial clustering method.
R package version 0.1.0, https://sydneybiox.github.io/clustSIGNAL/, https://sydneybiox.github.io/clustSIGNAL/.
@Manual{,
title = {clustSIGNAL: clustSIGNAL: a spatial clustering method},
- author = {{c)} and {person)} and {person)} and {person)} and {person)}},
+ author = {{c)} and {person} and {person} and {person} and {person)}},
year = {2024},
note = {R package version 0.1.0, https://sydneybiox.github.io/clustSIGNAL/},
url = {https://sydneybiox.github.io/clustSIGNAL/},
diff --git a/index.html b/index.html
index f27af15..06d4f84 100644
--- a/index.html
+++ b/index.html
@@ -35,8 +35,8 @@
data(mouseEmbryo2)
-#>Warning: data set ‘mouseEmbryo2’ not found
+
data(example)names(colData(spe))
-#>Error in h(simpleError(msg, call)): error in evaluating the argument 'x' in selecting a method for function 'colData': object 'spe' not found
+#> [1] "uniqueID" "pos"
+#> [3] "celltype_mapped_refined" "sample_id"
+#> [5] "entropy" "nsCluster"
+#> [7] "nsSubcluster" # identify the column names with cell and sample labelssamples="sample_id"cells="uniqueID"res_list<-clustSIGNAL(spe, samples, cells, outputs ="c")
-#>Error in h(simpleError(msg, call)): error in evaluating the argument 'x' in selecting a method for function 'spatialCoords': object 'spe' not found
+#> [1] "Calculating PCA to use as reduced dimension input."
+#> [1] "clustSIGNAL run started. 2024-09-04 10:26:33.692807"
+#> [1] "Initial nonspatial clustering performed. Clusters = 7 2024-09-04 10:26:33.982719"
+#>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 2024-09-04 10:26:35.112601"
+#> [1] "Regions defined. 2024-09-04 10:26:35.597471"
+#> [1] "Region domainness calculated. 2024-09-04 10:26:40.791918"
+#> [1] "Smoothing performed. NN = 30 Kernel = G Spread = 0.05 2024-09-04 10:26:59.630454"
+#> [1] "Nonspatial clustering performed on smoothed data. Clusters = 9 2024-09-04 10:26:59.903057"
+#> [1] "clustSIGNAL run completed. 2024-09-04 10:26:59.904878"
data(mouseEmbryo2)
-#>Warning: data set ‘mouseEmbryo2’ not found
+
data(example)# requires list containing cluster proportions of each region (regXclust),# generated using the neighbourDetect() functionspe<-entropyMeasure(spe, cells ="uniqueID", regXclust, threads =1)
-#>Error in eval(expr, envir, enclos): object 'spe' not found
+#> [1] "Region domainness calculated. 2024-09-04 10:27:06.03316"head(spe$entropy)
-#>Error in h(simpleError(msg, call)): error in evaluating the argument 'x' in selecting a method for function 'head': object 'spe' not found
+#> [1] 0.4689956 0.2108423 0.6998428 0.3533593 0.8118475 0.3533593
diff --git a/reference/example.html b/reference/example.html
new file mode 100644
index 0000000..f5fc9c8
--- /dev/null
+++ b/reference/example.html
@@ -0,0 +1,92 @@
+
+Example data as SpatialExperiment object — example • clustSIGNAL
+ Skip to contents
+
+
+
This example data was generated from the mouse embryo spatial transcriptomics
+dataset of 3 mouse embryos, with 351 genes and a total of 57536 cells. For running
+examples, we subset the data by selecting 1000 random cells from embryo 2, excluding
+any cells annotated as 'low quality'. After subsetting, we have 1000 cells from
+embryo 2 and 351 genes.
spe a spatialExperiment object containing gene expression matrix with
+normalised counts, where rows indicate genes and columns indicate cells. Also,
+contains a data frame of cell metadata including cell IDs, sample IDs, cell type
+annotations, and x-y coordinates of cells.
+nnCells a matrix where each row corresponds to a cell in spe object,
+and the columns correspond to the nearest neighbors.
+regXclust a list where each element corresponds to a cell in spe object,
+and contains the cluster composition proportions.
This dataset contains spatial transcriptomics data from 3 mouse embryos, with
-351 genes and a total of 57536 cells. For running vignettes and examples, we subset
-the data by selecting only embryo 2 and removed all cells that were annotated
-as 'low quality'. After subsetting, we have 14,185 cells from embryo 2 and 351
-genes.
+351 genes and a total of 57536 cells. For vignettes, we subset the data by selecting
+only embryo 2 and removing all cells that were annotated as 'low quality'. After
+subsetting, we have 14,185 cells from embryo 2 and 351 genes.
me_expr a gene expression matrix with normalised counts, where rows indicate
genes and columns indicate cells.
me_data a data frame of cell metadata including cell IDs, sample IDs,
-cell type annotations, and x-y coordinates of cells.
-nnCells a matrix where each row corresponds to a cell in spe object,
-and the columns correspond to the nearest neighbors.
-regXclust a list where each element corresponds to a cell in spe object,
-and contains the cluster composition proportions.
+cell type annotations, and x-y coordinates of cells.
Source
diff --git a/reference/mHypothal.html b/reference/mHypothal.html
index bffbdf8..16d1c7d 100644
--- a/reference/mHypothal.html
+++ b/reference/mHypothal.html
@@ -1,5 +1,5 @@
-Mouse Hypothalamus Data as SpatialExperiment object — mHypothal • clustSIGNALMouse Hypothalamus Data — mHypothal • clustSIGNAL
data(mouseEmbryo2)
-#>Warning: data set ‘mouseEmbryo2’ not found
-
-spe<-scater::runPCA(spe)
-#>Error in h(simpleError(msg, call)): error in evaluating the argument 'x' in selecting a method for function 'runPCA': object 'spe' not found
+
data(example)# reclust = FALSE for non-spatial clustering of normalised counts# reclust = TRUE for non-spatial clustering of adaptively smoothed countsspe<-nsClustering(spe, dimRed ="PCA", reclust =FALSE)
-#>Error in eval(expr, envir, enclos): object 'spe' not found
+#> [1] "Initial nonspatial clustering performed. Clusters = 7 2024-09-04 10:27:07.26897"
+#>Warning: You're computing too large a percentage of total singular values, use a standard svd instead.
+#> [1] "Nonspatial subclustering performed. Subclusters = 19 2024-09-04 10:27:08.354824"head(spe$nsCluster)
-#>Error in h(simpleError(msg, call)): error in evaluating the argument 'x' in selecting a method for function 'head': object 'spe' not found
+#> [1] 5 5 6 5 5 5
+#> Levels: 1 2 3 4 5 6 7head(spe$nsSubcluster)
-#>Error in h(simpleError(msg, call)): error in evaluating the argument 'x' in selecting a method for function 'head': object 'spe' not found
+#> 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
diff --git a/reference/regXclust.html b/reference/regXclust.html
index a760782..b4e41a4 100644
--- a/reference/regXclust.html
+++ b/reference/regXclust.html
@@ -1,8 +1,8 @@
-
+
-
+
diff --git a/reference/spe.html b/reference/spe.html
new file mode 100644
index 0000000..b4e41a4
--- /dev/null
+++ b/reference/spe.html
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
diff --git a/search.json b/search.json
index a3be861..3f4ae77 100644
--- a/search.json
+++ b/search.json
@@ -1 +1 @@
-[{"path":"https://sydneybiox.github.io/clustSIGNAL/articles/01_seqFISH_mouseEmbryo.html","id":"seqfish-mouse-embryo-data-analysis","dir":"Articles","previous_headings":"","what":"SeqFISH mouse embryo data analysis","title":"Single sample analysis","text":"run clustSIGNAL, need column names sample cell labels colData dataframe spatial experiment object. , cell labels column ‘uniqueID’ sample labels ‘embryo’ column.","code":"# load required packages library(clustSIGNAL) library(distances) library(cluster) library(aricode) library(dplyr) library(ggplot2) library(patchwork) data(mEmbryo2) spe = SpatialExperiment(assays = list(logcounts = me_expr), colData = me_data, spatialCoordsNames = c(\"X\", \"Y\")) spe #> class: SpatialExperiment #> dim: 351 14185 #> metadata(0): #> assays(1): logcounts #> rownames(351): Abcc4 Acp5 ... Zfp57 Zic3 #> rowData names(0): #> colnames(14185): embryo2_Pos29_cell10_z2 embryo2_Pos29_cell10_z5 ... #> embryo2_Pos50_cell99_z2 embryo2_Pos50_cell99_z5 #> colData names(7): uniqueID pos ... nsCluster nsSubcluster #> reducedDimNames(0): #> mainExpName: NULL #> altExpNames(0): #> spatialCoords names(2) : X Y #> imgData names(0): names(colData(spe)) #> [1] \"uniqueID\" \"pos\" #> [3] \"celltype_mapped_refined\" \"sample_id\" #> [5] \"entropy\" \"nsCluster\" #> [7] \"nsSubcluster\""},{"path":"https://sydneybiox.github.io/clustSIGNAL/articles/01_seqFISH_mouseEmbryo.html","id":"running-clustsignal","dir":"Articles","previous_headings":"","what":"Running clustSIGNAL","title":"Single sample analysis","text":"output variable list can contain dataframe cluster names, matrix NN neighbours cell, final spe object, combination , depending choice ‘outputs’ selected.","code":"set.seed(100) samples = \"sample_id\" cells = \"uniqueID\" res_emb = clustSIGNAL(spe, samples, cells, outputs = \"a\") #> [1] \"Calculating PCA to use as reduced dimension input.\" #> [1] \"clustSIGNAL run started. 2024-09-04 06:35:33.580553\" #> [1] \"Initial nonspatial clustering performed. Clusters = 16 2024-09-04 06:35:39.294941\" #> [1] \"Nonspatial subclustering performed. Subclusters = 80 2024-09-04 06:35:44.260327\" #> [1] \"Regions defined. 2024-09-04 06:35:49.944232\" #> [1] \"Region domainness calculated. 2024-09-04 06:36:00.507565\" #> [1] \"Smoothing performed. NN = 30 Kernel = G Spread = 0.05 2024-09-04 06:38:15.315252\" #> [1] \"Nonspatial clustering performed on smoothed data. Clusters = 24 2024-09-04 06:38:20.8452\" #> [1] \"clustSIGNAL run completed. 2024-09-04 06:38:20.847023\" names(res_emb) #> [1] \"clusters\" \"neighbours\" \"spe_final\" head(res_emb$clusters, n = 3) #> Cells Clusters #> 1 embryo2_Pos29_cell10_z2 19 #> 2 embryo2_Pos29_cell10_z5 19 #> 3 embryo2_Pos29_cell100_z2 19 spe = res_emb$spe_final spe #> class: SpatialExperiment #> dim: 351 14185 #> metadata(0): #> assays(2): logcounts smoothed #> rownames(351): Abcc4 Acp5 ... Zfp57 Zic3 #> rowData names(0): #> colnames(14185): embryo2_Pos29_cell10_z2 embryo2_Pos29_cell10_z5 ... #> embryo2_Pos50_cell99_z2 embryo2_Pos50_cell99_z5 #> colData names(8): uniqueID pos ... nsSubcluster reCluster #> 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/01_seqFISH_mouseEmbryo.html","id":"calculating-clustering-metrics","dir":"Articles","previous_headings":"","what":"Calculating clustering metrics","title":"Single sample analysis","text":"","code":"# calculating silhouette width clusts <- as.numeric(as.character(spe$reCluster)) cXg_mat <- t(as.matrix(logcounts(spe))) distMat <- distances(cXg_mat) silCluster <- as.matrix(silhouette(clusts, distMat)) spe$rcSil <- silCluster[, 3] # for datasets with annotated cell type information, we can also calculate # metrics like adjusted rand index (ARI) and normalised mutual information (NMI) as.data.frame(colData(spe)) %>% summarise(ARI = aricode::ARI(celltype_mapped_refined, reCluster), NMI = aricode::NMI(celltype_mapped_refined, reCluster), ASW = mean(rcSil), min_Entropy = min(entropy), max_Entropy = max(entropy), mean_Entropy = mean(entropy)) #> ARI NMI ASW min_Entropy max_Entropy mean_Entropy #> 1 0.3302441 0.58197 0.03808628 0 2.906357 1.246809"},{"path":"https://sydneybiox.github.io/clustSIGNAL/articles/01_seqFISH_mouseEmbryo.html","id":"visualising-clustsignal-outputs","dir":"Articles","previous_headings":"","what":"Visualising clustSIGNAL outputs","title":"Single sample analysis","text":"","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\")"},{"path":"https://sydneybiox.github.io/clustSIGNAL/articles/01_seqFISH_mouseEmbryo.html","id":"entropy-spread-and-distribution","dir":"Articles","previous_headings":"Visualising clustSIGNAL outputs","what":"Entropy spread and distribution","title":"Single sample analysis","text":"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":"# 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_grey() + 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_point(size = 0.5, 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/01_seqFISH_mouseEmbryo.html","id":"clustsignal-clusters-visualisation","dir":"Articles","previous_headings":"Visualising clustSIGNAL outputs","what":"clustSIGNAL clusters visualisation","title":"Single sample analysis","text":"spatial location () entropy distribution (B) clusters provide spatial context cluster cells neighbourhoods, well compositions neighbouhoods.","code":"df_ent = as.data.frame(colData(spe)) # spatial plot spt_clust <- df_ent %>% ggplot(aes(x = spatialCoords(spe)[, 1], y = -spatialCoords(spe)[, 2])) + geom_point(size = 0.5, aes(colour = reCluster)) + 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(reCluster)) %>% 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(reCluster)` cellOrder = sort(cellOrder) df_ent$reCluster = factor(df_ent$reCluster, levels = names(cellOrder)) # box plot of cluster entropy colors_ent = colors[as.numeric(names(cellOrder))] box_clust <- df_ent %>% ggplot(aes(x = reCluster, y = entropy, fill = reCluster)) + 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(1, 2)) sessionInfo() #> R version 4.4.1 (2024-06-14) #> Platform: x86_64-pc-linux-gnu #> Running under: Ubuntu 22.04.4 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] parallel stats4 stats graphics grDevices utils datasets #> [8] methods base #> #> other attached packages: #> [1] patchwork_1.2.0 ggplot2_3.5.1 #> [3] dplyr_1.1.4 aricode_1.0.3 #> [5] cluster_2.1.6 distances_0.1.11 #> [7] clustSIGNAL_0.1.0 doParallel_1.0.17 #> [9] iterators_1.0.14 foreach_1.5.2 #> [11] SpatialExperiment_1.14.0 SingleCellExperiment_1.26.0 #> [13] SummarizedExperiment_1.34.0 Biobase_2.64.0 #> [15] GenomicRanges_1.56.1 GenomeInfoDb_1.40.1 #> [17] IRanges_2.38.1 S4Vectors_0.42.1 #> [19] BiocGenerics_0.50.0 MatrixGenerics_1.16.0 #> [21] matrixStats_1.3.0 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.4 #> [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.2 #> [21] xfun_0.47 bluster_1.14.0 #> [23] zlibbioc_1.50.0 cachem_1.1.0 #> [25] beachmat_2.20.0 jsonlite_1.8.8 #> [27] highr_0.11 DelayedArray_0.30.1 #> [29] BiocParallel_1.38.0 irlba_2.3.5.1 #> [31] R6_2.5.1 bslib_0.8.0 #> [33] jquerylib_0.1.4 Rcpp_1.0.13 #> [35] bookdown_0.40 knitr_1.48 #> [37] igraph_2.0.3 Matrix_1.7-0 #> [39] tidyselect_1.2.1 abind_1.4-5 #> [41] yaml_2.3.10 viridis_0.6.5 #> [43] codetools_0.2-20 lattice_0.22-6 #> [45] tibble_3.2.1 withr_3.0.1 #> [47] evaluate_0.24.0 desc_1.4.3 #> [49] pillar_1.9.0 BiocManager_1.30.25 #> [51] generics_0.1.3 sparseMatrixStats_1.16.0 #> [53] munsell_0.5.1 scales_1.3.0 #> [55] glue_1.7.0 tools_4.4.1 #> [57] BiocNeighbors_1.22.0 ScaledMatrix_1.12.0 #> [59] fs_1.6.4 grid_4.4.1 #> [61] colorspace_2.1-1 GenomeInfoDbData_1.2.12 #> [63] beeswarm_0.4.0 BiocSingular_1.20.0 #> [65] vipor_0.4.7 cli_3.6.3 #> [67] rsvd_1.0.5 textshaping_0.4.0 #> [69] fansi_1.0.6 S4Arrays_1.4.1 #> [71] viridisLite_0.4.2 gtable_0.3.5 #> [73] sass_0.4.9 digest_0.6.37 #> [75] SparseArray_1.4.8 ggrepel_0.9.5 #> [77] farver_2.1.2 rjson_0.2.22 #> [79] htmltools_0.5.8.1 pkgdown_2.1.0 #> [81] lifecycle_1.0.4 httr_1.4.7"},{"path":"https://sydneybiox.github.io/clustSIGNAL/articles/02_MERFISH_mouseHypothalamus.html","id":"merfish-mouse-preoptic-hypothalamus-data-analysis","dir":"Articles","previous_headings":"","what":"MERFISH mouse preoptic hypothalamus data analysis","title":"Multisample analysis","text":"run clustSIGNAL, need column names sample cell IDs colData dataframe spatial experiment object. , cell IDs column ‘Cell_ID’ sample IDs ‘samples’ column.","code":"# load required packages library(clustSIGNAL) library(distances) library(cluster) library(aricode) library(dplyr) library(ggplot2) library(patchwork) data(mHypothal) spe = SpatialExperiment(assays = list(logcounts = mh_expr), colData = mh_data, spatialCoordsNames = c(\"X\", \"Y\")) spe #> class: SpatialExperiment #> dim: 135 15848 #> metadata(0): #> assays(1): logcounts #> rownames(135): Ace2 Adora2a ... Ttn Ttyh2 #> rowData names(0): #> colnames(15848): 8c7df84c-8a53-4aa4-86fd-26e575de9b0e #> 3617ee7c-c0a8-4f18-b9bd-c7ca737ff665 ... #> 8d083684-2e8d-47aa-91f4-dc88d1621f08 #> 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): names(colData(spe)) #> [1] \"Cell_ID\" \"Cell_class\" \"sample_id\" \"samples\""},{"path":"https://sydneybiox.github.io/clustSIGNAL/articles/02_MERFISH_mouseHypothalamus.html","id":"running-clustsignal","dir":"Articles","previous_headings":"","what":"Running clustSIGNAL","title":"Multisample analysis","text":"","code":"set.seed(101) samples = \"samples\" cells = \"Cell_ID\" res_hyp = clustSIGNAL(spe, samples, cells, outputs = \"a\") #> [1] \"Calculating PCA to use as reduced dimension input.\" #> [1] \"clustSIGNAL run started. 2024-09-04 06:39:10.408206\" #> [1] \"Initial nonspatial clustering performed. Clusters = 14 2024-09-04 06:39:17.865876\" #> [1] \"Nonspatial subclustering performed. Subclusters = 84 2024-09-04 06:39:22.74617\" #> [1] \"Regions defined. 2024-09-04 06:39:29.673683\" #> [1] \"Region domainness calculated. 2024-09-04 06:39:42.033402\" #> [1] \"Smoothing performed. NN = 30 Kernel = G Spread = 0.05 2024-09-04 06:41:04.157163\" #> [1] \"Nonspatial clustering performed on smoothed data. Clusters = 13 2024-09-04 06:41:12.803187\" #> [1] \"clustSIGNAL run completed. 2024-09-04 06:41:12.804923\" spe = res_hyp$spe_final spe #> class: SpatialExperiment #> dim: 135 15848 #> metadata(0): #> assays(2): logcounts smoothed #> rownames(135): Ace2 Adora2a ... Ttn Ttyh2 #> rowData names(0): #> colnames(15848): 8c7df84c-8a53-4aa4-86fd-26e575de9b0e #> 3617ee7c-c0a8-4f18-b9bd-c7ca737ff665 ... #> 8d083684-2e8d-47aa-91f4-dc88d1621f08 #> 96bc85ce-b993-4fb1-8e0c-165f83f0cfd0 #> colData names(8): Cell_ID Cell_class ... entropy reCluster #> 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/02_MERFISH_mouseHypothalamus.html","id":"calculating-clustering-metrics","dir":"Articles","previous_headings":"","what":"Calculating clustering metrics","title":"Multisample analysis","text":"","code":"samplesList <- levels(spe[[samples]]) # calculating silhouette width per sample silWidthRC <- matrix(nrow = 0, ncol = 3) for (s in samplesList) { speX <- spe[, spe[[samples]] == s] clust_sub <- as.numeric(as.character(speX$reCluster)) cXg <- t(as.matrix(logcounts(speX))) distMat <- distances(cXg) silCluster <- as.matrix(silhouette(clust_sub, distMat)) silWidthRC <- rbind(silWidthRC, silCluster) } spe$rcSil <- silWidthRC[, 3] # for datasets with annotated cell type information, we can also calculate # metrics like adjusted rand index (ARI) and normalised mutual information (NMI) as.data.frame(colData(spe)) %>% group_by(samples) %>% summarise(ARI = aricode::ARI(Cell_class, reCluster), NMI = aricode::NMI(Cell_class, reCluster), 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.433 0.608 0.0859 1.11 4.62 3.44 #> 2 7.-0.09 0.439 0.623 0.135 0.420 4.57 3.42 #> 3 7.0.16 0.546 0.679 0.110 0 4.62 3.34"},{"path":"https://sydneybiox.github.io/clustSIGNAL/articles/02_MERFISH_mouseHypothalamus.html","id":"visualising-clustsignal-outputs","dir":"Articles","previous_headings":"","what":"Visualising clustSIGNAL outputs","title":"Multisample analysis","text":"","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\")"},{"path":"https://sydneybiox.github.io/clustSIGNAL/articles/02_MERFISH_mouseHypothalamus.html","id":"entropy-spread-and-distribution","dir":"Articles","previous_headings":"Visualising clustSIGNAL outputs","what":"Entropy spread and distribution","title":"Multisample analysis","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(spe)) %>% ggplot(aes(entropy)) + geom_histogram(binwidth = 0.05) + ggtitle(\"A\") + facet_wrap(vars(samples), nrow = 1) + labs(x = \"Entropy\", y = \"Number of regions\") + theme_grey() + 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_point(size = 0.5, aes(colour = entropy)) + scale_colour_gradient2(\"Entropy\", low = \"grey\", high = \"blue\") + scale_size_continuous(range = c(0, max(spe$entropy))) + facet_wrap(vars(samples), scales = \"free\", nrow = 1) + ggtitle(\"B\") + labs(x = \"x-coordinate\", y = \"y-coordinate\") + theme_classic() + theme(text = element_text(size = 12), axis.text.x = element_text(angle = 90, vjust = 0.5)) hst_ent / spt_ent"},{"path":"https://sydneybiox.github.io/clustSIGNAL/articles/02_MERFISH_mouseHypothalamus.html","id":"clustsignal-clusters-visualisation","dir":"Articles","previous_headings":"Visualising clustSIGNAL outputs","what":"clustSIGNAL clusters visualisation","title":"Multisample analysis","text":"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(spe)) # spatial plot spt_clust <- df_ent %>% ggplot(aes(x = spatialCoords(spe)[, 1], y = -spatialCoords(spe)[, 2])) + geom_point(size = 0.5, aes(colour = reCluster)) + 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(spe)[spe[[samples]] == s, ]) # calculating median entropy of each cluster in a sample celltype_ent = df_ent_sub %>% group_by(as.character(reCluster)) %>% 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(reCluster)` cellOrder = sort(cellOrder) df_ent_sub$reCluster = factor(df_ent_sub$reCluster, levels = names(cellOrder)) # box plot of cluster entropy colors_ent = colors[as.numeric(names(cellOrder))] box_clust[[s]] <- df_ent_sub %>% ggplot(aes(x = reCluster, y = entropy, fill = reCluster)) + 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(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\") + plot_annotation(title = \"Spatial and entropy distributions of clusters\") sessionInfo() #> R version 4.4.1 (2024-06-14) #> Platform: x86_64-pc-linux-gnu #> Running under: Ubuntu 22.04.4 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] parallel stats4 stats graphics grDevices utils datasets #> [8] methods base #> #> other attached packages: #> [1] patchwork_1.2.0 ggplot2_3.5.1 #> [3] dplyr_1.1.4 aricode_1.0.3 #> [5] cluster_2.1.6 distances_0.1.11 #> [7] clustSIGNAL_0.1.0 doParallel_1.0.17 #> [9] iterators_1.0.14 foreach_1.5.2 #> [11] SpatialExperiment_1.14.0 SingleCellExperiment_1.26.0 #> [13] SummarizedExperiment_1.34.0 Biobase_2.64.0 #> [15] GenomicRanges_1.56.1 GenomeInfoDb_1.40.1 #> [17] IRanges_2.38.1 S4Vectors_0.42.1 #> [19] BiocGenerics_0.50.0 MatrixGenerics_1.16.0 #> [21] matrixStats_1.3.0 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.4 #> [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.2 #> [21] xfun_0.47 bluster_1.14.0 #> [23] zlibbioc_1.50.0 cachem_1.1.0 #> [25] beachmat_2.20.0 jsonlite_1.8.8 #> [27] highr_0.11 DelayedArray_0.30.1 #> [29] BiocParallel_1.38.0 irlba_2.3.5.1 #> [31] R6_2.5.1 bslib_0.8.0 #> [33] jquerylib_0.1.4 Rcpp_1.0.13 #> [35] bookdown_0.40 knitr_1.48 #> [37] igraph_2.0.3 Matrix_1.7-0 #> [39] tidyselect_1.2.1 abind_1.4-5 #> [41] yaml_2.3.10 viridis_0.6.5 #> [43] codetools_0.2-20 lattice_0.22-6 #> [45] tibble_3.2.1 withr_3.0.1 #> [47] evaluate_0.24.0 desc_1.4.3 #> [49] pillar_1.9.0 BiocManager_1.30.25 #> [51] generics_0.1.3 sparseMatrixStats_1.16.0 #> [53] munsell_0.5.1 scales_1.3.0 #> [55] glue_1.7.0 tools_4.4.1 #> [57] BiocNeighbors_1.22.0 ScaledMatrix_1.12.0 #> [59] fs_1.6.4 grid_4.4.1 #> [61] colorspace_2.1-1 GenomeInfoDbData_1.2.12 #> [63] beeswarm_0.4.0 BiocSingular_1.20.0 #> [65] vipor_0.4.7 cli_3.6.3 #> [67] rsvd_1.0.5 textshaping_0.4.0 #> [69] fansi_1.0.6 S4Arrays_1.4.1 #> [71] viridisLite_0.4.2 gtable_0.3.5 #> [73] sass_0.4.9 digest_0.6.37 #> [75] SparseArray_1.4.8 ggrepel_0.9.5 #> [77] farver_2.1.2 rjson_0.2.22 #> [79] htmltools_0.5.8.1 pkgdown_2.1.0 #> [81] lifecycle_1.0.4 httr_1.4.7"},{"path":"https://sydneybiox.github.io/clustSIGNAL/authors.html","id":null,"dir":"","previous_headings":"","what":"Authors","title":"Authors and Citation","text":"Pratibha Panwar. Maintainer.","code":""},{"path":"https://sydneybiox.github.io/clustSIGNAL/authors.html","id":"citation","dir":"","previous_headings":"","what":"Citation","title":"Authors and Citation","text":"c), person), person), person), person) (2024). clustSIGNAL: clustSIGNAL: spatial clustering method. R package version 0.1.0, https://sydneybiox.github.io/clustSIGNAL/, https://sydneybiox.github.io/clustSIGNAL/.","code":"@Manual{, title = {clustSIGNAL: clustSIGNAL: a spatial clustering method}, author = {{c)} and {person)} and {person)} and {person)} and {person)}}, year = {2024}, note = {R package version 0.1.0, https://sydneybiox.github.io/clustSIGNAL/}, 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 spatial clustering spatially-resolved transcriptomics datasets. , 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. tutorials use clustSIGNAL, see vignettes 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 spatialCoords matrix. 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 “None”, case PCA calculated used low dimension data. 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(mouseEmbryo2) spe # Here, the cell labels are in the column 'uniqueID' and sample labels are in 'embryo' column. set.seed(100) res = clustSIGNAL(spe, samples = \"embryo\", cells = \"uniqueID\", dimRed = \"PCA\", 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 = 30, kernel = \"G\", spread = 0.05)"},{"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.","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(mouseEmbryo2) #> Warning: data set ‘mouseEmbryo2’ not found # 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) #> Error in eval(expr, envir, enclos): object 'spe' not found spe #> Error in eval(expr, envir, enclos): object 'spe' not found"},{"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\", 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 'PCA'. 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 4 cores. 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. Default values k = 5, cluster.fun = \"louvain\".","code":""},{"path":"https://sydneybiox.github.io/clustSIGNAL/reference/clustSIGNAL.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"clustSIGNAL — clustSIGNAL","text":"list outputs clusters: data frame cell names cluster classification. neighbours: matrix cell names names NN nearest neighbour cells. 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(mouseEmbryo2) #> Warning: data set ‘mouseEmbryo2’ not found names(colData(spe)) #> Error in h(simpleError(msg, call)): error in evaluating the argument 'x' in selecting a method for function 'colData': object 'spe' not found # identify the column names with cell and sample labels samples = \"sample_id\" cells = \"uniqueID\" res_list <- clustSIGNAL(spe, samples, cells, outputs = \"c\") #> Error in h(simpleError(msg, call)): error in evaluating the argument 'x' in selecting a method for function 'spatialCoords': object 'spe' not found"},{"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":"numeric vector weights.","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":"numeric vector weights.","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 = 1)"},{"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(mouseEmbryo2) #> Warning: data set ‘mouseEmbryo2’ not found # requires list containing cluster proportions of each region (regXclust), # generated using the neighbourDetect() function spe <- entropyMeasure(spe, cells = \"uniqueID\", regXclust, threads = 1) #> Error in eval(expr, envir, enclos): object 'spe' not found head(spe$entropy) #> Error in h(simpleError(msg, call)): error in evaluating the argument 'x' in selecting a method for function 'head': object 'spe' not found"},{"path":"https://sydneybiox.github.io/clustSIGNAL/reference/mEmbryo2.html","id":null,"dir":"Reference","previous_headings":"","what":"Mouse Embryo Data as SpatialExperiment object — mEmbryo2","title":"Mouse Embryo Data as SpatialExperiment object — mEmbryo2","text":"dataset contains spatial transcriptomics data 3 mouse embryos, 351 genes total 57536 cells. running vignettes examples, subset data selecting embryo 2 removed cells annotated 'low quality'. subsetting, 14,185 cells embryo 2 351 genes.","code":""},{"path":"https://sydneybiox.github.io/clustSIGNAL/reference/mEmbryo2.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Mouse Embryo Data as SpatialExperiment object — mEmbryo2","text":"","code":"load(\"mEmbryo2.RData\")"},{"path":"https://sydneybiox.github.io/clustSIGNAL/reference/mEmbryo2.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"Mouse Embryo Data as SpatialExperiment object — 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. 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/mEmbryo2.html","id":"source","dir":"Reference","previous_headings":"","what":"Source","title":"Mouse Embryo Data as SpatialExperiment object — mEmbryo2","text":"Integration spatial single-cell transcriptomic data elucidates mouse organogenesis, Nature Biotechnology, 2022. 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 as SpatialExperiment object — mHypothal","title":"Mouse Hypothalamus Data as SpatialExperiment object — mHypothal","text":"dataset contains spatial transcriptomics data 181 mouse hypothalamus samples embryos, 155 genes total 1,027,080 cells. running vignettes, subset data selecting 3 samples - Animal 1 Bregma -0.09 Animal 7 Bregmas 0.16 -0.09, removed cells annotated 'ambiguous', removed 20 genes assessed using different technology. subsetting, 15,848 cells 3 mouse brain samples 135 genes.","code":""},{"path":"https://sydneybiox.github.io/clustSIGNAL/reference/mHypothal.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Mouse Hypothalamus Data as SpatialExperiment object — mHypothal","text":"","code":"load(\"mHypothal.RData\")"},{"path":"https://sydneybiox.github.io/clustSIGNAL/reference/mHypothal.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"Mouse Hypothalamus Data as SpatialExperiment object — 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 as SpatialExperiment object — 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 = 30, cells, sort = TRUE)"},{"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: 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 . 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(mouseEmbryo2) #> Warning: data set ‘mouseEmbryo2’ not found out_list <- neighbourDetect(spe, samples = \"sample_id\", NN = 30, cells = \"uniqueID\", sort = TRUE) #> Error in eval(expr, envir, enclos): object 'spe' not found names(out_list) #> Error in eval(expr, envir, enclos): object 'out_list' not found"},{"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, dimRed = \"PCA\", 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. dimRed character indicating name reduced dimensions use SpatialExperiment object (.e., reducedDimNames(spe)). Default value 'PCA'. 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(mouseEmbryo2) #> Warning: data set ‘mouseEmbryo2’ not found spe <- scater::runPCA(spe) #> Error in h(simpleError(msg, call)): error in evaluating the argument 'x' in selecting a method for function 'runPCA': object 'spe' not found # reclust = FALSE for non-spatial clustering of normalised counts # reclust = TRUE for non-spatial clustering of adaptively smoothed counts spe <- nsClustering(spe, dimRed = \"PCA\", reclust = FALSE) #> Error in eval(expr, envir, enclos): object 'spe' not found head(spe$nsCluster) #> Error in h(simpleError(msg, call)): error in evaluating the argument 'x' in selecting a method for function 'head': object 'spe' not found head(spe$nsSubcluster) #> Error in h(simpleError(msg, call)): error in evaluating the argument 'x' in selecting a method for function 'head': object 'spe' not found"}]
+[{"path":"https://sydneybiox.github.io/clustSIGNAL/articles/v1_seqFISH_mouseEmbryo.html","id":"seqfish-mouse-embryo-data-analysis","dir":"Articles","previous_headings":"","what":"SeqFISH mouse embryo data analysis","title":"Single sample analysis","text":"run clustSIGNAL, need column names sample cell labels colData dataframe spatial experiment object. , cell labels column ‘uniqueID’ sample labels ‘embryo’ column.","code":"# load required packages library(clustSIGNAL) library(distances) library(cluster) library(aricode) library(dplyr) library(ggplot2) library(patchwork) data(mEmbryo2) spe = SpatialExperiment(assays = list(logcounts = me_expr), colData = me_data, spatialCoordsNames = c(\"X\", \"Y\")) spe #> class: SpatialExperiment #> dim: 351 14185 #> metadata(0): #> assays(1): logcounts #> rownames(351): Abcc4 Acp5 ... Zfp57 Zic3 #> rowData names(0): #> colnames(14185): embryo2_Pos29_cell10_z2 embryo2_Pos29_cell10_z5 ... #> embryo2_Pos50_cell99_z2 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): names(colData(spe)) #> [1] \"uniqueID\" \"pos\" #> [3] \"celltype_mapped_refined\" \"sample_id\""},{"path":"https://sydneybiox.github.io/clustSIGNAL/articles/v1_seqFISH_mouseEmbryo.html","id":"running-clustsignal","dir":"Articles","previous_headings":"","what":"Running clustSIGNAL","title":"Single sample analysis","text":"output variable list can contain dataframe cluster names, matrix NN neighbours cell, final spe object, combination , depending choice ‘outputs’ selected.","code":"set.seed(100) samples = \"sample_id\" cells = \"uniqueID\" res_emb = clustSIGNAL(spe, samples, cells, outputs = \"a\") #> [1] \"Calculating PCA to use as reduced dimension input.\" #> [1] \"clustSIGNAL run started. 2024-09-04 10:27:17.879059\" #> [1] \"Initial nonspatial clustering performed. Clusters = 16 2024-09-04 10:27:23.610814\" #> [1] \"Nonspatial subclustering performed. Subclusters = 80 2024-09-04 10:27:28.701846\" #> [1] \"Regions defined. 2024-09-04 10:27:34.412133\" #> [1] \"Region domainness calculated. 2024-09-04 10:27:45.28564\" #> [1] \"Smoothing performed. NN = 30 Kernel = G Spread = 0.05 2024-09-04 10:29:59.7949\" #> [1] \"Nonspatial clustering performed on smoothed data. Clusters = 24 2024-09-04 10:30:05.292971\" #> [1] \"clustSIGNAL run completed. 2024-09-04 10:30:05.294878\" names(res_emb) #> [1] \"clusters\" \"neighbours\" \"spe_final\" head(res_emb$clusters, n = 3) #> Cells Clusters #> 1 embryo2_Pos29_cell10_z2 19 #> 2 embryo2_Pos29_cell10_z5 19 #> 3 embryo2_Pos29_cell100_z2 19 spe = res_emb$spe_final spe #> class: SpatialExperiment #> dim: 351 14185 #> metadata(0): #> assays(2): logcounts smoothed #> rownames(351): Abcc4 Acp5 ... Zfp57 Zic3 #> rowData names(0): #> colnames(14185): embryo2_Pos29_cell10_z2 embryo2_Pos29_cell10_z5 ... #> embryo2_Pos50_cell99_z2 embryo2_Pos50_cell99_z5 #> colData names(8): uniqueID pos ... entropy reCluster #> 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/v1_seqFISH_mouseEmbryo.html","id":"calculating-clustering-metrics","dir":"Articles","previous_headings":"","what":"Calculating clustering metrics","title":"Single sample analysis","text":"","code":"# calculating silhouette width clusts <- as.numeric(as.character(spe$reCluster)) cXg_mat <- t(as.matrix(logcounts(spe))) distMat <- distances(cXg_mat) silCluster <- as.matrix(silhouette(clusts, distMat)) spe$rcSil <- silCluster[, 3] # for datasets with annotated cell type information, we can also calculate # metrics like adjusted rand index (ARI) and normalised mutual information (NMI) as.data.frame(colData(spe)) %>% summarise(ARI = aricode::ARI(celltype_mapped_refined, reCluster), NMI = aricode::NMI(celltype_mapped_refined, reCluster), ASW = mean(rcSil), min_Entropy = min(entropy), max_Entropy = max(entropy), mean_Entropy = mean(entropy)) #> ARI NMI ASW min_Entropy max_Entropy mean_Entropy #> 1 0.3302441 0.58197 0.03808628 0 2.906357 1.246809"},{"path":"https://sydneybiox.github.io/clustSIGNAL/articles/v1_seqFISH_mouseEmbryo.html","id":"visualising-clustsignal-outputs","dir":"Articles","previous_headings":"","what":"Visualising clustSIGNAL outputs","title":"Single sample analysis","text":"","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\")"},{"path":"https://sydneybiox.github.io/clustSIGNAL/articles/v1_seqFISH_mouseEmbryo.html","id":"entropy-spread-and-distribution","dir":"Articles","previous_headings":"Visualising clustSIGNAL outputs","what":"Entropy spread and distribution","title":"Single sample analysis","text":"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":"# 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_grey() + 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_point(size = 0.5, 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/v1_seqFISH_mouseEmbryo.html","id":"clustsignal-clusters-visualisation","dir":"Articles","previous_headings":"Visualising clustSIGNAL outputs","what":"clustSIGNAL clusters visualisation","title":"Single sample analysis","text":"spatial location () entropy distribution (B) clusters provide spatial context cluster cells neighbourhoods, well compositions neighbouhoods.","code":"df_ent = as.data.frame(colData(spe)) # spatial plot spt_clust <- df_ent %>% ggplot(aes(x = spatialCoords(spe)[, 1], y = -spatialCoords(spe)[, 2])) + geom_point(size = 0.5, aes(colour = reCluster)) + 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(reCluster)) %>% 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(reCluster)` cellOrder = sort(cellOrder) df_ent$reCluster = factor(df_ent$reCluster, levels = names(cellOrder)) # box plot of cluster entropy colors_ent = colors[as.numeric(names(cellOrder))] box_clust <- df_ent %>% ggplot(aes(x = reCluster, y = entropy, fill = reCluster)) + 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)) sessionInfo() #> R version 4.4.1 (2024-06-14) #> Platform: x86_64-pc-linux-gnu #> Running under: Ubuntu 22.04.4 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] parallel stats4 stats graphics grDevices utils datasets #> [8] methods base #> #> other attached packages: #> [1] patchwork_1.2.0 ggplot2_3.5.1 #> [3] dplyr_1.1.4 aricode_1.0.3 #> [5] cluster_2.1.6 distances_0.1.11 #> [7] clustSIGNAL_0.1.0 doParallel_1.0.17 #> [9] iterators_1.0.14 foreach_1.5.2 #> [11] SpatialExperiment_1.14.0 SingleCellExperiment_1.26.0 #> [13] SummarizedExperiment_1.34.0 Biobase_2.64.0 #> [15] GenomicRanges_1.56.1 GenomeInfoDb_1.40.1 #> [17] IRanges_2.38.1 S4Vectors_0.42.1 #> [19] BiocGenerics_0.50.0 MatrixGenerics_1.16.0 #> [21] matrixStats_1.3.0 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.4 #> [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.2 #> [21] xfun_0.47 bluster_1.14.0 #> [23] zlibbioc_1.50.0 cachem_1.1.0 #> [25] beachmat_2.20.0 jsonlite_1.8.8 #> [27] highr_0.11 DelayedArray_0.30.1 #> [29] BiocParallel_1.38.0 irlba_2.3.5.1 #> [31] R6_2.5.1 bslib_0.8.0 #> [33] jquerylib_0.1.4 Rcpp_1.0.13 #> [35] bookdown_0.40 knitr_1.48 #> [37] igraph_2.0.3 Matrix_1.7-0 #> [39] tidyselect_1.2.1 abind_1.4-5 #> [41] yaml_2.3.10 viridis_0.6.5 #> [43] codetools_0.2-20 lattice_0.22-6 #> [45] tibble_3.2.1 withr_3.0.1 #> [47] evaluate_0.24.0 desc_1.4.3 #> [49] pillar_1.9.0 BiocManager_1.30.25 #> [51] generics_0.1.3 sparseMatrixStats_1.16.0 #> [53] munsell_0.5.1 scales_1.3.0 #> [55] glue_1.7.0 tools_4.4.1 #> [57] BiocNeighbors_1.22.0 ScaledMatrix_1.12.0 #> [59] fs_1.6.4 grid_4.4.1 #> [61] colorspace_2.1-1 GenomeInfoDbData_1.2.12 #> [63] beeswarm_0.4.0 BiocSingular_1.20.0 #> [65] vipor_0.4.7 cli_3.6.3 #> [67] rsvd_1.0.5 textshaping_0.4.0 #> [69] fansi_1.0.6 S4Arrays_1.4.1 #> [71] viridisLite_0.4.2 gtable_0.3.5 #> [73] sass_0.4.9 digest_0.6.37 #> [75] SparseArray_1.4.8 ggrepel_0.9.5 #> [77] farver_2.1.2 rjson_0.2.22 #> [79] htmltools_0.5.8.1 pkgdown_2.1.0 #> [81] lifecycle_1.0.4 httr_1.4.7"},{"path":"https://sydneybiox.github.io/clustSIGNAL/articles/v2_MERFISH_mouseHypothalamus.html","id":"merfish-mouse-preoptic-hypothalamus-data-analysis","dir":"Articles","previous_headings":"","what":"MERFISH mouse preoptic hypothalamus data analysis","title":"Multisample analysis","text":"run clustSIGNAL, need column names sample cell IDs colData dataframe spatial experiment object. , cell IDs column ‘Cell_ID’ sample IDs ‘samples’ column.","code":"# load required packages library(clustSIGNAL) library(distances) library(cluster) library(aricode) library(dplyr) library(ggplot2) library(patchwork) data(mHypothal) spe = SpatialExperiment(assays = list(logcounts = mh_expr), colData = mh_data, spatialCoordsNames = c(\"X\", \"Y\")) spe #> class: SpatialExperiment #> dim: 135 15848 #> metadata(0): #> assays(1): logcounts #> rownames(135): Ace2 Adora2a ... Ttn Ttyh2 #> rowData names(0): #> colnames(15848): 8c7df84c-8a53-4aa4-86fd-26e575de9b0e #> 3617ee7c-c0a8-4f18-b9bd-c7ca737ff665 ... #> 8d083684-2e8d-47aa-91f4-dc88d1621f08 #> 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): names(colData(spe)) #> [1] \"Cell_ID\" \"Cell_class\" \"sample_id\" \"samples\""},{"path":"https://sydneybiox.github.io/clustSIGNAL/articles/v2_MERFISH_mouseHypothalamus.html","id":"running-clustsignal","dir":"Articles","previous_headings":"","what":"Running clustSIGNAL","title":"Multisample analysis","text":"","code":"set.seed(101) samples = \"samples\" cells = \"Cell_ID\" res_hyp = clustSIGNAL(spe, samples, cells, outputs = \"a\") #> [1] \"Calculating PCA to use as reduced dimension input.\" #> [1] \"clustSIGNAL run started. 2024-09-04 10:30:55.6678\" #> [1] \"Initial nonspatial clustering performed. Clusters = 14 2024-09-04 10:31:03.204345\" #> [1] \"Nonspatial subclustering performed. Subclusters = 84 2024-09-04 10:31:08.222574\" #> [1] \"Regions defined. 2024-09-04 10:31:15.113896\" #> [1] \"Region domainness calculated. 2024-09-04 10:31:27.694133\" #> [1] \"Smoothing performed. NN = 30 Kernel = G Spread = 0.05 2024-09-04 10:32:55.826762\" #> [1] \"Nonspatial clustering performed on smoothed data. Clusters = 13 2024-09-04 10:33:04.379118\" #> [1] \"clustSIGNAL run completed. 2024-09-04 10:33:04.380896\" spe = res_hyp$spe_final spe #> class: SpatialExperiment #> dim: 135 15848 #> metadata(0): #> assays(2): logcounts smoothed #> rownames(135): Ace2 Adora2a ... Ttn Ttyh2 #> rowData names(0): #> colnames(15848): 8c7df84c-8a53-4aa4-86fd-26e575de9b0e #> 3617ee7c-c0a8-4f18-b9bd-c7ca737ff665 ... #> 8d083684-2e8d-47aa-91f4-dc88d1621f08 #> 96bc85ce-b993-4fb1-8e0c-165f83f0cfd0 #> colData names(8): Cell_ID Cell_class ... entropy reCluster #> 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/v2_MERFISH_mouseHypothalamus.html","id":"calculating-clustering-metrics","dir":"Articles","previous_headings":"","what":"Calculating clustering metrics","title":"Multisample analysis","text":"","code":"samplesList <- levels(spe[[samples]]) # calculating silhouette width per sample silWidthRC <- matrix(nrow = 0, ncol = 3) for (s in samplesList) { speX <- spe[, spe[[samples]] == s] clust_sub <- as.numeric(as.character(speX$reCluster)) cXg <- t(as.matrix(logcounts(speX))) distMat <- distances(cXg) silCluster <- as.matrix(silhouette(clust_sub, distMat)) silWidthRC <- rbind(silWidthRC, silCluster) } spe$rcSil <- silWidthRC[, 3] # for datasets with annotated cell type information, we can also calculate # metrics like adjusted rand index (ARI) and normalised mutual information (NMI) as.data.frame(colData(spe)) %>% group_by(samples) %>% summarise(ARI = aricode::ARI(Cell_class, reCluster), NMI = aricode::NMI(Cell_class, reCluster), 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.433 0.608 0.0859 1.11 4.62 3.44 #> 2 7.-0.09 0.439 0.623 0.135 0.420 4.57 3.42 #> 3 7.0.16 0.546 0.679 0.110 0 4.62 3.34"},{"path":"https://sydneybiox.github.io/clustSIGNAL/articles/v2_MERFISH_mouseHypothalamus.html","id":"visualising-clustsignal-outputs","dir":"Articles","previous_headings":"","what":"Visualising clustSIGNAL outputs","title":"Multisample analysis","text":"","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\")"},{"path":"https://sydneybiox.github.io/clustSIGNAL/articles/v2_MERFISH_mouseHypothalamus.html","id":"entropy-spread-and-distribution","dir":"Articles","previous_headings":"Visualising clustSIGNAL outputs","what":"Entropy spread and distribution","title":"Multisample analysis","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(spe)) %>% 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(spe)) %>% ggplot(aes(x = spatialCoords(spe)[, 1], y = -spatialCoords(spe)[, 2])) + geom_point(size = 0.5, aes(colour = entropy)) + scale_colour_gradient2(\"Entropy\", low = \"grey\", high = \"blue\") + scale_size_continuous(range = c(0, max(spe$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)\")"},{"path":"https://sydneybiox.github.io/clustSIGNAL/articles/v2_MERFISH_mouseHypothalamus.html","id":"clustsignal-clusters-visualisation","dir":"Articles","previous_headings":"Visualising clustSIGNAL outputs","what":"clustSIGNAL clusters visualisation","title":"Multisample analysis","text":"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(spe)) # spatial plot spt_clust <- df_ent %>% ggplot(aes(x = spatialCoords(spe)[, 1], y = -spatialCoords(spe)[, 2])) + geom_point(size = 0.5, aes(colour = reCluster)) + 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(spe)[spe[[samples]] == s, ]) # calculating median entropy of each cluster in a sample celltype_ent = df_ent_sub %>% group_by(as.character(reCluster)) %>% 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(reCluster)` cellOrder = sort(cellOrder) df_ent_sub$reCluster = factor(df_ent_sub$reCluster, levels = names(cellOrder)) # box plot of cluster entropy colors_ent = colors[as.numeric(names(cellOrder))] box_clust[[s]] <- df_ent_sub %>% ggplot(aes(x = reCluster, y = entropy, fill = reCluster)) + 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\") sessionInfo() #> R version 4.4.1 (2024-06-14) #> Platform: x86_64-pc-linux-gnu #> Running under: Ubuntu 22.04.4 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] parallel stats4 stats graphics grDevices utils datasets #> [8] methods base #> #> other attached packages: #> [1] patchwork_1.2.0 ggplot2_3.5.1 #> [3] dplyr_1.1.4 aricode_1.0.3 #> [5] cluster_2.1.6 distances_0.1.11 #> [7] clustSIGNAL_0.1.0 doParallel_1.0.17 #> [9] iterators_1.0.14 foreach_1.5.2 #> [11] SpatialExperiment_1.14.0 SingleCellExperiment_1.26.0 #> [13] SummarizedExperiment_1.34.0 Biobase_2.64.0 #> [15] GenomicRanges_1.56.1 GenomeInfoDb_1.40.1 #> [17] IRanges_2.38.1 S4Vectors_0.42.1 #> [19] BiocGenerics_0.50.0 MatrixGenerics_1.16.0 #> [21] matrixStats_1.3.0 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.4 #> [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.2 #> [21] xfun_0.47 bluster_1.14.0 #> [23] zlibbioc_1.50.0 cachem_1.1.0 #> [25] beachmat_2.20.0 jsonlite_1.8.8 #> [27] highr_0.11 DelayedArray_0.30.1 #> [29] BiocParallel_1.38.0 irlba_2.3.5.1 #> [31] R6_2.5.1 bslib_0.8.0 #> [33] jquerylib_0.1.4 Rcpp_1.0.13 #> [35] bookdown_0.40 knitr_1.48 #> [37] igraph_2.0.3 Matrix_1.7-0 #> [39] tidyselect_1.2.1 abind_1.4-5 #> [41] yaml_2.3.10 viridis_0.6.5 #> [43] codetools_0.2-20 lattice_0.22-6 #> [45] tibble_3.2.1 withr_3.0.1 #> [47] evaluate_0.24.0 desc_1.4.3 #> [49] pillar_1.9.0 BiocManager_1.30.25 #> [51] generics_0.1.3 sparseMatrixStats_1.16.0 #> [53] munsell_0.5.1 scales_1.3.0 #> [55] glue_1.7.0 tools_4.4.1 #> [57] BiocNeighbors_1.22.0 ScaledMatrix_1.12.0 #> [59] fs_1.6.4 grid_4.4.1 #> [61] colorspace_2.1-1 GenomeInfoDbData_1.2.12 #> [63] beeswarm_0.4.0 BiocSingular_1.20.0 #> [65] vipor_0.4.7 cli_3.6.3 #> [67] rsvd_1.0.5 textshaping_0.4.0 #> [69] fansi_1.0.6 S4Arrays_1.4.1 #> [71] viridisLite_0.4.2 gtable_0.3.5 #> [73] sass_0.4.9 digest_0.6.37 #> [75] SparseArray_1.4.8 ggrepel_0.9.5 #> [77] farver_2.1.2 rjson_0.2.22 #> [79] htmltools_0.5.8.1 pkgdown_2.1.0 #> [81] lifecycle_1.0.4 httr_1.4.7"},{"path":"https://sydneybiox.github.io/clustSIGNAL/authors.html","id":null,"dir":"","previous_headings":"","what":"Authors","title":"Authors and Citation","text":"Pratibha Panwar. Maintainer.","code":""},{"path":"https://sydneybiox.github.io/clustSIGNAL/authors.html","id":"citation","dir":"","previous_headings":"","what":"Citation","title":"Authors and Citation","text":"c), person, person, person, person) (2024). clustSIGNAL: clustSIGNAL: spatial clustering method. R package version 0.1.0, https://sydneybiox.github.io/clustSIGNAL/, https://sydneybiox.github.io/clustSIGNAL/.","code":"@Manual{, title = {clustSIGNAL: clustSIGNAL: a spatial clustering method}, author = {{c)} and {person} and {person} and {person} and {person)}}, year = {2024}, note = {R package version 0.1.0, https://sydneybiox.github.io/clustSIGNAL/}, 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 spatial clustering spatially-resolved transcriptomics datasets. , 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. tutorials use clustSIGNAL, see vignettes 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 spatialCoords matrix. 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 “None”, case PCA calculated used low dimension data. 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(mouseEmbryo2) spe # Here, the cell labels are in the column 'uniqueID' and sample labels are in 'embryo' column. set.seed(100) res = clustSIGNAL(spe, samples = \"embryo\", cells = \"uniqueID\", dimRed = \"PCA\", 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 = 30, kernel = \"G\", spread = 0.05)"},{"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.","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) #> [1] \"Smoothing performed. NN = 30 Kernel = G Spread = 0.05 2024-09-04 10:26:32.623951\" 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\", 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 'PCA'. 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 4 cores. 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. Default values k = 5, cluster.fun = \"louvain\".","code":""},{"path":"https://sydneybiox.github.io/clustSIGNAL/reference/clustSIGNAL.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"clustSIGNAL — clustSIGNAL","text":"list outputs clusters: data frame cell names cluster classification. neighbours: matrix cell names names NN nearest neighbour cells. 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 to use as reduced dimension input.\" #> [1] \"clustSIGNAL run started. 2024-09-04 10:26:33.692807\" #> [1] \"Initial nonspatial clustering performed. Clusters = 7 2024-09-04 10:26:33.982719\" #> 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 2024-09-04 10:26:35.112601\" #> [1] \"Regions defined. 2024-09-04 10:26:35.597471\" #> [1] \"Region domainness calculated. 2024-09-04 10:26:40.791918\" #> [1] \"Smoothing performed. NN = 30 Kernel = G Spread = 0.05 2024-09-04 10:26:59.630454\" #> [1] \"Nonspatial clustering performed on smoothed data. Clusters = 9 2024-09-04 10:26:59.903057\" #> [1] \"clustSIGNAL run completed. 2024-09-04 10:26:59.904878\""},{"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":"numeric vector weights.","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":"numeric vector weights.","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 = 1)"},{"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. 2024-09-04 10:27:06.03316\" head(spe$entropy) #> [1] 0.4689956 0.2108423 0.6998428 0.3533593 0.8118475 0.3533593"},{"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/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 selecting embryo 2 removing cells annotated 'low quality'. subsetting, 14,185 cells embryo 2 351 genes.","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, 2022. 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 embryos, 155 genes total 1,027,080 cells. running vignettes, subset data selecting 3 samples - Animal 1 Bregma -0.09 Animal 7 Bregmas 0.16 -0.09, removed cells annotated 'ambiguous', removed 20 genes assessed using different technology. subsetting, 15,848 cells 3 mouse brain samples 135 genes.","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 = 30, cells, sort = TRUE)"},{"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: 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 . 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. 2024-09-04 10:27:07.005551\" 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, dimRed = \"PCA\", 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. dimRed character indicating name reduced dimensions use SpatialExperiment object (.e., reducedDimNames(spe)). Default value 'PCA'. 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, dimRed = \"PCA\", reclust = FALSE) #> [1] \"Initial nonspatial clustering performed. Clusters = 7 2024-09-04 10:27:07.26897\" #> Warning: You're computing too large a percentage of total singular values, use a standard svd instead. #> [1] \"Nonspatial subclustering performed. Subclusters = 19 2024-09-04 10:27:08.354824\" 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"}]
diff --git a/sitemap.xml b/sitemap.xml
index fa51e19..fff1434 100644
--- a/sitemap.xml
+++ b/sitemap.xml
@@ -1,8 +1,8 @@
https://sydneybiox.github.io/clustSIGNAL/404.html
-https://sydneybiox.github.io/clustSIGNAL/articles/01_seqFISH_mouseEmbryo.html
-https://sydneybiox.github.io/clustSIGNAL/articles/02_MERFISH_mouseHypothalamus.htmlhttps://sydneybiox.github.io/clustSIGNAL/articles/index.html
+https://sydneybiox.github.io/clustSIGNAL/articles/v1_seqFISH_mouseEmbryo.html
+https://sydneybiox.github.io/clustSIGNAL/articles/v2_MERFISH_mouseHypothalamus.htmlhttps://sydneybiox.github.io/clustSIGNAL/authors.htmlhttps://sydneybiox.github.io/clustSIGNAL/index.htmlhttps://sydneybiox.github.io/clustSIGNAL/reference/adaptiveSmoothing.html
@@ -15,6 +15,7 @@
https://sydneybiox.github.io/clustSIGNAL/reference/dot-gauss_kernel.htmlhttps://sydneybiox.github.io/clustSIGNAL/reference/dot-smoothedData.htmlhttps://sydneybiox.github.io/clustSIGNAL/reference/entropyMeasure.html
+https://sydneybiox.github.io/clustSIGNAL/reference/example.htmlhttps://sydneybiox.github.io/clustSIGNAL/reference/index.htmlhttps://sydneybiox.github.io/clustSIGNAL/reference/mEmbryo2.htmlhttps://sydneybiox.github.io/clustSIGNAL/reference/mHypothal.html