diff --git a/articles/spicyR.html b/articles/spicyR.html index 61dbec8..8b01042 100644 --- a/articles/spicyR.html +++ b/articles/spicyR.html @@ -72,7 +72,7 @@

Ellis
Westmead Institute for Medical Research, University of Sydney, AustraliaSchool of Mathematics and Statistics, University of Sydney, -Australia

28 October 2024

+Australia

11 November 2024

Source: vignettes/spicyR.Rmd
spicyR.Rmd
@@ -509,7 +509,7 @@

References
 sessionInfo()
-#> R version 4.4.1 (2024-06-14)
+#> R version 4.4.2 (2024-10-31)
 #> Platform: x86_64-pc-linux-gnu
 #> Running under: Ubuntu 22.04.5 LTS
 #> 
@@ -531,30 +531,30 @@ 

References#> [8] base #> #> other attached packages: -#> [1] survival_3.6-4 dplyr_1.1.4 -#> [3] imcRtools_1.10.0 SpatialDatasets_1.2.0 -#> [5] ExperimentHub_2.12.0 AnnotationHub_3.12.0 -#> [7] BiocFileCache_2.12.0 dbplyr_2.5.0 -#> [9] SpatialExperiment_1.14.0 SingleCellExperiment_1.26.0 -#> [11] SummarizedExperiment_1.34.0 Biobase_2.64.0 -#> [13] GenomicRanges_1.56.2 GenomeInfoDb_1.40.1 -#> [15] IRanges_2.38.1 S4Vectors_0.42.1 -#> [17] BiocGenerics_0.50.0 MatrixGenerics_1.16.0 +#> [1] survival_3.7-0 dplyr_1.1.4 +#> [3] imcRtools_1.12.0 SpatialDatasets_1.4.0 +#> [5] ExperimentHub_2.14.0 AnnotationHub_3.14.0 +#> [7] BiocFileCache_2.14.0 dbplyr_2.5.0 +#> [9] SpatialExperiment_1.16.0 SingleCellExperiment_1.28.0 +#> [11] SummarizedExperiment_1.36.0 Biobase_2.66.0 +#> [13] GenomicRanges_1.58.0 GenomeInfoDb_1.42.0 +#> [15] IRanges_2.40.0 S4Vectors_0.44.0 +#> [17] BiocGenerics_0.52.0 MatrixGenerics_1.18.0 #> [19] matrixStats_1.4.1 ggplot2_3.5.1 -#> [21] spicyR_1.17.10 BiocStyle_2.32.1 +#> [21] spicyR_1.17.10 BiocStyle_2.34.0 #> #> loaded via a namespace (and not attached): -#> [1] fs_1.6.4 spatstat.sparse_3.1-0 -#> [3] bitops_1.0-9 sf_1.0-18 -#> [5] EBImage_4.46.0 httr_1.4.7 +#> [1] fs_1.6.5 spatstat.sparse_3.1-0 +#> [3] bitops_1.0-9 sf_1.0-19 +#> [5] EBImage_4.48.0 httr_1.4.7 #> [7] RColorBrewer_1.1-3 numDeriv_2016.8-1.1 -#> [9] tools_4.4.1 backports_1.5.0 +#> [9] tools_4.4.2 backports_1.5.0 #> [11] utf8_1.2.4 R6_2.5.1 -#> [13] DT_0.33 HDF5Array_1.32.1 -#> [15] mgcv_1.9-1 rhdf5filters_1.16.0 -#> [17] withr_3.0.1 sp_2.1-4 +#> [13] DT_0.33 HDF5Array_1.34.0 +#> [15] mgcv_1.9-1 rhdf5filters_1.18.0 +#> [17] withr_3.0.2 sp_2.1-4 #> [19] gridExtra_2.3 coxme_2.2-22 -#> [21] ClassifyR_3.8.5 cli_3.6.3 +#> [21] ClassifyR_3.10.0 cli_3.6.3 #> [23] textshaping_0.4.0 spatstat.explore_3.3-3 #> [25] labeling_0.4.3 sass_0.4.9 #> [27] nnls_1.6 spatstat.data_3.1-2 @@ -564,78 +564,77 @@

References#> [35] RSQLite_2.3.7 generics_0.1.3 #> [37] vroom_1.6.5 spatstat.random_3.3-2 #> [39] car_3.1-3 scam_1.2-17 -#> [41] Matrix_1.7-0 ggbeeswarm_0.7.2 +#> [41] Matrix_1.7-1 ggbeeswarm_0.7.2 #> [43] fansi_1.0.6 abind_1.4-8 #> [45] terra_1.7-83 lifecycle_1.0.4 #> [47] yaml_2.3.10 carData_3.0-5 -#> [49] rhdf5_2.48.0 SparseArray_1.4.8 -#> [51] grid_4.4.1 blob_1.2.4 +#> [49] rhdf5_2.50.0 SparseArray_1.6.0 +#> [51] grid_4.4.2 blob_1.2.4 #> [53] promises_1.3.0 crayon_1.5.3 #> [55] bdsmatrix_1.3-7 shinydashboard_0.7.2 -#> [57] lattice_0.22-6 beachmat_2.20.0 -#> [59] KEGGREST_1.44.1 magick_2.8.5 -#> [61] cytomapper_1.16.0 pillar_1.9.0 -#> [63] knitr_1.48 RTriangle_1.6-0.14 -#> [65] rjson_0.2.23 boot_1.3-30 +#> [57] lattice_0.22-6 beachmat_2.22.0 +#> [59] KEGGREST_1.46.0 magick_2.8.5 +#> [61] cytomapper_1.18.0 pillar_1.9.0 +#> [63] knitr_1.49 RTriangle_1.6-0.14 +#> [65] rjson_0.2.23 boot_1.3-31 #> [67] codetools_0.2-20 glue_1.8.0 -#> [69] spatstat.univar_3.0-1 data.table_1.16.2 -#> [71] MultiAssayExperiment_1.30.3 vctrs_0.6.5 +#> [69] spatstat.univar_3.1-1 data.table_1.16.2 +#> [71] MultiAssayExperiment_1.32.0 vctrs_0.6.5 #> [73] png_0.1-8 gtable_0.3.6 -#> [75] cachem_1.1.0 xfun_0.48 -#> [77] S4Arrays_1.4.1 mime_0.12 +#> [75] cachem_1.1.0 xfun_0.49 +#> [77] S4Arrays_1.6.0 mime_0.12 #> [79] tidygraph_1.3.1 pheatmap_1.0.12 -#> [81] units_0.8-5 nlme_3.1-164 +#> [81] units_0.8-5 nlme_3.1-166 #> [83] bit64_4.5.2 filelock_1.0.3 #> [85] bslib_0.8.0 svgPanZoom_0.3.4 #> [87] KernSmooth_2.23-24 vipor_0.4.7 #> [89] colorspace_2.1-1 DBI_1.2.3 #> [91] raster_3.6-30 tidyselect_1.2.1 -#> [93] bit_4.5.0 compiler_4.4.1 -#> [95] curl_5.2.3 BiocNeighbors_1.22.0 -#> [97] desc_1.4.3 DelayedArray_0.30.1 +#> [93] bit_4.5.0 compiler_4.4.2 +#> [95] curl_6.0.0 BiocNeighbors_2.0.0 +#> [97] desc_1.4.3 DelayedArray_0.32.0 #> [99] bookdown_0.41 scales_1.3.0 #> [101] classInt_0.4-10 distances_0.1.11 #> [103] rappdirs_0.3.3 tiff_0.1-12 #> [105] stringr_1.5.1 digest_0.6.37 #> [107] goftest_1.2-3 fftwtools_0.9-11 -#> [109] spatstat.utils_3.1-0 minqa_1.2.8 -#> [111] rmarkdown_2.28 XVector_0.44.0 +#> [109] spatstat.utils_3.1-1 minqa_1.2.8 +#> [111] rmarkdown_2.29 XVector_0.46.0 #> [113] htmltools_0.5.8.1 pkgconfig_2.0.3 #> [115] jpeg_0.1-10 lme4_1.1-35.5 -#> [117] sparseMatrixStats_1.16.0 highr_0.11 -#> [119] fastmap_1.2.0 rlang_1.1.4 -#> [121] htmlwidgets_1.6.4 ggthemes_5.1.0 -#> [123] UCSC.utils_1.0.0 DelayedMatrixStats_1.26.0 -#> [125] shiny_1.9.1 ggh4x_0.2.8 -#> [127] farver_2.1.2 jquerylib_0.1.4 -#> [129] jsonlite_1.8.9 BiocParallel_1.38.0 -#> [131] RCurl_1.98-1.16 magrittr_2.0.3 -#> [133] scuttle_1.14.0 Formula_1.2-5 -#> [135] GenomeInfoDbData_1.2.12 Rhdf5lib_1.26.0 -#> [137] munsell_0.5.1 Rcpp_1.0.13 -#> [139] viridis_0.6.5 stringi_1.8.4 -#> [141] ggraph_2.2.1 zlibbioc_1.50.0 -#> [143] MASS_7.3-60.2 plyr_1.8.9 -#> [145] parallel_4.4.1 ggrepel_0.9.6 -#> [147] deldir_2.0-4 Biostrings_2.72.1 -#> [149] graphlayouts_1.2.0 splines_4.4.1 -#> [151] tensor_1.5 hms_1.1.3 -#> [153] locfit_1.5-9.10 igraph_2.1.1 -#> [155] ggpubr_0.6.0 spatstat.geom_3.3-3 -#> [157] ggsignif_0.6.4 reshape2_1.4.4 -#> [159] BiocVersion_3.19.1 evaluate_1.0.1 -#> [161] BiocManager_1.30.25 tzdb_0.4.0 -#> [163] nloptr_2.1.1 tweenr_2.0.3 -#> [165] httpuv_1.6.15 tidyr_1.3.1 -#> [167] purrr_1.0.2 polyclip_1.10-7 -#> [169] ggforce_0.4.2 broom_1.0.7 -#> [171] xtable_1.8-4 e1071_1.7-16 -#> [173] rstatix_0.7.2 later_1.3.2 -#> [175] class_7.3-22 viridisLite_0.4.2 -#> [177] ragg_1.3.3 tibble_3.2.1 -#> [179] lmerTest_3.1-3 memoise_2.0.1 -#> [181] beeswarm_0.4.0 AnnotationDbi_1.66.0 -#> [183] concaveman_1.1.0

+#> [117] fastmap_1.2.0 rlang_1.1.4 +#> [119] htmlwidgets_1.6.4 ggthemes_5.1.0 +#> [121] UCSC.utils_1.2.0 shiny_1.9.1 +#> [123] ggh4x_0.2.8 farver_2.1.2 +#> [125] jquerylib_0.1.4 jsonlite_1.8.9 +#> [127] BiocParallel_1.40.0 RCurl_1.98-1.16 +#> [129] magrittr_2.0.3 scuttle_1.16.0 +#> [131] Formula_1.2-5 GenomeInfoDbData_1.2.13 +#> [133] Rhdf5lib_1.28.0 munsell_0.5.1 +#> [135] Rcpp_1.0.13-1 ggnewscale_0.5.0 +#> [137] viridis_0.6.5 stringi_1.8.4 +#> [139] ggraph_2.2.1 zlibbioc_1.52.0 +#> [141] MASS_7.3-61 plyr_1.8.9 +#> [143] parallel_4.4.2 ggrepel_0.9.6 +#> [145] deldir_2.0-4 Biostrings_2.74.0 +#> [147] graphlayouts_1.2.0 splines_4.4.2 +#> [149] tensor_1.5 hms_1.1.3 +#> [151] locfit_1.5-9.10 igraph_2.1.1 +#> [153] ggpubr_0.6.0 spatstat.geom_3.3-3 +#> [155] ggsignif_0.6.4 reshape2_1.4.4 +#> [157] BiocVersion_3.20.0 evaluate_1.0.1 +#> [159] BiocManager_1.30.25 tzdb_0.4.0 +#> [161] nloptr_2.1.1 tweenr_2.0.3 +#> [163] httpuv_1.6.15 tidyr_1.3.1 +#> [165] purrr_1.0.2 polyclip_1.10-7 +#> [167] ggforce_0.4.2 broom_1.0.7 +#> [169] xtable_1.8-4 e1071_1.7-16 +#> [171] rstatix_0.7.2 later_1.3.2 +#> [173] class_7.3-22 viridisLite_0.4.2 +#> [175] ragg_1.3.3 tibble_3.2.1 +#> [177] lmerTest_3.1-3 memoise_2.0.1 +#> [179] beeswarm_0.4.0 AnnotationDbi_1.68.0 +#> [181] concaveman_1.1.0
Keren, L, M Bosse, D Marquez, R Angoshtari, S Jain, S Varma, S Yang, et diff --git a/pkgdown.yml b/pkgdown.yml index 221dd98..8903a11 100644 --- a/pkgdown.yml +++ b/pkgdown.yml @@ -3,7 +3,7 @@ pkgdown: 2.1.1 pkgdown_sha: ~ articles: spicyR: spicyR.html -last_built: 2024-10-28T05:47Z +last_built: 2024-11-11T01:07Z urls: reference: https://sydneybiox.github.io/spicyR/reference article: https://sydneybiox.github.io/spicyR/articles diff --git a/reference/convPairs.html b/reference/convPairs.html index ea67a63..cb87be9 100644 --- a/reference/convPairs.html +++ b/reference/convPairs.html @@ -96,10 +96,6 @@

Examples k = 20, coords = c("x", "y") ) -#> Warning: detected tied distances to neighbors, see ?'BiocNeighbors-ties' -#> Warning: detected tied distances to neighbors, see ?'BiocNeighbors-ties' -#> Warning: detected tied distances to neighbors, see ?'BiocNeighbors-ties' -#> Warning: detected tied distances to neighbors, see ?'BiocNeighbors-ties' #> 'sample_id's are duplicated across 'SpatialExperiment' objects to cbind; appending sample indices. #> The returned object is ordered by the 'imageID' entry. diff --git a/reference/getPairwise.html b/reference/getPairwise.html index d0ac02f..a0d6808 100644 --- a/reference/getPairwise.html +++ b/reference/getPairwise.html @@ -50,10 +50,10 @@

Usage minLambda = 0.05, edgeCorrect = TRUE, includeZeroCells = TRUE, - BPPARAM = BiocParallel::SerialParam(), - imageIDCol = "imageID", - cellTypeCol = "cellType", - spatialCoordCols = c("x", "y") + nCores = 1, + imageID = "imageID", + cellType = "cellType", + spatialCoords = c("x", "y") )

@@ -107,21 +107,21 @@

ArgumentsBPPARAM -

A BiocParallelParam object.

+
nCores
+

number of cores to use for parallel processing.

-
imageIDCol
+
imageID

The name of the imageID column if using a SingleCellExperiment or SpatialExperiment.

-
cellTypeCol
+
cellType

