The goal of concordexR is to replace UMAP as a clustering diagnostic.
This package can be installed from Bioconductor since version 3.17 with
BiocManager::install("concordexR")
This is a basic example which shows you how to solve a common problem:
library(concordexR)
library(BiocNeighbors)
g <- findKNN(iris[, seq_len(4)], k = 10)
#> Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
#> detected tied distances to neighbors, see ?'BiocNeighbors-ties'
res <- calculateConcordex(g$index, labels = iris$Species, k = 10, return.map = TRUE)
plotConcordexSim(res)
heatConcordex(res)
sessionInfo()
#> R version 4.4.0 alpha (2024-03-27 r86216)
#> Platform: aarch64-apple-darwin20
#> Running under: macOS Ventura 13.6.5
#>
#> Matrix products: default
#> BLAS: /Library/Frameworks/R.framework/Versions/4.4-arm64/Resources/lib/libRblas.0.dylib
#> LAPACK: /Library/Frameworks/R.framework/Versions/4.4-arm64/Resources/lib/libRlapack.dylib; LAPACK version 3.12.0
#>
#> locale:
#> [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
#>
#> time zone: America/New_York
#> tzcode source: internal
#>
#> attached base packages:
#> [1] stats4 stats graphics grDevices utils datasets methods
#> [8] base
#>
#> other attached packages:
#> [1] patchwork_1.2.0 scater_1.32.0
#> [3] ggplot2_3.5.0 scuttle_1.14.0
#> [5] bluster_1.14.0 BiocNeighbors_1.22.0
#> [7] TENxPBMCData_1.21.0 HDF5Array_1.32.0
#> [9] rhdf5_2.48.0 DelayedArray_0.30.0
#> [11] SparseArray_1.4.0 S4Arrays_1.4.0
#> [13] abind_1.4-5 Matrix_1.7-0
#> [15] SingleCellExperiment_1.26.0 SummarizedExperiment_1.34.0
#> [17] Biobase_2.64.0 GenomicRanges_1.56.0
#> [19] GenomeInfoDb_1.40.0 IRanges_2.38.0
#> [21] S4Vectors_0.42.0 BiocGenerics_0.50.0
#> [23] MatrixGenerics_1.16.0 matrixStats_1.2.0
#> [25] concordexR_1.4.0 BiocStyle_2.32.0
#>
#> loaded via a namespace (and not attached):
#> [1] DBI_1.2.2 gridExtra_2.3
#> [3] rlang_1.1.3 magrittr_2.0.3
#> [5] compiler_4.4.0 RSQLite_2.3.5
#> [7] DelayedMatrixStats_1.26.0 png_0.1-8
#> [9] vctrs_0.6.5 pkgconfig_2.0.3
#> [11] crayon_1.5.2 fastmap_1.1.1
#> [13] magick_2.8.3 dbplyr_2.5.0
#> [15] XVector_0.44.0 labeling_0.4.3
#> [17] utf8_1.2.4 rmarkdown_2.26
#> [19] ggbeeswarm_0.7.2 UCSC.utils_1.0.0
#> [21] purrr_1.0.2 bit_4.0.5
#> [23] xfun_0.43 zlibbioc_1.50.0
#> [25] cachem_1.0.8 beachmat_2.20.0
#> [27] jsonlite_1.8.8 blob_1.2.4
#> [29] highr_0.10 rhdf5filters_1.16.0
#> [31] Rhdf5lib_1.26.0 BiocParallel_1.38.0
#> [33] irlba_2.3.5.1 parallel_4.4.0
#> [35] cluster_2.1.6 R6_2.5.1
#> [37] bslib_0.6.2 RColorBrewer_1.1-3
#> [39] jquerylib_0.1.4 Rcpp_1.0.12
#> [41] bookdown_0.38 knitr_1.45
#> [43] FNN_1.1.4 igraph_2.0.3
#> [45] tidyselect_1.2.1 viridis_0.6.5
#> [47] yaml_2.3.8 codetools_0.2-19
#> [49] curl_5.2.1 lattice_0.22-6
#> [51] tibble_3.2.1 withr_3.0.0
#> [53] KEGGREST_1.44.0 evaluate_0.23
#> [55] isoband_0.2.7 BiocFileCache_2.12.0
#> [57] ExperimentHub_2.12.0 Biostrings_2.72.0
#> [59] pillar_1.9.0 BiocManager_1.30.22
#> [61] filelock_1.0.3 generics_0.1.3
#> [63] BiocVersion_3.19.1 sparseMatrixStats_1.16.0
#> [65] munsell_0.5.0 scales_1.3.0
#> [67] glue_1.7.0 pheatmap_1.0.12
#> [69] tools_4.4.0 AnnotationHub_3.12.0
#> [71] ScaledMatrix_1.12.0 cowplot_1.1.3
#> [73] grid_4.4.0 AnnotationDbi_1.66.0
#> [75] colorspace_2.1-0 GenomeInfoDbData_1.2.12
#> [77] beeswarm_0.4.0 BiocSingular_1.20.0
#> [79] vipor_0.4.7 rsvd_1.0.5
#> [81] cli_3.6.2 rappdirs_0.3.3
#> [83] fansi_1.0.6 viridisLite_0.4.2
#> [85] dplyr_1.1.4 uwot_0.1.16
#> [87] gtable_0.3.4 sass_0.4.9
#> [89] digest_0.6.35 ggrepel_0.9.5
#> [91] farver_2.1.1 memoise_2.0.1
#> [93] htmltools_0.5.8 lifecycle_1.0.4
#> [95] httr_1.4.7 mime_0.12
#> [97] MASS_7.3-60.2 bit64_4.0.5