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.3.0 RC (2023-04-13 r84269)
#> Platform: x86_64-pc-linux-gnu (64-bit)
#> Running under: Ubuntu 22.04.2 LTS
#>
#> Matrix products: default
#> BLAS: /home/biocbuild/bbs-3.17-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] patchwork_1.1.2 scater_1.28.0
#> [3] ggplot2_3.4.2 scuttle_1.10.0
#> [5] bluster_1.10.0 BiocNeighbors_1.18.0
#> [7] TENxPBMCData_1.17.0 HDF5Array_1.28.0
#> [9] rhdf5_2.44.0 DelayedArray_0.26.0
#> [11] Matrix_1.5-4 SingleCellExperiment_1.22.0
#> [13] SummarizedExperiment_1.30.0 Biobase_2.60.0
#> [15] GenomicRanges_1.52.0 GenomeInfoDb_1.36.0
#> [17] IRanges_2.34.0 S4Vectors_0.38.0
#> [19] BiocGenerics_0.46.0 MatrixGenerics_1.12.0
#> [21] matrixStats_0.63.0 concordexR_1.0.0
#> [23] BiocStyle_2.28.0
#>
#> loaded via a namespace (and not attached):
#> [1] DBI_1.1.3 bitops_1.0-7
#> [3] gridExtra_2.3 rlang_1.1.0
#> [5] magrittr_2.0.3 compiler_4.3.0
#> [7] RSQLite_2.3.1 DelayedMatrixStats_1.22.0
#> [9] png_0.1-8 vctrs_0.6.2
#> [11] pkgconfig_2.0.3 crayon_1.5.2
#> [13] fastmap_1.1.1 magick_2.7.4
#> [15] dbplyr_2.3.2 XVector_0.40.0
#> [17] ellipsis_0.3.2 labeling_0.4.2
#> [19] utf8_1.2.3 promises_1.2.0.1
#> [21] rmarkdown_2.21 ggbeeswarm_0.7.1
#> [23] purrr_1.0.1 bit_4.0.5
#> [25] xfun_0.39 zlibbioc_1.46.0
#> [27] cachem_1.0.7 beachmat_2.16.0
#> [29] jsonlite_1.8.4 blob_1.2.4
#> [31] highr_0.10 later_1.3.0
#> [33] rhdf5filters_1.12.0 Rhdf5lib_1.22.0
#> [35] BiocParallel_1.34.0 interactiveDisplayBase_1.38.0
#> [37] irlba_2.3.5.1 parallel_4.3.0
#> [39] cluster_2.1.4 R6_2.5.1
#> [41] bslib_0.4.2 RColorBrewer_1.1-3
#> [43] jquerylib_0.1.4 Rcpp_1.0.10
#> [45] bookdown_0.33 knitr_1.42
#> [47] FNN_1.1.3.2 httpuv_1.6.9
#> [49] igraph_1.4.2 tidyselect_1.2.0
#> [51] viridis_0.6.2 yaml_2.3.7
#> [53] codetools_0.2-19 curl_5.0.0
#> [55] lattice_0.21-8 tibble_3.2.1
#> [57] withr_2.5.0 shiny_1.7.4
#> [59] KEGGREST_1.40.0 evaluate_0.20
#> [61] isoband_0.2.7 BiocFileCache_2.8.0
#> [63] ExperimentHub_2.8.0 Biostrings_2.68.0
#> [65] pillar_1.9.0 BiocManager_1.30.20
#> [67] filelock_1.0.2 generics_0.1.3
#> [69] RCurl_1.98-1.12 BiocVersion_3.17.1
#> [71] sparseMatrixStats_1.12.0 munsell_0.5.0
#> [73] scales_1.2.1 xtable_1.8-4
#> [75] glue_1.6.2 pheatmap_1.0.12
#> [77] tools_4.3.0 AnnotationHub_3.8.0
#> [79] ScaledMatrix_1.8.0 cowplot_1.1.1
#> [81] grid_4.3.0 AnnotationDbi_1.62.0
#> [83] colorspace_2.1-0 GenomeInfoDbData_1.2.10
#> [85] beeswarm_0.4.0 BiocSingular_1.16.0
#> [87] vipor_0.4.5 rsvd_1.0.5
#> [89] cli_3.6.1 rappdirs_0.3.3
#> [91] fansi_1.0.4 viridisLite_0.4.1
#> [93] dplyr_1.1.2 uwot_0.1.14
#> [95] gtable_0.3.3 sass_0.4.5
#> [97] digest_0.6.31 ggrepel_0.9.3
#> [99] farver_2.1.1 memoise_2.0.1
#> [101] htmltools_0.5.5 lifecycle_1.0.3
#> [103] httr_1.4.5 mime_0.12
#> [105] MASS_7.3-59 bit64_4.0.5