The name of the cellType column if using a SingleCellExperiment or SpatialExperiment.

-
spatialCoordCols
+
spatialCoords

The names of the spatialCoords column if using a SingleCellExperiment.

diff --git a/reference/spicy.html b/reference/spicy.html index 23f4785..30eb80f 100644 --- a/reference/spicy.html +++ b/reference/spicy.html @@ -46,9 +46,9 @@

Usage covariates = NULL, from = NULL, to = NULL, - imageIDCol = "imageID", - cellTypeCol = "cellType", - spatialCoordCols = c("x", "y"), + imageID = "imageID", + cellType = "cellType", + spatialCoords = c("x", "y"), alternateResult = NULL, verbose = FALSE, weights = TRUE, @@ -56,7 +56,7 @@

Usage weightFactor = 1, window = "convex", window.length = NULL, - BPPARAM = BiocParallel::SerialParam(), + nCores = 1, sigma = NULL, Rs = NULL, minLambda = 0.05, @@ -97,15 +97,15 @@

ArgumentsimageIDCol +
imageID

The image ID if using SingleCellExperiment.

-
cellTypeCol
+
cellType

The cell type if using SingleCellExperiment.

-
spatialCoordCols
+
spatialCoords

The spatial coordinates if using a SingleCellExperiment.

@@ -140,8 +140,8 @@

ArgumentsBPPARAM -

A BiocParallelParam object.

+
nCores
+

number of cores to use for parallel processing.

