Skip to contents

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.

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")

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
#> downloading 1 resources
#> retrieving 1 resource
#> loading from cache
#> require("SpatialFeatureExperiment")
res <- calculateConcordex(sfe, labels=colData(sfe)[["in_tissue"]])

SessionInfo

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] stats     graphics  grDevices utils     datasets  methods   base     
#> 
#> other attached packages:
#> [1] SpatialFeatureExperiment_1.6.1 SFEData_1.6.0                 
#> [3] concordexR_1.5.6               BiocStyle_2.32.1              
#> 
#> loaded via a namespace (and not attached):
#>   [1] wk_0.9.4                    jsonlite_1.8.9             
#>   [3] magrittr_2.0.3              magick_2.8.5               
#>   [5] rmarkdown_2.29              fs_1.6.5                   
#>   [7] zlibbioc_1.50.0             ragg_1.3.3                 
#>   [9] vctrs_0.6.5                 spdep_1.3-6                
#>  [11] memoise_2.0.1               DelayedMatrixStats_1.26.0  
#>  [13] RCurl_1.98-1.16             terra_1.7-83               
#>  [15] htmltools_0.5.8.1           S4Arrays_1.4.1             
#>  [17] AnnotationHub_3.12.0        curl_6.0.0                 
#>  [19] BiocNeighbors_1.22.0        s2_1.1.7                   
#>  [21] Rhdf5lib_1.26.0             SparseArray_1.4.8          
#>  [23] rhdf5_2.48.0                spData_2.3.3               
#>  [25] sass_0.4.9                  KernSmooth_2.23-24         
#>  [27] bslib_0.8.0                 htmlwidgets_1.6.4          
#>  [29] desc_1.4.3                  cachem_1.1.0               
#>  [31] igraph_2.1.1                mime_0.12                  
#>  [33] lifecycle_1.0.4             pkgconfig_2.0.3            
#>  [35] Matrix_1.7-1                R6_2.5.1                   
#>  [37] fastmap_1.2.0               GenomeInfoDbData_1.2.12    
#>  [39] MatrixGenerics_1.16.0       digest_0.6.37              
#>  [41] AnnotationDbi_1.66.0        S4Vectors_0.42.1           
#>  [43] dqrng_0.4.1                 ExperimentHub_2.12.0       
#>  [45] textshaping_0.4.0           GenomicRanges_1.56.2       
#>  [47] RSQLite_2.3.7               beachmat_2.20.0            
#>  [49] filelock_1.0.3              fansi_1.0.6                
#>  [51] httr_1.4.7                  abind_1.4-8                
#>  [53] compiler_4.4.2              proxy_0.4-27               
#>  [55] bit64_4.5.2                 withr_3.0.2                
#>  [57] tiff_0.1-12                 BiocParallel_1.38.0        
#>  [59] DBI_1.2.3                   HDF5Array_1.32.1           
#>  [61] R.utils_2.12.3              rappdirs_0.3.3             
#>  [63] DelayedArray_0.30.1         rjson_0.2.23               
#>  [65] classInt_0.4-10             bluster_1.14.0             
#>  [67] tools_4.4.2                 units_0.8-5                
#>  [69] R.oo_1.27.0                 glue_1.8.0                 
#>  [71] EBImage_4.46.0              rhdf5filters_1.16.0        
#>  [73] grid_4.4.2                  sf_1.0-19                  
#>  [75] cluster_2.1.6               generics_0.1.3             
#>  [77] R.methodsS3_1.8.2           class_7.3-22               
#>  [79] data.table_1.16.2           sp_2.1-4                   
#>  [81] utf8_1.2.4                  XVector_0.44.0             
#>  [83] BiocGenerics_0.50.0         BiocVersion_3.19.1         
#>  [85] pillar_1.9.0                limma_3.60.6               
#>  [87] dplyr_1.1.4                 BiocFileCache_2.12.0       
#>  [89] lattice_0.22-6              deldir_2.0-4               
#>  [91] bit_4.5.0                   tidyselect_1.2.1           
#>  [93] SingleCellExperiment_1.26.0 locfit_1.5-9.10            
#>  [95] Biostrings_2.72.1           scuttle_1.14.0             
#>  [97] sfheaders_0.4.4             knitr_1.49                 
#>  [99] bookdown_0.41               IRanges_2.38.1             
#> [101] edgeR_4.2.2                 SummarizedExperiment_1.34.0
#> [103] stats4_4.4.2                xfun_0.49                  
#> [105] Biobase_2.64.0              statmod_1.5.0              
#> [107] DropletUtils_1.24.0         matrixStats_1.4.1          
#> [109] UCSC.utils_1.0.0            fftwtools_0.9-11           
#> [111] boot_1.3-31                 yaml_2.3.10                
#> [113] evaluate_1.0.1              codetools_0.2-20           
#> [115] tibble_3.2.1                BiocManager_1.30.25        
#> [117] cli_3.6.3                   systemfonts_1.1.0          
#> [119] jquerylib_0.1.4             Rcpp_1.0.13-1              
#> [121] GenomeInfoDb_1.40.1         zeallot_0.1.0              
#> [123] dbplyr_2.5.0                png_0.1-8                  
#> [125] parallel_4.4.2              pkgdown_2.1.1              
#> [127] blob_1.2.4                  jpeg_0.1-10                
#> [129] sparseMatrixStats_1.16.0    bitops_1.0-9               
#> [131] SpatialExperiment_1.14.0    e1071_1.7-16               
#> [133] purrr_1.0.2                 crayon_1.5.3               
#> [135] rlang_1.1.4                 KEGGREST_1.44.1