Date: 2019-12-25 20:49:38 CET, cola version: 1.3.2
Document is loading...
All available functions which can be applied to this res_list
object:
res_list
#> A 'ConsensusPartitionList' object with 24 methods.
#> On a matrix with 51941 rows and 58 columns.
#> Top rows are extracted by 'SD, CV, MAD, ATC' methods.
#> Subgroups are detected by 'hclust, kmeans, skmeans, pam, mclust, NMF' method.
#> Number of partitions are tried for k = 2, 3, 4, 5, 6.
#> Performed in total 30000 partitions by row resampling.
#>
#> Following methods can be applied to this 'ConsensusPartitionList' object:
#> [1] "cola_report" "collect_classes" "collect_plots" "collect_stats"
#> [5] "colnames" "functional_enrichment" "get_anno_col" "get_anno"
#> [9] "get_classes" "get_matrix" "get_membership" "get_stats"
#> [13] "is_best_k" "is_stable_k" "ncol" "nrow"
#> [17] "rownames" "show" "suggest_best_k" "test_to_known_factors"
#> [21] "top_rows_heatmap" "top_rows_overlap"
#>
#> You can get result for a single method by, e.g. object["SD", "hclust"] or object["SD:hclust"]
#> or a subset of methods by object[c("SD", "CV")], c("hclust", "kmeans")]
The call of run_all_consensus_partition_methods()
was:
#> run_all_consensus_partition_methods(data = mat, mc.cores = 4, anno = anno)
Dimension of the input matrix:
mat = get_matrix(res_list)
dim(mat)
#> [1] 51941 58
The density distribution for each sample is visualized as in one column in the following heatmap. The clustering is based on the distance which is the Kolmogorov-Smirnov statistic between two distributions.
library(ComplexHeatmap)
densityHeatmap(mat, top_annotation = HeatmapAnnotation(df = get_anno(res_list),
col = get_anno_col(res_list)), ylab = "value", cluster_columns = TRUE, show_column_names = FALSE,
mc.cores = 4)
Folowing table shows the best k
(number of partitions) for each combination
of top-value methods and partition methods. Clicking on the method name in
the table goes to the section for a single combination of methods.
The cola vignette explains the definition of the metrics used for determining the best number of partitions.
suggest_best_k(res_list)
The best k | 1-PAC | Mean silhouette | Concordance | Optional k | ||
---|---|---|---|---|---|---|
SD:skmeans | 2 | 1.000 | 0.973 | 0.988 | ** | |
SD:pam | 2 | 1.000 | 0.965 | 0.986 | ** | |
CV:kmeans | 2 | 1.000 | 0.975 | 0.989 | ** | |
CV:skmeans | 2 | 1.000 | 0.985 | 0.994 | ** | |
MAD:skmeans | 2 | 1.000 | 0.958 | 0.984 | ** | |
ATC:mclust | 2 | 1.000 | 1.000 | 1.000 | ** | |
MAD:pam | 2 | 0.999 | 0.957 | 0.982 | ** | |
CV:NMF | 2 | 0.997 | 0.966 | 0.985 | ** | |
ATC:skmeans | 3 | 0.968 | 0.913 | 0.963 | ** | 2 |
MAD:kmeans | 2 | 0.964 | 0.946 | 0.979 | ** | |
SD:NMF | 2 | 0.963 | 0.943 | 0.976 | ** | |
SD:kmeans | 3 | 0.956 | 0.891 | 0.943 | ** | |
ATC:pam | 2 | 0.928 | 0.919 | 0.970 | * | |
MAD:NMF | 2 | 0.893 | 0.931 | 0.971 | ||
SD:mclust | 2 | 0.863 | 0.864 | 0.948 | ||
ATC:kmeans | 3 | 0.805 | 0.906 | 0.952 | ||
ATC:NMF | 2 | 0.664 | 0.869 | 0.934 | ||
CV:mclust | 2 | 0.624 | 0.842 | 0.930 | ||
ATC:hclust | 3 | 0.580 | 0.668 | 0.861 | ||
MAD:mclust | 4 | 0.507 | 0.613 | 0.787 | ||
CV:pam | 3 | 0.500 | 0.762 | 0.867 | ||
CV:hclust | 2 | 0.428 | 0.683 | 0.868 | ||
SD:hclust | 2 | 0.323 | 0.694 | 0.856 | ||
MAD:hclust | 2 | 0.308 | 0.790 | 0.875 |
**: 1-PAC > 0.95, *: 1-PAC > 0.9
Cumulative distribution function curves of consensus matrix for all methods.
collect_plots(res_list, fun = plot_ecdf)
Consensus heatmaps for all methods. (What is a consensus heatmap?)
collect_plots(res_list, k = 2, fun = consensus_heatmap, mc.cores = 4)
collect_plots(res_list, k = 3, fun = consensus_heatmap, mc.cores = 4)
collect_plots(res_list, k = 4, fun = consensus_heatmap, mc.cores = 4)
collect_plots(res_list, k = 5, fun = consensus_heatmap, mc.cores = 4)
collect_plots(res_list, k = 6, fun = consensus_heatmap, mc.cores = 4)
Membership heatmaps for all methods. (What is a membership heatmap?)
collect_plots(res_list, k = 2, fun = membership_heatmap, mc.cores = 4)
collect_plots(res_list, k = 3, fun = membership_heatmap, mc.cores = 4)
collect_plots(res_list, k = 4, fun = membership_heatmap, mc.cores = 4)
collect_plots(res_list, k = 5, fun = membership_heatmap, mc.cores = 4)
collect_plots(res_list, k = 6, fun = membership_heatmap, mc.cores = 4)
Signature heatmaps for all methods. (What is a signature heatmap?)
Note in following heatmaps, rows are scaled.
collect_plots(res_list, k = 2, fun = get_signatures, mc.cores = 4)
collect_plots(res_list, k = 3, fun = get_signatures, mc.cores = 4)
collect_plots(res_list, k = 4, fun = get_signatures, mc.cores = 4)
collect_plots(res_list, k = 5, fun = get_signatures, mc.cores = 4)
collect_plots(res_list, k = 6, fun = get_signatures, mc.cores = 4)
The statistics used for measuring the stability of consensus partitioning. (How are they defined?)
get_stats(res_list, k = 2)
#> k 1-PAC mean_silhouette concordance area_increased Rand Jaccard
#> SD:NMF 2 0.963 0.943 0.976 0.463 0.540 0.540
#> CV:NMF 2 0.997 0.966 0.985 0.454 0.552 0.552
#> MAD:NMF 2 0.893 0.931 0.971 0.494 0.506 0.506
#> ATC:NMF 2 0.664 0.869 0.934 0.462 0.530 0.530
#> SD:skmeans 2 1.000 0.973 0.988 0.493 0.506 0.506
#> CV:skmeans 2 1.000 0.985 0.994 0.493 0.506 0.506
#> MAD:skmeans 2 1.000 0.958 0.984 0.504 0.494 0.494
#> ATC:skmeans 2 1.000 1.000 1.000 0.509 0.491 0.491
#> SD:mclust 2 0.863 0.864 0.948 0.454 0.530 0.530
#> CV:mclust 2 0.624 0.842 0.930 0.475 0.513 0.513
#> MAD:mclust 2 0.402 0.795 0.862 0.391 0.578 0.578
#> ATC:mclust 2 1.000 1.000 1.000 0.132 0.869 0.869
#> SD:kmeans 2 0.833 0.935 0.971 0.426 0.578 0.578
#> CV:kmeans 2 1.000 0.975 0.989 0.405 0.593 0.593
#> MAD:kmeans 2 0.964 0.946 0.979 0.486 0.513 0.513
#> ATC:kmeans 2 0.617 0.823 0.928 0.480 0.501 0.501
#> SD:pam 2 1.000 0.965 0.986 0.397 0.610 0.610
#> CV:pam 2 0.896 0.946 0.977 0.386 0.627 0.627
#> MAD:pam 2 0.999 0.957 0.982 0.472 0.521 0.521
#> ATC:pam 2 0.928 0.919 0.970 0.504 0.494 0.494
#> SD:hclust 2 0.323 0.694 0.856 0.454 0.491 0.491
#> CV:hclust 2 0.428 0.683 0.868 0.462 0.501 0.501
#> MAD:hclust 2 0.308 0.790 0.875 0.467 0.501 0.501
#> ATC:hclust 2 0.576 0.861 0.927 0.418 0.610 0.610
get_stats(res_list, k = 3)
#> k 1-PAC mean_silhouette concordance area_increased Rand Jaccard
#> SD:NMF 3 0.875 0.878 0.947 0.442 0.700 0.486
#> CV:NMF 3 0.684 0.832 0.916 0.471 0.696 0.488
#> MAD:NMF 3 0.514 0.597 0.805 0.358 0.756 0.548
#> ATC:NMF 3 0.452 0.695 0.846 0.288 0.670 0.465
#> SD:skmeans 3 0.868 0.910 0.950 0.362 0.705 0.477
#> CV:skmeans 3 0.837 0.859 0.937 0.360 0.705 0.477
#> MAD:skmeans 3 0.673 0.634 0.862 0.327 0.758 0.545
#> ATC:skmeans 3 0.968 0.913 0.963 0.174 0.907 0.810
#> SD:mclust 3 0.554 0.762 0.852 0.368 0.826 0.688
#> CV:mclust 3 0.474 0.700 0.759 0.313 0.867 0.749
#> MAD:mclust 3 0.466 0.544 0.778 0.654 0.691 0.493
#> ATC:mclust 3 0.399 0.676 0.804 2.861 0.564 0.499
#> SD:kmeans 3 0.956 0.891 0.943 0.543 0.704 0.511
#> CV:kmeans 3 0.703 0.869 0.922 0.597 0.672 0.484
#> MAD:kmeans 3 0.720 0.851 0.918 0.368 0.666 0.434
#> ATC:kmeans 3 0.805 0.906 0.952 0.352 0.666 0.432
#> SD:pam 3 0.729 0.858 0.927 0.633 0.721 0.549
#> CV:pam 3 0.500 0.762 0.867 0.655 0.686 0.510
#> MAD:pam 3 0.865 0.886 0.954 0.380 0.682 0.465
#> ATC:pam 3 0.830 0.885 0.953 0.267 0.718 0.502
#> SD:hclust 3 0.392 0.642 0.786 0.363 0.735 0.530
#> CV:hclust 3 0.385 0.653 0.779 0.356 0.676 0.438
#> MAD:hclust 3 0.341 0.689 0.799 0.329 0.879 0.758
#> ATC:hclust 3 0.580 0.668 0.861 0.522 0.704 0.524
get_stats(res_list, k = 4)
#> k 1-PAC mean_silhouette concordance area_increased Rand Jaccard
#> SD:NMF 4 0.776 0.871 0.915 0.1347 0.854 0.592
#> CV:NMF 4 0.738 0.853 0.904 0.1341 0.857 0.603
#> MAD:NMF 4 0.609 0.667 0.826 0.1242 0.792 0.472
#> ATC:NMF 4 0.474 0.703 0.829 0.0576 0.950 0.874
#> SD:skmeans 4 0.737 0.691 0.826 0.1173 0.861 0.613
#> CV:skmeans 4 0.700 0.640 0.734 0.1215 0.818 0.515
#> MAD:skmeans 4 0.796 0.799 0.897 0.1234 0.833 0.550
#> ATC:skmeans 4 0.786 0.834 0.914 0.0865 0.964 0.910
#> SD:mclust 4 0.557 0.755 0.791 0.0969 0.962 0.908
#> CV:mclust 4 0.630 0.747 0.832 0.1606 0.754 0.462
#> MAD:mclust 4 0.507 0.613 0.787 0.1394 0.851 0.593
#> ATC:mclust 4 0.793 0.850 0.915 0.3504 0.672 0.388
#> SD:kmeans 4 0.679 0.653 0.799 0.1257 0.895 0.720
#> CV:kmeans 4 0.674 0.657 0.799 0.1400 0.920 0.780
#> MAD:kmeans 4 0.630 0.660 0.792 0.1261 0.863 0.617
#> ATC:kmeans 4 0.646 0.694 0.842 0.1239 0.768 0.439
#> SD:pam 4 0.623 0.690 0.805 0.1020 0.923 0.787
#> CV:pam 4 0.550 0.699 0.812 0.1268 0.909 0.741
#> MAD:pam 4 0.817 0.771 0.900 0.1118 0.873 0.662
#> ATC:pam 4 0.806 0.843 0.919 0.1096 0.889 0.711
#> SD:hclust 4 0.510 0.492 0.717 0.1738 0.758 0.453
#> CV:hclust 4 0.523 0.594 0.773 0.1471 0.838 0.571
#> MAD:hclust 4 0.509 0.515 0.717 0.1665 0.872 0.673
#> ATC:hclust 4 0.642 0.701 0.836 0.0876 0.858 0.642
get_stats(res_list, k = 5)
#> k 1-PAC mean_silhouette concordance area_increased Rand Jaccard
#> SD:NMF 5 0.811 0.800 0.896 0.0681 0.880 0.565
#> CV:NMF 5 0.879 0.843 0.919 0.0689 0.921 0.694
#> MAD:NMF 5 0.716 0.663 0.818 0.0676 0.883 0.587
#> ATC:NMF 5 0.424 0.423 0.723 0.0640 0.860 0.684
#> SD:skmeans 5 0.772 0.730 0.848 0.0656 0.866 0.539
#> CV:skmeans 5 0.763 0.775 0.859 0.0644 0.929 0.722
#> MAD:skmeans 5 0.699 0.583 0.767 0.0641 0.967 0.869
#> ATC:skmeans 5 0.749 0.701 0.877 0.0641 0.967 0.913
#> SD:mclust 5 0.580 0.517 0.708 0.1311 0.745 0.391
#> CV:mclust 5 0.752 0.803 0.891 0.0683 0.800 0.416
#> MAD:mclust 5 0.577 0.502 0.712 0.0699 0.909 0.675
#> ATC:mclust 5 0.761 0.817 0.900 0.1217 0.886 0.651
#> SD:kmeans 5 0.677 0.525 0.748 0.0751 0.877 0.605
#> CV:kmeans 5 0.684 0.606 0.761 0.0677 0.878 0.610
#> MAD:kmeans 5 0.648 0.501 0.724 0.0691 0.978 0.913
#> ATC:kmeans 5 0.694 0.622 0.745 0.0639 0.848 0.508
#> SD:pam 5 0.687 0.747 0.836 0.0879 0.901 0.682
#> CV:pam 5 0.609 0.585 0.761 0.0787 0.855 0.547
#> MAD:pam 5 0.865 0.755 0.900 0.0542 0.938 0.786
#> ATC:pam 5 0.758 0.783 0.863 0.0992 0.863 0.577
#> SD:hclust 5 0.585 0.545 0.719 0.0759 0.840 0.491
#> CV:hclust 5 0.601 0.520 0.713 0.0749 0.915 0.691
#> MAD:hclust 5 0.577 0.499 0.697 0.0681 0.881 0.621
#> ATC:hclust 5 0.657 0.699 0.762 0.0780 0.853 0.567
get_stats(res_list, k = 6)
#> k 1-PAC mean_silhouette concordance area_increased Rand Jaccard
#> SD:NMF 6 0.827 0.763 0.863 0.0346 0.962 0.809
#> CV:NMF 6 0.817 0.653 0.840 0.0372 0.938 0.698
#> MAD:NMF 6 0.758 0.730 0.832 0.0412 0.869 0.460
#> ATC:NMF 6 0.420 0.461 0.667 0.0561 0.762 0.497
#> SD:skmeans 6 0.759 0.604 0.780 0.0371 0.967 0.842
#> CV:skmeans 6 0.734 0.617 0.779 0.0343 0.961 0.815
#> MAD:skmeans 6 0.679 0.484 0.698 0.0370 0.938 0.741
#> ATC:skmeans 6 0.758 0.736 0.872 0.0343 0.937 0.817
#> SD:mclust 6 0.736 0.526 0.743 0.0641 0.854 0.435
#> CV:mclust 6 0.785 0.656 0.812 0.0580 0.945 0.767
#> MAD:mclust 6 0.680 0.575 0.752 0.0499 0.877 0.518
#> ATC:mclust 6 0.724 0.703 0.814 0.0502 0.986 0.940
#> SD:kmeans 6 0.743 0.516 0.690 0.0440 0.862 0.441
#> CV:kmeans 6 0.721 0.621 0.738 0.0468 0.959 0.809
#> MAD:kmeans 6 0.673 0.434 0.685 0.0419 0.896 0.592
#> ATC:kmeans 6 0.821 0.840 0.873 0.0468 0.913 0.639
#> SD:pam 6 0.777 0.751 0.859 0.0562 0.904 0.608
#> CV:pam 6 0.688 0.460 0.673 0.0571 0.841 0.408
#> MAD:pam 6 0.826 0.734 0.888 0.0662 0.947 0.780
#> ATC:pam 6 0.830 0.671 0.822 0.0509 0.885 0.552
#> SD:hclust 6 0.664 0.511 0.699 0.0485 0.918 0.662
#> CV:hclust 6 0.685 0.505 0.724 0.0548 0.924 0.672
#> MAD:hclust 6 0.636 0.548 0.704 0.0574 0.862 0.496
#> ATC:hclust 6 0.730 0.597 0.746 0.0503 0.811 0.370
Following heatmap plots the partition for each combination of methods and the lightness correspond to the silhouette scores for samples in each method. On top the consensus subgroup is inferred from all methods by taking the mean silhouette scores as weight.
collect_stats(res_list, k = 2)
collect_stats(res_list, k = 3)
collect_stats(res_list, k = 4)
collect_stats(res_list, k = 5)
collect_stats(res_list, k = 6)
Collect partitions from all methods:
collect_classes(res_list, k = 2)
collect_classes(res_list, k = 3)
collect_classes(res_list, k = 4)
collect_classes(res_list, k = 5)
collect_classes(res_list, k = 6)
Overlap of top rows from different top-row methods:
top_rows_overlap(res_list, top_n = 1000, method = "euler")
top_rows_overlap(res_list, top_n = 2000, method = "euler")
top_rows_overlap(res_list, top_n = 3000, method = "euler")
top_rows_overlap(res_list, top_n = 4000, method = "euler")
top_rows_overlap(res_list, top_n = 5000, method = "euler")
Also visualize the correspondance of rankings between different top-row methods:
top_rows_overlap(res_list, top_n = 1000, method = "correspondance")
top_rows_overlap(res_list, top_n = 2000, method = "correspondance")
top_rows_overlap(res_list, top_n = 3000, method = "correspondance")
top_rows_overlap(res_list, top_n = 4000, method = "correspondance")
top_rows_overlap(res_list, top_n = 5000, method = "correspondance")
Heatmaps of the top rows:
top_rows_heatmap(res_list, top_n = 1000)
top_rows_heatmap(res_list, top_n = 2000)
top_rows_heatmap(res_list, top_n = 3000)
top_rows_heatmap(res_list, top_n = 4000)
top_rows_heatmap(res_list, top_n = 5000)
Test correlation between subgroups and known annotations. If the known annotation is numeric, one-way ANOVA test is applied, and if the known annotation is discrete, chi-squared contingency table test is applied.
test_to_known_factors(res_list, k = 2)
#> n disease.state(p) k
#> SD:NMF 56 1.38e-08 2
#> CV:NMF 57 9.33e-09 2
#> MAD:NMF 57 2.62e-07 2
#> ATC:NMF 56 7.29e-01 2
#> SD:skmeans 57 2.62e-07 2
#> CV:skmeans 58 1.83e-07 2
#> MAD:skmeans 56 1.11e-06 2
#> ATC:skmeans 58 7.77e-01 2
#> SD:mclust 51 7.01e-10 2
#> CV:mclust 54 7.96e-10 2
#> MAD:mclust 53 2.93e-10 2
#> ATC:mclust 58 7.72e-01 2
#> SD:kmeans 57 3.66e-10 2
#> CV:kmeans 57 2.94e-09 2
#> MAD:kmeans 56 3.31e-08 2
#> ATC:kmeans 53 4.29e-01 2
#> SD:pam 57 2.94e-09 2
#> CV:pam 57 2.15e-08 2
#> MAD:pam 57 5.56e-09 2
#> ATC:pam 55 1.00e+00 2
#> SD:hclust 49 1.44e-05 2
#> CV:hclust 47 1.68e-06 2
#> MAD:hclust 56 3.78e-07 2
#> ATC:hclust 58 9.20e-01 2
test_to_known_factors(res_list, k = 3)
#> n disease.state(p) k
#> SD:NMF 55 8.59e-10 3
#> CV:NMF 53 2.16e-10 3
#> MAD:NMF 45 1.33e-09 3
#> ATC:NMF 52 6.26e-01 3
#> SD:skmeans 56 2.05e-09 3
#> CV:skmeans 53 1.53e-09 3
#> MAD:skmeans 43 2.46e-08 3
#> ATC:skmeans 56 4.14e-01 3
#> SD:mclust 51 9.53e-10 3
#> CV:mclust 51 3.27e-07 3
#> MAD:mclust 32 1.22e-07 3
#> ATC:mclust 54 6.63e-01 3
#> SD:kmeans 55 2.79e-09 3
#> CV:kmeans 57 4.80e-09 3
#> MAD:kmeans 55 4.91e-10 3
#> ATC:kmeans 57 9.04e-01 3
#> SD:pam 55 2.36e-09 3
#> CV:pam 52 1.44e-08 3
#> MAD:pam 54 8.05e-09 3
#> ATC:pam 55 7.74e-01 3
#> SD:hclust 44 2.32e-07 3
#> CV:hclust 49 7.32e-09 3
#> MAD:hclust 51 3.49e-06 3
#> ATC:hclust 48 9.03e-01 3
test_to_known_factors(res_list, k = 4)
#> n disease.state(p) k
#> SD:NMF 56 3.40e-09 4
#> CV:NMF 56 2.17e-09 4
#> MAD:NMF 44 6.32e-07 4
#> ATC:NMF 51 5.63e-01 4
#> SD:skmeans 50 2.77e-08 4
#> CV:skmeans 41 2.91e-07 4
#> MAD:skmeans 52 6.98e-08 4
#> ATC:skmeans 53 1.25e-01 4
#> SD:mclust 55 5.44e-09 4
#> CV:mclust 55 2.22e-09 4
#> MAD:mclust 45 1.92e-07 4
#> ATC:mclust 53 6.61e-01 4
#> SD:kmeans 51 1.23e-08 4
#> CV:kmeans 50 8.37e-08 4
#> MAD:kmeans 48 6.18e-08 4
#> ATC:kmeans 46 1.76e-01 4
#> SD:pam 50 4.05e-08 4
#> CV:pam 52 5.05e-08 4
#> MAD:pam 47 1.37e-06 4
#> ATC:pam 55 8.00e-01 4
#> SD:hclust 31 1.97e-03 4
#> CV:hclust 45 1.60e-07 4
#> MAD:hclust 30 2.53e-03 4
#> ATC:hclust 49 6.10e-01 4
test_to_known_factors(res_list, k = 5)
#> n disease.state(p) k
#> SD:NMF 55 7.94e-08 5
#> CV:NMF 54 1.72e-08 5
#> MAD:NMF 49 2.32e-07 5
#> ATC:NMF 29 5.61e-01 5
#> SD:skmeans 52 5.04e-08 5
#> CV:skmeans 54 7.28e-08 5
#> MAD:skmeans 41 1.45e-06 5
#> ATC:skmeans 46 1.34e-01 5
#> SD:mclust 34 2.11e-05 5
#> CV:mclust 54 1.11e-07 5
#> MAD:mclust 38 9.80e-07 5
#> ATC:mclust 53 6.44e-01 5
#> SD:kmeans 33 5.94e-06 5
#> CV:kmeans 47 2.17e-07 5
#> MAD:kmeans 41 1.03e-06 5
#> ATC:kmeans 44 9.06e-01 5
#> SD:pam 51 3.65e-07 5
#> CV:pam 38 9.26e-07 5
#> MAD:pam 47 1.05e-07 5
#> ATC:pam 54 5.49e-01 5
#> SD:hclust 36 2.28e-04 5
#> CV:hclust 37 8.42e-07 5
#> MAD:hclust 28 1.57e-03 5
#> ATC:hclust 49 5.80e-01 5
test_to_known_factors(res_list, k = 6)
#> n disease.state(p) k
#> SD:NMF 54 4.27e-07 6
#> CV:NMF 44 1.27e-06 6
#> MAD:NMF 49 3.50e-06 6
#> ATC:NMF 34 5.80e-01 6
#> SD:skmeans 45 2.75e-06 6
#> CV:skmeans 44 7.05e-07 6
#> MAD:skmeans 29 1.12e-05 6
#> ATC:skmeans 47 2.76e-01 6
#> SD:mclust 36 4.16e-07 6
#> CV:mclust 42 2.82e-05 6
#> MAD:mclust 39 6.51e-06 6
#> ATC:mclust 50 5.55e-01 6
#> SD:kmeans 29 1.33e-05 6
#> CV:kmeans 41 9.54e-06 6
#> MAD:kmeans 26 1.54e-04 6
#> ATC:kmeans 55 2.06e-01 6
#> SD:pam 52 8.35e-07 6
#> CV:pam 26 5.18e-05 6
#> MAD:pam 47 3.36e-07 6
#> ATC:pam 50 7.07e-01 6
#> SD:hclust 37 2.06e-03 6
#> CV:hclust 40 1.36e-06 6
#> MAD:hclust 31 9.50e-05 6
#> ATC:hclust 37 2.88e-01 6
The object with results only for a single top-value method and a single partition method can be extracted as:
res = res_list["SD", "hclust"]
# you can also extract it by
# res = res_list["SD:hclust"]
A summary of res
and all the functions that can be applied to it:
res
#> A 'ConsensusPartition' object with k = 2, 3, 4, 5, 6.
#> On a matrix with 51941 rows and 58 columns.
#> Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'SD' method.
#> Subgroups are detected by 'hclust' method.
#> Performed in total 1250 partitions by row resampling.
#> Best k for subgroups seems to be 2.
#>
#> Following methods can be applied to this 'ConsensusPartition' object:
#> [1] "cola_report" "collect_classes" "collect_plots"
#> [4] "collect_stats" "colnames" "compare_signatures"
#> [7] "consensus_heatmap" "dimension_reduction" "functional_enrichment"
#> [10] "get_anno_col" "get_anno" "get_classes"
#> [13] "get_consensus" "get_matrix" "get_membership"
#> [16] "get_param" "get_signatures" "get_stats"
#> [19] "is_best_k" "is_stable_k" "membership_heatmap"
#> [22] "ncol" "nrow" "plot_ecdf"
#> [25] "rownames" "select_partition_number" "show"
#> [28] "suggest_best_k" "test_to_known_factors"
collect_plots()
function collects all the plots made from res
for all k
(number of partitions)
into one single page to provide an easy and fast comparison between different k
.
collect_plots(res)
The plots are:
k
and the heatmap of
predicted classes for each k
.k
.k
.k
.All the plots in panels can be made by individual functions and they are plotted later in this section.
select_partition_number()
produces several plots showing different
statistics for choosing “optimized” k
. There are following statistics:
k
;k
, the area increased is defined as \(A_k - A_{k-1}\).The detailed explanations of these statistics can be found in the cola vignette.
Generally speaking, lower PAC score, higher mean silhouette score or higher
concordance corresponds to better partition. Rand index and Jaccard index
measure how similar the current partition is compared to partition with k-1
.
If they are too similar, we won't accept k
is better than k-1
.
select_partition_number(res)
The numeric values for all these statistics can be obtained by get_stats()
.
get_stats(res)
#> k 1-PAC mean_silhouette concordance area_increased Rand Jaccard
#> 2 2 0.323 0.694 0.856 0.4542 0.491 0.491
#> 3 3 0.392 0.642 0.786 0.3629 0.735 0.530
#> 4 4 0.510 0.492 0.717 0.1738 0.758 0.453
#> 5 5 0.585 0.545 0.719 0.0759 0.840 0.491
#> 6 6 0.664 0.511 0.699 0.0485 0.918 0.662
suggest_best_k()
suggests the best \(k\) based on these statistics. The rules are as follows:
suggest_best_k(res)
#> [1] 2
Following shows the table of the partitions (You need to click the show/hide
code output link to see it). The membership matrix (columns with name p*
)
is inferred by
clue::cl_consensus()
function with the SE
method. Basically the value in the membership matrix
represents the probability to belong to a certain group. The finall class
label for an item is determined with the group with highest probability it
belongs to.
In get_classes()
function, the entropy is calculated from the membership
matrix and the silhouette score is calculated from the consensus matrix.
cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#> class entropy silhouette p1 p2
#> GSM258553 1 0.0000 0.8157 1.000 0.000
#> GSM258555 1 0.0000 0.8157 1.000 0.000
#> GSM258556 2 0.6048 0.7961 0.148 0.852
#> GSM258557 1 0.1414 0.8204 0.980 0.020
#> GSM258562 1 0.7950 0.6841 0.760 0.240
#> GSM258563 1 0.1414 0.8204 0.980 0.020
#> GSM258565 1 0.0000 0.8157 1.000 0.000
#> GSM258566 1 0.0000 0.8157 1.000 0.000
#> GSM258570 1 0.0000 0.8157 1.000 0.000
#> GSM258578 1 0.0000 0.8157 1.000 0.000
#> GSM258580 1 0.7950 0.6841 0.760 0.240
#> GSM258583 1 0.0938 0.8189 0.988 0.012
#> GSM258585 1 0.1414 0.8204 0.980 0.020
#> GSM258590 1 0.0000 0.8157 1.000 0.000
#> GSM258594 1 0.0000 0.8157 1.000 0.000
#> GSM258596 1 0.1414 0.8204 0.980 0.020
#> GSM258599 1 0.1414 0.8204 0.980 0.020
#> GSM258603 1 0.0000 0.8157 1.000 0.000
#> GSM258551 2 0.4939 0.8147 0.108 0.892
#> GSM258552 1 0.9522 0.4032 0.628 0.372
#> GSM258554 2 0.2603 0.8147 0.044 0.956
#> GSM258558 2 0.3584 0.8194 0.068 0.932
#> GSM258559 2 0.6801 0.7763 0.180 0.820
#> GSM258560 1 0.9983 0.0280 0.524 0.476
#> GSM258561 2 0.5059 0.8130 0.112 0.888
#> GSM258564 2 0.3733 0.8187 0.072 0.928
#> GSM258567 1 0.9983 0.0285 0.524 0.476
#> GSM258568 2 0.1414 0.8070 0.020 0.980
#> GSM258569 1 0.7950 0.6841 0.760 0.240
#> GSM258571 1 0.6623 0.7602 0.828 0.172
#> GSM258572 2 0.9954 0.2236 0.460 0.540
#> GSM258573 2 0.0000 0.7989 0.000 1.000
#> GSM258574 2 0.9866 0.3134 0.432 0.568
#> GSM258575 2 0.4022 0.8172 0.080 0.920
#> GSM258576 2 0.0000 0.7989 0.000 1.000
#> GSM258577 2 0.8955 0.6082 0.312 0.688
#> GSM258579 2 0.0000 0.7989 0.000 1.000
#> GSM258581 2 0.0000 0.7989 0.000 1.000
#> GSM258582 1 0.6623 0.7602 0.828 0.172
#> GSM258584 2 0.8813 0.6282 0.300 0.700
#> GSM258586 2 0.6247 0.7917 0.156 0.844
#> GSM258587 2 0.0000 0.7989 0.000 1.000
#> GSM258588 2 0.9552 0.4105 0.376 0.624
#> GSM258589 2 0.9970 0.1944 0.468 0.532
#> GSM258591 2 0.4161 0.8178 0.084 0.916
#> GSM258592 1 0.9963 0.0833 0.536 0.464
#> GSM258593 1 0.3431 0.8088 0.936 0.064
#> GSM258595 1 0.8499 0.6245 0.724 0.276
#> GSM258597 2 0.0000 0.7989 0.000 1.000
#> GSM258598 2 0.0000 0.7989 0.000 1.000
#> GSM258600 2 0.9977 0.1780 0.472 0.528
#> GSM258601 1 0.6712 0.7571 0.824 0.176
#> GSM258602 2 0.6623 0.7823 0.172 0.828
#> GSM258604 1 0.6623 0.7602 0.828 0.172
#> GSM258605 1 0.6623 0.7602 0.828 0.172
#> GSM258606 2 0.3733 0.8183 0.072 0.928
#> GSM258607 2 0.6048 0.7961 0.148 0.852
#> GSM258608 2 0.7528 0.7376 0.216 0.784
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> GSM258553 1 0.3340 1.0000 0.880 0.000 0.120
#> GSM258555 1 0.3340 1.0000 0.880 0.000 0.120
#> GSM258556 2 0.8573 0.5989 0.116 0.556 0.328
#> GSM258557 3 0.6225 0.2549 0.432 0.000 0.568
#> GSM258562 3 0.2066 0.6722 0.060 0.000 0.940
#> GSM258563 3 0.6225 0.2549 0.432 0.000 0.568
#> GSM258565 1 0.3340 1.0000 0.880 0.000 0.120
#> GSM258566 1 0.3340 1.0000 0.880 0.000 0.120
#> GSM258570 1 0.3340 1.0000 0.880 0.000 0.120
#> GSM258578 1 0.3340 1.0000 0.880 0.000 0.120
#> GSM258580 3 0.2066 0.6722 0.060 0.000 0.940
#> GSM258583 3 0.6252 0.2163 0.444 0.000 0.556
#> GSM258585 3 0.6225 0.2549 0.432 0.000 0.568
#> GSM258590 1 0.3340 1.0000 0.880 0.000 0.120
#> GSM258594 1 0.3340 1.0000 0.880 0.000 0.120
#> GSM258596 3 0.6225 0.2549 0.432 0.000 0.568
#> GSM258599 3 0.6225 0.2549 0.432 0.000 0.568
#> GSM258603 1 0.3340 1.0000 0.880 0.000 0.120
#> GSM258551 2 0.4842 0.7517 0.000 0.776 0.224
#> GSM258552 3 0.2356 0.6287 0.000 0.072 0.928
#> GSM258554 2 0.3267 0.7949 0.000 0.884 0.116
#> GSM258558 2 0.4452 0.7747 0.000 0.808 0.192
#> GSM258559 2 0.5859 0.6199 0.000 0.656 0.344
#> GSM258560 3 0.4346 0.5341 0.000 0.184 0.816
#> GSM258561 2 0.5689 0.7706 0.036 0.780 0.184
#> GSM258564 2 0.6721 0.7712 0.116 0.748 0.136
#> GSM258567 3 0.4235 0.5395 0.000 0.176 0.824
#> GSM258568 2 0.2878 0.7938 0.000 0.904 0.096
#> GSM258569 3 0.2066 0.6722 0.060 0.000 0.940
#> GSM258571 3 0.3482 0.6529 0.128 0.000 0.872
#> GSM258572 3 0.5812 0.4441 0.012 0.264 0.724
#> GSM258573 2 0.2066 0.7708 0.060 0.940 0.000
#> GSM258574 3 0.5397 0.3938 0.000 0.280 0.720
#> GSM258575 2 0.3038 0.7914 0.000 0.896 0.104
#> GSM258576 2 0.0829 0.7816 0.004 0.984 0.012
#> GSM258577 3 0.6111 0.0478 0.000 0.396 0.604
#> GSM258579 2 0.0829 0.7816 0.004 0.984 0.012
#> GSM258581 2 0.0829 0.7816 0.004 0.984 0.012
#> GSM258582 3 0.3482 0.6529 0.128 0.000 0.872
#> GSM258584 3 0.6154 -0.0107 0.000 0.408 0.592
#> GSM258586 2 0.8645 0.5787 0.116 0.540 0.344
#> GSM258587 2 0.2860 0.7654 0.084 0.912 0.004
#> GSM258588 2 0.6307 0.2875 0.000 0.512 0.488
#> GSM258589 3 0.5881 0.4610 0.016 0.256 0.728
#> GSM258591 2 0.4136 0.7930 0.020 0.864 0.116
#> GSM258592 3 0.4062 0.5537 0.000 0.164 0.836
#> GSM258593 3 0.5254 0.5223 0.264 0.000 0.736
#> GSM258595 3 0.2527 0.6763 0.044 0.020 0.936
#> GSM258597 2 0.2860 0.7654 0.084 0.912 0.004
#> GSM258598 2 0.3340 0.7469 0.120 0.880 0.000
#> GSM258600 3 0.5803 0.4727 0.016 0.248 0.736
#> GSM258601 3 0.3715 0.6541 0.128 0.004 0.868
#> GSM258602 2 0.5785 0.6400 0.000 0.668 0.332
#> GSM258604 3 0.3482 0.6529 0.128 0.000 0.872
#> GSM258605 3 0.3482 0.6529 0.128 0.000 0.872
#> GSM258606 2 0.3879 0.7897 0.000 0.848 0.152
#> GSM258607 2 0.8554 0.6031 0.116 0.560 0.324
#> GSM258608 2 0.6180 0.4579 0.000 0.584 0.416
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> GSM258553 1 0.0188 1.0000 0.996 0.000 0.004 0.000
#> GSM258555 1 0.0188 1.0000 0.996 0.000 0.004 0.000
#> GSM258556 4 0.4855 0.5123 0.004 0.352 0.000 0.644
#> GSM258557 3 0.5070 0.5131 0.372 0.008 0.620 0.000
#> GSM258562 3 0.3895 0.5753 0.012 0.184 0.804 0.000
#> GSM258563 3 0.5070 0.5131 0.372 0.008 0.620 0.000
#> GSM258565 1 0.0188 1.0000 0.996 0.000 0.004 0.000
#> GSM258566 1 0.0188 1.0000 0.996 0.000 0.004 0.000
#> GSM258570 1 0.0188 1.0000 0.996 0.000 0.004 0.000
#> GSM258578 1 0.0188 1.0000 0.996 0.000 0.004 0.000
#> GSM258580 3 0.3895 0.5753 0.012 0.184 0.804 0.000
#> GSM258583 3 0.5112 0.4972 0.384 0.008 0.608 0.000
#> GSM258585 3 0.5070 0.5131 0.372 0.008 0.620 0.000
#> GSM258590 1 0.0188 1.0000 0.996 0.000 0.004 0.000
#> GSM258594 1 0.0188 1.0000 0.996 0.000 0.004 0.000
#> GSM258596 3 0.5070 0.5131 0.372 0.008 0.620 0.000
#> GSM258599 3 0.5070 0.5131 0.372 0.008 0.620 0.000
#> GSM258603 1 0.0188 1.0000 0.996 0.000 0.004 0.000
#> GSM258551 2 0.5928 -0.2996 0.000 0.508 0.036 0.456
#> GSM258552 3 0.4776 0.2308 0.000 0.376 0.624 0.000
#> GSM258554 4 0.5119 0.3383 0.000 0.440 0.004 0.556
#> GSM258558 2 0.4123 0.2602 0.000 0.772 0.008 0.220
#> GSM258559 2 0.3996 0.3683 0.000 0.836 0.060 0.104
#> GSM258560 2 0.5137 0.2091 0.000 0.544 0.452 0.004
#> GSM258561 4 0.6242 0.3888 0.004 0.356 0.056 0.584
#> GSM258564 4 0.3710 0.6220 0.004 0.192 0.000 0.804
#> GSM258567 2 0.4981 0.1781 0.000 0.536 0.464 0.000
#> GSM258568 2 0.4836 0.1890 0.000 0.672 0.008 0.320
#> GSM258569 3 0.4019 0.5669 0.012 0.196 0.792 0.000
#> GSM258571 3 0.0937 0.6819 0.012 0.012 0.976 0.000
#> GSM258572 2 0.5088 0.2425 0.000 0.572 0.424 0.004
#> GSM258573 4 0.3448 0.6027 0.000 0.168 0.004 0.828
#> GSM258574 2 0.4978 0.3062 0.000 0.612 0.384 0.004
#> GSM258575 2 0.5882 0.2072 0.000 0.608 0.048 0.344
#> GSM258576 2 0.5060 0.1127 0.000 0.584 0.004 0.412
#> GSM258577 2 0.3982 0.4185 0.000 0.776 0.220 0.004
#> GSM258579 2 0.5060 0.1127 0.000 0.584 0.004 0.412
#> GSM258581 2 0.5060 0.1127 0.000 0.584 0.004 0.412
#> GSM258582 3 0.0937 0.6819 0.012 0.012 0.976 0.000
#> GSM258584 2 0.3801 0.4215 0.000 0.780 0.220 0.000
#> GSM258586 4 0.5395 0.4950 0.004 0.352 0.016 0.628
#> GSM258587 4 0.3074 0.6226 0.000 0.152 0.000 0.848
#> GSM258588 2 0.7659 0.3077 0.000 0.444 0.332 0.224
#> GSM258589 2 0.4941 0.2154 0.000 0.564 0.436 0.000
#> GSM258591 2 0.6068 -0.0352 0.000 0.508 0.044 0.448
#> GSM258592 2 0.4992 0.1544 0.000 0.524 0.476 0.000
#> GSM258593 3 0.3208 0.6722 0.148 0.004 0.848 0.000
#> GSM258595 3 0.4088 0.5119 0.004 0.232 0.764 0.000
#> GSM258597 4 0.3074 0.6226 0.000 0.152 0.000 0.848
#> GSM258598 4 0.1209 0.6228 0.004 0.032 0.000 0.964
#> GSM258600 2 0.4955 0.2001 0.000 0.556 0.444 0.000
#> GSM258601 3 0.1174 0.6792 0.012 0.020 0.968 0.000
#> GSM258602 2 0.4171 0.3646 0.000 0.824 0.060 0.116
#> GSM258604 3 0.0937 0.6819 0.012 0.012 0.976 0.000
#> GSM258605 3 0.0937 0.6819 0.012 0.012 0.976 0.000
#> GSM258606 2 0.5417 0.2387 0.000 0.676 0.040 0.284
#> GSM258607 4 0.4837 0.5169 0.004 0.348 0.000 0.648
#> GSM258608 2 0.6439 0.3302 0.000 0.648 0.172 0.180
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> GSM258553 1 0.000 1.0000 1.000 0.000 0.000 0.000 0.000
#> GSM258555 1 0.000 1.0000 1.000 0.000 0.000 0.000 0.000
#> GSM258556 4 0.120 0.6200 0.000 0.000 0.048 0.952 0.000
#> GSM258557 5 0.474 0.6935 0.332 0.000 0.024 0.004 0.640
#> GSM258562 3 0.427 0.2847 0.000 0.000 0.556 0.000 0.444
#> GSM258563 5 0.474 0.6935 0.332 0.000 0.024 0.004 0.640
#> GSM258565 1 0.000 1.0000 1.000 0.000 0.000 0.000 0.000
#> GSM258566 1 0.000 1.0000 1.000 0.000 0.000 0.000 0.000
#> GSM258570 1 0.000 1.0000 1.000 0.000 0.000 0.000 0.000
#> GSM258578 1 0.000 1.0000 1.000 0.000 0.000 0.000 0.000
#> GSM258580 3 0.427 0.2847 0.000 0.000 0.556 0.000 0.444
#> GSM258583 5 0.479 0.6783 0.344 0.000 0.024 0.004 0.628
#> GSM258585 5 0.474 0.6935 0.332 0.000 0.024 0.004 0.640
#> GSM258590 1 0.000 1.0000 1.000 0.000 0.000 0.000 0.000
#> GSM258594 1 0.000 1.0000 1.000 0.000 0.000 0.000 0.000
#> GSM258596 5 0.474 0.6935 0.332 0.000 0.024 0.004 0.640
#> GSM258599 5 0.474 0.6935 0.332 0.000 0.024 0.004 0.640
#> GSM258603 1 0.000 1.0000 1.000 0.000 0.000 0.000 0.000
#> GSM258551 2 0.684 0.0456 0.000 0.404 0.188 0.396 0.012
#> GSM258552 3 0.550 0.4960 0.000 0.048 0.632 0.024 0.296
#> GSM258554 2 0.604 0.1136 0.000 0.516 0.128 0.356 0.000
#> GSM258558 2 0.442 0.5873 0.000 0.728 0.224 0.048 0.000
#> GSM258559 2 0.512 0.4245 0.000 0.576 0.388 0.008 0.028
#> GSM258560 3 0.542 0.4204 0.000 0.052 0.588 0.008 0.352
#> GSM258561 4 0.662 0.0537 0.000 0.416 0.088 0.456 0.040
#> GSM258564 4 0.388 0.6102 0.000 0.184 0.036 0.780 0.000
#> GSM258567 3 0.568 0.4384 0.000 0.044 0.572 0.024 0.360
#> GSM258568 2 0.233 0.6157 0.000 0.876 0.124 0.000 0.000
#> GSM258569 3 0.425 0.2975 0.000 0.000 0.568 0.000 0.432
#> GSM258571 5 0.104 0.5669 0.000 0.000 0.040 0.000 0.960
#> GSM258572 3 0.625 0.5550 0.000 0.164 0.640 0.044 0.152
#> GSM258573 2 0.473 -0.4263 0.000 0.524 0.016 0.460 0.000
#> GSM258574 3 0.619 0.5215 0.000 0.176 0.648 0.048 0.128
#> GSM258575 2 0.290 0.6107 0.000 0.880 0.076 0.008 0.036
#> GSM258576 2 0.029 0.5806 0.000 0.992 0.008 0.000 0.000
#> GSM258577 3 0.629 0.2415 0.000 0.288 0.588 0.048 0.076
#> GSM258579 2 0.029 0.5806 0.000 0.992 0.008 0.000 0.000
#> GSM258581 2 0.029 0.5806 0.000 0.992 0.008 0.000 0.000
#> GSM258582 5 0.104 0.5669 0.000 0.000 0.040 0.000 0.960
#> GSM258584 3 0.585 0.1306 0.000 0.296 0.576 0.000 0.128
#> GSM258586 4 0.163 0.6150 0.000 0.000 0.056 0.936 0.008
#> GSM258587 4 0.445 0.3921 0.000 0.488 0.004 0.508 0.000
#> GSM258588 2 0.731 0.2717 0.000 0.436 0.256 0.032 0.276
#> GSM258589 3 0.625 0.5629 0.000 0.156 0.640 0.044 0.160
#> GSM258591 2 0.527 0.4803 0.000 0.720 0.072 0.172 0.036
#> GSM258592 3 0.495 0.4202 0.000 0.036 0.596 0.000 0.368
#> GSM258593 5 0.574 0.3923 0.108 0.000 0.284 0.004 0.604
#> GSM258595 3 0.487 0.3473 0.000 0.004 0.532 0.016 0.448
#> GSM258597 4 0.445 0.3921 0.000 0.488 0.004 0.508 0.000
#> GSM258598 4 0.428 0.5460 0.000 0.348 0.008 0.644 0.000
#> GSM258600 3 0.618 0.5674 0.000 0.148 0.648 0.044 0.160
#> GSM258601 5 0.141 0.5633 0.000 0.000 0.044 0.008 0.948
#> GSM258602 2 0.512 0.4758 0.000 0.616 0.340 0.008 0.036
#> GSM258604 5 0.112 0.5661 0.000 0.000 0.044 0.000 0.956
#> GSM258605 5 0.112 0.5661 0.000 0.000 0.044 0.000 0.956
#> GSM258606 2 0.333 0.6188 0.000 0.828 0.144 0.000 0.028
#> GSM258607 4 0.112 0.6200 0.000 0.000 0.044 0.956 0.000
#> GSM258608 2 0.699 0.2493 0.000 0.432 0.408 0.104 0.056
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> GSM258553 1 0.0000 0.9989 1.000 0.000 0.000 0.000 NA 0.000
#> GSM258555 1 0.0000 0.9989 1.000 0.000 0.000 0.000 NA 0.000
#> GSM258556 4 0.0790 0.6190 0.000 0.032 0.000 0.968 NA 0.000
#> GSM258557 3 0.5977 0.5396 0.204 0.004 0.456 0.000 NA 0.000
#> GSM258562 2 0.3979 0.6254 0.000 0.752 0.076 0.000 NA 0.000
#> GSM258563 3 0.5977 0.5396 0.204 0.004 0.456 0.000 NA 0.000
#> GSM258565 1 0.0000 0.9989 1.000 0.000 0.000 0.000 NA 0.000
#> GSM258566 1 0.0000 0.9989 1.000 0.000 0.000 0.000 NA 0.000
#> GSM258570 1 0.0000 0.9989 1.000 0.000 0.000 0.000 NA 0.000
#> GSM258578 1 0.0000 0.9989 1.000 0.000 0.000 0.000 NA 0.000
#> GSM258580 2 0.3979 0.6254 0.000 0.752 0.076 0.000 NA 0.000
#> GSM258583 3 0.6015 0.5293 0.216 0.004 0.452 0.000 NA 0.000
#> GSM258585 3 0.5977 0.5396 0.204 0.004 0.456 0.000 NA 0.000
#> GSM258590 1 0.0146 0.9961 0.996 0.000 0.000 0.000 NA 0.000
#> GSM258594 1 0.0000 0.9989 1.000 0.000 0.000 0.000 NA 0.000
#> GSM258596 3 0.5977 0.5396 0.204 0.004 0.456 0.000 NA 0.000
#> GSM258599 3 0.5977 0.5396 0.204 0.004 0.456 0.000 NA 0.000
#> GSM258603 1 0.0146 0.9961 0.996 0.000 0.000 0.000 NA 0.000
#> GSM258551 6 0.6026 0.0925 0.000 0.096 0.004 0.404 NA 0.464
#> GSM258552 2 0.5909 0.6314 0.000 0.672 0.080 0.032 NA 0.096
#> GSM258554 6 0.5880 0.1283 0.000 0.048 0.000 0.304 NA 0.556
#> GSM258558 6 0.3977 0.5357 0.000 0.144 0.000 0.056 NA 0.780
#> GSM258559 6 0.5462 0.4257 0.000 0.180 0.008 0.008 NA 0.632
#> GSM258560 3 0.7557 -0.0686 0.000 0.312 0.332 0.008 NA 0.112
#> GSM258561 6 0.5506 -0.0524 0.000 0.004 0.008 0.444 NA 0.460
#> GSM258564 4 0.3706 0.5763 0.000 0.024 0.000 0.776 NA 0.184
#> GSM258567 3 0.7698 -0.0844 0.000 0.324 0.348 0.024 NA 0.104
#> GSM258568 6 0.2350 0.5570 0.000 0.020 0.000 0.000 NA 0.880
#> GSM258569 2 0.3825 0.6307 0.000 0.768 0.072 0.000 NA 0.000
#> GSM258571 3 0.0820 0.5331 0.000 0.016 0.972 0.000 NA 0.000
#> GSM258572 2 0.3886 0.5991 0.000 0.772 0.008 0.056 NA 0.164
#> GSM258573 6 0.6332 -0.4197 0.000 0.012 0.000 0.368 NA 0.372
#> GSM258574 2 0.4570 0.5498 0.000 0.720 0.008 0.060 NA 0.200
#> GSM258575 6 0.2627 0.5484 0.000 0.008 0.008 0.008 NA 0.872
#> GSM258576 6 0.2859 0.4966 0.000 0.016 0.000 0.000 NA 0.828
#> GSM258577 2 0.5883 0.2066 0.000 0.532 0.012 0.060 NA 0.356
#> GSM258579 6 0.2859 0.4966 0.000 0.016 0.000 0.000 NA 0.828
#> GSM258581 6 0.2859 0.4966 0.000 0.016 0.000 0.000 NA 0.828
#> GSM258582 3 0.0820 0.5331 0.000 0.016 0.972 0.000 NA 0.000
#> GSM258584 6 0.7433 0.0243 0.000 0.284 0.128 0.000 NA 0.344
#> GSM258586 4 0.1152 0.6125 0.000 0.044 0.000 0.952 NA 0.000
#> GSM258587 4 0.5937 0.3634 0.000 0.000 0.000 0.416 NA 0.368
#> GSM258588 6 0.7163 0.3766 0.000 0.128 0.228 0.032 NA 0.512
#> GSM258589 2 0.3883 0.6086 0.000 0.784 0.008 0.056 NA 0.148
#> GSM258591 6 0.4457 0.4539 0.000 0.008 0.008 0.164 NA 0.740
#> GSM258592 3 0.7210 -0.0309 0.000 0.304 0.364 0.000 NA 0.092
#> GSM258593 2 0.5811 0.2474 0.020 0.488 0.112 0.000 NA 0.000
#> GSM258595 2 0.5289 0.5485 0.000 0.648 0.220 0.016 NA 0.004
#> GSM258597 4 0.5937 0.3634 0.000 0.000 0.000 0.416 NA 0.368
#> GSM258598 4 0.5507 0.4931 0.000 0.000 0.000 0.548 NA 0.284
#> GSM258600 2 0.3666 0.6145 0.000 0.796 0.008 0.056 NA 0.140
#> GSM258601 3 0.0622 0.5304 0.000 0.012 0.980 0.008 NA 0.000
#> GSM258602 6 0.4987 0.4742 0.000 0.152 0.008 0.008 NA 0.692
#> GSM258604 3 0.0363 0.5321 0.000 0.012 0.988 0.000 NA 0.000
#> GSM258605 3 0.0363 0.5321 0.000 0.012 0.988 0.000 NA 0.000
#> GSM258606 6 0.2094 0.5641 0.000 0.016 0.008 0.000 NA 0.908
#> GSM258607 4 0.0713 0.6192 0.000 0.028 0.000 0.972 NA 0.000
#> GSM258608 6 0.6185 0.2137 0.000 0.352 0.004 0.116 NA 0.492
Heatmaps for the consensus matrix. It visualizes the probability of two samples to be in a same group.
consensus_heatmap(res, k = 2)
consensus_heatmap(res, k = 3)
consensus_heatmap(res, k = 4)
consensus_heatmap(res, k = 5)
consensus_heatmap(res, k = 6)
Heatmaps for the membership of samples in all partitions to see how consistent they are:
membership_heatmap(res, k = 2)
membership_heatmap(res, k = 3)
membership_heatmap(res, k = 4)
membership_heatmap(res, k = 5)
membership_heatmap(res, k = 6)
As soon as we have had the classes for columns, we can look for signatures which are significantly different between classes which can be candidate marks for certain classes. Following are the heatmaps for signatures.
Signature heatmaps where rows are scaled:
get_signatures(res, k = 2)
get_signatures(res, k = 3)
get_signatures(res, k = 4)
get_signatures(res, k = 5)
get_signatures(res, k = 6)
Signature heatmaps where rows are not scaled:
get_signatures(res, k = 2, scale_rows = FALSE)
get_signatures(res, k = 3, scale_rows = FALSE)
get_signatures(res, k = 4, scale_rows = FALSE)
get_signatures(res, k = 5, scale_rows = FALSE)
get_signatures(res, k = 6, scale_rows = FALSE)
Compare the overlap of signatures from different k:
compare_signatures(res)
get_signature()
returns a data frame invisibly. TO get the list of signatures, the function
call should be assigned to a variable explicitly. In following code, if plot
argument is set
to FALSE
, no heatmap is plotted while only the differential analysis is performed.
# code only for demonstration
tb = get_signature(res, k = ..., plot = FALSE)
An example of the output of tb
is:
#> which_row fdr mean_1 mean_2 scaled_mean_1 scaled_mean_2 km
#> 1 38 0.042760348 8.373488 9.131774 -0.5533452 0.5164555 1
#> 2 40 0.018707592 7.106213 8.469186 -0.6173731 0.5762149 1
#> 3 55 0.019134737 10.221463 11.207825 -0.6159697 0.5749050 1
#> 4 59 0.006059896 5.921854 7.869574 -0.6899429 0.6439467 1
#> 5 60 0.018055526 8.928898 10.211722 -0.6204761 0.5791110 1
#> 6 98 0.009384629 15.714769 14.887706 0.6635654 -0.6193277 2
...
The columns in tb
are:
which_row
: row indices corresponding to the input matrix.fdr
: FDR for the differential test. mean_x
: The mean value in group x.scaled_mean_x
: The mean value in group x after rows are scaled.km
: Row groups if k-means clustering is applied to rows.UMAP plot which shows how samples are separated.
dimension_reduction(res, k = 2, method = "UMAP")
dimension_reduction(res, k = 3, method = "UMAP")
dimension_reduction(res, k = 4, method = "UMAP")
dimension_reduction(res, k = 5, method = "UMAP")
dimension_reduction(res, k = 6, method = "UMAP")
Following heatmap shows how subgroups are split when increasing k
:
collect_classes(res)
Test correlation between subgroups and known annotations. If the known annotation is numeric, one-way ANOVA test is applied, and if the known annotation is discrete, chi-squared contingency table test is applied.
test_to_known_factors(res)
#> n disease.state(p) k
#> SD:hclust 49 1.44e-05 2
#> SD:hclust 44 2.32e-07 3
#> SD:hclust 31 1.97e-03 4
#> SD:hclust 36 2.28e-04 5
#> SD:hclust 37 2.06e-03 6
If matrix rows can be associated to genes, consider to use functional_enrichment(res,
...)
to perform function enrichment for the signature genes. See this vignette for more detailed explanations.
The object with results only for a single top-value method and a single partition method can be extracted as:
res = res_list["SD", "kmeans"]
# you can also extract it by
# res = res_list["SD:kmeans"]
A summary of res
and all the functions that can be applied to it:
res
#> A 'ConsensusPartition' object with k = 2, 3, 4, 5, 6.
#> On a matrix with 51941 rows and 58 columns.
#> Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'SD' method.
#> Subgroups are detected by 'kmeans' method.
#> Performed in total 1250 partitions by row resampling.
#> Best k for subgroups seems to be 3.
#>
#> Following methods can be applied to this 'ConsensusPartition' object:
#> [1] "cola_report" "collect_classes" "collect_plots"
#> [4] "collect_stats" "colnames" "compare_signatures"
#> [7] "consensus_heatmap" "dimension_reduction" "functional_enrichment"
#> [10] "get_anno_col" "get_anno" "get_classes"
#> [13] "get_consensus" "get_matrix" "get_membership"
#> [16] "get_param" "get_signatures" "get_stats"
#> [19] "is_best_k" "is_stable_k" "membership_heatmap"
#> [22] "ncol" "nrow" "plot_ecdf"
#> [25] "rownames" "select_partition_number" "show"
#> [28] "suggest_best_k" "test_to_known_factors"
collect_plots()
function collects all the plots made from res
for all k
(number of partitions)
into one single page to provide an easy and fast comparison between different k
.
collect_plots(res)
The plots are:
k
and the heatmap of
predicted classes for each k
.k
.k
.k
.All the plots in panels can be made by individual functions and they are plotted later in this section.
select_partition_number()
produces several plots showing different
statistics for choosing “optimized” k
. There are following statistics:
k
;k
, the area increased is defined as \(A_k - A_{k-1}\).The detailed explanations of these statistics can be found in the cola vignette.
Generally speaking, lower PAC score, higher mean silhouette score or higher
concordance corresponds to better partition. Rand index and Jaccard index
measure how similar the current partition is compared to partition with k-1
.
If they are too similar, we won't accept k
is better than k-1
.
select_partition_number(res)
The numeric values for all these statistics can be obtained by get_stats()
.
get_stats(res)
#> k 1-PAC mean_silhouette concordance area_increased Rand Jaccard
#> 2 2 0.833 0.935 0.971 0.4257 0.578 0.578
#> 3 3 0.956 0.891 0.943 0.5426 0.704 0.511
#> 4 4 0.679 0.653 0.799 0.1257 0.895 0.720
#> 5 5 0.677 0.525 0.748 0.0751 0.877 0.605
#> 6 6 0.743 0.516 0.690 0.0440 0.862 0.441
suggest_best_k()
suggests the best \(k\) based on these statistics. The rules are as follows:
suggest_best_k(res)
#> [1] 3
Following shows the table of the partitions (You need to click the show/hide
code output link to see it). The membership matrix (columns with name p*
)
is inferred by
clue::cl_consensus()
function with the SE
method. Basically the value in the membership matrix
represents the probability to belong to a certain group. The finall class
label for an item is determined with the group with highest probability it
belongs to.
In get_classes()
function, the entropy is calculated from the membership
matrix and the silhouette score is calculated from the consensus matrix.
cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#> class entropy silhouette p1 p2
#> GSM258553 1 0.0000 0.961 1.000 0.000
#> GSM258555 1 0.0000 0.961 1.000 0.000
#> GSM258556 2 0.0000 0.971 0.000 1.000
#> GSM258557 1 0.0376 0.959 0.996 0.004
#> GSM258562 1 0.9608 0.361 0.616 0.384
#> GSM258563 1 0.0376 0.959 0.996 0.004
#> GSM258565 1 0.0000 0.961 1.000 0.000
#> GSM258566 1 0.0000 0.961 1.000 0.000
#> GSM258570 1 0.0000 0.961 1.000 0.000
#> GSM258578 1 0.0000 0.961 1.000 0.000
#> GSM258580 2 0.3879 0.908 0.076 0.924
#> GSM258583 1 0.0376 0.959 0.996 0.004
#> GSM258585 1 0.6973 0.751 0.812 0.188
#> GSM258590 1 0.0000 0.961 1.000 0.000
#> GSM258594 1 0.0000 0.961 1.000 0.000
#> GSM258596 1 0.0000 0.961 1.000 0.000
#> GSM258599 1 0.0000 0.961 1.000 0.000
#> GSM258603 1 0.0000 0.961 1.000 0.000
#> GSM258551 2 0.0376 0.972 0.004 0.996
#> GSM258552 2 0.0000 0.971 0.000 1.000
#> GSM258554 2 0.0376 0.972 0.004 0.996
#> GSM258558 2 0.0376 0.972 0.004 0.996
#> GSM258559 2 0.0376 0.972 0.004 0.996
#> GSM258560 2 0.0000 0.971 0.000 1.000
#> GSM258561 2 0.0376 0.972 0.004 0.996
#> GSM258564 2 0.0376 0.972 0.004 0.996
#> GSM258567 2 0.0000 0.971 0.000 1.000
#> GSM258568 2 0.0376 0.972 0.004 0.996
#> GSM258569 2 0.0672 0.966 0.008 0.992
#> GSM258571 2 0.8327 0.649 0.264 0.736
#> GSM258572 2 0.0000 0.971 0.000 1.000
#> GSM258573 2 0.0376 0.972 0.004 0.996
#> GSM258574 2 0.0000 0.971 0.000 1.000
#> GSM258575 2 0.0376 0.972 0.004 0.996
#> GSM258576 2 0.0376 0.972 0.004 0.996
#> GSM258577 2 0.0000 0.971 0.000 1.000
#> GSM258579 2 0.0376 0.972 0.004 0.996
#> GSM258581 2 0.0376 0.972 0.004 0.996
#> GSM258582 2 0.8327 0.649 0.264 0.736
#> GSM258584 2 0.0000 0.971 0.000 1.000
#> GSM258586 2 0.0000 0.971 0.000 1.000
#> GSM258587 2 0.0376 0.972 0.004 0.996
#> GSM258588 2 0.0376 0.972 0.004 0.996
#> GSM258589 2 0.0000 0.971 0.000 1.000
#> GSM258591 2 0.0376 0.972 0.004 0.996
#> GSM258592 2 0.0000 0.971 0.000 1.000
#> GSM258593 1 0.0376 0.959 0.996 0.004
#> GSM258595 2 0.0000 0.971 0.000 1.000
#> GSM258597 2 0.0376 0.972 0.004 0.996
#> GSM258598 2 0.0376 0.972 0.004 0.996
#> GSM258600 2 0.0000 0.971 0.000 1.000
#> GSM258601 2 0.0000 0.971 0.000 1.000
#> GSM258602 2 0.0376 0.972 0.004 0.996
#> GSM258604 2 0.5294 0.855 0.120 0.880
#> GSM258605 2 0.8327 0.649 0.264 0.736
#> GSM258606 2 0.0376 0.972 0.004 0.996
#> GSM258607 2 0.0000 0.971 0.000 1.000
#> GSM258608 2 0.0376 0.972 0.004 0.996
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> GSM258553 1 0.0000 0.9236 1.000 0.000 0.000
#> GSM258555 1 0.0000 0.9236 1.000 0.000 0.000
#> GSM258556 3 0.2711 0.9056 0.000 0.088 0.912
#> GSM258557 1 0.6291 0.0972 0.532 0.000 0.468
#> GSM258562 3 0.2165 0.9059 0.064 0.000 0.936
#> GSM258563 1 0.0237 0.9226 0.996 0.000 0.004
#> GSM258565 1 0.0000 0.9236 1.000 0.000 0.000
#> GSM258566 1 0.0000 0.9236 1.000 0.000 0.000
#> GSM258570 1 0.0000 0.9236 1.000 0.000 0.000
#> GSM258578 1 0.0000 0.9236 1.000 0.000 0.000
#> GSM258580 3 0.0475 0.9359 0.004 0.004 0.992
#> GSM258583 1 0.0237 0.9226 0.996 0.000 0.004
#> GSM258585 3 0.4504 0.7503 0.196 0.000 0.804
#> GSM258590 1 0.0000 0.9236 1.000 0.000 0.000
#> GSM258594 1 0.0000 0.9236 1.000 0.000 0.000
#> GSM258596 1 0.0237 0.9226 0.996 0.000 0.004
#> GSM258599 1 0.0237 0.9226 0.996 0.000 0.004
#> GSM258603 1 0.0000 0.9236 1.000 0.000 0.000
#> GSM258551 2 0.1031 0.9524 0.000 0.976 0.024
#> GSM258552 3 0.0237 0.9359 0.000 0.004 0.996
#> GSM258554 2 0.0892 0.9516 0.000 0.980 0.020
#> GSM258558 2 0.2625 0.9535 0.000 0.916 0.084
#> GSM258559 2 0.2625 0.9535 0.000 0.916 0.084
#> GSM258560 3 0.0592 0.9343 0.000 0.012 0.988
#> GSM258561 2 0.0892 0.9516 0.000 0.980 0.020
#> GSM258564 2 0.0424 0.9457 0.000 0.992 0.008
#> GSM258567 3 0.0592 0.9343 0.000 0.012 0.988
#> GSM258568 2 0.2625 0.9535 0.000 0.916 0.084
#> GSM258569 3 0.0829 0.9354 0.004 0.012 0.984
#> GSM258571 3 0.3112 0.9043 0.056 0.028 0.916
#> GSM258572 3 0.0424 0.9354 0.000 0.008 0.992
#> GSM258573 2 0.0424 0.9457 0.000 0.992 0.008
#> GSM258574 3 0.0592 0.9343 0.000 0.012 0.988
#> GSM258575 2 0.2625 0.9535 0.000 0.916 0.084
#> GSM258576 2 0.2625 0.9535 0.000 0.916 0.084
#> GSM258577 3 0.0424 0.9354 0.000 0.008 0.992
#> GSM258579 2 0.2625 0.9535 0.000 0.916 0.084
#> GSM258581 2 0.2625 0.9535 0.000 0.916 0.084
#> GSM258582 3 0.3112 0.9043 0.056 0.028 0.916
#> GSM258584 3 0.0747 0.9330 0.000 0.016 0.984
#> GSM258586 3 0.2711 0.9056 0.000 0.088 0.912
#> GSM258587 2 0.1031 0.9524 0.000 0.976 0.024
#> GSM258588 3 0.6008 0.3533 0.000 0.372 0.628
#> GSM258589 3 0.0592 0.9343 0.000 0.012 0.988
#> GSM258591 2 0.0892 0.9516 0.000 0.980 0.020
#> GSM258592 3 0.0592 0.9343 0.000 0.012 0.988
#> GSM258593 1 0.6280 0.1244 0.540 0.000 0.460
#> GSM258595 3 0.1525 0.9306 0.004 0.032 0.964
#> GSM258597 2 0.0424 0.9457 0.000 0.992 0.008
#> GSM258598 2 0.0424 0.9457 0.000 0.992 0.008
#> GSM258600 3 0.0237 0.9359 0.000 0.004 0.996
#> GSM258601 3 0.1289 0.9308 0.000 0.032 0.968
#> GSM258602 2 0.2625 0.9535 0.000 0.916 0.084
#> GSM258604 3 0.3112 0.9043 0.056 0.028 0.916
#> GSM258605 3 0.3112 0.9043 0.056 0.028 0.916
#> GSM258606 2 0.2625 0.9535 0.000 0.916 0.084
#> GSM258607 3 0.2711 0.9056 0.000 0.088 0.912
#> GSM258608 3 0.1529 0.9184 0.000 0.040 0.960
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> GSM258553 1 0.0000 0.9411 1.000 0.000 0.000 0.000
#> GSM258555 1 0.0000 0.9411 1.000 0.000 0.000 0.000
#> GSM258556 4 0.5174 0.8847 0.000 0.012 0.368 0.620
#> GSM258557 3 0.7135 0.1508 0.240 0.000 0.560 0.200
#> GSM258562 3 0.3569 0.5708 0.000 0.000 0.804 0.196
#> GSM258563 1 0.4281 0.8402 0.792 0.000 0.028 0.180
#> GSM258565 1 0.0000 0.9411 1.000 0.000 0.000 0.000
#> GSM258566 1 0.0000 0.9411 1.000 0.000 0.000 0.000
#> GSM258570 1 0.0000 0.9411 1.000 0.000 0.000 0.000
#> GSM258578 1 0.0000 0.9411 1.000 0.000 0.000 0.000
#> GSM258580 3 0.2197 0.5644 0.000 0.004 0.916 0.080
#> GSM258583 1 0.3356 0.8645 0.824 0.000 0.000 0.176
#> GSM258585 3 0.5031 0.3919 0.048 0.000 0.740 0.212
#> GSM258590 1 0.0000 0.9411 1.000 0.000 0.000 0.000
#> GSM258594 1 0.0000 0.9411 1.000 0.000 0.000 0.000
#> GSM258596 1 0.3725 0.8573 0.812 0.000 0.008 0.180
#> GSM258599 1 0.3725 0.8573 0.812 0.000 0.008 0.180
#> GSM258603 1 0.0000 0.9411 1.000 0.000 0.000 0.000
#> GSM258551 2 0.4511 0.7070 0.000 0.724 0.008 0.268
#> GSM258552 3 0.0779 0.5764 0.000 0.004 0.980 0.016
#> GSM258554 2 0.3810 0.7572 0.000 0.804 0.008 0.188
#> GSM258558 2 0.0524 0.7821 0.000 0.988 0.008 0.004
#> GSM258559 2 0.5346 0.5420 0.000 0.732 0.076 0.192
#> GSM258560 3 0.5383 0.4962 0.000 0.036 0.672 0.292
#> GSM258561 2 0.4277 0.7169 0.000 0.720 0.000 0.280
#> GSM258564 2 0.5212 0.5439 0.000 0.572 0.008 0.420
#> GSM258567 3 0.4483 0.5367 0.000 0.004 0.712 0.284
#> GSM258568 2 0.0000 0.7835 0.000 1.000 0.000 0.000
#> GSM258569 3 0.2921 0.5710 0.000 0.000 0.860 0.140
#> GSM258571 3 0.4679 0.5415 0.000 0.000 0.648 0.352
#> GSM258572 3 0.1452 0.5611 0.000 0.008 0.956 0.036
#> GSM258573 2 0.3400 0.7605 0.000 0.820 0.000 0.180
#> GSM258574 3 0.2840 0.5241 0.000 0.044 0.900 0.056
#> GSM258575 2 0.0657 0.7783 0.000 0.984 0.012 0.004
#> GSM258576 2 0.0000 0.7835 0.000 1.000 0.000 0.000
#> GSM258577 3 0.2255 0.5414 0.000 0.012 0.920 0.068
#> GSM258579 2 0.0000 0.7835 0.000 1.000 0.000 0.000
#> GSM258581 2 0.0000 0.7835 0.000 1.000 0.000 0.000
#> GSM258582 3 0.4679 0.5415 0.000 0.000 0.648 0.352
#> GSM258584 3 0.7490 0.1069 0.000 0.220 0.496 0.284
#> GSM258586 4 0.5294 0.7714 0.000 0.008 0.484 0.508
#> GSM258587 2 0.3266 0.7646 0.000 0.832 0.000 0.168
#> GSM258588 2 0.7201 -0.0397 0.000 0.496 0.356 0.148
#> GSM258589 3 0.3367 0.5483 0.000 0.028 0.864 0.108
#> GSM258591 2 0.3400 0.7614 0.000 0.820 0.000 0.180
#> GSM258592 3 0.4632 0.5321 0.000 0.004 0.688 0.308
#> GSM258593 3 0.7241 0.1662 0.196 0.000 0.540 0.264
#> GSM258595 3 0.3764 0.5685 0.000 0.000 0.784 0.216
#> GSM258597 2 0.5183 0.5515 0.000 0.584 0.008 0.408
#> GSM258598 2 0.4877 0.5602 0.000 0.592 0.000 0.408
#> GSM258600 3 0.0524 0.5708 0.000 0.004 0.988 0.008
#> GSM258601 3 0.4605 0.5439 0.000 0.000 0.664 0.336
#> GSM258602 2 0.4153 0.6502 0.000 0.820 0.048 0.132
#> GSM258604 3 0.4624 0.5457 0.000 0.000 0.660 0.340
#> GSM258605 3 0.4679 0.5415 0.000 0.000 0.648 0.352
#> GSM258606 2 0.0000 0.7835 0.000 1.000 0.000 0.000
#> GSM258607 4 0.5189 0.8835 0.000 0.012 0.372 0.616
#> GSM258608 3 0.6307 -0.0131 0.000 0.288 0.620 0.092
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> GSM258553 1 0.0404 0.8755 0.988 0.000 0.000 0.012 0.000
#> GSM258555 1 0.0404 0.8752 0.988 0.000 0.000 0.012 0.000
#> GSM258556 4 0.5296 0.5938 0.000 0.000 0.180 0.676 0.144
#> GSM258557 5 0.7780 0.2682 0.144 0.000 0.184 0.184 0.488
#> GSM258562 3 0.4419 0.2440 0.000 0.000 0.668 0.020 0.312
#> GSM258563 1 0.6597 0.6501 0.592 0.000 0.040 0.176 0.192
#> GSM258565 1 0.0162 0.8757 0.996 0.000 0.000 0.004 0.000
#> GSM258566 1 0.0162 0.8757 0.996 0.000 0.000 0.004 0.000
#> GSM258570 1 0.0510 0.8755 0.984 0.000 0.000 0.016 0.000
#> GSM258578 1 0.0404 0.8752 0.988 0.000 0.000 0.012 0.000
#> GSM258580 5 0.4675 0.4569 0.000 0.004 0.360 0.016 0.620
#> GSM258583 1 0.6166 0.6936 0.632 0.000 0.028 0.176 0.164
#> GSM258585 5 0.6016 0.3486 0.000 0.000 0.236 0.184 0.580
#> GSM258590 1 0.0510 0.8755 0.984 0.000 0.000 0.016 0.000
#> GSM258594 1 0.0000 0.8759 1.000 0.000 0.000 0.000 0.000
#> GSM258596 1 0.6242 0.6895 0.628 0.000 0.032 0.176 0.164
#> GSM258599 1 0.6208 0.6931 0.632 0.000 0.032 0.176 0.160
#> GSM258603 1 0.0404 0.8755 0.988 0.000 0.000 0.012 0.000
#> GSM258551 4 0.5295 0.2104 0.000 0.464 0.000 0.488 0.048
#> GSM258552 5 0.4470 0.4691 0.000 0.012 0.372 0.000 0.616
#> GSM258554 2 0.4731 0.2692 0.000 0.640 0.000 0.328 0.032
#> GSM258558 2 0.1124 0.6738 0.000 0.960 0.000 0.004 0.036
#> GSM258559 2 0.6358 0.4263 0.000 0.640 0.076 0.100 0.184
#> GSM258560 3 0.6508 0.2937 0.000 0.028 0.508 0.104 0.360
#> GSM258561 2 0.6249 -0.1908 0.000 0.452 0.084 0.444 0.020
#> GSM258564 4 0.4623 0.5961 0.000 0.304 0.000 0.664 0.032
#> GSM258567 3 0.5865 0.3373 0.000 0.004 0.568 0.104 0.324
#> GSM258568 2 0.0162 0.6843 0.000 0.996 0.000 0.004 0.000
#> GSM258569 3 0.4516 -0.0954 0.000 0.004 0.576 0.004 0.416
#> GSM258571 3 0.0000 0.5894 0.000 0.000 1.000 0.000 0.000
#> GSM258572 5 0.4109 0.5147 0.000 0.012 0.288 0.000 0.700
#> GSM258573 2 0.4249 0.3561 0.000 0.688 0.000 0.296 0.016
#> GSM258574 5 0.4550 0.5103 0.000 0.064 0.188 0.004 0.744
#> GSM258575 2 0.0404 0.6837 0.000 0.988 0.000 0.000 0.012
#> GSM258576 2 0.0162 0.6843 0.000 0.996 0.000 0.004 0.000
#> GSM258577 5 0.5165 0.4537 0.000 0.032 0.244 0.036 0.688
#> GSM258579 2 0.0290 0.6837 0.000 0.992 0.000 0.000 0.008
#> GSM258581 2 0.0000 0.6851 0.000 1.000 0.000 0.000 0.000
#> GSM258582 3 0.0609 0.5831 0.000 0.000 0.980 0.000 0.020
#> GSM258584 3 0.7682 0.1892 0.000 0.128 0.412 0.108 0.352
#> GSM258586 4 0.5149 0.5714 0.000 0.000 0.104 0.680 0.216
#> GSM258587 2 0.3890 0.4348 0.000 0.736 0.000 0.252 0.012
#> GSM258588 2 0.7358 0.2068 0.000 0.500 0.116 0.100 0.284
#> GSM258589 5 0.5417 0.3531 0.000 0.036 0.304 0.028 0.632
#> GSM258591 2 0.4380 0.3404 0.000 0.676 0.000 0.304 0.020
#> GSM258592 3 0.5329 0.4455 0.000 0.004 0.672 0.104 0.220
#> GSM258593 5 0.7171 0.2690 0.056 0.000 0.284 0.156 0.504
#> GSM258595 3 0.4047 0.2121 0.000 0.000 0.676 0.004 0.320
#> GSM258597 4 0.4366 0.5771 0.000 0.320 0.000 0.664 0.016
#> GSM258598 4 0.4066 0.5767 0.000 0.324 0.000 0.672 0.004
#> GSM258600 5 0.4678 0.4976 0.000 0.012 0.328 0.012 0.648
#> GSM258601 3 0.1168 0.5880 0.000 0.000 0.960 0.008 0.032
#> GSM258602 2 0.5741 0.4733 0.000 0.692 0.048 0.100 0.160
#> GSM258604 3 0.0566 0.5887 0.000 0.000 0.984 0.004 0.012
#> GSM258605 3 0.0290 0.5895 0.000 0.000 0.992 0.000 0.008
#> GSM258606 2 0.0000 0.6851 0.000 1.000 0.000 0.000 0.000
#> GSM258607 4 0.5263 0.5971 0.000 0.000 0.176 0.680 0.144
#> GSM258608 5 0.5744 0.3258 0.000 0.160 0.112 0.040 0.688
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> GSM258553 1 0.0405 0.9760 0.988 0.000 0.008 0.004 0.000 0.000
#> GSM258555 1 0.1124 0.9710 0.956 0.000 0.008 0.036 0.000 0.000
#> GSM258556 4 0.2153 0.7258 0.000 0.040 0.040 0.912 0.004 0.004
#> GSM258557 5 0.2881 0.3649 0.084 0.032 0.012 0.004 0.868 0.000
#> GSM258562 2 0.4454 0.4457 0.000 0.736 0.108 0.012 0.144 0.000
#> GSM258563 5 0.3923 0.1663 0.416 0.004 0.000 0.000 0.580 0.000
#> GSM258565 1 0.0806 0.9744 0.972 0.000 0.008 0.020 0.000 0.000
#> GSM258566 1 0.0806 0.9744 0.972 0.000 0.008 0.020 0.000 0.000
#> GSM258570 1 0.0725 0.9752 0.976 0.000 0.012 0.012 0.000 0.000
#> GSM258578 1 0.1124 0.9710 0.956 0.000 0.008 0.036 0.000 0.000
#> GSM258580 2 0.5743 0.2822 0.000 0.508 0.064 0.036 0.388 0.004
#> GSM258583 5 0.3996 0.0269 0.484 0.004 0.000 0.000 0.512 0.000
#> GSM258585 5 0.2076 0.2959 0.000 0.060 0.012 0.016 0.912 0.000
#> GSM258590 1 0.0622 0.9758 0.980 0.000 0.012 0.008 0.000 0.000
#> GSM258594 1 0.0146 0.9774 0.996 0.000 0.004 0.000 0.000 0.000
#> GSM258596 5 0.4214 0.0850 0.460 0.004 0.000 0.008 0.528 0.000
#> GSM258599 5 0.3995 0.0388 0.480 0.004 0.000 0.000 0.516 0.000
#> GSM258603 1 0.0405 0.9760 0.988 0.000 0.008 0.004 0.000 0.000
#> GSM258551 4 0.6008 0.3319 0.000 0.044 0.036 0.516 0.032 0.372
#> GSM258552 2 0.5919 0.2600 0.000 0.468 0.072 0.040 0.416 0.004
#> GSM258554 6 0.6121 0.4585 0.000 0.060 0.036 0.232 0.060 0.612
#> GSM258558 6 0.1710 0.7871 0.000 0.028 0.020 0.000 0.016 0.936
#> GSM258559 3 0.4072 0.4561 0.000 0.000 0.544 0.008 0.000 0.448
#> GSM258560 3 0.3508 0.5275 0.000 0.152 0.808 0.020 0.008 0.012
#> GSM258561 4 0.6768 0.4683 0.000 0.048 0.096 0.524 0.048 0.284
#> GSM258564 4 0.2340 0.7381 0.000 0.000 0.000 0.852 0.000 0.148
#> GSM258567 3 0.2408 0.5292 0.000 0.068 0.896 0.008 0.024 0.004
#> GSM258568 6 0.0891 0.7980 0.000 0.000 0.024 0.000 0.008 0.968
#> GSM258569 2 0.4035 0.3929 0.000 0.712 0.016 0.016 0.256 0.000
#> GSM258571 2 0.5135 0.3502 0.000 0.584 0.344 0.040 0.032 0.000
#> GSM258572 2 0.6372 0.2238 0.000 0.432 0.112 0.048 0.404 0.004
#> GSM258573 6 0.5608 0.5742 0.000 0.052 0.044 0.184 0.044 0.676
#> GSM258574 5 0.7071 -0.2793 0.000 0.380 0.152 0.048 0.392 0.028
#> GSM258575 6 0.1218 0.7828 0.000 0.000 0.028 0.004 0.012 0.956
#> GSM258576 6 0.0405 0.8073 0.000 0.000 0.004 0.000 0.008 0.988
#> GSM258577 5 0.7509 -0.2185 0.000 0.308 0.260 0.064 0.344 0.024
#> GSM258579 6 0.0551 0.8057 0.000 0.000 0.008 0.004 0.004 0.984
#> GSM258581 6 0.0000 0.8076 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM258582 2 0.5123 0.3519 0.000 0.588 0.340 0.040 0.032 0.000
#> GSM258584 3 0.4289 0.5891 0.000 0.104 0.780 0.020 0.012 0.084
#> GSM258586 4 0.2259 0.7171 0.000 0.032 0.040 0.908 0.020 0.000
#> GSM258587 6 0.5326 0.6161 0.000 0.052 0.040 0.156 0.044 0.708
#> GSM258588 3 0.5186 0.5217 0.000 0.028 0.548 0.004 0.032 0.388
#> GSM258589 2 0.6742 0.2006 0.000 0.408 0.344 0.040 0.204 0.004
#> GSM258591 6 0.5460 0.5517 0.000 0.032 0.040 0.208 0.048 0.672
#> GSM258592 3 0.2488 0.4794 0.000 0.124 0.864 0.008 0.000 0.004
#> GSM258593 5 0.3623 0.1821 0.020 0.208 0.000 0.008 0.764 0.000
#> GSM258595 2 0.5431 0.4509 0.000 0.652 0.128 0.036 0.184 0.000
#> GSM258597 4 0.5516 0.6828 0.000 0.052 0.040 0.684 0.044 0.180
#> GSM258598 4 0.4593 0.7167 0.000 0.028 0.024 0.748 0.036 0.164
#> GSM258600 2 0.5979 0.2704 0.000 0.484 0.080 0.040 0.392 0.004
#> GSM258601 2 0.4949 0.3458 0.000 0.588 0.352 0.040 0.020 0.000
#> GSM258602 3 0.4097 0.3610 0.000 0.000 0.500 0.008 0.000 0.492
#> GSM258604 2 0.5135 0.3502 0.000 0.584 0.344 0.040 0.032 0.000
#> GSM258605 2 0.5147 0.3447 0.000 0.580 0.348 0.040 0.032 0.000
#> GSM258606 6 0.0146 0.8060 0.000 0.000 0.004 0.000 0.000 0.996
#> GSM258607 4 0.2077 0.7266 0.000 0.044 0.032 0.916 0.004 0.004
#> GSM258608 5 0.8222 -0.1218 0.000 0.220 0.296 0.064 0.312 0.108
Heatmaps for the consensus matrix. It visualizes the probability of two samples to be in a same group.
consensus_heatmap(res, k = 2)
consensus_heatmap(res, k = 3)
consensus_heatmap(res, k = 4)
consensus_heatmap(res, k = 5)
consensus_heatmap(res, k = 6)
Heatmaps for the membership of samples in all partitions to see how consistent they are:
membership_heatmap(res, k = 2)
membership_heatmap(res, k = 3)
membership_heatmap(res, k = 4)
membership_heatmap(res, k = 5)
membership_heatmap(res, k = 6)
As soon as we have had the classes for columns, we can look for signatures which are significantly different between classes which can be candidate marks for certain classes. Following are the heatmaps for signatures.
Signature heatmaps where rows are scaled:
get_signatures(res, k = 2)
get_signatures(res, k = 3)
get_signatures(res, k = 4)
get_signatures(res, k = 5)
get_signatures(res, k = 6)
Signature heatmaps where rows are not scaled:
get_signatures(res, k = 2, scale_rows = FALSE)
get_signatures(res, k = 3, scale_rows = FALSE)
get_signatures(res, k = 4, scale_rows = FALSE)
get_signatures(res, k = 5, scale_rows = FALSE)
get_signatures(res, k = 6, scale_rows = FALSE)
Compare the overlap of signatures from different k:
compare_signatures(res)
get_signature()
returns a data frame invisibly. TO get the list of signatures, the function
call should be assigned to a variable explicitly. In following code, if plot
argument is set
to FALSE
, no heatmap is plotted while only the differential analysis is performed.
# code only for demonstration
tb = get_signature(res, k = ..., plot = FALSE)
An example of the output of tb
is:
#> which_row fdr mean_1 mean_2 scaled_mean_1 scaled_mean_2 km
#> 1 38 0.042760348 8.373488 9.131774 -0.5533452 0.5164555 1
#> 2 40 0.018707592 7.106213 8.469186 -0.6173731 0.5762149 1
#> 3 55 0.019134737 10.221463 11.207825 -0.6159697 0.5749050 1
#> 4 59 0.006059896 5.921854 7.869574 -0.6899429 0.6439467 1
#> 5 60 0.018055526 8.928898 10.211722 -0.6204761 0.5791110 1
#> 6 98 0.009384629 15.714769 14.887706 0.6635654 -0.6193277 2
...
The columns in tb
are:
which_row
: row indices corresponding to the input matrix.fdr
: FDR for the differential test. mean_x
: The mean value in group x.scaled_mean_x
: The mean value in group x after rows are scaled.km
: Row groups if k-means clustering is applied to rows.UMAP plot which shows how samples are separated.
dimension_reduction(res, k = 2, method = "UMAP")
dimension_reduction(res, k = 3, method = "UMAP")
dimension_reduction(res, k = 4, method = "UMAP")
dimension_reduction(res, k = 5, method = "UMAP")
dimension_reduction(res, k = 6, method = "UMAP")
Following heatmap shows how subgroups are split when increasing k
:
collect_classes(res)
Test correlation between subgroups and known annotations. If the known annotation is numeric, one-way ANOVA test is applied, and if the known annotation is discrete, chi-squared contingency table test is applied.
test_to_known_factors(res)
#> n disease.state(p) k
#> SD:kmeans 57 3.66e-10 2
#> SD:kmeans 55 2.79e-09 3
#> SD:kmeans 51 1.23e-08 4
#> SD:kmeans 33 5.94e-06 5
#> SD:kmeans 29 1.33e-05 6
If matrix rows can be associated to genes, consider to use functional_enrichment(res,
...)
to perform function enrichment for the signature genes. See this vignette for more detailed explanations.
The object with results only for a single top-value method and a single partition method can be extracted as:
res = res_list["SD", "skmeans"]
# you can also extract it by
# res = res_list["SD:skmeans"]
A summary of res
and all the functions that can be applied to it:
res
#> A 'ConsensusPartition' object with k = 2, 3, 4, 5, 6.
#> On a matrix with 51941 rows and 58 columns.
#> Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'SD' method.
#> Subgroups are detected by 'skmeans' method.
#> Performed in total 1250 partitions by row resampling.
#> Best k for subgroups seems to be 2.
#>
#> Following methods can be applied to this 'ConsensusPartition' object:
#> [1] "cola_report" "collect_classes" "collect_plots"
#> [4] "collect_stats" "colnames" "compare_signatures"
#> [7] "consensus_heatmap" "dimension_reduction" "functional_enrichment"
#> [10] "get_anno_col" "get_anno" "get_classes"
#> [13] "get_consensus" "get_matrix" "get_membership"
#> [16] "get_param" "get_signatures" "get_stats"
#> [19] "is_best_k" "is_stable_k" "membership_heatmap"
#> [22] "ncol" "nrow" "plot_ecdf"
#> [25] "rownames" "select_partition_number" "show"
#> [28] "suggest_best_k" "test_to_known_factors"
collect_plots()
function collects all the plots made from res
for all k
(number of partitions)
into one single page to provide an easy and fast comparison between different k
.
collect_plots(res)
The plots are:
k
and the heatmap of
predicted classes for each k
.k
.k
.k
.All the plots in panels can be made by individual functions and they are plotted later in this section.
select_partition_number()
produces several plots showing different
statistics for choosing “optimized” k
. There are following statistics:
k
;k
, the area increased is defined as \(A_k - A_{k-1}\).The detailed explanations of these statistics can be found in the cola vignette.
Generally speaking, lower PAC score, higher mean silhouette score or higher
concordance corresponds to better partition. Rand index and Jaccard index
measure how similar the current partition is compared to partition with k-1
.
If they are too similar, we won't accept k
is better than k-1
.
select_partition_number(res)
The numeric values for all these statistics can be obtained by get_stats()
.
get_stats(res)
#> k 1-PAC mean_silhouette concordance area_increased Rand Jaccard
#> 2 2 1.000 0.973 0.988 0.4934 0.506 0.506
#> 3 3 0.868 0.910 0.950 0.3618 0.705 0.477
#> 4 4 0.737 0.691 0.826 0.1173 0.861 0.613
#> 5 5 0.772 0.730 0.848 0.0656 0.866 0.539
#> 6 6 0.759 0.604 0.780 0.0371 0.967 0.842
suggest_best_k()
suggests the best \(k\) based on these statistics. The rules are as follows:
suggest_best_k(res)
#> [1] 2
Following shows the table of the partitions (You need to click the show/hide
code output link to see it). The membership matrix (columns with name p*
)
is inferred by
clue::cl_consensus()
function with the SE
method. Basically the value in the membership matrix
represents the probability to belong to a certain group. The finall class
label for an item is determined with the group with highest probability it
belongs to.
In get_classes()
function, the entropy is calculated from the membership
matrix and the silhouette score is calculated from the consensus matrix.
cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#> class entropy silhouette p1 p2
#> GSM258553 1 0.000 0.985 1.000 0.000
#> GSM258555 1 0.000 0.985 1.000 0.000
#> GSM258556 2 0.000 0.990 0.000 1.000
#> GSM258557 1 0.000 0.985 1.000 0.000
#> GSM258562 1 0.000 0.985 1.000 0.000
#> GSM258563 1 0.000 0.985 1.000 0.000
#> GSM258565 1 0.000 0.985 1.000 0.000
#> GSM258566 1 0.000 0.985 1.000 0.000
#> GSM258570 1 0.000 0.985 1.000 0.000
#> GSM258578 1 0.000 0.985 1.000 0.000
#> GSM258580 1 0.706 0.769 0.808 0.192
#> GSM258583 1 0.000 0.985 1.000 0.000
#> GSM258585 1 0.000 0.985 1.000 0.000
#> GSM258590 1 0.000 0.985 1.000 0.000
#> GSM258594 1 0.000 0.985 1.000 0.000
#> GSM258596 1 0.000 0.985 1.000 0.000
#> GSM258599 1 0.000 0.985 1.000 0.000
#> GSM258603 1 0.000 0.985 1.000 0.000
#> GSM258551 2 0.000 0.990 0.000 1.000
#> GSM258552 2 0.000 0.990 0.000 1.000
#> GSM258554 2 0.000 0.990 0.000 1.000
#> GSM258558 2 0.000 0.990 0.000 1.000
#> GSM258559 2 0.000 0.990 0.000 1.000
#> GSM258560 2 0.000 0.990 0.000 1.000
#> GSM258561 2 0.000 0.990 0.000 1.000
#> GSM258564 2 0.000 0.990 0.000 1.000
#> GSM258567 2 0.000 0.990 0.000 1.000
#> GSM258568 2 0.000 0.990 0.000 1.000
#> GSM258569 1 0.552 0.856 0.872 0.128
#> GSM258571 1 0.000 0.985 1.000 0.000
#> GSM258572 2 0.000 0.990 0.000 1.000
#> GSM258573 2 0.000 0.990 0.000 1.000
#> GSM258574 2 0.000 0.990 0.000 1.000
#> GSM258575 2 0.000 0.990 0.000 1.000
#> GSM258576 2 0.000 0.990 0.000 1.000
#> GSM258577 2 0.000 0.990 0.000 1.000
#> GSM258579 2 0.000 0.990 0.000 1.000
#> GSM258581 2 0.000 0.990 0.000 1.000
#> GSM258582 1 0.000 0.985 1.000 0.000
#> GSM258584 2 0.000 0.990 0.000 1.000
#> GSM258586 2 0.000 0.990 0.000 1.000
#> GSM258587 2 0.000 0.990 0.000 1.000
#> GSM258588 2 0.000 0.990 0.000 1.000
#> GSM258589 2 0.000 0.990 0.000 1.000
#> GSM258591 2 0.000 0.990 0.000 1.000
#> GSM258592 2 0.000 0.990 0.000 1.000
#> GSM258593 1 0.000 0.985 1.000 0.000
#> GSM258595 1 0.184 0.961 0.972 0.028
#> GSM258597 2 0.000 0.990 0.000 1.000
#> GSM258598 2 0.000 0.990 0.000 1.000
#> GSM258600 2 0.000 0.990 0.000 1.000
#> GSM258601 2 0.913 0.495 0.328 0.672
#> GSM258602 2 0.000 0.990 0.000 1.000
#> GSM258604 1 0.000 0.985 1.000 0.000
#> GSM258605 1 0.000 0.985 1.000 0.000
#> GSM258606 2 0.000 0.990 0.000 1.000
#> GSM258607 2 0.000 0.990 0.000 1.000
#> GSM258608 2 0.000 0.990 0.000 1.000
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> GSM258553 1 0.0000 0.999 1.000 0.000 0.000
#> GSM258555 1 0.0000 0.999 1.000 0.000 0.000
#> GSM258556 3 0.2878 0.880 0.000 0.096 0.904
#> GSM258557 1 0.0747 0.982 0.984 0.000 0.016
#> GSM258562 3 0.2878 0.880 0.096 0.000 0.904
#> GSM258563 1 0.0000 0.999 1.000 0.000 0.000
#> GSM258565 1 0.0000 0.999 1.000 0.000 0.000
#> GSM258566 1 0.0000 0.999 1.000 0.000 0.000
#> GSM258570 1 0.0000 0.999 1.000 0.000 0.000
#> GSM258578 1 0.0000 0.999 1.000 0.000 0.000
#> GSM258580 3 0.7308 0.560 0.296 0.056 0.648
#> GSM258583 1 0.0000 0.999 1.000 0.000 0.000
#> GSM258585 1 0.0000 0.999 1.000 0.000 0.000
#> GSM258590 1 0.0000 0.999 1.000 0.000 0.000
#> GSM258594 1 0.0000 0.999 1.000 0.000 0.000
#> GSM258596 1 0.0000 0.999 1.000 0.000 0.000
#> GSM258599 1 0.0000 0.999 1.000 0.000 0.000
#> GSM258603 1 0.0000 0.999 1.000 0.000 0.000
#> GSM258551 2 0.0000 0.948 0.000 1.000 0.000
#> GSM258552 3 0.1643 0.903 0.000 0.044 0.956
#> GSM258554 2 0.0000 0.948 0.000 1.000 0.000
#> GSM258558 2 0.0424 0.948 0.000 0.992 0.008
#> GSM258559 2 0.1643 0.930 0.000 0.956 0.044
#> GSM258560 3 0.1753 0.901 0.000 0.048 0.952
#> GSM258561 2 0.0892 0.936 0.000 0.980 0.020
#> GSM258564 2 0.0237 0.946 0.000 0.996 0.004
#> GSM258567 3 0.0000 0.906 0.000 0.000 1.000
#> GSM258568 2 0.0424 0.948 0.000 0.992 0.008
#> GSM258569 3 0.1031 0.908 0.024 0.000 0.976
#> GSM258571 3 0.1529 0.906 0.040 0.000 0.960
#> GSM258572 3 0.1860 0.900 0.000 0.052 0.948
#> GSM258573 2 0.0000 0.948 0.000 1.000 0.000
#> GSM258574 2 0.5859 0.493 0.000 0.656 0.344
#> GSM258575 2 0.0424 0.948 0.000 0.992 0.008
#> GSM258576 2 0.0424 0.948 0.000 0.992 0.008
#> GSM258577 3 0.5016 0.694 0.000 0.240 0.760
#> GSM258579 2 0.0424 0.948 0.000 0.992 0.008
#> GSM258581 2 0.0424 0.948 0.000 0.992 0.008
#> GSM258582 3 0.1643 0.905 0.044 0.000 0.956
#> GSM258584 2 0.6204 0.276 0.000 0.576 0.424
#> GSM258586 3 0.3941 0.842 0.000 0.156 0.844
#> GSM258587 2 0.0000 0.948 0.000 1.000 0.000
#> GSM258588 2 0.3267 0.863 0.000 0.884 0.116
#> GSM258589 3 0.3551 0.843 0.000 0.132 0.868
#> GSM258591 2 0.0000 0.948 0.000 1.000 0.000
#> GSM258592 3 0.0000 0.906 0.000 0.000 1.000
#> GSM258593 1 0.0000 0.999 1.000 0.000 0.000
#> GSM258595 3 0.2096 0.903 0.052 0.004 0.944
#> GSM258597 2 0.0000 0.948 0.000 1.000 0.000
#> GSM258598 2 0.0000 0.948 0.000 1.000 0.000
#> GSM258600 3 0.1529 0.904 0.000 0.040 0.960
#> GSM258601 3 0.0983 0.908 0.004 0.016 0.980
#> GSM258602 2 0.0592 0.947 0.000 0.988 0.012
#> GSM258604 3 0.2860 0.886 0.084 0.004 0.912
#> GSM258605 3 0.2356 0.894 0.072 0.000 0.928
#> GSM258606 2 0.0424 0.948 0.000 0.992 0.008
#> GSM258607 3 0.4654 0.777 0.000 0.208 0.792
#> GSM258608 2 0.1753 0.924 0.000 0.952 0.048
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> GSM258553 1 0.0000 0.9851 1.000 0.000 0.000 0.000
#> GSM258555 1 0.0000 0.9851 1.000 0.000 0.000 0.000
#> GSM258556 3 0.7799 0.0490 0.000 0.272 0.420 0.308
#> GSM258557 1 0.3105 0.8271 0.856 0.000 0.004 0.140
#> GSM258562 3 0.5374 0.5194 0.052 0.000 0.704 0.244
#> GSM258563 1 0.0000 0.9851 1.000 0.000 0.000 0.000
#> GSM258565 1 0.0000 0.9851 1.000 0.000 0.000 0.000
#> GSM258566 1 0.0000 0.9851 1.000 0.000 0.000 0.000
#> GSM258570 1 0.0000 0.9851 1.000 0.000 0.000 0.000
#> GSM258578 1 0.0000 0.9851 1.000 0.000 0.000 0.000
#> GSM258580 4 0.4552 0.5606 0.072 0.000 0.128 0.800
#> GSM258583 1 0.0000 0.9851 1.000 0.000 0.000 0.000
#> GSM258585 1 0.0188 0.9818 0.996 0.000 0.000 0.004
#> GSM258590 1 0.0000 0.9851 1.000 0.000 0.000 0.000
#> GSM258594 1 0.0000 0.9851 1.000 0.000 0.000 0.000
#> GSM258596 1 0.0000 0.9851 1.000 0.000 0.000 0.000
#> GSM258599 1 0.0000 0.9851 1.000 0.000 0.000 0.000
#> GSM258603 1 0.0000 0.9851 1.000 0.000 0.000 0.000
#> GSM258551 2 0.0707 0.7923 0.000 0.980 0.000 0.020
#> GSM258552 4 0.3908 0.5206 0.000 0.004 0.212 0.784
#> GSM258554 2 0.0469 0.7952 0.000 0.988 0.000 0.012
#> GSM258558 2 0.4008 0.7567 0.000 0.756 0.000 0.244
#> GSM258559 2 0.6248 0.6150 0.000 0.640 0.100 0.260
#> GSM258560 3 0.6028 0.3314 0.000 0.052 0.584 0.364
#> GSM258561 2 0.1661 0.7697 0.000 0.944 0.052 0.004
#> GSM258564 2 0.1284 0.7841 0.000 0.964 0.012 0.024
#> GSM258567 3 0.3873 0.5614 0.000 0.000 0.772 0.228
#> GSM258568 2 0.3610 0.7783 0.000 0.800 0.000 0.200
#> GSM258569 3 0.4998 0.0641 0.000 0.000 0.512 0.488
#> GSM258571 3 0.0469 0.6981 0.000 0.000 0.988 0.012
#> GSM258572 4 0.2999 0.6006 0.000 0.004 0.132 0.864
#> GSM258573 2 0.0188 0.7967 0.000 0.996 0.004 0.000
#> GSM258574 4 0.0895 0.6262 0.000 0.020 0.004 0.976
#> GSM258575 2 0.3873 0.7629 0.000 0.772 0.000 0.228
#> GSM258576 2 0.3610 0.7783 0.000 0.800 0.000 0.200
#> GSM258577 4 0.3647 0.6136 0.000 0.040 0.108 0.852
#> GSM258579 2 0.3801 0.7679 0.000 0.780 0.000 0.220
#> GSM258581 2 0.3610 0.7783 0.000 0.800 0.000 0.200
#> GSM258582 3 0.1209 0.6979 0.004 0.000 0.964 0.032
#> GSM258584 3 0.7459 0.0892 0.000 0.188 0.476 0.336
#> GSM258586 4 0.7203 0.3106 0.000 0.288 0.176 0.536
#> GSM258587 2 0.0524 0.7989 0.000 0.988 0.004 0.008
#> GSM258588 4 0.6197 -0.0876 0.000 0.400 0.056 0.544
#> GSM258589 4 0.4673 0.5712 0.000 0.076 0.132 0.792
#> GSM258591 2 0.0376 0.7982 0.000 0.992 0.004 0.004
#> GSM258592 3 0.2281 0.6691 0.000 0.000 0.904 0.096
#> GSM258593 1 0.1938 0.9266 0.936 0.000 0.012 0.052
#> GSM258595 3 0.5251 0.5707 0.032 0.016 0.740 0.212
#> GSM258597 2 0.1059 0.7884 0.000 0.972 0.012 0.016
#> GSM258598 2 0.0469 0.7941 0.000 0.988 0.012 0.000
#> GSM258600 4 0.4059 0.5454 0.000 0.012 0.200 0.788
#> GSM258601 3 0.0707 0.6990 0.000 0.000 0.980 0.020
#> GSM258602 2 0.5083 0.7092 0.000 0.716 0.036 0.248
#> GSM258604 3 0.0967 0.6980 0.004 0.004 0.976 0.016
#> GSM258605 3 0.0657 0.6963 0.012 0.000 0.984 0.004
#> GSM258606 2 0.3610 0.7783 0.000 0.800 0.000 0.200
#> GSM258607 2 0.7845 -0.2891 0.000 0.400 0.320 0.280
#> GSM258608 4 0.4401 0.3967 0.000 0.272 0.004 0.724
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> GSM258553 1 0.0000 0.977 1.000 0.000 0.000 0.000 0.000
#> GSM258555 1 0.0000 0.977 1.000 0.000 0.000 0.000 0.000
#> GSM258556 4 0.4555 0.588 0.000 0.004 0.196 0.740 0.060
#> GSM258557 1 0.2624 0.860 0.872 0.012 0.000 0.000 0.116
#> GSM258562 3 0.5551 0.158 0.036 0.004 0.540 0.012 0.408
#> GSM258563 1 0.0290 0.973 0.992 0.008 0.000 0.000 0.000
#> GSM258565 1 0.0000 0.977 1.000 0.000 0.000 0.000 0.000
#> GSM258566 1 0.0000 0.977 1.000 0.000 0.000 0.000 0.000
#> GSM258570 1 0.0000 0.977 1.000 0.000 0.000 0.000 0.000
#> GSM258578 1 0.0000 0.977 1.000 0.000 0.000 0.000 0.000
#> GSM258580 5 0.2073 0.831 0.012 0.016 0.032 0.008 0.932
#> GSM258583 1 0.0290 0.973 0.992 0.008 0.000 0.000 0.000
#> GSM258585 1 0.0693 0.967 0.980 0.012 0.000 0.000 0.008
#> GSM258590 1 0.0000 0.977 1.000 0.000 0.000 0.000 0.000
#> GSM258594 1 0.0000 0.977 1.000 0.000 0.000 0.000 0.000
#> GSM258596 1 0.0000 0.977 1.000 0.000 0.000 0.000 0.000
#> GSM258599 1 0.0000 0.977 1.000 0.000 0.000 0.000 0.000
#> GSM258603 1 0.0000 0.977 1.000 0.000 0.000 0.000 0.000
#> GSM258551 4 0.2462 0.757 0.000 0.112 0.000 0.880 0.008
#> GSM258552 5 0.0992 0.844 0.000 0.008 0.024 0.000 0.968
#> GSM258554 4 0.2929 0.738 0.000 0.152 0.000 0.840 0.008
#> GSM258558 2 0.4754 0.640 0.000 0.684 0.000 0.264 0.052
#> GSM258559 2 0.1806 0.655 0.000 0.940 0.028 0.016 0.016
#> GSM258560 2 0.6060 -0.145 0.000 0.504 0.384 0.004 0.108
#> GSM258561 4 0.3994 0.740 0.000 0.140 0.068 0.792 0.000
#> GSM258564 4 0.0579 0.775 0.000 0.008 0.008 0.984 0.000
#> GSM258567 3 0.5158 0.582 0.000 0.264 0.656 0.000 0.080
#> GSM258568 2 0.3700 0.683 0.000 0.752 0.000 0.240 0.008
#> GSM258569 5 0.4142 0.495 0.000 0.004 0.308 0.004 0.684
#> GSM258571 3 0.0451 0.787 0.000 0.008 0.988 0.000 0.004
#> GSM258572 5 0.0566 0.845 0.000 0.012 0.004 0.000 0.984
#> GSM258573 4 0.3039 0.701 0.000 0.192 0.000 0.808 0.000
#> GSM258574 5 0.1121 0.838 0.000 0.044 0.000 0.000 0.956
#> GSM258575 2 0.4058 0.685 0.000 0.740 0.000 0.236 0.024
#> GSM258576 2 0.3689 0.671 0.000 0.740 0.000 0.256 0.004
#> GSM258577 5 0.3993 0.730 0.000 0.160 0.024 0.020 0.796
#> GSM258579 2 0.4114 0.680 0.000 0.732 0.000 0.244 0.024
#> GSM258581 2 0.3689 0.671 0.000 0.740 0.000 0.256 0.004
#> GSM258582 3 0.0566 0.786 0.000 0.000 0.984 0.004 0.012
#> GSM258584 2 0.4920 0.199 0.000 0.644 0.308 0.000 0.048
#> GSM258586 4 0.4703 0.625 0.000 0.008 0.096 0.752 0.144
#> GSM258587 4 0.3928 0.536 0.000 0.296 0.000 0.700 0.004
#> GSM258588 2 0.3174 0.590 0.000 0.844 0.020 0.004 0.132
#> GSM258589 5 0.5114 0.593 0.000 0.236 0.056 0.016 0.692
#> GSM258591 4 0.3586 0.608 0.000 0.264 0.000 0.736 0.000
#> GSM258592 3 0.4223 0.637 0.000 0.248 0.724 0.000 0.028
#> GSM258593 1 0.3289 0.784 0.816 0.004 0.008 0.000 0.172
#> GSM258595 3 0.6131 0.446 0.044 0.000 0.612 0.076 0.268
#> GSM258597 4 0.0963 0.779 0.000 0.036 0.000 0.964 0.000
#> GSM258598 4 0.0963 0.779 0.000 0.036 0.000 0.964 0.000
#> GSM258600 5 0.0566 0.844 0.000 0.000 0.012 0.004 0.984
#> GSM258601 3 0.0912 0.784 0.000 0.000 0.972 0.016 0.012
#> GSM258602 2 0.1186 0.665 0.000 0.964 0.008 0.020 0.008
#> GSM258604 3 0.0880 0.780 0.000 0.000 0.968 0.032 0.000
#> GSM258605 3 0.0798 0.785 0.008 0.016 0.976 0.000 0.000
#> GSM258606 2 0.3274 0.690 0.000 0.780 0.000 0.220 0.000
#> GSM258607 4 0.3983 0.641 0.000 0.000 0.164 0.784 0.052
#> GSM258608 2 0.5351 0.335 0.000 0.624 0.004 0.068 0.304
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> GSM258553 1 0.0000 0.8669 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM258555 1 0.0146 0.8669 0.996 0.000 0.000 0.004 0.000 0.000
#> GSM258556 4 0.3597 0.6689 0.000 0.016 0.072 0.832 0.068 0.012
#> GSM258557 1 0.6175 0.6745 0.572 0.092 0.012 0.056 0.268 0.000
#> GSM258562 3 0.6976 0.1246 0.076 0.336 0.460 0.028 0.100 0.000
#> GSM258563 1 0.4668 0.7757 0.688 0.004 0.012 0.056 0.240 0.000
#> GSM258565 1 0.0146 0.8669 0.996 0.000 0.000 0.004 0.000 0.000
#> GSM258566 1 0.0146 0.8669 0.996 0.000 0.000 0.004 0.000 0.000
#> GSM258570 1 0.0146 0.8669 0.996 0.000 0.000 0.004 0.000 0.000
#> GSM258578 1 0.0146 0.8669 0.996 0.000 0.000 0.004 0.000 0.000
#> GSM258580 2 0.3553 0.7514 0.004 0.840 0.040 0.020 0.084 0.012
#> GSM258583 1 0.3956 0.8062 0.748 0.000 0.008 0.040 0.204 0.000
#> GSM258585 1 0.5406 0.7461 0.640 0.036 0.012 0.056 0.256 0.000
#> GSM258590 1 0.0000 0.8669 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM258594 1 0.0146 0.8669 0.996 0.000 0.000 0.004 0.000 0.000
#> GSM258596 1 0.3708 0.8187 0.784 0.004 0.008 0.032 0.172 0.000
#> GSM258599 1 0.4179 0.7990 0.732 0.004 0.008 0.040 0.216 0.000
#> GSM258603 1 0.0000 0.8669 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM258551 4 0.4585 0.6770 0.000 0.000 0.000 0.648 0.068 0.284
#> GSM258552 2 0.1375 0.8044 0.000 0.952 0.008 0.004 0.028 0.008
#> GSM258554 4 0.4716 0.6038 0.000 0.004 0.000 0.576 0.044 0.376
#> GSM258558 6 0.2112 0.6446 0.000 0.020 0.000 0.028 0.036 0.916
#> GSM258559 6 0.4587 -0.0639 0.000 0.004 0.020 0.004 0.456 0.516
#> GSM258560 5 0.6983 0.6471 0.000 0.108 0.196 0.008 0.508 0.180
#> GSM258561 4 0.4827 0.7022 0.000 0.000 0.044 0.708 0.060 0.188
#> GSM258564 4 0.2282 0.7372 0.000 0.000 0.000 0.888 0.024 0.088
#> GSM258567 5 0.4613 0.3790 0.000 0.024 0.440 0.000 0.528 0.008
#> GSM258568 6 0.1152 0.6760 0.000 0.004 0.000 0.000 0.044 0.952
#> GSM258569 2 0.4253 0.4902 0.000 0.668 0.296 0.004 0.032 0.000
#> GSM258571 3 0.0260 0.6650 0.000 0.000 0.992 0.000 0.008 0.000
#> GSM258572 2 0.0909 0.8047 0.000 0.968 0.000 0.000 0.020 0.012
#> GSM258573 4 0.4834 0.4644 0.000 0.004 0.000 0.484 0.044 0.468
#> GSM258574 2 0.2209 0.7882 0.000 0.904 0.000 0.004 0.052 0.040
#> GSM258575 6 0.2136 0.6569 0.000 0.016 0.000 0.012 0.064 0.908
#> GSM258576 6 0.0000 0.6827 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM258577 2 0.5017 0.6053 0.000 0.684 0.004 0.064 0.216 0.032
#> GSM258579 6 0.1059 0.6777 0.000 0.016 0.000 0.004 0.016 0.964
#> GSM258581 6 0.0000 0.6827 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM258582 3 0.0810 0.6685 0.004 0.008 0.976 0.004 0.008 0.000
#> GSM258584 5 0.5872 0.6331 0.000 0.012 0.192 0.004 0.564 0.228
#> GSM258586 4 0.3777 0.6693 0.000 0.060 0.020 0.820 0.088 0.012
#> GSM258587 6 0.4597 -0.2664 0.000 0.004 0.000 0.376 0.036 0.584
#> GSM258588 6 0.5260 0.0194 0.000 0.068 0.012 0.000 0.400 0.520
#> GSM258589 2 0.6119 0.4527 0.000 0.612 0.032 0.024 0.168 0.164
#> GSM258591 4 0.4780 0.4424 0.000 0.004 0.000 0.484 0.040 0.472
#> GSM258592 3 0.4181 -0.4926 0.000 0.000 0.512 0.000 0.476 0.012
#> GSM258593 1 0.6495 0.6013 0.580 0.176 0.036 0.036 0.172 0.000
#> GSM258595 3 0.7336 0.2409 0.032 0.288 0.468 0.120 0.088 0.004
#> GSM258597 4 0.3722 0.7365 0.000 0.004 0.000 0.764 0.036 0.196
#> GSM258598 4 0.3212 0.7428 0.000 0.004 0.000 0.800 0.016 0.180
#> GSM258600 2 0.1198 0.7976 0.000 0.960 0.004 0.012 0.020 0.004
#> GSM258601 3 0.1448 0.6654 0.000 0.016 0.948 0.024 0.012 0.000
#> GSM258602 6 0.4053 0.2445 0.000 0.004 0.004 0.004 0.360 0.628
#> GSM258604 3 0.1720 0.6528 0.000 0.000 0.928 0.040 0.032 0.000
#> GSM258605 3 0.0777 0.6553 0.000 0.000 0.972 0.004 0.024 0.000
#> GSM258606 6 0.1007 0.6758 0.000 0.000 0.000 0.000 0.044 0.956
#> GSM258607 4 0.3039 0.7023 0.000 0.012 0.040 0.872 0.052 0.024
#> GSM258608 6 0.7274 -0.0959 0.000 0.260 0.004 0.080 0.300 0.356
Heatmaps for the consensus matrix. It visualizes the probability of two samples to be in a same group.
consensus_heatmap(res, k = 2)
consensus_heatmap(res, k = 3)
consensus_heatmap(res, k = 4)
consensus_heatmap(res, k = 5)
consensus_heatmap(res, k = 6)
Heatmaps for the membership of samples in all partitions to see how consistent they are:
membership_heatmap(res, k = 2)
membership_heatmap(res, k = 3)
membership_heatmap(res, k = 4)
membership_heatmap(res, k = 5)
membership_heatmap(res, k = 6)
As soon as we have had the classes for columns, we can look for signatures which are significantly different between classes which can be candidate marks for certain classes. Following are the heatmaps for signatures.
Signature heatmaps where rows are scaled:
get_signatures(res, k = 2)
get_signatures(res, k = 3)
get_signatures(res, k = 4)
get_signatures(res, k = 5)
get_signatures(res, k = 6)
Signature heatmaps where rows are not scaled:
get_signatures(res, k = 2, scale_rows = FALSE)
get_signatures(res, k = 3, scale_rows = FALSE)
get_signatures(res, k = 4, scale_rows = FALSE)
get_signatures(res, k = 5, scale_rows = FALSE)
get_signatures(res, k = 6, scale_rows = FALSE)
Compare the overlap of signatures from different k:
compare_signatures(res)
get_signature()
returns a data frame invisibly. TO get the list of signatures, the function
call should be assigned to a variable explicitly. In following code, if plot
argument is set
to FALSE
, no heatmap is plotted while only the differential analysis is performed.
# code only for demonstration
tb = get_signature(res, k = ..., plot = FALSE)
An example of the output of tb
is:
#> which_row fdr mean_1 mean_2 scaled_mean_1 scaled_mean_2 km
#> 1 38 0.042760348 8.373488 9.131774 -0.5533452 0.5164555 1
#> 2 40 0.018707592 7.106213 8.469186 -0.6173731 0.5762149 1
#> 3 55 0.019134737 10.221463 11.207825 -0.6159697 0.5749050 1
#> 4 59 0.006059896 5.921854 7.869574 -0.6899429 0.6439467 1
#> 5 60 0.018055526 8.928898 10.211722 -0.6204761 0.5791110 1
#> 6 98 0.009384629 15.714769 14.887706 0.6635654 -0.6193277 2
...
The columns in tb
are:
which_row
: row indices corresponding to the input matrix.fdr
: FDR for the differential test. mean_x
: The mean value in group x.scaled_mean_x
: The mean value in group x after rows are scaled.km
: Row groups if k-means clustering is applied to rows.UMAP plot which shows how samples are separated.
dimension_reduction(res, k = 2, method = "UMAP")
dimension_reduction(res, k = 3, method = "UMAP")
dimension_reduction(res, k = 4, method = "UMAP")
dimension_reduction(res, k = 5, method = "UMAP")
dimension_reduction(res, k = 6, method = "UMAP")
Following heatmap shows how subgroups are split when increasing k
:
collect_classes(res)
Test correlation between subgroups and known annotations. If the known annotation is numeric, one-way ANOVA test is applied, and if the known annotation is discrete, chi-squared contingency table test is applied.
test_to_known_factors(res)
#> n disease.state(p) k
#> SD:skmeans 57 2.62e-07 2
#> SD:skmeans 56 2.05e-09 3
#> SD:skmeans 50 2.77e-08 4
#> SD:skmeans 52 5.04e-08 5
#> SD:skmeans 45 2.75e-06 6
If matrix rows can be associated to genes, consider to use functional_enrichment(res,
...)
to perform function enrichment for the signature genes. See this vignette for more detailed explanations.
The object with results only for a single top-value method and a single partition method can be extracted as:
res = res_list["SD", "pam"]
# you can also extract it by
# res = res_list["SD:pam"]
A summary of res
and all the functions that can be applied to it:
res
#> A 'ConsensusPartition' object with k = 2, 3, 4, 5, 6.
#> On a matrix with 51941 rows and 58 columns.
#> Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'SD' method.
#> Subgroups are detected by 'pam' method.
#> Performed in total 1250 partitions by row resampling.
#> Best k for subgroups seems to be 2.
#>
#> Following methods can be applied to this 'ConsensusPartition' object:
#> [1] "cola_report" "collect_classes" "collect_plots"
#> [4] "collect_stats" "colnames" "compare_signatures"
#> [7] "consensus_heatmap" "dimension_reduction" "functional_enrichment"
#> [10] "get_anno_col" "get_anno" "get_classes"
#> [13] "get_consensus" "get_matrix" "get_membership"
#> [16] "get_param" "get_signatures" "get_stats"
#> [19] "is_best_k" "is_stable_k" "membership_heatmap"
#> [22] "ncol" "nrow" "plot_ecdf"
#> [25] "rownames" "select_partition_number" "show"
#> [28] "suggest_best_k" "test_to_known_factors"
collect_plots()
function collects all the plots made from res
for all k
(number of partitions)
into one single page to provide an easy and fast comparison between different k
.
collect_plots(res)
The plots are:
k
and the heatmap of
predicted classes for each k
.k
.k
.k
.All the plots in panels can be made by individual functions and they are plotted later in this section.
select_partition_number()
produces several plots showing different
statistics for choosing “optimized” k
. There are following statistics:
k
;k
, the area increased is defined as \(A_k - A_{k-1}\).The detailed explanations of these statistics can be found in the cola vignette.
Generally speaking, lower PAC score, higher mean silhouette score or higher
concordance corresponds to better partition. Rand index and Jaccard index
measure how similar the current partition is compared to partition with k-1
.
If they are too similar, we won't accept k
is better than k-1
.
select_partition_number(res)
The numeric values for all these statistics can be obtained by get_stats()
.
get_stats(res)
#> k 1-PAC mean_silhouette concordance area_increased Rand Jaccard
#> 2 2 1.000 0.965 0.986 0.3965 0.610 0.610
#> 3 3 0.729 0.858 0.927 0.6328 0.721 0.549
#> 4 4 0.623 0.690 0.805 0.1020 0.923 0.787
#> 5 5 0.687 0.747 0.836 0.0879 0.901 0.682
#> 6 6 0.777 0.751 0.859 0.0562 0.904 0.608
suggest_best_k()
suggests the best \(k\) based on these statistics. The rules are as follows:
suggest_best_k(res)
#> [1] 2
Following shows the table of the partitions (You need to click the show/hide
code output link to see it). The membership matrix (columns with name p*
)
is inferred by
clue::cl_consensus()
function with the SE
method. Basically the value in the membership matrix
represents the probability to belong to a certain group. The finall class
label for an item is determined with the group with highest probability it
belongs to.
In get_classes()
function, the entropy is calculated from the membership
matrix and the silhouette score is calculated from the consensus matrix.
cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#> class entropy silhouette p1 p2
#> GSM258553 1 0.0000 0.985 1.000 0.000
#> GSM258555 1 0.0000 0.985 1.000 0.000
#> GSM258556 2 0.0000 0.986 0.000 1.000
#> GSM258557 2 0.9922 0.175 0.448 0.552
#> GSM258562 1 0.7219 0.743 0.800 0.200
#> GSM258563 1 0.0000 0.985 1.000 0.000
#> GSM258565 1 0.0000 0.985 1.000 0.000
#> GSM258566 1 0.0000 0.985 1.000 0.000
#> GSM258570 1 0.0000 0.985 1.000 0.000
#> GSM258578 1 0.0000 0.985 1.000 0.000
#> GSM258580 2 0.2423 0.950 0.040 0.960
#> GSM258583 1 0.0000 0.985 1.000 0.000
#> GSM258585 2 0.2423 0.950 0.040 0.960
#> GSM258590 1 0.0000 0.985 1.000 0.000
#> GSM258594 1 0.0000 0.985 1.000 0.000
#> GSM258596 1 0.0000 0.985 1.000 0.000
#> GSM258599 1 0.0000 0.985 1.000 0.000
#> GSM258603 1 0.0000 0.985 1.000 0.000
#> GSM258551 2 0.0000 0.986 0.000 1.000
#> GSM258552 2 0.0000 0.986 0.000 1.000
#> GSM258554 2 0.0000 0.986 0.000 1.000
#> GSM258558 2 0.0000 0.986 0.000 1.000
#> GSM258559 2 0.0000 0.986 0.000 1.000
#> GSM258560 2 0.0000 0.986 0.000 1.000
#> GSM258561 2 0.0000 0.986 0.000 1.000
#> GSM258564 2 0.0000 0.986 0.000 1.000
#> GSM258567 2 0.0000 0.986 0.000 1.000
#> GSM258568 2 0.0000 0.986 0.000 1.000
#> GSM258569 2 0.0376 0.983 0.004 0.996
#> GSM258571 2 0.0000 0.986 0.000 1.000
#> GSM258572 2 0.0000 0.986 0.000 1.000
#> GSM258573 2 0.0000 0.986 0.000 1.000
#> GSM258574 2 0.0000 0.986 0.000 1.000
#> GSM258575 2 0.0000 0.986 0.000 1.000
#> GSM258576 2 0.0000 0.986 0.000 1.000
#> GSM258577 2 0.0000 0.986 0.000 1.000
#> GSM258579 2 0.0000 0.986 0.000 1.000
#> GSM258581 2 0.0000 0.986 0.000 1.000
#> GSM258582 2 0.1184 0.972 0.016 0.984
#> GSM258584 2 0.0000 0.986 0.000 1.000
#> GSM258586 2 0.0000 0.986 0.000 1.000
#> GSM258587 2 0.0000 0.986 0.000 1.000
#> GSM258588 2 0.0000 0.986 0.000 1.000
#> GSM258589 2 0.0000 0.986 0.000 1.000
#> GSM258591 2 0.0000 0.986 0.000 1.000
#> GSM258592 2 0.0000 0.986 0.000 1.000
#> GSM258593 1 0.0000 0.985 1.000 0.000
#> GSM258595 2 0.0000 0.986 0.000 1.000
#> GSM258597 2 0.0000 0.986 0.000 1.000
#> GSM258598 2 0.0000 0.986 0.000 1.000
#> GSM258600 2 0.0000 0.986 0.000 1.000
#> GSM258601 2 0.0000 0.986 0.000 1.000
#> GSM258602 2 0.0000 0.986 0.000 1.000
#> GSM258604 2 0.0000 0.986 0.000 1.000
#> GSM258605 2 0.2423 0.950 0.040 0.960
#> GSM258606 2 0.0000 0.986 0.000 1.000
#> GSM258607 2 0.0000 0.986 0.000 1.000
#> GSM258608 2 0.0000 0.986 0.000 1.000
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> GSM258553 1 0.0000 0.9791 1.000 0.000 0.000
#> GSM258555 1 0.0000 0.9791 1.000 0.000 0.000
#> GSM258556 2 0.4555 0.8128 0.000 0.800 0.200
#> GSM258557 3 0.0592 0.9237 0.012 0.000 0.988
#> GSM258562 1 0.4931 0.6467 0.768 0.000 0.232
#> GSM258563 1 0.0000 0.9791 1.000 0.000 0.000
#> GSM258565 1 0.0000 0.9791 1.000 0.000 0.000
#> GSM258566 1 0.0000 0.9791 1.000 0.000 0.000
#> GSM258570 1 0.0000 0.9791 1.000 0.000 0.000
#> GSM258578 1 0.0000 0.9791 1.000 0.000 0.000
#> GSM258580 3 0.0000 0.9334 0.000 0.000 1.000
#> GSM258583 1 0.0000 0.9791 1.000 0.000 0.000
#> GSM258585 3 0.0000 0.9334 0.000 0.000 1.000
#> GSM258590 1 0.0000 0.9791 1.000 0.000 0.000
#> GSM258594 1 0.0000 0.9791 1.000 0.000 0.000
#> GSM258596 1 0.0000 0.9791 1.000 0.000 0.000
#> GSM258599 1 0.0000 0.9791 1.000 0.000 0.000
#> GSM258603 1 0.0000 0.9791 1.000 0.000 0.000
#> GSM258551 2 0.5591 0.7096 0.000 0.696 0.304
#> GSM258552 3 0.0000 0.9334 0.000 0.000 1.000
#> GSM258554 2 0.1529 0.8806 0.000 0.960 0.040
#> GSM258558 3 0.0000 0.9334 0.000 0.000 1.000
#> GSM258559 2 0.4654 0.8068 0.000 0.792 0.208
#> GSM258560 3 0.6235 -0.0348 0.000 0.436 0.564
#> GSM258561 2 0.1529 0.8806 0.000 0.960 0.040
#> GSM258564 2 0.1529 0.8806 0.000 0.960 0.040
#> GSM258567 3 0.0000 0.9334 0.000 0.000 1.000
#> GSM258568 2 0.0000 0.8712 0.000 1.000 0.000
#> GSM258569 3 0.0424 0.9268 0.000 0.008 0.992
#> GSM258571 2 0.1529 0.8806 0.000 0.960 0.040
#> GSM258572 3 0.0000 0.9334 0.000 0.000 1.000
#> GSM258573 2 0.0000 0.8712 0.000 1.000 0.000
#> GSM258574 3 0.0000 0.9334 0.000 0.000 1.000
#> GSM258575 2 0.0000 0.8712 0.000 1.000 0.000
#> GSM258576 2 0.0000 0.8712 0.000 1.000 0.000
#> GSM258577 3 0.0000 0.9334 0.000 0.000 1.000
#> GSM258579 2 0.3941 0.8111 0.000 0.844 0.156
#> GSM258581 2 0.0000 0.8712 0.000 1.000 0.000
#> GSM258582 2 0.1860 0.8786 0.000 0.948 0.052
#> GSM258584 2 0.6235 0.4466 0.000 0.564 0.436
#> GSM258586 3 0.3267 0.7987 0.000 0.116 0.884
#> GSM258587 2 0.0000 0.8712 0.000 1.000 0.000
#> GSM258588 3 0.0000 0.9334 0.000 0.000 1.000
#> GSM258589 3 0.0000 0.9334 0.000 0.000 1.000
#> GSM258591 2 0.0000 0.8712 0.000 1.000 0.000
#> GSM258592 2 0.5650 0.6984 0.000 0.688 0.312
#> GSM258593 3 0.5760 0.4331 0.328 0.000 0.672
#> GSM258595 2 0.1529 0.8806 0.000 0.960 0.040
#> GSM258597 2 0.1529 0.8806 0.000 0.960 0.040
#> GSM258598 2 0.0000 0.8712 0.000 1.000 0.000
#> GSM258600 3 0.0000 0.9334 0.000 0.000 1.000
#> GSM258601 2 0.4702 0.8045 0.000 0.788 0.212
#> GSM258602 2 0.5560 0.7146 0.000 0.700 0.300
#> GSM258604 2 0.4399 0.8225 0.000 0.812 0.188
#> GSM258605 2 0.5678 0.6927 0.000 0.684 0.316
#> GSM258606 2 0.4002 0.8251 0.000 0.840 0.160
#> GSM258607 2 0.1529 0.8806 0.000 0.960 0.040
#> GSM258608 3 0.0000 0.9334 0.000 0.000 1.000
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> GSM258553 1 0.4877 0.893 0.592 0.000 0.000 0.408
#> GSM258555 1 0.4877 0.893 0.592 0.000 0.000 0.408
#> GSM258556 2 0.5147 0.731 0.060 0.740 0.200 0.000
#> GSM258557 4 0.6197 0.415 0.072 0.000 0.324 0.604
#> GSM258562 1 0.6930 -0.190 0.524 0.000 0.356 0.120
#> GSM258563 4 0.0469 0.541 0.012 0.000 0.000 0.988
#> GSM258565 1 0.4877 0.893 0.592 0.000 0.000 0.408
#> GSM258566 1 0.4877 0.893 0.592 0.000 0.000 0.408
#> GSM258570 1 0.4877 0.893 0.592 0.000 0.000 0.408
#> GSM258578 1 0.4877 0.893 0.592 0.000 0.000 0.408
#> GSM258580 3 0.0469 0.829 0.000 0.000 0.988 0.012
#> GSM258583 4 0.0000 0.535 0.000 0.000 0.000 1.000
#> GSM258585 4 0.4877 0.340 0.000 0.000 0.408 0.592
#> GSM258590 1 0.4877 0.893 0.592 0.000 0.000 0.408
#> GSM258594 1 0.4877 0.893 0.592 0.000 0.000 0.408
#> GSM258596 4 0.0000 0.535 0.000 0.000 0.000 1.000
#> GSM258599 4 0.0000 0.535 0.000 0.000 0.000 1.000
#> GSM258603 1 0.4877 0.893 0.592 0.000 0.000 0.408
#> GSM258551 2 0.4134 0.696 0.000 0.740 0.260 0.000
#> GSM258552 3 0.1452 0.812 0.000 0.008 0.956 0.036
#> GSM258554 2 0.1305 0.812 0.004 0.960 0.036 0.000
#> GSM258558 3 0.0927 0.824 0.008 0.016 0.976 0.000
#> GSM258559 2 0.7031 0.574 0.224 0.576 0.200 0.000
#> GSM258560 3 0.7800 -0.225 0.248 0.376 0.376 0.000
#> GSM258561 2 0.1302 0.812 0.000 0.956 0.044 0.000
#> GSM258564 2 0.1305 0.808 0.036 0.960 0.004 0.000
#> GSM258567 3 0.6761 0.487 0.224 0.000 0.608 0.168
#> GSM258568 2 0.4507 0.768 0.168 0.788 0.044 0.000
#> GSM258569 3 0.1151 0.827 0.024 0.008 0.968 0.000
#> GSM258571 2 0.5922 0.686 0.204 0.716 0.040 0.040
#> GSM258572 3 0.0592 0.831 0.016 0.000 0.984 0.000
#> GSM258573 2 0.0000 0.808 0.000 1.000 0.000 0.000
#> GSM258574 3 0.0000 0.831 0.000 0.000 1.000 0.000
#> GSM258575 2 0.2469 0.793 0.108 0.892 0.000 0.000
#> GSM258576 2 0.2647 0.790 0.120 0.880 0.000 0.000
#> GSM258577 3 0.0707 0.826 0.000 0.000 0.980 0.020
#> GSM258579 2 0.4773 0.749 0.120 0.788 0.092 0.000
#> GSM258581 2 0.2704 0.789 0.124 0.876 0.000 0.000
#> GSM258582 2 0.6305 0.679 0.204 0.696 0.060 0.040
#> GSM258584 2 0.8983 0.207 0.224 0.376 0.336 0.064
#> GSM258586 3 0.4740 0.684 0.080 0.132 0.788 0.000
#> GSM258587 2 0.0000 0.808 0.000 1.000 0.000 0.000
#> GSM258588 3 0.5170 0.641 0.228 0.048 0.724 0.000
#> GSM258589 3 0.1004 0.828 0.024 0.004 0.972 0.000
#> GSM258591 2 0.0000 0.808 0.000 1.000 0.000 0.000
#> GSM258592 2 0.7636 0.410 0.248 0.468 0.284 0.000
#> GSM258593 4 0.5574 0.505 0.048 0.000 0.284 0.668
#> GSM258595 2 0.1302 0.812 0.000 0.956 0.044 0.000
#> GSM258597 2 0.1305 0.808 0.036 0.960 0.004 0.000
#> GSM258598 2 0.1118 0.807 0.036 0.964 0.000 0.000
#> GSM258600 3 0.0817 0.828 0.024 0.000 0.976 0.000
#> GSM258601 2 0.5968 0.668 0.092 0.672 0.236 0.000
#> GSM258602 2 0.5200 0.675 0.036 0.700 0.264 0.000
#> GSM258604 2 0.8134 0.578 0.092 0.580 0.176 0.152
#> GSM258605 4 0.9265 0.246 0.244 0.156 0.156 0.444
#> GSM258606 2 0.4139 0.786 0.144 0.816 0.040 0.000
#> GSM258607 2 0.1305 0.808 0.036 0.960 0.004 0.000
#> GSM258608 3 0.1118 0.815 0.000 0.000 0.964 0.036
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> GSM258553 1 0.000 1.0000 1.000 0.000 0.000 0.000 0.000
#> GSM258555 1 0.000 1.0000 1.000 0.000 0.000 0.000 0.000
#> GSM258556 4 0.547 0.6821 0.000 0.096 0.208 0.680 0.016
#> GSM258557 5 0.155 0.9163 0.016 0.040 0.000 0.000 0.944
#> GSM258562 3 0.554 0.5899 0.100 0.188 0.688 0.000 0.024
#> GSM258563 5 0.134 0.9425 0.056 0.000 0.000 0.000 0.944
#> GSM258565 1 0.000 1.0000 1.000 0.000 0.000 0.000 0.000
#> GSM258566 1 0.000 1.0000 1.000 0.000 0.000 0.000 0.000
#> GSM258570 1 0.000 1.0000 1.000 0.000 0.000 0.000 0.000
#> GSM258578 1 0.000 1.0000 1.000 0.000 0.000 0.000 0.000
#> GSM258580 2 0.000 0.8450 0.000 1.000 0.000 0.000 0.000
#> GSM258583 5 0.167 0.9330 0.076 0.000 0.000 0.000 0.924
#> GSM258585 5 0.134 0.8968 0.000 0.056 0.000 0.000 0.944
#> GSM258590 1 0.000 1.0000 1.000 0.000 0.000 0.000 0.000
#> GSM258594 1 0.000 1.0000 1.000 0.000 0.000 0.000 0.000
#> GSM258596 5 0.141 0.9420 0.060 0.000 0.000 0.000 0.940
#> GSM258599 5 0.134 0.9425 0.056 0.000 0.000 0.000 0.944
#> GSM258603 1 0.000 1.0000 1.000 0.000 0.000 0.000 0.000
#> GSM258551 4 0.425 0.5696 0.000 0.340 0.008 0.652 0.000
#> GSM258552 2 0.000 0.8450 0.000 1.000 0.000 0.000 0.000
#> GSM258554 4 0.227 0.7823 0.000 0.076 0.020 0.904 0.000
#> GSM258558 2 0.106 0.8251 0.000 0.968 0.004 0.020 0.008
#> GSM258559 4 0.683 -0.1261 0.000 0.208 0.384 0.400 0.008
#> GSM258560 3 0.314 0.6289 0.000 0.204 0.796 0.000 0.000
#> GSM258561 4 0.207 0.7740 0.000 0.104 0.000 0.896 0.000
#> GSM258564 4 0.223 0.7847 0.000 0.000 0.080 0.904 0.016
#> GSM258567 3 0.403 0.6183 0.000 0.352 0.648 0.000 0.000
#> GSM258568 4 0.480 0.6233 0.000 0.000 0.312 0.648 0.040
#> GSM258569 2 0.297 0.7821 0.000 0.836 0.156 0.008 0.000
#> GSM258571 3 0.586 0.4926 0.000 0.000 0.592 0.260 0.148
#> GSM258572 2 0.252 0.7977 0.000 0.860 0.140 0.000 0.000
#> GSM258573 4 0.000 0.7920 0.000 0.000 0.000 1.000 0.000
#> GSM258574 2 0.000 0.8450 0.000 1.000 0.000 0.000 0.000
#> GSM258575 4 0.228 0.7804 0.000 0.000 0.060 0.908 0.032
#> GSM258576 4 0.257 0.7770 0.000 0.000 0.068 0.892 0.040
#> GSM258577 2 0.000 0.8450 0.000 1.000 0.000 0.000 0.000
#> GSM258579 4 0.418 0.7430 0.000 0.080 0.064 0.816 0.040
#> GSM258581 4 0.263 0.7763 0.000 0.000 0.072 0.888 0.040
#> GSM258582 3 0.581 0.4987 0.000 0.000 0.600 0.256 0.144
#> GSM258584 3 0.403 0.6183 0.000 0.352 0.648 0.000 0.000
#> GSM258586 2 0.557 -0.0697 0.000 0.580 0.332 0.088 0.000
#> GSM258587 4 0.000 0.7920 0.000 0.000 0.000 1.000 0.000
#> GSM258588 3 0.418 0.6167 0.000 0.352 0.644 0.000 0.004
#> GSM258589 2 0.269 0.7871 0.000 0.844 0.156 0.000 0.000
#> GSM258591 4 0.029 0.7917 0.000 0.000 0.008 0.992 0.000
#> GSM258592 3 0.304 0.6352 0.000 0.192 0.808 0.000 0.000
#> GSM258593 5 0.390 0.8448 0.116 0.080 0.000 0.000 0.804
#> GSM258595 4 0.213 0.7720 0.000 0.108 0.000 0.892 0.000
#> GSM258597 4 0.223 0.7847 0.000 0.000 0.080 0.904 0.016
#> GSM258598 4 0.223 0.7847 0.000 0.000 0.080 0.904 0.016
#> GSM258600 2 0.269 0.7871 0.000 0.844 0.156 0.000 0.000
#> GSM258601 4 0.576 0.5514 0.000 0.192 0.188 0.620 0.000
#> GSM258602 4 0.598 0.4564 0.000 0.336 0.100 0.556 0.008
#> GSM258604 4 0.688 0.3767 0.000 0.016 0.248 0.488 0.248
#> GSM258605 3 0.429 0.2817 0.000 0.000 0.612 0.004 0.384
#> GSM258606 4 0.369 0.7334 0.000 0.000 0.156 0.804 0.040
#> GSM258607 4 0.223 0.7847 0.000 0.000 0.080 0.904 0.016
#> GSM258608 2 0.000 0.8450 0.000 1.000 0.000 0.000 0.000
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> GSM258553 1 0.0000 1.0000 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM258555 1 0.0000 1.0000 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM258556 4 0.3150 0.7503 0.000 0.096 0.024 0.848 0.000 0.032
#> GSM258557 5 0.0146 0.9664 0.004 0.000 0.000 0.000 0.996 0.000
#> GSM258562 3 0.4662 0.5977 0.052 0.180 0.728 0.000 0.004 0.036
#> GSM258563 5 0.0146 0.9664 0.004 0.000 0.000 0.000 0.996 0.000
#> GSM258565 1 0.0000 1.0000 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM258566 1 0.0000 1.0000 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM258570 1 0.0000 1.0000 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM258578 1 0.0000 1.0000 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM258580 2 0.0146 0.8999 0.000 0.996 0.004 0.000 0.000 0.000
#> GSM258583 5 0.0363 0.9644 0.012 0.000 0.000 0.000 0.988 0.000
#> GSM258585 5 0.0508 0.9553 0.000 0.012 0.004 0.000 0.984 0.000
#> GSM258590 1 0.0000 1.0000 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM258594 1 0.0000 1.0000 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM258596 5 0.0713 0.9545 0.028 0.000 0.000 0.000 0.972 0.000
#> GSM258599 5 0.0146 0.9664 0.004 0.000 0.000 0.000 0.996 0.000
#> GSM258603 1 0.0000 1.0000 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM258551 4 0.3189 0.6653 0.000 0.236 0.004 0.760 0.000 0.000
#> GSM258552 2 0.0000 0.9013 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM258554 4 0.1531 0.8350 0.000 0.068 0.004 0.928 0.000 0.000
#> GSM258558 6 0.4378 0.2694 0.000 0.388 0.008 0.016 0.000 0.588
#> GSM258559 3 0.7610 0.3095 0.000 0.184 0.304 0.300 0.000 0.212
#> GSM258560 3 0.5421 0.6301 0.000 0.204 0.580 0.000 0.000 0.216
#> GSM258561 4 0.2163 0.8201 0.000 0.096 0.008 0.892 0.000 0.004
#> GSM258564 4 0.0000 0.8384 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM258567 3 0.5468 0.6373 0.000 0.244 0.568 0.000 0.000 0.188
#> GSM258568 6 0.0260 0.5999 0.000 0.000 0.008 0.000 0.000 0.992
#> GSM258569 2 0.1829 0.8837 0.000 0.928 0.028 0.008 0.000 0.036
#> GSM258571 3 0.1297 0.5515 0.000 0.000 0.948 0.040 0.012 0.000
#> GSM258572 2 0.1408 0.8912 0.000 0.944 0.020 0.000 0.000 0.036
#> GSM258573 4 0.2048 0.8079 0.000 0.000 0.000 0.880 0.000 0.120
#> GSM258574 2 0.0000 0.9013 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM258575 4 0.2730 0.7438 0.000 0.000 0.000 0.808 0.000 0.192
#> GSM258576 6 0.2883 0.6698 0.000 0.000 0.000 0.212 0.000 0.788
#> GSM258577 2 0.0000 0.9013 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM258579 6 0.2996 0.6514 0.000 0.000 0.000 0.228 0.000 0.772
#> GSM258581 6 0.2854 0.6721 0.000 0.000 0.000 0.208 0.000 0.792
#> GSM258582 3 0.1151 0.5540 0.000 0.000 0.956 0.032 0.012 0.000
#> GSM258584 3 0.5473 0.6387 0.000 0.240 0.568 0.000 0.000 0.192
#> GSM258586 2 0.5185 0.0858 0.000 0.564 0.328 0.108 0.000 0.000
#> GSM258587 4 0.1765 0.8209 0.000 0.000 0.000 0.904 0.000 0.096
#> GSM258588 3 0.5516 0.6353 0.000 0.244 0.560 0.000 0.000 0.196
#> GSM258589 2 0.1572 0.8875 0.000 0.936 0.028 0.000 0.000 0.036
#> GSM258591 4 0.1863 0.8182 0.000 0.000 0.000 0.896 0.000 0.104
#> GSM258592 3 0.5309 0.6441 0.000 0.176 0.596 0.000 0.000 0.228
#> GSM258593 5 0.2846 0.8543 0.060 0.084 0.000 0.000 0.856 0.000
#> GSM258595 4 0.2006 0.8184 0.000 0.104 0.004 0.892 0.000 0.000
#> GSM258597 4 0.0000 0.8384 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM258598 4 0.0000 0.8384 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM258600 2 0.1572 0.8875 0.000 0.936 0.028 0.000 0.000 0.036
#> GSM258601 4 0.6132 0.3894 0.000 0.180 0.236 0.548 0.000 0.036
#> GSM258602 6 0.6256 -0.0642 0.000 0.220 0.012 0.372 0.000 0.396
#> GSM258604 3 0.5831 -0.2097 0.000 0.000 0.452 0.412 0.120 0.016
#> GSM258605 3 0.1141 0.5491 0.000 0.000 0.948 0.000 0.052 0.000
#> GSM258606 6 0.0865 0.6236 0.000 0.000 0.000 0.036 0.000 0.964
#> GSM258607 4 0.0000 0.8384 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM258608 2 0.0146 0.8999 0.000 0.996 0.004 0.000 0.000 0.000
Heatmaps for the consensus matrix. It visualizes the probability of two samples to be in a same group.
consensus_heatmap(res, k = 2)
consensus_heatmap(res, k = 3)
consensus_heatmap(res, k = 4)
consensus_heatmap(res, k = 5)
consensus_heatmap(res, k = 6)
Heatmaps for the membership of samples in all partitions to see how consistent they are:
membership_heatmap(res, k = 2)
membership_heatmap(res, k = 3)
membership_heatmap(res, k = 4)
membership_heatmap(res, k = 5)
membership_heatmap(res, k = 6)
As soon as we have had the classes for columns, we can look for signatures which are significantly different between classes which can be candidate marks for certain classes. Following are the heatmaps for signatures.
Signature heatmaps where rows are scaled:
get_signatures(res, k = 2)
get_signatures(res, k = 3)
get_signatures(res, k = 4)
get_signatures(res, k = 5)
get_signatures(res, k = 6)
Signature heatmaps where rows are not scaled:
get_signatures(res, k = 2, scale_rows = FALSE)
get_signatures(res, k = 3, scale_rows = FALSE)
get_signatures(res, k = 4, scale_rows = FALSE)
get_signatures(res, k = 5, scale_rows = FALSE)
get_signatures(res, k = 6, scale_rows = FALSE)
Compare the overlap of signatures from different k:
compare_signatures(res)
get_signature()
returns a data frame invisibly. TO get the list of signatures, the function
call should be assigned to a variable explicitly. In following code, if plot
argument is set
to FALSE
, no heatmap is plotted while only the differential analysis is performed.
# code only for demonstration
tb = get_signature(res, k = ..., plot = FALSE)
An example of the output of tb
is:
#> which_row fdr mean_1 mean_2 scaled_mean_1 scaled_mean_2 km
#> 1 38 0.042760348 8.373488 9.131774 -0.5533452 0.5164555 1
#> 2 40 0.018707592 7.106213 8.469186 -0.6173731 0.5762149 1
#> 3 55 0.019134737 10.221463 11.207825 -0.6159697 0.5749050 1
#> 4 59 0.006059896 5.921854 7.869574 -0.6899429 0.6439467 1
#> 5 60 0.018055526 8.928898 10.211722 -0.6204761 0.5791110 1
#> 6 98 0.009384629 15.714769 14.887706 0.6635654 -0.6193277 2
...
The columns in tb
are:
which_row
: row indices corresponding to the input matrix.fdr
: FDR for the differential test. mean_x
: The mean value in group x.scaled_mean_x
: The mean value in group x after rows are scaled.km
: Row groups if k-means clustering is applied to rows.UMAP plot which shows how samples are separated.
dimension_reduction(res, k = 2, method = "UMAP")
dimension_reduction(res, k = 3, method = "UMAP")
dimension_reduction(res, k = 4, method = "UMAP")
dimension_reduction(res, k = 5, method = "UMAP")
dimension_reduction(res, k = 6, method = "UMAP")
Following heatmap shows how subgroups are split when increasing k
:
collect_classes(res)
Test correlation between subgroups and known annotations. If the known annotation is numeric, one-way ANOVA test is applied, and if the known annotation is discrete, chi-squared contingency table test is applied.
test_to_known_factors(res)
#> n disease.state(p) k
#> SD:pam 57 2.94e-09 2
#> SD:pam 55 2.36e-09 3
#> SD:pam 50 4.05e-08 4
#> SD:pam 51 3.65e-07 5
#> SD:pam 52 8.35e-07 6
If matrix rows can be associated to genes, consider to use functional_enrichment(res,
...)
to perform function enrichment for the signature genes. See this vignette for more detailed explanations.
The object with results only for a single top-value method and a single partition method can be extracted as:
res = res_list["SD", "mclust"]
# you can also extract it by
# res = res_list["SD:mclust"]
A summary of res
and all the functions that can be applied to it:
res
#> A 'ConsensusPartition' object with k = 2, 3, 4, 5, 6.
#> On a matrix with 51941 rows and 58 columns.
#> Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'SD' method.
#> Subgroups are detected by 'mclust' method.
#> Performed in total 1250 partitions by row resampling.
#> Best k for subgroups seems to be 2.
#>
#> Following methods can be applied to this 'ConsensusPartition' object:
#> [1] "cola_report" "collect_classes" "collect_plots"
#> [4] "collect_stats" "colnames" "compare_signatures"
#> [7] "consensus_heatmap" "dimension_reduction" "functional_enrichment"
#> [10] "get_anno_col" "get_anno" "get_classes"
#> [13] "get_consensus" "get_matrix" "get_membership"
#> [16] "get_param" "get_signatures" "get_stats"
#> [19] "is_best_k" "is_stable_k" "membership_heatmap"
#> [22] "ncol" "nrow" "plot_ecdf"
#> [25] "rownames" "select_partition_number" "show"
#> [28] "suggest_best_k" "test_to_known_factors"
collect_plots()
function collects all the plots made from res
for all k
(number of partitions)
into one single page to provide an easy and fast comparison between different k
.
collect_plots(res)
The plots are:
k
and the heatmap of
predicted classes for each k
.k
.k
.k
.All the plots in panels can be made by individual functions and they are plotted later in this section.
select_partition_number()
produces several plots showing different
statistics for choosing “optimized” k
. There are following statistics:
k
;k
, the area increased is defined as \(A_k - A_{k-1}\).The detailed explanations of these statistics can be found in the cola vignette.
Generally speaking, lower PAC score, higher mean silhouette score or higher
concordance corresponds to better partition. Rand index and Jaccard index
measure how similar the current partition is compared to partition with k-1
.
If they are too similar, we won't accept k
is better than k-1
.
select_partition_number(res)
The numeric values for all these statistics can be obtained by get_stats()
.
get_stats(res)
#> k 1-PAC mean_silhouette concordance area_increased Rand Jaccard
#> 2 2 0.863 0.864 0.948 0.4538 0.530 0.530
#> 3 3 0.554 0.762 0.852 0.3679 0.826 0.688
#> 4 4 0.557 0.755 0.791 0.0969 0.962 0.908
#> 5 5 0.580 0.517 0.708 0.1311 0.745 0.391
#> 6 6 0.736 0.526 0.743 0.0641 0.854 0.435
suggest_best_k()
suggests the best \(k\) based on these statistics. The rules are as follows:
suggest_best_k(res)
#> [1] 2
Following shows the table of the partitions (You need to click the show/hide
code output link to see it). The membership matrix (columns with name p*
)
is inferred by
clue::cl_consensus()
function with the SE
method. Basically the value in the membership matrix
represents the probability to belong to a certain group. The finall class
label for an item is determined with the group with highest probability it
belongs to.
In get_classes()
function, the entropy is calculated from the membership
matrix and the silhouette score is calculated from the consensus matrix.
cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#> class entropy silhouette p1 p2
#> GSM258553 1 0.0000 0.891 1.000 0.000
#> GSM258555 1 0.0000 0.891 1.000 0.000
#> GSM258556 2 0.0000 0.967 0.000 1.000
#> GSM258557 1 0.0000 0.891 1.000 0.000
#> GSM258562 1 0.9686 0.435 0.604 0.396
#> GSM258563 1 0.0000 0.891 1.000 0.000
#> GSM258565 1 0.0000 0.891 1.000 0.000
#> GSM258566 1 0.0000 0.891 1.000 0.000
#> GSM258570 1 0.0000 0.891 1.000 0.000
#> GSM258578 1 0.0000 0.891 1.000 0.000
#> GSM258580 1 0.9552 0.472 0.624 0.376
#> GSM258583 1 0.0000 0.891 1.000 0.000
#> GSM258585 1 0.0000 0.891 1.000 0.000
#> GSM258590 1 0.0000 0.891 1.000 0.000
#> GSM258594 1 0.0000 0.891 1.000 0.000
#> GSM258596 1 0.0000 0.891 1.000 0.000
#> GSM258599 1 0.0000 0.891 1.000 0.000
#> GSM258603 1 0.0000 0.891 1.000 0.000
#> GSM258551 2 0.0000 0.967 0.000 1.000
#> GSM258552 2 0.0000 0.967 0.000 1.000
#> GSM258554 2 0.0000 0.967 0.000 1.000
#> GSM258558 2 0.0000 0.967 0.000 1.000
#> GSM258559 2 0.0000 0.967 0.000 1.000
#> GSM258560 2 0.1414 0.949 0.020 0.980
#> GSM258561 2 0.0000 0.967 0.000 1.000
#> GSM258564 2 0.0000 0.967 0.000 1.000
#> GSM258567 2 0.0000 0.967 0.000 1.000
#> GSM258568 2 0.0000 0.967 0.000 1.000
#> GSM258569 1 0.9881 0.332 0.564 0.436
#> GSM258571 2 0.2778 0.920 0.048 0.952
#> GSM258572 2 0.0000 0.967 0.000 1.000
#> GSM258573 2 0.0000 0.967 0.000 1.000
#> GSM258574 2 0.0000 0.967 0.000 1.000
#> GSM258575 2 0.0000 0.967 0.000 1.000
#> GSM258576 2 0.0000 0.967 0.000 1.000
#> GSM258577 2 0.0000 0.967 0.000 1.000
#> GSM258579 2 0.0000 0.967 0.000 1.000
#> GSM258581 2 0.0000 0.967 0.000 1.000
#> GSM258582 2 1.0000 -0.165 0.496 0.504
#> GSM258584 2 0.0000 0.967 0.000 1.000
#> GSM258586 2 0.0000 0.967 0.000 1.000
#> GSM258587 2 0.0000 0.967 0.000 1.000
#> GSM258588 2 0.0000 0.967 0.000 1.000
#> GSM258589 2 0.0000 0.967 0.000 1.000
#> GSM258591 2 0.0000 0.967 0.000 1.000
#> GSM258592 2 0.0376 0.964 0.004 0.996
#> GSM258593 1 0.0000 0.891 1.000 0.000
#> GSM258595 1 0.9686 0.435 0.604 0.396
#> GSM258597 2 0.0000 0.967 0.000 1.000
#> GSM258598 2 0.0000 0.967 0.000 1.000
#> GSM258600 2 0.0376 0.964 0.004 0.996
#> GSM258601 2 0.2236 0.933 0.036 0.964
#> GSM258602 2 0.0000 0.967 0.000 1.000
#> GSM258604 1 0.9686 0.435 0.604 0.396
#> GSM258605 2 0.9795 0.149 0.416 0.584
#> GSM258606 2 0.0000 0.967 0.000 1.000
#> GSM258607 2 0.0000 0.967 0.000 1.000
#> GSM258608 2 0.0000 0.967 0.000 1.000
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> GSM258553 1 0.6252 1.0000 0.556 0.000 0.444
#> GSM258555 1 0.6252 1.0000 0.556 0.000 0.444
#> GSM258556 2 0.9736 -0.0723 0.228 0.416 0.356
#> GSM258557 3 0.0747 0.4909 0.016 0.000 0.984
#> GSM258562 3 0.7240 0.7203 0.432 0.028 0.540
#> GSM258563 3 0.0000 0.4742 0.000 0.000 1.000
#> GSM258565 1 0.6252 1.0000 0.556 0.000 0.444
#> GSM258566 1 0.6252 1.0000 0.556 0.000 0.444
#> GSM258570 1 0.6252 1.0000 0.556 0.000 0.444
#> GSM258578 1 0.6252 1.0000 0.556 0.000 0.444
#> GSM258580 3 0.7250 0.7165 0.396 0.032 0.572
#> GSM258583 3 0.0237 0.4685 0.004 0.000 0.996
#> GSM258585 3 0.0237 0.4793 0.004 0.000 0.996
#> GSM258590 1 0.6252 1.0000 0.556 0.000 0.444
#> GSM258594 1 0.6252 1.0000 0.556 0.000 0.444
#> GSM258596 3 0.0237 0.4685 0.004 0.000 0.996
#> GSM258599 3 0.0237 0.4685 0.004 0.000 0.996
#> GSM258603 1 0.6252 1.0000 0.556 0.000 0.444
#> GSM258551 2 0.4235 0.7999 0.176 0.824 0.000
#> GSM258552 2 0.4679 0.7884 0.148 0.832 0.020
#> GSM258554 2 0.4235 0.7999 0.176 0.824 0.000
#> GSM258558 2 0.0424 0.8361 0.008 0.992 0.000
#> GSM258559 2 0.1289 0.8351 0.032 0.968 0.000
#> GSM258560 2 0.5207 0.7659 0.052 0.824 0.124
#> GSM258561 2 0.4235 0.7999 0.176 0.824 0.000
#> GSM258564 2 0.4750 0.7748 0.216 0.784 0.000
#> GSM258567 2 0.4811 0.7873 0.148 0.828 0.024
#> GSM258568 2 0.0000 0.8355 0.000 1.000 0.000
#> GSM258569 3 0.9236 0.5858 0.248 0.220 0.532
#> GSM258571 3 0.7152 0.7207 0.444 0.024 0.532
#> GSM258572 2 0.4937 0.7836 0.148 0.824 0.028
#> GSM258573 2 0.4235 0.7999 0.176 0.824 0.000
#> GSM258574 2 0.3752 0.8022 0.144 0.856 0.000
#> GSM258575 2 0.0892 0.8381 0.020 0.980 0.000
#> GSM258576 2 0.0000 0.8355 0.000 1.000 0.000
#> GSM258577 2 0.4937 0.7841 0.148 0.824 0.028
#> GSM258579 2 0.0000 0.8355 0.000 1.000 0.000
#> GSM258581 2 0.0000 0.8355 0.000 1.000 0.000
#> GSM258582 3 0.7152 0.7207 0.444 0.024 0.532
#> GSM258584 2 0.7026 0.6830 0.152 0.728 0.120
#> GSM258586 2 0.4968 0.7923 0.188 0.800 0.012
#> GSM258587 2 0.4235 0.7999 0.176 0.824 0.000
#> GSM258588 2 0.3267 0.8138 0.116 0.884 0.000
#> GSM258589 2 0.1163 0.8363 0.028 0.972 0.000
#> GSM258591 2 0.4235 0.7999 0.176 0.824 0.000
#> GSM258592 2 0.6679 0.7107 0.152 0.748 0.100
#> GSM258593 3 0.2165 0.5238 0.064 0.000 0.936
#> GSM258595 3 0.7152 0.7207 0.444 0.024 0.532
#> GSM258597 2 0.4750 0.7748 0.216 0.784 0.000
#> GSM258598 2 0.4750 0.7748 0.216 0.784 0.000
#> GSM258600 2 0.6007 0.7701 0.192 0.764 0.044
#> GSM258601 3 0.7534 0.7151 0.428 0.040 0.532
#> GSM258602 2 0.0892 0.8362 0.020 0.980 0.000
#> GSM258604 3 0.7152 0.7207 0.444 0.024 0.532
#> GSM258605 3 0.7353 0.7203 0.436 0.032 0.532
#> GSM258606 2 0.0237 0.8358 0.004 0.996 0.000
#> GSM258607 2 0.4796 0.7745 0.220 0.780 0.000
#> GSM258608 2 0.3686 0.8039 0.140 0.860 0.000
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> GSM258553 1 0.0188 0.897 0.996 0.000 0.000 0.004
#> GSM258555 1 0.0000 0.900 1.000 0.000 0.000 0.000
#> GSM258556 2 0.7410 0.553 0.000 0.488 0.184 0.328
#> GSM258557 4 0.4897 0.937 0.332 0.000 0.008 0.660
#> GSM258562 3 0.0188 0.871 0.000 0.004 0.996 0.000
#> GSM258563 4 0.4761 0.936 0.332 0.000 0.004 0.664
#> GSM258565 1 0.0000 0.900 1.000 0.000 0.000 0.000
#> GSM258566 1 0.0000 0.900 1.000 0.000 0.000 0.000
#> GSM258570 1 0.0000 0.900 1.000 0.000 0.000 0.000
#> GSM258578 1 0.0000 0.900 1.000 0.000 0.000 0.000
#> GSM258580 3 0.7464 0.324 0.080 0.044 0.548 0.328
#> GSM258583 4 0.5367 0.918 0.304 0.000 0.032 0.664
#> GSM258585 4 0.5271 0.930 0.320 0.000 0.024 0.656
#> GSM258590 1 0.4008 0.485 0.756 0.000 0.000 0.244
#> GSM258594 1 0.0000 0.900 1.000 0.000 0.000 0.000
#> GSM258596 4 0.4837 0.930 0.348 0.000 0.004 0.648
#> GSM258599 4 0.4837 0.930 0.348 0.000 0.004 0.648
#> GSM258603 1 0.4008 0.485 0.756 0.000 0.000 0.244
#> GSM258551 2 0.4995 0.696 0.000 0.720 0.032 0.248
#> GSM258552 2 0.3836 0.728 0.000 0.816 0.168 0.016
#> GSM258554 2 0.5085 0.691 0.000 0.708 0.032 0.260
#> GSM258558 2 0.0188 0.767 0.000 0.996 0.004 0.000
#> GSM258559 2 0.2593 0.755 0.000 0.892 0.104 0.004
#> GSM258560 2 0.4849 0.702 0.000 0.772 0.164 0.064
#> GSM258561 2 0.6138 0.682 0.000 0.648 0.092 0.260
#> GSM258564 2 0.6430 0.618 0.000 0.596 0.092 0.312
#> GSM258567 2 0.3610 0.719 0.000 0.800 0.200 0.000
#> GSM258568 2 0.1022 0.765 0.000 0.968 0.000 0.032
#> GSM258569 3 0.5997 0.628 0.004 0.232 0.680 0.084
#> GSM258571 3 0.0657 0.870 0.000 0.012 0.984 0.004
#> GSM258572 2 0.4050 0.725 0.000 0.808 0.168 0.024
#> GSM258573 2 0.5557 0.661 0.000 0.652 0.040 0.308
#> GSM258574 2 0.3257 0.742 0.000 0.844 0.152 0.004
#> GSM258575 2 0.0524 0.768 0.000 0.988 0.008 0.004
#> GSM258576 2 0.1004 0.764 0.000 0.972 0.004 0.024
#> GSM258577 2 0.4423 0.717 0.000 0.792 0.168 0.040
#> GSM258579 2 0.0779 0.766 0.000 0.980 0.004 0.016
#> GSM258581 2 0.0779 0.766 0.000 0.980 0.004 0.016
#> GSM258582 3 0.0188 0.871 0.000 0.004 0.996 0.000
#> GSM258584 2 0.5250 0.672 0.000 0.736 0.196 0.068
#> GSM258586 2 0.7185 0.631 0.000 0.540 0.176 0.284
#> GSM258587 2 0.5883 0.654 0.000 0.640 0.060 0.300
#> GSM258588 2 0.3335 0.745 0.000 0.860 0.120 0.020
#> GSM258589 2 0.2831 0.755 0.000 0.876 0.120 0.004
#> GSM258591 2 0.5113 0.689 0.000 0.704 0.032 0.264
#> GSM258592 2 0.4546 0.666 0.000 0.732 0.256 0.012
#> GSM258593 4 0.6845 0.788 0.308 0.000 0.128 0.564
#> GSM258595 3 0.2401 0.841 0.000 0.004 0.904 0.092
#> GSM258597 2 0.6430 0.618 0.000 0.596 0.092 0.312
#> GSM258598 2 0.6430 0.618 0.000 0.596 0.092 0.312
#> GSM258600 2 0.5235 0.681 0.000 0.716 0.236 0.048
#> GSM258601 3 0.2021 0.862 0.000 0.024 0.936 0.040
#> GSM258602 2 0.0707 0.768 0.000 0.980 0.020 0.000
#> GSM258604 3 0.1743 0.859 0.000 0.004 0.940 0.056
#> GSM258605 3 0.0657 0.870 0.000 0.012 0.984 0.004
#> GSM258606 2 0.0376 0.766 0.000 0.992 0.004 0.004
#> GSM258607 2 0.7442 0.559 0.000 0.504 0.212 0.284
#> GSM258608 2 0.2814 0.747 0.000 0.868 0.132 0.000
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> GSM258553 1 0.0162 0.9844 0.996 0.000 0.000 0.000 0.004
#> GSM258555 1 0.0000 0.9856 1.000 0.000 0.000 0.000 0.000
#> GSM258556 3 0.6578 0.3701 0.000 0.288 0.568 0.072 0.072
#> GSM258557 5 0.3967 0.9677 0.200 0.020 0.008 0.000 0.772
#> GSM258562 3 0.1571 0.6457 0.000 0.060 0.936 0.000 0.004
#> GSM258563 5 0.3300 0.9734 0.204 0.004 0.000 0.000 0.792
#> GSM258565 1 0.0162 0.9844 0.996 0.000 0.000 0.000 0.004
#> GSM258566 1 0.0000 0.9856 1.000 0.000 0.000 0.000 0.000
#> GSM258570 1 0.0000 0.9856 1.000 0.000 0.000 0.000 0.000
#> GSM258578 1 0.0000 0.9856 1.000 0.000 0.000 0.000 0.000
#> GSM258580 3 0.5939 0.5151 0.000 0.216 0.620 0.008 0.156
#> GSM258583 5 0.3177 0.9737 0.208 0.000 0.000 0.000 0.792
#> GSM258585 5 0.3759 0.9538 0.180 0.024 0.004 0.000 0.792
#> GSM258590 1 0.1043 0.9538 0.960 0.000 0.000 0.000 0.040
#> GSM258594 1 0.0000 0.9856 1.000 0.000 0.000 0.000 0.000
#> GSM258596 5 0.3210 0.9727 0.212 0.000 0.000 0.000 0.788
#> GSM258599 5 0.3210 0.9727 0.212 0.000 0.000 0.000 0.788
#> GSM258603 1 0.1121 0.9507 0.956 0.000 0.000 0.000 0.044
#> GSM258551 4 0.4672 0.5395 0.000 0.064 0.012 0.748 0.176
#> GSM258552 2 0.6339 0.1512 0.000 0.512 0.328 0.156 0.004
#> GSM258554 4 0.4732 0.5373 0.000 0.068 0.012 0.744 0.176
#> GSM258558 4 0.0771 0.6091 0.000 0.020 0.004 0.976 0.000
#> GSM258559 4 0.6918 -0.3383 0.000 0.280 0.344 0.372 0.004
#> GSM258560 3 0.6316 0.4517 0.000 0.296 0.544 0.152 0.008
#> GSM258561 2 0.8074 -0.1892 0.000 0.352 0.348 0.124 0.176
#> GSM258564 2 0.6942 -0.3414 0.000 0.424 0.016 0.364 0.196
#> GSM258567 3 0.6104 0.4314 0.004 0.296 0.560 0.140 0.000
#> GSM258568 4 0.3231 0.5828 0.000 0.196 0.004 0.800 0.000
#> GSM258569 3 0.4626 0.5587 0.000 0.224 0.728 0.028 0.020
#> GSM258571 3 0.0451 0.6467 0.000 0.008 0.988 0.000 0.004
#> GSM258572 2 0.6370 0.1356 0.000 0.516 0.332 0.144 0.008
#> GSM258573 4 0.6701 0.4123 0.000 0.268 0.016 0.520 0.196
#> GSM258574 2 0.6814 0.1482 0.000 0.420 0.332 0.244 0.004
#> GSM258575 4 0.1768 0.5981 0.000 0.072 0.004 0.924 0.000
#> GSM258576 4 0.2648 0.6033 0.000 0.152 0.000 0.848 0.000
#> GSM258577 2 0.6685 0.1422 0.000 0.488 0.336 0.160 0.016
#> GSM258579 4 0.0703 0.6128 0.000 0.024 0.000 0.976 0.000
#> GSM258581 4 0.2280 0.6101 0.000 0.120 0.000 0.880 0.000
#> GSM258582 3 0.0162 0.6450 0.000 0.000 0.996 0.000 0.004
#> GSM258584 2 0.6633 0.0412 0.000 0.484 0.368 0.124 0.024
#> GSM258586 3 0.6180 0.4972 0.000 0.228 0.632 0.088 0.052
#> GSM258587 4 0.6915 0.3614 0.000 0.324 0.020 0.468 0.188
#> GSM258588 4 0.7053 -0.4050 0.000 0.328 0.312 0.352 0.008
#> GSM258589 3 0.6369 0.3816 0.000 0.244 0.520 0.236 0.000
#> GSM258591 4 0.6535 0.4336 0.000 0.260 0.016 0.548 0.176
#> GSM258592 3 0.5819 0.4845 0.000 0.252 0.600 0.148 0.000
#> GSM258593 5 0.4426 0.9340 0.196 0.004 0.052 0.000 0.748
#> GSM258595 3 0.3186 0.6326 0.000 0.080 0.864 0.008 0.048
#> GSM258597 2 0.6956 -0.3684 0.000 0.396 0.016 0.392 0.196
#> GSM258598 2 0.6869 -0.3078 0.000 0.468 0.016 0.320 0.196
#> GSM258600 3 0.6906 0.1676 0.000 0.360 0.460 0.152 0.028
#> GSM258601 3 0.2286 0.6488 0.000 0.108 0.888 0.000 0.004
#> GSM258602 4 0.3865 0.4502 0.000 0.092 0.100 0.808 0.000
#> GSM258604 3 0.1043 0.6475 0.000 0.040 0.960 0.000 0.000
#> GSM258605 3 0.0566 0.6470 0.000 0.012 0.984 0.000 0.004
#> GSM258606 4 0.0290 0.6132 0.000 0.008 0.000 0.992 0.000
#> GSM258607 3 0.7034 0.2909 0.000 0.332 0.496 0.104 0.068
#> GSM258608 2 0.7012 0.1425 0.000 0.388 0.316 0.288 0.008
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> GSM258553 1 0.0146 0.99562 0.996 0.000 0.000 0.000 0.004 0.000
#> GSM258555 1 0.0000 0.99824 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM258556 4 0.4429 0.17788 0.000 0.244 0.032 0.700 0.000 0.024
#> GSM258557 5 0.2033 0.92854 0.004 0.004 0.056 0.020 0.916 0.000
#> GSM258562 4 0.5360 -0.45937 0.000 0.108 0.436 0.456 0.000 0.000
#> GSM258563 5 0.0146 0.98438 0.004 0.000 0.000 0.000 0.996 0.000
#> GSM258565 1 0.0000 0.99824 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM258566 1 0.0000 0.99824 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM258570 1 0.0000 0.99824 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM258578 1 0.0000 0.99824 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM258580 2 0.7035 -0.00855 0.000 0.460 0.312 0.148 0.036 0.044
#> GSM258583 5 0.0260 0.98266 0.008 0.000 0.000 0.000 0.992 0.000
#> GSM258585 5 0.0363 0.98066 0.000 0.000 0.012 0.000 0.988 0.000
#> GSM258590 1 0.0146 0.99569 0.996 0.000 0.000 0.000 0.004 0.000
#> GSM258594 1 0.0000 0.99824 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM258596 5 0.0146 0.98438 0.004 0.000 0.000 0.000 0.996 0.000
#> GSM258599 5 0.0146 0.98438 0.004 0.000 0.000 0.000 0.996 0.000
#> GSM258603 1 0.0260 0.99457 0.992 0.000 0.000 0.000 0.008 0.000
#> GSM258551 6 0.3081 0.62591 0.000 0.000 0.004 0.220 0.000 0.776
#> GSM258552 2 0.0551 0.75100 0.000 0.984 0.004 0.004 0.000 0.008
#> GSM258554 6 0.3323 0.61584 0.000 0.000 0.008 0.240 0.000 0.752
#> GSM258558 6 0.0146 0.70339 0.000 0.004 0.000 0.000 0.000 0.996
#> GSM258559 2 0.6060 0.48115 0.000 0.596 0.084 0.108 0.000 0.212
#> GSM258560 2 0.5186 0.47112 0.000 0.624 0.100 0.264 0.000 0.012
#> GSM258561 4 0.4836 0.22192 0.000 0.288 0.004 0.632 0.000 0.076
#> GSM258564 4 0.5919 -0.25978 0.000 0.000 0.248 0.464 0.000 0.288
#> GSM258567 4 0.5451 -0.22548 0.000 0.444 0.092 0.456 0.000 0.008
#> GSM258568 6 0.4265 0.64424 0.000 0.000 0.172 0.100 0.000 0.728
#> GSM258569 2 0.4613 0.52899 0.000 0.692 0.128 0.180 0.000 0.000
#> GSM258571 3 0.4757 0.33884 0.000 0.048 0.484 0.468 0.000 0.000
#> GSM258572 2 0.0291 0.74908 0.000 0.992 0.004 0.000 0.000 0.004
#> GSM258573 3 0.6078 -0.52875 0.000 0.000 0.388 0.336 0.000 0.276
#> GSM258574 2 0.0405 0.75231 0.000 0.988 0.000 0.004 0.000 0.008
#> GSM258575 6 0.1333 0.69040 0.000 0.048 0.008 0.000 0.000 0.944
#> GSM258576 6 0.4718 0.57429 0.000 0.000 0.316 0.068 0.000 0.616
#> GSM258577 2 0.0405 0.74877 0.000 0.988 0.004 0.000 0.000 0.008
#> GSM258579 6 0.1700 0.69273 0.000 0.004 0.080 0.000 0.000 0.916
#> GSM258581 6 0.3952 0.59206 0.000 0.000 0.308 0.020 0.000 0.672
#> GSM258582 3 0.4529 0.34094 0.000 0.032 0.508 0.460 0.000 0.000
#> GSM258584 2 0.1599 0.74964 0.000 0.940 0.024 0.028 0.000 0.008
#> GSM258586 4 0.5525 0.04009 0.000 0.364 0.084 0.532 0.000 0.020
#> GSM258587 6 0.5981 0.29696 0.000 0.000 0.228 0.376 0.000 0.396
#> GSM258588 2 0.1897 0.71135 0.000 0.908 0.004 0.004 0.000 0.084
#> GSM258589 2 0.5050 0.52690 0.000 0.664 0.092 0.224 0.000 0.020
#> GSM258591 6 0.6069 0.41477 0.000 0.036 0.116 0.360 0.000 0.488
#> GSM258592 4 0.5603 -0.20811 0.000 0.432 0.100 0.456 0.000 0.012
#> GSM258593 5 0.0508 0.98231 0.004 0.000 0.012 0.000 0.984 0.000
#> GSM258595 3 0.5739 0.25469 0.000 0.348 0.492 0.156 0.000 0.004
#> GSM258597 4 0.5930 -0.26464 0.000 0.000 0.248 0.460 0.000 0.292
#> GSM258598 4 0.4574 -0.09510 0.000 0.000 0.440 0.524 0.000 0.036
#> GSM258600 2 0.3115 0.70236 0.000 0.848 0.048 0.092 0.000 0.012
#> GSM258601 3 0.6067 0.27074 0.000 0.332 0.396 0.272 0.000 0.000
#> GSM258602 6 0.3911 0.52476 0.000 0.160 0.004 0.068 0.000 0.768
#> GSM258604 3 0.5767 0.39169 0.000 0.232 0.508 0.260 0.000 0.000
#> GSM258605 4 0.4992 -0.47949 0.000 0.068 0.464 0.468 0.000 0.000
#> GSM258606 6 0.0146 0.70350 0.000 0.004 0.000 0.000 0.000 0.996
#> GSM258607 4 0.4935 0.22391 0.000 0.280 0.016 0.640 0.000 0.064
#> GSM258608 2 0.1194 0.74794 0.000 0.956 0.000 0.008 0.004 0.032
Heatmaps for the consensus matrix. It visualizes the probability of two samples to be in a same group.
consensus_heatmap(res, k = 2)
consensus_heatmap(res, k = 3)
consensus_heatmap(res, k = 4)
consensus_heatmap(res, k = 5)
consensus_heatmap(res, k = 6)
Heatmaps for the membership of samples in all partitions to see how consistent they are:
membership_heatmap(res, k = 2)
membership_heatmap(res, k = 3)
membership_heatmap(res, k = 4)
membership_heatmap(res, k = 5)
membership_heatmap(res, k = 6)
As soon as we have had the classes for columns, we can look for signatures which are significantly different between classes which can be candidate marks for certain classes. Following are the heatmaps for signatures.
Signature heatmaps where rows are scaled:
get_signatures(res, k = 2)
get_signatures(res, k = 3)
get_signatures(res, k = 4)
get_signatures(res, k = 5)
get_signatures(res, k = 6)
Signature heatmaps where rows are not scaled:
get_signatures(res, k = 2, scale_rows = FALSE)
get_signatures(res, k = 3, scale_rows = FALSE)
get_signatures(res, k = 4, scale_rows = FALSE)
get_signatures(res, k = 5, scale_rows = FALSE)
get_signatures(res, k = 6, scale_rows = FALSE)
Compare the overlap of signatures from different k:
compare_signatures(res)
get_signature()
returns a data frame invisibly. TO get the list of signatures, the function
call should be assigned to a variable explicitly. In following code, if plot
argument is set
to FALSE
, no heatmap is plotted while only the differential analysis is performed.
# code only for demonstration
tb = get_signature(res, k = ..., plot = FALSE)
An example of the output of tb
is:
#> which_row fdr mean_1 mean_2 scaled_mean_1 scaled_mean_2 km
#> 1 38 0.042760348 8.373488 9.131774 -0.5533452 0.5164555 1
#> 2 40 0.018707592 7.106213 8.469186 -0.6173731 0.5762149 1
#> 3 55 0.019134737 10.221463 11.207825 -0.6159697 0.5749050 1
#> 4 59 0.006059896 5.921854 7.869574 -0.6899429 0.6439467 1
#> 5 60 0.018055526 8.928898 10.211722 -0.6204761 0.5791110 1
#> 6 98 0.009384629 15.714769 14.887706 0.6635654 -0.6193277 2
...
The columns in tb
are:
which_row
: row indices corresponding to the input matrix.fdr
: FDR for the differential test. mean_x
: The mean value in group x.scaled_mean_x
: The mean value in group x after rows are scaled.km
: Row groups if k-means clustering is applied to rows.UMAP plot which shows how samples are separated.
dimension_reduction(res, k = 2, method = "UMAP")
dimension_reduction(res, k = 3, method = "UMAP")
dimension_reduction(res, k = 4, method = "UMAP")
dimension_reduction(res, k = 5, method = "UMAP")
dimension_reduction(res, k = 6, method = "UMAP")
Following heatmap shows how subgroups are split when increasing k
:
collect_classes(res)
Test correlation between subgroups and known annotations. If the known annotation is numeric, one-way ANOVA test is applied, and if the known annotation is discrete, chi-squared contingency table test is applied.
test_to_known_factors(res)
#> n disease.state(p) k
#> SD:mclust 51 7.01e-10 2
#> SD:mclust 51 9.53e-10 3
#> SD:mclust 55 5.44e-09 4
#> SD:mclust 34 2.11e-05 5
#> SD:mclust 36 4.16e-07 6
If matrix rows can be associated to genes, consider to use functional_enrichment(res,
...)
to perform function enrichment for the signature genes. See this vignette for more detailed explanations.
The object with results only for a single top-value method and a single partition method can be extracted as:
res = res_list["SD", "NMF"]
# you can also extract it by
# res = res_list["SD:NMF"]
A summary of res
and all the functions that can be applied to it:
res
#> A 'ConsensusPartition' object with k = 2, 3, 4, 5, 6.
#> On a matrix with 51941 rows and 58 columns.
#> Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'SD' method.
#> Subgroups are detected by 'NMF' method.
#> Performed in total 1250 partitions by row resampling.
#> Best k for subgroups seems to be 2.
#>
#> Following methods can be applied to this 'ConsensusPartition' object:
#> [1] "cola_report" "collect_classes" "collect_plots"
#> [4] "collect_stats" "colnames" "compare_signatures"
#> [7] "consensus_heatmap" "dimension_reduction" "functional_enrichment"
#> [10] "get_anno_col" "get_anno" "get_classes"
#> [13] "get_consensus" "get_matrix" "get_membership"
#> [16] "get_param" "get_signatures" "get_stats"
#> [19] "is_best_k" "is_stable_k" "membership_heatmap"
#> [22] "ncol" "nrow" "plot_ecdf"
#> [25] "rownames" "select_partition_number" "show"
#> [28] "suggest_best_k" "test_to_known_factors"
collect_plots()
function collects all the plots made from res
for all k
(number of partitions)
into one single page to provide an easy and fast comparison between different k
.
collect_plots(res)
The plots are:
k
and the heatmap of
predicted classes for each k
.k
.k
.k
.All the plots in panels can be made by individual functions and they are plotted later in this section.
select_partition_number()
produces several plots showing different
statistics for choosing “optimized” k
. There are following statistics:
k
;k
, the area increased is defined as \(A_k - A_{k-1}\).The detailed explanations of these statistics can be found in the cola vignette.
Generally speaking, lower PAC score, higher mean silhouette score or higher
concordance corresponds to better partition. Rand index and Jaccard index
measure how similar the current partition is compared to partition with k-1
.
If they are too similar, we won't accept k
is better than k-1
.
select_partition_number(res)
The numeric values for all these statistics can be obtained by get_stats()
.
get_stats(res)
#> k 1-PAC mean_silhouette concordance area_increased Rand Jaccard
#> 2 2 0.963 0.943 0.976 0.4634 0.540 0.540
#> 3 3 0.875 0.878 0.947 0.4422 0.700 0.486
#> 4 4 0.776 0.871 0.915 0.1347 0.854 0.592
#> 5 5 0.811 0.800 0.896 0.0681 0.880 0.565
#> 6 6 0.827 0.763 0.863 0.0346 0.962 0.809
suggest_best_k()
suggests the best \(k\) based on these statistics. The rules are as follows:
suggest_best_k(res)
#> [1] 2
Following shows the table of the partitions (You need to click the show/hide
code output link to see it). The membership matrix (columns with name p*
)
is inferred by
clue::cl_consensus()
function with the SE
method. Basically the value in the membership matrix
represents the probability to belong to a certain group. The finall class
label for an item is determined with the group with highest probability it
belongs to.
In get_classes()
function, the entropy is calculated from the membership
matrix and the silhouette score is calculated from the consensus matrix.
cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#> class entropy silhouette p1 p2
#> GSM258553 1 0.0000 0.974 1.000 0.000
#> GSM258555 1 0.0000 0.974 1.000 0.000
#> GSM258556 2 0.0000 0.974 0.000 1.000
#> GSM258557 1 0.0000 0.974 1.000 0.000
#> GSM258562 1 0.4431 0.886 0.908 0.092
#> GSM258563 1 0.0000 0.974 1.000 0.000
#> GSM258565 1 0.0000 0.974 1.000 0.000
#> GSM258566 1 0.0000 0.974 1.000 0.000
#> GSM258570 1 0.0000 0.974 1.000 0.000
#> GSM258578 1 0.0000 0.974 1.000 0.000
#> GSM258580 2 0.8081 0.673 0.248 0.752
#> GSM258583 1 0.0000 0.974 1.000 0.000
#> GSM258585 1 0.0000 0.974 1.000 0.000
#> GSM258590 1 0.0000 0.974 1.000 0.000
#> GSM258594 1 0.0000 0.974 1.000 0.000
#> GSM258596 1 0.0000 0.974 1.000 0.000
#> GSM258599 1 0.0000 0.974 1.000 0.000
#> GSM258603 1 0.0000 0.974 1.000 0.000
#> GSM258551 2 0.0000 0.974 0.000 1.000
#> GSM258552 2 0.0000 0.974 0.000 1.000
#> GSM258554 2 0.0000 0.974 0.000 1.000
#> GSM258558 2 0.0000 0.974 0.000 1.000
#> GSM258559 2 0.0000 0.974 0.000 1.000
#> GSM258560 2 0.0000 0.974 0.000 1.000
#> GSM258561 2 0.0000 0.974 0.000 1.000
#> GSM258564 2 0.0000 0.974 0.000 1.000
#> GSM258567 2 0.0000 0.974 0.000 1.000
#> GSM258568 2 0.0000 0.974 0.000 1.000
#> GSM258569 2 0.7674 0.713 0.224 0.776
#> GSM258571 1 0.9323 0.448 0.652 0.348
#> GSM258572 2 0.0000 0.974 0.000 1.000
#> GSM258573 2 0.0000 0.974 0.000 1.000
#> GSM258574 2 0.0000 0.974 0.000 1.000
#> GSM258575 2 0.0000 0.974 0.000 1.000
#> GSM258576 2 0.0000 0.974 0.000 1.000
#> GSM258577 2 0.0000 0.974 0.000 1.000
#> GSM258579 2 0.0000 0.974 0.000 1.000
#> GSM258581 2 0.0000 0.974 0.000 1.000
#> GSM258582 1 0.0672 0.969 0.992 0.008
#> GSM258584 2 0.0000 0.974 0.000 1.000
#> GSM258586 2 0.0000 0.974 0.000 1.000
#> GSM258587 2 0.0000 0.974 0.000 1.000
#> GSM258588 2 0.0000 0.974 0.000 1.000
#> GSM258589 2 0.0000 0.974 0.000 1.000
#> GSM258591 2 0.0000 0.974 0.000 1.000
#> GSM258592 2 0.0000 0.974 0.000 1.000
#> GSM258593 1 0.0000 0.974 1.000 0.000
#> GSM258595 2 0.3431 0.914 0.064 0.936
#> GSM258597 2 0.0000 0.974 0.000 1.000
#> GSM258598 2 0.0000 0.974 0.000 1.000
#> GSM258600 2 0.0000 0.974 0.000 1.000
#> GSM258601 2 0.0000 0.974 0.000 1.000
#> GSM258602 2 0.0000 0.974 0.000 1.000
#> GSM258604 2 0.9580 0.393 0.380 0.620
#> GSM258605 1 0.1414 0.959 0.980 0.020
#> GSM258606 2 0.0000 0.974 0.000 1.000
#> GSM258607 2 0.0000 0.974 0.000 1.000
#> GSM258608 2 0.0000 0.974 0.000 1.000
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> GSM258553 1 0.0000 0.9624 1.000 0.000 0.000
#> GSM258555 1 0.0000 0.9624 1.000 0.000 0.000
#> GSM258556 3 0.6111 0.4281 0.000 0.396 0.604
#> GSM258557 1 0.6307 -0.0276 0.512 0.000 0.488
#> GSM258562 3 0.0892 0.9127 0.020 0.000 0.980
#> GSM258563 1 0.0000 0.9624 1.000 0.000 0.000
#> GSM258565 1 0.0000 0.9624 1.000 0.000 0.000
#> GSM258566 1 0.0000 0.9624 1.000 0.000 0.000
#> GSM258570 1 0.0000 0.9624 1.000 0.000 0.000
#> GSM258578 1 0.0000 0.9624 1.000 0.000 0.000
#> GSM258580 3 0.5431 0.6133 0.000 0.284 0.716
#> GSM258583 1 0.0000 0.9624 1.000 0.000 0.000
#> GSM258585 1 0.1031 0.9433 0.976 0.000 0.024
#> GSM258590 1 0.0000 0.9624 1.000 0.000 0.000
#> GSM258594 1 0.0000 0.9624 1.000 0.000 0.000
#> GSM258596 1 0.0000 0.9624 1.000 0.000 0.000
#> GSM258599 1 0.0000 0.9624 1.000 0.000 0.000
#> GSM258603 1 0.0000 0.9624 1.000 0.000 0.000
#> GSM258551 2 0.0000 0.9441 0.000 1.000 0.000
#> GSM258552 3 0.0000 0.9206 0.000 0.000 1.000
#> GSM258554 2 0.0000 0.9441 0.000 1.000 0.000
#> GSM258558 2 0.1163 0.9430 0.000 0.972 0.028
#> GSM258559 2 0.5431 0.6031 0.000 0.716 0.284
#> GSM258560 3 0.0000 0.9206 0.000 0.000 1.000
#> GSM258561 2 0.0592 0.9401 0.000 0.988 0.012
#> GSM258564 2 0.0000 0.9441 0.000 1.000 0.000
#> GSM258567 3 0.0000 0.9206 0.000 0.000 1.000
#> GSM258568 2 0.1163 0.9430 0.000 0.972 0.028
#> GSM258569 3 0.0000 0.9206 0.000 0.000 1.000
#> GSM258571 3 0.0983 0.9161 0.004 0.016 0.980
#> GSM258572 3 0.0000 0.9206 0.000 0.000 1.000
#> GSM258573 2 0.0000 0.9441 0.000 1.000 0.000
#> GSM258574 3 0.0424 0.9191 0.000 0.008 0.992
#> GSM258575 2 0.1163 0.9430 0.000 0.972 0.028
#> GSM258576 2 0.0892 0.9438 0.000 0.980 0.020
#> GSM258577 3 0.0424 0.9195 0.000 0.008 0.992
#> GSM258579 2 0.1031 0.9436 0.000 0.976 0.024
#> GSM258581 2 0.1163 0.9430 0.000 0.972 0.028
#> GSM258582 3 0.1491 0.9095 0.016 0.016 0.968
#> GSM258584 3 0.1289 0.9051 0.000 0.032 0.968
#> GSM258586 3 0.5327 0.6651 0.000 0.272 0.728
#> GSM258587 2 0.0000 0.9441 0.000 1.000 0.000
#> GSM258588 3 0.6111 0.3753 0.000 0.396 0.604
#> GSM258589 3 0.0592 0.9181 0.000 0.012 0.988
#> GSM258591 2 0.0000 0.9441 0.000 1.000 0.000
#> GSM258592 3 0.0000 0.9206 0.000 0.000 1.000
#> GSM258593 1 0.0747 0.9502 0.984 0.000 0.016
#> GSM258595 3 0.0983 0.9167 0.004 0.016 0.980
#> GSM258597 2 0.0000 0.9441 0.000 1.000 0.000
#> GSM258598 2 0.0000 0.9441 0.000 1.000 0.000
#> GSM258600 3 0.0000 0.9206 0.000 0.000 1.000
#> GSM258601 3 0.0747 0.9173 0.000 0.016 0.984
#> GSM258602 2 0.1289 0.9408 0.000 0.968 0.032
#> GSM258604 3 0.1453 0.9102 0.008 0.024 0.968
#> GSM258605 3 0.0747 0.9145 0.016 0.000 0.984
#> GSM258606 2 0.1163 0.9430 0.000 0.972 0.028
#> GSM258607 2 0.5733 0.5019 0.000 0.676 0.324
#> GSM258608 2 0.3941 0.8179 0.000 0.844 0.156
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> GSM258553 1 0.0000 0.942 1.000 0.000 0.000 0.000
#> GSM258555 1 0.0000 0.942 1.000 0.000 0.000 0.000
#> GSM258556 4 0.3143 0.842 0.000 0.024 0.100 0.876
#> GSM258557 1 0.7093 0.472 0.568 0.220 0.212 0.000
#> GSM258562 3 0.1022 0.890 0.000 0.032 0.968 0.000
#> GSM258563 1 0.0188 0.940 0.996 0.004 0.000 0.000
#> GSM258565 1 0.0000 0.942 1.000 0.000 0.000 0.000
#> GSM258566 1 0.0000 0.942 1.000 0.000 0.000 0.000
#> GSM258570 1 0.0000 0.942 1.000 0.000 0.000 0.000
#> GSM258578 1 0.0000 0.942 1.000 0.000 0.000 0.000
#> GSM258580 3 0.4907 0.425 0.000 0.420 0.580 0.000
#> GSM258583 1 0.0000 0.942 1.000 0.000 0.000 0.000
#> GSM258585 1 0.5727 0.662 0.692 0.228 0.080 0.000
#> GSM258590 1 0.0000 0.942 1.000 0.000 0.000 0.000
#> GSM258594 1 0.0000 0.942 1.000 0.000 0.000 0.000
#> GSM258596 1 0.0000 0.942 1.000 0.000 0.000 0.000
#> GSM258599 1 0.0000 0.942 1.000 0.000 0.000 0.000
#> GSM258603 1 0.0000 0.942 1.000 0.000 0.000 0.000
#> GSM258551 4 0.3801 0.700 0.000 0.220 0.000 0.780
#> GSM258552 3 0.1867 0.879 0.000 0.072 0.928 0.000
#> GSM258554 4 0.1022 0.929 0.000 0.032 0.000 0.968
#> GSM258558 2 0.2281 0.910 0.000 0.904 0.000 0.096
#> GSM258559 2 0.2670 0.863 0.000 0.904 0.072 0.024
#> GSM258560 3 0.3495 0.828 0.000 0.140 0.844 0.016
#> GSM258561 4 0.1833 0.899 0.000 0.024 0.032 0.944
#> GSM258564 4 0.0336 0.936 0.000 0.008 0.000 0.992
#> GSM258567 3 0.1677 0.892 0.000 0.040 0.948 0.012
#> GSM258568 2 0.3726 0.822 0.000 0.788 0.000 0.212
#> GSM258569 3 0.1474 0.885 0.000 0.052 0.948 0.000
#> GSM258571 3 0.1510 0.893 0.000 0.028 0.956 0.016
#> GSM258572 3 0.2149 0.874 0.000 0.088 0.912 0.000
#> GSM258573 4 0.0592 0.937 0.000 0.016 0.000 0.984
#> GSM258574 2 0.3123 0.744 0.000 0.844 0.156 0.000
#> GSM258575 2 0.2408 0.910 0.000 0.896 0.000 0.104
#> GSM258576 2 0.3123 0.883 0.000 0.844 0.000 0.156
#> GSM258577 3 0.4072 0.720 0.000 0.252 0.748 0.000
#> GSM258579 2 0.2281 0.910 0.000 0.904 0.000 0.096
#> GSM258581 2 0.2647 0.906 0.000 0.880 0.000 0.120
#> GSM258582 3 0.1510 0.893 0.000 0.028 0.956 0.016
#> GSM258584 2 0.3335 0.815 0.000 0.856 0.128 0.016
#> GSM258586 4 0.2919 0.866 0.000 0.044 0.060 0.896
#> GSM258587 4 0.0707 0.936 0.000 0.020 0.000 0.980
#> GSM258588 2 0.2565 0.888 0.000 0.912 0.056 0.032
#> GSM258589 3 0.3681 0.801 0.000 0.176 0.816 0.008
#> GSM258591 4 0.0707 0.936 0.000 0.020 0.000 0.980
#> GSM258592 3 0.1610 0.892 0.000 0.032 0.952 0.016
#> GSM258593 1 0.4374 0.791 0.812 0.068 0.120 0.000
#> GSM258595 3 0.2300 0.882 0.000 0.028 0.924 0.048
#> GSM258597 4 0.0592 0.937 0.000 0.016 0.000 0.984
#> GSM258598 4 0.0592 0.937 0.000 0.016 0.000 0.984
#> GSM258600 3 0.1867 0.879 0.000 0.072 0.928 0.000
#> GSM258601 3 0.1624 0.892 0.000 0.028 0.952 0.020
#> GSM258602 2 0.2408 0.911 0.000 0.896 0.000 0.104
#> GSM258604 3 0.3307 0.841 0.000 0.028 0.868 0.104
#> GSM258605 3 0.1510 0.893 0.000 0.028 0.956 0.016
#> GSM258606 2 0.2704 0.904 0.000 0.876 0.000 0.124
#> GSM258607 4 0.0672 0.926 0.000 0.008 0.008 0.984
#> GSM258608 2 0.1256 0.862 0.000 0.964 0.028 0.008
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> GSM258553 1 0.0000 0.9888 1.000 0.000 0.000 0.000 0.000
#> GSM258555 1 0.0000 0.9888 1.000 0.000 0.000 0.000 0.000
#> GSM258556 4 0.1043 0.9259 0.000 0.000 0.000 0.960 0.040
#> GSM258557 5 0.5487 0.5387 0.252 0.100 0.004 0.000 0.644
#> GSM258562 5 0.4030 0.5016 0.000 0.000 0.352 0.000 0.648
#> GSM258563 1 0.2068 0.8982 0.904 0.000 0.004 0.000 0.092
#> GSM258565 1 0.0000 0.9888 1.000 0.000 0.000 0.000 0.000
#> GSM258566 1 0.0000 0.9888 1.000 0.000 0.000 0.000 0.000
#> GSM258570 1 0.0000 0.9888 1.000 0.000 0.000 0.000 0.000
#> GSM258578 1 0.0000 0.9888 1.000 0.000 0.000 0.000 0.000
#> GSM258580 5 0.2519 0.7352 0.000 0.100 0.016 0.000 0.884
#> GSM258583 1 0.0451 0.9841 0.988 0.000 0.004 0.000 0.008
#> GSM258585 5 0.4210 0.6735 0.140 0.072 0.004 0.000 0.784
#> GSM258590 1 0.0162 0.9875 0.996 0.000 0.000 0.000 0.004
#> GSM258594 1 0.0000 0.9888 1.000 0.000 0.000 0.000 0.000
#> GSM258596 1 0.0510 0.9811 0.984 0.000 0.000 0.000 0.016
#> GSM258599 1 0.0451 0.9841 0.988 0.000 0.004 0.000 0.008
#> GSM258603 1 0.0000 0.9888 1.000 0.000 0.000 0.000 0.000
#> GSM258551 4 0.2554 0.8898 0.000 0.072 0.000 0.892 0.036
#> GSM258552 5 0.1544 0.7512 0.000 0.000 0.068 0.000 0.932
#> GSM258554 4 0.0162 0.9420 0.000 0.004 0.000 0.996 0.000
#> GSM258558 2 0.1197 0.8570 0.000 0.952 0.000 0.000 0.048
#> GSM258559 3 0.4305 -0.0722 0.000 0.488 0.512 0.000 0.000
#> GSM258560 3 0.2193 0.7594 0.000 0.028 0.912 0.000 0.060
#> GSM258561 4 0.2179 0.8682 0.000 0.000 0.112 0.888 0.000
#> GSM258564 4 0.0000 0.9424 0.000 0.000 0.000 1.000 0.000
#> GSM258567 3 0.0324 0.7875 0.000 0.004 0.992 0.000 0.004
#> GSM258568 2 0.2423 0.8334 0.000 0.896 0.024 0.080 0.000
#> GSM258569 5 0.3612 0.5969 0.000 0.000 0.268 0.000 0.732
#> GSM258571 3 0.2824 0.7577 0.000 0.000 0.864 0.020 0.116
#> GSM258572 5 0.1043 0.7562 0.000 0.000 0.040 0.000 0.960
#> GSM258573 4 0.1197 0.9284 0.000 0.048 0.000 0.952 0.000
#> GSM258574 5 0.3123 0.6953 0.000 0.160 0.012 0.000 0.828
#> GSM258575 2 0.0000 0.8768 0.000 1.000 0.000 0.000 0.000
#> GSM258576 2 0.1043 0.8694 0.000 0.960 0.000 0.040 0.000
#> GSM258577 5 0.3409 0.6942 0.000 0.024 0.160 0.000 0.816
#> GSM258579 2 0.0609 0.8731 0.000 0.980 0.000 0.000 0.020
#> GSM258581 2 0.0162 0.8774 0.000 0.996 0.000 0.004 0.000
#> GSM258582 3 0.3452 0.6188 0.000 0.000 0.756 0.000 0.244
#> GSM258584 3 0.3305 0.5959 0.000 0.224 0.776 0.000 0.000
#> GSM258586 4 0.1270 0.9238 0.000 0.000 0.000 0.948 0.052
#> GSM258587 4 0.2813 0.8053 0.000 0.168 0.000 0.832 0.000
#> GSM258588 2 0.1608 0.8599 0.000 0.928 0.072 0.000 0.000
#> GSM258589 5 0.5671 0.5029 0.000 0.092 0.308 0.004 0.596
#> GSM258591 4 0.1544 0.9159 0.000 0.068 0.000 0.932 0.000
#> GSM258592 3 0.0162 0.7878 0.000 0.000 0.996 0.000 0.004
#> GSM258593 5 0.2017 0.7449 0.080 0.000 0.008 0.000 0.912
#> GSM258595 5 0.5821 0.4774 0.000 0.000 0.240 0.156 0.604
#> GSM258597 4 0.0000 0.9424 0.000 0.000 0.000 1.000 0.000
#> GSM258598 4 0.0000 0.9424 0.000 0.000 0.000 1.000 0.000
#> GSM258600 5 0.0404 0.7547 0.000 0.000 0.012 0.000 0.988
#> GSM258601 3 0.2540 0.7750 0.000 0.000 0.888 0.024 0.088
#> GSM258602 2 0.2929 0.7552 0.000 0.820 0.180 0.000 0.000
#> GSM258604 3 0.3692 0.7085 0.000 0.000 0.812 0.136 0.052
#> GSM258605 3 0.1410 0.7862 0.000 0.000 0.940 0.000 0.060
#> GSM258606 2 0.1331 0.8708 0.000 0.952 0.040 0.008 0.000
#> GSM258607 4 0.0000 0.9424 0.000 0.000 0.000 1.000 0.000
#> GSM258608 2 0.5891 0.0586 0.000 0.468 0.100 0.000 0.432
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> GSM258553 1 0.0000 0.944 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM258555 1 0.0000 0.944 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM258556 4 0.0291 0.911 0.000 0.004 0.000 0.992 0.004 0.000
#> GSM258557 5 0.4478 0.685 0.200 0.088 0.004 0.000 0.708 0.000
#> GSM258562 2 0.3314 0.787 0.000 0.828 0.052 0.008 0.112 0.000
#> GSM258563 1 0.4032 0.219 0.572 0.000 0.008 0.000 0.420 0.000
#> GSM258565 1 0.0000 0.944 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM258566 1 0.0000 0.944 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM258570 1 0.0000 0.944 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM258578 1 0.0000 0.944 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM258580 2 0.2537 0.780 0.000 0.872 0.000 0.000 0.096 0.032
#> GSM258583 1 0.2165 0.847 0.884 0.000 0.008 0.000 0.108 0.000
#> GSM258585 5 0.5097 0.739 0.036 0.184 0.044 0.000 0.708 0.028
#> GSM258590 1 0.0146 0.943 0.996 0.000 0.000 0.000 0.004 0.000
#> GSM258594 1 0.0000 0.944 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM258596 1 0.0937 0.924 0.960 0.000 0.000 0.000 0.040 0.000
#> GSM258599 1 0.0858 0.928 0.968 0.000 0.004 0.000 0.028 0.000
#> GSM258603 1 0.0146 0.943 0.996 0.000 0.000 0.000 0.004 0.000
#> GSM258551 4 0.3240 0.668 0.000 0.004 0.000 0.752 0.244 0.000
#> GSM258552 2 0.1753 0.803 0.000 0.912 0.084 0.000 0.004 0.000
#> GSM258554 4 0.0622 0.909 0.000 0.000 0.008 0.980 0.012 0.000
#> GSM258558 6 0.1341 0.811 0.000 0.024 0.000 0.000 0.028 0.948
#> GSM258559 3 0.5002 0.641 0.000 0.000 0.636 0.000 0.228 0.136
#> GSM258560 3 0.4470 0.687 0.000 0.004 0.696 0.000 0.228 0.072
#> GSM258561 4 0.2006 0.845 0.000 0.000 0.104 0.892 0.004 0.000
#> GSM258564 4 0.0146 0.912 0.000 0.004 0.000 0.996 0.000 0.000
#> GSM258567 3 0.3349 0.700 0.000 0.000 0.748 0.000 0.244 0.008
#> GSM258568 6 0.0725 0.821 0.000 0.000 0.012 0.000 0.012 0.976
#> GSM258569 2 0.2300 0.775 0.000 0.856 0.144 0.000 0.000 0.000
#> GSM258571 3 0.2400 0.655 0.000 0.116 0.872 0.004 0.008 0.000
#> GSM258572 2 0.0458 0.821 0.000 0.984 0.000 0.000 0.016 0.000
#> GSM258573 4 0.3023 0.728 0.000 0.000 0.000 0.784 0.004 0.212
#> GSM258574 2 0.3351 0.664 0.000 0.800 0.000 0.000 0.160 0.040
#> GSM258575 6 0.0632 0.823 0.000 0.000 0.000 0.000 0.024 0.976
#> GSM258576 6 0.0260 0.825 0.000 0.000 0.000 0.008 0.000 0.992
#> GSM258577 5 0.4395 0.663 0.000 0.280 0.028 0.016 0.676 0.000
#> GSM258579 6 0.2034 0.791 0.000 0.024 0.004 0.000 0.060 0.912
#> GSM258581 6 0.0458 0.825 0.000 0.000 0.000 0.000 0.016 0.984
#> GSM258582 3 0.3874 0.265 0.000 0.356 0.636 0.000 0.008 0.000
#> GSM258584 3 0.4476 0.662 0.000 0.000 0.664 0.000 0.272 0.064
#> GSM258586 4 0.0508 0.909 0.000 0.004 0.000 0.984 0.012 0.000
#> GSM258587 6 0.4253 0.212 0.000 0.000 0.008 0.412 0.008 0.572
#> GSM258588 6 0.5378 0.406 0.000 0.020 0.300 0.000 0.088 0.592
#> GSM258589 2 0.4762 0.639 0.000 0.720 0.100 0.000 0.152 0.028
#> GSM258591 4 0.2921 0.797 0.000 0.000 0.008 0.828 0.008 0.156
#> GSM258592 3 0.3357 0.706 0.000 0.004 0.764 0.000 0.224 0.008
#> GSM258593 2 0.0725 0.820 0.012 0.976 0.000 0.000 0.012 0.000
#> GSM258595 2 0.3198 0.671 0.000 0.740 0.260 0.000 0.000 0.000
#> GSM258597 4 0.0520 0.909 0.000 0.000 0.008 0.984 0.008 0.000
#> GSM258598 4 0.0000 0.912 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM258600 2 0.1327 0.805 0.000 0.936 0.000 0.000 0.064 0.000
#> GSM258601 3 0.2669 0.670 0.000 0.108 0.864 0.024 0.004 0.000
#> GSM258602 6 0.4772 0.534 0.000 0.000 0.124 0.000 0.208 0.668
#> GSM258604 3 0.4597 0.531 0.000 0.072 0.716 0.192 0.020 0.000
#> GSM258605 3 0.1838 0.681 0.000 0.068 0.916 0.000 0.016 0.000
#> GSM258606 6 0.0622 0.825 0.000 0.000 0.008 0.000 0.012 0.980
#> GSM258607 4 0.0146 0.912 0.000 0.004 0.000 0.996 0.000 0.000
#> GSM258608 5 0.2400 0.696 0.000 0.064 0.016 0.000 0.896 0.024
Heatmaps for the consensus matrix. It visualizes the probability of two samples to be in a same group.
consensus_heatmap(res, k = 2)
consensus_heatmap(res, k = 3)
consensus_heatmap(res, k = 4)
consensus_heatmap(res, k = 5)
consensus_heatmap(res, k = 6)
Heatmaps for the membership of samples in all partitions to see how consistent they are:
membership_heatmap(res, k = 2)
membership_heatmap(res, k = 3)
membership_heatmap(res, k = 4)
membership_heatmap(res, k = 5)
membership_heatmap(res, k = 6)
As soon as we have had the classes for columns, we can look for signatures which are significantly different between classes which can be candidate marks for certain classes. Following are the heatmaps for signatures.
Signature heatmaps where rows are scaled:
get_signatures(res, k = 2)
get_signatures(res, k = 3)
get_signatures(res, k = 4)
get_signatures(res, k = 5)
get_signatures(res, k = 6)
Signature heatmaps where rows are not scaled:
get_signatures(res, k = 2, scale_rows = FALSE)
get_signatures(res, k = 3, scale_rows = FALSE)
get_signatures(res, k = 4, scale_rows = FALSE)
get_signatures(res, k = 5, scale_rows = FALSE)
get_signatures(res, k = 6, scale_rows = FALSE)
Compare the overlap of signatures from different k:
compare_signatures(res)
get_signature()
returns a data frame invisibly. TO get the list of signatures, the function
call should be assigned to a variable explicitly. In following code, if plot
argument is set
to FALSE
, no heatmap is plotted while only the differential analysis is performed.
# code only for demonstration
tb = get_signature(res, k = ..., plot = FALSE)
An example of the output of tb
is:
#> which_row fdr mean_1 mean_2 scaled_mean_1 scaled_mean_2 km
#> 1 38 0.042760348 8.373488 9.131774 -0.5533452 0.5164555 1
#> 2 40 0.018707592 7.106213 8.469186 -0.6173731 0.5762149 1
#> 3 55 0.019134737 10.221463 11.207825 -0.6159697 0.5749050 1
#> 4 59 0.006059896 5.921854 7.869574 -0.6899429 0.6439467 1
#> 5 60 0.018055526 8.928898 10.211722 -0.6204761 0.5791110 1
#> 6 98 0.009384629 15.714769 14.887706 0.6635654 -0.6193277 2
...
The columns in tb
are:
which_row
: row indices corresponding to the input matrix.fdr
: FDR for the differential test. mean_x
: The mean value in group x.scaled_mean_x
: The mean value in group x after rows are scaled.km
: Row groups if k-means clustering is applied to rows.UMAP plot which shows how samples are separated.
dimension_reduction(res, k = 2, method = "UMAP")
dimension_reduction(res, k = 3, method = "UMAP")
dimension_reduction(res, k = 4, method = "UMAP")
dimension_reduction(res, k = 5, method = "UMAP")
dimension_reduction(res, k = 6, method = "UMAP")
Following heatmap shows how subgroups are split when increasing k
:
collect_classes(res)
Test correlation between subgroups and known annotations. If the known annotation is numeric, one-way ANOVA test is applied, and if the known annotation is discrete, chi-squared contingency table test is applied.
test_to_known_factors(res)
#> n disease.state(p) k
#> SD:NMF 56 1.38e-08 2
#> SD:NMF 55 8.59e-10 3
#> SD:NMF 56 3.40e-09 4
#> SD:NMF 55 7.94e-08 5
#> SD:NMF 54 4.27e-07 6
If matrix rows can be associated to genes, consider to use functional_enrichment(res,
...)
to perform function enrichment for the signature genes. See this vignette for more detailed explanations.
The object with results only for a single top-value method and a single partition method can be extracted as:
res = res_list["CV", "hclust"]
# you can also extract it by
# res = res_list["CV:hclust"]
A summary of res
and all the functions that can be applied to it:
res
#> A 'ConsensusPartition' object with k = 2, 3, 4, 5, 6.
#> On a matrix with 51941 rows and 58 columns.
#> Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'CV' method.
#> Subgroups are detected by 'hclust' method.
#> Performed in total 1250 partitions by row resampling.
#> Best k for subgroups seems to be 2.
#>
#> Following methods can be applied to this 'ConsensusPartition' object:
#> [1] "cola_report" "collect_classes" "collect_plots"
#> [4] "collect_stats" "colnames" "compare_signatures"
#> [7] "consensus_heatmap" "dimension_reduction" "functional_enrichment"
#> [10] "get_anno_col" "get_anno" "get_classes"
#> [13] "get_consensus" "get_matrix" "get_membership"
#> [16] "get_param" "get_signatures" "get_stats"
#> [19] "is_best_k" "is_stable_k" "membership_heatmap"
#> [22] "ncol" "nrow" "plot_ecdf"
#> [25] "rownames" "select_partition_number" "show"
#> [28] "suggest_best_k" "test_to_known_factors"
collect_plots()
function collects all the plots made from res
for all k
(number of partitions)
into one single page to provide an easy and fast comparison between different k
.
collect_plots(res)
The plots are:
k
and the heatmap of
predicted classes for each k
.k
.k
.k
.All the plots in panels can be made by individual functions and they are plotted later in this section.
select_partition_number()
produces several plots showing different
statistics for choosing “optimized” k
. There are following statistics:
k
;k
, the area increased is defined as \(A_k - A_{k-1}\).The detailed explanations of these statistics can be found in the cola vignette.
Generally speaking, lower PAC score, higher mean silhouette score or higher
concordance corresponds to better partition. Rand index and Jaccard index
measure how similar the current partition is compared to partition with k-1
.
If they are too similar, we won't accept k
is better than k-1
.
select_partition_number(res)
The numeric values for all these statistics can be obtained by get_stats()
.
get_stats(res)
#> k 1-PAC mean_silhouette concordance area_increased Rand Jaccard
#> 2 2 0.428 0.683 0.868 0.4618 0.501 0.501
#> 3 3 0.385 0.653 0.779 0.3556 0.676 0.438
#> 4 4 0.523 0.594 0.773 0.1471 0.838 0.571
#> 5 5 0.601 0.520 0.713 0.0749 0.915 0.691
#> 6 6 0.685 0.505 0.724 0.0548 0.924 0.672
suggest_best_k()
suggests the best \(k\) based on these statistics. The rules are as follows:
suggest_best_k(res)
#> [1] 2
Following shows the table of the partitions (You need to click the show/hide
code output link to see it). The membership matrix (columns with name p*
)
is inferred by
clue::cl_consensus()
function with the SE
method. Basically the value in the membership matrix
represents the probability to belong to a certain group. The finall class
label for an item is determined with the group with highest probability it
belongs to.
In get_classes()
function, the entropy is calculated from the membership
matrix and the silhouette score is calculated from the consensus matrix.
cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#> class entropy silhouette p1 p2
#> GSM258553 1 0.0000 0.8115 1.000 0.000
#> GSM258555 1 0.0000 0.8115 1.000 0.000
#> GSM258556 2 0.0376 0.8317 0.004 0.996
#> GSM258557 1 0.0000 0.8115 1.000 0.000
#> GSM258562 1 0.9552 0.4241 0.624 0.376
#> GSM258563 1 0.0000 0.8115 1.000 0.000
#> GSM258565 1 0.0000 0.8115 1.000 0.000
#> GSM258566 1 0.0000 0.8115 1.000 0.000
#> GSM258570 1 0.0000 0.8115 1.000 0.000
#> GSM258578 1 0.0000 0.8115 1.000 0.000
#> GSM258580 1 0.9552 0.4241 0.624 0.376
#> GSM258583 1 0.0000 0.8115 1.000 0.000
#> GSM258585 1 0.0938 0.8069 0.988 0.012
#> GSM258590 1 0.0000 0.8115 1.000 0.000
#> GSM258594 1 0.0000 0.8115 1.000 0.000
#> GSM258596 1 0.0376 0.8103 0.996 0.004
#> GSM258599 1 0.0000 0.8115 1.000 0.000
#> GSM258603 1 0.0000 0.8115 1.000 0.000
#> GSM258551 2 0.0938 0.8313 0.012 0.988
#> GSM258552 2 0.9522 0.4005 0.372 0.628
#> GSM258554 2 0.0672 0.8318 0.008 0.992
#> GSM258558 2 0.0672 0.8318 0.008 0.992
#> GSM258559 2 0.5178 0.7907 0.116 0.884
#> GSM258560 2 0.8555 0.6129 0.280 0.720
#> GSM258561 2 0.3274 0.8162 0.060 0.940
#> GSM258564 2 0.0376 0.8317 0.004 0.996
#> GSM258567 2 0.9522 0.4255 0.372 0.628
#> GSM258568 2 0.0000 0.8302 0.000 1.000
#> GSM258569 1 0.9491 0.4434 0.632 0.368
#> GSM258571 1 0.9170 0.5191 0.668 0.332
#> GSM258572 2 0.9954 0.1427 0.460 0.540
#> GSM258573 2 0.0000 0.8302 0.000 1.000
#> GSM258574 2 0.7299 0.7101 0.204 0.796
#> GSM258575 2 0.0376 0.8317 0.004 0.996
#> GSM258576 2 0.0000 0.8302 0.000 1.000
#> GSM258577 2 0.6531 0.7476 0.168 0.832
#> GSM258579 2 0.0376 0.8317 0.004 0.996
#> GSM258581 2 0.0000 0.8302 0.000 1.000
#> GSM258582 1 0.9170 0.5191 0.668 0.332
#> GSM258584 2 0.7299 0.7113 0.204 0.796
#> GSM258586 2 0.0376 0.8317 0.004 0.996
#> GSM258587 2 0.0000 0.8302 0.000 1.000
#> GSM258588 2 0.8499 0.6085 0.276 0.724
#> GSM258589 2 0.9993 0.0456 0.484 0.516
#> GSM258591 2 0.0938 0.8314 0.012 0.988
#> GSM258592 2 0.9977 0.1059 0.472 0.528
#> GSM258593 1 0.3114 0.7826 0.944 0.056
#> GSM258595 1 0.9954 0.1387 0.540 0.460
#> GSM258597 2 0.0000 0.8302 0.000 1.000
#> GSM258598 2 0.0000 0.8302 0.000 1.000
#> GSM258600 2 0.9993 0.0456 0.484 0.516
#> GSM258601 1 0.9358 0.4826 0.648 0.352
#> GSM258602 2 0.5059 0.7923 0.112 0.888
#> GSM258604 1 0.9170 0.5191 0.668 0.332
#> GSM258605 1 0.9170 0.5191 0.668 0.332
#> GSM258606 2 0.4562 0.8007 0.096 0.904
#> GSM258607 2 0.0376 0.8317 0.004 0.996
#> GSM258608 2 0.4690 0.7952 0.100 0.900
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> GSM258553 1 0.000 0.8951 1.000 0.000 0.000
#> GSM258555 1 0.000 0.8951 1.000 0.000 0.000
#> GSM258556 2 0.236 0.7130 0.000 0.928 0.072
#> GSM258557 1 0.394 0.8525 0.844 0.000 0.156
#> GSM258562 3 0.512 0.6490 0.200 0.012 0.788
#> GSM258563 1 0.394 0.8525 0.844 0.000 0.156
#> GSM258565 1 0.000 0.8951 1.000 0.000 0.000
#> GSM258566 1 0.000 0.8951 1.000 0.000 0.000
#> GSM258570 1 0.000 0.8951 1.000 0.000 0.000
#> GSM258578 1 0.000 0.8951 1.000 0.000 0.000
#> GSM258580 3 0.512 0.6490 0.200 0.012 0.788
#> GSM258583 1 0.394 0.8525 0.844 0.000 0.156
#> GSM258585 1 0.412 0.8390 0.832 0.000 0.168
#> GSM258590 1 0.000 0.8951 1.000 0.000 0.000
#> GSM258594 1 0.000 0.8951 1.000 0.000 0.000
#> GSM258596 1 0.400 0.8487 0.840 0.000 0.160
#> GSM258599 1 0.394 0.8525 0.844 0.000 0.156
#> GSM258603 1 0.000 0.8951 1.000 0.000 0.000
#> GSM258551 2 0.536 0.7518 0.000 0.724 0.276
#> GSM258552 3 0.657 0.5806 0.088 0.160 0.752
#> GSM258554 2 0.603 0.7539 0.000 0.624 0.376
#> GSM258558 2 0.611 0.7298 0.000 0.604 0.396
#> GSM258559 3 0.623 -0.3704 0.000 0.436 0.564
#> GSM258560 3 0.394 0.4947 0.000 0.156 0.844
#> GSM258561 2 0.588 0.7156 0.000 0.652 0.348
#> GSM258564 2 0.236 0.7130 0.000 0.928 0.072
#> GSM258567 3 0.372 0.6022 0.024 0.088 0.888
#> GSM258568 2 0.536 0.7917 0.000 0.724 0.276
#> GSM258569 3 0.501 0.6416 0.204 0.008 0.788
#> GSM258571 3 0.493 0.5967 0.232 0.000 0.768
#> GSM258572 3 0.542 0.6670 0.100 0.080 0.820
#> GSM258573 2 0.475 0.8063 0.000 0.784 0.216
#> GSM258574 3 0.533 0.3524 0.004 0.248 0.748
#> GSM258575 2 0.581 0.7884 0.000 0.664 0.336
#> GSM258576 2 0.514 0.8035 0.000 0.748 0.252
#> GSM258577 3 0.536 0.2662 0.000 0.276 0.724
#> GSM258579 2 0.581 0.7884 0.000 0.664 0.336
#> GSM258581 2 0.514 0.8035 0.000 0.748 0.252
#> GSM258582 3 0.493 0.5967 0.232 0.000 0.768
#> GSM258584 3 0.502 0.3555 0.000 0.240 0.760
#> GSM258586 2 0.355 0.7176 0.000 0.868 0.132
#> GSM258587 2 0.475 0.8063 0.000 0.784 0.216
#> GSM258588 3 0.688 -0.0253 0.024 0.360 0.616
#> GSM258589 3 0.521 0.6769 0.108 0.064 0.828
#> GSM258591 2 0.590 0.7780 0.000 0.648 0.352
#> GSM258592 3 0.489 0.6604 0.096 0.060 0.844
#> GSM258593 1 0.619 0.3888 0.580 0.000 0.420
#> GSM258595 3 0.480 0.6847 0.132 0.032 0.836
#> GSM258597 2 0.475 0.8063 0.000 0.784 0.216
#> GSM258598 2 0.000 0.6802 0.000 1.000 0.000
#> GSM258600 3 0.521 0.6769 0.108 0.064 0.828
#> GSM258601 3 0.498 0.6215 0.216 0.004 0.780
#> GSM258602 3 0.630 -0.4993 0.000 0.484 0.516
#> GSM258604 3 0.493 0.5967 0.232 0.000 0.768
#> GSM258605 3 0.493 0.5967 0.232 0.000 0.768
#> GSM258606 2 0.625 0.6371 0.000 0.556 0.444
#> GSM258607 2 0.236 0.7130 0.000 0.928 0.072
#> GSM258608 3 0.597 -0.0543 0.000 0.364 0.636
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> GSM258553 1 0.000 0.8720 1.000 0.000 0.000 0.000
#> GSM258555 1 0.000 0.8720 1.000 0.000 0.000 0.000
#> GSM258556 4 0.130 0.7266 0.000 0.044 0.000 0.956
#> GSM258557 1 0.482 0.7912 0.740 0.016 0.236 0.008
#> GSM258562 3 0.240 0.7297 0.000 0.076 0.912 0.012
#> GSM258563 1 0.482 0.7912 0.740 0.016 0.236 0.008
#> GSM258565 1 0.000 0.8720 1.000 0.000 0.000 0.000
#> GSM258566 1 0.000 0.8720 1.000 0.000 0.000 0.000
#> GSM258570 1 0.000 0.8720 1.000 0.000 0.000 0.000
#> GSM258578 1 0.000 0.8720 1.000 0.000 0.000 0.000
#> GSM258580 3 0.240 0.7297 0.000 0.076 0.912 0.012
#> GSM258583 1 0.482 0.7912 0.740 0.016 0.236 0.008
#> GSM258585 1 0.506 0.7775 0.728 0.024 0.240 0.008
#> GSM258590 1 0.000 0.8720 1.000 0.000 0.000 0.000
#> GSM258594 1 0.000 0.8720 1.000 0.000 0.000 0.000
#> GSM258596 1 0.485 0.7869 0.736 0.016 0.240 0.008
#> GSM258599 1 0.482 0.7912 0.740 0.016 0.236 0.008
#> GSM258603 1 0.000 0.8720 1.000 0.000 0.000 0.000
#> GSM258551 4 0.573 0.2105 0.000 0.344 0.040 0.616
#> GSM258552 3 0.642 0.5480 0.000 0.156 0.648 0.196
#> GSM258554 2 0.496 0.5274 0.000 0.684 0.016 0.300
#> GSM258558 2 0.480 0.5705 0.000 0.744 0.032 0.224
#> GSM258559 2 0.640 0.5024 0.000 0.652 0.172 0.176
#> GSM258560 3 0.690 0.3133 0.000 0.380 0.508 0.112
#> GSM258561 4 0.655 -0.0506 0.000 0.400 0.080 0.520
#> GSM258564 4 0.130 0.7266 0.000 0.044 0.000 0.956
#> GSM258567 3 0.626 0.5133 0.000 0.312 0.608 0.080
#> GSM258568 2 0.147 0.5516 0.000 0.948 0.000 0.052
#> GSM258569 3 0.225 0.7286 0.000 0.068 0.920 0.012
#> GSM258571 3 0.130 0.7053 0.000 0.016 0.964 0.020
#> GSM258572 3 0.529 0.6729 0.000 0.168 0.744 0.088
#> GSM258573 2 0.413 0.3561 0.000 0.740 0.000 0.260
#> GSM258574 3 0.755 0.1690 0.000 0.344 0.456 0.200
#> GSM258575 2 0.416 0.5606 0.000 0.736 0.000 0.264
#> GSM258576 2 0.194 0.5432 0.000 0.924 0.000 0.076
#> GSM258577 2 0.758 -0.0815 0.000 0.420 0.384 0.196
#> GSM258579 2 0.416 0.5606 0.000 0.736 0.000 0.264
#> GSM258581 2 0.194 0.5432 0.000 0.924 0.000 0.076
#> GSM258582 3 0.130 0.7053 0.000 0.016 0.964 0.020
#> GSM258584 3 0.757 0.0743 0.000 0.396 0.412 0.192
#> GSM258586 4 0.312 0.6766 0.000 0.092 0.028 0.880
#> GSM258587 2 0.413 0.3561 0.000 0.740 0.000 0.260
#> GSM258588 2 0.619 0.4018 0.000 0.640 0.268 0.092
#> GSM258589 3 0.499 0.6914 0.000 0.152 0.768 0.080
#> GSM258591 2 0.541 0.4369 0.000 0.604 0.020 0.376
#> GSM258592 3 0.480 0.6201 0.000 0.276 0.708 0.016
#> GSM258593 3 0.516 0.0302 0.364 0.000 0.624 0.012
#> GSM258595 3 0.419 0.7158 0.000 0.112 0.824 0.064
#> GSM258597 2 0.413 0.3561 0.000 0.740 0.000 0.260
#> GSM258598 4 0.404 0.5374 0.000 0.248 0.000 0.752
#> GSM258600 3 0.499 0.6914 0.000 0.152 0.768 0.080
#> GSM258601 3 0.266 0.7170 0.000 0.056 0.908 0.036
#> GSM258602 2 0.537 0.5513 0.000 0.740 0.164 0.096
#> GSM258604 3 0.183 0.7032 0.000 0.024 0.944 0.032
#> GSM258605 3 0.183 0.7032 0.000 0.024 0.944 0.032
#> GSM258606 2 0.415 0.5888 0.000 0.828 0.072 0.100
#> GSM258607 4 0.130 0.7266 0.000 0.044 0.000 0.956
#> GSM258608 2 0.766 0.2085 0.000 0.452 0.316 0.232
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> GSM258553 1 0.0000 0.8283 1.000 0.000 0.000 0.000 0.000
#> GSM258555 1 0.0000 0.8283 1.000 0.000 0.000 0.000 0.000
#> GSM258556 4 0.0000 0.7081 0.000 0.000 0.000 1.000 0.000
#> GSM258557 1 0.4787 0.7090 0.608 0.000 0.364 0.000 0.028
#> GSM258562 5 0.1281 0.4483 0.000 0.032 0.012 0.000 0.956
#> GSM258563 1 0.4787 0.7090 0.608 0.000 0.364 0.000 0.028
#> GSM258565 1 0.0000 0.8283 1.000 0.000 0.000 0.000 0.000
#> GSM258566 1 0.0000 0.8283 1.000 0.000 0.000 0.000 0.000
#> GSM258570 1 0.0000 0.8283 1.000 0.000 0.000 0.000 0.000
#> GSM258578 1 0.0000 0.8283 1.000 0.000 0.000 0.000 0.000
#> GSM258580 5 0.1281 0.4483 0.000 0.032 0.012 0.000 0.956
#> GSM258583 1 0.4787 0.7090 0.608 0.000 0.364 0.000 0.028
#> GSM258585 1 0.5002 0.6962 0.596 0.000 0.364 0.000 0.040
#> GSM258590 1 0.0000 0.8283 1.000 0.000 0.000 0.000 0.000
#> GSM258594 1 0.0000 0.8283 1.000 0.000 0.000 0.000 0.000
#> GSM258596 1 0.4849 0.7067 0.608 0.000 0.360 0.000 0.032
#> GSM258599 1 0.4787 0.7090 0.608 0.000 0.364 0.000 0.028
#> GSM258603 1 0.0000 0.8283 1.000 0.000 0.000 0.000 0.000
#> GSM258551 4 0.6997 0.1279 0.000 0.284 0.156 0.516 0.044
#> GSM258552 5 0.5421 0.3681 0.000 0.092 0.028 0.176 0.704
#> GSM258554 2 0.6625 0.5320 0.000 0.560 0.192 0.224 0.024
#> GSM258558 2 0.6679 0.5455 0.000 0.600 0.148 0.192 0.060
#> GSM258559 2 0.7721 0.4254 0.000 0.460 0.280 0.144 0.116
#> GSM258560 3 0.7576 0.0955 0.000 0.152 0.424 0.080 0.344
#> GSM258561 4 0.6755 -0.0455 0.000 0.368 0.176 0.444 0.012
#> GSM258564 4 0.0000 0.7081 0.000 0.000 0.000 1.000 0.000
#> GSM258567 3 0.6757 0.2054 0.000 0.084 0.488 0.056 0.372
#> GSM258568 2 0.2011 0.6157 0.000 0.908 0.088 0.000 0.004
#> GSM258569 5 0.0992 0.4395 0.000 0.024 0.008 0.000 0.968
#> GSM258571 3 0.4273 0.5160 0.000 0.000 0.552 0.000 0.448
#> GSM258572 5 0.4433 0.5001 0.000 0.084 0.044 0.072 0.800
#> GSM258573 2 0.3780 0.4717 0.000 0.808 0.060 0.132 0.000
#> GSM258574 5 0.7881 0.1689 0.000 0.152 0.200 0.176 0.472
#> GSM258575 2 0.4305 0.6027 0.000 0.760 0.040 0.192 0.008
#> GSM258576 2 0.0671 0.6037 0.000 0.980 0.016 0.000 0.004
#> GSM258577 5 0.8321 -0.0502 0.000 0.188 0.300 0.164 0.348
#> GSM258579 2 0.4512 0.6025 0.000 0.752 0.040 0.192 0.016
#> GSM258581 2 0.0671 0.6037 0.000 0.980 0.016 0.000 0.004
#> GSM258582 3 0.4273 0.5160 0.000 0.000 0.552 0.000 0.448
#> GSM258584 3 0.8238 -0.0727 0.000 0.168 0.336 0.160 0.336
#> GSM258586 4 0.3654 0.6473 0.000 0.036 0.108 0.836 0.020
#> GSM258587 2 0.3780 0.4717 0.000 0.808 0.060 0.132 0.000
#> GSM258588 2 0.6241 0.3836 0.000 0.492 0.412 0.056 0.040
#> GSM258589 5 0.4074 0.5115 0.000 0.068 0.044 0.064 0.824
#> GSM258591 2 0.5946 0.4729 0.000 0.604 0.112 0.272 0.012
#> GSM258592 3 0.5107 0.3453 0.000 0.048 0.596 0.000 0.356
#> GSM258593 5 0.5993 0.0592 0.232 0.000 0.184 0.000 0.584
#> GSM258595 5 0.3154 0.4960 0.000 0.048 0.028 0.048 0.876
#> GSM258597 2 0.3780 0.4717 0.000 0.808 0.060 0.132 0.000
#> GSM258598 4 0.3480 0.5049 0.000 0.248 0.000 0.752 0.000
#> GSM258600 5 0.4074 0.5115 0.000 0.068 0.044 0.064 0.824
#> GSM258601 3 0.4670 0.5225 0.000 0.008 0.548 0.004 0.440
#> GSM258602 2 0.6702 0.5360 0.000 0.592 0.228 0.076 0.104
#> GSM258604 3 0.4192 0.5373 0.000 0.000 0.596 0.000 0.404
#> GSM258605 3 0.4192 0.5373 0.000 0.000 0.596 0.000 0.404
#> GSM258606 2 0.5147 0.6098 0.000 0.708 0.200 0.076 0.016
#> GSM258607 4 0.0000 0.7081 0.000 0.000 0.000 1.000 0.000
#> GSM258608 5 0.8492 0.0382 0.000 0.276 0.220 0.188 0.316
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> GSM258553 1 0.0000 0.7560 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM258555 1 0.0000 0.7560 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM258556 4 0.0000 0.7684 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM258557 1 0.6324 0.5392 0.464 0.324 0.184 0.000 0.028 0.000
#> GSM258562 2 0.4300 0.7003 0.000 0.608 0.028 0.000 0.364 0.000
#> GSM258563 1 0.6324 0.5392 0.464 0.324 0.184 0.000 0.028 0.000
#> GSM258565 1 0.0000 0.7560 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM258566 1 0.0000 0.7560 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM258570 1 0.0000 0.7560 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM258578 1 0.0000 0.7560 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM258580 2 0.4300 0.7003 0.000 0.608 0.028 0.000 0.364 0.000
#> GSM258583 1 0.6324 0.5392 0.464 0.324 0.184 0.000 0.028 0.000
#> GSM258585 1 0.6474 0.5332 0.464 0.312 0.184 0.000 0.040 0.000
#> GSM258590 1 0.0000 0.7560 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM258594 1 0.0000 0.7560 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM258596 1 0.6377 0.5379 0.464 0.320 0.184 0.000 0.032 0.000
#> GSM258599 1 0.6324 0.5392 0.464 0.324 0.184 0.000 0.028 0.000
#> GSM258603 1 0.0000 0.7560 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM258551 5 0.7574 -0.2499 0.000 0.068 0.032 0.292 0.380 0.228
#> GSM258552 5 0.4830 -0.1222 0.000 0.336 0.032 0.004 0.612 0.016
#> GSM258554 6 0.5593 0.5214 0.000 0.056 0.024 0.008 0.416 0.496
#> GSM258558 6 0.3993 0.4375 0.000 0.000 0.000 0.004 0.476 0.520
#> GSM258559 5 0.4686 -0.1740 0.000 0.004 0.044 0.000 0.588 0.364
#> GSM258560 5 0.3631 0.4496 0.000 0.000 0.156 0.008 0.792 0.044
#> GSM258561 4 0.7755 -0.0997 0.000 0.068 0.084 0.364 0.128 0.356
#> GSM258564 4 0.0000 0.7684 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM258567 5 0.3420 0.3819 0.000 0.012 0.240 0.000 0.748 0.000
#> GSM258568 6 0.2146 0.6384 0.000 0.004 0.000 0.000 0.116 0.880
#> GSM258569 2 0.4356 0.6956 0.000 0.608 0.032 0.000 0.360 0.000
#> GSM258571 3 0.1745 0.9040 0.000 0.020 0.924 0.000 0.056 0.000
#> GSM258572 5 0.4714 -0.4416 0.000 0.460 0.008 0.008 0.508 0.016
#> GSM258573 6 0.3748 0.5173 0.000 0.068 0.028 0.092 0.000 0.812
#> GSM258574 5 0.3491 0.3805 0.000 0.124 0.012 0.004 0.820 0.040
#> GSM258575 6 0.3508 0.6174 0.000 0.000 0.000 0.004 0.292 0.704
#> GSM258576 6 0.0777 0.6270 0.000 0.004 0.000 0.000 0.024 0.972
#> GSM258577 5 0.2237 0.4796 0.000 0.000 0.036 0.000 0.896 0.068
#> GSM258579 6 0.3547 0.6119 0.000 0.000 0.000 0.004 0.300 0.696
#> GSM258581 6 0.0777 0.6270 0.000 0.004 0.000 0.000 0.024 0.972
#> GSM258582 3 0.1745 0.9040 0.000 0.020 0.924 0.000 0.056 0.000
#> GSM258584 5 0.2685 0.4825 0.000 0.000 0.072 0.000 0.868 0.060
#> GSM258586 4 0.4318 0.6922 0.000 0.068 0.028 0.796 0.072 0.036
#> GSM258587 6 0.3748 0.5173 0.000 0.068 0.028 0.092 0.000 0.812
#> GSM258588 6 0.6155 0.3164 0.000 0.012 0.196 0.000 0.360 0.432
#> GSM258589 5 0.4452 -0.4946 0.000 0.472 0.008 0.008 0.508 0.004
#> GSM258591 6 0.6127 0.5640 0.000 0.060 0.024 0.056 0.288 0.572
#> GSM258592 5 0.3634 0.2475 0.000 0.000 0.356 0.000 0.644 0.000
#> GSM258593 2 0.2113 0.2933 0.092 0.896 0.008 0.000 0.004 0.000
#> GSM258595 2 0.4690 0.5117 0.000 0.512 0.028 0.008 0.452 0.000
#> GSM258597 6 0.3748 0.5173 0.000 0.068 0.028 0.092 0.000 0.812
#> GSM258598 4 0.3126 0.6233 0.000 0.000 0.000 0.752 0.000 0.248
#> GSM258600 5 0.4452 -0.4946 0.000 0.472 0.008 0.008 0.508 0.004
#> GSM258601 3 0.2558 0.8507 0.000 0.000 0.840 0.004 0.156 0.000
#> GSM258602 6 0.5071 0.3738 0.000 0.004 0.068 0.000 0.400 0.528
#> GSM258604 3 0.1644 0.9168 0.000 0.004 0.920 0.000 0.076 0.000
#> GSM258605 3 0.1644 0.9168 0.000 0.004 0.920 0.000 0.076 0.000
#> GSM258606 6 0.4632 0.5755 0.000 0.004 0.064 0.000 0.276 0.656
#> GSM258607 4 0.0000 0.7684 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM258608 5 0.3109 0.4211 0.000 0.000 0.016 0.004 0.812 0.168
Heatmaps for the consensus matrix. It visualizes the probability of two samples to be in a same group.
consensus_heatmap(res, k = 2)
consensus_heatmap(res, k = 3)
consensus_heatmap(res, k = 4)
consensus_heatmap(res, k = 5)
consensus_heatmap(res, k = 6)
Heatmaps for the membership of samples in all partitions to see how consistent they are:
membership_heatmap(res, k = 2)
membership_heatmap(res, k = 3)
membership_heatmap(res, k = 4)
membership_heatmap(res, k = 5)
membership_heatmap(res, k = 6)
As soon as we have had the classes for columns, we can look for signatures which are significantly different between classes which can be candidate marks for certain classes. Following are the heatmaps for signatures.
Signature heatmaps where rows are scaled:
get_signatures(res, k = 2)
get_signatures(res, k = 3)
get_signatures(res, k = 4)
get_signatures(res, k = 5)
get_signatures(res, k = 6)
Signature heatmaps where rows are not scaled:
get_signatures(res, k = 2, scale_rows = FALSE)
get_signatures(res, k = 3, scale_rows = FALSE)
get_signatures(res, k = 4, scale_rows = FALSE)
get_signatures(res, k = 5, scale_rows = FALSE)
get_signatures(res, k = 6, scale_rows = FALSE)
Compare the overlap of signatures from different k:
compare_signatures(res)
get_signature()
returns a data frame invisibly. TO get the list of signatures, the function
call should be assigned to a variable explicitly. In following code, if plot
argument is set
to FALSE
, no heatmap is plotted while only the differential analysis is performed.
# code only for demonstration
tb = get_signature(res, k = ..., plot = FALSE)
An example of the output of tb
is:
#> which_row fdr mean_1 mean_2 scaled_mean_1 scaled_mean_2 km
#> 1 38 0.042760348 8.373488 9.131774 -0.5533452 0.5164555 1
#> 2 40 0.018707592 7.106213 8.469186 -0.6173731 0.5762149 1
#> 3 55 0.019134737 10.221463 11.207825 -0.6159697 0.5749050 1
#> 4 59 0.006059896 5.921854 7.869574 -0.6899429 0.6439467 1
#> 5 60 0.018055526 8.928898 10.211722 -0.6204761 0.5791110 1
#> 6 98 0.009384629 15.714769 14.887706 0.6635654 -0.6193277 2
...
The columns in tb
are:
which_row
: row indices corresponding to the input matrix.fdr
: FDR for the differential test. mean_x
: The mean value in group x.scaled_mean_x
: The mean value in group x after rows are scaled.km
: Row groups if k-means clustering is applied to rows.UMAP plot which shows how samples are separated.
dimension_reduction(res, k = 2, method = "UMAP")
dimension_reduction(res, k = 3, method = "UMAP")
dimension_reduction(res, k = 4, method = "UMAP")
dimension_reduction(res, k = 5, method = "UMAP")
dimension_reduction(res, k = 6, method = "UMAP")
Following heatmap shows how subgroups are split when increasing k
:
collect_classes(res)
Test correlation between subgroups and known annotations. If the known annotation is numeric, one-way ANOVA test is applied, and if the known annotation is discrete, chi-squared contingency table test is applied.
test_to_known_factors(res)
#> n disease.state(p) k
#> CV:hclust 47 1.68e-06 2
#> CV:hclust 49 7.32e-09 3
#> CV:hclust 45 1.60e-07 4
#> CV:hclust 37 8.42e-07 5
#> CV:hclust 40 1.36e-06 6
If matrix rows can be associated to genes, consider to use functional_enrichment(res,
...)
to perform function enrichment for the signature genes. See this vignette for more detailed explanations.
The object with results only for a single top-value method and a single partition method can be extracted as:
res = res_list["CV", "kmeans"]
# you can also extract it by
# res = res_list["CV:kmeans"]
A summary of res
and all the functions that can be applied to it:
res
#> A 'ConsensusPartition' object with k = 2, 3, 4, 5, 6.
#> On a matrix with 51941 rows and 58 columns.
#> Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'CV' method.
#> Subgroups are detected by 'kmeans' method.
#> Performed in total 1250 partitions by row resampling.
#> Best k for subgroups seems to be 2.
#>
#> Following methods can be applied to this 'ConsensusPartition' object:
#> [1] "cola_report" "collect_classes" "collect_plots"
#> [4] "collect_stats" "colnames" "compare_signatures"
#> [7] "consensus_heatmap" "dimension_reduction" "functional_enrichment"
#> [10] "get_anno_col" "get_anno" "get_classes"
#> [13] "get_consensus" "get_matrix" "get_membership"
#> [16] "get_param" "get_signatures" "get_stats"
#> [19] "is_best_k" "is_stable_k" "membership_heatmap"
#> [22] "ncol" "nrow" "plot_ecdf"
#> [25] "rownames" "select_partition_number" "show"
#> [28] "suggest_best_k" "test_to_known_factors"
collect_plots()
function collects all the plots made from res
for all k
(number of partitions)
into one single page to provide an easy and fast comparison between different k
.
collect_plots(res)
The plots are:
k
and the heatmap of
predicted classes for each k
.k
.k
.k
.All the plots in panels can be made by individual functions and they are plotted later in this section.
select_partition_number()
produces several plots showing different
statistics for choosing “optimized” k
. There are following statistics:
k
;k
, the area increased is defined as \(A_k - A_{k-1}\).The detailed explanations of these statistics can be found in the cola vignette.
Generally speaking, lower PAC score, higher mean silhouette score or higher
concordance corresponds to better partition. Rand index and Jaccard index
measure how similar the current partition is compared to partition with k-1
.
If they are too similar, we won't accept k
is better than k-1
.
select_partition_number(res)
The numeric values for all these statistics can be obtained by get_stats()
.
get_stats(res)
#> k 1-PAC mean_silhouette concordance area_increased Rand Jaccard
#> 2 2 1.000 0.975 0.989 0.4046 0.593 0.593
#> 3 3 0.703 0.869 0.922 0.5974 0.672 0.484
#> 4 4 0.674 0.657 0.799 0.1400 0.920 0.780
#> 5 5 0.684 0.606 0.761 0.0677 0.878 0.610
#> 6 6 0.721 0.621 0.738 0.0468 0.959 0.809
suggest_best_k()
suggests the best \(k\) based on these statistics. The rules are as follows:
suggest_best_k(res)
#> [1] 2
Following shows the table of the partitions (You need to click the show/hide
code output link to see it). The membership matrix (columns with name p*
)
is inferred by
clue::cl_consensus()
function with the SE
method. Basically the value in the membership matrix
represents the probability to belong to a certain group. The finall class
label for an item is determined with the group with highest probability it
belongs to.
In get_classes()
function, the entropy is calculated from the membership
matrix and the silhouette score is calculated from the consensus matrix.
cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#> class entropy silhouette p1 p2
#> GSM258553 1 0.0000 0.975 1.000 0.000
#> GSM258555 1 0.0000 0.975 1.000 0.000
#> GSM258556 2 0.0000 0.993 0.000 1.000
#> GSM258557 1 0.0672 0.969 0.992 0.008
#> GSM258562 2 0.4022 0.917 0.080 0.920
#> GSM258563 1 0.0000 0.975 1.000 0.000
#> GSM258565 1 0.0000 0.975 1.000 0.000
#> GSM258566 1 0.0000 0.975 1.000 0.000
#> GSM258570 1 0.0000 0.975 1.000 0.000
#> GSM258578 1 0.0000 0.975 1.000 0.000
#> GSM258580 2 0.0000 0.993 0.000 1.000
#> GSM258583 1 0.0000 0.975 1.000 0.000
#> GSM258585 1 0.9358 0.448 0.648 0.352
#> GSM258590 1 0.0000 0.975 1.000 0.000
#> GSM258594 1 0.0000 0.975 1.000 0.000
#> GSM258596 1 0.0000 0.975 1.000 0.000
#> GSM258599 1 0.0000 0.975 1.000 0.000
#> GSM258603 1 0.0000 0.975 1.000 0.000
#> GSM258551 2 0.0000 0.993 0.000 1.000
#> GSM258552 2 0.0000 0.993 0.000 1.000
#> GSM258554 2 0.0000 0.993 0.000 1.000
#> GSM258558 2 0.0000 0.993 0.000 1.000
#> GSM258559 2 0.0000 0.993 0.000 1.000
#> GSM258560 2 0.0000 0.993 0.000 1.000
#> GSM258561 2 0.0000 0.993 0.000 1.000
#> GSM258564 2 0.0000 0.993 0.000 1.000
#> GSM258567 2 0.0000 0.993 0.000 1.000
#> GSM258568 2 0.0000 0.993 0.000 1.000
#> GSM258569 2 0.0000 0.993 0.000 1.000
#> GSM258571 2 0.3274 0.938 0.060 0.940
#> GSM258572 2 0.0000 0.993 0.000 1.000
#> GSM258573 2 0.0000 0.993 0.000 1.000
#> GSM258574 2 0.0000 0.993 0.000 1.000
#> GSM258575 2 0.0000 0.993 0.000 1.000
#> GSM258576 2 0.0000 0.993 0.000 1.000
#> GSM258577 2 0.0000 0.993 0.000 1.000
#> GSM258579 2 0.0000 0.993 0.000 1.000
#> GSM258581 2 0.0000 0.993 0.000 1.000
#> GSM258582 2 0.3274 0.938 0.060 0.940
#> GSM258584 2 0.0000 0.993 0.000 1.000
#> GSM258586 2 0.0000 0.993 0.000 1.000
#> GSM258587 2 0.0000 0.993 0.000 1.000
#> GSM258588 2 0.0000 0.993 0.000 1.000
#> GSM258589 2 0.0000 0.993 0.000 1.000
#> GSM258591 2 0.0000 0.993 0.000 1.000
#> GSM258592 2 0.0000 0.993 0.000 1.000
#> GSM258593 1 0.0672 0.969 0.992 0.008
#> GSM258595 2 0.0000 0.993 0.000 1.000
#> GSM258597 2 0.0000 0.993 0.000 1.000
#> GSM258598 2 0.0000 0.993 0.000 1.000
#> GSM258600 2 0.0000 0.993 0.000 1.000
#> GSM258601 2 0.0000 0.993 0.000 1.000
#> GSM258602 2 0.0000 0.993 0.000 1.000
#> GSM258604 2 0.0000 0.993 0.000 1.000
#> GSM258605 2 0.3274 0.938 0.060 0.940
#> GSM258606 2 0.0000 0.993 0.000 1.000
#> GSM258607 2 0.0000 0.993 0.000 1.000
#> GSM258608 2 0.0000 0.993 0.000 1.000
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> GSM258553 1 0.0000 0.998 1.000 0.000 0.000
#> GSM258555 1 0.0000 0.998 1.000 0.000 0.000
#> GSM258556 3 0.5882 0.571 0.000 0.348 0.652
#> GSM258557 3 0.6102 0.543 0.320 0.008 0.672
#> GSM258562 3 0.0592 0.890 0.012 0.000 0.988
#> GSM258563 1 0.0424 0.995 0.992 0.008 0.000
#> GSM258565 1 0.0000 0.998 1.000 0.000 0.000
#> GSM258566 1 0.0000 0.998 1.000 0.000 0.000
#> GSM258570 1 0.0000 0.998 1.000 0.000 0.000
#> GSM258578 1 0.0000 0.998 1.000 0.000 0.000
#> GSM258580 3 0.0237 0.892 0.000 0.004 0.996
#> GSM258583 1 0.0424 0.995 0.992 0.008 0.000
#> GSM258585 3 0.2173 0.866 0.048 0.008 0.944
#> GSM258590 1 0.0000 0.998 1.000 0.000 0.000
#> GSM258594 1 0.0000 0.998 1.000 0.000 0.000
#> GSM258596 1 0.0424 0.995 0.992 0.008 0.000
#> GSM258599 1 0.0424 0.995 0.992 0.008 0.000
#> GSM258603 1 0.0000 0.998 1.000 0.000 0.000
#> GSM258551 2 0.1163 0.888 0.000 0.972 0.028
#> GSM258552 3 0.0237 0.892 0.000 0.004 0.996
#> GSM258554 2 0.1163 0.888 0.000 0.972 0.028
#> GSM258558 2 0.4346 0.876 0.000 0.816 0.184
#> GSM258559 2 0.4654 0.853 0.000 0.792 0.208
#> GSM258560 3 0.0747 0.889 0.000 0.016 0.984
#> GSM258561 2 0.1163 0.888 0.000 0.972 0.028
#> GSM258564 2 0.0747 0.879 0.000 0.984 0.016
#> GSM258567 3 0.0424 0.891 0.000 0.008 0.992
#> GSM258568 2 0.4346 0.876 0.000 0.816 0.184
#> GSM258569 3 0.0000 0.892 0.000 0.000 1.000
#> GSM258571 3 0.1015 0.890 0.008 0.012 0.980
#> GSM258572 3 0.0237 0.892 0.000 0.004 0.996
#> GSM258573 2 0.0747 0.879 0.000 0.984 0.016
#> GSM258574 3 0.0424 0.891 0.000 0.008 0.992
#> GSM258575 2 0.4399 0.875 0.000 0.812 0.188
#> GSM258576 2 0.4346 0.876 0.000 0.816 0.184
#> GSM258577 3 0.0892 0.886 0.000 0.020 0.980
#> GSM258579 2 0.4399 0.875 0.000 0.812 0.188
#> GSM258581 2 0.4346 0.876 0.000 0.816 0.184
#> GSM258582 3 0.0848 0.890 0.008 0.008 0.984
#> GSM258584 3 0.3686 0.772 0.000 0.140 0.860
#> GSM258586 3 0.5591 0.638 0.000 0.304 0.696
#> GSM258587 2 0.1163 0.885 0.000 0.972 0.028
#> GSM258588 3 0.4931 0.653 0.000 0.232 0.768
#> GSM258589 3 0.0237 0.892 0.000 0.004 0.996
#> GSM258591 2 0.1163 0.888 0.000 0.972 0.028
#> GSM258592 3 0.0424 0.891 0.000 0.008 0.992
#> GSM258593 3 0.5692 0.622 0.268 0.008 0.724
#> GSM258595 3 0.0237 0.892 0.000 0.004 0.996
#> GSM258597 2 0.0747 0.879 0.000 0.984 0.016
#> GSM258598 2 0.0747 0.879 0.000 0.984 0.016
#> GSM258600 3 0.0237 0.892 0.000 0.004 0.996
#> GSM258601 3 0.0424 0.892 0.000 0.008 0.992
#> GSM258602 2 0.4605 0.855 0.000 0.796 0.204
#> GSM258604 3 0.1015 0.890 0.008 0.012 0.980
#> GSM258605 3 0.1015 0.888 0.008 0.012 0.980
#> GSM258606 2 0.4346 0.876 0.000 0.816 0.184
#> GSM258607 3 0.6045 0.516 0.000 0.380 0.620
#> GSM258608 3 0.5835 0.422 0.000 0.340 0.660
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> GSM258553 1 0.0000 0.947 1.000 0.000 0.000 0.000
#> GSM258555 1 0.0000 0.947 1.000 0.000 0.000 0.000
#> GSM258556 4 0.7724 0.651 0.000 0.328 0.240 0.432
#> GSM258557 3 0.6159 0.477 0.132 0.000 0.672 0.196
#> GSM258562 3 0.1716 0.724 0.000 0.000 0.936 0.064
#> GSM258563 1 0.3853 0.865 0.820 0.000 0.020 0.160
#> GSM258565 1 0.0000 0.947 1.000 0.000 0.000 0.000
#> GSM258566 1 0.0000 0.947 1.000 0.000 0.000 0.000
#> GSM258570 1 0.0000 0.947 1.000 0.000 0.000 0.000
#> GSM258578 1 0.0000 0.947 1.000 0.000 0.000 0.000
#> GSM258580 3 0.0921 0.720 0.000 0.000 0.972 0.028
#> GSM258583 1 0.3306 0.878 0.840 0.000 0.004 0.156
#> GSM258585 3 0.4019 0.625 0.012 0.000 0.792 0.196
#> GSM258590 1 0.0000 0.947 1.000 0.000 0.000 0.000
#> GSM258594 1 0.0000 0.947 1.000 0.000 0.000 0.000
#> GSM258596 1 0.3695 0.871 0.828 0.000 0.016 0.156
#> GSM258599 1 0.3695 0.871 0.828 0.000 0.016 0.156
#> GSM258603 1 0.0000 0.947 1.000 0.000 0.000 0.000
#> GSM258551 2 0.2011 0.607 0.000 0.920 0.000 0.080
#> GSM258552 3 0.0927 0.715 0.000 0.008 0.976 0.016
#> GSM258554 2 0.0000 0.659 0.000 1.000 0.000 0.000
#> GSM258558 2 0.4464 0.708 0.000 0.768 0.024 0.208
#> GSM258559 2 0.5985 0.538 0.000 0.596 0.052 0.352
#> GSM258560 3 0.6221 0.475 0.000 0.076 0.608 0.316
#> GSM258561 2 0.1576 0.633 0.000 0.948 0.004 0.048
#> GSM258564 2 0.4431 0.271 0.000 0.696 0.000 0.304
#> GSM258567 3 0.4304 0.649 0.000 0.000 0.716 0.284
#> GSM258568 2 0.4464 0.708 0.000 0.768 0.024 0.208
#> GSM258569 3 0.1474 0.724 0.000 0.000 0.948 0.052
#> GSM258571 3 0.4673 0.658 0.000 0.008 0.700 0.292
#> GSM258572 3 0.1042 0.714 0.000 0.008 0.972 0.020
#> GSM258573 2 0.1637 0.621 0.000 0.940 0.000 0.060
#> GSM258574 3 0.3182 0.650 0.000 0.028 0.876 0.096
#> GSM258575 2 0.4868 0.698 0.000 0.748 0.040 0.212
#> GSM258576 2 0.4464 0.708 0.000 0.768 0.024 0.208
#> GSM258577 3 0.5076 0.606 0.000 0.072 0.756 0.172
#> GSM258579 2 0.4868 0.698 0.000 0.748 0.040 0.212
#> GSM258581 2 0.4464 0.708 0.000 0.768 0.024 0.208
#> GSM258582 3 0.4482 0.665 0.000 0.008 0.728 0.264
#> GSM258584 4 0.7524 -0.195 0.000 0.184 0.408 0.408
#> GSM258586 4 0.7884 0.632 0.000 0.312 0.304 0.384
#> GSM258587 2 0.1389 0.631 0.000 0.952 0.000 0.048
#> GSM258588 3 0.7883 -0.244 0.000 0.316 0.384 0.300
#> GSM258589 3 0.2593 0.684 0.000 0.016 0.904 0.080
#> GSM258591 2 0.0000 0.659 0.000 1.000 0.000 0.000
#> GSM258592 3 0.4477 0.645 0.000 0.000 0.688 0.312
#> GSM258593 3 0.4875 0.582 0.068 0.000 0.772 0.160
#> GSM258595 3 0.1722 0.721 0.000 0.008 0.944 0.048
#> GSM258597 2 0.4382 0.275 0.000 0.704 0.000 0.296
#> GSM258598 2 0.4431 0.271 0.000 0.696 0.000 0.304
#> GSM258600 3 0.1042 0.714 0.000 0.008 0.972 0.020
#> GSM258601 3 0.4539 0.667 0.000 0.008 0.720 0.272
#> GSM258602 2 0.5359 0.633 0.000 0.676 0.036 0.288
#> GSM258604 3 0.4567 0.664 0.000 0.008 0.716 0.276
#> GSM258605 3 0.4769 0.650 0.000 0.008 0.684 0.308
#> GSM258606 2 0.4464 0.708 0.000 0.768 0.024 0.208
#> GSM258607 4 0.7645 0.615 0.000 0.360 0.212 0.428
#> GSM258608 2 0.7744 0.196 0.000 0.440 0.268 0.292
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> GSM258553 1 0.0404 0.8635 0.988 0.000 0.000 0.012 0.000
#> GSM258555 1 0.0609 0.8634 0.980 0.000 0.000 0.020 0.000
#> GSM258556 4 0.4865 0.7312 0.000 0.044 0.040 0.748 0.168
#> GSM258557 5 0.7692 0.1985 0.092 0.000 0.312 0.160 0.436
#> GSM258562 5 0.3115 0.5260 0.000 0.000 0.112 0.036 0.852
#> GSM258563 1 0.6263 0.6601 0.580 0.000 0.248 0.160 0.012
#> GSM258565 1 0.0703 0.8634 0.976 0.000 0.000 0.024 0.000
#> GSM258566 1 0.0703 0.8634 0.976 0.000 0.000 0.024 0.000
#> GSM258570 1 0.0162 0.8640 0.996 0.000 0.000 0.004 0.000
#> GSM258578 1 0.0609 0.8634 0.980 0.000 0.000 0.020 0.000
#> GSM258580 5 0.1901 0.5890 0.000 0.004 0.024 0.040 0.932
#> GSM258583 1 0.5924 0.6841 0.608 0.000 0.232 0.156 0.004
#> GSM258585 5 0.6444 0.2639 0.004 0.000 0.336 0.168 0.492
#> GSM258590 1 0.0162 0.8640 0.996 0.000 0.000 0.004 0.000
#> GSM258594 1 0.0404 0.8635 0.988 0.000 0.000 0.012 0.000
#> GSM258596 1 0.6072 0.6786 0.600 0.000 0.232 0.160 0.008
#> GSM258599 1 0.6005 0.6839 0.608 0.000 0.232 0.152 0.008
#> GSM258603 1 0.0162 0.8638 0.996 0.000 0.000 0.004 0.000
#> GSM258551 2 0.5215 0.4620 0.000 0.656 0.088 0.256 0.000
#> GSM258552 5 0.1369 0.5834 0.000 0.008 0.028 0.008 0.956
#> GSM258554 2 0.4094 0.6410 0.000 0.788 0.084 0.128 0.000
#> GSM258558 2 0.0960 0.7359 0.000 0.972 0.004 0.008 0.016
#> GSM258559 2 0.5503 0.5479 0.000 0.688 0.212 0.048 0.052
#> GSM258560 5 0.6674 -0.3550 0.000 0.100 0.412 0.036 0.452
#> GSM258561 2 0.5198 0.5555 0.000 0.692 0.108 0.196 0.004
#> GSM258564 4 0.3661 0.6876 0.000 0.276 0.000 0.724 0.000
#> GSM258567 3 0.5257 0.4523 0.000 0.004 0.492 0.036 0.468
#> GSM258568 2 0.0451 0.7377 0.000 0.988 0.004 0.000 0.008
#> GSM258569 5 0.2966 0.4899 0.000 0.000 0.136 0.016 0.848
#> GSM258571 3 0.5061 0.6930 0.000 0.008 0.572 0.024 0.396
#> GSM258572 5 0.1369 0.5888 0.000 0.008 0.028 0.008 0.956
#> GSM258573 2 0.4637 0.5351 0.000 0.728 0.076 0.196 0.000
#> GSM258574 5 0.2474 0.5507 0.000 0.040 0.040 0.012 0.908
#> GSM258575 2 0.1518 0.7251 0.000 0.944 0.004 0.004 0.048
#> GSM258576 2 0.0451 0.7373 0.000 0.988 0.004 0.000 0.008
#> GSM258577 5 0.6181 0.0927 0.000 0.128 0.224 0.028 0.620
#> GSM258579 2 0.1518 0.7251 0.000 0.944 0.004 0.004 0.048
#> GSM258581 2 0.0451 0.7373 0.000 0.988 0.004 0.000 0.008
#> GSM258582 3 0.5101 0.6782 0.000 0.008 0.552 0.024 0.416
#> GSM258584 3 0.7367 0.2696 0.000 0.204 0.460 0.048 0.288
#> GSM258586 4 0.5005 0.7092 0.000 0.044 0.028 0.716 0.212
#> GSM258587 2 0.4537 0.5542 0.000 0.740 0.076 0.184 0.000
#> GSM258588 2 0.7025 0.3069 0.000 0.496 0.172 0.036 0.296
#> GSM258589 5 0.1967 0.5663 0.000 0.020 0.036 0.012 0.932
#> GSM258591 2 0.3791 0.6422 0.000 0.812 0.076 0.112 0.000
#> GSM258592 3 0.5005 0.5579 0.000 0.004 0.580 0.028 0.388
#> GSM258593 5 0.6390 0.3413 0.020 0.000 0.264 0.144 0.572
#> GSM258595 5 0.2805 0.5091 0.000 0.008 0.108 0.012 0.872
#> GSM258597 4 0.5396 0.5538 0.000 0.340 0.072 0.588 0.000
#> GSM258598 4 0.3928 0.6770 0.000 0.296 0.004 0.700 0.000
#> GSM258600 5 0.0981 0.5910 0.000 0.008 0.008 0.012 0.972
#> GSM258601 3 0.5140 0.6618 0.000 0.008 0.524 0.024 0.444
#> GSM258602 2 0.4897 0.5996 0.000 0.748 0.164 0.040 0.048
#> GSM258604 3 0.5070 0.6867 0.000 0.008 0.568 0.024 0.400
#> GSM258605 3 0.4709 0.6849 0.000 0.000 0.612 0.024 0.364
#> GSM258606 2 0.0451 0.7377 0.000 0.988 0.004 0.000 0.008
#> GSM258607 4 0.4914 0.7425 0.000 0.056 0.040 0.752 0.152
#> GSM258608 2 0.6814 0.3957 0.000 0.568 0.164 0.048 0.220
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> GSM258553 1 0.1151 0.94081 0.956 0.000 0.032 0.012 0.000 0.000
#> GSM258555 1 0.1572 0.94008 0.936 0.000 0.036 0.028 0.000 0.000
#> GSM258556 4 0.3182 0.82832 0.000 0.080 0.040 0.856 0.012 0.012
#> GSM258557 5 0.5461 0.36565 0.064 0.324 0.036 0.000 0.576 0.000
#> GSM258562 2 0.3111 0.69100 0.000 0.852 0.088 0.020 0.040 0.000
#> GSM258563 5 0.4493 0.62759 0.424 0.004 0.024 0.000 0.548 0.000
#> GSM258565 1 0.1700 0.94023 0.928 0.000 0.048 0.024 0.000 0.000
#> GSM258566 1 0.1700 0.94023 0.928 0.000 0.048 0.024 0.000 0.000
#> GSM258570 1 0.0820 0.94407 0.972 0.000 0.016 0.012 0.000 0.000
#> GSM258578 1 0.1572 0.94008 0.936 0.000 0.036 0.028 0.000 0.000
#> GSM258580 2 0.2103 0.72219 0.000 0.916 0.024 0.020 0.040 0.000
#> GSM258583 5 0.4314 0.61591 0.444 0.000 0.020 0.000 0.536 0.000
#> GSM258585 5 0.4707 0.21473 0.000 0.360 0.056 0.000 0.584 0.000
#> GSM258590 1 0.0820 0.94407 0.972 0.000 0.016 0.012 0.000 0.000
#> GSM258594 1 0.1151 0.94081 0.956 0.000 0.032 0.012 0.000 0.000
#> GSM258596 5 0.4533 0.62698 0.432 0.008 0.020 0.000 0.540 0.000
#> GSM258599 5 0.4314 0.61591 0.444 0.000 0.020 0.000 0.536 0.000
#> GSM258603 1 0.0458 0.94555 0.984 0.000 0.000 0.016 0.000 0.000
#> GSM258551 6 0.6513 0.28824 0.000 0.000 0.040 0.288 0.204 0.468
#> GSM258552 2 0.1786 0.72620 0.000 0.932 0.032 0.004 0.028 0.004
#> GSM258554 6 0.5893 0.46810 0.000 0.000 0.032 0.172 0.212 0.584
#> GSM258558 6 0.0881 0.66587 0.000 0.000 0.012 0.008 0.008 0.972
#> GSM258559 6 0.6405 0.46889 0.000 0.024 0.112 0.064 0.208 0.592
#> GSM258560 2 0.7973 -0.30633 0.000 0.324 0.320 0.068 0.220 0.068
#> GSM258561 6 0.6861 0.28566 0.000 0.000 0.068 0.280 0.212 0.440
#> GSM258564 4 0.2135 0.82842 0.000 0.000 0.000 0.872 0.000 0.128
#> GSM258567 3 0.6672 0.43201 0.000 0.288 0.480 0.044 0.180 0.008
#> GSM258568 6 0.0653 0.66488 0.000 0.000 0.012 0.004 0.004 0.980
#> GSM258569 2 0.2482 0.65538 0.000 0.848 0.148 0.000 0.004 0.000
#> GSM258571 3 0.2955 0.72396 0.000 0.172 0.816 0.004 0.008 0.000
#> GSM258572 2 0.1294 0.73024 0.000 0.956 0.008 0.008 0.024 0.004
#> GSM258573 6 0.5694 0.40632 0.000 0.000 0.020 0.224 0.164 0.592
#> GSM258574 2 0.2051 0.71519 0.000 0.924 0.028 0.008 0.024 0.016
#> GSM258575 6 0.1780 0.64970 0.000 0.028 0.000 0.012 0.028 0.932
#> GSM258576 6 0.0508 0.66178 0.000 0.000 0.000 0.012 0.004 0.984
#> GSM258577 2 0.7182 0.17701 0.000 0.540 0.160 0.052 0.160 0.088
#> GSM258579 6 0.1700 0.65035 0.000 0.024 0.000 0.012 0.028 0.936
#> GSM258581 6 0.0405 0.66273 0.000 0.000 0.000 0.008 0.004 0.988
#> GSM258582 3 0.2979 0.71462 0.000 0.188 0.804 0.004 0.004 0.000
#> GSM258584 3 0.8307 0.28405 0.000 0.212 0.356 0.064 0.220 0.148
#> GSM258586 4 0.3745 0.81454 0.000 0.104 0.028 0.820 0.036 0.012
#> GSM258587 6 0.5626 0.42285 0.000 0.000 0.020 0.212 0.164 0.604
#> GSM258588 6 0.7415 0.31915 0.000 0.212 0.076 0.044 0.188 0.480
#> GSM258589 2 0.1647 0.72279 0.000 0.940 0.032 0.016 0.008 0.004
#> GSM258591 6 0.5810 0.46653 0.000 0.000 0.028 0.180 0.200 0.592
#> GSM258592 3 0.6320 0.51737 0.000 0.224 0.560 0.044 0.164 0.008
#> GSM258593 2 0.4835 -0.00125 0.004 0.540 0.048 0.000 0.408 0.000
#> GSM258595 2 0.2053 0.68951 0.000 0.888 0.108 0.000 0.004 0.000
#> GSM258597 4 0.5108 0.67187 0.000 0.000 0.020 0.676 0.160 0.144
#> GSM258598 4 0.2755 0.81833 0.000 0.000 0.004 0.844 0.012 0.140
#> GSM258600 2 0.1109 0.73335 0.000 0.964 0.012 0.016 0.004 0.004
#> GSM258601 3 0.2980 0.71642 0.000 0.192 0.800 0.008 0.000 0.000
#> GSM258602 6 0.6207 0.49427 0.000 0.024 0.092 0.064 0.208 0.612
#> GSM258604 3 0.3219 0.72218 0.000 0.168 0.808 0.008 0.016 0.000
#> GSM258605 3 0.3128 0.72366 0.000 0.168 0.812 0.008 0.012 0.000
#> GSM258606 6 0.0767 0.66478 0.000 0.000 0.012 0.008 0.004 0.976
#> GSM258607 4 0.2620 0.83746 0.000 0.048 0.040 0.888 0.000 0.024
#> GSM258608 6 0.7519 0.34861 0.000 0.144 0.084 0.060 0.232 0.480
Heatmaps for the consensus matrix. It visualizes the probability of two samples to be in a same group.
consensus_heatmap(res, k = 2)
consensus_heatmap(res, k = 3)
consensus_heatmap(res, k = 4)
consensus_heatmap(res, k = 5)
consensus_heatmap(res, k = 6)
Heatmaps for the membership of samples in all partitions to see how consistent they are:
membership_heatmap(res, k = 2)
membership_heatmap(res, k = 3)
membership_heatmap(res, k = 4)
membership_heatmap(res, k = 5)
membership_heatmap(res, k = 6)
As soon as we have had the classes for columns, we can look for signatures which are significantly different between classes which can be candidate marks for certain classes. Following are the heatmaps for signatures.
Signature heatmaps where rows are scaled:
get_signatures(res, k = 2)
get_signatures(res, k = 3)
get_signatures(res, k = 4)
get_signatures(res, k = 5)
get_signatures(res, k = 6)
Signature heatmaps where rows are not scaled:
get_signatures(res, k = 2, scale_rows = FALSE)
get_signatures(res, k = 3, scale_rows = FALSE)
get_signatures(res, k = 4, scale_rows = FALSE)
get_signatures(res, k = 5, scale_rows = FALSE)
get_signatures(res, k = 6, scale_rows = FALSE)
Compare the overlap of signatures from different k:
compare_signatures(res)
get_signature()
returns a data frame invisibly. TO get the list of signatures, the function
call should be assigned to a variable explicitly. In following code, if plot
argument is set
to FALSE
, no heatmap is plotted while only the differential analysis is performed.
# code only for demonstration
tb = get_signature(res, k = ..., plot = FALSE)
An example of the output of tb
is:
#> which_row fdr mean_1 mean_2 scaled_mean_1 scaled_mean_2 km
#> 1 38 0.042760348 8.373488 9.131774 -0.5533452 0.5164555 1
#> 2 40 0.018707592 7.106213 8.469186 -0.6173731 0.5762149 1
#> 3 55 0.019134737 10.221463 11.207825 -0.6159697 0.5749050 1
#> 4 59 0.006059896 5.921854 7.869574 -0.6899429 0.6439467 1
#> 5 60 0.018055526 8.928898 10.211722 -0.6204761 0.5791110 1
#> 6 98 0.009384629 15.714769 14.887706 0.6635654 -0.6193277 2
...
The columns in tb
are:
which_row
: row indices corresponding to the input matrix.fdr
: FDR for the differential test. mean_x
: The mean value in group x.scaled_mean_x
: The mean value in group x after rows are scaled.km
: Row groups if k-means clustering is applied to rows.UMAP plot which shows how samples are separated.
dimension_reduction(res, k = 2, method = "UMAP")
dimension_reduction(res, k = 3, method = "UMAP")
dimension_reduction(res, k = 4, method = "UMAP")
dimension_reduction(res, k = 5, method = "UMAP")
dimension_reduction(res, k = 6, method = "UMAP")
Following heatmap shows how subgroups are split when increasing k
:
collect_classes(res)
Test correlation between subgroups and known annotations. If the known annotation is numeric, one-way ANOVA test is applied, and if the known annotation is discrete, chi-squared contingency table test is applied.
test_to_known_factors(res)
#> n disease.state(p) k
#> CV:kmeans 57 2.94e-09 2
#> CV:kmeans 57 4.80e-09 3
#> CV:kmeans 50 8.37e-08 4
#> CV:kmeans 47 2.17e-07 5
#> CV:kmeans 41 9.54e-06 6
If matrix rows can be associated to genes, consider to use functional_enrichment(res,
...)
to perform function enrichment for the signature genes. See this vignette for more detailed explanations.
The object with results only for a single top-value method and a single partition method can be extracted as:
res = res_list["CV", "skmeans"]
# you can also extract it by
# res = res_list["CV:skmeans"]
A summary of res
and all the functions that can be applied to it:
res
#> A 'ConsensusPartition' object with k = 2, 3, 4, 5, 6.
#> On a matrix with 51941 rows and 58 columns.
#> Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'CV' method.
#> Subgroups are detected by 'skmeans' method.
#> Performed in total 1250 partitions by row resampling.
#> Best k for subgroups seems to be 2.
#>
#> Following methods can be applied to this 'ConsensusPartition' object:
#> [1] "cola_report" "collect_classes" "collect_plots"
#> [4] "collect_stats" "colnames" "compare_signatures"
#> [7] "consensus_heatmap" "dimension_reduction" "functional_enrichment"
#> [10] "get_anno_col" "get_anno" "get_classes"
#> [13] "get_consensus" "get_matrix" "get_membership"
#> [16] "get_param" "get_signatures" "get_stats"
#> [19] "is_best_k" "is_stable_k" "membership_heatmap"
#> [22] "ncol" "nrow" "plot_ecdf"
#> [25] "rownames" "select_partition_number" "show"
#> [28] "suggest_best_k" "test_to_known_factors"
collect_plots()
function collects all the plots made from res
for all k
(number of partitions)
into one single page to provide an easy and fast comparison between different k
.
collect_plots(res)
The plots are:
k
and the heatmap of
predicted classes for each k
.k
.k
.k
.All the plots in panels can be made by individual functions and they are plotted later in this section.
select_partition_number()
produces several plots showing different
statistics for choosing “optimized” k
. There are following statistics:
k
;k
, the area increased is defined as \(A_k - A_{k-1}\).The detailed explanations of these statistics can be found in the cola vignette.
Generally speaking, lower PAC score, higher mean silhouette score or higher
concordance corresponds to better partition. Rand index and Jaccard index
measure how similar the current partition is compared to partition with k-1
.
If they are too similar, we won't accept k
is better than k-1
.
select_partition_number(res)
The numeric values for all these statistics can be obtained by get_stats()
.
get_stats(res)
#> k 1-PAC mean_silhouette concordance area_increased Rand Jaccard
#> 2 2 1.000 0.985 0.994 0.4935 0.506 0.506
#> 3 3 0.837 0.859 0.937 0.3602 0.705 0.477
#> 4 4 0.700 0.640 0.734 0.1215 0.818 0.515
#> 5 5 0.763 0.775 0.859 0.0644 0.929 0.722
#> 6 6 0.734 0.617 0.779 0.0343 0.961 0.815
suggest_best_k()
suggests the best \(k\) based on these statistics. The rules are as follows:
suggest_best_k(res)
#> [1] 2
Following shows the table of the partitions (You need to click the show/hide
code output link to see it). The membership matrix (columns with name p*
)
is inferred by
clue::cl_consensus()
function with the SE
method. Basically the value in the membership matrix
represents the probability to belong to a certain group. The finall class
label for an item is determined with the group with highest probability it
belongs to.
In get_classes()
function, the entropy is calculated from the membership
matrix and the silhouette score is calculated from the consensus matrix.
cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#> class entropy silhouette p1 p2
#> GSM258553 1 0.0000 0.990 1.000 0.000
#> GSM258555 1 0.0000 0.990 1.000 0.000
#> GSM258556 2 0.0000 0.995 0.000 1.000
#> GSM258557 1 0.0000 0.990 1.000 0.000
#> GSM258562 1 0.0000 0.990 1.000 0.000
#> GSM258563 1 0.0000 0.990 1.000 0.000
#> GSM258565 1 0.0000 0.990 1.000 0.000
#> GSM258566 1 0.0000 0.990 1.000 0.000
#> GSM258570 1 0.0000 0.990 1.000 0.000
#> GSM258578 1 0.0000 0.990 1.000 0.000
#> GSM258580 1 0.7453 0.729 0.788 0.212
#> GSM258583 1 0.0000 0.990 1.000 0.000
#> GSM258585 1 0.0000 0.990 1.000 0.000
#> GSM258590 1 0.0000 0.990 1.000 0.000
#> GSM258594 1 0.0000 0.990 1.000 0.000
#> GSM258596 1 0.0000 0.990 1.000 0.000
#> GSM258599 1 0.0000 0.990 1.000 0.000
#> GSM258603 1 0.0000 0.990 1.000 0.000
#> GSM258551 2 0.0000 0.995 0.000 1.000
#> GSM258552 2 0.0000 0.995 0.000 1.000
#> GSM258554 2 0.0000 0.995 0.000 1.000
#> GSM258558 2 0.0000 0.995 0.000 1.000
#> GSM258559 2 0.0000 0.995 0.000 1.000
#> GSM258560 2 0.0000 0.995 0.000 1.000
#> GSM258561 2 0.0000 0.995 0.000 1.000
#> GSM258564 2 0.0000 0.995 0.000 1.000
#> GSM258567 2 0.0000 0.995 0.000 1.000
#> GSM258568 2 0.0000 0.995 0.000 1.000
#> GSM258569 1 0.0376 0.987 0.996 0.004
#> GSM258571 1 0.0000 0.990 1.000 0.000
#> GSM258572 2 0.0000 0.995 0.000 1.000
#> GSM258573 2 0.0000 0.995 0.000 1.000
#> GSM258574 2 0.0000 0.995 0.000 1.000
#> GSM258575 2 0.0000 0.995 0.000 1.000
#> GSM258576 2 0.0000 0.995 0.000 1.000
#> GSM258577 2 0.0000 0.995 0.000 1.000
#> GSM258579 2 0.0000 0.995 0.000 1.000
#> GSM258581 2 0.0000 0.995 0.000 1.000
#> GSM258582 1 0.0000 0.990 1.000 0.000
#> GSM258584 2 0.0000 0.995 0.000 1.000
#> GSM258586 2 0.0000 0.995 0.000 1.000
#> GSM258587 2 0.0000 0.995 0.000 1.000
#> GSM258588 2 0.0000 0.995 0.000 1.000
#> GSM258589 2 0.0000 0.995 0.000 1.000
#> GSM258591 2 0.0000 0.995 0.000 1.000
#> GSM258592 2 0.0000 0.995 0.000 1.000
#> GSM258593 1 0.0000 0.990 1.000 0.000
#> GSM258595 1 0.0672 0.983 0.992 0.008
#> GSM258597 2 0.0000 0.995 0.000 1.000
#> GSM258598 2 0.0000 0.995 0.000 1.000
#> GSM258600 2 0.0000 0.995 0.000 1.000
#> GSM258601 2 0.6148 0.818 0.152 0.848
#> GSM258602 2 0.0000 0.995 0.000 1.000
#> GSM258604 1 0.0000 0.990 1.000 0.000
#> GSM258605 1 0.0000 0.990 1.000 0.000
#> GSM258606 2 0.0000 0.995 0.000 1.000
#> GSM258607 2 0.0000 0.995 0.000 1.000
#> GSM258608 2 0.0000 0.995 0.000 1.000
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> GSM258553 1 0.0000 0.998 1.000 0.000 0.000
#> GSM258555 1 0.0000 0.998 1.000 0.000 0.000
#> GSM258556 3 0.6154 0.318 0.000 0.408 0.592
#> GSM258557 1 0.1031 0.975 0.976 0.000 0.024
#> GSM258562 3 0.1529 0.858 0.040 0.000 0.960
#> GSM258563 1 0.0000 0.998 1.000 0.000 0.000
#> GSM258565 1 0.0000 0.998 1.000 0.000 0.000
#> GSM258566 1 0.0000 0.998 1.000 0.000 0.000
#> GSM258570 1 0.0000 0.998 1.000 0.000 0.000
#> GSM258578 1 0.0000 0.998 1.000 0.000 0.000
#> GSM258580 3 0.2165 0.841 0.064 0.000 0.936
#> GSM258583 1 0.0000 0.998 1.000 0.000 0.000
#> GSM258585 1 0.0000 0.998 1.000 0.000 0.000
#> GSM258590 1 0.0000 0.998 1.000 0.000 0.000
#> GSM258594 1 0.0000 0.998 1.000 0.000 0.000
#> GSM258596 1 0.0000 0.998 1.000 0.000 0.000
#> GSM258599 1 0.0000 0.998 1.000 0.000 0.000
#> GSM258603 1 0.0000 0.998 1.000 0.000 0.000
#> GSM258551 2 0.0000 0.937 0.000 1.000 0.000
#> GSM258552 3 0.0592 0.861 0.000 0.012 0.988
#> GSM258554 2 0.0000 0.937 0.000 1.000 0.000
#> GSM258558 2 0.0424 0.937 0.000 0.992 0.008
#> GSM258559 2 0.0747 0.934 0.000 0.984 0.016
#> GSM258560 3 0.5254 0.635 0.000 0.264 0.736
#> GSM258561 2 0.0424 0.933 0.000 0.992 0.008
#> GSM258564 2 0.0237 0.936 0.000 0.996 0.004
#> GSM258567 3 0.0000 0.861 0.000 0.000 1.000
#> GSM258568 2 0.0424 0.937 0.000 0.992 0.008
#> GSM258569 3 0.0592 0.862 0.012 0.000 0.988
#> GSM258571 3 0.1525 0.859 0.032 0.004 0.964
#> GSM258572 3 0.0592 0.861 0.000 0.012 0.988
#> GSM258573 2 0.0000 0.937 0.000 1.000 0.000
#> GSM258574 3 0.5621 0.555 0.000 0.308 0.692
#> GSM258575 2 0.1031 0.928 0.000 0.976 0.024
#> GSM258576 2 0.0424 0.937 0.000 0.992 0.008
#> GSM258577 3 0.6045 0.414 0.000 0.380 0.620
#> GSM258579 2 0.0592 0.936 0.000 0.988 0.012
#> GSM258581 2 0.0424 0.937 0.000 0.992 0.008
#> GSM258582 3 0.1267 0.861 0.024 0.004 0.972
#> GSM258584 2 0.6180 0.183 0.000 0.584 0.416
#> GSM258586 3 0.6126 0.343 0.000 0.400 0.600
#> GSM258587 2 0.0000 0.937 0.000 1.000 0.000
#> GSM258588 2 0.5529 0.536 0.000 0.704 0.296
#> GSM258589 3 0.2261 0.836 0.000 0.068 0.932
#> GSM258591 2 0.0000 0.937 0.000 1.000 0.000
#> GSM258592 3 0.0000 0.861 0.000 0.000 1.000
#> GSM258593 1 0.0424 0.990 0.992 0.000 0.008
#> GSM258595 3 0.0661 0.862 0.008 0.004 0.988
#> GSM258597 2 0.0237 0.936 0.000 0.996 0.004
#> GSM258598 2 0.0237 0.936 0.000 0.996 0.004
#> GSM258600 3 0.0592 0.861 0.000 0.012 0.988
#> GSM258601 3 0.1482 0.861 0.012 0.020 0.968
#> GSM258602 2 0.0424 0.937 0.000 0.992 0.008
#> GSM258604 3 0.4110 0.771 0.152 0.004 0.844
#> GSM258605 3 0.4555 0.718 0.200 0.000 0.800
#> GSM258606 2 0.0424 0.937 0.000 0.992 0.008
#> GSM258607 2 0.5591 0.491 0.000 0.696 0.304
#> GSM258608 2 0.0592 0.936 0.000 0.988 0.012
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> GSM258553 1 0.0000 0.98314 1.000 0.000 0.000 0.000
#> GSM258555 1 0.0000 0.98314 1.000 0.000 0.000 0.000
#> GSM258556 4 0.6545 0.48038 0.000 0.216 0.152 0.632
#> GSM258557 1 0.1902 0.92188 0.932 0.064 0.004 0.000
#> GSM258562 3 0.4776 0.70211 0.016 0.272 0.712 0.000
#> GSM258563 1 0.0000 0.98314 1.000 0.000 0.000 0.000
#> GSM258565 1 0.0000 0.98314 1.000 0.000 0.000 0.000
#> GSM258566 1 0.0000 0.98314 1.000 0.000 0.000 0.000
#> GSM258570 1 0.0000 0.98314 1.000 0.000 0.000 0.000
#> GSM258578 1 0.0000 0.98314 1.000 0.000 0.000 0.000
#> GSM258580 2 0.5680 -0.47194 0.012 0.584 0.392 0.012
#> GSM258583 1 0.0000 0.98314 1.000 0.000 0.000 0.000
#> GSM258585 1 0.0000 0.98314 1.000 0.000 0.000 0.000
#> GSM258590 1 0.0000 0.98314 1.000 0.000 0.000 0.000
#> GSM258594 1 0.0000 0.98314 1.000 0.000 0.000 0.000
#> GSM258596 1 0.0000 0.98314 1.000 0.000 0.000 0.000
#> GSM258599 1 0.0000 0.98314 1.000 0.000 0.000 0.000
#> GSM258603 1 0.0000 0.98314 1.000 0.000 0.000 0.000
#> GSM258551 4 0.1118 0.80337 0.000 0.036 0.000 0.964
#> GSM258552 3 0.5236 0.62768 0.000 0.432 0.560 0.008
#> GSM258554 4 0.1474 0.78528 0.000 0.052 0.000 0.948
#> GSM258558 2 0.4999 0.45730 0.000 0.508 0.000 0.492
#> GSM258559 2 0.6813 0.50665 0.000 0.576 0.132 0.292
#> GSM258560 2 0.6609 -0.00857 0.000 0.472 0.448 0.080
#> GSM258561 4 0.2124 0.79729 0.000 0.028 0.040 0.932
#> GSM258564 4 0.0927 0.81364 0.000 0.016 0.008 0.976
#> GSM258567 3 0.4522 0.48525 0.000 0.320 0.680 0.000
#> GSM258568 2 0.5000 0.45381 0.000 0.504 0.000 0.496
#> GSM258569 3 0.4193 0.70721 0.000 0.268 0.732 0.000
#> GSM258571 3 0.1191 0.70324 0.004 0.024 0.968 0.004
#> GSM258572 3 0.5506 0.59095 0.000 0.472 0.512 0.016
#> GSM258573 4 0.1118 0.80833 0.000 0.036 0.000 0.964
#> GSM258574 2 0.4434 -0.14886 0.000 0.756 0.228 0.016
#> GSM258575 2 0.5137 0.45901 0.000 0.544 0.004 0.452
#> GSM258576 2 0.5000 0.45381 0.000 0.504 0.000 0.496
#> GSM258577 2 0.6875 -0.14189 0.000 0.504 0.388 0.108
#> GSM258579 2 0.4961 0.47155 0.000 0.552 0.000 0.448
#> GSM258581 2 0.5000 0.45381 0.000 0.504 0.000 0.496
#> GSM258582 3 0.1396 0.71900 0.004 0.032 0.960 0.004
#> GSM258584 2 0.6664 0.39916 0.000 0.580 0.308 0.112
#> GSM258586 4 0.6412 0.41467 0.000 0.320 0.088 0.592
#> GSM258587 4 0.1474 0.78680 0.000 0.052 0.000 0.948
#> GSM258588 2 0.5102 0.48332 0.000 0.764 0.100 0.136
#> GSM258589 2 0.5565 -0.37123 0.000 0.624 0.344 0.032
#> GSM258591 4 0.1118 0.80026 0.000 0.036 0.000 0.964
#> GSM258592 3 0.3975 0.51799 0.000 0.240 0.760 0.000
#> GSM258593 1 0.4274 0.78701 0.820 0.108 0.072 0.000
#> GSM258595 3 0.5256 0.69730 0.000 0.272 0.692 0.036
#> GSM258597 4 0.0524 0.81680 0.000 0.008 0.004 0.988
#> GSM258598 4 0.0524 0.81680 0.000 0.008 0.004 0.988
#> GSM258600 3 0.5586 0.60292 0.000 0.452 0.528 0.020
#> GSM258601 3 0.2282 0.69057 0.000 0.024 0.924 0.052
#> GSM258602 2 0.6020 0.50464 0.000 0.568 0.048 0.384
#> GSM258604 3 0.3266 0.66858 0.032 0.004 0.880 0.084
#> GSM258605 3 0.2494 0.68296 0.048 0.036 0.916 0.000
#> GSM258606 2 0.4999 0.45699 0.000 0.508 0.000 0.492
#> GSM258607 4 0.4940 0.64338 0.000 0.096 0.128 0.776
#> GSM258608 2 0.5130 0.51468 0.000 0.652 0.016 0.332
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> GSM258553 1 0.0000 0.9599 1.000 0.000 0.000 0.000 0.000
#> GSM258555 1 0.0000 0.9599 1.000 0.000 0.000 0.000 0.000
#> GSM258556 4 0.3736 0.7296 0.000 0.004 0.100 0.824 0.072
#> GSM258557 1 0.3625 0.8489 0.844 0.028 0.016 0.008 0.104
#> GSM258562 5 0.4401 0.5697 0.016 0.000 0.296 0.004 0.684
#> GSM258563 1 0.1200 0.9503 0.964 0.012 0.016 0.008 0.000
#> GSM258565 1 0.0000 0.9599 1.000 0.000 0.000 0.000 0.000
#> GSM258566 1 0.0000 0.9599 1.000 0.000 0.000 0.000 0.000
#> GSM258570 1 0.0000 0.9599 1.000 0.000 0.000 0.000 0.000
#> GSM258578 1 0.0000 0.9599 1.000 0.000 0.000 0.000 0.000
#> GSM258580 5 0.1901 0.7700 0.004 0.040 0.024 0.000 0.932
#> GSM258583 1 0.1200 0.9503 0.964 0.012 0.016 0.008 0.000
#> GSM258585 1 0.2288 0.9280 0.924 0.020 0.020 0.008 0.028
#> GSM258590 1 0.0000 0.9599 1.000 0.000 0.000 0.000 0.000
#> GSM258594 1 0.0000 0.9599 1.000 0.000 0.000 0.000 0.000
#> GSM258596 1 0.0740 0.9551 0.980 0.008 0.008 0.004 0.000
#> GSM258599 1 0.1200 0.9503 0.964 0.012 0.016 0.008 0.000
#> GSM258603 1 0.0000 0.9599 1.000 0.000 0.000 0.000 0.000
#> GSM258551 4 0.3333 0.7514 0.000 0.208 0.000 0.788 0.004
#> GSM258552 5 0.2349 0.7628 0.000 0.012 0.084 0.004 0.900
#> GSM258554 4 0.3398 0.7532 0.000 0.216 0.000 0.780 0.004
#> GSM258558 2 0.2997 0.7688 0.000 0.840 0.000 0.148 0.012
#> GSM258559 2 0.2460 0.7478 0.000 0.900 0.072 0.024 0.004
#> GSM258560 2 0.7344 -0.0741 0.000 0.404 0.348 0.036 0.212
#> GSM258561 4 0.2919 0.8176 0.000 0.104 0.024 0.868 0.004
#> GSM258564 4 0.0833 0.8203 0.000 0.016 0.004 0.976 0.004
#> GSM258567 3 0.4444 0.7279 0.000 0.104 0.760 0.000 0.136
#> GSM258568 2 0.2471 0.7743 0.000 0.864 0.000 0.136 0.000
#> GSM258569 5 0.4101 0.5588 0.000 0.000 0.332 0.004 0.664
#> GSM258571 3 0.1251 0.8825 0.000 0.008 0.956 0.000 0.036
#> GSM258572 5 0.1195 0.7716 0.000 0.012 0.028 0.000 0.960
#> GSM258573 4 0.3333 0.7571 0.000 0.208 0.000 0.788 0.004
#> GSM258574 5 0.2825 0.7310 0.000 0.124 0.016 0.000 0.860
#> GSM258575 2 0.4386 0.7298 0.000 0.764 0.000 0.140 0.096
#> GSM258576 2 0.2605 0.7689 0.000 0.852 0.000 0.148 0.000
#> GSM258577 5 0.6674 0.4089 0.000 0.284 0.132 0.036 0.548
#> GSM258579 2 0.4038 0.7489 0.000 0.792 0.000 0.128 0.080
#> GSM258581 2 0.2471 0.7743 0.000 0.864 0.000 0.136 0.000
#> GSM258582 3 0.1571 0.8695 0.004 0.000 0.936 0.000 0.060
#> GSM258584 2 0.5724 0.4324 0.000 0.640 0.260 0.024 0.076
#> GSM258586 4 0.3895 0.7154 0.000 0.012 0.044 0.812 0.132
#> GSM258587 4 0.3809 0.6967 0.000 0.256 0.000 0.736 0.008
#> GSM258588 2 0.4673 0.5907 0.000 0.716 0.052 0.004 0.228
#> GSM258589 5 0.3318 0.7524 0.000 0.072 0.040 0.024 0.864
#> GSM258591 4 0.3790 0.6849 0.000 0.272 0.000 0.724 0.004
#> GSM258592 3 0.3442 0.8030 0.000 0.104 0.836 0.000 0.060
#> GSM258593 1 0.4974 0.6121 0.692 0.008 0.036 0.008 0.256
#> GSM258595 5 0.5288 0.4653 0.004 0.004 0.360 0.040 0.592
#> GSM258597 4 0.1124 0.8252 0.000 0.036 0.000 0.960 0.004
#> GSM258598 4 0.1043 0.8249 0.000 0.040 0.000 0.960 0.000
#> GSM258600 5 0.0451 0.7692 0.000 0.004 0.000 0.008 0.988
#> GSM258601 3 0.2513 0.8692 0.000 0.008 0.904 0.040 0.048
#> GSM258602 2 0.1997 0.7669 0.000 0.924 0.040 0.036 0.000
#> GSM258604 3 0.2555 0.8543 0.016 0.000 0.904 0.052 0.028
#> GSM258605 3 0.1278 0.8821 0.004 0.016 0.960 0.000 0.020
#> GSM258606 2 0.2389 0.7792 0.000 0.880 0.004 0.116 0.000
#> GSM258607 4 0.2608 0.7713 0.000 0.004 0.088 0.888 0.020
#> GSM258608 2 0.3546 0.7410 0.000 0.848 0.016 0.060 0.076
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> GSM258553 1 0.0000 0.89176 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM258555 1 0.0000 0.89176 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM258556 4 0.2959 0.71176 0.000 0.048 0.036 0.876 0.032 0.008
#> GSM258557 1 0.5550 0.67419 0.632 0.096 0.008 0.028 0.236 0.000
#> GSM258562 2 0.5835 0.53651 0.012 0.612 0.216 0.024 0.136 0.000
#> GSM258563 1 0.3349 0.82721 0.804 0.000 0.008 0.024 0.164 0.000
#> GSM258565 1 0.0000 0.89176 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM258566 1 0.0000 0.89176 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM258570 1 0.0000 0.89176 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM258578 1 0.0000 0.89176 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM258580 2 0.3919 0.67363 0.004 0.808 0.012 0.012 0.108 0.056
#> GSM258583 1 0.3239 0.83381 0.816 0.000 0.008 0.024 0.152 0.000
#> GSM258585 1 0.5278 0.73407 0.676 0.064 0.016 0.032 0.212 0.000
#> GSM258590 1 0.0000 0.89176 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM258594 1 0.0000 0.89176 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM258596 1 0.1701 0.87323 0.920 0.000 0.000 0.008 0.072 0.000
#> GSM258599 1 0.3010 0.83964 0.828 0.000 0.004 0.020 0.148 0.000
#> GSM258603 1 0.0291 0.89040 0.992 0.000 0.000 0.004 0.004 0.000
#> GSM258551 4 0.4402 0.69805 0.000 0.000 0.000 0.712 0.104 0.184
#> GSM258552 2 0.2365 0.71225 0.000 0.892 0.012 0.008 0.084 0.004
#> GSM258554 4 0.5209 0.56916 0.000 0.000 0.000 0.564 0.112 0.324
#> GSM258558 6 0.3113 0.63594 0.000 0.028 0.000 0.040 0.076 0.856
#> GSM258559 6 0.4591 0.16907 0.000 0.000 0.040 0.000 0.408 0.552
#> GSM258560 5 0.7671 0.47675 0.000 0.156 0.204 0.028 0.444 0.168
#> GSM258561 4 0.4621 0.72334 0.000 0.000 0.040 0.720 0.048 0.192
#> GSM258564 4 0.2034 0.76166 0.000 0.004 0.000 0.912 0.024 0.060
#> GSM258567 5 0.5556 0.00275 0.000 0.040 0.440 0.012 0.480 0.028
#> GSM258568 6 0.1141 0.66908 0.000 0.000 0.000 0.000 0.052 0.948
#> GSM258569 2 0.4354 0.61232 0.000 0.716 0.228 0.012 0.040 0.004
#> GSM258571 3 0.0622 0.81124 0.000 0.000 0.980 0.008 0.012 0.000
#> GSM258572 2 0.1949 0.71078 0.000 0.904 0.004 0.004 0.088 0.000
#> GSM258573 4 0.4692 0.43583 0.000 0.000 0.000 0.512 0.044 0.444
#> GSM258574 2 0.4031 0.62677 0.000 0.776 0.004 0.008 0.140 0.072
#> GSM258575 6 0.2966 0.63682 0.000 0.072 0.000 0.020 0.044 0.864
#> GSM258576 6 0.0363 0.67134 0.000 0.000 0.000 0.012 0.000 0.988
#> GSM258577 5 0.6897 0.01501 0.000 0.368 0.020 0.088 0.436 0.088
#> GSM258579 6 0.2719 0.64028 0.000 0.072 0.000 0.012 0.040 0.876
#> GSM258581 6 0.0458 0.67145 0.000 0.000 0.000 0.016 0.000 0.984
#> GSM258582 3 0.1659 0.80122 0.004 0.028 0.940 0.008 0.020 0.000
#> GSM258584 5 0.6117 0.32068 0.000 0.016 0.160 0.008 0.524 0.292
#> GSM258586 4 0.3618 0.68686 0.000 0.100 0.016 0.824 0.052 0.008
#> GSM258587 6 0.4853 -0.39138 0.000 0.000 0.000 0.456 0.056 0.488
#> GSM258588 6 0.6161 0.21867 0.000 0.128 0.028 0.008 0.312 0.524
#> GSM258589 2 0.5510 0.54849 0.000 0.676 0.024 0.028 0.172 0.100
#> GSM258591 4 0.4644 0.42208 0.000 0.000 0.000 0.504 0.040 0.456
#> GSM258592 3 0.5019 -0.06864 0.000 0.012 0.544 0.008 0.404 0.032
#> GSM258593 1 0.6299 0.26732 0.492 0.348 0.020 0.012 0.124 0.004
#> GSM258595 2 0.6184 0.49695 0.012 0.588 0.256 0.076 0.064 0.004
#> GSM258597 4 0.3123 0.75844 0.000 0.000 0.000 0.824 0.040 0.136
#> GSM258598 4 0.1957 0.76817 0.000 0.000 0.000 0.888 0.000 0.112
#> GSM258600 2 0.1398 0.71583 0.000 0.940 0.000 0.008 0.052 0.000
#> GSM258601 3 0.2414 0.78399 0.000 0.028 0.900 0.028 0.044 0.000
#> GSM258602 6 0.3867 0.38868 0.000 0.000 0.012 0.000 0.328 0.660
#> GSM258604 3 0.1972 0.77841 0.000 0.004 0.916 0.056 0.024 0.000
#> GSM258605 3 0.0891 0.80701 0.000 0.008 0.968 0.000 0.024 0.000
#> GSM258606 6 0.1471 0.66596 0.000 0.000 0.000 0.004 0.064 0.932
#> GSM258607 4 0.2159 0.73528 0.000 0.004 0.040 0.916 0.024 0.016
#> GSM258608 6 0.5985 0.09299 0.000 0.052 0.004 0.064 0.412 0.468
Heatmaps for the consensus matrix. It visualizes the probability of two samples to be in a same group.
consensus_heatmap(res, k = 2)
consensus_heatmap(res, k = 3)
consensus_heatmap(res, k = 4)
consensus_heatmap(res, k = 5)
consensus_heatmap(res, k = 6)
Heatmaps for the membership of samples in all partitions to see how consistent they are:
membership_heatmap(res, k = 2)
membership_heatmap(res, k = 3)
membership_heatmap(res, k = 4)
membership_heatmap(res, k = 5)
membership_heatmap(res, k = 6)
As soon as we have had the classes for columns, we can look for signatures which are significantly different between classes which can be candidate marks for certain classes. Following are the heatmaps for signatures.
Signature heatmaps where rows are scaled:
get_signatures(res, k = 2)
get_signatures(res, k = 3)
get_signatures(res, k = 4)
get_signatures(res, k = 5)
get_signatures(res, k = 6)
Signature heatmaps where rows are not scaled:
get_signatures(res, k = 2, scale_rows = FALSE)
get_signatures(res, k = 3, scale_rows = FALSE)
get_signatures(res, k = 4, scale_rows = FALSE)
get_signatures(res, k = 5, scale_rows = FALSE)
get_signatures(res, k = 6, scale_rows = FALSE)
Compare the overlap of signatures from different k:
compare_signatures(res)
get_signature()
returns a data frame invisibly. TO get the list of signatures, the function
call should be assigned to a variable explicitly. In following code, if plot
argument is set
to FALSE
, no heatmap is plotted while only the differential analysis is performed.
# code only for demonstration
tb = get_signature(res, k = ..., plot = FALSE)
An example of the output of tb
is:
#> which_row fdr mean_1 mean_2 scaled_mean_1 scaled_mean_2 km
#> 1 38 0.042760348 8.373488 9.131774 -0.5533452 0.5164555 1
#> 2 40 0.018707592 7.106213 8.469186 -0.6173731 0.5762149 1
#> 3 55 0.019134737 10.221463 11.207825 -0.6159697 0.5749050 1
#> 4 59 0.006059896 5.921854 7.869574 -0.6899429 0.6439467 1
#> 5 60 0.018055526 8.928898 10.211722 -0.6204761 0.5791110 1
#> 6 98 0.009384629 15.714769 14.887706 0.6635654 -0.6193277 2
...
The columns in tb
are:
which_row
: row indices corresponding to the input matrix.fdr
: FDR for the differential test. mean_x
: The mean value in group x.scaled_mean_x
: The mean value in group x after rows are scaled.km
: Row groups if k-means clustering is applied to rows.UMAP plot which shows how samples are separated.
dimension_reduction(res, k = 2, method = "UMAP")
dimension_reduction(res, k = 3, method = "UMAP")
dimension_reduction(res, k = 4, method = "UMAP")
dimension_reduction(res, k = 5, method = "UMAP")
dimension_reduction(res, k = 6, method = "UMAP")
Following heatmap shows how subgroups are split when increasing k
:
collect_classes(res)
Test correlation between subgroups and known annotations. If the known annotation is numeric, one-way ANOVA test is applied, and if the known annotation is discrete, chi-squared contingency table test is applied.
test_to_known_factors(res)
#> n disease.state(p) k
#> CV:skmeans 58 1.83e-07 2
#> CV:skmeans 53 1.53e-09 3
#> CV:skmeans 41 2.91e-07 4
#> CV:skmeans 54 7.28e-08 5
#> CV:skmeans 44 7.05e-07 6
If matrix rows can be associated to genes, consider to use functional_enrichment(res,
...)
to perform function enrichment for the signature genes. See this vignette for more detailed explanations.
The object with results only for a single top-value method and a single partition method can be extracted as:
res = res_list["CV", "pam"]
# you can also extract it by
# res = res_list["CV:pam"]
A summary of res
and all the functions that can be applied to it:
res
#> A 'ConsensusPartition' object with k = 2, 3, 4, 5, 6.
#> On a matrix with 51941 rows and 58 columns.
#> Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'CV' method.
#> Subgroups are detected by 'pam' method.
#> Performed in total 1250 partitions by row resampling.
#> Best k for subgroups seems to be 3.
#>
#> Following methods can be applied to this 'ConsensusPartition' object:
#> [1] "cola_report" "collect_classes" "collect_plots"
#> [4] "collect_stats" "colnames" "compare_signatures"
#> [7] "consensus_heatmap" "dimension_reduction" "functional_enrichment"
#> [10] "get_anno_col" "get_anno" "get_classes"
#> [13] "get_consensus" "get_matrix" "get_membership"
#> [16] "get_param" "get_signatures" "get_stats"
#> [19] "is_best_k" "is_stable_k" "membership_heatmap"
#> [22] "ncol" "nrow" "plot_ecdf"
#> [25] "rownames" "select_partition_number" "show"
#> [28] "suggest_best_k" "test_to_known_factors"
collect_plots()
function collects all the plots made from res
for all k
(number of partitions)
into one single page to provide an easy and fast comparison between different k
.
collect_plots(res)
The plots are:
k
and the heatmap of
predicted classes for each k
.k
.k
.k
.All the plots in panels can be made by individual functions and they are plotted later in this section.
select_partition_number()
produces several plots showing different
statistics for choosing “optimized” k
. There are following statistics:
k
;k
, the area increased is defined as \(A_k - A_{k-1}\).The detailed explanations of these statistics can be found in the cola vignette.
Generally speaking, lower PAC score, higher mean silhouette score or higher
concordance corresponds to better partition. Rand index and Jaccard index
measure how similar the current partition is compared to partition with k-1
.
If they are too similar, we won't accept k
is better than k-1
.
select_partition_number(res)
The numeric values for all these statistics can be obtained by get_stats()
.
get_stats(res)
#> k 1-PAC mean_silhouette concordance area_increased Rand Jaccard
#> 2 2 0.896 0.946 0.977 0.3860 0.627 0.627
#> 3 3 0.500 0.762 0.867 0.6549 0.686 0.510
#> 4 4 0.550 0.699 0.812 0.1268 0.909 0.741
#> 5 5 0.609 0.585 0.761 0.0787 0.855 0.547
#> 6 6 0.688 0.460 0.673 0.0571 0.841 0.408
suggest_best_k()
suggests the best \(k\) based on these statistics. The rules are as follows:
suggest_best_k(res)
#> [1] 3
Following shows the table of the partitions (You need to click the show/hide
code output link to see it). The membership matrix (columns with name p*
)
is inferred by
clue::cl_consensus()
function with the SE
method. Basically the value in the membership matrix
represents the probability to belong to a certain group. The finall class
label for an item is determined with the group with highest probability it
belongs to.
In get_classes()
function, the entropy is calculated from the membership
matrix and the silhouette score is calculated from the consensus matrix.
cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#> class entropy silhouette p1 p2
#> GSM258553 1 0.0000 0.979 1.000 0.000
#> GSM258555 1 0.0000 0.979 1.000 0.000
#> GSM258556 2 0.0000 0.974 0.000 1.000
#> GSM258557 2 0.7674 0.721 0.224 0.776
#> GSM258562 2 0.9933 0.191 0.452 0.548
#> GSM258563 1 0.1843 0.958 0.972 0.028
#> GSM258565 1 0.0000 0.979 1.000 0.000
#> GSM258566 1 0.0000 0.979 1.000 0.000
#> GSM258570 1 0.0000 0.979 1.000 0.000
#> GSM258578 1 0.0000 0.979 1.000 0.000
#> GSM258580 2 0.4815 0.878 0.104 0.896
#> GSM258583 1 0.0672 0.974 0.992 0.008
#> GSM258585 2 0.5408 0.856 0.124 0.876
#> GSM258590 1 0.0000 0.979 1.000 0.000
#> GSM258594 1 0.0000 0.979 1.000 0.000
#> GSM258596 1 0.0376 0.977 0.996 0.004
#> GSM258599 1 0.0000 0.979 1.000 0.000
#> GSM258603 1 0.0000 0.979 1.000 0.000
#> GSM258551 2 0.0000 0.974 0.000 1.000
#> GSM258552 2 0.0000 0.974 0.000 1.000
#> GSM258554 2 0.0000 0.974 0.000 1.000
#> GSM258558 2 0.0000 0.974 0.000 1.000
#> GSM258559 2 0.0000 0.974 0.000 1.000
#> GSM258560 2 0.0000 0.974 0.000 1.000
#> GSM258561 2 0.0000 0.974 0.000 1.000
#> GSM258564 2 0.0000 0.974 0.000 1.000
#> GSM258567 2 0.0000 0.974 0.000 1.000
#> GSM258568 2 0.0000 0.974 0.000 1.000
#> GSM258569 2 0.0672 0.968 0.008 0.992
#> GSM258571 2 0.0000 0.974 0.000 1.000
#> GSM258572 2 0.0000 0.974 0.000 1.000
#> GSM258573 2 0.0000 0.974 0.000 1.000
#> GSM258574 2 0.0000 0.974 0.000 1.000
#> GSM258575 2 0.0000 0.974 0.000 1.000
#> GSM258576 2 0.0000 0.974 0.000 1.000
#> GSM258577 2 0.0000 0.974 0.000 1.000
#> GSM258579 2 0.0000 0.974 0.000 1.000
#> GSM258581 2 0.0000 0.974 0.000 1.000
#> GSM258582 2 0.2778 0.933 0.048 0.952
#> GSM258584 2 0.0000 0.974 0.000 1.000
#> GSM258586 2 0.0000 0.974 0.000 1.000
#> GSM258587 2 0.0000 0.974 0.000 1.000
#> GSM258588 2 0.0000 0.974 0.000 1.000
#> GSM258589 2 0.0000 0.974 0.000 1.000
#> GSM258591 2 0.0000 0.974 0.000 1.000
#> GSM258592 2 0.0000 0.974 0.000 1.000
#> GSM258593 1 0.7602 0.708 0.780 0.220
#> GSM258595 2 0.0000 0.974 0.000 1.000
#> GSM258597 2 0.0000 0.974 0.000 1.000
#> GSM258598 2 0.0000 0.974 0.000 1.000
#> GSM258600 2 0.0000 0.974 0.000 1.000
#> GSM258601 2 0.0000 0.974 0.000 1.000
#> GSM258602 2 0.0000 0.974 0.000 1.000
#> GSM258604 2 0.0000 0.974 0.000 1.000
#> GSM258605 2 0.5408 0.856 0.124 0.876
#> GSM258606 2 0.0000 0.974 0.000 1.000
#> GSM258607 2 0.0000 0.974 0.000 1.000
#> GSM258608 2 0.0000 0.974 0.000 1.000
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> GSM258553 1 0.0000 0.943 1.000 0.000 0.000
#> GSM258555 1 0.0000 0.943 1.000 0.000 0.000
#> GSM258556 2 0.2878 0.833 0.000 0.904 0.096
#> GSM258557 3 0.1964 0.757 0.056 0.000 0.944
#> GSM258562 3 0.6630 0.491 0.300 0.028 0.672
#> GSM258563 1 0.5397 0.701 0.720 0.000 0.280
#> GSM258565 1 0.0000 0.943 1.000 0.000 0.000
#> GSM258566 1 0.0000 0.943 1.000 0.000 0.000
#> GSM258570 1 0.0000 0.943 1.000 0.000 0.000
#> GSM258578 1 0.0000 0.943 1.000 0.000 0.000
#> GSM258580 3 0.0747 0.793 0.000 0.016 0.984
#> GSM258583 1 0.3816 0.869 0.852 0.000 0.148
#> GSM258585 3 0.1031 0.787 0.000 0.024 0.976
#> GSM258590 1 0.0000 0.943 1.000 0.000 0.000
#> GSM258594 1 0.0000 0.943 1.000 0.000 0.000
#> GSM258596 1 0.3816 0.869 0.852 0.000 0.148
#> GSM258599 1 0.3752 0.872 0.856 0.000 0.144
#> GSM258603 1 0.0000 0.943 1.000 0.000 0.000
#> GSM258551 3 0.6079 0.541 0.000 0.388 0.612
#> GSM258552 3 0.1031 0.793 0.000 0.024 0.976
#> GSM258554 2 0.4796 0.698 0.000 0.780 0.220
#> GSM258558 3 0.4002 0.756 0.000 0.160 0.840
#> GSM258559 3 0.6204 0.312 0.000 0.424 0.576
#> GSM258560 3 0.5706 0.549 0.000 0.320 0.680
#> GSM258561 2 0.1643 0.846 0.000 0.956 0.044
#> GSM258564 2 0.1031 0.828 0.000 0.976 0.024
#> GSM258567 3 0.0747 0.793 0.000 0.016 0.984
#> GSM258568 2 0.4504 0.805 0.000 0.804 0.196
#> GSM258569 3 0.3752 0.760 0.000 0.144 0.856
#> GSM258571 2 0.3116 0.848 0.000 0.892 0.108
#> GSM258572 3 0.0747 0.793 0.000 0.016 0.984
#> GSM258573 2 0.2356 0.852 0.000 0.928 0.072
#> GSM258574 3 0.0747 0.793 0.000 0.016 0.984
#> GSM258575 2 0.3116 0.849 0.000 0.892 0.108
#> GSM258576 2 0.3116 0.849 0.000 0.892 0.108
#> GSM258577 3 0.1860 0.786 0.000 0.052 0.948
#> GSM258579 2 0.4702 0.785 0.000 0.788 0.212
#> GSM258581 2 0.5138 0.718 0.000 0.748 0.252
#> GSM258582 2 0.3412 0.849 0.000 0.876 0.124
#> GSM258584 3 0.4887 0.687 0.000 0.228 0.772
#> GSM258586 3 0.4291 0.761 0.000 0.180 0.820
#> GSM258587 2 0.2066 0.851 0.000 0.940 0.060
#> GSM258588 3 0.4291 0.749 0.000 0.180 0.820
#> GSM258589 3 0.4002 0.751 0.000 0.160 0.840
#> GSM258591 2 0.2356 0.852 0.000 0.928 0.072
#> GSM258592 3 0.4002 0.735 0.000 0.160 0.840
#> GSM258593 3 0.5733 0.304 0.324 0.000 0.676
#> GSM258595 2 0.3551 0.847 0.000 0.868 0.132
#> GSM258597 2 0.0000 0.826 0.000 1.000 0.000
#> GSM258598 2 0.0000 0.826 0.000 1.000 0.000
#> GSM258600 3 0.1964 0.776 0.000 0.056 0.944
#> GSM258601 2 0.5882 0.564 0.000 0.652 0.348
#> GSM258602 3 0.5733 0.568 0.000 0.324 0.676
#> GSM258604 2 0.6008 0.313 0.000 0.628 0.372
#> GSM258605 3 0.5859 0.472 0.000 0.344 0.656
#> GSM258606 2 0.6045 0.433 0.000 0.620 0.380
#> GSM258607 2 0.1163 0.829 0.000 0.972 0.028
#> GSM258608 3 0.2625 0.791 0.000 0.084 0.916
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> GSM258553 1 0.0000 1.000 1.000 0.000 0.000 0.000
#> GSM258555 1 0.0000 1.000 1.000 0.000 0.000 0.000
#> GSM258556 4 0.1510 0.760 0.000 0.028 0.016 0.956
#> GSM258557 3 0.3870 0.699 0.004 0.208 0.788 0.000
#> GSM258562 3 0.4077 0.539 0.012 0.184 0.800 0.004
#> GSM258563 3 0.4466 0.717 0.036 0.180 0.784 0.000
#> GSM258565 1 0.0000 1.000 1.000 0.000 0.000 0.000
#> GSM258566 1 0.0000 1.000 1.000 0.000 0.000 0.000
#> GSM258570 1 0.0000 1.000 1.000 0.000 0.000 0.000
#> GSM258578 1 0.0000 1.000 1.000 0.000 0.000 0.000
#> GSM258580 2 0.3610 0.684 0.000 0.800 0.200 0.000
#> GSM258583 3 0.4250 0.661 0.276 0.000 0.724 0.000
#> GSM258585 3 0.4584 0.657 0.000 0.300 0.696 0.004
#> GSM258590 1 0.0000 1.000 1.000 0.000 0.000 0.000
#> GSM258594 1 0.0000 1.000 1.000 0.000 0.000 0.000
#> GSM258596 3 0.4250 0.661 0.276 0.000 0.724 0.000
#> GSM258599 3 0.4250 0.661 0.276 0.000 0.724 0.000
#> GSM258603 1 0.0000 1.000 1.000 0.000 0.000 0.000
#> GSM258551 2 0.4843 0.405 0.000 0.604 0.000 0.396
#> GSM258552 2 0.4008 0.674 0.000 0.756 0.244 0.000
#> GSM258554 4 0.3649 0.697 0.000 0.204 0.000 0.796
#> GSM258558 2 0.1576 0.728 0.000 0.948 0.004 0.048
#> GSM258559 2 0.5172 0.176 0.000 0.588 0.008 0.404
#> GSM258560 2 0.5631 0.559 0.000 0.696 0.072 0.232
#> GSM258561 4 0.1792 0.784 0.000 0.068 0.000 0.932
#> GSM258564 4 0.0376 0.764 0.000 0.004 0.004 0.992
#> GSM258567 2 0.4164 0.580 0.000 0.736 0.264 0.000
#> GSM258568 4 0.3870 0.761 0.000 0.208 0.004 0.788
#> GSM258569 2 0.4049 0.679 0.000 0.780 0.212 0.008
#> GSM258571 4 0.4973 0.491 0.000 0.008 0.348 0.644
#> GSM258572 2 0.3837 0.675 0.000 0.776 0.224 0.000
#> GSM258573 4 0.2589 0.789 0.000 0.116 0.000 0.884
#> GSM258574 2 0.0592 0.719 0.000 0.984 0.016 0.000
#> GSM258575 4 0.3444 0.772 0.000 0.184 0.000 0.816
#> GSM258576 4 0.3444 0.772 0.000 0.184 0.000 0.816
#> GSM258577 2 0.4015 0.658 0.000 0.832 0.052 0.116
#> GSM258579 4 0.4134 0.723 0.000 0.260 0.000 0.740
#> GSM258581 4 0.4304 0.683 0.000 0.284 0.000 0.716
#> GSM258582 4 0.5353 0.326 0.000 0.012 0.432 0.556
#> GSM258584 2 0.5272 0.654 0.000 0.752 0.136 0.112
#> GSM258586 2 0.4989 0.626 0.000 0.764 0.072 0.164
#> GSM258587 4 0.1867 0.786 0.000 0.072 0.000 0.928
#> GSM258588 2 0.4030 0.717 0.000 0.836 0.072 0.092
#> GSM258589 2 0.3649 0.683 0.000 0.796 0.204 0.000
#> GSM258591 4 0.2868 0.787 0.000 0.136 0.000 0.864
#> GSM258592 2 0.4283 0.591 0.000 0.740 0.256 0.004
#> GSM258593 3 0.2469 0.650 0.000 0.108 0.892 0.000
#> GSM258595 4 0.3852 0.772 0.000 0.180 0.012 0.808
#> GSM258597 4 0.0188 0.764 0.000 0.000 0.004 0.996
#> GSM258598 4 0.0188 0.764 0.000 0.000 0.004 0.996
#> GSM258600 2 0.5359 0.585 0.000 0.676 0.288 0.036
#> GSM258601 4 0.5306 0.561 0.000 0.348 0.020 0.632
#> GSM258602 2 0.4193 0.506 0.000 0.732 0.000 0.268
#> GSM258604 4 0.7588 0.175 0.000 0.312 0.220 0.468
#> GSM258605 3 0.4635 0.579 0.000 0.028 0.756 0.216
#> GSM258606 4 0.4888 0.424 0.000 0.412 0.000 0.588
#> GSM258607 4 0.0524 0.765 0.000 0.008 0.004 0.988
#> GSM258608 2 0.1520 0.721 0.000 0.956 0.024 0.020
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> GSM258553 1 0.0000 1.00000 1.000 0.000 0.000 0.000 0.000
#> GSM258555 1 0.0000 1.00000 1.000 0.000 0.000 0.000 0.000
#> GSM258556 4 0.3707 0.68439 0.000 0.284 0.000 0.716 0.000
#> GSM258557 5 0.0162 0.70148 0.000 0.000 0.004 0.000 0.996
#> GSM258562 3 0.6252 -0.05711 0.000 0.328 0.508 0.000 0.164
#> GSM258563 5 0.0000 0.70108 0.000 0.000 0.000 0.000 1.000
#> GSM258565 1 0.0000 1.00000 1.000 0.000 0.000 0.000 0.000
#> GSM258566 1 0.0000 1.00000 1.000 0.000 0.000 0.000 0.000
#> GSM258570 1 0.0000 1.00000 1.000 0.000 0.000 0.000 0.000
#> GSM258578 1 0.0000 1.00000 1.000 0.000 0.000 0.000 0.000
#> GSM258580 2 0.4687 0.84871 0.000 0.672 0.288 0.040 0.000
#> GSM258583 5 0.2020 0.70256 0.100 0.000 0.000 0.000 0.900
#> GSM258585 5 0.3487 0.58565 0.000 0.008 0.212 0.000 0.780
#> GSM258590 1 0.0000 1.00000 1.000 0.000 0.000 0.000 0.000
#> GSM258594 1 0.0000 1.00000 1.000 0.000 0.000 0.000 0.000
#> GSM258596 5 0.2020 0.70256 0.100 0.000 0.000 0.000 0.900
#> GSM258599 5 0.2020 0.70256 0.100 0.000 0.000 0.000 0.900
#> GSM258603 1 0.0000 1.00000 1.000 0.000 0.000 0.000 0.000
#> GSM258551 4 0.4632 0.06881 0.000 0.012 0.448 0.540 0.000
#> GSM258552 2 0.5534 0.65892 0.000 0.668 0.196 0.128 0.008
#> GSM258554 4 0.2629 0.69497 0.000 0.004 0.136 0.860 0.000
#> GSM258558 3 0.5341 -0.09869 0.000 0.356 0.580 0.064 0.000
#> GSM258559 4 0.5489 0.02867 0.000 0.008 0.460 0.488 0.044
#> GSM258560 3 0.5156 0.38569 0.000 0.076 0.752 0.072 0.100
#> GSM258561 4 0.1732 0.73743 0.000 0.000 0.080 0.920 0.000
#> GSM258564 4 0.3452 0.70242 0.000 0.244 0.000 0.756 0.000
#> GSM258567 3 0.3332 0.43836 0.000 0.008 0.844 0.028 0.120
#> GSM258568 4 0.4974 0.62901 0.000 0.092 0.212 0.696 0.000
#> GSM258569 2 0.4400 0.86820 0.000 0.672 0.308 0.020 0.000
#> GSM258571 5 0.6641 0.14500 0.000 0.000 0.224 0.368 0.408
#> GSM258572 2 0.3895 0.87694 0.000 0.680 0.320 0.000 0.000
#> GSM258573 4 0.0324 0.75774 0.000 0.004 0.004 0.992 0.000
#> GSM258574 3 0.4403 -0.18488 0.000 0.384 0.608 0.008 0.000
#> GSM258575 4 0.1872 0.75033 0.000 0.052 0.020 0.928 0.000
#> GSM258576 4 0.2770 0.73630 0.000 0.076 0.044 0.880 0.000
#> GSM258577 3 0.4380 -0.17472 0.000 0.376 0.616 0.008 0.000
#> GSM258579 4 0.3521 0.69924 0.000 0.140 0.040 0.820 0.000
#> GSM258581 4 0.3043 0.73159 0.000 0.080 0.056 0.864 0.000
#> GSM258582 5 0.6613 0.28059 0.000 0.000 0.332 0.228 0.440
#> GSM258584 3 0.1082 0.44316 0.000 0.008 0.964 0.028 0.000
#> GSM258586 3 0.3164 0.41580 0.000 0.104 0.852 0.044 0.000
#> GSM258587 4 0.0404 0.75908 0.000 0.000 0.012 0.988 0.000
#> GSM258588 3 0.5372 0.39814 0.000 0.008 0.676 0.216 0.100
#> GSM258589 2 0.3895 0.87694 0.000 0.680 0.320 0.000 0.000
#> GSM258591 4 0.0324 0.75774 0.000 0.004 0.004 0.992 0.000
#> GSM258592 3 0.2914 0.43260 0.000 0.016 0.872 0.012 0.100
#> GSM258593 5 0.4047 0.49031 0.004 0.320 0.000 0.000 0.676
#> GSM258595 4 0.4106 0.60077 0.000 0.020 0.256 0.724 0.000
#> GSM258597 4 0.3424 0.70429 0.000 0.240 0.000 0.760 0.000
#> GSM258598 4 0.3452 0.70242 0.000 0.244 0.000 0.756 0.000
#> GSM258600 2 0.3895 0.87694 0.000 0.680 0.320 0.000 0.000
#> GSM258601 4 0.5313 0.39695 0.000 0.048 0.376 0.572 0.004
#> GSM258602 3 0.4644 -0.00172 0.000 0.012 0.528 0.460 0.000
#> GSM258604 3 0.6131 -0.06524 0.000 0.024 0.488 0.420 0.068
#> GSM258605 5 0.5368 0.41903 0.000 0.000 0.332 0.072 0.596
#> GSM258606 4 0.3043 0.73123 0.000 0.080 0.056 0.864 0.000
#> GSM258607 4 0.3452 0.70242 0.000 0.244 0.000 0.756 0.000
#> GSM258608 3 0.6405 -0.00167 0.000 0.364 0.460 0.176 0.000
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> GSM258553 1 0.0000 1.00000 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM258555 1 0.0000 1.00000 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM258556 4 0.5312 0.16374 0.000 0.040 0.052 0.600 0.000 0.308
#> GSM258557 5 0.0000 0.86111 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM258562 2 0.4775 0.06017 0.000 0.588 0.348 0.000 0.064 0.000
#> GSM258563 5 0.0000 0.86111 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM258565 1 0.0000 1.00000 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM258566 1 0.0000 1.00000 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM258570 1 0.0000 1.00000 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM258578 1 0.0000 1.00000 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM258580 2 0.1858 0.68233 0.000 0.904 0.092 0.000 0.000 0.004
#> GSM258583 5 0.0000 0.86111 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM258585 5 0.4741 0.54218 0.000 0.016 0.012 0.244 0.688 0.040
#> GSM258590 1 0.0000 1.00000 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM258594 1 0.0000 1.00000 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM258596 5 0.0000 0.86111 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM258599 5 0.0000 0.86111 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM258603 1 0.0000 1.00000 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM258551 4 0.4981 0.16244 0.000 0.064 0.080 0.716 0.000 0.140
#> GSM258552 2 0.2914 0.65444 0.000 0.860 0.092 0.004 0.004 0.040
#> GSM258554 6 0.5808 -0.01310 0.000 0.052 0.060 0.408 0.000 0.480
#> GSM258558 6 0.6964 -0.20428 0.000 0.184 0.080 0.344 0.000 0.392
#> GSM258559 3 0.6550 0.11364 0.000 0.068 0.520 0.212 0.000 0.200
#> GSM258560 3 0.3656 0.54168 0.000 0.256 0.728 0.012 0.000 0.004
#> GSM258561 6 0.5337 0.01194 0.000 0.024 0.052 0.448 0.000 0.476
#> GSM258564 4 0.4552 0.15557 0.000 0.000 0.044 0.592 0.000 0.364
#> GSM258567 3 0.2408 0.62361 0.000 0.108 0.876 0.012 0.004 0.000
#> GSM258568 6 0.2859 0.31440 0.000 0.156 0.016 0.000 0.000 0.828
#> GSM258569 2 0.1444 0.68929 0.000 0.928 0.072 0.000 0.000 0.000
#> GSM258571 3 0.5865 0.45711 0.000 0.004 0.612 0.140 0.204 0.040
#> GSM258572 2 0.0000 0.69185 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM258573 6 0.4261 0.10705 0.000 0.000 0.020 0.408 0.000 0.572
#> GSM258574 2 0.4881 0.44800 0.000 0.588 0.076 0.336 0.000 0.000
#> GSM258575 6 0.4851 0.28134 0.000 0.000 0.096 0.272 0.000 0.632
#> GSM258576 6 0.1910 0.40241 0.000 0.000 0.108 0.000 0.000 0.892
#> GSM258577 2 0.4787 0.44916 0.000 0.596 0.068 0.336 0.000 0.000
#> GSM258579 6 0.4027 0.38723 0.000 0.044 0.124 0.044 0.000 0.788
#> GSM258581 6 0.2053 0.40171 0.000 0.000 0.108 0.004 0.000 0.888
#> GSM258582 3 0.4006 0.52693 0.000 0.016 0.748 0.032 0.204 0.000
#> GSM258584 3 0.5471 0.24020 0.000 0.140 0.524 0.336 0.000 0.000
#> GSM258586 4 0.6316 -0.28499 0.000 0.108 0.336 0.492 0.000 0.064
#> GSM258587 6 0.4046 0.15621 0.000 0.004 0.008 0.368 0.000 0.620
#> GSM258588 3 0.2984 0.61661 0.000 0.064 0.860 0.012 0.000 0.064
#> GSM258589 2 0.0363 0.69265 0.000 0.988 0.012 0.000 0.000 0.000
#> GSM258591 6 0.4355 0.09142 0.000 0.000 0.024 0.420 0.000 0.556
#> GSM258592 3 0.2668 0.61178 0.000 0.168 0.828 0.004 0.000 0.000
#> GSM258593 5 0.3890 0.39910 0.004 0.400 0.000 0.000 0.596 0.000
#> GSM258595 4 0.6436 -0.06424 0.000 0.264 0.016 0.368 0.000 0.352
#> GSM258597 4 0.4076 0.00767 0.000 0.000 0.008 0.540 0.000 0.452
#> GSM258598 4 0.4563 0.15346 0.000 0.000 0.044 0.588 0.000 0.368
#> GSM258600 2 0.0000 0.69185 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM258601 6 0.7649 -0.05162 0.000 0.224 0.200 0.256 0.000 0.320
#> GSM258602 4 0.6780 0.02385 0.000 0.088 0.204 0.496 0.000 0.212
#> GSM258604 4 0.7524 0.13169 0.000 0.132 0.216 0.492 0.064 0.096
#> GSM258605 3 0.3405 0.47035 0.000 0.004 0.724 0.000 0.272 0.000
#> GSM258606 6 0.2165 0.39963 0.000 0.000 0.108 0.008 0.000 0.884
#> GSM258607 4 0.4580 0.15925 0.000 0.000 0.052 0.612 0.000 0.336
#> GSM258608 2 0.6728 0.30496 0.000 0.412 0.184 0.348 0.000 0.056
Heatmaps for the consensus matrix. It visualizes the probability of two samples to be in a same group.
consensus_heatmap(res, k = 2)
consensus_heatmap(res, k = 3)
consensus_heatmap(res, k = 4)
consensus_heatmap(res, k = 5)
consensus_heatmap(res, k = 6)
Heatmaps for the membership of samples in all partitions to see how consistent they are:
membership_heatmap(res, k = 2)
membership_heatmap(res, k = 3)
membership_heatmap(res, k = 4)
membership_heatmap(res, k = 5)
membership_heatmap(res, k = 6)
As soon as we have had the classes for columns, we can look for signatures which are significantly different between classes which can be candidate marks for certain classes. Following are the heatmaps for signatures.
Signature heatmaps where rows are scaled:
get_signatures(res, k = 2)
get_signatures(res, k = 3)
get_signatures(res, k = 4)
get_signatures(res, k = 5)
get_signatures(res, k = 6)
Signature heatmaps where rows are not scaled:
get_signatures(res, k = 2, scale_rows = FALSE)
get_signatures(res, k = 3, scale_rows = FALSE)
get_signatures(res, k = 4, scale_rows = FALSE)
get_signatures(res, k = 5, scale_rows = FALSE)
get_signatures(res, k = 6, scale_rows = FALSE)
Compare the overlap of signatures from different k:
compare_signatures(res)
get_signature()
returns a data frame invisibly. TO get the list of signatures, the function
call should be assigned to a variable explicitly. In following code, if plot
argument is set
to FALSE
, no heatmap is plotted while only the differential analysis is performed.
# code only for demonstration
tb = get_signature(res, k = ..., plot = FALSE)
An example of the output of tb
is:
#> which_row fdr mean_1 mean_2 scaled_mean_1 scaled_mean_2 km
#> 1 38 0.042760348 8.373488 9.131774 -0.5533452 0.5164555 1
#> 2 40 0.018707592 7.106213 8.469186 -0.6173731 0.5762149 1
#> 3 55 0.019134737 10.221463 11.207825 -0.6159697 0.5749050 1
#> 4 59 0.006059896 5.921854 7.869574 -0.6899429 0.6439467 1
#> 5 60 0.018055526 8.928898 10.211722 -0.6204761 0.5791110 1
#> 6 98 0.009384629 15.714769 14.887706 0.6635654 -0.6193277 2
...
The columns in tb
are:
which_row
: row indices corresponding to the input matrix.fdr
: FDR for the differential test. mean_x
: The mean value in group x.scaled_mean_x
: The mean value in group x after rows are scaled.km
: Row groups if k-means clustering is applied to rows.UMAP plot which shows how samples are separated.
dimension_reduction(res, k = 2, method = "UMAP")
dimension_reduction(res, k = 3, method = "UMAP")
dimension_reduction(res, k = 4, method = "UMAP")
dimension_reduction(res, k = 5, method = "UMAP")
dimension_reduction(res, k = 6, method = "UMAP")
Following heatmap shows how subgroups are split when increasing k
:
collect_classes(res)
Test correlation between subgroups and known annotations. If the known annotation is numeric, one-way ANOVA test is applied, and if the known annotation is discrete, chi-squared contingency table test is applied.
test_to_known_factors(res)
#> n disease.state(p) k
#> CV:pam 57 2.15e-08 2
#> CV:pam 52 1.44e-08 3
#> CV:pam 52 5.05e-08 4
#> CV:pam 38 9.26e-07 5
#> CV:pam 26 5.18e-05 6
If matrix rows can be associated to genes, consider to use functional_enrichment(res,
...)
to perform function enrichment for the signature genes. See this vignette for more detailed explanations.
The object with results only for a single top-value method and a single partition method can be extracted as:
res = res_list["CV", "mclust"]
# you can also extract it by
# res = res_list["CV:mclust"]
A summary of res
and all the functions that can be applied to it:
res
#> A 'ConsensusPartition' object with k = 2, 3, 4, 5, 6.
#> On a matrix with 51941 rows and 58 columns.
#> Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'CV' method.
#> Subgroups are detected by 'mclust' method.
#> Performed in total 1250 partitions by row resampling.
#> Best k for subgroups seems to be 2.
#>
#> Following methods can be applied to this 'ConsensusPartition' object:
#> [1] "cola_report" "collect_classes" "collect_plots"
#> [4] "collect_stats" "colnames" "compare_signatures"
#> [7] "consensus_heatmap" "dimension_reduction" "functional_enrichment"
#> [10] "get_anno_col" "get_anno" "get_classes"
#> [13] "get_consensus" "get_matrix" "get_membership"
#> [16] "get_param" "get_signatures" "get_stats"
#> [19] "is_best_k" "is_stable_k" "membership_heatmap"
#> [22] "ncol" "nrow" "plot_ecdf"
#> [25] "rownames" "select_partition_number" "show"
#> [28] "suggest_best_k" "test_to_known_factors"
collect_plots()
function collects all the plots made from res
for all k
(number of partitions)
into one single page to provide an easy and fast comparison between different k
.
collect_plots(res)
The plots are:
k
and the heatmap of
predicted classes for each k
.k
.k
.k
.All the plots in panels can be made by individual functions and they are plotted later in this section.
select_partition_number()
produces several plots showing different
statistics for choosing “optimized” k
. There are following statistics:
k
;k
, the area increased is defined as \(A_k - A_{k-1}\).The detailed explanations of these statistics can be found in the cola vignette.
Generally speaking, lower PAC score, higher mean silhouette score or higher
concordance corresponds to better partition. Rand index and Jaccard index
measure how similar the current partition is compared to partition with k-1
.
If they are too similar, we won't accept k
is better than k-1
.
select_partition_number(res)
The numeric values for all these statistics can be obtained by get_stats()
.
get_stats(res)
#> k 1-PAC mean_silhouette concordance area_increased Rand Jaccard
#> 2 2 0.624 0.842 0.930 0.4755 0.513 0.513
#> 3 3 0.474 0.700 0.759 0.3126 0.867 0.749
#> 4 4 0.630 0.747 0.832 0.1606 0.754 0.462
#> 5 5 0.752 0.803 0.891 0.0683 0.800 0.416
#> 6 6 0.785 0.656 0.812 0.0580 0.945 0.767
suggest_best_k()
suggests the best \(k\) based on these statistics. The rules are as follows:
suggest_best_k(res)
#> [1] 2
Following shows the table of the partitions (You need to click the show/hide
code output link to see it). The membership matrix (columns with name p*
)
is inferred by
clue::cl_consensus()
function with the SE
method. Basically the value in the membership matrix
represents the probability to belong to a certain group. The finall class
label for an item is determined with the group with highest probability it
belongs to.
In get_classes()
function, the entropy is calculated from the membership
matrix and the silhouette score is calculated from the consensus matrix.
cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#> class entropy silhouette p1 p2
#> GSM258553 1 0.0000 0.882 1.000 0.000
#> GSM258555 1 0.0000 0.882 1.000 0.000
#> GSM258556 2 0.0000 0.943 0.000 1.000
#> GSM258557 1 0.6343 0.765 0.840 0.160
#> GSM258562 1 0.3114 0.852 0.944 0.056
#> GSM258563 1 0.0000 0.882 1.000 0.000
#> GSM258565 1 0.0000 0.882 1.000 0.000
#> GSM258566 1 0.0000 0.882 1.000 0.000
#> GSM258570 1 0.0000 0.882 1.000 0.000
#> GSM258578 1 0.0000 0.882 1.000 0.000
#> GSM258580 1 0.6148 0.774 0.848 0.152
#> GSM258583 1 0.0000 0.882 1.000 0.000
#> GSM258585 1 0.0376 0.880 0.996 0.004
#> GSM258590 1 0.0000 0.882 1.000 0.000
#> GSM258594 1 0.0000 0.882 1.000 0.000
#> GSM258596 1 0.0000 0.882 1.000 0.000
#> GSM258599 1 0.0000 0.882 1.000 0.000
#> GSM258603 1 0.0000 0.882 1.000 0.000
#> GSM258551 2 0.0000 0.943 0.000 1.000
#> GSM258552 2 0.7056 0.769 0.192 0.808
#> GSM258554 2 0.0000 0.943 0.000 1.000
#> GSM258558 2 0.0000 0.943 0.000 1.000
#> GSM258559 2 0.0000 0.943 0.000 1.000
#> GSM258560 2 0.8608 0.550 0.284 0.716
#> GSM258561 2 0.0000 0.943 0.000 1.000
#> GSM258564 2 0.0000 0.943 0.000 1.000
#> GSM258567 2 0.6801 0.785 0.180 0.820
#> GSM258568 2 0.0000 0.943 0.000 1.000
#> GSM258569 1 0.9833 0.383 0.576 0.424
#> GSM258571 2 0.8207 0.673 0.256 0.744
#> GSM258572 2 0.7376 0.749 0.208 0.792
#> GSM258573 2 0.0000 0.943 0.000 1.000
#> GSM258574 2 0.5059 0.858 0.112 0.888
#> GSM258575 2 0.0000 0.943 0.000 1.000
#> GSM258576 2 0.0000 0.943 0.000 1.000
#> GSM258577 2 0.0000 0.943 0.000 1.000
#> GSM258579 2 0.0000 0.943 0.000 1.000
#> GSM258581 2 0.0000 0.943 0.000 1.000
#> GSM258582 1 0.9963 0.155 0.536 0.464
#> GSM258584 2 0.0000 0.943 0.000 1.000
#> GSM258586 2 0.0000 0.943 0.000 1.000
#> GSM258587 2 0.0000 0.943 0.000 1.000
#> GSM258588 2 0.6343 0.809 0.160 0.840
#> GSM258589 2 0.0000 0.943 0.000 1.000
#> GSM258591 2 0.0000 0.943 0.000 1.000
#> GSM258592 2 0.6247 0.817 0.156 0.844
#> GSM258593 1 0.0376 0.880 0.996 0.004
#> GSM258595 1 0.9000 0.596 0.684 0.316
#> GSM258597 2 0.0000 0.943 0.000 1.000
#> GSM258598 2 0.0000 0.943 0.000 1.000
#> GSM258600 2 0.2236 0.920 0.036 0.964
#> GSM258601 2 0.3584 0.887 0.068 0.932
#> GSM258602 2 0.0000 0.943 0.000 1.000
#> GSM258604 1 0.9922 0.309 0.552 0.448
#> GSM258605 1 0.9710 0.362 0.600 0.400
#> GSM258606 2 0.0000 0.943 0.000 1.000
#> GSM258607 2 0.0000 0.943 0.000 1.000
#> GSM258608 2 0.0000 0.943 0.000 1.000
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> GSM258553 1 0.0000 0.9993 1.000 0.000 0.000
#> GSM258555 1 0.0000 0.9993 1.000 0.000 0.000
#> GSM258556 2 0.6225 0.6323 0.000 0.568 0.432
#> GSM258557 3 0.6297 0.5996 0.352 0.008 0.640
#> GSM258562 3 0.4750 0.7305 0.000 0.216 0.784
#> GSM258563 3 0.6154 0.5402 0.408 0.000 0.592
#> GSM258565 1 0.0000 0.9993 1.000 0.000 0.000
#> GSM258566 1 0.0000 0.9993 1.000 0.000 0.000
#> GSM258570 1 0.0000 0.9993 1.000 0.000 0.000
#> GSM258578 1 0.0000 0.9993 1.000 0.000 0.000
#> GSM258580 3 0.4750 0.7305 0.000 0.216 0.784
#> GSM258583 3 0.6235 0.4920 0.436 0.000 0.564
#> GSM258585 3 0.6379 0.5863 0.368 0.008 0.624
#> GSM258590 1 0.0000 0.9993 1.000 0.000 0.000
#> GSM258594 1 0.0000 0.9993 1.000 0.000 0.000
#> GSM258596 3 0.6225 0.5005 0.432 0.000 0.568
#> GSM258599 3 0.6225 0.5005 0.432 0.000 0.568
#> GSM258603 1 0.0237 0.9944 0.996 0.000 0.004
#> GSM258551 2 0.4750 0.7099 0.000 0.784 0.216
#> GSM258552 2 0.5178 0.5620 0.000 0.744 0.256
#> GSM258554 2 0.4654 0.7136 0.000 0.792 0.208
#> GSM258558 2 0.0000 0.7578 0.000 1.000 0.000
#> GSM258559 2 0.0000 0.7578 0.000 1.000 0.000
#> GSM258560 2 0.5397 0.4942 0.000 0.720 0.280
#> GSM258561 2 0.5058 0.7068 0.000 0.756 0.244
#> GSM258564 2 0.5785 0.6727 0.000 0.668 0.332
#> GSM258567 2 0.5733 0.4416 0.000 0.676 0.324
#> GSM258568 2 0.0000 0.7578 0.000 1.000 0.000
#> GSM258569 3 0.6062 0.7440 0.064 0.160 0.776
#> GSM258571 3 0.4796 0.7277 0.000 0.220 0.780
#> GSM258572 2 0.5497 0.5039 0.000 0.708 0.292
#> GSM258573 2 0.5678 0.6805 0.000 0.684 0.316
#> GSM258574 2 0.3619 0.6966 0.000 0.864 0.136
#> GSM258575 2 0.0747 0.7562 0.000 0.984 0.016
#> GSM258576 2 0.0237 0.7582 0.000 0.996 0.004
#> GSM258577 2 0.5591 0.4255 0.000 0.696 0.304
#> GSM258579 2 0.0747 0.7562 0.000 0.984 0.016
#> GSM258581 2 0.0747 0.7580 0.000 0.984 0.016
#> GSM258582 3 0.4750 0.7305 0.000 0.216 0.784
#> GSM258584 2 0.5591 0.4091 0.000 0.696 0.304
#> GSM258586 2 0.5859 0.6930 0.000 0.656 0.344
#> GSM258587 2 0.5706 0.6788 0.000 0.680 0.320
#> GSM258588 2 0.3116 0.7142 0.000 0.892 0.108
#> GSM258589 2 0.3686 0.6961 0.000 0.860 0.140
#> GSM258591 2 0.4796 0.7109 0.000 0.780 0.220
#> GSM258592 2 0.5882 0.3847 0.000 0.652 0.348
#> GSM258593 3 0.5465 0.6259 0.288 0.000 0.712
#> GSM258595 3 0.4750 0.7305 0.000 0.216 0.784
#> GSM258597 2 0.5785 0.6727 0.000 0.668 0.332
#> GSM258598 2 0.5785 0.6727 0.000 0.668 0.332
#> GSM258600 2 0.6252 0.0985 0.000 0.556 0.444
#> GSM258601 3 0.4887 0.7196 0.000 0.228 0.772
#> GSM258602 2 0.0000 0.7578 0.000 1.000 0.000
#> GSM258604 3 0.4842 0.7273 0.000 0.224 0.776
#> GSM258605 3 0.7596 0.7226 0.100 0.228 0.672
#> GSM258606 2 0.0000 0.7578 0.000 1.000 0.000
#> GSM258607 2 0.5785 0.6727 0.000 0.668 0.332
#> GSM258608 2 0.0592 0.7566 0.000 0.988 0.012
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> GSM258553 1 0.0000 0.820 1.000 0.000 0.000 0.000
#> GSM258555 1 0.0000 0.820 1.000 0.000 0.000 0.000
#> GSM258556 4 0.2450 0.719 0.000 0.016 0.072 0.912
#> GSM258557 1 0.5821 0.474 0.536 0.000 0.432 0.032
#> GSM258562 3 0.2002 0.938 0.000 0.044 0.936 0.020
#> GSM258563 1 0.6061 0.520 0.552 0.000 0.400 0.048
#> GSM258565 1 0.0000 0.820 1.000 0.000 0.000 0.000
#> GSM258566 1 0.0000 0.820 1.000 0.000 0.000 0.000
#> GSM258570 1 0.0000 0.820 1.000 0.000 0.000 0.000
#> GSM258578 1 0.0000 0.820 1.000 0.000 0.000 0.000
#> GSM258580 3 0.1182 0.901 0.000 0.016 0.968 0.016
#> GSM258583 1 0.4761 0.743 0.764 0.000 0.192 0.044
#> GSM258585 1 0.6368 0.504 0.540 0.004 0.400 0.056
#> GSM258590 1 0.0000 0.820 1.000 0.000 0.000 0.000
#> GSM258594 1 0.0000 0.820 1.000 0.000 0.000 0.000
#> GSM258596 1 0.5381 0.719 0.716 0.004 0.232 0.048
#> GSM258599 1 0.5203 0.720 0.720 0.000 0.232 0.048
#> GSM258603 1 0.0188 0.819 0.996 0.000 0.004 0.000
#> GSM258551 4 0.5151 0.622 0.000 0.464 0.004 0.532
#> GSM258552 2 0.5489 0.652 0.000 0.664 0.296 0.040
#> GSM258554 4 0.5151 0.622 0.000 0.464 0.004 0.532
#> GSM258558 2 0.0188 0.770 0.000 0.996 0.000 0.004
#> GSM258559 2 0.1557 0.780 0.000 0.944 0.056 0.000
#> GSM258560 2 0.4214 0.745 0.000 0.780 0.204 0.016
#> GSM258561 4 0.5602 0.663 0.000 0.408 0.024 0.568
#> GSM258564 4 0.2300 0.760 0.000 0.064 0.016 0.920
#> GSM258567 2 0.5466 0.656 0.000 0.668 0.292 0.040
#> GSM258568 2 0.0188 0.770 0.000 0.996 0.000 0.004
#> GSM258569 3 0.4050 0.797 0.016 0.148 0.824 0.012
#> GSM258571 3 0.1975 0.937 0.000 0.048 0.936 0.016
#> GSM258572 2 0.5578 0.631 0.000 0.648 0.312 0.040
#> GSM258573 4 0.4539 0.752 0.000 0.272 0.008 0.720
#> GSM258574 2 0.4932 0.713 0.000 0.728 0.240 0.032
#> GSM258575 2 0.0336 0.771 0.000 0.992 0.000 0.008
#> GSM258576 2 0.0188 0.770 0.000 0.996 0.000 0.004
#> GSM258577 2 0.4889 0.476 0.000 0.636 0.360 0.004
#> GSM258579 2 0.0469 0.771 0.000 0.988 0.000 0.012
#> GSM258581 2 0.0188 0.770 0.000 0.996 0.000 0.004
#> GSM258582 3 0.2002 0.938 0.000 0.044 0.936 0.020
#> GSM258584 2 0.3444 0.735 0.000 0.816 0.184 0.000
#> GSM258586 4 0.5478 0.543 0.000 0.056 0.248 0.696
#> GSM258587 4 0.4767 0.755 0.000 0.256 0.020 0.724
#> GSM258588 2 0.4964 0.711 0.000 0.724 0.244 0.032
#> GSM258589 2 0.5661 0.695 0.000 0.700 0.220 0.080
#> GSM258591 4 0.5586 0.627 0.000 0.452 0.020 0.528
#> GSM258592 2 0.5535 0.639 0.000 0.656 0.304 0.040
#> GSM258593 1 0.6265 0.492 0.532 0.004 0.416 0.048
#> GSM258595 3 0.1297 0.922 0.000 0.016 0.964 0.020
#> GSM258597 4 0.2662 0.767 0.000 0.084 0.016 0.900
#> GSM258598 4 0.2300 0.760 0.000 0.064 0.016 0.920
#> GSM258600 3 0.4046 0.823 0.000 0.124 0.828 0.048
#> GSM258601 3 0.2002 0.937 0.000 0.044 0.936 0.020
#> GSM258602 2 0.0336 0.773 0.000 0.992 0.008 0.000
#> GSM258604 3 0.1510 0.922 0.000 0.016 0.956 0.028
#> GSM258605 3 0.2335 0.932 0.000 0.060 0.920 0.020
#> GSM258606 2 0.0188 0.770 0.000 0.996 0.000 0.004
#> GSM258607 4 0.2466 0.757 0.000 0.056 0.028 0.916
#> GSM258608 2 0.1557 0.780 0.000 0.944 0.056 0.000
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> GSM258553 1 0.0000 1.000 1.000 0.000 0.000 0.000 0.000
#> GSM258555 1 0.0000 1.000 1.000 0.000 0.000 0.000 0.000
#> GSM258556 4 0.3231 0.734 0.000 0.000 0.196 0.800 0.004
#> GSM258557 5 0.0579 0.834 0.008 0.000 0.008 0.000 0.984
#> GSM258562 3 0.0510 0.869 0.000 0.000 0.984 0.000 0.016
#> GSM258563 5 0.0566 0.838 0.012 0.000 0.004 0.000 0.984
#> GSM258565 1 0.0000 1.000 1.000 0.000 0.000 0.000 0.000
#> GSM258566 1 0.0000 1.000 1.000 0.000 0.000 0.000 0.000
#> GSM258570 1 0.0000 1.000 1.000 0.000 0.000 0.000 0.000
#> GSM258578 1 0.0000 1.000 1.000 0.000 0.000 0.000 0.000
#> GSM258580 3 0.0404 0.868 0.000 0.000 0.988 0.000 0.012
#> GSM258583 5 0.3231 0.812 0.196 0.000 0.004 0.000 0.800
#> GSM258585 5 0.0693 0.836 0.008 0.000 0.012 0.000 0.980
#> GSM258590 1 0.0000 1.000 1.000 0.000 0.000 0.000 0.000
#> GSM258594 1 0.0000 1.000 1.000 0.000 0.000 0.000 0.000
#> GSM258596 5 0.3462 0.814 0.196 0.000 0.012 0.000 0.792
#> GSM258599 5 0.3462 0.814 0.196 0.000 0.012 0.000 0.792
#> GSM258603 1 0.0000 1.000 1.000 0.000 0.000 0.000 0.000
#> GSM258551 2 0.4538 0.271 0.000 0.564 0.004 0.428 0.004
#> GSM258552 3 0.1981 0.869 0.000 0.016 0.920 0.000 0.064
#> GSM258554 2 0.4531 0.281 0.000 0.568 0.004 0.424 0.004
#> GSM258558 2 0.0000 0.810 0.000 1.000 0.000 0.000 0.000
#> GSM258559 3 0.4310 0.518 0.000 0.392 0.604 0.000 0.004
#> GSM258560 3 0.3922 0.793 0.000 0.180 0.780 0.000 0.040
#> GSM258561 4 0.5191 0.485 0.000 0.244 0.080 0.672 0.004
#> GSM258564 4 0.0162 0.838 0.000 0.000 0.000 0.996 0.004
#> GSM258567 3 0.3492 0.825 0.000 0.016 0.796 0.000 0.188
#> GSM258568 2 0.0000 0.810 0.000 1.000 0.000 0.000 0.000
#> GSM258569 3 0.0566 0.869 0.000 0.004 0.984 0.000 0.012
#> GSM258571 3 0.1478 0.869 0.000 0.000 0.936 0.000 0.064
#> GSM258572 3 0.1549 0.872 0.000 0.016 0.944 0.000 0.040
#> GSM258573 4 0.1731 0.810 0.000 0.060 0.004 0.932 0.004
#> GSM258574 3 0.3527 0.832 0.000 0.024 0.804 0.000 0.172
#> GSM258575 2 0.0000 0.810 0.000 1.000 0.000 0.000 0.000
#> GSM258576 2 0.0000 0.810 0.000 1.000 0.000 0.000 0.000
#> GSM258577 3 0.4381 0.825 0.000 0.088 0.780 0.008 0.124
#> GSM258579 2 0.0000 0.810 0.000 1.000 0.000 0.000 0.000
#> GSM258581 2 0.0000 0.810 0.000 1.000 0.000 0.000 0.000
#> GSM258582 3 0.0510 0.869 0.000 0.000 0.984 0.000 0.016
#> GSM258584 3 0.4002 0.783 0.000 0.184 0.780 0.008 0.028
#> GSM258586 4 0.3766 0.662 0.000 0.000 0.268 0.728 0.004
#> GSM258587 4 0.3088 0.701 0.000 0.164 0.004 0.828 0.004
#> GSM258588 3 0.5791 0.681 0.000 0.196 0.616 0.000 0.188
#> GSM258589 3 0.0609 0.871 0.000 0.020 0.980 0.000 0.000
#> GSM258591 2 0.4538 0.270 0.000 0.564 0.004 0.428 0.004
#> GSM258592 3 0.3492 0.825 0.000 0.016 0.796 0.000 0.188
#> GSM258593 5 0.3519 0.718 0.008 0.000 0.216 0.000 0.776
#> GSM258595 3 0.0404 0.868 0.000 0.000 0.988 0.000 0.012
#> GSM258597 4 0.0000 0.837 0.000 0.000 0.000 1.000 0.000
#> GSM258598 4 0.0162 0.838 0.000 0.000 0.000 0.996 0.004
#> GSM258600 3 0.0290 0.868 0.000 0.000 0.992 0.000 0.008
#> GSM258601 3 0.0290 0.868 0.000 0.000 0.992 0.000 0.008
#> GSM258602 2 0.3109 0.604 0.000 0.800 0.200 0.000 0.000
#> GSM258604 3 0.1281 0.854 0.000 0.000 0.956 0.032 0.012
#> GSM258605 3 0.3210 0.817 0.000 0.000 0.788 0.000 0.212
#> GSM258606 2 0.0000 0.810 0.000 1.000 0.000 0.000 0.000
#> GSM258607 4 0.0162 0.838 0.000 0.000 0.000 0.996 0.004
#> GSM258608 3 0.3579 0.746 0.000 0.240 0.756 0.000 0.004
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> GSM258553 1 0.0000 0.9994 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM258555 1 0.0000 0.9994 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM258556 4 0.3488 0.6304 0.000 0.008 0.244 0.744 0.000 0.004
#> GSM258557 5 0.1802 0.8702 0.000 0.072 0.012 0.000 0.916 0.000
#> GSM258562 3 0.0748 0.6599 0.000 0.016 0.976 0.000 0.004 0.004
#> GSM258563 5 0.0000 0.9395 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM258565 1 0.0000 0.9994 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM258566 1 0.0000 0.9994 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM258570 1 0.0000 0.9994 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM258578 1 0.0000 0.9994 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM258580 3 0.0653 0.6598 0.000 0.004 0.980 0.000 0.012 0.004
#> GSM258583 5 0.0000 0.9395 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM258585 5 0.0291 0.9364 0.000 0.004 0.004 0.000 0.992 0.000
#> GSM258590 1 0.0000 0.9994 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM258594 1 0.0146 0.9953 0.996 0.000 0.000 0.000 0.004 0.000
#> GSM258596 5 0.0000 0.9395 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM258599 5 0.0000 0.9395 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM258603 1 0.0000 0.9994 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM258551 6 0.5561 0.4346 0.000 0.168 0.004 0.264 0.000 0.564
#> GSM258552 3 0.3862 0.3583 0.000 0.476 0.524 0.000 0.000 0.000
#> GSM258554 6 0.5561 0.4346 0.000 0.168 0.004 0.264 0.000 0.564
#> GSM258558 6 0.0000 0.7514 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM258559 2 0.4317 0.4189 0.000 0.572 0.016 0.004 0.000 0.408
#> GSM258560 3 0.5629 0.2809 0.000 0.324 0.524 0.000 0.004 0.148
#> GSM258561 6 0.6378 0.0506 0.000 0.168 0.032 0.396 0.000 0.404
#> GSM258564 4 0.0146 0.7636 0.000 0.000 0.000 0.996 0.000 0.004
#> GSM258567 3 0.3867 0.3565 0.000 0.488 0.512 0.000 0.000 0.000
#> GSM258568 6 0.0000 0.7514 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM258569 3 0.0837 0.6634 0.000 0.020 0.972 0.000 0.004 0.004
#> GSM258571 3 0.1967 0.6516 0.000 0.084 0.904 0.000 0.012 0.000
#> GSM258572 3 0.3862 0.3583 0.000 0.476 0.524 0.000 0.000 0.000
#> GSM258573 4 0.5297 0.4236 0.000 0.168 0.004 0.616 0.000 0.212
#> GSM258574 2 0.3468 0.2209 0.000 0.712 0.284 0.000 0.000 0.004
#> GSM258575 6 0.0000 0.7514 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM258576 6 0.0000 0.7514 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM258577 3 0.6027 0.1366 0.000 0.316 0.480 0.004 0.004 0.196
#> GSM258579 6 0.0000 0.7514 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM258581 6 0.0000 0.7514 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM258582 3 0.0972 0.6565 0.000 0.028 0.964 0.000 0.008 0.000
#> GSM258584 3 0.5983 0.0412 0.000 0.352 0.444 0.004 0.000 0.200
#> GSM258586 4 0.4507 0.5796 0.000 0.048 0.268 0.676 0.004 0.004
#> GSM258587 4 0.5667 0.2594 0.000 0.168 0.004 0.536 0.000 0.292
#> GSM258588 2 0.4282 0.5834 0.000 0.720 0.088 0.000 0.000 0.192
#> GSM258589 3 0.3163 0.5746 0.000 0.232 0.764 0.000 0.000 0.004
#> GSM258591 6 0.5578 0.4266 0.000 0.168 0.004 0.268 0.000 0.560
#> GSM258592 3 0.3867 0.3565 0.000 0.488 0.512 0.000 0.000 0.000
#> GSM258593 5 0.2823 0.7174 0.000 0.000 0.204 0.000 0.796 0.000
#> GSM258595 3 0.0748 0.6584 0.000 0.004 0.976 0.000 0.016 0.004
#> GSM258597 4 0.0508 0.7610 0.000 0.004 0.000 0.984 0.000 0.012
#> GSM258598 4 0.0000 0.7632 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM258600 3 0.2482 0.6254 0.000 0.148 0.848 0.000 0.004 0.000
#> GSM258601 3 0.0405 0.6634 0.000 0.004 0.988 0.000 0.008 0.000
#> GSM258602 6 0.2772 0.5960 0.000 0.180 0.000 0.004 0.000 0.816
#> GSM258604 3 0.0820 0.6553 0.000 0.016 0.972 0.000 0.012 0.000
#> GSM258605 3 0.4300 0.4919 0.000 0.080 0.712 0.000 0.208 0.000
#> GSM258606 6 0.0000 0.7514 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM258607 4 0.0146 0.7635 0.000 0.000 0.004 0.996 0.000 0.000
#> GSM258608 2 0.5441 0.5700 0.000 0.584 0.156 0.004 0.000 0.256
Heatmaps for the consensus matrix. It visualizes the probability of two samples to be in a same group.
consensus_heatmap(res, k = 2)
consensus_heatmap(res, k = 3)
consensus_heatmap(res, k = 4)
consensus_heatmap(res, k = 5)
consensus_heatmap(res, k = 6)
Heatmaps for the membership of samples in all partitions to see how consistent they are:
membership_heatmap(res, k = 2)
membership_heatmap(res, k = 3)
membership_heatmap(res, k = 4)
membership_heatmap(res, k = 5)
membership_heatmap(res, k = 6)
As soon as we have had the classes for columns, we can look for signatures which are significantly different between classes which can be candidate marks for certain classes. Following are the heatmaps for signatures.
Signature heatmaps where rows are scaled:
get_signatures(res, k = 2)
get_signatures(res, k = 3)
get_signatures(res, k = 4)
get_signatures(res, k = 5)
get_signatures(res, k = 6)
Signature heatmaps where rows are not scaled:
get_signatures(res, k = 2, scale_rows = FALSE)
get_signatures(res, k = 3, scale_rows = FALSE)
get_signatures(res, k = 4, scale_rows = FALSE)
get_signatures(res, k = 5, scale_rows = FALSE)
get_signatures(res, k = 6, scale_rows = FALSE)
Compare the overlap of signatures from different k:
compare_signatures(res)
get_signature()
returns a data frame invisibly. TO get the list of signatures, the function
call should be assigned to a variable explicitly. In following code, if plot
argument is set
to FALSE
, no heatmap is plotted while only the differential analysis is performed.
# code only for demonstration
tb = get_signature(res, k = ..., plot = FALSE)
An example of the output of tb
is:
#> which_row fdr mean_1 mean_2 scaled_mean_1 scaled_mean_2 km
#> 1 38 0.042760348 8.373488 9.131774 -0.5533452 0.5164555 1
#> 2 40 0.018707592 7.106213 8.469186 -0.6173731 0.5762149 1
#> 3 55 0.019134737 10.221463 11.207825 -0.6159697 0.5749050 1
#> 4 59 0.006059896 5.921854 7.869574 -0.6899429 0.6439467 1
#> 5 60 0.018055526 8.928898 10.211722 -0.6204761 0.5791110 1
#> 6 98 0.009384629 15.714769 14.887706 0.6635654 -0.6193277 2
...
The columns in tb
are:
which_row
: row indices corresponding to the input matrix.fdr
: FDR for the differential test. mean_x
: The mean value in group x.scaled_mean_x
: The mean value in group x after rows are scaled.km
: Row groups if k-means clustering is applied to rows.UMAP plot which shows how samples are separated.
dimension_reduction(res, k = 2, method = "UMAP")
dimension_reduction(res, k = 3, method = "UMAP")
dimension_reduction(res, k = 4, method = "UMAP")
dimension_reduction(res, k = 5, method = "UMAP")
dimension_reduction(res, k = 6, method = "UMAP")
Following heatmap shows how subgroups are split when increasing k
:
collect_classes(res)
Test correlation between subgroups and known annotations. If the known annotation is numeric, one-way ANOVA test is applied, and if the known annotation is discrete, chi-squared contingency table test is applied.
test_to_known_factors(res)
#> n disease.state(p) k
#> CV:mclust 54 7.96e-10 2
#> CV:mclust 51 3.27e-07 3
#> CV:mclust 55 2.22e-09 4
#> CV:mclust 54 1.11e-07 5
#> CV:mclust 42 2.82e-05 6
If matrix rows can be associated to genes, consider to use functional_enrichment(res,
...)
to perform function enrichment for the signature genes. See this vignette for more detailed explanations.
The object with results only for a single top-value method and a single partition method can be extracted as:
res = res_list["CV", "NMF"]
# you can also extract it by
# res = res_list["CV:NMF"]
A summary of res
and all the functions that can be applied to it:
res
#> A 'ConsensusPartition' object with k = 2, 3, 4, 5, 6.
#> On a matrix with 51941 rows and 58 columns.
#> Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'CV' method.
#> Subgroups are detected by 'NMF' method.
#> Performed in total 1250 partitions by row resampling.
#> Best k for subgroups seems to be 2.
#>
#> Following methods can be applied to this 'ConsensusPartition' object:
#> [1] "cola_report" "collect_classes" "collect_plots"
#> [4] "collect_stats" "colnames" "compare_signatures"
#> [7] "consensus_heatmap" "dimension_reduction" "functional_enrichment"
#> [10] "get_anno_col" "get_anno" "get_classes"
#> [13] "get_consensus" "get_matrix" "get_membership"
#> [16] "get_param" "get_signatures" "get_stats"
#> [19] "is_best_k" "is_stable_k" "membership_heatmap"
#> [22] "ncol" "nrow" "plot_ecdf"
#> [25] "rownames" "select_partition_number" "show"
#> [28] "suggest_best_k" "test_to_known_factors"
collect_plots()
function collects all the plots made from res
for all k
(number of partitions)
into one single page to provide an easy and fast comparison between different k
.
collect_plots(res)
The plots are:
k
and the heatmap of
predicted classes for each k
.k
.k
.k
.All the plots in panels can be made by individual functions and they are plotted later in this section.
select_partition_number()
produces several plots showing different
statistics for choosing “optimized” k
. There are following statistics:
k
;k
, the area increased is defined as \(A_k - A_{k-1}\).The detailed explanations of these statistics can be found in the cola vignette.
Generally speaking, lower PAC score, higher mean silhouette score or higher
concordance corresponds to better partition. Rand index and Jaccard index
measure how similar the current partition is compared to partition with k-1
.
If they are too similar, we won't accept k
is better than k-1
.
select_partition_number(res)
The numeric values for all these statistics can be obtained by get_stats()
.
get_stats(res)
#> k 1-PAC mean_silhouette concordance area_increased Rand Jaccard
#> 2 2 0.997 0.966 0.985 0.4536 0.552 0.552
#> 3 3 0.684 0.832 0.916 0.4709 0.696 0.488
#> 4 4 0.738 0.853 0.904 0.1341 0.857 0.603
#> 5 5 0.879 0.843 0.919 0.0689 0.921 0.694
#> 6 6 0.817 0.653 0.840 0.0372 0.938 0.698
suggest_best_k()
suggests the best \(k\) based on these statistics. The rules are as follows:
suggest_best_k(res)
#> [1] 2
Following shows the table of the partitions (You need to click the show/hide
code output link to see it). The membership matrix (columns with name p*
)
is inferred by
clue::cl_consensus()
function with the SE
method. Basically the value in the membership matrix
represents the probability to belong to a certain group. The finall class
label for an item is determined with the group with highest probability it
belongs to.
In get_classes()
function, the entropy is calculated from the membership
matrix and the silhouette score is calculated from the consensus matrix.
cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#> class entropy silhouette p1 p2
#> GSM258553 1 0.0000 0.988 1.000 0.000
#> GSM258555 1 0.0000 0.988 1.000 0.000
#> GSM258556 2 0.0000 0.982 0.000 1.000
#> GSM258557 1 0.0000 0.988 1.000 0.000
#> GSM258562 1 0.4298 0.909 0.912 0.088
#> GSM258563 1 0.0000 0.988 1.000 0.000
#> GSM258565 1 0.0000 0.988 1.000 0.000
#> GSM258566 1 0.0000 0.988 1.000 0.000
#> GSM258570 1 0.0000 0.988 1.000 0.000
#> GSM258578 1 0.0000 0.988 1.000 0.000
#> GSM258580 2 0.3274 0.927 0.060 0.940
#> GSM258583 1 0.0000 0.988 1.000 0.000
#> GSM258585 1 0.0000 0.988 1.000 0.000
#> GSM258590 1 0.0000 0.988 1.000 0.000
#> GSM258594 1 0.0000 0.988 1.000 0.000
#> GSM258596 1 0.0000 0.988 1.000 0.000
#> GSM258599 1 0.0000 0.988 1.000 0.000
#> GSM258603 1 0.0000 0.988 1.000 0.000
#> GSM258551 2 0.0000 0.982 0.000 1.000
#> GSM258552 2 0.0000 0.982 0.000 1.000
#> GSM258554 2 0.0000 0.982 0.000 1.000
#> GSM258558 2 0.0000 0.982 0.000 1.000
#> GSM258559 2 0.0000 0.982 0.000 1.000
#> GSM258560 2 0.0000 0.982 0.000 1.000
#> GSM258561 2 0.0000 0.982 0.000 1.000
#> GSM258564 2 0.0000 0.982 0.000 1.000
#> GSM258567 2 0.0000 0.982 0.000 1.000
#> GSM258568 2 0.0000 0.982 0.000 1.000
#> GSM258569 2 0.7056 0.766 0.192 0.808
#> GSM258571 2 0.9491 0.419 0.368 0.632
#> GSM258572 2 0.0000 0.982 0.000 1.000
#> GSM258573 2 0.0000 0.982 0.000 1.000
#> GSM258574 2 0.0000 0.982 0.000 1.000
#> GSM258575 2 0.0000 0.982 0.000 1.000
#> GSM258576 2 0.0000 0.982 0.000 1.000
#> GSM258577 2 0.0000 0.982 0.000 1.000
#> GSM258579 2 0.0000 0.982 0.000 1.000
#> GSM258581 2 0.0000 0.982 0.000 1.000
#> GSM258582 1 0.3274 0.940 0.940 0.060
#> GSM258584 2 0.0000 0.982 0.000 1.000
#> GSM258586 2 0.0000 0.982 0.000 1.000
#> GSM258587 2 0.0000 0.982 0.000 1.000
#> GSM258588 2 0.0000 0.982 0.000 1.000
#> GSM258589 2 0.0000 0.982 0.000 1.000
#> GSM258591 2 0.0000 0.982 0.000 1.000
#> GSM258592 2 0.0000 0.982 0.000 1.000
#> GSM258593 1 0.0000 0.988 1.000 0.000
#> GSM258595 2 0.0938 0.972 0.012 0.988
#> GSM258597 2 0.0000 0.982 0.000 1.000
#> GSM258598 2 0.0000 0.982 0.000 1.000
#> GSM258600 2 0.0000 0.982 0.000 1.000
#> GSM258601 2 0.0000 0.982 0.000 1.000
#> GSM258602 2 0.0000 0.982 0.000 1.000
#> GSM258604 2 0.2778 0.940 0.048 0.952
#> GSM258605 1 0.3274 0.940 0.940 0.060
#> GSM258606 2 0.0000 0.982 0.000 1.000
#> GSM258607 2 0.0000 0.982 0.000 1.000
#> GSM258608 2 0.0000 0.982 0.000 1.000
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> GSM258553 1 0.0000 0.9633 1.000 0.000 0.000
#> GSM258555 1 0.0000 0.9633 1.000 0.000 0.000
#> GSM258556 2 0.5706 0.4752 0.000 0.680 0.320
#> GSM258557 3 0.6308 0.0972 0.492 0.000 0.508
#> GSM258562 3 0.2537 0.8477 0.080 0.000 0.920
#> GSM258563 1 0.0000 0.9633 1.000 0.000 0.000
#> GSM258565 1 0.0000 0.9633 1.000 0.000 0.000
#> GSM258566 1 0.0000 0.9633 1.000 0.000 0.000
#> GSM258570 1 0.0000 0.9633 1.000 0.000 0.000
#> GSM258578 1 0.0000 0.9633 1.000 0.000 0.000
#> GSM258580 3 0.4047 0.7760 0.004 0.148 0.848
#> GSM258583 1 0.0000 0.9633 1.000 0.000 0.000
#> GSM258585 1 0.3752 0.8202 0.856 0.000 0.144
#> GSM258590 1 0.0000 0.9633 1.000 0.000 0.000
#> GSM258594 1 0.0000 0.9633 1.000 0.000 0.000
#> GSM258596 1 0.0000 0.9633 1.000 0.000 0.000
#> GSM258599 1 0.0000 0.9633 1.000 0.000 0.000
#> GSM258603 1 0.0000 0.9633 1.000 0.000 0.000
#> GSM258551 2 0.0424 0.8740 0.000 0.992 0.008
#> GSM258552 3 0.0237 0.8838 0.000 0.004 0.996
#> GSM258554 2 0.0747 0.8738 0.000 0.984 0.016
#> GSM258558 2 0.3267 0.8751 0.000 0.884 0.116
#> GSM258559 2 0.3267 0.8751 0.000 0.884 0.116
#> GSM258560 3 0.0237 0.8838 0.000 0.004 0.996
#> GSM258561 2 0.1753 0.8653 0.000 0.952 0.048
#> GSM258564 2 0.1753 0.8653 0.000 0.952 0.048
#> GSM258567 3 0.1753 0.8695 0.000 0.048 0.952
#> GSM258568 2 0.3267 0.8751 0.000 0.884 0.116
#> GSM258569 3 0.0000 0.8840 0.000 0.000 1.000
#> GSM258571 3 0.3267 0.8313 0.000 0.116 0.884
#> GSM258572 3 0.0000 0.8840 0.000 0.000 1.000
#> GSM258573 2 0.0424 0.8736 0.000 0.992 0.008
#> GSM258574 3 0.1753 0.8692 0.000 0.048 0.952
#> GSM258575 2 0.3267 0.8751 0.000 0.884 0.116
#> GSM258576 2 0.3267 0.8751 0.000 0.884 0.116
#> GSM258577 3 0.1031 0.8808 0.000 0.024 0.976
#> GSM258579 2 0.3267 0.8751 0.000 0.884 0.116
#> GSM258581 2 0.3267 0.8751 0.000 0.884 0.116
#> GSM258582 3 0.3921 0.8406 0.036 0.080 0.884
#> GSM258584 3 0.5138 0.6344 0.000 0.252 0.748
#> GSM258586 2 0.6309 -0.1226 0.000 0.504 0.496
#> GSM258587 2 0.0892 0.8731 0.000 0.980 0.020
#> GSM258588 3 0.5859 0.4267 0.000 0.344 0.656
#> GSM258589 3 0.1289 0.8783 0.000 0.032 0.968
#> GSM258591 2 0.1031 0.8723 0.000 0.976 0.024
#> GSM258592 3 0.1643 0.8704 0.000 0.044 0.956
#> GSM258593 1 0.5810 0.4630 0.664 0.000 0.336
#> GSM258595 3 0.2703 0.8654 0.016 0.056 0.928
#> GSM258597 2 0.1753 0.8653 0.000 0.952 0.048
#> GSM258598 2 0.1753 0.8653 0.000 0.952 0.048
#> GSM258600 3 0.0000 0.8840 0.000 0.000 1.000
#> GSM258601 3 0.2796 0.8493 0.000 0.092 0.908
#> GSM258602 2 0.3267 0.8751 0.000 0.884 0.116
#> GSM258604 3 0.3267 0.8313 0.000 0.116 0.884
#> GSM258605 3 0.1643 0.8737 0.044 0.000 0.956
#> GSM258606 2 0.3267 0.8751 0.000 0.884 0.116
#> GSM258607 2 0.1964 0.8611 0.000 0.944 0.056
#> GSM258608 2 0.3267 0.8751 0.000 0.884 0.116
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> GSM258553 1 0.0000 0.976 1.000 0.000 0.000 0.000
#> GSM258555 1 0.0000 0.976 1.000 0.000 0.000 0.000
#> GSM258556 4 0.1209 0.936 0.000 0.004 0.032 0.964
#> GSM258557 3 0.5273 0.143 0.456 0.008 0.536 0.000
#> GSM258562 3 0.0000 0.827 0.000 0.000 1.000 0.000
#> GSM258563 1 0.0188 0.975 0.996 0.004 0.000 0.000
#> GSM258565 1 0.0000 0.976 1.000 0.000 0.000 0.000
#> GSM258566 1 0.0000 0.976 1.000 0.000 0.000 0.000
#> GSM258570 1 0.0000 0.976 1.000 0.000 0.000 0.000
#> GSM258578 1 0.0000 0.976 1.000 0.000 0.000 0.000
#> GSM258580 3 0.3945 0.684 0.000 0.216 0.780 0.004
#> GSM258583 1 0.0188 0.975 0.996 0.004 0.000 0.000
#> GSM258585 1 0.5025 0.607 0.716 0.032 0.252 0.000
#> GSM258590 1 0.0000 0.976 1.000 0.000 0.000 0.000
#> GSM258594 1 0.0000 0.976 1.000 0.000 0.000 0.000
#> GSM258596 1 0.0188 0.975 0.996 0.004 0.000 0.000
#> GSM258599 1 0.0188 0.975 0.996 0.004 0.000 0.000
#> GSM258603 1 0.0000 0.976 1.000 0.000 0.000 0.000
#> GSM258551 4 0.2760 0.825 0.000 0.128 0.000 0.872
#> GSM258552 3 0.0000 0.827 0.000 0.000 1.000 0.000
#> GSM258554 4 0.1716 0.906 0.000 0.064 0.000 0.936
#> GSM258558 2 0.2868 0.919 0.000 0.864 0.000 0.136
#> GSM258559 2 0.0188 0.831 0.000 0.996 0.000 0.004
#> GSM258560 3 0.4661 0.657 0.000 0.348 0.652 0.000
#> GSM258561 4 0.1022 0.939 0.000 0.032 0.000 0.968
#> GSM258564 4 0.0000 0.958 0.000 0.000 0.000 1.000
#> GSM258567 3 0.4431 0.721 0.000 0.304 0.696 0.000
#> GSM258568 2 0.2868 0.919 0.000 0.864 0.000 0.136
#> GSM258569 3 0.0000 0.827 0.000 0.000 1.000 0.000
#> GSM258571 3 0.2760 0.820 0.000 0.128 0.872 0.000
#> GSM258572 3 0.0000 0.827 0.000 0.000 1.000 0.000
#> GSM258573 4 0.0000 0.958 0.000 0.000 0.000 1.000
#> GSM258574 2 0.4843 0.391 0.000 0.604 0.396 0.000
#> GSM258575 2 0.2868 0.919 0.000 0.864 0.000 0.136
#> GSM258576 2 0.2868 0.919 0.000 0.864 0.000 0.136
#> GSM258577 3 0.4304 0.693 0.000 0.284 0.716 0.000
#> GSM258579 2 0.2868 0.919 0.000 0.864 0.000 0.136
#> GSM258581 2 0.2868 0.919 0.000 0.864 0.000 0.136
#> GSM258582 3 0.2760 0.820 0.000 0.128 0.872 0.000
#> GSM258584 2 0.0188 0.827 0.000 0.996 0.004 0.000
#> GSM258586 4 0.2530 0.863 0.000 0.004 0.100 0.896
#> GSM258587 4 0.0000 0.958 0.000 0.000 0.000 1.000
#> GSM258588 2 0.2924 0.835 0.000 0.884 0.100 0.016
#> GSM258589 3 0.4543 0.505 0.000 0.324 0.676 0.000
#> GSM258591 4 0.0000 0.958 0.000 0.000 0.000 1.000
#> GSM258592 3 0.3764 0.792 0.000 0.216 0.784 0.000
#> GSM258593 3 0.3539 0.708 0.176 0.004 0.820 0.000
#> GSM258595 3 0.0000 0.827 0.000 0.000 1.000 0.000
#> GSM258597 4 0.0000 0.958 0.000 0.000 0.000 1.000
#> GSM258598 4 0.0000 0.958 0.000 0.000 0.000 1.000
#> GSM258600 3 0.0000 0.827 0.000 0.000 1.000 0.000
#> GSM258601 3 0.3217 0.820 0.000 0.128 0.860 0.012
#> GSM258602 2 0.2704 0.917 0.000 0.876 0.000 0.124
#> GSM258604 3 0.5842 0.713 0.000 0.128 0.704 0.168
#> GSM258605 3 0.2814 0.820 0.000 0.132 0.868 0.000
#> GSM258606 2 0.2814 0.919 0.000 0.868 0.000 0.132
#> GSM258607 4 0.0376 0.955 0.000 0.004 0.004 0.992
#> GSM258608 2 0.2944 0.918 0.000 0.868 0.004 0.128
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> GSM258553 1 0.0000 0.9529 1.000 0.000 0.000 0.000 0.000
#> GSM258555 1 0.0000 0.9529 1.000 0.000 0.000 0.000 0.000
#> GSM258556 4 0.0290 0.9536 0.000 0.000 0.000 0.992 0.008
#> GSM258557 5 0.4855 0.1186 0.436 0.004 0.016 0.000 0.544
#> GSM258562 5 0.2248 0.8324 0.000 0.000 0.088 0.012 0.900
#> GSM258563 1 0.1372 0.9363 0.956 0.004 0.016 0.000 0.024
#> GSM258565 1 0.0000 0.9529 1.000 0.000 0.000 0.000 0.000
#> GSM258566 1 0.0000 0.9529 1.000 0.000 0.000 0.000 0.000
#> GSM258570 1 0.0000 0.9529 1.000 0.000 0.000 0.000 0.000
#> GSM258578 1 0.0000 0.9529 1.000 0.000 0.000 0.000 0.000
#> GSM258580 5 0.3086 0.7933 0.000 0.092 0.040 0.004 0.864
#> GSM258583 1 0.1372 0.9363 0.956 0.004 0.016 0.000 0.024
#> GSM258585 1 0.5262 0.1926 0.536 0.008 0.032 0.000 0.424
#> GSM258590 1 0.0000 0.9529 1.000 0.000 0.000 0.000 0.000
#> GSM258594 1 0.0000 0.9529 1.000 0.000 0.000 0.000 0.000
#> GSM258596 1 0.0865 0.9432 0.972 0.000 0.004 0.000 0.024
#> GSM258599 1 0.1372 0.9363 0.956 0.004 0.016 0.000 0.024
#> GSM258603 1 0.0000 0.9529 1.000 0.000 0.000 0.000 0.000
#> GSM258551 4 0.3282 0.7868 0.000 0.188 0.000 0.804 0.008
#> GSM258552 5 0.1043 0.8523 0.000 0.000 0.040 0.000 0.960
#> GSM258554 4 0.2873 0.8608 0.000 0.128 0.016 0.856 0.000
#> GSM258558 2 0.1041 0.9054 0.000 0.964 0.032 0.004 0.000
#> GSM258559 2 0.4306 0.0829 0.000 0.508 0.492 0.000 0.000
#> GSM258560 3 0.3399 0.7624 0.000 0.020 0.812 0.000 0.168
#> GSM258561 4 0.0510 0.9516 0.000 0.000 0.016 0.984 0.000
#> GSM258564 4 0.0290 0.9536 0.000 0.000 0.000 0.992 0.008
#> GSM258567 3 0.1478 0.8595 0.000 0.064 0.936 0.000 0.000
#> GSM258568 2 0.0162 0.9140 0.000 0.996 0.000 0.004 0.000
#> GSM258569 5 0.1121 0.8515 0.000 0.000 0.044 0.000 0.956
#> GSM258571 3 0.1792 0.8811 0.000 0.000 0.916 0.000 0.084
#> GSM258572 5 0.0880 0.8533 0.000 0.000 0.032 0.000 0.968
#> GSM258573 4 0.1469 0.9404 0.000 0.036 0.016 0.948 0.000
#> GSM258574 5 0.1668 0.8468 0.000 0.032 0.028 0.000 0.940
#> GSM258575 2 0.0162 0.9140 0.000 0.996 0.000 0.004 0.000
#> GSM258576 2 0.0162 0.9140 0.000 0.996 0.000 0.004 0.000
#> GSM258577 5 0.4860 0.0509 0.000 0.004 0.440 0.016 0.540
#> GSM258579 2 0.0324 0.9123 0.000 0.992 0.000 0.004 0.004
#> GSM258581 2 0.0162 0.9140 0.000 0.996 0.000 0.004 0.000
#> GSM258582 3 0.2773 0.8332 0.000 0.000 0.836 0.000 0.164
#> GSM258584 3 0.1732 0.8471 0.000 0.080 0.920 0.000 0.000
#> GSM258586 4 0.0290 0.9536 0.000 0.000 0.000 0.992 0.008
#> GSM258587 4 0.1018 0.9502 0.000 0.016 0.016 0.968 0.000
#> GSM258588 2 0.3523 0.7980 0.000 0.832 0.044 0.004 0.120
#> GSM258589 5 0.2595 0.8202 0.000 0.032 0.080 0.000 0.888
#> GSM258591 4 0.1300 0.9460 0.000 0.028 0.016 0.956 0.000
#> GSM258592 3 0.1399 0.8784 0.000 0.028 0.952 0.000 0.020
#> GSM258593 5 0.1059 0.8373 0.008 0.004 0.020 0.000 0.968
#> GSM258595 5 0.1121 0.8527 0.000 0.000 0.044 0.000 0.956
#> GSM258597 4 0.0510 0.9516 0.000 0.000 0.016 0.984 0.000
#> GSM258598 4 0.0000 0.9537 0.000 0.000 0.000 1.000 0.000
#> GSM258600 5 0.1331 0.8501 0.000 0.000 0.040 0.008 0.952
#> GSM258601 3 0.2221 0.8751 0.000 0.000 0.912 0.052 0.036
#> GSM258602 2 0.2011 0.8778 0.000 0.908 0.088 0.004 0.000
#> GSM258604 3 0.3906 0.8030 0.000 0.000 0.800 0.132 0.068
#> GSM258605 3 0.1792 0.8797 0.000 0.000 0.916 0.000 0.084
#> GSM258606 2 0.0162 0.9140 0.000 0.996 0.000 0.004 0.000
#> GSM258607 4 0.0290 0.9536 0.000 0.000 0.000 0.992 0.008
#> GSM258608 2 0.1704 0.8899 0.000 0.928 0.068 0.004 0.000
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> GSM258553 1 0.0000 0.9135 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM258555 1 0.0000 0.9135 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM258556 4 0.0146 0.8926 0.000 0.000 0.000 0.996 0.004 0.000
#> GSM258557 5 0.6335 0.1001 0.300 0.156 0.044 0.000 0.500 0.000
#> GSM258562 2 0.2501 0.8295 0.000 0.888 0.028 0.012 0.072 0.000
#> GSM258563 1 0.4715 0.2619 0.508 0.004 0.036 0.000 0.452 0.000
#> GSM258565 1 0.0000 0.9135 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM258566 1 0.0000 0.9135 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM258570 1 0.0000 0.9135 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM258578 1 0.0000 0.9135 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM258580 2 0.2635 0.8113 0.000 0.880 0.004 0.004 0.036 0.076
#> GSM258583 1 0.3999 0.6136 0.696 0.000 0.032 0.000 0.272 0.000
#> GSM258585 5 0.6947 0.2172 0.212 0.216 0.068 0.000 0.492 0.012
#> GSM258590 1 0.0000 0.9135 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM258594 1 0.0000 0.9135 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM258596 1 0.1657 0.8724 0.928 0.000 0.016 0.000 0.056 0.000
#> GSM258599 1 0.2221 0.8489 0.896 0.000 0.032 0.000 0.072 0.000
#> GSM258603 1 0.0000 0.9135 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM258551 4 0.2257 0.8032 0.000 0.000 0.000 0.876 0.116 0.008
#> GSM258552 2 0.1644 0.8414 0.000 0.932 0.040 0.000 0.028 0.000
#> GSM258554 4 0.2038 0.8774 0.000 0.000 0.032 0.920 0.028 0.020
#> GSM258558 6 0.1267 0.7661 0.000 0.000 0.000 0.000 0.060 0.940
#> GSM258559 5 0.5958 0.0239 0.000 0.000 0.248 0.000 0.448 0.304
#> GSM258560 5 0.5725 -0.3037 0.000 0.076 0.432 0.000 0.460 0.032
#> GSM258561 4 0.1141 0.8783 0.000 0.000 0.052 0.948 0.000 0.000
#> GSM258564 4 0.0146 0.8926 0.000 0.000 0.000 0.996 0.004 0.000
#> GSM258567 3 0.4072 0.2740 0.000 0.000 0.544 0.000 0.448 0.008
#> GSM258568 6 0.0405 0.7888 0.000 0.000 0.000 0.004 0.008 0.988
#> GSM258569 2 0.2597 0.7573 0.000 0.824 0.176 0.000 0.000 0.000
#> GSM258571 3 0.1003 0.7312 0.000 0.020 0.964 0.016 0.000 0.000
#> GSM258572 2 0.0790 0.8434 0.000 0.968 0.000 0.000 0.032 0.000
#> GSM258573 4 0.3958 0.7109 0.000 0.000 0.020 0.756 0.028 0.196
#> GSM258574 2 0.3141 0.7570 0.000 0.828 0.020 0.000 0.140 0.012
#> GSM258575 6 0.0632 0.7829 0.000 0.000 0.000 0.000 0.024 0.976
#> GSM258576 6 0.0000 0.7894 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM258577 5 0.5271 -0.1083 0.000 0.456 0.052 0.020 0.472 0.000
#> GSM258579 6 0.1082 0.7740 0.000 0.004 0.000 0.000 0.040 0.956
#> GSM258581 6 0.0000 0.7894 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM258582 3 0.1610 0.6980 0.000 0.084 0.916 0.000 0.000 0.000
#> GSM258584 5 0.4172 0.0730 0.000 0.000 0.280 0.000 0.680 0.040
#> GSM258586 4 0.0260 0.8916 0.000 0.000 0.000 0.992 0.008 0.000
#> GSM258587 4 0.5105 0.2428 0.000 0.000 0.032 0.520 0.028 0.420
#> GSM258588 6 0.6047 0.1614 0.000 0.160 0.016 0.000 0.360 0.464
#> GSM258589 2 0.2302 0.7969 0.000 0.872 0.000 0.000 0.120 0.008
#> GSM258591 6 0.5293 -0.1026 0.000 0.000 0.044 0.436 0.028 0.492
#> GSM258592 3 0.4204 0.2719 0.000 0.004 0.540 0.000 0.448 0.008
#> GSM258593 2 0.1794 0.8278 0.000 0.924 0.036 0.000 0.040 0.000
#> GSM258595 2 0.3636 0.5800 0.000 0.676 0.320 0.000 0.004 0.000
#> GSM258597 4 0.1485 0.8830 0.000 0.000 0.024 0.944 0.028 0.004
#> GSM258598 4 0.0458 0.8916 0.000 0.000 0.000 0.984 0.016 0.000
#> GSM258600 2 0.0405 0.8448 0.000 0.988 0.000 0.004 0.008 0.000
#> GSM258601 3 0.1679 0.7243 0.000 0.016 0.936 0.036 0.012 0.000
#> GSM258602 6 0.4002 0.3036 0.000 0.000 0.008 0.000 0.404 0.588
#> GSM258604 3 0.1536 0.7152 0.000 0.016 0.940 0.040 0.004 0.000
#> GSM258605 3 0.2070 0.7026 0.000 0.044 0.908 0.000 0.048 0.000
#> GSM258606 6 0.0363 0.7887 0.000 0.000 0.000 0.000 0.012 0.988
#> GSM258607 4 0.0146 0.8926 0.000 0.000 0.000 0.996 0.004 0.000
#> GSM258608 5 0.2340 0.3328 0.000 0.000 0.000 0.000 0.852 0.148
Heatmaps for the consensus matrix. It visualizes the probability of two samples to be in a same group.
consensus_heatmap(res, k = 2)
consensus_heatmap(res, k = 3)
consensus_heatmap(res, k = 4)
consensus_heatmap(res, k = 5)
consensus_heatmap(res, k = 6)
Heatmaps for the membership of samples in all partitions to see how consistent they are:
membership_heatmap(res, k = 2)
membership_heatmap(res, k = 3)
membership_heatmap(res, k = 4)
membership_heatmap(res, k = 5)
membership_heatmap(res, k = 6)
As soon as we have had the classes for columns, we can look for signatures which are significantly different between classes which can be candidate marks for certain classes. Following are the heatmaps for signatures.
Signature heatmaps where rows are scaled:
get_signatures(res, k = 2)
get_signatures(res, k = 3)
get_signatures(res, k = 4)
get_signatures(res, k = 5)
get_signatures(res, k = 6)
Signature heatmaps where rows are not scaled:
get_signatures(res, k = 2, scale_rows = FALSE)
get_signatures(res, k = 3, scale_rows = FALSE)
get_signatures(res, k = 4, scale_rows = FALSE)
get_signatures(res, k = 5, scale_rows = FALSE)
get_signatures(res, k = 6, scale_rows = FALSE)
Compare the overlap of signatures from different k:
compare_signatures(res)
get_signature()
returns a data frame invisibly. TO get the list of signatures, the function
call should be assigned to a variable explicitly. In following code, if plot
argument is set
to FALSE
, no heatmap is plotted while only the differential analysis is performed.
# code only for demonstration
tb = get_signature(res, k = ..., plot = FALSE)
An example of the output of tb
is:
#> which_row fdr mean_1 mean_2 scaled_mean_1 scaled_mean_2 km
#> 1 38 0.042760348 8.373488 9.131774 -0.5533452 0.5164555 1
#> 2 40 0.018707592 7.106213 8.469186 -0.6173731 0.5762149 1
#> 3 55 0.019134737 10.221463 11.207825 -0.6159697 0.5749050 1
#> 4 59 0.006059896 5.921854 7.869574 -0.6899429 0.6439467 1
#> 5 60 0.018055526 8.928898 10.211722 -0.6204761 0.5791110 1
#> 6 98 0.009384629 15.714769 14.887706 0.6635654 -0.6193277 2
...
The columns in tb
are:
which_row
: row indices corresponding to the input matrix.fdr
: FDR for the differential test. mean_x
: The mean value in group x.scaled_mean_x
: The mean value in group x after rows are scaled.km
: Row groups if k-means clustering is applied to rows.UMAP plot which shows how samples are separated.
dimension_reduction(res, k = 2, method = "UMAP")
dimension_reduction(res, k = 3, method = "UMAP")
dimension_reduction(res, k = 4, method = "UMAP")
dimension_reduction(res, k = 5, method = "UMAP")
dimension_reduction(res, k = 6, method = "UMAP")
Following heatmap shows how subgroups are split when increasing k
:
collect_classes(res)
Test correlation between subgroups and known annotations. If the known annotation is numeric, one-way ANOVA test is applied, and if the known annotation is discrete, chi-squared contingency table test is applied.
test_to_known_factors(res)
#> n disease.state(p) k
#> CV:NMF 57 9.33e-09 2
#> CV:NMF 53 2.16e-10 3
#> CV:NMF 56 2.17e-09 4
#> CV:NMF 54 1.72e-08 5
#> CV:NMF 44 1.27e-06 6
If matrix rows can be associated to genes, consider to use functional_enrichment(res,
...)
to perform function enrichment for the signature genes. See this vignette for more detailed explanations.
The object with results only for a single top-value method and a single partition method can be extracted as:
res = res_list["MAD", "hclust"]
# you can also extract it by
# res = res_list["MAD:hclust"]
A summary of res
and all the functions that can be applied to it:
res
#> A 'ConsensusPartition' object with k = 2, 3, 4, 5, 6.
#> On a matrix with 51941 rows and 58 columns.
#> Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'MAD' method.
#> Subgroups are detected by 'hclust' method.
#> Performed in total 1250 partitions by row resampling.
#> Best k for subgroups seems to be 2.
#>
#> Following methods can be applied to this 'ConsensusPartition' object:
#> [1] "cola_report" "collect_classes" "collect_plots"
#> [4] "collect_stats" "colnames" "compare_signatures"
#> [7] "consensus_heatmap" "dimension_reduction" "functional_enrichment"
#> [10] "get_anno_col" "get_anno" "get_classes"
#> [13] "get_consensus" "get_matrix" "get_membership"
#> [16] "get_param" "get_signatures" "get_stats"
#> [19] "is_best_k" "is_stable_k" "membership_heatmap"
#> [22] "ncol" "nrow" "plot_ecdf"
#> [25] "rownames" "select_partition_number" "show"
#> [28] "suggest_best_k" "test_to_known_factors"
collect_plots()
function collects all the plots made from res
for all k
(number of partitions)
into one single page to provide an easy and fast comparison between different k
.
collect_plots(res)
The plots are:
k
and the heatmap of
predicted classes for each k
.k
.k
.k
.All the plots in panels can be made by individual functions and they are plotted later in this section.
select_partition_number()
produces several plots showing different
statistics for choosing “optimized” k
. There are following statistics:
k
;k
, the area increased is defined as \(A_k - A_{k-1}\).The detailed explanations of these statistics can be found in the cola vignette.
Generally speaking, lower PAC score, higher mean silhouette score or higher
concordance corresponds to better partition. Rand index and Jaccard index
measure how similar the current partition is compared to partition with k-1
.
If they are too similar, we won't accept k
is better than k-1
.
select_partition_number(res)
The numeric values for all these statistics can be obtained by get_stats()
.
get_stats(res)
#> k 1-PAC mean_silhouette concordance area_increased Rand Jaccard
#> 2 2 0.308 0.790 0.875 0.4669 0.501 0.501
#> 3 3 0.341 0.689 0.799 0.3290 0.879 0.758
#> 4 4 0.509 0.515 0.717 0.1665 0.872 0.673
#> 5 5 0.577 0.499 0.697 0.0681 0.881 0.621
#> 6 6 0.636 0.548 0.704 0.0574 0.862 0.496
suggest_best_k()
suggests the best \(k\) based on these statistics. The rules are as follows:
suggest_best_k(res)
#> [1] 2
Following shows the table of the partitions (You need to click the show/hide
code output link to see it). The membership matrix (columns with name p*
)
is inferred by
clue::cl_consensus()
function with the SE
method. Basically the value in the membership matrix
represents the probability to belong to a certain group. The finall class
label for an item is determined with the group with highest probability it
belongs to.
In get_classes()
function, the entropy is calculated from the membership
matrix and the silhouette score is calculated from the consensus matrix.
cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#> class entropy silhouette p1 p2
#> GSM258553 1 0.0000 0.876 1.000 0.000
#> GSM258555 1 0.0000 0.876 1.000 0.000
#> GSM258556 2 0.7883 0.788 0.236 0.764
#> GSM258557 1 0.7528 0.713 0.784 0.216
#> GSM258562 1 0.3733 0.858 0.928 0.072
#> GSM258563 1 0.7528 0.713 0.784 0.216
#> GSM258565 1 0.0000 0.876 1.000 0.000
#> GSM258566 1 0.0000 0.876 1.000 0.000
#> GSM258570 1 0.0000 0.876 1.000 0.000
#> GSM258578 1 0.0000 0.876 1.000 0.000
#> GSM258580 1 0.3733 0.858 0.928 0.072
#> GSM258583 1 0.7528 0.713 0.784 0.216
#> GSM258585 1 0.7528 0.713 0.784 0.216
#> GSM258590 1 0.0000 0.876 1.000 0.000
#> GSM258594 1 0.0000 0.876 1.000 0.000
#> GSM258596 1 0.7528 0.713 0.784 0.216
#> GSM258599 1 0.7528 0.713 0.784 0.216
#> GSM258603 1 0.0000 0.876 1.000 0.000
#> GSM258551 2 0.0672 0.816 0.008 0.992
#> GSM258552 2 0.9248 0.634 0.340 0.660
#> GSM258554 2 0.0000 0.812 0.000 1.000
#> GSM258558 2 0.0672 0.813 0.008 0.992
#> GSM258559 2 0.6712 0.819 0.176 0.824
#> GSM258560 2 0.9286 0.643 0.344 0.656
#> GSM258561 2 0.7219 0.814 0.200 0.800
#> GSM258564 2 0.7139 0.813 0.196 0.804
#> GSM258567 2 0.8955 0.687 0.312 0.688
#> GSM258568 2 0.1414 0.813 0.020 0.980
#> GSM258569 1 0.4161 0.850 0.916 0.084
#> GSM258571 1 0.1633 0.876 0.976 0.024
#> GSM258572 2 0.8144 0.766 0.252 0.748
#> GSM258573 2 0.1414 0.813 0.020 0.980
#> GSM258574 2 0.7139 0.809 0.196 0.804
#> GSM258575 2 0.5408 0.829 0.124 0.876
#> GSM258576 2 0.1414 0.813 0.020 0.980
#> GSM258577 2 0.6623 0.821 0.172 0.828
#> GSM258579 2 0.0000 0.812 0.000 1.000
#> GSM258581 2 0.1414 0.813 0.020 0.980
#> GSM258582 1 0.1633 0.876 0.976 0.024
#> GSM258584 2 0.7883 0.780 0.236 0.764
#> GSM258586 2 0.7745 0.794 0.228 0.772
#> GSM258587 2 0.1414 0.813 0.020 0.980
#> GSM258588 2 0.7745 0.788 0.228 0.772
#> GSM258589 2 0.8608 0.731 0.284 0.716
#> GSM258591 2 0.1633 0.820 0.024 0.976
#> GSM258592 2 1.0000 0.224 0.496 0.504
#> GSM258593 1 0.4161 0.850 0.916 0.084
#> GSM258595 1 0.8909 0.459 0.692 0.308
#> GSM258597 2 0.1414 0.813 0.020 0.980
#> GSM258598 2 0.1414 0.813 0.020 0.980
#> GSM258600 2 0.8608 0.731 0.284 0.716
#> GSM258601 1 0.2778 0.870 0.952 0.048
#> GSM258602 2 0.6247 0.827 0.156 0.844
#> GSM258604 1 0.5842 0.793 0.860 0.140
#> GSM258605 1 0.2043 0.875 0.968 0.032
#> GSM258606 2 0.6148 0.827 0.152 0.848
#> GSM258607 2 0.7815 0.791 0.232 0.768
#> GSM258608 2 0.3431 0.828 0.064 0.936
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> GSM258553 1 0.0237 0.7897 0.996 0.004 0.000
#> GSM258555 1 0.0237 0.7897 0.996 0.004 0.000
#> GSM258556 3 0.4709 0.7622 0.056 0.092 0.852
#> GSM258557 1 0.5754 0.5962 0.700 0.004 0.296
#> GSM258562 1 0.5987 0.7268 0.756 0.036 0.208
#> GSM258563 1 0.5754 0.5962 0.700 0.004 0.296
#> GSM258565 1 0.0237 0.7897 0.996 0.004 0.000
#> GSM258566 1 0.0237 0.7897 0.996 0.004 0.000
#> GSM258570 1 0.0237 0.7897 0.996 0.004 0.000
#> GSM258578 1 0.0237 0.7897 0.996 0.004 0.000
#> GSM258580 1 0.5987 0.7268 0.756 0.036 0.208
#> GSM258583 1 0.5529 0.5963 0.704 0.000 0.296
#> GSM258585 1 0.5754 0.5962 0.700 0.004 0.296
#> GSM258590 1 0.0237 0.7897 0.996 0.004 0.000
#> GSM258594 1 0.0237 0.7897 0.996 0.004 0.000
#> GSM258596 1 0.5465 0.6042 0.712 0.000 0.288
#> GSM258599 1 0.5722 0.5997 0.704 0.004 0.292
#> GSM258603 1 0.0237 0.7897 0.996 0.004 0.000
#> GSM258551 3 0.5968 0.4554 0.000 0.364 0.636
#> GSM258552 3 0.6091 0.7120 0.124 0.092 0.784
#> GSM258554 3 0.6180 0.3336 0.000 0.416 0.584
#> GSM258558 3 0.6111 0.3700 0.000 0.396 0.604
#> GSM258559 3 0.3412 0.7325 0.000 0.124 0.876
#> GSM258560 3 0.4544 0.7262 0.084 0.056 0.860
#> GSM258561 3 0.5574 0.7377 0.032 0.184 0.784
#> GSM258564 3 0.5267 0.7560 0.044 0.140 0.816
#> GSM258567 3 0.5505 0.7305 0.096 0.088 0.816
#> GSM258568 2 0.3816 0.8065 0.000 0.852 0.148
#> GSM258569 1 0.6276 0.7107 0.736 0.040 0.224
#> GSM258571 1 0.5222 0.7644 0.816 0.040 0.144
#> GSM258572 3 0.6037 0.7539 0.112 0.100 0.788
#> GSM258573 2 0.1753 0.8803 0.000 0.952 0.048
#> GSM258574 3 0.5377 0.7654 0.068 0.112 0.820
#> GSM258575 3 0.6482 0.5976 0.024 0.296 0.680
#> GSM258576 2 0.2959 0.8679 0.000 0.900 0.100
#> GSM258577 3 0.2448 0.7498 0.000 0.076 0.924
#> GSM258579 2 0.6286 -0.0622 0.000 0.536 0.464
#> GSM258581 2 0.2959 0.8679 0.000 0.900 0.100
#> GSM258582 1 0.5222 0.7644 0.816 0.040 0.144
#> GSM258584 3 0.2590 0.7421 0.004 0.072 0.924
#> GSM258586 3 0.4505 0.7625 0.048 0.092 0.860
#> GSM258587 2 0.1753 0.8803 0.000 0.952 0.048
#> GSM258588 3 0.5407 0.7636 0.076 0.104 0.820
#> GSM258589 3 0.5848 0.7445 0.124 0.080 0.796
#> GSM258591 3 0.6225 0.3114 0.000 0.432 0.568
#> GSM258592 3 0.6337 0.4950 0.220 0.044 0.736
#> GSM258593 1 0.5921 0.7231 0.756 0.032 0.212
#> GSM258595 1 0.7138 0.3227 0.540 0.024 0.436
#> GSM258597 2 0.1753 0.8803 0.000 0.952 0.048
#> GSM258598 2 0.1753 0.8803 0.000 0.952 0.048
#> GSM258600 3 0.5848 0.7445 0.124 0.080 0.796
#> GSM258601 1 0.6348 0.7347 0.740 0.048 0.212
#> GSM258602 3 0.7097 0.6467 0.052 0.280 0.668
#> GSM258604 1 0.7260 0.6179 0.636 0.048 0.316
#> GSM258605 1 0.6106 0.7448 0.756 0.044 0.200
#> GSM258606 3 0.7246 0.6189 0.052 0.300 0.648
#> GSM258607 3 0.4945 0.7596 0.056 0.104 0.840
#> GSM258608 3 0.4842 0.6604 0.000 0.224 0.776
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> GSM258553 1 0.0000 0.76065 1.000 0.000 0.000 0.000
#> GSM258555 1 0.0000 0.76065 1.000 0.000 0.000 0.000
#> GSM258556 2 0.5853 0.45114 0.000 0.508 0.460 0.032
#> GSM258557 1 0.5769 0.59012 0.652 0.292 0.056 0.000
#> GSM258562 1 0.6810 0.58431 0.596 0.248 0.156 0.000
#> GSM258563 1 0.5769 0.59012 0.652 0.292 0.056 0.000
#> GSM258565 1 0.0000 0.76065 1.000 0.000 0.000 0.000
#> GSM258566 1 0.0000 0.76065 1.000 0.000 0.000 0.000
#> GSM258570 1 0.0000 0.76065 1.000 0.000 0.000 0.000
#> GSM258578 1 0.0000 0.76065 1.000 0.000 0.000 0.000
#> GSM258580 1 0.6810 0.58431 0.596 0.248 0.156 0.000
#> GSM258583 1 0.5745 0.59016 0.656 0.288 0.056 0.000
#> GSM258585 1 0.5769 0.59012 0.652 0.292 0.056 0.000
#> GSM258590 1 0.0000 0.76065 1.000 0.000 0.000 0.000
#> GSM258594 1 0.0000 0.76065 1.000 0.000 0.000 0.000
#> GSM258596 1 0.5649 0.59643 0.664 0.284 0.052 0.000
#> GSM258599 1 0.5745 0.59288 0.656 0.288 0.056 0.000
#> GSM258603 1 0.0000 0.76065 1.000 0.000 0.000 0.000
#> GSM258551 3 0.7064 0.29674 0.000 0.164 0.556 0.280
#> GSM258552 3 0.3569 0.38185 0.000 0.196 0.804 0.000
#> GSM258554 3 0.7368 0.20295 0.000 0.164 0.460 0.376
#> GSM258558 3 0.6945 0.30558 0.000 0.136 0.552 0.312
#> GSM258559 2 0.6852 0.36981 0.000 0.556 0.320 0.124
#> GSM258560 2 0.5212 0.40868 0.000 0.572 0.420 0.008
#> GSM258561 2 0.7323 0.46573 0.000 0.484 0.352 0.164
#> GSM258564 2 0.6602 0.44545 0.000 0.484 0.436 0.080
#> GSM258567 3 0.3725 0.36928 0.008 0.180 0.812 0.000
#> GSM258568 4 0.2623 0.74662 0.000 0.064 0.028 0.908
#> GSM258569 1 0.7001 0.56084 0.576 0.244 0.180 0.000
#> GSM258571 1 0.5540 0.69165 0.728 0.164 0.108 0.000
#> GSM258572 3 0.1209 0.45408 0.000 0.032 0.964 0.004
#> GSM258573 4 0.0336 0.79516 0.000 0.008 0.000 0.992
#> GSM258574 3 0.2300 0.40674 0.000 0.064 0.920 0.016
#> GSM258575 3 0.6993 0.31058 0.004 0.152 0.588 0.256
#> GSM258576 4 0.2021 0.78311 0.000 0.040 0.024 0.936
#> GSM258577 3 0.5386 0.00358 0.000 0.344 0.632 0.024
#> GSM258579 4 0.6813 0.07363 0.000 0.104 0.380 0.516
#> GSM258581 4 0.2021 0.78311 0.000 0.040 0.024 0.936
#> GSM258582 1 0.5540 0.69165 0.728 0.164 0.108 0.000
#> GSM258584 2 0.5403 0.35833 0.000 0.628 0.348 0.024
#> GSM258586 2 0.5859 0.44361 0.000 0.496 0.472 0.032
#> GSM258587 4 0.0707 0.79420 0.000 0.020 0.000 0.980
#> GSM258588 3 0.4010 0.39576 0.000 0.100 0.836 0.064
#> GSM258589 3 0.2384 0.44799 0.004 0.072 0.916 0.008
#> GSM258591 4 0.7835 -0.15994 0.000 0.268 0.336 0.396
#> GSM258592 2 0.6949 0.29502 0.124 0.528 0.348 0.000
#> GSM258593 1 0.6897 0.57607 0.592 0.228 0.180 0.000
#> GSM258595 3 0.7444 -0.21217 0.428 0.120 0.440 0.012
#> GSM258597 4 0.0707 0.79420 0.000 0.020 0.000 0.980
#> GSM258598 4 0.0707 0.79420 0.000 0.020 0.000 0.980
#> GSM258600 3 0.2384 0.44799 0.004 0.072 0.916 0.008
#> GSM258601 1 0.6027 0.64941 0.660 0.252 0.088 0.000
#> GSM258602 2 0.7831 0.38486 0.000 0.408 0.280 0.312
#> GSM258604 1 0.7113 0.49969 0.552 0.276 0.172 0.000
#> GSM258605 1 0.5940 0.65998 0.672 0.240 0.088 0.000
#> GSM258606 2 0.7852 0.36800 0.000 0.392 0.276 0.332
#> GSM258607 2 0.6068 0.45443 0.000 0.508 0.448 0.044
#> GSM258608 3 0.6167 0.31571 0.000 0.208 0.668 0.124
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> GSM258553 1 0.0000 0.708 1.000 0.000 0.000 0.000 0.000
#> GSM258555 1 0.0000 0.708 1.000 0.000 0.000 0.000 0.000
#> GSM258556 5 0.7344 0.200 0.000 0.312 0.300 0.024 0.364
#> GSM258557 1 0.5697 0.569 0.620 0.016 0.288 0.000 0.076
#> GSM258562 5 0.4865 0.250 0.356 0.020 0.008 0.000 0.616
#> GSM258563 1 0.5697 0.569 0.620 0.016 0.288 0.000 0.076
#> GSM258565 1 0.0000 0.708 1.000 0.000 0.000 0.000 0.000
#> GSM258566 1 0.0000 0.708 1.000 0.000 0.000 0.000 0.000
#> GSM258570 1 0.0000 0.708 1.000 0.000 0.000 0.000 0.000
#> GSM258578 1 0.0000 0.708 1.000 0.000 0.000 0.000 0.000
#> GSM258580 5 0.4865 0.250 0.356 0.020 0.008 0.000 0.616
#> GSM258583 1 0.5644 0.571 0.624 0.016 0.288 0.000 0.072
#> GSM258585 1 0.5697 0.569 0.620 0.016 0.288 0.000 0.076
#> GSM258590 1 0.0000 0.708 1.000 0.000 0.000 0.000 0.000
#> GSM258594 1 0.0000 0.708 1.000 0.000 0.000 0.000 0.000
#> GSM258596 1 0.5530 0.577 0.632 0.012 0.284 0.000 0.072
#> GSM258599 1 0.5678 0.573 0.624 0.016 0.284 0.000 0.076
#> GSM258603 1 0.0000 0.708 1.000 0.000 0.000 0.000 0.000
#> GSM258551 2 0.5279 0.450 0.000 0.680 0.052 0.244 0.024
#> GSM258552 2 0.4697 0.420 0.000 0.648 0.032 0.000 0.320
#> GSM258554 2 0.5616 0.390 0.000 0.576 0.040 0.360 0.024
#> GSM258558 2 0.4875 0.451 0.000 0.668 0.016 0.292 0.024
#> GSM258559 3 0.5940 0.482 0.000 0.348 0.544 0.104 0.004
#> GSM258560 3 0.5807 0.473 0.000 0.256 0.612 0.004 0.128
#> GSM258561 3 0.8191 0.139 0.000 0.216 0.408 0.152 0.224
#> GSM258564 5 0.7915 0.176 0.000 0.292 0.284 0.072 0.352
#> GSM258567 2 0.5204 0.371 0.008 0.680 0.236 0.000 0.076
#> GSM258568 4 0.2608 0.857 0.000 0.020 0.088 0.888 0.004
#> GSM258569 5 0.5209 0.238 0.368 0.036 0.008 0.000 0.588
#> GSM258571 1 0.5833 0.554 0.684 0.044 0.148 0.000 0.124
#> GSM258572 2 0.3649 0.505 0.000 0.808 0.040 0.000 0.152
#> GSM258573 4 0.0290 0.935 0.000 0.008 0.000 0.992 0.000
#> GSM258574 2 0.2949 0.498 0.000 0.876 0.052 0.004 0.068
#> GSM258575 2 0.6017 0.350 0.000 0.624 0.108 0.244 0.024
#> GSM258576 4 0.2110 0.900 0.000 0.072 0.016 0.912 0.000
#> GSM258577 2 0.3968 0.237 0.000 0.768 0.204 0.004 0.024
#> GSM258579 2 0.4748 0.102 0.000 0.492 0.016 0.492 0.000
#> GSM258581 4 0.2110 0.900 0.000 0.072 0.016 0.912 0.000
#> GSM258582 1 0.5833 0.554 0.684 0.044 0.148 0.000 0.124
#> GSM258584 3 0.4389 0.477 0.000 0.368 0.624 0.004 0.004
#> GSM258586 5 0.7355 0.191 0.000 0.328 0.300 0.024 0.348
#> GSM258587 4 0.0324 0.936 0.000 0.000 0.004 0.992 0.004
#> GSM258588 2 0.5421 0.425 0.000 0.720 0.152 0.052 0.076
#> GSM258589 2 0.4359 0.492 0.004 0.752 0.048 0.000 0.196
#> GSM258591 2 0.7496 0.167 0.000 0.404 0.088 0.384 0.124
#> GSM258592 3 0.6434 0.432 0.092 0.148 0.644 0.000 0.116
#> GSM258593 5 0.4920 0.226 0.384 0.032 0.000 0.000 0.584
#> GSM258595 1 0.7820 -0.310 0.332 0.296 0.060 0.000 0.312
#> GSM258597 4 0.0324 0.936 0.000 0.000 0.004 0.992 0.004
#> GSM258598 4 0.0324 0.936 0.000 0.000 0.004 0.992 0.004
#> GSM258600 2 0.4359 0.492 0.004 0.752 0.048 0.000 0.196
#> GSM258601 1 0.5984 0.530 0.628 0.028 0.248 0.000 0.096
#> GSM258602 3 0.7613 0.504 0.000 0.148 0.460 0.296 0.096
#> GSM258604 1 0.7278 0.361 0.516 0.108 0.272 0.000 0.104
#> GSM258605 1 0.6042 0.536 0.632 0.028 0.228 0.000 0.112
#> GSM258606 3 0.7605 0.487 0.000 0.140 0.448 0.316 0.096
#> GSM258607 5 0.7516 0.200 0.000 0.308 0.292 0.036 0.364
#> GSM258608 2 0.4118 0.463 0.000 0.812 0.060 0.104 0.024
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> GSM258553 1 0.0000 0.999 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM258555 1 0.0000 0.999 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM258556 4 0.3925 0.556 0.000 0.260 0.008 0.716 0.012 0.004
#> GSM258557 3 0.5162 0.445 0.336 0.012 0.580 0.000 0.072 0.000
#> GSM258562 5 0.1418 0.836 0.032 0.000 0.024 0.000 0.944 0.000
#> GSM258563 3 0.5162 0.445 0.336 0.012 0.580 0.000 0.072 0.000
#> GSM258565 1 0.0000 0.999 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM258566 1 0.0000 0.999 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM258570 1 0.0000 0.999 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM258578 1 0.0000 0.999 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM258580 5 0.1418 0.836 0.032 0.000 0.024 0.000 0.944 0.000
#> GSM258583 3 0.5127 0.442 0.340 0.012 0.580 0.000 0.068 0.000
#> GSM258585 3 0.5162 0.445 0.336 0.012 0.580 0.000 0.072 0.000
#> GSM258590 1 0.0146 0.994 0.996 0.000 0.004 0.000 0.000 0.000
#> GSM258594 1 0.0000 0.999 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM258596 3 0.5059 0.433 0.348 0.008 0.576 0.000 0.068 0.000
#> GSM258599 3 0.5174 0.442 0.340 0.012 0.576 0.000 0.072 0.000
#> GSM258603 1 0.0000 0.999 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM258551 2 0.5752 0.466 0.000 0.608 0.084 0.064 0.000 0.244
#> GSM258552 2 0.4183 0.490 0.000 0.692 0.036 0.004 0.268 0.000
#> GSM258554 2 0.5719 0.350 0.000 0.524 0.084 0.032 0.000 0.360
#> GSM258558 2 0.5363 0.460 0.000 0.608 0.056 0.044 0.000 0.292
#> GSM258559 3 0.7125 -0.125 0.000 0.300 0.396 0.228 0.004 0.072
#> GSM258560 3 0.6513 -0.122 0.000 0.288 0.416 0.276 0.016 0.004
#> GSM258561 4 0.6474 0.406 0.000 0.200 0.120 0.568 0.004 0.108
#> GSM258564 4 0.4296 0.546 0.000 0.244 0.000 0.700 0.004 0.052
#> GSM258567 2 0.4648 0.512 0.000 0.740 0.116 0.108 0.036 0.000
#> GSM258568 6 0.2342 0.768 0.000 0.020 0.004 0.088 0.000 0.888
#> GSM258569 5 0.2832 0.824 0.056 0.016 0.040 0.008 0.880 0.000
#> GSM258571 3 0.5773 0.301 0.332 0.016 0.552 0.016 0.084 0.000
#> GSM258572 2 0.2887 0.573 0.000 0.856 0.032 0.008 0.104 0.000
#> GSM258573 6 0.0260 0.835 0.000 0.000 0.000 0.008 0.000 0.992
#> GSM258574 2 0.2045 0.563 0.000 0.920 0.028 0.024 0.028 0.000
#> GSM258575 2 0.6546 0.466 0.000 0.576 0.072 0.128 0.020 0.204
#> GSM258576 6 0.2614 0.801 0.000 0.060 0.012 0.044 0.000 0.884
#> GSM258577 2 0.4457 0.385 0.000 0.704 0.228 0.056 0.000 0.012
#> GSM258579 6 0.5776 -0.153 0.000 0.432 0.052 0.056 0.000 0.460
#> GSM258581 6 0.2614 0.801 0.000 0.060 0.012 0.044 0.000 0.884
#> GSM258582 3 0.5773 0.301 0.332 0.016 0.552 0.016 0.084 0.000
#> GSM258584 3 0.6318 -0.044 0.000 0.316 0.448 0.220 0.004 0.012
#> GSM258586 4 0.3810 0.547 0.000 0.276 0.008 0.708 0.004 0.004
#> GSM258587 6 0.0777 0.835 0.000 0.000 0.004 0.024 0.000 0.972
#> GSM258588 2 0.4203 0.540 0.000 0.784 0.040 0.132 0.028 0.016
#> GSM258589 2 0.4030 0.549 0.000 0.776 0.032 0.040 0.152 0.000
#> GSM258591 2 0.7300 0.115 0.000 0.352 0.096 0.208 0.004 0.340
#> GSM258592 3 0.6530 0.106 0.000 0.192 0.528 0.208 0.072 0.000
#> GSM258593 5 0.2504 0.823 0.104 0.012 0.004 0.004 0.876 0.000
#> GSM258595 5 0.6804 0.450 0.080 0.264 0.032 0.092 0.532 0.000
#> GSM258597 6 0.0777 0.835 0.000 0.000 0.004 0.024 0.000 0.972
#> GSM258598 6 0.0777 0.835 0.000 0.000 0.004 0.024 0.000 0.972
#> GSM258600 2 0.4030 0.549 0.000 0.776 0.032 0.040 0.152 0.000
#> GSM258601 3 0.5284 0.359 0.288 0.004 0.616 0.020 0.072 0.000
#> GSM258602 4 0.7967 0.106 0.000 0.200 0.260 0.280 0.012 0.248
#> GSM258604 3 0.7201 0.344 0.264 0.072 0.504 0.084 0.076 0.000
#> GSM258605 3 0.4788 0.359 0.288 0.004 0.636 0.000 0.072 0.000
#> GSM258606 4 0.7957 0.105 0.000 0.192 0.256 0.272 0.012 0.268
#> GSM258607 4 0.4146 0.559 0.000 0.248 0.008 0.716 0.012 0.016
#> GSM258608 2 0.4604 0.511 0.000 0.752 0.088 0.056 0.000 0.104
Heatmaps for the consensus matrix. It visualizes the probability of two samples to be in a same group.
consensus_heatmap(res, k = 2)
consensus_heatmap(res, k = 3)
consensus_heatmap(res, k = 4)
consensus_heatmap(res, k = 5)
consensus_heatmap(res, k = 6)
Heatmaps for the membership of samples in all partitions to see how consistent they are:
membership_heatmap(res, k = 2)
membership_heatmap(res, k = 3)
membership_heatmap(res, k = 4)
membership_heatmap(res, k = 5)
membership_heatmap(res, k = 6)
As soon as we have had the classes for columns, we can look for signatures which are significantly different between classes which can be candidate marks for certain classes. Following are the heatmaps for signatures.
Signature heatmaps where rows are scaled:
get_signatures(res, k = 2)
get_signatures(res, k = 3)
get_signatures(res, k = 4)
get_signatures(res, k = 5)
get_signatures(res, k = 6)
Signature heatmaps where rows are not scaled:
get_signatures(res, k = 2, scale_rows = FALSE)
get_signatures(res, k = 3, scale_rows = FALSE)
get_signatures(res, k = 4, scale_rows = FALSE)
get_signatures(res, k = 5, scale_rows = FALSE)
get_signatures(res, k = 6, scale_rows = FALSE)
Compare the overlap of signatures from different k:
compare_signatures(res)
get_signature()
returns a data frame invisibly. TO get the list of signatures, the function
call should be assigned to a variable explicitly. In following code, if plot
argument is set
to FALSE
, no heatmap is plotted while only the differential analysis is performed.
# code only for demonstration
tb = get_signature(res, k = ..., plot = FALSE)
An example of the output of tb
is:
#> which_row fdr mean_1 mean_2 scaled_mean_1 scaled_mean_2 km
#> 1 38 0.042760348 8.373488 9.131774 -0.5533452 0.5164555 1
#> 2 40 0.018707592 7.106213 8.469186 -0.6173731 0.5762149 1
#> 3 55 0.019134737 10.221463 11.207825 -0.6159697 0.5749050 1
#> 4 59 0.006059896 5.921854 7.869574 -0.6899429 0.6439467 1
#> 5 60 0.018055526 8.928898 10.211722 -0.6204761 0.5791110 1
#> 6 98 0.009384629 15.714769 14.887706 0.6635654 -0.6193277 2
...
The columns in tb
are:
which_row
: row indices corresponding to the input matrix.fdr
: FDR for the differential test. mean_x
: The mean value in group x.scaled_mean_x
: The mean value in group x after rows are scaled.km
: Row groups if k-means clustering is applied to rows.UMAP plot which shows how samples are separated.
dimension_reduction(res, k = 2, method = "UMAP")
dimension_reduction(res, k = 3, method = "UMAP")
dimension_reduction(res, k = 4, method = "UMAP")
dimension_reduction(res, k = 5, method = "UMAP")
dimension_reduction(res, k = 6, method = "UMAP")
Following heatmap shows how subgroups are split when increasing k
:
collect_classes(res)
Test correlation between subgroups and known annotations. If the known annotation is numeric, one-way ANOVA test is applied, and if the known annotation is discrete, chi-squared contingency table test is applied.
test_to_known_factors(res)
#> n disease.state(p) k
#> MAD:hclust 56 3.78e-07 2
#> MAD:hclust 51 3.49e-06 3
#> MAD:hclust 30 2.53e-03 4
#> MAD:hclust 28 1.57e-03 5
#> MAD:hclust 31 9.50e-05 6
If matrix rows can be associated to genes, consider to use functional_enrichment(res,
...)
to perform function enrichment for the signature genes. See this vignette for more detailed explanations.
The object with results only for a single top-value method and a single partition method can be extracted as:
res = res_list["MAD", "kmeans"]
# you can also extract it by
# res = res_list["MAD:kmeans"]
A summary of res
and all the functions that can be applied to it:
res
#> A 'ConsensusPartition' object with k = 2, 3, 4, 5, 6.
#> On a matrix with 51941 rows and 58 columns.
#> Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'MAD' method.
#> Subgroups are detected by 'kmeans' method.
#> Performed in total 1250 partitions by row resampling.
#> Best k for subgroups seems to be 2.
#>
#> Following methods can be applied to this 'ConsensusPartition' object:
#> [1] "cola_report" "collect_classes" "collect_plots"
#> [4] "collect_stats" "colnames" "compare_signatures"
#> [7] "consensus_heatmap" "dimension_reduction" "functional_enrichment"
#> [10] "get_anno_col" "get_anno" "get_classes"
#> [13] "get_consensus" "get_matrix" "get_membership"
#> [16] "get_param" "get_signatures" "get_stats"
#> [19] "is_best_k" "is_stable_k" "membership_heatmap"
#> [22] "ncol" "nrow" "plot_ecdf"
#> [25] "rownames" "select_partition_number" "show"
#> [28] "suggest_best_k" "test_to_known_factors"
collect_plots()
function collects all the plots made from res
for all k
(number of partitions)
into one single page to provide an easy and fast comparison between different k
.
collect_plots(res)
The plots are:
k
and the heatmap of
predicted classes for each k
.k
.k
.k
.All the plots in panels can be made by individual functions and they are plotted later in this section.
select_partition_number()
produces several plots showing different
statistics for choosing “optimized” k
. There are following statistics:
k
;k
, the area increased is defined as \(A_k - A_{k-1}\).The detailed explanations of these statistics can be found in the cola vignette.
Generally speaking, lower PAC score, higher mean silhouette score or higher
concordance corresponds to better partition. Rand index and Jaccard index
measure how similar the current partition is compared to partition with k-1
.
If they are too similar, we won't accept k
is better than k-1
.
select_partition_number(res)
The numeric values for all these statistics can be obtained by get_stats()
.
get_stats(res)
#> k 1-PAC mean_silhouette concordance area_increased Rand Jaccard
#> 2 2 0.964 0.946 0.979 0.4862 0.513 0.513
#> 3 3 0.720 0.851 0.918 0.3676 0.666 0.434
#> 4 4 0.630 0.660 0.792 0.1261 0.863 0.617
#> 5 5 0.648 0.501 0.724 0.0691 0.978 0.913
#> 6 6 0.673 0.434 0.685 0.0419 0.896 0.592
suggest_best_k()
suggests the best \(k\) based on these statistics. The rules are as follows:
suggest_best_k(res)
#> [1] 2
Following shows the table of the partitions (You need to click the show/hide
code output link to see it). The membership matrix (columns with name p*
)
is inferred by
clue::cl_consensus()
function with the SE
method. Basically the value in the membership matrix
represents the probability to belong to a certain group. The finall class
label for an item is determined with the group with highest probability it
belongs to.
In get_classes()
function, the entropy is calculated from the membership
matrix and the silhouette score is calculated from the consensus matrix.
cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#> class entropy silhouette p1 p2
#> GSM258553 1 0.0000 0.971 1.000 0.000
#> GSM258555 1 0.0000 0.971 1.000 0.000
#> GSM258556 2 0.0000 0.981 0.000 1.000
#> GSM258557 1 0.0000 0.971 1.000 0.000
#> GSM258562 1 0.0000 0.971 1.000 0.000
#> GSM258563 1 0.0000 0.971 1.000 0.000
#> GSM258565 1 0.0000 0.971 1.000 0.000
#> GSM258566 1 0.0000 0.971 1.000 0.000
#> GSM258570 1 0.0000 0.971 1.000 0.000
#> GSM258578 1 0.0000 0.971 1.000 0.000
#> GSM258580 1 0.6973 0.757 0.812 0.188
#> GSM258583 1 0.0000 0.971 1.000 0.000
#> GSM258585 1 0.0000 0.971 1.000 0.000
#> GSM258590 1 0.0000 0.971 1.000 0.000
#> GSM258594 1 0.0000 0.971 1.000 0.000
#> GSM258596 1 0.0000 0.971 1.000 0.000
#> GSM258599 1 0.0000 0.971 1.000 0.000
#> GSM258603 1 0.0000 0.971 1.000 0.000
#> GSM258551 2 0.0000 0.981 0.000 1.000
#> GSM258552 2 0.0000 0.981 0.000 1.000
#> GSM258554 2 0.0000 0.981 0.000 1.000
#> GSM258558 2 0.0000 0.981 0.000 1.000
#> GSM258559 2 0.0000 0.981 0.000 1.000
#> GSM258560 2 0.0000 0.981 0.000 1.000
#> GSM258561 2 0.0000 0.981 0.000 1.000
#> GSM258564 2 0.0000 0.981 0.000 1.000
#> GSM258567 2 0.1184 0.967 0.016 0.984
#> GSM258568 2 0.0000 0.981 0.000 1.000
#> GSM258569 1 0.9732 0.314 0.596 0.404
#> GSM258571 1 0.0000 0.971 1.000 0.000
#> GSM258572 2 0.0000 0.981 0.000 1.000
#> GSM258573 2 0.0000 0.981 0.000 1.000
#> GSM258574 2 0.0000 0.981 0.000 1.000
#> GSM258575 2 0.0000 0.981 0.000 1.000
#> GSM258576 2 0.0000 0.981 0.000 1.000
#> GSM258577 2 0.0000 0.981 0.000 1.000
#> GSM258579 2 0.0000 0.981 0.000 1.000
#> GSM258581 2 0.0000 0.981 0.000 1.000
#> GSM258582 1 0.0000 0.971 1.000 0.000
#> GSM258584 2 0.0000 0.981 0.000 1.000
#> GSM258586 2 0.0000 0.981 0.000 1.000
#> GSM258587 2 0.0000 0.981 0.000 1.000
#> GSM258588 2 0.0000 0.981 0.000 1.000
#> GSM258589 2 0.0000 0.981 0.000 1.000
#> GSM258591 2 0.0000 0.981 0.000 1.000
#> GSM258592 2 0.1184 0.967 0.016 0.984
#> GSM258593 1 0.0000 0.971 1.000 0.000
#> GSM258595 2 0.9686 0.322 0.396 0.604
#> GSM258597 2 0.0000 0.981 0.000 1.000
#> GSM258598 2 0.0000 0.981 0.000 1.000
#> GSM258600 2 0.0376 0.978 0.004 0.996
#> GSM258601 2 0.6887 0.763 0.184 0.816
#> GSM258602 2 0.0000 0.981 0.000 1.000
#> GSM258604 1 0.1633 0.950 0.976 0.024
#> GSM258605 1 0.0000 0.971 1.000 0.000
#> GSM258606 2 0.0000 0.981 0.000 1.000
#> GSM258607 2 0.0000 0.981 0.000 1.000
#> GSM258608 2 0.0000 0.981 0.000 1.000
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> GSM258553 1 0.0000 0.9455 1.000 0.000 0.000
#> GSM258555 1 0.0000 0.9455 1.000 0.000 0.000
#> GSM258556 3 0.2537 0.8665 0.000 0.080 0.920
#> GSM258557 3 0.6617 0.1421 0.436 0.008 0.556
#> GSM258562 3 0.4002 0.8072 0.160 0.000 0.840
#> GSM258563 1 0.3192 0.8697 0.888 0.000 0.112
#> GSM258565 1 0.0000 0.9455 1.000 0.000 0.000
#> GSM258566 1 0.0000 0.9455 1.000 0.000 0.000
#> GSM258570 1 0.0000 0.9455 1.000 0.000 0.000
#> GSM258578 1 0.0000 0.9455 1.000 0.000 0.000
#> GSM258580 3 0.2959 0.8464 0.100 0.000 0.900
#> GSM258583 1 0.1411 0.9231 0.964 0.000 0.036
#> GSM258585 1 0.3686 0.8395 0.860 0.000 0.140
#> GSM258590 1 0.0000 0.9455 1.000 0.000 0.000
#> GSM258594 1 0.0000 0.9455 1.000 0.000 0.000
#> GSM258596 1 0.0000 0.9455 1.000 0.000 0.000
#> GSM258599 1 0.0000 0.9455 1.000 0.000 0.000
#> GSM258603 1 0.0000 0.9455 1.000 0.000 0.000
#> GSM258551 2 0.0424 0.9508 0.000 0.992 0.008
#> GSM258552 3 0.2796 0.8596 0.000 0.092 0.908
#> GSM258554 2 0.0424 0.9508 0.000 0.992 0.008
#> GSM258558 2 0.1529 0.9493 0.000 0.960 0.040
#> GSM258559 2 0.3116 0.8962 0.000 0.892 0.108
#> GSM258560 3 0.1753 0.8658 0.000 0.048 0.952
#> GSM258561 2 0.1643 0.9252 0.000 0.956 0.044
#> GSM258564 2 0.0892 0.9460 0.000 0.980 0.020
#> GSM258567 3 0.0892 0.8631 0.000 0.020 0.980
#> GSM258568 2 0.1289 0.9505 0.000 0.968 0.032
#> GSM258569 3 0.2866 0.8591 0.076 0.008 0.916
#> GSM258571 3 0.3030 0.8440 0.092 0.004 0.904
#> GSM258572 3 0.2796 0.8596 0.000 0.092 0.908
#> GSM258573 2 0.0892 0.9460 0.000 0.980 0.020
#> GSM258574 3 0.4002 0.8098 0.000 0.160 0.840
#> GSM258575 2 0.2261 0.9319 0.000 0.932 0.068
#> GSM258576 2 0.1289 0.9505 0.000 0.968 0.032
#> GSM258577 3 0.4605 0.7095 0.000 0.204 0.796
#> GSM258579 2 0.1964 0.9395 0.000 0.944 0.056
#> GSM258581 2 0.1289 0.9505 0.000 0.968 0.032
#> GSM258582 3 0.3349 0.8410 0.108 0.004 0.888
#> GSM258584 3 0.6267 0.0807 0.000 0.452 0.548
#> GSM258586 3 0.3267 0.8579 0.000 0.116 0.884
#> GSM258587 2 0.0892 0.9460 0.000 0.980 0.020
#> GSM258588 3 0.5363 0.6678 0.000 0.276 0.724
#> GSM258589 3 0.2625 0.8610 0.000 0.084 0.916
#> GSM258591 2 0.0237 0.9505 0.000 0.996 0.004
#> GSM258592 3 0.1031 0.8639 0.000 0.024 0.976
#> GSM258593 1 0.6215 0.1440 0.572 0.000 0.428
#> GSM258595 3 0.2663 0.8695 0.024 0.044 0.932
#> GSM258597 2 0.0892 0.9460 0.000 0.980 0.020
#> GSM258598 2 0.0892 0.9460 0.000 0.980 0.020
#> GSM258600 3 0.2625 0.8610 0.000 0.084 0.916
#> GSM258601 3 0.2269 0.8641 0.040 0.016 0.944
#> GSM258602 2 0.1289 0.9505 0.000 0.968 0.032
#> GSM258604 3 0.2804 0.8568 0.060 0.016 0.924
#> GSM258605 3 0.3030 0.8440 0.092 0.004 0.904
#> GSM258606 2 0.1289 0.9505 0.000 0.968 0.032
#> GSM258607 3 0.2878 0.8644 0.000 0.096 0.904
#> GSM258608 2 0.5706 0.5306 0.000 0.680 0.320
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> GSM258553 1 0.0000 0.9295 1.000 0.000 0.000 0.000
#> GSM258555 1 0.0188 0.9292 0.996 0.000 0.000 0.004
#> GSM258556 4 0.4925 0.5723 0.000 0.000 0.428 0.572
#> GSM258557 3 0.6993 0.4139 0.224 0.008 0.608 0.160
#> GSM258562 4 0.6240 0.6750 0.076 0.000 0.320 0.604
#> GSM258563 1 0.7215 0.1704 0.500 0.000 0.348 0.152
#> GSM258565 1 0.0188 0.9292 0.996 0.000 0.000 0.004
#> GSM258566 1 0.0188 0.9292 0.996 0.000 0.000 0.004
#> GSM258570 1 0.0000 0.9295 1.000 0.000 0.000 0.000
#> GSM258578 1 0.0188 0.9292 0.996 0.000 0.000 0.004
#> GSM258580 3 0.3182 0.5038 0.028 0.000 0.876 0.096
#> GSM258583 1 0.3659 0.8305 0.840 0.000 0.024 0.136
#> GSM258585 3 0.7423 0.0214 0.404 0.000 0.428 0.168
#> GSM258590 1 0.0779 0.9250 0.980 0.000 0.004 0.016
#> GSM258594 1 0.0000 0.9295 1.000 0.000 0.000 0.000
#> GSM258596 1 0.1792 0.9037 0.932 0.000 0.000 0.068
#> GSM258599 1 0.2053 0.9009 0.924 0.000 0.004 0.072
#> GSM258603 1 0.0895 0.9237 0.976 0.000 0.004 0.020
#> GSM258551 2 0.3820 0.8557 0.000 0.848 0.064 0.088
#> GSM258552 3 0.2399 0.5591 0.000 0.048 0.920 0.032
#> GSM258554 2 0.3687 0.8578 0.000 0.856 0.064 0.080
#> GSM258558 2 0.2124 0.8603 0.000 0.924 0.068 0.008
#> GSM258559 2 0.4893 0.7197 0.000 0.768 0.064 0.168
#> GSM258560 4 0.6307 0.5953 0.000 0.092 0.288 0.620
#> GSM258561 2 0.3764 0.8254 0.000 0.816 0.012 0.172
#> GSM258564 2 0.5229 0.8126 0.000 0.748 0.084 0.168
#> GSM258567 3 0.5075 0.1231 0.000 0.012 0.644 0.344
#> GSM258568 2 0.0804 0.8666 0.000 0.980 0.008 0.012
#> GSM258569 3 0.6178 -0.6043 0.040 0.004 0.484 0.472
#> GSM258571 4 0.5174 0.7202 0.032 0.004 0.248 0.716
#> GSM258572 3 0.1854 0.5637 0.000 0.048 0.940 0.012
#> GSM258573 2 0.3443 0.8497 0.000 0.848 0.016 0.136
#> GSM258574 3 0.2704 0.5594 0.000 0.124 0.876 0.000
#> GSM258575 2 0.4053 0.6601 0.000 0.768 0.228 0.004
#> GSM258576 2 0.0188 0.8668 0.000 0.996 0.004 0.000
#> GSM258577 3 0.5496 0.4522 0.000 0.108 0.732 0.160
#> GSM258579 2 0.3610 0.7054 0.000 0.800 0.200 0.000
#> GSM258581 2 0.0188 0.8668 0.000 0.996 0.004 0.000
#> GSM258582 4 0.5636 0.7187 0.044 0.000 0.308 0.648
#> GSM258584 4 0.7500 -0.1183 0.000 0.180 0.408 0.412
#> GSM258586 3 0.2773 0.5407 0.000 0.028 0.900 0.072
#> GSM258587 2 0.3335 0.8508 0.000 0.856 0.016 0.128
#> GSM258588 3 0.5491 0.4564 0.000 0.260 0.688 0.052
#> GSM258589 3 0.3421 0.5072 0.000 0.044 0.868 0.088
#> GSM258591 2 0.1867 0.8702 0.000 0.928 0.000 0.072
#> GSM258592 4 0.4936 0.6775 0.000 0.012 0.316 0.672
#> GSM258593 3 0.7772 0.0719 0.368 0.000 0.392 0.240
#> GSM258595 4 0.5296 0.5754 0.008 0.000 0.492 0.500
#> GSM258597 2 0.5096 0.8149 0.000 0.760 0.084 0.156
#> GSM258598 2 0.3853 0.8383 0.000 0.820 0.020 0.160
#> GSM258600 3 0.2313 0.5452 0.000 0.032 0.924 0.044
#> GSM258601 4 0.5409 0.7253 0.020 0.004 0.332 0.644
#> GSM258602 2 0.2644 0.8442 0.000 0.908 0.032 0.060
#> GSM258604 4 0.5214 0.7307 0.024 0.004 0.280 0.692
#> GSM258605 4 0.5013 0.7096 0.032 0.004 0.228 0.736
#> GSM258606 2 0.0927 0.8661 0.000 0.976 0.008 0.016
#> GSM258607 4 0.4920 0.5196 0.000 0.004 0.368 0.628
#> GSM258608 3 0.6086 0.4665 0.000 0.188 0.680 0.132
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> GSM258553 1 0.0404 0.8774 0.988 0.000 0.000 0.000 0.012
#> GSM258555 1 0.0162 0.8775 0.996 0.000 0.004 0.000 0.000
#> GSM258556 3 0.6009 0.5173 0.000 0.180 0.580 0.000 0.240
#> GSM258557 2 0.6843 0.3426 0.116 0.572 0.072 0.000 0.240
#> GSM258562 3 0.3538 0.6605 0.020 0.088 0.848 0.000 0.044
#> GSM258563 1 0.7572 0.2504 0.424 0.276 0.052 0.000 0.248
#> GSM258565 1 0.0162 0.8775 0.996 0.000 0.004 0.000 0.000
#> GSM258566 1 0.0162 0.8775 0.996 0.000 0.004 0.000 0.000
#> GSM258570 1 0.0162 0.8777 0.996 0.000 0.000 0.000 0.004
#> GSM258578 1 0.0162 0.8775 0.996 0.000 0.004 0.000 0.000
#> GSM258580 2 0.3845 0.5757 0.004 0.812 0.124 0.000 0.060
#> GSM258583 1 0.5355 0.7078 0.680 0.044 0.036 0.000 0.240
#> GSM258585 2 0.7849 0.0300 0.288 0.372 0.068 0.000 0.272
#> GSM258590 1 0.2125 0.8648 0.920 0.024 0.004 0.000 0.052
#> GSM258594 1 0.0162 0.8777 0.996 0.000 0.000 0.000 0.004
#> GSM258596 1 0.4588 0.7917 0.768 0.048 0.028 0.000 0.156
#> GSM258599 1 0.4588 0.7917 0.768 0.048 0.028 0.000 0.156
#> GSM258603 1 0.2460 0.8585 0.900 0.024 0.004 0.000 0.072
#> GSM258551 4 0.4301 0.5955 0.000 0.028 0.000 0.712 0.260
#> GSM258552 2 0.2692 0.5959 0.000 0.884 0.092 0.008 0.016
#> GSM258554 4 0.3940 0.6148 0.000 0.024 0.000 0.756 0.220
#> GSM258558 4 0.2370 0.6255 0.000 0.040 0.000 0.904 0.056
#> GSM258559 4 0.6505 -0.2564 0.000 0.072 0.064 0.568 0.296
#> GSM258560 3 0.7681 -0.3364 0.000 0.116 0.476 0.148 0.260
#> GSM258561 4 0.6107 0.3201 0.000 0.012 0.144 0.600 0.244
#> GSM258564 4 0.5254 0.5023 0.000 0.036 0.004 0.500 0.460
#> GSM258567 2 0.6503 -0.1286 0.000 0.436 0.372 0.000 0.192
#> GSM258568 4 0.0703 0.6155 0.000 0.000 0.000 0.976 0.024
#> GSM258569 3 0.4623 0.5171 0.000 0.304 0.664 0.000 0.032
#> GSM258571 3 0.0865 0.6544 0.000 0.004 0.972 0.000 0.024
#> GSM258572 2 0.1956 0.5860 0.000 0.928 0.052 0.008 0.012
#> GSM258573 4 0.4329 0.5945 0.000 0.016 0.000 0.672 0.312
#> GSM258574 2 0.2244 0.5718 0.000 0.920 0.024 0.040 0.016
#> GSM258575 4 0.4841 0.1543 0.000 0.416 0.000 0.560 0.024
#> GSM258576 4 0.0162 0.6236 0.000 0.000 0.000 0.996 0.004
#> GSM258577 2 0.7564 -0.2508 0.000 0.460 0.076 0.176 0.288
#> GSM258579 4 0.4045 0.3044 0.000 0.356 0.000 0.644 0.000
#> GSM258581 4 0.0000 0.6226 0.000 0.000 0.000 1.000 0.000
#> GSM258582 3 0.1270 0.6820 0.000 0.052 0.948 0.000 0.000
#> GSM258584 5 0.8238 0.0000 0.000 0.128 0.272 0.236 0.364
#> GSM258586 2 0.4514 0.5230 0.000 0.760 0.068 0.008 0.164
#> GSM258587 4 0.4025 0.6004 0.000 0.008 0.000 0.700 0.292
#> GSM258588 2 0.6179 0.2701 0.000 0.636 0.044 0.212 0.108
#> GSM258589 2 0.4038 0.5553 0.000 0.812 0.088 0.012 0.088
#> GSM258591 4 0.2763 0.6244 0.000 0.004 0.000 0.848 0.148
#> GSM258592 3 0.4581 0.3326 0.000 0.072 0.732 0.000 0.196
#> GSM258593 2 0.7954 0.0945 0.172 0.392 0.324 0.000 0.112
#> GSM258595 3 0.4616 0.5391 0.000 0.288 0.676 0.000 0.036
#> GSM258597 4 0.5249 0.5093 0.000 0.036 0.004 0.508 0.452
#> GSM258598 4 0.4752 0.5330 0.000 0.012 0.004 0.556 0.428
#> GSM258600 2 0.3346 0.5919 0.000 0.848 0.108 0.008 0.036
#> GSM258601 3 0.1893 0.6793 0.000 0.048 0.928 0.000 0.024
#> GSM258602 4 0.4918 0.1960 0.000 0.044 0.016 0.704 0.236
#> GSM258604 3 0.1753 0.6779 0.000 0.032 0.936 0.000 0.032
#> GSM258605 3 0.1168 0.6429 0.000 0.008 0.960 0.000 0.032
#> GSM258606 4 0.1502 0.5937 0.000 0.004 0.000 0.940 0.056
#> GSM258607 3 0.6366 0.3526 0.000 0.164 0.440 0.000 0.396
#> GSM258608 2 0.6395 -0.0129 0.000 0.552 0.008 0.248 0.192
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> GSM258553 1 0.0937 0.8098 0.960 0.000 0.000 0.000 0.040 0.000
#> GSM258555 1 0.0891 0.8135 0.968 0.000 0.000 0.008 0.000 0.024
#> GSM258556 3 0.7462 0.3090 0.000 0.152 0.388 0.304 0.148 0.008
#> GSM258557 5 0.5604 0.4684 0.072 0.412 0.020 0.000 0.492 0.004
#> GSM258562 3 0.5448 0.5859 0.000 0.068 0.676 0.012 0.188 0.056
#> GSM258563 5 0.6247 0.4713 0.252 0.228 0.016 0.000 0.500 0.004
#> GSM258565 1 0.0891 0.8135 0.968 0.000 0.000 0.008 0.000 0.024
#> GSM258566 1 0.0891 0.8135 0.968 0.000 0.000 0.008 0.000 0.024
#> GSM258570 1 0.0146 0.8143 0.996 0.000 0.000 0.000 0.004 0.000
#> GSM258578 1 0.0891 0.8135 0.968 0.000 0.000 0.008 0.000 0.024
#> GSM258580 2 0.4392 0.4028 0.000 0.744 0.024 0.012 0.188 0.032
#> GSM258583 1 0.4222 0.2591 0.516 0.000 0.008 0.000 0.472 0.004
#> GSM258585 5 0.5944 0.5785 0.140 0.264 0.020 0.000 0.568 0.008
#> GSM258590 1 0.2378 0.7638 0.848 0.000 0.000 0.000 0.152 0.000
#> GSM258594 1 0.0000 0.8146 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM258596 1 0.3942 0.5143 0.624 0.004 0.004 0.000 0.368 0.000
#> GSM258599 1 0.3911 0.5152 0.624 0.000 0.008 0.000 0.368 0.000
#> GSM258603 1 0.2416 0.7613 0.844 0.000 0.000 0.000 0.156 0.000
#> GSM258551 4 0.5638 -0.1247 0.000 0.024 0.000 0.468 0.080 0.428
#> GSM258552 2 0.1500 0.5059 0.000 0.936 0.012 0.000 0.052 0.000
#> GSM258554 6 0.5405 0.0458 0.000 0.020 0.000 0.436 0.064 0.480
#> GSM258558 6 0.5374 0.2288 0.000 0.060 0.000 0.356 0.028 0.556
#> GSM258559 6 0.4716 0.3574 0.000 0.020 0.024 0.020 0.244 0.692
#> GSM258560 6 0.7283 -0.1179 0.000 0.076 0.328 0.008 0.228 0.360
#> GSM258561 6 0.6636 0.1855 0.000 0.000 0.128 0.264 0.100 0.508
#> GSM258564 4 0.1737 0.5457 0.000 0.008 0.000 0.932 0.040 0.020
#> GSM258567 2 0.7239 0.1496 0.000 0.400 0.280 0.000 0.204 0.116
#> GSM258568 6 0.4644 0.3200 0.000 0.000 0.004 0.316 0.052 0.628
#> GSM258569 3 0.6219 0.4397 0.000 0.264 0.528 0.008 0.180 0.020
#> GSM258571 3 0.0665 0.7231 0.000 0.008 0.980 0.000 0.008 0.004
#> GSM258572 2 0.0665 0.5294 0.000 0.980 0.008 0.000 0.008 0.004
#> GSM258573 4 0.3828 0.3473 0.000 0.012 0.000 0.696 0.004 0.288
#> GSM258574 2 0.1401 0.5291 0.000 0.948 0.000 0.004 0.020 0.028
#> GSM258575 6 0.5535 0.0955 0.000 0.428 0.000 0.084 0.016 0.472
#> GSM258576 6 0.4119 0.2894 0.000 0.004 0.000 0.336 0.016 0.644
#> GSM258577 2 0.6763 0.1298 0.000 0.404 0.016 0.016 0.268 0.296
#> GSM258579 6 0.5855 0.2336 0.000 0.328 0.000 0.152 0.012 0.508
#> GSM258581 6 0.4090 0.2980 0.000 0.004 0.000 0.328 0.016 0.652
#> GSM258582 3 0.0767 0.7246 0.000 0.012 0.976 0.000 0.008 0.004
#> GSM258584 6 0.6697 0.1084 0.000 0.068 0.152 0.000 0.352 0.428
#> GSM258586 2 0.4606 0.4241 0.000 0.720 0.012 0.184 0.080 0.004
#> GSM258587 4 0.3935 0.3385 0.000 0.008 0.000 0.692 0.012 0.288
#> GSM258588 2 0.5448 0.3481 0.000 0.588 0.012 0.000 0.120 0.280
#> GSM258589 2 0.4027 0.5009 0.000 0.736 0.008 0.004 0.224 0.028
#> GSM258591 6 0.4792 0.1587 0.000 0.004 0.000 0.416 0.044 0.536
#> GSM258592 3 0.4673 0.5236 0.000 0.008 0.708 0.000 0.148 0.136
#> GSM258593 5 0.7759 0.0622 0.068 0.344 0.164 0.008 0.372 0.044
#> GSM258595 3 0.6025 0.3343 0.000 0.340 0.480 0.008 0.168 0.004
#> GSM258597 4 0.1036 0.5631 0.000 0.008 0.000 0.964 0.004 0.024
#> GSM258598 4 0.1410 0.5589 0.000 0.004 0.000 0.944 0.008 0.044
#> GSM258600 2 0.2572 0.4902 0.000 0.852 0.012 0.000 0.136 0.000
#> GSM258601 3 0.1440 0.7277 0.000 0.012 0.948 0.004 0.032 0.004
#> GSM258602 6 0.4539 0.3878 0.000 0.016 0.008 0.080 0.152 0.744
#> GSM258604 3 0.1799 0.7222 0.000 0.008 0.928 0.008 0.052 0.004
#> GSM258605 3 0.0405 0.7204 0.000 0.000 0.988 0.000 0.008 0.004
#> GSM258606 6 0.3217 0.3749 0.000 0.000 0.000 0.224 0.008 0.768
#> GSM258607 4 0.7206 -0.1263 0.000 0.144 0.240 0.476 0.128 0.012
#> GSM258608 2 0.6195 0.1907 0.000 0.476 0.000 0.016 0.216 0.292
Heatmaps for the consensus matrix. It visualizes the probability of two samples to be in a same group.
consensus_heatmap(res, k = 2)
consensus_heatmap(res, k = 3)
consensus_heatmap(res, k = 4)
consensus_heatmap(res, k = 5)
consensus_heatmap(res, k = 6)
Heatmaps for the membership of samples in all partitions to see how consistent they are:
membership_heatmap(res, k = 2)
membership_heatmap(res, k = 3)
membership_heatmap(res, k = 4)
membership_heatmap(res, k = 5)
membership_heatmap(res, k = 6)
As soon as we have had the classes for columns, we can look for signatures which are significantly different between classes which can be candidate marks for certain classes. Following are the heatmaps for signatures.
Signature heatmaps where rows are scaled:
get_signatures(res, k = 2)
get_signatures(res, k = 3)
get_signatures(res, k = 4)
get_signatures(res, k = 5)
get_signatures(res, k = 6)
Signature heatmaps where rows are not scaled:
get_signatures(res, k = 2, scale_rows = FALSE)
get_signatures(res, k = 3, scale_rows = FALSE)
get_signatures(res, k = 4, scale_rows = FALSE)
get_signatures(res, k = 5, scale_rows = FALSE)
get_signatures(res, k = 6, scale_rows = FALSE)
Compare the overlap of signatures from different k:
compare_signatures(res)
get_signature()
returns a data frame invisibly. TO get the list of signatures, the function
call should be assigned to a variable explicitly. In following code, if plot
argument is set
to FALSE
, no heatmap is plotted while only the differential analysis is performed.
# code only for demonstration
tb = get_signature(res, k = ..., plot = FALSE)
An example of the output of tb
is:
#> which_row fdr mean_1 mean_2 scaled_mean_1 scaled_mean_2 km
#> 1 38 0.042760348 8.373488 9.131774 -0.5533452 0.5164555 1
#> 2 40 0.018707592 7.106213 8.469186 -0.6173731 0.5762149 1
#> 3 55 0.019134737 10.221463 11.207825 -0.6159697 0.5749050 1
#> 4 59 0.006059896 5.921854 7.869574 -0.6899429 0.6439467 1
#> 5 60 0.018055526 8.928898 10.211722 -0.6204761 0.5791110 1
#> 6 98 0.009384629 15.714769 14.887706 0.6635654 -0.6193277 2
...
The columns in tb
are:
which_row
: row indices corresponding to the input matrix.fdr
: FDR for the differential test. mean_x
: The mean value in group x.scaled_mean_x
: The mean value in group x after rows are scaled.km
: Row groups if k-means clustering is applied to rows.UMAP plot which shows how samples are separated.
dimension_reduction(res, k = 2, method = "UMAP")
dimension_reduction(res, k = 3, method = "UMAP")
dimension_reduction(res, k = 4, method = "UMAP")
dimension_reduction(res, k = 5, method = "UMAP")
dimension_reduction(res, k = 6, method = "UMAP")
Following heatmap shows how subgroups are split when increasing k
:
collect_classes(res)
Test correlation between subgroups and known annotations. If the known annotation is numeric, one-way ANOVA test is applied, and if the known annotation is discrete, chi-squared contingency table test is applied.
test_to_known_factors(res)
#> n disease.state(p) k
#> MAD:kmeans 56 3.31e-08 2
#> MAD:kmeans 55 4.91e-10 3
#> MAD:kmeans 48 6.18e-08 4
#> MAD:kmeans 41 1.03e-06 5
#> MAD:kmeans 26 1.54e-04 6
If matrix rows can be associated to genes, consider to use functional_enrichment(res,
...)
to perform function enrichment for the signature genes. See this vignette for more detailed explanations.
The object with results only for a single top-value method and a single partition method can be extracted as:
res = res_list["MAD", "skmeans"]
# you can also extract it by
# res = res_list["MAD:skmeans"]
A summary of res
and all the functions that can be applied to it:
res
#> A 'ConsensusPartition' object with k = 2, 3, 4, 5, 6.
#> On a matrix with 51941 rows and 58 columns.
#> Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'MAD' method.
#> Subgroups are detected by 'skmeans' method.
#> Performed in total 1250 partitions by row resampling.
#> Best k for subgroups seems to be 2.
#>
#> Following methods can be applied to this 'ConsensusPartition' object:
#> [1] "cola_report" "collect_classes" "collect_plots"
#> [4] "collect_stats" "colnames" "compare_signatures"
#> [7] "consensus_heatmap" "dimension_reduction" "functional_enrichment"
#> [10] "get_anno_col" "get_anno" "get_classes"
#> [13] "get_consensus" "get_matrix" "get_membership"
#> [16] "get_param" "get_signatures" "get_stats"
#> [19] "is_best_k" "is_stable_k" "membership_heatmap"
#> [22] "ncol" "nrow" "plot_ecdf"
#> [25] "rownames" "select_partition_number" "show"
#> [28] "suggest_best_k" "test_to_known_factors"
collect_plots()
function collects all the plots made from res
for all k
(number of partitions)
into one single page to provide an easy and fast comparison between different k
.
collect_plots(res)
The plots are:
k
and the heatmap of
predicted classes for each k
.k
.k
.k
.All the plots in panels can be made by individual functions and they are plotted later in this section.
select_partition_number()
produces several plots showing different
statistics for choosing “optimized” k
. There are following statistics:
k
;k
, the area increased is defined as \(A_k - A_{k-1}\).The detailed explanations of these statistics can be found in the cola vignette.
Generally speaking, lower PAC score, higher mean silhouette score or higher
concordance corresponds to better partition. Rand index and Jaccard index
measure how similar the current partition is compared to partition with k-1
.
If they are too similar, we won't accept k
is better than k-1
.
select_partition_number(res)
The numeric values for all these statistics can be obtained by get_stats()
.
get_stats(res)
#> k 1-PAC mean_silhouette concordance area_increased Rand Jaccard
#> 2 2 1.000 0.958 0.984 0.5039 0.494 0.494
#> 3 3 0.673 0.634 0.862 0.3267 0.758 0.545
#> 4 4 0.796 0.799 0.897 0.1234 0.833 0.550
#> 5 5 0.699 0.583 0.767 0.0641 0.967 0.869
#> 6 6 0.679 0.484 0.698 0.0370 0.938 0.741
suggest_best_k()
suggests the best \(k\) based on these statistics. The rules are as follows:
suggest_best_k(res)
#> [1] 2
Following shows the table of the partitions (You need to click the show/hide
code output link to see it). The membership matrix (columns with name p*
)
is inferred by
clue::cl_consensus()
function with the SE
method. Basically the value in the membership matrix
represents the probability to belong to a certain group. The finall class
label for an item is determined with the group with highest probability it
belongs to.
In get_classes()
function, the entropy is calculated from the membership
matrix and the silhouette score is calculated from the consensus matrix.
cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#> class entropy silhouette p1 p2
#> GSM258553 1 0.0000 0.966 1.000 0.000
#> GSM258555 1 0.0000 0.966 1.000 0.000
#> GSM258556 2 0.0000 0.998 0.000 1.000
#> GSM258557 1 0.0000 0.966 1.000 0.000
#> GSM258562 1 0.0000 0.966 1.000 0.000
#> GSM258563 1 0.0000 0.966 1.000 0.000
#> GSM258565 1 0.0000 0.966 1.000 0.000
#> GSM258566 1 0.0000 0.966 1.000 0.000
#> GSM258570 1 0.0000 0.966 1.000 0.000
#> GSM258578 1 0.0000 0.966 1.000 0.000
#> GSM258580 1 0.0000 0.966 1.000 0.000
#> GSM258583 1 0.0000 0.966 1.000 0.000
#> GSM258585 1 0.0000 0.966 1.000 0.000
#> GSM258590 1 0.0000 0.966 1.000 0.000
#> GSM258594 1 0.0000 0.966 1.000 0.000
#> GSM258596 1 0.0000 0.966 1.000 0.000
#> GSM258599 1 0.0000 0.966 1.000 0.000
#> GSM258603 1 0.0000 0.966 1.000 0.000
#> GSM258551 2 0.0000 0.998 0.000 1.000
#> GSM258552 2 0.0000 0.998 0.000 1.000
#> GSM258554 2 0.0000 0.998 0.000 1.000
#> GSM258558 2 0.0000 0.998 0.000 1.000
#> GSM258559 2 0.0000 0.998 0.000 1.000
#> GSM258560 2 0.0000 0.998 0.000 1.000
#> GSM258561 2 0.0000 0.998 0.000 1.000
#> GSM258564 2 0.0000 0.998 0.000 1.000
#> GSM258567 1 0.9833 0.290 0.576 0.424
#> GSM258568 2 0.0000 0.998 0.000 1.000
#> GSM258569 1 0.0000 0.966 1.000 0.000
#> GSM258571 1 0.0000 0.966 1.000 0.000
#> GSM258572 2 0.0000 0.998 0.000 1.000
#> GSM258573 2 0.0000 0.998 0.000 1.000
#> GSM258574 2 0.0000 0.998 0.000 1.000
#> GSM258575 2 0.0000 0.998 0.000 1.000
#> GSM258576 2 0.0000 0.998 0.000 1.000
#> GSM258577 2 0.0000 0.998 0.000 1.000
#> GSM258579 2 0.0000 0.998 0.000 1.000
#> GSM258581 2 0.0000 0.998 0.000 1.000
#> GSM258582 1 0.0000 0.966 1.000 0.000
#> GSM258584 2 0.0000 0.998 0.000 1.000
#> GSM258586 2 0.0000 0.998 0.000 1.000
#> GSM258587 2 0.0000 0.998 0.000 1.000
#> GSM258588 2 0.0000 0.998 0.000 1.000
#> GSM258589 2 0.0000 0.998 0.000 1.000
#> GSM258591 2 0.0000 0.998 0.000 1.000
#> GSM258592 1 0.9833 0.290 0.576 0.424
#> GSM258593 1 0.0000 0.966 1.000 0.000
#> GSM258595 1 0.0376 0.963 0.996 0.004
#> GSM258597 2 0.0000 0.998 0.000 1.000
#> GSM258598 2 0.0000 0.998 0.000 1.000
#> GSM258600 2 0.3733 0.920 0.072 0.928
#> GSM258601 1 0.0672 0.960 0.992 0.008
#> GSM258602 2 0.0000 0.998 0.000 1.000
#> GSM258604 1 0.0000 0.966 1.000 0.000
#> GSM258605 1 0.0000 0.966 1.000 0.000
#> GSM258606 2 0.0000 0.998 0.000 1.000
#> GSM258607 2 0.0000 0.998 0.000 1.000
#> GSM258608 2 0.0000 0.998 0.000 1.000
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> GSM258553 1 0.0000 0.8656 1.000 0.000 0.000
#> GSM258555 1 0.0000 0.8656 1.000 0.000 0.000
#> GSM258556 3 0.1031 0.6545 0.000 0.024 0.976
#> GSM258557 1 0.6192 0.1443 0.580 0.000 0.420
#> GSM258562 1 0.6045 0.2636 0.620 0.000 0.380
#> GSM258563 1 0.0892 0.8471 0.980 0.000 0.020
#> GSM258565 1 0.0000 0.8656 1.000 0.000 0.000
#> GSM258566 1 0.0000 0.8656 1.000 0.000 0.000
#> GSM258570 1 0.0000 0.8656 1.000 0.000 0.000
#> GSM258578 1 0.0000 0.8656 1.000 0.000 0.000
#> GSM258580 3 0.6307 -0.0315 0.488 0.000 0.512
#> GSM258583 1 0.0000 0.8656 1.000 0.000 0.000
#> GSM258585 1 0.0000 0.8656 1.000 0.000 0.000
#> GSM258590 1 0.0000 0.8656 1.000 0.000 0.000
#> GSM258594 1 0.0000 0.8656 1.000 0.000 0.000
#> GSM258596 1 0.0000 0.8656 1.000 0.000 0.000
#> GSM258599 1 0.0000 0.8656 1.000 0.000 0.000
#> GSM258603 1 0.0000 0.8656 1.000 0.000 0.000
#> GSM258551 2 0.0000 0.8822 0.000 1.000 0.000
#> GSM258552 3 0.1753 0.6602 0.000 0.048 0.952
#> GSM258554 2 0.0000 0.8822 0.000 1.000 0.000
#> GSM258558 2 0.0000 0.8822 0.000 1.000 0.000
#> GSM258559 2 0.0424 0.8772 0.000 0.992 0.008
#> GSM258560 2 0.6154 0.3303 0.000 0.592 0.408
#> GSM258561 2 0.1031 0.8664 0.000 0.976 0.024
#> GSM258564 2 0.0000 0.8822 0.000 1.000 0.000
#> GSM258567 3 0.0000 0.6537 0.000 0.000 1.000
#> GSM258568 2 0.0000 0.8822 0.000 1.000 0.000
#> GSM258569 3 0.6180 0.2267 0.416 0.000 0.584
#> GSM258571 3 0.6280 0.1197 0.460 0.000 0.540
#> GSM258572 3 0.3267 0.6125 0.000 0.116 0.884
#> GSM258573 2 0.0000 0.8822 0.000 1.000 0.000
#> GSM258574 3 0.6305 -0.1217 0.000 0.484 0.516
#> GSM258575 2 0.5733 0.4874 0.000 0.676 0.324
#> GSM258576 2 0.0000 0.8822 0.000 1.000 0.000
#> GSM258577 2 0.5733 0.5278 0.000 0.676 0.324
#> GSM258579 2 0.5529 0.5415 0.000 0.704 0.296
#> GSM258581 2 0.0000 0.8822 0.000 1.000 0.000
#> GSM258582 3 0.6252 0.1604 0.444 0.000 0.556
#> GSM258584 2 0.4702 0.6978 0.000 0.788 0.212
#> GSM258586 3 0.1031 0.6593 0.000 0.024 0.976
#> GSM258587 2 0.0000 0.8822 0.000 1.000 0.000
#> GSM258588 3 0.6308 -0.1289 0.000 0.492 0.508
#> GSM258589 3 0.4399 0.5320 0.000 0.188 0.812
#> GSM258591 2 0.0000 0.8822 0.000 1.000 0.000
#> GSM258592 3 0.0000 0.6537 0.000 0.000 1.000
#> GSM258593 1 0.0892 0.8490 0.980 0.000 0.020
#> GSM258595 3 0.6148 0.3364 0.356 0.004 0.640
#> GSM258597 2 0.0000 0.8822 0.000 1.000 0.000
#> GSM258598 2 0.0000 0.8822 0.000 1.000 0.000
#> GSM258600 3 0.1753 0.6602 0.000 0.048 0.952
#> GSM258601 3 0.6095 0.2724 0.392 0.000 0.608
#> GSM258602 2 0.0000 0.8822 0.000 1.000 0.000
#> GSM258604 1 0.6308 -0.0743 0.508 0.000 0.492
#> GSM258605 1 0.6295 -0.0122 0.528 0.000 0.472
#> GSM258606 2 0.0000 0.8822 0.000 1.000 0.000
#> GSM258607 2 0.6309 0.0819 0.000 0.504 0.496
#> GSM258608 2 0.3192 0.8046 0.000 0.888 0.112
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> GSM258553 1 0.0188 0.992 0.996 0.000 0.004 0.000
#> GSM258555 1 0.0188 0.992 0.996 0.000 0.004 0.000
#> GSM258556 3 0.4262 0.718 0.000 0.008 0.756 0.236
#> GSM258557 4 0.5172 0.334 0.404 0.000 0.008 0.588
#> GSM258562 3 0.4831 0.692 0.208 0.000 0.752 0.040
#> GSM258563 1 0.1042 0.969 0.972 0.000 0.008 0.020
#> GSM258565 1 0.0188 0.992 0.996 0.000 0.004 0.000
#> GSM258566 1 0.0188 0.992 0.996 0.000 0.004 0.000
#> GSM258570 1 0.0188 0.992 0.996 0.000 0.004 0.000
#> GSM258578 1 0.0188 0.992 0.996 0.000 0.004 0.000
#> GSM258580 4 0.3355 0.671 0.160 0.000 0.004 0.836
#> GSM258583 1 0.0336 0.986 0.992 0.000 0.008 0.000
#> GSM258585 1 0.0336 0.986 0.992 0.000 0.008 0.000
#> GSM258590 1 0.0000 0.991 1.000 0.000 0.000 0.000
#> GSM258594 1 0.0188 0.992 0.996 0.000 0.004 0.000
#> GSM258596 1 0.0188 0.992 0.996 0.000 0.004 0.000
#> GSM258599 1 0.0188 0.992 0.996 0.000 0.004 0.000
#> GSM258603 1 0.0000 0.991 1.000 0.000 0.000 0.000
#> GSM258551 2 0.1792 0.865 0.000 0.932 0.000 0.068
#> GSM258552 4 0.1109 0.744 0.000 0.004 0.028 0.968
#> GSM258554 2 0.1118 0.885 0.000 0.964 0.000 0.036
#> GSM258558 2 0.1557 0.879 0.000 0.944 0.000 0.056
#> GSM258559 2 0.1820 0.870 0.000 0.944 0.036 0.020
#> GSM258560 3 0.5608 0.553 0.000 0.256 0.684 0.060
#> GSM258561 2 0.2011 0.854 0.000 0.920 0.080 0.000
#> GSM258564 2 0.2623 0.864 0.000 0.908 0.028 0.064
#> GSM258567 4 0.4830 0.375 0.000 0.000 0.392 0.608
#> GSM258568 2 0.0336 0.889 0.000 0.992 0.000 0.008
#> GSM258569 3 0.4562 0.752 0.028 0.000 0.764 0.208
#> GSM258571 3 0.1004 0.834 0.024 0.000 0.972 0.004
#> GSM258572 4 0.0188 0.748 0.000 0.004 0.000 0.996
#> GSM258573 2 0.1520 0.885 0.000 0.956 0.020 0.024
#> GSM258574 4 0.1022 0.751 0.000 0.032 0.000 0.968
#> GSM258575 2 0.4746 0.353 0.000 0.632 0.000 0.368
#> GSM258576 2 0.0336 0.889 0.000 0.992 0.000 0.008
#> GSM258577 4 0.6282 0.295 0.004 0.368 0.056 0.572
#> GSM258579 2 0.4776 0.349 0.000 0.624 0.000 0.376
#> GSM258581 2 0.0336 0.889 0.000 0.992 0.000 0.008
#> GSM258582 3 0.1610 0.835 0.032 0.000 0.952 0.016
#> GSM258584 2 0.6799 0.393 0.004 0.584 0.300 0.112
#> GSM258586 4 0.1545 0.741 0.000 0.008 0.040 0.952
#> GSM258587 2 0.1059 0.887 0.000 0.972 0.016 0.012
#> GSM258588 4 0.4661 0.598 0.000 0.256 0.016 0.728
#> GSM258589 4 0.3687 0.714 0.000 0.080 0.064 0.856
#> GSM258591 2 0.0000 0.888 0.000 1.000 0.000 0.000
#> GSM258592 3 0.1557 0.817 0.000 0.000 0.944 0.056
#> GSM258593 1 0.1520 0.958 0.956 0.000 0.020 0.024
#> GSM258595 3 0.4425 0.778 0.036 0.004 0.800 0.160
#> GSM258597 2 0.2466 0.870 0.000 0.916 0.028 0.056
#> GSM258598 2 0.1388 0.883 0.000 0.960 0.028 0.012
#> GSM258600 4 0.0707 0.746 0.000 0.000 0.020 0.980
#> GSM258601 3 0.0672 0.833 0.008 0.000 0.984 0.008
#> GSM258602 2 0.0927 0.885 0.000 0.976 0.016 0.008
#> GSM258604 3 0.1209 0.836 0.032 0.000 0.964 0.004
#> GSM258605 3 0.1004 0.834 0.024 0.000 0.972 0.004
#> GSM258606 2 0.0336 0.889 0.000 0.992 0.000 0.008
#> GSM258607 3 0.6110 0.626 0.000 0.100 0.660 0.240
#> GSM258608 4 0.4762 0.520 0.004 0.300 0.004 0.692
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> GSM258553 1 0.0162 0.9534 0.996 0.000 0.004 0.000 0.000
#> GSM258555 1 0.0324 0.9539 0.992 0.000 0.004 0.000 0.004
#> GSM258556 3 0.5341 0.3333 0.000 0.064 0.580 0.000 0.356
#> GSM258557 2 0.6081 0.2364 0.376 0.496 0.000 0.000 0.128
#> GSM258562 3 0.4874 0.5399 0.208 0.048 0.724 0.000 0.020
#> GSM258563 1 0.2771 0.8654 0.860 0.012 0.000 0.000 0.128
#> GSM258565 1 0.0324 0.9539 0.992 0.000 0.004 0.000 0.004
#> GSM258566 1 0.0324 0.9539 0.992 0.000 0.004 0.000 0.004
#> GSM258570 1 0.0324 0.9539 0.992 0.000 0.004 0.000 0.004
#> GSM258578 1 0.0324 0.9539 0.992 0.000 0.004 0.000 0.004
#> GSM258580 2 0.2830 0.6149 0.080 0.884 0.020 0.000 0.016
#> GSM258583 1 0.2230 0.8816 0.884 0.000 0.000 0.000 0.116
#> GSM258585 1 0.2864 0.8609 0.852 0.012 0.000 0.000 0.136
#> GSM258590 1 0.0000 0.9527 1.000 0.000 0.000 0.000 0.000
#> GSM258594 1 0.0324 0.9539 0.992 0.000 0.004 0.000 0.004
#> GSM258596 1 0.0451 0.9522 0.988 0.000 0.004 0.000 0.008
#> GSM258599 1 0.0566 0.9512 0.984 0.000 0.004 0.000 0.012
#> GSM258603 1 0.0162 0.9515 0.996 0.000 0.000 0.000 0.004
#> GSM258551 4 0.4491 0.5313 0.000 0.020 0.000 0.652 0.328
#> GSM258552 2 0.0579 0.6492 0.000 0.984 0.008 0.000 0.008
#> GSM258554 4 0.3957 0.5805 0.000 0.008 0.000 0.712 0.280
#> GSM258558 4 0.3346 0.5853 0.000 0.064 0.000 0.844 0.092
#> GSM258559 4 0.4436 -0.0233 0.000 0.000 0.008 0.596 0.396
#> GSM258560 5 0.7117 0.2766 0.000 0.012 0.312 0.300 0.376
#> GSM258561 4 0.5144 0.5184 0.000 0.000 0.068 0.640 0.292
#> GSM258564 4 0.4446 0.4773 0.000 0.000 0.004 0.520 0.476
#> GSM258567 2 0.6733 0.1181 0.000 0.416 0.296 0.000 0.288
#> GSM258568 4 0.1121 0.5860 0.000 0.000 0.000 0.956 0.044
#> GSM258569 3 0.3996 0.5969 0.008 0.228 0.752 0.000 0.012
#> GSM258571 3 0.0794 0.7485 0.000 0.000 0.972 0.000 0.028
#> GSM258572 2 0.0451 0.6492 0.000 0.988 0.000 0.004 0.008
#> GSM258573 4 0.4045 0.5675 0.000 0.000 0.000 0.644 0.356
#> GSM258574 2 0.1012 0.6467 0.000 0.968 0.000 0.020 0.012
#> GSM258575 4 0.4654 0.2812 0.000 0.348 0.000 0.628 0.024
#> GSM258576 4 0.0162 0.6080 0.000 0.000 0.000 0.996 0.004
#> GSM258577 5 0.6865 0.0262 0.004 0.388 0.004 0.208 0.396
#> GSM258579 4 0.4505 0.2319 0.000 0.384 0.000 0.604 0.012
#> GSM258581 4 0.0000 0.6069 0.000 0.000 0.000 1.000 0.000
#> GSM258582 3 0.0324 0.7491 0.000 0.004 0.992 0.000 0.004
#> GSM258584 5 0.6671 0.3358 0.004 0.016 0.140 0.332 0.508
#> GSM258586 2 0.4475 0.4744 0.000 0.692 0.032 0.000 0.276
#> GSM258587 4 0.3452 0.6007 0.000 0.000 0.000 0.756 0.244
#> GSM258588 2 0.5959 0.3594 0.000 0.600 0.004 0.244 0.152
#> GSM258589 2 0.5370 0.5231 0.000 0.708 0.020 0.124 0.148
#> GSM258591 4 0.2929 0.6270 0.000 0.000 0.000 0.820 0.180
#> GSM258592 3 0.3662 0.5036 0.000 0.004 0.744 0.000 0.252
#> GSM258593 1 0.4287 0.7796 0.800 0.116 0.056 0.000 0.028
#> GSM258595 3 0.6563 0.4733 0.040 0.168 0.596 0.000 0.196
#> GSM258597 4 0.4278 0.4990 0.000 0.000 0.000 0.548 0.452
#> GSM258598 4 0.4171 0.5411 0.000 0.000 0.000 0.604 0.396
#> GSM258600 2 0.0798 0.6476 0.000 0.976 0.008 0.000 0.016
#> GSM258601 3 0.0880 0.7482 0.000 0.000 0.968 0.000 0.032
#> GSM258602 4 0.3752 0.2270 0.000 0.000 0.000 0.708 0.292
#> GSM258604 3 0.1282 0.7460 0.004 0.000 0.952 0.000 0.044
#> GSM258605 3 0.1121 0.7432 0.000 0.000 0.956 0.000 0.044
#> GSM258606 4 0.1197 0.5875 0.000 0.000 0.000 0.952 0.048
#> GSM258607 5 0.6676 -0.2044 0.000 0.040 0.388 0.096 0.476
#> GSM258608 2 0.6888 -0.2317 0.004 0.392 0.000 0.268 0.336
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> GSM258553 1 0.0937 0.8250 0.960 0.000 0.000 0.040 0.000 0.000
#> GSM258555 1 0.0363 0.8250 0.988 0.000 0.000 0.012 0.000 0.000
#> GSM258556 4 0.7277 -0.3278 0.000 0.044 0.344 0.348 0.024 0.240
#> GSM258557 4 0.6589 -0.2256 0.288 0.320 0.000 0.368 0.024 0.000
#> GSM258562 3 0.6570 0.3094 0.284 0.076 0.520 0.112 0.008 0.000
#> GSM258563 1 0.4549 0.5599 0.596 0.008 0.000 0.368 0.028 0.000
#> GSM258565 1 0.0363 0.8250 0.988 0.000 0.000 0.012 0.000 0.000
#> GSM258566 1 0.0363 0.8250 0.988 0.000 0.000 0.012 0.000 0.000
#> GSM258570 1 0.0000 0.8262 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM258578 1 0.0363 0.8250 0.988 0.000 0.000 0.012 0.000 0.000
#> GSM258580 2 0.4115 0.6001 0.068 0.796 0.024 0.100 0.012 0.000
#> GSM258583 1 0.4029 0.6513 0.680 0.000 0.000 0.292 0.028 0.000
#> GSM258585 1 0.4699 0.5335 0.580 0.008 0.000 0.376 0.036 0.000
#> GSM258590 1 0.1610 0.8183 0.916 0.000 0.000 0.084 0.000 0.000
#> GSM258594 1 0.0000 0.8262 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM258596 1 0.2664 0.7808 0.816 0.000 0.000 0.184 0.000 0.000
#> GSM258599 1 0.2631 0.7808 0.820 0.000 0.000 0.180 0.000 0.000
#> GSM258603 1 0.1910 0.8114 0.892 0.000 0.000 0.108 0.000 0.000
#> GSM258551 6 0.5890 0.3966 0.000 0.008 0.000 0.180 0.308 0.504
#> GSM258552 2 0.0777 0.7025 0.000 0.972 0.000 0.024 0.004 0.000
#> GSM258554 6 0.5246 0.4709 0.000 0.008 0.000 0.108 0.280 0.604
#> GSM258558 6 0.5733 0.4471 0.000 0.052 0.000 0.072 0.308 0.568
#> GSM258559 5 0.2308 0.3352 0.000 0.000 0.004 0.008 0.880 0.108
#> GSM258560 5 0.5420 0.3581 0.000 0.004 0.228 0.080 0.648 0.040
#> GSM258561 6 0.6551 0.3723 0.000 0.000 0.096 0.104 0.312 0.488
#> GSM258564 6 0.3670 0.3713 0.000 0.000 0.000 0.284 0.012 0.704
#> GSM258567 5 0.7390 0.0252 0.000 0.296 0.252 0.116 0.336 0.000
#> GSM258568 6 0.3986 0.4190 0.000 0.000 0.000 0.004 0.464 0.532
#> GSM258569 3 0.5722 0.4502 0.020 0.264 0.604 0.100 0.008 0.004
#> GSM258571 3 0.0508 0.6930 0.000 0.000 0.984 0.004 0.012 0.000
#> GSM258572 2 0.1572 0.7040 0.000 0.936 0.000 0.036 0.028 0.000
#> GSM258573 6 0.1793 0.5471 0.000 0.004 0.000 0.032 0.036 0.928
#> GSM258574 2 0.2314 0.6946 0.000 0.900 0.000 0.036 0.056 0.008
#> GSM258575 6 0.6436 0.1666 0.000 0.312 0.000 0.016 0.280 0.392
#> GSM258576 6 0.4004 0.4904 0.000 0.000 0.000 0.012 0.368 0.620
#> GSM258577 5 0.6227 0.2662 0.000 0.264 0.000 0.268 0.456 0.012
#> GSM258579 6 0.6201 0.2900 0.000 0.288 0.000 0.016 0.220 0.476
#> GSM258581 6 0.4088 0.4897 0.000 0.000 0.000 0.016 0.368 0.616
#> GSM258582 3 0.1152 0.6904 0.004 0.000 0.952 0.044 0.000 0.000
#> GSM258584 5 0.4806 0.4966 0.000 0.012 0.108 0.156 0.716 0.008
#> GSM258586 2 0.6588 0.2245 0.000 0.464 0.020 0.336 0.024 0.156
#> GSM258587 6 0.2617 0.5437 0.000 0.004 0.000 0.040 0.080 0.876
#> GSM258588 2 0.6041 0.0992 0.000 0.480 0.008 0.040 0.396 0.076
#> GSM258589 2 0.5879 0.5705 0.000 0.656 0.012 0.120 0.132 0.080
#> GSM258591 6 0.4234 0.5371 0.000 0.000 0.000 0.044 0.280 0.676
#> GSM258592 3 0.4832 0.2920 0.000 0.008 0.612 0.056 0.324 0.000
#> GSM258593 1 0.6179 0.3350 0.588 0.180 0.056 0.172 0.000 0.004
#> GSM258595 3 0.8478 0.1837 0.092 0.204 0.372 0.248 0.028 0.056
#> GSM258597 6 0.2738 0.4723 0.000 0.000 0.000 0.176 0.004 0.820
#> GSM258598 6 0.2692 0.5001 0.000 0.000 0.000 0.148 0.012 0.840
#> GSM258600 2 0.1010 0.6991 0.000 0.960 0.000 0.036 0.004 0.000
#> GSM258601 3 0.1590 0.6850 0.000 0.000 0.936 0.048 0.008 0.008
#> GSM258602 5 0.3265 0.0994 0.000 0.000 0.000 0.004 0.748 0.248
#> GSM258604 3 0.2153 0.6693 0.004 0.000 0.900 0.084 0.008 0.004
#> GSM258605 3 0.0725 0.6921 0.000 0.000 0.976 0.012 0.012 0.000
#> GSM258606 6 0.4067 0.4400 0.000 0.000 0.000 0.008 0.444 0.548
#> GSM258607 6 0.6712 -0.1927 0.000 0.016 0.172 0.376 0.028 0.408
#> GSM258608 5 0.7111 0.2541 0.000 0.260 0.000 0.244 0.408 0.088
Heatmaps for the consensus matrix. It visualizes the probability of two samples to be in a same group.
consensus_heatmap(res, k = 2)
consensus_heatmap(res, k = 3)
consensus_heatmap(res, k = 4)
consensus_heatmap(res, k = 5)
consensus_heatmap(res, k = 6)
Heatmaps for the membership of samples in all partitions to see how consistent they are:
membership_heatmap(res, k = 2)
membership_heatmap(res, k = 3)
membership_heatmap(res, k = 4)
membership_heatmap(res, k = 5)
membership_heatmap(res, k = 6)
As soon as we have had the classes for columns, we can look for signatures which are significantly different between classes which can be candidate marks for certain classes. Following are the heatmaps for signatures.
Signature heatmaps where rows are scaled:
get_signatures(res, k = 2)
get_signatures(res, k = 3)
get_signatures(res, k = 4)
get_signatures(res, k = 5)
get_signatures(res, k = 6)
Signature heatmaps where rows are not scaled:
get_signatures(res, k = 2, scale_rows = FALSE)
get_signatures(res, k = 3, scale_rows = FALSE)
get_signatures(res, k = 4, scale_rows = FALSE)
get_signatures(res, k = 5, scale_rows = FALSE)
get_signatures(res, k = 6, scale_rows = FALSE)
Compare the overlap of signatures from different k:
compare_signatures(res)
get_signature()
returns a data frame invisibly. TO get the list of signatures, the function
call should be assigned to a variable explicitly. In following code, if plot
argument is set
to FALSE
, no heatmap is plotted while only the differential analysis is performed.
# code only for demonstration
tb = get_signature(res, k = ..., plot = FALSE)
An example of the output of tb
is:
#> which_row fdr mean_1 mean_2 scaled_mean_1 scaled_mean_2 km
#> 1 38 0.042760348 8.373488 9.131774 -0.5533452 0.5164555 1
#> 2 40 0.018707592 7.106213 8.469186 -0.6173731 0.5762149 1
#> 3 55 0.019134737 10.221463 11.207825 -0.6159697 0.5749050 1
#> 4 59 0.006059896 5.921854 7.869574 -0.6899429 0.6439467 1
#> 5 60 0.018055526 8.928898 10.211722 -0.6204761 0.5791110 1
#> 6 98 0.009384629 15.714769 14.887706 0.6635654 -0.6193277 2
...
The columns in tb
are:
which_row
: row indices corresponding to the input matrix.fdr
: FDR for the differential test. mean_x
: The mean value in group x.scaled_mean_x
: The mean value in group x after rows are scaled.km
: Row groups if k-means clustering is applied to rows.UMAP plot which shows how samples are separated.
dimension_reduction(res, k = 2, method = "UMAP")
dimension_reduction(res, k = 3, method = "UMAP")
dimension_reduction(res, k = 4, method = "UMAP")
dimension_reduction(res, k = 5, method = "UMAP")
dimension_reduction(res, k = 6, method = "UMAP")
Following heatmap shows how subgroups are split when increasing k
:
collect_classes(res)
Test correlation between subgroups and known annotations. If the known annotation is numeric, one-way ANOVA test is applied, and if the known annotation is discrete, chi-squared contingency table test is applied.
test_to_known_factors(res)
#> n disease.state(p) k
#> MAD:skmeans 56 1.11e-06 2
#> MAD:skmeans 43 2.46e-08 3
#> MAD:skmeans 52 6.98e-08 4
#> MAD:skmeans 41 1.45e-06 5
#> MAD:skmeans 29 1.12e-05 6
If matrix rows can be associated to genes, consider to use functional_enrichment(res,
...)
to perform function enrichment for the signature genes. See this vignette for more detailed explanations.
The object with results only for a single top-value method and a single partition method can be extracted as:
res = res_list["MAD", "pam"]
# you can also extract it by
# res = res_list["MAD:pam"]
A summary of res
and all the functions that can be applied to it:
res
#> A 'ConsensusPartition' object with k = 2, 3, 4, 5, 6.
#> On a matrix with 51941 rows and 58 columns.
#> Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'MAD' method.
#> Subgroups are detected by 'pam' method.
#> Performed in total 1250 partitions by row resampling.
#> Best k for subgroups seems to be 2.
#>
#> Following methods can be applied to this 'ConsensusPartition' object:
#> [1] "cola_report" "collect_classes" "collect_plots"
#> [4] "collect_stats" "colnames" "compare_signatures"
#> [7] "consensus_heatmap" "dimension_reduction" "functional_enrichment"
#> [10] "get_anno_col" "get_anno" "get_classes"
#> [13] "get_consensus" "get_matrix" "get_membership"
#> [16] "get_param" "get_signatures" "get_stats"
#> [19] "is_best_k" "is_stable_k" "membership_heatmap"
#> [22] "ncol" "nrow" "plot_ecdf"
#> [25] "rownames" "select_partition_number" "show"
#> [28] "suggest_best_k" "test_to_known_factors"
collect_plots()
function collects all the plots made from res
for all k
(number of partitions)
into one single page to provide an easy and fast comparison between different k
.
collect_plots(res)
The plots are:
k
and the heatmap of
predicted classes for each k
.k
.k
.k
.All the plots in panels can be made by individual functions and they are plotted later in this section.
select_partition_number()
produces several plots showing different
statistics for choosing “optimized” k
. There are following statistics:
k
;k
, the area increased is defined as \(A_k - A_{k-1}\).The detailed explanations of these statistics can be found in the cola vignette.
Generally speaking, lower PAC score, higher mean silhouette score or higher
concordance corresponds to better partition. Rand index and Jaccard index
measure how similar the current partition is compared to partition with k-1
.
If they are too similar, we won't accept k
is better than k-1
.
select_partition_number(res)
The numeric values for all these statistics can be obtained by get_stats()
.
get_stats(res)
#> k 1-PAC mean_silhouette concordance area_increased Rand Jaccard
#> 2 2 0.999 0.957 0.982 0.4720 0.521 0.521
#> 3 3 0.865 0.886 0.954 0.3796 0.682 0.465
#> 4 4 0.817 0.771 0.900 0.1118 0.873 0.662
#> 5 5 0.865 0.755 0.900 0.0542 0.938 0.786
#> 6 6 0.826 0.734 0.888 0.0662 0.947 0.780
suggest_best_k()
suggests the best \(k\) based on these statistics. The rules are as follows:
suggest_best_k(res)
#> [1] 2
Following shows the table of the partitions (You need to click the show/hide
code output link to see it). The membership matrix (columns with name p*
)
is inferred by
clue::cl_consensus()
function with the SE
method. Basically the value in the membership matrix
represents the probability to belong to a certain group. The finall class
label for an item is determined with the group with highest probability it
belongs to.
In get_classes()
function, the entropy is calculated from the membership
matrix and the silhouette score is calculated from the consensus matrix.
cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#> class entropy silhouette p1 p2
#> GSM258553 1 0.0000 0.956 1.000 0.000
#> GSM258555 1 0.0000 0.956 1.000 0.000
#> GSM258556 2 0.0000 0.995 0.000 1.000
#> GSM258557 1 0.0672 0.952 0.992 0.008
#> GSM258562 1 0.0000 0.956 1.000 0.000
#> GSM258563 1 0.0000 0.956 1.000 0.000
#> GSM258565 1 0.0000 0.956 1.000 0.000
#> GSM258566 1 0.0000 0.956 1.000 0.000
#> GSM258570 1 0.0000 0.956 1.000 0.000
#> GSM258578 1 0.0000 0.956 1.000 0.000
#> GSM258580 1 0.6048 0.824 0.852 0.148
#> GSM258583 1 0.0000 0.956 1.000 0.000
#> GSM258585 1 0.2603 0.927 0.956 0.044
#> GSM258590 1 0.0000 0.956 1.000 0.000
#> GSM258594 1 0.0000 0.956 1.000 0.000
#> GSM258596 1 0.0000 0.956 1.000 0.000
#> GSM258599 1 0.0000 0.956 1.000 0.000
#> GSM258603 1 0.0000 0.956 1.000 0.000
#> GSM258551 2 0.0000 0.995 0.000 1.000
#> GSM258552 2 0.0000 0.995 0.000 1.000
#> GSM258554 2 0.0000 0.995 0.000 1.000
#> GSM258558 2 0.0000 0.995 0.000 1.000
#> GSM258559 2 0.0000 0.995 0.000 1.000
#> GSM258560 2 0.0000 0.995 0.000 1.000
#> GSM258561 2 0.0000 0.995 0.000 1.000
#> GSM258564 2 0.0000 0.995 0.000 1.000
#> GSM258567 2 0.0938 0.984 0.012 0.988
#> GSM258568 2 0.0000 0.995 0.000 1.000
#> GSM258569 1 0.9988 0.126 0.520 0.480
#> GSM258571 1 0.7219 0.759 0.800 0.200
#> GSM258572 2 0.0000 0.995 0.000 1.000
#> GSM258573 2 0.0000 0.995 0.000 1.000
#> GSM258574 2 0.0000 0.995 0.000 1.000
#> GSM258575 2 0.0000 0.995 0.000 1.000
#> GSM258576 2 0.0000 0.995 0.000 1.000
#> GSM258577 2 0.0000 0.995 0.000 1.000
#> GSM258579 2 0.0000 0.995 0.000 1.000
#> GSM258581 2 0.0000 0.995 0.000 1.000
#> GSM258582 1 0.0000 0.956 1.000 0.000
#> GSM258584 2 0.0376 0.992 0.004 0.996
#> GSM258586 2 0.0000 0.995 0.000 1.000
#> GSM258587 2 0.0000 0.995 0.000 1.000
#> GSM258588 2 0.0000 0.995 0.000 1.000
#> GSM258589 2 0.0000 0.995 0.000 1.000
#> GSM258591 2 0.0000 0.995 0.000 1.000
#> GSM258592 2 0.3431 0.932 0.064 0.936
#> GSM258593 1 0.0000 0.956 1.000 0.000
#> GSM258595 2 0.0000 0.995 0.000 1.000
#> GSM258597 2 0.0000 0.995 0.000 1.000
#> GSM258598 2 0.0000 0.995 0.000 1.000
#> GSM258600 2 0.0376 0.992 0.004 0.996
#> GSM258601 2 0.0000 0.995 0.000 1.000
#> GSM258602 2 0.0000 0.995 0.000 1.000
#> GSM258604 2 0.3879 0.917 0.076 0.924
#> GSM258605 1 0.2043 0.936 0.968 0.032
#> GSM258606 2 0.0000 0.995 0.000 1.000
#> GSM258607 2 0.0000 0.995 0.000 1.000
#> GSM258608 2 0.0000 0.995 0.000 1.000
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> GSM258553 1 0.0000 0.990 1.000 0.000 0.000
#> GSM258555 1 0.0000 0.990 1.000 0.000 0.000
#> GSM258556 2 0.0000 0.947 0.000 1.000 0.000
#> GSM258557 3 0.0000 0.896 0.000 0.000 1.000
#> GSM258562 1 0.0000 0.990 1.000 0.000 0.000
#> GSM258563 1 0.3551 0.846 0.868 0.000 0.132
#> GSM258565 1 0.0000 0.990 1.000 0.000 0.000
#> GSM258566 1 0.0000 0.990 1.000 0.000 0.000
#> GSM258570 1 0.0000 0.990 1.000 0.000 0.000
#> GSM258578 1 0.0000 0.990 1.000 0.000 0.000
#> GSM258580 3 0.0000 0.896 0.000 0.000 1.000
#> GSM258583 1 0.0000 0.990 1.000 0.000 0.000
#> GSM258585 3 0.5988 0.417 0.000 0.368 0.632
#> GSM258590 1 0.0000 0.990 1.000 0.000 0.000
#> GSM258594 1 0.0000 0.990 1.000 0.000 0.000
#> GSM258596 1 0.0000 0.990 1.000 0.000 0.000
#> GSM258599 1 0.0000 0.990 1.000 0.000 0.000
#> GSM258603 1 0.0000 0.990 1.000 0.000 0.000
#> GSM258551 2 0.1163 0.926 0.000 0.972 0.028
#> GSM258552 3 0.0000 0.896 0.000 0.000 1.000
#> GSM258554 2 0.0000 0.947 0.000 1.000 0.000
#> GSM258558 3 0.2261 0.852 0.000 0.068 0.932
#> GSM258559 2 0.0000 0.947 0.000 1.000 0.000
#> GSM258560 2 0.0000 0.947 0.000 1.000 0.000
#> GSM258561 2 0.0000 0.947 0.000 1.000 0.000
#> GSM258564 2 0.0000 0.947 0.000 1.000 0.000
#> GSM258567 3 0.0000 0.896 0.000 0.000 1.000
#> GSM258568 2 0.0000 0.947 0.000 1.000 0.000
#> GSM258569 2 0.6126 0.302 0.000 0.600 0.400
#> GSM258571 2 0.2165 0.893 0.064 0.936 0.000
#> GSM258572 3 0.0000 0.896 0.000 0.000 1.000
#> GSM258573 2 0.0000 0.947 0.000 1.000 0.000
#> GSM258574 3 0.0000 0.896 0.000 0.000 1.000
#> GSM258575 2 0.0000 0.947 0.000 1.000 0.000
#> GSM258576 2 0.0000 0.947 0.000 1.000 0.000
#> GSM258577 3 0.5810 0.491 0.000 0.336 0.664
#> GSM258579 3 0.5785 0.518 0.000 0.332 0.668
#> GSM258581 2 0.0000 0.947 0.000 1.000 0.000
#> GSM258582 1 0.0000 0.990 1.000 0.000 0.000
#> GSM258584 2 0.4555 0.729 0.000 0.800 0.200
#> GSM258586 3 0.0000 0.896 0.000 0.000 1.000
#> GSM258587 2 0.0000 0.947 0.000 1.000 0.000
#> GSM258588 3 0.0000 0.896 0.000 0.000 1.000
#> GSM258589 3 0.0000 0.896 0.000 0.000 1.000
#> GSM258591 2 0.0000 0.947 0.000 1.000 0.000
#> GSM258592 2 0.4063 0.828 0.020 0.868 0.112
#> GSM258593 3 0.4555 0.678 0.200 0.000 0.800
#> GSM258595 2 0.0000 0.947 0.000 1.000 0.000
#> GSM258597 2 0.0000 0.947 0.000 1.000 0.000
#> GSM258598 2 0.0000 0.947 0.000 1.000 0.000
#> GSM258600 3 0.0000 0.896 0.000 0.000 1.000
#> GSM258601 2 0.0000 0.947 0.000 1.000 0.000
#> GSM258602 2 0.0000 0.947 0.000 1.000 0.000
#> GSM258604 2 0.0424 0.942 0.008 0.992 0.000
#> GSM258605 2 0.6192 0.311 0.420 0.580 0.000
#> GSM258606 2 0.0000 0.947 0.000 1.000 0.000
#> GSM258607 2 0.0000 0.947 0.000 1.000 0.000
#> GSM258608 3 0.0000 0.896 0.000 0.000 1.000
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> GSM258553 1 0.0000 0.9863 1.000 0.000 0.000 0.000
#> GSM258555 1 0.0000 0.9863 1.000 0.000 0.000 0.000
#> GSM258556 4 0.0000 0.9382 0.000 0.000 0.000 1.000
#> GSM258557 3 0.4925 0.1004 0.000 0.428 0.572 0.000
#> GSM258562 1 0.0000 0.9863 1.000 0.000 0.000 0.000
#> GSM258563 3 0.0707 0.6561 0.020 0.000 0.980 0.000
#> GSM258565 1 0.0000 0.9863 1.000 0.000 0.000 0.000
#> GSM258566 1 0.0000 0.9863 1.000 0.000 0.000 0.000
#> GSM258570 1 0.0000 0.9863 1.000 0.000 0.000 0.000
#> GSM258578 1 0.0000 0.9863 1.000 0.000 0.000 0.000
#> GSM258580 2 0.0000 0.8793 0.000 1.000 0.000 0.000
#> GSM258583 3 0.3172 0.6258 0.160 0.000 0.840 0.000
#> GSM258585 3 0.2011 0.6483 0.000 0.080 0.920 0.000
#> GSM258590 3 0.4730 0.4081 0.364 0.000 0.636 0.000
#> GSM258594 1 0.0000 0.9863 1.000 0.000 0.000 0.000
#> GSM258596 3 0.2469 0.6464 0.108 0.000 0.892 0.000
#> GSM258599 3 0.4843 0.3068 0.396 0.000 0.604 0.000
#> GSM258603 3 0.4585 0.4576 0.332 0.000 0.668 0.000
#> GSM258551 4 0.0921 0.9143 0.000 0.028 0.000 0.972
#> GSM258552 2 0.0000 0.8793 0.000 1.000 0.000 0.000
#> GSM258554 4 0.0000 0.9382 0.000 0.000 0.000 1.000
#> GSM258558 2 0.1792 0.8147 0.000 0.932 0.000 0.068
#> GSM258559 4 0.0000 0.9382 0.000 0.000 0.000 1.000
#> GSM258560 4 0.1637 0.8855 0.000 0.000 0.060 0.940
#> GSM258561 4 0.0000 0.9382 0.000 0.000 0.000 1.000
#> GSM258564 4 0.0000 0.9382 0.000 0.000 0.000 1.000
#> GSM258567 2 0.4134 0.6107 0.000 0.740 0.260 0.000
#> GSM258568 4 0.0000 0.9382 0.000 0.000 0.000 1.000
#> GSM258569 4 0.7186 0.0955 0.000 0.384 0.140 0.476
#> GSM258571 4 0.4992 0.1196 0.000 0.000 0.476 0.524
#> GSM258572 2 0.0000 0.8793 0.000 1.000 0.000 0.000
#> GSM258573 4 0.0000 0.9382 0.000 0.000 0.000 1.000
#> GSM258574 2 0.0000 0.8793 0.000 1.000 0.000 0.000
#> GSM258575 4 0.0000 0.9382 0.000 0.000 0.000 1.000
#> GSM258576 4 0.0000 0.9382 0.000 0.000 0.000 1.000
#> GSM258577 2 0.6238 0.3643 0.000 0.632 0.276 0.092
#> GSM258579 2 0.4585 0.4310 0.000 0.668 0.000 0.332
#> GSM258581 4 0.0000 0.9382 0.000 0.000 0.000 1.000
#> GSM258582 1 0.2081 0.8850 0.916 0.000 0.084 0.000
#> GSM258584 3 0.7410 0.3041 0.000 0.184 0.488 0.328
#> GSM258586 2 0.0000 0.8793 0.000 1.000 0.000 0.000
#> GSM258587 4 0.0000 0.9382 0.000 0.000 0.000 1.000
#> GSM258588 2 0.1637 0.8354 0.000 0.940 0.060 0.000
#> GSM258589 2 0.0000 0.8793 0.000 1.000 0.000 0.000
#> GSM258591 4 0.0000 0.9382 0.000 0.000 0.000 1.000
#> GSM258592 4 0.4934 0.7173 0.004 0.084 0.128 0.784
#> GSM258593 3 0.5602 0.0620 0.020 0.472 0.508 0.000
#> GSM258595 4 0.0000 0.9382 0.000 0.000 0.000 1.000
#> GSM258597 4 0.0000 0.9382 0.000 0.000 0.000 1.000
#> GSM258598 4 0.0000 0.9382 0.000 0.000 0.000 1.000
#> GSM258600 2 0.0000 0.8793 0.000 1.000 0.000 0.000
#> GSM258601 4 0.0188 0.9354 0.000 0.000 0.004 0.996
#> GSM258602 4 0.0000 0.9382 0.000 0.000 0.000 1.000
#> GSM258604 3 0.4605 0.4215 0.000 0.000 0.664 0.336
#> GSM258605 3 0.2256 0.6500 0.020 0.000 0.924 0.056
#> GSM258606 4 0.0000 0.9382 0.000 0.000 0.000 1.000
#> GSM258607 4 0.0000 0.9382 0.000 0.000 0.000 1.000
#> GSM258608 2 0.0000 0.8793 0.000 1.000 0.000 0.000
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> GSM258553 1 0.0000 0.876112 1.000 0.000 0.000 0.000 0.000
#> GSM258555 1 0.0000 0.876112 1.000 0.000 0.000 0.000 0.000
#> GSM258556 4 0.0000 0.953924 0.000 0.000 0.000 1.000 0.000
#> GSM258557 5 0.4310 0.284539 0.000 0.392 0.004 0.000 0.604
#> GSM258562 1 0.1270 0.833588 0.948 0.000 0.052 0.000 0.000
#> GSM258563 5 0.0000 0.645997 0.000 0.000 0.000 0.000 1.000
#> GSM258565 1 0.0000 0.876112 1.000 0.000 0.000 0.000 0.000
#> GSM258566 1 0.0000 0.876112 1.000 0.000 0.000 0.000 0.000
#> GSM258570 1 0.0000 0.876112 1.000 0.000 0.000 0.000 0.000
#> GSM258578 1 0.0000 0.876112 1.000 0.000 0.000 0.000 0.000
#> GSM258580 2 0.0000 0.831526 0.000 1.000 0.000 0.000 0.000
#> GSM258583 5 0.1121 0.642732 0.044 0.000 0.000 0.000 0.956
#> GSM258585 5 0.0000 0.645997 0.000 0.000 0.000 0.000 1.000
#> GSM258590 1 0.4278 0.294711 0.548 0.000 0.000 0.000 0.452
#> GSM258594 1 0.0000 0.876112 1.000 0.000 0.000 0.000 0.000
#> GSM258596 5 0.1341 0.637571 0.056 0.000 0.000 0.000 0.944
#> GSM258599 5 0.3774 0.409844 0.296 0.000 0.000 0.000 0.704
#> GSM258603 1 0.4294 0.263434 0.532 0.000 0.000 0.000 0.468
#> GSM258551 4 0.0794 0.935112 0.000 0.028 0.000 0.972 0.000
#> GSM258552 2 0.0000 0.831526 0.000 1.000 0.000 0.000 0.000
#> GSM258554 4 0.0000 0.953924 0.000 0.000 0.000 1.000 0.000
#> GSM258558 2 0.2079 0.763361 0.000 0.916 0.020 0.064 0.000
#> GSM258559 4 0.0609 0.946600 0.000 0.000 0.020 0.980 0.000
#> GSM258560 4 0.3395 0.684285 0.000 0.000 0.236 0.764 0.000
#> GSM258561 4 0.0000 0.953924 0.000 0.000 0.000 1.000 0.000
#> GSM258564 4 0.0000 0.953924 0.000 0.000 0.000 1.000 0.000
#> GSM258567 2 0.6513 0.000929 0.000 0.424 0.384 0.000 0.192
#> GSM258568 4 0.1043 0.938577 0.000 0.000 0.040 0.960 0.000
#> GSM258569 4 0.5213 0.243657 0.000 0.396 0.000 0.556 0.048
#> GSM258571 3 0.1216 0.929354 0.000 0.000 0.960 0.020 0.020
#> GSM258572 2 0.0000 0.831526 0.000 1.000 0.000 0.000 0.000
#> GSM258573 4 0.0000 0.953924 0.000 0.000 0.000 1.000 0.000
#> GSM258574 2 0.0000 0.831526 0.000 1.000 0.000 0.000 0.000
#> GSM258575 4 0.0000 0.953924 0.000 0.000 0.000 1.000 0.000
#> GSM258576 4 0.1043 0.938577 0.000 0.000 0.040 0.960 0.000
#> GSM258577 2 0.5400 0.356617 0.000 0.632 0.000 0.096 0.272
#> GSM258579 2 0.3949 0.415312 0.000 0.668 0.000 0.332 0.000
#> GSM258581 4 0.0609 0.945394 0.000 0.000 0.020 0.980 0.000
#> GSM258582 3 0.1197 0.911987 0.048 0.000 0.952 0.000 0.000
#> GSM258584 5 0.7538 -0.077102 0.000 0.056 0.360 0.192 0.392
#> GSM258586 2 0.0000 0.831526 0.000 1.000 0.000 0.000 0.000
#> GSM258587 4 0.0000 0.953924 0.000 0.000 0.000 1.000 0.000
#> GSM258588 2 0.3424 0.615862 0.000 0.760 0.240 0.000 0.000
#> GSM258589 2 0.0000 0.831526 0.000 1.000 0.000 0.000 0.000
#> GSM258591 4 0.0000 0.953924 0.000 0.000 0.000 1.000 0.000
#> GSM258592 3 0.0609 0.922567 0.000 0.000 0.980 0.020 0.000
#> GSM258593 5 0.5159 0.256922 0.044 0.400 0.000 0.000 0.556
#> GSM258595 4 0.0000 0.953924 0.000 0.000 0.000 1.000 0.000
#> GSM258597 4 0.0000 0.953924 0.000 0.000 0.000 1.000 0.000
#> GSM258598 4 0.0000 0.953924 0.000 0.000 0.000 1.000 0.000
#> GSM258600 2 0.0000 0.831526 0.000 1.000 0.000 0.000 0.000
#> GSM258601 4 0.0703 0.940477 0.000 0.000 0.024 0.976 0.000
#> GSM258602 4 0.0609 0.946600 0.000 0.000 0.020 0.980 0.000
#> GSM258604 5 0.4696 0.470684 0.000 0.000 0.108 0.156 0.736
#> GSM258605 3 0.2179 0.865273 0.000 0.000 0.888 0.000 0.112
#> GSM258606 4 0.1043 0.938577 0.000 0.000 0.040 0.960 0.000
#> GSM258607 4 0.0000 0.953924 0.000 0.000 0.000 1.000 0.000
#> GSM258608 2 0.0000 0.831526 0.000 1.000 0.000 0.000 0.000
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> GSM258553 1 0.0146 0.8744 0.996 0.000 0.000 0.000 0.000 0.004
#> GSM258555 1 0.0000 0.8756 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM258556 4 0.0000 0.9287 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM258557 5 0.3872 0.2540 0.000 0.392 0.004 0.000 0.604 0.000
#> GSM258562 1 0.1141 0.8363 0.948 0.000 0.052 0.000 0.000 0.000
#> GSM258563 5 0.0000 0.6533 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM258565 1 0.0000 0.8756 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM258566 1 0.0000 0.8756 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM258570 1 0.0146 0.8744 0.996 0.000 0.000 0.000 0.000 0.004
#> GSM258578 1 0.0000 0.8756 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM258580 2 0.0000 0.8255 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM258583 5 0.0713 0.6526 0.028 0.000 0.000 0.000 0.972 0.000
#> GSM258585 5 0.0000 0.6533 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM258590 1 0.3971 0.2989 0.548 0.000 0.000 0.000 0.448 0.004
#> GSM258594 1 0.0000 0.8756 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM258596 5 0.1204 0.6426 0.056 0.000 0.000 0.000 0.944 0.000
#> GSM258599 5 0.3528 0.4074 0.296 0.000 0.000 0.000 0.700 0.004
#> GSM258603 1 0.3986 0.2680 0.532 0.000 0.000 0.000 0.464 0.004
#> GSM258551 4 0.0713 0.9113 0.000 0.028 0.000 0.972 0.000 0.000
#> GSM258552 2 0.0000 0.8255 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM258554 4 0.0000 0.9287 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM258558 6 0.2664 0.7296 0.000 0.184 0.000 0.000 0.000 0.816
#> GSM258559 4 0.1910 0.8478 0.000 0.000 0.000 0.892 0.000 0.108
#> GSM258560 4 0.4668 0.5832 0.000 0.000 0.204 0.680 0.000 0.116
#> GSM258561 4 0.0000 0.9287 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM258564 4 0.0000 0.9287 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM258567 2 0.6036 0.0628 0.000 0.424 0.384 0.000 0.184 0.008
#> GSM258568 6 0.0458 0.8823 0.000 0.000 0.000 0.016 0.000 0.984
#> GSM258569 4 0.4682 0.3074 0.000 0.396 0.000 0.556 0.048 0.000
#> GSM258571 3 0.0000 0.9338 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM258572 2 0.0000 0.8255 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM258573 4 0.0363 0.9223 0.000 0.000 0.000 0.988 0.000 0.012
#> GSM258574 2 0.0000 0.8255 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM258575 4 0.0000 0.9287 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM258576 6 0.0790 0.8826 0.000 0.000 0.000 0.032 0.000 0.968
#> GSM258577 2 0.4851 0.3373 0.000 0.632 0.000 0.096 0.272 0.000
#> GSM258579 2 0.5133 0.3486 0.000 0.592 0.000 0.116 0.000 0.292
#> GSM258581 6 0.2048 0.8036 0.000 0.000 0.000 0.120 0.000 0.880
#> GSM258582 3 0.0260 0.9338 0.008 0.000 0.992 0.000 0.000 0.000
#> GSM258584 5 0.7567 -0.0405 0.000 0.016 0.288 0.188 0.392 0.116
#> GSM258586 2 0.0000 0.8255 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM258587 4 0.0000 0.9287 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM258588 2 0.4681 0.5194 0.000 0.676 0.212 0.000 0.000 0.112
#> GSM258589 2 0.0000 0.8255 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM258591 4 0.0000 0.9287 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM258592 3 0.1663 0.8765 0.000 0.000 0.912 0.000 0.000 0.088
#> GSM258593 5 0.4634 0.2250 0.044 0.400 0.000 0.000 0.556 0.000
#> GSM258595 4 0.0000 0.9287 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM258597 4 0.0000 0.9287 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM258598 4 0.0000 0.9287 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM258600 2 0.0000 0.8255 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM258601 4 0.0790 0.9116 0.000 0.000 0.032 0.968 0.000 0.000
#> GSM258602 4 0.2762 0.7706 0.000 0.000 0.000 0.804 0.000 0.196
#> GSM258604 5 0.4736 0.4383 0.000 0.000 0.164 0.156 0.680 0.000
#> GSM258605 3 0.1267 0.8944 0.000 0.000 0.940 0.000 0.060 0.000
#> GSM258606 6 0.0363 0.8791 0.000 0.000 0.000 0.012 0.000 0.988
#> GSM258607 4 0.0000 0.9287 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM258608 2 0.0000 0.8255 0.000 1.000 0.000 0.000 0.000 0.000
Heatmaps for the consensus matrix. It visualizes the probability of two samples to be in a same group.
consensus_heatmap(res, k = 2)
consensus_heatmap(res, k = 3)
consensus_heatmap(res, k = 4)
consensus_heatmap(res, k = 5)
consensus_heatmap(res, k = 6)
Heatmaps for the membership of samples in all partitions to see how consistent they are:
membership_heatmap(res, k = 2)
membership_heatmap(res, k = 3)
membership_heatmap(res, k = 4)
membership_heatmap(res, k = 5)
membership_heatmap(res, k = 6)
As soon as we have had the classes for columns, we can look for signatures which are significantly different between classes which can be candidate marks for certain classes. Following are the heatmaps for signatures.
Signature heatmaps where rows are scaled:
get_signatures(res, k = 2)
get_signatures(res, k = 3)
get_signatures(res, k = 4)
get_signatures(res, k = 5)
get_signatures(res, k = 6)
Signature heatmaps where rows are not scaled:
get_signatures(res, k = 2, scale_rows = FALSE)
get_signatures(res, k = 3, scale_rows = FALSE)
get_signatures(res, k = 4, scale_rows = FALSE)
get_signatures(res, k = 5, scale_rows = FALSE)
get_signatures(res, k = 6, scale_rows = FALSE)
Compare the overlap of signatures from different k:
compare_signatures(res)
get_signature()
returns a data frame invisibly. TO get the list of signatures, the function
call should be assigned to a variable explicitly. In following code, if plot
argument is set
to FALSE
, no heatmap is plotted while only the differential analysis is performed.
# code only for demonstration
tb = get_signature(res, k = ..., plot = FALSE)
An example of the output of tb
is:
#> which_row fdr mean_1 mean_2 scaled_mean_1 scaled_mean_2 km
#> 1 38 0.042760348 8.373488 9.131774 -0.5533452 0.5164555 1
#> 2 40 0.018707592 7.106213 8.469186 -0.6173731 0.5762149 1
#> 3 55 0.019134737 10.221463 11.207825 -0.6159697 0.5749050 1
#> 4 59 0.006059896 5.921854 7.869574 -0.6899429 0.6439467 1
#> 5 60 0.018055526 8.928898 10.211722 -0.6204761 0.5791110 1
#> 6 98 0.009384629 15.714769 14.887706 0.6635654 -0.6193277 2
...
The columns in tb
are:
which_row
: row indices corresponding to the input matrix.fdr
: FDR for the differential test. mean_x
: The mean value in group x.scaled_mean_x
: The mean value in group x after rows are scaled.km
: Row groups if k-means clustering is applied to rows.UMAP plot which shows how samples are separated.
dimension_reduction(res, k = 2, method = "UMAP")
dimension_reduction(res, k = 3, method = "UMAP")
dimension_reduction(res, k = 4, method = "UMAP")
dimension_reduction(res, k = 5, method = "UMAP")
dimension_reduction(res, k = 6, method = "UMAP")
Following heatmap shows how subgroups are split when increasing k
:
collect_classes(res)
Test correlation between subgroups and known annotations. If the known annotation is numeric, one-way ANOVA test is applied, and if the known annotation is discrete, chi-squared contingency table test is applied.
test_to_known_factors(res)
#> n disease.state(p) k
#> MAD:pam 57 5.56e-09 2
#> MAD:pam 54 8.05e-09 3
#> MAD:pam 47 1.37e-06 4
#> MAD:pam 47 1.05e-07 5
#> MAD:pam 47 3.36e-07 6
If matrix rows can be associated to genes, consider to use functional_enrichment(res,
...)
to perform function enrichment for the signature genes. See this vignette for more detailed explanations.
The object with results only for a single top-value method and a single partition method can be extracted as:
res = res_list["MAD", "mclust"]
# you can also extract it by
# res = res_list["MAD:mclust"]
A summary of res
and all the functions that can be applied to it:
res
#> A 'ConsensusPartition' object with k = 2, 3, 4, 5, 6.
#> On a matrix with 51941 rows and 58 columns.
#> Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'MAD' method.
#> Subgroups are detected by 'mclust' method.
#> Performed in total 1250 partitions by row resampling.
#> Best k for subgroups seems to be 4.
#>
#> Following methods can be applied to this 'ConsensusPartition' object:
#> [1] "cola_report" "collect_classes" "collect_plots"
#> [4] "collect_stats" "colnames" "compare_signatures"
#> [7] "consensus_heatmap" "dimension_reduction" "functional_enrichment"
#> [10] "get_anno_col" "get_anno" "get_classes"
#> [13] "get_consensus" "get_matrix" "get_membership"
#> [16] "get_param" "get_signatures" "get_stats"
#> [19] "is_best_k" "is_stable_k" "membership_heatmap"
#> [22] "ncol" "nrow" "plot_ecdf"
#> [25] "rownames" "select_partition_number" "show"
#> [28] "suggest_best_k" "test_to_known_factors"
collect_plots()
function collects all the plots made from res
for all k
(number of partitions)
into one single page to provide an easy and fast comparison between different k
.
collect_plots(res)
The plots are:
k
and the heatmap of
predicted classes for each k
.k
.k
.k
.All the plots in panels can be made by individual functions and they are plotted later in this section.
select_partition_number()
produces several plots showing different
statistics for choosing “optimized” k
. There are following statistics:
k
;k
, the area increased is defined as \(A_k - A_{k-1}\).The detailed explanations of these statistics can be found in the cola vignette.
Generally speaking, lower PAC score, higher mean silhouette score or higher
concordance corresponds to better partition. Rand index and Jaccard index
measure how similar the current partition is compared to partition with k-1
.
If they are too similar, we won't accept k
is better than k-1
.
select_partition_number(res)
The numeric values for all these statistics can be obtained by get_stats()
.
get_stats(res)
#> k 1-PAC mean_silhouette concordance area_increased Rand Jaccard
#> 2 2 0.402 0.795 0.862 0.3906 0.578 0.578
#> 3 3 0.466 0.544 0.778 0.6542 0.691 0.493
#> 4 4 0.507 0.613 0.787 0.1394 0.851 0.593
#> 5 5 0.577 0.502 0.712 0.0699 0.909 0.675
#> 6 6 0.680 0.575 0.752 0.0499 0.877 0.518
suggest_best_k()
suggests the best \(k\) based on these statistics. The rules are as follows:
suggest_best_k(res)
#> [1] 4
Following shows the table of the partitions (You need to click the show/hide
code output link to see it). The membership matrix (columns with name p*
)
is inferred by
clue::cl_consensus()
function with the SE
method. Basically the value in the membership matrix
represents the probability to belong to a certain group. The finall class
label for an item is determined with the group with highest probability it
belongs to.
In get_classes()
function, the entropy is calculated from the membership
matrix and the silhouette score is calculated from the consensus matrix.
cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#> class entropy silhouette p1 p2
#> GSM258553 1 0.8267 0.908 0.740 0.260
#> GSM258555 1 0.8267 0.908 0.740 0.260
#> GSM258556 2 0.0000 0.879 0.000 1.000
#> GSM258557 1 0.8955 0.583 0.688 0.312
#> GSM258562 2 0.8955 0.293 0.312 0.688
#> GSM258563 1 0.6148 0.778 0.848 0.152
#> GSM258565 1 0.8267 0.908 0.740 0.260
#> GSM258566 1 0.8267 0.908 0.740 0.260
#> GSM258570 1 0.8267 0.908 0.740 0.260
#> GSM258578 1 0.8267 0.908 0.740 0.260
#> GSM258580 1 0.9358 0.198 0.648 0.352
#> GSM258583 1 0.8267 0.908 0.740 0.260
#> GSM258585 1 0.9795 0.701 0.584 0.416
#> GSM258590 1 0.8267 0.908 0.740 0.260
#> GSM258594 1 0.8267 0.908 0.740 0.260
#> GSM258596 1 0.8499 0.896 0.724 0.276
#> GSM258599 1 0.8327 0.906 0.736 0.264
#> GSM258603 1 0.8267 0.908 0.740 0.260
#> GSM258551 2 0.0000 0.879 0.000 1.000
#> GSM258552 2 0.8327 0.654 0.264 0.736
#> GSM258554 2 0.0000 0.879 0.000 1.000
#> GSM258558 2 0.0000 0.879 0.000 1.000
#> GSM258559 2 0.0000 0.879 0.000 1.000
#> GSM258560 2 0.0000 0.879 0.000 1.000
#> GSM258561 2 0.0000 0.879 0.000 1.000
#> GSM258564 2 0.0000 0.879 0.000 1.000
#> GSM258567 2 0.8267 0.661 0.260 0.740
#> GSM258568 2 0.0000 0.879 0.000 1.000
#> GSM258569 2 0.2778 0.836 0.048 0.952
#> GSM258571 2 0.8207 0.462 0.256 0.744
#> GSM258572 2 0.8327 0.654 0.264 0.736
#> GSM258573 2 0.0000 0.879 0.000 1.000
#> GSM258574 2 0.8267 0.656 0.260 0.740
#> GSM258575 2 0.0000 0.879 0.000 1.000
#> GSM258576 2 0.0000 0.879 0.000 1.000
#> GSM258577 2 0.0000 0.879 0.000 1.000
#> GSM258579 2 0.6148 0.751 0.152 0.848
#> GSM258581 2 0.0000 0.879 0.000 1.000
#> GSM258582 2 0.8386 0.432 0.268 0.732
#> GSM258584 2 0.0376 0.876 0.004 0.996
#> GSM258586 2 0.8386 0.652 0.268 0.732
#> GSM258587 2 0.0000 0.879 0.000 1.000
#> GSM258588 2 0.8267 0.656 0.260 0.740
#> GSM258589 2 0.0000 0.879 0.000 1.000
#> GSM258591 2 0.0000 0.879 0.000 1.000
#> GSM258592 2 0.0376 0.876 0.004 0.996
#> GSM258593 1 0.8955 0.855 0.688 0.312
#> GSM258595 2 0.2423 0.844 0.040 0.960
#> GSM258597 2 0.0000 0.879 0.000 1.000
#> GSM258598 2 0.0000 0.879 0.000 1.000
#> GSM258600 2 0.8327 0.654 0.264 0.736
#> GSM258601 2 0.1414 0.862 0.020 0.980
#> GSM258602 2 0.0000 0.879 0.000 1.000
#> GSM258604 2 0.4298 0.786 0.088 0.912
#> GSM258605 2 0.8909 0.308 0.308 0.692
#> GSM258606 2 0.0000 0.879 0.000 1.000
#> GSM258607 2 0.0000 0.879 0.000 1.000
#> GSM258608 2 0.0000 0.879 0.000 1.000
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> GSM258553 1 0.0000 0.8433 1.000 0.000 0.000
#> GSM258555 1 0.0592 0.8395 0.988 0.000 0.012
#> GSM258556 3 0.8220 0.1132 0.076 0.408 0.516
#> GSM258557 3 0.6804 -0.1088 0.460 0.012 0.528
#> GSM258562 3 0.8179 0.1561 0.424 0.072 0.504
#> GSM258563 1 0.6518 0.1157 0.512 0.004 0.484
#> GSM258565 1 0.0000 0.8433 1.000 0.000 0.000
#> GSM258566 1 0.0424 0.8414 0.992 0.000 0.008
#> GSM258570 1 0.0000 0.8433 1.000 0.000 0.000
#> GSM258578 1 0.0592 0.8395 0.988 0.000 0.012
#> GSM258580 3 0.5982 0.1124 0.328 0.004 0.668
#> GSM258583 1 0.1163 0.8331 0.972 0.000 0.028
#> GSM258585 1 0.5480 0.5471 0.732 0.004 0.264
#> GSM258590 1 0.0000 0.8433 1.000 0.000 0.000
#> GSM258594 1 0.0424 0.8414 0.992 0.000 0.008
#> GSM258596 1 0.1399 0.8299 0.968 0.004 0.028
#> GSM258599 1 0.1163 0.8331 0.972 0.000 0.028
#> GSM258603 1 0.0000 0.8433 1.000 0.000 0.000
#> GSM258551 2 0.1643 0.8118 0.000 0.956 0.044
#> GSM258552 3 0.5591 0.3429 0.000 0.304 0.696
#> GSM258554 2 0.1163 0.8220 0.000 0.972 0.028
#> GSM258558 2 0.2796 0.7902 0.000 0.908 0.092
#> GSM258559 2 0.3412 0.7481 0.000 0.876 0.124
#> GSM258560 2 0.5678 0.4968 0.000 0.684 0.316
#> GSM258561 2 0.3116 0.7631 0.000 0.892 0.108
#> GSM258564 2 0.1860 0.8186 0.000 0.948 0.052
#> GSM258567 3 0.7640 0.3468 0.056 0.352 0.592
#> GSM258568 2 0.0237 0.8309 0.000 0.996 0.004
#> GSM258569 3 0.8675 0.2270 0.388 0.108 0.504
#> GSM258571 3 0.8260 0.1416 0.432 0.076 0.492
#> GSM258572 3 0.5591 0.3429 0.000 0.304 0.696
#> GSM258573 2 0.0892 0.8301 0.000 0.980 0.020
#> GSM258574 3 0.5650 0.3327 0.000 0.312 0.688
#> GSM258575 2 0.5882 0.3257 0.000 0.652 0.348
#> GSM258576 2 0.0237 0.8309 0.000 0.996 0.004
#> GSM258577 2 0.4842 0.6574 0.000 0.776 0.224
#> GSM258579 2 0.6026 0.3051 0.000 0.624 0.376
#> GSM258581 2 0.0747 0.8252 0.000 0.984 0.016
#> GSM258582 3 0.8249 0.1568 0.424 0.076 0.500
#> GSM258584 2 0.5138 0.5929 0.000 0.748 0.252
#> GSM258586 3 0.5760 0.3236 0.000 0.328 0.672
#> GSM258587 2 0.0424 0.8313 0.000 0.992 0.008
#> GSM258588 3 0.6126 0.2574 0.000 0.400 0.600
#> GSM258589 3 0.6180 0.2085 0.000 0.416 0.584
#> GSM258591 2 0.0237 0.8305 0.000 0.996 0.004
#> GSM258592 3 0.9488 0.3553 0.256 0.248 0.496
#> GSM258593 1 0.6476 0.2197 0.548 0.004 0.448
#> GSM258595 3 0.8549 0.2264 0.384 0.100 0.516
#> GSM258597 2 0.2066 0.8140 0.000 0.940 0.060
#> GSM258598 2 0.0424 0.8313 0.000 0.992 0.008
#> GSM258600 3 0.5591 0.3429 0.000 0.304 0.696
#> GSM258601 3 0.9438 0.3454 0.244 0.252 0.504
#> GSM258602 2 0.0424 0.8302 0.000 0.992 0.008
#> GSM258604 3 0.8363 0.1832 0.412 0.084 0.504
#> GSM258605 1 0.8249 -0.0617 0.500 0.076 0.424
#> GSM258606 2 0.0000 0.8300 0.000 1.000 0.000
#> GSM258607 2 0.6225 0.2785 0.000 0.568 0.432
#> GSM258608 2 0.5560 0.5476 0.000 0.700 0.300
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> GSM258553 1 0.0469 0.9210 0.988 0.000 0.000 0.012
#> GSM258555 1 0.0336 0.9183 0.992 0.000 0.000 0.008
#> GSM258556 3 0.4625 0.5409 0.008 0.092 0.812 0.088
#> GSM258557 4 0.5938 0.4472 0.216 0.012 0.072 0.700
#> GSM258562 3 0.4633 0.6701 0.172 0.000 0.780 0.048
#> GSM258563 4 0.7154 0.2330 0.320 0.008 0.124 0.548
#> GSM258565 1 0.0188 0.9206 0.996 0.000 0.004 0.000
#> GSM258566 1 0.0000 0.9209 1.000 0.000 0.000 0.000
#> GSM258570 1 0.0188 0.9215 0.996 0.000 0.000 0.004
#> GSM258578 1 0.0336 0.9183 0.992 0.000 0.000 0.008
#> GSM258580 4 0.3899 0.5492 0.052 0.000 0.108 0.840
#> GSM258583 1 0.2973 0.8477 0.856 0.000 0.000 0.144
#> GSM258585 4 0.7996 -0.2230 0.336 0.004 0.268 0.392
#> GSM258590 1 0.1389 0.9105 0.952 0.000 0.000 0.048
#> GSM258594 1 0.0000 0.9209 1.000 0.000 0.000 0.000
#> GSM258596 1 0.6205 0.5803 0.668 0.000 0.196 0.136
#> GSM258599 1 0.4286 0.7991 0.812 0.000 0.052 0.136
#> GSM258603 1 0.1389 0.9105 0.952 0.000 0.000 0.048
#> GSM258551 2 0.2048 0.7375 0.000 0.928 0.008 0.064
#> GSM258552 4 0.4231 0.6865 0.000 0.080 0.096 0.824
#> GSM258554 2 0.0376 0.7552 0.000 0.992 0.004 0.004
#> GSM258558 2 0.4220 0.6856 0.004 0.828 0.056 0.112
#> GSM258559 2 0.4468 0.6301 0.000 0.752 0.232 0.016
#> GSM258560 2 0.6315 0.2446 0.004 0.480 0.468 0.048
#> GSM258561 2 0.4276 0.6883 0.004 0.788 0.192 0.016
#> GSM258564 2 0.4119 0.7097 0.004 0.796 0.188 0.012
#> GSM258567 4 0.5894 0.6239 0.000 0.108 0.200 0.692
#> GSM258568 2 0.0967 0.7561 0.004 0.976 0.004 0.016
#> GSM258569 3 0.4821 0.6632 0.068 0.056 0.820 0.056
#> GSM258571 3 0.5093 0.5591 0.348 0.000 0.640 0.012
#> GSM258572 4 0.4359 0.6859 0.000 0.084 0.100 0.816
#> GSM258573 2 0.4151 0.7160 0.004 0.800 0.180 0.016
#> GSM258574 4 0.4364 0.6856 0.000 0.092 0.092 0.816
#> GSM258575 2 0.5660 0.1582 0.004 0.576 0.020 0.400
#> GSM258576 2 0.0592 0.7548 0.000 0.984 0.000 0.016
#> GSM258577 2 0.7215 0.2166 0.004 0.520 0.136 0.340
#> GSM258579 2 0.5163 -0.0614 0.000 0.516 0.004 0.480
#> GSM258581 2 0.0707 0.7543 0.000 0.980 0.000 0.020
#> GSM258582 3 0.3790 0.6797 0.164 0.000 0.820 0.016
#> GSM258584 2 0.6164 0.4192 0.004 0.604 0.336 0.056
#> GSM258586 4 0.4426 0.6862 0.000 0.092 0.096 0.812
#> GSM258587 2 0.3448 0.7268 0.004 0.828 0.168 0.000
#> GSM258588 4 0.5926 0.6248 0.000 0.192 0.116 0.692
#> GSM258589 4 0.6982 0.3460 0.004 0.104 0.380 0.512
#> GSM258591 2 0.1489 0.7579 0.000 0.952 0.044 0.004
#> GSM258592 3 0.4343 0.6528 0.060 0.040 0.844 0.056
#> GSM258593 3 0.7818 0.1321 0.268 0.000 0.408 0.324
#> GSM258595 3 0.3102 0.6800 0.064 0.024 0.896 0.016
#> GSM258597 2 0.4114 0.7042 0.004 0.788 0.200 0.008
#> GSM258598 2 0.3901 0.7245 0.004 0.816 0.168 0.012
#> GSM258600 4 0.3796 0.6780 0.000 0.056 0.096 0.848
#> GSM258601 3 0.2352 0.6522 0.016 0.044 0.928 0.012
#> GSM258602 2 0.3443 0.7135 0.000 0.848 0.136 0.016
#> GSM258604 3 0.5090 0.6076 0.312 0.004 0.672 0.012
#> GSM258605 3 0.4985 0.3264 0.468 0.000 0.532 0.000
#> GSM258606 2 0.1042 0.7575 0.000 0.972 0.020 0.008
#> GSM258607 3 0.5768 0.2168 0.004 0.300 0.652 0.044
#> GSM258608 4 0.6790 0.1335 0.004 0.408 0.084 0.504
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> GSM258553 1 0.3636 0.63791 0.728 0.000 0.000 0.000 0.272
#> GSM258555 1 0.0000 0.76324 1.000 0.000 0.000 0.000 0.000
#> GSM258556 3 0.4210 0.57009 0.000 0.184 0.772 0.028 0.016
#> GSM258557 2 0.6065 -0.02700 0.028 0.476 0.056 0.000 0.440
#> GSM258562 3 0.4268 0.54635 0.184 0.012 0.768 0.000 0.036
#> GSM258563 5 0.6592 0.20090 0.068 0.336 0.064 0.000 0.532
#> GSM258565 1 0.0000 0.76324 1.000 0.000 0.000 0.000 0.000
#> GSM258566 1 0.0000 0.76324 1.000 0.000 0.000 0.000 0.000
#> GSM258570 1 0.0963 0.76247 0.964 0.000 0.000 0.000 0.036
#> GSM258578 1 0.0000 0.76324 1.000 0.000 0.000 0.000 0.000
#> GSM258580 2 0.5815 0.14878 0.000 0.540 0.104 0.000 0.356
#> GSM258583 5 0.4227 -0.00724 0.420 0.000 0.000 0.000 0.580
#> GSM258585 5 0.3561 0.47397 0.052 0.028 0.068 0.000 0.852
#> GSM258590 1 0.3796 0.60807 0.700 0.000 0.000 0.000 0.300
#> GSM258594 1 0.2230 0.72700 0.884 0.000 0.000 0.000 0.116
#> GSM258596 1 0.5825 -0.21160 0.508 0.008 0.072 0.000 0.412
#> GSM258599 5 0.5080 0.30571 0.316 0.000 0.056 0.000 0.628
#> GSM258603 1 0.3816 0.60566 0.696 0.000 0.000 0.000 0.304
#> GSM258551 4 0.4080 0.67019 0.000 0.104 0.012 0.808 0.076
#> GSM258552 2 0.1153 0.65513 0.000 0.964 0.024 0.008 0.004
#> GSM258554 4 0.2625 0.72314 0.000 0.048 0.012 0.900 0.040
#> GSM258558 4 0.6373 0.43396 0.000 0.240 0.040 0.604 0.116
#> GSM258559 4 0.6072 0.47646 0.000 0.068 0.224 0.644 0.064
#> GSM258560 3 0.7008 0.07637 0.000 0.136 0.480 0.340 0.044
#> GSM258561 4 0.5927 0.51544 0.000 0.076 0.284 0.612 0.028
#> GSM258564 4 0.4725 0.65844 0.000 0.024 0.196 0.740 0.040
#> GSM258567 2 0.4930 0.52541 0.000 0.700 0.244 0.032 0.024
#> GSM258568 4 0.1731 0.72825 0.000 0.008 0.012 0.940 0.040
#> GSM258569 3 0.4193 0.65445 0.016 0.088 0.824 0.048 0.024
#> GSM258571 3 0.6263 0.38313 0.276 0.028 0.588 0.000 0.108
#> GSM258572 2 0.0992 0.65577 0.000 0.968 0.024 0.008 0.000
#> GSM258573 4 0.5122 0.65692 0.000 0.016 0.204 0.708 0.072
#> GSM258574 2 0.1179 0.65418 0.000 0.964 0.016 0.016 0.004
#> GSM258575 4 0.5807 0.09225 0.000 0.396 0.020 0.532 0.052
#> GSM258576 4 0.2266 0.72662 0.000 0.008 0.016 0.912 0.064
#> GSM258577 2 0.7474 0.20241 0.000 0.428 0.044 0.280 0.248
#> GSM258579 2 0.5502 0.28519 0.000 0.576 0.008 0.360 0.056
#> GSM258581 4 0.2611 0.72547 0.000 0.016 0.016 0.896 0.072
#> GSM258582 3 0.4032 0.56432 0.176 0.008 0.788 0.008 0.020
#> GSM258584 4 0.7695 -0.05241 0.000 0.072 0.352 0.388 0.188
#> GSM258586 2 0.2795 0.64960 0.000 0.884 0.080 0.028 0.008
#> GSM258587 4 0.4074 0.66829 0.000 0.012 0.180 0.780 0.028
#> GSM258588 2 0.3641 0.64176 0.000 0.844 0.060 0.076 0.020
#> GSM258589 2 0.5864 0.14801 0.000 0.528 0.396 0.056 0.020
#> GSM258591 4 0.1661 0.73245 0.000 0.024 0.036 0.940 0.000
#> GSM258592 3 0.3036 0.63944 0.012 0.104 0.868 0.008 0.008
#> GSM258593 5 0.7295 0.19583 0.196 0.036 0.380 0.000 0.388
#> GSM258595 3 0.3736 0.63266 0.092 0.052 0.836 0.000 0.020
#> GSM258597 4 0.4899 0.65764 0.000 0.024 0.192 0.732 0.052
#> GSM258598 4 0.4538 0.65485 0.000 0.008 0.180 0.752 0.060
#> GSM258600 2 0.1869 0.65579 0.000 0.936 0.028 0.028 0.008
#> GSM258601 3 0.3272 0.65750 0.004 0.048 0.868 0.068 0.012
#> GSM258602 4 0.3575 0.68082 0.000 0.056 0.120 0.824 0.000
#> GSM258604 3 0.4631 0.59850 0.176 0.016 0.764 0.024 0.020
#> GSM258605 3 0.6408 0.27351 0.268 0.008 0.544 0.000 0.180
#> GSM258606 4 0.1836 0.73057 0.000 0.032 0.036 0.932 0.000
#> GSM258607 3 0.6429 0.30389 0.000 0.092 0.584 0.276 0.048
#> GSM258608 2 0.7182 0.19607 0.000 0.436 0.024 0.296 0.244
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> GSM258553 1 0.3937 -0.04960 0.572 0.000 0.000 0.004 0.424 0.000
#> GSM258555 1 0.0000 0.89233 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM258556 3 0.3373 0.66257 0.000 0.140 0.816 0.032 0.000 0.012
#> GSM258557 5 0.5497 0.00854 0.000 0.352 0.060 0.028 0.556 0.004
#> GSM258562 3 0.4839 0.69357 0.064 0.004 0.704 0.200 0.028 0.000
#> GSM258563 5 0.1375 0.66260 0.004 0.008 0.008 0.028 0.952 0.000
#> GSM258565 1 0.0260 0.89037 0.992 0.000 0.000 0.000 0.008 0.000
#> GSM258566 1 0.0146 0.89157 0.996 0.000 0.000 0.000 0.004 0.000
#> GSM258570 1 0.0363 0.89054 0.988 0.000 0.000 0.000 0.012 0.000
#> GSM258578 1 0.0000 0.89233 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM258580 2 0.5094 0.32035 0.000 0.568 0.096 0.000 0.336 0.000
#> GSM258583 5 0.3215 0.60938 0.240 0.000 0.000 0.004 0.756 0.000
#> GSM258585 5 0.0622 0.66783 0.000 0.000 0.008 0.000 0.980 0.012
#> GSM258590 5 0.3997 0.12963 0.488 0.000 0.000 0.004 0.508 0.000
#> GSM258594 1 0.0547 0.87893 0.980 0.000 0.000 0.000 0.020 0.000
#> GSM258596 5 0.2768 0.67244 0.156 0.000 0.012 0.000 0.832 0.000
#> GSM258599 5 0.2357 0.68144 0.116 0.000 0.012 0.000 0.872 0.000
#> GSM258603 5 0.3907 0.34933 0.408 0.000 0.000 0.004 0.588 0.000
#> GSM258551 6 0.3368 0.53794 0.000 0.088 0.000 0.084 0.004 0.824
#> GSM258552 2 0.0146 0.76776 0.000 0.996 0.004 0.000 0.000 0.000
#> GSM258554 6 0.2147 0.51676 0.000 0.020 0.000 0.084 0.000 0.896
#> GSM258558 6 0.4026 0.53542 0.000 0.144 0.000 0.072 0.012 0.772
#> GSM258559 6 0.4840 0.53400 0.000 0.044 0.224 0.044 0.000 0.688
#> GSM258560 6 0.6753 0.30008 0.000 0.104 0.396 0.092 0.004 0.404
#> GSM258561 6 0.6046 0.40098 0.000 0.036 0.240 0.164 0.000 0.560
#> GSM258564 4 0.4787 0.88650 0.000 0.004 0.052 0.584 0.000 0.360
#> GSM258567 2 0.5552 0.52524 0.000 0.636 0.176 0.164 0.008 0.016
#> GSM258568 6 0.3314 0.30077 0.000 0.004 0.000 0.256 0.000 0.740
#> GSM258569 3 0.2308 0.70897 0.000 0.108 0.880 0.008 0.000 0.004
#> GSM258571 3 0.4713 0.69929 0.036 0.024 0.704 0.224 0.012 0.000
#> GSM258572 2 0.0146 0.76776 0.000 0.996 0.004 0.000 0.000 0.000
#> GSM258573 4 0.4555 0.86308 0.000 0.004 0.048 0.640 0.000 0.308
#> GSM258574 2 0.0862 0.76329 0.000 0.972 0.000 0.016 0.004 0.008
#> GSM258575 6 0.5362 -0.10573 0.000 0.436 0.020 0.036 0.012 0.496
#> GSM258576 6 0.2442 0.47823 0.000 0.000 0.004 0.144 0.000 0.852
#> GSM258577 6 0.4885 0.39105 0.000 0.416 0.024 0.004 0.016 0.540
#> GSM258579 2 0.5322 0.11722 0.000 0.472 0.000 0.104 0.000 0.424
#> GSM258581 6 0.2178 0.49168 0.000 0.000 0.000 0.132 0.000 0.868
#> GSM258582 3 0.3709 0.70606 0.040 0.000 0.756 0.204 0.000 0.000
#> GSM258584 6 0.5537 0.47045 0.000 0.052 0.360 0.024 0.012 0.552
#> GSM258586 2 0.1049 0.76436 0.000 0.960 0.032 0.008 0.000 0.000
#> GSM258587 4 0.4875 0.84277 0.000 0.004 0.052 0.544 0.000 0.400
#> GSM258588 2 0.2664 0.73999 0.000 0.888 0.032 0.020 0.004 0.056
#> GSM258589 2 0.5101 0.28416 0.000 0.544 0.392 0.044 0.000 0.020
#> GSM258591 6 0.2308 0.49203 0.000 0.012 0.016 0.076 0.000 0.896
#> GSM258592 3 0.4583 0.69403 0.000 0.072 0.708 0.208 0.004 0.008
#> GSM258593 3 0.5147 0.27180 0.044 0.020 0.512 0.000 0.424 0.000
#> GSM258595 3 0.1802 0.71977 0.000 0.072 0.916 0.000 0.000 0.012
#> GSM258597 4 0.4836 0.87545 0.000 0.004 0.052 0.564 0.000 0.380
#> GSM258598 4 0.4497 0.84841 0.000 0.000 0.048 0.624 0.000 0.328
#> GSM258600 2 0.0665 0.76750 0.000 0.980 0.008 0.008 0.004 0.000
#> GSM258601 3 0.1003 0.73198 0.000 0.028 0.964 0.004 0.000 0.004
#> GSM258602 6 0.4044 0.54047 0.000 0.020 0.128 0.072 0.000 0.780
#> GSM258604 3 0.1863 0.74254 0.008 0.004 0.924 0.056 0.000 0.008
#> GSM258605 3 0.7387 0.02202 0.128 0.000 0.352 0.216 0.304 0.000
#> GSM258606 6 0.1503 0.52608 0.000 0.008 0.016 0.032 0.000 0.944
#> GSM258607 3 0.3336 0.67429 0.000 0.100 0.832 0.012 0.000 0.056
#> GSM258608 6 0.4638 0.42091 0.000 0.392 0.000 0.020 0.016 0.572
Heatmaps for the consensus matrix. It visualizes the probability of two samples to be in a same group.
consensus_heatmap(res, k = 2)
consensus_heatmap(res, k = 3)
consensus_heatmap(res, k = 4)
consensus_heatmap(res, k = 5)
consensus_heatmap(res, k = 6)
Heatmaps for the membership of samples in all partitions to see how consistent they are:
membership_heatmap(res, k = 2)
membership_heatmap(res, k = 3)
membership_heatmap(res, k = 4)
membership_heatmap(res, k = 5)
membership_heatmap(res, k = 6)
As soon as we have had the classes for columns, we can look for signatures which are significantly different between classes which can be candidate marks for certain classes. Following are the heatmaps for signatures.
Signature heatmaps where rows are scaled:
get_signatures(res, k = 2)
get_signatures(res, k = 3)
get_signatures(res, k = 4)
get_signatures(res, k = 5)
get_signatures(res, k = 6)
Signature heatmaps where rows are not scaled:
get_signatures(res, k = 2, scale_rows = FALSE)
get_signatures(res, k = 3, scale_rows = FALSE)
get_signatures(res, k = 4, scale_rows = FALSE)
get_signatures(res, k = 5, scale_rows = FALSE)
get_signatures(res, k = 6, scale_rows = FALSE)
Compare the overlap of signatures from different k:
compare_signatures(res)
get_signature()
returns a data frame invisibly. TO get the list of signatures, the function
call should be assigned to a variable explicitly. In following code, if plot
argument is set
to FALSE
, no heatmap is plotted while only the differential analysis is performed.
# code only for demonstration
tb = get_signature(res, k = ..., plot = FALSE)
An example of the output of tb
is:
#> which_row fdr mean_1 mean_2 scaled_mean_1 scaled_mean_2 km
#> 1 38 0.042760348 8.373488 9.131774 -0.5533452 0.5164555 1
#> 2 40 0.018707592 7.106213 8.469186 -0.6173731 0.5762149 1
#> 3 55 0.019134737 10.221463 11.207825 -0.6159697 0.5749050 1
#> 4 59 0.006059896 5.921854 7.869574 -0.6899429 0.6439467 1
#> 5 60 0.018055526 8.928898 10.211722 -0.6204761 0.5791110 1
#> 6 98 0.009384629 15.714769 14.887706 0.6635654 -0.6193277 2
...
The columns in tb
are:
which_row
: row indices corresponding to the input matrix.fdr
: FDR for the differential test. mean_x
: The mean value in group x.scaled_mean_x
: The mean value in group x after rows are scaled.km
: Row groups if k-means clustering is applied to rows.UMAP plot which shows how samples are separated.
dimension_reduction(res, k = 2, method = "UMAP")
dimension_reduction(res, k = 3, method = "UMAP")
dimension_reduction(res, k = 4, method = "UMAP")
dimension_reduction(res, k = 5, method = "UMAP")
dimension_reduction(res, k = 6, method = "UMAP")
Following heatmap shows how subgroups are split when increasing k
:
collect_classes(res)
Test correlation between subgroups and known annotations. If the known annotation is numeric, one-way ANOVA test is applied, and if the known annotation is discrete, chi-squared contingency table test is applied.
test_to_known_factors(res)
#> n disease.state(p) k
#> MAD:mclust 53 2.93e-10 2
#> MAD:mclust 32 1.22e-07 3
#> MAD:mclust 45 1.92e-07 4
#> MAD:mclust 38 9.80e-07 5
#> MAD:mclust 39 6.51e-06 6
If matrix rows can be associated to genes, consider to use functional_enrichment(res,
...)
to perform function enrichment for the signature genes. See this vignette for more detailed explanations.
The object with results only for a single top-value method and a single partition method can be extracted as:
res = res_list["MAD", "NMF"]
# you can also extract it by
# res = res_list["MAD:NMF"]
A summary of res
and all the functions that can be applied to it:
res
#> A 'ConsensusPartition' object with k = 2, 3, 4, 5, 6.
#> On a matrix with 51941 rows and 58 columns.
#> Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'MAD' method.
#> Subgroups are detected by 'NMF' method.
#> Performed in total 1250 partitions by row resampling.
#> Best k for subgroups seems to be 2.
#>
#> Following methods can be applied to this 'ConsensusPartition' object:
#> [1] "cola_report" "collect_classes" "collect_plots"
#> [4] "collect_stats" "colnames" "compare_signatures"
#> [7] "consensus_heatmap" "dimension_reduction" "functional_enrichment"
#> [10] "get_anno_col" "get_anno" "get_classes"
#> [13] "get_consensus" "get_matrix" "get_membership"
#> [16] "get_param" "get_signatures" "get_stats"
#> [19] "is_best_k" "is_stable_k" "membership_heatmap"
#> [22] "ncol" "nrow" "plot_ecdf"
#> [25] "rownames" "select_partition_number" "show"
#> [28] "suggest_best_k" "test_to_known_factors"
collect_plots()
function collects all the plots made from res
for all k
(number of partitions)
into one single page to provide an easy and fast comparison between different k
.
collect_plots(res)
The plots are:
k
and the heatmap of
predicted classes for each k
.k
.k
.k
.All the plots in panels can be made by individual functions and they are plotted later in this section.
select_partition_number()
produces several plots showing different
statistics for choosing “optimized” k
. There are following statistics:
k
;k
, the area increased is defined as \(A_k - A_{k-1}\).The detailed explanations of these statistics can be found in the cola vignette.
Generally speaking, lower PAC score, higher mean silhouette score or higher
concordance corresponds to better partition. Rand index and Jaccard index
measure how similar the current partition is compared to partition with k-1
.
If they are too similar, we won't accept k
is better than k-1
.
select_partition_number(res)
The numeric values for all these statistics can be obtained by get_stats()
.
get_stats(res)
#> k 1-PAC mean_silhouette concordance area_increased Rand Jaccard
#> 2 2 0.893 0.931 0.971 0.4940 0.506 0.506
#> 3 3 0.514 0.597 0.805 0.3581 0.756 0.548
#> 4 4 0.609 0.667 0.826 0.1242 0.792 0.472
#> 5 5 0.716 0.663 0.818 0.0676 0.883 0.587
#> 6 6 0.758 0.730 0.832 0.0412 0.869 0.460
suggest_best_k()
suggests the best \(k\) based on these statistics. The rules are as follows:
suggest_best_k(res)
#> [1] 2
Following shows the table of the partitions (You need to click the show/hide
code output link to see it). The membership matrix (columns with name p*
)
is inferred by
clue::cl_consensus()
function with the SE
method. Basically the value in the membership matrix
represents the probability to belong to a certain group. The finall class
label for an item is determined with the group with highest probability it
belongs to.
In get_classes()
function, the entropy is calculated from the membership
matrix and the silhouette score is calculated from the consensus matrix.
cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#> class entropy silhouette p1 p2
#> GSM258553 1 0.000 0.970 1.000 0.000
#> GSM258555 1 0.000 0.970 1.000 0.000
#> GSM258556 2 0.000 0.968 0.000 1.000
#> GSM258557 1 0.000 0.970 1.000 0.000
#> GSM258562 1 0.000 0.970 1.000 0.000
#> GSM258563 1 0.000 0.970 1.000 0.000
#> GSM258565 1 0.000 0.970 1.000 0.000
#> GSM258566 1 0.000 0.970 1.000 0.000
#> GSM258570 1 0.000 0.970 1.000 0.000
#> GSM258578 1 0.000 0.970 1.000 0.000
#> GSM258580 1 0.615 0.815 0.848 0.152
#> GSM258583 1 0.000 0.970 1.000 0.000
#> GSM258585 1 0.000 0.970 1.000 0.000
#> GSM258590 1 0.000 0.970 1.000 0.000
#> GSM258594 1 0.000 0.970 1.000 0.000
#> GSM258596 1 0.000 0.970 1.000 0.000
#> GSM258599 1 0.000 0.970 1.000 0.000
#> GSM258603 1 0.000 0.970 1.000 0.000
#> GSM258551 2 0.000 0.968 0.000 1.000
#> GSM258552 2 0.000 0.968 0.000 1.000
#> GSM258554 2 0.000 0.968 0.000 1.000
#> GSM258558 2 0.000 0.968 0.000 1.000
#> GSM258559 2 0.000 0.968 0.000 1.000
#> GSM258560 2 0.000 0.968 0.000 1.000
#> GSM258561 2 0.000 0.968 0.000 1.000
#> GSM258564 2 0.000 0.968 0.000 1.000
#> GSM258567 2 0.963 0.362 0.388 0.612
#> GSM258568 2 0.000 0.968 0.000 1.000
#> GSM258569 1 0.808 0.676 0.752 0.248
#> GSM258571 1 0.000 0.970 1.000 0.000
#> GSM258572 2 0.000 0.968 0.000 1.000
#> GSM258573 2 0.000 0.968 0.000 1.000
#> GSM258574 2 0.000 0.968 0.000 1.000
#> GSM258575 2 0.000 0.968 0.000 1.000
#> GSM258576 2 0.000 0.968 0.000 1.000
#> GSM258577 2 0.000 0.968 0.000 1.000
#> GSM258579 2 0.000 0.968 0.000 1.000
#> GSM258581 2 0.000 0.968 0.000 1.000
#> GSM258582 1 0.000 0.970 1.000 0.000
#> GSM258584 2 0.000 0.968 0.000 1.000
#> GSM258586 2 0.000 0.968 0.000 1.000
#> GSM258587 2 0.000 0.968 0.000 1.000
#> GSM258588 2 0.000 0.968 0.000 1.000
#> GSM258589 2 0.000 0.968 0.000 1.000
#> GSM258591 2 0.000 0.968 0.000 1.000
#> GSM258592 2 0.886 0.559 0.304 0.696
#> GSM258593 1 0.000 0.970 1.000 0.000
#> GSM258595 1 0.821 0.659 0.744 0.256
#> GSM258597 2 0.000 0.968 0.000 1.000
#> GSM258598 2 0.000 0.968 0.000 1.000
#> GSM258600 2 0.000 0.968 0.000 1.000
#> GSM258601 2 0.900 0.534 0.316 0.684
#> GSM258602 2 0.000 0.968 0.000 1.000
#> GSM258604 1 0.000 0.970 1.000 0.000
#> GSM258605 1 0.000 0.970 1.000 0.000
#> GSM258606 2 0.000 0.968 0.000 1.000
#> GSM258607 2 0.000 0.968 0.000 1.000
#> GSM258608 2 0.000 0.968 0.000 1.000
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> GSM258553 1 0.0237 0.8190 0.996 0.000 0.004
#> GSM258555 1 0.0000 0.8199 1.000 0.000 0.000
#> GSM258556 3 0.4842 0.6084 0.000 0.224 0.776
#> GSM258557 1 0.7728 0.4861 0.640 0.084 0.276
#> GSM258562 3 0.5859 0.4854 0.344 0.000 0.656
#> GSM258563 1 0.2261 0.7864 0.932 0.000 0.068
#> GSM258565 1 0.0000 0.8199 1.000 0.000 0.000
#> GSM258566 1 0.0000 0.8199 1.000 0.000 0.000
#> GSM258570 1 0.0000 0.8199 1.000 0.000 0.000
#> GSM258578 1 0.0000 0.8199 1.000 0.000 0.000
#> GSM258580 1 0.9488 -0.0927 0.424 0.184 0.392
#> GSM258583 1 0.1919 0.8008 0.956 0.020 0.024
#> GSM258585 1 0.7485 0.5221 0.680 0.096 0.224
#> GSM258590 1 0.0424 0.8177 0.992 0.000 0.008
#> GSM258594 1 0.0000 0.8199 1.000 0.000 0.000
#> GSM258596 1 0.0000 0.8199 1.000 0.000 0.000
#> GSM258599 1 0.0000 0.8199 1.000 0.000 0.000
#> GSM258603 1 0.2176 0.7964 0.948 0.020 0.032
#> GSM258551 2 0.4605 0.7002 0.000 0.796 0.204
#> GSM258552 3 0.2261 0.6471 0.000 0.068 0.932
#> GSM258554 2 0.2878 0.7530 0.000 0.904 0.096
#> GSM258558 2 0.4235 0.7187 0.000 0.824 0.176
#> GSM258559 2 0.6140 0.4078 0.000 0.596 0.404
#> GSM258560 2 0.6204 0.0458 0.000 0.576 0.424
#> GSM258561 2 0.4605 0.6666 0.000 0.796 0.204
#> GSM258564 2 0.3192 0.7476 0.000 0.888 0.112
#> GSM258567 3 0.4295 0.5928 0.032 0.104 0.864
#> GSM258568 2 0.1529 0.7738 0.000 0.960 0.040
#> GSM258569 3 0.6075 0.5255 0.316 0.008 0.676
#> GSM258571 3 0.6299 0.1837 0.476 0.000 0.524
#> GSM258572 3 0.3752 0.5928 0.000 0.144 0.856
#> GSM258573 2 0.3116 0.7494 0.000 0.892 0.108
#> GSM258574 2 0.4796 0.7081 0.000 0.780 0.220
#> GSM258575 2 0.2537 0.7633 0.000 0.920 0.080
#> GSM258576 2 0.1753 0.7716 0.000 0.952 0.048
#> GSM258577 3 0.6154 -0.0334 0.000 0.408 0.592
#> GSM258579 2 0.4605 0.7045 0.000 0.796 0.204
#> GSM258581 2 0.2878 0.7518 0.000 0.904 0.096
#> GSM258582 3 0.5650 0.5267 0.312 0.000 0.688
#> GSM258584 3 0.6274 -0.0778 0.000 0.456 0.544
#> GSM258586 3 0.4002 0.6430 0.000 0.160 0.840
#> GSM258587 2 0.3340 0.7431 0.000 0.880 0.120
#> GSM258588 2 0.6295 0.3307 0.000 0.528 0.472
#> GSM258589 3 0.5058 0.5953 0.000 0.244 0.756
#> GSM258591 2 0.1163 0.7749 0.000 0.972 0.028
#> GSM258592 3 0.7180 0.6248 0.216 0.084 0.700
#> GSM258593 1 0.5733 0.4038 0.676 0.000 0.324
#> GSM258595 3 0.8000 0.5342 0.284 0.096 0.620
#> GSM258597 2 0.4796 0.6337 0.000 0.780 0.220
#> GSM258598 2 0.3686 0.7274 0.000 0.860 0.140
#> GSM258600 3 0.4555 0.5675 0.000 0.200 0.800
#> GSM258601 3 0.6336 0.6539 0.064 0.180 0.756
#> GSM258602 2 0.0424 0.7739 0.000 0.992 0.008
#> GSM258604 1 0.6180 0.0762 0.584 0.000 0.416
#> GSM258605 1 0.6154 0.1054 0.592 0.000 0.408
#> GSM258606 2 0.0424 0.7748 0.000 0.992 0.008
#> GSM258607 2 0.6192 0.2079 0.000 0.580 0.420
#> GSM258608 2 0.5058 0.6733 0.000 0.756 0.244
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> GSM258553 1 0.0188 0.9437 0.996 0.004 0.000 0.000
#> GSM258555 1 0.0000 0.9443 1.000 0.000 0.000 0.000
#> GSM258556 3 0.2888 0.6433 0.000 0.004 0.872 0.124
#> GSM258557 2 0.3161 0.6135 0.124 0.864 0.012 0.000
#> GSM258562 3 0.1706 0.6650 0.036 0.016 0.948 0.000
#> GSM258563 2 0.4992 0.1119 0.476 0.524 0.000 0.000
#> GSM258565 1 0.0000 0.9443 1.000 0.000 0.000 0.000
#> GSM258566 1 0.0000 0.9443 1.000 0.000 0.000 0.000
#> GSM258570 1 0.0000 0.9443 1.000 0.000 0.000 0.000
#> GSM258578 1 0.0000 0.9443 1.000 0.000 0.000 0.000
#> GSM258580 3 0.5709 0.3707 0.024 0.384 0.588 0.004
#> GSM258583 1 0.0817 0.9275 0.976 0.024 0.000 0.000
#> GSM258585 2 0.3266 0.6067 0.168 0.832 0.000 0.000
#> GSM258590 1 0.0188 0.9437 0.996 0.004 0.000 0.000
#> GSM258594 1 0.0000 0.9443 1.000 0.000 0.000 0.000
#> GSM258596 1 0.0469 0.9389 0.988 0.012 0.000 0.000
#> GSM258599 1 0.0188 0.9437 0.996 0.004 0.000 0.000
#> GSM258603 1 0.0592 0.9352 0.984 0.016 0.000 0.000
#> GSM258551 2 0.4948 0.2602 0.000 0.560 0.000 0.440
#> GSM258552 3 0.4283 0.5285 0.000 0.256 0.740 0.004
#> GSM258554 4 0.0817 0.8686 0.000 0.024 0.000 0.976
#> GSM258558 4 0.4977 0.2579 0.000 0.460 0.000 0.540
#> GSM258559 2 0.6714 0.4576 0.000 0.616 0.176 0.208
#> GSM258560 3 0.6536 0.3134 0.000 0.088 0.560 0.352
#> GSM258561 4 0.3333 0.7800 0.000 0.040 0.088 0.872
#> GSM258564 4 0.0188 0.8699 0.000 0.000 0.004 0.996
#> GSM258567 3 0.2921 0.6160 0.000 0.140 0.860 0.000
#> GSM258568 4 0.2799 0.8520 0.000 0.108 0.008 0.884
#> GSM258569 3 0.5532 0.5765 0.212 0.040 0.728 0.020
#> GSM258571 3 0.5917 0.4592 0.320 0.056 0.624 0.000
#> GSM258572 3 0.4406 0.4804 0.000 0.300 0.700 0.000
#> GSM258573 4 0.0469 0.8737 0.000 0.012 0.000 0.988
#> GSM258574 2 0.5279 0.3876 0.000 0.716 0.232 0.052
#> GSM258575 4 0.4644 0.7132 0.000 0.228 0.024 0.748
#> GSM258576 4 0.2530 0.8515 0.000 0.112 0.000 0.888
#> GSM258577 2 0.3172 0.5474 0.000 0.840 0.160 0.000
#> GSM258579 2 0.4088 0.5074 0.000 0.764 0.004 0.232
#> GSM258581 4 0.2760 0.8462 0.000 0.128 0.000 0.872
#> GSM258582 3 0.1059 0.6637 0.016 0.012 0.972 0.000
#> GSM258584 2 0.4991 0.2663 0.000 0.608 0.388 0.004
#> GSM258586 3 0.5175 0.6001 0.000 0.120 0.760 0.120
#> GSM258587 4 0.0188 0.8722 0.000 0.004 0.000 0.996
#> GSM258588 3 0.5565 0.4931 0.000 0.260 0.684 0.056
#> GSM258589 3 0.1109 0.6653 0.000 0.004 0.968 0.028
#> GSM258591 4 0.0524 0.8730 0.000 0.008 0.004 0.988
#> GSM258592 3 0.2164 0.6504 0.004 0.068 0.924 0.004
#> GSM258593 1 0.6694 0.0818 0.516 0.092 0.392 0.000
#> GSM258595 3 0.5145 0.6178 0.076 0.008 0.772 0.144
#> GSM258597 4 0.0469 0.8677 0.000 0.000 0.012 0.988
#> GSM258598 4 0.0336 0.8691 0.000 0.000 0.008 0.992
#> GSM258600 3 0.5820 0.5164 0.000 0.240 0.680 0.080
#> GSM258601 3 0.5618 0.5300 0.024 0.036 0.720 0.220
#> GSM258602 4 0.3392 0.8435 0.000 0.124 0.020 0.856
#> GSM258604 3 0.7746 0.2694 0.416 0.056 0.456 0.072
#> GSM258605 3 0.6465 0.3920 0.364 0.080 0.556 0.000
#> GSM258606 4 0.2918 0.8492 0.000 0.116 0.008 0.876
#> GSM258607 4 0.2737 0.7824 0.000 0.008 0.104 0.888
#> GSM258608 2 0.1118 0.6235 0.000 0.964 0.000 0.036
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> GSM258553 1 0.0000 0.9538 1.000 0.000 0.000 0.000 0.000
#> GSM258555 1 0.0000 0.9538 1.000 0.000 0.000 0.000 0.000
#> GSM258556 5 0.3527 0.4724 0.000 0.000 0.192 0.016 0.792
#> GSM258557 2 0.0798 0.7094 0.008 0.976 0.000 0.000 0.016
#> GSM258562 5 0.4617 0.5291 0.004 0.024 0.304 0.000 0.668
#> GSM258563 1 0.4658 0.2053 0.556 0.432 0.008 0.000 0.004
#> GSM258565 1 0.0000 0.9538 1.000 0.000 0.000 0.000 0.000
#> GSM258566 1 0.0000 0.9538 1.000 0.000 0.000 0.000 0.000
#> GSM258570 1 0.0000 0.9538 1.000 0.000 0.000 0.000 0.000
#> GSM258578 1 0.0000 0.9538 1.000 0.000 0.000 0.000 0.000
#> GSM258580 5 0.4066 0.6012 0.000 0.324 0.004 0.000 0.672
#> GSM258583 1 0.1408 0.9116 0.948 0.044 0.008 0.000 0.000
#> GSM258585 2 0.1544 0.6942 0.068 0.932 0.000 0.000 0.000
#> GSM258590 1 0.0000 0.9538 1.000 0.000 0.000 0.000 0.000
#> GSM258594 1 0.0000 0.9538 1.000 0.000 0.000 0.000 0.000
#> GSM258596 1 0.0609 0.9377 0.980 0.020 0.000 0.000 0.000
#> GSM258599 1 0.0000 0.9538 1.000 0.000 0.000 0.000 0.000
#> GSM258603 1 0.0162 0.9511 0.996 0.004 0.000 0.000 0.000
#> GSM258551 2 0.6014 0.2845 0.000 0.576 0.000 0.252 0.172
#> GSM258552 5 0.4275 0.6275 0.000 0.284 0.020 0.000 0.696
#> GSM258554 4 0.3783 0.7431 0.000 0.008 0.000 0.740 0.252
#> GSM258558 4 0.4583 0.0454 0.000 0.464 0.004 0.528 0.004
#> GSM258559 3 0.4594 0.5416 0.000 0.036 0.680 0.284 0.000
#> GSM258560 3 0.0609 0.7347 0.000 0.000 0.980 0.020 0.000
#> GSM258561 3 0.5568 0.4464 0.000 0.000 0.596 0.308 0.096
#> GSM258564 4 0.3906 0.7251 0.000 0.000 0.004 0.704 0.292
#> GSM258567 3 0.0807 0.7341 0.000 0.012 0.976 0.000 0.012
#> GSM258568 4 0.0771 0.7318 0.000 0.004 0.020 0.976 0.000
#> GSM258569 3 0.6477 0.1618 0.028 0.064 0.540 0.016 0.352
#> GSM258571 3 0.1282 0.7237 0.004 0.000 0.952 0.000 0.044
#> GSM258572 5 0.4380 0.5216 0.000 0.376 0.008 0.000 0.616
#> GSM258573 4 0.3039 0.7623 0.000 0.000 0.000 0.808 0.192
#> GSM258574 2 0.2462 0.6406 0.000 0.880 0.000 0.008 0.112
#> GSM258575 4 0.3292 0.6116 0.000 0.140 0.008 0.836 0.016
#> GSM258576 4 0.0671 0.7313 0.000 0.016 0.004 0.980 0.000
#> GSM258577 2 0.4990 0.2606 0.000 0.580 0.384 0.000 0.036
#> GSM258579 2 0.4552 0.5933 0.000 0.716 0.004 0.240 0.040
#> GSM258581 4 0.0798 0.7299 0.000 0.016 0.008 0.976 0.000
#> GSM258582 3 0.3395 0.5511 0.000 0.000 0.764 0.000 0.236
#> GSM258584 3 0.3758 0.6531 0.000 0.088 0.816 0.096 0.000
#> GSM258586 5 0.1059 0.6654 0.000 0.020 0.008 0.004 0.968
#> GSM258587 4 0.2732 0.7659 0.000 0.000 0.000 0.840 0.160
#> GSM258588 3 0.8340 0.1031 0.000 0.196 0.384 0.216 0.204
#> GSM258589 5 0.3266 0.6318 0.000 0.000 0.200 0.004 0.796
#> GSM258591 4 0.2471 0.7652 0.000 0.000 0.000 0.864 0.136
#> GSM258592 3 0.0162 0.7352 0.004 0.000 0.996 0.000 0.000
#> GSM258593 5 0.5678 0.5080 0.260 0.128 0.000 0.000 0.612
#> GSM258595 5 0.2180 0.6373 0.020 0.000 0.032 0.024 0.924
#> GSM258597 4 0.3949 0.7204 0.000 0.000 0.004 0.696 0.300
#> GSM258598 4 0.3884 0.7275 0.000 0.000 0.004 0.708 0.288
#> GSM258600 5 0.2970 0.6823 0.000 0.168 0.004 0.000 0.828
#> GSM258601 3 0.3231 0.6555 0.000 0.000 0.800 0.004 0.196
#> GSM258602 4 0.4161 0.4033 0.000 0.016 0.280 0.704 0.000
#> GSM258604 3 0.4521 0.5384 0.012 0.000 0.664 0.008 0.316
#> GSM258605 3 0.0613 0.7345 0.004 0.008 0.984 0.000 0.004
#> GSM258606 4 0.1493 0.7191 0.000 0.024 0.028 0.948 0.000
#> GSM258607 4 0.4649 0.5889 0.000 0.000 0.016 0.580 0.404
#> GSM258608 2 0.0404 0.7142 0.000 0.988 0.012 0.000 0.000
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> GSM258553 1 0.0000 1.000 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM258555 1 0.0000 1.000 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM258556 4 0.4321 0.571 0.000 0.084 0.204 0.712 0.000 0.000
#> GSM258557 5 0.2265 0.746 0.000 0.024 0.076 0.000 0.896 0.004
#> GSM258562 2 0.3449 0.700 0.016 0.784 0.192 0.004 0.004 0.000
#> GSM258563 5 0.3381 0.725 0.156 0.000 0.044 0.000 0.800 0.000
#> GSM258565 1 0.0000 1.000 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM258566 1 0.0000 1.000 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM258570 1 0.0000 1.000 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM258578 1 0.0000 1.000 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM258580 2 0.1851 0.828 0.000 0.924 0.004 0.004 0.056 0.012
#> GSM258583 5 0.3944 0.348 0.428 0.000 0.004 0.000 0.568 0.000
#> GSM258585 5 0.1562 0.752 0.032 0.024 0.000 0.000 0.940 0.004
#> GSM258590 1 0.0000 1.000 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM258594 1 0.0000 1.000 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM258596 1 0.0000 1.000 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM258599 1 0.0000 1.000 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM258603 1 0.0000 1.000 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM258551 5 0.3853 0.438 0.000 0.000 0.000 0.304 0.680 0.016
#> GSM258552 2 0.2493 0.823 0.000 0.884 0.036 0.000 0.076 0.004
#> GSM258554 4 0.2499 0.757 0.000 0.000 0.000 0.880 0.072 0.048
#> GSM258558 6 0.4977 0.675 0.000 0.040 0.000 0.092 0.164 0.704
#> GSM258559 6 0.3930 0.234 0.000 0.000 0.420 0.000 0.004 0.576
#> GSM258560 3 0.3377 0.662 0.000 0.028 0.784 0.000 0.000 0.188
#> GSM258561 3 0.4539 0.450 0.000 0.004 0.644 0.304 0.000 0.048
#> GSM258564 4 0.0547 0.780 0.000 0.000 0.000 0.980 0.000 0.020
#> GSM258567 3 0.1370 0.771 0.000 0.012 0.948 0.000 0.036 0.004
#> GSM258568 6 0.3089 0.704 0.000 0.004 0.008 0.188 0.000 0.800
#> GSM258569 3 0.4080 0.172 0.000 0.456 0.536 0.008 0.000 0.000
#> GSM258571 3 0.1082 0.771 0.000 0.040 0.956 0.004 0.000 0.000
#> GSM258572 2 0.1921 0.820 0.000 0.920 0.000 0.012 0.056 0.012
#> GSM258573 4 0.1863 0.763 0.000 0.000 0.000 0.896 0.000 0.104
#> GSM258574 2 0.4672 0.658 0.000 0.684 0.000 0.000 0.188 0.128
#> GSM258575 6 0.1092 0.808 0.000 0.000 0.000 0.020 0.020 0.960
#> GSM258576 6 0.0865 0.810 0.000 0.000 0.000 0.036 0.000 0.964
#> GSM258577 5 0.3838 0.694 0.000 0.116 0.096 0.000 0.784 0.004
#> GSM258579 6 0.3602 0.714 0.000 0.088 0.000 0.000 0.116 0.796
#> GSM258581 6 0.0993 0.810 0.000 0.000 0.000 0.024 0.012 0.964
#> GSM258582 3 0.2346 0.728 0.000 0.124 0.868 0.008 0.000 0.000
#> GSM258584 3 0.5520 0.400 0.000 0.020 0.592 0.000 0.112 0.276
#> GSM258586 4 0.4928 0.283 0.000 0.056 0.004 0.592 0.344 0.004
#> GSM258587 4 0.3531 0.481 0.000 0.000 0.000 0.672 0.000 0.328
#> GSM258588 6 0.4830 0.644 0.000 0.160 0.100 0.000 0.028 0.712
#> GSM258589 2 0.3210 0.777 0.000 0.844 0.096 0.020 0.000 0.040
#> GSM258591 4 0.3050 0.640 0.000 0.000 0.000 0.764 0.000 0.236
#> GSM258592 3 0.1088 0.777 0.000 0.024 0.960 0.000 0.000 0.016
#> GSM258593 2 0.3758 0.579 0.284 0.700 0.000 0.000 0.016 0.000
#> GSM258595 4 0.4072 0.585 0.004 0.216 0.040 0.736 0.004 0.000
#> GSM258597 4 0.0713 0.781 0.000 0.000 0.000 0.972 0.000 0.028
#> GSM258598 4 0.0790 0.781 0.000 0.000 0.000 0.968 0.000 0.032
#> GSM258600 2 0.1251 0.828 0.000 0.956 0.012 0.008 0.024 0.000
#> GSM258601 3 0.3254 0.723 0.000 0.048 0.816 0.136 0.000 0.000
#> GSM258602 6 0.2558 0.730 0.000 0.000 0.156 0.004 0.000 0.840
#> GSM258604 4 0.5348 0.500 0.000 0.012 0.208 0.628 0.152 0.000
#> GSM258605 3 0.1010 0.773 0.000 0.004 0.960 0.000 0.036 0.000
#> GSM258606 6 0.2003 0.801 0.000 0.000 0.044 0.044 0.000 0.912
#> GSM258607 4 0.0858 0.771 0.000 0.028 0.004 0.968 0.000 0.000
#> GSM258608 5 0.0603 0.753 0.000 0.016 0.000 0.004 0.980 0.000
Heatmaps for the consensus matrix. It visualizes the probability of two samples to be in a same group.
consensus_heatmap(res, k = 2)
consensus_heatmap(res, k = 3)
consensus_heatmap(res, k = 4)
consensus_heatmap(res, k = 5)
consensus_heatmap(res, k = 6)
Heatmaps for the membership of samples in all partitions to see how consistent they are:
membership_heatmap(res, k = 2)
membership_heatmap(res, k = 3)
membership_heatmap(res, k = 4)
membership_heatmap(res, k = 5)
membership_heatmap(res, k = 6)
As soon as we have had the classes for columns, we can look for signatures which are significantly different between classes which can be candidate marks for certain classes. Following are the heatmaps for signatures.
Signature heatmaps where rows are scaled:
get_signatures(res, k = 2)
get_signatures(res, k = 3)
get_signatures(res, k = 4)
get_signatures(res, k = 5)
get_signatures(res, k = 6)
Signature heatmaps where rows are not scaled:
get_signatures(res, k = 2, scale_rows = FALSE)
get_signatures(res, k = 3, scale_rows = FALSE)
get_signatures(res, k = 4, scale_rows = FALSE)
get_signatures(res, k = 5, scale_rows = FALSE)
get_signatures(res, k = 6, scale_rows = FALSE)
Compare the overlap of signatures from different k:
compare_signatures(res)
get_signature()
returns a data frame invisibly. TO get the list of signatures, the function
call should be assigned to a variable explicitly. In following code, if plot
argument is set
to FALSE
, no heatmap is plotted while only the differential analysis is performed.
# code only for demonstration
tb = get_signature(res, k = ..., plot = FALSE)
An example of the output of tb
is:
#> which_row fdr mean_1 mean_2 scaled_mean_1 scaled_mean_2 km
#> 1 38 0.042760348 8.373488 9.131774 -0.5533452 0.5164555 1
#> 2 40 0.018707592 7.106213 8.469186 -0.6173731 0.5762149 1
#> 3 55 0.019134737 10.221463 11.207825 -0.6159697 0.5749050 1
#> 4 59 0.006059896 5.921854 7.869574 -0.6899429 0.6439467 1
#> 5 60 0.018055526 8.928898 10.211722 -0.6204761 0.5791110 1
#> 6 98 0.009384629 15.714769 14.887706 0.6635654 -0.6193277 2
...
The columns in tb
are:
which_row
: row indices corresponding to the input matrix.fdr
: FDR for the differential test. mean_x
: The mean value in group x.scaled_mean_x
: The mean value in group x after rows are scaled.km
: Row groups if k-means clustering is applied to rows.UMAP plot which shows how samples are separated.
dimension_reduction(res, k = 2, method = "UMAP")
dimension_reduction(res, k = 3, method = "UMAP")
dimension_reduction(res, k = 4, method = "UMAP")
dimension_reduction(res, k = 5, method = "UMAP")
dimension_reduction(res, k = 6, method = "UMAP")
Following heatmap shows how subgroups are split when increasing k
:
collect_classes(res)
Test correlation between subgroups and known annotations. If the known annotation is numeric, one-way ANOVA test is applied, and if the known annotation is discrete, chi-squared contingency table test is applied.
test_to_known_factors(res)
#> n disease.state(p) k
#> MAD:NMF 57 2.62e-07 2
#> MAD:NMF 45 1.33e-09 3
#> MAD:NMF 44 6.32e-07 4
#> MAD:NMF 49 2.32e-07 5
#> MAD:NMF 49 3.50e-06 6
If matrix rows can be associated to genes, consider to use functional_enrichment(res,
...)
to perform function enrichment for the signature genes. See this vignette for more detailed explanations.
The object with results only for a single top-value method and a single partition method can be extracted as:
res = res_list["ATC", "hclust"]
# you can also extract it by
# res = res_list["ATC:hclust"]
A summary of res
and all the functions that can be applied to it:
res
#> A 'ConsensusPartition' object with k = 2, 3, 4, 5, 6.
#> On a matrix with 51941 rows and 58 columns.
#> Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'ATC' method.
#> Subgroups are detected by 'hclust' method.
#> Performed in total 1250 partitions by row resampling.
#> Best k for subgroups seems to be 3.
#>
#> Following methods can be applied to this 'ConsensusPartition' object:
#> [1] "cola_report" "collect_classes" "collect_plots"
#> [4] "collect_stats" "colnames" "compare_signatures"
#> [7] "consensus_heatmap" "dimension_reduction" "functional_enrichment"
#> [10] "get_anno_col" "get_anno" "get_classes"
#> [13] "get_consensus" "get_matrix" "get_membership"
#> [16] "get_param" "get_signatures" "get_stats"
#> [19] "is_best_k" "is_stable_k" "membership_heatmap"
#> [22] "ncol" "nrow" "plot_ecdf"
#> [25] "rownames" "select_partition_number" "show"
#> [28] "suggest_best_k" "test_to_known_factors"
collect_plots()
function collects all the plots made from res
for all k
(number of partitions)
into one single page to provide an easy and fast comparison between different k
.
collect_plots(res)
The plots are:
k
and the heatmap of
predicted classes for each k
.k
.k
.k
.All the plots in panels can be made by individual functions and they are plotted later in this section.
select_partition_number()
produces several plots showing different
statistics for choosing “optimized” k
. There are following statistics:
k
;k
, the area increased is defined as \(A_k - A_{k-1}\).The detailed explanations of these statistics can be found in the cola vignette.
Generally speaking, lower PAC score, higher mean silhouette score or higher
concordance corresponds to better partition. Rand index and Jaccard index
measure how similar the current partition is compared to partition with k-1
.
If they are too similar, we won't accept k
is better than k-1
.
select_partition_number(res)
The numeric values for all these statistics can be obtained by get_stats()
.
get_stats(res)
#> k 1-PAC mean_silhouette concordance area_increased Rand Jaccard
#> 2 2 0.576 0.861 0.927 0.4176 0.610 0.610
#> 3 3 0.580 0.668 0.861 0.5221 0.704 0.524
#> 4 4 0.642 0.701 0.836 0.0876 0.858 0.642
#> 5 5 0.657 0.699 0.762 0.0780 0.853 0.567
#> 6 6 0.730 0.597 0.746 0.0503 0.811 0.370
suggest_best_k()
suggests the best \(k\) based on these statistics. The rules are as follows:
suggest_best_k(res)
#> [1] 3
Following shows the table of the partitions (You need to click the show/hide
code output link to see it). The membership matrix (columns with name p*
)
is inferred by
clue::cl_consensus()
function with the SE
method. Basically the value in the membership matrix
represents the probability to belong to a certain group. The finall class
label for an item is determined with the group with highest probability it
belongs to.
In get_classes()
function, the entropy is calculated from the membership
matrix and the silhouette score is calculated from the consensus matrix.
cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#> class entropy silhouette p1 p2
#> GSM258553 1 0.0000 0.964 1.000 0.000
#> GSM258555 2 0.0000 0.898 0.000 1.000
#> GSM258556 2 0.0000 0.898 0.000 1.000
#> GSM258557 2 0.8763 0.690 0.296 0.704
#> GSM258562 2 0.0000 0.898 0.000 1.000
#> GSM258563 2 0.1184 0.892 0.016 0.984
#> GSM258565 2 0.0000 0.898 0.000 1.000
#> GSM258566 2 0.0000 0.898 0.000 1.000
#> GSM258570 2 0.0376 0.897 0.004 0.996
#> GSM258578 2 0.6438 0.806 0.164 0.836
#> GSM258580 2 0.0000 0.898 0.000 1.000
#> GSM258583 1 0.0000 0.964 1.000 0.000
#> GSM258585 2 0.0000 0.898 0.000 1.000
#> GSM258590 1 0.0000 0.964 1.000 0.000
#> GSM258594 2 0.0376 0.897 0.004 0.996
#> GSM258596 2 0.6438 0.806 0.164 0.836
#> GSM258599 2 0.8763 0.690 0.296 0.704
#> GSM258603 1 0.0000 0.964 1.000 0.000
#> GSM258551 1 0.0000 0.964 1.000 0.000
#> GSM258552 2 0.0000 0.898 0.000 1.000
#> GSM258554 1 0.0000 0.964 1.000 0.000
#> GSM258558 1 0.0000 0.964 1.000 0.000
#> GSM258559 1 0.0000 0.964 1.000 0.000
#> GSM258560 2 0.0672 0.895 0.008 0.992
#> GSM258561 1 0.0000 0.964 1.000 0.000
#> GSM258564 2 0.0000 0.898 0.000 1.000
#> GSM258567 2 0.0000 0.898 0.000 1.000
#> GSM258568 2 0.8763 0.690 0.296 0.704
#> GSM258569 1 0.0000 0.964 1.000 0.000
#> GSM258571 1 0.0000 0.964 1.000 0.000
#> GSM258572 2 0.0000 0.898 0.000 1.000
#> GSM258573 2 0.0000 0.898 0.000 1.000
#> GSM258574 2 0.0000 0.898 0.000 1.000
#> GSM258575 2 0.0000 0.898 0.000 1.000
#> GSM258576 2 0.8763 0.690 0.296 0.704
#> GSM258577 1 0.0000 0.964 1.000 0.000
#> GSM258579 2 0.0000 0.898 0.000 1.000
#> GSM258581 2 0.8763 0.690 0.296 0.704
#> GSM258582 2 0.8763 0.690 0.296 0.704
#> GSM258584 1 0.0000 0.964 1.000 0.000
#> GSM258586 2 0.0000 0.898 0.000 1.000
#> GSM258587 2 0.8763 0.690 0.296 0.704
#> GSM258588 2 0.0000 0.898 0.000 1.000
#> GSM258589 2 0.0000 0.898 0.000 1.000
#> GSM258591 2 0.8763 0.690 0.296 0.704
#> GSM258592 2 0.0000 0.898 0.000 1.000
#> GSM258593 2 0.0000 0.898 0.000 1.000
#> GSM258595 2 0.0000 0.898 0.000 1.000
#> GSM258597 2 0.8661 0.699 0.288 0.712
#> GSM258598 2 0.0000 0.898 0.000 1.000
#> GSM258600 2 0.0000 0.898 0.000 1.000
#> GSM258601 2 0.0000 0.898 0.000 1.000
#> GSM258602 2 0.8763 0.690 0.296 0.704
#> GSM258604 2 0.0000 0.898 0.000 1.000
#> GSM258605 1 0.5842 0.801 0.860 0.140
#> GSM258606 2 0.8763 0.690 0.296 0.704
#> GSM258607 2 0.6887 0.791 0.184 0.816
#> GSM258608 1 0.8499 0.542 0.724 0.276
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> GSM258553 1 0.5363 0.8035 0.724 0.276 0.000
#> GSM258555 3 0.0000 0.8241 0.000 0.000 1.000
#> GSM258556 3 0.6302 0.1145 0.000 0.480 0.520
#> GSM258557 2 0.0000 0.7842 0.000 1.000 0.000
#> GSM258562 3 0.5988 0.4157 0.000 0.368 0.632
#> GSM258563 2 0.5397 0.5111 0.000 0.720 0.280
#> GSM258565 3 0.0000 0.8241 0.000 0.000 1.000
#> GSM258566 3 0.0237 0.8261 0.000 0.004 0.996
#> GSM258570 2 0.6291 0.0127 0.000 0.532 0.468
#> GSM258578 2 0.3551 0.7231 0.000 0.868 0.132
#> GSM258580 3 0.0000 0.8241 0.000 0.000 1.000
#> GSM258583 1 0.5363 0.8035 0.724 0.276 0.000
#> GSM258585 3 0.4974 0.6435 0.000 0.236 0.764
#> GSM258590 1 0.0000 0.8433 1.000 0.000 0.000
#> GSM258594 2 0.6299 -0.0190 0.000 0.524 0.476
#> GSM258596 2 0.3551 0.7231 0.000 0.868 0.132
#> GSM258599 2 0.0000 0.7842 0.000 1.000 0.000
#> GSM258603 1 0.0000 0.8433 1.000 0.000 0.000
#> GSM258551 1 0.0000 0.8433 1.000 0.000 0.000
#> GSM258552 3 0.0237 0.8261 0.000 0.004 0.996
#> GSM258554 1 0.2066 0.8614 0.940 0.060 0.000
#> GSM258558 1 0.5363 0.8035 0.724 0.276 0.000
#> GSM258559 1 0.2066 0.8614 0.940 0.060 0.000
#> GSM258560 2 0.5733 0.4268 0.000 0.676 0.324
#> GSM258561 1 0.2066 0.8614 0.940 0.060 0.000
#> GSM258564 2 0.6308 -0.0852 0.000 0.508 0.492
#> GSM258567 3 0.4974 0.6435 0.000 0.236 0.764
#> GSM258568 2 0.0000 0.7842 0.000 1.000 0.000
#> GSM258569 1 0.5363 0.8035 0.724 0.276 0.000
#> GSM258571 1 0.5363 0.8035 0.724 0.276 0.000
#> GSM258572 3 0.0000 0.8241 0.000 0.000 1.000
#> GSM258573 3 0.0237 0.8261 0.000 0.004 0.996
#> GSM258574 3 0.0000 0.8241 0.000 0.000 1.000
#> GSM258575 3 0.0237 0.8261 0.000 0.004 0.996
#> GSM258576 2 0.0000 0.7842 0.000 1.000 0.000
#> GSM258577 1 0.2066 0.8614 0.940 0.060 0.000
#> GSM258579 3 0.0237 0.8261 0.000 0.004 0.996
#> GSM258581 2 0.0000 0.7842 0.000 1.000 0.000
#> GSM258582 2 0.0000 0.7842 0.000 1.000 0.000
#> GSM258584 1 0.0000 0.8433 1.000 0.000 0.000
#> GSM258586 3 0.6302 0.1145 0.000 0.480 0.520
#> GSM258587 2 0.0000 0.7842 0.000 1.000 0.000
#> GSM258588 3 0.0237 0.8261 0.000 0.004 0.996
#> GSM258589 3 0.5058 0.6325 0.000 0.244 0.756
#> GSM258591 2 0.0000 0.7842 0.000 1.000 0.000
#> GSM258592 3 0.0237 0.8261 0.000 0.004 0.996
#> GSM258593 3 0.0237 0.8261 0.000 0.004 0.996
#> GSM258595 3 0.3116 0.7615 0.000 0.108 0.892
#> GSM258597 2 0.0424 0.7834 0.000 0.992 0.008
#> GSM258598 3 0.6302 0.1140 0.000 0.480 0.520
#> GSM258600 3 0.6299 0.1280 0.000 0.476 0.524
#> GSM258601 3 0.0237 0.8261 0.000 0.004 0.996
#> GSM258602 2 0.0000 0.7842 0.000 1.000 0.000
#> GSM258604 3 0.0237 0.8261 0.000 0.004 0.996
#> GSM258605 1 0.6235 0.5425 0.564 0.436 0.000
#> GSM258606 2 0.0000 0.7842 0.000 1.000 0.000
#> GSM258607 2 0.3192 0.7389 0.000 0.888 0.112
#> GSM258608 2 0.6215 -0.2249 0.428 0.572 0.000
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> GSM258553 2 0.4008 0.825 0.000 0.756 0.000 0.244
#> GSM258555 3 0.1733 0.851 0.024 0.028 0.948 0.000
#> GSM258556 4 0.7433 0.492 0.216 0.000 0.276 0.508
#> GSM258557 4 0.0921 0.695 0.000 0.028 0.000 0.972
#> GSM258562 4 0.7684 0.219 0.216 0.000 0.388 0.396
#> GSM258563 4 0.4818 0.670 0.216 0.000 0.036 0.748
#> GSM258565 3 0.1733 0.851 0.024 0.028 0.948 0.000
#> GSM258566 3 0.0927 0.873 0.000 0.008 0.976 0.016
#> GSM258570 4 0.7147 0.558 0.216 0.000 0.224 0.560
#> GSM258578 4 0.2892 0.705 0.068 0.000 0.036 0.896
#> GSM258580 3 0.1733 0.851 0.024 0.028 0.948 0.000
#> GSM258583 2 0.4008 0.825 0.000 0.756 0.000 0.244
#> GSM258585 3 0.7015 0.300 0.168 0.000 0.568 0.264
#> GSM258590 1 0.3975 1.000 0.760 0.240 0.000 0.000
#> GSM258594 4 0.7199 0.549 0.216 0.000 0.232 0.552
#> GSM258596 4 0.2892 0.705 0.068 0.000 0.036 0.896
#> GSM258599 4 0.0921 0.695 0.000 0.028 0.000 0.972
#> GSM258603 1 0.3975 1.000 0.760 0.240 0.000 0.000
#> GSM258551 1 0.3975 1.000 0.760 0.240 0.000 0.000
#> GSM258552 3 0.0188 0.874 0.000 0.000 0.996 0.004
#> GSM258554 2 0.0921 0.711 0.000 0.972 0.000 0.028
#> GSM258558 2 0.4008 0.825 0.000 0.756 0.000 0.244
#> GSM258559 2 0.0921 0.711 0.000 0.972 0.000 0.028
#> GSM258560 4 0.5628 0.660 0.216 0.000 0.080 0.704
#> GSM258561 2 0.0921 0.711 0.000 0.972 0.000 0.028
#> GSM258564 4 0.7293 0.531 0.216 0.000 0.248 0.536
#> GSM258567 3 0.7015 0.300 0.168 0.000 0.568 0.264
#> GSM258568 4 0.1022 0.693 0.000 0.032 0.000 0.968
#> GSM258569 2 0.4008 0.825 0.000 0.756 0.000 0.244
#> GSM258571 2 0.4008 0.825 0.000 0.756 0.000 0.244
#> GSM258572 3 0.1733 0.851 0.024 0.028 0.948 0.000
#> GSM258573 3 0.1247 0.865 0.012 0.016 0.968 0.004
#> GSM258574 3 0.1733 0.851 0.024 0.028 0.948 0.000
#> GSM258575 3 0.0188 0.874 0.000 0.000 0.996 0.004
#> GSM258576 4 0.0921 0.695 0.000 0.028 0.000 0.972
#> GSM258577 2 0.0921 0.711 0.000 0.972 0.000 0.028
#> GSM258579 3 0.0336 0.874 0.000 0.000 0.992 0.008
#> GSM258581 4 0.1022 0.693 0.000 0.032 0.000 0.968
#> GSM258582 4 0.0921 0.695 0.000 0.028 0.000 0.972
#> GSM258584 1 0.3975 1.000 0.760 0.240 0.000 0.000
#> GSM258586 4 0.7433 0.492 0.216 0.000 0.276 0.508
#> GSM258587 4 0.0921 0.695 0.000 0.028 0.000 0.972
#> GSM258588 3 0.0592 0.872 0.000 0.000 0.984 0.016
#> GSM258589 3 0.7415 0.162 0.216 0.000 0.512 0.272
#> GSM258591 4 0.1022 0.693 0.000 0.032 0.000 0.968
#> GSM258592 3 0.0592 0.872 0.000 0.000 0.984 0.016
#> GSM258593 3 0.0188 0.874 0.000 0.000 0.996 0.004
#> GSM258595 3 0.2868 0.764 0.000 0.000 0.864 0.136
#> GSM258597 4 0.1296 0.697 0.004 0.028 0.004 0.964
#> GSM258598 4 0.7433 0.492 0.216 0.000 0.276 0.508
#> GSM258600 4 0.7450 0.484 0.216 0.000 0.280 0.504
#> GSM258601 3 0.0592 0.872 0.000 0.000 0.984 0.016
#> GSM258602 4 0.0921 0.695 0.000 0.028 0.000 0.972
#> GSM258604 3 0.0592 0.872 0.000 0.000 0.984 0.016
#> GSM258605 2 0.4866 0.613 0.000 0.596 0.000 0.404
#> GSM258606 4 0.1022 0.693 0.000 0.032 0.000 0.968
#> GSM258607 4 0.2466 0.705 0.056 0.000 0.028 0.916
#> GSM258608 4 0.4977 -0.328 0.000 0.460 0.000 0.540
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> GSM258553 3 0.3242 0.75077 0 0.000 0.784 0.216 0.000
#> GSM258555 2 0.0290 0.71619 0 0.992 0.000 0.008 0.000
#> GSM258556 5 0.0162 0.71610 0 0.000 0.000 0.004 0.996
#> GSM258557 4 0.3508 0.93212 0 0.000 0.000 0.748 0.252
#> GSM258562 5 0.2127 0.59459 0 0.108 0.000 0.000 0.892
#> GSM258563 5 0.3480 0.41848 0 0.000 0.000 0.248 0.752
#> GSM258565 2 0.0290 0.71619 0 0.992 0.000 0.008 0.000
#> GSM258566 2 0.3684 0.84720 0 0.720 0.000 0.000 0.280
#> GSM258570 5 0.1341 0.69465 0 0.000 0.000 0.056 0.944
#> GSM258578 5 0.4171 0.00481 0 0.000 0.000 0.396 0.604
#> GSM258580 2 0.0290 0.71619 0 0.992 0.000 0.008 0.000
#> GSM258583 3 0.3242 0.75077 0 0.000 0.784 0.216 0.000
#> GSM258585 5 0.3730 0.19908 0 0.288 0.000 0.000 0.712
#> GSM258590 1 0.0000 1.00000 1 0.000 0.000 0.000 0.000
#> GSM258594 5 0.1197 0.70056 0 0.000 0.000 0.048 0.952
#> GSM258596 5 0.4171 0.00481 0 0.000 0.000 0.396 0.604
#> GSM258599 4 0.3508 0.93212 0 0.000 0.000 0.748 0.252
#> GSM258603 1 0.0000 1.00000 1 0.000 0.000 0.000 0.000
#> GSM258551 1 0.0000 1.00000 1 0.000 0.000 0.000 0.000
#> GSM258552 2 0.3661 0.84872 0 0.724 0.000 0.000 0.276
#> GSM258554 3 0.3452 0.61710 0 0.000 0.756 0.244 0.000
#> GSM258558 3 0.3242 0.75077 0 0.000 0.784 0.216 0.000
#> GSM258559 3 0.3452 0.61710 0 0.000 0.756 0.244 0.000
#> GSM258560 5 0.3109 0.51444 0 0.000 0.000 0.200 0.800
#> GSM258561 3 0.3452 0.61710 0 0.000 0.756 0.244 0.000
#> GSM258564 5 0.0880 0.70811 0 0.000 0.000 0.032 0.968
#> GSM258567 5 0.3730 0.19908 0 0.288 0.000 0.000 0.712
#> GSM258568 4 0.3662 0.93116 0 0.000 0.004 0.744 0.252
#> GSM258569 3 0.3242 0.75077 0 0.000 0.784 0.216 0.000
#> GSM258571 3 0.3242 0.75077 0 0.000 0.784 0.216 0.000
#> GSM258572 2 0.0290 0.71619 0 0.992 0.000 0.008 0.000
#> GSM258573 2 0.3480 0.84158 0 0.752 0.000 0.000 0.248
#> GSM258574 2 0.0290 0.71619 0 0.992 0.000 0.008 0.000
#> GSM258575 2 0.3661 0.84872 0 0.724 0.000 0.000 0.276
#> GSM258576 4 0.3508 0.93212 0 0.000 0.000 0.748 0.252
#> GSM258577 3 0.3452 0.61710 0 0.000 0.756 0.244 0.000
#> GSM258579 2 0.3730 0.84551 0 0.712 0.000 0.000 0.288
#> GSM258581 4 0.3662 0.93116 0 0.000 0.004 0.744 0.252
#> GSM258582 4 0.3508 0.93212 0 0.000 0.000 0.748 0.252
#> GSM258584 1 0.0000 1.00000 1 0.000 0.000 0.000 0.000
#> GSM258586 5 0.0162 0.71610 0 0.000 0.000 0.004 0.996
#> GSM258587 4 0.3508 0.93212 0 0.000 0.000 0.748 0.252
#> GSM258588 2 0.3774 0.84028 0 0.704 0.000 0.000 0.296
#> GSM258589 5 0.3366 0.33668 0 0.232 0.000 0.000 0.768
#> GSM258591 4 0.3662 0.93116 0 0.000 0.004 0.744 0.252
#> GSM258592 2 0.3774 0.84128 0 0.704 0.000 0.000 0.296
#> GSM258593 2 0.3661 0.84872 0 0.724 0.000 0.000 0.276
#> GSM258595 2 0.4219 0.65740 0 0.584 0.000 0.000 0.416
#> GSM258597 4 0.3707 0.88668 0 0.000 0.000 0.716 0.284
#> GSM258598 5 0.0162 0.71592 0 0.000 0.000 0.004 0.996
#> GSM258600 5 0.0000 0.71511 0 0.000 0.000 0.000 1.000
#> GSM258601 2 0.3774 0.84128 0 0.704 0.000 0.000 0.296
#> GSM258602 4 0.3508 0.93212 0 0.000 0.000 0.748 0.252
#> GSM258604 2 0.3774 0.84128 0 0.704 0.000 0.000 0.296
#> GSM258605 3 0.4171 0.47090 0 0.000 0.604 0.396 0.000
#> GSM258606 4 0.3662 0.93116 0 0.000 0.004 0.744 0.252
#> GSM258607 5 0.4256 -0.16632 0 0.000 0.000 0.436 0.564
#> GSM258608 4 0.4249 -0.11331 0 0.000 0.432 0.568 0.000
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> GSM258553 5 0.1267 0.82156 0.000 0.000 0.000 0.000 0.940 0.060
#> GSM258555 1 0.3428 0.15332 0.696 0.304 0.000 0.000 0.000 0.000
#> GSM258556 1 0.7685 0.33979 0.304 0.256 0.000 0.220 0.000 0.220
#> GSM258557 6 0.0146 0.80312 0.000 0.000 0.000 0.004 0.000 0.996
#> GSM258562 2 0.7274 -0.19538 0.304 0.368 0.000 0.220 0.000 0.108
#> GSM258563 6 0.6349 0.14999 0.304 0.024 0.000 0.212 0.000 0.460
#> GSM258565 1 0.3428 0.15332 0.696 0.304 0.000 0.000 0.000 0.000
#> GSM258566 2 0.0692 0.74281 0.020 0.976 0.000 0.004 0.000 0.000
#> GSM258570 1 0.7670 0.31207 0.304 0.204 0.000 0.224 0.000 0.268
#> GSM258578 6 0.5410 0.48916 0.128 0.024 0.000 0.212 0.000 0.636
#> GSM258580 1 0.3428 0.15332 0.696 0.304 0.000 0.000 0.000 0.000
#> GSM258583 5 0.1267 0.82156 0.000 0.000 0.000 0.000 0.940 0.060
#> GSM258585 2 0.5378 0.27178 0.304 0.556 0.000 0.140 0.000 0.000
#> GSM258590 3 0.0000 0.99712 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM258594 1 0.7677 0.32550 0.304 0.212 0.000 0.220 0.000 0.264
#> GSM258596 6 0.5410 0.48916 0.128 0.024 0.000 0.212 0.000 0.636
#> GSM258599 6 0.0146 0.80198 0.000 0.000 0.000 0.004 0.000 0.996
#> GSM258603 3 0.0363 0.99135 0.000 0.000 0.988 0.012 0.000 0.000
#> GSM258551 3 0.0000 0.99712 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM258552 2 0.0458 0.74146 0.016 0.984 0.000 0.000 0.000 0.000
#> GSM258554 4 0.3126 0.84786 0.000 0.000 0.000 0.752 0.248 0.000
#> GSM258558 5 0.1524 0.81859 0.000 0.000 0.000 0.008 0.932 0.060
#> GSM258559 4 0.3804 0.82268 0.000 0.000 0.000 0.576 0.424 0.000
#> GSM258560 6 0.6872 0.00249 0.304 0.060 0.000 0.224 0.000 0.412
#> GSM258561 4 0.3126 0.84786 0.000 0.000 0.000 0.752 0.248 0.000
#> GSM258564 1 0.7693 0.35266 0.304 0.228 0.000 0.224 0.000 0.244
#> GSM258567 2 0.5438 0.25802 0.304 0.548 0.000 0.148 0.000 0.000
#> GSM258568 6 0.0291 0.80040 0.000 0.000 0.000 0.004 0.004 0.992
#> GSM258569 5 0.1267 0.82156 0.000 0.000 0.000 0.000 0.940 0.060
#> GSM258571 5 0.1524 0.81859 0.000 0.000 0.000 0.008 0.932 0.060
#> GSM258572 1 0.3428 0.15332 0.696 0.304 0.000 0.000 0.000 0.000
#> GSM258573 2 0.1327 0.70396 0.064 0.936 0.000 0.000 0.000 0.000
#> GSM258574 1 0.3428 0.15332 0.696 0.304 0.000 0.000 0.000 0.000
#> GSM258575 2 0.1327 0.70792 0.064 0.936 0.000 0.000 0.000 0.000
#> GSM258576 6 0.0000 0.80300 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM258577 4 0.3833 0.80654 0.000 0.000 0.000 0.556 0.444 0.000
#> GSM258579 2 0.0520 0.74567 0.008 0.984 0.000 0.008 0.000 0.000
#> GSM258581 6 0.0291 0.80040 0.000 0.000 0.000 0.004 0.004 0.992
#> GSM258582 6 0.0146 0.80312 0.000 0.000 0.000 0.004 0.000 0.996
#> GSM258584 3 0.0000 0.99712 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM258586 1 0.7685 0.33979 0.304 0.256 0.000 0.220 0.000 0.220
#> GSM258587 6 0.0146 0.80312 0.000 0.000 0.000 0.004 0.000 0.996
#> GSM258588 2 0.0725 0.74438 0.012 0.976 0.000 0.012 0.000 0.000
#> GSM258589 2 0.5794 0.14631 0.296 0.492 0.000 0.212 0.000 0.000
#> GSM258591 6 0.0291 0.80040 0.000 0.000 0.000 0.004 0.004 0.992
#> GSM258592 2 0.0146 0.74684 0.000 0.996 0.000 0.004 0.000 0.000
#> GSM258593 2 0.0458 0.74146 0.016 0.984 0.000 0.000 0.000 0.000
#> GSM258595 2 0.2905 0.63636 0.064 0.852 0.000 0.084 0.000 0.000
#> GSM258597 6 0.0993 0.79138 0.012 0.000 0.000 0.024 0.000 0.964
#> GSM258598 1 0.7685 0.33845 0.304 0.256 0.000 0.224 0.000 0.216
#> GSM258600 1 0.7682 0.33385 0.304 0.260 0.000 0.220 0.000 0.216
#> GSM258601 2 0.0146 0.74684 0.000 0.996 0.000 0.004 0.000 0.000
#> GSM258602 6 0.0000 0.80300 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM258604 2 0.0146 0.74684 0.000 0.996 0.000 0.004 0.000 0.000
#> GSM258605 5 0.3189 0.66844 0.000 0.000 0.000 0.004 0.760 0.236
#> GSM258606 6 0.0291 0.80040 0.000 0.000 0.000 0.004 0.004 0.992
#> GSM258607 6 0.4982 0.54887 0.108 0.020 0.000 0.188 0.000 0.684
#> GSM258608 5 0.3907 0.47578 0.000 0.000 0.000 0.004 0.588 0.408
Heatmaps for the consensus matrix. It visualizes the probability of two samples to be in a same group.
consensus_heatmap(res, k = 2)
consensus_heatmap(res, k = 3)
consensus_heatmap(res, k = 4)
consensus_heatmap(res, k = 5)
consensus_heatmap(res, k = 6)
Heatmaps for the membership of samples in all partitions to see how consistent they are:
membership_heatmap(res, k = 2)
membership_heatmap(res, k = 3)
membership_heatmap(res, k = 4)
membership_heatmap(res, k = 5)
membership_heatmap(res, k = 6)
As soon as we have had the classes for columns, we can look for signatures which are significantly different between classes which can be candidate marks for certain classes. Following are the heatmaps for signatures.
Signature heatmaps where rows are scaled:
get_signatures(res, k = 2)
get_signatures(res, k = 3)
get_signatures(res, k = 4)
get_signatures(res, k = 5)
get_signatures(res, k = 6)
Signature heatmaps where rows are not scaled:
get_signatures(res, k = 2, scale_rows = FALSE)
get_signatures(res, k = 3, scale_rows = FALSE)
get_signatures(res, k = 4, scale_rows = FALSE)
get_signatures(res, k = 5, scale_rows = FALSE)
get_signatures(res, k = 6, scale_rows = FALSE)
Compare the overlap of signatures from different k:
compare_signatures(res)
get_signature()
returns a data frame invisibly. TO get the list of signatures, the function
call should be assigned to a variable explicitly. In following code, if plot
argument is set
to FALSE
, no heatmap is plotted while only the differential analysis is performed.
# code only for demonstration
tb = get_signature(res, k = ..., plot = FALSE)
An example of the output of tb
is:
#> which_row fdr mean_1 mean_2 scaled_mean_1 scaled_mean_2 km
#> 1 38 0.042760348 8.373488 9.131774 -0.5533452 0.5164555 1
#> 2 40 0.018707592 7.106213 8.469186 -0.6173731 0.5762149 1
#> 3 55 0.019134737 10.221463 11.207825 -0.6159697 0.5749050 1
#> 4 59 0.006059896 5.921854 7.869574 -0.6899429 0.6439467 1
#> 5 60 0.018055526 8.928898 10.211722 -0.6204761 0.5791110 1
#> 6 98 0.009384629 15.714769 14.887706 0.6635654 -0.6193277 2
...
The columns in tb
are:
which_row
: row indices corresponding to the input matrix.fdr
: FDR for the differential test. mean_x
: The mean value in group x.scaled_mean_x
: The mean value in group x after rows are scaled.km
: Row groups if k-means clustering is applied to rows.UMAP plot which shows how samples are separated.
dimension_reduction(res, k = 2, method = "UMAP")
dimension_reduction(res, k = 3, method = "UMAP")
dimension_reduction(res, k = 4, method = "UMAP")
dimension_reduction(res, k = 5, method = "UMAP")
dimension_reduction(res, k = 6, method = "UMAP")
Following heatmap shows how subgroups are split when increasing k
:
collect_classes(res)
Test correlation between subgroups and known annotations. If the known annotation is numeric, one-way ANOVA test is applied, and if the known annotation is discrete, chi-squared contingency table test is applied.
test_to_known_factors(res)
#> n disease.state(p) k
#> ATC:hclust 58 0.920 2
#> ATC:hclust 48 0.903 3
#> ATC:hclust 49 0.610 4
#> ATC:hclust 49 0.580 5
#> ATC:hclust 37 0.288 6
If matrix rows can be associated to genes, consider to use functional_enrichment(res,
...)
to perform function enrichment for the signature genes. See this vignette for more detailed explanations.
The object with results only for a single top-value method and a single partition method can be extracted as:
res = res_list["ATC", "kmeans"]
# you can also extract it by
# res = res_list["ATC:kmeans"]
A summary of res
and all the functions that can be applied to it:
res
#> A 'ConsensusPartition' object with k = 2, 3, 4, 5, 6.
#> On a matrix with 51941 rows and 58 columns.
#> Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'ATC' method.
#> Subgroups are detected by 'kmeans' method.
#> Performed in total 1250 partitions by row resampling.
#> Best k for subgroups seems to be 3.
#>
#> Following methods can be applied to this 'ConsensusPartition' object:
#> [1] "cola_report" "collect_classes" "collect_plots"
#> [4] "collect_stats" "colnames" "compare_signatures"
#> [7] "consensus_heatmap" "dimension_reduction" "functional_enrichment"
#> [10] "get_anno_col" "get_anno" "get_classes"
#> [13] "get_consensus" "get_matrix" "get_membership"
#> [16] "get_param" "get_signatures" "get_stats"
#> [19] "is_best_k" "is_stable_k" "membership_heatmap"
#> [22] "ncol" "nrow" "plot_ecdf"
#> [25] "rownames" "select_partition_number" "show"
#> [28] "suggest_best_k" "test_to_known_factors"
collect_plots()
function collects all the plots made from res
for all k
(number of partitions)
into one single page to provide an easy and fast comparison between different k
.
collect_plots(res)
The plots are:
k
and the heatmap of
predicted classes for each k
.k
.k
.k
.All the plots in panels can be made by individual functions and they are plotted later in this section.
select_partition_number()
produces several plots showing different
statistics for choosing “optimized” k
. There are following statistics:
k
;k
, the area increased is defined as \(A_k - A_{k-1}\).The detailed explanations of these statistics can be found in the cola vignette.
Generally speaking, lower PAC score, higher mean silhouette score or higher
concordance corresponds to better partition. Rand index and Jaccard index
measure how similar the current partition is compared to partition with k-1
.
If they are too similar, we won't accept k
is better than k-1
.
select_partition_number(res)
The numeric values for all these statistics can be obtained by get_stats()
.
get_stats(res)
#> k 1-PAC mean_silhouette concordance area_increased Rand Jaccard
#> 2 2 0.617 0.823 0.928 0.4802 0.501 0.501
#> 3 3 0.805 0.906 0.952 0.3520 0.666 0.432
#> 4 4 0.646 0.694 0.842 0.1239 0.768 0.439
#> 5 5 0.694 0.622 0.745 0.0639 0.848 0.508
#> 6 6 0.821 0.840 0.873 0.0468 0.913 0.639
suggest_best_k()
suggests the best \(k\) based on these statistics. The rules are as follows:
suggest_best_k(res)
#> [1] 3
Following shows the table of the partitions (You need to click the show/hide
code output link to see it). The membership matrix (columns with name p*
)
is inferred by
clue::cl_consensus()
function with the SE
method. Basically the value in the membership matrix
represents the probability to belong to a certain group. The finall class
label for an item is determined with the group with highest probability it
belongs to.
In get_classes()
function, the entropy is calculated from the membership
matrix and the silhouette score is calculated from the consensus matrix.
cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#> class entropy silhouette p1 p2
#> GSM258553 2 0.000 0.888 0.000 1.000
#> GSM258555 1 0.000 0.930 1.000 0.000
#> GSM258556 1 0.000 0.930 1.000 0.000
#> GSM258557 2 0.961 0.480 0.384 0.616
#> GSM258562 1 0.000 0.930 1.000 0.000
#> GSM258563 1 0.000 0.930 1.000 0.000
#> GSM258565 1 0.000 0.930 1.000 0.000
#> GSM258566 1 0.000 0.930 1.000 0.000
#> GSM258570 1 0.000 0.930 1.000 0.000
#> GSM258578 1 0.996 -0.019 0.536 0.464
#> GSM258580 1 0.000 0.930 1.000 0.000
#> GSM258583 2 0.000 0.888 0.000 1.000
#> GSM258585 1 0.000 0.930 1.000 0.000
#> GSM258590 2 0.000 0.888 0.000 1.000
#> GSM258594 1 0.000 0.930 1.000 0.000
#> GSM258596 1 0.996 -0.019 0.536 0.464
#> GSM258599 2 0.760 0.788 0.220 0.780
#> GSM258603 2 0.000 0.888 0.000 1.000
#> GSM258551 2 0.000 0.888 0.000 1.000
#> GSM258552 1 0.000 0.930 1.000 0.000
#> GSM258554 2 0.000 0.888 0.000 1.000
#> GSM258558 2 0.000 0.888 0.000 1.000
#> GSM258559 2 0.000 0.888 0.000 1.000
#> GSM258560 1 0.000 0.930 1.000 0.000
#> GSM258561 2 0.000 0.888 0.000 1.000
#> GSM258564 1 0.000 0.930 1.000 0.000
#> GSM258567 1 0.000 0.930 1.000 0.000
#> GSM258568 2 0.760 0.788 0.220 0.780
#> GSM258569 2 0.000 0.888 0.000 1.000
#> GSM258571 2 0.000 0.888 0.000 1.000
#> GSM258572 1 0.000 0.930 1.000 0.000
#> GSM258573 1 0.000 0.930 1.000 0.000
#> GSM258574 1 0.000 0.930 1.000 0.000
#> GSM258575 1 0.000 0.930 1.000 0.000
#> GSM258576 2 0.775 0.780 0.228 0.772
#> GSM258577 2 0.000 0.888 0.000 1.000
#> GSM258579 1 0.000 0.930 1.000 0.000
#> GSM258581 2 0.760 0.788 0.220 0.780
#> GSM258582 2 0.775 0.780 0.228 0.772
#> GSM258584 2 0.000 0.888 0.000 1.000
#> GSM258586 1 0.000 0.930 1.000 0.000
#> GSM258587 2 0.775 0.780 0.228 0.772
#> GSM258588 1 0.000 0.930 1.000 0.000
#> GSM258589 1 0.000 0.930 1.000 0.000
#> GSM258591 2 0.615 0.827 0.152 0.848
#> GSM258592 1 0.000 0.930 1.000 0.000
#> GSM258593 1 0.000 0.930 1.000 0.000
#> GSM258595 1 0.000 0.930 1.000 0.000
#> GSM258597 1 0.999 -0.100 0.516 0.484
#> GSM258598 1 0.000 0.930 1.000 0.000
#> GSM258600 1 0.000 0.930 1.000 0.000
#> GSM258601 1 0.000 0.930 1.000 0.000
#> GSM258602 2 0.775 0.780 0.228 0.772
#> GSM258604 1 0.000 0.930 1.000 0.000
#> GSM258605 2 0.000 0.888 0.000 1.000
#> GSM258606 2 0.760 0.788 0.220 0.780
#> GSM258607 1 0.996 -0.019 0.536 0.464
#> GSM258608 2 0.000 0.888 0.000 1.000
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> GSM258553 1 0.514 0.791 0.748 0.252 0.000
#> GSM258555 3 0.000 1.000 0.000 0.000 1.000
#> GSM258556 2 0.514 0.698 0.000 0.748 0.252
#> GSM258557 2 0.000 0.912 0.000 1.000 0.000
#> GSM258562 3 0.000 1.000 0.000 0.000 1.000
#> GSM258563 2 0.000 0.912 0.000 1.000 0.000
#> GSM258565 3 0.000 1.000 0.000 0.000 1.000
#> GSM258566 3 0.000 1.000 0.000 0.000 1.000
#> GSM258570 2 0.388 0.795 0.000 0.848 0.152
#> GSM258578 2 0.000 0.912 0.000 1.000 0.000
#> GSM258580 3 0.000 1.000 0.000 0.000 1.000
#> GSM258583 1 0.514 0.791 0.748 0.252 0.000
#> GSM258585 3 0.000 1.000 0.000 0.000 1.000
#> GSM258590 1 0.000 0.892 1.000 0.000 0.000
#> GSM258594 2 0.388 0.795 0.000 0.848 0.152
#> GSM258596 2 0.000 0.912 0.000 1.000 0.000
#> GSM258599 2 0.000 0.912 0.000 1.000 0.000
#> GSM258603 1 0.000 0.892 1.000 0.000 0.000
#> GSM258551 1 0.000 0.892 1.000 0.000 0.000
#> GSM258552 3 0.000 1.000 0.000 0.000 1.000
#> GSM258554 1 0.000 0.892 1.000 0.000 0.000
#> GSM258558 1 0.514 0.791 0.748 0.252 0.000
#> GSM258559 1 0.000 0.892 1.000 0.000 0.000
#> GSM258560 2 0.000 0.912 0.000 1.000 0.000
#> GSM258561 1 0.000 0.892 1.000 0.000 0.000
#> GSM258564 2 0.514 0.698 0.000 0.748 0.252
#> GSM258567 3 0.000 1.000 0.000 0.000 1.000
#> GSM258568 2 0.000 0.912 0.000 1.000 0.000
#> GSM258569 1 0.514 0.791 0.748 0.252 0.000
#> GSM258571 1 0.514 0.791 0.748 0.252 0.000
#> GSM258572 3 0.000 1.000 0.000 0.000 1.000
#> GSM258573 3 0.000 1.000 0.000 0.000 1.000
#> GSM258574 3 0.000 1.000 0.000 0.000 1.000
#> GSM258575 3 0.000 1.000 0.000 0.000 1.000
#> GSM258576 2 0.000 0.912 0.000 1.000 0.000
#> GSM258577 1 0.000 0.892 1.000 0.000 0.000
#> GSM258579 3 0.000 1.000 0.000 0.000 1.000
#> GSM258581 2 0.000 0.912 0.000 1.000 0.000
#> GSM258582 2 0.000 0.912 0.000 1.000 0.000
#> GSM258584 1 0.000 0.892 1.000 0.000 0.000
#> GSM258586 2 0.581 0.568 0.000 0.664 0.336
#> GSM258587 2 0.000 0.912 0.000 1.000 0.000
#> GSM258588 3 0.000 1.000 0.000 0.000 1.000
#> GSM258589 3 0.000 1.000 0.000 0.000 1.000
#> GSM258591 2 0.000 0.912 0.000 1.000 0.000
#> GSM258592 3 0.000 1.000 0.000 0.000 1.000
#> GSM258593 3 0.000 1.000 0.000 0.000 1.000
#> GSM258595 3 0.000 1.000 0.000 0.000 1.000
#> GSM258597 2 0.000 0.912 0.000 1.000 0.000
#> GSM258598 3 0.000 1.000 0.000 0.000 1.000
#> GSM258600 2 0.606 0.469 0.000 0.616 0.384
#> GSM258601 3 0.000 1.000 0.000 0.000 1.000
#> GSM258602 2 0.000 0.912 0.000 1.000 0.000
#> GSM258604 3 0.000 1.000 0.000 0.000 1.000
#> GSM258605 2 0.000 0.912 0.000 1.000 0.000
#> GSM258606 2 0.000 0.912 0.000 1.000 0.000
#> GSM258607 2 0.000 0.912 0.000 1.000 0.000
#> GSM258608 2 0.000 0.912 0.000 1.000 0.000
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> GSM258553 2 0.3074 0.487 0.152 0.848 0.000 0.000
#> GSM258555 3 0.0000 0.925 0.000 0.000 1.000 0.000
#> GSM258556 4 0.0469 0.690 0.000 0.012 0.000 0.988
#> GSM258557 2 0.4907 0.445 0.000 0.580 0.000 0.420
#> GSM258562 4 0.3649 0.555 0.000 0.000 0.204 0.796
#> GSM258563 4 0.2530 0.655 0.000 0.112 0.000 0.888
#> GSM258565 3 0.0000 0.925 0.000 0.000 1.000 0.000
#> GSM258566 3 0.0469 0.926 0.000 0.000 0.988 0.012
#> GSM258570 4 0.2469 0.658 0.000 0.108 0.000 0.892
#> GSM258578 4 0.4746 0.263 0.000 0.368 0.000 0.632
#> GSM258580 3 0.0000 0.925 0.000 0.000 1.000 0.000
#> GSM258583 2 0.3123 0.481 0.156 0.844 0.000 0.000
#> GSM258585 4 0.4222 0.436 0.000 0.000 0.272 0.728
#> GSM258590 1 0.0000 0.859 1.000 0.000 0.000 0.000
#> GSM258594 4 0.2469 0.658 0.000 0.108 0.000 0.892
#> GSM258596 4 0.4730 0.273 0.000 0.364 0.000 0.636
#> GSM258599 2 0.4500 0.660 0.000 0.684 0.000 0.316
#> GSM258603 1 0.0000 0.859 1.000 0.000 0.000 0.000
#> GSM258551 1 0.0000 0.859 1.000 0.000 0.000 0.000
#> GSM258552 3 0.2469 0.922 0.000 0.000 0.892 0.108
#> GSM258554 1 0.3801 0.844 0.780 0.220 0.000 0.000
#> GSM258558 2 0.3123 0.481 0.156 0.844 0.000 0.000
#> GSM258559 1 0.4500 0.787 0.684 0.316 0.000 0.000
#> GSM258560 4 0.3074 0.622 0.000 0.152 0.000 0.848
#> GSM258561 1 0.3801 0.844 0.780 0.220 0.000 0.000
#> GSM258564 4 0.0000 0.689 0.000 0.000 0.000 1.000
#> GSM258567 4 0.4500 0.342 0.000 0.000 0.316 0.684
#> GSM258568 2 0.4134 0.696 0.000 0.740 0.000 0.260
#> GSM258569 2 0.2530 0.535 0.112 0.888 0.000 0.000
#> GSM258571 2 0.3123 0.481 0.156 0.844 0.000 0.000
#> GSM258572 3 0.0000 0.925 0.000 0.000 1.000 0.000
#> GSM258573 3 0.0000 0.925 0.000 0.000 1.000 0.000
#> GSM258574 3 0.0000 0.925 0.000 0.000 1.000 0.000
#> GSM258575 3 0.0000 0.925 0.000 0.000 1.000 0.000
#> GSM258576 2 0.4500 0.660 0.000 0.684 0.000 0.316
#> GSM258577 1 0.4500 0.787 0.684 0.316 0.000 0.000
#> GSM258579 3 0.2469 0.922 0.000 0.000 0.892 0.108
#> GSM258581 2 0.4134 0.696 0.000 0.740 0.000 0.260
#> GSM258582 2 0.4500 0.660 0.000 0.684 0.000 0.316
#> GSM258584 1 0.0000 0.859 1.000 0.000 0.000 0.000
#> GSM258586 4 0.0469 0.690 0.000 0.012 0.000 0.988
#> GSM258587 2 0.4500 0.660 0.000 0.684 0.000 0.316
#> GSM258588 3 0.2647 0.917 0.000 0.000 0.880 0.120
#> GSM258589 4 0.4500 0.342 0.000 0.000 0.316 0.684
#> GSM258591 2 0.4134 0.696 0.000 0.740 0.000 0.260
#> GSM258592 3 0.2647 0.917 0.000 0.000 0.880 0.120
#> GSM258593 3 0.2469 0.922 0.000 0.000 0.892 0.108
#> GSM258595 3 0.4164 0.745 0.000 0.000 0.736 0.264
#> GSM258597 4 0.4746 0.263 0.000 0.368 0.000 0.632
#> GSM258598 4 0.3172 0.613 0.000 0.000 0.160 0.840
#> GSM258600 4 0.0000 0.689 0.000 0.000 0.000 1.000
#> GSM258601 3 0.2647 0.917 0.000 0.000 0.880 0.120
#> GSM258602 2 0.4500 0.660 0.000 0.684 0.000 0.316
#> GSM258604 3 0.2647 0.917 0.000 0.000 0.880 0.120
#> GSM258605 2 0.0000 0.642 0.000 1.000 0.000 0.000
#> GSM258606 2 0.4134 0.696 0.000 0.740 0.000 0.260
#> GSM258607 4 0.4746 0.263 0.000 0.368 0.000 0.632
#> GSM258608 2 0.0000 0.642 0.000 1.000 0.000 0.000
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> GSM258553 3 0.0290 0.6685 0.000 0.000 0.992 0.008 0.000
#> GSM258555 2 0.0609 0.6214 0.020 0.980 0.000 0.000 0.000
#> GSM258556 5 0.2561 0.6822 0.000 0.000 0.000 0.144 0.856
#> GSM258557 4 0.4934 0.7882 0.000 0.000 0.188 0.708 0.104
#> GSM258562 5 0.1701 0.6759 0.000 0.048 0.000 0.016 0.936
#> GSM258563 5 0.4045 0.3694 0.000 0.000 0.000 0.356 0.644
#> GSM258565 2 0.0609 0.6214 0.020 0.980 0.000 0.000 0.000
#> GSM258566 2 0.5899 0.7274 0.012 0.604 0.000 0.280 0.104
#> GSM258570 5 0.4370 0.4307 0.008 0.000 0.004 0.332 0.656
#> GSM258578 4 0.4737 0.7137 0.000 0.000 0.068 0.708 0.224
#> GSM258580 2 0.0609 0.6214 0.020 0.980 0.000 0.000 0.000
#> GSM258583 3 0.0162 0.6691 0.000 0.000 0.996 0.004 0.000
#> GSM258585 5 0.5452 0.4220 0.020 0.064 0.004 0.232 0.680
#> GSM258590 1 0.1043 0.9991 0.960 0.000 0.040 0.000 0.000
#> GSM258594 5 0.4642 0.4389 0.020 0.000 0.004 0.328 0.648
#> GSM258596 4 0.4737 0.7137 0.000 0.000 0.068 0.708 0.224
#> GSM258599 4 0.3816 0.8133 0.000 0.000 0.304 0.696 0.000
#> GSM258603 1 0.1205 0.9972 0.956 0.000 0.040 0.000 0.004
#> GSM258551 1 0.1043 0.9991 0.960 0.000 0.040 0.000 0.000
#> GSM258552 2 0.6358 0.7120 0.000 0.516 0.000 0.276 0.208
#> GSM258554 3 0.5533 0.1771 0.396 0.000 0.540 0.004 0.060
#> GSM258558 3 0.0162 0.6685 0.004 0.000 0.996 0.000 0.000
#> GSM258559 3 0.5237 0.3413 0.304 0.000 0.632 0.004 0.060
#> GSM258560 4 0.4434 0.1438 0.000 0.000 0.004 0.536 0.460
#> GSM258561 3 0.5516 0.1949 0.388 0.000 0.548 0.004 0.060
#> GSM258564 5 0.2835 0.7031 0.016 0.000 0.004 0.112 0.868
#> GSM258567 5 0.4708 0.4292 0.000 0.068 0.000 0.220 0.712
#> GSM258568 4 0.3932 0.7939 0.000 0.000 0.328 0.672 0.000
#> GSM258569 3 0.0963 0.6558 0.000 0.000 0.964 0.036 0.000
#> GSM258571 3 0.0162 0.6685 0.004 0.000 0.996 0.000 0.000
#> GSM258572 2 0.0609 0.6214 0.020 0.980 0.000 0.000 0.000
#> GSM258573 2 0.4315 0.7247 0.000 0.700 0.000 0.276 0.024
#> GSM258574 2 0.0609 0.6214 0.020 0.980 0.000 0.000 0.000
#> GSM258575 2 0.4141 0.7209 0.000 0.728 0.000 0.248 0.024
#> GSM258576 4 0.3884 0.8171 0.000 0.000 0.288 0.708 0.004
#> GSM258577 3 0.5237 0.3413 0.304 0.000 0.632 0.004 0.060
#> GSM258579 2 0.6358 0.7120 0.000 0.516 0.000 0.276 0.208
#> GSM258581 4 0.3932 0.7939 0.000 0.000 0.328 0.672 0.000
#> GSM258582 4 0.3949 0.8155 0.000 0.000 0.300 0.696 0.004
#> GSM258584 1 0.1043 0.9991 0.960 0.000 0.040 0.000 0.000
#> GSM258586 5 0.2561 0.6822 0.000 0.000 0.000 0.144 0.856
#> GSM258587 4 0.3949 0.8155 0.000 0.000 0.300 0.696 0.004
#> GSM258588 2 0.6694 0.6202 0.000 0.432 0.000 0.276 0.292
#> GSM258589 5 0.4708 0.4292 0.000 0.068 0.000 0.220 0.712
#> GSM258591 4 0.3932 0.7939 0.000 0.000 0.328 0.672 0.000
#> GSM258592 2 0.7090 0.6928 0.020 0.476 0.004 0.288 0.212
#> GSM258593 2 0.6358 0.7120 0.000 0.516 0.000 0.276 0.208
#> GSM258595 5 0.6518 -0.2369 0.000 0.240 0.000 0.276 0.484
#> GSM258597 4 0.4737 0.7137 0.000 0.000 0.068 0.708 0.224
#> GSM258598 5 0.1750 0.6856 0.000 0.036 0.000 0.028 0.936
#> GSM258600 5 0.1792 0.7085 0.000 0.000 0.000 0.084 0.916
#> GSM258601 2 0.7090 0.6928 0.020 0.476 0.004 0.288 0.212
#> GSM258602 4 0.3884 0.8171 0.000 0.000 0.288 0.708 0.004
#> GSM258604 2 0.7090 0.6928 0.020 0.476 0.004 0.288 0.212
#> GSM258605 3 0.3913 0.0913 0.000 0.000 0.676 0.324 0.000
#> GSM258606 4 0.3876 0.8049 0.000 0.000 0.316 0.684 0.000
#> GSM258607 4 0.4737 0.7137 0.000 0.000 0.068 0.708 0.224
#> GSM258608 3 0.3999 0.0179 0.000 0.000 0.656 0.344 0.000
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> GSM258553 5 0.1584 0.861 0.000 0.008 0.000 0.000 0.928 0.064
#> GSM258555 2 0.3360 0.994 0.000 0.732 0.264 0.000 0.004 0.000
#> GSM258556 4 0.1088 0.848 0.000 0.016 0.000 0.960 0.000 0.024
#> GSM258557 6 0.1334 0.885 0.000 0.020 0.000 0.032 0.000 0.948
#> GSM258562 4 0.0858 0.844 0.000 0.000 0.028 0.968 0.000 0.004
#> GSM258563 4 0.4332 0.686 0.000 0.072 0.000 0.700 0.000 0.228
#> GSM258565 2 0.3468 0.995 0.000 0.728 0.264 0.000 0.008 0.000
#> GSM258566 3 0.0993 0.863 0.012 0.000 0.964 0.000 0.024 0.000
#> GSM258570 4 0.3416 0.779 0.000 0.056 0.000 0.804 0.000 0.140
#> GSM258578 6 0.2448 0.857 0.000 0.064 0.000 0.052 0.000 0.884
#> GSM258580 2 0.3221 0.996 0.000 0.736 0.264 0.000 0.000 0.000
#> GSM258583 5 0.1584 0.861 0.000 0.008 0.000 0.000 0.928 0.064
#> GSM258585 4 0.3943 0.764 0.012 0.028 0.144 0.792 0.024 0.000
#> GSM258590 1 0.0363 0.996 0.988 0.000 0.000 0.000 0.012 0.000
#> GSM258594 4 0.3944 0.784 0.008 0.056 0.016 0.796 0.000 0.124
#> GSM258596 6 0.2448 0.857 0.000 0.064 0.000 0.052 0.000 0.884
#> GSM258599 6 0.0458 0.893 0.000 0.016 0.000 0.000 0.000 0.984
#> GSM258603 1 0.0984 0.987 0.968 0.012 0.000 0.008 0.012 0.000
#> GSM258551 1 0.0363 0.996 0.988 0.000 0.000 0.000 0.012 0.000
#> GSM258552 3 0.1749 0.872 0.000 0.024 0.932 0.036 0.008 0.000
#> GSM258554 5 0.4720 0.717 0.176 0.128 0.000 0.004 0.692 0.000
#> GSM258558 5 0.1327 0.863 0.000 0.000 0.000 0.000 0.936 0.064
#> GSM258559 5 0.3436 0.818 0.056 0.128 0.000 0.004 0.812 0.000
#> GSM258560 4 0.5007 0.280 0.000 0.072 0.000 0.512 0.000 0.416
#> GSM258561 5 0.4689 0.722 0.172 0.128 0.000 0.004 0.696 0.000
#> GSM258564 4 0.2068 0.841 0.000 0.048 0.020 0.916 0.000 0.016
#> GSM258567 4 0.1588 0.817 0.000 0.000 0.072 0.924 0.004 0.000
#> GSM258568 6 0.1265 0.885 0.000 0.044 0.000 0.000 0.008 0.948
#> GSM258569 5 0.1757 0.850 0.000 0.008 0.000 0.000 0.916 0.076
#> GSM258571 5 0.1327 0.863 0.000 0.000 0.000 0.000 0.936 0.064
#> GSM258572 2 0.3468 0.995 0.000 0.728 0.264 0.000 0.008 0.000
#> GSM258573 3 0.1524 0.850 0.000 0.060 0.932 0.000 0.008 0.000
#> GSM258574 2 0.3221 0.996 0.000 0.736 0.264 0.000 0.000 0.000
#> GSM258575 3 0.1524 0.850 0.000 0.060 0.932 0.000 0.008 0.000
#> GSM258576 6 0.0806 0.896 0.000 0.020 0.000 0.008 0.000 0.972
#> GSM258577 5 0.3561 0.818 0.056 0.120 0.000 0.012 0.812 0.000
#> GSM258579 3 0.1492 0.873 0.000 0.024 0.940 0.036 0.000 0.000
#> GSM258581 6 0.1265 0.885 0.000 0.044 0.000 0.000 0.008 0.948
#> GSM258582 6 0.0405 0.896 0.000 0.004 0.000 0.008 0.000 0.988
#> GSM258584 1 0.0363 0.996 0.988 0.000 0.000 0.000 0.012 0.000
#> GSM258586 4 0.0777 0.849 0.000 0.004 0.000 0.972 0.000 0.024
#> GSM258587 6 0.0405 0.896 0.000 0.004 0.000 0.008 0.000 0.988
#> GSM258588 3 0.2595 0.776 0.000 0.004 0.836 0.160 0.000 0.000
#> GSM258589 4 0.1444 0.818 0.000 0.000 0.072 0.928 0.000 0.000
#> GSM258591 6 0.1265 0.885 0.000 0.044 0.000 0.000 0.008 0.948
#> GSM258592 3 0.1611 0.864 0.012 0.008 0.944 0.012 0.024 0.000
#> GSM258593 3 0.1492 0.873 0.000 0.024 0.940 0.036 0.000 0.000
#> GSM258595 3 0.3351 0.603 0.000 0.000 0.712 0.288 0.000 0.000
#> GSM258597 6 0.1995 0.871 0.000 0.052 0.000 0.036 0.000 0.912
#> GSM258598 4 0.0858 0.844 0.000 0.000 0.028 0.968 0.000 0.004
#> GSM258600 4 0.0717 0.849 0.000 0.000 0.008 0.976 0.000 0.016
#> GSM258601 3 0.1611 0.864 0.012 0.008 0.944 0.012 0.024 0.000
#> GSM258602 6 0.0725 0.895 0.000 0.012 0.000 0.012 0.000 0.976
#> GSM258604 3 0.1842 0.858 0.012 0.008 0.932 0.012 0.036 0.000
#> GSM258605 6 0.4530 0.417 0.000 0.044 0.000 0.000 0.356 0.600
#> GSM258606 6 0.1152 0.886 0.000 0.044 0.000 0.000 0.004 0.952
#> GSM258607 6 0.2448 0.857 0.000 0.064 0.000 0.052 0.000 0.884
#> GSM258608 6 0.4438 0.482 0.000 0.044 0.000 0.000 0.328 0.628
Heatmaps for the consensus matrix. It visualizes the probability of two samples to be in a same group.
consensus_heatmap(res, k = 2)
consensus_heatmap(res, k = 3)
consensus_heatmap(res, k = 4)
consensus_heatmap(res, k = 5)
consensus_heatmap(res, k = 6)
Heatmaps for the membership of samples in all partitions to see how consistent they are:
membership_heatmap(res, k = 2)
membership_heatmap(res, k = 3)
membership_heatmap(res, k = 4)
membership_heatmap(res, k = 5)
membership_heatmap(res, k = 6)
As soon as we have had the classes for columns, we can look for signatures which are significantly different between classes which can be candidate marks for certain classes. Following are the heatmaps for signatures.
Signature heatmaps where rows are scaled:
get_signatures(res, k = 2)
get_signatures(res, k = 3)
get_signatures(res, k = 4)
get_signatures(res, k = 5)
get_signatures(res, k = 6)
Signature heatmaps where rows are not scaled:
get_signatures(res, k = 2, scale_rows = FALSE)
get_signatures(res, k = 3, scale_rows = FALSE)
get_signatures(res, k = 4, scale_rows = FALSE)
get_signatures(res, k = 5, scale_rows = FALSE)
get_signatures(res, k = 6, scale_rows = FALSE)
Compare the overlap of signatures from different k:
compare_signatures(res)
get_signature()
returns a data frame invisibly. TO get the list of signatures, the function
call should be assigned to a variable explicitly. In following code, if plot
argument is set
to FALSE
, no heatmap is plotted while only the differential analysis is performed.
# code only for demonstration
tb = get_signature(res, k = ..., plot = FALSE)
An example of the output of tb
is:
#> which_row fdr mean_1 mean_2 scaled_mean_1 scaled_mean_2 km
#> 1 38 0.042760348 8.373488 9.131774 -0.5533452 0.5164555 1
#> 2 40 0.018707592 7.106213 8.469186 -0.6173731 0.5762149 1
#> 3 55 0.019134737 10.221463 11.207825 -0.6159697 0.5749050 1
#> 4 59 0.006059896 5.921854 7.869574 -0.6899429 0.6439467 1
#> 5 60 0.018055526 8.928898 10.211722 -0.6204761 0.5791110 1
#> 6 98 0.009384629 15.714769 14.887706 0.6635654 -0.6193277 2
...
The columns in tb
are:
which_row
: row indices corresponding to the input matrix.fdr
: FDR for the differential test. mean_x
: The mean value in group x.scaled_mean_x
: The mean value in group x after rows are scaled.km
: Row groups if k-means clustering is applied to rows.UMAP plot which shows how samples are separated.
dimension_reduction(res, k = 2, method = "UMAP")
dimension_reduction(res, k = 3, method = "UMAP")
dimension_reduction(res, k = 4, method = "UMAP")
dimension_reduction(res, k = 5, method = "UMAP")
dimension_reduction(res, k = 6, method = "UMAP")
Following heatmap shows how subgroups are split when increasing k
:
collect_classes(res)
Test correlation between subgroups and known annotations. If the known annotation is numeric, one-way ANOVA test is applied, and if the known annotation is discrete, chi-squared contingency table test is applied.
test_to_known_factors(res)
#> n disease.state(p) k
#> ATC:kmeans 53 0.429 2
#> ATC:kmeans 57 0.904 3
#> ATC:kmeans 46 0.176 4
#> ATC:kmeans 44 0.906 5
#> ATC:kmeans 55 0.206 6
If matrix rows can be associated to genes, consider to use functional_enrichment(res,
...)
to perform function enrichment for the signature genes. See this vignette for more detailed explanations.
The object with results only for a single top-value method and a single partition method can be extracted as:
res = res_list["ATC", "skmeans"]
# you can also extract it by
# res = res_list["ATC:skmeans"]
A summary of res
and all the functions that can be applied to it:
res
#> A 'ConsensusPartition' object with k = 2, 3, 4, 5, 6.
#> On a matrix with 51941 rows and 58 columns.
#> Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'ATC' method.
#> Subgroups are detected by 'skmeans' method.
#> Performed in total 1250 partitions by row resampling.
#> Best k for subgroups seems to be 3.
#>
#> Following methods can be applied to this 'ConsensusPartition' object:
#> [1] "cola_report" "collect_classes" "collect_plots"
#> [4] "collect_stats" "colnames" "compare_signatures"
#> [7] "consensus_heatmap" "dimension_reduction" "functional_enrichment"
#> [10] "get_anno_col" "get_anno" "get_classes"
#> [13] "get_consensus" "get_matrix" "get_membership"
#> [16] "get_param" "get_signatures" "get_stats"
#> [19] "is_best_k" "is_stable_k" "membership_heatmap"
#> [22] "ncol" "nrow" "plot_ecdf"
#> [25] "rownames" "select_partition_number" "show"
#> [28] "suggest_best_k" "test_to_known_factors"
collect_plots()
function collects all the plots made from res
for all k
(number of partitions)
into one single page to provide an easy and fast comparison between different k
.
collect_plots(res)
The plots are:
k
and the heatmap of
predicted classes for each k
.k
.k
.k
.All the plots in panels can be made by individual functions and they are plotted later in this section.
select_partition_number()
produces several plots showing different
statistics for choosing “optimized” k
. There are following statistics:
k
;k
, the area increased is defined as \(A_k - A_{k-1}\).The detailed explanations of these statistics can be found in the cola vignette.
Generally speaking, lower PAC score, higher mean silhouette score or higher
concordance corresponds to better partition. Rand index and Jaccard index
measure how similar the current partition is compared to partition with k-1
.
If they are too similar, we won't accept k
is better than k-1
.
select_partition_number(res)
The numeric values for all these statistics can be obtained by get_stats()
.
get_stats(res)
#> k 1-PAC mean_silhouette concordance area_increased Rand Jaccard
#> 2 2 1.000 1.000 1.000 0.5093 0.491 0.491
#> 3 3 0.968 0.913 0.963 0.1745 0.907 0.810
#> 4 4 0.786 0.834 0.914 0.0865 0.964 0.910
#> 5 5 0.749 0.701 0.877 0.0641 0.967 0.913
#> 6 6 0.758 0.736 0.872 0.0343 0.937 0.817
suggest_best_k()
suggests the best \(k\) based on these statistics. The rules are as follows:
suggest_best_k(res)
#> [1] 3
#> attr(,"optional")
#> [1] 2
There is also optional best \(k\) = 2 that is worth to check.
Following shows the table of the partitions (You need to click the show/hide
code output link to see it). The membership matrix (columns with name p*
)
is inferred by
clue::cl_consensus()
function with the SE
method. Basically the value in the membership matrix
represents the probability to belong to a certain group. The finall class
label for an item is determined with the group with highest probability it
belongs to.
In get_classes()
function, the entropy is calculated from the membership
matrix and the silhouette score is calculated from the consensus matrix.
cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#> class entropy silhouette p1 p2
#> GSM258553 2 0 1 0 1
#> GSM258555 1 0 1 1 0
#> GSM258556 1 0 1 1 0
#> GSM258557 2 0 1 0 1
#> GSM258562 1 0 1 1 0
#> GSM258563 1 0 1 1 0
#> GSM258565 1 0 1 1 0
#> GSM258566 1 0 1 1 0
#> GSM258570 1 0 1 1 0
#> GSM258578 2 0 1 0 1
#> GSM258580 1 0 1 1 0
#> GSM258583 2 0 1 0 1
#> GSM258585 1 0 1 1 0
#> GSM258590 2 0 1 0 1
#> GSM258594 1 0 1 1 0
#> GSM258596 2 0 1 0 1
#> GSM258599 2 0 1 0 1
#> GSM258603 2 0 1 0 1
#> GSM258551 2 0 1 0 1
#> GSM258552 1 0 1 1 0
#> GSM258554 2 0 1 0 1
#> GSM258558 2 0 1 0 1
#> GSM258559 2 0 1 0 1
#> GSM258560 1 0 1 1 0
#> GSM258561 2 0 1 0 1
#> GSM258564 1 0 1 1 0
#> GSM258567 1 0 1 1 0
#> GSM258568 2 0 1 0 1
#> GSM258569 2 0 1 0 1
#> GSM258571 2 0 1 0 1
#> GSM258572 1 0 1 1 0
#> GSM258573 1 0 1 1 0
#> GSM258574 1 0 1 1 0
#> GSM258575 1 0 1 1 0
#> GSM258576 2 0 1 0 1
#> GSM258577 2 0 1 0 1
#> GSM258579 1 0 1 1 0
#> GSM258581 2 0 1 0 1
#> GSM258582 2 0 1 0 1
#> GSM258584 2 0 1 0 1
#> GSM258586 1 0 1 1 0
#> GSM258587 2 0 1 0 1
#> GSM258588 1 0 1 1 0
#> GSM258589 1 0 1 1 0
#> GSM258591 2 0 1 0 1
#> GSM258592 1 0 1 1 0
#> GSM258593 1 0 1 1 0
#> GSM258595 1 0 1 1 0
#> GSM258597 2 0 1 0 1
#> GSM258598 1 0 1 1 0
#> GSM258600 1 0 1 1 0
#> GSM258601 1 0 1 1 0
#> GSM258602 2 0 1 0 1
#> GSM258604 1 0 1 1 0
#> GSM258605 2 0 1 0 1
#> GSM258606 2 0 1 0 1
#> GSM258607 2 0 1 0 1
#> GSM258608 2 0 1 0 1
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> GSM258553 2 0.0000 0.949 0.000 1.000 0.000
#> GSM258555 3 0.0000 0.998 0.000 0.000 1.000
#> GSM258556 3 0.0000 0.998 0.000 0.000 1.000
#> GSM258557 1 0.6045 0.567 0.620 0.380 0.000
#> GSM258562 3 0.0000 0.998 0.000 0.000 1.000
#> GSM258563 3 0.0237 0.995 0.004 0.000 0.996
#> GSM258565 3 0.0000 0.998 0.000 0.000 1.000
#> GSM258566 3 0.0000 0.998 0.000 0.000 1.000
#> GSM258570 3 0.0747 0.985 0.016 0.000 0.984
#> GSM258578 1 0.0000 0.780 1.000 0.000 0.000
#> GSM258580 3 0.0000 0.998 0.000 0.000 1.000
#> GSM258583 2 0.0000 0.949 0.000 1.000 0.000
#> GSM258585 3 0.0000 0.998 0.000 0.000 1.000
#> GSM258590 2 0.0000 0.949 0.000 1.000 0.000
#> GSM258594 3 0.0747 0.985 0.016 0.000 0.984
#> GSM258596 1 0.0592 0.782 0.988 0.012 0.000
#> GSM258599 2 0.6062 0.247 0.384 0.616 0.000
#> GSM258603 2 0.0000 0.949 0.000 1.000 0.000
#> GSM258551 2 0.0000 0.949 0.000 1.000 0.000
#> GSM258552 3 0.0000 0.998 0.000 0.000 1.000
#> GSM258554 2 0.0000 0.949 0.000 1.000 0.000
#> GSM258558 2 0.0000 0.949 0.000 1.000 0.000
#> GSM258559 2 0.0000 0.949 0.000 1.000 0.000
#> GSM258560 3 0.1163 0.975 0.028 0.000 0.972
#> GSM258561 2 0.0000 0.949 0.000 1.000 0.000
#> GSM258564 3 0.0000 0.998 0.000 0.000 1.000
#> GSM258567 3 0.0000 0.998 0.000 0.000 1.000
#> GSM258568 2 0.0000 0.949 0.000 1.000 0.000
#> GSM258569 2 0.0000 0.949 0.000 1.000 0.000
#> GSM258571 2 0.0000 0.949 0.000 1.000 0.000
#> GSM258572 3 0.0000 0.998 0.000 0.000 1.000
#> GSM258573 3 0.0000 0.998 0.000 0.000 1.000
#> GSM258574 3 0.0000 0.998 0.000 0.000 1.000
#> GSM258575 3 0.0000 0.998 0.000 0.000 1.000
#> GSM258576 2 0.6215 0.111 0.428 0.572 0.000
#> GSM258577 2 0.0000 0.949 0.000 1.000 0.000
#> GSM258579 3 0.0000 0.998 0.000 0.000 1.000
#> GSM258581 2 0.1031 0.926 0.024 0.976 0.000
#> GSM258582 1 0.6045 0.567 0.620 0.380 0.000
#> GSM258584 2 0.0000 0.949 0.000 1.000 0.000
#> GSM258586 3 0.0000 0.998 0.000 0.000 1.000
#> GSM258587 1 0.6154 0.511 0.592 0.408 0.000
#> GSM258588 3 0.0000 0.998 0.000 0.000 1.000
#> GSM258589 3 0.0000 0.998 0.000 0.000 1.000
#> GSM258591 2 0.1289 0.917 0.032 0.968 0.000
#> GSM258592 3 0.0000 0.998 0.000 0.000 1.000
#> GSM258593 3 0.0000 0.998 0.000 0.000 1.000
#> GSM258595 3 0.0000 0.998 0.000 0.000 1.000
#> GSM258597 1 0.0747 0.783 0.984 0.016 0.000
#> GSM258598 3 0.0000 0.998 0.000 0.000 1.000
#> GSM258600 3 0.0000 0.998 0.000 0.000 1.000
#> GSM258601 3 0.0000 0.998 0.000 0.000 1.000
#> GSM258602 2 0.0000 0.949 0.000 1.000 0.000
#> GSM258604 3 0.0000 0.998 0.000 0.000 1.000
#> GSM258605 2 0.0000 0.949 0.000 1.000 0.000
#> GSM258606 2 0.0000 0.949 0.000 1.000 0.000
#> GSM258607 1 0.0237 0.783 0.996 0.004 0.000
#> GSM258608 2 0.0000 0.949 0.000 1.000 0.000
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> GSM258553 2 0.0000 0.965 0.000 1.000 0.000 0.000
#> GSM258555 3 0.0188 0.918 0.004 0.000 0.996 0.000
#> GSM258556 3 0.3764 0.776 0.216 0.000 0.784 0.000
#> GSM258557 4 0.2773 0.566 0.004 0.116 0.000 0.880
#> GSM258562 3 0.1302 0.900 0.044 0.000 0.956 0.000
#> GSM258563 3 0.4605 0.637 0.336 0.000 0.664 0.000
#> GSM258565 3 0.0000 0.919 0.000 0.000 1.000 0.000
#> GSM258566 3 0.0336 0.917 0.008 0.000 0.992 0.000
#> GSM258570 3 0.3649 0.762 0.204 0.000 0.796 0.000
#> GSM258578 1 0.4855 0.916 0.600 0.000 0.000 0.400
#> GSM258580 3 0.0000 0.919 0.000 0.000 1.000 0.000
#> GSM258583 2 0.0000 0.965 0.000 1.000 0.000 0.000
#> GSM258585 3 0.1389 0.899 0.048 0.000 0.952 0.000
#> GSM258590 2 0.0000 0.965 0.000 1.000 0.000 0.000
#> GSM258594 3 0.3975 0.714 0.240 0.000 0.760 0.000
#> GSM258596 1 0.4973 0.918 0.644 0.008 0.000 0.348
#> GSM258599 4 0.5244 0.444 0.012 0.388 0.000 0.600
#> GSM258603 2 0.0000 0.965 0.000 1.000 0.000 0.000
#> GSM258551 2 0.0000 0.965 0.000 1.000 0.000 0.000
#> GSM258552 3 0.0000 0.919 0.000 0.000 1.000 0.000
#> GSM258554 2 0.0000 0.965 0.000 1.000 0.000 0.000
#> GSM258558 2 0.0000 0.965 0.000 1.000 0.000 0.000
#> GSM258559 2 0.0000 0.965 0.000 1.000 0.000 0.000
#> GSM258560 3 0.4948 0.387 0.440 0.000 0.560 0.000
#> GSM258561 2 0.0000 0.965 0.000 1.000 0.000 0.000
#> GSM258564 3 0.0817 0.911 0.024 0.000 0.976 0.000
#> GSM258567 3 0.0000 0.919 0.000 0.000 1.000 0.000
#> GSM258568 2 0.0469 0.956 0.012 0.988 0.000 0.000
#> GSM258569 2 0.0000 0.965 0.000 1.000 0.000 0.000
#> GSM258571 2 0.0000 0.965 0.000 1.000 0.000 0.000
#> GSM258572 3 0.0000 0.919 0.000 0.000 1.000 0.000
#> GSM258573 3 0.0000 0.919 0.000 0.000 1.000 0.000
#> GSM258574 3 0.0000 0.919 0.000 0.000 1.000 0.000
#> GSM258575 3 0.0000 0.919 0.000 0.000 1.000 0.000
#> GSM258576 4 0.5093 0.463 0.012 0.348 0.000 0.640
#> GSM258577 2 0.0000 0.965 0.000 1.000 0.000 0.000
#> GSM258579 3 0.0000 0.919 0.000 0.000 1.000 0.000
#> GSM258581 2 0.4098 0.666 0.012 0.784 0.000 0.204
#> GSM258582 4 0.3157 0.585 0.004 0.144 0.000 0.852
#> GSM258584 2 0.0000 0.965 0.000 1.000 0.000 0.000
#> GSM258586 3 0.3764 0.776 0.216 0.000 0.784 0.000
#> GSM258587 4 0.3444 0.576 0.000 0.184 0.000 0.816
#> GSM258588 3 0.0000 0.919 0.000 0.000 1.000 0.000
#> GSM258589 3 0.3726 0.779 0.212 0.000 0.788 0.000
#> GSM258591 2 0.4453 0.583 0.012 0.744 0.000 0.244
#> GSM258592 3 0.0336 0.917 0.008 0.000 0.992 0.000
#> GSM258593 3 0.0000 0.919 0.000 0.000 1.000 0.000
#> GSM258595 3 0.0000 0.919 0.000 0.000 1.000 0.000
#> GSM258597 4 0.0188 0.363 0.004 0.000 0.000 0.996
#> GSM258598 3 0.0336 0.917 0.008 0.000 0.992 0.000
#> GSM258600 3 0.3764 0.776 0.216 0.000 0.784 0.000
#> GSM258601 3 0.0592 0.915 0.016 0.000 0.984 0.000
#> GSM258602 2 0.0336 0.959 0.008 0.992 0.000 0.000
#> GSM258604 3 0.1389 0.899 0.048 0.000 0.952 0.000
#> GSM258605 2 0.0000 0.965 0.000 1.000 0.000 0.000
#> GSM258606 2 0.1488 0.924 0.012 0.956 0.000 0.032
#> GSM258607 4 0.3105 0.149 0.140 0.004 0.000 0.856
#> GSM258608 2 0.0000 0.965 0.000 1.000 0.000 0.000
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> GSM258553 3 0.0000 0.9324 0.000 0.000 1.000 0.000 0.000
#> GSM258555 2 0.0510 0.8269 0.000 0.984 0.000 0.000 0.016
#> GSM258556 2 0.4300 -0.0734 0.000 0.524 0.000 0.000 0.476
#> GSM258557 4 0.4015 0.6111 0.016 0.000 0.204 0.768 0.012
#> GSM258562 2 0.2471 0.7130 0.000 0.864 0.000 0.000 0.136
#> GSM258563 5 0.4842 0.3523 0.048 0.264 0.000 0.004 0.684
#> GSM258565 2 0.0404 0.8281 0.000 0.988 0.000 0.000 0.012
#> GSM258566 2 0.0510 0.8269 0.000 0.984 0.000 0.000 0.016
#> GSM258570 2 0.5348 0.4070 0.112 0.656 0.000 0.000 0.232
#> GSM258578 1 0.2890 0.8316 0.836 0.000 0.000 0.160 0.004
#> GSM258580 2 0.0290 0.8290 0.000 0.992 0.000 0.000 0.008
#> GSM258583 3 0.0000 0.9324 0.000 0.000 1.000 0.000 0.000
#> GSM258585 2 0.2970 0.6842 0.004 0.828 0.000 0.000 0.168
#> GSM258590 3 0.0000 0.9324 0.000 0.000 1.000 0.000 0.000
#> GSM258594 2 0.5122 0.4622 0.112 0.688 0.000 0.000 0.200
#> GSM258596 1 0.1484 0.8275 0.944 0.000 0.000 0.048 0.008
#> GSM258599 4 0.5158 0.4799 0.020 0.000 0.316 0.636 0.028
#> GSM258603 3 0.0000 0.9324 0.000 0.000 1.000 0.000 0.000
#> GSM258551 3 0.0000 0.9324 0.000 0.000 1.000 0.000 0.000
#> GSM258552 2 0.0162 0.8300 0.000 0.996 0.000 0.000 0.004
#> GSM258554 3 0.0000 0.9324 0.000 0.000 1.000 0.000 0.000
#> GSM258558 3 0.0000 0.9324 0.000 0.000 1.000 0.000 0.000
#> GSM258559 3 0.0000 0.9324 0.000 0.000 1.000 0.000 0.000
#> GSM258560 5 0.6269 0.0892 0.284 0.188 0.000 0.000 0.528
#> GSM258561 3 0.0000 0.9324 0.000 0.000 1.000 0.000 0.000
#> GSM258564 2 0.1544 0.7952 0.000 0.932 0.000 0.000 0.068
#> GSM258567 2 0.0290 0.8291 0.000 0.992 0.000 0.000 0.008
#> GSM258568 3 0.2925 0.8312 0.024 0.000 0.884 0.068 0.024
#> GSM258569 3 0.0000 0.9324 0.000 0.000 1.000 0.000 0.000
#> GSM258571 3 0.0000 0.9324 0.000 0.000 1.000 0.000 0.000
#> GSM258572 2 0.0162 0.8300 0.000 0.996 0.000 0.000 0.004
#> GSM258573 2 0.0162 0.8300 0.000 0.996 0.000 0.000 0.004
#> GSM258574 2 0.0162 0.8297 0.000 0.996 0.000 0.000 0.004
#> GSM258575 2 0.0000 0.8300 0.000 1.000 0.000 0.000 0.000
#> GSM258576 4 0.4938 0.5147 0.020 0.000 0.272 0.680 0.028
#> GSM258577 3 0.0000 0.9324 0.000 0.000 1.000 0.000 0.000
#> GSM258579 2 0.0162 0.8300 0.000 0.996 0.000 0.000 0.004
#> GSM258581 3 0.4965 0.5002 0.024 0.000 0.676 0.276 0.024
#> GSM258582 4 0.3832 0.6191 0.016 0.000 0.172 0.796 0.016
#> GSM258584 3 0.0000 0.9324 0.000 0.000 1.000 0.000 0.000
#> GSM258586 2 0.4300 -0.0741 0.000 0.524 0.000 0.000 0.476
#> GSM258587 4 0.3266 0.6267 0.004 0.000 0.200 0.796 0.000
#> GSM258588 2 0.0404 0.8273 0.000 0.988 0.000 0.000 0.012
#> GSM258589 2 0.4219 0.1341 0.000 0.584 0.000 0.000 0.416
#> GSM258591 3 0.5307 0.3490 0.024 0.000 0.616 0.332 0.028
#> GSM258592 2 0.0963 0.8169 0.000 0.964 0.000 0.000 0.036
#> GSM258593 2 0.0162 0.8300 0.000 0.996 0.000 0.000 0.004
#> GSM258595 2 0.0290 0.8288 0.000 0.992 0.000 0.000 0.008
#> GSM258597 4 0.0566 0.4772 0.012 0.000 0.000 0.984 0.004
#> GSM258598 2 0.1341 0.7979 0.000 0.944 0.000 0.000 0.056
#> GSM258600 2 0.4273 0.0293 0.000 0.552 0.000 0.000 0.448
#> GSM258601 2 0.1341 0.8042 0.000 0.944 0.000 0.000 0.056
#> GSM258602 3 0.1787 0.8899 0.032 0.000 0.940 0.016 0.012
#> GSM258604 2 0.2674 0.7189 0.004 0.856 0.000 0.000 0.140
#> GSM258605 3 0.0000 0.9324 0.000 0.000 1.000 0.000 0.000
#> GSM258606 3 0.3917 0.7389 0.024 0.000 0.808 0.144 0.024
#> GSM258607 4 0.5026 0.1253 0.280 0.000 0.000 0.656 0.064
#> GSM258608 3 0.0000 0.9324 0.000 0.000 1.000 0.000 0.000
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> GSM258553 6 0.0000 0.8830 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM258555 2 0.0363 0.9148 0.000 0.988 0.012 0.000 0.000 0.000
#> GSM258556 4 0.3578 0.8148 0.000 0.340 0.000 0.660 0.000 0.000
#> GSM258557 5 0.3150 0.5275 0.000 0.000 0.052 0.000 0.828 0.120
#> GSM258562 2 0.2378 0.7201 0.000 0.848 0.000 0.152 0.000 0.000
#> GSM258563 4 0.2315 0.2386 0.008 0.084 0.016 0.892 0.000 0.000
#> GSM258565 2 0.0146 0.9170 0.000 0.996 0.004 0.000 0.000 0.000
#> GSM258566 2 0.0725 0.9094 0.000 0.976 0.012 0.012 0.000 0.000
#> GSM258570 2 0.5313 0.4760 0.068 0.684 0.156 0.092 0.000 0.000
#> GSM258578 1 0.3322 0.7778 0.832 0.000 0.052 0.012 0.104 0.000
#> GSM258580 2 0.0000 0.9177 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM258583 6 0.0000 0.8830 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM258585 2 0.2457 0.8231 0.000 0.880 0.084 0.036 0.000 0.000
#> GSM258590 6 0.0508 0.8754 0.000 0.000 0.012 0.004 0.000 0.984
#> GSM258594 2 0.4934 0.4633 0.040 0.672 0.240 0.048 0.000 0.000
#> GSM258596 1 0.0603 0.7845 0.980 0.000 0.016 0.000 0.004 0.000
#> GSM258599 5 0.5781 0.4518 0.024 0.000 0.140 0.000 0.572 0.264
#> GSM258603 6 0.0508 0.8754 0.000 0.000 0.012 0.004 0.000 0.984
#> GSM258551 6 0.0508 0.8754 0.000 0.000 0.012 0.004 0.000 0.984
#> GSM258552 2 0.0260 0.9168 0.000 0.992 0.000 0.008 0.000 0.000
#> GSM258554 6 0.0000 0.8830 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM258558 6 0.0000 0.8830 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM258559 6 0.0000 0.8830 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM258560 3 0.6634 -0.0401 0.128 0.076 0.436 0.360 0.000 0.000
#> GSM258561 6 0.0000 0.8830 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM258564 2 0.1334 0.8913 0.000 0.948 0.032 0.020 0.000 0.000
#> GSM258567 2 0.0260 0.9168 0.000 0.992 0.000 0.008 0.000 0.000
#> GSM258568 6 0.4330 0.6506 0.028 0.000 0.136 0.000 0.076 0.760
#> GSM258569 6 0.0000 0.8830 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM258571 6 0.0000 0.8830 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM258572 2 0.0146 0.9180 0.000 0.996 0.000 0.004 0.000 0.000
#> GSM258573 2 0.0146 0.9180 0.000 0.996 0.000 0.004 0.000 0.000
#> GSM258574 2 0.0146 0.9180 0.000 0.996 0.000 0.004 0.000 0.000
#> GSM258575 2 0.0146 0.9180 0.000 0.996 0.000 0.004 0.000 0.000
#> GSM258576 5 0.5593 0.4855 0.028 0.000 0.144 0.000 0.620 0.208
#> GSM258577 6 0.0000 0.8830 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM258579 2 0.0260 0.9168 0.000 0.992 0.000 0.008 0.000 0.000
#> GSM258581 6 0.6099 0.0872 0.028 0.000 0.148 0.000 0.320 0.504
#> GSM258582 5 0.2848 0.5633 0.004 0.000 0.024 0.000 0.848 0.124
#> GSM258584 6 0.0508 0.8754 0.000 0.000 0.012 0.004 0.000 0.984
#> GSM258586 4 0.3578 0.8149 0.000 0.340 0.000 0.660 0.000 0.000
#> GSM258587 5 0.2482 0.5862 0.000 0.000 0.004 0.000 0.848 0.148
#> GSM258588 2 0.0632 0.9062 0.000 0.976 0.000 0.024 0.000 0.000
#> GSM258589 4 0.3789 0.7631 0.000 0.416 0.000 0.584 0.000 0.000
#> GSM258591 6 0.6140 -0.0212 0.028 0.000 0.144 0.000 0.352 0.476
#> GSM258592 2 0.0725 0.9094 0.000 0.976 0.012 0.012 0.000 0.000
#> GSM258593 2 0.0146 0.9180 0.000 0.996 0.000 0.004 0.000 0.000
#> GSM258595 2 0.0790 0.9003 0.000 0.968 0.000 0.032 0.000 0.000
#> GSM258597 5 0.1807 0.4438 0.020 0.000 0.060 0.000 0.920 0.000
#> GSM258598 2 0.1387 0.8615 0.000 0.932 0.000 0.068 0.000 0.000
#> GSM258600 4 0.3717 0.8058 0.000 0.384 0.000 0.616 0.000 0.000
#> GSM258601 2 0.0993 0.9031 0.000 0.964 0.024 0.012 0.000 0.000
#> GSM258602 6 0.3546 0.7427 0.056 0.000 0.096 0.000 0.024 0.824
#> GSM258604 2 0.1984 0.8571 0.000 0.912 0.056 0.032 0.000 0.000
#> GSM258605 6 0.0000 0.8830 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM258606 6 0.5608 0.3971 0.028 0.000 0.140 0.000 0.216 0.616
#> GSM258607 3 0.5987 -0.1048 0.136 0.000 0.468 0.020 0.376 0.000
#> GSM258608 6 0.0000 0.8830 0.000 0.000 0.000 0.000 0.000 1.000
Heatmaps for the consensus matrix. It visualizes the probability of two samples to be in a same group.
consensus_heatmap(res, k = 2)
consensus_heatmap(res, k = 3)
consensus_heatmap(res, k = 4)
consensus_heatmap(res, k = 5)
consensus_heatmap(res, k = 6)
Heatmaps for the membership of samples in all partitions to see how consistent they are:
membership_heatmap(res, k = 2)
membership_heatmap(res, k = 3)
membership_heatmap(res, k = 4)
membership_heatmap(res, k = 5)
membership_heatmap(res, k = 6)
As soon as we have had the classes for columns, we can look for signatures which are significantly different between classes which can be candidate marks for certain classes. Following are the heatmaps for signatures.
Signature heatmaps where rows are scaled:
get_signatures(res, k = 2)
get_signatures(res, k = 3)
get_signatures(res, k = 4)
get_signatures(res, k = 5)
get_signatures(res, k = 6)
Signature heatmaps where rows are not scaled:
get_signatures(res, k = 2, scale_rows = FALSE)
get_signatures(res, k = 3, scale_rows = FALSE)
get_signatures(res, k = 4, scale_rows = FALSE)
get_signatures(res, k = 5, scale_rows = FALSE)
get_signatures(res, k = 6, scale_rows = FALSE)
Compare the overlap of signatures from different k:
compare_signatures(res)
get_signature()
returns a data frame invisibly. TO get the list of signatures, the function
call should be assigned to a variable explicitly. In following code, if plot
argument is set
to FALSE
, no heatmap is plotted while only the differential analysis is performed.
# code only for demonstration
tb = get_signature(res, k = ..., plot = FALSE)
An example of the output of tb
is:
#> which_row fdr mean_1 mean_2 scaled_mean_1 scaled_mean_2 km
#> 1 38 0.042760348 8.373488 9.131774 -0.5533452 0.5164555 1
#> 2 40 0.018707592 7.106213 8.469186 -0.6173731 0.5762149 1
#> 3 55 0.019134737 10.221463 11.207825 -0.6159697 0.5749050 1
#> 4 59 0.006059896 5.921854 7.869574 -0.6899429 0.6439467 1
#> 5 60 0.018055526 8.928898 10.211722 -0.6204761 0.5791110 1
#> 6 98 0.009384629 15.714769 14.887706 0.6635654 -0.6193277 2
...
The columns in tb
are:
which_row
: row indices corresponding to the input matrix.fdr
: FDR for the differential test. mean_x
: The mean value in group x.scaled_mean_x
: The mean value in group x after rows are scaled.km
: Row groups if k-means clustering is applied to rows.UMAP plot which shows how samples are separated.
dimension_reduction(res, k = 2, method = "UMAP")
dimension_reduction(res, k = 3, method = "UMAP")
dimension_reduction(res, k = 4, method = "UMAP")
dimension_reduction(res, k = 5, method = "UMAP")
dimension_reduction(res, k = 6, method = "UMAP")
Following heatmap shows how subgroups are split when increasing k
:
collect_classes(res)
Test correlation between subgroups and known annotations. If the known annotation is numeric, one-way ANOVA test is applied, and if the known annotation is discrete, chi-squared contingency table test is applied.
test_to_known_factors(res)
#> n disease.state(p) k
#> ATC:skmeans 58 0.777 2
#> ATC:skmeans 56 0.414 3
#> ATC:skmeans 53 0.125 4
#> ATC:skmeans 46 0.134 5
#> ATC:skmeans 47 0.276 6
If matrix rows can be associated to genes, consider to use functional_enrichment(res,
...)
to perform function enrichment for the signature genes. See this vignette for more detailed explanations.
The object with results only for a single top-value method and a single partition method can be extracted as:
res = res_list["ATC", "pam"]
# you can also extract it by
# res = res_list["ATC:pam"]
A summary of res
and all the functions that can be applied to it:
res
#> A 'ConsensusPartition' object with k = 2, 3, 4, 5, 6.
#> On a matrix with 51941 rows and 58 columns.
#> Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'ATC' method.
#> Subgroups are detected by 'pam' method.
#> Performed in total 1250 partitions by row resampling.
#> Best k for subgroups seems to be 2.
#>
#> Following methods can be applied to this 'ConsensusPartition' object:
#> [1] "cola_report" "collect_classes" "collect_plots"
#> [4] "collect_stats" "colnames" "compare_signatures"
#> [7] "consensus_heatmap" "dimension_reduction" "functional_enrichment"
#> [10] "get_anno_col" "get_anno" "get_classes"
#> [13] "get_consensus" "get_matrix" "get_membership"
#> [16] "get_param" "get_signatures" "get_stats"
#> [19] "is_best_k" "is_stable_k" "membership_heatmap"
#> [22] "ncol" "nrow" "plot_ecdf"
#> [25] "rownames" "select_partition_number" "show"
#> [28] "suggest_best_k" "test_to_known_factors"
collect_plots()
function collects all the plots made from res
for all k
(number of partitions)
into one single page to provide an easy and fast comparison between different k
.
collect_plots(res)
The plots are:
k
and the heatmap of
predicted classes for each k
.k
.k
.k
.All the plots in panels can be made by individual functions and they are plotted later in this section.
select_partition_number()
produces several plots showing different
statistics for choosing “optimized” k
. There are following statistics:
k
;k
, the area increased is defined as \(A_k - A_{k-1}\).The detailed explanations of these statistics can be found in the cola vignette.
Generally speaking, lower PAC score, higher mean silhouette score or higher
concordance corresponds to better partition. Rand index and Jaccard index
measure how similar the current partition is compared to partition with k-1
.
If they are too similar, we won't accept k
is better than k-1
.
select_partition_number(res)
The numeric values for all these statistics can be obtained by get_stats()
.
get_stats(res)
#> k 1-PAC mean_silhouette concordance area_increased Rand Jaccard
#> 2 2 0.928 0.919 0.970 0.5042 0.494 0.494
#> 3 3 0.830 0.885 0.953 0.2666 0.718 0.502
#> 4 4 0.806 0.843 0.919 0.1096 0.889 0.711
#> 5 5 0.758 0.783 0.863 0.0992 0.863 0.577
#> 6 6 0.830 0.671 0.822 0.0509 0.885 0.552
suggest_best_k()
suggests the best \(k\) based on these statistics. The rules are as follows:
suggest_best_k(res)
#> [1] 2
Following shows the table of the partitions (You need to click the show/hide
code output link to see it). The membership matrix (columns with name p*
)
is inferred by
clue::cl_consensus()
function with the SE
method. Basically the value in the membership matrix
represents the probability to belong to a certain group. The finall class
label for an item is determined with the group with highest probability it
belongs to.
In get_classes()
function, the entropy is calculated from the membership
matrix and the silhouette score is calculated from the consensus matrix.
cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#> class entropy silhouette p1 p2
#> GSM258553 2 0.000 0.972 0.000 1.000
#> GSM258555 1 0.000 0.960 1.000 0.000
#> GSM258556 1 0.808 0.670 0.752 0.248
#> GSM258557 2 0.000 0.972 0.000 1.000
#> GSM258562 1 0.000 0.960 1.000 0.000
#> GSM258563 2 0.994 0.108 0.456 0.544
#> GSM258565 1 0.000 0.960 1.000 0.000
#> GSM258566 1 0.000 0.960 1.000 0.000
#> GSM258570 1 0.992 0.188 0.552 0.448
#> GSM258578 2 0.000 0.972 0.000 1.000
#> GSM258580 1 0.000 0.960 1.000 0.000
#> GSM258583 2 0.000 0.972 0.000 1.000
#> GSM258585 1 0.000 0.960 1.000 0.000
#> GSM258590 2 0.000 0.972 0.000 1.000
#> GSM258594 1 0.781 0.695 0.768 0.232
#> GSM258596 2 0.000 0.972 0.000 1.000
#> GSM258599 2 0.000 0.972 0.000 1.000
#> GSM258603 2 0.000 0.972 0.000 1.000
#> GSM258551 2 0.000 0.972 0.000 1.000
#> GSM258552 1 0.000 0.960 1.000 0.000
#> GSM258554 2 0.000 0.972 0.000 1.000
#> GSM258558 2 0.000 0.972 0.000 1.000
#> GSM258559 2 0.000 0.972 0.000 1.000
#> GSM258560 2 0.917 0.469 0.332 0.668
#> GSM258561 2 0.000 0.972 0.000 1.000
#> GSM258564 1 0.000 0.960 1.000 0.000
#> GSM258567 1 0.000 0.960 1.000 0.000
#> GSM258568 2 0.000 0.972 0.000 1.000
#> GSM258569 2 0.000 0.972 0.000 1.000
#> GSM258571 2 0.000 0.972 0.000 1.000
#> GSM258572 1 0.000 0.960 1.000 0.000
#> GSM258573 1 0.000 0.960 1.000 0.000
#> GSM258574 1 0.000 0.960 1.000 0.000
#> GSM258575 1 0.000 0.960 1.000 0.000
#> GSM258576 2 0.000 0.972 0.000 1.000
#> GSM258577 2 0.000 0.972 0.000 1.000
#> GSM258579 1 0.000 0.960 1.000 0.000
#> GSM258581 2 0.000 0.972 0.000 1.000
#> GSM258582 2 0.000 0.972 0.000 1.000
#> GSM258584 2 0.000 0.972 0.000 1.000
#> GSM258586 1 0.295 0.915 0.948 0.052
#> GSM258587 2 0.000 0.972 0.000 1.000
#> GSM258588 1 0.000 0.960 1.000 0.000
#> GSM258589 1 0.000 0.960 1.000 0.000
#> GSM258591 2 0.000 0.972 0.000 1.000
#> GSM258592 1 0.000 0.960 1.000 0.000
#> GSM258593 1 0.000 0.960 1.000 0.000
#> GSM258595 1 0.000 0.960 1.000 0.000
#> GSM258597 2 0.000 0.972 0.000 1.000
#> GSM258598 1 0.000 0.960 1.000 0.000
#> GSM258600 1 0.000 0.960 1.000 0.000
#> GSM258601 1 0.000 0.960 1.000 0.000
#> GSM258602 2 0.000 0.972 0.000 1.000
#> GSM258604 1 0.000 0.960 1.000 0.000
#> GSM258605 2 0.000 0.972 0.000 1.000
#> GSM258606 2 0.000 0.972 0.000 1.000
#> GSM258607 2 0.000 0.972 0.000 1.000
#> GSM258608 2 0.000 0.972 0.000 1.000
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> GSM258553 2 0.6286 -0.023 0.464 0.536 0.000
#> GSM258555 3 0.0000 0.957 0.000 0.000 1.000
#> GSM258556 2 0.2625 0.870 0.000 0.916 0.084
#> GSM258557 2 0.0000 0.941 0.000 1.000 0.000
#> GSM258562 3 0.3038 0.851 0.000 0.104 0.896
#> GSM258563 2 0.0592 0.935 0.000 0.988 0.012
#> GSM258565 3 0.0000 0.957 0.000 0.000 1.000
#> GSM258566 3 0.0000 0.957 0.000 0.000 1.000
#> GSM258570 2 0.0592 0.935 0.000 0.988 0.012
#> GSM258578 2 0.0000 0.941 0.000 1.000 0.000
#> GSM258580 3 0.0000 0.957 0.000 0.000 1.000
#> GSM258583 1 0.6026 0.468 0.624 0.376 0.000
#> GSM258585 3 0.4750 0.710 0.000 0.216 0.784
#> GSM258590 1 0.0000 0.913 1.000 0.000 0.000
#> GSM258594 2 0.0592 0.935 0.000 0.988 0.012
#> GSM258596 2 0.0000 0.941 0.000 1.000 0.000
#> GSM258599 2 0.0000 0.941 0.000 1.000 0.000
#> GSM258603 1 0.0000 0.913 1.000 0.000 0.000
#> GSM258551 1 0.0000 0.913 1.000 0.000 0.000
#> GSM258552 3 0.0000 0.957 0.000 0.000 1.000
#> GSM258554 1 0.0000 0.913 1.000 0.000 0.000
#> GSM258558 1 0.4235 0.816 0.824 0.176 0.000
#> GSM258559 1 0.1753 0.905 0.952 0.048 0.000
#> GSM258560 2 0.0000 0.941 0.000 1.000 0.000
#> GSM258561 1 0.0000 0.913 1.000 0.000 0.000
#> GSM258564 2 0.2625 0.870 0.000 0.916 0.084
#> GSM258567 3 0.0000 0.957 0.000 0.000 1.000
#> GSM258568 2 0.0000 0.941 0.000 1.000 0.000
#> GSM258569 2 0.4504 0.708 0.196 0.804 0.000
#> GSM258571 1 0.4235 0.816 0.824 0.176 0.000
#> GSM258572 3 0.0000 0.957 0.000 0.000 1.000
#> GSM258573 3 0.0000 0.957 0.000 0.000 1.000
#> GSM258574 3 0.0000 0.957 0.000 0.000 1.000
#> GSM258575 3 0.0000 0.957 0.000 0.000 1.000
#> GSM258576 2 0.0000 0.941 0.000 1.000 0.000
#> GSM258577 1 0.1860 0.903 0.948 0.052 0.000
#> GSM258579 3 0.0000 0.957 0.000 0.000 1.000
#> GSM258581 2 0.0000 0.941 0.000 1.000 0.000
#> GSM258582 2 0.0000 0.941 0.000 1.000 0.000
#> GSM258584 1 0.0000 0.913 1.000 0.000 0.000
#> GSM258586 2 0.4121 0.773 0.000 0.832 0.168
#> GSM258587 2 0.0000 0.941 0.000 1.000 0.000
#> GSM258588 3 0.0000 0.957 0.000 0.000 1.000
#> GSM258589 3 0.0000 0.957 0.000 0.000 1.000
#> GSM258591 2 0.0000 0.941 0.000 1.000 0.000
#> GSM258592 3 0.0000 0.957 0.000 0.000 1.000
#> GSM258593 3 0.0000 0.957 0.000 0.000 1.000
#> GSM258595 3 0.0000 0.957 0.000 0.000 1.000
#> GSM258597 2 0.0000 0.941 0.000 1.000 0.000
#> GSM258598 3 0.6026 0.383 0.000 0.376 0.624
#> GSM258600 2 0.4235 0.763 0.000 0.824 0.176
#> GSM258601 3 0.0000 0.957 0.000 0.000 1.000
#> GSM258602 2 0.0000 0.941 0.000 1.000 0.000
#> GSM258604 3 0.0000 0.957 0.000 0.000 1.000
#> GSM258605 2 0.0000 0.941 0.000 1.000 0.000
#> GSM258606 2 0.0000 0.941 0.000 1.000 0.000
#> GSM258607 2 0.0000 0.941 0.000 1.000 0.000
#> GSM258608 2 0.0000 0.941 0.000 1.000 0.000
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> GSM258553 2 0.0000 0.956 0.000 1.000 0.000 0.000
#> GSM258555 3 0.0000 0.923 0.000 0.000 1.000 0.000
#> GSM258556 4 0.0000 0.833 0.000 0.000 0.000 1.000
#> GSM258557 4 0.2345 0.829 0.000 0.100 0.000 0.900
#> GSM258562 3 0.4761 0.535 0.000 0.000 0.628 0.372
#> GSM258563 4 0.0000 0.833 0.000 0.000 0.000 1.000
#> GSM258565 3 0.0000 0.923 0.000 0.000 1.000 0.000
#> GSM258566 3 0.0000 0.923 0.000 0.000 1.000 0.000
#> GSM258570 4 0.0000 0.833 0.000 0.000 0.000 1.000
#> GSM258578 4 0.0817 0.839 0.000 0.024 0.000 0.976
#> GSM258580 3 0.0000 0.923 0.000 0.000 1.000 0.000
#> GSM258583 2 0.0000 0.956 0.000 1.000 0.000 0.000
#> GSM258585 3 0.4985 0.311 0.000 0.000 0.532 0.468
#> GSM258590 1 0.0000 0.999 1.000 0.000 0.000 0.000
#> GSM258594 4 0.0000 0.833 0.000 0.000 0.000 1.000
#> GSM258596 4 0.0817 0.839 0.000 0.024 0.000 0.976
#> GSM258599 4 0.4356 0.732 0.000 0.292 0.000 0.708
#> GSM258603 1 0.0000 0.999 1.000 0.000 0.000 0.000
#> GSM258551 1 0.0000 0.999 1.000 0.000 0.000 0.000
#> GSM258552 3 0.0000 0.923 0.000 0.000 1.000 0.000
#> GSM258554 1 0.0188 0.996 0.996 0.004 0.000 0.000
#> GSM258558 2 0.0000 0.956 0.000 1.000 0.000 0.000
#> GSM258559 2 0.0336 0.949 0.008 0.992 0.000 0.000
#> GSM258560 4 0.0592 0.837 0.000 0.016 0.000 0.984
#> GSM258561 2 0.4454 0.458 0.308 0.692 0.000 0.000
#> GSM258564 4 0.0000 0.833 0.000 0.000 0.000 1.000
#> GSM258567 3 0.4250 0.661 0.000 0.000 0.724 0.276
#> GSM258568 4 0.4356 0.732 0.000 0.292 0.000 0.708
#> GSM258569 2 0.0000 0.956 0.000 1.000 0.000 0.000
#> GSM258571 2 0.0000 0.956 0.000 1.000 0.000 0.000
#> GSM258572 3 0.0000 0.923 0.000 0.000 1.000 0.000
#> GSM258573 3 0.0000 0.923 0.000 0.000 1.000 0.000
#> GSM258574 3 0.0000 0.923 0.000 0.000 1.000 0.000
#> GSM258575 3 0.0000 0.923 0.000 0.000 1.000 0.000
#> GSM258576 4 0.4356 0.732 0.000 0.292 0.000 0.708
#> GSM258577 2 0.0188 0.953 0.004 0.996 0.000 0.000
#> GSM258579 3 0.0000 0.923 0.000 0.000 1.000 0.000
#> GSM258581 4 0.4356 0.732 0.000 0.292 0.000 0.708
#> GSM258582 4 0.2345 0.829 0.000 0.100 0.000 0.900
#> GSM258584 1 0.0000 0.999 1.000 0.000 0.000 0.000
#> GSM258586 4 0.0000 0.833 0.000 0.000 0.000 1.000
#> GSM258587 4 0.4356 0.732 0.000 0.292 0.000 0.708
#> GSM258588 3 0.0000 0.923 0.000 0.000 1.000 0.000
#> GSM258589 3 0.2216 0.856 0.000 0.000 0.908 0.092
#> GSM258591 4 0.4356 0.732 0.000 0.292 0.000 0.708
#> GSM258592 3 0.0000 0.923 0.000 0.000 1.000 0.000
#> GSM258593 3 0.0000 0.923 0.000 0.000 1.000 0.000
#> GSM258595 3 0.0707 0.912 0.000 0.000 0.980 0.020
#> GSM258597 4 0.2345 0.829 0.000 0.100 0.000 0.900
#> GSM258598 4 0.4761 0.190 0.000 0.000 0.372 0.628
#> GSM258600 4 0.0000 0.833 0.000 0.000 0.000 1.000
#> GSM258601 3 0.0000 0.923 0.000 0.000 1.000 0.000
#> GSM258602 4 0.4356 0.732 0.000 0.292 0.000 0.708
#> GSM258604 3 0.0921 0.908 0.000 0.000 0.972 0.028
#> GSM258605 2 0.0000 0.956 0.000 1.000 0.000 0.000
#> GSM258606 4 0.4356 0.732 0.000 0.292 0.000 0.708
#> GSM258607 4 0.0817 0.839 0.000 0.024 0.000 0.976
#> GSM258608 2 0.0000 0.956 0.000 1.000 0.000 0.000
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> GSM258553 3 0.3895 0.827 0.000 0.000 0.680 0.320 0.000
#> GSM258555 2 0.0000 0.933 0.000 1.000 0.000 0.000 0.000
#> GSM258556 5 0.0000 0.850 0.000 0.000 0.000 0.000 1.000
#> GSM258557 4 0.2179 0.732 0.000 0.000 0.000 0.888 0.112
#> GSM258562 5 0.0290 0.845 0.000 0.008 0.000 0.000 0.992
#> GSM258563 5 0.3661 0.658 0.000 0.000 0.000 0.276 0.724
#> GSM258565 2 0.0000 0.933 0.000 1.000 0.000 0.000 0.000
#> GSM258566 2 0.0963 0.938 0.000 0.964 0.000 0.000 0.036
#> GSM258570 5 0.3586 0.674 0.000 0.000 0.000 0.264 0.736
#> GSM258578 4 0.3876 0.451 0.000 0.000 0.000 0.684 0.316
#> GSM258580 2 0.0000 0.933 0.000 1.000 0.000 0.000 0.000
#> GSM258583 3 0.3895 0.827 0.000 0.000 0.680 0.320 0.000
#> GSM258585 5 0.0000 0.850 0.000 0.000 0.000 0.000 1.000
#> GSM258590 1 0.0000 0.936 1.000 0.000 0.000 0.000 0.000
#> GSM258594 5 0.3612 0.669 0.000 0.000 0.000 0.268 0.732
#> GSM258596 4 0.3876 0.451 0.000 0.000 0.000 0.684 0.316
#> GSM258599 4 0.2424 0.690 0.000 0.000 0.132 0.868 0.000
#> GSM258603 1 0.0000 0.936 1.000 0.000 0.000 0.000 0.000
#> GSM258551 1 0.0000 0.936 1.000 0.000 0.000 0.000 0.000
#> GSM258552 2 0.1270 0.938 0.000 0.948 0.000 0.000 0.052
#> GSM258554 1 0.3895 0.709 0.680 0.000 0.320 0.000 0.000
#> GSM258558 3 0.3895 0.827 0.000 0.000 0.680 0.320 0.000
#> GSM258559 3 0.0000 0.608 0.000 0.000 1.000 0.000 0.000
#> GSM258560 5 0.3774 0.622 0.000 0.000 0.000 0.296 0.704
#> GSM258561 3 0.2648 0.348 0.152 0.000 0.848 0.000 0.000
#> GSM258564 5 0.0000 0.850 0.000 0.000 0.000 0.000 1.000
#> GSM258567 5 0.1341 0.801 0.000 0.056 0.000 0.000 0.944
#> GSM258568 4 0.2424 0.690 0.000 0.000 0.132 0.868 0.000
#> GSM258569 3 0.3895 0.827 0.000 0.000 0.680 0.320 0.000
#> GSM258571 3 0.3895 0.827 0.000 0.000 0.680 0.320 0.000
#> GSM258572 2 0.0000 0.933 0.000 1.000 0.000 0.000 0.000
#> GSM258573 2 0.0404 0.936 0.000 0.988 0.000 0.000 0.012
#> GSM258574 2 0.0000 0.933 0.000 1.000 0.000 0.000 0.000
#> GSM258575 2 0.0290 0.935 0.000 0.992 0.000 0.000 0.008
#> GSM258576 4 0.2424 0.690 0.000 0.000 0.132 0.868 0.000
#> GSM258577 3 0.0000 0.608 0.000 0.000 1.000 0.000 0.000
#> GSM258579 2 0.1270 0.938 0.000 0.948 0.000 0.000 0.052
#> GSM258581 4 0.2424 0.690 0.000 0.000 0.132 0.868 0.000
#> GSM258582 4 0.2669 0.739 0.000 0.000 0.020 0.876 0.104
#> GSM258584 1 0.0000 0.936 1.000 0.000 0.000 0.000 0.000
#> GSM258586 5 0.0000 0.850 0.000 0.000 0.000 0.000 1.000
#> GSM258587 4 0.0609 0.740 0.000 0.000 0.000 0.980 0.020
#> GSM258588 2 0.1270 0.938 0.000 0.948 0.000 0.000 0.052
#> GSM258589 5 0.3366 0.584 0.000 0.232 0.000 0.000 0.768
#> GSM258591 4 0.2424 0.690 0.000 0.000 0.132 0.868 0.000
#> GSM258592 2 0.1270 0.938 0.000 0.948 0.000 0.000 0.052
#> GSM258593 2 0.1270 0.938 0.000 0.948 0.000 0.000 0.052
#> GSM258595 2 0.3684 0.703 0.000 0.720 0.000 0.000 0.280
#> GSM258597 4 0.2179 0.732 0.000 0.000 0.000 0.888 0.112
#> GSM258598 5 0.0000 0.850 0.000 0.000 0.000 0.000 1.000
#> GSM258600 5 0.0000 0.850 0.000 0.000 0.000 0.000 1.000
#> GSM258601 2 0.1270 0.938 0.000 0.948 0.000 0.000 0.052
#> GSM258602 4 0.0609 0.740 0.000 0.000 0.000 0.980 0.020
#> GSM258604 2 0.3707 0.697 0.000 0.716 0.000 0.000 0.284
#> GSM258605 3 0.3895 0.827 0.000 0.000 0.680 0.320 0.000
#> GSM258606 4 0.2424 0.690 0.000 0.000 0.132 0.868 0.000
#> GSM258607 4 0.3876 0.451 0.000 0.000 0.000 0.684 0.316
#> GSM258608 3 0.3966 0.806 0.000 0.000 0.664 0.336 0.000
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> GSM258553 6 0.3789 0.5407 0.000 0.000 0.000 0.000 0.416 0.584
#> GSM258555 2 0.3862 0.5647 0.000 0.524 0.000 0.476 0.000 0.000
#> GSM258556 4 0.4824 0.9829 0.000 0.056 0.420 0.524 0.000 0.000
#> GSM258557 1 0.3797 0.7455 0.580 0.000 0.000 0.000 0.000 0.420
#> GSM258562 4 0.4824 0.9829 0.000 0.056 0.420 0.524 0.000 0.000
#> GSM258563 1 0.4504 0.4879 0.576 0.000 0.392 0.004 0.000 0.028
#> GSM258565 2 0.3862 0.5647 0.000 0.524 0.000 0.476 0.000 0.000
#> GSM258566 2 0.0547 0.7502 0.000 0.980 0.000 0.020 0.000 0.000
#> GSM258570 1 0.4999 0.4104 0.544 0.000 0.400 0.036 0.000 0.020
#> GSM258578 1 0.3923 0.7478 0.580 0.000 0.004 0.000 0.000 0.416
#> GSM258580 2 0.3862 0.5647 0.000 0.524 0.000 0.476 0.000 0.000
#> GSM258583 6 0.3789 0.5407 0.000 0.000 0.000 0.000 0.416 0.584
#> GSM258585 4 0.4824 0.9829 0.000 0.056 0.420 0.524 0.000 0.000
#> GSM258590 3 0.3797 1.0000 0.420 0.000 0.580 0.000 0.000 0.000
#> GSM258594 1 0.4310 0.4865 0.580 0.000 0.396 0.000 0.000 0.024
#> GSM258596 1 0.3923 0.7478 0.580 0.000 0.004 0.000 0.000 0.416
#> GSM258599 6 0.0000 0.5957 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM258603 3 0.3797 1.0000 0.420 0.000 0.580 0.000 0.000 0.000
#> GSM258551 3 0.3797 1.0000 0.420 0.000 0.580 0.000 0.000 0.000
#> GSM258552 2 0.0458 0.7550 0.000 0.984 0.000 0.016 0.000 0.000
#> GSM258554 5 0.3789 0.0442 0.416 0.000 0.000 0.000 0.584 0.000
#> GSM258558 6 0.3789 0.5407 0.000 0.000 0.000 0.000 0.416 0.584
#> GSM258559 5 0.0000 0.8041 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM258560 1 0.4371 0.4930 0.580 0.000 0.392 0.000 0.000 0.028
#> GSM258561 5 0.0547 0.7992 0.020 0.000 0.000 0.000 0.980 0.000
#> GSM258564 4 0.4824 0.9829 0.000 0.056 0.420 0.524 0.000 0.000
#> GSM258567 4 0.4868 0.9795 0.000 0.060 0.416 0.524 0.000 0.000
#> GSM258568 6 0.0000 0.5957 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM258569 6 0.3789 0.5407 0.000 0.000 0.000 0.000 0.416 0.584
#> GSM258571 6 0.3789 0.5407 0.000 0.000 0.000 0.000 0.416 0.584
#> GSM258572 2 0.3862 0.5647 0.000 0.524 0.000 0.476 0.000 0.000
#> GSM258573 2 0.0865 0.7452 0.000 0.964 0.000 0.036 0.000 0.000
#> GSM258574 2 0.3862 0.5647 0.000 0.524 0.000 0.476 0.000 0.000
#> GSM258575 2 0.1007 0.7421 0.000 0.956 0.000 0.044 0.000 0.000
#> GSM258576 6 0.0000 0.5957 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM258577 5 0.0000 0.8041 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM258579 2 0.0458 0.7550 0.000 0.984 0.000 0.016 0.000 0.000
#> GSM258581 6 0.0000 0.5957 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM258582 6 0.3843 -0.5887 0.452 0.000 0.000 0.000 0.000 0.548
#> GSM258584 3 0.3797 1.0000 0.420 0.000 0.580 0.000 0.000 0.000
#> GSM258586 4 0.4824 0.9829 0.000 0.056 0.420 0.524 0.000 0.000
#> GSM258587 1 0.3823 0.7262 0.564 0.000 0.000 0.000 0.000 0.436
#> GSM258588 2 0.0458 0.7550 0.000 0.984 0.000 0.016 0.000 0.000
#> GSM258589 4 0.5543 0.8638 0.000 0.156 0.320 0.524 0.000 0.000
#> GSM258591 6 0.0000 0.5957 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM258592 2 0.0458 0.7550 0.000 0.984 0.000 0.016 0.000 0.000
#> GSM258593 2 0.0458 0.7550 0.000 0.984 0.000 0.016 0.000 0.000
#> GSM258595 2 0.4101 0.1049 0.000 0.580 0.012 0.408 0.000 0.000
#> GSM258597 1 0.3797 0.7455 0.580 0.000 0.000 0.000 0.000 0.420
#> GSM258598 4 0.4824 0.9829 0.000 0.056 0.420 0.524 0.000 0.000
#> GSM258600 4 0.4824 0.9829 0.000 0.056 0.420 0.524 0.000 0.000
#> GSM258601 2 0.0458 0.7550 0.000 0.984 0.000 0.016 0.000 0.000
#> GSM258602 1 0.3797 0.7455 0.580 0.000 0.000 0.000 0.000 0.420
#> GSM258604 2 0.3737 0.1818 0.000 0.608 0.000 0.392 0.000 0.000
#> GSM258605 6 0.3789 0.5407 0.000 0.000 0.000 0.000 0.416 0.584
#> GSM258606 6 0.0000 0.5957 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM258607 1 0.3923 0.7478 0.580 0.000 0.004 0.000 0.000 0.416
#> GSM258608 6 0.3789 0.5407 0.000 0.000 0.000 0.000 0.416 0.584
Heatmaps for the consensus matrix. It visualizes the probability of two samples to be in a same group.
consensus_heatmap(res, k = 2)
consensus_heatmap(res, k = 3)
consensus_heatmap(res, k = 4)
consensus_heatmap(res, k = 5)
consensus_heatmap(res, k = 6)
Heatmaps for the membership of samples in all partitions to see how consistent they are:
membership_heatmap(res, k = 2)
membership_heatmap(res, k = 3)
membership_heatmap(res, k = 4)
membership_heatmap(res, k = 5)
membership_heatmap(res, k = 6)
As soon as we have had the classes for columns, we can look for signatures which are significantly different between classes which can be candidate marks for certain classes. Following are the heatmaps for signatures.
Signature heatmaps where rows are scaled:
get_signatures(res, k = 2)
get_signatures(res, k = 3)
get_signatures(res, k = 4)
get_signatures(res, k = 5)
get_signatures(res, k = 6)
Signature heatmaps where rows are not scaled:
get_signatures(res, k = 2, scale_rows = FALSE)
get_signatures(res, k = 3, scale_rows = FALSE)
get_signatures(res, k = 4, scale_rows = FALSE)
get_signatures(res, k = 5, scale_rows = FALSE)
get_signatures(res, k = 6, scale_rows = FALSE)
Compare the overlap of signatures from different k:
compare_signatures(res)
get_signature()
returns a data frame invisibly. TO get the list of signatures, the function
call should be assigned to a variable explicitly. In following code, if plot
argument is set
to FALSE
, no heatmap is plotted while only the differential analysis is performed.
# code only for demonstration
tb = get_signature(res, k = ..., plot = FALSE)
An example of the output of tb
is:
#> which_row fdr mean_1 mean_2 scaled_mean_1 scaled_mean_2 km
#> 1 38 0.042760348 8.373488 9.131774 -0.5533452 0.5164555 1
#> 2 40 0.018707592 7.106213 8.469186 -0.6173731 0.5762149 1
#> 3 55 0.019134737 10.221463 11.207825 -0.6159697 0.5749050 1
#> 4 59 0.006059896 5.921854 7.869574 -0.6899429 0.6439467 1
#> 5 60 0.018055526 8.928898 10.211722 -0.6204761 0.5791110 1
#> 6 98 0.009384629 15.714769 14.887706 0.6635654 -0.6193277 2
...
The columns in tb
are:
which_row
: row indices corresponding to the input matrix.fdr
: FDR for the differential test. mean_x
: The mean value in group x.scaled_mean_x
: The mean value in group x after rows are scaled.km
: Row groups if k-means clustering is applied to rows.UMAP plot which shows how samples are separated.
dimension_reduction(res, k = 2, method = "UMAP")
dimension_reduction(res, k = 3, method = "UMAP")
dimension_reduction(res, k = 4, method = "UMAP")
dimension_reduction(res, k = 5, method = "UMAP")
dimension_reduction(res, k = 6, method = "UMAP")
Following heatmap shows how subgroups are split when increasing k
:
collect_classes(res)
Test correlation between subgroups and known annotations. If the known annotation is numeric, one-way ANOVA test is applied, and if the known annotation is discrete, chi-squared contingency table test is applied.
test_to_known_factors(res)
#> n disease.state(p) k
#> ATC:pam 55 1.000 2
#> ATC:pam 55 0.774 3
#> ATC:pam 55 0.800 4
#> ATC:pam 54 0.549 5
#> ATC:pam 50 0.707 6
If matrix rows can be associated to genes, consider to use functional_enrichment(res,
...)
to perform function enrichment for the signature genes. See this vignette for more detailed explanations.
The object with results only for a single top-value method and a single partition method can be extracted as:
res = res_list["ATC", "mclust"]
# you can also extract it by
# res = res_list["ATC:mclust"]
A summary of res
and all the functions that can be applied to it:
res
#> A 'ConsensusPartition' object with k = 2, 3, 4, 5, 6.
#> On a matrix with 51941 rows and 58 columns.
#> Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'ATC' method.
#> Subgroups are detected by 'mclust' method.
#> Performed in total 1250 partitions by row resampling.
#> Best k for subgroups seems to be 2.
#>
#> Following methods can be applied to this 'ConsensusPartition' object:
#> [1] "cola_report" "collect_classes" "collect_plots"
#> [4] "collect_stats" "colnames" "compare_signatures"
#> [7] "consensus_heatmap" "dimension_reduction" "functional_enrichment"
#> [10] "get_anno_col" "get_anno" "get_classes"
#> [13] "get_consensus" "get_matrix" "get_membership"
#> [16] "get_param" "get_signatures" "get_stats"
#> [19] "is_best_k" "is_stable_k" "membership_heatmap"
#> [22] "ncol" "nrow" "plot_ecdf"
#> [25] "rownames" "select_partition_number" "show"
#> [28] "suggest_best_k" "test_to_known_factors"
collect_plots()
function collects all the plots made from res
for all k
(number of partitions)
into one single page to provide an easy and fast comparison between different k
.
collect_plots(res)
The plots are:
k
and the heatmap of
predicted classes for each k
.k
.k
.k
.All the plots in panels can be made by individual functions and they are plotted later in this section.
select_partition_number()
produces several plots showing different
statistics for choosing “optimized” k
. There are following statistics:
k
;k
, the area increased is defined as \(A_k - A_{k-1}\).The detailed explanations of these statistics can be found in the cola vignette.
Generally speaking, lower PAC score, higher mean silhouette score or higher
concordance corresponds to better partition. Rand index and Jaccard index
measure how similar the current partition is compared to partition with k-1
.
If they are too similar, we won't accept k
is better than k-1
.
select_partition_number(res)
The numeric values for all these statistics can be obtained by get_stats()
.
get_stats(res)
#> k 1-PAC mean_silhouette concordance area_increased Rand Jaccard
#> 2 2 1.000 1.000 1.000 0.1315 0.869 0.869
#> 3 3 0.399 0.676 0.804 2.8605 0.564 0.499
#> 4 4 0.793 0.850 0.915 0.3504 0.672 0.388
#> 5 5 0.761 0.817 0.900 0.1217 0.886 0.651
#> 6 6 0.724 0.703 0.814 0.0502 0.986 0.940
suggest_best_k()
suggests the best \(k\) based on these statistics. The rules are as follows:
suggest_best_k(res)
#> [1] 2
Following shows the table of the partitions (You need to click the show/hide
code output link to see it). The membership matrix (columns with name p*
)
is inferred by
clue::cl_consensus()
function with the SE
method. Basically the value in the membership matrix
represents the probability to belong to a certain group. The finall class
label for an item is determined with the group with highest probability it
belongs to.
In get_classes()
function, the entropy is calculated from the membership
matrix and the silhouette score is calculated from the consensus matrix.
cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#> class entropy silhouette p1 p2
#> GSM258553 2 0 1 0 1
#> GSM258555 2 0 1 0 1
#> GSM258556 2 0 1 0 1
#> GSM258557 2 0 1 0 1
#> GSM258562 2 0 1 0 1
#> GSM258563 2 0 1 0 1
#> GSM258565 2 0 1 0 1
#> GSM258566 2 0 1 0 1
#> GSM258570 2 0 1 0 1
#> GSM258578 2 0 1 0 1
#> GSM258580 2 0 1 0 1
#> GSM258583 2 0 1 0 1
#> GSM258585 2 0 1 0 1
#> GSM258590 1 0 1 1 0
#> GSM258594 2 0 1 0 1
#> GSM258596 2 0 1 0 1
#> GSM258599 2 0 1 0 1
#> GSM258603 1 0 1 1 0
#> GSM258551 1 0 1 1 0
#> GSM258552 2 0 1 0 1
#> GSM258554 2 0 1 0 1
#> GSM258558 2 0 1 0 1
#> GSM258559 2 0 1 0 1
#> GSM258560 2 0 1 0 1
#> GSM258561 2 0 1 0 1
#> GSM258564 2 0 1 0 1
#> GSM258567 2 0 1 0 1
#> GSM258568 2 0 1 0 1
#> GSM258569 2 0 1 0 1
#> GSM258571 2 0 1 0 1
#> GSM258572 2 0 1 0 1
#> GSM258573 2 0 1 0 1
#> GSM258574 2 0 1 0 1
#> GSM258575 2 0 1 0 1
#> GSM258576 2 0 1 0 1
#> GSM258577 2 0 1 0 1
#> GSM258579 2 0 1 0 1
#> GSM258581 2 0 1 0 1
#> GSM258582 2 0 1 0 1
#> GSM258584 1 0 1 1 0
#> GSM258586 2 0 1 0 1
#> GSM258587 2 0 1 0 1
#> GSM258588 2 0 1 0 1
#> GSM258589 2 0 1 0 1
#> GSM258591 2 0 1 0 1
#> GSM258592 2 0 1 0 1
#> GSM258593 2 0 1 0 1
#> GSM258595 2 0 1 0 1
#> GSM258597 2 0 1 0 1
#> GSM258598 2 0 1 0 1
#> GSM258600 2 0 1 0 1
#> GSM258601 2 0 1 0 1
#> GSM258602 2 0 1 0 1
#> GSM258604 2 0 1 0 1
#> GSM258605 2 0 1 0 1
#> GSM258606 2 0 1 0 1
#> GSM258607 2 0 1 0 1
#> GSM258608 2 0 1 0 1
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> GSM258553 2 0.2448 0.695 0.000 0.924 0.076
#> GSM258555 3 0.0237 0.784 0.000 0.004 0.996
#> GSM258556 2 0.6309 0.303 0.000 0.504 0.496
#> GSM258557 2 0.6062 0.599 0.000 0.616 0.384
#> GSM258562 3 0.4002 0.756 0.000 0.160 0.840
#> GSM258563 2 0.6079 0.599 0.000 0.612 0.388
#> GSM258565 3 0.0237 0.784 0.000 0.004 0.996
#> GSM258566 3 0.0237 0.784 0.000 0.004 0.996
#> GSM258570 3 0.4887 0.740 0.000 0.228 0.772
#> GSM258578 2 0.5706 0.623 0.000 0.680 0.320
#> GSM258580 3 0.0237 0.784 0.000 0.004 0.996
#> GSM258583 2 0.0000 0.681 0.000 1.000 0.000
#> GSM258585 3 0.4842 0.743 0.000 0.224 0.776
#> GSM258590 1 0.0000 1.000 1.000 0.000 0.000
#> GSM258594 3 0.5098 0.723 0.000 0.248 0.752
#> GSM258596 2 0.5706 0.623 0.000 0.680 0.320
#> GSM258599 3 0.5465 0.674 0.000 0.288 0.712
#> GSM258603 1 0.0000 1.000 1.000 0.000 0.000
#> GSM258551 1 0.0000 1.000 1.000 0.000 0.000
#> GSM258552 3 0.0000 0.783 0.000 0.000 1.000
#> GSM258554 2 0.0000 0.681 0.000 1.000 0.000
#> GSM258558 2 0.0000 0.681 0.000 1.000 0.000
#> GSM258559 2 0.0237 0.679 0.000 0.996 0.004
#> GSM258560 3 0.4887 0.740 0.000 0.228 0.772
#> GSM258561 2 0.0000 0.681 0.000 1.000 0.000
#> GSM258564 3 0.4931 0.739 0.000 0.232 0.768
#> GSM258567 3 0.4002 0.756 0.000 0.160 0.840
#> GSM258568 2 0.6308 -0.169 0.000 0.508 0.492
#> GSM258569 2 0.4504 0.670 0.000 0.804 0.196
#> GSM258571 2 0.0000 0.681 0.000 1.000 0.000
#> GSM258572 3 0.0424 0.786 0.000 0.008 0.992
#> GSM258573 3 0.0237 0.784 0.000 0.004 0.996
#> GSM258574 3 0.0237 0.784 0.000 0.004 0.996
#> GSM258575 3 0.0424 0.786 0.000 0.008 0.992
#> GSM258576 3 0.5178 0.707 0.000 0.256 0.744
#> GSM258577 2 0.0237 0.676 0.004 0.996 0.000
#> GSM258579 3 0.0424 0.786 0.000 0.008 0.992
#> GSM258581 3 0.6026 0.533 0.000 0.376 0.624
#> GSM258582 2 0.6062 0.599 0.000 0.616 0.384
#> GSM258584 1 0.0000 1.000 1.000 0.000 0.000
#> GSM258586 2 0.6126 0.573 0.000 0.600 0.400
#> GSM258587 2 0.6079 0.599 0.000 0.612 0.388
#> GSM258588 3 0.3816 0.764 0.000 0.148 0.852
#> GSM258589 2 0.6111 0.587 0.000 0.604 0.396
#> GSM258591 3 0.5988 0.549 0.000 0.368 0.632
#> GSM258592 3 0.2165 0.776 0.000 0.064 0.936
#> GSM258593 3 0.0592 0.786 0.000 0.012 0.988
#> GSM258595 2 0.6215 0.519 0.000 0.572 0.428
#> GSM258597 3 0.4974 0.729 0.000 0.236 0.764
#> GSM258598 3 0.4002 0.756 0.000 0.160 0.840
#> GSM258600 3 0.6252 -0.133 0.000 0.444 0.556
#> GSM258601 3 0.2261 0.774 0.000 0.068 0.932
#> GSM258602 2 0.5178 0.662 0.000 0.744 0.256
#> GSM258604 3 0.2356 0.774 0.000 0.072 0.928
#> GSM258605 2 0.0000 0.681 0.000 1.000 0.000
#> GSM258606 3 0.6299 0.228 0.000 0.476 0.524
#> GSM258607 2 0.5706 0.623 0.000 0.680 0.320
#> GSM258608 2 0.0000 0.681 0.000 1.000 0.000
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> GSM258553 2 0.2530 0.857 0 0.888 0.000 0.112
#> GSM258555 3 0.0817 0.881 0 0.024 0.976 0.000
#> GSM258556 4 0.5193 0.477 0 0.020 0.324 0.656
#> GSM258557 4 0.2111 0.878 0 0.044 0.024 0.932
#> GSM258562 3 0.2081 0.849 0 0.000 0.916 0.084
#> GSM258563 4 0.2500 0.884 0 0.044 0.040 0.916
#> GSM258565 3 0.0817 0.881 0 0.024 0.976 0.000
#> GSM258566 3 0.0817 0.881 0 0.024 0.976 0.000
#> GSM258570 4 0.2281 0.876 0 0.000 0.096 0.904
#> GSM258578 4 0.1637 0.877 0 0.060 0.000 0.940
#> GSM258580 3 0.0817 0.881 0 0.024 0.976 0.000
#> GSM258583 2 0.1022 0.958 0 0.968 0.000 0.032
#> GSM258585 3 0.6270 0.313 0 0.060 0.536 0.404
#> GSM258590 1 0.0000 1.000 1 0.000 0.000 0.000
#> GSM258594 4 0.2002 0.893 0 0.020 0.044 0.936
#> GSM258596 4 0.1807 0.882 0 0.052 0.008 0.940
#> GSM258599 4 0.2142 0.894 0 0.016 0.056 0.928
#> GSM258603 1 0.0000 1.000 1 0.000 0.000 0.000
#> GSM258551 1 0.0000 1.000 1 0.000 0.000 0.000
#> GSM258552 3 0.1635 0.858 0 0.044 0.948 0.008
#> GSM258554 2 0.0921 0.959 0 0.972 0.000 0.028
#> GSM258558 2 0.2081 0.913 0 0.916 0.000 0.084
#> GSM258559 2 0.0817 0.958 0 0.976 0.000 0.024
#> GSM258560 4 0.1867 0.890 0 0.000 0.072 0.928
#> GSM258561 2 0.2081 0.913 0 0.916 0.000 0.084
#> GSM258564 4 0.1716 0.892 0 0.000 0.064 0.936
#> GSM258567 3 0.2011 0.851 0 0.000 0.920 0.080
#> GSM258568 4 0.2300 0.892 0 0.016 0.064 0.920
#> GSM258569 4 0.2647 0.797 0 0.120 0.000 0.880
#> GSM258571 2 0.0921 0.959 0 0.972 0.000 0.028
#> GSM258572 3 0.0817 0.881 0 0.024 0.976 0.000
#> GSM258573 3 0.0817 0.881 0 0.024 0.976 0.000
#> GSM258574 3 0.0817 0.881 0 0.024 0.976 0.000
#> GSM258575 3 0.0000 0.879 0 0.000 1.000 0.000
#> GSM258576 4 0.2142 0.894 0 0.016 0.056 0.928
#> GSM258577 2 0.0921 0.959 0 0.972 0.000 0.028
#> GSM258579 3 0.0817 0.881 0 0.024 0.976 0.000
#> GSM258581 4 0.2300 0.892 0 0.016 0.064 0.920
#> GSM258582 4 0.1004 0.869 0 0.004 0.024 0.972
#> GSM258584 1 0.0000 1.000 1 0.000 0.000 0.000
#> GSM258586 4 0.4720 0.474 0 0.004 0.324 0.672
#> GSM258587 4 0.1004 0.869 0 0.004 0.024 0.972
#> GSM258588 3 0.1940 0.853 0 0.000 0.924 0.076
#> GSM258589 3 0.3208 0.818 0 0.004 0.848 0.148
#> GSM258591 4 0.2300 0.892 0 0.016 0.064 0.920
#> GSM258592 3 0.2644 0.843 0 0.060 0.908 0.032
#> GSM258593 3 0.0000 0.879 0 0.000 1.000 0.000
#> GSM258595 3 0.3208 0.818 0 0.004 0.848 0.148
#> GSM258597 4 0.0817 0.887 0 0.000 0.024 0.976
#> GSM258598 3 0.4072 0.632 0 0.000 0.748 0.252
#> GSM258600 4 0.4920 0.369 0 0.004 0.368 0.628
#> GSM258601 3 0.2644 0.843 0 0.060 0.908 0.032
#> GSM258602 4 0.1637 0.877 0 0.060 0.000 0.940
#> GSM258604 3 0.5090 0.475 0 0.016 0.660 0.324
#> GSM258605 2 0.1211 0.955 0 0.960 0.000 0.040
#> GSM258606 4 0.2335 0.893 0 0.020 0.060 0.920
#> GSM258607 4 0.1807 0.882 0 0.052 0.008 0.940
#> GSM258608 2 0.1302 0.951 0 0.956 0.000 0.044
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> GSM258553 3 0.2233 0.845 0 0.000 0.892 0.104 0.004
#> GSM258555 2 0.0162 0.855 0 0.996 0.000 0.000 0.004
#> GSM258556 5 0.4538 0.107 0 0.008 0.000 0.452 0.540
#> GSM258557 4 0.2773 0.810 0 0.000 0.000 0.836 0.164
#> GSM258562 5 0.1282 0.813 0 0.044 0.000 0.004 0.952
#> GSM258563 4 0.2605 0.818 0 0.000 0.000 0.852 0.148
#> GSM258565 2 0.0162 0.855 0 0.996 0.000 0.000 0.004
#> GSM258566 2 0.0693 0.854 0 0.980 0.000 0.008 0.012
#> GSM258570 4 0.4414 0.379 0 0.004 0.004 0.616 0.376
#> GSM258578 4 0.1121 0.890 0 0.000 0.000 0.956 0.044
#> GSM258580 2 0.0162 0.855 0 0.996 0.000 0.000 0.004
#> GSM258583 3 0.1408 0.938 0 0.000 0.948 0.044 0.008
#> GSM258585 5 0.5875 0.398 0 0.256 0.000 0.152 0.592
#> GSM258590 1 0.0000 1.000 1 0.000 0.000 0.000 0.000
#> GSM258594 4 0.1282 0.892 0 0.000 0.004 0.952 0.044
#> GSM258596 4 0.1211 0.893 0 0.000 0.024 0.960 0.016
#> GSM258599 4 0.1907 0.899 0 0.000 0.028 0.928 0.044
#> GSM258603 1 0.0000 1.000 1 0.000 0.000 0.000 0.000
#> GSM258551 1 0.0000 1.000 1 0.000 0.000 0.000 0.000
#> GSM258552 2 0.3816 0.563 0 0.696 0.000 0.000 0.304
#> GSM258554 3 0.0290 0.953 0 0.000 0.992 0.000 0.008
#> GSM258558 3 0.0771 0.944 0 0.000 0.976 0.020 0.004
#> GSM258559 3 0.0000 0.952 0 0.000 1.000 0.000 0.000
#> GSM258560 4 0.1978 0.899 0 0.004 0.024 0.928 0.044
#> GSM258561 3 0.0290 0.953 0 0.000 0.992 0.000 0.008
#> GSM258564 4 0.3031 0.846 0 0.016 0.004 0.852 0.128
#> GSM258567 5 0.1484 0.813 0 0.048 0.000 0.008 0.944
#> GSM258568 4 0.2149 0.898 0 0.000 0.048 0.916 0.036
#> GSM258569 4 0.3010 0.807 0 0.000 0.172 0.824 0.004
#> GSM258571 3 0.0290 0.954 0 0.000 0.992 0.008 0.000
#> GSM258572 2 0.0579 0.855 0 0.984 0.000 0.008 0.008
#> GSM258573 2 0.0609 0.855 0 0.980 0.000 0.000 0.020
#> GSM258574 2 0.0290 0.855 0 0.992 0.000 0.000 0.008
#> GSM258575 2 0.3519 0.703 0 0.776 0.000 0.008 0.216
#> GSM258576 4 0.1907 0.899 0 0.000 0.028 0.928 0.044
#> GSM258577 3 0.0290 0.953 0 0.000 0.992 0.000 0.008
#> GSM258579 2 0.4446 0.244 0 0.592 0.000 0.008 0.400
#> GSM258581 4 0.1992 0.899 0 0.000 0.044 0.924 0.032
#> GSM258582 4 0.2773 0.810 0 0.000 0.000 0.836 0.164
#> GSM258584 1 0.0000 1.000 1 0.000 0.000 0.000 0.000
#> GSM258586 5 0.2886 0.717 0 0.008 0.000 0.148 0.844
#> GSM258587 4 0.2516 0.828 0 0.000 0.000 0.860 0.140
#> GSM258588 5 0.1557 0.811 0 0.052 0.000 0.008 0.940
#> GSM258589 5 0.1818 0.794 0 0.024 0.000 0.044 0.932
#> GSM258591 4 0.1992 0.899 0 0.000 0.044 0.924 0.032
#> GSM258592 2 0.3622 0.781 0 0.816 0.000 0.136 0.048
#> GSM258593 5 0.4268 0.391 0 0.344 0.000 0.008 0.648
#> GSM258595 5 0.1410 0.799 0 0.060 0.000 0.000 0.940
#> GSM258597 4 0.1704 0.894 0 0.004 0.000 0.928 0.068
#> GSM258598 5 0.1485 0.811 0 0.032 0.000 0.020 0.948
#> GSM258600 5 0.1012 0.805 0 0.012 0.000 0.020 0.968
#> GSM258601 2 0.3779 0.772 0 0.804 0.000 0.144 0.052
#> GSM258602 4 0.1386 0.891 0 0.000 0.032 0.952 0.016
#> GSM258604 2 0.3197 0.783 0 0.836 0.000 0.140 0.024
#> GSM258605 3 0.1725 0.934 0 0.000 0.936 0.044 0.020
#> GSM258606 4 0.1992 0.899 0 0.000 0.044 0.924 0.032
#> GSM258607 4 0.1197 0.889 0 0.000 0.000 0.952 0.048
#> GSM258608 3 0.1626 0.935 0 0.000 0.940 0.044 0.016
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> GSM258553 4 0.2163 0.86728 0 0.000 0.000 0.892 NA 0.092
#> GSM258555 3 0.4946 0.77397 0 0.068 0.528 0.000 NA 0.000
#> GSM258556 2 0.5870 0.13098 0 0.480 0.000 0.000 NA 0.244
#> GSM258557 6 0.5694 0.49754 0 0.188 0.000 0.000 NA 0.508
#> GSM258562 2 0.0405 0.75215 0 0.988 0.000 0.000 NA 0.004
#> GSM258563 6 0.5528 0.57193 0 0.192 0.000 0.000 NA 0.556
#> GSM258565 3 0.4952 0.77319 0 0.068 0.524 0.000 NA 0.000
#> GSM258566 3 0.5358 0.76505 0 0.112 0.496 0.000 NA 0.000
#> GSM258570 6 0.6447 0.32217 0 0.348 0.088 0.000 NA 0.472
#> GSM258578 6 0.4002 0.74739 0 0.028 0.080 0.000 NA 0.792
#> GSM258580 3 0.4885 0.77337 0 0.068 0.560 0.000 NA 0.000
#> GSM258583 4 0.0405 0.95406 0 0.008 0.000 0.988 NA 0.004
#> GSM258585 2 0.5148 0.27056 0 0.476 0.460 0.000 NA 0.048
#> GSM258590 1 0.0000 1.00000 1 0.000 0.000 0.000 NA 0.000
#> GSM258594 6 0.6287 0.61535 0 0.112 0.148 0.000 NA 0.588
#> GSM258596 6 0.3717 0.75046 0 0.016 0.084 0.000 NA 0.808
#> GSM258599 6 0.0858 0.75904 0 0.004 0.000 0.000 NA 0.968
#> GSM258603 1 0.0000 1.00000 1 0.000 0.000 0.000 NA 0.000
#> GSM258551 1 0.0000 1.00000 1 0.000 0.000 0.000 NA 0.000
#> GSM258552 3 0.5099 0.25772 0 0.424 0.496 0.000 NA 0.000
#> GSM258554 4 0.1765 0.91495 0 0.000 0.000 0.904 NA 0.000
#> GSM258558 4 0.1007 0.93615 0 0.000 0.000 0.956 NA 0.044
#> GSM258559 4 0.0603 0.95359 0 0.000 0.000 0.980 NA 0.004
#> GSM258560 6 0.3731 0.70715 0 0.072 0.008 0.000 NA 0.796
#> GSM258561 4 0.2020 0.91423 0 0.000 0.000 0.896 NA 0.008
#> GSM258564 6 0.6619 0.53509 0 0.196 0.096 0.000 NA 0.532
#> GSM258567 2 0.1219 0.74455 0 0.948 0.000 0.000 NA 0.004
#> GSM258568 6 0.1787 0.74986 0 0.004 0.000 0.008 NA 0.920
#> GSM258569 6 0.4885 0.26915 0 0.000 0.000 0.372 NA 0.560
#> GSM258571 4 0.0146 0.95376 0 0.000 0.000 0.996 NA 0.004
#> GSM258572 3 0.4952 0.77319 0 0.068 0.524 0.000 NA 0.000
#> GSM258573 3 0.5278 0.76801 0 0.104 0.512 0.000 NA 0.000
#> GSM258574 3 0.4946 0.77397 0 0.068 0.528 0.000 NA 0.000
#> GSM258575 3 0.5974 0.63815 0 0.248 0.440 0.000 NA 0.000
#> GSM258576 6 0.1010 0.75944 0 0.004 0.000 0.000 NA 0.960
#> GSM258577 4 0.0777 0.95309 0 0.000 0.000 0.972 NA 0.004
#> GSM258579 2 0.5864 -0.00104 0 0.512 0.228 0.000 NA 0.004
#> GSM258581 6 0.1410 0.75601 0 0.004 0.000 0.008 NA 0.944
#> GSM258582 6 0.6046 0.48581 0 0.180 0.000 0.016 NA 0.500
#> GSM258584 1 0.0000 1.00000 1 0.000 0.000 0.000 NA 0.000
#> GSM258586 2 0.4787 0.51363 0 0.672 0.000 0.000 NA 0.144
#> GSM258587 6 0.4756 0.64600 0 0.128 0.000 0.000 NA 0.672
#> GSM258588 2 0.1707 0.73758 0 0.928 0.012 0.000 NA 0.004
#> GSM258589 2 0.0405 0.75218 0 0.988 0.000 0.000 NA 0.004
#> GSM258591 6 0.1152 0.75622 0 0.004 0.000 0.000 NA 0.952
#> GSM258592 3 0.1610 0.50523 0 0.084 0.916 0.000 NA 0.000
#> GSM258593 2 0.4209 0.51012 0 0.736 0.160 0.000 NA 0.000
#> GSM258595 2 0.1367 0.74228 0 0.944 0.012 0.000 NA 0.000
#> GSM258597 6 0.1643 0.75860 0 0.008 0.000 0.000 NA 0.924
#> GSM258598 2 0.0935 0.74959 0 0.964 0.000 0.000 NA 0.004
#> GSM258600 2 0.1349 0.73371 0 0.940 0.000 0.000 NA 0.004
#> GSM258601 3 0.1610 0.50523 0 0.084 0.916 0.000 NA 0.000
#> GSM258602 6 0.3807 0.75059 0 0.016 0.080 0.000 NA 0.800
#> GSM258604 3 0.2411 0.54533 0 0.032 0.900 0.000 NA 0.024
#> GSM258605 4 0.0520 0.95456 0 0.008 0.000 0.984 NA 0.008
#> GSM258606 6 0.1477 0.75534 0 0.004 0.000 0.008 NA 0.940
#> GSM258607 6 0.4243 0.74379 0 0.032 0.076 0.000 NA 0.772
#> GSM258608 4 0.0520 0.95456 0 0.008 0.000 0.984 NA 0.008
Heatmaps for the consensus matrix. It visualizes the probability of two samples to be in a same group.
consensus_heatmap(res, k = 2)
consensus_heatmap(res, k = 3)
consensus_heatmap(res, k = 4)
consensus_heatmap(res, k = 5)
consensus_heatmap(res, k = 6)
Heatmaps for the membership of samples in all partitions to see how consistent they are:
membership_heatmap(res, k = 2)
membership_heatmap(res, k = 3)
membership_heatmap(res, k = 4)
membership_heatmap(res, k = 5)
membership_heatmap(res, k = 6)
As soon as we have had the classes for columns, we can look for signatures which are significantly different between classes which can be candidate marks for certain classes. Following are the heatmaps for signatures.
Signature heatmaps where rows are scaled:
get_signatures(res, k = 2)
get_signatures(res, k = 3)
get_signatures(res, k = 4)
get_signatures(res, k = 5)
get_signatures(res, k = 6)
Signature heatmaps where rows are not scaled:
get_signatures(res, k = 2, scale_rows = FALSE)
get_signatures(res, k = 3, scale_rows = FALSE)
get_signatures(res, k = 4, scale_rows = FALSE)
get_signatures(res, k = 5, scale_rows = FALSE)
get_signatures(res, k = 6, scale_rows = FALSE)
Compare the overlap of signatures from different k:
compare_signatures(res)
get_signature()
returns a data frame invisibly. TO get the list of signatures, the function
call should be assigned to a variable explicitly. In following code, if plot
argument is set
to FALSE
, no heatmap is plotted while only the differential analysis is performed.
# code only for demonstration
tb = get_signature(res, k = ..., plot = FALSE)
An example of the output of tb
is:
#> which_row fdr mean_1 mean_2 scaled_mean_1 scaled_mean_2 km
#> 1 38 0.042760348 8.373488 9.131774 -0.5533452 0.5164555 1
#> 2 40 0.018707592 7.106213 8.469186 -0.6173731 0.5762149 1
#> 3 55 0.019134737 10.221463 11.207825 -0.6159697 0.5749050 1
#> 4 59 0.006059896 5.921854 7.869574 -0.6899429 0.6439467 1
#> 5 60 0.018055526 8.928898 10.211722 -0.6204761 0.5791110 1
#> 6 98 0.009384629 15.714769 14.887706 0.6635654 -0.6193277 2
...
The columns in tb
are:
which_row
: row indices corresponding to the input matrix.fdr
: FDR for the differential test. mean_x
: The mean value in group x.scaled_mean_x
: The mean value in group x after rows are scaled.km
: Row groups if k-means clustering is applied to rows.UMAP plot which shows how samples are separated.
dimension_reduction(res, k = 2, method = "UMAP")
dimension_reduction(res, k = 3, method = "UMAP")
dimension_reduction(res, k = 4, method = "UMAP")
dimension_reduction(res, k = 5, method = "UMAP")
dimension_reduction(res, k = 6, method = "UMAP")
Following heatmap shows how subgroups are split when increasing k
:
collect_classes(res)
Test correlation between subgroups and known annotations. If the known annotation is numeric, one-way ANOVA test is applied, and if the known annotation is discrete, chi-squared contingency table test is applied.
test_to_known_factors(res)
#> n disease.state(p) k
#> ATC:mclust 58 0.772 2
#> ATC:mclust 54 0.663 3
#> ATC:mclust 53 0.661 4
#> ATC:mclust 53 0.644 5
#> ATC:mclust 50 0.555 6
If matrix rows can be associated to genes, consider to use functional_enrichment(res,
...)
to perform function enrichment for the signature genes. See this vignette for more detailed explanations.
The object with results only for a single top-value method and a single partition method can be extracted as:
res = res_list["ATC", "NMF"]
# you can also extract it by
# res = res_list["ATC:NMF"]
A summary of res
and all the functions that can be applied to it:
res
#> A 'ConsensusPartition' object with k = 2, 3, 4, 5, 6.
#> On a matrix with 51941 rows and 58 columns.
#> Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'ATC' method.
#> Subgroups are detected by 'NMF' method.
#> Performed in total 1250 partitions by row resampling.
#> Best k for subgroups seems to be 2.
#>
#> Following methods can be applied to this 'ConsensusPartition' object:
#> [1] "cola_report" "collect_classes" "collect_plots"
#> [4] "collect_stats" "colnames" "compare_signatures"
#> [7] "consensus_heatmap" "dimension_reduction" "functional_enrichment"
#> [10] "get_anno_col" "get_anno" "get_classes"
#> [13] "get_consensus" "get_matrix" "get_membership"
#> [16] "get_param" "get_signatures" "get_stats"
#> [19] "is_best_k" "is_stable_k" "membership_heatmap"
#> [22] "ncol" "nrow" "plot_ecdf"
#> [25] "rownames" "select_partition_number" "show"
#> [28] "suggest_best_k" "test_to_known_factors"
collect_plots()
function collects all the plots made from res
for all k
(number of partitions)
into one single page to provide an easy and fast comparison between different k
.
collect_plots(res)
The plots are:
k
and the heatmap of
predicted classes for each k
.k
.k
.k
.All the plots in panels can be made by individual functions and they are plotted later in this section.
select_partition_number()
produces several plots showing different
statistics for choosing “optimized” k
. There are following statistics:
k
;k
, the area increased is defined as \(A_k - A_{k-1}\).The detailed explanations of these statistics can be found in the cola vignette.
Generally speaking, lower PAC score, higher mean silhouette score or higher
concordance corresponds to better partition. Rand index and Jaccard index
measure how similar the current partition is compared to partition with k-1
.
If they are too similar, we won't accept k
is better than k-1
.
select_partition_number(res)
The numeric values for all these statistics can be obtained by get_stats()
.
get_stats(res)
#> k 1-PAC mean_silhouette concordance area_increased Rand Jaccard
#> 2 2 0.664 0.869 0.934 0.4620 0.530 0.530
#> 3 3 0.452 0.695 0.846 0.2884 0.670 0.465
#> 4 4 0.474 0.703 0.829 0.0576 0.950 0.874
#> 5 5 0.424 0.423 0.723 0.0640 0.860 0.684
#> 6 6 0.420 0.461 0.667 0.0561 0.762 0.497
suggest_best_k()
suggests the best \(k\) based on these statistics. The rules are as follows:
suggest_best_k(res)
#> [1] 2
Following shows the table of the partitions (You need to click the show/hide
code output link to see it). The membership matrix (columns with name p*
)
is inferred by
clue::cl_consensus()
function with the SE
method. Basically the value in the membership matrix
represents the probability to belong to a certain group. The finall class
label for an item is determined with the group with highest probability it
belongs to.
In get_classes()
function, the entropy is calculated from the membership
matrix and the silhouette score is calculated from the consensus matrix.
cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#> class entropy silhouette p1 p2
#> GSM258553 1 0.1633 0.9247 0.976 0.024
#> GSM258555 2 0.0000 0.9324 0.000 1.000
#> GSM258556 1 0.9993 0.1260 0.516 0.484
#> GSM258557 1 0.0938 0.9245 0.988 0.012
#> GSM258562 2 0.5178 0.8368 0.116 0.884
#> GSM258563 1 0.6343 0.8519 0.840 0.160
#> GSM258565 2 0.0000 0.9324 0.000 1.000
#> GSM258566 2 0.0000 0.9324 0.000 1.000
#> GSM258570 1 0.7376 0.8014 0.792 0.208
#> GSM258578 1 0.2423 0.9231 0.960 0.040
#> GSM258580 2 0.0376 0.9295 0.004 0.996
#> GSM258583 1 0.0000 0.9221 1.000 0.000
#> GSM258585 1 0.7139 0.8159 0.804 0.196
#> GSM258590 1 0.0000 0.9221 1.000 0.000
#> GSM258594 1 0.2948 0.9207 0.948 0.052
#> GSM258596 1 0.2948 0.9207 0.948 0.052
#> GSM258599 1 0.6531 0.8448 0.832 0.168
#> GSM258603 1 0.0000 0.9221 1.000 0.000
#> GSM258551 1 0.0000 0.9221 1.000 0.000
#> GSM258552 2 0.0000 0.9324 0.000 1.000
#> GSM258554 1 0.0376 0.9233 0.996 0.004
#> GSM258558 1 0.0672 0.9239 0.992 0.008
#> GSM258559 1 0.0000 0.9221 1.000 0.000
#> GSM258560 1 0.7056 0.8199 0.808 0.192
#> GSM258561 1 0.0000 0.9221 1.000 0.000
#> GSM258564 1 0.2948 0.9207 0.948 0.052
#> GSM258567 2 0.4298 0.8650 0.088 0.912
#> GSM258568 1 0.1414 0.9248 0.980 0.020
#> GSM258569 1 0.2043 0.9242 0.968 0.032
#> GSM258571 1 0.0376 0.9233 0.996 0.004
#> GSM258572 2 0.0000 0.9324 0.000 1.000
#> GSM258573 2 0.0000 0.9324 0.000 1.000
#> GSM258574 2 0.0000 0.9324 0.000 1.000
#> GSM258575 2 0.0000 0.9324 0.000 1.000
#> GSM258576 1 0.6712 0.8369 0.824 0.176
#> GSM258577 1 0.0000 0.9221 1.000 0.000
#> GSM258579 2 0.0672 0.9281 0.008 0.992
#> GSM258581 1 0.4161 0.9060 0.916 0.084
#> GSM258582 1 0.0938 0.9245 0.988 0.012
#> GSM258584 1 0.0000 0.9221 1.000 0.000
#> GSM258586 2 0.8144 0.6421 0.252 0.748
#> GSM258587 1 0.2948 0.9208 0.948 0.052
#> GSM258588 2 0.0000 0.9324 0.000 1.000
#> GSM258589 2 0.0000 0.9324 0.000 1.000
#> GSM258591 1 0.6438 0.8484 0.836 0.164
#> GSM258592 2 0.0000 0.9324 0.000 1.000
#> GSM258593 2 0.0000 0.9324 0.000 1.000
#> GSM258595 2 0.0000 0.9324 0.000 1.000
#> GSM258597 1 0.7056 0.8199 0.808 0.192
#> GSM258598 2 0.9998 -0.0971 0.492 0.508
#> GSM258600 2 0.7453 0.7104 0.212 0.788
#> GSM258601 2 0.0672 0.9283 0.008 0.992
#> GSM258602 1 0.0376 0.9233 0.996 0.004
#> GSM258604 1 0.5178 0.8845 0.884 0.116
#> GSM258605 1 0.0000 0.9221 1.000 0.000
#> GSM258606 1 0.3733 0.9123 0.928 0.072
#> GSM258607 1 0.3114 0.9192 0.944 0.056
#> GSM258608 1 0.0000 0.9221 1.000 0.000
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> GSM258553 2 0.4062 0.7530 0.164 0.836 0.000
#> GSM258555 3 0.0592 0.8422 0.012 0.000 0.988
#> GSM258556 2 0.4931 0.6043 0.000 0.768 0.232
#> GSM258557 2 0.3412 0.7858 0.124 0.876 0.000
#> GSM258562 2 0.5443 0.5580 0.004 0.736 0.260
#> GSM258563 2 0.2096 0.8023 0.052 0.944 0.004
#> GSM258565 3 0.0237 0.8444 0.004 0.000 0.996
#> GSM258566 3 0.0475 0.8463 0.004 0.004 0.992
#> GSM258570 2 0.3425 0.7464 0.004 0.884 0.112
#> GSM258578 2 0.3619 0.7768 0.136 0.864 0.000
#> GSM258580 3 0.0592 0.8422 0.012 0.000 0.988
#> GSM258583 1 0.5465 0.6753 0.712 0.288 0.000
#> GSM258585 2 0.1411 0.7866 0.000 0.964 0.036
#> GSM258590 1 0.0747 0.7187 0.984 0.016 0.000
#> GSM258594 2 0.3755 0.7869 0.120 0.872 0.008
#> GSM258596 2 0.3349 0.7930 0.108 0.888 0.004
#> GSM258599 2 0.0592 0.7936 0.012 0.988 0.000
#> GSM258603 1 0.0747 0.7187 0.984 0.016 0.000
#> GSM258551 1 0.0592 0.7150 0.988 0.012 0.000
#> GSM258552 3 0.0892 0.8481 0.000 0.020 0.980
#> GSM258554 1 0.5363 0.6782 0.724 0.276 0.000
#> GSM258558 2 0.4702 0.6810 0.212 0.788 0.000
#> GSM258559 1 0.6291 0.2973 0.532 0.468 0.000
#> GSM258560 2 0.0237 0.7872 0.000 0.996 0.004
#> GSM258561 1 0.6045 0.5337 0.620 0.380 0.000
#> GSM258564 2 0.3267 0.7902 0.116 0.884 0.000
#> GSM258567 2 0.6460 0.1116 0.004 0.556 0.440
#> GSM258568 2 0.3619 0.7727 0.136 0.864 0.000
#> GSM258569 2 0.3267 0.7908 0.116 0.884 0.000
#> GSM258571 1 0.6225 0.4108 0.568 0.432 0.000
#> GSM258572 3 0.4733 0.7904 0.004 0.196 0.800
#> GSM258573 3 0.0592 0.8480 0.000 0.012 0.988
#> GSM258574 3 0.0237 0.8467 0.000 0.004 0.996
#> GSM258575 3 0.2945 0.8349 0.004 0.088 0.908
#> GSM258576 2 0.0237 0.7905 0.004 0.996 0.000
#> GSM258577 1 0.3619 0.7450 0.864 0.136 0.000
#> GSM258579 3 0.4629 0.7957 0.004 0.188 0.808
#> GSM258581 2 0.2448 0.8022 0.076 0.924 0.000
#> GSM258582 2 0.3192 0.7919 0.112 0.888 0.000
#> GSM258584 1 0.0747 0.7187 0.984 0.016 0.000
#> GSM258586 2 0.6148 0.3142 0.004 0.640 0.356
#> GSM258587 2 0.2878 0.7983 0.096 0.904 0.000
#> GSM258588 3 0.6033 0.5959 0.004 0.336 0.660
#> GSM258589 3 0.6489 0.2951 0.004 0.456 0.540
#> GSM258591 2 0.1031 0.7971 0.024 0.976 0.000
#> GSM258592 3 0.1453 0.8414 0.008 0.024 0.968
#> GSM258593 3 0.4291 0.8004 0.000 0.180 0.820
#> GSM258595 2 0.4351 0.6735 0.004 0.828 0.168
#> GSM258597 2 0.0000 0.7887 0.000 1.000 0.000
#> GSM258598 2 0.4291 0.6639 0.000 0.820 0.180
#> GSM258600 2 0.4784 0.6415 0.004 0.796 0.200
#> GSM258601 3 0.5580 0.5964 0.008 0.256 0.736
#> GSM258602 2 0.6260 -0.0629 0.448 0.552 0.000
#> GSM258604 1 0.6767 0.5093 0.720 0.064 0.216
#> GSM258605 1 0.5465 0.6726 0.712 0.288 0.000
#> GSM258606 2 0.2945 0.8007 0.088 0.908 0.004
#> GSM258607 2 0.2711 0.8005 0.088 0.912 0.000
#> GSM258608 1 0.4002 0.7416 0.840 0.160 0.000
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> GSM258553 4 0.2973 0.806 0.000 0.096 0.020 0.884
#> GSM258555 1 0.4996 0.245 0.516 0.000 0.484 0.000
#> GSM258556 4 0.4182 0.717 0.180 0.000 0.024 0.796
#> GSM258557 4 0.2742 0.823 0.000 0.076 0.024 0.900
#> GSM258562 4 0.4511 0.617 0.268 0.000 0.008 0.724
#> GSM258563 4 0.0712 0.844 0.004 0.008 0.004 0.984
#> GSM258565 1 0.2944 0.700 0.868 0.004 0.128 0.000
#> GSM258566 1 0.5250 0.590 0.660 0.000 0.316 0.024
#> GSM258570 4 0.3852 0.737 0.008 0.000 0.192 0.800
#> GSM258578 4 0.2586 0.833 0.000 0.048 0.040 0.912
#> GSM258580 1 0.4193 0.647 0.732 0.000 0.268 0.000
#> GSM258583 2 0.5309 0.698 0.000 0.700 0.044 0.256
#> GSM258585 4 0.1545 0.840 0.008 0.000 0.040 0.952
#> GSM258590 2 0.0188 0.590 0.000 0.996 0.004 0.000
#> GSM258594 4 0.3431 0.812 0.004 0.060 0.060 0.876
#> GSM258596 4 0.3181 0.824 0.004 0.044 0.064 0.888
#> GSM258599 4 0.0657 0.841 0.004 0.000 0.012 0.984
#> GSM258603 2 0.0188 0.590 0.000 0.996 0.004 0.000
#> GSM258551 2 0.0469 0.585 0.000 0.988 0.012 0.000
#> GSM258552 1 0.4332 0.710 0.792 0.000 0.176 0.032
#> GSM258554 2 0.5013 0.689 0.000 0.688 0.020 0.292
#> GSM258558 4 0.3356 0.723 0.000 0.176 0.000 0.824
#> GSM258559 2 0.5931 0.357 0.000 0.504 0.036 0.460
#> GSM258560 4 0.1398 0.841 0.004 0.000 0.040 0.956
#> GSM258561 2 0.4781 0.646 0.000 0.660 0.004 0.336
#> GSM258564 4 0.1854 0.837 0.000 0.048 0.012 0.940
#> GSM258567 4 0.5686 0.357 0.376 0.000 0.032 0.592
#> GSM258568 4 0.3820 0.789 0.000 0.064 0.088 0.848
#> GSM258569 4 0.2021 0.832 0.000 0.056 0.012 0.932
#> GSM258571 2 0.5750 0.419 0.000 0.532 0.028 0.440
#> GSM258572 1 0.2342 0.703 0.912 0.000 0.008 0.080
#> GSM258573 1 0.2859 0.721 0.880 0.000 0.112 0.008
#> GSM258574 1 0.3249 0.718 0.852 0.000 0.140 0.008
#> GSM258575 1 0.2036 0.709 0.936 0.000 0.032 0.032
#> GSM258576 4 0.0336 0.839 0.000 0.000 0.008 0.992
#> GSM258577 2 0.5000 0.658 0.000 0.772 0.100 0.128
#> GSM258579 1 0.3946 0.660 0.812 0.000 0.020 0.168
#> GSM258581 4 0.1624 0.841 0.000 0.020 0.028 0.952
#> GSM258582 4 0.2670 0.825 0.000 0.072 0.024 0.904
#> GSM258584 2 0.0188 0.590 0.000 0.996 0.004 0.000
#> GSM258586 4 0.5118 0.653 0.224 0.008 0.032 0.736
#> GSM258587 4 0.1004 0.843 0.000 0.024 0.004 0.972
#> GSM258588 1 0.5818 0.410 0.600 0.004 0.032 0.364
#> GSM258589 4 0.5859 0.329 0.376 0.004 0.032 0.588
#> GSM258591 4 0.1082 0.843 0.004 0.004 0.020 0.972
#> GSM258592 3 0.2796 0.912 0.092 0.000 0.892 0.016
#> GSM258593 1 0.4011 0.628 0.784 0.000 0.008 0.208
#> GSM258595 4 0.3266 0.789 0.084 0.004 0.032 0.880
#> GSM258597 4 0.0524 0.840 0.004 0.000 0.008 0.988
#> GSM258598 4 0.3606 0.764 0.132 0.000 0.024 0.844
#> GSM258600 4 0.3932 0.758 0.128 0.004 0.032 0.836
#> GSM258601 3 0.1920 0.946 0.028 0.004 0.944 0.024
#> GSM258602 4 0.5736 0.272 0.000 0.328 0.044 0.628
#> GSM258604 3 0.2021 0.944 0.040 0.000 0.936 0.024
#> GSM258605 2 0.6708 0.653 0.000 0.596 0.132 0.272
#> GSM258606 4 0.2124 0.837 0.000 0.028 0.040 0.932
#> GSM258607 4 0.1488 0.840 0.000 0.032 0.012 0.956
#> GSM258608 2 0.3962 0.691 0.000 0.820 0.028 0.152
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> GSM258553 4 0.2853 0.6827 0.040 0.000 0.008 0.884 0.068
#> GSM258555 3 0.6100 -0.0554 0.000 0.128 0.484 0.000 0.388
#> GSM258556 4 0.5136 0.4671 0.000 0.260 0.000 0.660 0.080
#> GSM258557 4 0.2316 0.7241 0.036 0.012 0.000 0.916 0.036
#> GSM258562 4 0.6670 0.3349 0.000 0.172 0.028 0.556 0.244
#> GSM258563 4 0.1522 0.7278 0.000 0.044 0.000 0.944 0.012
#> GSM258565 5 0.5655 0.3214 0.000 0.304 0.092 0.004 0.600
#> GSM258566 5 0.6946 0.1614 0.000 0.248 0.264 0.016 0.472
#> GSM258570 4 0.6385 0.4668 0.000 0.052 0.224 0.616 0.108
#> GSM258578 4 0.4384 0.6590 0.020 0.000 0.032 0.764 0.184
#> GSM258580 3 0.6756 -0.3680 0.000 0.308 0.404 0.000 0.288
#> GSM258583 1 0.6237 0.2984 0.476 0.000 0.016 0.416 0.092
#> GSM258585 4 0.4442 0.6261 0.000 0.116 0.016 0.784 0.084
#> GSM258590 1 0.0162 0.5660 0.996 0.004 0.000 0.000 0.000
#> GSM258594 4 0.5468 0.6628 0.032 0.056 0.052 0.752 0.108
#> GSM258596 4 0.2614 0.7185 0.012 0.012 0.024 0.908 0.044
#> GSM258599 4 0.1364 0.7276 0.000 0.012 0.000 0.952 0.036
#> GSM258603 1 0.0162 0.5660 0.996 0.004 0.000 0.000 0.000
#> GSM258551 1 0.0162 0.5649 0.996 0.000 0.000 0.000 0.004
#> GSM258552 2 0.4953 0.2240 0.000 0.740 0.172 0.032 0.056
#> GSM258554 1 0.6160 0.2807 0.476 0.000 0.016 0.424 0.084
#> GSM258558 4 0.3948 0.6034 0.112 0.000 0.004 0.808 0.076
#> GSM258559 4 0.6557 0.0850 0.292 0.000 0.036 0.556 0.116
#> GSM258560 4 0.1538 0.7294 0.000 0.036 0.008 0.948 0.008
#> GSM258561 4 0.5828 -0.2138 0.432 0.000 0.004 0.484 0.080
#> GSM258564 4 0.4031 0.6983 0.028 0.108 0.008 0.824 0.032
#> GSM258567 4 0.6575 0.0473 0.000 0.360 0.020 0.492 0.128
#> GSM258568 4 0.4478 0.6258 0.024 0.000 0.104 0.788 0.084
#> GSM258569 4 0.2236 0.6919 0.024 0.000 0.000 0.908 0.068
#> GSM258571 4 0.6034 0.1802 0.300 0.000 0.020 0.588 0.092
#> GSM258572 2 0.5028 -0.1763 0.000 0.524 0.000 0.032 0.444
#> GSM258573 2 0.4584 0.1498 0.000 0.752 0.160 0.004 0.084
#> GSM258574 2 0.5041 0.0856 0.000 0.716 0.148 0.004 0.132
#> GSM258575 2 0.4521 0.1987 0.000 0.716 0.012 0.024 0.248
#> GSM258576 4 0.0898 0.7282 0.000 0.020 0.000 0.972 0.008
#> GSM258577 1 0.8005 0.4600 0.424 0.000 0.212 0.248 0.116
#> GSM258579 2 0.4140 0.3851 0.000 0.800 0.012 0.124 0.064
#> GSM258581 4 0.2116 0.7082 0.004 0.008 0.012 0.924 0.052
#> GSM258582 4 0.2606 0.7256 0.032 0.012 0.000 0.900 0.056
#> GSM258584 1 0.0162 0.5660 0.996 0.004 0.000 0.000 0.000
#> GSM258586 4 0.5516 0.3684 0.000 0.296 0.000 0.608 0.096
#> GSM258587 4 0.2003 0.7075 0.008 0.008 0.004 0.928 0.052
#> GSM258588 2 0.6262 0.3202 0.000 0.520 0.000 0.304 0.176
#> GSM258589 2 0.5964 0.1013 0.000 0.464 0.000 0.428 0.108
#> GSM258591 4 0.0566 0.7249 0.000 0.004 0.000 0.984 0.012
#> GSM258592 3 0.3019 0.5041 0.000 0.012 0.864 0.016 0.108
#> GSM258593 2 0.6326 0.3089 0.000 0.588 0.016 0.180 0.216
#> GSM258595 4 0.5060 0.5156 0.000 0.204 0.000 0.692 0.104
#> GSM258597 4 0.1836 0.7217 0.000 0.036 0.000 0.932 0.032
#> GSM258598 4 0.4988 0.2061 0.000 0.416 0.004 0.556 0.024
#> GSM258600 4 0.4960 0.4729 0.000 0.268 0.000 0.668 0.064
#> GSM258601 3 0.1018 0.5183 0.000 0.000 0.968 0.016 0.016
#> GSM258602 4 0.6009 0.2880 0.256 0.000 0.032 0.624 0.088
#> GSM258604 3 0.3625 0.4877 0.000 0.096 0.840 0.016 0.048
#> GSM258605 4 0.8064 -0.3651 0.312 0.000 0.192 0.380 0.116
#> GSM258606 4 0.1652 0.7136 0.004 0.008 0.004 0.944 0.040
#> GSM258607 4 0.1911 0.7280 0.004 0.028 0.000 0.932 0.036
#> GSM258608 1 0.5818 0.5738 0.620 0.000 0.012 0.264 0.104
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> GSM258553 6 0.1565 0.6443 0.008 0.032 0.000 0.008 0.008 0.944
#> GSM258555 3 0.6403 0.0709 0.356 0.060 0.476 0.004 0.104 0.000
#> GSM258556 2 0.4914 0.5268 0.016 0.576 0.000 0.000 0.040 0.368
#> GSM258557 6 0.3056 0.5646 0.004 0.184 0.000 0.008 0.000 0.804
#> GSM258562 2 0.6632 0.5126 0.136 0.488 0.068 0.000 0.004 0.304
#> GSM258563 6 0.3383 0.4653 0.000 0.268 0.000 0.000 0.004 0.728
#> GSM258565 1 0.4775 0.1788 0.712 0.052 0.188 0.000 0.048 0.000
#> GSM258566 1 0.7519 -0.0594 0.388 0.204 0.292 0.004 0.104 0.008
#> GSM258570 6 0.7909 -0.1422 0.136 0.188 0.228 0.000 0.040 0.408
#> GSM258578 6 0.4551 0.5527 0.112 0.064 0.068 0.000 0.000 0.756
#> GSM258580 3 0.6868 -0.0221 0.196 0.128 0.504 0.000 0.172 0.000
#> GSM258583 6 0.4538 0.4822 0.020 0.004 0.016 0.284 0.004 0.672
#> GSM258585 2 0.5026 0.5187 0.020 0.592 0.016 0.000 0.020 0.352
#> GSM258590 4 0.0458 0.9877 0.000 0.000 0.000 0.984 0.000 0.016
#> GSM258594 6 0.6669 0.0384 0.088 0.304 0.072 0.004 0.016 0.516
#> GSM258596 6 0.2094 0.6352 0.000 0.068 0.008 0.000 0.016 0.908
#> GSM258599 6 0.3565 0.4112 0.000 0.304 0.004 0.000 0.000 0.692
#> GSM258603 4 0.0653 0.9851 0.000 0.004 0.000 0.980 0.004 0.012
#> GSM258551 4 0.0405 0.9801 0.000 0.000 0.000 0.988 0.004 0.008
#> GSM258552 5 0.4848 0.8118 0.032 0.196 0.072 0.000 0.700 0.000
#> GSM258554 6 0.4902 0.3948 0.024 0.004 0.016 0.328 0.008 0.620
#> GSM258558 6 0.2270 0.6331 0.012 0.004 0.004 0.060 0.012 0.908
#> GSM258559 6 0.4321 0.5859 0.024 0.004 0.044 0.140 0.012 0.776
#> GSM258560 6 0.3535 0.5013 0.000 0.220 0.008 0.000 0.012 0.760
#> GSM258561 6 0.4359 0.4779 0.012 0.004 0.012 0.300 0.004 0.668
#> GSM258564 6 0.5621 0.2014 0.000 0.260 0.004 0.004 0.160 0.572
#> GSM258567 2 0.6157 0.6105 0.044 0.608 0.052 0.000 0.060 0.236
#> GSM258568 6 0.2451 0.6306 0.020 0.004 0.060 0.004 0.012 0.900
#> GSM258569 6 0.0692 0.6434 0.004 0.020 0.000 0.000 0.000 0.976
#> GSM258571 6 0.3708 0.5855 0.020 0.000 0.012 0.188 0.004 0.776
#> GSM258572 1 0.6373 0.0398 0.480 0.264 0.012 0.004 0.236 0.004
#> GSM258573 5 0.4626 0.7852 0.020 0.196 0.072 0.000 0.712 0.000
#> GSM258574 5 0.4021 0.7845 0.028 0.116 0.068 0.000 0.788 0.000
#> GSM258575 2 0.6624 -0.3100 0.180 0.540 0.052 0.004 0.216 0.008
#> GSM258576 6 0.3288 0.4470 0.000 0.276 0.000 0.000 0.000 0.724
#> GSM258577 6 0.6799 0.3139 0.032 0.012 0.128 0.208 0.048 0.572
#> GSM258579 2 0.6163 -0.4040 0.100 0.456 0.008 0.004 0.408 0.024
#> GSM258581 6 0.1219 0.6393 0.000 0.048 0.004 0.000 0.000 0.948
#> GSM258582 6 0.3276 0.5201 0.004 0.228 0.000 0.004 0.000 0.764
#> GSM258584 4 0.0458 0.9877 0.000 0.000 0.000 0.984 0.000 0.016
#> GSM258586 2 0.5374 0.5961 0.032 0.600 0.000 0.004 0.056 0.308
#> GSM258587 6 0.1429 0.6402 0.004 0.052 0.000 0.000 0.004 0.940
#> GSM258588 2 0.5382 0.4761 0.072 0.712 0.020 0.004 0.056 0.136
#> GSM258589 2 0.5641 0.5782 0.068 0.644 0.000 0.000 0.100 0.188
#> GSM258591 6 0.2320 0.5969 0.000 0.132 0.004 0.000 0.000 0.864
#> GSM258592 3 0.4398 0.4863 0.044 0.032 0.792 0.000 0.052 0.080
#> GSM258593 2 0.7205 -0.2188 0.208 0.420 0.020 0.000 0.296 0.056
#> GSM258595 2 0.4560 0.5563 0.008 0.632 0.004 0.004 0.020 0.332
#> GSM258597 6 0.3563 0.3442 0.000 0.336 0.000 0.000 0.000 0.664
#> GSM258598 2 0.6021 0.5887 0.016 0.500 0.000 0.000 0.172 0.312
#> GSM258600 2 0.4302 0.5657 0.004 0.628 0.000 0.000 0.024 0.344
#> GSM258601 3 0.2917 0.5037 0.008 0.012 0.872 0.000 0.040 0.068
#> GSM258602 6 0.3875 0.5844 0.020 0.000 0.008 0.184 0.016 0.772
#> GSM258604 3 0.5845 0.4079 0.088 0.064 0.656 0.004 0.176 0.012
#> GSM258605 6 0.5458 0.5305 0.032 0.008 0.124 0.120 0.016 0.700
#> GSM258606 6 0.1812 0.6287 0.000 0.080 0.008 0.000 0.000 0.912
#> GSM258607 6 0.3586 0.4527 0.004 0.280 0.000 0.004 0.000 0.712
#> GSM258608 6 0.5031 0.1906 0.024 0.004 0.012 0.412 0.008 0.540
Heatmaps for the consensus matrix. It visualizes the probability of two samples to be in a same group.
consensus_heatmap(res, k = 2)
consensus_heatmap(res, k = 3)
consensus_heatmap(res, k = 4)
consensus_heatmap(res, k = 5)
consensus_heatmap(res, k = 6)
Heatmaps for the membership of samples in all partitions to see how consistent they are:
membership_heatmap(res, k = 2)
membership_heatmap(res, k = 3)
membership_heatmap(res, k = 4)
membership_heatmap(res, k = 5)
membership_heatmap(res, k = 6)
As soon as we have had the classes for columns, we can look for signatures which are significantly different between classes which can be candidate marks for certain classes. Following are the heatmaps for signatures.
Signature heatmaps where rows are scaled:
get_signatures(res, k = 2)
get_signatures(res, k = 3)
get_signatures(res, k = 4)
get_signatures(res, k = 5)
get_signatures(res, k = 6)
Signature heatmaps where rows are not scaled:
get_signatures(res, k = 2, scale_rows = FALSE)
get_signatures(res, k = 3, scale_rows = FALSE)
get_signatures(res, k = 4, scale_rows = FALSE)
get_signatures(res, k = 5, scale_rows = FALSE)
get_signatures(res, k = 6, scale_rows = FALSE)
Compare the overlap of signatures from different k:
compare_signatures(res)
get_signature()
returns a data frame invisibly. TO get the list of signatures, the function
call should be assigned to a variable explicitly. In following code, if plot
argument is set
to FALSE
, no heatmap is plotted while only the differential analysis is performed.
# code only for demonstration
tb = get_signature(res, k = ..., plot = FALSE)
An example of the output of tb
is:
#> which_row fdr mean_1 mean_2 scaled_mean_1 scaled_mean_2 km
#> 1 38 0.042760348 8.373488 9.131774 -0.5533452 0.5164555 1
#> 2 40 0.018707592 7.106213 8.469186 -0.6173731 0.5762149 1
#> 3 55 0.019134737 10.221463 11.207825 -0.6159697 0.5749050 1
#> 4 59 0.006059896 5.921854 7.869574 -0.6899429 0.6439467 1
#> 5 60 0.018055526 8.928898 10.211722 -0.6204761 0.5791110 1
#> 6 98 0.009384629 15.714769 14.887706 0.6635654 -0.6193277 2
...
The columns in tb
are:
which_row
: row indices corresponding to the input matrix.fdr
: FDR for the differential test. mean_x
: The mean value in group x.scaled_mean_x
: The mean value in group x after rows are scaled.km
: Row groups if k-means clustering is applied to rows.UMAP plot which shows how samples are separated.
dimension_reduction(res, k = 2, method = "UMAP")
dimension_reduction(res, k = 3, method = "UMAP")
dimension_reduction(res, k = 4, method = "UMAP")
dimension_reduction(res, k = 5, method = "UMAP")
dimension_reduction(res, k = 6, method = "UMAP")
Following heatmap shows how subgroups are split when increasing k
:
collect_classes(res)
Test correlation between subgroups and known annotations. If the known annotation is numeric, one-way ANOVA test is applied, and if the known annotation is discrete, chi-squared contingency table test is applied.
test_to_known_factors(res)
#> n disease.state(p) k
#> ATC:NMF 56 0.729 2
#> ATC:NMF 52 0.626 3
#> ATC:NMF 51 0.563 4
#> ATC:NMF 29 0.561 5
#> ATC:NMF 34 0.580 6
If matrix rows can be associated to genes, consider to use functional_enrichment(res,
...)
to perform function enrichment for the signature genes. See this vignette for more detailed explanations.
sessionInfo()
#> R version 3.6.0 (2019-04-26)
#> Platform: x86_64-pc-linux-gnu (64-bit)
#> Running under: CentOS Linux 7 (Core)
#>
#> Matrix products: default
#> BLAS: /usr/lib64/libblas.so.3.4.2
#> LAPACK: /usr/lib64/liblapack.so.3.4.2
#>
#> locale:
#> [1] LC_CTYPE=en_GB.UTF-8 LC_NUMERIC=C LC_TIME=en_GB.UTF-8
#> [4] LC_COLLATE=en_GB.UTF-8 LC_MONETARY=en_GB.UTF-8 LC_MESSAGES=en_GB.UTF-8
#> [7] LC_PAPER=en_GB.UTF-8 LC_NAME=C LC_ADDRESS=C
#> [10] LC_TELEPHONE=C LC_MEASUREMENT=en_GB.UTF-8 LC_IDENTIFICATION=C
#>
#> attached base packages:
#> [1] grid stats graphics grDevices utils datasets methods base
#>
#> other attached packages:
#> [1] genefilter_1.66.0 ComplexHeatmap_2.3.1 markdown_1.1 knitr_1.26
#> [5] GetoptLong_0.1.7 cola_1.3.2
#>
#> loaded via a namespace (and not attached):
#> [1] circlize_0.4.8 shape_1.4.4 xfun_0.11 slam_0.1-46
#> [5] lattice_0.20-38 splines_3.6.0 colorspace_1.4-1 vctrs_0.2.0
#> [9] stats4_3.6.0 blob_1.2.0 XML_3.98-1.20 survival_2.44-1.1
#> [13] rlang_0.4.2 pillar_1.4.2 DBI_1.0.0 BiocGenerics_0.30.0
#> [17] bit64_0.9-7 RColorBrewer_1.1-2 matrixStats_0.55.0 stringr_1.4.0
#> [21] GlobalOptions_0.1.1 evaluate_0.14 memoise_1.1.0 Biobase_2.44.0
#> [25] IRanges_2.18.3 parallel_3.6.0 AnnotationDbi_1.46.1 highr_0.8
#> [29] Rcpp_1.0.3 xtable_1.8-4 backports_1.1.5 S4Vectors_0.22.1
#> [33] annotate_1.62.0 skmeans_0.2-11 bit_1.1-14 microbenchmark_1.4-7
#> [37] brew_1.0-6 impute_1.58.0 rjson_0.2.20 png_0.1-7
#> [41] digest_0.6.23 stringi_1.4.3 polyclip_1.10-0 clue_0.3-57
#> [45] tools_3.6.0 bitops_1.0-6 magrittr_1.5 eulerr_6.0.0
#> [49] RCurl_1.95-4.12 RSQLite_2.1.4 tibble_2.1.3 cluster_2.1.0
#> [53] crayon_1.3.4 pkgconfig_2.0.3 zeallot_0.1.0 Matrix_1.2-17
#> [57] xml2_1.2.2 httr_1.4.1 R6_2.4.1 mclust_5.4.5
#> [61] compiler_3.6.0