sigma
diff --git a/search.json b/search.json index fc03934..e93f51c 100644 --- a/search.json +++ b/search.json @@ -1 +1 @@ -[{"path":"https://sydneybiox.github.io/spicyR/articles/spicyR.html","id":"installation","dir":"Articles","previous_headings":"","what":"Installation","title":"Spatial Linear and Mixed-Effects Modelling with spicyR","text":"","code":"if (!require(\"BiocManager\")) { install.packages(\"BiocManager\") } BiocManager::install(\"spicyR\") # load required packages library(spicyR) library(ggplot2) library(SpatialExperiment) library(SpatialDatasets) library(imcRtools) library(dplyr) library(survival)"},{"path":"https://sydneybiox.github.io/spicyR/articles/spicyR.html","id":"overview","dir":"Articles","previous_headings":"","what":"Overview","title":"Spatial Linear and Mixed-Effects Modelling with spicyR","text":"guide provides step--step instructions apply linear model multiple segmented labelled images assess localisation different cell types changes across different disease conditions.","code":""},{"path":"https://sydneybiox.github.io/spicyR/articles/spicyR.html","id":"example-data","dir":"Articles","previous_headings":"","what":"Example data","title":"Spatial Linear and Mixed-Effects Modelling with spicyR","text":"use Keren et al. (2018) breast cancer dataset compare spatial distribution immune cells individuals different levels tumour infiltration (cold compartmentalised). data stored SpatialExperiment object contains single-cell spatial data 41 images. cell types dataset includes 11 immune cell types (double negative CD3 T cells, CD4 T cells, B cells, monocytes, macrophages, CD8 T cells, neutrophils, natural killer cells, dendritic cells, regulatory T cells), 2 structural cell types (endothelial, mesenchymal), 2 tumour cell types (keratin+ tumour, tumour) one unidentified category.","code":"kerenSPE <- SpatialDatasets::spe_Keren_2018()"},{"path":"https://sydneybiox.github.io/spicyR/articles/spicyR.html","id":"linear-modelling","dir":"Articles","previous_headings":"","what":"Linear modelling","title":"Spatial Linear and Mixed-Effects Modelling with spicyR","text":"investigate changes localisation two different cell types, measure level localisation two cell types modelling L-function. L-function variance-stabilised K-function given equation Liĵ(r)=Kiĵ(r)π \\widehat{L_{ij}} (r) = \\sqrt{\\frac{\\widehat{K_{ij}}(r)}{\\pi}} Kiĵ\\widehat{K_{ij}} defined Kiĵ(r)=|W|ninj∑ni∑nj1{dij≤r}eij(r) \\widehat{K_{ij}} (r) = \\frac{|W|}{n_i n_j} \\sum_{n_i} \\sum_{n_j} 1 \\{d_{ij} \\leq r \\} e_{ij} (r) Kiĵ\\widehat{K_{ij}} summarises degree co-localisation cell type jj cell type ii, nin_i njn_j number cells type ii jj, |W||W| image area, dijd_{ij} distance two cells eij(r)e_{ij} (r) edge correcting factor. Specifically, mean difference experimental function theoretical function used measure level localisation, defined u=∑r′=rminrmaxL̂ij,Experimental(r′)−L̂ij,Poisson(r′) u = \\sum_{r' = r_{\\text{min}}}^{r_{\\text{max}}} \\widehat L_{ij, \\text{Experimental}} (r') - \\widehat L_{ij, \\text{Poisson}} (r') uu sum taken discrete range rr rminr_{\\text{min}} rmaxr_{\\text{max}}. Differences statistic uu two conditions modelled using weighted linear model.","code":""},{"path":"https://sydneybiox.github.io/spicyR/articles/spicyR.html","id":"test-for-change-in-localisation-for-a-specific-pair-of-cells","dir":"Articles","previous_headings":"Linear modelling","what":"Test for change in localisation for a specific pair of cells","title":"Spatial Linear and Mixed-Effects Modelling with spicyR","text":"Firstly, can test whether one cell type tends localised another cell type one condition compared . can done using spicy() function, specify condition parameter. example, want see whether neutrophils () tend found around CD8 T cells () compartmentalised tumours compared cold tumours. Given 3 conditions, can specify desired conditions setting order condition factor. spicy choose first level factor base condition second level comparison condition. spicy also naturally coerce condition column factor already factor. column containing cell type annotations can specified using cellTypeCol argument. default, spicy uses column named cellType SpatialExperiment object. obtain spicy object details results modelling performed. topPairs() function can used obtain associated coefficients p-value. coefficient spicyTestPair positive, find neutrophils significantly likely found near CD8 T cells compartmentalised tumours group compared cold tumour group.","code":"spicyTestPair <- spicy( kerenSPE, condition = \"tumour_type\", from = \"CD8_T_cell\", to = \"Neutrophils\" ) topPairs(spicyTestPair) #> intercept coefficient p.value adj.pvalue #> CD8_T_cell__Neutrophils -109.081 112.0185 2.166646e-05 2.166646e-05 #> from to #> CD8_T_cell__Neutrophils CD8_T_cell Neutrophils"},{"path":"https://sydneybiox.github.io/spicyR/articles/spicyR.html","id":"test-for-change-in-localisation-for-all-pairwise-cell-combinations","dir":"Articles","previous_headings":"Linear modelling","what":"Test for change in localisation for all pairwise cell combinations","title":"Spatial Linear and Mixed-Effects Modelling with spicyR","text":"can perform pairwise combinations cell types excluding parameters spicy(). , obtain spicy object outlines result linear models performed pairwise combination cell types. can also examine L-function metrics individual images using convenient bind() function spicyTest results object. results can represented bubble plot using signifPlot() function. , can observe significant relationships occur macrophages double negative CD3 T cells, suggesting two cell types far dispersed compartmentalised tumours compared cold tumours. examine specific cell type-cell type relationship detail, can use spicyBoxplot() specify either = \"Macrophages\" = \"dn_T_CD3\" rank = 1.","code":"spicyTest <- spicy( kerenSPE, condition = \"tumour_type\" ) topPairs(spicyTest) #> intercept coefficient p.value adj.pvalue #> Macrophages__dn_T_CD3 56.446064 -50.08474 1.080273e-07 3.035568e-05 #> dn_T_CD3__Macrophages 54.987151 -48.38664 2.194018e-07 3.082595e-05 #> Macrophages__DC_or_Mono 73.239404 -59.90361 5.224660e-06 4.893765e-04 #> DC_or_Mono__Macrophages 71.777087 -58.46833 7.431172e-06 5.220399e-04 #> dn_T_CD3__dn_T_CD3 -63.786032 100.61010 2.878804e-05 1.208706e-03 #> Neutrophils__dn_T_CD3 -63.141840 69.64356 2.891872e-05 1.208706e-03 #> dn_T_CD3__Neutrophils -63.133725 70.15508 3.011012e-05 1.208706e-03 #> DC__Macrophages 96.893239 -92.55112 1.801300e-04 5.758129e-03 #> Macrophages__DC 96.896215 -93.25194 1.844241e-04 5.758129e-03 #> CD4_T_cell__Keratin_Tumour -4.845037 -22.14995 2.834659e-04 7.409016e-03 #> from to #> Macrophages__dn_T_CD3 Macrophages dn_T_CD3 #> dn_T_CD3__Macrophages dn_T_CD3 Macrophages #> Macrophages__DC_or_Mono Macrophages DC_or_Mono #> DC_or_Mono__Macrophages DC_or_Mono Macrophages #> dn_T_CD3__dn_T_CD3 dn_T_CD3 dn_T_CD3 #> Neutrophils__dn_T_CD3 Neutrophils dn_T_CD3 #> dn_T_CD3__Neutrophils dn_T_CD3 Neutrophils #> DC__Macrophages DC Macrophages #> Macrophages__DC Macrophages DC #> CD4_T_cell__Keratin_Tumour CD4_T_cell Keratin_Tumour bind(spicyTest)[1:5, 1:5] #> imageID condition Keratin_Tumour__Keratin_Tumour #> 1 1 mixed -2.300602 #> 2 2 mixed -1.989699 #> 3 3 compartmentalised 11.373530 #> 4 4 compartmentalised 33.931133 #> 5 5 compartmentalised 17.922818 #> dn_T_CD3__Keratin_Tumour B_cell__Keratin_Tumour #> 1 -5.298543 -20.827279 #> 2 -16.020022 3.025815 #> 3 -21.857447 -24.962913 #> 4 -36.438476 -40.470221 #> 5 -20.816783 -38.138076 signifPlot( spicyTest, breaks = c(-3, 3, 1), marksToPlot = c(\"Macrophages\", \"DC_or_Mono\", \"dn_T_CD3\", \"Neutrophils\", \"CD8_T_cell\", \"Keratin_Tumour\") ) spicyBoxPlot(results = spicyTest, # from = \"Macrophages\", # to = \"dn_T_CD3\" rank = 1)"},{"path":"https://sydneybiox.github.io/spicyR/articles/spicyR.html","id":"linear-modelling-for-custom-metrics","dir":"Articles","previous_headings":"","what":"Linear modelling for custom metrics","title":"Spatial Linear and Mixed-Effects Modelling with spicyR","text":"spicyR can also applied custom distance abundance metrics. kNN interactions graph can generated function buildSpatialGraph imcRtools package. generates colPairs object inside SpatialExperiment object. spicyR provides function convPairs converting colPairs object abundance matrix calculating average number nearby cells types every cell type given k. example, exists average 5 neutrophils every macrophage image 1, column Neutrophil__Macrophage value 5 image 1. custom distance abundance metrics can included analysis alternateResult parameter. Statial package contains custom distance metrics can used spicy.","code":"kerenSPE <- imcRtools::buildSpatialGraph(kerenSPE, img_id = \"imageID\", type = \"knn\", k = 20, coords = c(\"x\", \"y\")) pairAbundances <- convPairs(kerenSPE, colPair = \"knn_interaction_graph\") head(pairAbundances[\"B_cell__B_cell\"]) #> B_cell__B_cell #> 1 12.7349608 #> 10 0.2777778 #> 11 0.0000000 #> 12 1.3333333 #> 13 1.2200957 #> 14 0.0000000 spicyTestColPairs <- spicy( kerenSPE, condition = \"tumour_type\", alternateResult = pairAbundances, weights = FALSE ) topPairs(spicyTestColPairs) #> intercept coefficient p.value adj.pvalue #> CD8_T_cell__Neutrophils 0.833333333 -0.7592968 0.002645466 0.3291833 #> B_cell__Tumour 0.001937984 0.2602822 0.004872664 0.3291833 #> Other_Immune__NK 0.012698413 0.2612881 0.005673068 0.3291833 #> Unidentified__CD8_T_cell 0.106626794 0.6387339 0.005906526 0.3291833 #> dn_T_CD3__NK 0.004242424 0.2148797 0.006317829 0.3291833 #> CD4_T_cell__Neutrophils 0.036213602 0.2947696 0.007902670 0.3291833 #> Tregs__CD4_T_cell 0.128876212 0.5726201 0.010207087 0.3291833 #> Endothelial__DC 0.008771930 0.3008523 0.011189533 0.3291833 #> Tumour__Neutrophils 0.021638939 0.2529045 0.011388850 0.3291833 #> Mesenchymal__Neutrophils 0.004504505 0.2494301 0.012761315 0.3291833 #> from to #> CD8_T_cell__Neutrophils CD8_T_cell Neutrophils #> B_cell__Tumour B_cell Tumour #> Other_Immune__NK Other_Immune NK #> Unidentified__CD8_T_cell Unidentified CD8_T_cell #> dn_T_CD3__NK dn_T_CD3 NK #> CD4_T_cell__Neutrophils CD4_T_cell Neutrophils #> Tregs__CD4_T_cell Tregs CD4_T_cell #> Endothelial__DC Endothelial DC #> Tumour__Neutrophils Tumour Neutrophils #> Mesenchymal__Neutrophils Mesenchymal Neutrophils signifPlot( spicyTestColPairs, breaks = c(-3, 3, 1), marksToPlot = c(\"Macrophages\", \"dn_T_CD3\", \"CD4_T_cell\", \"B_cell\", \"DC_or_Mono\", \"Neutrophils\", \"CD8_T_cell\") )"},{"path":"https://sydneybiox.github.io/spicyR/articles/spicyR.html","id":"performing-survival-analysis","dir":"Articles","previous_headings":"","what":"Performing survival analysis","title":"Spatial Linear and Mixed-Effects Modelling with spicyR","text":"spicy can also used perform survival analysis asses whether changes co-localisation cell types associated survival probability. spicy requires SingleCellExperiment object used contain column called survival Surv object. can perform survival analysis using spicy function specifying condition = \"survival\". can access corresponding coefficients p-values accessing survivalResults slot spicy results object.","code":"kerenSPE$event = 1 - kerenSPE$Censored kerenSPE$survival = Surv(kerenSPE$`Survival_days_capped*`, kerenSPE$event) # Running survival analysis spicySurvival = spicy(kerenSPE, condition = \"survival\") # top 10 significant pairs head(spicySurvival$survivalResults, 10) #> # A tibble: 10 × 4 #> test coef se.coef p.value #> #> 1 Other_Immune__Tregs 0.0236 0.00866 0.00000893 #> 2 CD4_T_cell__Tregs 0.0177 0.00685 0.0000124 #> 3 Tregs__Other_Immune 0.0237 0.00873 0.0000126 #> 4 Tregs__CD4_T_cell 0.0171 0.00676 0.0000285 #> 5 CD8_T_cell__CD8_T_cell 0.00605 0.00272 0.000332 #> 6 Tumour__CD8_T_cell -0.0305 0.0114 0.000617 #> 7 CD8_T_cell__Tumour -0.0305 0.0116 0.000721 #> 8 CD4_T_cell__dn_T_CD3 0.00845 0.00353 0.000794 #> 9 dn_T_CD3__CD4_T_cell 0.00840 0.00353 0.000937 #> 10 DC__Other_Immune -0.0289 0.0123 0.00103"},{"path":"https://sydneybiox.github.io/spicyR/articles/spicyR.html","id":"accounting-for-tissue-inhomogeneity","dir":"Articles","previous_headings":"","what":"Accounting for tissue inhomogeneity","title":"Spatial Linear and Mixed-Effects Modelling with spicyR","text":"spicy function can also account tissue inhomogeneity avoid false positives negatives. can done setting sigma = parameter within spicy function. default, sigma set NULL, spicy assumes homogeneous tissue structure. example, examine L-function Keratin_Tumour__Neutrophils sigma = NULL Rs = 100, value positive, indicating attraction two cell types. specify sigma = 20 re-calculate L-function, indicates relationship Keratin_Tumour Neutrophils, .e., major attraction dispersion, now takes account tissue inhomogeneity. Plotting image 24 shows supposed co-localisation occurs due dense cluster cells near top image.","code":"# filter SPE object to obtain image 24 data kerenSubset = kerenSPE[, colData(kerenSPE)$imageID == \"24\"] pairwiseAssoc = getPairwise(kerenSubset, sigma = NULL, Rs = 100) |> as.data.frame() pairwiseAssoc[[\"Keratin_Tumour__Neutrophils\"]] #> [1] 10.88892 pairwiseAssoc = getPairwise(kerenSubset, sigma = 20, Rs = 100) |> as.data.frame() pairwiseAssoc[[\"Keratin_Tumour__Neutrophils\"]] #> [1] 0.9024836 # obtain colData for image 24 cData = colData(kerenSPE) |> as.data.frame() |> dplyr::filter(imageID == \"24\") # obtain cells present in image 24 coords = spatialCoords(kerenSPE) |> as.data.frame() coords$cellID = rownames(coords) coords = coords |> dplyr::filter(cellID %in% cData$CellID) cData$X = coords$x cData$Y = coords$y cData = cData |> dplyr::mutate(cellTypeNew = ifelse(cellType %in% c(\"Keratin_Tumour\", \"Neutrophils\"), cellType, \"Other\")) pal = setNames(c(\"#d6b11c\", \"#850f07\"), c(\"Keratin_Tumour\", \"Neutrophils\")) ggplot() + stat_density_2d(data = cData, aes(x = X, y = Y, fill = after_stat(density)), geom = \"raster\", contour = FALSE) + geom_point(data = cData |> filter(cellType != \"Other\"), aes(x = X, y = Y, colour = cellTypeNew), size = 1) + scale_color_manual(values = pal) + scale_fill_distiller(palette = \"Blues\", direction = 1) + theme_classic() + labs(title = \"image ID: 24\")"},{"path":"https://sydneybiox.github.io/spicyR/articles/spicyR.html","id":"mixed-effects-modelling","dir":"Articles","previous_headings":"","what":"Mixed effects modelling","title":"Spatial Linear and Mixed-Effects Modelling with spicyR","text":"spicyR supports mixed effects modelling multiple images obtained subject. case, subject treated random effect condition treated fixed effect. perform mixed effects modelling, can specify subject parameter spicy function.","code":"spicyMixedTest <- spicy( diabetesData, condition = \"stage\", subject = \"case\" )"},{"path":"https://sydneybiox.github.io/spicyR/articles/spicyR.html","id":"references","dir":"Articles","previous_headings":"","what":"References","title":"Spatial Linear and Mixed-Effects Modelling with spicyR","text":"","code":"sessionInfo() #> R version 4.4.1 (2024-06-14) #> Platform: x86_64-pc-linux-gnu #> Running under: Ubuntu 22.04.5 LTS #> #> Matrix products: default #> BLAS: /usr/lib/x86_64-linux-gnu/openblas-pthread/libblas.so.3 #> LAPACK: /usr/lib/x86_64-linux-gnu/openblas-pthread/libopenblasp-r0.3.20.so; LAPACK version 3.10.0 #> #> locale: #> [1] LC_CTYPE=C.UTF-8 LC_NUMERIC=C LC_TIME=C.UTF-8 #> [4] LC_COLLATE=C.UTF-8 LC_MONETARY=C.UTF-8 LC_MESSAGES=C.UTF-8 #> [7] LC_PAPER=C.UTF-8 LC_NAME=C LC_ADDRESS=C #> [10] LC_TELEPHONE=C LC_MEASUREMENT=C.UTF-8 LC_IDENTIFICATION=C #> #> time zone: UTC #> tzcode source: system (glibc) #> #> attached base packages: #> [1] stats4 stats graphics grDevices utils datasets methods #> [8] base #> #> other attached packages: #> [1] survival_3.6-4 dplyr_1.1.4 #> [3] imcRtools_1.10.0 SpatialDatasets_1.2.0 #> [5] ExperimentHub_2.12.0 AnnotationHub_3.12.0 #> [7] BiocFileCache_2.12.0 dbplyr_2.5.0 #> [9] SpatialExperiment_1.14.0 SingleCellExperiment_1.26.0 #> [11] SummarizedExperiment_1.34.0 Biobase_2.64.0 #> [13] GenomicRanges_1.56.2 GenomeInfoDb_1.40.1 #> [15] IRanges_2.38.1 S4Vectors_0.42.1 #> [17] BiocGenerics_0.50.0 MatrixGenerics_1.16.0 #> [19] matrixStats_1.4.1 ggplot2_3.5.1 #> [21] spicyR_1.17.10 BiocStyle_2.32.1 #> #> loaded via a namespace (and not attached): #> [1] fs_1.6.4 spatstat.sparse_3.1-0 #> [3] bitops_1.0-9 sf_1.0-18 #> [5] EBImage_4.46.0 httr_1.4.7 #> [7] RColorBrewer_1.1-3 numDeriv_2016.8-1.1 #> [9] tools_4.4.1 backports_1.5.0 #> [11] utf8_1.2.4 R6_2.5.1 #> [13] DT_0.33 HDF5Array_1.32.1 #> [15] mgcv_1.9-1 rhdf5filters_1.16.0 #> [17] withr_3.0.1 sp_2.1-4 #> [19] gridExtra_2.3 coxme_2.2-22 #> [21] ClassifyR_3.8.5 cli_3.6.3 #> [23] textshaping_0.4.0 spatstat.explore_3.3-3 #> [25] labeling_0.4.3 sass_0.4.9 #> [27] nnls_1.6 spatstat.data_3.1-2 #> [29] readr_2.1.5 proxy_0.4-27 #> [31] pkgdown_2.1.1 systemfonts_1.1.0 #> [33] ggupset_0.4.0 svglite_2.1.3 #> [35] RSQLite_2.3.7 generics_0.1.3 #> [37] vroom_1.6.5 spatstat.random_3.3-2 #> [39] car_3.1-3 scam_1.2-17 #> [41] Matrix_1.7-0 ggbeeswarm_0.7.2 #> [43] fansi_1.0.6 abind_1.4-8 #> [45] terra_1.7-83 lifecycle_1.0.4 #> [47] yaml_2.3.10 carData_3.0-5 #> [49] rhdf5_2.48.0 SparseArray_1.4.8 #> [51] grid_4.4.1 blob_1.2.4 #> [53] promises_1.3.0 crayon_1.5.3 #> [55] bdsmatrix_1.3-7 shinydashboard_0.7.2 #> [57] lattice_0.22-6 beachmat_2.20.0 #> [59] KEGGREST_1.44.1 magick_2.8.5 #> [61] cytomapper_1.16.0 pillar_1.9.0 #> [63] knitr_1.48 RTriangle_1.6-0.14 #> [65] rjson_0.2.23 boot_1.3-30 #> [67] codetools_0.2-20 glue_1.8.0 #> [69] spatstat.univar_3.0-1 data.table_1.16.2 #> [71] MultiAssayExperiment_1.30.3 vctrs_0.6.5 #> [73] png_0.1-8 gtable_0.3.6 #> [75] cachem_1.1.0 xfun_0.48 #> [77] S4Arrays_1.4.1 mime_0.12 #> [79] tidygraph_1.3.1 pheatmap_1.0.12 #> [81] units_0.8-5 nlme_3.1-164 #> [83] bit64_4.5.2 filelock_1.0.3 #> [85] bslib_0.8.0 svgPanZoom_0.3.4 #> [87] KernSmooth_2.23-24 vipor_0.4.7 #> [89] colorspace_2.1-1 DBI_1.2.3 #> [91] raster_3.6-30 tidyselect_1.2.1 #> [93] bit_4.5.0 compiler_4.4.1 #> [95] curl_5.2.3 BiocNeighbors_1.22.0 #> [97] desc_1.4.3 DelayedArray_0.30.1 #> [99] bookdown_0.41 scales_1.3.0 #> [101] classInt_0.4-10 distances_0.1.11 #> [103] rappdirs_0.3.3 tiff_0.1-12 #> [105] stringr_1.5.1 digest_0.6.37 #> [107] goftest_1.2-3 fftwtools_0.9-11 #> [109] spatstat.utils_3.1-0 minqa_1.2.8 #> [111] rmarkdown_2.28 XVector_0.44.0 #> [113] htmltools_0.5.8.1 pkgconfig_2.0.3 #> [115] jpeg_0.1-10 lme4_1.1-35.5 #> [117] sparseMatrixStats_1.16.0 highr_0.11 #> [119] fastmap_1.2.0 rlang_1.1.4 #> [121] htmlwidgets_1.6.4 ggthemes_5.1.0 #> [123] UCSC.utils_1.0.0 DelayedMatrixStats_1.26.0 #> [125] shiny_1.9.1 ggh4x_0.2.8 #> [127] farver_2.1.2 jquerylib_0.1.4 #> [129] jsonlite_1.8.9 BiocParallel_1.38.0 #> [131] RCurl_1.98-1.16 magrittr_2.0.3 #> [133] scuttle_1.14.0 Formula_1.2-5 #> [135] GenomeInfoDbData_1.2.12 Rhdf5lib_1.26.0 #> [137] munsell_0.5.1 Rcpp_1.0.13 #> [139] viridis_0.6.5 stringi_1.8.4 #> [141] ggraph_2.2.1 zlibbioc_1.50.0 #> [143] MASS_7.3-60.2 plyr_1.8.9 #> [145] parallel_4.4.1 ggrepel_0.9.6 #> [147] deldir_2.0-4 Biostrings_2.72.1 #> [149] graphlayouts_1.2.0 splines_4.4.1 #> [151] tensor_1.5 hms_1.1.3 #> [153] locfit_1.5-9.10 igraph_2.1.1 #> [155] ggpubr_0.6.0 spatstat.geom_3.3-3 #> [157] ggsignif_0.6.4 reshape2_1.4.4 #> [159] BiocVersion_3.19.1 evaluate_1.0.1 #> [161] BiocManager_1.30.25 tzdb_0.4.0 #> [163] nloptr_2.1.1 tweenr_2.0.3 #> [165] httpuv_1.6.15 tidyr_1.3.1 #> [167] purrr_1.0.2 polyclip_1.10-7 #> [169] ggforce_0.4.2 broom_1.0.7 #> [171] xtable_1.8-4 e1071_1.7-16 #> [173] rstatix_0.7.2 later_1.3.2 #> [175] class_7.3-22 viridisLite_0.4.2 #> [177] ragg_1.3.3 tibble_3.2.1 #> [179] lmerTest_3.1-3 memoise_2.0.1 #> [181] beeswarm_0.4.0 AnnotationDbi_1.66.0 #> [183] concaveman_1.1.0"},{"path":"https://sydneybiox.github.io/spicyR/authors.html","id":null,"dir":"","previous_headings":"","what":"Authors","title":"Authors and Citation","text":"Nicolas Canete. Author. Ellis Patrick. Author, maintainer. Nicholas Robertson. Contributor. Alex Qin. Contributor. Farhan Ameen. Contributor. Shreya Rao. Contributor.","code":""},{"path":"https://sydneybiox.github.io/spicyR/authors.html","id":"citation","dir":"","previous_headings":"","what":"Citation","title":"Authors and Citation","text":"Canete N, Iyengar S, Ormerod J, Baharlou H, Harman , Patrick E (2022). “spicyR: spatial analysis situ cytometry data R.” Bioinformatics, 38(11), 3099–3105. doi:10.1093/bioinformatics/btac268, https://doi.org/10.1093/bioinformatics/btac268.","code":"@Article{, title = {{spicyR: spatial analysis of in situ cytometry data in R}}, author = {Nicolas Canete and Sourish Iyengar and John Ormerod and Heeva Baharlou and Andrew Harman and Ellis Patrick}, year = {2022}, volume = {38}, number = {11}, pages = {3099–3105}, journal = {Bioinformatics}, doi = {10.1093/bioinformatics/btac268}, url = {https://doi.org/10.1093/bioinformatics/btac268}, }"},{"path":"https://sydneybiox.github.io/spicyR/index.html","id":"spicyr","dir":"","previous_headings":"","what":"Spatial analysis of in situ cytometry data","title":"Spatial analysis of in situ cytometry data","text":"Spatial analysis situ cytometry data.","code":""},{"path":"https://sydneybiox.github.io/spicyR/index.html","id":"overview","dir":"","previous_headings":"","what":"Overview","title":"Spatial analysis of in situ cytometry data","text":"spicyR package provides framework performing inference changes spatial relationships pairs cell types cell-resolution spatial omics technologies. spicyR consists three primary steps: () summarizing degree spatial localization pairs cell types image; (ii) modelling variability localization summary statistics function cell counts (iii) testing changes spatial localizations associated response variable.","code":""},{"path":"https://sydneybiox.github.io/spicyR/index.html","id":"installation","dir":"","previous_headings":"","what":"Installation","title":"Spatial analysis of in situ cytometry data","text":"Bioconductor release version, run following. like --date features, install recent development version.","code":"if (!require(\"BiocManager\", quietly = TRUE)) install.packages(\"BiocManager\") BiocManager::install(\"spicyR\") # Install the development version from Bioconductor: if (!require(\"BiocManager\", quietly = TRUE)) install.packages(\"BiocManager\") # The following initializes usage of Bioc devel # This will update all your Bioconductor packages to devel version BiocManager::install(version='devel') BiocManager::install(\"spicyR\") # Otherwise install the development version from GitHub: # install.packages(\"devtools\") devtools::install_github(\"ellispatrick/spicyR\") library(spicyR)"},{"path":"https://sydneybiox.github.io/spicyR/index.html","id":"submitting-an-issue-or-feature-request","dir":"","previous_headings":"","what":"Submitting an issue or feature request","title":"Spatial analysis of in situ cytometry data","text":"spicyR still active development. greatly appreciate feedback related package. R package related issues raised . general questions feedback, please contact us directly via ellis.patrick@sydney.edu.au.","code":""},{"path":"https://sydneybiox.github.io/spicyR/index.html","id":"authors","dir":"","previous_headings":"","what":"Authors","title":"Spatial analysis of in situ cytometry data","text":"Nicolas Canete Ellis Patrick - @TheEllisPatrick","code":""},{"path":"https://sydneybiox.github.io/spicyR/index.html","id":"citation","dir":"","previous_headings":"","what":"Citation","title":"Spatial analysis of in situ cytometry data","text":"Nicolas P Canete, Sourish S Iyengar, John T Ormerod, Heeva Baharlou, Andrew N Harman, Ellis Patrick, spicyR: spatial analysis situ cytometry data R, Bioinformatics, Volume 38, Issue 11, 1 June 2022, Pages 3099–3105, https://doi.org/10.1093/bioinformatics/btac268","code":""},{"path":"https://sydneybiox.github.io/spicyR/reference/bind.html","id":null,"dir":"Reference","previous_headings":"","what":"Produces a dataframe showing L-function metric for each imageID entry. — bind","title":"Produces a dataframe showing L-function metric for each imageID entry. — bind","text":"Produces dataframe showing L-function metric imageID entry.","code":""},{"path":"https://sydneybiox.github.io/spicyR/reference/bind.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Produces a dataframe showing L-function metric for each imageID entry. — bind","text":"","code":"bind(results, pairName = NULL)"},{"path":"https://sydneybiox.github.io/spicyR/reference/bind.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Produces a dataframe showing L-function metric for each imageID entry. — bind","text":"results Spicy test result obtained spicy. pairName string specifying pairwise interaction interest. NULL, pairwise interactions shown.","code":""},{"path":"https://sydneybiox.github.io/spicyR/reference/bind.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Produces a dataframe showing L-function metric for each imageID entry. — bind","text":"data.frame containing colData related results.","code":""},{"path":"https://sydneybiox.github.io/spicyR/reference/bind.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Produces a dataframe showing L-function metric for each imageID entry. — bind","text":"","code":"data(spicyTest) df <- bind(spicyTest)"},{"path":"https://sydneybiox.github.io/spicyR/reference/colTest.html","id":null,"dir":"Reference","previous_headings":"","what":"Perform a simple wilcoxon-rank-sum test or t-test on the columns of a data frame — colTest","title":"Perform a simple wilcoxon-rank-sum test or t-test on the columns of a data frame — colTest","text":"Perform simple wilcoxon-rank-sum test t-test columns data frame","code":""},{"path":"https://sydneybiox.github.io/spicyR/reference/colTest.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Perform a simple wilcoxon-rank-sum test or t-test on the columns of a data frame — colTest","text":"","code":"colTest(df, condition, type = NULL, feature = NULL, imageID = \"imageID\")"},{"path":"https://sydneybiox.github.io/spicyR/reference/colTest.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Perform a simple wilcoxon-rank-sum test or t-test on the columns of a data frame — colTest","text":"df data.frame SingleCellExperiment, SpatialExperiment condition condition interest type type test, \"wilcox\", \"ttest\" \"survival\". feature Can used calculate proportions feature image imageID imageID's presenting SingleCellExperiment","code":""},{"path":"https://sydneybiox.github.io/spicyR/reference/colTest.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Perform a simple wilcoxon-rank-sum test or t-test on the columns of a data frame — colTest","text":"Proportions","code":""},{"path":"https://sydneybiox.github.io/spicyR/reference/colTest.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Perform a simple wilcoxon-rank-sum test or t-test on the columns of a data frame — colTest","text":"","code":"# Test for an association with long-duration diabetes # This is clearly ignoring the repeated measures... data(\"diabetesData\") diabetesData <- spicyR:::.format_data( diabetesData, \"imageID\", \"cellType\", c(\"x\", \"y\"), FALSE ) props <- getProp(diabetesData) condition <- spicyR:::getImagePheno(diabetesData)$stage names(condition) <- spicyR:::getImagePheno(diabetesData)$imageID condition <- condition[condition %in% c(\"Long-duration\", \"Onset\")] test <- colTest(props[names(condition), ], condition)"},{"path":"https://sydneybiox.github.io/spicyR/reference/convPairs.html","id":null,"dir":"Reference","previous_headings":"","what":"Converts colPairs object into an abundance matrix based on number of nearby interactions for every cell type. — convPairs","title":"Converts colPairs object into an abundance matrix based on number of nearby interactions for every cell type. — convPairs","text":"Converts colPairs object abundance matrix based number nearby interactions every cell type.","code":""},{"path":"https://sydneybiox.github.io/spicyR/reference/convPairs.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Converts colPairs object into an abundance matrix based on number of nearby interactions for every cell type. — convPairs","text":"","code":"convPairs(cells, colPair, cellType = \"cellType\", imageID = \"imageID\")"},{"path":"https://sydneybiox.github.io/spicyR/reference/convPairs.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Converts colPairs object into an abundance matrix based on number of nearby interactions for every cell type. — convPairs","text":"cells SingleCellExperiment contains objects colPairs slot. colPair name object colPairs slot dataframe constructed . cellType cell type using SingleCellExperiment. imageID image ID using SingleCellExperiment.","code":""},{"path":"https://sydneybiox.github.io/spicyR/reference/convPairs.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Converts colPairs object into an abundance matrix based on number of nearby interactions for every cell type. — convPairs","text":"Matrix abundances","code":""},{"path":"https://sydneybiox.github.io/spicyR/reference/convPairs.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Converts colPairs object into an abundance matrix based on number of nearby interactions for every cell type. — convPairs","text":"","code":"data(\"diabetesData\") images <- c(\"A09\", \"A11\", \"A16\", \"A17\") diabetesData <- diabetesData[ , SummarizedExperiment::colData(diabetesData)$imageID %in% images ] diabetesData_SPE <- SpatialExperiment::SpatialExperiment(diabetesData, colData = SummarizedExperiment::colData(diabetesData) ) SpatialExperiment::spatialCoords(diabetesData_SPE) <- data.frame( SummarizedExperiment::colData(diabetesData_SPE)$x, SummarizedExperiment::colData(diabetesData_SPE)$y ) |> as.matrix() SpatialExperiment::spatialCoordsNames(diabetesData_SPE) <- c(\"x\", \"y\") diabetesData_SPE <- imcRtools::buildSpatialGraph(diabetesData_SPE, img_id = \"imageID\", type = \"knn\", k = 20, coords = c(\"x\", \"y\") ) #> Warning: detected tied distances to neighbors, see ?'BiocNeighbors-ties' #> Warning: detected tied distances to neighbors, see ?'BiocNeighbors-ties' #> Warning: detected tied distances to neighbors, see ?'BiocNeighbors-ties' #> Warning: detected tied distances to neighbors, see ?'BiocNeighbors-ties' #> 'sample_id's are duplicated across 'SpatialExperiment' objects to cbind; appending sample indices. #> The returned object is ordered by the 'imageID' entry. pairAbundances <- convPairs(diabetesData_SPE, colPair = \"knn_interaction_graph\" )"},{"path":"https://sydneybiox.github.io/spicyR/reference/diabetesData.html","id":null,"dir":"Reference","previous_headings":"","what":"Diabetes IMC data in SCE format. — diabetesData","title":"Diabetes IMC data in SCE format. — diabetesData","text":"subset Damond et al 2019 imaging mass cytometry dataset. data contains cells pancreatic islets individuals early onset diabetes healthy controls. object contains single-cell data 160 images 8 subjects, 20 images per subject.","code":""},{"path":"https://sydneybiox.github.io/spicyR/reference/diabetesData.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Diabetes IMC data in SCE format. — diabetesData","text":"","code":"data(\"diabetesData\")"},{"path":"https://sydneybiox.github.io/spicyR/reference/diabetesData.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"Diabetes IMC data in SCE format. — diabetesData","text":"diabetesData_SCE SingleCellExperiment object","code":""},{"path":"https://sydneybiox.github.io/spicyR/reference/diabetesData.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Diabetes IMC data in SCE format. — diabetesData","text":"Converted SingleCellExperiment format.","code":""},{"path":"https://sydneybiox.github.io/spicyR/reference/getPairwise.html","id":null,"dir":"Reference","previous_headings":"","what":"Get statistic from pairwise L curve of a single image. — getPairwise","title":"Get statistic from pairwise L curve of a single image. — getPairwise","text":"Get statistic pairwise L curve single image.","code":""},{"path":"https://sydneybiox.github.io/spicyR/reference/getPairwise.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Get statistic from pairwise L curve of a single image. — getPairwise","text":"","code":"getPairwise( cells, from = NULL, to = NULL, window = \"convex\", window.length = NULL, Rs = c(20, 50, 100), sigma = NULL, minLambda = 0.05, edgeCorrect = TRUE, includeZeroCells = TRUE, BPPARAM = BiocParallel::SerialParam(), imageIDCol = \"imageID\", cellTypeCol = \"cellType\", spatialCoordCols = c(\"x\", \"y\") )"},{"path":"https://sydneybiox.github.io/spicyR/reference/getPairwise.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Get statistic from pairwise L curve of a single image. — getPairwise","text":"cells SummarizedExperiment contains least variables x y, giving location coordinates cell, cellType. '' cellType generating L curve. '' cellType generating L curve. window window around regions 'square', 'convex' 'concave'. window.length tuning parameter controlling level concavity estimating concave windows. Rs vector radii measures association calculated. sigma numeric variable used scaling fitting inhomogeneous L-curves. minLambda Minimum value density scaling fitting inhomogeneous L-curves. edgeCorrect logical indicating whether perform edge correction. includeZeroCells logical indicating whether include cells zero counts pairwise association calculation. BPPARAM BiocParallelParam object. imageIDCol name imageID column using SingleCellExperiment SpatialExperiment. cellTypeCol name cellType column using SingleCellExperiment SpatialExperiment. spatialCoordCols names spatialCoords column using SingleCellExperiment.","code":""},{"path":"https://sydneybiox.github.io/spicyR/reference/getPairwise.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Get statistic from pairwise L curve of a single image. — getPairwise","text":"Statistic pairwise L curve single image.","code":""},{"path":"https://sydneybiox.github.io/spicyR/reference/getPairwise.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Get statistic from pairwise L curve of a single image. — getPairwise","text":"","code":"data(\"diabetesData\") # Subset by imageID for fast example selected_cells <- diabetesData[ , SummarizedExperiment::colData(diabetesData)$imageID == \"A09\" ] pairAssoc <- getPairwise(selected_cells)"},{"path":"https://sydneybiox.github.io/spicyR/reference/getProp.html","id":null,"dir":"Reference","previous_headings":"","what":"Get proportions from a SummarizedExperiment. — getProp","title":"Get proportions from a SummarizedExperiment. — getProp","text":"Get proportions SummarizedExperiment.","code":""},{"path":"https://sydneybiox.github.io/spicyR/reference/getProp.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Get proportions from a SummarizedExperiment. — getProp","text":"","code":"getProp(cells, feature = \"cellType\", imageID = \"imageID\")"},{"path":"https://sydneybiox.github.io/spicyR/reference/getProp.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Get proportions from a SummarizedExperiment. — getProp","text":"cells SingleCellExperiment, SpatialExperiment data.frame. feature feature interest imageID imageID's","code":""},{"path":"https://sydneybiox.github.io/spicyR/reference/getProp.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Get proportions from a SummarizedExperiment. — getProp","text":"Proportions","code":""},{"path":"https://sydneybiox.github.io/spicyR/reference/getProp.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Get proportions from a SummarizedExperiment. — getProp","text":"","code":"data(\"diabetesData\") prop <- getProp(diabetesData)"},{"path":"https://sydneybiox.github.io/spicyR/reference/signifPlot.html","id":null,"dir":"Reference","previous_headings":"","what":"Plots result of signifPlot. — signifPlot","title":"Plots result of signifPlot. — signifPlot","text":"Plots result signifPlot.","code":""},{"path":"https://sydneybiox.github.io/spicyR/reference/signifPlot.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Plots result of signifPlot. — signifPlot","text":"","code":"signifPlot( results, fdr = FALSE, type = \"bubble\", breaks = NULL, comparisonGroup = NULL, colours = c(\"#4575B4\", \"white\", \"#D73027\"), marksToPlot = NULL, cutoff = 0.05, contextColours = NULL, contextLabels = waiver() )"},{"path":"https://sydneybiox.github.io/spicyR/reference/signifPlot.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Plots result of signifPlot. — signifPlot","text":"results spicy results object fdr TRUE FDR correction used. type Whether make bubble plot heatmap. Note: survival results bubble plot used. breaks Vector 3 numbers giving breaks used legend. first number minimum, second maximum, third number breaks. comparisonGroup string specifying name outcome group compare base group. colours Vector colours use colour legend. marksToPlot Vector marks include plot. cutoff significance threshold circles bubble plot. contextColours Used Kontextual results. named list specifying colours context. default Tableau colour palette used. contextLabels Used Kontextual results. named list change default labels context.","code":""},{"path":"https://sydneybiox.github.io/spicyR/reference/signifPlot.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Plots result of signifPlot. — signifPlot","text":"ggplot pheatmap object","code":""},{"path":"https://sydneybiox.github.io/spicyR/reference/signifPlot.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Plots result of signifPlot. — signifPlot","text":"","code":"data(spicyTest) p <- signifPlot(spicyTest, breaks = c(-3, 3, 0.5)) # plot includes unicode characters, do not use default pdf device ggplot2::ggsave(p, filename = tempfile(), device = cairo_pdf) #> Saving 7 x 7 in image"},{"path":"https://sydneybiox.github.io/spicyR/reference/spicy.html","id":null,"dir":"Reference","previous_headings":"","what":"Performs spatial tests on spatial cytometry data. — SpicyResults-class","title":"Performs spatial tests on spatial cytometry data. — SpicyResults-class","text":"Performs spatial tests spatial cytometry data.","code":""},{"path":"https://sydneybiox.github.io/spicyR/reference/spicy.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Performs spatial tests on spatial cytometry data. — SpicyResults-class","text":"","code":"spicy( cells, condition, subject = NULL, covariates = NULL, from = NULL, to = NULL, imageIDCol = \"imageID\", cellTypeCol = \"cellType\", spatialCoordCols = c(\"x\", \"y\"), alternateResult = NULL, verbose = FALSE, weights = TRUE, weightsByPair = FALSE, weightFactor = 1, window = \"convex\", window.length = NULL, BPPARAM = BiocParallel::SerialParam(), sigma = NULL, Rs = NULL, minLambda = 0.05, edgeCorrect = TRUE, includeZeroCells = FALSE, ... )"},{"path":"https://sydneybiox.github.io/spicyR/reference/spicy.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Performs spatial tests on spatial cytometry data. — SpicyResults-class","text":"cells SummarizedExperiment data frame contains least variables x y, giving location coordinates cell, cellType. condition character specifying column contains condition `Surv` objects subject Vector subject IDs corresponding image cells data frame. covariates Vector covariate names included mixed effects model fixed effects. vector cell types like compare vector vector cell types like compare vector imageIDCol image ID using SingleCellExperiment. cellTypeCol cell type using SingleCellExperiment. spatialCoordCols spatial coordinates using SingleCellExperiment. alternateResult pairwise association statistic combination celltypes image. verbose logical indicating whether output messages. weights logical indicating whether include weights based cell counts. weightsByPair logical indicating whether weights calculated cell type pair. weightFactor numeric controls convexity weight function. window window around regions 'square', 'convex' 'concave'. window.length tuning parameter controlling level concavity estimating concave windows. BPPARAM BiocParallelParam object. sigma numeric variable used scaling fitting inhomogeneous L-curves. Rs vector radii measures association calculated. NULL, Rs = c(20, 50, 100) specified default. minLambda Minimum value density scaling fitting inhomogeneous L-curves. edgeCorrect logical indicating whether perform edge correction. includeZeroCells logical indicating whether include cells zero counts pairwise association calculation. ... options.","code":""},{"path":"https://sydneybiox.github.io/spicyR/reference/spicy.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Performs spatial tests on spatial cytometry data. — SpicyResults-class","text":"Data frame p-values.","code":""},{"path":"https://sydneybiox.github.io/spicyR/reference/spicy.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Performs spatial tests on spatial cytometry data. — SpicyResults-class","text":"","code":"data(\"diabetesData\") # Test with random effect for patient on a pairwise combination of cell # types. spicy(diabetesData, condition = \"stage\", subject = \"case\", from = \"Tc\", to = \"Th\" ) #> #> Number of cell type pairs: 1 #> Number of differentially localised cell type pairs: #> [1] 0 # Test all pairwise combinations of cell types without random effect of # patient. if (FALSE) { # \\dontrun{ spicyTest <- spicy(diabetesData, condition = \"stage\", subject = \"case\") } # } # Test all pairwise combination of cell types with random effect of patient. if (FALSE) { # \\dontrun{ spicy(diabetesData, condition = \"condition\", subject = \"subject\") } # }"},{"path":"https://sydneybiox.github.io/spicyR/reference/spicyBoxPlot.html","id":null,"dir":"Reference","previous_headings":"","what":"Plots boxplot for a specified cell-cell relationship — spicyBoxPlot","title":"Plots boxplot for a specified cell-cell relationship — spicyBoxPlot","text":"Plots boxplot specified cell-cell relationship","code":""},{"path":"https://sydneybiox.github.io/spicyR/reference/spicyBoxPlot.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Plots boxplot for a specified cell-cell relationship — spicyBoxPlot","text":"","code":"spicyBoxPlot(results, from = NULL, to = NULL, rank = NULL)"},{"path":"https://sydneybiox.github.io/spicyR/reference/spicyBoxPlot.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Plots boxplot for a specified cell-cell relationship — spicyBoxPlot","text":"results Data frame obtained spicy. Cell type like compare cell type. Cell type like compare cell type. rank Ranking cell type terms p-value, smaller p-value higher rank.","code":""},{"path":"https://sydneybiox.github.io/spicyR/reference/spicyBoxPlot.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Plots boxplot for a specified cell-cell relationship — spicyBoxPlot","text":"ggplot2 boxplot","code":""},{"path":"https://sydneybiox.github.io/spicyR/reference/spicyBoxPlot.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Plots boxplot for a specified cell-cell relationship — spicyBoxPlot","text":"","code":"data(spicyTest) spicyBoxPlot(spicyTest, rank = 1) #> Warning: Removed 53 rows containing non-finite outside the scale range #> (`stat_boxplot()`)."},{"path":"https://sydneybiox.github.io/spicyR/reference/spicyTest.html","id":null,"dir":"Reference","previous_headings":"","what":"Results from spicy for diabetesData — spicyTest","title":"Results from spicy for diabetesData — spicyTest","text":"Results call: spicyTest <- spicy(diabetesData, condition = \"condition\", subject = \"subject\")","code":""},{"path":"https://sydneybiox.github.io/spicyR/reference/spicyTest.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Results from spicy for diabetesData — spicyTest","text":"","code":"data(\"spicyTest\")"},{"path":"https://sydneybiox.github.io/spicyR/reference/spicyTest.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"Results from spicy for diabetesData — spicyTest","text":"spicyTest spicy object","code":""},{"path":"https://sydneybiox.github.io/spicyR/reference/survBubble.html","id":null,"dir":"Reference","previous_headings":"","what":"Plots survival results from spicy. — survBubble","title":"Plots survival results from spicy. — survBubble","text":"Plots survival results spicy.","code":""},{"path":"https://sydneybiox.github.io/spicyR/reference/survBubble.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Plots survival results from spicy. — survBubble","text":"","code":"survBubble( result, fdr = FALSE, cutoff = 0.05, colourGradient = c(\"#4575B4\", \"white\", \"#D73027\"), marksToPlot = NULL, contextColours = NULL, contextLabels = waiver() )"},{"path":"https://sydneybiox.github.io/spicyR/reference/survBubble.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Plots survival results from spicy. — survBubble","text":"result spicyResults object contains survival results. fdr TRUE FDR correction used. cutoff Significance threshold circles bubble plot. colourGradient vector colours, used define low, medium, high values colour scale. marksToPlot Vector marks include bubble plot. contextColours Used Kontextual results. named list specifying colours context. default Tableau colour palette used. contextLabels Used Kontextual results. named list change default labels context.","code":""},{"path":"https://sydneybiox.github.io/spicyR/reference/survBubble.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Plots survival results from spicy. — survBubble","text":"ggplot object.","code":""},{"path":"https://sydneybiox.github.io/spicyR/reference/topPairs.html","id":null,"dir":"Reference","previous_headings":"","what":"A table of the significant results from spicy tests — topPairs","title":"A table of the significant results from spicy tests — topPairs","text":"table significant results spicy tests","code":""},{"path":"https://sydneybiox.github.io/spicyR/reference/topPairs.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"A table of the significant results from spicy tests — topPairs","text":"","code":"topPairs(x, coef = NULL, n = 10, adj = \"fdr\", cutoff = NULL, figures = NULL)"},{"path":"https://sydneybiox.github.io/spicyR/reference/topPairs.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"A table of the significant results from spicy tests — topPairs","text":"x output spicy. coef coefficient list. n Extract top n significant pairs. adj p-value adjustment method use, argument p.adjust(). cutoff p-value threshold extract significant pairs. figures Round `figures` significant figures.","code":""},{"path":"https://sydneybiox.github.io/spicyR/reference/topPairs.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"A table of the significant results from spicy tests — topPairs","text":"data.frame","code":""},{"path":"https://sydneybiox.github.io/spicyR/reference/topPairs.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"A table of the significant results from spicy tests — topPairs","text":"","code":"data(spicyTest) topPairs(spicyTest) #> intercept coefficient p.value adj.pvalue #> beta__delta 1.815458e+02 -48.735693 0.0005033247 0.07169649 #> delta__beta 1.817943e+02 -48.166076 0.0005601288 0.07169649 #> B__unknown -3.606296e-15 11.770938 0.0052338392 0.42051606 #> delta__delta 2.089550e+02 -52.061196 0.0125129422 0.42051606 #> unknown__macrophage 1.007337e+01 -15.826919 0.0207410908 0.42051606 #> unknown__B -5.161932e-15 12.142848 0.0225855419 0.42051606 #> macrophage__unknown 1.004424e+01 -14.471666 0.0244668075 0.42051606 #> B__Th 1.571479e-15 26.847934 0.0245039854 0.42051606 #> otherimmune__naiveTc -9.292508e+00 33.584755 0.0255812944 0.42051606 #> ductal__ductal 1.481580e+01 -8.632569 0.0266935703 0.42051606 #> from to #> beta__delta beta delta #> delta__beta delta beta #> B__unknown B unknown #> delta__delta delta delta #> unknown__macrophage unknown macrophage #> unknown__B unknown B #> macrophage__unknown macrophage unknown #> B__Th B Th #> otherimmune__naiveTc otherimmune naiveTc #> ductal__ductal ductal ductal"}] +[{"path":"https://sydneybiox.github.io/spicyR/articles/spicyR.html","id":"installation","dir":"Articles","previous_headings":"","what":"Installation","title":"Spatial Linear and Mixed-Effects Modelling with spicyR","text":"","code":"if (!require(\"BiocManager\")) { install.packages(\"BiocManager\") } BiocManager::install(\"spicyR\") # load required packages library(spicyR) library(ggplot2) library(SpatialExperiment) library(SpatialDatasets) library(imcRtools) library(dplyr) library(survival)"},{"path":"https://sydneybiox.github.io/spicyR/articles/spicyR.html","id":"overview","dir":"Articles","previous_headings":"","what":"Overview","title":"Spatial Linear and Mixed-Effects Modelling with spicyR","text":"guide provides step--step instructions apply linear model multiple segmented labelled images assess localisation different cell types changes across different disease conditions.","code":""},{"path":"https://sydneybiox.github.io/spicyR/articles/spicyR.html","id":"example-data","dir":"Articles","previous_headings":"","what":"Example data","title":"Spatial Linear and Mixed-Effects Modelling with spicyR","text":"use Keren et al. (2018) breast cancer dataset compare spatial distribution immune cells individuals different levels tumour infiltration (cold compartmentalised). data stored SpatialExperiment object contains single-cell spatial data 41 images. cell types dataset includes 11 immune cell types (double negative CD3 T cells, CD4 T cells, B cells, monocytes, macrophages, CD8 T cells, neutrophils, natural killer cells, dendritic cells, regulatory T cells), 2 structural cell types (endothelial, mesenchymal), 2 tumour cell types (keratin+ tumour, tumour) one unidentified category.","code":"kerenSPE <- SpatialDatasets::spe_Keren_2018()"},{"path":"https://sydneybiox.github.io/spicyR/articles/spicyR.html","id":"linear-modelling","dir":"Articles","previous_headings":"","what":"Linear modelling","title":"Spatial Linear and Mixed-Effects Modelling with spicyR","text":"investigate changes localisation two different cell types, measure level localisation two cell types modelling L-function. L-function variance-stabilised K-function given equation Liĵ(r)=Kiĵ(r)π \\widehat{L_{ij}} (r) = \\sqrt{\\frac{\\widehat{K_{ij}}(r)}{\\pi}} Kiĵ\\widehat{K_{ij}} defined Kiĵ(r)=|W|ninj∑ni∑nj1{dij≤r}eij(r) \\widehat{K_{ij}} (r) = \\frac{|W|}{n_i n_j} \\sum_{n_i} \\sum_{n_j} 1 \\{d_{ij} \\leq r \\} e_{ij} (r) Kiĵ\\widehat{K_{ij}} summarises degree co-localisation cell type jj cell type ii, nin_i njn_j number cells type ii jj, |W||W| image area, dijd_{ij} distance two cells eij(r)e_{ij} (r) edge correcting factor. Specifically, mean difference experimental function theoretical function used measure level localisation, defined u=∑r′=rminrmaxL̂ij,Experimental(r′)−L̂ij,Poisson(r′) u = \\sum_{r' = r_{\\text{min}}}^{r_{\\text{max}}} \\widehat L_{ij, \\text{Experimental}} (r') - \\widehat L_{ij, \\text{Poisson}} (r') uu sum taken discrete range rr rminr_{\\text{min}} rmaxr_{\\text{max}}. Differences statistic uu two conditions modelled using weighted linear model.","code":""},{"path":"https://sydneybiox.github.io/spicyR/articles/spicyR.html","id":"test-for-change-in-localisation-for-a-specific-pair-of-cells","dir":"Articles","previous_headings":"Linear modelling","what":"Test for change in localisation for a specific pair of cells","title":"Spatial Linear and Mixed-Effects Modelling with spicyR","text":"Firstly, can test whether one cell type tends localised another cell type one condition compared . can done using spicy() function, specify condition parameter. example, want see whether neutrophils () tend found around CD8 T cells () compartmentalised tumours compared cold tumours. Given 3 conditions, can specify desired conditions setting order condition factor. spicy choose first level factor base condition second level comparison condition. spicy also naturally coerce condition column factor already factor. column containing cell type annotations can specified using cellTypeCol argument. default, spicy uses column named cellType SpatialExperiment object. obtain spicy object details results modelling performed. topPairs() function can used obtain associated coefficients p-value. coefficient spicyTestPair positive, find neutrophils significantly likely found near CD8 T cells compartmentalised tumours group compared cold tumour group.","code":"spicyTestPair <- spicy( kerenSPE, condition = \"tumour_type\", from = \"CD8_T_cell\", to = \"Neutrophils\" ) topPairs(spicyTestPair) #> intercept coefficient p.value adj.pvalue #> CD8_T_cell__Neutrophils -109.081 112.0185 2.166646e-05 2.166646e-05 #> from to #> CD8_T_cell__Neutrophils CD8_T_cell Neutrophils"},{"path":"https://sydneybiox.github.io/spicyR/articles/spicyR.html","id":"test-for-change-in-localisation-for-all-pairwise-cell-combinations","dir":"Articles","previous_headings":"Linear modelling","what":"Test for change in localisation for all pairwise cell combinations","title":"Spatial Linear and Mixed-Effects Modelling with spicyR","text":"can perform pairwise combinations cell types excluding parameters spicy(). , obtain spicy object outlines result linear models performed pairwise combination cell types. can also examine L-function metrics individual images using convenient bind() function spicyTest results object. results can represented bubble plot using signifPlot() function. , can observe significant relationships occur macrophages double negative CD3 T cells, suggesting two cell types far dispersed compartmentalised tumours compared cold tumours. examine specific cell type-cell type relationship detail, can use spicyBoxplot() specify either = \"Macrophages\" = \"dn_T_CD3\" rank = 1.","code":"spicyTest <- spicy( kerenSPE, condition = \"tumour_type\" ) topPairs(spicyTest) #> intercept coefficient p.value adj.pvalue #> Macrophages__dn_T_CD3 56.446064 -50.08474 1.080273e-07 3.035568e-05 #> dn_T_CD3__Macrophages 54.987151 -48.38664 2.194018e-07 3.082595e-05 #> Macrophages__DC_or_Mono 73.239404 -59.90361 5.224660e-06 4.893765e-04 #> DC_or_Mono__Macrophages 71.777087 -58.46833 7.431172e-06 5.220399e-04 #> dn_T_CD3__dn_T_CD3 -63.786032 100.61010 2.878804e-05 1.208706e-03 #> Neutrophils__dn_T_CD3 -63.141840 69.64356 2.891872e-05 1.208706e-03 #> dn_T_CD3__Neutrophils -63.133725 70.15508 3.011012e-05 1.208706e-03 #> DC__Macrophages 96.893239 -92.55112 1.801300e-04 5.758129e-03 #> Macrophages__DC 96.896215 -93.25194 1.844241e-04 5.758129e-03 #> CD4_T_cell__Keratin_Tumour -4.845037 -22.14995 2.834659e-04 7.409016e-03 #> from to #> Macrophages__dn_T_CD3 Macrophages dn_T_CD3 #> dn_T_CD3__Macrophages dn_T_CD3 Macrophages #> Macrophages__DC_or_Mono Macrophages DC_or_Mono #> DC_or_Mono__Macrophages DC_or_Mono Macrophages #> dn_T_CD3__dn_T_CD3 dn_T_CD3 dn_T_CD3 #> Neutrophils__dn_T_CD3 Neutrophils dn_T_CD3 #> dn_T_CD3__Neutrophils dn_T_CD3 Neutrophils #> DC__Macrophages DC Macrophages #> Macrophages__DC Macrophages DC #> CD4_T_cell__Keratin_Tumour CD4_T_cell Keratin_Tumour bind(spicyTest)[1:5, 1:5] #> imageID condition Keratin_Tumour__Keratin_Tumour #> 1 1 mixed -2.300602 #> 2 2 mixed -1.989699 #> 3 3 compartmentalised 11.373530 #> 4 4 compartmentalised 33.931133 #> 5 5 compartmentalised 17.922818 #> dn_T_CD3__Keratin_Tumour B_cell__Keratin_Tumour #> 1 -5.298543 -20.827279 #> 2 -16.020022 3.025815 #> 3 -21.857447 -24.962913 #> 4 -36.438476 -40.470221 #> 5 -20.816783 -38.138076 signifPlot( spicyTest, breaks = c(-3, 3, 1), marksToPlot = c(\"Macrophages\", \"DC_or_Mono\", \"dn_T_CD3\", \"Neutrophils\", \"CD8_T_cell\", \"Keratin_Tumour\") ) spicyBoxPlot(results = spicyTest, # from = \"Macrophages\", # to = \"dn_T_CD3\" rank = 1)"},{"path":"https://sydneybiox.github.io/spicyR/articles/spicyR.html","id":"linear-modelling-for-custom-metrics","dir":"Articles","previous_headings":"","what":"Linear modelling for custom metrics","title":"Spatial Linear and Mixed-Effects Modelling with spicyR","text":"spicyR can also applied custom distance abundance metrics. kNN interactions graph can generated function buildSpatialGraph imcRtools package. generates colPairs object inside SpatialExperiment object. spicyR provides function convPairs converting colPairs object abundance matrix calculating average number nearby cells types every cell type given k. example, exists average 5 neutrophils every macrophage image 1, column Neutrophil__Macrophage value 5 image 1. custom distance abundance metrics can included analysis alternateResult parameter. Statial package contains custom distance metrics can used spicy.","code":"kerenSPE <- imcRtools::buildSpatialGraph(kerenSPE, img_id = \"imageID\", type = \"knn\", k = 20, coords = c(\"x\", \"y\")) pairAbundances <- convPairs(kerenSPE, colPair = \"knn_interaction_graph\") head(pairAbundances[\"B_cell__B_cell\"]) #> B_cell__B_cell #> 1 12.7349608 #> 10 0.2777778 #> 11 0.0000000 #> 12 1.3333333 #> 13 1.2200957 #> 14 0.0000000 spicyTestColPairs <- spicy( kerenSPE, condition = \"tumour_type\", alternateResult = pairAbundances, weights = FALSE ) topPairs(spicyTestColPairs) #> intercept coefficient p.value adj.pvalue #> CD8_T_cell__Neutrophils 0.833333333 -0.7592968 0.002645466 0.3291833 #> B_cell__Tumour 0.001937984 0.2602822 0.004872664 0.3291833 #> Other_Immune__NK 0.012698413 0.2612881 0.005673068 0.3291833 #> Unidentified__CD8_T_cell 0.106626794 0.6387339 0.005906526 0.3291833 #> dn_T_CD3__NK 0.004242424 0.2148797 0.006317829 0.3291833 #> CD4_T_cell__Neutrophils 0.036213602 0.2947696 0.007902670 0.3291833 #> Tregs__CD4_T_cell 0.128876212 0.5726201 0.010207087 0.3291833 #> Endothelial__DC 0.008771930 0.3008523 0.011189533 0.3291833 #> Tumour__Neutrophils 0.021638939 0.2529045 0.011388850 0.3291833 #> Mesenchymal__Neutrophils 0.004504505 0.2494301 0.012761315 0.3291833 #> from to #> CD8_T_cell__Neutrophils CD8_T_cell Neutrophils #> B_cell__Tumour B_cell Tumour #> Other_Immune__NK Other_Immune NK #> Unidentified__CD8_T_cell Unidentified CD8_T_cell #> dn_T_CD3__NK dn_T_CD3 NK #> CD4_T_cell__Neutrophils CD4_T_cell Neutrophils #> Tregs__CD4_T_cell Tregs CD4_T_cell #> Endothelial__DC Endothelial DC #> Tumour__Neutrophils Tumour Neutrophils #> Mesenchymal__Neutrophils Mesenchymal Neutrophils signifPlot( spicyTestColPairs, breaks = c(-3, 3, 1), marksToPlot = c(\"Macrophages\", \"dn_T_CD3\", \"CD4_T_cell\", \"B_cell\", \"DC_or_Mono\", \"Neutrophils\", \"CD8_T_cell\") )"},{"path":"https://sydneybiox.github.io/spicyR/articles/spicyR.html","id":"performing-survival-analysis","dir":"Articles","previous_headings":"","what":"Performing survival analysis","title":"Spatial Linear and Mixed-Effects Modelling with spicyR","text":"spicy can also used perform survival analysis asses whether changes co-localisation cell types associated survival probability. spicy requires SingleCellExperiment object used contain column called survival Surv object. can perform survival analysis using spicy function specifying condition = \"survival\". can access corresponding coefficients p-values accessing survivalResults slot spicy results object.","code":"kerenSPE$event = 1 - kerenSPE$Censored kerenSPE$survival = Surv(kerenSPE$`Survival_days_capped*`, kerenSPE$event) # Running survival analysis spicySurvival = spicy(kerenSPE, condition = \"survival\") # top 10 significant pairs head(spicySurvival$survivalResults, 10) #> # A tibble: 10 × 4 #> test coef se.coef p.value #> #> 1 Other_Immune__Tregs 0.0236 0.00866 0.00000893 #> 2 CD4_T_cell__Tregs 0.0177 0.00685 0.0000124 #> 3 Tregs__Other_Immune 0.0237 0.00873 0.0000126 #> 4 Tregs__CD4_T_cell 0.0171 0.00676 0.0000285 #> 5 CD8_T_cell__CD8_T_cell 0.00605 0.00272 0.000332 #> 6 Tumour__CD8_T_cell -0.0305 0.0114 0.000617 #> 7 CD8_T_cell__Tumour -0.0305 0.0116 0.000721 #> 8 CD4_T_cell__dn_T_CD3 0.00845 0.00353 0.000794 #> 9 dn_T_CD3__CD4_T_cell 0.00840 0.00353 0.000937 #> 10 DC__Other_Immune -0.0289 0.0123 0.00103"},{"path":"https://sydneybiox.github.io/spicyR/articles/spicyR.html","id":"accounting-for-tissue-inhomogeneity","dir":"Articles","previous_headings":"","what":"Accounting for tissue inhomogeneity","title":"Spatial Linear and Mixed-Effects Modelling with spicyR","text":"spicy function can also account tissue inhomogeneity avoid false positives negatives. can done setting sigma = parameter within spicy function. default, sigma set NULL, spicy assumes homogeneous tissue structure. example, examine L-function Keratin_Tumour__Neutrophils sigma = NULL Rs = 100, value positive, indicating attraction two cell types. specify sigma = 20 re-calculate L-function, indicates relationship Keratin_Tumour Neutrophils, .e., major attraction dispersion, now takes account tissue inhomogeneity. Plotting image 24 shows supposed co-localisation occurs due dense cluster cells near top image.","code":"# filter SPE object to obtain image 24 data kerenSubset = kerenSPE[, colData(kerenSPE)$imageID == \"24\"] pairwiseAssoc = getPairwise(kerenSubset, sigma = NULL, Rs = 100) |> as.data.frame() pairwiseAssoc[[\"Keratin_Tumour__Neutrophils\"]] #> [1] 10.88892 pairwiseAssoc = getPairwise(kerenSubset, sigma = 20, Rs = 100) |> as.data.frame() pairwiseAssoc[[\"Keratin_Tumour__Neutrophils\"]] #> [1] 0.9024836 # obtain colData for image 24 cData = colData(kerenSPE) |> as.data.frame() |> dplyr::filter(imageID == \"24\") # obtain cells present in image 24 coords = spatialCoords(kerenSPE) |> as.data.frame() coords$cellID = rownames(coords) coords = coords |> dplyr::filter(cellID %in% cData$CellID) cData$X = coords$x cData$Y = coords$y cData = cData |> dplyr::mutate(cellTypeNew = ifelse(cellType %in% c(\"Keratin_Tumour\", \"Neutrophils\"), cellType, \"Other\")) pal = setNames(c(\"#d6b11c\", \"#850f07\"), c(\"Keratin_Tumour\", \"Neutrophils\")) ggplot() + stat_density_2d(data = cData, aes(x = X, y = Y, fill = after_stat(density)), geom = \"raster\", contour = FALSE) + geom_point(data = cData |> filter(cellType != \"Other\"), aes(x = X, y = Y, colour = cellTypeNew), size = 1) + scale_color_manual(values = pal) + scale_fill_distiller(palette = \"Blues\", direction = 1) + theme_classic() + labs(title = \"image ID: 24\")"},{"path":"https://sydneybiox.github.io/spicyR/articles/spicyR.html","id":"mixed-effects-modelling","dir":"Articles","previous_headings":"","what":"Mixed effects modelling","title":"Spatial Linear and Mixed-Effects Modelling with spicyR","text":"spicyR supports mixed effects modelling multiple images obtained subject. case, subject treated random effect condition treated fixed effect. perform mixed effects modelling, can specify subject parameter spicy function.","code":"spicyMixedTest <- spicy( diabetesData, condition = \"stage\", subject = \"case\" )"},{"path":"https://sydneybiox.github.io/spicyR/articles/spicyR.html","id":"references","dir":"Articles","previous_headings":"","what":"References","title":"Spatial Linear and Mixed-Effects Modelling with spicyR","text":"","code":"sessionInfo() #> R version 4.4.2 (2024-10-31) #> Platform: x86_64-pc-linux-gnu #> Running under: Ubuntu 22.04.5 LTS #> #> Matrix products: default #> BLAS: /usr/lib/x86_64-linux-gnu/openblas-pthread/libblas.so.3 #> LAPACK: /usr/lib/x86_64-linux-gnu/openblas-pthread/libopenblasp-r0.3.20.so; LAPACK version 3.10.0 #> #> locale: #> [1] LC_CTYPE=C.UTF-8 LC_NUMERIC=C LC_TIME=C.UTF-8 #> [4] LC_COLLATE=C.UTF-8 LC_MONETARY=C.UTF-8 LC_MESSAGES=C.UTF-8 #> [7] LC_PAPER=C.UTF-8 LC_NAME=C LC_ADDRESS=C #> [10] LC_TELEPHONE=C LC_MEASUREMENT=C.UTF-8 LC_IDENTIFICATION=C #> #> time zone: UTC #> tzcode source: system (glibc) #> #> attached base packages: #> [1] stats4 stats graphics grDevices utils datasets methods #> [8] base #> #> other attached packages: #> [1] survival_3.7-0 dplyr_1.1.4 #> [3] imcRtools_1.12.0 SpatialDatasets_1.4.0 #> [5] ExperimentHub_2.14.0 AnnotationHub_3.14.0 #> [7] BiocFileCache_2.14.0 dbplyr_2.5.0 #> [9] SpatialExperiment_1.16.0 SingleCellExperiment_1.28.0 #> [11] SummarizedExperiment_1.36.0 Biobase_2.66.0 #> [13] GenomicRanges_1.58.0 GenomeInfoDb_1.42.0 #> [15] IRanges_2.40.0 S4Vectors_0.44.0 #> [17] BiocGenerics_0.52.0 MatrixGenerics_1.18.0 #> [19] matrixStats_1.4.1 ggplot2_3.5.1 #> [21] spicyR_1.17.10 BiocStyle_2.34.0 #> #> loaded via a namespace (and not attached): #> [1] fs_1.6.5 spatstat.sparse_3.1-0 #> [3] bitops_1.0-9 sf_1.0-19 #> [5] EBImage_4.48.0 httr_1.4.7 #> [7] RColorBrewer_1.1-3 numDeriv_2016.8-1.1 #> [9] tools_4.4.2 backports_1.5.0 #> [11] utf8_1.2.4 R6_2.5.1 #> [13] DT_0.33 HDF5Array_1.34.0 #> [15] mgcv_1.9-1 rhdf5filters_1.18.0 #> [17] withr_3.0.2 sp_2.1-4 #> [19] gridExtra_2.3 coxme_2.2-22 #> [21] ClassifyR_3.10.0 cli_3.6.3 #> [23] textshaping_0.4.0 spatstat.explore_3.3-3 #> [25] labeling_0.4.3 sass_0.4.9 #> [27] nnls_1.6 spatstat.data_3.1-2 #> [29] readr_2.1.5 proxy_0.4-27 #> [31] pkgdown_2.1.1 systemfonts_1.1.0 #> [33] ggupset_0.4.0 svglite_2.1.3 #> [35] RSQLite_2.3.7 generics_0.1.3 #> [37] vroom_1.6.5 spatstat.random_3.3-2 #> [39] car_3.1-3 scam_1.2-17 #> [41] Matrix_1.7-1 ggbeeswarm_0.7.2 #> [43] fansi_1.0.6 abind_1.4-8 #> [45] terra_1.7-83 lifecycle_1.0.4 #> [47] yaml_2.3.10 carData_3.0-5 #> [49] rhdf5_2.50.0 SparseArray_1.6.0 #> [51] grid_4.4.2 blob_1.2.4 #> [53] promises_1.3.0 crayon_1.5.3 #> [55] bdsmatrix_1.3-7 shinydashboard_0.7.2 #> [57] lattice_0.22-6 beachmat_2.22.0 #> [59] KEGGREST_1.46.0 magick_2.8.5 #> [61] cytomapper_1.18.0 pillar_1.9.0 #> [63] knitr_1.49 RTriangle_1.6-0.14 #> [65] rjson_0.2.23 boot_1.3-31 #> [67] codetools_0.2-20 glue_1.8.0 #> [69] spatstat.univar_3.1-1 data.table_1.16.2 #> [71] MultiAssayExperiment_1.32.0 vctrs_0.6.5 #> [73] png_0.1-8 gtable_0.3.6 #> [75] cachem_1.1.0 xfun_0.49 #> [77] S4Arrays_1.6.0 mime_0.12 #> [79] tidygraph_1.3.1 pheatmap_1.0.12 #> [81] units_0.8-5 nlme_3.1-166 #> [83] bit64_4.5.2 filelock_1.0.3 #> [85] bslib_0.8.0 svgPanZoom_0.3.4 #> [87] KernSmooth_2.23-24 vipor_0.4.7 #> [89] colorspace_2.1-1 DBI_1.2.3 #> [91] raster_3.6-30 tidyselect_1.2.1 #> [93] bit_4.5.0 compiler_4.4.2 #> [95] curl_6.0.0 BiocNeighbors_2.0.0 #> [97] desc_1.4.3 DelayedArray_0.32.0 #> [99] bookdown_0.41 scales_1.3.0 #> [101] classInt_0.4-10 distances_0.1.11 #> [103] rappdirs_0.3.3 tiff_0.1-12 #> [105] stringr_1.5.1 digest_0.6.37 #> [107] goftest_1.2-3 fftwtools_0.9-11 #> [109] spatstat.utils_3.1-1 minqa_1.2.8 #> [111] rmarkdown_2.29 XVector_0.46.0 #> [113] htmltools_0.5.8.1 pkgconfig_2.0.3 #> [115] jpeg_0.1-10 lme4_1.1-35.5 #> [117] fastmap_1.2.0 rlang_1.1.4 #> [119] htmlwidgets_1.6.4 ggthemes_5.1.0 #> [121] UCSC.utils_1.2.0 shiny_1.9.1 #> [123] ggh4x_0.2.8 farver_2.1.2 #> [125] jquerylib_0.1.4 jsonlite_1.8.9 #> [127] BiocParallel_1.40.0 RCurl_1.98-1.16 #> [129] magrittr_2.0.3 scuttle_1.16.0 #> [131] Formula_1.2-5 GenomeInfoDbData_1.2.13 #> [133] Rhdf5lib_1.28.0 munsell_0.5.1 #> [135] Rcpp_1.0.13-1 ggnewscale_0.5.0 #> [137] viridis_0.6.5 stringi_1.8.4 #> [139] ggraph_2.2.1 zlibbioc_1.52.0 #> [141] MASS_7.3-61 plyr_1.8.9 #> [143] parallel_4.4.2 ggrepel_0.9.6 #> [145] deldir_2.0-4 Biostrings_2.74.0 #> [147] graphlayouts_1.2.0 splines_4.4.2 #> [149] tensor_1.5 hms_1.1.3 #> [151] locfit_1.5-9.10 igraph_2.1.1 #> [153] ggpubr_0.6.0 spatstat.geom_3.3-3 #> [155] ggsignif_0.6.4 reshape2_1.4.4 #> [157] BiocVersion_3.20.0 evaluate_1.0.1 #> [159] BiocManager_1.30.25 tzdb_0.4.0 #> [161] nloptr_2.1.1 tweenr_2.0.3 #> [163] httpuv_1.6.15 tidyr_1.3.1 #> [165] purrr_1.0.2 polyclip_1.10-7 #> [167] ggforce_0.4.2 broom_1.0.7 #> [169] xtable_1.8-4 e1071_1.7-16 #> [171] rstatix_0.7.2 later_1.3.2 #> [173] class_7.3-22 viridisLite_0.4.2 #> [175] ragg_1.3.3 tibble_3.2.1 #> [177] lmerTest_3.1-3 memoise_2.0.1 #> [179] beeswarm_0.4.0 AnnotationDbi_1.68.0 #> [181] concaveman_1.1.0"},{"path":"https://sydneybiox.github.io/spicyR/authors.html","id":null,"dir":"","previous_headings":"","what":"Authors","title":"Authors and Citation","text":"Nicolas Canete. Author. Ellis Patrick. Author, maintainer. Nicholas Robertson. Contributor. Alex Qin. Contributor. Farhan Ameen. Contributor. Shreya Rao. Contributor.","code":""},{"path":"https://sydneybiox.github.io/spicyR/authors.html","id":"citation","dir":"","previous_headings":"","what":"Citation","title":"Authors and Citation","text":"Canete N, Iyengar S, Ormerod J, Baharlou H, Harman , Patrick E (2022). “spicyR: spatial analysis situ cytometry data R.” Bioinformatics, 38(11), 3099–3105. doi:10.1093/bioinformatics/btac268, https://doi.org/10.1093/bioinformatics/btac268.","code":"@Article{, title = {{spicyR: spatial analysis of in situ cytometry data in R}}, author = {Nicolas Canete and Sourish Iyengar and John Ormerod and Heeva Baharlou and Andrew Harman and Ellis Patrick}, year = {2022}, volume = {38}, number = {11}, pages = {3099–3105}, journal = {Bioinformatics}, doi = {10.1093/bioinformatics/btac268}, url = {https://doi.org/10.1093/bioinformatics/btac268}, }"},{"path":"https://sydneybiox.github.io/spicyR/index.html","id":"spicyr","dir":"","previous_headings":"","what":"Spatial analysis of in situ cytometry data","title":"Spatial analysis of in situ cytometry data","text":"Spatial analysis situ cytometry data.","code":""},{"path":"https://sydneybiox.github.io/spicyR/index.html","id":"overview","dir":"","previous_headings":"","what":"Overview","title":"Spatial analysis of in situ cytometry data","text":"spicyR package provides framework performing inference changes spatial relationships pairs cell types cell-resolution spatial omics technologies. spicyR consists three primary steps: () summarizing degree spatial localization pairs cell types image; (ii) modelling variability localization summary statistics function cell counts (iii) testing changes spatial localizations associated response variable.","code":""},{"path":"https://sydneybiox.github.io/spicyR/index.html","id":"installation","dir":"","previous_headings":"","what":"Installation","title":"Spatial analysis of in situ cytometry data","text":"Bioconductor release version, run following. like --date features, install recent development version.","code":"if (!require(\"BiocManager\", quietly = TRUE)) install.packages(\"BiocManager\") BiocManager::install(\"spicyR\") # Install the development version from Bioconductor: if (!require(\"BiocManager\", quietly = TRUE)) install.packages(\"BiocManager\") # The following initializes usage of Bioc devel # This will update all your Bioconductor packages to devel version BiocManager::install(version='devel') BiocManager::install(\"spicyR\") # Otherwise install the development version from GitHub: # install.packages(\"devtools\") devtools::install_github(\"ellispatrick/spicyR\") library(spicyR)"},{"path":"https://sydneybiox.github.io/spicyR/index.html","id":"submitting-an-issue-or-feature-request","dir":"","previous_headings":"","what":"Submitting an issue or feature request","title":"Spatial analysis of in situ cytometry data","text":"spicyR still active development. greatly appreciate feedback related package. R package related issues raised . general questions feedback, please contact us directly via ellis.patrick@sydney.edu.au.","code":""},{"path":"https://sydneybiox.github.io/spicyR/index.html","id":"authors","dir":"","previous_headings":"","what":"Authors","title":"Spatial analysis of in situ cytometry data","text":"Nicolas Canete Ellis Patrick - @TheEllisPatrick","code":""},{"path":"https://sydneybiox.github.io/spicyR/index.html","id":"citation","dir":"","previous_headings":"","what":"Citation","title":"Spatial analysis of in situ cytometry data","text":"Nicolas P Canete, Sourish S Iyengar, John T Ormerod, Heeva Baharlou, Andrew N Harman, Ellis Patrick, spicyR: spatial analysis situ cytometry data R, Bioinformatics, Volume 38, Issue 11, 1 June 2022, Pages 3099–3105, https://doi.org/10.1093/bioinformatics/btac268","code":""},{"path":"https://sydneybiox.github.io/spicyR/reference/bind.html","id":null,"dir":"Reference","previous_headings":"","what":"Produces a dataframe showing L-function metric for each imageID entry. — bind","title":"Produces a dataframe showing L-function metric for each imageID entry. — bind","text":"Produces dataframe showing L-function metric imageID entry.","code":""},{"path":"https://sydneybiox.github.io/spicyR/reference/bind.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Produces a dataframe showing L-function metric for each imageID entry. — bind","text":"","code":"bind(results, pairName = NULL)"},{"path":"https://sydneybiox.github.io/spicyR/reference/bind.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Produces a dataframe showing L-function metric for each imageID entry. — bind","text":"results Spicy test result obtained spicy. pairName string specifying pairwise interaction interest. NULL, pairwise interactions shown.","code":""},{"path":"https://sydneybiox.github.io/spicyR/reference/bind.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Produces a dataframe showing L-function metric for each imageID entry. — bind","text":"data.frame containing colData related results.","code":""},{"path":"https://sydneybiox.github.io/spicyR/reference/bind.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Produces a dataframe showing L-function metric for each imageID entry. — bind","text":"","code":"data(spicyTest) df <- bind(spicyTest)"},{"path":"https://sydneybiox.github.io/spicyR/reference/colTest.html","id":null,"dir":"Reference","previous_headings":"","what":"Perform a simple wilcoxon-rank-sum test or t-test on the columns of a data frame — colTest","title":"Perform a simple wilcoxon-rank-sum test or t-test on the columns of a data frame — colTest","text":"Perform simple wilcoxon-rank-sum test t-test columns data frame","code":""},{"path":"https://sydneybiox.github.io/spicyR/reference/colTest.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Perform a simple wilcoxon-rank-sum test or t-test on the columns of a data frame — colTest","text":"","code":"colTest(df, condition, type = NULL, feature = NULL, imageID = \"imageID\")"},{"path":"https://sydneybiox.github.io/spicyR/reference/colTest.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Perform a simple wilcoxon-rank-sum test or t-test on the columns of a data frame — colTest","text":"df data.frame SingleCellExperiment, SpatialExperiment condition condition interest type type test, \"wilcox\", \"ttest\" \"survival\". feature Can used calculate proportions feature image imageID imageID's presenting SingleCellExperiment","code":""},{"path":"https://sydneybiox.github.io/spicyR/reference/colTest.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Perform a simple wilcoxon-rank-sum test or t-test on the columns of a data frame — colTest","text":"Proportions","code":""},{"path":"https://sydneybiox.github.io/spicyR/reference/colTest.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Perform a simple wilcoxon-rank-sum test or t-test on the columns of a data frame — colTest","text":"","code":"# Test for an association with long-duration diabetes # This is clearly ignoring the repeated measures... data(\"diabetesData\") diabetesData <- spicyR:::.format_data( diabetesData, \"imageID\", \"cellType\", c(\"x\", \"y\"), FALSE ) props <- getProp(diabetesData) condition <- spicyR:::getImagePheno(diabetesData)$stage names(condition) <- spicyR:::getImagePheno(diabetesData)$imageID condition <- condition[condition %in% c(\"Long-duration\", \"Onset\")] test <- colTest(props[names(condition), ], condition)"},{"path":"https://sydneybiox.github.io/spicyR/reference/convPairs.html","id":null,"dir":"Reference","previous_headings":"","what":"Converts colPairs object into an abundance matrix based on number of nearby interactions for every cell type. — convPairs","title":"Converts colPairs object into an abundance matrix based on number of nearby interactions for every cell type. — convPairs","text":"Converts colPairs object abundance matrix based number nearby interactions every cell type.","code":""},{"path":"https://sydneybiox.github.io/spicyR/reference/convPairs.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Converts colPairs object into an abundance matrix based on number of nearby interactions for every cell type. — convPairs","text":"","code":"convPairs(cells, colPair, cellType = \"cellType\", imageID = \"imageID\")"},{"path":"https://sydneybiox.github.io/spicyR/reference/convPairs.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Converts colPairs object into an abundance matrix based on number of nearby interactions for every cell type. — convPairs","text":"cells SingleCellExperiment contains objects colPairs slot. colPair name object colPairs slot dataframe constructed . cellType cell type using SingleCellExperiment. imageID image ID using SingleCellExperiment.","code":""},{"path":"https://sydneybiox.github.io/spicyR/reference/convPairs.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Converts colPairs object into an abundance matrix based on number of nearby interactions for every cell type. — convPairs","text":"Matrix abundances","code":""},{"path":"https://sydneybiox.github.io/spicyR/reference/convPairs.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Converts colPairs object into an abundance matrix based on number of nearby interactions for every cell type. — convPairs","text":"","code":"data(\"diabetesData\") images <- c(\"A09\", \"A11\", \"A16\", \"A17\") diabetesData <- diabetesData[ , SummarizedExperiment::colData(diabetesData)$imageID %in% images ] diabetesData_SPE <- SpatialExperiment::SpatialExperiment(diabetesData, colData = SummarizedExperiment::colData(diabetesData) ) SpatialExperiment::spatialCoords(diabetesData_SPE) <- data.frame( SummarizedExperiment::colData(diabetesData_SPE)$x, SummarizedExperiment::colData(diabetesData_SPE)$y ) |> as.matrix() SpatialExperiment::spatialCoordsNames(diabetesData_SPE) <- c(\"x\", \"y\") diabetesData_SPE <- imcRtools::buildSpatialGraph(diabetesData_SPE, img_id = \"imageID\", type = \"knn\", k = 20, coords = c(\"x\", \"y\") ) #> 'sample_id's are duplicated across 'SpatialExperiment' objects to cbind; appending sample indices. #> The returned object is ordered by the 'imageID' entry. pairAbundances <- convPairs(diabetesData_SPE, colPair = \"knn_interaction_graph\" )"},{"path":"https://sydneybiox.github.io/spicyR/reference/diabetesData.html","id":null,"dir":"Reference","previous_headings":"","what":"Diabetes IMC data in SCE format. — diabetesData","title":"Diabetes IMC data in SCE format. — diabetesData","text":"subset Damond et al 2019 imaging mass cytometry dataset. data contains cells pancreatic islets individuals early onset diabetes healthy controls. object contains single-cell data 160 images 8 subjects, 20 images per subject.","code":""},{"path":"https://sydneybiox.github.io/spicyR/reference/diabetesData.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Diabetes IMC data in SCE format. — diabetesData","text":"","code":"data(\"diabetesData\")"},{"path":"https://sydneybiox.github.io/spicyR/reference/diabetesData.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"Diabetes IMC data in SCE format. — diabetesData","text":"diabetesData_SCE SingleCellExperiment object","code":""},{"path":"https://sydneybiox.github.io/spicyR/reference/diabetesData.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Diabetes IMC data in SCE format. — diabetesData","text":"Converted SingleCellExperiment format.","code":""},{"path":"https://sydneybiox.github.io/spicyR/reference/getPairwise.html","id":null,"dir":"Reference","previous_headings":"","what":"Get statistic from pairwise L curve of a single image. — getPairwise","title":"Get statistic from pairwise L curve of a single image. — getPairwise","text":"Get statistic pairwise L curve single image.","code":""},{"path":"https://sydneybiox.github.io/spicyR/reference/getPairwise.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Get statistic from pairwise L curve of a single image. — getPairwise","text":"","code":"getPairwise( cells, from = NULL, to = NULL, window = \"convex\", window.length = NULL, Rs = c(20, 50, 100), sigma = NULL, minLambda = 0.05, edgeCorrect = TRUE, includeZeroCells = TRUE, nCores = 1, imageID = \"imageID\", cellType = \"cellType\", spatialCoords = c(\"x\", \"y\") )"},{"path":"https://sydneybiox.github.io/spicyR/reference/getPairwise.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Get statistic from pairwise L curve of a single image. — getPairwise","text":"cells SummarizedExperiment contains least variables x y, giving location coordinates cell, cellType. '' cellType generating L curve. '' cellType generating L curve. window window around regions 'square', 'convex' 'concave'. window.length tuning parameter controlling level concavity estimating concave windows. Rs vector radii measures association calculated. sigma numeric variable used scaling fitting inhomogeneous L-curves. minLambda Minimum value density scaling fitting inhomogeneous L-curves. edgeCorrect logical indicating whether perform edge correction. includeZeroCells logical indicating whether include cells zero counts pairwise association calculation. nCores number cores use parallel processing. imageID name imageID column using SingleCellExperiment SpatialExperiment. cellType name cellType column using SingleCellExperiment SpatialExperiment. spatialCoords names spatialCoords column using SingleCellExperiment.","code":""},{"path":"https://sydneybiox.github.io/spicyR/reference/getPairwise.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Get statistic from pairwise L curve of a single image. — getPairwise","text":"Statistic pairwise L curve single image.","code":""},{"path":"https://sydneybiox.github.io/spicyR/reference/getPairwise.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Get statistic from pairwise L curve of a single image. — getPairwise","text":"","code":"data(\"diabetesData\") # Subset by imageID for fast example selected_cells <- diabetesData[ , SummarizedExperiment::colData(diabetesData)$imageID == \"A09\" ] pairAssoc <- getPairwise(selected_cells)"},{"path":"https://sydneybiox.github.io/spicyR/reference/getProp.html","id":null,"dir":"Reference","previous_headings":"","what":"Get proportions from a SummarizedExperiment. — getProp","title":"Get proportions from a SummarizedExperiment. — getProp","text":"Get proportions SummarizedExperiment.","code":""},{"path":"https://sydneybiox.github.io/spicyR/reference/getProp.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Get proportions from a SummarizedExperiment. — getProp","text":"","code":"getProp(cells, feature = \"cellType\", imageID = \"imageID\")"},{"path":"https://sydneybiox.github.io/spicyR/reference/getProp.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Get proportions from a SummarizedExperiment. — getProp","text":"cells SingleCellExperiment, SpatialExperiment data.frame. feature feature interest imageID imageID's","code":""},{"path":"https://sydneybiox.github.io/spicyR/reference/getProp.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Get proportions from a SummarizedExperiment. — getProp","text":"Proportions","code":""},{"path":"https://sydneybiox.github.io/spicyR/reference/getProp.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Get proportions from a SummarizedExperiment. — getProp","text":"","code":"data(\"diabetesData\") prop <- getProp(diabetesData)"},{"path":"https://sydneybiox.github.io/spicyR/reference/signifPlot.html","id":null,"dir":"Reference","previous_headings":"","what":"Plots result of signifPlot. — signifPlot","title":"Plots result of signifPlot. — signifPlot","text":"Plots result signifPlot.","code":""},{"path":"https://sydneybiox.github.io/spicyR/reference/signifPlot.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Plots result of signifPlot. — signifPlot","text":"","code":"signifPlot( results, fdr = FALSE, type = \"bubble\", breaks = NULL, comparisonGroup = NULL, colours = c(\"#4575B4\", \"white\", \"#D73027\"), marksToPlot = NULL, cutoff = 0.05, contextColours = NULL, contextLabels = waiver() )"},{"path":"https://sydneybiox.github.io/spicyR/reference/signifPlot.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Plots result of signifPlot. — signifPlot","text":"results spicy results object fdr TRUE FDR correction used. type Whether make bubble plot heatmap. Note: survival results bubble plot used. breaks Vector 3 numbers giving breaks used legend. first number minimum, second maximum, third number breaks. comparisonGroup string specifying name outcome group compare base group. colours Vector colours use colour legend. marksToPlot Vector marks include plot. cutoff significance threshold circles bubble plot. contextColours Used Kontextual results. named list specifying colours context. default Tableau colour palette used. contextLabels Used Kontextual results. named list change default labels context.","code":""},{"path":"https://sydneybiox.github.io/spicyR/reference/signifPlot.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Plots result of signifPlot. — signifPlot","text":"ggplot pheatmap object","code":""},{"path":"https://sydneybiox.github.io/spicyR/reference/signifPlot.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Plots result of signifPlot. — signifPlot","text":"","code":"data(spicyTest) p <- signifPlot(spicyTest, breaks = c(-3, 3, 0.5)) # plot includes unicode characters, do not use default pdf device ggplot2::ggsave(p, filename = tempfile(), device = cairo_pdf) #> Saving 7 x 7 in image"},{"path":"https://sydneybiox.github.io/spicyR/reference/spicy.html","id":null,"dir":"Reference","previous_headings":"","what":"Performs spatial tests on spatial cytometry data. — SpicyResults-class","title":"Performs spatial tests on spatial cytometry data. — SpicyResults-class","text":"Performs spatial tests spatial cytometry data.","code":""},{"path":"https://sydneybiox.github.io/spicyR/reference/spicy.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Performs spatial tests on spatial cytometry data. — SpicyResults-class","text":"","code":"spicy( cells, condition, subject = NULL, covariates = NULL, from = NULL, to = NULL, imageID = \"imageID\", cellType = \"cellType\", spatialCoords = c(\"x\", \"y\"), alternateResult = NULL, verbose = FALSE, weights = TRUE, weightsByPair = FALSE, weightFactor = 1, window = \"convex\", window.length = NULL, nCores = 1, sigma = NULL, Rs = NULL, minLambda = 0.05, edgeCorrect = TRUE, includeZeroCells = FALSE, ... )"},{"path":"https://sydneybiox.github.io/spicyR/reference/spicy.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Performs spatial tests on spatial cytometry data. — SpicyResults-class","text":"cells SummarizedExperiment data frame contains least variables x y, giving location coordinates cell, cellType. condition character specifying column contains condition `Surv` objects subject Vector subject IDs corresponding image cells data frame. covariates Vector covariate names included mixed effects model fixed effects. vector cell types like compare vector vector cell types like compare vector imageID image ID using SingleCellExperiment. cellType cell type using SingleCellExperiment. spatialCoords spatial coordinates using SingleCellExperiment. alternateResult pairwise association statistic combination celltypes image. verbose logical indicating whether output messages. weights logical indicating whether include weights based cell counts. weightsByPair logical indicating whether weights calculated cell type pair. weightFactor numeric controls convexity weight function. window window around regions 'square', 'convex' 'concave'. window.length tuning parameter controlling level concavity estimating concave windows. nCores number cores use parallel processing. sigma numeric variable used scaling fitting inhomogeneous L-curves. Rs vector radii measures association calculated. NULL, Rs = c(20, 50, 100) specified default. minLambda Minimum value density scaling fitting inhomogeneous L-curves. edgeCorrect logical indicating whether perform edge correction. includeZeroCells logical indicating whether include cells zero counts pairwise association calculation. ... options.","code":""},{"path":"https://sydneybiox.github.io/spicyR/reference/spicy.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Performs spatial tests on spatial cytometry data. — SpicyResults-class","text":"Data frame p-values.","code":""},{"path":"https://sydneybiox.github.io/spicyR/reference/spicy.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Performs spatial tests on spatial cytometry data. — SpicyResults-class","text":"","code":"data(\"diabetesData\") # Test with random effect for patient on a pairwise combination of cell # types. spicy(diabetesData, condition = \"stage\", subject = \"case\", from = \"Tc\", to = \"Th\" ) #> #> Number of cell type pairs: 1 #> Number of differentially localised cell type pairs: #> [1] 0 # Test all pairwise combinations of cell types without random effect of # patient. if (FALSE) { # \\dontrun{ spicyTest <- spicy(diabetesData, condition = \"stage\", subject = \"case\") } # } # Test all pairwise combination of cell types with random effect of patient. if (FALSE) { # \\dontrun{ spicy(diabetesData, condition = \"condition\", subject = \"subject\") } # }"},{"path":"https://sydneybiox.github.io/spicyR/reference/spicyBoxPlot.html","id":null,"dir":"Reference","previous_headings":"","what":"Plots boxplot for a specified cell-cell relationship — spicyBoxPlot","title":"Plots boxplot for a specified cell-cell relationship — spicyBoxPlot","text":"Plots boxplot specified cell-cell relationship","code":""},{"path":"https://sydneybiox.github.io/spicyR/reference/spicyBoxPlot.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Plots boxplot for a specified cell-cell relationship — spicyBoxPlot","text":"","code":"spicyBoxPlot(results, from = NULL, to = NULL, rank = NULL)"},{"path":"https://sydneybiox.github.io/spicyR/reference/spicyBoxPlot.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Plots boxplot for a specified cell-cell relationship — spicyBoxPlot","text":"results Data frame obtained spicy. Cell type like compare cell type. Cell type like compare cell type. rank Ranking cell type terms p-value, smaller p-value higher rank.","code":""},{"path":"https://sydneybiox.github.io/spicyR/reference/spicyBoxPlot.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Plots boxplot for a specified cell-cell relationship — spicyBoxPlot","text":"ggplot2 boxplot","code":""},{"path":"https://sydneybiox.github.io/spicyR/reference/spicyBoxPlot.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Plots boxplot for a specified cell-cell relationship — spicyBoxPlot","text":"","code":"data(spicyTest) spicyBoxPlot(spicyTest, rank = 1) #> Warning: Removed 53 rows containing non-finite outside the scale range #> (`stat_boxplot()`)."},{"path":"https://sydneybiox.github.io/spicyR/reference/spicyTest.html","id":null,"dir":"Reference","previous_headings":"","what":"Results from spicy for diabetesData — spicyTest","title":"Results from spicy for diabetesData — spicyTest","text":"Results call: spicyTest <- spicy(diabetesData, condition = \"condition\", subject = \"subject\")","code":""},{"path":"https://sydneybiox.github.io/spicyR/reference/spicyTest.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Results from spicy for diabetesData — spicyTest","text":"","code":"data(\"spicyTest\")"},{"path":"https://sydneybiox.github.io/spicyR/reference/spicyTest.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"Results from spicy for diabetesData — spicyTest","text":"spicyTest spicy object","code":""},{"path":"https://sydneybiox.github.io/spicyR/reference/survBubble.html","id":null,"dir":"Reference","previous_headings":"","what":"Plots survival results from spicy. — survBubble","title":"Plots survival results from spicy. — survBubble","text":"Plots survival results spicy.","code":""},{"path":"https://sydneybiox.github.io/spicyR/reference/survBubble.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Plots survival results from spicy. — survBubble","text":"","code":"survBubble( result, fdr = FALSE, cutoff = 0.05, colourGradient = c(\"#4575B4\", \"white\", \"#D73027\"), marksToPlot = NULL, contextColours = NULL, contextLabels = waiver() )"},{"path":"https://sydneybiox.github.io/spicyR/reference/survBubble.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Plots survival results from spicy. — survBubble","text":"result spicyResults object contains survival results. fdr TRUE FDR correction used. cutoff Significance threshold circles bubble plot. colourGradient vector colours, used define low, medium, high values colour scale. marksToPlot Vector marks include bubble plot. contextColours Used Kontextual results. named list specifying colours context. default Tableau colour palette used. contextLabels Used Kontextual results. named list change default labels context.","code":""},{"path":"https://sydneybiox.github.io/spicyR/reference/survBubble.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Plots survival results from spicy. — survBubble","text":"ggplot object.","code":""},{"path":"https://sydneybiox.github.io/spicyR/reference/topPairs.html","id":null,"dir":"Reference","previous_headings":"","what":"A table of the significant results from spicy tests — topPairs","title":"A table of the significant results from spicy tests — topPairs","text":"table significant results spicy tests","code":""},{"path":"https://sydneybiox.github.io/spicyR/reference/topPairs.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"A table of the significant results from spicy tests — topPairs","text":"","code":"topPairs(x, coef = NULL, n = 10, adj = \"fdr\", cutoff = NULL, figures = NULL)"},{"path":"https://sydneybiox.github.io/spicyR/reference/topPairs.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"A table of the significant results from spicy tests — topPairs","text":"x output spicy. coef coefficient list. n Extract top n significant pairs. adj p-value adjustment method use, argument p.adjust(). cutoff p-value threshold extract significant pairs. figures Round `figures` significant figures.","code":""},{"path":"https://sydneybiox.github.io/spicyR/reference/topPairs.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"A table of the significant results from spicy tests — topPairs","text":"data.frame","code":""},{"path":"https://sydneybiox.github.io/spicyR/reference/topPairs.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"A table of the significant results from spicy tests — topPairs","text":"","code":"data(spicyTest) topPairs(spicyTest) #> intercept coefficient p.value adj.pvalue #> beta__delta 1.815458e+02 -48.735693 0.0005033247 0.07169649 #> delta__beta 1.817943e+02 -48.166076 0.0005601288 0.07169649 #> B__unknown -3.606296e-15 11.770938 0.0052338392 0.42051606 #> delta__delta 2.089550e+02 -52.061196 0.0125129422 0.42051606 #> unknown__macrophage 1.007337e+01 -15.826919 0.0207410908 0.42051606 #> unknown__B -5.161932e-15 12.142848 0.0225855419 0.42051606 #> macrophage__unknown 1.004424e+01 -14.471666 0.0244668075 0.42051606 #> B__Th 1.571479e-15 26.847934 0.0245039854 0.42051606 #> otherimmune__naiveTc -9.292508e+00 33.584755 0.0255812944 0.42051606 #> ductal__ductal 1.481580e+01 -8.632569 0.0266935703 0.42051606 #> from to #> beta__delta beta delta #> delta__beta delta beta #> B__unknown B unknown #> delta__delta delta delta #> unknown__macrophage unknown macrophage #> unknown__B unknown B #> macrophage__unknown macrophage unknown #> B__Th B Th #> otherimmune__naiveTc otherimmune naiveTc #> ductal__ductal ductal ductal"}]