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