The goal of concordexR is to identify spatial homogeneous regions (SHRs) as defined in the recent manuscrpt“Identification of spatial homogenous regions in tissues with concordex”. Briefly, SHRs are are domains that are homogeneous with respect to cell type composition. concordex relies on the the k-nearest-neighbor (kNN) graph to representing similarities between cells and uses common clustering algorithms to identify SHRs.

0.1 Installation

This package is under active development will be available in the Bioconductor version 3.20 release.

Until then, please install the package from Github or from the Bioconductor devel branch.

if (!requireNamespace("BiocManager", quietly=TRUE))
    install.packages("BiocManager")

#BiocManager::install("concordexR", version="devel")
devtools::install_github("pachterlab/concordexR")

0.2 Example of main functionality

This is a basic example which shows you how to solve a common problem:

library(concordexR)
library(SFEData)

sfe <- McKellarMuscleData("small")
#> see ?SFEData and browseVignettes('SFEData') for documentation
#> loading from cache
#> require("SpatialFeatureExperiment")
res <- calculateConcordex(sfe, labels=colData(sfe)[["in_tissue"]])

0.3 SessionInfo

sessionInfo()
#> R version 4.4.1 (2024-06-14)
#> Platform: x86_64-pc-linux-gnu
#> Running under: Ubuntu 22.04.4 LTS
#> 
#> Matrix products: default
#> BLAS:   /home/biocbuild/bbs-3.20-bioc/R/lib/libRblas.so 
#> LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.10.0
#> 
#> locale:
#>  [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
#>  [3] LC_TIME=en_GB              LC_COLLATE=C              
#>  [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8   
#>  [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                 
#>  [9] LC_ADDRESS=C               LC_TELEPHONE=C            
#> [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       
#> 
#> time zone: America/New_York
#> tzcode source: system (glibc)
#> 
#> attached base packages:
#> [1] stats4    stats     graphics  grDevices utils     datasets  methods  
#> [8] base     
#> 
#> other attached packages:
#>  [1] SpatialFeatureExperiment_1.7.1 SFEData_1.7.0                 
#>  [3] patchwork_1.2.0                scater_1.33.4                 
#>  [5] ggplot2_3.5.1                  scuttle_1.15.2                
#>  [7] bluster_1.15.0                 BiocNeighbors_1.23.0          
#>  [9] TENxPBMCData_1.23.0            HDF5Array_1.33.5              
#> [11] rhdf5_2.49.0                   DelayedArray_0.31.9           
#> [13] SparseArray_1.5.25             S4Arrays_1.5.5                
#> [15] abind_1.4-5                    Matrix_1.7-0                  
#> [17] SingleCellExperiment_1.27.2    SummarizedExperiment_1.35.1   
#> [19] Biobase_2.65.0                 GenomicRanges_1.57.1          
#> [21] GenomeInfoDb_1.41.1            IRanges_2.39.2                
#> [23] S4Vectors_0.43.2               BiocGenerics_0.51.0           
#> [25] MatrixGenerics_1.17.0          matrixStats_1.3.0             
#> [27] concordexR_1.5.5               BiocStyle_2.33.1              
#> 
#> loaded via a namespace (and not attached):
#>   [1] bitops_1.0-7              filelock_1.0.3           
#>   [3] tibble_3.2.1              R.oo_1.26.0              
#>   [5] lifecycle_1.0.4           sf_1.0-16                
#>   [7] edgeR_4.3.5               lattice_0.22-6           
#>   [9] MASS_7.3-61               magrittr_2.0.3           
#>  [11] limma_3.61.5              sass_0.4.9               
#>  [13] rmarkdown_2.27            jquerylib_0.1.4          
#>  [15] yaml_2.3.9                sp_2.1-4                 
#>  [17] cowplot_1.1.3             DBI_1.2.3                
#>  [19] zlibbioc_1.51.1           purrr_1.0.2              
#>  [21] R.utils_2.12.3            RCurl_1.98-1.16          
#>  [23] rappdirs_0.3.3            GenomeInfoDbData_1.2.12  
#>  [25] ggrepel_0.9.5             irlba_2.3.5.1            
#>  [27] terra_1.7-78              units_0.8-5              
#>  [29] dqrng_0.4.1               DelayedMatrixStats_1.27.2
#>  [31] codetools_0.2-20          DropletUtils_1.25.2      
#>  [33] tidyselect_1.2.1          UCSC.utils_1.1.0         
#>  [35] farver_2.1.2              ScaledMatrix_1.13.0      
#>  [37] viridis_0.6.5             BiocFileCache_2.13.0     
#>  [39] jsonlite_1.8.8            e1071_1.7-14             
#>  [41] tools_4.4.1               Rcpp_1.0.13              
#>  [43] glue_1.7.0                gridExtra_2.3            
#>  [45] xfun_0.46                 EBImage_4.47.0           
#>  [47] dplyr_1.1.4               withr_3.0.0              
#>  [49] BiocManager_1.30.23       fastmap_1.2.0            
#>  [51] boot_1.3-30               rhdf5filters_1.17.0      
#>  [53] fansi_1.0.6               spData_2.3.1             
#>  [55] digest_0.6.36             rsvd_1.0.5               
#>  [57] R6_2.5.1                  mime_0.12                
#>  [59] wk_0.9.2                  colorspace_2.1-0         
#>  [61] jpeg_0.1-10               RSQLite_2.3.7            
#>  [63] R.methodsS3_1.8.2         utf8_1.2.4               
#>  [65] generics_0.1.3            data.table_1.15.4        
#>  [67] FNN_1.1.4                 class_7.3-22             
#>  [69] httr_1.4.7                htmlwidgets_1.6.4        
#>  [71] spdep_1.3-5               uwot_0.2.2               
#>  [73] pkgconfig_2.0.3           gtable_0.3.5             
#>  [75] blob_1.2.4                XVector_0.45.0           
#>  [77] htmltools_0.5.8.1         bookdown_0.40            
#>  [79] fftwtools_0.9-11          scales_1.3.0             
#>  [81] png_0.1-8                 SpatialExperiment_1.15.1 
#>  [83] knitr_1.48                rjson_0.2.21             
#>  [85] curl_5.2.1                proxy_0.4-27             
#>  [87] cachem_1.1.0              BiocVersion_3.20.0       
#>  [89] KernSmooth_2.23-24        parallel_4.4.1           
#>  [91] vipor_0.4.7               AnnotationDbi_1.67.0     
#>  [93] s2_1.1.7                  pillar_1.9.0             
#>  [95] grid_4.4.1                vctrs_0.6.5              
#>  [97] BiocSingular_1.21.2       dbplyr_2.5.0             
#>  [99] beachmat_2.21.4           sfheaders_0.4.4          
#> [101] cluster_2.1.6             beeswarm_0.4.0           
#> [103] evaluate_0.24.0           zeallot_0.1.0            
#> [105] isoband_0.2.7             tinytex_0.52             
#> [107] magick_2.8.4              cli_3.6.3                
#> [109] locfit_1.5-9.10           compiler_4.4.1           
#> [111] rlang_1.1.4               crayon_1.5.3             
#> [113] labeling_0.4.3            classInt_0.4-10          
#> [115] ggbeeswarm_0.7.2          viridisLite_0.4.2        
#> [117] deldir_2.0-4              BiocParallel_1.39.0      
#> [119] munsell_0.5.1             Biostrings_2.73.1        
#> [121] tiff_0.1-12               ExperimentHub_2.13.0     
#> [123] sparseMatrixStats_1.17.2  bit64_4.0.5              
#> [125] Rhdf5lib_1.27.0           KEGGREST_1.45.1          
#> [127] statmod_1.5.0             highr_0.11               
#> [129] AnnotationHub_3.13.0      igraph_2.0.3             
#> [131] memoise_2.0.1             bslib_0.7.0              
#> [133] bit_4.0.5