Date: 2019-12-25 21:22:43 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 | ||
---|---|---|---|---|---|---|
CV:kmeans | 2 | 1.000 | 0.999 | 0.999 | ** | |
ATC:kmeans | 2 | 1.000 | 0.995 | 0.997 | ** | |
ATC:pam | 6 | 1.000 | 0.935 | 0.975 | ** | 2,3,4,5 |
ATC:mclust | 2 | 1.000 | 0.965 | 0.985 | ** | |
CV:NMF | 2 | 0.964 | 0.935 | 0.975 | ** | |
SD:skmeans | 3 | 0.951 | 0.915 | 0.969 | ** | 2 |
CV:skmeans | 3 | 0.934 | 0.932 | 0.970 | * | 2 |
ATC:skmeans | 4 | 0.933 | 0.874 | 0.952 | * | 2,3 |
CV:pam | 6 | 0.923 | 0.912 | 0.955 | * | |
MAD:skmeans | 3 | 0.906 | 0.902 | 0.963 | * | 2 |
ATC:NMF | 2 | 0.893 | 0.905 | 0.963 | ||
CV:mclust | 5 | 0.874 | 0.810 | 0.923 | ||
MAD:kmeans | 2 | 0.863 | 0.920 | 0.965 | ||
MAD:pam | 3 | 0.861 | 0.892 | 0.946 | ||
MAD:NMF | 2 | 0.861 | 0.934 | 0.971 | ||
MAD:hclust | 2 | 0.860 | 0.911 | 0.954 | ||
ATC:hclust | 4 | 0.834 | 0.925 | 0.941 | ||
MAD:mclust | 4 | 0.766 | 0.833 | 0.901 | ||
SD:kmeans | 2 | 0.762 | 0.882 | 0.950 | ||
SD:NMF | 2 | 0.737 | 0.881 | 0.947 | ||
SD:pam | 3 | 0.717 | 0.889 | 0.938 | ||
SD:mclust | 3 | 0.596 | 0.707 | 0.867 | ||
SD:hclust | 2 | 0.385 | 0.844 | 0.902 | ||
CV:hclust | 2 | 0.350 | 0.813 | 0.902 |
**: 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.737 0.881 0.947 0.498 0.494 0.494
#> CV:NMF 2 0.964 0.935 0.975 0.508 0.491 0.491
#> MAD:NMF 2 0.861 0.934 0.971 0.506 0.494 0.494
#> ATC:NMF 2 0.893 0.905 0.963 0.505 0.491 0.491
#> SD:skmeans 2 0.964 0.943 0.977 0.507 0.494 0.494
#> CV:skmeans 2 1.000 0.961 0.986 0.504 0.497 0.497
#> MAD:skmeans 2 1.000 0.977 0.989 0.507 0.494 0.494
#> ATC:skmeans 2 1.000 0.968 0.988 0.507 0.494 0.494
#> SD:mclust 2 0.666 0.879 0.944 0.355 0.666 0.666
#> CV:mclust 2 0.612 0.737 0.877 0.287 0.784 0.784
#> MAD:mclust 2 0.861 0.867 0.947 0.263 0.733 0.733
#> ATC:mclust 2 1.000 0.965 0.985 0.415 0.593 0.593
#> SD:kmeans 2 0.762 0.882 0.950 0.500 0.497 0.497
#> CV:kmeans 2 1.000 0.999 0.999 0.488 0.513 0.513
#> MAD:kmeans 2 0.863 0.920 0.965 0.498 0.501 0.501
#> ATC:kmeans 2 1.000 0.995 0.997 0.479 0.521 0.521
#> SD:pam 2 0.859 0.898 0.957 0.438 0.564 0.564
#> CV:pam 2 0.863 0.910 0.963 0.441 0.552 0.552
#> MAD:pam 2 0.826 0.926 0.966 0.454 0.552 0.552
#> ATC:pam 2 1.000 0.978 0.992 0.476 0.521 0.521
#> SD:hclust 2 0.385 0.844 0.902 0.468 0.491 0.491
#> CV:hclust 2 0.350 0.813 0.902 0.482 0.491 0.491
#> MAD:hclust 2 0.860 0.911 0.954 0.499 0.491 0.491
#> ATC:hclust 2 0.615 0.794 0.894 0.477 0.521 0.521
get_stats(res_list, k = 3)
#> k 1-PAC mean_silhouette concordance area_increased Rand Jaccard
#> SD:NMF 3 0.719 0.795 0.915 0.271 0.724 0.514
#> CV:NMF 3 0.786 0.823 0.929 0.294 0.758 0.550
#> MAD:NMF 3 0.824 0.859 0.940 0.259 0.789 0.609
#> ATC:NMF 3 0.745 0.881 0.924 0.254 0.782 0.595
#> SD:skmeans 3 0.951 0.915 0.969 0.318 0.753 0.540
#> CV:skmeans 3 0.934 0.932 0.970 0.324 0.758 0.548
#> MAD:skmeans 3 0.906 0.902 0.963 0.319 0.770 0.566
#> ATC:skmeans 3 0.958 0.939 0.971 0.216 0.856 0.715
#> SD:mclust 3 0.596 0.707 0.867 0.778 0.693 0.544
#> CV:mclust 3 0.681 0.821 0.895 1.082 0.572 0.471
#> MAD:mclust 3 0.535 0.778 0.874 1.313 0.618 0.494
#> ATC:mclust 3 0.690 0.823 0.867 0.518 0.794 0.652
#> SD:kmeans 3 0.776 0.789 0.842 0.298 0.780 0.585
#> CV:kmeans 3 0.774 0.863 0.925 0.327 0.753 0.547
#> MAD:kmeans 3 0.760 0.828 0.910 0.294 0.828 0.670
#> ATC:kmeans 3 0.842 0.905 0.950 0.375 0.760 0.560
#> SD:pam 3 0.717 0.889 0.938 0.530 0.719 0.521
#> CV:pam 3 0.653 0.770 0.887 0.497 0.690 0.483
#> MAD:pam 3 0.861 0.892 0.946 0.487 0.729 0.527
#> ATC:pam 3 1.000 0.989 0.995 0.397 0.763 0.567
#> SD:hclust 3 0.638 0.765 0.867 0.349 0.874 0.744
#> CV:hclust 3 0.392 0.632 0.794 0.277 0.885 0.766
#> MAD:hclust 3 0.662 0.840 0.880 0.268 0.874 0.744
#> ATC:hclust 3 0.739 0.780 0.851 0.357 0.805 0.625
get_stats(res_list, k = 4)
#> k 1-PAC mean_silhouette concordance area_increased Rand Jaccard
#> SD:NMF 4 0.698 0.772 0.874 0.1873 0.775 0.461
#> CV:NMF 4 0.724 0.692 0.852 0.1316 0.818 0.524
#> MAD:NMF 4 0.684 0.745 0.869 0.1729 0.770 0.456
#> ATC:NMF 4 0.729 0.785 0.882 0.1042 0.947 0.855
#> SD:skmeans 4 0.886 0.888 0.949 0.1261 0.828 0.538
#> CV:skmeans 4 0.897 0.867 0.931 0.1178 0.895 0.701
#> MAD:skmeans 4 0.891 0.901 0.956 0.1260 0.838 0.563
#> ATC:skmeans 4 0.933 0.874 0.952 0.0760 0.973 0.928
#> SD:mclust 4 0.547 0.773 0.840 0.1325 0.766 0.459
#> CV:mclust 4 0.762 0.859 0.881 0.2025 0.789 0.519
#> MAD:mclust 4 0.766 0.833 0.901 0.2006 0.779 0.492
#> ATC:mclust 4 0.614 0.755 0.869 0.0523 0.921 0.804
#> SD:kmeans 4 0.710 0.778 0.865 0.1456 0.820 0.531
#> CV:kmeans 4 0.633 0.649 0.795 0.1436 0.872 0.647
#> MAD:kmeans 4 0.669 0.730 0.850 0.1539 0.816 0.544
#> ATC:kmeans 4 0.761 0.802 0.830 0.1135 0.891 0.690
#> SD:pam 4 0.690 0.677 0.845 0.1074 0.698 0.321
#> CV:pam 4 0.644 0.623 0.812 0.1064 0.717 0.363
#> MAD:pam 4 0.731 0.797 0.894 0.1048 0.719 0.343
#> ATC:pam 4 1.000 0.994 0.998 0.1151 0.864 0.630
#> SD:hclust 4 0.699 0.775 0.812 0.1179 1.000 1.000
#> CV:hclust 4 0.618 0.585 0.806 0.1585 0.898 0.743
#> MAD:hclust 4 0.699 0.722 0.780 0.1060 0.953 0.879
#> ATC:hclust 4 0.834 0.925 0.941 0.1291 0.914 0.744
get_stats(res_list, k = 5)
#> k 1-PAC mean_silhouette concordance area_increased Rand Jaccard
#> SD:NMF 5 0.697 0.738 0.836 0.0625 0.903 0.639
#> CV:NMF 5 0.666 0.579 0.766 0.0669 0.868 0.541
#> MAD:NMF 5 0.696 0.745 0.852 0.0661 0.863 0.529
#> ATC:NMF 5 0.672 0.522 0.775 0.0802 0.956 0.863
#> SD:skmeans 5 0.778 0.688 0.847 0.0591 0.947 0.791
#> CV:skmeans 5 0.821 0.797 0.877 0.0608 0.946 0.794
#> MAD:skmeans 5 0.782 0.631 0.836 0.0571 0.964 0.854
#> ATC:skmeans 5 0.863 0.798 0.913 0.0398 0.951 0.864
#> SD:mclust 5 0.865 0.846 0.936 0.0880 0.892 0.633
#> CV:mclust 5 0.874 0.810 0.923 0.0672 0.906 0.674
#> MAD:mclust 5 0.863 0.860 0.943 0.0585 0.889 0.624
#> ATC:mclust 5 0.802 0.815 0.880 0.1124 0.874 0.656
#> SD:kmeans 5 0.718 0.613 0.755 0.0642 0.909 0.661
#> CV:kmeans 5 0.640 0.582 0.743 0.0711 0.895 0.628
#> MAD:kmeans 5 0.729 0.634 0.784 0.0658 0.915 0.687
#> ATC:kmeans 5 0.748 0.688 0.820 0.0602 0.955 0.837
#> SD:pam 5 0.792 0.813 0.892 0.0764 0.827 0.456
#> CV:pam 5 0.805 0.770 0.877 0.0880 0.887 0.619
#> MAD:pam 5 0.776 0.788 0.899 0.0719 0.852 0.505
#> ATC:pam 5 0.931 0.868 0.945 0.0588 0.958 0.840
#> SD:hclust 5 0.743 0.632 0.797 0.0915 0.857 0.608
#> CV:hclust 5 0.628 0.518 0.742 0.0674 0.841 0.562
#> MAD:hclust 5 0.733 0.636 0.821 0.0898 0.883 0.680
#> ATC:hclust 5 0.859 0.813 0.899 0.0662 0.953 0.820
get_stats(res_list, k = 6)
#> k 1-PAC mean_silhouette concordance area_increased Rand Jaccard
#> SD:NMF 6 0.697 0.579 0.775 0.0373 0.877 0.504
#> CV:NMF 6 0.696 0.656 0.803 0.0370 0.897 0.565
#> MAD:NMF 6 0.698 0.591 0.787 0.0358 0.894 0.561
#> ATC:NMF 6 0.681 0.639 0.741 0.0427 0.858 0.535
#> SD:skmeans 6 0.758 0.618 0.788 0.0396 0.981 0.910
#> CV:skmeans 6 0.787 0.728 0.847 0.0420 0.947 0.762
#> MAD:skmeans 6 0.768 0.680 0.834 0.0397 0.941 0.735
#> ATC:skmeans 6 0.803 0.749 0.882 0.0360 0.979 0.935
#> SD:mclust 6 0.833 0.783 0.912 0.0133 0.996 0.981
#> CV:mclust 6 0.805 0.715 0.865 0.0267 0.920 0.689
#> MAD:mclust 6 0.843 0.779 0.912 0.0123 0.996 0.984
#> ATC:mclust 6 0.652 0.392 0.673 0.0787 0.828 0.476
#> SD:kmeans 6 0.743 0.547 0.734 0.0449 0.947 0.751
#> CV:kmeans 6 0.685 0.539 0.732 0.0447 0.916 0.623
#> MAD:kmeans 6 0.741 0.497 0.753 0.0433 0.978 0.895
#> ATC:kmeans 6 0.811 0.814 0.835 0.0429 0.899 0.623
#> SD:pam 6 0.846 0.833 0.916 0.0411 0.936 0.708
#> CV:pam 6 0.923 0.912 0.955 0.0436 0.949 0.765
#> MAD:pam 6 0.822 0.813 0.902 0.0377 0.946 0.745
#> ATC:pam 6 1.000 0.935 0.975 0.0413 0.964 0.841
#> SD:hclust 6 0.745 0.541 0.707 0.0451 0.891 0.603
#> CV:hclust 6 0.653 0.618 0.752 0.0536 0.925 0.717
#> MAD:hclust 6 0.756 0.669 0.787 0.0463 0.935 0.748
#> ATC:hclust 6 0.851 0.784 0.877 0.0315 0.998 0.989
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 individual(p) k
#> SD:NMF 56 0.1639 2
#> CV:NMF 56 0.1719 2
#> MAD:NMF 57 0.2102 2
#> ATC:NMF 55 0.4614 2
#> SD:skmeans 55 0.1158 2
#> CV:skmeans 57 0.1196 2
#> MAD:skmeans 58 0.1697 2
#> ATC:skmeans 57 0.5126 2
#> SD:mclust 52 0.8749 2
#> CV:mclust 45 0.4373 2
#> MAD:mclust 55 0.6056 2
#> ATC:mclust 56 0.2629 2
#> SD:kmeans 55 0.1013 2
#> CV:kmeans 58 0.1353 2
#> MAD:kmeans 56 0.1337 2
#> ATC:kmeans 58 0.4538 2
#> SD:pam 55 0.0590 2
#> CV:pam 55 0.3168 2
#> MAD:pam 57 0.0709 2
#> ATC:pam 57 0.3457 2
#> SD:hclust 58 0.1769 2
#> CV:hclust 55 0.2090 2
#> MAD:hclust 57 0.1291 2
#> ATC:hclust 51 0.4172 2
test_to_known_factors(res_list, k = 3)
#> n individual(p) k
#> SD:NMF 52 0.209025 3
#> CV:NMF 52 0.019197 3
#> MAD:NMF 55 0.170750 3
#> ATC:NMF 57 0.158172 3
#> SD:skmeans 55 0.001421 3
#> CV:skmeans 56 0.000999 3
#> MAD:skmeans 54 0.001353 3
#> ATC:skmeans 56 0.705813 3
#> SD:mclust 46 0.259941 3
#> CV:mclust 53 0.137631 3
#> MAD:mclust 57 0.460963 3
#> ATC:mclust 56 0.109913 3
#> SD:kmeans 53 0.121742 3
#> CV:kmeans 58 0.007791 3
#> MAD:kmeans 53 0.155827 3
#> ATC:kmeans 58 0.329072 3
#> SD:pam 57 0.087447 3
#> CV:pam 54 0.087624 3
#> MAD:pam 56 0.086692 3
#> ATC:pam 58 0.418877 3
#> SD:hclust 49 0.037431 3
#> CV:hclust 47 0.113769 3
#> MAD:hclust 56 0.250933 3
#> ATC:hclust 55 0.630663 3
test_to_known_factors(res_list, k = 4)
#> n individual(p) k
#> SD:NMF 54 0.003075 4
#> CV:NMF 48 0.049228 4
#> MAD:NMF 51 0.011018 4
#> ATC:NMF 53 0.216236 4
#> SD:skmeans 56 0.024954 4
#> CV:skmeans 54 0.002790 4
#> MAD:skmeans 57 0.029172 4
#> ATC:skmeans 55 0.270059 4
#> SD:mclust 53 0.013460 4
#> CV:mclust 56 0.005298 4
#> MAD:mclust 54 0.009050 4
#> ATC:mclust 53 0.069124 4
#> SD:kmeans 51 0.001224 4
#> CV:kmeans 46 0.011214 4
#> MAD:kmeans 49 0.000219 4
#> ATC:kmeans 55 0.767215 4
#> SD:pam 49 0.050830 4
#> CV:pam 47 0.005225 4
#> MAD:pam 54 0.097074 4
#> ATC:pam 58 0.719112 4
#> SD:hclust 58 0.289776 4
#> CV:hclust 40 0.085589 4
#> MAD:hclust 53 0.261617 4
#> ATC:hclust 57 0.676628 4
test_to_known_factors(res_list, k = 5)
#> n individual(p) k
#> SD:NMF 53 0.036604 5
#> CV:NMF 41 0.049568 5
#> MAD:NMF 51 0.082823 5
#> ATC:NMF 37 0.205511 5
#> SD:skmeans 48 0.003906 5
#> CV:skmeans 57 0.001530 5
#> MAD:skmeans 44 0.007064 5
#> ATC:skmeans 47 0.796172 5
#> SD:mclust 54 0.106348 5
#> CV:mclust 49 0.007184 5
#> MAD:mclust 54 0.064756 5
#> ATC:mclust 52 0.005182 5
#> SD:kmeans 43 0.000407 5
#> CV:kmeans 39 0.006318 5
#> MAD:kmeans 45 0.001336 5
#> ATC:kmeans 46 0.356114 5
#> SD:pam 51 0.104977 5
#> CV:pam 57 0.043238 5
#> MAD:pam 51 0.134280 5
#> ATC:pam 54 0.684089 5
#> SD:hclust 43 0.000573 5
#> CV:hclust 30 0.092317 5
#> MAD:hclust 41 0.003261 5
#> ATC:hclust 50 0.884142 5
test_to_known_factors(res_list, k = 6)
#> n individual(p) k
#> SD:NMF 41 0.01293 6
#> CV:NMF 44 0.00606 6
#> MAD:NMF 36 0.06388 6
#> ATC:NMF 39 0.14720 6
#> SD:skmeans 41 0.00443 6
#> CV:skmeans 52 0.00114 6
#> MAD:skmeans 49 0.00467 6
#> ATC:skmeans 49 0.47080 6
#> SD:mclust 52 0.03419 6
#> CV:mclust 48 0.00473 6
#> MAD:mclust 51 0.02592 6
#> ATC:mclust 22 0.22670 6
#> SD:kmeans 38 0.00954 6
#> CV:kmeans 35 0.00088 6
#> MAD:kmeans 36 0.00670 6
#> ATC:kmeans 54 0.08790 6
#> SD:pam 53 0.06031 6
#> CV:pam 58 0.03276 6
#> MAD:pam 55 0.06403 6
#> ATC:pam 55 0.20489 6
#> SD:hclust 41 0.09089 6
#> CV:hclust 42 0.00319 6
#> MAD:hclust 42 0.00121 6
#> ATC:hclust 54 0.29191 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.385 0.844 0.902 0.4683 0.491 0.491
#> 3 3 0.638 0.765 0.867 0.3494 0.874 0.744
#> 4 4 0.699 0.775 0.812 0.1179 1.000 1.000
#> 5 5 0.743 0.632 0.797 0.0915 0.857 0.608
#> 6 6 0.745 0.541 0.707 0.0451 0.891 0.603
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
#> GSM553595 2 0.4815 0.927 0.104 0.896
#> GSM553596 2 0.4815 0.927 0.104 0.896
#> GSM553597 1 0.1414 0.839 0.980 0.020
#> GSM553598 2 0.0000 0.917 0.000 1.000
#> GSM553599 1 0.7453 0.773 0.788 0.212
#> GSM553600 1 0.0000 0.842 1.000 0.000
#> GSM553601 1 0.7528 0.770 0.784 0.216
#> GSM553602 1 0.0000 0.842 1.000 0.000
#> GSM553603 1 0.3274 0.824 0.940 0.060
#> GSM553604 1 0.7528 0.770 0.784 0.216
#> GSM553605 2 0.0000 0.917 0.000 1.000
#> GSM553606 2 0.0000 0.917 0.000 1.000
#> GSM553607 2 0.0000 0.917 0.000 1.000
#> GSM553608 2 0.4815 0.928 0.104 0.896
#> GSM553609 2 0.4161 0.933 0.084 0.916
#> GSM553610 2 0.0000 0.917 0.000 1.000
#> GSM553611 2 0.5178 0.921 0.116 0.884
#> GSM553612 2 0.4815 0.928 0.104 0.896
#> GSM553613 2 0.0000 0.917 0.000 1.000
#> GSM553614 1 0.1414 0.839 0.980 0.020
#> GSM553615 1 0.0376 0.842 0.996 0.004
#> GSM553616 1 0.0000 0.842 1.000 0.000
#> GSM553617 1 0.7299 0.777 0.796 0.204
#> GSM553618 2 0.2603 0.927 0.044 0.956
#> GSM553619 2 0.1633 0.915 0.024 0.976
#> GSM553620 1 0.0000 0.842 1.000 0.000
#> GSM553621 1 0.0000 0.842 1.000 0.000
#> GSM553622 1 0.0000 0.842 1.000 0.000
#> GSM553623 1 0.7453 0.773 0.788 0.212
#> GSM553624 1 0.7299 0.777 0.796 0.204
#> GSM553625 1 0.0376 0.841 0.996 0.004
#> GSM553626 1 0.0000 0.842 1.000 0.000
#> GSM553627 1 0.7376 0.775 0.792 0.208
#> GSM553628 1 0.0000 0.842 1.000 0.000
#> GSM553629 1 0.0672 0.842 0.992 0.008
#> GSM553630 1 0.9000 0.643 0.684 0.316
#> GSM553631 1 0.0672 0.842 0.992 0.008
#> GSM553632 1 0.0000 0.842 1.000 0.000
#> GSM553633 2 0.3879 0.933 0.076 0.924
#> GSM553634 2 0.5294 0.916 0.120 0.880
#> GSM553635 2 0.4690 0.929 0.100 0.900
#> GSM553636 2 0.5178 0.921 0.116 0.884
#> GSM553637 2 0.0000 0.917 0.000 1.000
#> GSM553638 2 0.4815 0.928 0.104 0.896
#> GSM553639 2 0.4815 0.928 0.104 0.896
#> GSM553640 2 0.7219 0.818 0.200 0.800
#> GSM553641 2 0.0000 0.917 0.000 1.000
#> GSM553642 1 0.9552 0.558 0.624 0.376
#> GSM553643 1 0.9552 0.558 0.624 0.376
#> GSM553644 1 0.9552 0.558 0.624 0.376
#> GSM553645 2 0.3879 0.933 0.076 0.924
#> GSM553646 1 0.9552 0.558 0.624 0.376
#> GSM553647 1 0.9552 0.558 0.624 0.376
#> GSM553648 2 0.0000 0.917 0.000 1.000
#> GSM553649 2 0.0000 0.917 0.000 1.000
#> GSM553650 2 0.4939 0.927 0.108 0.892
#> GSM553651 2 0.5178 0.921 0.116 0.884
#> GSM553652 2 0.4815 0.928 0.104 0.896
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> GSM553595 3 0.7059 0.230 0.020 0.460 0.520
#> GSM553596 3 0.7059 0.230 0.020 0.460 0.520
#> GSM553597 1 0.1491 0.803 0.968 0.016 0.016
#> GSM553598 3 0.1163 0.839 0.000 0.028 0.972
#> GSM553599 1 0.5178 0.742 0.744 0.256 0.000
#> GSM553600 1 0.0000 0.799 1.000 0.000 0.000
#> GSM553601 1 0.5216 0.739 0.740 0.260 0.000
#> GSM553602 1 0.0892 0.806 0.980 0.020 0.000
#> GSM553603 1 0.3879 0.772 0.848 0.152 0.000
#> GSM553604 1 0.5058 0.745 0.756 0.244 0.000
#> GSM553605 3 0.0892 0.839 0.000 0.020 0.980
#> GSM553606 3 0.1753 0.836 0.000 0.048 0.952
#> GSM553607 3 0.1411 0.826 0.000 0.036 0.964
#> GSM553608 2 0.0237 0.966 0.000 0.996 0.004
#> GSM553609 2 0.1411 0.943 0.000 0.964 0.036
#> GSM553610 3 0.1753 0.836 0.000 0.048 0.952
#> GSM553611 2 0.0424 0.964 0.008 0.992 0.000
#> GSM553612 2 0.0237 0.966 0.000 0.996 0.004
#> GSM553613 3 0.0892 0.839 0.000 0.020 0.980
#> GSM553614 1 0.1491 0.803 0.968 0.016 0.016
#> GSM553615 1 0.2711 0.803 0.912 0.088 0.000
#> GSM553616 1 0.1860 0.803 0.948 0.052 0.000
#> GSM553617 1 0.4887 0.753 0.772 0.228 0.000
#> GSM553618 3 0.2550 0.815 0.012 0.056 0.932
#> GSM553619 3 0.1636 0.825 0.020 0.016 0.964
#> GSM553620 1 0.0000 0.799 1.000 0.000 0.000
#> GSM553621 1 0.0000 0.799 1.000 0.000 0.000
#> GSM553622 1 0.0000 0.799 1.000 0.000 0.000
#> GSM553623 1 0.5178 0.742 0.744 0.256 0.000
#> GSM553624 1 0.4887 0.753 0.772 0.228 0.000
#> GSM553625 1 0.1163 0.807 0.972 0.028 0.000
#> GSM553626 1 0.1031 0.807 0.976 0.024 0.000
#> GSM553627 1 0.4931 0.750 0.768 0.232 0.000
#> GSM553628 1 0.1289 0.809 0.968 0.032 0.000
#> GSM553629 1 0.2772 0.802 0.916 0.080 0.004
#> GSM553630 1 0.5882 0.618 0.652 0.348 0.000
#> GSM553631 1 0.2772 0.802 0.916 0.080 0.004
#> GSM553632 1 0.1643 0.809 0.956 0.044 0.000
#> GSM553633 3 0.6468 0.291 0.004 0.444 0.552
#> GSM553634 2 0.3375 0.910 0.044 0.908 0.048
#> GSM553635 2 0.2743 0.924 0.020 0.928 0.052
#> GSM553636 2 0.0424 0.964 0.008 0.992 0.000
#> GSM553637 3 0.1411 0.826 0.000 0.036 0.964
#> GSM553638 2 0.0237 0.966 0.000 0.996 0.004
#> GSM553639 2 0.0237 0.966 0.000 0.996 0.004
#> GSM553640 2 0.3267 0.854 0.116 0.884 0.000
#> GSM553641 3 0.0892 0.839 0.000 0.020 0.980
#> GSM553642 1 0.6291 0.465 0.532 0.468 0.000
#> GSM553643 1 0.6291 0.465 0.532 0.468 0.000
#> GSM553644 1 0.6291 0.465 0.532 0.468 0.000
#> GSM553645 3 0.6468 0.291 0.004 0.444 0.552
#> GSM553646 1 0.6291 0.465 0.532 0.468 0.000
#> GSM553647 1 0.6291 0.465 0.532 0.468 0.000
#> GSM553648 3 0.0892 0.839 0.000 0.020 0.980
#> GSM553649 3 0.0892 0.839 0.000 0.020 0.980
#> GSM553650 2 0.0475 0.966 0.004 0.992 0.004
#> GSM553651 2 0.0424 0.964 0.008 0.992 0.000
#> GSM553652 2 0.0237 0.966 0.000 0.996 0.004
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> GSM553595 3 0.5760 0.536 0.028 0.448 0.524 0.000
#> GSM553596 3 0.5760 0.536 0.028 0.448 0.524 0.000
#> GSM553597 1 0.2149 0.791 0.912 0.000 0.000 0.088
#> GSM553598 3 0.0376 0.788 0.000 0.004 0.992 0.004
#> GSM553599 1 0.4542 0.771 0.752 0.228 0.000 0.020
#> GSM553600 1 0.2593 0.773 0.892 0.004 0.000 0.104
#> GSM553601 1 0.4576 0.769 0.748 0.232 0.000 0.020
#> GSM553602 1 0.2342 0.784 0.912 0.008 0.000 0.080
#> GSM553603 1 0.4038 0.770 0.828 0.136 0.004 0.032
#> GSM553604 1 0.4053 0.770 0.768 0.228 0.004 0.000
#> GSM553605 3 0.0188 0.789 0.000 0.000 0.996 0.004
#> GSM553606 3 0.1929 0.777 0.000 0.024 0.940 0.036
#> GSM553607 3 0.5673 0.567 0.000 0.024 0.528 0.448
#> GSM553608 2 0.4964 0.967 0.000 0.616 0.004 0.380
#> GSM553609 2 0.5560 0.948 0.000 0.584 0.024 0.392
#> GSM553610 3 0.1929 0.777 0.000 0.024 0.940 0.036
#> GSM553611 2 0.5085 0.965 0.008 0.616 0.000 0.376
#> GSM553612 2 0.4964 0.967 0.000 0.616 0.004 0.380
#> GSM553613 3 0.0188 0.789 0.000 0.000 0.996 0.004
#> GSM553614 1 0.2149 0.791 0.912 0.000 0.000 0.088
#> GSM553615 1 0.4139 0.760 0.816 0.040 0.000 0.144
#> GSM553616 1 0.2635 0.792 0.904 0.020 0.000 0.076
#> GSM553617 1 0.3764 0.774 0.784 0.216 0.000 0.000
#> GSM553618 3 0.3030 0.769 0.020 0.020 0.900 0.060
#> GSM553619 3 0.4985 0.575 0.000 0.000 0.532 0.468
#> GSM553620 1 0.1576 0.794 0.948 0.004 0.000 0.048
#> GSM553621 1 0.1576 0.794 0.948 0.004 0.000 0.048
#> GSM553622 1 0.2593 0.773 0.892 0.004 0.000 0.104
#> GSM553623 1 0.4542 0.771 0.752 0.228 0.000 0.020
#> GSM553624 1 0.3764 0.774 0.784 0.216 0.000 0.000
#> GSM553625 1 0.0469 0.797 0.988 0.012 0.000 0.000
#> GSM553626 1 0.2271 0.785 0.916 0.008 0.000 0.076
#> GSM553627 1 0.3801 0.773 0.780 0.220 0.000 0.000
#> GSM553628 1 0.2796 0.780 0.892 0.016 0.000 0.092
#> GSM553629 1 0.4149 0.757 0.812 0.036 0.000 0.152
#> GSM553630 1 0.5882 0.698 0.608 0.344 0.000 0.048
#> GSM553631 1 0.4149 0.757 0.812 0.036 0.000 0.152
#> GSM553632 1 0.3117 0.780 0.880 0.028 0.000 0.092
#> GSM553633 3 0.5353 0.565 0.012 0.432 0.556 0.000
#> GSM553634 2 0.5901 0.909 0.036 0.532 0.000 0.432
#> GSM553635 2 0.5378 0.919 0.012 0.540 0.000 0.448
#> GSM553636 2 0.5085 0.965 0.008 0.616 0.000 0.376
#> GSM553637 3 0.5673 0.567 0.000 0.024 0.528 0.448
#> GSM553638 2 0.4964 0.967 0.000 0.616 0.004 0.380
#> GSM553639 2 0.4964 0.967 0.000 0.616 0.004 0.380
#> GSM553640 2 0.6804 0.865 0.104 0.520 0.000 0.376
#> GSM553641 3 0.0000 0.789 0.000 0.000 1.000 0.000
#> GSM553642 1 0.6019 0.613 0.508 0.456 0.004 0.032
#> GSM553643 1 0.6019 0.613 0.508 0.456 0.004 0.032
#> GSM553644 1 0.6019 0.613 0.508 0.456 0.004 0.032
#> GSM553645 3 0.5353 0.565 0.012 0.432 0.556 0.000
#> GSM553646 1 0.6019 0.613 0.508 0.456 0.004 0.032
#> GSM553647 1 0.6019 0.613 0.508 0.456 0.004 0.032
#> GSM553648 3 0.0000 0.789 0.000 0.000 1.000 0.000
#> GSM553649 3 0.0000 0.789 0.000 0.000 1.000 0.000
#> GSM553650 2 0.4964 0.966 0.004 0.616 0.000 0.380
#> GSM553651 2 0.5085 0.965 0.008 0.616 0.000 0.376
#> GSM553652 2 0.4964 0.967 0.000 0.616 0.004 0.380
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> GSM553595 3 0.5473 0.508 0.000 0.064 0.520 0.416 0.000
#> GSM553596 3 0.5473 0.508 0.000 0.064 0.520 0.416 0.000
#> GSM553597 4 0.5431 0.226 0.476 0.008 0.000 0.476 0.040
#> GSM553598 3 0.4047 0.514 0.000 0.000 0.676 0.004 0.320
#> GSM553599 1 0.5014 0.475 0.560 0.020 0.000 0.412 0.008
#> GSM553600 1 0.0807 0.628 0.976 0.000 0.000 0.012 0.012
#> GSM553601 1 0.5094 0.469 0.556 0.024 0.000 0.412 0.008
#> GSM553602 1 0.1591 0.640 0.940 0.004 0.000 0.052 0.004
#> GSM553603 4 0.5513 0.304 0.408 0.068 0.000 0.524 0.000
#> GSM553604 1 0.4702 0.417 0.552 0.016 0.000 0.432 0.000
#> GSM553605 3 0.0162 0.658 0.000 0.000 0.996 0.000 0.004
#> GSM553606 3 0.4623 0.502 0.000 0.032 0.664 0.000 0.304
#> GSM553607 5 0.1661 0.976 0.000 0.024 0.036 0.000 0.940
#> GSM553608 2 0.0000 0.964 0.000 1.000 0.000 0.000 0.000
#> GSM553609 2 0.1012 0.946 0.000 0.968 0.012 0.000 0.020
#> GSM553610 3 0.4623 0.502 0.000 0.032 0.664 0.000 0.304
#> GSM553611 2 0.0486 0.962 0.004 0.988 0.000 0.004 0.004
#> GSM553612 2 0.0000 0.964 0.000 1.000 0.000 0.000 0.000
#> GSM553613 3 0.0162 0.658 0.000 0.000 0.996 0.000 0.004
#> GSM553614 4 0.5431 0.226 0.476 0.008 0.000 0.476 0.040
#> GSM553615 1 0.2937 0.604 0.884 0.060 0.000 0.040 0.016
#> GSM553616 1 0.5962 -0.246 0.488 0.044 0.000 0.436 0.032
#> GSM553617 1 0.4436 0.482 0.596 0.008 0.000 0.396 0.000
#> GSM553618 3 0.5747 0.381 0.008 0.016 0.536 0.036 0.404
#> GSM553619 5 0.1444 0.951 0.000 0.000 0.040 0.012 0.948
#> GSM553620 4 0.4798 0.340 0.440 0.000 0.000 0.540 0.020
#> GSM553621 4 0.4798 0.340 0.440 0.000 0.000 0.540 0.020
#> GSM553622 1 0.0807 0.628 0.976 0.000 0.000 0.012 0.012
#> GSM553623 1 0.5014 0.475 0.560 0.020 0.000 0.412 0.008
#> GSM553624 1 0.4436 0.482 0.596 0.008 0.000 0.396 0.000
#> GSM553625 1 0.3519 0.537 0.776 0.008 0.000 0.216 0.000
#> GSM553626 1 0.1502 0.641 0.940 0.004 0.000 0.056 0.000
#> GSM553627 1 0.4489 0.449 0.572 0.008 0.000 0.420 0.000
#> GSM553628 1 0.1074 0.641 0.968 0.012 0.000 0.016 0.004
#> GSM553629 1 0.2980 0.597 0.884 0.056 0.000 0.036 0.024
#> GSM553630 4 0.4074 0.441 0.224 0.012 0.000 0.752 0.012
#> GSM553631 1 0.3058 0.596 0.880 0.056 0.000 0.040 0.024
#> GSM553632 1 0.1498 0.640 0.952 0.016 0.000 0.024 0.008
#> GSM553633 3 0.5213 0.549 0.000 0.048 0.556 0.396 0.000
#> GSM553634 2 0.2647 0.897 0.008 0.892 0.000 0.024 0.076
#> GSM553635 2 0.2012 0.910 0.000 0.920 0.000 0.020 0.060
#> GSM553636 2 0.0486 0.962 0.004 0.988 0.000 0.004 0.004
#> GSM553637 5 0.1661 0.976 0.000 0.024 0.036 0.000 0.940
#> GSM553638 2 0.0000 0.964 0.000 1.000 0.000 0.000 0.000
#> GSM553639 2 0.0000 0.964 0.000 1.000 0.000 0.000 0.000
#> GSM553640 2 0.3288 0.856 0.076 0.864 0.000 0.040 0.020
#> GSM553641 3 0.0000 0.659 0.000 0.000 1.000 0.000 0.000
#> GSM553642 4 0.1544 0.629 0.000 0.068 0.000 0.932 0.000
#> GSM553643 4 0.1544 0.629 0.000 0.068 0.000 0.932 0.000
#> GSM553644 4 0.1544 0.629 0.000 0.068 0.000 0.932 0.000
#> GSM553645 3 0.5213 0.549 0.000 0.048 0.556 0.396 0.000
#> GSM553646 4 0.1544 0.629 0.000 0.068 0.000 0.932 0.000
#> GSM553647 4 0.1544 0.629 0.000 0.068 0.000 0.932 0.000
#> GSM553648 3 0.0000 0.659 0.000 0.000 1.000 0.000 0.000
#> GSM553649 3 0.0000 0.659 0.000 0.000 1.000 0.000 0.000
#> GSM553650 2 0.0162 0.964 0.004 0.996 0.000 0.000 0.000
#> GSM553651 2 0.0486 0.962 0.004 0.988 0.000 0.004 0.004
#> GSM553652 2 0.0000 0.964 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
#> GSM553595 3 0.6937 0.1625 0.224 0.052 0.396 0.000 0.004 0.324
#> GSM553596 3 0.6937 0.1625 0.224 0.052 0.396 0.000 0.004 0.324
#> GSM553597 5 0.2806 0.9115 0.144 0.008 0.000 0.000 0.840 0.008
#> GSM553598 6 0.6169 0.6982 0.000 0.000 0.268 0.320 0.004 0.408
#> GSM553599 1 0.1065 0.6272 0.964 0.008 0.000 0.000 0.020 0.008
#> GSM553600 1 0.4619 0.6347 0.564 0.000 0.000 0.000 0.044 0.392
#> GSM553601 1 0.1167 0.6247 0.960 0.012 0.000 0.000 0.020 0.008
#> GSM553602 1 0.3927 0.6605 0.644 0.000 0.000 0.000 0.012 0.344
#> GSM553603 1 0.7994 0.2765 0.388 0.056 0.256 0.000 0.104 0.196
#> GSM553604 1 0.1555 0.5971 0.940 0.012 0.040 0.000 0.008 0.000
#> GSM553605 3 0.3833 -0.4402 0.000 0.000 0.556 0.000 0.000 0.444
#> GSM553606 6 0.6552 0.8580 0.000 0.020 0.316 0.320 0.000 0.344
#> GSM553607 4 0.0000 0.6856 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM553608 2 0.0000 0.9583 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM553609 2 0.1124 0.9330 0.000 0.956 0.008 0.036 0.000 0.000
#> GSM553610 6 0.6552 0.8580 0.000 0.020 0.316 0.320 0.000 0.344
#> GSM553611 2 0.0520 0.9562 0.008 0.984 0.000 0.000 0.008 0.000
#> GSM553612 2 0.0000 0.9583 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM553613 3 0.3833 -0.4402 0.000 0.000 0.556 0.000 0.000 0.444
#> GSM553614 5 0.2806 0.9115 0.144 0.008 0.000 0.000 0.840 0.008
#> GSM553615 1 0.5152 0.6180 0.504 0.012 0.000 0.000 0.056 0.428
#> GSM553616 5 0.3079 0.8608 0.128 0.008 0.000 0.000 0.836 0.028
#> GSM553617 1 0.0146 0.6304 0.996 0.000 0.000 0.000 0.004 0.000
#> GSM553618 4 0.7242 -0.6202 0.012 0.012 0.196 0.388 0.044 0.348
#> GSM553619 4 0.2138 0.6603 0.000 0.000 0.004 0.908 0.052 0.036
#> GSM553620 5 0.2425 0.8969 0.100 0.000 0.012 0.000 0.880 0.008
#> GSM553621 5 0.2425 0.8969 0.100 0.000 0.012 0.000 0.880 0.008
#> GSM553622 1 0.4619 0.6347 0.564 0.000 0.000 0.000 0.044 0.392
#> GSM553623 1 0.1065 0.6272 0.964 0.008 0.000 0.000 0.020 0.008
#> GSM553624 1 0.0146 0.6304 0.996 0.000 0.000 0.000 0.004 0.000
#> GSM553625 1 0.3720 0.6489 0.768 0.000 0.020 0.000 0.016 0.196
#> GSM553626 1 0.3728 0.6624 0.652 0.000 0.000 0.000 0.004 0.344
#> GSM553627 1 0.0858 0.6151 0.968 0.000 0.028 0.000 0.004 0.000
#> GSM553628 1 0.3975 0.6519 0.600 0.000 0.000 0.000 0.008 0.392
#> GSM553629 1 0.5379 0.6095 0.488 0.012 0.000 0.004 0.064 0.432
#> GSM553630 1 0.6732 -0.0315 0.456 0.000 0.284 0.000 0.200 0.060
#> GSM553631 1 0.5503 0.6059 0.484 0.012 0.000 0.004 0.076 0.424
#> GSM553632 1 0.4101 0.6497 0.580 0.000 0.000 0.000 0.012 0.408
#> GSM553633 3 0.6744 0.1231 0.208 0.040 0.416 0.000 0.004 0.332
#> GSM553634 2 0.3156 0.8676 0.000 0.852 0.000 0.056 0.072 0.020
#> GSM553635 2 0.2002 0.9093 0.000 0.916 0.000 0.056 0.020 0.008
#> GSM553636 2 0.0520 0.9562 0.008 0.984 0.000 0.000 0.008 0.000
#> GSM553637 4 0.0000 0.6856 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM553638 2 0.0000 0.9583 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM553639 2 0.0000 0.9583 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM553640 2 0.3689 0.8224 0.036 0.820 0.000 0.000 0.076 0.068
#> GSM553641 3 0.3828 -0.4406 0.000 0.000 0.560 0.000 0.000 0.440
#> GSM553642 3 0.6388 0.3123 0.384 0.056 0.440 0.000 0.120 0.000
#> GSM553643 3 0.6388 0.3123 0.384 0.056 0.440 0.000 0.120 0.000
#> GSM553644 3 0.6388 0.3123 0.384 0.056 0.440 0.000 0.120 0.000
#> GSM553645 3 0.6744 0.1231 0.208 0.040 0.416 0.000 0.004 0.332
#> GSM553646 3 0.6388 0.3123 0.384 0.056 0.440 0.000 0.120 0.000
#> GSM553647 3 0.6388 0.3123 0.384 0.056 0.440 0.000 0.120 0.000
#> GSM553648 3 0.3828 -0.4406 0.000 0.000 0.560 0.000 0.000 0.440
#> GSM553649 3 0.3828 -0.4406 0.000 0.000 0.560 0.000 0.000 0.440
#> GSM553650 2 0.0146 0.9578 0.004 0.996 0.000 0.000 0.000 0.000
#> GSM553651 2 0.0520 0.9562 0.008 0.984 0.000 0.000 0.008 0.000
#> GSM553652 2 0.0000 0.9583 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 individual(p) k
#> SD:hclust 58 0.176936 2
#> SD:hclust 49 0.037431 3
#> SD:hclust 58 0.289776 4
#> SD:hclust 43 0.000573 5
#> SD:hclust 41 0.090895 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 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.762 0.882 0.950 0.5005 0.497 0.497
#> 3 3 0.776 0.789 0.842 0.2982 0.780 0.585
#> 4 4 0.710 0.778 0.865 0.1456 0.820 0.531
#> 5 5 0.718 0.613 0.755 0.0642 0.909 0.661
#> 6 6 0.743 0.547 0.734 0.0449 0.947 0.751
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
#> GSM553595 1 0.8813 0.5872 0.700 0.300
#> GSM553596 1 0.9998 0.0459 0.508 0.492
#> GSM553597 1 0.1843 0.9332 0.972 0.028
#> GSM553598 2 0.0000 0.9375 0.000 1.000
#> GSM553599 1 0.0000 0.9492 1.000 0.000
#> GSM553600 1 0.0000 0.9492 1.000 0.000
#> GSM553601 1 0.2778 0.9197 0.952 0.048
#> GSM553602 1 0.0000 0.9492 1.000 0.000
#> GSM553603 1 0.3114 0.9136 0.944 0.056
#> GSM553604 1 0.0000 0.9492 1.000 0.000
#> GSM553605 2 0.0000 0.9375 0.000 1.000
#> GSM553606 2 0.0000 0.9375 0.000 1.000
#> GSM553607 2 0.0000 0.9375 0.000 1.000
#> GSM553608 2 0.0000 0.9375 0.000 1.000
#> GSM553609 2 0.0000 0.9375 0.000 1.000
#> GSM553610 2 0.0000 0.9375 0.000 1.000
#> GSM553611 2 0.0000 0.9375 0.000 1.000
#> GSM553612 2 0.0000 0.9375 0.000 1.000
#> GSM553613 2 0.0000 0.9375 0.000 1.000
#> GSM553614 1 0.0000 0.9492 1.000 0.000
#> GSM553615 1 0.0000 0.9492 1.000 0.000
#> GSM553616 1 0.0000 0.9492 1.000 0.000
#> GSM553617 1 0.0000 0.9492 1.000 0.000
#> GSM553618 2 0.9754 0.2643 0.408 0.592
#> GSM553619 1 0.9129 0.5327 0.672 0.328
#> GSM553620 1 0.0000 0.9492 1.000 0.000
#> GSM553621 1 0.0000 0.9492 1.000 0.000
#> GSM553622 1 0.0000 0.9492 1.000 0.000
#> GSM553623 1 0.0000 0.9492 1.000 0.000
#> GSM553624 1 0.0000 0.9492 1.000 0.000
#> GSM553625 1 0.0000 0.9492 1.000 0.000
#> GSM553626 1 0.0000 0.9492 1.000 0.000
#> GSM553627 1 0.0000 0.9492 1.000 0.000
#> GSM553628 1 0.0000 0.9492 1.000 0.000
#> GSM553629 1 0.0000 0.9492 1.000 0.000
#> GSM553630 1 0.0000 0.9492 1.000 0.000
#> GSM553631 1 0.0000 0.9492 1.000 0.000
#> GSM553632 1 0.0000 0.9492 1.000 0.000
#> GSM553633 2 0.5059 0.8489 0.112 0.888
#> GSM553634 2 0.2603 0.9112 0.044 0.956
#> GSM553635 2 0.0000 0.9375 0.000 1.000
#> GSM553636 2 0.5519 0.8409 0.128 0.872
#> GSM553637 2 0.0000 0.9375 0.000 1.000
#> GSM553638 2 0.0000 0.9375 0.000 1.000
#> GSM553639 2 0.5059 0.8571 0.112 0.888
#> GSM553640 2 0.9686 0.3893 0.396 0.604
#> GSM553641 2 0.0000 0.9375 0.000 1.000
#> GSM553642 1 0.0376 0.9474 0.996 0.004
#> GSM553643 1 0.4431 0.8808 0.908 0.092
#> GSM553644 1 0.0376 0.9474 0.996 0.004
#> GSM553645 2 0.5059 0.8489 0.112 0.888
#> GSM553646 1 0.3114 0.9136 0.944 0.056
#> GSM553647 1 0.3274 0.9102 0.940 0.060
#> GSM553648 2 0.0000 0.9375 0.000 1.000
#> GSM553649 2 0.0000 0.9375 0.000 1.000
#> GSM553650 2 0.0000 0.9375 0.000 1.000
#> GSM553651 2 0.5294 0.8495 0.120 0.880
#> GSM553652 2 0.0000 0.9375 0.000 1.000
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> GSM553595 3 0.3947 0.75728 0.076 0.040 0.884
#> GSM553596 3 0.4146 0.75444 0.080 0.044 0.876
#> GSM553597 1 0.7065 0.51177 0.644 0.040 0.316
#> GSM553598 3 0.1643 0.78660 0.000 0.044 0.956
#> GSM553599 1 0.3780 0.85659 0.892 0.044 0.064
#> GSM553600 1 0.0237 0.90362 0.996 0.004 0.000
#> GSM553601 1 0.5094 0.78740 0.824 0.040 0.136
#> GSM553602 1 0.0475 0.90431 0.992 0.004 0.004
#> GSM553603 1 0.7291 0.41572 0.604 0.040 0.356
#> GSM553604 1 0.3669 0.85291 0.896 0.040 0.064
#> GSM553605 3 0.2261 0.77744 0.000 0.068 0.932
#> GSM553606 2 0.5016 0.72423 0.000 0.760 0.240
#> GSM553607 2 0.2448 0.88308 0.000 0.924 0.076
#> GSM553608 2 0.0892 0.92634 0.000 0.980 0.020
#> GSM553609 2 0.0892 0.92634 0.000 0.980 0.020
#> GSM553610 2 0.6140 0.42466 0.000 0.596 0.404
#> GSM553611 2 0.0000 0.92503 0.000 1.000 0.000
#> GSM553612 2 0.1643 0.91808 0.000 0.956 0.044
#> GSM553613 3 0.4504 0.61391 0.000 0.196 0.804
#> GSM553614 1 0.1031 0.90660 0.976 0.000 0.024
#> GSM553615 1 0.0983 0.90019 0.980 0.016 0.004
#> GSM553616 1 0.1267 0.90713 0.972 0.004 0.024
#> GSM553617 1 0.1267 0.90713 0.972 0.004 0.024
#> GSM553618 3 0.3134 0.79006 0.032 0.052 0.916
#> GSM553619 3 0.3337 0.78916 0.032 0.060 0.908
#> GSM553620 1 0.0892 0.90692 0.980 0.000 0.020
#> GSM553621 1 0.0000 0.90383 1.000 0.000 0.000
#> GSM553622 1 0.0237 0.90362 0.996 0.004 0.000
#> GSM553623 1 0.1525 0.90546 0.964 0.004 0.032
#> GSM553624 1 0.1267 0.90713 0.972 0.004 0.024
#> GSM553625 1 0.1267 0.90713 0.972 0.004 0.024
#> GSM553626 1 0.0237 0.90362 0.996 0.004 0.000
#> GSM553627 1 0.1399 0.90610 0.968 0.004 0.028
#> GSM553628 1 0.0237 0.90362 0.996 0.004 0.000
#> GSM553629 1 0.1129 0.89868 0.976 0.020 0.004
#> GSM553630 1 0.0892 0.90692 0.980 0.000 0.020
#> GSM553631 1 0.1919 0.90258 0.956 0.020 0.024
#> GSM553632 1 0.0237 0.90362 0.996 0.004 0.000
#> GSM553633 3 0.0000 0.78702 0.000 0.000 1.000
#> GSM553634 2 0.0000 0.92503 0.000 1.000 0.000
#> GSM553635 2 0.0000 0.92503 0.000 1.000 0.000
#> GSM553636 2 0.2173 0.90443 0.008 0.944 0.048
#> GSM553637 2 0.1643 0.90123 0.000 0.956 0.044
#> GSM553638 2 0.0892 0.92634 0.000 0.980 0.020
#> GSM553639 2 0.1878 0.91130 0.004 0.952 0.044
#> GSM553640 2 0.2796 0.85112 0.092 0.908 0.000
#> GSM553641 3 0.2261 0.77744 0.000 0.068 0.932
#> GSM553642 1 0.7065 0.50530 0.644 0.040 0.316
#> GSM553643 3 0.7549 0.09888 0.436 0.040 0.524
#> GSM553644 1 0.7039 0.51376 0.648 0.040 0.312
#> GSM553645 3 0.1529 0.77767 0.000 0.040 0.960
#> GSM553646 3 0.7581 0.00894 0.464 0.040 0.496
#> GSM553647 3 0.7578 0.01223 0.460 0.040 0.500
#> GSM553648 3 0.2261 0.77744 0.000 0.068 0.932
#> GSM553649 3 0.2261 0.77744 0.000 0.068 0.932
#> GSM553650 2 0.0592 0.92705 0.000 0.988 0.012
#> GSM553651 2 0.2173 0.90443 0.008 0.944 0.048
#> GSM553652 2 0.0592 0.92705 0.000 0.988 0.012
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> GSM553595 4 0.2984 0.7696 0.028 0.000 0.084 0.888
#> GSM553596 4 0.4682 0.6007 0.024 0.004 0.212 0.760
#> GSM553597 4 0.3051 0.8030 0.088 0.000 0.028 0.884
#> GSM553598 3 0.0592 0.8437 0.000 0.000 0.984 0.016
#> GSM553599 1 0.4569 0.7808 0.760 0.008 0.012 0.220
#> GSM553600 1 0.0707 0.8324 0.980 0.000 0.000 0.020
#> GSM553601 1 0.5649 0.4403 0.580 0.004 0.020 0.396
#> GSM553602 1 0.1557 0.8388 0.944 0.000 0.000 0.056
#> GSM553603 4 0.2843 0.8265 0.088 0.000 0.020 0.892
#> GSM553604 4 0.2593 0.8033 0.104 0.004 0.000 0.892
#> GSM553605 3 0.0937 0.8509 0.000 0.012 0.976 0.012
#> GSM553606 3 0.2376 0.8244 0.000 0.068 0.916 0.016
#> GSM553607 3 0.5730 0.4358 0.000 0.344 0.616 0.040
#> GSM553608 2 0.1256 0.9572 0.000 0.964 0.008 0.028
#> GSM553609 2 0.1284 0.9493 0.000 0.964 0.024 0.012
#> GSM553610 3 0.1854 0.8354 0.000 0.048 0.940 0.012
#> GSM553611 2 0.0524 0.9531 0.000 0.988 0.004 0.008
#> GSM553612 2 0.1256 0.9572 0.000 0.964 0.008 0.028
#> GSM553613 3 0.1109 0.8457 0.000 0.028 0.968 0.004
#> GSM553614 1 0.4153 0.7629 0.784 0.004 0.008 0.204
#> GSM553615 1 0.2234 0.8270 0.924 0.008 0.004 0.064
#> GSM553616 1 0.3672 0.8198 0.848 0.012 0.012 0.128
#> GSM553617 1 0.3950 0.8132 0.820 0.008 0.012 0.160
#> GSM553618 3 0.5962 0.6034 0.032 0.028 0.676 0.264
#> GSM553619 3 0.6008 0.6081 0.036 0.024 0.668 0.272
#> GSM553620 4 0.5060 0.2686 0.412 0.004 0.000 0.584
#> GSM553621 1 0.5039 0.2926 0.592 0.004 0.000 0.404
#> GSM553622 1 0.1022 0.8303 0.968 0.000 0.000 0.032
#> GSM553623 1 0.4218 0.8099 0.796 0.008 0.012 0.184
#> GSM553624 1 0.3933 0.8265 0.828 0.012 0.012 0.148
#> GSM553625 1 0.4294 0.7773 0.780 0.008 0.008 0.204
#> GSM553626 1 0.1661 0.8385 0.944 0.004 0.000 0.052
#> GSM553627 1 0.3583 0.8121 0.816 0.004 0.000 0.180
#> GSM553628 1 0.1661 0.8385 0.944 0.004 0.000 0.052
#> GSM553629 1 0.2441 0.8177 0.920 0.020 0.004 0.056
#> GSM553630 4 0.5281 -0.0101 0.464 0.008 0.000 0.528
#> GSM553631 1 0.4007 0.8208 0.836 0.024 0.012 0.128
#> GSM553632 1 0.1661 0.8385 0.944 0.004 0.000 0.052
#> GSM553633 3 0.4837 0.4367 0.000 0.004 0.648 0.348
#> GSM553634 2 0.0188 0.9490 0.000 0.996 0.004 0.000
#> GSM553635 2 0.0524 0.9477 0.000 0.988 0.008 0.004
#> GSM553636 2 0.1909 0.9456 0.004 0.940 0.008 0.048
#> GSM553637 2 0.4716 0.6819 0.000 0.764 0.196 0.040
#> GSM553638 2 0.1356 0.9571 0.000 0.960 0.008 0.032
#> GSM553639 2 0.1822 0.9476 0.004 0.944 0.008 0.044
#> GSM553640 2 0.1369 0.9365 0.016 0.964 0.004 0.016
#> GSM553641 3 0.0937 0.8509 0.000 0.012 0.976 0.012
#> GSM553642 4 0.2741 0.8232 0.096 0.000 0.012 0.892
#> GSM553643 4 0.2797 0.8261 0.068 0.000 0.032 0.900
#> GSM553644 4 0.2741 0.8232 0.096 0.000 0.012 0.892
#> GSM553645 4 0.4761 0.4317 0.000 0.004 0.332 0.664
#> GSM553646 4 0.2943 0.8281 0.076 0.000 0.032 0.892
#> GSM553647 4 0.2915 0.8280 0.080 0.000 0.028 0.892
#> GSM553648 3 0.0937 0.8509 0.000 0.012 0.976 0.012
#> GSM553649 3 0.0937 0.8509 0.000 0.012 0.976 0.012
#> GSM553650 2 0.1356 0.9571 0.000 0.960 0.008 0.032
#> GSM553651 2 0.1909 0.9456 0.004 0.940 0.008 0.048
#> GSM553652 2 0.1356 0.9571 0.000 0.960 0.008 0.032
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> GSM553595 5 0.3237 0.3491 0.008 0.004 0.008 0.140 0.840
#> GSM553596 5 0.2213 0.4482 0.004 0.004 0.024 0.048 0.920
#> GSM553597 5 0.3366 0.3004 0.004 0.000 0.000 0.212 0.784
#> GSM553598 3 0.4009 0.5347 0.000 0.000 0.684 0.004 0.312
#> GSM553599 1 0.5402 0.6153 0.612 0.004 0.000 0.068 0.316
#> GSM553600 1 0.2674 0.7015 0.856 0.000 0.000 0.140 0.004
#> GSM553601 5 0.5477 -0.2423 0.396 0.004 0.000 0.056 0.544
#> GSM553602 1 0.1549 0.7386 0.944 0.000 0.000 0.040 0.016
#> GSM553603 4 0.5987 0.6013 0.060 0.004 0.016 0.520 0.400
#> GSM553604 4 0.5809 0.5901 0.084 0.004 0.000 0.528 0.384
#> GSM553605 3 0.0963 0.7702 0.000 0.000 0.964 0.000 0.036
#> GSM553606 3 0.2941 0.7294 0.000 0.032 0.884 0.064 0.020
#> GSM553607 3 0.6906 0.2921 0.000 0.312 0.508 0.140 0.040
#> GSM553608 2 0.0162 0.9407 0.000 0.996 0.000 0.000 0.004
#> GSM553609 2 0.2238 0.8803 0.000 0.912 0.020 0.064 0.004
#> GSM553610 3 0.2504 0.7358 0.000 0.032 0.900 0.064 0.004
#> GSM553611 2 0.0162 0.9397 0.000 0.996 0.000 0.004 0.000
#> GSM553612 2 0.0162 0.9407 0.000 0.996 0.000 0.000 0.004
#> GSM553613 3 0.0290 0.7661 0.000 0.000 0.992 0.000 0.008
#> GSM553614 4 0.6719 -0.4776 0.372 0.000 0.000 0.380 0.248
#> GSM553615 1 0.0404 0.7416 0.988 0.000 0.000 0.000 0.012
#> GSM553616 1 0.6647 0.4948 0.424 0.000 0.000 0.344 0.232
#> GSM553617 1 0.6139 0.6185 0.556 0.000 0.000 0.184 0.260
#> GSM553618 5 0.5377 0.2866 0.004 0.004 0.268 0.072 0.652
#> GSM553619 5 0.5584 0.2652 0.004 0.004 0.268 0.088 0.636
#> GSM553620 4 0.4155 0.3644 0.144 0.000 0.000 0.780 0.076
#> GSM553621 4 0.3812 0.3282 0.204 0.000 0.000 0.772 0.024
#> GSM553622 1 0.3790 0.5992 0.724 0.000 0.000 0.272 0.004
#> GSM553623 1 0.5341 0.6348 0.620 0.000 0.000 0.080 0.300
#> GSM553624 1 0.4863 0.6881 0.716 0.008 0.000 0.064 0.212
#> GSM553625 1 0.5010 0.6615 0.688 0.000 0.000 0.088 0.224
#> GSM553626 1 0.0324 0.7405 0.992 0.000 0.000 0.004 0.004
#> GSM553627 1 0.4958 0.5614 0.692 0.000 0.000 0.224 0.084
#> GSM553628 1 0.0162 0.7405 0.996 0.000 0.000 0.004 0.000
#> GSM553629 1 0.1728 0.7306 0.940 0.004 0.000 0.036 0.020
#> GSM553630 4 0.5600 0.3780 0.316 0.000 0.000 0.588 0.096
#> GSM553631 1 0.5855 0.6003 0.616 0.004 0.000 0.148 0.232
#> GSM553632 1 0.0162 0.7405 0.996 0.000 0.000 0.004 0.000
#> GSM553633 5 0.5003 0.0778 0.000 0.000 0.424 0.032 0.544
#> GSM553634 2 0.0771 0.9335 0.004 0.976 0.000 0.020 0.000
#> GSM553635 2 0.0703 0.9329 0.000 0.976 0.000 0.024 0.000
#> GSM553636 2 0.0865 0.9336 0.000 0.972 0.000 0.004 0.024
#> GSM553637 2 0.6918 0.2004 0.000 0.504 0.316 0.140 0.040
#> GSM553638 2 0.0162 0.9407 0.000 0.996 0.000 0.000 0.004
#> GSM553639 2 0.0609 0.9362 0.000 0.980 0.000 0.000 0.020
#> GSM553640 2 0.2263 0.9011 0.036 0.920 0.000 0.024 0.020
#> GSM553641 3 0.2424 0.7549 0.000 0.000 0.868 0.000 0.132
#> GSM553642 4 0.6003 0.6164 0.064 0.004 0.016 0.536 0.380
#> GSM553643 4 0.5973 0.6105 0.060 0.004 0.016 0.528 0.392
#> GSM553644 4 0.6003 0.6164 0.064 0.004 0.016 0.536 0.380
#> GSM553645 5 0.5813 0.2046 0.008 0.004 0.144 0.192 0.652
#> GSM553646 4 0.5958 0.6132 0.060 0.004 0.016 0.536 0.384
#> GSM553647 4 0.5973 0.6105 0.060 0.004 0.016 0.528 0.392
#> GSM553648 3 0.2674 0.7487 0.000 0.000 0.856 0.004 0.140
#> GSM553649 3 0.2629 0.7516 0.000 0.000 0.860 0.004 0.136
#> GSM553650 2 0.0162 0.9407 0.000 0.996 0.000 0.000 0.004
#> GSM553651 2 0.0865 0.9336 0.000 0.972 0.000 0.004 0.024
#> GSM553652 2 0.0162 0.9407 0.000 0.996 0.000 0.000 0.004
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> GSM553595 4 0.4241 0.5055 0.000 0.000 0.000 0.608 0.368 0.024
#> GSM553596 4 0.3810 0.6154 0.004 0.000 0.004 0.708 0.276 0.008
#> GSM553597 4 0.5426 0.5238 0.000 0.000 0.000 0.556 0.292 0.152
#> GSM553598 3 0.3717 0.3455 0.000 0.000 0.616 0.384 0.000 0.000
#> GSM553599 1 0.7065 0.0527 0.388 0.000 0.000 0.312 0.080 0.220
#> GSM553600 1 0.3525 0.4609 0.784 0.000 0.000 0.032 0.004 0.180
#> GSM553601 4 0.7342 -0.0151 0.216 0.000 0.000 0.420 0.184 0.180
#> GSM553602 1 0.2649 0.5621 0.884 0.000 0.000 0.048 0.016 0.052
#> GSM553603 5 0.0458 0.8209 0.000 0.000 0.000 0.016 0.984 0.000
#> GSM553604 5 0.2868 0.6816 0.004 0.000 0.000 0.032 0.852 0.112
#> GSM553605 3 0.0363 0.6931 0.000 0.000 0.988 0.000 0.000 0.012
#> GSM553606 3 0.5311 0.5641 0.000 0.020 0.628 0.104 0.000 0.248
#> GSM553607 3 0.7691 0.2354 0.000 0.224 0.296 0.216 0.000 0.264
#> GSM553608 2 0.0146 0.9084 0.000 0.996 0.000 0.000 0.004 0.000
#> GSM553609 2 0.4203 0.6515 0.000 0.716 0.000 0.068 0.000 0.216
#> GSM553610 3 0.4788 0.5835 0.000 0.012 0.668 0.072 0.000 0.248
#> GSM553611 2 0.1007 0.9052 0.004 0.968 0.000 0.016 0.004 0.008
#> GSM553612 2 0.0146 0.9084 0.000 0.996 0.000 0.000 0.004 0.000
#> GSM553613 3 0.0777 0.6909 0.000 0.000 0.972 0.004 0.000 0.024
#> GSM553614 6 0.5886 0.4353 0.108 0.000 0.000 0.232 0.060 0.600
#> GSM553615 1 0.0951 0.5942 0.968 0.000 0.000 0.020 0.004 0.008
#> GSM553616 6 0.5733 0.3914 0.176 0.000 0.000 0.192 0.028 0.604
#> GSM553617 6 0.6899 -0.0887 0.324 0.000 0.000 0.288 0.048 0.340
#> GSM553618 4 0.3194 0.5471 0.008 0.000 0.132 0.828 0.032 0.000
#> GSM553619 4 0.3326 0.5371 0.004 0.004 0.132 0.828 0.024 0.008
#> GSM553620 6 0.5522 0.3045 0.044 0.000 0.000 0.048 0.384 0.524
#> GSM553621 6 0.5383 0.3258 0.092 0.000 0.000 0.008 0.376 0.524
#> GSM553622 1 0.4210 0.2396 0.644 0.000 0.000 0.016 0.008 0.332
#> GSM553623 1 0.7042 0.0514 0.388 0.000 0.000 0.312 0.076 0.224
#> GSM553624 1 0.6608 0.2439 0.524 0.004 0.000 0.188 0.064 0.220
#> GSM553625 1 0.6817 0.2122 0.504 0.000 0.000 0.184 0.108 0.204
#> GSM553626 1 0.0405 0.5978 0.988 0.000 0.000 0.004 0.008 0.000
#> GSM553627 1 0.6766 0.1397 0.472 0.000 0.000 0.072 0.264 0.192
#> GSM553628 1 0.0260 0.5975 0.992 0.000 0.000 0.000 0.008 0.000
#> GSM553629 1 0.1536 0.5829 0.940 0.000 0.000 0.040 0.004 0.016
#> GSM553630 5 0.5553 0.0677 0.240 0.000 0.000 0.008 0.584 0.168
#> GSM553631 1 0.5345 0.2873 0.560 0.000 0.000 0.352 0.024 0.064
#> GSM553632 1 0.0405 0.5964 0.988 0.000 0.000 0.000 0.008 0.004
#> GSM553633 3 0.5834 -0.0970 0.000 0.000 0.424 0.388 0.188 0.000
#> GSM553634 2 0.1138 0.8966 0.004 0.960 0.000 0.012 0.000 0.024
#> GSM553635 2 0.1863 0.8750 0.000 0.920 0.000 0.044 0.000 0.036
#> GSM553636 2 0.1109 0.9021 0.004 0.964 0.000 0.016 0.004 0.012
#> GSM553637 2 0.7398 0.0670 0.000 0.380 0.140 0.216 0.000 0.264
#> GSM553638 2 0.0146 0.9084 0.000 0.996 0.000 0.000 0.004 0.000
#> GSM553639 2 0.0551 0.9057 0.000 0.984 0.000 0.004 0.004 0.008
#> GSM553640 2 0.2989 0.8399 0.072 0.864 0.000 0.028 0.000 0.036
#> GSM553641 3 0.1141 0.6921 0.000 0.000 0.948 0.052 0.000 0.000
#> GSM553642 5 0.0260 0.8226 0.000 0.000 0.000 0.000 0.992 0.008
#> GSM553643 5 0.0363 0.8234 0.000 0.000 0.000 0.012 0.988 0.000
#> GSM553644 5 0.0260 0.8226 0.000 0.000 0.000 0.000 0.992 0.008
#> GSM553645 5 0.5352 0.1841 0.000 0.000 0.144 0.236 0.612 0.008
#> GSM553646 5 0.0146 0.8233 0.000 0.000 0.000 0.000 0.996 0.004
#> GSM553647 5 0.0363 0.8234 0.000 0.000 0.000 0.012 0.988 0.000
#> GSM553648 3 0.1327 0.6879 0.000 0.000 0.936 0.064 0.000 0.000
#> GSM553649 3 0.1141 0.6921 0.000 0.000 0.948 0.052 0.000 0.000
#> GSM553650 2 0.0146 0.9084 0.000 0.996 0.000 0.000 0.004 0.000
#> GSM553651 2 0.0964 0.9030 0.000 0.968 0.000 0.016 0.004 0.012
#> GSM553652 2 0.0146 0.9084 0.000 0.996 0.000 0.000 0.004 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 individual(p) k
#> SD:kmeans 55 0.101326 2
#> SD:kmeans 53 0.121742 3
#> SD:kmeans 51 0.001224 4
#> SD:kmeans 43 0.000407 5
#> SD:kmeans 38 0.009544 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 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.964 0.943 0.977 0.5075 0.494 0.494
#> 3 3 0.951 0.915 0.969 0.3184 0.753 0.540
#> 4 4 0.886 0.888 0.949 0.1261 0.828 0.538
#> 5 5 0.778 0.688 0.847 0.0591 0.947 0.791
#> 6 6 0.758 0.618 0.788 0.0396 0.981 0.910
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
#> GSM553595 1 0.9286 0.493 0.656 0.344
#> GSM553596 2 0.2236 0.949 0.036 0.964
#> GSM553597 1 0.0000 0.969 1.000 0.000
#> GSM553598 2 0.0000 0.982 0.000 1.000
#> GSM553599 1 0.0000 0.969 1.000 0.000
#> GSM553600 1 0.0000 0.969 1.000 0.000
#> GSM553601 1 0.0000 0.969 1.000 0.000
#> GSM553602 1 0.0000 0.969 1.000 0.000
#> GSM553603 1 0.0376 0.966 0.996 0.004
#> GSM553604 1 0.0000 0.969 1.000 0.000
#> GSM553605 2 0.0000 0.982 0.000 1.000
#> GSM553606 2 0.0000 0.982 0.000 1.000
#> GSM553607 2 0.0000 0.982 0.000 1.000
#> GSM553608 2 0.0000 0.982 0.000 1.000
#> GSM553609 2 0.0000 0.982 0.000 1.000
#> GSM553610 2 0.0000 0.982 0.000 1.000
#> GSM553611 2 0.0000 0.982 0.000 1.000
#> GSM553612 2 0.0000 0.982 0.000 1.000
#> GSM553613 2 0.0000 0.982 0.000 1.000
#> GSM553614 1 0.0000 0.969 1.000 0.000
#> GSM553615 1 0.0000 0.969 1.000 0.000
#> GSM553616 1 0.0000 0.969 1.000 0.000
#> GSM553617 1 0.0000 0.969 1.000 0.000
#> GSM553618 2 0.0000 0.982 0.000 1.000
#> GSM553619 1 0.9732 0.350 0.596 0.404
#> GSM553620 1 0.0000 0.969 1.000 0.000
#> GSM553621 1 0.0000 0.969 1.000 0.000
#> GSM553622 1 0.0000 0.969 1.000 0.000
#> GSM553623 1 0.0000 0.969 1.000 0.000
#> GSM553624 1 0.0000 0.969 1.000 0.000
#> GSM553625 1 0.0000 0.969 1.000 0.000
#> GSM553626 1 0.0000 0.969 1.000 0.000
#> GSM553627 1 0.0000 0.969 1.000 0.000
#> GSM553628 1 0.0000 0.969 1.000 0.000
#> GSM553629 1 0.0000 0.969 1.000 0.000
#> GSM553630 1 0.0000 0.969 1.000 0.000
#> GSM553631 1 0.0000 0.969 1.000 0.000
#> GSM553632 1 0.0000 0.969 1.000 0.000
#> GSM553633 2 0.0000 0.982 0.000 1.000
#> GSM553634 2 0.0000 0.982 0.000 1.000
#> GSM553635 2 0.0000 0.982 0.000 1.000
#> GSM553636 2 0.2778 0.938 0.048 0.952
#> GSM553637 2 0.0000 0.982 0.000 1.000
#> GSM553638 2 0.0000 0.982 0.000 1.000
#> GSM553639 2 0.0000 0.982 0.000 1.000
#> GSM553640 2 0.9286 0.468 0.344 0.656
#> GSM553641 2 0.0000 0.982 0.000 1.000
#> GSM553642 1 0.0000 0.969 1.000 0.000
#> GSM553643 1 0.6048 0.816 0.852 0.148
#> GSM553644 1 0.0000 0.969 1.000 0.000
#> GSM553645 2 0.0000 0.982 0.000 1.000
#> GSM553646 1 0.0000 0.969 1.000 0.000
#> GSM553647 1 0.0938 0.959 0.988 0.012
#> GSM553648 2 0.0000 0.982 0.000 1.000
#> GSM553649 2 0.0000 0.982 0.000 1.000
#> GSM553650 2 0.0000 0.982 0.000 1.000
#> GSM553651 2 0.1184 0.969 0.016 0.984
#> GSM553652 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
#> GSM553595 3 0.000 0.957 0.000 0.000 1.000
#> GSM553596 3 0.000 0.957 0.000 0.000 1.000
#> GSM553597 3 0.319 0.845 0.112 0.000 0.888
#> GSM553598 3 0.000 0.957 0.000 0.000 1.000
#> GSM553599 1 0.000 0.947 1.000 0.000 0.000
#> GSM553600 1 0.000 0.947 1.000 0.000 0.000
#> GSM553601 1 0.455 0.720 0.800 0.000 0.200
#> GSM553602 1 0.000 0.947 1.000 0.000 0.000
#> GSM553603 3 0.622 0.161 0.432 0.000 0.568
#> GSM553604 1 0.000 0.947 1.000 0.000 0.000
#> GSM553605 3 0.000 0.957 0.000 0.000 1.000
#> GSM553606 2 0.000 0.997 0.000 1.000 0.000
#> GSM553607 2 0.000 0.997 0.000 1.000 0.000
#> GSM553608 2 0.000 0.997 0.000 1.000 0.000
#> GSM553609 2 0.000 0.997 0.000 1.000 0.000
#> GSM553610 2 0.000 0.997 0.000 1.000 0.000
#> GSM553611 2 0.000 0.997 0.000 1.000 0.000
#> GSM553612 2 0.000 0.997 0.000 1.000 0.000
#> GSM553613 3 0.245 0.885 0.000 0.076 0.924
#> GSM553614 1 0.000 0.947 1.000 0.000 0.000
#> GSM553615 1 0.000 0.947 1.000 0.000 0.000
#> GSM553616 1 0.000 0.947 1.000 0.000 0.000
#> GSM553617 1 0.000 0.947 1.000 0.000 0.000
#> GSM553618 3 0.000 0.957 0.000 0.000 1.000
#> GSM553619 3 0.000 0.957 0.000 0.000 1.000
#> GSM553620 1 0.000 0.947 1.000 0.000 0.000
#> GSM553621 1 0.000 0.947 1.000 0.000 0.000
#> GSM553622 1 0.000 0.947 1.000 0.000 0.000
#> GSM553623 1 0.000 0.947 1.000 0.000 0.000
#> GSM553624 1 0.000 0.947 1.000 0.000 0.000
#> GSM553625 1 0.000 0.947 1.000 0.000 0.000
#> GSM553626 1 0.000 0.947 1.000 0.000 0.000
#> GSM553627 1 0.000 0.947 1.000 0.000 0.000
#> GSM553628 1 0.000 0.947 1.000 0.000 0.000
#> GSM553629 1 0.000 0.947 1.000 0.000 0.000
#> GSM553630 1 0.000 0.947 1.000 0.000 0.000
#> GSM553631 1 0.000 0.947 1.000 0.000 0.000
#> GSM553632 1 0.000 0.947 1.000 0.000 0.000
#> GSM553633 3 0.000 0.957 0.000 0.000 1.000
#> GSM553634 2 0.000 0.997 0.000 1.000 0.000
#> GSM553635 2 0.000 0.997 0.000 1.000 0.000
#> GSM553636 2 0.000 0.997 0.000 1.000 0.000
#> GSM553637 2 0.000 0.997 0.000 1.000 0.000
#> GSM553638 2 0.000 0.997 0.000 1.000 0.000
#> GSM553639 2 0.000 0.997 0.000 1.000 0.000
#> GSM553640 2 0.164 0.951 0.044 0.956 0.000
#> GSM553641 3 0.000 0.957 0.000 0.000 1.000
#> GSM553642 1 0.629 0.135 0.536 0.000 0.464
#> GSM553643 3 0.000 0.957 0.000 0.000 1.000
#> GSM553644 1 0.629 0.135 0.536 0.000 0.464
#> GSM553645 3 0.000 0.957 0.000 0.000 1.000
#> GSM553646 3 0.000 0.957 0.000 0.000 1.000
#> GSM553647 3 0.000 0.957 0.000 0.000 1.000
#> GSM553648 3 0.000 0.957 0.000 0.000 1.000
#> GSM553649 3 0.000 0.957 0.000 0.000 1.000
#> GSM553650 2 0.000 0.997 0.000 1.000 0.000
#> GSM553651 2 0.000 0.997 0.000 1.000 0.000
#> GSM553652 2 0.000 0.997 0.000 1.000 0.000
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> GSM553595 4 0.3172 0.726 0.000 0.000 0.160 0.840
#> GSM553596 3 0.0336 0.899 0.000 0.000 0.992 0.008
#> GSM553597 4 0.0524 0.872 0.004 0.000 0.008 0.988
#> GSM553598 3 0.0336 0.901 0.000 0.000 0.992 0.008
#> GSM553599 1 0.0336 0.978 0.992 0.000 0.000 0.008
#> GSM553600 1 0.0000 0.980 1.000 0.000 0.000 0.000
#> GSM553601 1 0.3831 0.717 0.792 0.000 0.004 0.204
#> GSM553602 1 0.0000 0.980 1.000 0.000 0.000 0.000
#> GSM553603 4 0.0376 0.875 0.004 0.000 0.004 0.992
#> GSM553604 4 0.0469 0.871 0.012 0.000 0.000 0.988
#> GSM553605 3 0.0336 0.901 0.000 0.000 0.992 0.008
#> GSM553606 3 0.3528 0.747 0.000 0.192 0.808 0.000
#> GSM553607 3 0.4933 0.257 0.000 0.432 0.568 0.000
#> GSM553608 2 0.0000 0.979 0.000 1.000 0.000 0.000
#> GSM553609 2 0.0000 0.979 0.000 1.000 0.000 0.000
#> GSM553610 3 0.3219 0.779 0.000 0.164 0.836 0.000
#> GSM553611 2 0.0000 0.979 0.000 1.000 0.000 0.000
#> GSM553612 2 0.0000 0.979 0.000 1.000 0.000 0.000
#> GSM553613 3 0.0336 0.901 0.000 0.000 0.992 0.008
#> GSM553614 1 0.0779 0.970 0.980 0.000 0.004 0.016
#> GSM553615 1 0.0336 0.977 0.992 0.000 0.008 0.000
#> GSM553616 1 0.0188 0.979 0.996 0.000 0.000 0.004
#> GSM553617 1 0.0188 0.979 0.996 0.000 0.000 0.004
#> GSM553618 3 0.0188 0.898 0.000 0.000 0.996 0.004
#> GSM553619 3 0.0188 0.898 0.000 0.000 0.996 0.004
#> GSM553620 4 0.4522 0.607 0.320 0.000 0.000 0.680
#> GSM553621 4 0.4585 0.590 0.332 0.000 0.000 0.668
#> GSM553622 1 0.0000 0.980 1.000 0.000 0.000 0.000
#> GSM553623 1 0.0188 0.979 0.996 0.000 0.000 0.004
#> GSM553624 1 0.0188 0.979 0.996 0.000 0.000 0.004
#> GSM553625 1 0.0592 0.971 0.984 0.000 0.000 0.016
#> GSM553626 1 0.0000 0.980 1.000 0.000 0.000 0.000
#> GSM553627 1 0.0707 0.971 0.980 0.000 0.000 0.020
#> GSM553628 1 0.0000 0.980 1.000 0.000 0.000 0.000
#> GSM553629 1 0.0336 0.977 0.992 0.000 0.008 0.000
#> GSM553630 4 0.4522 0.608 0.320 0.000 0.000 0.680
#> GSM553631 1 0.0524 0.975 0.988 0.000 0.008 0.004
#> GSM553632 1 0.0000 0.980 1.000 0.000 0.000 0.000
#> GSM553633 3 0.0336 0.901 0.000 0.000 0.992 0.008
#> GSM553634 2 0.0188 0.977 0.000 0.996 0.004 0.000
#> GSM553635 2 0.0000 0.979 0.000 1.000 0.000 0.000
#> GSM553636 2 0.0000 0.979 0.000 1.000 0.000 0.000
#> GSM553637 2 0.3873 0.676 0.000 0.772 0.228 0.000
#> GSM553638 2 0.0000 0.979 0.000 1.000 0.000 0.000
#> GSM553639 2 0.0000 0.979 0.000 1.000 0.000 0.000
#> GSM553640 2 0.0524 0.970 0.008 0.988 0.004 0.000
#> GSM553641 3 0.0336 0.901 0.000 0.000 0.992 0.008
#> GSM553642 4 0.0376 0.875 0.004 0.000 0.004 0.992
#> GSM553643 4 0.0336 0.873 0.000 0.000 0.008 0.992
#> GSM553644 4 0.0376 0.875 0.004 0.000 0.004 0.992
#> GSM553645 3 0.4564 0.489 0.000 0.000 0.672 0.328
#> GSM553646 4 0.0336 0.873 0.000 0.000 0.008 0.992
#> GSM553647 4 0.0336 0.873 0.000 0.000 0.008 0.992
#> GSM553648 3 0.0336 0.901 0.000 0.000 0.992 0.008
#> GSM553649 3 0.0336 0.901 0.000 0.000 0.992 0.008
#> GSM553650 2 0.0000 0.979 0.000 1.000 0.000 0.000
#> GSM553651 2 0.0000 0.979 0.000 1.000 0.000 0.000
#> GSM553652 2 0.0000 0.979 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
#> GSM553595 5 0.6130 0.00535 0.000 0.000 0.128 0.424 0.448
#> GSM553596 3 0.4182 0.53880 0.000 0.000 0.600 0.000 0.400
#> GSM553597 5 0.3796 0.30999 0.000 0.000 0.000 0.300 0.700
#> GSM553598 3 0.2471 0.79956 0.000 0.000 0.864 0.000 0.136
#> GSM553599 1 0.3857 0.67080 0.688 0.000 0.000 0.000 0.312
#> GSM553600 1 0.1908 0.80145 0.908 0.000 0.000 0.000 0.092
#> GSM553601 1 0.4666 0.64725 0.676 0.000 0.000 0.040 0.284
#> GSM553602 1 0.1965 0.79855 0.904 0.000 0.000 0.000 0.096
#> GSM553603 4 0.0000 0.74404 0.000 0.000 0.000 1.000 0.000
#> GSM553604 4 0.0703 0.72548 0.000 0.000 0.000 0.976 0.024
#> GSM553605 3 0.0000 0.84213 0.000 0.000 1.000 0.000 0.000
#> GSM553606 3 0.3085 0.75367 0.000 0.116 0.852 0.000 0.032
#> GSM553607 3 0.5309 0.36727 0.000 0.364 0.576 0.000 0.060
#> GSM553608 2 0.0000 0.95501 0.000 1.000 0.000 0.000 0.000
#> GSM553609 2 0.0963 0.94294 0.000 0.964 0.000 0.000 0.036
#> GSM553610 3 0.2473 0.79058 0.000 0.072 0.896 0.000 0.032
#> GSM553611 2 0.0290 0.95300 0.000 0.992 0.000 0.000 0.008
#> GSM553612 2 0.0000 0.95501 0.000 1.000 0.000 0.000 0.000
#> GSM553613 3 0.0000 0.84213 0.000 0.000 1.000 0.000 0.000
#> GSM553614 5 0.4327 0.19773 0.360 0.000 0.000 0.008 0.632
#> GSM553615 1 0.0290 0.80699 0.992 0.000 0.000 0.000 0.008
#> GSM553616 5 0.4045 0.05481 0.356 0.000 0.000 0.000 0.644
#> GSM553617 1 0.4182 0.54572 0.600 0.000 0.000 0.000 0.400
#> GSM553618 3 0.3210 0.75684 0.000 0.000 0.788 0.000 0.212
#> GSM553619 3 0.3774 0.68830 0.000 0.000 0.704 0.000 0.296
#> GSM553620 5 0.5931 0.07999 0.104 0.000 0.000 0.436 0.460
#> GSM553621 4 0.6372 -0.29697 0.164 0.000 0.000 0.428 0.408
#> GSM553622 1 0.2690 0.75371 0.844 0.000 0.000 0.000 0.156
#> GSM553623 1 0.3837 0.67483 0.692 0.000 0.000 0.000 0.308
#> GSM553624 1 0.2605 0.76978 0.852 0.000 0.000 0.000 0.148
#> GSM553625 1 0.2628 0.75634 0.884 0.000 0.000 0.028 0.088
#> GSM553626 1 0.0000 0.80907 1.000 0.000 0.000 0.000 0.000
#> GSM553627 1 0.2504 0.79757 0.896 0.000 0.000 0.040 0.064
#> GSM553628 1 0.0000 0.80907 1.000 0.000 0.000 0.000 0.000
#> GSM553629 1 0.1851 0.77215 0.912 0.000 0.000 0.000 0.088
#> GSM553630 4 0.6341 -0.05484 0.256 0.000 0.000 0.524 0.220
#> GSM553631 1 0.3774 0.47205 0.704 0.000 0.000 0.000 0.296
#> GSM553632 1 0.0000 0.80907 1.000 0.000 0.000 0.000 0.000
#> GSM553633 3 0.0992 0.83498 0.000 0.000 0.968 0.008 0.024
#> GSM553634 2 0.1043 0.94250 0.000 0.960 0.000 0.000 0.040
#> GSM553635 2 0.1197 0.93796 0.000 0.952 0.000 0.000 0.048
#> GSM553636 2 0.0404 0.95127 0.000 0.988 0.000 0.000 0.012
#> GSM553637 2 0.4674 0.61355 0.000 0.708 0.232 0.000 0.060
#> GSM553638 2 0.0162 0.95490 0.000 0.996 0.000 0.000 0.004
#> GSM553639 2 0.0000 0.95501 0.000 1.000 0.000 0.000 0.000
#> GSM553640 2 0.2914 0.85024 0.076 0.872 0.000 0.000 0.052
#> GSM553641 3 0.0000 0.84213 0.000 0.000 1.000 0.000 0.000
#> GSM553642 4 0.0000 0.74404 0.000 0.000 0.000 1.000 0.000
#> GSM553643 4 0.0000 0.74404 0.000 0.000 0.000 1.000 0.000
#> GSM553644 4 0.0000 0.74404 0.000 0.000 0.000 1.000 0.000
#> GSM553645 4 0.4425 0.12998 0.000 0.000 0.452 0.544 0.004
#> GSM553646 4 0.0000 0.74404 0.000 0.000 0.000 1.000 0.000
#> GSM553647 4 0.0000 0.74404 0.000 0.000 0.000 1.000 0.000
#> GSM553648 3 0.0000 0.84213 0.000 0.000 1.000 0.000 0.000
#> GSM553649 3 0.0000 0.84213 0.000 0.000 1.000 0.000 0.000
#> GSM553650 2 0.0162 0.95490 0.000 0.996 0.000 0.000 0.004
#> GSM553651 2 0.0290 0.95300 0.000 0.992 0.000 0.000 0.008
#> GSM553652 2 0.0162 0.95486 0.000 0.996 0.000 0.000 0.004
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> GSM553595 4 0.6829 0.26507 0.000 0.000 0.208 0.508 0.128 NA
#> GSM553596 4 0.6148 0.00734 0.000 0.000 0.320 0.460 0.012 NA
#> GSM553597 4 0.3693 0.51534 0.000 0.000 0.000 0.788 0.092 NA
#> GSM553598 3 0.4308 0.57273 0.000 0.000 0.728 0.152 0.000 NA
#> GSM553599 1 0.5721 0.47819 0.480 0.000 0.000 0.148 0.004 NA
#> GSM553600 1 0.2509 0.71969 0.876 0.000 0.000 0.088 0.000 NA
#> GSM553601 1 0.6272 0.43596 0.464 0.000 0.008 0.148 0.020 NA
#> GSM553602 1 0.2393 0.72477 0.892 0.000 0.000 0.064 0.004 NA
#> GSM553603 5 0.0146 0.80990 0.000 0.000 0.004 0.000 0.996 NA
#> GSM553604 5 0.1850 0.74706 0.008 0.000 0.000 0.016 0.924 NA
#> GSM553605 3 0.0000 0.73337 0.000 0.000 1.000 0.000 0.000 NA
#> GSM553606 3 0.4354 0.57153 0.000 0.068 0.692 0.000 0.000 NA
#> GSM553607 3 0.6107 0.24351 0.000 0.228 0.388 0.004 0.000 NA
#> GSM553608 2 0.0146 0.88893 0.000 0.996 0.000 0.004 0.000 NA
#> GSM553609 2 0.2823 0.79357 0.000 0.796 0.000 0.000 0.000 NA
#> GSM553610 3 0.3830 0.60942 0.000 0.044 0.744 0.000 0.000 NA
#> GSM553611 2 0.0717 0.88658 0.000 0.976 0.000 0.008 0.000 NA
#> GSM553612 2 0.0363 0.88947 0.000 0.988 0.000 0.000 0.000 NA
#> GSM553613 3 0.0458 0.72962 0.000 0.000 0.984 0.000 0.000 NA
#> GSM553614 4 0.3460 0.46313 0.164 0.000 0.000 0.796 0.004 NA
#> GSM553615 1 0.1088 0.72235 0.960 0.000 0.000 0.016 0.000 NA
#> GSM553616 4 0.4488 0.36554 0.164 0.000 0.000 0.708 0.000 NA
#> GSM553617 1 0.6104 0.30367 0.364 0.000 0.000 0.288 0.000 NA
#> GSM553618 3 0.5636 0.38169 0.000 0.000 0.520 0.180 0.000 NA
#> GSM553619 3 0.6086 0.15863 0.000 0.000 0.376 0.276 0.000 NA
#> GSM553620 4 0.5216 0.36433 0.088 0.000 0.000 0.600 0.300 NA
#> GSM553621 4 0.5765 0.32609 0.136 0.000 0.000 0.540 0.308 NA
#> GSM553622 1 0.3078 0.66612 0.796 0.000 0.000 0.192 0.000 NA
#> GSM553623 1 0.5700 0.47884 0.480 0.000 0.000 0.144 0.004 NA
#> GSM553624 1 0.3869 0.67267 0.768 0.012 0.000 0.040 0.000 NA
#> GSM553625 1 0.3150 0.68451 0.840 0.000 0.000 0.112 0.012 NA
#> GSM553626 1 0.0291 0.72905 0.992 0.000 0.000 0.004 0.000 NA
#> GSM553627 1 0.3416 0.71226 0.832 0.000 0.000 0.028 0.040 NA
#> GSM553628 1 0.0146 0.72889 0.996 0.000 0.000 0.000 0.000 NA
#> GSM553629 1 0.3518 0.62129 0.804 0.000 0.000 0.092 0.000 NA
#> GSM553630 5 0.6472 -0.17537 0.296 0.000 0.000 0.276 0.408 NA
#> GSM553631 1 0.5508 0.31888 0.564 0.000 0.000 0.224 0.000 NA
#> GSM553632 1 0.0146 0.72889 0.996 0.000 0.000 0.000 0.000 NA
#> GSM553633 3 0.2128 0.69319 0.000 0.000 0.908 0.032 0.004 NA
#> GSM553634 2 0.3171 0.80567 0.000 0.784 0.000 0.012 0.000 NA
#> GSM553635 2 0.3288 0.74950 0.000 0.724 0.000 0.000 0.000 NA
#> GSM553636 2 0.0972 0.87971 0.000 0.964 0.000 0.008 0.000 NA
#> GSM553637 2 0.5783 0.32362 0.000 0.448 0.180 0.000 0.000 NA
#> GSM553638 2 0.0363 0.88865 0.000 0.988 0.000 0.000 0.000 NA
#> GSM553639 2 0.0146 0.88893 0.000 0.996 0.000 0.004 0.000 NA
#> GSM553640 2 0.3797 0.79370 0.072 0.812 0.000 0.036 0.000 NA
#> GSM553641 3 0.0000 0.73337 0.000 0.000 1.000 0.000 0.000 NA
#> GSM553642 5 0.0146 0.80990 0.000 0.000 0.004 0.000 0.996 NA
#> GSM553643 5 0.0260 0.80734 0.000 0.000 0.008 0.000 0.992 NA
#> GSM553644 5 0.0146 0.80990 0.000 0.000 0.004 0.000 0.996 NA
#> GSM553645 5 0.4126 0.05008 0.000 0.000 0.480 0.004 0.512 NA
#> GSM553646 5 0.0146 0.80990 0.000 0.000 0.004 0.000 0.996 NA
#> GSM553647 5 0.0146 0.80990 0.000 0.000 0.004 0.000 0.996 NA
#> GSM553648 3 0.0000 0.73337 0.000 0.000 1.000 0.000 0.000 NA
#> GSM553649 3 0.0000 0.73337 0.000 0.000 1.000 0.000 0.000 NA
#> GSM553650 2 0.0000 0.88933 0.000 1.000 0.000 0.000 0.000 NA
#> GSM553651 2 0.0717 0.88468 0.000 0.976 0.000 0.008 0.000 NA
#> GSM553652 2 0.0713 0.88535 0.000 0.972 0.000 0.000 0.000 NA
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 individual(p) k
#> SD:skmeans 55 0.11582 2
#> SD:skmeans 55 0.00142 3
#> SD:skmeans 56 0.02495 4
#> SD:skmeans 48 0.00391 5
#> SD:skmeans 41 0.00443 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 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.859 0.898 0.957 0.4380 0.564 0.564
#> 3 3 0.717 0.889 0.938 0.5295 0.719 0.521
#> 4 4 0.690 0.677 0.845 0.1074 0.698 0.321
#> 5 5 0.792 0.813 0.892 0.0764 0.827 0.456
#> 6 6 0.846 0.833 0.916 0.0411 0.936 0.708
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
#> GSM553595 1 0.000 0.962 1.000 0.000
#> GSM553596 1 0.000 0.962 1.000 0.000
#> GSM553597 1 0.141 0.949 0.980 0.020
#> GSM553598 2 0.795 0.669 0.240 0.760
#> GSM553599 1 0.000 0.962 1.000 0.000
#> GSM553600 1 0.000 0.962 1.000 0.000
#> GSM553601 1 0.000 0.962 1.000 0.000
#> GSM553602 1 0.000 0.962 1.000 0.000
#> GSM553603 1 0.224 0.938 0.964 0.036
#> GSM553604 1 0.000 0.962 1.000 0.000
#> GSM553605 2 0.000 0.927 0.000 1.000
#> GSM553606 2 0.000 0.927 0.000 1.000
#> GSM553607 2 0.000 0.927 0.000 1.000
#> GSM553608 1 0.929 0.454 0.656 0.344
#> GSM553609 2 0.000 0.927 0.000 1.000
#> GSM553610 2 0.000 0.927 0.000 1.000
#> GSM553611 1 0.913 0.489 0.672 0.328
#> GSM553612 2 0.224 0.913 0.036 0.964
#> GSM553613 2 0.000 0.927 0.000 1.000
#> GSM553614 1 0.000 0.962 1.000 0.000
#> GSM553615 1 0.000 0.962 1.000 0.000
#> GSM553616 1 0.000 0.962 1.000 0.000
#> GSM553617 1 0.000 0.962 1.000 0.000
#> GSM553618 1 0.373 0.912 0.928 0.072
#> GSM553619 2 0.993 0.169 0.452 0.548
#> GSM553620 1 0.000 0.962 1.000 0.000
#> GSM553621 1 0.000 0.962 1.000 0.000
#> GSM553622 1 0.000 0.962 1.000 0.000
#> GSM553623 1 0.000 0.962 1.000 0.000
#> GSM553624 1 0.000 0.962 1.000 0.000
#> GSM553625 1 0.000 0.962 1.000 0.000
#> GSM553626 1 0.000 0.962 1.000 0.000
#> GSM553627 1 0.000 0.962 1.000 0.000
#> GSM553628 1 0.000 0.962 1.000 0.000
#> GSM553629 1 0.000 0.962 1.000 0.000
#> GSM553630 1 0.000 0.962 1.000 0.000
#> GSM553631 1 0.358 0.912 0.932 0.068
#> GSM553632 1 0.000 0.962 1.000 0.000
#> GSM553633 1 0.802 0.669 0.756 0.244
#> GSM553634 2 0.224 0.913 0.036 0.964
#> GSM553635 2 0.224 0.913 0.036 0.964
#> GSM553636 1 0.000 0.962 1.000 0.000
#> GSM553637 2 0.000 0.927 0.000 1.000
#> GSM553638 2 0.000 0.927 0.000 1.000
#> GSM553639 1 0.595 0.813 0.856 0.144
#> GSM553640 1 0.000 0.962 1.000 0.000
#> GSM553641 2 0.000 0.927 0.000 1.000
#> GSM553642 1 0.224 0.938 0.964 0.036
#> GSM553643 1 0.224 0.938 0.964 0.036
#> GSM553644 1 0.000 0.962 1.000 0.000
#> GSM553645 1 0.224 0.938 0.964 0.036
#> GSM553646 1 0.000 0.962 1.000 0.000
#> GSM553647 1 0.000 0.962 1.000 0.000
#> GSM553648 2 0.000 0.927 0.000 1.000
#> GSM553649 2 0.000 0.927 0.000 1.000
#> GSM553650 2 0.900 0.548 0.316 0.684
#> GSM553651 1 0.000 0.962 1.000 0.000
#> GSM553652 2 0.224 0.913 0.036 0.964
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> GSM553595 3 0.4121 0.753 0.168 0.000 0.832
#> GSM553596 1 0.3551 0.886 0.868 0.000 0.132
#> GSM553597 3 0.0000 0.926 0.000 0.000 1.000
#> GSM553598 3 0.1289 0.910 0.000 0.032 0.968
#> GSM553599 1 0.1964 0.905 0.944 0.000 0.056
#> GSM553600 1 0.0000 0.902 1.000 0.000 0.000
#> GSM553601 1 0.3116 0.899 0.892 0.000 0.108
#> GSM553602 1 0.0000 0.902 1.000 0.000 0.000
#> GSM553603 3 0.0000 0.926 0.000 0.000 1.000
#> GSM553604 1 0.3116 0.899 0.892 0.000 0.108
#> GSM553605 2 0.0000 0.977 0.000 1.000 0.000
#> GSM553606 2 0.0000 0.977 0.000 1.000 0.000
#> GSM553607 2 0.0000 0.977 0.000 1.000 0.000
#> GSM553608 1 0.4413 0.859 0.832 0.008 0.160
#> GSM553609 2 0.0000 0.977 0.000 1.000 0.000
#> GSM553610 2 0.0000 0.977 0.000 1.000 0.000
#> GSM553611 1 0.3038 0.900 0.896 0.000 0.104
#> GSM553612 2 0.0000 0.977 0.000 1.000 0.000
#> GSM553613 2 0.0000 0.977 0.000 1.000 0.000
#> GSM553614 3 0.3038 0.854 0.104 0.000 0.896
#> GSM553615 1 0.0000 0.902 1.000 0.000 0.000
#> GSM553616 1 0.2711 0.903 0.912 0.000 0.088
#> GSM553617 1 0.0000 0.902 1.000 0.000 0.000
#> GSM553618 1 0.5363 0.723 0.724 0.000 0.276
#> GSM553619 3 0.5291 0.641 0.000 0.268 0.732
#> GSM553620 3 0.0424 0.922 0.008 0.000 0.992
#> GSM553621 1 0.3879 0.775 0.848 0.000 0.152
#> GSM553622 1 0.0000 0.902 1.000 0.000 0.000
#> GSM553623 1 0.0000 0.902 1.000 0.000 0.000
#> GSM553624 1 0.0000 0.902 1.000 0.000 0.000
#> GSM553625 3 0.3116 0.861 0.108 0.000 0.892
#> GSM553626 3 0.3116 0.861 0.108 0.000 0.892
#> GSM553627 1 0.0000 0.902 1.000 0.000 0.000
#> GSM553628 1 0.0000 0.902 1.000 0.000 0.000
#> GSM553629 3 0.5621 0.634 0.308 0.000 0.692
#> GSM553630 3 0.0592 0.922 0.012 0.000 0.988
#> GSM553631 3 0.0000 0.926 0.000 0.000 1.000
#> GSM553632 3 0.4654 0.787 0.208 0.000 0.792
#> GSM553633 3 0.0000 0.926 0.000 0.000 1.000
#> GSM553634 2 0.0000 0.977 0.000 1.000 0.000
#> GSM553635 2 0.0000 0.977 0.000 1.000 0.000
#> GSM553636 1 0.3116 0.899 0.892 0.000 0.108
#> GSM553637 2 0.0000 0.977 0.000 1.000 0.000
#> GSM553638 2 0.0000 0.977 0.000 1.000 0.000
#> GSM553639 1 0.3116 0.899 0.892 0.000 0.108
#> GSM553640 1 0.6225 0.371 0.568 0.000 0.432
#> GSM553641 2 0.0000 0.977 0.000 1.000 0.000
#> GSM553642 3 0.0000 0.926 0.000 0.000 1.000
#> GSM553643 3 0.0000 0.926 0.000 0.000 1.000
#> GSM553644 3 0.0000 0.926 0.000 0.000 1.000
#> GSM553645 3 0.0000 0.926 0.000 0.000 1.000
#> GSM553646 3 0.0000 0.926 0.000 0.000 1.000
#> GSM553647 3 0.0000 0.926 0.000 0.000 1.000
#> GSM553648 2 0.0000 0.977 0.000 1.000 0.000
#> GSM553649 2 0.0237 0.974 0.000 0.996 0.004
#> GSM553650 2 0.6937 0.537 0.272 0.680 0.048
#> GSM553651 1 0.3116 0.899 0.892 0.000 0.108
#> GSM553652 2 0.0000 0.977 0.000 1.000 0.000
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> GSM553595 4 0.1824 0.8343 0.004 0.060 0.000 0.936
#> GSM553596 4 0.4483 0.6973 0.004 0.284 0.000 0.712
#> GSM553597 4 0.0188 0.8439 0.004 0.000 0.000 0.996
#> GSM553598 3 0.4543 0.5014 0.000 0.000 0.676 0.324
#> GSM553599 4 0.7404 0.4074 0.180 0.336 0.000 0.484
#> GSM553600 1 0.1022 0.8446 0.968 0.032 0.000 0.000
#> GSM553601 4 0.4483 0.6973 0.004 0.284 0.000 0.712
#> GSM553602 1 0.1389 0.8353 0.952 0.048 0.000 0.000
#> GSM553603 4 0.0000 0.8438 0.000 0.000 0.000 1.000
#> GSM553604 4 0.4483 0.6973 0.004 0.284 0.000 0.712
#> GSM553605 3 0.0000 0.8157 0.000 0.000 1.000 0.000
#> GSM553606 3 0.0188 0.8141 0.000 0.004 0.996 0.000
#> GSM553607 3 0.4543 0.2269 0.000 0.324 0.676 0.000
#> GSM553608 2 0.0469 0.6906 0.000 0.988 0.000 0.012
#> GSM553609 2 0.4817 0.5543 0.000 0.612 0.388 0.000
#> GSM553610 3 0.0188 0.8141 0.000 0.004 0.996 0.000
#> GSM553611 2 0.0188 0.6882 0.004 0.996 0.000 0.000
#> GSM553612 2 0.4567 0.6450 0.000 0.716 0.276 0.008
#> GSM553613 3 0.0000 0.8157 0.000 0.000 1.000 0.000
#> GSM553614 4 0.1584 0.8419 0.012 0.036 0.000 0.952
#> GSM553615 1 0.0188 0.8545 0.996 0.004 0.000 0.000
#> GSM553616 2 0.5592 -0.0732 0.024 0.572 0.000 0.404
#> GSM553617 1 0.4998 0.3083 0.512 0.488 0.000 0.000
#> GSM553618 4 0.4313 0.7182 0.000 0.260 0.004 0.736
#> GSM553619 4 0.4877 0.4559 0.000 0.008 0.328 0.664
#> GSM553620 4 0.1209 0.8425 0.004 0.032 0.000 0.964
#> GSM553621 4 0.7188 0.4027 0.292 0.172 0.000 0.536
#> GSM553622 1 0.0188 0.8543 0.996 0.000 0.000 0.004
#> GSM553623 2 0.4948 -0.2337 0.440 0.560 0.000 0.000
#> GSM553624 1 0.4999 0.2331 0.508 0.492 0.000 0.000
#> GSM553625 4 0.4446 0.7117 0.196 0.028 0.000 0.776
#> GSM553626 1 0.0188 0.8543 0.996 0.000 0.000 0.004
#> GSM553627 1 0.4831 0.6781 0.752 0.208 0.000 0.040
#> GSM553628 1 0.0188 0.8545 0.996 0.004 0.000 0.000
#> GSM553629 1 0.0188 0.8543 0.996 0.000 0.000 0.004
#> GSM553630 4 0.1302 0.8369 0.044 0.000 0.000 0.956
#> GSM553631 4 0.1302 0.8375 0.044 0.000 0.000 0.956
#> GSM553632 1 0.0188 0.8543 0.996 0.000 0.000 0.004
#> GSM553633 3 0.4817 0.4092 0.000 0.000 0.612 0.388
#> GSM553634 2 0.5497 0.6322 0.000 0.672 0.284 0.044
#> GSM553635 2 0.4817 0.5543 0.000 0.612 0.388 0.000
#> GSM553636 2 0.0188 0.6882 0.004 0.996 0.000 0.000
#> GSM553637 2 0.4817 0.5543 0.000 0.612 0.388 0.000
#> GSM553638 2 0.4304 0.6438 0.000 0.716 0.284 0.000
#> GSM553639 2 0.0000 0.6899 0.000 1.000 0.000 0.000
#> GSM553640 2 0.3308 0.6577 0.036 0.872 0.000 0.092
#> GSM553641 3 0.0000 0.8157 0.000 0.000 1.000 0.000
#> GSM553642 4 0.0000 0.8438 0.000 0.000 0.000 1.000
#> GSM553643 4 0.0188 0.8428 0.000 0.000 0.004 0.996
#> GSM553644 4 0.0000 0.8438 0.000 0.000 0.000 1.000
#> GSM553645 4 0.0188 0.8428 0.000 0.000 0.004 0.996
#> GSM553646 4 0.0000 0.8438 0.000 0.000 0.000 1.000
#> GSM553647 4 0.0000 0.8438 0.000 0.000 0.000 1.000
#> GSM553648 3 0.1557 0.8001 0.000 0.000 0.944 0.056
#> GSM553649 3 0.1557 0.8001 0.000 0.000 0.944 0.056
#> GSM553650 2 0.3569 0.6792 0.000 0.804 0.196 0.000
#> GSM553651 2 0.0188 0.6882 0.004 0.996 0.000 0.000
#> GSM553652 2 0.4304 0.6438 0.000 0.716 0.284 0.000
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> GSM553595 4 0.3242 0.684 0.000 0.000 0.000 0.784 0.216
#> GSM553596 5 0.2852 0.744 0.000 0.000 0.000 0.172 0.828
#> GSM553597 4 0.0162 0.906 0.000 0.000 0.000 0.996 0.004
#> GSM553598 3 0.0510 0.982 0.000 0.000 0.984 0.016 0.000
#> GSM553599 5 0.2316 0.765 0.036 0.012 0.000 0.036 0.916
#> GSM553600 1 0.2127 0.879 0.892 0.000 0.000 0.000 0.108
#> GSM553601 5 0.2074 0.764 0.000 0.000 0.000 0.104 0.896
#> GSM553602 1 0.1732 0.906 0.920 0.000 0.000 0.000 0.080
#> GSM553603 4 0.0000 0.907 0.000 0.000 0.000 1.000 0.000
#> GSM553604 5 0.2648 0.755 0.000 0.000 0.000 0.152 0.848
#> GSM553605 3 0.0000 0.993 0.000 0.000 1.000 0.000 0.000
#> GSM553606 2 0.5343 0.455 0.000 0.592 0.340 0.000 0.068
#> GSM553607 2 0.2046 0.874 0.000 0.916 0.016 0.000 0.068
#> GSM553608 2 0.0000 0.882 0.000 1.000 0.000 0.000 0.000
#> GSM553609 2 0.1845 0.877 0.000 0.928 0.016 0.000 0.056
#> GSM553610 2 0.5260 0.447 0.000 0.592 0.348 0.000 0.060
#> GSM553611 5 0.4201 0.469 0.000 0.408 0.000 0.000 0.592
#> GSM553612 2 0.0162 0.881 0.000 0.996 0.000 0.000 0.004
#> GSM553613 3 0.0000 0.993 0.000 0.000 1.000 0.000 0.000
#> GSM553614 4 0.2848 0.814 0.004 0.000 0.000 0.840 0.156
#> GSM553615 1 0.0000 0.967 1.000 0.000 0.000 0.000 0.000
#> GSM553616 5 0.1830 0.766 0.012 0.004 0.000 0.052 0.932
#> GSM553617 5 0.1792 0.746 0.084 0.000 0.000 0.000 0.916
#> GSM553618 5 0.3671 0.672 0.000 0.000 0.008 0.236 0.756
#> GSM553619 4 0.5480 0.336 0.000 0.000 0.368 0.560 0.072
#> GSM553620 4 0.1671 0.880 0.000 0.000 0.000 0.924 0.076
#> GSM553621 5 0.5704 0.561 0.148 0.000 0.000 0.232 0.620
#> GSM553622 1 0.0404 0.960 0.988 0.000 0.000 0.000 0.012
#> GSM553623 5 0.1892 0.748 0.080 0.004 0.000 0.000 0.916
#> GSM553624 5 0.4367 0.440 0.416 0.004 0.000 0.000 0.580
#> GSM553625 4 0.4693 0.685 0.196 0.000 0.000 0.724 0.080
#> GSM553626 1 0.0000 0.967 1.000 0.000 0.000 0.000 0.000
#> GSM553627 5 0.4161 0.479 0.392 0.000 0.000 0.000 0.608
#> GSM553628 1 0.0000 0.967 1.000 0.000 0.000 0.000 0.000
#> GSM553629 1 0.0000 0.967 1.000 0.000 0.000 0.000 0.000
#> GSM553630 4 0.1357 0.889 0.048 0.000 0.000 0.948 0.004
#> GSM553631 4 0.1270 0.889 0.052 0.000 0.000 0.948 0.000
#> GSM553632 1 0.0000 0.967 1.000 0.000 0.000 0.000 0.000
#> GSM553633 3 0.0510 0.982 0.000 0.000 0.984 0.016 0.000
#> GSM553634 2 0.1965 0.853 0.000 0.924 0.000 0.052 0.024
#> GSM553635 2 0.1914 0.876 0.000 0.924 0.016 0.000 0.060
#> GSM553636 5 0.3837 0.608 0.000 0.308 0.000 0.000 0.692
#> GSM553637 2 0.2046 0.874 0.000 0.916 0.016 0.000 0.068
#> GSM553638 2 0.0000 0.882 0.000 1.000 0.000 0.000 0.000
#> GSM553639 2 0.0963 0.861 0.000 0.964 0.000 0.000 0.036
#> GSM553640 2 0.4214 0.682 0.004 0.788 0.000 0.088 0.120
#> GSM553641 3 0.0000 0.993 0.000 0.000 1.000 0.000 0.000
#> GSM553642 4 0.0000 0.907 0.000 0.000 0.000 1.000 0.000
#> GSM553643 4 0.0000 0.907 0.000 0.000 0.000 1.000 0.000
#> GSM553644 4 0.0000 0.907 0.000 0.000 0.000 1.000 0.000
#> GSM553645 4 0.0162 0.906 0.000 0.000 0.004 0.996 0.000
#> GSM553646 4 0.0000 0.907 0.000 0.000 0.000 1.000 0.000
#> GSM553647 4 0.0000 0.907 0.000 0.000 0.000 1.000 0.000
#> GSM553648 3 0.0000 0.993 0.000 0.000 1.000 0.000 0.000
#> GSM553649 3 0.0000 0.993 0.000 0.000 1.000 0.000 0.000
#> GSM553650 2 0.0000 0.882 0.000 1.000 0.000 0.000 0.000
#> GSM553651 5 0.4201 0.469 0.000 0.408 0.000 0.000 0.592
#> GSM553652 2 0.0000 0.882 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
#> GSM553595 4 0.3050 0.675 0.000 0.000 0.000 0.764 0.236 0.000
#> GSM553596 5 0.2003 0.803 0.000 0.000 0.000 0.116 0.884 0.000
#> GSM553597 4 0.0000 0.904 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM553598 3 0.0000 0.999 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM553599 5 0.0508 0.825 0.012 0.004 0.000 0.000 0.984 0.000
#> GSM553600 1 0.2135 0.853 0.872 0.000 0.000 0.000 0.128 0.000
#> GSM553601 5 0.1007 0.824 0.000 0.000 0.000 0.044 0.956 0.000
#> GSM553602 1 0.1910 0.868 0.892 0.000 0.000 0.000 0.108 0.000
#> GSM553603 4 0.0000 0.904 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM553604 5 0.1714 0.814 0.000 0.000 0.000 0.092 0.908 0.000
#> GSM553605 3 0.0000 0.999 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM553606 6 0.1075 0.778 0.000 0.000 0.048 0.000 0.000 0.952
#> GSM553607 6 0.0632 0.795 0.000 0.024 0.000 0.000 0.000 0.976
#> GSM553608 2 0.0000 0.932 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM553609 6 0.3563 0.528 0.000 0.336 0.000 0.000 0.000 0.664
#> GSM553610 6 0.1910 0.741 0.000 0.000 0.108 0.000 0.000 0.892
#> GSM553611 2 0.0000 0.932 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM553612 2 0.0713 0.915 0.000 0.972 0.000 0.000 0.000 0.028
#> GSM553613 3 0.0146 0.996 0.000 0.000 0.996 0.000 0.000 0.004
#> GSM553614 4 0.2738 0.797 0.000 0.000 0.000 0.820 0.176 0.004
#> GSM553615 1 0.0000 0.955 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM553616 5 0.0363 0.821 0.000 0.000 0.000 0.000 0.988 0.012
#> GSM553617 5 0.0458 0.826 0.016 0.000 0.000 0.000 0.984 0.000
#> GSM553618 5 0.3073 0.725 0.000 0.000 0.008 0.204 0.788 0.000
#> GSM553619 4 0.5839 0.424 0.000 0.000 0.244 0.548 0.012 0.196
#> GSM553620 4 0.2333 0.859 0.000 0.000 0.000 0.884 0.092 0.024
#> GSM553621 5 0.5309 0.594 0.112 0.000 0.000 0.220 0.644 0.024
#> GSM553622 1 0.0603 0.945 0.980 0.000 0.000 0.000 0.016 0.004
#> GSM553623 5 0.0458 0.826 0.016 0.000 0.000 0.000 0.984 0.000
#> GSM553624 5 0.3756 0.460 0.400 0.000 0.000 0.000 0.600 0.000
#> GSM553625 4 0.4215 0.695 0.196 0.000 0.000 0.724 0.080 0.000
#> GSM553626 1 0.0000 0.955 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM553627 5 0.3706 0.500 0.380 0.000 0.000 0.000 0.620 0.000
#> GSM553628 1 0.0000 0.955 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM553629 1 0.0260 0.953 0.992 0.000 0.000 0.000 0.000 0.008
#> GSM553630 4 0.1500 0.881 0.052 0.000 0.000 0.936 0.000 0.012
#> GSM553631 4 0.1644 0.884 0.040 0.000 0.000 0.932 0.000 0.028
#> GSM553632 1 0.0000 0.955 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM553633 3 0.0000 0.999 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM553634 2 0.3601 0.488 0.000 0.684 0.000 0.004 0.000 0.312
#> GSM553635 6 0.3847 0.169 0.000 0.456 0.000 0.000 0.000 0.544
#> GSM553636 2 0.2178 0.794 0.000 0.868 0.000 0.000 0.132 0.000
#> GSM553637 6 0.0632 0.795 0.000 0.024 0.000 0.000 0.000 0.976
#> GSM553638 2 0.0000 0.932 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM553639 2 0.0000 0.932 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM553640 2 0.1483 0.886 0.008 0.944 0.000 0.036 0.000 0.012
#> GSM553641 3 0.0000 0.999 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM553642 4 0.0000 0.904 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM553643 4 0.0000 0.904 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM553644 4 0.0000 0.904 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM553645 4 0.0000 0.904 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM553646 4 0.0000 0.904 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM553647 4 0.0000 0.904 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM553648 3 0.0000 0.999 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM553649 3 0.0000 0.999 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM553650 2 0.0000 0.932 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM553651 2 0.0363 0.925 0.000 0.988 0.000 0.000 0.012 0.000
#> GSM553652 2 0.0000 0.932 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 individual(p) k
#> SD:pam 55 0.0590 2
#> SD:pam 57 0.0874 3
#> SD:pam 49 0.0508 4
#> SD:pam 51 0.1050 5
#> SD:pam 53 0.0603 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 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.666 0.879 0.944 0.3548 0.666 0.666
#> 3 3 0.596 0.707 0.867 0.7782 0.693 0.544
#> 4 4 0.547 0.773 0.840 0.1325 0.766 0.459
#> 5 5 0.865 0.846 0.936 0.0880 0.892 0.633
#> 6 6 0.833 0.783 0.912 0.0133 0.996 0.981
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
#> GSM553595 1 0.0938 0.940 0.988 0.012
#> GSM553596 1 0.0938 0.940 0.988 0.012
#> GSM553597 1 0.0938 0.940 0.988 0.012
#> GSM553598 1 0.0938 0.940 0.988 0.012
#> GSM553599 1 0.0938 0.940 0.988 0.012
#> GSM553600 1 0.0000 0.937 1.000 0.000
#> GSM553601 1 0.0938 0.940 0.988 0.012
#> GSM553602 1 0.0000 0.937 1.000 0.000
#> GSM553603 1 0.0938 0.940 0.988 0.012
#> GSM553604 1 0.0938 0.940 0.988 0.012
#> GSM553605 1 0.0938 0.940 0.988 0.012
#> GSM553606 1 0.9393 0.456 0.644 0.356
#> GSM553607 1 0.9393 0.456 0.644 0.356
#> GSM553608 2 0.0000 0.925 0.000 1.000
#> GSM553609 2 0.5842 0.891 0.140 0.860
#> GSM553610 1 0.9393 0.456 0.644 0.356
#> GSM553611 2 0.0000 0.925 0.000 1.000
#> GSM553612 2 0.4815 0.921 0.104 0.896
#> GSM553613 1 0.9393 0.456 0.644 0.356
#> GSM553614 1 0.0000 0.937 1.000 0.000
#> GSM553615 1 0.0000 0.937 1.000 0.000
#> GSM553616 1 0.0000 0.937 1.000 0.000
#> GSM553617 1 0.0000 0.937 1.000 0.000
#> GSM553618 1 0.0938 0.940 0.988 0.012
#> GSM553619 1 0.0938 0.940 0.988 0.012
#> GSM553620 1 0.0000 0.937 1.000 0.000
#> GSM553621 1 0.0000 0.937 1.000 0.000
#> GSM553622 1 0.0000 0.937 1.000 0.000
#> GSM553623 1 0.0000 0.937 1.000 0.000
#> GSM553624 1 0.0000 0.937 1.000 0.000
#> GSM553625 1 0.0000 0.937 1.000 0.000
#> GSM553626 1 0.0000 0.937 1.000 0.000
#> GSM553627 1 0.0000 0.937 1.000 0.000
#> GSM553628 1 0.0000 0.937 1.000 0.000
#> GSM553629 1 0.0938 0.940 0.988 0.012
#> GSM553630 1 0.0000 0.937 1.000 0.000
#> GSM553631 1 0.0938 0.940 0.988 0.012
#> GSM553632 1 0.0000 0.937 1.000 0.000
#> GSM553633 1 0.0938 0.940 0.988 0.012
#> GSM553634 2 0.5842 0.891 0.140 0.860
#> GSM553635 1 0.9944 0.163 0.544 0.456
#> GSM553636 2 0.4815 0.921 0.104 0.896
#> GSM553637 1 0.9393 0.456 0.644 0.356
#> GSM553638 2 0.1184 0.928 0.016 0.984
#> GSM553639 2 0.0000 0.925 0.000 1.000
#> GSM553640 2 0.5408 0.906 0.124 0.876
#> GSM553641 1 0.0938 0.940 0.988 0.012
#> GSM553642 1 0.0938 0.940 0.988 0.012
#> GSM553643 1 0.0938 0.940 0.988 0.012
#> GSM553644 1 0.0938 0.940 0.988 0.012
#> GSM553645 1 0.0938 0.940 0.988 0.012
#> GSM553646 1 0.0938 0.940 0.988 0.012
#> GSM553647 1 0.0938 0.940 0.988 0.012
#> GSM553648 1 0.0938 0.940 0.988 0.012
#> GSM553649 1 0.0938 0.940 0.988 0.012
#> GSM553650 2 0.0000 0.925 0.000 1.000
#> GSM553651 2 0.4815 0.921 0.104 0.896
#> GSM553652 2 0.0672 0.927 0.008 0.992
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> GSM553595 3 0.6308 -0.374 0.492 0.000 0.508
#> GSM553596 1 0.6274 0.428 0.544 0.000 0.456
#> GSM553597 1 0.6260 0.461 0.552 0.000 0.448
#> GSM553598 3 0.0000 0.732 0.000 0.000 1.000
#> GSM553599 1 0.0424 0.821 0.992 0.000 0.008
#> GSM553600 1 0.0000 0.821 1.000 0.000 0.000
#> GSM553601 1 0.4750 0.719 0.784 0.000 0.216
#> GSM553602 1 0.0424 0.821 0.992 0.000 0.008
#> GSM553603 1 0.6267 0.454 0.548 0.000 0.452
#> GSM553604 1 0.5216 0.683 0.740 0.000 0.260
#> GSM553605 3 0.0000 0.732 0.000 0.000 1.000
#> GSM553606 3 0.5835 0.440 0.000 0.340 0.660
#> GSM553607 3 0.6057 0.436 0.004 0.340 0.656
#> GSM553608 2 0.0000 0.964 0.000 1.000 0.000
#> GSM553609 2 0.3116 0.873 0.000 0.892 0.108
#> GSM553610 3 0.5835 0.440 0.000 0.340 0.660
#> GSM553611 2 0.0000 0.964 0.000 1.000 0.000
#> GSM553612 2 0.0000 0.964 0.000 1.000 0.000
#> GSM553613 3 0.4291 0.624 0.000 0.180 0.820
#> GSM553614 1 0.5178 0.675 0.744 0.000 0.256
#> GSM553615 1 0.0237 0.821 0.996 0.000 0.004
#> GSM553616 1 0.0000 0.821 1.000 0.000 0.000
#> GSM553617 1 0.0000 0.821 1.000 0.000 0.000
#> GSM553618 3 0.6295 -0.180 0.472 0.000 0.528
#> GSM553619 3 0.3192 0.678 0.112 0.000 0.888
#> GSM553620 1 0.4062 0.748 0.836 0.000 0.164
#> GSM553621 1 0.0000 0.821 1.000 0.000 0.000
#> GSM553622 1 0.0000 0.821 1.000 0.000 0.000
#> GSM553623 1 0.0237 0.821 0.996 0.000 0.004
#> GSM553624 1 0.0983 0.815 0.980 0.016 0.004
#> GSM553625 1 0.0424 0.820 0.992 0.000 0.008
#> GSM553626 1 0.0000 0.821 1.000 0.000 0.000
#> GSM553627 1 0.0237 0.821 0.996 0.000 0.004
#> GSM553628 1 0.0000 0.821 1.000 0.000 0.000
#> GSM553629 1 0.1315 0.813 0.972 0.020 0.008
#> GSM553630 1 0.0000 0.821 1.000 0.000 0.000
#> GSM553631 1 0.5363 0.656 0.724 0.000 0.276
#> GSM553632 1 0.0000 0.821 1.000 0.000 0.000
#> GSM553633 3 0.0592 0.730 0.012 0.000 0.988
#> GSM553634 2 0.1399 0.943 0.004 0.968 0.028
#> GSM553635 2 0.3349 0.870 0.004 0.888 0.108
#> GSM553636 2 0.0000 0.964 0.000 1.000 0.000
#> GSM553637 3 0.6057 0.436 0.004 0.340 0.656
#> GSM553638 2 0.0000 0.964 0.000 1.000 0.000
#> GSM553639 2 0.0000 0.964 0.000 1.000 0.000
#> GSM553640 2 0.3359 0.858 0.084 0.900 0.016
#> GSM553641 3 0.0000 0.732 0.000 0.000 1.000
#> GSM553642 1 0.5591 0.645 0.696 0.000 0.304
#> GSM553643 1 0.6280 0.436 0.540 0.000 0.460
#> GSM553644 1 0.5591 0.645 0.696 0.000 0.304
#> GSM553645 3 0.5291 0.348 0.268 0.000 0.732
#> GSM553646 1 0.5760 0.615 0.672 0.000 0.328
#> GSM553647 1 0.6267 0.454 0.548 0.000 0.452
#> GSM553648 3 0.0000 0.732 0.000 0.000 1.000
#> GSM553649 3 0.0000 0.732 0.000 0.000 1.000
#> GSM553650 2 0.0000 0.964 0.000 1.000 0.000
#> GSM553651 2 0.0000 0.964 0.000 1.000 0.000
#> GSM553652 2 0.0000 0.964 0.000 1.000 0.000
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> GSM553595 4 0.0524 0.778 0.004 0.000 0.008 0.988
#> GSM553596 4 0.4098 0.641 0.012 0.000 0.204 0.784
#> GSM553597 4 0.2714 0.762 0.112 0.000 0.004 0.884
#> GSM553598 3 0.3356 0.889 0.000 0.000 0.824 0.176
#> GSM553599 1 0.3172 0.918 0.840 0.000 0.000 0.160
#> GSM553600 1 0.2976 0.946 0.872 0.000 0.008 0.120
#> GSM553601 1 0.4605 0.648 0.664 0.000 0.000 0.336
#> GSM553602 1 0.3545 0.916 0.828 0.000 0.008 0.164
#> GSM553603 4 0.0524 0.781 0.008 0.000 0.004 0.988
#> GSM553604 4 0.3539 0.649 0.176 0.000 0.004 0.820
#> GSM553605 3 0.3356 0.889 0.000 0.000 0.824 0.176
#> GSM553606 3 0.5250 0.556 0.080 0.176 0.744 0.000
#> GSM553607 2 0.7273 0.331 0.128 0.460 0.408 0.004
#> GSM553608 2 0.0000 0.862 0.000 1.000 0.000 0.000
#> GSM553609 2 0.4852 0.734 0.072 0.776 0.152 0.000
#> GSM553610 3 0.2256 0.758 0.020 0.056 0.924 0.000
#> GSM553611 2 0.0000 0.862 0.000 1.000 0.000 0.000
#> GSM553612 2 0.0000 0.862 0.000 1.000 0.000 0.000
#> GSM553613 3 0.4358 0.857 0.020 0.044 0.832 0.104
#> GSM553614 1 0.4428 0.699 0.720 0.000 0.004 0.276
#> GSM553615 1 0.2704 0.946 0.876 0.000 0.000 0.124
#> GSM553616 1 0.2647 0.947 0.880 0.000 0.000 0.120
#> GSM553617 1 0.2647 0.947 0.880 0.000 0.000 0.120
#> GSM553618 4 0.5022 0.623 0.044 0.000 0.220 0.736
#> GSM553619 4 0.5219 0.587 0.044 0.000 0.244 0.712
#> GSM553620 4 0.4500 0.561 0.316 0.000 0.000 0.684
#> GSM553621 4 0.5281 0.167 0.464 0.000 0.008 0.528
#> GSM553622 1 0.3088 0.943 0.864 0.000 0.008 0.128
#> GSM553623 1 0.2647 0.947 0.880 0.000 0.000 0.120
#> GSM553624 1 0.2647 0.947 0.880 0.000 0.000 0.120
#> GSM553625 4 0.4830 0.410 0.392 0.000 0.000 0.608
#> GSM553626 1 0.2976 0.946 0.872 0.000 0.008 0.120
#> GSM553627 1 0.3498 0.918 0.832 0.000 0.008 0.160
#> GSM553628 1 0.2976 0.946 0.872 0.000 0.008 0.120
#> GSM553629 1 0.2704 0.946 0.876 0.000 0.000 0.124
#> GSM553630 4 0.4843 0.409 0.396 0.000 0.000 0.604
#> GSM553631 4 0.6317 0.605 0.240 0.000 0.116 0.644
#> GSM553632 1 0.2976 0.946 0.872 0.000 0.008 0.120
#> GSM553633 4 0.2760 0.708 0.000 0.000 0.128 0.872
#> GSM553634 2 0.3377 0.791 0.012 0.848 0.140 0.000
#> GSM553635 2 0.5160 0.725 0.072 0.748 0.180 0.000
#> GSM553636 2 0.0000 0.862 0.000 1.000 0.000 0.000
#> GSM553637 2 0.7273 0.331 0.128 0.460 0.408 0.004
#> GSM553638 2 0.0188 0.860 0.004 0.996 0.000 0.000
#> GSM553639 2 0.0000 0.862 0.000 1.000 0.000 0.000
#> GSM553640 2 0.5247 0.694 0.128 0.784 0.036 0.052
#> GSM553641 3 0.3356 0.889 0.000 0.000 0.824 0.176
#> GSM553642 4 0.0592 0.781 0.016 0.000 0.000 0.984
#> GSM553643 4 0.0524 0.781 0.008 0.000 0.004 0.988
#> GSM553644 4 0.0592 0.781 0.016 0.000 0.000 0.984
#> GSM553645 4 0.0524 0.778 0.004 0.000 0.008 0.988
#> GSM553646 4 0.0657 0.781 0.012 0.000 0.004 0.984
#> GSM553647 4 0.0336 0.781 0.008 0.000 0.000 0.992
#> GSM553648 3 0.3356 0.889 0.000 0.000 0.824 0.176
#> GSM553649 3 0.3356 0.889 0.000 0.000 0.824 0.176
#> GSM553650 2 0.0188 0.860 0.004 0.996 0.000 0.000
#> GSM553651 2 0.0000 0.862 0.000 1.000 0.000 0.000
#> GSM553652 2 0.0000 0.862 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
#> GSM553595 4 0.0162 0.8911 0.004 0.000 0.000 0.996 0.000
#> GSM553596 4 0.0162 0.8883 0.000 0.000 0.004 0.996 0.000
#> GSM553597 4 0.0162 0.8883 0.000 0.000 0.004 0.996 0.000
#> GSM553598 3 0.0162 0.8988 0.000 0.000 0.996 0.000 0.004
#> GSM553599 1 0.0703 0.8648 0.976 0.000 0.000 0.024 0.000
#> GSM553600 1 0.0000 0.8835 1.000 0.000 0.000 0.000 0.000
#> GSM553601 1 0.4235 0.2945 0.576 0.000 0.000 0.424 0.000
#> GSM553602 1 0.0000 0.8835 1.000 0.000 0.000 0.000 0.000
#> GSM553603 4 0.0162 0.8911 0.004 0.000 0.000 0.996 0.000
#> GSM553604 1 0.3003 0.6859 0.812 0.000 0.000 0.188 0.000
#> GSM553605 3 0.0000 0.9004 0.000 0.000 1.000 0.000 0.000
#> GSM553606 5 0.3003 0.8377 0.000 0.000 0.188 0.000 0.812
#> GSM553607 5 0.0000 0.8537 0.000 0.000 0.000 0.000 1.000
#> GSM553608 2 0.0000 1.0000 0.000 1.000 0.000 0.000 0.000
#> GSM553609 2 0.0000 1.0000 0.000 1.000 0.000 0.000 0.000
#> GSM553610 5 0.3003 0.8377 0.000 0.000 0.188 0.000 0.812
#> GSM553611 2 0.0000 1.0000 0.000 1.000 0.000 0.000 0.000
#> GSM553612 2 0.0000 1.0000 0.000 1.000 0.000 0.000 0.000
#> GSM553613 3 0.0000 0.9004 0.000 0.000 1.000 0.000 0.000
#> GSM553614 4 0.3003 0.7711 0.188 0.000 0.000 0.812 0.000
#> GSM553615 1 0.0000 0.8835 1.000 0.000 0.000 0.000 0.000
#> GSM553616 1 0.0000 0.8835 1.000 0.000 0.000 0.000 0.000
#> GSM553617 1 0.0000 0.8835 1.000 0.000 0.000 0.000 0.000
#> GSM553618 4 0.2732 0.7935 0.000 0.000 0.000 0.840 0.160
#> GSM553619 3 0.3039 0.7212 0.000 0.000 0.808 0.000 0.192
#> GSM553620 4 0.3039 0.7710 0.192 0.000 0.000 0.808 0.000
#> GSM553621 1 0.4249 0.0944 0.568 0.000 0.000 0.432 0.000
#> GSM553622 1 0.0162 0.8802 0.996 0.000 0.000 0.004 0.000
#> GSM553623 1 0.0000 0.8835 1.000 0.000 0.000 0.000 0.000
#> GSM553624 1 0.4161 0.3486 0.608 0.392 0.000 0.000 0.000
#> GSM553625 4 0.3074 0.7671 0.196 0.000 0.000 0.804 0.000
#> GSM553626 1 0.0000 0.8835 1.000 0.000 0.000 0.000 0.000
#> GSM553627 1 0.0000 0.8835 1.000 0.000 0.000 0.000 0.000
#> GSM553628 1 0.0000 0.8835 1.000 0.000 0.000 0.000 0.000
#> GSM553629 1 0.0000 0.8835 1.000 0.000 0.000 0.000 0.000
#> GSM553630 4 0.4192 0.3819 0.404 0.000 0.000 0.596 0.000
#> GSM553631 4 0.3280 0.7760 0.012 0.000 0.000 0.812 0.176
#> GSM553632 1 0.0000 0.8835 1.000 0.000 0.000 0.000 0.000
#> GSM553633 3 0.3816 0.5296 0.000 0.000 0.696 0.304 0.000
#> GSM553634 2 0.0000 1.0000 0.000 1.000 0.000 0.000 0.000
#> GSM553635 2 0.0000 1.0000 0.000 1.000 0.000 0.000 0.000
#> GSM553636 2 0.0000 1.0000 0.000 1.000 0.000 0.000 0.000
#> GSM553637 5 0.0000 0.8537 0.000 0.000 0.000 0.000 1.000
#> GSM553638 2 0.0000 1.0000 0.000 1.000 0.000 0.000 0.000
#> GSM553639 2 0.0000 1.0000 0.000 1.000 0.000 0.000 0.000
#> GSM553640 2 0.0000 1.0000 0.000 1.000 0.000 0.000 0.000
#> GSM553641 3 0.0162 0.8988 0.000 0.000 0.996 0.000 0.004
#> GSM553642 4 0.0162 0.8911 0.004 0.000 0.000 0.996 0.000
#> GSM553643 4 0.0162 0.8911 0.004 0.000 0.000 0.996 0.000
#> GSM553644 4 0.0162 0.8911 0.004 0.000 0.000 0.996 0.000
#> GSM553645 4 0.0162 0.8911 0.004 0.000 0.000 0.996 0.000
#> GSM553646 4 0.0162 0.8911 0.004 0.000 0.000 0.996 0.000
#> GSM553647 4 0.0162 0.8911 0.004 0.000 0.000 0.996 0.000
#> GSM553648 3 0.0000 0.9004 0.000 0.000 1.000 0.000 0.000
#> GSM553649 3 0.0000 0.9004 0.000 0.000 1.000 0.000 0.000
#> GSM553650 2 0.0000 1.0000 0.000 1.000 0.000 0.000 0.000
#> GSM553651 2 0.0000 1.0000 0.000 1.000 0.000 0.000 0.000
#> GSM553652 2 0.0000 1.0000 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
#> GSM553595 4 0.0000 0.8335 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM553596 4 0.1327 0.8056 0.000 0.000 0.000 0.936 0.064 0.000
#> GSM553597 4 0.0363 0.8294 0.000 0.000 0.000 0.988 0.012 0.000
#> GSM553598 3 0.1007 0.7964 0.000 0.000 0.956 0.000 0.044 0.000
#> GSM553599 1 0.1492 0.8278 0.940 0.000 0.000 0.024 0.036 0.000
#> GSM553600 1 0.0146 0.8553 0.996 0.000 0.000 0.000 0.004 0.000
#> GSM553601 1 0.3531 0.4896 0.672 0.000 0.000 0.328 0.000 0.000
#> GSM553602 1 0.2793 0.7460 0.800 0.000 0.000 0.000 0.200 0.000
#> GSM553603 4 0.0000 0.8335 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM553604 1 0.4158 0.5521 0.704 0.000 0.000 0.244 0.052 0.000
#> GSM553605 3 0.0000 0.8409 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM553606 6 0.2416 0.7791 0.000 0.000 0.156 0.000 0.000 0.844
#> GSM553607 6 0.0000 0.7883 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM553608 2 0.0000 0.9981 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM553609 2 0.0000 0.9981 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM553610 6 0.3266 0.6627 0.000 0.000 0.272 0.000 0.000 0.728
#> GSM553611 2 0.0000 0.9981 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM553612 2 0.0000 0.9981 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM553613 3 0.0000 0.8409 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM553614 4 0.3690 0.6286 0.288 0.000 0.000 0.700 0.012 0.000
#> GSM553615 1 0.0146 0.8559 0.996 0.000 0.000 0.000 0.004 0.000
#> GSM553616 1 0.0000 0.8559 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM553617 1 0.0146 0.8558 0.996 0.000 0.000 0.000 0.004 0.000
#> GSM553618 4 0.3558 0.6544 0.000 0.000 0.000 0.736 0.248 0.016
#> GSM553619 5 0.3712 0.0000 0.000 0.000 0.180 0.000 0.768 0.052
#> GSM553620 4 0.3907 0.6328 0.268 0.000 0.000 0.704 0.028 0.000
#> GSM553621 1 0.5651 0.1544 0.492 0.000 0.000 0.344 0.164 0.000
#> GSM553622 1 0.2527 0.7587 0.832 0.000 0.000 0.000 0.168 0.000
#> GSM553623 1 0.0000 0.8559 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM553624 1 0.3499 0.4533 0.680 0.320 0.000 0.000 0.000 0.000
#> GSM553625 4 0.3371 0.6257 0.292 0.000 0.000 0.708 0.000 0.000
#> GSM553626 1 0.0260 0.8550 0.992 0.000 0.000 0.000 0.008 0.000
#> GSM553627 1 0.1007 0.8406 0.956 0.000 0.000 0.000 0.044 0.000
#> GSM553628 1 0.0000 0.8559 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM553629 1 0.0000 0.8559 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM553630 4 0.4047 0.4392 0.384 0.000 0.000 0.604 0.012 0.000
#> GSM553631 4 0.4456 0.5889 0.008 0.000 0.000 0.672 0.276 0.044
#> GSM553632 1 0.0146 0.8559 0.996 0.000 0.000 0.000 0.004 0.000
#> GSM553633 3 0.3854 0.0582 0.000 0.000 0.536 0.464 0.000 0.000
#> GSM553634 2 0.0260 0.9937 0.000 0.992 0.000 0.000 0.008 0.000
#> GSM553635 2 0.0260 0.9937 0.000 0.992 0.000 0.000 0.008 0.000
#> GSM553636 2 0.0000 0.9981 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM553637 6 0.0000 0.7883 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM553638 2 0.0000 0.9981 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM553639 2 0.0000 0.9981 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM553640 2 0.0260 0.9937 0.000 0.992 0.000 0.000 0.008 0.000
#> GSM553641 3 0.0000 0.8409 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM553642 4 0.0000 0.8335 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM553643 4 0.0000 0.8335 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM553644 4 0.0260 0.8322 0.000 0.000 0.000 0.992 0.008 0.000
#> GSM553645 4 0.0146 0.8331 0.000 0.000 0.000 0.996 0.004 0.000
#> GSM553646 4 0.0260 0.8322 0.000 0.000 0.000 0.992 0.008 0.000
#> GSM553647 4 0.0000 0.8335 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM553648 3 0.0000 0.8409 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM553649 3 0.0000 0.8409 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM553650 2 0.0000 0.9981 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM553651 2 0.0000 0.9981 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM553652 2 0.0000 0.9981 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 individual(p) k
#> SD:mclust 52 0.8749 2
#> SD:mclust 46 0.2599 3
#> SD:mclust 53 0.0135 4
#> SD:mclust 54 0.1063 5
#> SD:mclust 52 0.0342 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.737 0.881 0.947 0.4978 0.494 0.494
#> 3 3 0.719 0.795 0.915 0.2709 0.724 0.514
#> 4 4 0.698 0.772 0.874 0.1873 0.775 0.461
#> 5 5 0.697 0.738 0.836 0.0625 0.903 0.639
#> 6 6 0.697 0.579 0.775 0.0373 0.877 0.504
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
#> GSM553595 1 0.9732 0.3224 0.596 0.404
#> GSM553596 2 0.9000 0.6303 0.316 0.684
#> GSM553597 1 0.0000 0.9610 1.000 0.000
#> GSM553598 2 0.0000 0.9180 0.000 1.000
#> GSM553599 1 0.0000 0.9610 1.000 0.000
#> GSM553600 1 0.0000 0.9610 1.000 0.000
#> GSM553601 1 0.0000 0.9610 1.000 0.000
#> GSM553602 1 0.0000 0.9610 1.000 0.000
#> GSM553603 1 0.0000 0.9610 1.000 0.000
#> GSM553604 1 0.0000 0.9610 1.000 0.000
#> GSM553605 2 0.0000 0.9180 0.000 1.000
#> GSM553606 2 0.0000 0.9180 0.000 1.000
#> GSM553607 2 0.0000 0.9180 0.000 1.000
#> GSM553608 2 0.0000 0.9180 0.000 1.000
#> GSM553609 2 0.0000 0.9180 0.000 1.000
#> GSM553610 2 0.0000 0.9180 0.000 1.000
#> GSM553611 2 0.6801 0.8081 0.180 0.820
#> GSM553612 2 0.0000 0.9180 0.000 1.000
#> GSM553613 2 0.0000 0.9180 0.000 1.000
#> GSM553614 1 0.0000 0.9610 1.000 0.000
#> GSM553615 1 0.0000 0.9610 1.000 0.000
#> GSM553616 1 0.0000 0.9610 1.000 0.000
#> GSM553617 1 0.0000 0.9610 1.000 0.000
#> GSM553618 2 0.5629 0.8480 0.132 0.868
#> GSM553619 2 0.9170 0.5980 0.332 0.668
#> GSM553620 1 0.0000 0.9610 1.000 0.000
#> GSM553621 1 0.0000 0.9610 1.000 0.000
#> GSM553622 1 0.0000 0.9610 1.000 0.000
#> GSM553623 1 0.0000 0.9610 1.000 0.000
#> GSM553624 1 0.0000 0.9610 1.000 0.000
#> GSM553625 1 0.0000 0.9610 1.000 0.000
#> GSM553626 1 0.0000 0.9610 1.000 0.000
#> GSM553627 1 0.0000 0.9610 1.000 0.000
#> GSM553628 1 0.0000 0.9610 1.000 0.000
#> GSM553629 1 0.0000 0.9610 1.000 0.000
#> GSM553630 1 0.0000 0.9610 1.000 0.000
#> GSM553631 1 0.0000 0.9610 1.000 0.000
#> GSM553632 1 0.0000 0.9610 1.000 0.000
#> GSM553633 2 0.0000 0.9180 0.000 1.000
#> GSM553634 2 0.7219 0.7884 0.200 0.800
#> GSM553635 2 0.3114 0.8945 0.056 0.944
#> GSM553636 2 0.8327 0.7117 0.264 0.736
#> GSM553637 2 0.0000 0.9180 0.000 1.000
#> GSM553638 2 0.0000 0.9180 0.000 1.000
#> GSM553639 2 0.6531 0.8193 0.168 0.832
#> GSM553640 1 0.9977 -0.0814 0.528 0.472
#> GSM553641 2 0.0000 0.9180 0.000 1.000
#> GSM553642 1 0.0000 0.9610 1.000 0.000
#> GSM553643 1 0.6048 0.8000 0.852 0.148
#> GSM553644 1 0.0000 0.9610 1.000 0.000
#> GSM553645 2 0.0000 0.9180 0.000 1.000
#> GSM553646 1 0.0376 0.9575 0.996 0.004
#> GSM553647 1 0.2236 0.9273 0.964 0.036
#> GSM553648 2 0.0000 0.9180 0.000 1.000
#> GSM553649 2 0.0000 0.9180 0.000 1.000
#> GSM553650 2 0.0376 0.9167 0.004 0.996
#> GSM553651 2 0.9170 0.6023 0.332 0.668
#> GSM553652 2 0.2603 0.9003 0.044 0.956
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> GSM553595 3 0.6244 0.1897 0.440 0.000 0.560
#> GSM553596 1 0.6291 0.0508 0.532 0.000 0.468
#> GSM553597 1 0.0237 0.9250 0.996 0.000 0.004
#> GSM553598 3 0.0000 0.8523 0.000 0.000 1.000
#> GSM553599 1 0.0424 0.9242 0.992 0.008 0.000
#> GSM553600 1 0.1643 0.9012 0.956 0.044 0.000
#> GSM553601 1 0.0237 0.9253 0.996 0.004 0.000
#> GSM553602 1 0.0000 0.9258 1.000 0.000 0.000
#> GSM553603 1 0.0237 0.9250 0.996 0.000 0.004
#> GSM553604 1 0.0000 0.9258 1.000 0.000 0.000
#> GSM553605 3 0.0237 0.8514 0.000 0.004 0.996
#> GSM553606 2 0.6126 0.2801 0.000 0.600 0.400
#> GSM553607 2 0.2261 0.8270 0.000 0.932 0.068
#> GSM553608 2 0.0424 0.8650 0.000 0.992 0.008
#> GSM553609 2 0.0237 0.8656 0.000 0.996 0.004
#> GSM553610 3 0.5397 0.5167 0.000 0.280 0.720
#> GSM553611 2 0.0237 0.8656 0.000 0.996 0.004
#> GSM553612 2 0.5465 0.5986 0.000 0.712 0.288
#> GSM553613 3 0.0237 0.8514 0.000 0.004 0.996
#> GSM553614 1 0.0000 0.9258 1.000 0.000 0.000
#> GSM553615 1 0.3686 0.8137 0.860 0.140 0.000
#> GSM553616 2 0.5988 0.4482 0.368 0.632 0.000
#> GSM553617 1 0.0237 0.9253 0.996 0.004 0.000
#> GSM553618 3 0.7809 0.2695 0.396 0.056 0.548
#> GSM553619 1 0.7926 0.5212 0.656 0.216 0.128
#> GSM553620 1 0.0237 0.9250 0.996 0.000 0.004
#> GSM553621 1 0.0000 0.9258 1.000 0.000 0.000
#> GSM553622 1 0.0237 0.9253 0.996 0.004 0.000
#> GSM553623 1 0.4291 0.7649 0.820 0.180 0.000
#> GSM553624 2 0.6026 0.4299 0.376 0.624 0.000
#> GSM553625 1 0.0000 0.9258 1.000 0.000 0.000
#> GSM553626 1 0.0424 0.9242 0.992 0.008 0.000
#> GSM553627 1 0.0000 0.9258 1.000 0.000 0.000
#> GSM553628 1 0.2959 0.8543 0.900 0.100 0.000
#> GSM553629 2 0.1964 0.8414 0.056 0.944 0.000
#> GSM553630 1 0.0000 0.9258 1.000 0.000 0.000
#> GSM553631 1 0.3340 0.8235 0.880 0.120 0.000
#> GSM553632 1 0.0424 0.9242 0.992 0.008 0.000
#> GSM553633 3 0.0747 0.8475 0.016 0.000 0.984
#> GSM553634 2 0.0237 0.8656 0.000 0.996 0.004
#> GSM553635 2 0.0000 0.8650 0.000 1.000 0.000
#> GSM553636 2 0.4504 0.7071 0.196 0.804 0.000
#> GSM553637 2 0.1411 0.8504 0.000 0.964 0.036
#> GSM553638 2 0.1163 0.8592 0.000 0.972 0.028
#> GSM553639 2 0.2301 0.8396 0.060 0.936 0.004
#> GSM553640 2 0.0237 0.8644 0.004 0.996 0.000
#> GSM553641 3 0.0237 0.8514 0.000 0.004 0.996
#> GSM553642 1 0.0237 0.9250 0.996 0.000 0.004
#> GSM553643 1 0.4605 0.7153 0.796 0.000 0.204
#> GSM553644 1 0.0237 0.9250 0.996 0.000 0.004
#> GSM553645 3 0.1031 0.8432 0.024 0.000 0.976
#> GSM553646 1 0.2448 0.8717 0.924 0.000 0.076
#> GSM553647 1 0.1163 0.9117 0.972 0.000 0.028
#> GSM553648 3 0.0000 0.8523 0.000 0.000 1.000
#> GSM553649 3 0.0000 0.8523 0.000 0.000 1.000
#> GSM553650 2 0.0237 0.8656 0.000 0.996 0.004
#> GSM553651 2 0.1860 0.8456 0.052 0.948 0.000
#> GSM553652 2 0.0237 0.8656 0.000 0.996 0.004
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> GSM553595 3 0.2466 0.8903 0.004 0.000 0.900 0.096
#> GSM553596 4 0.4955 0.5287 0.000 0.024 0.268 0.708
#> GSM553597 4 0.0336 0.7670 0.000 0.000 0.008 0.992
#> GSM553598 3 0.2596 0.8982 0.000 0.024 0.908 0.068
#> GSM553599 1 0.1305 0.8120 0.960 0.004 0.000 0.036
#> GSM553600 4 0.4477 0.5658 0.312 0.000 0.000 0.688
#> GSM553601 4 0.5361 0.6225 0.224 0.000 0.060 0.716
#> GSM553602 1 0.2589 0.7946 0.884 0.000 0.000 0.116
#> GSM553603 4 0.6613 0.6102 0.200 0.000 0.172 0.628
#> GSM553604 1 0.0921 0.7989 0.972 0.000 0.000 0.028
#> GSM553605 3 0.0188 0.9353 0.000 0.004 0.996 0.000
#> GSM553606 2 0.1118 0.8979 0.000 0.964 0.036 0.000
#> GSM553607 2 0.0376 0.9099 0.000 0.992 0.004 0.004
#> GSM553608 2 0.1004 0.9081 0.024 0.972 0.004 0.000
#> GSM553609 2 0.0000 0.9112 0.000 1.000 0.000 0.000
#> GSM553610 2 0.4697 0.4761 0.000 0.644 0.356 0.000
#> GSM553611 2 0.1302 0.9017 0.044 0.956 0.000 0.000
#> GSM553612 2 0.3219 0.8092 0.000 0.836 0.164 0.000
#> GSM553613 3 0.0188 0.9353 0.000 0.004 0.996 0.000
#> GSM553614 4 0.0000 0.7668 0.000 0.000 0.000 1.000
#> GSM553615 1 0.4516 0.6411 0.736 0.012 0.000 0.252
#> GSM553616 2 0.4877 0.5268 0.008 0.664 0.000 0.328
#> GSM553617 4 0.2216 0.7692 0.092 0.000 0.000 0.908
#> GSM553618 4 0.2021 0.7505 0.000 0.024 0.040 0.936
#> GSM553619 4 0.1743 0.7438 0.000 0.056 0.004 0.940
#> GSM553620 4 0.1716 0.7728 0.064 0.000 0.000 0.936
#> GSM553621 4 0.2408 0.7668 0.104 0.000 0.000 0.896
#> GSM553622 4 0.2345 0.7691 0.100 0.000 0.000 0.900
#> GSM553623 1 0.4322 0.7601 0.804 0.044 0.000 0.152
#> GSM553624 1 0.3355 0.7420 0.836 0.160 0.000 0.004
#> GSM553625 4 0.4454 0.6022 0.308 0.000 0.000 0.692
#> GSM553626 1 0.2714 0.8011 0.884 0.004 0.000 0.112
#> GSM553627 1 0.1118 0.7988 0.964 0.000 0.000 0.036
#> GSM553628 1 0.1978 0.8161 0.928 0.004 0.000 0.068
#> GSM553629 2 0.2443 0.8770 0.024 0.916 0.000 0.060
#> GSM553630 4 0.4996 0.3528 0.484 0.000 0.000 0.516
#> GSM553631 4 0.0188 0.7666 0.000 0.004 0.000 0.996
#> GSM553632 1 0.2530 0.8061 0.896 0.004 0.000 0.100
#> GSM553633 3 0.0336 0.9350 0.000 0.000 0.992 0.008
#> GSM553634 2 0.0000 0.9112 0.000 1.000 0.000 0.000
#> GSM553635 2 0.0188 0.9111 0.000 0.996 0.000 0.004
#> GSM553636 1 0.3355 0.7352 0.836 0.160 0.000 0.004
#> GSM553637 2 0.0188 0.9106 0.000 0.996 0.004 0.000
#> GSM553638 2 0.1913 0.8993 0.040 0.940 0.020 0.000
#> GSM553639 2 0.3583 0.7460 0.180 0.816 0.000 0.004
#> GSM553640 2 0.0592 0.9096 0.016 0.984 0.000 0.000
#> GSM553641 3 0.0000 0.9363 0.000 0.000 1.000 0.000
#> GSM553642 4 0.5172 0.5280 0.404 0.000 0.008 0.588
#> GSM553643 3 0.2214 0.9044 0.044 0.000 0.928 0.028
#> GSM553644 4 0.5295 0.3652 0.488 0.000 0.008 0.504
#> GSM553645 3 0.0336 0.9357 0.008 0.000 0.992 0.000
#> GSM553646 3 0.4920 0.7606 0.192 0.000 0.756 0.052
#> GSM553647 3 0.3718 0.8096 0.168 0.000 0.820 0.012
#> GSM553648 3 0.0000 0.9363 0.000 0.000 1.000 0.000
#> GSM553649 3 0.0000 0.9363 0.000 0.000 1.000 0.000
#> GSM553650 2 0.0921 0.9075 0.028 0.972 0.000 0.000
#> GSM553651 1 0.5165 0.0795 0.512 0.484 0.000 0.004
#> GSM553652 2 0.0188 0.9113 0.004 0.996 0.000 0.000
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> GSM553595 3 0.4422 0.7046 0.004 0.000 0.772 0.120 0.104
#> GSM553596 5 0.5233 0.6104 0.020 0.008 0.180 0.068 0.724
#> GSM553597 5 0.4283 -0.0286 0.000 0.000 0.000 0.456 0.544
#> GSM553598 3 0.4256 0.1768 0.000 0.000 0.564 0.000 0.436
#> GSM553599 1 0.1399 0.7913 0.952 0.000 0.000 0.020 0.028
#> GSM553600 5 0.5379 0.5882 0.268 0.000 0.000 0.096 0.636
#> GSM553601 5 0.4111 0.7450 0.100 0.000 0.048 0.036 0.816
#> GSM553602 1 0.2669 0.8024 0.876 0.000 0.000 0.104 0.020
#> GSM553603 4 0.4885 0.7253 0.060 0.000 0.136 0.760 0.044
#> GSM553604 1 0.4607 0.5069 0.664 0.000 0.012 0.312 0.012
#> GSM553605 3 0.0000 0.8951 0.000 0.000 1.000 0.000 0.000
#> GSM553606 2 0.0609 0.9046 0.000 0.980 0.020 0.000 0.000
#> GSM553607 2 0.0404 0.9072 0.000 0.988 0.000 0.000 0.012
#> GSM553608 2 0.0693 0.9057 0.008 0.980 0.000 0.012 0.000
#> GSM553609 2 0.0000 0.9074 0.000 1.000 0.000 0.000 0.000
#> GSM553610 2 0.2561 0.8181 0.000 0.856 0.144 0.000 0.000
#> GSM553611 2 0.1740 0.8836 0.056 0.932 0.000 0.000 0.012
#> GSM553612 2 0.3234 0.8487 0.008 0.864 0.088 0.036 0.004
#> GSM553613 3 0.0510 0.8858 0.000 0.016 0.984 0.000 0.000
#> GSM553614 4 0.4030 0.5039 0.000 0.000 0.000 0.648 0.352
#> GSM553615 5 0.5037 0.6287 0.228 0.000 0.000 0.088 0.684
#> GSM553616 2 0.5941 0.4274 0.000 0.584 0.000 0.256 0.160
#> GSM553617 5 0.3214 0.6900 0.036 0.000 0.000 0.120 0.844
#> GSM553618 5 0.3404 0.7269 0.024 0.000 0.068 0.048 0.860
#> GSM553619 5 0.1571 0.7114 0.000 0.004 0.000 0.060 0.936
#> GSM553620 4 0.2891 0.7198 0.000 0.000 0.000 0.824 0.176
#> GSM553621 4 0.2583 0.7469 0.004 0.000 0.000 0.864 0.132
#> GSM553622 4 0.3697 0.7273 0.080 0.000 0.000 0.820 0.100
#> GSM553623 5 0.4953 0.6361 0.264 0.036 0.000 0.016 0.684
#> GSM553624 1 0.2868 0.7892 0.884 0.072 0.000 0.032 0.012
#> GSM553625 5 0.4989 0.6753 0.168 0.000 0.000 0.124 0.708
#> GSM553626 1 0.3916 0.7706 0.804 0.000 0.000 0.104 0.092
#> GSM553627 1 0.1792 0.8089 0.916 0.000 0.000 0.084 0.000
#> GSM553628 1 0.3758 0.7798 0.816 0.000 0.000 0.096 0.088
#> GSM553629 2 0.6319 0.5332 0.108 0.648 0.000 0.076 0.168
#> GSM553630 4 0.2376 0.7650 0.044 0.000 0.000 0.904 0.052
#> GSM553631 5 0.4140 0.7278 0.064 0.012 0.000 0.124 0.800
#> GSM553632 1 0.3527 0.7919 0.828 0.000 0.000 0.116 0.056
#> GSM553633 3 0.1612 0.8647 0.016 0.000 0.948 0.024 0.012
#> GSM553634 2 0.0000 0.9074 0.000 1.000 0.000 0.000 0.000
#> GSM553635 2 0.0162 0.9077 0.000 0.996 0.000 0.000 0.004
#> GSM553636 1 0.2703 0.7606 0.896 0.024 0.000 0.060 0.020
#> GSM553637 2 0.0162 0.9077 0.000 0.996 0.000 0.000 0.004
#> GSM553638 2 0.2597 0.8741 0.060 0.896 0.040 0.000 0.004
#> GSM553639 2 0.3053 0.8240 0.128 0.852 0.000 0.012 0.008
#> GSM553640 2 0.0404 0.9072 0.000 0.988 0.000 0.000 0.012
#> GSM553641 3 0.0000 0.8951 0.000 0.000 1.000 0.000 0.000
#> GSM553642 4 0.1989 0.7798 0.020 0.000 0.032 0.932 0.016
#> GSM553643 4 0.4533 0.3473 0.008 0.000 0.448 0.544 0.000
#> GSM553644 4 0.2178 0.7671 0.048 0.000 0.024 0.920 0.008
#> GSM553645 3 0.0324 0.8914 0.004 0.000 0.992 0.004 0.000
#> GSM553646 4 0.3556 0.7534 0.036 0.000 0.116 0.836 0.012
#> GSM553647 4 0.4533 0.6654 0.032 0.000 0.260 0.704 0.004
#> GSM553648 3 0.0000 0.8951 0.000 0.000 1.000 0.000 0.000
#> GSM553649 3 0.0000 0.8951 0.000 0.000 1.000 0.000 0.000
#> GSM553650 2 0.0162 0.9077 0.004 0.996 0.000 0.000 0.000
#> GSM553651 1 0.4759 0.4210 0.636 0.336 0.000 0.024 0.004
#> GSM553652 2 0.1460 0.9005 0.020 0.956 0.004 0.012 0.008
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> GSM553595 4 0.7584 0.1786 0.000 0.000 0.276 0.328 0.172 0.224
#> GSM553596 4 0.4342 0.6676 0.044 0.000 0.064 0.796 0.028 0.068
#> GSM553597 4 0.3936 0.6509 0.000 0.008 0.000 0.780 0.124 0.088
#> GSM553598 4 0.4046 0.4140 0.000 0.000 0.368 0.620 0.004 0.008
#> GSM553599 1 0.4564 -0.2032 0.500 0.000 0.000 0.020 0.008 0.472
#> GSM553600 1 0.5495 0.2919 0.512 0.000 0.000 0.376 0.008 0.104
#> GSM553601 4 0.3296 0.5885 0.180 0.000 0.020 0.796 0.000 0.004
#> GSM553602 1 0.2714 0.4586 0.848 0.000 0.000 0.004 0.012 0.136
#> GSM553603 5 0.6626 0.2951 0.360 0.000 0.132 0.008 0.448 0.052
#> GSM553604 6 0.6272 0.3107 0.200 0.000 0.028 0.004 0.240 0.528
#> GSM553605 3 0.0547 0.8268 0.000 0.000 0.980 0.000 0.000 0.020
#> GSM553606 2 0.1401 0.8922 0.000 0.948 0.020 0.004 0.000 0.028
#> GSM553607 2 0.1508 0.8837 0.004 0.940 0.004 0.004 0.000 0.048
#> GSM553608 2 0.1471 0.8837 0.000 0.932 0.000 0.000 0.004 0.064
#> GSM553609 2 0.1003 0.8921 0.000 0.964 0.004 0.004 0.000 0.028
#> GSM553610 2 0.2669 0.8238 0.000 0.864 0.108 0.004 0.000 0.024
#> GSM553611 2 0.2442 0.8462 0.068 0.884 0.000 0.000 0.000 0.048
#> GSM553612 2 0.5080 0.6876 0.004 0.708 0.152 0.008 0.020 0.108
#> GSM553613 3 0.1480 0.8113 0.000 0.020 0.940 0.000 0.000 0.040
#> GSM553614 4 0.3866 0.6097 0.000 0.012 0.000 0.764 0.188 0.036
#> GSM553615 1 0.3593 0.5130 0.788 0.004 0.000 0.164 0.000 0.044
#> GSM553616 5 0.7059 -0.0926 0.004 0.184 0.000 0.356 0.380 0.076
#> GSM553617 4 0.2706 0.7004 0.016 0.008 0.000 0.888 0.040 0.048
#> GSM553618 4 0.2987 0.6879 0.056 0.000 0.080 0.856 0.000 0.008
#> GSM553619 4 0.0858 0.6931 0.028 0.000 0.004 0.968 0.000 0.000
#> GSM553620 5 0.1934 0.6711 0.000 0.000 0.000 0.044 0.916 0.040
#> GSM553621 5 0.1642 0.6849 0.004 0.000 0.000 0.028 0.936 0.032
#> GSM553622 5 0.5038 0.5169 0.292 0.000 0.000 0.068 0.624 0.016
#> GSM553623 4 0.5538 0.2541 0.312 0.008 0.000 0.564 0.004 0.112
#> GSM553624 1 0.4833 0.1001 0.640 0.060 0.000 0.000 0.012 0.288
#> GSM553625 1 0.5032 0.4283 0.632 0.000 0.000 0.284 0.064 0.020
#> GSM553626 1 0.1382 0.5321 0.948 0.000 0.000 0.008 0.036 0.008
#> GSM553627 1 0.4639 -0.1795 0.512 0.000 0.000 0.000 0.040 0.448
#> GSM553628 1 0.1080 0.5231 0.960 0.000 0.000 0.004 0.004 0.032
#> GSM553629 1 0.5511 0.2115 0.580 0.328 0.000 0.020 0.016 0.056
#> GSM553630 5 0.2781 0.7075 0.108 0.000 0.000 0.008 0.860 0.024
#> GSM553631 1 0.6513 0.2293 0.484 0.020 0.000 0.332 0.136 0.028
#> GSM553632 1 0.1745 0.5218 0.920 0.000 0.000 0.000 0.068 0.012
#> GSM553633 3 0.3431 0.7533 0.028 0.000 0.848 0.064 0.012 0.048
#> GSM553634 2 0.0858 0.8915 0.000 0.968 0.000 0.000 0.004 0.028
#> GSM553635 2 0.0993 0.8935 0.000 0.964 0.000 0.012 0.000 0.024
#> GSM553636 6 0.4726 0.2993 0.352 0.036 0.000 0.000 0.012 0.600
#> GSM553637 2 0.1010 0.8890 0.000 0.960 0.004 0.000 0.000 0.036
#> GSM553638 2 0.4165 0.7647 0.024 0.776 0.092 0.000 0.000 0.108
#> GSM553639 2 0.4516 0.6706 0.032 0.708 0.004 0.008 0.012 0.236
#> GSM553640 2 0.1285 0.8842 0.004 0.944 0.000 0.000 0.000 0.052
#> GSM553641 3 0.0260 0.8273 0.000 0.000 0.992 0.000 0.000 0.008
#> GSM553642 5 0.2834 0.6985 0.128 0.000 0.008 0.000 0.848 0.016
#> GSM553643 3 0.5057 0.5371 0.088 0.000 0.668 0.000 0.220 0.024
#> GSM553644 5 0.2069 0.7065 0.068 0.000 0.000 0.004 0.908 0.020
#> GSM553645 3 0.2886 0.7711 0.000 0.000 0.836 0.004 0.016 0.144
#> GSM553646 5 0.3518 0.6333 0.016 0.000 0.044 0.004 0.824 0.112
#> GSM553647 3 0.4984 0.0143 0.056 0.000 0.480 0.000 0.460 0.004
#> GSM553648 3 0.0260 0.8277 0.000 0.000 0.992 0.000 0.000 0.008
#> GSM553649 3 0.0725 0.8274 0.000 0.000 0.976 0.000 0.012 0.012
#> GSM553650 2 0.0858 0.8914 0.004 0.968 0.000 0.000 0.000 0.028
#> GSM553651 6 0.5211 0.3929 0.116 0.256 0.000 0.000 0.008 0.620
#> GSM553652 2 0.2287 0.8797 0.008 0.912 0.004 0.012 0.016 0.048
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 individual(p) k
#> SD:NMF 56 0.16390 2
#> SD:NMF 52 0.20903 3
#> SD:NMF 54 0.00307 4
#> SD:NMF 53 0.03660 5
#> SD:NMF 41 0.01293 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.350 0.813 0.902 0.4816 0.491 0.491
#> 3 3 0.392 0.632 0.794 0.2771 0.885 0.766
#> 4 4 0.618 0.585 0.806 0.1585 0.898 0.743
#> 5 5 0.628 0.518 0.742 0.0674 0.841 0.562
#> 6 6 0.653 0.618 0.752 0.0536 0.925 0.717
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
#> GSM553595 2 0.9323 0.351 0.348 0.652
#> GSM553596 2 0.9323 0.351 0.348 0.652
#> GSM553597 1 0.8661 0.705 0.712 0.288
#> GSM553598 2 0.4815 0.830 0.104 0.896
#> GSM553599 1 0.8016 0.750 0.756 0.244
#> GSM553600 1 0.0000 0.827 1.000 0.000
#> GSM553601 1 0.9970 0.308 0.532 0.468
#> GSM553602 1 0.0000 0.827 1.000 0.000
#> GSM553603 1 0.4815 0.829 0.896 0.104
#> GSM553604 1 0.8327 0.734 0.736 0.264
#> GSM553605 2 0.0000 0.924 0.000 1.000
#> GSM553606 2 0.0000 0.924 0.000 1.000
#> GSM553607 2 0.0000 0.924 0.000 1.000
#> GSM553608 2 0.0000 0.924 0.000 1.000
#> GSM553609 2 0.0000 0.924 0.000 1.000
#> GSM553610 2 0.0000 0.924 0.000 1.000
#> GSM553611 2 0.0000 0.924 0.000 1.000
#> GSM553612 2 0.0000 0.924 0.000 1.000
#> GSM553613 2 0.0000 0.924 0.000 1.000
#> GSM553614 1 0.8555 0.715 0.720 0.280
#> GSM553615 1 0.5629 0.800 0.868 0.132
#> GSM553616 1 0.7674 0.770 0.776 0.224
#> GSM553617 1 0.8016 0.750 0.756 0.244
#> GSM553618 2 0.8661 0.518 0.288 0.712
#> GSM553619 2 0.7453 0.688 0.212 0.788
#> GSM553620 1 0.0000 0.827 1.000 0.000
#> GSM553621 1 0.0000 0.827 1.000 0.000
#> GSM553622 1 0.0000 0.827 1.000 0.000
#> GSM553623 1 0.8016 0.750 0.756 0.244
#> GSM553624 1 0.8016 0.750 0.756 0.244
#> GSM553625 1 0.7883 0.755 0.764 0.236
#> GSM553626 1 0.0000 0.827 1.000 0.000
#> GSM553627 1 0.7950 0.753 0.760 0.240
#> GSM553628 1 0.0000 0.827 1.000 0.000
#> GSM553629 1 0.5629 0.800 0.868 0.132
#> GSM553630 1 0.3879 0.826 0.924 0.076
#> GSM553631 1 0.5629 0.800 0.868 0.132
#> GSM553632 1 0.0000 0.827 1.000 0.000
#> GSM553633 2 0.6247 0.769 0.156 0.844
#> GSM553634 2 0.0000 0.924 0.000 1.000
#> GSM553635 2 0.0000 0.924 0.000 1.000
#> GSM553636 2 0.0938 0.916 0.012 0.988
#> GSM553637 2 0.0000 0.924 0.000 1.000
#> GSM553638 2 0.0000 0.924 0.000 1.000
#> GSM553639 2 0.0000 0.924 0.000 1.000
#> GSM553640 2 0.0000 0.924 0.000 1.000
#> GSM553641 2 0.0000 0.924 0.000 1.000
#> GSM553642 1 0.4815 0.829 0.896 0.104
#> GSM553643 1 0.4815 0.829 0.896 0.104
#> GSM553644 1 0.4815 0.829 0.896 0.104
#> GSM553645 2 0.6247 0.769 0.156 0.844
#> GSM553646 1 0.4815 0.829 0.896 0.104
#> GSM553647 1 0.4815 0.829 0.896 0.104
#> GSM553648 2 0.0000 0.924 0.000 1.000
#> GSM553649 2 0.0000 0.924 0.000 1.000
#> GSM553650 2 0.0000 0.924 0.000 1.000
#> GSM553651 2 0.0938 0.916 0.012 0.988
#> GSM553652 2 0.0000 0.924 0.000 1.000
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> GSM553595 2 0.9735 -0.155 0.244 0.440 0.316
#> GSM553596 2 0.9735 -0.155 0.244 0.440 0.316
#> GSM553597 1 0.7677 0.635 0.656 0.252 0.092
#> GSM553598 3 0.5397 0.539 0.000 0.280 0.720
#> GSM553599 1 0.7569 0.662 0.668 0.240 0.092
#> GSM553600 1 0.0000 0.772 1.000 0.000 0.000
#> GSM553601 1 0.9521 0.312 0.440 0.368 0.192
#> GSM553602 1 0.0000 0.772 1.000 0.000 0.000
#> GSM553603 1 0.4195 0.747 0.852 0.012 0.136
#> GSM553604 1 0.7909 0.651 0.648 0.240 0.112
#> GSM553605 3 0.3941 0.597 0.000 0.156 0.844
#> GSM553606 2 0.6062 0.182 0.000 0.616 0.384
#> GSM553607 2 0.5178 0.447 0.000 0.744 0.256
#> GSM553608 2 0.0000 0.783 0.000 1.000 0.000
#> GSM553609 2 0.0424 0.780 0.000 0.992 0.008
#> GSM553610 2 0.6062 0.182 0.000 0.616 0.384
#> GSM553611 2 0.0000 0.783 0.000 1.000 0.000
#> GSM553612 2 0.0000 0.783 0.000 1.000 0.000
#> GSM553613 3 0.3941 0.597 0.000 0.156 0.844
#> GSM553614 1 0.7569 0.643 0.664 0.248 0.088
#> GSM553615 1 0.4196 0.715 0.864 0.112 0.024
#> GSM553616 1 0.6673 0.686 0.720 0.224 0.056
#> GSM553617 1 0.7569 0.662 0.668 0.240 0.092
#> GSM553618 3 0.9168 0.389 0.184 0.288 0.528
#> GSM553619 3 0.8109 0.488 0.108 0.272 0.620
#> GSM553620 1 0.0000 0.772 1.000 0.000 0.000
#> GSM553621 1 0.0000 0.772 1.000 0.000 0.000
#> GSM553622 1 0.0000 0.772 1.000 0.000 0.000
#> GSM553623 1 0.7569 0.662 0.668 0.240 0.092
#> GSM553624 1 0.7569 0.662 0.668 0.240 0.092
#> GSM553625 1 0.7458 0.666 0.676 0.236 0.088
#> GSM553626 1 0.0000 0.772 1.000 0.000 0.000
#> GSM553627 1 0.7531 0.665 0.672 0.236 0.092
#> GSM553628 1 0.0000 0.772 1.000 0.000 0.000
#> GSM553629 1 0.4196 0.715 0.864 0.112 0.024
#> GSM553630 1 0.3797 0.759 0.892 0.056 0.052
#> GSM553631 1 0.4196 0.715 0.864 0.112 0.024
#> GSM553632 1 0.0000 0.772 1.000 0.000 0.000
#> GSM553633 3 0.7819 0.286 0.052 0.440 0.508
#> GSM553634 2 0.0000 0.783 0.000 1.000 0.000
#> GSM553635 2 0.0237 0.781 0.000 0.996 0.004
#> GSM553636 2 0.0829 0.769 0.012 0.984 0.004
#> GSM553637 2 0.5178 0.447 0.000 0.744 0.256
#> GSM553638 2 0.0424 0.780 0.000 0.992 0.008
#> GSM553639 2 0.0000 0.783 0.000 1.000 0.000
#> GSM553640 2 0.0000 0.783 0.000 1.000 0.000
#> GSM553641 3 0.4121 0.646 0.000 0.168 0.832
#> GSM553642 1 0.4195 0.747 0.852 0.012 0.136
#> GSM553643 1 0.4195 0.747 0.852 0.012 0.136
#> GSM553644 1 0.4195 0.747 0.852 0.012 0.136
#> GSM553645 3 0.7819 0.286 0.052 0.440 0.508
#> GSM553646 1 0.4195 0.747 0.852 0.012 0.136
#> GSM553647 1 0.4195 0.747 0.852 0.012 0.136
#> GSM553648 3 0.4121 0.646 0.000 0.168 0.832
#> GSM553649 3 0.4121 0.646 0.000 0.168 0.832
#> GSM553650 2 0.0000 0.783 0.000 1.000 0.000
#> GSM553651 2 0.0829 0.769 0.012 0.984 0.004
#> GSM553652 2 0.0000 0.783 0.000 1.000 0.000
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> GSM553595 4 0.2405 0.5724 0.036 0.020 0.016 0.928
#> GSM553596 4 0.2405 0.5724 0.036 0.020 0.016 0.928
#> GSM553597 4 0.5000 -0.2657 0.500 0.000 0.000 0.500
#> GSM553598 4 0.4978 -0.0625 0.000 0.004 0.384 0.612
#> GSM553599 1 0.5526 0.3192 0.564 0.020 0.000 0.416
#> GSM553600 1 0.0000 0.6653 1.000 0.000 0.000 0.000
#> GSM553601 4 0.4711 0.3097 0.236 0.024 0.000 0.740
#> GSM553602 1 0.2469 0.6411 0.892 0.000 0.000 0.108
#> GSM553603 1 0.4543 0.5482 0.676 0.000 0.000 0.324
#> GSM553604 4 0.5500 -0.2661 0.464 0.016 0.000 0.520
#> GSM553605 3 0.0336 0.8128 0.000 0.000 0.992 0.008
#> GSM553606 2 0.5558 0.4907 0.000 0.608 0.364 0.028
#> GSM553607 2 0.4988 0.6780 0.000 0.728 0.236 0.036
#> GSM553608 2 0.0000 0.9082 0.000 1.000 0.000 0.000
#> GSM553609 2 0.0336 0.9061 0.000 0.992 0.008 0.000
#> GSM553610 2 0.5558 0.4907 0.000 0.608 0.364 0.028
#> GSM553611 2 0.0000 0.9082 0.000 1.000 0.000 0.000
#> GSM553612 2 0.0000 0.9082 0.000 1.000 0.000 0.000
#> GSM553613 3 0.0336 0.8128 0.000 0.000 0.992 0.008
#> GSM553614 1 0.4999 0.1740 0.508 0.000 0.000 0.492
#> GSM553615 1 0.3208 0.5881 0.848 0.004 0.000 0.148
#> GSM553616 1 0.5206 0.4133 0.668 0.024 0.000 0.308
#> GSM553617 1 0.5526 0.3192 0.564 0.020 0.000 0.416
#> GSM553618 4 0.4666 0.3716 0.028 0.004 0.200 0.768
#> GSM553619 4 0.6280 0.0640 0.064 0.004 0.332 0.600
#> GSM553620 1 0.0469 0.6673 0.988 0.000 0.000 0.012
#> GSM553621 1 0.0469 0.6673 0.988 0.000 0.000 0.012
#> GSM553622 1 0.0000 0.6653 1.000 0.000 0.000 0.000
#> GSM553623 1 0.5526 0.3192 0.564 0.020 0.000 0.416
#> GSM553624 1 0.5517 0.3221 0.568 0.020 0.000 0.412
#> GSM553625 1 0.5408 0.3317 0.576 0.016 0.000 0.408
#> GSM553626 1 0.0336 0.6653 0.992 0.000 0.000 0.008
#> GSM553627 1 0.5512 0.2168 0.492 0.016 0.000 0.492
#> GSM553628 1 0.0336 0.6653 0.992 0.000 0.000 0.008
#> GSM553629 1 0.3208 0.5881 0.848 0.004 0.000 0.148
#> GSM553630 1 0.3266 0.6280 0.832 0.000 0.000 0.168
#> GSM553631 1 0.3208 0.5881 0.848 0.004 0.000 0.148
#> GSM553632 1 0.0336 0.6653 0.992 0.000 0.000 0.008
#> GSM553633 4 0.4163 0.4469 0.000 0.020 0.188 0.792
#> GSM553634 2 0.0000 0.9082 0.000 1.000 0.000 0.000
#> GSM553635 2 0.0188 0.9072 0.000 0.996 0.004 0.000
#> GSM553636 2 0.0592 0.8977 0.000 0.984 0.000 0.016
#> GSM553637 2 0.4988 0.6780 0.000 0.728 0.236 0.036
#> GSM553638 2 0.0336 0.9060 0.000 0.992 0.008 0.000
#> GSM553639 2 0.0000 0.9082 0.000 1.000 0.000 0.000
#> GSM553640 2 0.0000 0.9082 0.000 1.000 0.000 0.000
#> GSM553641 3 0.3726 0.8597 0.000 0.000 0.788 0.212
#> GSM553642 1 0.4543 0.5482 0.676 0.000 0.000 0.324
#> GSM553643 1 0.4543 0.5482 0.676 0.000 0.000 0.324
#> GSM553644 1 0.4543 0.5482 0.676 0.000 0.000 0.324
#> GSM553645 4 0.4163 0.4469 0.000 0.020 0.188 0.792
#> GSM553646 1 0.4543 0.5482 0.676 0.000 0.000 0.324
#> GSM553647 1 0.4543 0.5482 0.676 0.000 0.000 0.324
#> GSM553648 3 0.3726 0.8597 0.000 0.000 0.788 0.212
#> GSM553649 3 0.3726 0.8597 0.000 0.000 0.788 0.212
#> GSM553650 2 0.0000 0.9082 0.000 1.000 0.000 0.000
#> GSM553651 2 0.0592 0.8977 0.000 0.984 0.000 0.016
#> GSM553652 2 0.0000 0.9082 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
#> GSM553595 1 0.7350 -0.4991 0.356 0.000 0.024 0.320 0.300
#> GSM553596 1 0.7350 -0.4991 0.356 0.000 0.024 0.320 0.300
#> GSM553597 1 0.4201 0.3870 0.752 0.000 0.000 0.204 0.044
#> GSM553598 5 0.6850 0.5078 0.088 0.000 0.196 0.124 0.592
#> GSM553599 1 0.2628 0.4909 0.884 0.000 0.000 0.088 0.028
#> GSM553600 1 0.4540 0.1568 0.640 0.000 0.000 0.340 0.020
#> GSM553601 1 0.6115 -0.0559 0.552 0.000 0.000 0.280 0.168
#> GSM553602 1 0.4291 -0.0316 0.536 0.000 0.000 0.464 0.000
#> GSM553603 4 0.1732 0.7693 0.080 0.000 0.000 0.920 0.000
#> GSM553604 1 0.4106 0.3959 0.724 0.000 0.000 0.256 0.020
#> GSM553605 3 0.0000 0.7864 0.000 0.000 1.000 0.000 0.000
#> GSM553606 2 0.6653 0.4340 0.000 0.476 0.136 0.020 0.368
#> GSM553607 2 0.4744 0.5782 0.000 0.572 0.000 0.020 0.408
#> GSM553608 2 0.0000 0.8733 0.000 1.000 0.000 0.000 0.000
#> GSM553609 2 0.2462 0.8190 0.000 0.880 0.000 0.008 0.112
#> GSM553610 2 0.6653 0.4340 0.000 0.476 0.136 0.020 0.368
#> GSM553611 2 0.0609 0.8717 0.000 0.980 0.000 0.000 0.020
#> GSM553612 2 0.0000 0.8733 0.000 1.000 0.000 0.000 0.000
#> GSM553613 3 0.0000 0.7864 0.000 0.000 1.000 0.000 0.000
#> GSM553614 1 0.4096 0.3972 0.760 0.000 0.000 0.200 0.040
#> GSM553615 1 0.6194 0.0179 0.500 0.000 0.000 0.352 0.148
#> GSM553616 1 0.1461 0.4630 0.952 0.016 0.000 0.028 0.004
#> GSM553617 1 0.2628 0.4909 0.884 0.000 0.000 0.088 0.028
#> GSM553618 5 0.6426 0.6079 0.156 0.000 0.024 0.236 0.584
#> GSM553619 5 0.3449 0.4705 0.120 0.000 0.004 0.040 0.836
#> GSM553620 4 0.4597 0.3720 0.424 0.000 0.000 0.564 0.012
#> GSM553621 4 0.4597 0.3720 0.424 0.000 0.000 0.564 0.012
#> GSM553622 1 0.4540 0.1568 0.640 0.000 0.000 0.340 0.020
#> GSM553623 1 0.2628 0.4909 0.884 0.000 0.000 0.088 0.028
#> GSM553624 1 0.2390 0.4903 0.896 0.000 0.000 0.084 0.020
#> GSM553625 1 0.2519 0.4865 0.884 0.000 0.000 0.100 0.016
#> GSM553626 1 0.4451 0.1645 0.644 0.000 0.000 0.340 0.016
#> GSM553627 1 0.3912 0.4211 0.752 0.000 0.000 0.228 0.020
#> GSM553628 1 0.4451 0.1645 0.644 0.000 0.000 0.340 0.016
#> GSM553629 1 0.6224 0.0145 0.496 0.000 0.000 0.352 0.152
#> GSM553630 4 0.5682 0.2138 0.372 0.000 0.000 0.540 0.088
#> GSM553631 1 0.6224 0.0145 0.496 0.000 0.000 0.352 0.152
#> GSM553632 1 0.4451 0.1645 0.644 0.000 0.000 0.340 0.016
#> GSM553633 5 0.8472 0.6012 0.272 0.000 0.196 0.204 0.328
#> GSM553634 2 0.0703 0.8706 0.000 0.976 0.000 0.000 0.024
#> GSM553635 2 0.0609 0.8722 0.000 0.980 0.000 0.000 0.020
#> GSM553636 2 0.0727 0.8654 0.012 0.980 0.000 0.004 0.004
#> GSM553637 2 0.4744 0.5782 0.000 0.572 0.000 0.020 0.408
#> GSM553638 2 0.0324 0.8728 0.000 0.992 0.004 0.000 0.004
#> GSM553639 2 0.0000 0.8733 0.000 1.000 0.000 0.000 0.000
#> GSM553640 2 0.0865 0.8700 0.004 0.972 0.000 0.000 0.024
#> GSM553641 3 0.4020 0.8373 0.000 0.000 0.796 0.108 0.096
#> GSM553642 4 0.1732 0.7693 0.080 0.000 0.000 0.920 0.000
#> GSM553643 4 0.1732 0.7693 0.080 0.000 0.000 0.920 0.000
#> GSM553644 4 0.1732 0.7693 0.080 0.000 0.000 0.920 0.000
#> GSM553645 5 0.8472 0.6012 0.272 0.000 0.196 0.204 0.328
#> GSM553646 4 0.1732 0.7693 0.080 0.000 0.000 0.920 0.000
#> GSM553647 4 0.1732 0.7693 0.080 0.000 0.000 0.920 0.000
#> GSM553648 3 0.4020 0.8373 0.000 0.000 0.796 0.108 0.096
#> GSM553649 3 0.4020 0.8373 0.000 0.000 0.796 0.108 0.096
#> GSM553650 2 0.0000 0.8733 0.000 1.000 0.000 0.000 0.000
#> GSM553651 2 0.0727 0.8654 0.012 0.980 0.000 0.004 0.004
#> GSM553652 2 0.0000 0.8733 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
#> GSM553595 4 0.5455 0.5756 0.148 0.000 0.012 0.608 0.232 0.000
#> GSM553596 4 0.5455 0.5756 0.148 0.000 0.012 0.608 0.232 0.000
#> GSM553597 1 0.5448 0.3361 0.592 0.000 0.000 0.224 0.180 0.004
#> GSM553598 4 0.6611 0.1788 0.000 0.000 0.184 0.520 0.080 0.216
#> GSM553599 1 0.4322 0.5057 0.672 0.000 0.000 0.288 0.032 0.008
#> GSM553600 1 0.2513 0.5339 0.852 0.000 0.000 0.008 0.140 0.000
#> GSM553601 4 0.6114 0.1697 0.340 0.000 0.000 0.440 0.212 0.008
#> GSM553602 1 0.3288 0.4351 0.724 0.000 0.000 0.000 0.276 0.000
#> GSM553603 5 0.0363 0.7731 0.012 0.000 0.000 0.000 0.988 0.000
#> GSM553604 1 0.5787 0.3125 0.528 0.000 0.000 0.256 0.212 0.004
#> GSM553605 3 0.0000 0.7815 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM553606 6 0.4079 0.8233 0.000 0.112 0.136 0.000 0.000 0.752
#> GSM553607 6 0.1152 0.8380 0.000 0.044 0.000 0.004 0.000 0.952
#> GSM553608 2 0.0000 0.9004 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM553609 2 0.3464 0.4583 0.000 0.688 0.000 0.000 0.000 0.312
#> GSM553610 6 0.4079 0.8233 0.000 0.112 0.136 0.000 0.000 0.752
#> GSM553611 2 0.2968 0.8057 0.000 0.816 0.000 0.016 0.000 0.168
#> GSM553612 2 0.0000 0.9004 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM553613 3 0.0000 0.7815 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM553614 1 0.5399 0.3514 0.600 0.000 0.000 0.220 0.176 0.004
#> GSM553615 1 0.4733 0.4384 0.708 0.000 0.000 0.136 0.144 0.012
#> GSM553616 1 0.3104 0.5593 0.788 0.004 0.000 0.204 0.000 0.004
#> GSM553617 1 0.4322 0.5057 0.672 0.000 0.000 0.288 0.032 0.008
#> GSM553618 4 0.6191 0.4137 0.024 0.000 0.012 0.564 0.196 0.204
#> GSM553619 4 0.3915 0.0342 0.008 0.000 0.000 0.680 0.008 0.304
#> GSM553620 5 0.4002 0.3955 0.404 0.000 0.000 0.008 0.588 0.000
#> GSM553621 5 0.4002 0.3955 0.404 0.000 0.000 0.008 0.588 0.000
#> GSM553622 1 0.2513 0.5339 0.852 0.000 0.000 0.008 0.140 0.000
#> GSM553623 1 0.4322 0.5057 0.672 0.000 0.000 0.288 0.032 0.008
#> GSM553624 1 0.4263 0.5123 0.684 0.000 0.000 0.276 0.032 0.008
#> GSM553625 1 0.4131 0.5232 0.688 0.000 0.000 0.272 0.040 0.000
#> GSM553626 1 0.2402 0.5380 0.856 0.000 0.000 0.004 0.140 0.000
#> GSM553627 1 0.5630 0.3718 0.556 0.000 0.000 0.256 0.184 0.004
#> GSM553628 1 0.2402 0.5380 0.856 0.000 0.000 0.004 0.140 0.000
#> GSM553629 1 0.4769 0.4358 0.704 0.000 0.000 0.140 0.144 0.012
#> GSM553630 5 0.5269 0.2187 0.380 0.000 0.000 0.080 0.532 0.008
#> GSM553631 1 0.4769 0.4358 0.704 0.000 0.000 0.140 0.144 0.012
#> GSM553632 1 0.2402 0.5380 0.856 0.000 0.000 0.004 0.140 0.000
#> GSM553633 4 0.6093 0.5165 0.104 0.000 0.184 0.604 0.108 0.000
#> GSM553634 2 0.3104 0.7930 0.000 0.800 0.000 0.016 0.000 0.184
#> GSM553635 2 0.1610 0.8707 0.000 0.916 0.000 0.000 0.000 0.084
#> GSM553636 2 0.0622 0.8937 0.000 0.980 0.000 0.012 0.000 0.008
#> GSM553637 6 0.1152 0.8380 0.000 0.044 0.000 0.004 0.000 0.952
#> GSM553638 2 0.0858 0.8885 0.000 0.968 0.004 0.000 0.000 0.028
#> GSM553639 2 0.0000 0.9004 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM553640 2 0.3136 0.7918 0.000 0.796 0.000 0.016 0.000 0.188
#> GSM553641 3 0.3694 0.8464 0.000 0.000 0.784 0.140 0.076 0.000
#> GSM553642 5 0.0260 0.7754 0.008 0.000 0.000 0.000 0.992 0.000
#> GSM553643 5 0.0260 0.7754 0.008 0.000 0.000 0.000 0.992 0.000
#> GSM553644 5 0.0260 0.7754 0.008 0.000 0.000 0.000 0.992 0.000
#> GSM553645 4 0.6093 0.5165 0.104 0.000 0.184 0.604 0.108 0.000
#> GSM553646 5 0.0260 0.7754 0.008 0.000 0.000 0.000 0.992 0.000
#> GSM553647 5 0.0260 0.7754 0.008 0.000 0.000 0.000 0.992 0.000
#> GSM553648 3 0.3694 0.8464 0.000 0.000 0.784 0.140 0.076 0.000
#> GSM553649 3 0.3694 0.8464 0.000 0.000 0.784 0.140 0.076 0.000
#> GSM553650 2 0.0146 0.9000 0.000 0.996 0.000 0.000 0.000 0.004
#> GSM553651 2 0.0622 0.8937 0.000 0.980 0.000 0.012 0.000 0.008
#> GSM553652 2 0.0146 0.9000 0.000 0.996 0.000 0.000 0.000 0.004
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 individual(p) k
#> CV:hclust 55 0.20898 2
#> CV:hclust 47 0.11377 3
#> CV:hclust 40 0.08559 4
#> CV:hclust 30 0.09232 5
#> CV:hclust 42 0.00319 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.999 0.999 0.4876 0.513 0.513
#> 3 3 0.774 0.863 0.925 0.3273 0.753 0.547
#> 4 4 0.633 0.649 0.795 0.1436 0.872 0.647
#> 5 5 0.640 0.582 0.743 0.0711 0.895 0.628
#> 6 6 0.685 0.539 0.732 0.0447 0.916 0.623
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
#> GSM553595 1 0.0000 0.999 1.000 0.000
#> GSM553596 1 0.0000 0.999 1.000 0.000
#> GSM553597 1 0.0000 0.999 1.000 0.000
#> GSM553598 2 0.0000 0.999 0.000 1.000
#> GSM553599 1 0.0000 0.999 1.000 0.000
#> GSM553600 1 0.0000 0.999 1.000 0.000
#> GSM553601 1 0.0000 0.999 1.000 0.000
#> GSM553602 1 0.0000 0.999 1.000 0.000
#> GSM553603 1 0.0000 0.999 1.000 0.000
#> GSM553604 1 0.0000 0.999 1.000 0.000
#> GSM553605 2 0.0000 0.999 0.000 1.000
#> GSM553606 2 0.0000 0.999 0.000 1.000
#> GSM553607 2 0.0000 0.999 0.000 1.000
#> GSM553608 2 0.0000 0.999 0.000 1.000
#> GSM553609 2 0.0000 0.999 0.000 1.000
#> GSM553610 2 0.0000 0.999 0.000 1.000
#> GSM553611 2 0.0000 0.999 0.000 1.000
#> GSM553612 2 0.0000 0.999 0.000 1.000
#> GSM553613 2 0.0000 0.999 0.000 1.000
#> GSM553614 1 0.0000 0.999 1.000 0.000
#> GSM553615 1 0.0000 0.999 1.000 0.000
#> GSM553616 1 0.0000 0.999 1.000 0.000
#> GSM553617 1 0.0000 0.999 1.000 0.000
#> GSM553618 1 0.0000 0.999 1.000 0.000
#> GSM553619 1 0.0000 0.999 1.000 0.000
#> GSM553620 1 0.0000 0.999 1.000 0.000
#> GSM553621 1 0.0000 0.999 1.000 0.000
#> GSM553622 1 0.0000 0.999 1.000 0.000
#> GSM553623 1 0.0000 0.999 1.000 0.000
#> GSM553624 1 0.0000 0.999 1.000 0.000
#> GSM553625 1 0.0000 0.999 1.000 0.000
#> GSM553626 1 0.0000 0.999 1.000 0.000
#> GSM553627 1 0.0000 0.999 1.000 0.000
#> GSM553628 1 0.0000 0.999 1.000 0.000
#> GSM553629 1 0.0000 0.999 1.000 0.000
#> GSM553630 1 0.0000 0.999 1.000 0.000
#> GSM553631 1 0.0000 0.999 1.000 0.000
#> GSM553632 1 0.0000 0.999 1.000 0.000
#> GSM553633 1 0.1184 0.984 0.984 0.016
#> GSM553634 2 0.0000 0.999 0.000 1.000
#> GSM553635 2 0.0000 0.999 0.000 1.000
#> GSM553636 2 0.0376 0.996 0.004 0.996
#> GSM553637 2 0.0000 0.999 0.000 1.000
#> GSM553638 2 0.0000 0.999 0.000 1.000
#> GSM553639 2 0.0000 0.999 0.000 1.000
#> GSM553640 2 0.0376 0.996 0.004 0.996
#> GSM553641 2 0.0000 0.999 0.000 1.000
#> GSM553642 1 0.0000 0.999 1.000 0.000
#> GSM553643 1 0.0000 0.999 1.000 0.000
#> GSM553644 1 0.0000 0.999 1.000 0.000
#> GSM553645 1 0.1184 0.984 0.984 0.016
#> GSM553646 1 0.0000 0.999 1.000 0.000
#> GSM553647 1 0.0000 0.999 1.000 0.000
#> GSM553648 2 0.0000 0.999 0.000 1.000
#> GSM553649 2 0.0000 0.999 0.000 1.000
#> GSM553650 2 0.0000 0.999 0.000 1.000
#> GSM553651 2 0.0376 0.996 0.004 0.996
#> GSM553652 2 0.0000 0.999 0.000 1.000
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> GSM553595 3 0.4654 0.763 0.208 0.000 0.792
#> GSM553596 3 0.4555 0.767 0.200 0.000 0.800
#> GSM553597 3 0.6111 0.571 0.396 0.000 0.604
#> GSM553598 3 0.0237 0.771 0.000 0.004 0.996
#> GSM553599 1 0.1031 0.947 0.976 0.000 0.024
#> GSM553600 1 0.0000 0.954 1.000 0.000 0.000
#> GSM553601 1 0.4346 0.736 0.816 0.000 0.184
#> GSM553602 1 0.0237 0.953 0.996 0.000 0.004
#> GSM553603 3 0.6140 0.557 0.404 0.000 0.596
#> GSM553604 1 0.1860 0.917 0.948 0.000 0.052
#> GSM553605 3 0.0892 0.759 0.000 0.020 0.980
#> GSM553606 2 0.1031 0.955 0.000 0.976 0.024
#> GSM553607 2 0.0424 0.962 0.000 0.992 0.008
#> GSM553608 2 0.0237 0.966 0.000 0.996 0.004
#> GSM553609 2 0.0237 0.966 0.000 0.996 0.004
#> GSM553610 2 0.4605 0.791 0.000 0.796 0.204
#> GSM553611 2 0.0000 0.965 0.000 1.000 0.000
#> GSM553612 2 0.0237 0.966 0.000 0.996 0.004
#> GSM553613 2 0.6008 0.555 0.000 0.628 0.372
#> GSM553614 1 0.0237 0.954 0.996 0.000 0.004
#> GSM553615 1 0.0237 0.954 0.996 0.000 0.004
#> GSM553616 1 0.0747 0.951 0.984 0.000 0.016
#> GSM553617 1 0.0892 0.948 0.980 0.000 0.020
#> GSM553618 3 0.4733 0.769 0.196 0.004 0.800
#> GSM553619 3 0.4733 0.769 0.196 0.004 0.800
#> GSM553620 1 0.0000 0.954 1.000 0.000 0.000
#> GSM553621 1 0.0000 0.954 1.000 0.000 0.000
#> GSM553622 1 0.0000 0.954 1.000 0.000 0.000
#> GSM553623 1 0.0892 0.948 0.980 0.000 0.020
#> GSM553624 1 0.0747 0.951 0.984 0.000 0.016
#> GSM553625 1 0.0747 0.951 0.984 0.000 0.016
#> GSM553626 1 0.0000 0.954 1.000 0.000 0.000
#> GSM553627 1 0.0237 0.953 0.996 0.000 0.004
#> GSM553628 1 0.0000 0.954 1.000 0.000 0.000
#> GSM553629 1 0.0475 0.952 0.992 0.004 0.004
#> GSM553630 1 0.0000 0.954 1.000 0.000 0.000
#> GSM553631 1 0.0475 0.952 0.992 0.004 0.004
#> GSM553632 1 0.0000 0.954 1.000 0.000 0.000
#> GSM553633 3 0.0000 0.772 0.000 0.000 1.000
#> GSM553634 2 0.0000 0.965 0.000 1.000 0.000
#> GSM553635 2 0.0000 0.965 0.000 1.000 0.000
#> GSM553636 2 0.0424 0.964 0.000 0.992 0.008
#> GSM553637 2 0.0000 0.965 0.000 1.000 0.000
#> GSM553638 2 0.0237 0.966 0.000 0.996 0.004
#> GSM553639 2 0.0237 0.966 0.000 0.996 0.004
#> GSM553640 2 0.0237 0.963 0.004 0.996 0.000
#> GSM553641 3 0.0424 0.769 0.000 0.008 0.992
#> GSM553642 1 0.4842 0.641 0.776 0.000 0.224
#> GSM553643 3 0.6079 0.590 0.388 0.000 0.612
#> GSM553644 1 0.4842 0.641 0.776 0.000 0.224
#> GSM553645 3 0.0424 0.775 0.008 0.000 0.992
#> GSM553646 3 0.6140 0.563 0.404 0.000 0.596
#> GSM553647 3 0.6079 0.590 0.388 0.000 0.612
#> GSM553648 3 0.0424 0.769 0.000 0.008 0.992
#> GSM553649 3 0.0424 0.769 0.000 0.008 0.992
#> GSM553650 2 0.0237 0.966 0.000 0.996 0.004
#> GSM553651 2 0.0424 0.964 0.000 0.992 0.008
#> GSM553652 2 0.0237 0.966 0.000 0.996 0.004
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> GSM553595 4 0.2300 0.733 0.016 0.000 0.064 0.920
#> GSM553596 4 0.2924 0.685 0.016 0.000 0.100 0.884
#> GSM553597 4 0.1398 0.733 0.040 0.000 0.004 0.956
#> GSM553598 3 0.4643 0.537 0.000 0.000 0.656 0.344
#> GSM553599 1 0.6995 0.281 0.468 0.008 0.088 0.436
#> GSM553600 1 0.1059 0.724 0.972 0.000 0.016 0.012
#> GSM553601 4 0.5354 0.455 0.232 0.000 0.056 0.712
#> GSM553602 1 0.1305 0.717 0.960 0.000 0.036 0.004
#> GSM553603 4 0.4477 0.737 0.108 0.000 0.084 0.808
#> GSM553604 4 0.6813 0.366 0.292 0.000 0.132 0.576
#> GSM553605 3 0.3626 0.644 0.000 0.004 0.812 0.184
#> GSM553606 3 0.5193 0.247 0.000 0.412 0.580 0.008
#> GSM553607 2 0.4814 0.519 0.000 0.676 0.316 0.008
#> GSM553608 2 0.0000 0.924 0.000 1.000 0.000 0.000
#> GSM553609 2 0.1389 0.897 0.000 0.952 0.048 0.000
#> GSM553610 3 0.4761 0.355 0.000 0.372 0.628 0.000
#> GSM553611 2 0.0188 0.923 0.000 0.996 0.004 0.000
#> GSM553612 2 0.0000 0.924 0.000 1.000 0.000 0.000
#> GSM553613 3 0.4164 0.531 0.000 0.264 0.736 0.000
#> GSM553614 1 0.4589 0.682 0.784 0.000 0.048 0.168
#> GSM553615 1 0.2124 0.716 0.924 0.000 0.008 0.068
#> GSM553616 1 0.7147 0.393 0.508 0.008 0.108 0.376
#> GSM553617 1 0.7167 0.356 0.492 0.012 0.096 0.400
#> GSM553618 4 0.4015 0.666 0.052 0.000 0.116 0.832
#> GSM553619 4 0.4356 0.653 0.064 0.000 0.124 0.812
#> GSM553620 1 0.4227 0.658 0.820 0.000 0.060 0.120
#> GSM553621 1 0.3611 0.671 0.860 0.000 0.060 0.080
#> GSM553622 1 0.1743 0.714 0.940 0.000 0.056 0.004
#> GSM553623 1 0.7167 0.356 0.492 0.012 0.096 0.400
#> GSM553624 1 0.6954 0.411 0.548 0.012 0.088 0.352
#> GSM553625 1 0.5018 0.494 0.656 0.000 0.012 0.332
#> GSM553626 1 0.0000 0.723 1.000 0.000 0.000 0.000
#> GSM553627 1 0.4882 0.526 0.708 0.000 0.020 0.272
#> GSM553628 1 0.0524 0.723 0.988 0.000 0.008 0.004
#> GSM553629 1 0.2255 0.716 0.920 0.000 0.012 0.068
#> GSM553630 1 0.3612 0.667 0.856 0.000 0.044 0.100
#> GSM553631 1 0.2843 0.714 0.892 0.000 0.020 0.088
#> GSM553632 1 0.1209 0.718 0.964 0.000 0.032 0.004
#> GSM553633 4 0.4222 0.580 0.000 0.000 0.272 0.728
#> GSM553634 2 0.0657 0.920 0.000 0.984 0.012 0.004
#> GSM553635 2 0.0657 0.920 0.000 0.984 0.012 0.004
#> GSM553636 2 0.2271 0.878 0.000 0.916 0.076 0.008
#> GSM553637 2 0.4086 0.710 0.000 0.776 0.216 0.008
#> GSM553638 2 0.0000 0.924 0.000 1.000 0.000 0.000
#> GSM553639 2 0.1637 0.896 0.000 0.940 0.060 0.000
#> GSM553640 2 0.2053 0.895 0.000 0.924 0.072 0.004
#> GSM553641 3 0.3610 0.640 0.000 0.000 0.800 0.200
#> GSM553642 1 0.6949 -0.124 0.480 0.000 0.112 0.408
#> GSM553643 4 0.4667 0.732 0.108 0.000 0.096 0.796
#> GSM553644 4 0.6932 0.248 0.396 0.000 0.112 0.492
#> GSM553645 4 0.3649 0.657 0.000 0.000 0.204 0.796
#> GSM553646 4 0.5483 0.702 0.128 0.000 0.136 0.736
#> GSM553647 4 0.4667 0.732 0.108 0.000 0.096 0.796
#> GSM553648 3 0.4454 0.567 0.000 0.000 0.692 0.308
#> GSM553649 3 0.4406 0.566 0.000 0.000 0.700 0.300
#> GSM553650 2 0.0000 0.924 0.000 1.000 0.000 0.000
#> GSM553651 2 0.2271 0.878 0.000 0.916 0.076 0.008
#> GSM553652 2 0.0000 0.924 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
#> GSM553595 4 0.5014 0.0252 0.000 0.000 0.040 0.592 0.368
#> GSM553596 5 0.5707 0.3368 0.004 0.000 0.084 0.344 0.568
#> GSM553597 5 0.5114 0.1838 0.000 0.000 0.036 0.472 0.492
#> GSM553598 3 0.6521 0.4445 0.000 0.000 0.484 0.244 0.272
#> GSM553599 5 0.5660 0.5577 0.232 0.008 0.000 0.116 0.644
#> GSM553600 1 0.1893 0.7043 0.928 0.000 0.024 0.000 0.048
#> GSM553601 5 0.6124 0.5094 0.088 0.000 0.036 0.264 0.612
#> GSM553602 1 0.1356 0.7106 0.956 0.000 0.012 0.028 0.004
#> GSM553603 4 0.1792 0.6848 0.084 0.000 0.000 0.916 0.000
#> GSM553604 4 0.5140 0.4202 0.084 0.000 0.000 0.664 0.252
#> GSM553605 3 0.4343 0.7010 0.000 0.000 0.768 0.136 0.096
#> GSM553606 3 0.4424 0.5486 0.000 0.188 0.752 0.004 0.056
#> GSM553607 2 0.6062 0.2249 0.000 0.476 0.416 0.004 0.104
#> GSM553608 2 0.0000 0.8719 0.000 1.000 0.000 0.000 0.000
#> GSM553609 2 0.3732 0.7521 0.000 0.820 0.120 0.004 0.056
#> GSM553610 3 0.4126 0.5932 0.000 0.156 0.784 0.004 0.056
#> GSM553611 2 0.0451 0.8714 0.000 0.988 0.008 0.000 0.004
#> GSM553612 2 0.0000 0.8719 0.000 1.000 0.000 0.000 0.000
#> GSM553613 3 0.2389 0.6603 0.000 0.116 0.880 0.000 0.004
#> GSM553614 1 0.6786 0.1847 0.492 0.000 0.056 0.088 0.364
#> GSM553615 1 0.3587 0.6567 0.824 0.000 0.012 0.024 0.140
#> GSM553616 5 0.5598 0.4796 0.276 0.008 0.008 0.068 0.640
#> GSM553617 5 0.5611 0.5371 0.252 0.008 0.004 0.088 0.648
#> GSM553618 5 0.5640 0.3593 0.008 0.000 0.092 0.276 0.624
#> GSM553619 5 0.5694 0.3617 0.008 0.000 0.108 0.252 0.632
#> GSM553620 1 0.5850 0.4587 0.600 0.000 0.032 0.312 0.056
#> GSM553621 1 0.5320 0.5166 0.652 0.000 0.028 0.284 0.036
#> GSM553622 1 0.2095 0.7044 0.928 0.000 0.024 0.028 0.020
#> GSM553623 5 0.5509 0.5411 0.252 0.008 0.000 0.092 0.648
#> GSM553624 5 0.6032 0.3350 0.356 0.008 0.000 0.100 0.536
#> GSM553625 1 0.6342 -0.0186 0.476 0.000 0.000 0.168 0.356
#> GSM553626 1 0.1981 0.7044 0.920 0.000 0.000 0.016 0.064
#> GSM553627 1 0.6204 0.3665 0.536 0.000 0.000 0.288 0.176
#> GSM553628 1 0.1981 0.7044 0.920 0.000 0.000 0.016 0.064
#> GSM553629 1 0.3858 0.6550 0.804 0.000 0.016 0.024 0.156
#> GSM553630 1 0.4958 0.4649 0.616 0.000 0.004 0.348 0.032
#> GSM553631 1 0.4396 0.6511 0.772 0.000 0.012 0.056 0.160
#> GSM553632 1 0.1205 0.7138 0.956 0.000 0.000 0.040 0.004
#> GSM553633 4 0.6069 0.1195 0.000 0.000 0.136 0.524 0.340
#> GSM553634 2 0.1082 0.8650 0.000 0.964 0.008 0.000 0.028
#> GSM553635 2 0.1670 0.8556 0.000 0.936 0.012 0.000 0.052
#> GSM553636 2 0.2329 0.8108 0.000 0.876 0.000 0.000 0.124
#> GSM553637 2 0.5998 0.3366 0.000 0.520 0.372 0.004 0.104
#> GSM553638 2 0.0290 0.8697 0.000 0.992 0.008 0.000 0.000
#> GSM553639 2 0.1732 0.8406 0.000 0.920 0.000 0.000 0.080
#> GSM553640 2 0.2470 0.8383 0.000 0.884 0.012 0.000 0.104
#> GSM553641 3 0.5150 0.6962 0.000 0.000 0.692 0.172 0.136
#> GSM553642 4 0.3707 0.4804 0.284 0.000 0.000 0.716 0.000
#> GSM553643 4 0.1697 0.6917 0.060 0.000 0.008 0.932 0.000
#> GSM553644 4 0.3424 0.5528 0.240 0.000 0.000 0.760 0.000
#> GSM553645 4 0.4114 0.4640 0.000 0.000 0.060 0.776 0.164
#> GSM553646 4 0.1704 0.6919 0.068 0.000 0.004 0.928 0.000
#> GSM553647 4 0.1697 0.6917 0.060 0.000 0.008 0.932 0.000
#> GSM553648 3 0.5642 0.6598 0.000 0.000 0.624 0.240 0.136
#> GSM553649 3 0.5642 0.6598 0.000 0.000 0.624 0.240 0.136
#> GSM553650 2 0.0000 0.8719 0.000 1.000 0.000 0.000 0.000
#> GSM553651 2 0.2127 0.8230 0.000 0.892 0.000 0.000 0.108
#> GSM553652 2 0.0000 0.8719 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
#> GSM553595 4 0.6058 -0.0938 0.004 0.000 0.292 0.456 0.248 0.000
#> GSM553596 3 0.6013 0.2602 0.004 0.000 0.428 0.204 0.364 0.000
#> GSM553597 5 0.6183 -0.1585 0.004 0.000 0.260 0.360 0.376 0.000
#> GSM553598 3 0.5836 0.4859 0.000 0.000 0.636 0.112 0.092 0.160
#> GSM553599 5 0.2631 0.6674 0.068 0.000 0.008 0.044 0.880 0.000
#> GSM553600 1 0.4048 0.6406 0.796 0.000 0.080 0.004 0.092 0.028
#> GSM553601 5 0.5333 0.3465 0.020 0.000 0.164 0.168 0.648 0.000
#> GSM553602 1 0.3218 0.6577 0.860 0.000 0.060 0.016 0.048 0.016
#> GSM553603 4 0.1261 0.7499 0.024 0.000 0.024 0.952 0.000 0.000
#> GSM553604 4 0.4218 0.3043 0.024 0.000 0.000 0.616 0.360 0.000
#> GSM553605 6 0.5351 -0.0795 0.000 0.004 0.428 0.044 0.024 0.500
#> GSM553606 6 0.2003 0.6288 0.000 0.116 0.000 0.000 0.000 0.884
#> GSM553607 6 0.4598 0.5058 0.000 0.280 0.060 0.000 0.004 0.656
#> GSM553608 2 0.0146 0.8881 0.000 0.996 0.000 0.000 0.000 0.004
#> GSM553609 2 0.3782 0.2008 0.000 0.588 0.000 0.000 0.000 0.412
#> GSM553610 6 0.1913 0.6140 0.000 0.080 0.012 0.000 0.000 0.908
#> GSM553611 2 0.0841 0.8863 0.004 0.976 0.004 0.004 0.008 0.004
#> GSM553612 2 0.0291 0.8882 0.000 0.992 0.000 0.000 0.004 0.004
#> GSM553613 6 0.4323 0.4599 0.000 0.040 0.188 0.004 0.024 0.744
#> GSM553614 1 0.7620 0.1156 0.372 0.000 0.196 0.088 0.316 0.028
#> GSM553615 1 0.3542 0.6042 0.800 0.000 0.028 0.016 0.156 0.000
#> GSM553616 5 0.2876 0.6373 0.104 0.000 0.024 0.008 0.860 0.004
#> GSM553617 5 0.2456 0.6689 0.076 0.000 0.008 0.028 0.888 0.000
#> GSM553618 3 0.5748 0.3551 0.004 0.000 0.496 0.160 0.340 0.000
#> GSM553619 3 0.5693 0.3557 0.008 0.000 0.520 0.140 0.332 0.000
#> GSM553620 1 0.7451 0.3539 0.428 0.000 0.152 0.296 0.096 0.028
#> GSM553621 1 0.7057 0.4082 0.480 0.000 0.128 0.292 0.072 0.028
#> GSM553622 1 0.3745 0.6333 0.820 0.000 0.104 0.012 0.036 0.028
#> GSM553623 5 0.2456 0.6696 0.076 0.000 0.008 0.028 0.888 0.000
#> GSM553624 5 0.3947 0.5552 0.228 0.000 0.004 0.036 0.732 0.000
#> GSM553625 5 0.5372 0.3372 0.348 0.000 0.004 0.108 0.540 0.000
#> GSM553626 1 0.2494 0.6340 0.864 0.000 0.000 0.016 0.120 0.000
#> GSM553627 5 0.5975 0.1437 0.348 0.000 0.000 0.232 0.420 0.000
#> GSM553628 1 0.2538 0.6311 0.860 0.000 0.000 0.016 0.124 0.000
#> GSM553629 1 0.3682 0.6056 0.796 0.000 0.028 0.016 0.156 0.004
#> GSM553630 1 0.5126 0.3038 0.532 0.000 0.016 0.408 0.040 0.004
#> GSM553631 1 0.4419 0.5917 0.752 0.000 0.080 0.028 0.140 0.000
#> GSM553632 1 0.1003 0.6648 0.964 0.000 0.000 0.020 0.016 0.000
#> GSM553633 3 0.5748 0.3496 0.000 0.000 0.532 0.332 0.116 0.020
#> GSM553634 2 0.2074 0.8589 0.004 0.920 0.036 0.000 0.012 0.028
#> GSM553635 2 0.3351 0.7701 0.004 0.828 0.032 0.000 0.012 0.124
#> GSM553636 2 0.2519 0.8181 0.004 0.864 0.004 0.004 0.124 0.000
#> GSM553637 6 0.4688 0.4673 0.000 0.300 0.060 0.000 0.004 0.636
#> GSM553638 2 0.0291 0.8882 0.000 0.992 0.000 0.000 0.004 0.004
#> GSM553639 2 0.1267 0.8686 0.000 0.940 0.000 0.000 0.060 0.000
#> GSM553640 2 0.3138 0.8465 0.008 0.864 0.036 0.004 0.072 0.016
#> GSM553641 3 0.4838 0.1662 0.000 0.000 0.544 0.060 0.000 0.396
#> GSM553642 4 0.2135 0.7045 0.128 0.000 0.000 0.872 0.000 0.000
#> GSM553643 4 0.0820 0.7511 0.016 0.000 0.012 0.972 0.000 0.000
#> GSM553644 4 0.2048 0.7132 0.120 0.000 0.000 0.880 0.000 0.000
#> GSM553645 4 0.4204 0.3388 0.000 0.000 0.272 0.688 0.036 0.004
#> GSM553646 4 0.0790 0.7506 0.032 0.000 0.000 0.968 0.000 0.000
#> GSM553647 4 0.0820 0.7511 0.016 0.000 0.012 0.972 0.000 0.000
#> GSM553648 3 0.5108 0.2491 0.000 0.000 0.552 0.092 0.000 0.356
#> GSM553649 3 0.5186 0.2355 0.000 0.000 0.544 0.100 0.000 0.356
#> GSM553650 2 0.0146 0.8881 0.000 0.996 0.000 0.000 0.000 0.004
#> GSM553651 2 0.2377 0.8197 0.004 0.868 0.000 0.004 0.124 0.000
#> GSM553652 2 0.0291 0.8882 0.000 0.992 0.000 0.000 0.004 0.004
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 individual(p) k
#> CV:kmeans 58 0.13531 2
#> CV:kmeans 58 0.00779 3
#> CV:kmeans 46 0.01121 4
#> CV:kmeans 39 0.00632 5
#> CV:kmeans 35 0.00088 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 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 0.961 0.986 0.5041 0.497 0.497
#> 3 3 0.934 0.932 0.970 0.3235 0.758 0.548
#> 4 4 0.897 0.867 0.931 0.1178 0.895 0.701
#> 5 5 0.821 0.797 0.877 0.0608 0.946 0.794
#> 6 6 0.787 0.728 0.847 0.0420 0.947 0.762
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
#> GSM553595 1 0.0000 0.9836 1.000 0.000
#> GSM553596 2 0.8608 0.5919 0.284 0.716
#> GSM553597 1 0.0000 0.9836 1.000 0.000
#> GSM553598 2 0.0000 0.9879 0.000 1.000
#> GSM553599 1 0.0000 0.9836 1.000 0.000
#> GSM553600 1 0.0000 0.9836 1.000 0.000
#> GSM553601 1 0.0000 0.9836 1.000 0.000
#> GSM553602 1 0.0000 0.9836 1.000 0.000
#> GSM553603 1 0.0000 0.9836 1.000 0.000
#> GSM553604 1 0.0000 0.9836 1.000 0.000
#> GSM553605 2 0.0000 0.9879 0.000 1.000
#> GSM553606 2 0.0000 0.9879 0.000 1.000
#> GSM553607 2 0.0000 0.9879 0.000 1.000
#> GSM553608 2 0.0000 0.9879 0.000 1.000
#> GSM553609 2 0.0000 0.9879 0.000 1.000
#> GSM553610 2 0.0000 0.9879 0.000 1.000
#> GSM553611 2 0.0000 0.9879 0.000 1.000
#> GSM553612 2 0.0000 0.9879 0.000 1.000
#> GSM553613 2 0.0000 0.9879 0.000 1.000
#> GSM553614 1 0.0000 0.9836 1.000 0.000
#> GSM553615 1 0.0000 0.9836 1.000 0.000
#> GSM553616 1 0.0000 0.9836 1.000 0.000
#> GSM553617 1 0.0000 0.9836 1.000 0.000
#> GSM553618 1 1.0000 -0.0148 0.504 0.496
#> GSM553619 1 0.0000 0.9836 1.000 0.000
#> GSM553620 1 0.0000 0.9836 1.000 0.000
#> GSM553621 1 0.0000 0.9836 1.000 0.000
#> GSM553622 1 0.0000 0.9836 1.000 0.000
#> GSM553623 1 0.0000 0.9836 1.000 0.000
#> GSM553624 1 0.0000 0.9836 1.000 0.000
#> GSM553625 1 0.0000 0.9836 1.000 0.000
#> GSM553626 1 0.0000 0.9836 1.000 0.000
#> GSM553627 1 0.0000 0.9836 1.000 0.000
#> GSM553628 1 0.0000 0.9836 1.000 0.000
#> GSM553629 1 0.0000 0.9836 1.000 0.000
#> GSM553630 1 0.0000 0.9836 1.000 0.000
#> GSM553631 1 0.0000 0.9836 1.000 0.000
#> GSM553632 1 0.0000 0.9836 1.000 0.000
#> GSM553633 2 0.0000 0.9879 0.000 1.000
#> GSM553634 2 0.0000 0.9879 0.000 1.000
#> GSM553635 2 0.0000 0.9879 0.000 1.000
#> GSM553636 2 0.0000 0.9879 0.000 1.000
#> GSM553637 2 0.0000 0.9879 0.000 1.000
#> GSM553638 2 0.0000 0.9879 0.000 1.000
#> GSM553639 2 0.0000 0.9879 0.000 1.000
#> GSM553640 2 0.0000 0.9879 0.000 1.000
#> GSM553641 2 0.0000 0.9879 0.000 1.000
#> GSM553642 1 0.0000 0.9836 1.000 0.000
#> GSM553643 1 0.0000 0.9836 1.000 0.000
#> GSM553644 1 0.0000 0.9836 1.000 0.000
#> GSM553645 2 0.0672 0.9806 0.008 0.992
#> GSM553646 1 0.0000 0.9836 1.000 0.000
#> GSM553647 1 0.0000 0.9836 1.000 0.000
#> GSM553648 2 0.0000 0.9879 0.000 1.000
#> GSM553649 2 0.0000 0.9879 0.000 1.000
#> GSM553650 2 0.0000 0.9879 0.000 1.000
#> GSM553651 2 0.0000 0.9879 0.000 1.000
#> GSM553652 2 0.0000 0.9879 0.000 1.000
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> GSM553595 3 0.0237 0.953 0.004 0.000 0.996
#> GSM553596 3 0.0000 0.954 0.000 0.000 1.000
#> GSM553597 3 0.3752 0.851 0.144 0.000 0.856
#> GSM553598 3 0.0000 0.954 0.000 0.000 1.000
#> GSM553599 1 0.0000 0.952 1.000 0.000 0.000
#> GSM553600 1 0.0000 0.952 1.000 0.000 0.000
#> GSM553601 1 0.4555 0.726 0.800 0.000 0.200
#> GSM553602 1 0.0000 0.952 1.000 0.000 0.000
#> GSM553603 3 0.4796 0.743 0.220 0.000 0.780
#> GSM553604 1 0.0237 0.949 0.996 0.000 0.004
#> GSM553605 3 0.0000 0.954 0.000 0.000 1.000
#> GSM553606 2 0.0237 0.994 0.000 0.996 0.004
#> GSM553607 2 0.0237 0.994 0.000 0.996 0.004
#> GSM553608 2 0.0000 0.996 0.000 1.000 0.000
#> GSM553609 2 0.0000 0.996 0.000 1.000 0.000
#> GSM553610 2 0.0424 0.991 0.000 0.992 0.008
#> GSM553611 2 0.0000 0.996 0.000 1.000 0.000
#> GSM553612 2 0.0000 0.996 0.000 1.000 0.000
#> GSM553613 2 0.1753 0.955 0.000 0.952 0.048
#> GSM553614 1 0.0000 0.952 1.000 0.000 0.000
#> GSM553615 1 0.0000 0.952 1.000 0.000 0.000
#> GSM553616 1 0.0000 0.952 1.000 0.000 0.000
#> GSM553617 1 0.0424 0.946 0.992 0.008 0.000
#> GSM553618 3 0.0000 0.954 0.000 0.000 1.000
#> GSM553619 3 0.0237 0.952 0.004 0.000 0.996
#> GSM553620 1 0.0000 0.952 1.000 0.000 0.000
#> GSM553621 1 0.0000 0.952 1.000 0.000 0.000
#> GSM553622 1 0.0000 0.952 1.000 0.000 0.000
#> GSM553623 1 0.0424 0.946 0.992 0.008 0.000
#> GSM553624 1 0.0424 0.946 0.992 0.008 0.000
#> GSM553625 1 0.0000 0.952 1.000 0.000 0.000
#> GSM553626 1 0.0000 0.952 1.000 0.000 0.000
#> GSM553627 1 0.0000 0.952 1.000 0.000 0.000
#> GSM553628 1 0.0000 0.952 1.000 0.000 0.000
#> GSM553629 1 0.0000 0.952 1.000 0.000 0.000
#> GSM553630 1 0.0000 0.952 1.000 0.000 0.000
#> GSM553631 1 0.0000 0.952 1.000 0.000 0.000
#> GSM553632 1 0.0000 0.952 1.000 0.000 0.000
#> GSM553633 3 0.0000 0.954 0.000 0.000 1.000
#> GSM553634 2 0.0000 0.996 0.000 1.000 0.000
#> GSM553635 2 0.0000 0.996 0.000 1.000 0.000
#> GSM553636 2 0.0000 0.996 0.000 1.000 0.000
#> GSM553637 2 0.0000 0.996 0.000 1.000 0.000
#> GSM553638 2 0.0000 0.996 0.000 1.000 0.000
#> GSM553639 2 0.0000 0.996 0.000 1.000 0.000
#> GSM553640 2 0.0000 0.996 0.000 1.000 0.000
#> GSM553641 3 0.0000 0.954 0.000 0.000 1.000
#> GSM553642 1 0.6079 0.353 0.612 0.000 0.388
#> GSM553643 3 0.2261 0.919 0.068 0.000 0.932
#> GSM553644 1 0.6079 0.353 0.612 0.000 0.388
#> GSM553645 3 0.0000 0.954 0.000 0.000 1.000
#> GSM553646 3 0.3551 0.864 0.132 0.000 0.868
#> GSM553647 3 0.2356 0.917 0.072 0.000 0.928
#> GSM553648 3 0.0000 0.954 0.000 0.000 1.000
#> GSM553649 3 0.0000 0.954 0.000 0.000 1.000
#> GSM553650 2 0.0000 0.996 0.000 1.000 0.000
#> GSM553651 2 0.0000 0.996 0.000 1.000 0.000
#> GSM553652 2 0.0000 0.996 0.000 1.000 0.000
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> GSM553595 4 0.2469 0.848 0.000 0.000 0.108 0.892
#> GSM553596 3 0.0469 0.962 0.000 0.000 0.988 0.012
#> GSM553597 4 0.2521 0.889 0.024 0.000 0.064 0.912
#> GSM553598 3 0.0707 0.973 0.000 0.000 0.980 0.020
#> GSM553599 1 0.1767 0.856 0.944 0.000 0.012 0.044
#> GSM553600 1 0.0000 0.874 1.000 0.000 0.000 0.000
#> GSM553601 1 0.4764 0.673 0.748 0.000 0.032 0.220
#> GSM553602 1 0.0921 0.876 0.972 0.000 0.000 0.028
#> GSM553603 4 0.1302 0.920 0.044 0.000 0.000 0.956
#> GSM553604 4 0.0707 0.888 0.020 0.000 0.000 0.980
#> GSM553605 3 0.0921 0.975 0.000 0.000 0.972 0.028
#> GSM553606 2 0.2868 0.850 0.000 0.864 0.136 0.000
#> GSM553607 2 0.0921 0.957 0.000 0.972 0.028 0.000
#> GSM553608 2 0.0000 0.977 0.000 1.000 0.000 0.000
#> GSM553609 2 0.0000 0.977 0.000 1.000 0.000 0.000
#> GSM553610 2 0.3486 0.784 0.000 0.812 0.188 0.000
#> GSM553611 2 0.0000 0.977 0.000 1.000 0.000 0.000
#> GSM553612 2 0.0000 0.977 0.000 1.000 0.000 0.000
#> GSM553613 3 0.2281 0.875 0.000 0.096 0.904 0.000
#> GSM553614 1 0.4501 0.697 0.764 0.000 0.024 0.212
#> GSM553615 1 0.0657 0.876 0.984 0.000 0.004 0.012
#> GSM553616 1 0.1302 0.859 0.956 0.000 0.000 0.044
#> GSM553617 1 0.1767 0.856 0.944 0.000 0.012 0.044
#> GSM553618 3 0.0000 0.966 0.000 0.000 1.000 0.000
#> GSM553619 3 0.0000 0.966 0.000 0.000 1.000 0.000
#> GSM553620 1 0.5155 0.229 0.528 0.000 0.004 0.468
#> GSM553621 1 0.4961 0.291 0.552 0.000 0.000 0.448
#> GSM553622 1 0.0921 0.876 0.972 0.000 0.000 0.028
#> GSM553623 1 0.1767 0.856 0.944 0.000 0.012 0.044
#> GSM553624 1 0.1302 0.859 0.956 0.000 0.000 0.044
#> GSM553625 1 0.1022 0.875 0.968 0.000 0.000 0.032
#> GSM553626 1 0.0707 0.877 0.980 0.000 0.000 0.020
#> GSM553627 1 0.1022 0.875 0.968 0.000 0.000 0.032
#> GSM553628 1 0.0469 0.876 0.988 0.000 0.000 0.012
#> GSM553629 1 0.0657 0.876 0.984 0.000 0.004 0.012
#> GSM553630 1 0.4977 0.258 0.540 0.000 0.000 0.460
#> GSM553631 1 0.1722 0.866 0.944 0.000 0.008 0.048
#> GSM553632 1 0.0921 0.876 0.972 0.000 0.000 0.028
#> GSM553633 3 0.0921 0.975 0.000 0.000 0.972 0.028
#> GSM553634 2 0.0000 0.977 0.000 1.000 0.000 0.000
#> GSM553635 2 0.0000 0.977 0.000 1.000 0.000 0.000
#> GSM553636 2 0.0000 0.977 0.000 1.000 0.000 0.000
#> GSM553637 2 0.0188 0.975 0.000 0.996 0.004 0.000
#> GSM553638 2 0.0000 0.977 0.000 1.000 0.000 0.000
#> GSM553639 2 0.0000 0.977 0.000 1.000 0.000 0.000
#> GSM553640 2 0.0000 0.977 0.000 1.000 0.000 0.000
#> GSM553641 3 0.0921 0.975 0.000 0.000 0.972 0.028
#> GSM553642 4 0.1302 0.920 0.044 0.000 0.000 0.956
#> GSM553643 4 0.1302 0.920 0.044 0.000 0.000 0.956
#> GSM553644 4 0.1302 0.920 0.044 0.000 0.000 0.956
#> GSM553645 4 0.4933 0.187 0.000 0.000 0.432 0.568
#> GSM553646 4 0.1302 0.920 0.044 0.000 0.000 0.956
#> GSM553647 4 0.1302 0.920 0.044 0.000 0.000 0.956
#> GSM553648 3 0.0921 0.975 0.000 0.000 0.972 0.028
#> GSM553649 3 0.0921 0.975 0.000 0.000 0.972 0.028
#> GSM553650 2 0.0000 0.977 0.000 1.000 0.000 0.000
#> GSM553651 2 0.0000 0.977 0.000 1.000 0.000 0.000
#> GSM553652 2 0.0000 0.977 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
#> GSM553595 4 0.4647 0.704 0.000 0.000 0.092 0.736 0.172
#> GSM553596 3 0.4716 0.669 0.000 0.000 0.656 0.036 0.308
#> GSM553597 4 0.5120 0.593 0.004 0.000 0.056 0.648 0.292
#> GSM553598 3 0.1648 0.838 0.000 0.000 0.940 0.020 0.040
#> GSM553599 5 0.3274 0.801 0.220 0.000 0.000 0.000 0.780
#> GSM553600 1 0.1608 0.804 0.928 0.000 0.000 0.000 0.072
#> GSM553601 5 0.5046 0.578 0.276 0.000 0.024 0.028 0.672
#> GSM553602 1 0.1121 0.825 0.956 0.000 0.000 0.000 0.044
#> GSM553603 4 0.1043 0.878 0.040 0.000 0.000 0.960 0.000
#> GSM553604 4 0.2448 0.836 0.020 0.000 0.000 0.892 0.088
#> GSM553605 3 0.0794 0.855 0.000 0.000 0.972 0.028 0.000
#> GSM553606 2 0.4503 0.564 0.000 0.664 0.312 0.000 0.024
#> GSM553607 2 0.2325 0.877 0.000 0.904 0.068 0.000 0.028
#> GSM553608 2 0.0162 0.933 0.000 0.996 0.000 0.000 0.004
#> GSM553609 2 0.0703 0.927 0.000 0.976 0.000 0.000 0.024
#> GSM553610 2 0.4798 0.388 0.000 0.580 0.396 0.000 0.024
#> GSM553611 2 0.0162 0.933 0.000 0.996 0.000 0.000 0.004
#> GSM553612 2 0.0162 0.933 0.000 0.996 0.000 0.000 0.004
#> GSM553613 3 0.2761 0.755 0.000 0.104 0.872 0.000 0.024
#> GSM553614 1 0.4798 0.513 0.684 0.000 0.008 0.036 0.272
#> GSM553615 1 0.0609 0.826 0.980 0.000 0.000 0.000 0.020
#> GSM553616 5 0.4192 0.622 0.404 0.000 0.000 0.000 0.596
#> GSM553617 5 0.3305 0.801 0.224 0.000 0.000 0.000 0.776
#> GSM553618 3 0.4338 0.707 0.000 0.000 0.696 0.024 0.280
#> GSM553619 3 0.4526 0.686 0.000 0.000 0.672 0.028 0.300
#> GSM553620 1 0.5442 0.512 0.644 0.000 0.000 0.240 0.116
#> GSM553621 1 0.4461 0.610 0.728 0.000 0.000 0.220 0.052
#> GSM553622 1 0.1043 0.828 0.960 0.000 0.000 0.000 0.040
#> GSM553623 5 0.3210 0.797 0.212 0.000 0.000 0.000 0.788
#> GSM553624 5 0.4542 0.581 0.456 0.008 0.000 0.000 0.536
#> GSM553625 1 0.0290 0.833 0.992 0.000 0.000 0.000 0.008
#> GSM553626 1 0.0404 0.832 0.988 0.000 0.000 0.000 0.012
#> GSM553627 1 0.2139 0.794 0.916 0.000 0.000 0.032 0.052
#> GSM553628 1 0.0880 0.823 0.968 0.000 0.000 0.000 0.032
#> GSM553629 1 0.0794 0.828 0.972 0.000 0.000 0.000 0.028
#> GSM553630 1 0.3878 0.608 0.748 0.000 0.000 0.236 0.016
#> GSM553631 1 0.1671 0.795 0.924 0.000 0.000 0.000 0.076
#> GSM553632 1 0.0000 0.833 1.000 0.000 0.000 0.000 0.000
#> GSM553633 3 0.1331 0.854 0.000 0.000 0.952 0.040 0.008
#> GSM553634 2 0.0000 0.933 0.000 1.000 0.000 0.000 0.000
#> GSM553635 2 0.0703 0.927 0.000 0.976 0.000 0.000 0.024
#> GSM553636 2 0.1270 0.906 0.000 0.948 0.000 0.000 0.052
#> GSM553637 2 0.0955 0.924 0.000 0.968 0.004 0.000 0.028
#> GSM553638 2 0.0000 0.933 0.000 1.000 0.000 0.000 0.000
#> GSM553639 2 0.0404 0.931 0.000 0.988 0.000 0.000 0.012
#> GSM553640 2 0.0404 0.931 0.000 0.988 0.000 0.000 0.012
#> GSM553641 3 0.0794 0.855 0.000 0.000 0.972 0.028 0.000
#> GSM553642 4 0.1121 0.876 0.044 0.000 0.000 0.956 0.000
#> GSM553643 4 0.0865 0.879 0.024 0.000 0.004 0.972 0.000
#> GSM553644 4 0.1121 0.876 0.044 0.000 0.000 0.956 0.000
#> GSM553645 4 0.3366 0.659 0.000 0.000 0.232 0.768 0.000
#> GSM553646 4 0.0794 0.879 0.028 0.000 0.000 0.972 0.000
#> GSM553647 4 0.0865 0.879 0.024 0.000 0.004 0.972 0.000
#> GSM553648 3 0.0794 0.855 0.000 0.000 0.972 0.028 0.000
#> GSM553649 3 0.0963 0.852 0.000 0.000 0.964 0.036 0.000
#> GSM553650 2 0.0162 0.933 0.000 0.996 0.000 0.000 0.004
#> GSM553651 2 0.1121 0.912 0.000 0.956 0.000 0.000 0.044
#> GSM553652 2 0.0000 0.933 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
#> GSM553595 4 0.4591 0.636 0.000 0.000 0.064 0.680 0.248 0.008
#> GSM553596 4 0.3766 0.731 0.000 0.000 0.232 0.736 0.000 0.032
#> GSM553597 4 0.4521 0.635 0.012 0.000 0.016 0.736 0.184 0.052
#> GSM553598 3 0.3371 0.224 0.000 0.000 0.708 0.292 0.000 0.000
#> GSM553599 6 0.2302 0.759 0.120 0.000 0.000 0.008 0.000 0.872
#> GSM553600 1 0.1141 0.804 0.948 0.000 0.000 0.000 0.000 0.052
#> GSM553601 6 0.5923 0.348 0.176 0.000 0.004 0.284 0.008 0.528
#> GSM553602 1 0.1204 0.801 0.944 0.000 0.000 0.000 0.000 0.056
#> GSM553603 5 0.0000 0.936 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM553604 5 0.2053 0.841 0.000 0.000 0.000 0.004 0.888 0.108
#> GSM553605 3 0.0000 0.694 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM553606 3 0.6571 0.208 0.000 0.324 0.444 0.188 0.000 0.044
#> GSM553607 2 0.6008 0.539 0.000 0.596 0.156 0.192 0.000 0.056
#> GSM553608 2 0.0260 0.893 0.000 0.992 0.000 0.008 0.000 0.000
#> GSM553609 2 0.3620 0.773 0.000 0.772 0.000 0.184 0.000 0.044
#> GSM553610 3 0.6234 0.421 0.000 0.240 0.536 0.184 0.000 0.040
#> GSM553611 2 0.0508 0.893 0.000 0.984 0.000 0.004 0.000 0.012
#> GSM553612 2 0.0291 0.893 0.000 0.992 0.000 0.004 0.000 0.004
#> GSM553613 3 0.4022 0.589 0.000 0.024 0.764 0.176 0.000 0.036
#> GSM553614 1 0.5632 0.194 0.464 0.000 0.000 0.420 0.012 0.104
#> GSM553615 1 0.0520 0.814 0.984 0.000 0.000 0.008 0.000 0.008
#> GSM553616 6 0.4740 0.627 0.228 0.000 0.000 0.108 0.000 0.664
#> GSM553617 6 0.1910 0.755 0.108 0.000 0.000 0.000 0.000 0.892
#> GSM553618 4 0.4913 0.633 0.000 0.000 0.332 0.588 0.000 0.080
#> GSM553619 4 0.4382 0.714 0.000 0.000 0.264 0.676 0.000 0.060
#> GSM553620 1 0.6523 0.451 0.536 0.000 0.000 0.176 0.208 0.080
#> GSM553621 1 0.5106 0.618 0.680 0.000 0.000 0.040 0.200 0.080
#> GSM553622 1 0.1219 0.812 0.948 0.000 0.000 0.004 0.000 0.048
#> GSM553623 6 0.2404 0.755 0.112 0.000 0.000 0.016 0.000 0.872
#> GSM553624 6 0.4302 0.546 0.368 0.004 0.000 0.020 0.000 0.608
#> GSM553625 1 0.1552 0.806 0.940 0.000 0.000 0.004 0.020 0.036
#> GSM553626 1 0.0363 0.814 0.988 0.000 0.000 0.000 0.000 0.012
#> GSM553627 1 0.3264 0.726 0.832 0.000 0.000 0.004 0.088 0.076
#> GSM553628 1 0.0405 0.814 0.988 0.000 0.000 0.004 0.000 0.008
#> GSM553629 1 0.1265 0.809 0.948 0.000 0.000 0.008 0.000 0.044
#> GSM553630 1 0.4373 0.596 0.688 0.000 0.000 0.008 0.260 0.044
#> GSM553631 1 0.2201 0.790 0.900 0.000 0.000 0.048 0.000 0.052
#> GSM553632 1 0.0000 0.816 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM553633 3 0.1913 0.609 0.000 0.000 0.908 0.080 0.012 0.000
#> GSM553634 2 0.1794 0.877 0.000 0.924 0.000 0.040 0.000 0.036
#> GSM553635 2 0.3506 0.794 0.000 0.792 0.000 0.156 0.000 0.052
#> GSM553636 2 0.1867 0.852 0.000 0.916 0.000 0.020 0.000 0.064
#> GSM553637 2 0.5307 0.666 0.000 0.672 0.084 0.188 0.000 0.056
#> GSM553638 2 0.0692 0.892 0.000 0.976 0.000 0.020 0.000 0.004
#> GSM553639 2 0.0508 0.891 0.000 0.984 0.000 0.012 0.000 0.004
#> GSM553640 2 0.1176 0.889 0.000 0.956 0.000 0.020 0.000 0.024
#> GSM553641 3 0.0000 0.694 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM553642 5 0.0000 0.936 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM553643 5 0.0000 0.936 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM553644 5 0.0000 0.936 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM553645 5 0.3398 0.618 0.000 0.000 0.252 0.008 0.740 0.000
#> GSM553646 5 0.0000 0.936 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM553647 5 0.0000 0.936 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM553648 3 0.0000 0.694 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM553649 3 0.0146 0.692 0.000 0.000 0.996 0.000 0.004 0.000
#> GSM553650 2 0.0146 0.893 0.000 0.996 0.000 0.004 0.000 0.000
#> GSM553651 2 0.1480 0.870 0.000 0.940 0.000 0.020 0.000 0.040
#> GSM553652 2 0.0713 0.892 0.000 0.972 0.000 0.028 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 individual(p) k
#> CV:skmeans 57 0.119597 2
#> CV:skmeans 56 0.000999 3
#> CV:skmeans 54 0.002790 4
#> CV:skmeans 57 0.001530 5
#> CV:skmeans 52 0.001138 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 6.
#>
#> 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.910 0.963 0.4413 0.552 0.552
#> 3 3 0.653 0.770 0.887 0.4973 0.690 0.483
#> 4 4 0.644 0.623 0.812 0.1064 0.717 0.363
#> 5 5 0.805 0.770 0.877 0.0880 0.887 0.619
#> 6 6 0.923 0.912 0.955 0.0436 0.949 0.765
suggest_best_k()
suggests the best \(k\) based on these statistics. The rules are as follows:
suggest_best_k(res)
#> [1] 6
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
#> GSM553595 1 0.0000 0.976 1.000 0.000
#> GSM553596 1 0.0000 0.976 1.000 0.000
#> GSM553597 1 0.0000 0.976 1.000 0.000
#> GSM553598 1 0.0376 0.973 0.996 0.004
#> GSM553599 1 0.0000 0.976 1.000 0.000
#> GSM553600 1 0.0000 0.976 1.000 0.000
#> GSM553601 1 0.0000 0.976 1.000 0.000
#> GSM553602 1 0.0000 0.976 1.000 0.000
#> GSM553603 1 0.0000 0.976 1.000 0.000
#> GSM553604 1 0.0000 0.976 1.000 0.000
#> GSM553605 2 0.9358 0.462 0.352 0.648
#> GSM553606 2 0.0000 0.923 0.000 1.000
#> GSM553607 2 0.0000 0.923 0.000 1.000
#> GSM553608 2 0.0000 0.923 0.000 1.000
#> GSM553609 2 0.0000 0.923 0.000 1.000
#> GSM553610 2 0.0000 0.923 0.000 1.000
#> GSM553611 2 0.0000 0.923 0.000 1.000
#> GSM553612 2 0.0000 0.923 0.000 1.000
#> GSM553613 2 0.0000 0.923 0.000 1.000
#> GSM553614 1 0.0000 0.976 1.000 0.000
#> GSM553615 1 0.0000 0.976 1.000 0.000
#> GSM553616 1 0.0000 0.976 1.000 0.000
#> GSM553617 1 0.9491 0.327 0.632 0.368
#> GSM553618 1 0.0000 0.976 1.000 0.000
#> GSM553619 1 0.0376 0.973 0.996 0.004
#> GSM553620 1 0.0000 0.976 1.000 0.000
#> GSM553621 1 0.0000 0.976 1.000 0.000
#> GSM553622 1 0.0000 0.976 1.000 0.000
#> GSM553623 1 0.0672 0.969 0.992 0.008
#> GSM553624 1 0.0000 0.976 1.000 0.000
#> GSM553625 1 0.0000 0.976 1.000 0.000
#> GSM553626 1 0.0000 0.976 1.000 0.000
#> GSM553627 1 0.0000 0.976 1.000 0.000
#> GSM553628 1 0.0000 0.976 1.000 0.000
#> GSM553629 1 0.0000 0.976 1.000 0.000
#> GSM553630 1 0.0000 0.976 1.000 0.000
#> GSM553631 1 0.0000 0.976 1.000 0.000
#> GSM553632 1 0.0000 0.976 1.000 0.000
#> GSM553633 1 0.0000 0.976 1.000 0.000
#> GSM553634 2 0.0000 0.923 0.000 1.000
#> GSM553635 2 0.0000 0.923 0.000 1.000
#> GSM553636 2 0.9970 0.202 0.468 0.532
#> GSM553637 2 0.0000 0.923 0.000 1.000
#> GSM553638 2 0.0000 0.923 0.000 1.000
#> GSM553639 2 0.2236 0.899 0.036 0.964
#> GSM553640 2 0.7883 0.703 0.236 0.764
#> GSM553641 1 0.7883 0.668 0.764 0.236
#> GSM553642 1 0.0000 0.976 1.000 0.000
#> GSM553643 1 0.0000 0.976 1.000 0.000
#> GSM553644 1 0.0000 0.976 1.000 0.000
#> GSM553645 1 0.0000 0.976 1.000 0.000
#> GSM553646 1 0.0000 0.976 1.000 0.000
#> GSM553647 1 0.0000 0.976 1.000 0.000
#> GSM553648 1 0.6712 0.765 0.824 0.176
#> GSM553649 1 0.0376 0.973 0.996 0.004
#> GSM553650 2 0.0000 0.923 0.000 1.000
#> GSM553651 2 0.7883 0.703 0.236 0.764
#> GSM553652 2 0.0000 0.923 0.000 1.000
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> GSM553595 3 0.0000 0.8701 0.000 0.000 1.000
#> GSM553596 1 0.5397 0.6762 0.720 0.000 0.280
#> GSM553597 3 0.0000 0.8701 0.000 0.000 1.000
#> GSM553598 3 0.0237 0.8687 0.004 0.000 0.996
#> GSM553599 1 0.4504 0.7352 0.804 0.000 0.196
#> GSM553600 1 0.1031 0.7663 0.976 0.000 0.024
#> GSM553601 1 0.5363 0.6812 0.724 0.000 0.276
#> GSM553602 1 0.6286 -0.1330 0.536 0.000 0.464
#> GSM553603 3 0.0424 0.8698 0.008 0.000 0.992
#> GSM553604 1 0.5327 0.6847 0.728 0.000 0.272
#> GSM553605 2 0.4172 0.7870 0.004 0.840 0.156
#> GSM553606 2 0.0661 0.9490 0.004 0.988 0.008
#> GSM553607 2 0.0000 0.9525 0.000 1.000 0.000
#> GSM553608 2 0.0892 0.9526 0.020 0.980 0.000
#> GSM553609 2 0.0000 0.9525 0.000 1.000 0.000
#> GSM553610 2 0.0661 0.9490 0.004 0.988 0.008
#> GSM553611 1 0.5465 0.6047 0.712 0.288 0.000
#> GSM553612 2 0.0892 0.9526 0.020 0.980 0.000
#> GSM553613 2 0.0661 0.9490 0.004 0.988 0.008
#> GSM553614 3 0.0892 0.8678 0.020 0.000 0.980
#> GSM553615 3 0.5178 0.7206 0.256 0.000 0.744
#> GSM553616 1 0.3412 0.7597 0.876 0.000 0.124
#> GSM553617 1 0.0237 0.7690 0.996 0.000 0.004
#> GSM553618 3 0.5216 0.4868 0.260 0.000 0.740
#> GSM553619 3 0.0237 0.8687 0.004 0.000 0.996
#> GSM553620 3 0.2625 0.8444 0.084 0.000 0.916
#> GSM553621 3 0.5216 0.7166 0.260 0.000 0.740
#> GSM553622 1 0.6274 -0.1051 0.544 0.000 0.456
#> GSM553623 1 0.0237 0.7690 0.996 0.000 0.004
#> GSM553624 1 0.0237 0.7690 0.996 0.000 0.004
#> GSM553625 3 0.4555 0.7674 0.200 0.000 0.800
#> GSM553626 3 0.5216 0.7166 0.260 0.000 0.740
#> GSM553627 1 0.1163 0.7647 0.972 0.000 0.028
#> GSM553628 1 0.1031 0.7663 0.976 0.000 0.024
#> GSM553629 3 0.5178 0.7206 0.256 0.000 0.744
#> GSM553630 3 0.3038 0.8335 0.104 0.000 0.896
#> GSM553631 3 0.2356 0.8499 0.072 0.000 0.928
#> GSM553632 3 0.5216 0.7166 0.260 0.000 0.740
#> GSM553633 3 0.0237 0.8687 0.004 0.000 0.996
#> GSM553634 2 0.0892 0.9526 0.020 0.980 0.000
#> GSM553635 2 0.0592 0.9531 0.012 0.988 0.000
#> GSM553636 1 0.6393 0.6834 0.736 0.216 0.048
#> GSM553637 2 0.0000 0.9525 0.000 1.000 0.000
#> GSM553638 2 0.0892 0.9526 0.020 0.980 0.000
#> GSM553639 1 0.6141 0.6704 0.736 0.232 0.032
#> GSM553640 1 0.5849 0.6847 0.756 0.216 0.028
#> GSM553641 2 0.4931 0.7069 0.004 0.784 0.212
#> GSM553642 3 0.0424 0.8698 0.008 0.000 0.992
#> GSM553643 3 0.0000 0.8701 0.000 0.000 1.000
#> GSM553644 3 0.0424 0.8698 0.008 0.000 0.992
#> GSM553645 3 0.0237 0.8687 0.004 0.000 0.996
#> GSM553646 3 0.0237 0.8701 0.004 0.000 0.996
#> GSM553647 3 0.0000 0.8701 0.000 0.000 1.000
#> GSM553648 3 0.6505 0.0253 0.004 0.468 0.528
#> GSM553649 3 0.0237 0.8687 0.004 0.000 0.996
#> GSM553650 2 0.0892 0.9526 0.020 0.980 0.000
#> GSM553651 1 0.6393 0.6834 0.736 0.216 0.048
#> GSM553652 2 0.0892 0.9526 0.020 0.980 0.000
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> GSM553595 4 0.4304 0.7533 0.284 0.000 0.000 0.716
#> GSM553596 4 0.3051 0.4375 0.028 0.088 0.000 0.884
#> GSM553597 4 0.4304 0.7533 0.284 0.000 0.000 0.716
#> GSM553598 4 0.7273 0.4654 0.148 0.000 0.400 0.452
#> GSM553599 4 0.5092 0.2554 0.140 0.096 0.000 0.764
#> GSM553600 1 0.4304 0.6406 0.716 0.000 0.000 0.284
#> GSM553601 4 0.3051 0.4375 0.028 0.088 0.000 0.884
#> GSM553602 1 0.0000 0.6662 1.000 0.000 0.000 0.000
#> GSM553603 4 0.4304 0.7533 0.284 0.000 0.000 0.716
#> GSM553604 4 0.3745 0.3974 0.060 0.088 0.000 0.852
#> GSM553605 3 0.0000 0.6886 0.000 0.000 1.000 0.000
#> GSM553606 3 0.3219 0.7006 0.000 0.164 0.836 0.000
#> GSM553607 3 0.4843 0.5412 0.000 0.396 0.604 0.000
#> GSM553608 2 0.2149 0.8440 0.000 0.912 0.088 0.000
#> GSM553609 3 0.4855 0.5360 0.000 0.400 0.600 0.000
#> GSM553610 3 0.3219 0.7006 0.000 0.164 0.836 0.000
#> GSM553611 2 0.3485 0.7339 0.028 0.856 0.000 0.116
#> GSM553612 2 0.2149 0.8440 0.000 0.912 0.088 0.000
#> GSM553613 3 0.0000 0.6886 0.000 0.000 1.000 0.000
#> GSM553614 4 0.4382 0.7466 0.296 0.000 0.000 0.704
#> GSM553615 1 0.1389 0.6353 0.952 0.000 0.000 0.048
#> GSM553616 4 0.6886 -0.0783 0.200 0.204 0.000 0.596
#> GSM553617 1 0.7363 0.5105 0.516 0.200 0.000 0.284
#> GSM553618 4 0.2334 0.6210 0.088 0.004 0.000 0.908
#> GSM553619 4 0.4304 0.7533 0.284 0.000 0.000 0.716
#> GSM553620 4 0.4776 0.6788 0.376 0.000 0.000 0.624
#> GSM553621 1 0.0921 0.6550 0.972 0.000 0.000 0.028
#> GSM553622 1 0.0336 0.6675 0.992 0.000 0.000 0.008
#> GSM553623 1 0.7390 0.5055 0.512 0.204 0.000 0.284
#> GSM553624 1 0.7216 0.5314 0.536 0.180 0.000 0.284
#> GSM553625 1 0.4994 -0.5058 0.520 0.000 0.000 0.480
#> GSM553626 1 0.0921 0.6550 0.972 0.000 0.000 0.028
#> GSM553627 1 0.5062 0.6345 0.692 0.024 0.000 0.284
#> GSM553628 1 0.4304 0.6406 0.716 0.000 0.000 0.284
#> GSM553629 1 0.1637 0.6196 0.940 0.000 0.000 0.060
#> GSM553630 4 0.4830 0.6580 0.392 0.000 0.000 0.608
#> GSM553631 4 0.4661 0.7059 0.348 0.000 0.000 0.652
#> GSM553632 1 0.0921 0.6550 0.972 0.000 0.000 0.028
#> GSM553633 4 0.7260 0.4812 0.148 0.000 0.388 0.464
#> GSM553634 2 0.2149 0.8440 0.000 0.912 0.088 0.000
#> GSM553635 3 0.4941 0.4607 0.000 0.436 0.564 0.000
#> GSM553636 2 0.3760 0.7154 0.028 0.836 0.000 0.136
#> GSM553637 3 0.4855 0.5360 0.000 0.400 0.600 0.000
#> GSM553638 2 0.2149 0.8440 0.000 0.912 0.088 0.000
#> GSM553639 2 0.0000 0.8295 0.000 1.000 0.000 0.000
#> GSM553640 2 0.0188 0.8282 0.004 0.996 0.000 0.000
#> GSM553641 3 0.0000 0.6886 0.000 0.000 1.000 0.000
#> GSM553642 4 0.4304 0.7533 0.284 0.000 0.000 0.716
#> GSM553643 4 0.4304 0.7533 0.284 0.000 0.000 0.716
#> GSM553644 4 0.4304 0.7533 0.284 0.000 0.000 0.716
#> GSM553645 4 0.4304 0.7533 0.284 0.000 0.000 0.716
#> GSM553646 4 0.4304 0.7533 0.284 0.000 0.000 0.716
#> GSM553647 4 0.4304 0.7533 0.284 0.000 0.000 0.716
#> GSM553648 3 0.4008 0.3934 0.000 0.000 0.756 0.244
#> GSM553649 4 0.7273 0.4654 0.148 0.000 0.400 0.452
#> GSM553650 2 0.2149 0.8440 0.000 0.912 0.088 0.000
#> GSM553651 2 0.3760 0.7154 0.028 0.836 0.000 0.136
#> GSM553652 2 0.2149 0.8440 0.000 0.912 0.088 0.000
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> GSM553595 4 0.0404 0.870 0.000 0.000 0.000 0.988 0.012
#> GSM553596 5 0.2280 0.869 0.000 0.000 0.000 0.120 0.880
#> GSM553597 4 0.0000 0.873 0.000 0.000 0.000 1.000 0.000
#> GSM553598 4 0.5086 0.500 0.000 0.396 0.000 0.564 0.040
#> GSM553599 5 0.1168 0.924 0.032 0.000 0.000 0.008 0.960
#> GSM553600 1 0.1671 0.884 0.924 0.000 0.000 0.000 0.076
#> GSM553601 5 0.1043 0.910 0.000 0.000 0.000 0.040 0.960
#> GSM553602 1 0.0609 0.934 0.980 0.000 0.000 0.000 0.020
#> GSM553603 4 0.0000 0.873 0.000 0.000 0.000 1.000 0.000
#> GSM553604 5 0.2685 0.891 0.028 0.000 0.000 0.092 0.880
#> GSM553605 3 0.5086 0.680 0.000 0.396 0.564 0.000 0.040
#> GSM553606 3 0.3366 0.739 0.000 0.232 0.768 0.000 0.000
#> GSM553607 3 0.0000 0.651 0.000 0.000 1.000 0.000 0.000
#> GSM553608 2 0.4171 0.796 0.000 0.604 0.396 0.000 0.000
#> GSM553609 3 0.0000 0.651 0.000 0.000 1.000 0.000 0.000
#> GSM553610 3 0.3366 0.739 0.000 0.232 0.768 0.000 0.000
#> GSM553611 2 0.5784 0.700 0.000 0.604 0.252 0.000 0.144
#> GSM553612 2 0.4171 0.796 0.000 0.604 0.396 0.000 0.000
#> GSM553613 3 0.4171 0.693 0.000 0.396 0.604 0.000 0.000
#> GSM553614 4 0.2017 0.844 0.008 0.000 0.000 0.912 0.080
#> GSM553615 1 0.0609 0.932 0.980 0.000 0.000 0.020 0.000
#> GSM553616 5 0.1205 0.924 0.040 0.000 0.000 0.004 0.956
#> GSM553617 5 0.1121 0.922 0.044 0.000 0.000 0.000 0.956
#> GSM553618 4 0.3816 0.532 0.000 0.000 0.000 0.696 0.304
#> GSM553619 4 0.1956 0.846 0.000 0.008 0.000 0.916 0.076
#> GSM553620 4 0.2011 0.842 0.088 0.000 0.000 0.908 0.004
#> GSM553621 1 0.0000 0.944 1.000 0.000 0.000 0.000 0.000
#> GSM553622 1 0.0000 0.944 1.000 0.000 0.000 0.000 0.000
#> GSM553623 5 0.1043 0.924 0.040 0.000 0.000 0.000 0.960
#> GSM553624 5 0.3366 0.726 0.232 0.000 0.000 0.000 0.768
#> GSM553625 4 0.3336 0.719 0.228 0.000 0.000 0.772 0.000
#> GSM553626 1 0.0000 0.944 1.000 0.000 0.000 0.000 0.000
#> GSM553627 1 0.3707 0.551 0.716 0.000 0.000 0.000 0.284
#> GSM553628 1 0.0000 0.944 1.000 0.000 0.000 0.000 0.000
#> GSM553629 1 0.0794 0.924 0.972 0.000 0.000 0.028 0.000
#> GSM553630 4 0.2020 0.835 0.100 0.000 0.000 0.900 0.000
#> GSM553631 4 0.1638 0.854 0.064 0.000 0.000 0.932 0.004
#> GSM553632 1 0.0000 0.944 1.000 0.000 0.000 0.000 0.000
#> GSM553633 4 0.4990 0.519 0.000 0.384 0.000 0.580 0.036
#> GSM553634 2 0.4171 0.796 0.000 0.604 0.396 0.000 0.000
#> GSM553635 3 0.0000 0.651 0.000 0.000 1.000 0.000 0.000
#> GSM553636 2 0.5681 0.564 0.000 0.604 0.120 0.000 0.276
#> GSM553637 3 0.0000 0.651 0.000 0.000 1.000 0.000 0.000
#> GSM553638 2 0.4171 0.796 0.000 0.604 0.396 0.000 0.000
#> GSM553639 2 0.4171 0.796 0.000 0.604 0.396 0.000 0.000
#> GSM553640 2 0.4310 0.795 0.000 0.604 0.392 0.000 0.004
#> GSM553641 3 0.5086 0.680 0.000 0.396 0.564 0.000 0.040
#> GSM553642 4 0.0000 0.873 0.000 0.000 0.000 1.000 0.000
#> GSM553643 4 0.0000 0.873 0.000 0.000 0.000 1.000 0.000
#> GSM553644 4 0.0000 0.873 0.000 0.000 0.000 1.000 0.000
#> GSM553645 4 0.0000 0.873 0.000 0.000 0.000 1.000 0.000
#> GSM553646 4 0.0000 0.873 0.000 0.000 0.000 1.000 0.000
#> GSM553647 4 0.0000 0.873 0.000 0.000 0.000 1.000 0.000
#> GSM553648 2 0.7441 -0.513 0.000 0.396 0.340 0.224 0.040
#> GSM553649 4 0.5086 0.500 0.000 0.396 0.000 0.564 0.040
#> GSM553650 2 0.4171 0.796 0.000 0.604 0.396 0.000 0.000
#> GSM553651 2 0.5772 0.536 0.000 0.584 0.120 0.000 0.296
#> GSM553652 2 0.4171 0.796 0.000 0.604 0.396 0.000 0.000
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> GSM553595 4 0.0458 0.930 0.000 0.000 0.000 0.984 0.016 0.000
#> GSM553596 5 0.1610 0.894 0.000 0.000 0.000 0.084 0.916 0.000
#> GSM553597 4 0.0146 0.934 0.000 0.000 0.000 0.996 0.000 0.004
#> GSM553598 3 0.0000 0.996 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM553599 5 0.0000 0.937 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM553600 1 0.1556 0.885 0.920 0.000 0.000 0.000 0.080 0.000
#> GSM553601 5 0.0000 0.937 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM553602 1 0.0547 0.940 0.980 0.000 0.000 0.000 0.020 0.000
#> GSM553603 4 0.0000 0.935 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM553604 5 0.1610 0.894 0.000 0.000 0.000 0.084 0.916 0.000
#> GSM553605 3 0.0000 0.996 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM553606 6 0.0458 0.920 0.000 0.000 0.016 0.000 0.000 0.984
#> GSM553607 6 0.0146 0.921 0.000 0.004 0.000 0.000 0.000 0.996
#> GSM553608 2 0.0000 0.959 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM553609 6 0.2762 0.774 0.000 0.196 0.000 0.000 0.000 0.804
#> GSM553610 6 0.2003 0.877 0.000 0.000 0.116 0.000 0.000 0.884
#> GSM553611 2 0.0000 0.959 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM553612 2 0.0000 0.959 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM553613 6 0.2003 0.877 0.000 0.000 0.116 0.000 0.000 0.884
#> GSM553614 4 0.1956 0.895 0.008 0.000 0.000 0.908 0.080 0.004
#> GSM553615 1 0.0000 0.952 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM553616 5 0.0291 0.936 0.004 0.000 0.000 0.000 0.992 0.004
#> GSM553617 5 0.0146 0.936 0.004 0.000 0.000 0.000 0.996 0.000
#> GSM553618 4 0.3428 0.568 0.000 0.000 0.000 0.696 0.304 0.000
#> GSM553619 4 0.1845 0.900 0.000 0.000 0.008 0.916 0.072 0.004
#> GSM553620 4 0.1897 0.898 0.084 0.000 0.000 0.908 0.004 0.004
#> GSM553621 1 0.0146 0.951 0.996 0.000 0.000 0.000 0.000 0.004
#> GSM553622 1 0.0000 0.952 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM553623 5 0.0000 0.937 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM553624 5 0.2823 0.735 0.204 0.000 0.000 0.000 0.796 0.000
#> GSM553625 4 0.2793 0.781 0.200 0.000 0.000 0.800 0.000 0.000
#> GSM553626 1 0.0000 0.952 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM553627 1 0.3330 0.572 0.716 0.000 0.000 0.000 0.284 0.000
#> GSM553628 1 0.0000 0.952 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM553629 1 0.0000 0.952 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM553630 4 0.1814 0.887 0.100 0.000 0.000 0.900 0.000 0.000
#> GSM553631 4 0.1471 0.911 0.064 0.000 0.000 0.932 0.004 0.000
#> GSM553632 1 0.0000 0.952 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM553633 3 0.0458 0.980 0.000 0.000 0.984 0.016 0.000 0.000
#> GSM553634 2 0.2730 0.784 0.000 0.808 0.000 0.000 0.000 0.192
#> GSM553635 6 0.0146 0.921 0.000 0.004 0.000 0.000 0.000 0.996
#> GSM553636 2 0.1610 0.904 0.000 0.916 0.000 0.000 0.084 0.000
#> GSM553637 6 0.0146 0.921 0.000 0.004 0.000 0.000 0.000 0.996
#> GSM553638 2 0.0000 0.959 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM553639 2 0.0000 0.959 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM553640 2 0.0000 0.959 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM553641 3 0.0000 0.996 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM553642 4 0.0000 0.935 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM553643 4 0.0000 0.935 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM553644 4 0.0000 0.935 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM553645 4 0.0000 0.935 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM553646 4 0.0000 0.935 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM553647 4 0.0000 0.935 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM553648 3 0.0000 0.996 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM553649 3 0.0000 0.996 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM553650 2 0.0000 0.959 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM553651 2 0.2092 0.868 0.000 0.876 0.000 0.000 0.124 0.000
#> GSM553652 2 0.0000 0.959 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 individual(p) k
#> CV:pam 55 0.31676 2
#> CV:pam 54 0.08762 3
#> CV:pam 47 0.00523 4
#> CV:pam 57 0.04324 5
#> CV:pam 58 0.03276 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 5.
#>
#> 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.612 0.737 0.877 0.2871 0.784 0.784
#> 3 3 0.681 0.821 0.895 1.0815 0.572 0.471
#> 4 4 0.762 0.859 0.881 0.2025 0.789 0.519
#> 5 5 0.874 0.810 0.923 0.0672 0.906 0.674
#> 6 6 0.805 0.715 0.865 0.0267 0.920 0.689
suggest_best_k()
suggests the best \(k\) based on these statistics. The rules are as follows:
suggest_best_k(res)
#> [1] 5
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
#> GSM553595 1 0.0000 0.8664 1.000 0.000
#> GSM553596 1 0.0000 0.8664 1.000 0.000
#> GSM553597 1 0.0000 0.8664 1.000 0.000
#> GSM553598 1 0.0672 0.8639 0.992 0.008
#> GSM553599 1 0.0000 0.8664 1.000 0.000
#> GSM553600 1 0.2948 0.8464 0.948 0.052
#> GSM553601 1 0.0000 0.8664 1.000 0.000
#> GSM553602 1 0.2948 0.8464 0.948 0.052
#> GSM553603 1 0.0000 0.8664 1.000 0.000
#> GSM553604 1 0.0000 0.8664 1.000 0.000
#> GSM553605 1 0.0672 0.8639 0.992 0.008
#> GSM553606 1 0.9170 0.4563 0.668 0.332
#> GSM553607 1 0.9170 0.4563 0.668 0.332
#> GSM553608 2 0.2948 0.8230 0.052 0.948
#> GSM553609 1 0.9686 0.2929 0.604 0.396
#> GSM553610 1 0.9170 0.4563 0.668 0.332
#> GSM553611 2 0.2948 0.8230 0.052 0.948
#> GSM553612 1 0.9686 0.2929 0.604 0.396
#> GSM553613 1 0.9170 0.4563 0.668 0.332
#> GSM553614 1 0.0672 0.8642 0.992 0.008
#> GSM553615 1 0.2948 0.8464 0.948 0.052
#> GSM553616 1 0.5059 0.8163 0.888 0.112
#> GSM553617 1 0.4022 0.8401 0.920 0.080
#> GSM553618 1 0.0000 0.8664 1.000 0.000
#> GSM553619 1 0.0000 0.8664 1.000 0.000
#> GSM553620 1 0.2948 0.8464 0.948 0.052
#> GSM553621 1 0.2948 0.8464 0.948 0.052
#> GSM553622 1 0.2948 0.8464 0.948 0.052
#> GSM553623 1 0.1633 0.8548 0.976 0.024
#> GSM553624 1 0.7453 0.6545 0.788 0.212
#> GSM553625 1 0.2948 0.8464 0.948 0.052
#> GSM553626 1 0.2948 0.8464 0.948 0.052
#> GSM553627 1 0.2948 0.8464 0.948 0.052
#> GSM553628 1 0.2948 0.8464 0.948 0.052
#> GSM553629 1 0.0000 0.8664 1.000 0.000
#> GSM553630 1 0.2948 0.8464 0.948 0.052
#> GSM553631 1 0.0000 0.8664 1.000 0.000
#> GSM553632 1 0.2948 0.8464 0.948 0.052
#> GSM553633 1 0.0000 0.8664 1.000 0.000
#> GSM553634 2 0.9775 0.3115 0.412 0.588
#> GSM553635 1 0.9393 0.4008 0.644 0.356
#> GSM553636 1 0.9635 0.3105 0.612 0.388
#> GSM553637 1 0.9170 0.4563 0.668 0.332
#> GSM553638 1 0.9686 0.2929 0.604 0.396
#> GSM553639 2 0.3733 0.8141 0.072 0.928
#> GSM553640 2 0.9996 0.0423 0.488 0.512
#> GSM553641 1 0.0672 0.8639 0.992 0.008
#> GSM553642 1 0.0000 0.8664 1.000 0.000
#> GSM553643 1 0.0000 0.8664 1.000 0.000
#> GSM553644 1 0.0000 0.8664 1.000 0.000
#> GSM553645 1 0.0000 0.8664 1.000 0.000
#> GSM553646 1 0.0000 0.8664 1.000 0.000
#> GSM553647 1 0.0000 0.8664 1.000 0.000
#> GSM553648 1 0.0672 0.8639 0.992 0.008
#> GSM553649 1 0.0672 0.8639 0.992 0.008
#> GSM553650 2 0.2948 0.8230 0.052 0.948
#> GSM553651 1 0.9686 0.2929 0.604 0.396
#> GSM553652 2 0.2948 0.8230 0.052 0.948
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> GSM553595 1 0.4504 0.865 0.804 0.000 0.196
#> GSM553596 1 0.3551 0.889 0.868 0.000 0.132
#> GSM553597 1 0.4452 0.867 0.808 0.000 0.192
#> GSM553598 3 0.1643 0.721 0.044 0.000 0.956
#> GSM553599 1 0.1643 0.862 0.956 0.000 0.044
#> GSM553600 1 0.0424 0.883 0.992 0.000 0.008
#> GSM553601 1 0.4002 0.881 0.840 0.000 0.160
#> GSM553602 1 0.0000 0.887 1.000 0.000 0.000
#> GSM553603 1 0.4504 0.865 0.804 0.000 0.196
#> GSM553604 1 0.3192 0.852 0.888 0.000 0.112
#> GSM553605 3 0.1643 0.721 0.044 0.000 0.956
#> GSM553606 3 0.6126 0.393 0.000 0.400 0.600
#> GSM553607 3 0.6126 0.393 0.000 0.400 0.600
#> GSM553608 2 0.0000 0.974 0.000 1.000 0.000
#> GSM553609 2 0.0424 0.969 0.000 0.992 0.008
#> GSM553610 3 0.4555 0.600 0.000 0.200 0.800
#> GSM553611 2 0.0000 0.974 0.000 1.000 0.000
#> GSM553612 2 0.0000 0.974 0.000 1.000 0.000
#> GSM553613 3 0.4555 0.600 0.000 0.200 0.800
#> GSM553614 1 0.3482 0.890 0.872 0.000 0.128
#> GSM553615 1 0.2537 0.896 0.920 0.000 0.080
#> GSM553616 1 0.1643 0.862 0.956 0.000 0.044
#> GSM553617 1 0.1643 0.862 0.956 0.000 0.044
#> GSM553618 1 0.3551 0.889 0.868 0.000 0.132
#> GSM553619 3 0.6026 0.314 0.376 0.000 0.624
#> GSM553620 1 0.3412 0.891 0.876 0.000 0.124
#> GSM553621 1 0.0237 0.888 0.996 0.000 0.004
#> GSM553622 1 0.0000 0.887 1.000 0.000 0.000
#> GSM553623 1 0.1643 0.862 0.956 0.000 0.044
#> GSM553624 1 0.1643 0.862 0.956 0.000 0.044
#> GSM553625 1 0.2796 0.895 0.908 0.000 0.092
#> GSM553626 1 0.0000 0.887 1.000 0.000 0.000
#> GSM553627 1 0.0000 0.887 1.000 0.000 0.000
#> GSM553628 1 0.0000 0.887 1.000 0.000 0.000
#> GSM553629 1 0.1289 0.872 0.968 0.000 0.032
#> GSM553630 1 0.3340 0.892 0.880 0.000 0.120
#> GSM553631 1 0.3551 0.889 0.868 0.000 0.132
#> GSM553632 1 0.0000 0.887 1.000 0.000 0.000
#> GSM553633 3 0.6215 -0.041 0.428 0.000 0.572
#> GSM553634 2 0.0000 0.974 0.000 1.000 0.000
#> GSM553635 2 0.1163 0.953 0.000 0.972 0.028
#> GSM553636 2 0.3412 0.825 0.124 0.876 0.000
#> GSM553637 3 0.6126 0.393 0.000 0.400 0.600
#> GSM553638 2 0.0000 0.974 0.000 1.000 0.000
#> GSM553639 2 0.0424 0.971 0.008 0.992 0.000
#> GSM553640 2 0.1031 0.959 0.024 0.976 0.000
#> GSM553641 3 0.1643 0.721 0.044 0.000 0.956
#> GSM553642 1 0.4452 0.867 0.808 0.000 0.192
#> GSM553643 1 0.4504 0.865 0.804 0.000 0.196
#> GSM553644 1 0.4452 0.867 0.808 0.000 0.192
#> GSM553645 1 0.4504 0.865 0.804 0.000 0.196
#> GSM553646 1 0.4504 0.865 0.804 0.000 0.196
#> GSM553647 1 0.4504 0.865 0.804 0.000 0.196
#> GSM553648 3 0.1643 0.721 0.044 0.000 0.956
#> GSM553649 3 0.1643 0.721 0.044 0.000 0.956
#> GSM553650 2 0.0000 0.974 0.000 1.000 0.000
#> GSM553651 2 0.1289 0.950 0.032 0.968 0.000
#> GSM553652 2 0.0000 0.974 0.000 1.000 0.000
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> GSM553595 4 0.1474 0.8377 0.052 0.000 0.000 0.948
#> GSM553596 4 0.3946 0.8726 0.168 0.000 0.020 0.812
#> GSM553597 4 0.3123 0.8755 0.156 0.000 0.000 0.844
#> GSM553598 3 0.2530 0.9076 0.000 0.000 0.888 0.112
#> GSM553599 1 0.1297 0.9063 0.964 0.000 0.016 0.020
#> GSM553600 1 0.1610 0.9139 0.952 0.000 0.016 0.032
#> GSM553601 1 0.3907 0.7059 0.768 0.000 0.000 0.232
#> GSM553602 1 0.1211 0.9118 0.960 0.000 0.000 0.040
#> GSM553603 4 0.3024 0.8785 0.148 0.000 0.000 0.852
#> GSM553604 1 0.4434 0.7112 0.756 0.000 0.016 0.228
#> GSM553605 3 0.2281 0.9145 0.000 0.000 0.904 0.096
#> GSM553606 3 0.4831 0.6516 0.000 0.208 0.752 0.040
#> GSM553607 2 0.4638 0.7641 0.000 0.776 0.180 0.044
#> GSM553608 2 0.0000 0.9614 0.000 1.000 0.000 0.000
#> GSM553609 2 0.1398 0.9394 0.000 0.956 0.004 0.040
#> GSM553610 3 0.1545 0.8760 0.000 0.008 0.952 0.040
#> GSM553611 2 0.0000 0.9614 0.000 1.000 0.000 0.000
#> GSM553612 2 0.0000 0.9614 0.000 1.000 0.000 0.000
#> GSM553613 3 0.1545 0.8760 0.000 0.008 0.952 0.040
#> GSM553614 1 0.3636 0.7998 0.820 0.000 0.008 0.172
#> GSM553615 1 0.1970 0.9094 0.932 0.000 0.008 0.060
#> GSM553616 1 0.1182 0.9067 0.968 0.000 0.016 0.016
#> GSM553617 1 0.1182 0.9067 0.968 0.000 0.016 0.016
#> GSM553618 4 0.4267 0.8571 0.188 0.000 0.024 0.788
#> GSM553619 4 0.5151 0.8137 0.140 0.000 0.100 0.760
#> GSM553620 4 0.5294 0.2740 0.484 0.000 0.008 0.508
#> GSM553621 1 0.1022 0.9126 0.968 0.000 0.000 0.032
#> GSM553622 1 0.1022 0.9126 0.968 0.000 0.000 0.032
#> GSM553623 1 0.1182 0.9067 0.968 0.000 0.016 0.016
#> GSM553624 1 0.1182 0.9067 0.968 0.000 0.016 0.016
#> GSM553625 1 0.1557 0.9098 0.944 0.000 0.000 0.056
#> GSM553626 1 0.1576 0.9121 0.948 0.000 0.004 0.048
#> GSM553627 1 0.1938 0.9126 0.936 0.000 0.012 0.052
#> GSM553628 1 0.1798 0.9148 0.944 0.000 0.016 0.040
#> GSM553629 1 0.2411 0.9111 0.920 0.000 0.040 0.040
#> GSM553630 1 0.5028 0.0962 0.596 0.000 0.004 0.400
#> GSM553631 4 0.5253 0.5851 0.360 0.000 0.016 0.624
#> GSM553632 1 0.1209 0.9122 0.964 0.000 0.004 0.032
#> GSM553633 4 0.3056 0.8078 0.040 0.000 0.072 0.888
#> GSM553634 2 0.0188 0.9604 0.000 0.996 0.004 0.000
#> GSM553635 2 0.1042 0.9493 0.000 0.972 0.008 0.020
#> GSM553636 2 0.0592 0.9507 0.016 0.984 0.000 0.000
#> GSM553637 2 0.4638 0.7641 0.000 0.776 0.180 0.044
#> GSM553638 2 0.0000 0.9614 0.000 1.000 0.000 0.000
#> GSM553639 2 0.0000 0.9614 0.000 1.000 0.000 0.000
#> GSM553640 2 0.0188 0.9604 0.000 0.996 0.004 0.000
#> GSM553641 3 0.2345 0.9147 0.000 0.000 0.900 0.100
#> GSM553642 4 0.3444 0.8629 0.184 0.000 0.000 0.816
#> GSM553643 4 0.1637 0.8401 0.060 0.000 0.000 0.940
#> GSM553644 4 0.2921 0.8814 0.140 0.000 0.000 0.860
#> GSM553645 4 0.2647 0.8798 0.120 0.000 0.000 0.880
#> GSM553646 4 0.2814 0.8808 0.132 0.000 0.000 0.868
#> GSM553647 4 0.1474 0.8397 0.052 0.000 0.000 0.948
#> GSM553648 3 0.2345 0.9147 0.000 0.000 0.900 0.100
#> GSM553649 3 0.2345 0.9147 0.000 0.000 0.900 0.100
#> GSM553650 2 0.0000 0.9614 0.000 1.000 0.000 0.000
#> GSM553651 2 0.0336 0.9565 0.008 0.992 0.000 0.000
#> GSM553652 2 0.0000 0.9614 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
#> GSM553595 4 0.0000 0.832 0.000 0.000 0.000 1.000 0.000
#> GSM553596 4 0.1502 0.809 0.056 0.000 0.000 0.940 0.004
#> GSM553597 4 0.0703 0.825 0.024 0.000 0.000 0.976 0.000
#> GSM553598 3 0.0162 0.887 0.000 0.000 0.996 0.000 0.004
#> GSM553599 1 0.0324 0.919 0.992 0.000 0.000 0.004 0.004
#> GSM553600 1 0.0000 0.920 1.000 0.000 0.000 0.000 0.000
#> GSM553601 1 0.4015 0.429 0.652 0.000 0.000 0.348 0.000
#> GSM553602 1 0.0000 0.920 1.000 0.000 0.000 0.000 0.000
#> GSM553603 4 0.0000 0.832 0.000 0.000 0.000 1.000 0.000
#> GSM553604 1 0.4201 0.307 0.592 0.000 0.000 0.408 0.000
#> GSM553605 3 0.0000 0.889 0.000 0.000 1.000 0.000 0.000
#> GSM553606 5 0.2970 0.745 0.000 0.004 0.168 0.000 0.828
#> GSM553607 5 0.0290 0.784 0.000 0.008 0.000 0.000 0.992
#> GSM553608 2 0.0000 0.954 0.000 1.000 0.000 0.000 0.000
#> GSM553609 2 0.0000 0.954 0.000 1.000 0.000 0.000 0.000
#> GSM553610 5 0.4341 0.432 0.000 0.004 0.404 0.000 0.592
#> GSM553611 2 0.0000 0.954 0.000 1.000 0.000 0.000 0.000
#> GSM553612 2 0.0000 0.954 0.000 1.000 0.000 0.000 0.000
#> GSM553613 3 0.1892 0.804 0.000 0.004 0.916 0.000 0.080
#> GSM553614 4 0.4171 0.465 0.396 0.000 0.000 0.604 0.000
#> GSM553615 1 0.0880 0.906 0.968 0.000 0.000 0.032 0.000
#> GSM553616 1 0.1704 0.866 0.928 0.068 0.000 0.000 0.004
#> GSM553617 1 0.1662 0.879 0.936 0.056 0.000 0.004 0.004
#> GSM553618 4 0.2971 0.742 0.156 0.000 0.000 0.836 0.008
#> GSM553619 3 0.6258 0.346 0.156 0.000 0.592 0.016 0.236
#> GSM553620 4 0.4150 0.479 0.388 0.000 0.000 0.612 0.000
#> GSM553621 1 0.0162 0.920 0.996 0.000 0.000 0.004 0.000
#> GSM553622 1 0.0000 0.920 1.000 0.000 0.000 0.000 0.000
#> GSM553623 1 0.0613 0.918 0.984 0.004 0.000 0.008 0.004
#> GSM553624 2 0.4524 0.210 0.420 0.572 0.000 0.004 0.004
#> GSM553625 1 0.1792 0.859 0.916 0.000 0.000 0.084 0.000
#> GSM553626 1 0.0000 0.920 1.000 0.000 0.000 0.000 0.000
#> GSM553627 1 0.0510 0.916 0.984 0.000 0.000 0.016 0.000
#> GSM553628 1 0.0000 0.920 1.000 0.000 0.000 0.000 0.000
#> GSM553629 1 0.0566 0.918 0.984 0.000 0.000 0.012 0.004
#> GSM553630 4 0.4235 0.396 0.424 0.000 0.000 0.576 0.000
#> GSM553631 4 0.4686 0.471 0.384 0.000 0.000 0.596 0.020
#> GSM553632 1 0.0000 0.920 1.000 0.000 0.000 0.000 0.000
#> GSM553633 4 0.0000 0.832 0.000 0.000 0.000 1.000 0.000
#> GSM553634 2 0.0000 0.954 0.000 1.000 0.000 0.000 0.000
#> GSM553635 2 0.0000 0.954 0.000 1.000 0.000 0.000 0.000
#> GSM553636 2 0.0000 0.954 0.000 1.000 0.000 0.000 0.000
#> GSM553637 5 0.0290 0.784 0.000 0.008 0.000 0.000 0.992
#> GSM553638 2 0.0000 0.954 0.000 1.000 0.000 0.000 0.000
#> GSM553639 2 0.0000 0.954 0.000 1.000 0.000 0.000 0.000
#> GSM553640 2 0.0000 0.954 0.000 1.000 0.000 0.000 0.000
#> GSM553641 3 0.0000 0.889 0.000 0.000 1.000 0.000 0.000
#> GSM553642 4 0.0162 0.831 0.004 0.000 0.000 0.996 0.000
#> GSM553643 4 0.0000 0.832 0.000 0.000 0.000 1.000 0.000
#> GSM553644 4 0.0000 0.832 0.000 0.000 0.000 1.000 0.000
#> GSM553645 4 0.0000 0.832 0.000 0.000 0.000 1.000 0.000
#> GSM553646 4 0.0000 0.832 0.000 0.000 0.000 1.000 0.000
#> GSM553647 4 0.0000 0.832 0.000 0.000 0.000 1.000 0.000
#> GSM553648 3 0.0000 0.889 0.000 0.000 1.000 0.000 0.000
#> GSM553649 3 0.0000 0.889 0.000 0.000 1.000 0.000 0.000
#> GSM553650 2 0.0000 0.954 0.000 1.000 0.000 0.000 0.000
#> GSM553651 2 0.0000 0.954 0.000 1.000 0.000 0.000 0.000
#> GSM553652 2 0.0000 0.954 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
#> GSM553595 5 0.0000 0.74676 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM553596 5 0.4253 -0.03368 0.024 0.000 0.000 0.304 0.664 0.008
#> GSM553597 5 0.0891 0.73795 0.024 0.000 0.000 0.008 0.968 0.000
#> GSM553598 3 0.1765 0.74179 0.000 0.000 0.904 0.096 0.000 0.000
#> GSM553599 1 0.3266 0.70559 0.728 0.000 0.000 0.272 0.000 0.000
#> GSM553600 1 0.1524 0.80487 0.932 0.000 0.000 0.008 0.060 0.000
#> GSM553601 1 0.4086 0.18537 0.528 0.000 0.000 0.008 0.464 0.000
#> GSM553602 1 0.0632 0.79645 0.976 0.000 0.000 0.000 0.024 0.000
#> GSM553603 5 0.0458 0.74837 0.016 0.000 0.000 0.000 0.984 0.000
#> GSM553604 5 0.5531 0.14784 0.264 0.000 0.000 0.184 0.552 0.000
#> GSM553605 3 0.0000 0.80812 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM553606 6 0.2831 0.77417 0.000 0.000 0.136 0.024 0.000 0.840
#> GSM553607 6 0.0000 0.90259 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM553608 2 0.0000 0.97949 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM553609 2 0.0865 0.96527 0.000 0.964 0.000 0.000 0.000 0.036
#> GSM553610 3 0.4408 0.00252 0.000 0.000 0.488 0.024 0.000 0.488
#> GSM553611 2 0.0000 0.97949 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM553612 2 0.0000 0.97949 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM553613 3 0.4153 0.40272 0.000 0.000 0.636 0.024 0.000 0.340
#> GSM553614 1 0.4994 0.20296 0.524 0.000 0.000 0.060 0.412 0.004
#> GSM553615 1 0.2165 0.78305 0.884 0.000 0.000 0.008 0.108 0.000
#> GSM553616 1 0.3266 0.70559 0.728 0.000 0.000 0.272 0.000 0.000
#> GSM553617 1 0.3288 0.70318 0.724 0.000 0.000 0.276 0.000 0.000
#> GSM553618 4 0.4627 0.53220 0.024 0.000 0.000 0.512 0.456 0.008
#> GSM553619 4 0.6050 0.43324 0.032 0.000 0.192 0.628 0.112 0.036
#> GSM553620 5 0.4074 0.24611 0.324 0.000 0.000 0.016 0.656 0.004
#> GSM553621 1 0.0713 0.79650 0.972 0.000 0.000 0.000 0.028 0.000
#> GSM553622 1 0.0632 0.79645 0.976 0.000 0.000 0.000 0.024 0.000
#> GSM553623 1 0.3266 0.70559 0.728 0.000 0.000 0.272 0.000 0.000
#> GSM553624 1 0.5805 0.39750 0.488 0.212 0.000 0.300 0.000 0.000
#> GSM553625 1 0.2814 0.72734 0.820 0.000 0.000 0.008 0.172 0.000
#> GSM553626 1 0.1327 0.80283 0.936 0.000 0.000 0.000 0.064 0.000
#> GSM553627 1 0.2365 0.80234 0.888 0.000 0.000 0.040 0.072 0.000
#> GSM553628 1 0.1462 0.80541 0.936 0.000 0.000 0.008 0.056 0.000
#> GSM553629 1 0.2308 0.80336 0.892 0.000 0.000 0.040 0.068 0.000
#> GSM553630 5 0.3804 0.14190 0.424 0.000 0.000 0.000 0.576 0.000
#> GSM553631 4 0.5119 0.62387 0.068 0.000 0.000 0.552 0.372 0.008
#> GSM553632 1 0.1267 0.80301 0.940 0.000 0.000 0.000 0.060 0.000
#> GSM553633 5 0.0622 0.74292 0.000 0.000 0.012 0.008 0.980 0.000
#> GSM553634 2 0.0363 0.97601 0.000 0.988 0.000 0.000 0.000 0.012
#> GSM553635 2 0.1075 0.95745 0.000 0.952 0.000 0.000 0.000 0.048
#> GSM553636 2 0.1141 0.96343 0.000 0.948 0.000 0.052 0.000 0.000
#> GSM553637 6 0.0000 0.90259 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM553638 2 0.0000 0.97949 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM553639 2 0.0713 0.97133 0.000 0.972 0.000 0.028 0.000 0.000
#> GSM553640 2 0.1426 0.95862 0.016 0.948 0.000 0.028 0.000 0.008
#> GSM553641 3 0.0000 0.80812 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM553642 5 0.0993 0.74553 0.024 0.000 0.000 0.012 0.964 0.000
#> GSM553643 5 0.0000 0.74676 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM553644 5 0.1341 0.74117 0.024 0.000 0.000 0.028 0.948 0.000
#> GSM553645 5 0.0858 0.74406 0.004 0.000 0.000 0.028 0.968 0.000
#> GSM553646 5 0.0935 0.74206 0.004 0.000 0.000 0.032 0.964 0.000
#> GSM553647 5 0.0146 0.74525 0.000 0.000 0.000 0.004 0.996 0.000
#> GSM553648 3 0.0146 0.80569 0.000 0.000 0.996 0.000 0.004 0.000
#> GSM553649 3 0.0000 0.80812 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM553650 2 0.0000 0.97949 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM553651 2 0.1141 0.96343 0.000 0.948 0.000 0.052 0.000 0.000
#> GSM553652 2 0.0000 0.97949 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 individual(p) k
#> CV:mclust 45 0.43728 2
#> CV:mclust 53 0.13763 3
#> CV:mclust 56 0.00530 4
#> CV:mclust 49 0.00718 5
#> CV:mclust 48 0.00473 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.964 0.935 0.975 0.5081 0.491 0.491
#> 3 3 0.786 0.823 0.929 0.2941 0.758 0.550
#> 4 4 0.724 0.692 0.852 0.1316 0.818 0.524
#> 5 5 0.666 0.579 0.766 0.0669 0.868 0.541
#> 6 6 0.696 0.656 0.803 0.0370 0.897 0.565
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
#> GSM553595 2 0.9552 0.363 0.376 0.624
#> GSM553596 2 0.0376 0.974 0.004 0.996
#> GSM553597 1 0.1633 0.950 0.976 0.024
#> GSM553598 2 0.0000 0.977 0.000 1.000
#> GSM553599 1 0.0000 0.968 1.000 0.000
#> GSM553600 1 0.0000 0.968 1.000 0.000
#> GSM553601 1 0.0672 0.963 0.992 0.008
#> GSM553602 1 0.0000 0.968 1.000 0.000
#> GSM553603 1 0.2043 0.943 0.968 0.032
#> GSM553604 1 0.0000 0.968 1.000 0.000
#> GSM553605 2 0.0000 0.977 0.000 1.000
#> GSM553606 2 0.0000 0.977 0.000 1.000
#> GSM553607 2 0.0000 0.977 0.000 1.000
#> GSM553608 2 0.0000 0.977 0.000 1.000
#> GSM553609 2 0.0000 0.977 0.000 1.000
#> GSM553610 2 0.0000 0.977 0.000 1.000
#> GSM553611 2 0.0000 0.977 0.000 1.000
#> GSM553612 2 0.0000 0.977 0.000 1.000
#> GSM553613 2 0.0000 0.977 0.000 1.000
#> GSM553614 1 0.0000 0.968 1.000 0.000
#> GSM553615 1 0.0000 0.968 1.000 0.000
#> GSM553616 1 0.0000 0.968 1.000 0.000
#> GSM553617 1 0.0000 0.968 1.000 0.000
#> GSM553618 2 0.0000 0.977 0.000 1.000
#> GSM553619 2 0.0000 0.977 0.000 1.000
#> GSM553620 1 0.0000 0.968 1.000 0.000
#> GSM553621 1 0.0000 0.968 1.000 0.000
#> GSM553622 1 0.0000 0.968 1.000 0.000
#> GSM553623 1 0.0376 0.966 0.996 0.004
#> GSM553624 1 0.0938 0.960 0.988 0.012
#> GSM553625 1 0.0000 0.968 1.000 0.000
#> GSM553626 1 0.0000 0.968 1.000 0.000
#> GSM553627 1 0.0000 0.968 1.000 0.000
#> GSM553628 1 0.0000 0.968 1.000 0.000
#> GSM553629 1 0.0000 0.968 1.000 0.000
#> GSM553630 1 0.0000 0.968 1.000 0.000
#> GSM553631 1 0.0000 0.968 1.000 0.000
#> GSM553632 1 0.0000 0.968 1.000 0.000
#> GSM553633 2 0.0000 0.977 0.000 1.000
#> GSM553634 2 0.0000 0.977 0.000 1.000
#> GSM553635 2 0.0000 0.977 0.000 1.000
#> GSM553636 2 0.1414 0.960 0.020 0.980
#> GSM553637 2 0.0000 0.977 0.000 1.000
#> GSM553638 2 0.0000 0.977 0.000 1.000
#> GSM553639 2 0.0000 0.977 0.000 1.000
#> GSM553640 2 0.6247 0.809 0.156 0.844
#> GSM553641 2 0.0000 0.977 0.000 1.000
#> GSM553642 1 0.0000 0.968 1.000 0.000
#> GSM553643 1 0.9087 0.525 0.676 0.324
#> GSM553644 1 0.0000 0.968 1.000 0.000
#> GSM553645 2 0.0000 0.977 0.000 1.000
#> GSM553646 1 0.0000 0.968 1.000 0.000
#> GSM553647 1 0.9933 0.174 0.548 0.452
#> GSM553648 2 0.0000 0.977 0.000 1.000
#> GSM553649 2 0.0000 0.977 0.000 1.000
#> GSM553650 2 0.0000 0.977 0.000 1.000
#> GSM553651 2 0.3431 0.918 0.064 0.936
#> GSM553652 2 0.0000 0.977 0.000 1.000
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> GSM553595 3 0.2537 0.8580 0.080 0.000 0.920
#> GSM553596 3 0.5330 0.7692 0.144 0.044 0.812
#> GSM553597 1 0.1964 0.9163 0.944 0.000 0.056
#> GSM553598 3 0.0000 0.8970 0.000 0.000 1.000
#> GSM553599 1 0.0000 0.9619 1.000 0.000 0.000
#> GSM553600 1 0.0000 0.9619 1.000 0.000 0.000
#> GSM553601 1 0.0237 0.9601 0.996 0.000 0.004
#> GSM553602 1 0.0000 0.9619 1.000 0.000 0.000
#> GSM553603 1 0.1031 0.9463 0.976 0.000 0.024
#> GSM553604 1 0.0237 0.9602 0.996 0.000 0.004
#> GSM553605 3 0.0000 0.8970 0.000 0.000 1.000
#> GSM553606 2 0.4654 0.6692 0.000 0.792 0.208
#> GSM553607 2 0.0592 0.8632 0.000 0.988 0.012
#> GSM553608 2 0.0000 0.8676 0.000 1.000 0.000
#> GSM553609 2 0.0000 0.8676 0.000 1.000 0.000
#> GSM553610 2 0.6274 0.1550 0.000 0.544 0.456
#> GSM553611 2 0.0000 0.8676 0.000 1.000 0.000
#> GSM553612 2 0.1643 0.8453 0.000 0.956 0.044
#> GSM553613 3 0.1031 0.8823 0.000 0.024 0.976
#> GSM553614 1 0.0000 0.9619 1.000 0.000 0.000
#> GSM553615 1 0.0237 0.9594 0.996 0.004 0.000
#> GSM553616 2 0.6095 0.3802 0.392 0.608 0.000
#> GSM553617 1 0.0000 0.9619 1.000 0.000 0.000
#> GSM553618 3 0.7487 0.1842 0.040 0.408 0.552
#> GSM553619 2 0.6451 0.1910 0.004 0.560 0.436
#> GSM553620 1 0.0000 0.9619 1.000 0.000 0.000
#> GSM553621 1 0.0000 0.9619 1.000 0.000 0.000
#> GSM553622 1 0.0000 0.9619 1.000 0.000 0.000
#> GSM553623 1 0.2066 0.9060 0.940 0.060 0.000
#> GSM553624 2 0.6244 0.2519 0.440 0.560 0.000
#> GSM553625 1 0.0000 0.9619 1.000 0.000 0.000
#> GSM553626 1 0.0000 0.9619 1.000 0.000 0.000
#> GSM553627 1 0.0000 0.9619 1.000 0.000 0.000
#> GSM553628 1 0.0000 0.9619 1.000 0.000 0.000
#> GSM553629 2 0.0892 0.8584 0.020 0.980 0.000
#> GSM553630 1 0.0000 0.9619 1.000 0.000 0.000
#> GSM553631 1 0.3879 0.7925 0.848 0.152 0.000
#> GSM553632 1 0.0000 0.9619 1.000 0.000 0.000
#> GSM553633 3 0.0000 0.8970 0.000 0.000 1.000
#> GSM553634 2 0.0000 0.8676 0.000 1.000 0.000
#> GSM553635 2 0.0000 0.8676 0.000 1.000 0.000
#> GSM553636 2 0.4291 0.7130 0.180 0.820 0.000
#> GSM553637 2 0.0237 0.8664 0.000 0.996 0.004
#> GSM553638 2 0.0424 0.8649 0.000 0.992 0.008
#> GSM553639 2 0.0000 0.8676 0.000 1.000 0.000
#> GSM553640 2 0.0000 0.8676 0.000 1.000 0.000
#> GSM553641 3 0.0000 0.8970 0.000 0.000 1.000
#> GSM553642 1 0.0592 0.9553 0.988 0.000 0.012
#> GSM553643 3 0.3879 0.8010 0.152 0.000 0.848
#> GSM553644 1 0.0424 0.9579 0.992 0.000 0.008
#> GSM553645 3 0.0000 0.8970 0.000 0.000 1.000
#> GSM553646 1 0.6295 0.0579 0.528 0.000 0.472
#> GSM553647 3 0.4452 0.7562 0.192 0.000 0.808
#> GSM553648 3 0.0000 0.8970 0.000 0.000 1.000
#> GSM553649 3 0.0000 0.8970 0.000 0.000 1.000
#> GSM553650 2 0.0000 0.8676 0.000 1.000 0.000
#> GSM553651 2 0.1163 0.8528 0.028 0.972 0.000
#> GSM553652 2 0.0000 0.8676 0.000 1.000 0.000
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> GSM553595 3 0.2124 0.8357 0.068 0.000 0.924 0.008
#> GSM553596 3 0.6009 0.5172 0.312 0.040 0.636 0.012
#> GSM553597 1 0.0524 0.7870 0.988 0.000 0.008 0.004
#> GSM553598 3 0.3029 0.8231 0.068 0.028 0.896 0.008
#> GSM553599 4 0.2281 0.6289 0.096 0.000 0.000 0.904
#> GSM553600 1 0.2149 0.7629 0.912 0.000 0.000 0.088
#> GSM553601 1 0.0188 0.7861 0.996 0.000 0.004 0.000
#> GSM553602 4 0.4804 0.5092 0.384 0.000 0.000 0.616
#> GSM553603 3 0.7686 -0.0900 0.336 0.000 0.436 0.228
#> GSM553604 4 0.1488 0.6103 0.032 0.000 0.012 0.956
#> GSM553605 3 0.0000 0.8652 0.000 0.000 1.000 0.000
#> GSM553606 2 0.1584 0.8917 0.000 0.952 0.036 0.012
#> GSM553607 2 0.0804 0.9056 0.008 0.980 0.000 0.012
#> GSM553608 2 0.1022 0.9035 0.000 0.968 0.000 0.032
#> GSM553609 2 0.0336 0.9079 0.000 0.992 0.000 0.008
#> GSM553610 2 0.5143 0.1396 0.000 0.540 0.456 0.004
#> GSM553611 2 0.1211 0.9005 0.000 0.960 0.000 0.040
#> GSM553612 2 0.1398 0.8989 0.000 0.956 0.040 0.004
#> GSM553613 3 0.1389 0.8403 0.000 0.048 0.952 0.000
#> GSM553614 1 0.0188 0.7864 0.996 0.000 0.000 0.004
#> GSM553615 1 0.4560 0.4180 0.700 0.004 0.000 0.296
#> GSM553616 2 0.5213 0.4919 0.328 0.652 0.000 0.020
#> GSM553617 1 0.2124 0.7795 0.924 0.008 0.000 0.068
#> GSM553618 1 0.4819 0.5955 0.788 0.044 0.156 0.012
#> GSM553619 1 0.3024 0.7214 0.896 0.072 0.020 0.012
#> GSM553620 1 0.1389 0.7830 0.952 0.000 0.000 0.048
#> GSM553621 1 0.3219 0.7012 0.836 0.000 0.000 0.164
#> GSM553622 1 0.3444 0.6628 0.816 0.000 0.000 0.184
#> GSM553623 1 0.6689 0.3576 0.620 0.196 0.000 0.184
#> GSM553624 4 0.4999 -0.0502 0.000 0.492 0.000 0.508
#> GSM553625 1 0.4564 0.3424 0.672 0.000 0.000 0.328
#> GSM553626 4 0.4761 0.5180 0.372 0.000 0.000 0.628
#> GSM553627 4 0.1302 0.6168 0.044 0.000 0.000 0.956
#> GSM553628 4 0.4877 0.5257 0.328 0.008 0.000 0.664
#> GSM553629 2 0.1807 0.8817 0.052 0.940 0.000 0.008
#> GSM553630 4 0.4877 0.4524 0.408 0.000 0.000 0.592
#> GSM553631 1 0.1042 0.7758 0.972 0.020 0.000 0.008
#> GSM553632 4 0.4761 0.5063 0.372 0.000 0.000 0.628
#> GSM553633 3 0.0188 0.8650 0.004 0.000 0.996 0.000
#> GSM553634 2 0.0336 0.9079 0.000 0.992 0.000 0.008
#> GSM553635 2 0.0336 0.9079 0.000 0.992 0.000 0.008
#> GSM553636 4 0.4624 0.2884 0.000 0.340 0.000 0.660
#> GSM553637 2 0.0804 0.9056 0.008 0.980 0.000 0.012
#> GSM553638 2 0.1389 0.8954 0.000 0.952 0.048 0.000
#> GSM553639 2 0.1867 0.8808 0.000 0.928 0.000 0.072
#> GSM553640 2 0.0921 0.9048 0.000 0.972 0.000 0.028
#> GSM553641 3 0.0000 0.8652 0.000 0.000 1.000 0.000
#> GSM553642 4 0.5113 0.5530 0.292 0.000 0.024 0.684
#> GSM553643 3 0.0779 0.8629 0.004 0.000 0.980 0.016
#> GSM553644 4 0.3681 0.6097 0.176 0.000 0.008 0.816
#> GSM553645 3 0.0817 0.8604 0.000 0.000 0.976 0.024
#> GSM553646 3 0.5792 0.3539 0.032 0.000 0.552 0.416
#> GSM553647 3 0.1389 0.8510 0.000 0.000 0.952 0.048
#> GSM553648 3 0.0000 0.8652 0.000 0.000 1.000 0.000
#> GSM553649 3 0.0000 0.8652 0.000 0.000 1.000 0.000
#> GSM553650 2 0.0817 0.9056 0.000 0.976 0.000 0.024
#> GSM553651 2 0.3311 0.7784 0.000 0.828 0.000 0.172
#> GSM553652 2 0.0000 0.9080 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
#> GSM553595 3 0.6546 0.4229 0.088 0.000 0.560 0.052 0.300
#> GSM553596 5 0.5875 0.5775 0.048 0.024 0.144 0.072 0.712
#> GSM553597 5 0.2568 0.6632 0.004 0.000 0.016 0.092 0.888
#> GSM553598 3 0.4981 0.1918 0.012 0.000 0.536 0.012 0.440
#> GSM553599 1 0.2505 0.5852 0.888 0.000 0.000 0.092 0.020
#> GSM553600 5 0.6552 -0.0953 0.200 0.000 0.000 0.388 0.412
#> GSM553601 5 0.2409 0.6790 0.028 0.000 0.008 0.056 0.908
#> GSM553602 4 0.4752 0.3232 0.412 0.000 0.000 0.568 0.020
#> GSM553603 4 0.5024 0.4812 0.052 0.000 0.232 0.700 0.016
#> GSM553604 1 0.4138 0.5221 0.776 0.000 0.064 0.160 0.000
#> GSM553605 3 0.0324 0.7947 0.004 0.004 0.992 0.000 0.000
#> GSM553606 2 0.1124 0.8838 0.004 0.960 0.036 0.000 0.000
#> GSM553607 2 0.0290 0.8984 0.008 0.992 0.000 0.000 0.000
#> GSM553608 2 0.0794 0.8894 0.028 0.972 0.000 0.000 0.000
#> GSM553609 2 0.0000 0.8989 0.000 1.000 0.000 0.000 0.000
#> GSM553610 2 0.3949 0.4821 0.000 0.668 0.332 0.000 0.000
#> GSM553611 2 0.0324 0.8986 0.004 0.992 0.000 0.004 0.000
#> GSM553612 2 0.2152 0.8589 0.032 0.920 0.044 0.004 0.000
#> GSM553613 3 0.2439 0.7080 0.004 0.120 0.876 0.000 0.000
#> GSM553614 5 0.2179 0.6510 0.000 0.000 0.000 0.112 0.888
#> GSM553615 4 0.6242 -0.0644 0.144 0.000 0.000 0.448 0.408
#> GSM553616 5 0.5283 0.3331 0.028 0.348 0.000 0.020 0.604
#> GSM553617 5 0.3758 0.6719 0.044 0.028 0.004 0.080 0.844
#> GSM553618 5 0.2304 0.6706 0.000 0.000 0.100 0.008 0.892
#> GSM553619 5 0.1095 0.6838 0.012 0.008 0.000 0.012 0.968
#> GSM553620 4 0.4560 -0.0375 0.008 0.000 0.000 0.508 0.484
#> GSM553621 4 0.3596 0.5218 0.016 0.000 0.000 0.784 0.200
#> GSM553622 4 0.3437 0.5895 0.048 0.000 0.000 0.832 0.120
#> GSM553623 5 0.4219 0.6410 0.132 0.004 0.004 0.068 0.792
#> GSM553624 1 0.6220 0.5029 0.524 0.308 0.000 0.168 0.000
#> GSM553625 5 0.6001 0.1275 0.100 0.000 0.004 0.396 0.500
#> GSM553626 4 0.5091 0.3125 0.372 0.000 0.000 0.584 0.044
#> GSM553627 1 0.2929 0.5383 0.820 0.000 0.000 0.180 0.000
#> GSM553628 4 0.4969 0.3128 0.376 0.000 0.000 0.588 0.036
#> GSM553629 2 0.6175 0.1196 0.056 0.532 0.000 0.372 0.040
#> GSM553630 4 0.2569 0.5902 0.068 0.000 0.000 0.892 0.040
#> GSM553631 5 0.5341 0.0948 0.044 0.004 0.000 0.420 0.532
#> GSM553632 4 0.3582 0.5029 0.224 0.000 0.000 0.768 0.008
#> GSM553633 3 0.2548 0.7698 0.028 0.000 0.896 0.004 0.072
#> GSM553634 2 0.0000 0.8989 0.000 1.000 0.000 0.000 0.000
#> GSM553635 2 0.0162 0.8989 0.004 0.996 0.000 0.000 0.000
#> GSM553636 1 0.4177 0.6206 0.772 0.164 0.000 0.064 0.000
#> GSM553637 2 0.0290 0.8984 0.008 0.992 0.000 0.000 0.000
#> GSM553638 2 0.1662 0.8672 0.004 0.936 0.056 0.004 0.000
#> GSM553639 2 0.2612 0.7863 0.124 0.868 0.000 0.008 0.000
#> GSM553640 2 0.0451 0.8978 0.008 0.988 0.000 0.004 0.000
#> GSM553641 3 0.0162 0.7953 0.000 0.004 0.996 0.000 0.000
#> GSM553642 4 0.2476 0.5832 0.064 0.000 0.012 0.904 0.020
#> GSM553643 3 0.3844 0.6099 0.004 0.000 0.736 0.256 0.004
#> GSM553644 4 0.2909 0.5648 0.140 0.000 0.000 0.848 0.012
#> GSM553645 3 0.2829 0.7642 0.080 0.004 0.884 0.028 0.004
#> GSM553646 4 0.6276 -0.0596 0.132 0.000 0.388 0.476 0.004
#> GSM553647 3 0.4398 0.4973 0.008 0.000 0.672 0.312 0.008
#> GSM553648 3 0.0486 0.7951 0.004 0.004 0.988 0.000 0.004
#> GSM553649 3 0.0162 0.7953 0.000 0.004 0.996 0.000 0.000
#> GSM553650 2 0.0162 0.8989 0.000 0.996 0.000 0.004 0.000
#> GSM553651 1 0.4705 0.3725 0.580 0.404 0.000 0.012 0.004
#> GSM553652 2 0.0693 0.8948 0.012 0.980 0.008 0.000 0.000
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> GSM553595 4 0.6903 0.4392 0.004 0.000 0.172 0.500 0.224 0.100
#> GSM553596 4 0.3724 0.7626 0.036 0.004 0.032 0.840 0.060 0.028
#> GSM553597 4 0.1867 0.7938 0.004 0.000 0.000 0.924 0.036 0.036
#> GSM553598 4 0.4746 0.6341 0.000 0.004 0.208 0.708 0.044 0.036
#> GSM553599 5 0.4845 0.3235 0.400 0.004 0.000 0.028 0.556 0.012
#> GSM553600 1 0.4962 0.4389 0.672 0.000 0.000 0.232 0.068 0.028
#> GSM553601 4 0.2093 0.7671 0.088 0.000 0.004 0.900 0.004 0.004
#> GSM553602 1 0.4671 0.4822 0.688 0.000 0.000 0.000 0.160 0.152
#> GSM553603 3 0.7551 -0.0276 0.252 0.000 0.356 0.008 0.112 0.272
#> GSM553604 5 0.4185 0.4611 0.092 0.000 0.044 0.000 0.784 0.080
#> GSM553605 3 0.0405 0.7961 0.000 0.004 0.988 0.000 0.008 0.000
#> GSM553606 2 0.1801 0.8957 0.000 0.924 0.056 0.004 0.016 0.000
#> GSM553607 2 0.1026 0.9101 0.004 0.968 0.008 0.008 0.012 0.000
#> GSM553608 2 0.2203 0.8788 0.004 0.896 0.000 0.000 0.084 0.016
#> GSM553609 2 0.0146 0.9134 0.004 0.996 0.000 0.000 0.000 0.000
#> GSM553610 2 0.3053 0.7540 0.004 0.812 0.172 0.000 0.012 0.000
#> GSM553611 2 0.1003 0.9102 0.016 0.964 0.000 0.000 0.020 0.000
#> GSM553612 2 0.2771 0.8687 0.000 0.868 0.068 0.000 0.060 0.004
#> GSM553613 3 0.2350 0.7172 0.000 0.100 0.880 0.000 0.020 0.000
#> GSM553614 4 0.1956 0.7834 0.008 0.000 0.000 0.908 0.004 0.080
#> GSM553615 1 0.2136 0.6045 0.908 0.000 0.000 0.064 0.016 0.012
#> GSM553616 4 0.5956 0.4988 0.016 0.172 0.000 0.616 0.028 0.168
#> GSM553617 4 0.1749 0.7956 0.016 0.004 0.000 0.936 0.012 0.032
#> GSM553618 4 0.1819 0.7939 0.024 0.004 0.032 0.932 0.000 0.008
#> GSM553619 4 0.1294 0.7929 0.024 0.008 0.000 0.956 0.004 0.008
#> GSM553620 6 0.3819 0.6461 0.028 0.000 0.000 0.152 0.032 0.788
#> GSM553621 6 0.2918 0.7351 0.084 0.000 0.000 0.032 0.020 0.864
#> GSM553622 6 0.4287 0.5205 0.312 0.000 0.000 0.024 0.008 0.656
#> GSM553623 4 0.5610 0.4856 0.224 0.004 0.000 0.616 0.136 0.020
#> GSM553624 1 0.6446 -0.1305 0.508 0.196 0.000 0.000 0.248 0.048
#> GSM553625 1 0.4982 0.5227 0.656 0.000 0.000 0.228 0.008 0.108
#> GSM553626 1 0.2019 0.6177 0.900 0.000 0.000 0.000 0.012 0.088
#> GSM553627 5 0.4717 0.3452 0.364 0.000 0.000 0.000 0.580 0.056
#> GSM553628 1 0.1769 0.6176 0.924 0.000 0.000 0.004 0.012 0.060
#> GSM553629 1 0.4140 0.3368 0.676 0.300 0.000 0.008 0.008 0.008
#> GSM553630 6 0.2668 0.7306 0.168 0.000 0.000 0.000 0.004 0.828
#> GSM553631 1 0.6083 0.3249 0.552 0.012 0.000 0.232 0.012 0.192
#> GSM553632 1 0.2632 0.6031 0.832 0.000 0.000 0.000 0.004 0.164
#> GSM553633 3 0.4070 0.7193 0.004 0.000 0.796 0.104 0.056 0.040
#> GSM553634 2 0.0551 0.9138 0.000 0.984 0.004 0.004 0.008 0.000
#> GSM553635 2 0.0582 0.9149 0.000 0.984 0.004 0.004 0.004 0.004
#> GSM553636 5 0.5682 0.5197 0.148 0.140 0.016 0.000 0.660 0.036
#> GSM553637 2 0.0767 0.9111 0.004 0.976 0.000 0.008 0.012 0.000
#> GSM553638 2 0.3381 0.7886 0.000 0.800 0.156 0.000 0.044 0.000
#> GSM553639 2 0.3437 0.7599 0.008 0.788 0.000 0.004 0.188 0.012
#> GSM553640 2 0.0551 0.9127 0.004 0.984 0.000 0.004 0.008 0.000
#> GSM553641 3 0.0291 0.7970 0.000 0.000 0.992 0.004 0.004 0.000
#> GSM553642 6 0.3243 0.7411 0.136 0.000 0.012 0.004 0.020 0.828
#> GSM553643 3 0.4441 0.6665 0.040 0.000 0.728 0.004 0.024 0.204
#> GSM553644 6 0.3795 0.7198 0.108 0.000 0.004 0.004 0.088 0.796
#> GSM553645 3 0.4756 0.6593 0.000 0.000 0.684 0.008 0.212 0.096
#> GSM553646 6 0.6030 0.3535 0.016 0.000 0.160 0.008 0.268 0.548
#> GSM553647 3 0.3224 0.7317 0.040 0.000 0.824 0.000 0.004 0.132
#> GSM553648 3 0.1194 0.7988 0.000 0.000 0.956 0.008 0.004 0.032
#> GSM553649 3 0.0363 0.7996 0.000 0.000 0.988 0.000 0.000 0.012
#> GSM553650 2 0.1155 0.9083 0.000 0.956 0.004 0.000 0.036 0.004
#> GSM553651 5 0.4733 0.1674 0.032 0.408 0.000 0.004 0.552 0.004
#> GSM553652 2 0.2108 0.9012 0.008 0.920 0.024 0.004 0.040 0.004
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 individual(p) k
#> CV:NMF 56 0.17188 2
#> CV:NMF 52 0.01920 3
#> CV:NMF 48 0.04923 4
#> CV:NMF 41 0.04957 5
#> CV:NMF 44 0.00606 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.860 0.911 0.954 0.4992 0.491 0.491
#> 3 3 0.662 0.840 0.880 0.2676 0.874 0.744
#> 4 4 0.699 0.722 0.780 0.1060 0.953 0.879
#> 5 5 0.733 0.636 0.821 0.0898 0.883 0.680
#> 6 6 0.756 0.669 0.787 0.0463 0.935 0.748
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
#> GSM553595 2 0.9358 0.541 0.352 0.648
#> GSM553596 2 0.9358 0.541 0.352 0.648
#> GSM553597 1 0.1633 0.978 0.976 0.024
#> GSM553598 2 0.6887 0.774 0.184 0.816
#> GSM553599 1 0.1184 0.983 0.984 0.016
#> GSM553600 1 0.0000 0.982 1.000 0.000
#> GSM553601 1 0.2236 0.972 0.964 0.036
#> GSM553602 1 0.0000 0.982 1.000 0.000
#> GSM553603 1 0.2236 0.972 0.964 0.036
#> GSM553604 1 0.1633 0.980 0.976 0.024
#> GSM553605 2 0.0000 0.917 0.000 1.000
#> GSM553606 2 0.0000 0.917 0.000 1.000
#> GSM553607 2 0.0000 0.917 0.000 1.000
#> GSM553608 2 0.0376 0.918 0.004 0.996
#> GSM553609 2 0.0376 0.918 0.004 0.996
#> GSM553610 2 0.0000 0.917 0.000 1.000
#> GSM553611 2 0.0672 0.917 0.008 0.992
#> GSM553612 2 0.0376 0.918 0.004 0.996
#> GSM553613 2 0.0000 0.917 0.000 1.000
#> GSM553614 1 0.1184 0.982 0.984 0.016
#> GSM553615 1 0.0000 0.982 1.000 0.000
#> GSM553616 1 0.2778 0.960 0.952 0.048
#> GSM553617 1 0.1184 0.983 0.984 0.016
#> GSM553618 2 0.8267 0.693 0.260 0.740
#> GSM553619 2 0.9552 0.492 0.376 0.624
#> GSM553620 1 0.0000 0.982 1.000 0.000
#> GSM553621 1 0.0000 0.982 1.000 0.000
#> GSM553622 1 0.0000 0.982 1.000 0.000
#> GSM553623 1 0.1184 0.983 0.984 0.016
#> GSM553624 1 0.1184 0.983 0.984 0.016
#> GSM553625 1 0.0938 0.982 0.988 0.012
#> GSM553626 1 0.0000 0.982 1.000 0.000
#> GSM553627 1 0.1184 0.983 0.984 0.016
#> GSM553628 1 0.0000 0.982 1.000 0.000
#> GSM553629 1 0.0000 0.982 1.000 0.000
#> GSM553630 1 0.0672 0.982 0.992 0.008
#> GSM553631 1 0.0672 0.983 0.992 0.008
#> GSM553632 1 0.0000 0.982 1.000 0.000
#> GSM553633 2 0.8813 0.633 0.300 0.700
#> GSM553634 2 0.0672 0.917 0.008 0.992
#> GSM553635 2 0.0376 0.918 0.004 0.996
#> GSM553636 2 0.0672 0.917 0.008 0.992
#> GSM553637 2 0.0000 0.917 0.000 1.000
#> GSM553638 2 0.0376 0.918 0.004 0.996
#> GSM553639 2 0.0376 0.918 0.004 0.996
#> GSM553640 2 0.0938 0.915 0.012 0.988
#> GSM553641 2 0.0000 0.917 0.000 1.000
#> GSM553642 1 0.2236 0.970 0.964 0.036
#> GSM553643 1 0.2603 0.963 0.956 0.044
#> GSM553644 1 0.2236 0.970 0.964 0.036
#> GSM553645 2 0.8813 0.633 0.300 0.700
#> GSM553646 1 0.2236 0.970 0.964 0.036
#> GSM553647 1 0.2603 0.963 0.956 0.044
#> GSM553648 2 0.0000 0.917 0.000 1.000
#> GSM553649 2 0.0000 0.917 0.000 1.000
#> GSM553650 2 0.0376 0.918 0.004 0.996
#> GSM553651 2 0.0672 0.917 0.008 0.992
#> GSM553652 2 0.0376 0.918 0.004 0.996
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> GSM553595 3 0.5988 0.641 0.168 0.056 0.776
#> GSM553596 3 0.5988 0.641 0.168 0.056 0.776
#> GSM553597 1 0.1267 0.884 0.972 0.024 0.004
#> GSM553598 3 0.1411 0.717 0.000 0.036 0.964
#> GSM553599 1 0.5008 0.862 0.804 0.016 0.180
#> GSM553600 1 0.0237 0.891 0.996 0.000 0.004
#> GSM553601 1 0.5574 0.851 0.784 0.032 0.184
#> GSM553602 1 0.0000 0.891 1.000 0.000 0.000
#> GSM553603 1 0.1877 0.884 0.956 0.012 0.032
#> GSM553604 1 0.5115 0.859 0.796 0.016 0.188
#> GSM553605 3 0.4452 0.721 0.000 0.192 0.808
#> GSM553606 3 0.5760 0.628 0.000 0.328 0.672
#> GSM553607 3 0.6274 0.436 0.000 0.456 0.544
#> GSM553608 2 0.0000 0.996 0.000 1.000 0.000
#> GSM553609 2 0.0237 0.993 0.000 0.996 0.004
#> GSM553610 3 0.5760 0.628 0.000 0.328 0.672
#> GSM553611 2 0.0237 0.994 0.004 0.996 0.000
#> GSM553612 2 0.0000 0.996 0.000 1.000 0.000
#> GSM553613 3 0.4452 0.721 0.000 0.192 0.808
#> GSM553614 1 0.0983 0.888 0.980 0.016 0.004
#> GSM553615 1 0.0237 0.891 0.996 0.000 0.004
#> GSM553616 1 0.1860 0.866 0.948 0.052 0.000
#> GSM553617 1 0.5147 0.861 0.800 0.020 0.180
#> GSM553618 3 0.4269 0.712 0.076 0.052 0.872
#> GSM553619 3 0.5384 0.615 0.188 0.024 0.788
#> GSM553620 1 0.0000 0.891 1.000 0.000 0.000
#> GSM553621 1 0.0000 0.891 1.000 0.000 0.000
#> GSM553622 1 0.0237 0.891 0.996 0.000 0.004
#> GSM553623 1 0.5008 0.862 0.804 0.016 0.180
#> GSM553624 1 0.5147 0.861 0.800 0.020 0.180
#> GSM553625 1 0.0983 0.890 0.980 0.016 0.004
#> GSM553626 1 0.0237 0.891 0.996 0.000 0.004
#> GSM553627 1 0.5008 0.862 0.804 0.016 0.180
#> GSM553628 1 0.0237 0.891 0.996 0.000 0.004
#> GSM553629 1 0.0237 0.891 0.996 0.000 0.004
#> GSM553630 1 0.4465 0.866 0.820 0.004 0.176
#> GSM553631 1 0.0661 0.890 0.988 0.008 0.004
#> GSM553632 1 0.0237 0.891 0.996 0.000 0.004
#> GSM553633 3 0.4636 0.693 0.116 0.036 0.848
#> GSM553634 2 0.0237 0.993 0.004 0.996 0.000
#> GSM553635 2 0.0000 0.996 0.000 1.000 0.000
#> GSM553636 2 0.0237 0.994 0.004 0.996 0.000
#> GSM553637 3 0.6274 0.436 0.000 0.456 0.544
#> GSM553638 2 0.0000 0.996 0.000 1.000 0.000
#> GSM553639 2 0.0000 0.996 0.000 1.000 0.000
#> GSM553640 2 0.0424 0.990 0.008 0.992 0.000
#> GSM553641 3 0.4399 0.723 0.000 0.188 0.812
#> GSM553642 1 0.5109 0.846 0.780 0.008 0.212
#> GSM553643 1 0.5202 0.840 0.772 0.008 0.220
#> GSM553644 1 0.5109 0.846 0.780 0.008 0.212
#> GSM553645 3 0.4636 0.693 0.116 0.036 0.848
#> GSM553646 1 0.5109 0.846 0.780 0.008 0.212
#> GSM553647 1 0.5202 0.840 0.772 0.008 0.220
#> GSM553648 3 0.4399 0.723 0.000 0.188 0.812
#> GSM553649 3 0.4399 0.723 0.000 0.188 0.812
#> GSM553650 2 0.0000 0.996 0.000 1.000 0.000
#> GSM553651 2 0.0237 0.994 0.004 0.996 0.000
#> GSM553652 2 0.0000 0.996 0.000 1.000 0.000
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> GSM553595 3 0.6716 0.676 0.348 0.008 0.564 NA
#> GSM553596 3 0.6716 0.676 0.348 0.008 0.564 NA
#> GSM553597 1 0.5060 0.776 0.584 0.004 0.000 NA
#> GSM553598 3 0.4677 0.750 0.192 0.000 0.768 NA
#> GSM553599 1 0.0921 0.730 0.972 0.000 0.000 NA
#> GSM553600 1 0.4916 0.782 0.576 0.000 0.000 NA
#> GSM553601 1 0.1042 0.715 0.972 0.008 0.000 NA
#> GSM553602 1 0.4304 0.781 0.716 0.000 0.000 NA
#> GSM553603 1 0.4769 0.767 0.684 0.000 0.008 NA
#> GSM553604 1 0.0592 0.714 0.984 0.000 0.000 NA
#> GSM553605 3 0.0336 0.744 0.000 0.000 0.992 NA
#> GSM553606 3 0.5288 0.309 0.000 0.472 0.520 NA
#> GSM553607 2 0.2281 0.323 0.000 0.904 0.096 NA
#> GSM553608 2 0.4972 0.866 0.000 0.544 0.000 NA
#> GSM553609 2 0.5143 0.864 0.000 0.540 0.004 NA
#> GSM553610 3 0.5288 0.309 0.000 0.472 0.520 NA
#> GSM553611 2 0.5143 0.865 0.004 0.540 0.000 NA
#> GSM553612 2 0.4972 0.866 0.000 0.544 0.000 NA
#> GSM553613 3 0.0336 0.744 0.000 0.000 0.992 NA
#> GSM553614 1 0.5050 0.779 0.588 0.004 0.000 NA
#> GSM553615 1 0.4916 0.782 0.576 0.000 0.000 NA
#> GSM553616 1 0.5827 0.772 0.568 0.036 0.000 NA
#> GSM553617 1 0.2704 0.740 0.876 0.000 0.000 NA
#> GSM553618 3 0.6391 0.731 0.220 0.012 0.668 NA
#> GSM553619 2 0.9240 -0.353 0.212 0.452 0.136 NA
#> GSM553620 1 0.4522 0.783 0.680 0.000 0.000 NA
#> GSM553621 1 0.4522 0.783 0.680 0.000 0.000 NA
#> GSM553622 1 0.4916 0.782 0.576 0.000 0.000 NA
#> GSM553623 1 0.0921 0.730 0.972 0.000 0.000 NA
#> GSM553624 1 0.2921 0.739 0.860 0.000 0.000 NA
#> GSM553625 1 0.4855 0.784 0.600 0.000 0.000 NA
#> GSM553626 1 0.4916 0.782 0.576 0.000 0.000 NA
#> GSM553627 1 0.0000 0.721 1.000 0.000 0.000 NA
#> GSM553628 1 0.4916 0.782 0.576 0.000 0.000 NA
#> GSM553629 1 0.4916 0.782 0.576 0.000 0.000 NA
#> GSM553630 1 0.3402 0.745 0.832 0.000 0.004 NA
#> GSM553631 1 0.4888 0.782 0.588 0.000 0.000 NA
#> GSM553632 1 0.4916 0.782 0.576 0.000 0.000 NA
#> GSM553633 3 0.6260 0.720 0.288 0.008 0.636 NA
#> GSM553634 2 0.5126 0.862 0.004 0.552 0.000 NA
#> GSM553635 2 0.4967 0.865 0.000 0.548 0.000 NA
#> GSM553636 2 0.5143 0.865 0.004 0.540 0.000 NA
#> GSM553637 2 0.2281 0.323 0.000 0.904 0.096 NA
#> GSM553638 2 0.4972 0.866 0.000 0.544 0.000 NA
#> GSM553639 2 0.4972 0.866 0.000 0.544 0.000 NA
#> GSM553640 2 0.5257 0.860 0.008 0.548 0.000 NA
#> GSM553641 3 0.0000 0.746 0.000 0.000 1.000 NA
#> GSM553642 1 0.2329 0.681 0.916 0.000 0.012 NA
#> GSM553643 1 0.2563 0.673 0.908 0.000 0.020 NA
#> GSM553644 1 0.2329 0.681 0.916 0.000 0.012 NA
#> GSM553645 3 0.6260 0.720 0.288 0.008 0.636 NA
#> GSM553646 1 0.2329 0.681 0.916 0.000 0.012 NA
#> GSM553647 1 0.2563 0.673 0.908 0.000 0.020 NA
#> GSM553648 3 0.0000 0.746 0.000 0.000 1.000 NA
#> GSM553649 3 0.0000 0.746 0.000 0.000 1.000 NA
#> GSM553650 2 0.4972 0.866 0.000 0.544 0.000 NA
#> GSM553651 2 0.5143 0.865 0.004 0.540 0.000 NA
#> GSM553652 2 0.4972 0.866 0.000 0.544 0.000 NA
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> GSM553595 3 0.5775 0.4635 0.000 0.024 0.556 0.372 0.048
#> GSM553596 3 0.5775 0.4635 0.000 0.024 0.556 0.372 0.048
#> GSM553597 1 0.5664 0.4884 0.632 0.000 0.000 0.200 0.168
#> GSM553598 3 0.4335 0.5630 0.000 0.008 0.664 0.004 0.324
#> GSM553599 1 0.4760 0.3862 0.564 0.000 0.000 0.416 0.020
#> GSM553600 1 0.0000 0.7094 1.000 0.000 0.000 0.000 0.000
#> GSM553601 1 0.5385 0.3315 0.528 0.016 0.000 0.428 0.028
#> GSM553602 1 0.2732 0.6484 0.840 0.000 0.000 0.160 0.000
#> GSM553603 4 0.4562 -0.1859 0.496 0.000 0.000 0.496 0.008
#> GSM553604 1 0.4648 0.3104 0.524 0.000 0.000 0.464 0.012
#> GSM553605 3 0.0290 0.6576 0.000 0.000 0.992 0.000 0.008
#> GSM553606 3 0.6674 -0.0823 0.000 0.324 0.428 0.000 0.248
#> GSM553607 5 0.4262 0.5782 0.000 0.440 0.000 0.000 0.560
#> GSM553608 2 0.0000 0.9912 0.000 1.000 0.000 0.000 0.000
#> GSM553609 2 0.0162 0.9869 0.000 0.996 0.004 0.000 0.000
#> GSM553610 3 0.6674 -0.0823 0.000 0.324 0.428 0.000 0.248
#> GSM553611 2 0.0162 0.9895 0.000 0.996 0.000 0.000 0.004
#> GSM553612 2 0.0000 0.9912 0.000 1.000 0.000 0.000 0.000
#> GSM553613 3 0.0290 0.6576 0.000 0.000 0.992 0.000 0.008
#> GSM553614 1 0.5567 0.5008 0.644 0.000 0.000 0.196 0.160
#> GSM553615 1 0.0000 0.7094 1.000 0.000 0.000 0.000 0.000
#> GSM553616 1 0.4403 0.5890 0.772 0.036 0.000 0.168 0.024
#> GSM553617 1 0.4571 0.4816 0.664 0.004 0.000 0.312 0.020
#> GSM553618 3 0.5634 0.5124 0.004 0.024 0.552 0.028 0.392
#> GSM553619 5 0.0898 0.2816 0.020 0.000 0.008 0.000 0.972
#> GSM553620 1 0.4045 0.4535 0.644 0.000 0.000 0.356 0.000
#> GSM553621 1 0.4045 0.4535 0.644 0.000 0.000 0.356 0.000
#> GSM553622 1 0.0000 0.7094 1.000 0.000 0.000 0.000 0.000
#> GSM553623 1 0.4760 0.3862 0.564 0.000 0.000 0.416 0.020
#> GSM553624 1 0.4359 0.4966 0.692 0.004 0.000 0.288 0.016
#> GSM553625 1 0.1547 0.7027 0.948 0.004 0.000 0.032 0.016
#> GSM553626 1 0.0000 0.7094 1.000 0.000 0.000 0.000 0.000
#> GSM553627 1 0.4632 0.3421 0.540 0.000 0.000 0.448 0.012
#> GSM553628 1 0.0000 0.7094 1.000 0.000 0.000 0.000 0.000
#> GSM553629 1 0.0000 0.7094 1.000 0.000 0.000 0.000 0.000
#> GSM553630 4 0.4015 0.3304 0.348 0.000 0.000 0.652 0.000
#> GSM553631 1 0.0451 0.7084 0.988 0.000 0.000 0.004 0.008
#> GSM553632 1 0.0000 0.7094 1.000 0.000 0.000 0.000 0.000
#> GSM553633 3 0.5129 0.5375 0.000 0.024 0.628 0.328 0.020
#> GSM553634 2 0.0771 0.9672 0.000 0.976 0.000 0.004 0.020
#> GSM553635 2 0.0162 0.9881 0.000 0.996 0.000 0.000 0.004
#> GSM553636 2 0.0162 0.9895 0.000 0.996 0.000 0.000 0.004
#> GSM553637 5 0.4262 0.5782 0.000 0.440 0.000 0.000 0.560
#> GSM553638 2 0.0000 0.9912 0.000 1.000 0.000 0.000 0.000
#> GSM553639 2 0.0000 0.9912 0.000 1.000 0.000 0.000 0.000
#> GSM553640 2 0.0865 0.9656 0.000 0.972 0.000 0.004 0.024
#> GSM553641 3 0.0000 0.6600 0.000 0.000 1.000 0.000 0.000
#> GSM553642 4 0.0000 0.8093 0.000 0.000 0.000 1.000 0.000
#> GSM553643 4 0.0290 0.8064 0.000 0.000 0.008 0.992 0.000
#> GSM553644 4 0.0000 0.8093 0.000 0.000 0.000 1.000 0.000
#> GSM553645 3 0.5129 0.5375 0.000 0.024 0.628 0.328 0.020
#> GSM553646 4 0.0000 0.8093 0.000 0.000 0.000 1.000 0.000
#> GSM553647 4 0.0290 0.8064 0.000 0.000 0.008 0.992 0.000
#> GSM553648 3 0.0000 0.6600 0.000 0.000 1.000 0.000 0.000
#> GSM553649 3 0.0000 0.6600 0.000 0.000 1.000 0.000 0.000
#> GSM553650 2 0.0000 0.9912 0.000 1.000 0.000 0.000 0.000
#> GSM553651 2 0.0162 0.9895 0.000 0.996 0.000 0.000 0.004
#> GSM553652 2 0.0000 0.9912 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
#> GSM553595 3 0.6239 0.3900 0.000 0.016 0.484 0.120 0.360 0.020
#> GSM553596 3 0.6239 0.3900 0.000 0.016 0.484 0.120 0.360 0.020
#> GSM553597 4 0.3648 0.8170 0.072 0.000 0.000 0.824 0.064 0.040
#> GSM553598 3 0.5052 0.4993 0.000 0.000 0.592 0.084 0.004 0.320
#> GSM553599 1 0.4716 0.4629 0.552 0.000 0.000 0.040 0.404 0.004
#> GSM553600 1 0.0146 0.7145 0.996 0.000 0.000 0.004 0.000 0.000
#> GSM553601 1 0.5248 0.4124 0.516 0.016 0.000 0.048 0.416 0.004
#> GSM553602 1 0.2706 0.6548 0.832 0.000 0.000 0.008 0.160 0.000
#> GSM553603 1 0.4264 0.0476 0.492 0.000 0.000 0.016 0.492 0.000
#> GSM553604 1 0.4584 0.3909 0.512 0.000 0.000 0.036 0.452 0.000
#> GSM553605 3 0.0717 0.6067 0.000 0.000 0.976 0.016 0.000 0.008
#> GSM553606 3 0.6014 -0.0741 0.000 0.308 0.428 0.000 0.000 0.264
#> GSM553607 6 0.3547 0.6844 0.000 0.332 0.000 0.000 0.000 0.668
#> GSM553608 2 0.0000 0.9662 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM553609 2 0.0508 0.9556 0.000 0.984 0.004 0.000 0.000 0.012
#> GSM553610 3 0.6014 -0.0741 0.000 0.308 0.428 0.000 0.000 0.264
#> GSM553611 2 0.0603 0.9593 0.000 0.980 0.000 0.004 0.000 0.016
#> GSM553612 2 0.0000 0.9662 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM553613 3 0.0717 0.6067 0.000 0.000 0.976 0.016 0.000 0.008
#> GSM553614 4 0.3628 0.8207 0.080 0.000 0.000 0.824 0.060 0.036
#> GSM553615 1 0.0000 0.7162 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM553616 4 0.4553 0.7254 0.224 0.028 0.000 0.712 0.028 0.008
#> GSM553617 1 0.4522 0.5511 0.648 0.000 0.000 0.048 0.300 0.004
#> GSM553618 3 0.6289 0.4422 0.000 0.016 0.480 0.108 0.028 0.368
#> GSM553619 6 0.2513 0.3231 0.000 0.000 0.008 0.140 0.000 0.852
#> GSM553620 4 0.4255 0.7974 0.068 0.000 0.000 0.708 0.224 0.000
#> GSM553621 4 0.4255 0.7974 0.068 0.000 0.000 0.708 0.224 0.000
#> GSM553622 1 0.0146 0.7145 0.996 0.000 0.000 0.004 0.000 0.000
#> GSM553623 1 0.4716 0.4629 0.552 0.000 0.000 0.040 0.404 0.004
#> GSM553624 1 0.4224 0.5700 0.684 0.000 0.000 0.036 0.276 0.004
#> GSM553625 1 0.1565 0.7086 0.940 0.000 0.000 0.028 0.028 0.004
#> GSM553626 1 0.0000 0.7162 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM553627 1 0.4570 0.4219 0.528 0.000 0.000 0.036 0.436 0.000
#> GSM553628 1 0.0000 0.7162 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM553629 1 0.0000 0.7162 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM553630 5 0.4585 0.3850 0.308 0.000 0.000 0.060 0.632 0.000
#> GSM553631 1 0.0458 0.7138 0.984 0.000 0.000 0.016 0.000 0.000
#> GSM553632 1 0.0000 0.7162 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM553633 3 0.5762 0.4660 0.000 0.016 0.556 0.084 0.328 0.016
#> GSM553634 2 0.2170 0.8706 0.000 0.888 0.000 0.012 0.000 0.100
#> GSM553635 2 0.0632 0.9531 0.000 0.976 0.000 0.000 0.000 0.024
#> GSM553636 2 0.0603 0.9593 0.000 0.980 0.000 0.004 0.000 0.016
#> GSM553637 6 0.3547 0.6844 0.000 0.332 0.000 0.000 0.000 0.668
#> GSM553638 2 0.0000 0.9662 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM553639 2 0.0000 0.9662 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM553640 2 0.2311 0.8669 0.000 0.880 0.000 0.016 0.000 0.104
#> GSM553641 3 0.0000 0.6153 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM553642 5 0.0000 0.8987 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM553643 5 0.0260 0.8966 0.000 0.000 0.008 0.000 0.992 0.000
#> GSM553644 5 0.0000 0.8987 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM553645 3 0.5762 0.4660 0.000 0.016 0.556 0.084 0.328 0.016
#> GSM553646 5 0.0000 0.8987 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM553647 5 0.0260 0.8966 0.000 0.000 0.008 0.000 0.992 0.000
#> GSM553648 3 0.0000 0.6153 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM553649 3 0.0000 0.6153 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM553650 2 0.0000 0.9662 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM553651 2 0.0603 0.9593 0.000 0.980 0.000 0.004 0.000 0.016
#> GSM553652 2 0.0000 0.9662 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 individual(p) k
#> MAD:hclust 57 0.12910 2
#> MAD:hclust 56 0.25093 3
#> MAD:hclust 53 0.26162 4
#> MAD:hclust 41 0.00326 5
#> MAD:hclust 42 0.00121 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.863 0.920 0.965 0.4977 0.501 0.501
#> 3 3 0.760 0.828 0.910 0.2944 0.828 0.670
#> 4 4 0.669 0.730 0.850 0.1539 0.816 0.544
#> 5 5 0.729 0.634 0.784 0.0658 0.915 0.687
#> 6 6 0.741 0.497 0.753 0.0433 0.978 0.895
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
#> GSM553595 1 0.5519 0.849 0.872 0.128
#> GSM553596 1 0.9209 0.510 0.664 0.336
#> GSM553597 1 0.0000 0.964 1.000 0.000
#> GSM553598 2 0.0376 0.957 0.004 0.996
#> GSM553599 1 0.0376 0.964 0.996 0.004
#> GSM553600 1 0.0376 0.964 0.996 0.004
#> GSM553601 1 0.0376 0.964 0.996 0.004
#> GSM553602 1 0.0376 0.964 0.996 0.004
#> GSM553603 1 0.0000 0.964 1.000 0.000
#> GSM553604 1 0.0376 0.964 0.996 0.004
#> GSM553605 2 0.0376 0.957 0.004 0.996
#> GSM553606 2 0.0376 0.957 0.004 0.996
#> GSM553607 2 0.0000 0.958 0.000 1.000
#> GSM553608 2 0.0000 0.958 0.000 1.000
#> GSM553609 2 0.0000 0.958 0.000 1.000
#> GSM553610 2 0.0376 0.957 0.004 0.996
#> GSM553611 2 0.0000 0.958 0.000 1.000
#> GSM553612 2 0.0000 0.958 0.000 1.000
#> GSM553613 2 0.0376 0.957 0.004 0.996
#> GSM553614 1 0.0000 0.964 1.000 0.000
#> GSM553615 1 0.0376 0.964 0.996 0.004
#> GSM553616 1 0.0376 0.964 0.996 0.004
#> GSM553617 1 0.0376 0.964 0.996 0.004
#> GSM553618 1 0.8909 0.570 0.692 0.308
#> GSM553619 1 0.5519 0.850 0.872 0.128
#> GSM553620 1 0.0000 0.964 1.000 0.000
#> GSM553621 1 0.0000 0.964 1.000 0.000
#> GSM553622 1 0.0376 0.964 0.996 0.004
#> GSM553623 1 0.0376 0.964 0.996 0.004
#> GSM553624 1 0.0376 0.964 0.996 0.004
#> GSM553625 1 0.0000 0.964 1.000 0.000
#> GSM553626 1 0.0376 0.964 0.996 0.004
#> GSM553627 1 0.0376 0.964 0.996 0.004
#> GSM553628 1 0.0376 0.964 0.996 0.004
#> GSM553629 1 0.0376 0.964 0.996 0.004
#> GSM553630 1 0.0000 0.964 1.000 0.000
#> GSM553631 1 0.0000 0.964 1.000 0.000
#> GSM553632 1 0.0376 0.964 0.996 0.004
#> GSM553633 2 0.9209 0.485 0.336 0.664
#> GSM553634 2 0.0000 0.958 0.000 1.000
#> GSM553635 2 0.0000 0.958 0.000 1.000
#> GSM553636 2 0.1633 0.941 0.024 0.976
#> GSM553637 2 0.0000 0.958 0.000 1.000
#> GSM553638 2 0.0000 0.958 0.000 1.000
#> GSM553639 2 0.0000 0.958 0.000 1.000
#> GSM553640 2 0.7219 0.747 0.200 0.800
#> GSM553641 2 0.0376 0.957 0.004 0.996
#> GSM553642 1 0.0000 0.964 1.000 0.000
#> GSM553643 1 0.3584 0.911 0.932 0.068
#> GSM553644 1 0.0000 0.964 1.000 0.000
#> GSM553645 2 0.9209 0.485 0.336 0.664
#> GSM553646 1 0.0000 0.964 1.000 0.000
#> GSM553647 1 0.3584 0.911 0.932 0.068
#> GSM553648 2 0.0376 0.957 0.004 0.996
#> GSM553649 2 0.0376 0.957 0.004 0.996
#> GSM553650 2 0.0000 0.958 0.000 1.000
#> GSM553651 2 0.1633 0.941 0.024 0.976
#> GSM553652 2 0.0000 0.958 0.000 1.000
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> GSM553595 3 0.4033 0.803 0.136 0.008 0.856
#> GSM553596 3 0.4059 0.809 0.128 0.012 0.860
#> GSM553597 1 0.6180 0.593 0.660 0.008 0.332
#> GSM553598 3 0.0892 0.880 0.000 0.020 0.980
#> GSM553599 1 0.1950 0.876 0.952 0.008 0.040
#> GSM553600 1 0.0592 0.879 0.988 0.000 0.012
#> GSM553601 1 0.3965 0.817 0.860 0.008 0.132
#> GSM553602 1 0.0424 0.880 0.992 0.000 0.008
#> GSM553603 1 0.6205 0.582 0.656 0.008 0.336
#> GSM553604 1 0.2173 0.865 0.944 0.008 0.048
#> GSM553605 3 0.1643 0.877 0.000 0.044 0.956
#> GSM553606 2 0.4452 0.785 0.000 0.808 0.192
#> GSM553607 2 0.0424 0.943 0.000 0.992 0.008
#> GSM553608 2 0.0892 0.949 0.000 0.980 0.020
#> GSM553609 2 0.1163 0.946 0.000 0.972 0.028
#> GSM553610 2 0.6154 0.374 0.000 0.592 0.408
#> GSM553611 2 0.0000 0.945 0.000 1.000 0.000
#> GSM553612 2 0.0892 0.949 0.000 0.980 0.020
#> GSM553613 3 0.5621 0.443 0.000 0.308 0.692
#> GSM553614 1 0.1031 0.882 0.976 0.000 0.024
#> GSM553615 1 0.0892 0.879 0.980 0.000 0.020
#> GSM553616 1 0.1163 0.880 0.972 0.000 0.028
#> GSM553617 1 0.1163 0.880 0.972 0.000 0.028
#> GSM553618 3 0.5028 0.803 0.132 0.040 0.828
#> GSM553619 3 0.4865 0.805 0.136 0.032 0.832
#> GSM553620 1 0.0592 0.881 0.988 0.000 0.012
#> GSM553621 1 0.0237 0.879 0.996 0.000 0.004
#> GSM553622 1 0.0237 0.879 0.996 0.000 0.004
#> GSM553623 1 0.1711 0.879 0.960 0.008 0.032
#> GSM553624 1 0.1031 0.881 0.976 0.000 0.024
#> GSM553625 1 0.1163 0.882 0.972 0.000 0.028
#> GSM553626 1 0.0424 0.879 0.992 0.000 0.008
#> GSM553627 1 0.0747 0.881 0.984 0.000 0.016
#> GSM553628 1 0.0424 0.879 0.992 0.000 0.008
#> GSM553629 1 0.1781 0.872 0.960 0.020 0.020
#> GSM553630 1 0.0592 0.881 0.988 0.000 0.012
#> GSM553631 1 0.1919 0.873 0.956 0.020 0.024
#> GSM553632 1 0.0000 0.879 1.000 0.000 0.000
#> GSM553633 3 0.0747 0.880 0.000 0.016 0.984
#> GSM553634 2 0.0000 0.945 0.000 1.000 0.000
#> GSM553635 2 0.0000 0.945 0.000 1.000 0.000
#> GSM553636 2 0.1525 0.942 0.004 0.964 0.032
#> GSM553637 2 0.0424 0.943 0.000 0.992 0.008
#> GSM553638 2 0.0892 0.949 0.000 0.980 0.020
#> GSM553639 2 0.1031 0.948 0.000 0.976 0.024
#> GSM553640 2 0.1163 0.926 0.028 0.972 0.000
#> GSM553641 3 0.1643 0.877 0.000 0.044 0.956
#> GSM553642 1 0.5988 0.620 0.688 0.008 0.304
#> GSM553643 1 0.6625 0.367 0.552 0.008 0.440
#> GSM553644 1 0.5988 0.620 0.688 0.008 0.304
#> GSM553645 3 0.0747 0.880 0.000 0.016 0.984
#> GSM553646 1 0.6540 0.429 0.584 0.008 0.408
#> GSM553647 1 0.6598 0.399 0.564 0.008 0.428
#> GSM553648 3 0.1643 0.877 0.000 0.044 0.956
#> GSM553649 3 0.1643 0.877 0.000 0.044 0.956
#> GSM553650 2 0.0892 0.949 0.000 0.980 0.020
#> GSM553651 2 0.1525 0.942 0.004 0.964 0.032
#> GSM553652 2 0.0892 0.949 0.000 0.980 0.020
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> GSM553595 4 0.3030 0.7075 0.028 0.004 0.076 0.892
#> GSM553596 4 0.5586 0.4648 0.032 0.008 0.288 0.672
#> GSM553597 4 0.2494 0.7143 0.048 0.000 0.036 0.916
#> GSM553598 3 0.2773 0.7962 0.000 0.004 0.880 0.116
#> GSM553599 1 0.4276 0.7803 0.788 0.004 0.016 0.192
#> GSM553600 1 0.1520 0.8157 0.956 0.000 0.020 0.024
#> GSM553601 1 0.5799 0.3730 0.552 0.004 0.024 0.420
#> GSM553602 1 0.1489 0.8184 0.952 0.000 0.004 0.044
#> GSM553603 4 0.2739 0.7351 0.060 0.000 0.036 0.904
#> GSM553604 4 0.3676 0.6123 0.172 0.004 0.004 0.820
#> GSM553605 3 0.1677 0.8269 0.000 0.012 0.948 0.040
#> GSM553606 3 0.3355 0.7298 0.000 0.160 0.836 0.004
#> GSM553607 2 0.4175 0.7348 0.000 0.776 0.212 0.012
#> GSM553608 2 0.0188 0.9634 0.004 0.996 0.000 0.000
#> GSM553609 2 0.0376 0.9615 0.000 0.992 0.004 0.004
#> GSM553610 3 0.2714 0.7770 0.000 0.112 0.884 0.004
#> GSM553611 2 0.0188 0.9634 0.004 0.996 0.000 0.000
#> GSM553612 2 0.0188 0.9623 0.000 0.996 0.004 0.000
#> GSM553613 3 0.2101 0.8145 0.000 0.060 0.928 0.012
#> GSM553614 1 0.4508 0.7736 0.780 0.000 0.036 0.184
#> GSM553615 1 0.1211 0.8206 0.960 0.000 0.000 0.040
#> GSM553616 1 0.4152 0.8032 0.808 0.000 0.032 0.160
#> GSM553617 1 0.3937 0.7875 0.800 0.000 0.012 0.188
#> GSM553618 4 0.6588 0.1794 0.068 0.004 0.420 0.508
#> GSM553619 4 0.6606 0.1508 0.068 0.004 0.436 0.492
#> GSM553620 4 0.5691 -0.1583 0.468 0.000 0.024 0.508
#> GSM553621 1 0.5496 0.4227 0.604 0.000 0.024 0.372
#> GSM553622 1 0.1820 0.8143 0.944 0.000 0.020 0.036
#> GSM553623 1 0.4235 0.7833 0.792 0.004 0.016 0.188
#> GSM553624 1 0.3196 0.8130 0.856 0.000 0.008 0.136
#> GSM553625 1 0.4391 0.7441 0.740 0.000 0.008 0.252
#> GSM553626 1 0.1302 0.8206 0.956 0.000 0.000 0.044
#> GSM553627 1 0.3626 0.7984 0.812 0.000 0.004 0.184
#> GSM553628 1 0.1211 0.8204 0.960 0.000 0.000 0.040
#> GSM553629 1 0.1798 0.8171 0.944 0.000 0.016 0.040
#> GSM553630 1 0.5472 0.2794 0.544 0.000 0.016 0.440
#> GSM553631 1 0.3403 0.8045 0.864 0.004 0.020 0.112
#> GSM553632 1 0.1118 0.8173 0.964 0.000 0.000 0.036
#> GSM553633 3 0.4999 -0.0745 0.000 0.000 0.508 0.492
#> GSM553634 2 0.0376 0.9627 0.004 0.992 0.004 0.000
#> GSM553635 2 0.0188 0.9616 0.000 0.996 0.004 0.000
#> GSM553636 2 0.1114 0.9533 0.008 0.972 0.004 0.016
#> GSM553637 2 0.3479 0.8229 0.000 0.840 0.148 0.012
#> GSM553638 2 0.0188 0.9623 0.000 0.996 0.004 0.000
#> GSM553639 2 0.0712 0.9591 0.004 0.984 0.004 0.008
#> GSM553640 2 0.1377 0.9496 0.020 0.964 0.008 0.008
#> GSM553641 3 0.1767 0.8274 0.000 0.012 0.944 0.044
#> GSM553642 4 0.3863 0.7010 0.144 0.000 0.028 0.828
#> GSM553643 4 0.2924 0.7331 0.036 0.004 0.060 0.900
#> GSM553644 4 0.3542 0.7162 0.120 0.000 0.028 0.852
#> GSM553645 4 0.5028 0.2745 0.000 0.004 0.400 0.596
#> GSM553646 4 0.3110 0.7301 0.048 0.004 0.056 0.892
#> GSM553647 4 0.2924 0.7331 0.036 0.004 0.060 0.900
#> GSM553648 3 0.3047 0.8097 0.000 0.012 0.872 0.116
#> GSM553649 3 0.3047 0.8097 0.000 0.012 0.872 0.116
#> GSM553650 2 0.0188 0.9634 0.004 0.996 0.000 0.000
#> GSM553651 2 0.1114 0.9533 0.008 0.972 0.004 0.016
#> GSM553652 2 0.0188 0.9634 0.004 0.996 0.000 0.000
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> GSM553595 5 0.4658 0.4054 0.004 0.000 0.008 0.432 0.556
#> GSM553596 5 0.5214 0.5336 0.008 0.000 0.052 0.300 0.640
#> GSM553597 5 0.4583 0.3671 0.004 0.000 0.004 0.464 0.528
#> GSM553598 3 0.4589 0.6484 0.000 0.004 0.660 0.020 0.316
#> GSM553599 1 0.5948 0.4773 0.536 0.000 0.012 0.080 0.372
#> GSM553600 1 0.2482 0.6968 0.904 0.000 0.016 0.016 0.064
#> GSM553601 5 0.6706 -0.0505 0.352 0.000 0.008 0.188 0.452
#> GSM553602 1 0.1845 0.7099 0.928 0.000 0.000 0.016 0.056
#> GSM553603 4 0.1750 0.6941 0.028 0.000 0.000 0.936 0.036
#> GSM553604 4 0.3237 0.6423 0.048 0.000 0.012 0.864 0.076
#> GSM553605 3 0.2075 0.7618 0.000 0.004 0.924 0.032 0.040
#> GSM553606 3 0.3852 0.6746 0.000 0.084 0.828 0.016 0.072
#> GSM553607 2 0.6233 0.5072 0.000 0.584 0.264 0.016 0.136
#> GSM553608 2 0.0000 0.9256 0.000 1.000 0.000 0.000 0.000
#> GSM553609 2 0.2925 0.8521 0.000 0.884 0.036 0.016 0.064
#> GSM553610 3 0.3424 0.6949 0.000 0.064 0.856 0.016 0.064
#> GSM553611 2 0.0324 0.9245 0.004 0.992 0.000 0.000 0.004
#> GSM553612 2 0.0000 0.9256 0.000 1.000 0.000 0.000 0.000
#> GSM553613 3 0.1043 0.7433 0.000 0.040 0.960 0.000 0.000
#> GSM553614 5 0.6578 -0.2534 0.372 0.000 0.016 0.136 0.476
#> GSM553615 1 0.0671 0.7199 0.980 0.000 0.000 0.004 0.016
#> GSM553616 1 0.6045 0.4635 0.500 0.000 0.028 0.056 0.416
#> GSM553617 1 0.6029 0.4825 0.536 0.000 0.016 0.080 0.368
#> GSM553618 5 0.5569 0.5211 0.028 0.004 0.120 0.140 0.708
#> GSM553619 5 0.5446 0.5188 0.024 0.004 0.120 0.136 0.716
#> GSM553620 4 0.6123 0.4284 0.164 0.000 0.016 0.616 0.204
#> GSM553621 4 0.6410 0.3474 0.288 0.000 0.016 0.552 0.144
#> GSM553622 1 0.3609 0.6505 0.836 0.000 0.016 0.036 0.112
#> GSM553623 1 0.5948 0.4773 0.536 0.000 0.012 0.080 0.372
#> GSM553624 1 0.5853 0.5811 0.636 0.028 0.012 0.048 0.276
#> GSM553625 1 0.5709 0.5776 0.652 0.000 0.008 0.156 0.184
#> GSM553626 1 0.0404 0.7189 0.988 0.000 0.000 0.012 0.000
#> GSM553627 1 0.5470 0.5226 0.640 0.000 0.008 0.272 0.080
#> GSM553628 1 0.0290 0.7197 0.992 0.000 0.000 0.008 0.000
#> GSM553629 1 0.1518 0.7117 0.944 0.000 0.004 0.004 0.048
#> GSM553630 4 0.5393 0.4170 0.312 0.000 0.000 0.608 0.080
#> GSM553631 1 0.4267 0.5917 0.736 0.000 0.004 0.028 0.232
#> GSM553632 1 0.0579 0.7168 0.984 0.000 0.000 0.008 0.008
#> GSM553633 3 0.6725 0.2279 0.000 0.000 0.420 0.288 0.292
#> GSM553634 2 0.0451 0.9243 0.000 0.988 0.004 0.000 0.008
#> GSM553635 2 0.0324 0.9243 0.000 0.992 0.004 0.000 0.004
#> GSM553636 2 0.1443 0.9030 0.004 0.948 0.004 0.000 0.044
#> GSM553637 2 0.6081 0.5568 0.000 0.612 0.236 0.016 0.136
#> GSM553638 2 0.0000 0.9256 0.000 1.000 0.000 0.000 0.000
#> GSM553639 2 0.0451 0.9226 0.000 0.988 0.004 0.000 0.008
#> GSM553640 2 0.1306 0.9140 0.016 0.960 0.008 0.000 0.016
#> GSM553641 3 0.3651 0.7667 0.000 0.004 0.812 0.032 0.152
#> GSM553642 4 0.0963 0.7046 0.036 0.000 0.000 0.964 0.000
#> GSM553643 4 0.1673 0.6889 0.016 0.000 0.008 0.944 0.032
#> GSM553644 4 0.0963 0.7046 0.036 0.000 0.000 0.964 0.000
#> GSM553645 4 0.6441 -0.0718 0.000 0.000 0.240 0.504 0.256
#> GSM553646 4 0.0898 0.7018 0.020 0.000 0.008 0.972 0.000
#> GSM553647 4 0.1756 0.6875 0.016 0.000 0.008 0.940 0.036
#> GSM553648 3 0.4078 0.7556 0.000 0.004 0.776 0.040 0.180
#> GSM553649 3 0.4041 0.7577 0.000 0.004 0.780 0.040 0.176
#> GSM553650 2 0.0000 0.9256 0.000 1.000 0.000 0.000 0.000
#> GSM553651 2 0.1443 0.9030 0.004 0.948 0.004 0.000 0.044
#> GSM553652 2 0.0000 0.9256 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
#> GSM553595 4 0.3741 0.6354 0.000 0.000 0.004 0.756 0.208 0.032
#> GSM553596 4 0.2489 0.6608 0.000 0.000 0.012 0.860 0.128 0.000
#> GSM553597 4 0.4371 0.5769 0.000 0.000 0.000 0.716 0.180 0.104
#> GSM553598 3 0.4096 0.0618 0.000 0.000 0.508 0.484 0.008 0.000
#> GSM553599 1 0.6995 -0.3393 0.368 0.008 0.000 0.308 0.040 0.276
#> GSM553600 1 0.2218 0.4519 0.884 0.000 0.000 0.012 0.000 0.104
#> GSM553601 4 0.6760 -0.3604 0.204 0.000 0.000 0.496 0.084 0.216
#> GSM553602 1 0.2149 0.4714 0.900 0.000 0.000 0.016 0.004 0.080
#> GSM553603 5 0.1155 0.7105 0.004 0.000 0.004 0.036 0.956 0.000
#> GSM553604 5 0.3663 0.5799 0.012 0.000 0.000 0.040 0.792 0.156
#> GSM553605 3 0.0951 0.7562 0.000 0.000 0.968 0.008 0.004 0.020
#> GSM553606 3 0.4264 0.6004 0.000 0.032 0.636 0.000 0.000 0.332
#> GSM553607 2 0.6505 0.3482 0.000 0.444 0.120 0.068 0.000 0.368
#> GSM553608 2 0.0146 0.8849 0.000 0.996 0.000 0.004 0.000 0.000
#> GSM553609 2 0.3543 0.6764 0.000 0.720 0.004 0.004 0.000 0.272
#> GSM553610 3 0.3938 0.6180 0.000 0.016 0.660 0.000 0.000 0.324
#> GSM553611 2 0.0935 0.8812 0.000 0.964 0.000 0.000 0.004 0.032
#> GSM553612 2 0.0000 0.8852 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM553613 3 0.1471 0.7448 0.000 0.004 0.932 0.000 0.000 0.064
#> GSM553614 6 0.6820 0.3813 0.224 0.000 0.000 0.332 0.052 0.392
#> GSM553615 1 0.0806 0.5068 0.972 0.000 0.000 0.020 0.000 0.008
#> GSM553616 6 0.6472 0.2374 0.312 0.008 0.000 0.268 0.008 0.404
#> GSM553617 1 0.6867 -0.3578 0.392 0.008 0.000 0.272 0.032 0.296
#> GSM553618 4 0.2074 0.6420 0.000 0.000 0.036 0.912 0.048 0.004
#> GSM553619 4 0.2484 0.6354 0.000 0.000 0.036 0.896 0.044 0.024
#> GSM553620 5 0.6686 0.1842 0.108 0.000 0.004 0.084 0.448 0.356
#> GSM553621 5 0.6479 0.1463 0.168 0.000 0.004 0.032 0.440 0.356
#> GSM553622 1 0.3708 0.3036 0.752 0.000 0.000 0.020 0.008 0.220
#> GSM553623 1 0.6995 -0.3393 0.368 0.008 0.000 0.308 0.040 0.276
#> GSM553624 1 0.7096 -0.1692 0.468 0.032 0.000 0.192 0.044 0.264
#> GSM553625 1 0.6938 -0.0982 0.496 0.000 0.000 0.160 0.148 0.196
#> GSM553626 1 0.0291 0.5117 0.992 0.000 0.000 0.004 0.004 0.000
#> GSM553627 1 0.6559 -0.0284 0.504 0.000 0.000 0.060 0.244 0.192
#> GSM553628 1 0.0291 0.5117 0.992 0.000 0.000 0.004 0.004 0.000
#> GSM553629 1 0.1934 0.4809 0.916 0.000 0.000 0.040 0.000 0.044
#> GSM553630 5 0.5691 0.3429 0.248 0.000 0.004 0.016 0.592 0.140
#> GSM553631 1 0.4281 0.2432 0.704 0.000 0.000 0.228 0.000 0.068
#> GSM553632 1 0.0508 0.5083 0.984 0.000 0.000 0.000 0.004 0.012
#> GSM553633 4 0.5903 0.2104 0.000 0.000 0.312 0.460 0.228 0.000
#> GSM553634 2 0.1616 0.8730 0.000 0.932 0.000 0.020 0.000 0.048
#> GSM553635 2 0.1549 0.8722 0.000 0.936 0.000 0.020 0.000 0.044
#> GSM553636 2 0.1578 0.8698 0.000 0.936 0.000 0.012 0.004 0.048
#> GSM553637 2 0.6413 0.3726 0.000 0.456 0.108 0.068 0.000 0.368
#> GSM553638 2 0.0000 0.8852 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM553639 2 0.0146 0.8848 0.000 0.996 0.000 0.000 0.000 0.004
#> GSM553640 2 0.2265 0.8629 0.000 0.896 0.000 0.024 0.004 0.076
#> GSM553641 3 0.1700 0.7529 0.000 0.000 0.916 0.080 0.004 0.000
#> GSM553642 5 0.0405 0.7183 0.008 0.000 0.000 0.000 0.988 0.004
#> GSM553643 5 0.1155 0.7105 0.004 0.000 0.004 0.036 0.956 0.000
#> GSM553644 5 0.0291 0.7187 0.004 0.000 0.000 0.000 0.992 0.004
#> GSM553645 5 0.5587 0.0143 0.000 0.000 0.188 0.272 0.540 0.000
#> GSM553646 5 0.0146 0.7189 0.004 0.000 0.000 0.000 0.996 0.000
#> GSM553647 5 0.1155 0.7105 0.004 0.000 0.004 0.036 0.956 0.000
#> GSM553648 3 0.1806 0.7497 0.000 0.000 0.908 0.088 0.004 0.000
#> GSM553649 3 0.1806 0.7497 0.000 0.000 0.908 0.088 0.004 0.000
#> GSM553650 2 0.0000 0.8852 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM553651 2 0.1578 0.8698 0.000 0.936 0.000 0.012 0.004 0.048
#> GSM553652 2 0.0000 0.8852 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 individual(p) k
#> MAD:kmeans 56 0.133679 2
#> MAD:kmeans 53 0.155827 3
#> MAD:kmeans 49 0.000219 4
#> MAD:kmeans 45 0.001336 5
#> MAD:kmeans 36 0.006698 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 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 0.977 0.989 0.5072 0.494 0.494
#> 3 3 0.906 0.902 0.963 0.3188 0.770 0.566
#> 4 4 0.891 0.901 0.956 0.1260 0.838 0.563
#> 5 5 0.782 0.631 0.836 0.0571 0.964 0.854
#> 6 6 0.768 0.680 0.834 0.0397 0.941 0.735
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
#> GSM553595 1 0.6712 0.799 0.824 0.176
#> GSM553596 2 0.0376 0.989 0.004 0.996
#> GSM553597 1 0.0000 0.986 1.000 0.000
#> GSM553598 2 0.0000 0.992 0.000 1.000
#> GSM553599 1 0.0000 0.986 1.000 0.000
#> GSM553600 1 0.0000 0.986 1.000 0.000
#> GSM553601 1 0.0000 0.986 1.000 0.000
#> GSM553602 1 0.0000 0.986 1.000 0.000
#> GSM553603 1 0.0000 0.986 1.000 0.000
#> GSM553604 1 0.0000 0.986 1.000 0.000
#> GSM553605 2 0.0000 0.992 0.000 1.000
#> GSM553606 2 0.0000 0.992 0.000 1.000
#> GSM553607 2 0.0000 0.992 0.000 1.000
#> GSM553608 2 0.0000 0.992 0.000 1.000
#> GSM553609 2 0.0000 0.992 0.000 1.000
#> GSM553610 2 0.0000 0.992 0.000 1.000
#> GSM553611 2 0.0000 0.992 0.000 1.000
#> GSM553612 2 0.0000 0.992 0.000 1.000
#> GSM553613 2 0.0000 0.992 0.000 1.000
#> GSM553614 1 0.0000 0.986 1.000 0.000
#> GSM553615 1 0.0000 0.986 1.000 0.000
#> GSM553616 1 0.0000 0.986 1.000 0.000
#> GSM553617 1 0.0000 0.986 1.000 0.000
#> GSM553618 2 0.1633 0.971 0.024 0.976
#> GSM553619 1 0.5519 0.859 0.872 0.128
#> GSM553620 1 0.0000 0.986 1.000 0.000
#> GSM553621 1 0.0000 0.986 1.000 0.000
#> GSM553622 1 0.0000 0.986 1.000 0.000
#> GSM553623 1 0.0000 0.986 1.000 0.000
#> GSM553624 1 0.0000 0.986 1.000 0.000
#> GSM553625 1 0.0000 0.986 1.000 0.000
#> GSM553626 1 0.0000 0.986 1.000 0.000
#> GSM553627 1 0.0000 0.986 1.000 0.000
#> GSM553628 1 0.0000 0.986 1.000 0.000
#> GSM553629 1 0.0000 0.986 1.000 0.000
#> GSM553630 1 0.0000 0.986 1.000 0.000
#> GSM553631 1 0.0000 0.986 1.000 0.000
#> GSM553632 1 0.0000 0.986 1.000 0.000
#> GSM553633 2 0.0000 0.992 0.000 1.000
#> GSM553634 2 0.0000 0.992 0.000 1.000
#> GSM553635 2 0.0000 0.992 0.000 1.000
#> GSM553636 2 0.0000 0.992 0.000 1.000
#> GSM553637 2 0.0000 0.992 0.000 1.000
#> GSM553638 2 0.0000 0.992 0.000 1.000
#> GSM553639 2 0.0000 0.992 0.000 1.000
#> GSM553640 2 0.6712 0.790 0.176 0.824
#> GSM553641 2 0.0000 0.992 0.000 1.000
#> GSM553642 1 0.0000 0.986 1.000 0.000
#> GSM553643 1 0.2778 0.947 0.952 0.048
#> GSM553644 1 0.0000 0.986 1.000 0.000
#> GSM553645 2 0.0000 0.992 0.000 1.000
#> GSM553646 1 0.0672 0.980 0.992 0.008
#> GSM553647 1 0.3733 0.925 0.928 0.072
#> GSM553648 2 0.0000 0.992 0.000 1.000
#> GSM553649 2 0.0000 0.992 0.000 1.000
#> GSM553650 2 0.0000 0.992 0.000 1.000
#> GSM553651 2 0.0000 0.992 0.000 1.000
#> GSM553652 2 0.0000 0.992 0.000 1.000
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> GSM553595 3 0.0000 0.9566 0.000 0.000 1.000
#> GSM553596 3 0.0000 0.9566 0.000 0.000 1.000
#> GSM553597 3 0.3038 0.8424 0.104 0.000 0.896
#> GSM553598 3 0.0000 0.9566 0.000 0.000 1.000
#> GSM553599 1 0.0000 0.9317 1.000 0.000 0.000
#> GSM553600 1 0.0000 0.9317 1.000 0.000 0.000
#> GSM553601 1 0.3941 0.7826 0.844 0.000 0.156
#> GSM553602 1 0.0000 0.9317 1.000 0.000 0.000
#> GSM553603 1 0.6295 0.2034 0.528 0.000 0.472
#> GSM553604 1 0.0747 0.9195 0.984 0.000 0.016
#> GSM553605 3 0.0000 0.9566 0.000 0.000 1.000
#> GSM553606 2 0.0000 1.0000 0.000 1.000 0.000
#> GSM553607 2 0.0000 1.0000 0.000 1.000 0.000
#> GSM553608 2 0.0000 1.0000 0.000 1.000 0.000
#> GSM553609 2 0.0000 1.0000 0.000 1.000 0.000
#> GSM553610 2 0.0000 1.0000 0.000 1.000 0.000
#> GSM553611 2 0.0000 1.0000 0.000 1.000 0.000
#> GSM553612 2 0.0000 1.0000 0.000 1.000 0.000
#> GSM553613 3 0.6295 0.0701 0.000 0.472 0.528
#> GSM553614 1 0.0000 0.9317 1.000 0.000 0.000
#> GSM553615 1 0.0000 0.9317 1.000 0.000 0.000
#> GSM553616 1 0.0000 0.9317 1.000 0.000 0.000
#> GSM553617 1 0.0000 0.9317 1.000 0.000 0.000
#> GSM553618 3 0.0747 0.9451 0.016 0.000 0.984
#> GSM553619 3 0.0747 0.9451 0.016 0.000 0.984
#> GSM553620 1 0.0000 0.9317 1.000 0.000 0.000
#> GSM553621 1 0.0000 0.9317 1.000 0.000 0.000
#> GSM553622 1 0.0000 0.9317 1.000 0.000 0.000
#> GSM553623 1 0.0000 0.9317 1.000 0.000 0.000
#> GSM553624 1 0.0000 0.9317 1.000 0.000 0.000
#> GSM553625 1 0.0000 0.9317 1.000 0.000 0.000
#> GSM553626 1 0.0000 0.9317 1.000 0.000 0.000
#> GSM553627 1 0.0000 0.9317 1.000 0.000 0.000
#> GSM553628 1 0.0000 0.9317 1.000 0.000 0.000
#> GSM553629 1 0.0000 0.9317 1.000 0.000 0.000
#> GSM553630 1 0.0000 0.9317 1.000 0.000 0.000
#> GSM553631 1 0.0000 0.9317 1.000 0.000 0.000
#> GSM553632 1 0.0000 0.9317 1.000 0.000 0.000
#> GSM553633 3 0.0000 0.9566 0.000 0.000 1.000
#> GSM553634 2 0.0000 1.0000 0.000 1.000 0.000
#> GSM553635 2 0.0000 1.0000 0.000 1.000 0.000
#> GSM553636 2 0.0000 1.0000 0.000 1.000 0.000
#> GSM553637 2 0.0000 1.0000 0.000 1.000 0.000
#> GSM553638 2 0.0000 1.0000 0.000 1.000 0.000
#> GSM553639 2 0.0000 1.0000 0.000 1.000 0.000
#> GSM553640 2 0.0000 1.0000 0.000 1.000 0.000
#> GSM553641 3 0.0000 0.9566 0.000 0.000 1.000
#> GSM553642 1 0.6280 0.2395 0.540 0.000 0.460
#> GSM553643 3 0.0000 0.9566 0.000 0.000 1.000
#> GSM553644 1 0.6280 0.2395 0.540 0.000 0.460
#> GSM553645 3 0.0000 0.9566 0.000 0.000 1.000
#> GSM553646 3 0.0000 0.9566 0.000 0.000 1.000
#> GSM553647 3 0.0000 0.9566 0.000 0.000 1.000
#> GSM553648 3 0.0000 0.9566 0.000 0.000 1.000
#> GSM553649 3 0.0000 0.9566 0.000 0.000 1.000
#> GSM553650 2 0.0000 1.0000 0.000 1.000 0.000
#> GSM553651 2 0.0000 1.0000 0.000 1.000 0.000
#> GSM553652 2 0.0000 1.0000 0.000 1.000 0.000
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> GSM553595 4 0.2921 0.7711 0.000 0.000 0.140 0.860
#> GSM553596 3 0.0000 0.9025 0.000 0.000 1.000 0.000
#> GSM553597 4 0.0336 0.8949 0.000 0.000 0.008 0.992
#> GSM553598 3 0.0188 0.9036 0.000 0.000 0.996 0.004
#> GSM553599 1 0.0000 0.9802 1.000 0.000 0.000 0.000
#> GSM553600 1 0.0000 0.9802 1.000 0.000 0.000 0.000
#> GSM553601 1 0.2799 0.8590 0.884 0.000 0.008 0.108
#> GSM553602 1 0.0188 0.9796 0.996 0.000 0.000 0.004
#> GSM553603 4 0.0188 0.8982 0.000 0.000 0.004 0.996
#> GSM553604 4 0.0336 0.8956 0.008 0.000 0.000 0.992
#> GSM553605 3 0.0188 0.9036 0.000 0.000 0.996 0.004
#> GSM553606 3 0.4998 0.0304 0.000 0.488 0.512 0.000
#> GSM553607 2 0.3311 0.7863 0.000 0.828 0.172 0.000
#> GSM553608 2 0.0000 0.9806 0.000 1.000 0.000 0.000
#> GSM553609 2 0.0000 0.9806 0.000 1.000 0.000 0.000
#> GSM553610 3 0.3726 0.6981 0.000 0.212 0.788 0.000
#> GSM553611 2 0.0000 0.9806 0.000 1.000 0.000 0.000
#> GSM553612 2 0.0000 0.9806 0.000 1.000 0.000 0.000
#> GSM553613 3 0.0188 0.9036 0.000 0.000 0.996 0.004
#> GSM553614 1 0.2530 0.8827 0.896 0.000 0.004 0.100
#> GSM553615 1 0.0000 0.9802 1.000 0.000 0.000 0.000
#> GSM553616 1 0.0188 0.9793 0.996 0.000 0.000 0.004
#> GSM553617 1 0.0000 0.9802 1.000 0.000 0.000 0.000
#> GSM553618 3 0.0188 0.9009 0.000 0.000 0.996 0.004
#> GSM553619 3 0.0188 0.9009 0.000 0.000 0.996 0.004
#> GSM553620 4 0.4072 0.7086 0.252 0.000 0.000 0.748
#> GSM553621 4 0.4134 0.6977 0.260 0.000 0.000 0.740
#> GSM553622 1 0.0188 0.9796 0.996 0.000 0.000 0.004
#> GSM553623 1 0.0188 0.9786 0.996 0.000 0.004 0.000
#> GSM553624 1 0.0000 0.9802 1.000 0.000 0.000 0.000
#> GSM553625 1 0.1022 0.9603 0.968 0.000 0.000 0.032
#> GSM553626 1 0.0000 0.9802 1.000 0.000 0.000 0.000
#> GSM553627 1 0.0817 0.9666 0.976 0.000 0.000 0.024
#> GSM553628 1 0.0000 0.9802 1.000 0.000 0.000 0.000
#> GSM553629 1 0.0188 0.9793 0.996 0.000 0.000 0.004
#> GSM553630 4 0.4103 0.7035 0.256 0.000 0.000 0.744
#> GSM553631 1 0.0469 0.9764 0.988 0.000 0.000 0.012
#> GSM553632 1 0.0188 0.9796 0.996 0.000 0.000 0.004
#> GSM553633 3 0.1637 0.8641 0.000 0.000 0.940 0.060
#> GSM553634 2 0.0000 0.9806 0.000 1.000 0.000 0.000
#> GSM553635 2 0.0000 0.9806 0.000 1.000 0.000 0.000
#> GSM553636 2 0.0000 0.9806 0.000 1.000 0.000 0.000
#> GSM553637 2 0.2011 0.9050 0.000 0.920 0.080 0.000
#> GSM553638 2 0.0000 0.9806 0.000 1.000 0.000 0.000
#> GSM553639 2 0.0000 0.9806 0.000 1.000 0.000 0.000
#> GSM553640 2 0.0000 0.9806 0.000 1.000 0.000 0.000
#> GSM553641 3 0.0188 0.9036 0.000 0.000 0.996 0.004
#> GSM553642 4 0.0188 0.8982 0.000 0.000 0.004 0.996
#> GSM553643 4 0.0188 0.8982 0.000 0.000 0.004 0.996
#> GSM553644 4 0.0188 0.8982 0.000 0.000 0.004 0.996
#> GSM553645 3 0.4103 0.6332 0.000 0.000 0.744 0.256
#> GSM553646 4 0.0188 0.8982 0.000 0.000 0.004 0.996
#> GSM553647 4 0.0188 0.8982 0.000 0.000 0.004 0.996
#> GSM553648 3 0.0188 0.9036 0.000 0.000 0.996 0.004
#> GSM553649 3 0.0188 0.9036 0.000 0.000 0.996 0.004
#> GSM553650 2 0.0000 0.9806 0.000 1.000 0.000 0.000
#> GSM553651 2 0.0000 0.9806 0.000 1.000 0.000 0.000
#> GSM553652 2 0.0000 0.9806 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
#> GSM553595 4 0.6264 0.123 0.000 0.000 0.148 0.452 0.400
#> GSM553596 3 0.4126 0.598 0.000 0.000 0.620 0.000 0.380
#> GSM553597 5 0.4359 -0.269 0.000 0.000 0.004 0.412 0.584
#> GSM553598 3 0.2280 0.773 0.000 0.000 0.880 0.000 0.120
#> GSM553599 1 0.4278 0.159 0.548 0.000 0.000 0.000 0.452
#> GSM553600 1 0.1341 0.688 0.944 0.000 0.000 0.000 0.056
#> GSM553601 5 0.4446 -0.130 0.476 0.000 0.004 0.000 0.520
#> GSM553602 1 0.1704 0.680 0.928 0.000 0.000 0.004 0.068
#> GSM553603 4 0.0000 0.754 0.000 0.000 0.000 1.000 0.000
#> GSM553604 4 0.0404 0.747 0.000 0.000 0.000 0.988 0.012
#> GSM553605 3 0.0000 0.806 0.000 0.000 1.000 0.000 0.000
#> GSM553606 3 0.3720 0.614 0.000 0.228 0.760 0.000 0.012
#> GSM553607 2 0.3750 0.671 0.000 0.756 0.232 0.000 0.012
#> GSM553608 2 0.0404 0.966 0.000 0.988 0.000 0.000 0.012
#> GSM553609 2 0.0404 0.961 0.000 0.988 0.000 0.000 0.012
#> GSM553610 3 0.2723 0.724 0.000 0.124 0.864 0.000 0.012
#> GSM553611 2 0.0290 0.966 0.000 0.992 0.000 0.000 0.008
#> GSM553612 2 0.0000 0.966 0.000 1.000 0.000 0.000 0.000
#> GSM553613 3 0.0290 0.804 0.000 0.000 0.992 0.000 0.008
#> GSM553614 5 0.5425 0.101 0.420 0.000 0.000 0.060 0.520
#> GSM553615 1 0.0290 0.703 0.992 0.000 0.000 0.000 0.008
#> GSM553616 5 0.4268 -0.145 0.444 0.000 0.000 0.000 0.556
#> GSM553617 1 0.4278 0.158 0.548 0.000 0.000 0.000 0.452
#> GSM553618 3 0.4015 0.630 0.000 0.000 0.652 0.000 0.348
#> GSM553619 3 0.4171 0.583 0.000 0.000 0.604 0.000 0.396
#> GSM553620 4 0.6147 0.315 0.188 0.000 0.000 0.556 0.256
#> GSM553621 4 0.6361 0.193 0.296 0.000 0.000 0.508 0.196
#> GSM553622 1 0.2583 0.621 0.864 0.000 0.000 0.004 0.132
#> GSM553623 1 0.4278 0.159 0.548 0.000 0.000 0.000 0.452
#> GSM553624 1 0.3816 0.375 0.696 0.000 0.000 0.000 0.304
#> GSM553625 1 0.2914 0.606 0.872 0.000 0.000 0.076 0.052
#> GSM553626 1 0.0162 0.705 0.996 0.000 0.000 0.004 0.000
#> GSM553627 1 0.2104 0.667 0.916 0.000 0.000 0.060 0.024
#> GSM553628 1 0.0000 0.705 1.000 0.000 0.000 0.000 0.000
#> GSM553629 1 0.1478 0.671 0.936 0.000 0.000 0.000 0.064
#> GSM553630 4 0.6068 0.234 0.328 0.000 0.000 0.532 0.140
#> GSM553631 1 0.3863 0.353 0.740 0.000 0.000 0.012 0.248
#> GSM553632 1 0.0162 0.705 0.996 0.000 0.000 0.004 0.000
#> GSM553633 3 0.1168 0.794 0.000 0.000 0.960 0.032 0.008
#> GSM553634 2 0.0162 0.965 0.000 0.996 0.000 0.000 0.004
#> GSM553635 2 0.0290 0.963 0.000 0.992 0.000 0.000 0.008
#> GSM553636 2 0.0404 0.966 0.000 0.988 0.000 0.000 0.012
#> GSM553637 2 0.2361 0.872 0.000 0.892 0.096 0.000 0.012
#> GSM553638 2 0.0000 0.966 0.000 1.000 0.000 0.000 0.000
#> GSM553639 2 0.0404 0.966 0.000 0.988 0.000 0.000 0.012
#> GSM553640 2 0.0566 0.964 0.004 0.984 0.000 0.000 0.012
#> GSM553641 3 0.0000 0.806 0.000 0.000 1.000 0.000 0.000
#> GSM553642 4 0.0000 0.754 0.000 0.000 0.000 1.000 0.000
#> GSM553643 4 0.0162 0.752 0.000 0.000 0.004 0.996 0.000
#> GSM553644 4 0.0000 0.754 0.000 0.000 0.000 1.000 0.000
#> GSM553645 3 0.4440 0.146 0.000 0.000 0.528 0.468 0.004
#> GSM553646 4 0.0000 0.754 0.000 0.000 0.000 1.000 0.000
#> GSM553647 4 0.0162 0.752 0.000 0.000 0.004 0.996 0.000
#> GSM553648 3 0.0000 0.806 0.000 0.000 1.000 0.000 0.000
#> GSM553649 3 0.0000 0.806 0.000 0.000 1.000 0.000 0.000
#> GSM553650 2 0.0290 0.966 0.000 0.992 0.000 0.000 0.008
#> GSM553651 2 0.0404 0.966 0.000 0.988 0.000 0.000 0.012
#> GSM553652 2 0.0000 0.966 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
#> GSM553595 4 0.4353 0.628 0.000 0.000 0.108 0.756 0.116 0.020
#> GSM553596 4 0.3221 0.588 0.000 0.000 0.264 0.736 0.000 0.000
#> GSM553597 4 0.4162 0.525 0.000 0.000 0.000 0.744 0.120 0.136
#> GSM553598 3 0.3592 0.290 0.000 0.000 0.656 0.344 0.000 0.000
#> GSM553599 6 0.3136 0.787 0.228 0.000 0.000 0.004 0.000 0.768
#> GSM553600 1 0.2178 0.741 0.868 0.000 0.000 0.000 0.000 0.132
#> GSM553601 6 0.5271 0.605 0.292 0.000 0.000 0.132 0.000 0.576
#> GSM553602 1 0.2135 0.742 0.872 0.000 0.000 0.000 0.000 0.128
#> GSM553603 5 0.0000 0.768 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM553604 5 0.1471 0.729 0.000 0.000 0.000 0.004 0.932 0.064
#> GSM553605 3 0.0000 0.796 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM553606 3 0.4308 0.629 0.000 0.088 0.768 0.112 0.000 0.032
#> GSM553607 2 0.6299 0.522 0.000 0.556 0.220 0.160 0.000 0.064
#> GSM553608 2 0.0146 0.912 0.000 0.996 0.000 0.004 0.000 0.000
#> GSM553609 2 0.2487 0.872 0.000 0.876 0.000 0.092 0.000 0.032
#> GSM553610 3 0.3041 0.719 0.000 0.036 0.856 0.088 0.000 0.020
#> GSM553611 2 0.0508 0.911 0.000 0.984 0.000 0.012 0.000 0.004
#> GSM553612 2 0.0260 0.913 0.000 0.992 0.000 0.008 0.000 0.000
#> GSM553613 3 0.1007 0.782 0.000 0.000 0.956 0.044 0.000 0.000
#> GSM553614 4 0.6670 -0.087 0.340 0.000 0.000 0.368 0.032 0.260
#> GSM553615 1 0.0603 0.804 0.980 0.000 0.000 0.004 0.000 0.016
#> GSM553616 6 0.4746 0.487 0.236 0.000 0.000 0.104 0.000 0.660
#> GSM553617 6 0.2664 0.775 0.184 0.000 0.000 0.000 0.000 0.816
#> GSM553618 4 0.4453 0.445 0.000 0.000 0.332 0.624 0.000 0.044
#> GSM553619 4 0.3539 0.605 0.000 0.000 0.220 0.756 0.000 0.024
#> GSM553620 5 0.7444 0.209 0.184 0.000 0.000 0.208 0.396 0.212
#> GSM553621 5 0.7163 0.200 0.288 0.000 0.000 0.096 0.396 0.220
#> GSM553622 1 0.2653 0.745 0.844 0.000 0.000 0.012 0.000 0.144
#> GSM553623 6 0.3136 0.787 0.228 0.000 0.000 0.004 0.000 0.768
#> GSM553624 1 0.4315 -0.379 0.496 0.004 0.000 0.012 0.000 0.488
#> GSM553625 1 0.3040 0.747 0.856 0.000 0.000 0.016 0.044 0.084
#> GSM553626 1 0.0146 0.805 0.996 0.000 0.000 0.000 0.000 0.004
#> GSM553627 1 0.3756 0.649 0.784 0.000 0.000 0.008 0.052 0.156
#> GSM553628 1 0.0458 0.803 0.984 0.000 0.000 0.000 0.000 0.016
#> GSM553629 1 0.1950 0.779 0.912 0.000 0.000 0.024 0.000 0.064
#> GSM553630 5 0.5735 0.199 0.404 0.000 0.000 0.024 0.480 0.092
#> GSM553631 1 0.3405 0.692 0.812 0.000 0.000 0.076 0.000 0.112
#> GSM553632 1 0.0000 0.806 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM553633 3 0.2165 0.702 0.000 0.000 0.884 0.108 0.008 0.000
#> GSM553634 2 0.2506 0.882 0.000 0.880 0.000 0.068 0.000 0.052
#> GSM553635 2 0.3092 0.856 0.000 0.836 0.000 0.104 0.000 0.060
#> GSM553636 2 0.0820 0.904 0.000 0.972 0.000 0.012 0.000 0.016
#> GSM553637 2 0.5504 0.696 0.000 0.664 0.112 0.160 0.000 0.064
#> GSM553638 2 0.0363 0.913 0.000 0.988 0.000 0.012 0.000 0.000
#> GSM553639 2 0.0146 0.912 0.000 0.996 0.000 0.004 0.000 0.000
#> GSM553640 2 0.2146 0.892 0.004 0.908 0.000 0.044 0.000 0.044
#> GSM553641 3 0.0000 0.796 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM553642 5 0.0000 0.768 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM553643 5 0.0000 0.768 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM553644 5 0.0000 0.768 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM553645 3 0.3854 0.211 0.000 0.000 0.536 0.000 0.464 0.000
#> GSM553646 5 0.0000 0.768 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM553647 5 0.0000 0.768 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM553648 3 0.0000 0.796 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM553649 3 0.0000 0.796 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM553650 2 0.0146 0.913 0.000 0.996 0.000 0.004 0.000 0.000
#> GSM553651 2 0.0725 0.906 0.000 0.976 0.000 0.012 0.000 0.012
#> GSM553652 2 0.0713 0.910 0.000 0.972 0.000 0.028 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 individual(p) k
#> MAD:skmeans 58 0.16965 2
#> MAD:skmeans 54 0.00135 3
#> MAD:skmeans 57 0.02917 4
#> MAD:skmeans 44 0.00706 5
#> MAD:skmeans 49 0.00467 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 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.826 0.926 0.966 0.4537 0.552 0.552
#> 3 3 0.861 0.892 0.946 0.4869 0.729 0.527
#> 4 4 0.731 0.797 0.894 0.1048 0.719 0.343
#> 5 5 0.776 0.788 0.899 0.0719 0.852 0.505
#> 6 6 0.822 0.813 0.902 0.0377 0.946 0.745
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
#> GSM553595 1 0.0000 0.965 1.000 0.000
#> GSM553596 1 0.5059 0.860 0.888 0.112
#> GSM553597 1 0.0000 0.965 1.000 0.000
#> GSM553598 1 0.9661 0.369 0.608 0.392
#> GSM553599 1 0.0000 0.965 1.000 0.000
#> GSM553600 1 0.0000 0.965 1.000 0.000
#> GSM553601 1 0.0000 0.965 1.000 0.000
#> GSM553602 1 0.0000 0.965 1.000 0.000
#> GSM553603 1 0.0000 0.965 1.000 0.000
#> GSM553604 1 0.0000 0.965 1.000 0.000
#> GSM553605 2 0.0000 0.958 0.000 1.000
#> GSM553606 2 0.0000 0.958 0.000 1.000
#> GSM553607 2 0.0000 0.958 0.000 1.000
#> GSM553608 2 0.1843 0.944 0.028 0.972
#> GSM553609 2 0.0000 0.958 0.000 1.000
#> GSM553610 2 0.0000 0.958 0.000 1.000
#> GSM553611 2 0.6048 0.834 0.148 0.852
#> GSM553612 2 0.0000 0.958 0.000 1.000
#> GSM553613 2 0.0000 0.958 0.000 1.000
#> GSM553614 1 0.0000 0.965 1.000 0.000
#> GSM553615 1 0.0000 0.965 1.000 0.000
#> GSM553616 1 0.0000 0.965 1.000 0.000
#> GSM553617 1 0.0000 0.965 1.000 0.000
#> GSM553618 1 0.6623 0.785 0.828 0.172
#> GSM553619 1 0.8813 0.579 0.700 0.300
#> GSM553620 1 0.0000 0.965 1.000 0.000
#> GSM553621 1 0.0000 0.965 1.000 0.000
#> GSM553622 1 0.0000 0.965 1.000 0.000
#> GSM553623 1 0.0000 0.965 1.000 0.000
#> GSM553624 1 0.0000 0.965 1.000 0.000
#> GSM553625 1 0.0000 0.965 1.000 0.000
#> GSM553626 1 0.0000 0.965 1.000 0.000
#> GSM553627 1 0.0000 0.965 1.000 0.000
#> GSM553628 1 0.0000 0.965 1.000 0.000
#> GSM553629 1 0.0000 0.965 1.000 0.000
#> GSM553630 1 0.0000 0.965 1.000 0.000
#> GSM553631 1 0.0000 0.965 1.000 0.000
#> GSM553632 1 0.0000 0.965 1.000 0.000
#> GSM553633 1 0.1414 0.950 0.980 0.020
#> GSM553634 2 0.0000 0.958 0.000 1.000
#> GSM553635 2 0.0000 0.958 0.000 1.000
#> GSM553636 1 0.3733 0.903 0.928 0.072
#> GSM553637 2 0.0000 0.958 0.000 1.000
#> GSM553638 2 0.0000 0.958 0.000 1.000
#> GSM553639 2 0.5737 0.848 0.136 0.864
#> GSM553640 1 0.5629 0.845 0.868 0.132
#> GSM553641 2 0.3733 0.912 0.072 0.928
#> GSM553642 1 0.0000 0.965 1.000 0.000
#> GSM553643 1 0.0000 0.965 1.000 0.000
#> GSM553644 1 0.0000 0.965 1.000 0.000
#> GSM553645 1 0.0000 0.965 1.000 0.000
#> GSM553646 1 0.0000 0.965 1.000 0.000
#> GSM553647 1 0.0000 0.965 1.000 0.000
#> GSM553648 2 0.3733 0.912 0.072 0.928
#> GSM553649 2 0.7950 0.696 0.240 0.760
#> GSM553650 2 0.0938 0.953 0.012 0.988
#> GSM553651 1 0.3733 0.903 0.928 0.072
#> GSM553652 2 0.0000 0.958 0.000 1.000
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> GSM553595 1 0.0424 0.924 0.992 0.000 0.008
#> GSM553596 3 0.2356 0.922 0.072 0.000 0.928
#> GSM553597 1 0.0000 0.927 1.000 0.000 0.000
#> GSM553598 1 0.2066 0.894 0.940 0.060 0.000
#> GSM553599 3 0.0237 0.941 0.004 0.000 0.996
#> GSM553600 3 0.0000 0.941 0.000 0.000 1.000
#> GSM553601 3 0.2356 0.922 0.072 0.000 0.928
#> GSM553602 3 0.0000 0.941 0.000 0.000 1.000
#> GSM553603 1 0.0000 0.927 1.000 0.000 0.000
#> GSM553604 3 0.2356 0.922 0.072 0.000 0.928
#> GSM553605 2 0.0000 0.961 0.000 1.000 0.000
#> GSM553606 2 0.0000 0.961 0.000 1.000 0.000
#> GSM553607 2 0.0000 0.961 0.000 1.000 0.000
#> GSM553608 2 0.3816 0.817 0.000 0.852 0.148
#> GSM553609 2 0.0000 0.961 0.000 1.000 0.000
#> GSM553610 2 0.0000 0.961 0.000 1.000 0.000
#> GSM553611 3 0.3009 0.914 0.028 0.052 0.920
#> GSM553612 2 0.0000 0.961 0.000 1.000 0.000
#> GSM553613 2 0.0000 0.961 0.000 1.000 0.000
#> GSM553614 1 0.2537 0.889 0.920 0.000 0.080
#> GSM553615 3 0.0000 0.941 0.000 0.000 1.000
#> GSM553616 3 0.0000 0.941 0.000 0.000 1.000
#> GSM553617 3 0.0000 0.941 0.000 0.000 1.000
#> GSM553618 3 0.5988 0.485 0.368 0.000 0.632
#> GSM553619 1 0.4235 0.774 0.824 0.176 0.000
#> GSM553620 1 0.0000 0.927 1.000 0.000 0.000
#> GSM553621 1 0.5591 0.633 0.696 0.000 0.304
#> GSM553622 3 0.0592 0.936 0.012 0.000 0.988
#> GSM553623 3 0.0000 0.941 0.000 0.000 1.000
#> GSM553624 3 0.0000 0.941 0.000 0.000 1.000
#> GSM553625 1 0.2356 0.899 0.928 0.000 0.072
#> GSM553626 1 0.2356 0.899 0.928 0.000 0.072
#> GSM553627 3 0.0000 0.941 0.000 0.000 1.000
#> GSM553628 3 0.0000 0.941 0.000 0.000 1.000
#> GSM553629 1 0.6291 0.158 0.532 0.000 0.468
#> GSM553630 1 0.1643 0.915 0.956 0.000 0.044
#> GSM553631 1 0.1643 0.915 0.956 0.000 0.044
#> GSM553632 1 0.3192 0.877 0.888 0.000 0.112
#> GSM553633 1 0.0000 0.927 1.000 0.000 0.000
#> GSM553634 2 0.0000 0.961 0.000 1.000 0.000
#> GSM553635 2 0.0000 0.961 0.000 1.000 0.000
#> GSM553636 3 0.2356 0.922 0.072 0.000 0.928
#> GSM553637 2 0.0000 0.961 0.000 1.000 0.000
#> GSM553638 2 0.0000 0.961 0.000 1.000 0.000
#> GSM553639 3 0.2743 0.915 0.020 0.052 0.928
#> GSM553640 3 0.4796 0.771 0.220 0.000 0.780
#> GSM553641 2 0.0000 0.961 0.000 1.000 0.000
#> GSM553642 1 0.0000 0.927 1.000 0.000 0.000
#> GSM553643 1 0.0000 0.927 1.000 0.000 0.000
#> GSM553644 1 0.0000 0.927 1.000 0.000 0.000
#> GSM553645 1 0.0000 0.927 1.000 0.000 0.000
#> GSM553646 1 0.0000 0.927 1.000 0.000 0.000
#> GSM553647 1 0.0000 0.927 1.000 0.000 0.000
#> GSM553648 2 0.0000 0.961 0.000 1.000 0.000
#> GSM553649 2 0.5706 0.501 0.320 0.680 0.000
#> GSM553650 2 0.3267 0.854 0.000 0.884 0.116
#> GSM553651 3 0.2356 0.922 0.072 0.000 0.928
#> GSM553652 2 0.0000 0.961 0.000 1.000 0.000
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> GSM553595 4 0.1059 0.9221 0.016 0.012 0.000 0.972
#> GSM553596 4 0.3999 0.8324 0.036 0.140 0.000 0.824
#> GSM553597 4 0.0592 0.9231 0.016 0.000 0.000 0.984
#> GSM553598 3 0.3266 0.7496 0.000 0.000 0.832 0.168
#> GSM553599 1 0.3266 0.7833 0.832 0.168 0.000 0.000
#> GSM553600 1 0.0000 0.8451 1.000 0.000 0.000 0.000
#> GSM553601 4 0.3999 0.8324 0.036 0.140 0.000 0.824
#> GSM553602 1 0.1118 0.8388 0.964 0.036 0.000 0.000
#> GSM553603 4 0.0000 0.9246 0.000 0.000 0.000 1.000
#> GSM553604 4 0.4088 0.8295 0.040 0.140 0.000 0.820
#> GSM553605 3 0.0000 0.8708 0.000 0.000 1.000 0.000
#> GSM553606 3 0.1118 0.8546 0.000 0.036 0.964 0.000
#> GSM553607 3 0.4992 -0.1199 0.000 0.476 0.524 0.000
#> GSM553608 2 0.2408 0.8510 0.000 0.896 0.104 0.000
#> GSM553609 2 0.3569 0.8134 0.000 0.804 0.196 0.000
#> GSM553610 3 0.1118 0.8546 0.000 0.036 0.964 0.000
#> GSM553611 2 0.0921 0.8074 0.028 0.972 0.000 0.000
#> GSM553612 2 0.2921 0.8472 0.000 0.860 0.140 0.000
#> GSM553613 3 0.0000 0.8708 0.000 0.000 1.000 0.000
#> GSM553614 4 0.2214 0.9084 0.044 0.028 0.000 0.928
#> GSM553615 1 0.0000 0.8451 1.000 0.000 0.000 0.000
#> GSM553616 2 0.7516 0.0346 0.200 0.472 0.000 0.328
#> GSM553617 1 0.4790 0.5417 0.620 0.380 0.000 0.000
#> GSM553618 4 0.2871 0.8867 0.032 0.072 0.000 0.896
#> GSM553619 4 0.2125 0.8936 0.000 0.004 0.076 0.920
#> GSM553620 4 0.0657 0.9242 0.012 0.004 0.000 0.984
#> GSM553621 1 0.5028 0.2952 0.596 0.004 0.000 0.400
#> GSM553622 1 0.0592 0.8423 0.984 0.000 0.000 0.016
#> GSM553623 1 0.4564 0.6251 0.672 0.328 0.000 0.000
#> GSM553624 1 0.4761 0.4961 0.628 0.372 0.000 0.000
#> GSM553625 4 0.3751 0.7641 0.196 0.004 0.000 0.800
#> GSM553626 1 0.1118 0.8336 0.964 0.000 0.000 0.036
#> GSM553627 1 0.1743 0.8339 0.940 0.056 0.000 0.004
#> GSM553628 1 0.0000 0.8451 1.000 0.000 0.000 0.000
#> GSM553629 1 0.0817 0.8409 0.976 0.000 0.000 0.024
#> GSM553630 4 0.2345 0.8732 0.100 0.000 0.000 0.900
#> GSM553631 4 0.2408 0.8714 0.104 0.000 0.000 0.896
#> GSM553632 1 0.1118 0.8336 0.964 0.000 0.000 0.036
#> GSM553633 3 0.3569 0.7233 0.000 0.000 0.804 0.196
#> GSM553634 2 0.2921 0.8472 0.000 0.860 0.140 0.000
#> GSM553635 2 0.3528 0.8168 0.000 0.808 0.192 0.000
#> GSM553636 2 0.1118 0.8021 0.036 0.964 0.000 0.000
#> GSM553637 2 0.3569 0.8134 0.000 0.804 0.196 0.000
#> GSM553638 2 0.2921 0.8472 0.000 0.860 0.140 0.000
#> GSM553639 2 0.0000 0.8202 0.000 1.000 0.000 0.000
#> GSM553640 2 0.1305 0.8192 0.004 0.960 0.000 0.036
#> GSM553641 3 0.0000 0.8708 0.000 0.000 1.000 0.000
#> GSM553642 4 0.0000 0.9246 0.000 0.000 0.000 1.000
#> GSM553643 4 0.0000 0.9246 0.000 0.000 0.000 1.000
#> GSM553644 4 0.0000 0.9246 0.000 0.000 0.000 1.000
#> GSM553645 4 0.1389 0.9072 0.000 0.000 0.048 0.952
#> GSM553646 4 0.0000 0.9246 0.000 0.000 0.000 1.000
#> GSM553647 4 0.0000 0.9246 0.000 0.000 0.000 1.000
#> GSM553648 3 0.0469 0.8690 0.000 0.000 0.988 0.012
#> GSM553649 3 0.0469 0.8691 0.000 0.000 0.988 0.012
#> GSM553650 2 0.2469 0.8505 0.000 0.892 0.108 0.000
#> GSM553651 2 0.1118 0.8021 0.036 0.964 0.000 0.000
#> GSM553652 2 0.2921 0.8472 0.000 0.860 0.140 0.000
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> GSM553595 4 0.0703 0.931 0.000 0.000 0.000 0.976 0.024
#> GSM553596 5 0.2773 0.737 0.000 0.000 0.000 0.164 0.836
#> GSM553597 4 0.0609 0.934 0.000 0.000 0.000 0.980 0.020
#> GSM553598 3 0.2127 0.871 0.000 0.000 0.892 0.108 0.000
#> GSM553599 5 0.0992 0.778 0.024 0.008 0.000 0.000 0.968
#> GSM553600 1 0.2424 0.777 0.868 0.000 0.000 0.000 0.132
#> GSM553601 5 0.0880 0.776 0.000 0.000 0.000 0.032 0.968
#> GSM553602 1 0.0963 0.879 0.964 0.000 0.000 0.000 0.036
#> GSM553603 4 0.0000 0.938 0.000 0.000 0.000 1.000 0.000
#> GSM553604 5 0.2773 0.737 0.000 0.000 0.000 0.164 0.836
#> GSM553605 3 0.0000 0.948 0.000 0.000 1.000 0.000 0.000
#> GSM553606 2 0.4547 0.413 0.000 0.588 0.400 0.000 0.012
#> GSM553607 2 0.2574 0.822 0.000 0.876 0.112 0.000 0.012
#> GSM553608 2 0.0000 0.857 0.000 1.000 0.000 0.000 0.000
#> GSM553609 2 0.2574 0.822 0.000 0.876 0.112 0.000 0.012
#> GSM553610 2 0.4547 0.413 0.000 0.588 0.400 0.000 0.012
#> GSM553611 2 0.4294 -0.180 0.000 0.532 0.000 0.000 0.468
#> GSM553612 2 0.0000 0.857 0.000 1.000 0.000 0.000 0.000
#> GSM553613 3 0.0162 0.946 0.000 0.000 0.996 0.000 0.004
#> GSM553614 4 0.2813 0.827 0.000 0.000 0.000 0.832 0.168
#> GSM553615 1 0.0000 0.905 1.000 0.000 0.000 0.000 0.000
#> GSM553616 5 0.0613 0.777 0.008 0.004 0.000 0.004 0.984
#> GSM553617 5 0.0703 0.777 0.024 0.000 0.000 0.000 0.976
#> GSM553618 5 0.3586 0.586 0.000 0.000 0.000 0.264 0.736
#> GSM553619 4 0.4364 0.779 0.000 0.000 0.088 0.764 0.148
#> GSM553620 4 0.1195 0.931 0.012 0.000 0.000 0.960 0.028
#> GSM553621 1 0.4982 0.206 0.556 0.000 0.000 0.412 0.032
#> GSM553622 1 0.0000 0.905 1.000 0.000 0.000 0.000 0.000
#> GSM553623 5 0.0880 0.776 0.032 0.000 0.000 0.000 0.968
#> GSM553624 5 0.4060 0.501 0.360 0.000 0.000 0.000 0.640
#> GSM553625 4 0.4303 0.725 0.192 0.000 0.000 0.752 0.056
#> GSM553626 1 0.0000 0.905 1.000 0.000 0.000 0.000 0.000
#> GSM553627 5 0.4278 0.311 0.452 0.000 0.000 0.000 0.548
#> GSM553628 1 0.0000 0.905 1.000 0.000 0.000 0.000 0.000
#> GSM553629 1 0.0000 0.905 1.000 0.000 0.000 0.000 0.000
#> GSM553630 4 0.0880 0.928 0.032 0.000 0.000 0.968 0.000
#> GSM553631 4 0.2020 0.881 0.100 0.000 0.000 0.900 0.000
#> GSM553632 1 0.0000 0.905 1.000 0.000 0.000 0.000 0.000
#> GSM553633 3 0.2179 0.867 0.000 0.000 0.888 0.112 0.000
#> GSM553634 2 0.0000 0.857 0.000 1.000 0.000 0.000 0.000
#> GSM553635 2 0.2462 0.823 0.000 0.880 0.112 0.000 0.008
#> GSM553636 5 0.4161 0.454 0.000 0.392 0.000 0.000 0.608
#> GSM553637 2 0.2574 0.822 0.000 0.876 0.112 0.000 0.012
#> GSM553638 2 0.0000 0.857 0.000 1.000 0.000 0.000 0.000
#> GSM553639 2 0.0000 0.857 0.000 1.000 0.000 0.000 0.000
#> GSM553640 2 0.0162 0.854 0.000 0.996 0.000 0.000 0.004
#> GSM553641 3 0.0000 0.948 0.000 0.000 1.000 0.000 0.000
#> GSM553642 4 0.0000 0.938 0.000 0.000 0.000 1.000 0.000
#> GSM553643 4 0.0000 0.938 0.000 0.000 0.000 1.000 0.000
#> GSM553644 4 0.0000 0.938 0.000 0.000 0.000 1.000 0.000
#> GSM553645 4 0.1043 0.919 0.000 0.000 0.040 0.960 0.000
#> GSM553646 4 0.0000 0.938 0.000 0.000 0.000 1.000 0.000
#> GSM553647 4 0.0000 0.938 0.000 0.000 0.000 1.000 0.000
#> GSM553648 3 0.0000 0.948 0.000 0.000 1.000 0.000 0.000
#> GSM553649 3 0.0162 0.947 0.000 0.000 0.996 0.004 0.000
#> GSM553650 2 0.0000 0.857 0.000 1.000 0.000 0.000 0.000
#> GSM553651 5 0.4138 0.462 0.000 0.384 0.000 0.000 0.616
#> GSM553652 2 0.0000 0.857 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
#> GSM553595 4 0.0935 0.90543 0.000 0.000 0.000 0.964 0.032 0.004
#> GSM553596 5 0.2178 0.77532 0.000 0.000 0.000 0.132 0.868 0.000
#> GSM553597 4 0.2135 0.87347 0.000 0.000 0.000 0.872 0.000 0.128
#> GSM553598 3 0.0000 0.95452 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM553599 5 0.0000 0.81338 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM553600 1 0.2178 0.77505 0.868 0.000 0.000 0.000 0.132 0.000
#> GSM553601 5 0.0000 0.81338 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM553602 1 0.1141 0.85130 0.948 0.000 0.000 0.000 0.052 0.000
#> GSM553603 4 0.0000 0.91492 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM553604 5 0.2178 0.77532 0.000 0.000 0.000 0.132 0.868 0.000
#> GSM553605 3 0.0000 0.95452 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM553606 6 0.2831 0.74704 0.000 0.024 0.136 0.000 0.000 0.840
#> GSM553607 6 0.2378 0.80733 0.000 0.152 0.000 0.000 0.000 0.848
#> GSM553608 2 0.0000 0.90770 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM553609 6 0.3684 0.56245 0.000 0.372 0.000 0.000 0.000 0.628
#> GSM553610 6 0.3394 0.69284 0.000 0.024 0.200 0.000 0.000 0.776
#> GSM553611 2 0.0547 0.89637 0.000 0.980 0.000 0.000 0.020 0.000
#> GSM553612 2 0.2219 0.80818 0.000 0.864 0.000 0.000 0.000 0.136
#> GSM553613 3 0.3076 0.64681 0.000 0.000 0.760 0.000 0.000 0.240
#> GSM553614 4 0.3359 0.85108 0.008 0.000 0.000 0.820 0.044 0.128
#> GSM553615 1 0.0000 0.88938 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM553616 5 0.2092 0.77207 0.000 0.000 0.000 0.000 0.876 0.124
#> GSM553617 5 0.0000 0.81338 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM553618 5 0.3445 0.61072 0.000 0.000 0.012 0.244 0.744 0.000
#> GSM553619 4 0.4738 0.73893 0.000 0.000 0.112 0.684 0.004 0.200
#> GSM553620 4 0.2963 0.86020 0.016 0.000 0.000 0.828 0.004 0.152
#> GSM553621 1 0.5936 -0.00929 0.440 0.000 0.000 0.400 0.012 0.148
#> GSM553622 1 0.0458 0.88332 0.984 0.000 0.000 0.000 0.000 0.016
#> GSM553623 5 0.0000 0.81338 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM553624 5 0.3647 0.51122 0.360 0.000 0.000 0.000 0.640 0.000
#> GSM553625 4 0.3896 0.73267 0.196 0.000 0.000 0.748 0.056 0.000
#> GSM553626 1 0.0000 0.88938 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM553627 5 0.3843 0.31273 0.452 0.000 0.000 0.000 0.548 0.000
#> GSM553628 1 0.0000 0.88938 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM553629 1 0.0000 0.88938 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM553630 4 0.0937 0.90567 0.040 0.000 0.000 0.960 0.000 0.000
#> GSM553631 4 0.2053 0.86312 0.108 0.000 0.000 0.888 0.000 0.004
#> GSM553632 1 0.0000 0.88938 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM553633 3 0.0000 0.95452 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM553634 2 0.2762 0.74251 0.000 0.804 0.000 0.000 0.000 0.196
#> GSM553635 2 0.3547 0.49287 0.000 0.668 0.000 0.000 0.000 0.332
#> GSM553636 2 0.1501 0.85982 0.000 0.924 0.000 0.000 0.076 0.000
#> GSM553637 6 0.2378 0.80733 0.000 0.152 0.000 0.000 0.000 0.848
#> GSM553638 2 0.0000 0.90770 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM553639 2 0.0000 0.90770 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM553640 2 0.0000 0.90770 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM553641 3 0.0000 0.95452 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM553642 4 0.0000 0.91492 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM553643 4 0.0000 0.91492 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM553644 4 0.0000 0.91492 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM553645 4 0.1556 0.88123 0.000 0.000 0.080 0.920 0.000 0.000
#> GSM553646 4 0.0000 0.91492 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM553647 4 0.0000 0.91492 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM553648 3 0.0000 0.95452 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM553649 3 0.0000 0.95452 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM553650 2 0.0000 0.90770 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM553651 2 0.1444 0.86276 0.000 0.928 0.000 0.000 0.072 0.000
#> GSM553652 2 0.0000 0.90770 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 individual(p) k
#> MAD:pam 57 0.0709 2
#> MAD:pam 56 0.0867 3
#> MAD:pam 54 0.0971 4
#> MAD:pam 51 0.1343 5
#> MAD:pam 55 0.0640 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.861 0.867 0.947 0.2635 0.733 0.733
#> 3 3 0.535 0.778 0.874 1.3133 0.618 0.494
#> 4 4 0.766 0.833 0.901 0.2006 0.779 0.492
#> 5 5 0.863 0.860 0.943 0.0585 0.889 0.624
#> 6 6 0.843 0.779 0.912 0.0123 0.996 0.984
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
#> GSM553595 1 0.0000 0.9588 1.000 0.000
#> GSM553596 1 0.0000 0.9588 1.000 0.000
#> GSM553597 1 0.0000 0.9588 1.000 0.000
#> GSM553598 1 0.0000 0.9588 1.000 0.000
#> GSM553599 1 0.0000 0.9588 1.000 0.000
#> GSM553600 1 0.0376 0.9579 0.996 0.004
#> GSM553601 1 0.0000 0.9588 1.000 0.000
#> GSM553602 1 0.0376 0.9579 0.996 0.004
#> GSM553603 1 0.0000 0.9588 1.000 0.000
#> GSM553604 1 0.0000 0.9588 1.000 0.000
#> GSM553605 1 0.0000 0.9588 1.000 0.000
#> GSM553606 1 0.2043 0.9330 0.968 0.032
#> GSM553607 1 0.2043 0.9330 0.968 0.032
#> GSM553608 2 0.0376 0.8051 0.004 0.996
#> GSM553609 1 0.9795 0.0470 0.584 0.416
#> GSM553610 1 0.2043 0.9330 0.968 0.032
#> GSM553611 2 0.2043 0.8038 0.032 0.968
#> GSM553612 2 0.9552 0.5790 0.376 0.624
#> GSM553613 1 0.2043 0.9330 0.968 0.032
#> GSM553614 1 0.0376 0.9579 0.996 0.004
#> GSM553615 1 0.0376 0.9579 0.996 0.004
#> GSM553616 1 0.0376 0.9579 0.996 0.004
#> GSM553617 1 0.0376 0.9579 0.996 0.004
#> GSM553618 1 0.0000 0.9588 1.000 0.000
#> GSM553619 1 0.0000 0.9588 1.000 0.000
#> GSM553620 1 0.0376 0.9579 0.996 0.004
#> GSM553621 1 0.0376 0.9579 0.996 0.004
#> GSM553622 1 0.0376 0.9579 0.996 0.004
#> GSM553623 1 0.0376 0.9579 0.996 0.004
#> GSM553624 1 0.2236 0.9335 0.964 0.036
#> GSM553625 1 0.0376 0.9579 0.996 0.004
#> GSM553626 1 0.0376 0.9579 0.996 0.004
#> GSM553627 1 0.0376 0.9579 0.996 0.004
#> GSM553628 1 0.0376 0.9579 0.996 0.004
#> GSM553629 1 0.0000 0.9588 1.000 0.000
#> GSM553630 1 0.0376 0.9579 0.996 0.004
#> GSM553631 1 0.0000 0.9588 1.000 0.000
#> GSM553632 1 0.0376 0.9579 0.996 0.004
#> GSM553633 1 0.0000 0.9588 1.000 0.000
#> GSM553634 1 0.9909 -0.0678 0.556 0.444
#> GSM553635 1 0.2043 0.9330 0.968 0.032
#> GSM553636 2 0.9608 0.5620 0.384 0.616
#> GSM553637 1 0.2043 0.9330 0.968 0.032
#> GSM553638 2 0.8327 0.7009 0.264 0.736
#> GSM553639 2 0.0376 0.8051 0.004 0.996
#> GSM553640 1 0.9909 -0.0678 0.556 0.444
#> GSM553641 1 0.0000 0.9588 1.000 0.000
#> GSM553642 1 0.0000 0.9588 1.000 0.000
#> GSM553643 1 0.0000 0.9588 1.000 0.000
#> GSM553644 1 0.0000 0.9588 1.000 0.000
#> GSM553645 1 0.0000 0.9588 1.000 0.000
#> GSM553646 1 0.0000 0.9588 1.000 0.000
#> GSM553647 1 0.0000 0.9588 1.000 0.000
#> GSM553648 1 0.0000 0.9588 1.000 0.000
#> GSM553649 1 0.0000 0.9588 1.000 0.000
#> GSM553650 2 0.0376 0.8051 0.004 0.996
#> GSM553651 2 0.9522 0.5856 0.372 0.628
#> GSM553652 2 0.1184 0.8065 0.016 0.984
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> GSM553595 1 0.6045 0.657 0.620 0.000 0.380
#> GSM553596 1 0.5650 0.699 0.688 0.000 0.312
#> GSM553597 1 0.6008 0.666 0.628 0.000 0.372
#> GSM553598 3 0.0000 0.843 0.000 0.000 1.000
#> GSM553599 1 0.3896 0.824 0.888 0.060 0.052
#> GSM553600 1 0.2066 0.813 0.940 0.060 0.000
#> GSM553601 1 0.4452 0.781 0.808 0.000 0.192
#> GSM553602 1 0.1753 0.828 0.952 0.000 0.048
#> GSM553603 1 0.5678 0.698 0.684 0.000 0.316
#> GSM553604 1 0.5465 0.723 0.712 0.000 0.288
#> GSM553605 3 0.0000 0.843 0.000 0.000 1.000
#> GSM553606 3 0.5334 0.779 0.060 0.120 0.820
#> GSM553607 3 0.4521 0.735 0.004 0.180 0.816
#> GSM553608 2 0.0000 0.909 0.000 1.000 0.000
#> GSM553609 2 0.5404 0.651 0.004 0.740 0.256
#> GSM553610 3 0.5334 0.779 0.060 0.120 0.820
#> GSM553611 2 0.0000 0.909 0.000 1.000 0.000
#> GSM553612 2 0.0000 0.909 0.000 1.000 0.000
#> GSM553613 3 0.3340 0.784 0.000 0.120 0.880
#> GSM553614 1 0.4346 0.785 0.816 0.000 0.184
#> GSM553615 1 0.1964 0.814 0.944 0.056 0.000
#> GSM553616 1 0.2066 0.813 0.940 0.060 0.000
#> GSM553617 1 0.2066 0.813 0.940 0.060 0.000
#> GSM553618 1 0.5905 0.640 0.648 0.000 0.352
#> GSM553619 3 0.3116 0.789 0.108 0.000 0.892
#> GSM553620 1 0.3412 0.821 0.876 0.000 0.124
#> GSM553621 1 0.0000 0.821 1.000 0.000 0.000
#> GSM553622 1 0.0000 0.821 1.000 0.000 0.000
#> GSM553623 1 0.3337 0.822 0.908 0.060 0.032
#> GSM553624 1 0.3325 0.817 0.904 0.076 0.020
#> GSM553625 1 0.0237 0.822 0.996 0.000 0.004
#> GSM553626 1 0.0000 0.821 1.000 0.000 0.000
#> GSM553627 1 0.1643 0.829 0.956 0.000 0.044
#> GSM553628 1 0.2066 0.813 0.940 0.060 0.000
#> GSM553629 1 0.3791 0.824 0.892 0.060 0.048
#> GSM553630 1 0.0000 0.821 1.000 0.000 0.000
#> GSM553631 1 0.5591 0.707 0.696 0.000 0.304
#> GSM553632 1 0.0000 0.821 1.000 0.000 0.000
#> GSM553633 3 0.0237 0.841 0.004 0.000 0.996
#> GSM553634 2 0.4465 0.760 0.004 0.820 0.176
#> GSM553635 2 0.4682 0.744 0.004 0.804 0.192
#> GSM553636 2 0.0000 0.909 0.000 1.000 0.000
#> GSM553637 3 0.4521 0.735 0.004 0.180 0.816
#> GSM553638 2 0.0000 0.909 0.000 1.000 0.000
#> GSM553639 2 0.0000 0.909 0.000 1.000 0.000
#> GSM553640 2 0.4692 0.761 0.012 0.820 0.168
#> GSM553641 3 0.0000 0.843 0.000 0.000 1.000
#> GSM553642 1 0.5291 0.758 0.732 0.000 0.268
#> GSM553643 1 0.5431 0.747 0.716 0.000 0.284
#> GSM553644 1 0.5291 0.758 0.732 0.000 0.268
#> GSM553645 3 0.6309 -0.442 0.496 0.000 0.504
#> GSM553646 1 0.5327 0.755 0.728 0.000 0.272
#> GSM553647 1 0.5760 0.693 0.672 0.000 0.328
#> GSM553648 3 0.0000 0.843 0.000 0.000 1.000
#> GSM553649 3 0.0000 0.843 0.000 0.000 1.000
#> GSM553650 2 0.0000 0.909 0.000 1.000 0.000
#> GSM553651 2 0.0000 0.909 0.000 1.000 0.000
#> GSM553652 2 0.0000 0.909 0.000 1.000 0.000
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> GSM553595 4 0.1389 0.860 0.048 0.000 0.000 0.952
#> GSM553596 4 0.3978 0.790 0.056 0.000 0.108 0.836
#> GSM553597 4 0.1557 0.861 0.056 0.000 0.000 0.944
#> GSM553598 3 0.1940 0.932 0.000 0.000 0.924 0.076
#> GSM553599 1 0.0000 0.908 1.000 0.000 0.000 0.000
#> GSM553600 1 0.1389 0.904 0.952 0.000 0.048 0.000
#> GSM553601 1 0.3486 0.695 0.812 0.000 0.000 0.188
#> GSM553602 1 0.2089 0.900 0.932 0.000 0.048 0.020
#> GSM553603 4 0.1389 0.860 0.048 0.000 0.000 0.952
#> GSM553604 4 0.4004 0.791 0.164 0.000 0.024 0.812
#> GSM553605 3 0.1940 0.932 0.000 0.000 0.924 0.076
#> GSM553606 3 0.4890 0.632 0.004 0.236 0.736 0.024
#> GSM553607 2 0.4388 0.843 0.004 0.812 0.136 0.048
#> GSM553608 2 0.0000 0.935 0.000 1.000 0.000 0.000
#> GSM553609 2 0.3587 0.875 0.004 0.860 0.104 0.032
#> GSM553610 3 0.1576 0.893 0.004 0.048 0.948 0.000
#> GSM553611 2 0.0000 0.935 0.000 1.000 0.000 0.000
#> GSM553612 2 0.0000 0.935 0.000 1.000 0.000 0.000
#> GSM553613 3 0.2161 0.904 0.004 0.048 0.932 0.016
#> GSM553614 1 0.1022 0.892 0.968 0.000 0.000 0.032
#> GSM553615 1 0.0188 0.907 0.996 0.000 0.000 0.004
#> GSM553616 1 0.0000 0.908 1.000 0.000 0.000 0.000
#> GSM553617 1 0.0000 0.908 1.000 0.000 0.000 0.000
#> GSM553618 4 0.4901 0.773 0.112 0.000 0.108 0.780
#> GSM553619 4 0.5116 0.764 0.128 0.000 0.108 0.764
#> GSM553620 4 0.4406 0.676 0.300 0.000 0.000 0.700
#> GSM553621 1 0.5865 0.333 0.612 0.000 0.048 0.340
#> GSM553622 1 0.1975 0.901 0.936 0.000 0.048 0.016
#> GSM553623 1 0.0000 0.908 1.000 0.000 0.000 0.000
#> GSM553624 1 0.0188 0.908 0.996 0.000 0.004 0.000
#> GSM553625 1 0.4776 0.202 0.624 0.000 0.000 0.376
#> GSM553626 1 0.1576 0.904 0.948 0.000 0.048 0.004
#> GSM553627 1 0.1389 0.904 0.952 0.000 0.048 0.000
#> GSM553628 1 0.1389 0.904 0.952 0.000 0.048 0.000
#> GSM553629 1 0.0000 0.908 1.000 0.000 0.000 0.000
#> GSM553630 4 0.4999 0.238 0.492 0.000 0.000 0.508
#> GSM553631 4 0.4989 0.228 0.472 0.000 0.000 0.528
#> GSM553632 1 0.1576 0.904 0.948 0.000 0.048 0.004
#> GSM553633 4 0.1722 0.857 0.048 0.000 0.008 0.944
#> GSM553634 2 0.2611 0.890 0.008 0.896 0.096 0.000
#> GSM553635 2 0.3526 0.878 0.004 0.864 0.100 0.032
#> GSM553636 2 0.0000 0.935 0.000 1.000 0.000 0.000
#> GSM553637 2 0.4388 0.843 0.004 0.812 0.136 0.048
#> GSM553638 2 0.0000 0.935 0.000 1.000 0.000 0.000
#> GSM553639 2 0.0000 0.935 0.000 1.000 0.000 0.000
#> GSM553640 2 0.2593 0.851 0.104 0.892 0.004 0.000
#> GSM553641 3 0.1940 0.932 0.000 0.000 0.924 0.076
#> GSM553642 4 0.2281 0.850 0.096 0.000 0.000 0.904
#> GSM553643 4 0.1389 0.860 0.048 0.000 0.000 0.952
#> GSM553644 4 0.2281 0.850 0.096 0.000 0.000 0.904
#> GSM553645 4 0.1389 0.860 0.048 0.000 0.000 0.952
#> GSM553646 4 0.2635 0.853 0.076 0.000 0.020 0.904
#> GSM553647 4 0.1389 0.860 0.048 0.000 0.000 0.952
#> GSM553648 3 0.1940 0.932 0.000 0.000 0.924 0.076
#> GSM553649 3 0.1940 0.932 0.000 0.000 0.924 0.076
#> GSM553650 2 0.0000 0.935 0.000 1.000 0.000 0.000
#> GSM553651 2 0.0000 0.935 0.000 1.000 0.000 0.000
#> GSM553652 2 0.0000 0.935 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
#> GSM553595 4 0.000 0.873 0.000 0.00 0.000 1.000 0.000
#> GSM553596 4 0.000 0.873 0.000 0.00 0.000 1.000 0.000
#> GSM553597 4 0.000 0.873 0.000 0.00 0.000 1.000 0.000
#> GSM553598 3 0.000 0.968 0.000 0.00 1.000 0.000 0.000
#> GSM553599 1 0.000 0.919 1.000 0.00 0.000 0.000 0.000
#> GSM553600 1 0.000 0.919 1.000 0.00 0.000 0.000 0.000
#> GSM553601 1 0.415 0.383 0.612 0.00 0.000 0.388 0.000
#> GSM553602 1 0.000 0.919 1.000 0.00 0.000 0.000 0.000
#> GSM553603 4 0.000 0.873 0.000 0.00 0.000 1.000 0.000
#> GSM553604 1 0.281 0.726 0.832 0.00 0.000 0.168 0.000
#> GSM553605 3 0.000 0.968 0.000 0.00 1.000 0.000 0.000
#> GSM553606 5 0.281 0.865 0.000 0.00 0.168 0.000 0.832
#> GSM553607 5 0.000 0.877 0.000 0.00 0.000 0.000 1.000
#> GSM553608 2 0.000 0.975 0.000 1.00 0.000 0.000 0.000
#> GSM553609 2 0.000 0.975 0.000 1.00 0.000 0.000 0.000
#> GSM553610 5 0.281 0.865 0.000 0.00 0.168 0.000 0.832
#> GSM553611 2 0.000 0.975 0.000 1.00 0.000 0.000 0.000
#> GSM553612 2 0.000 0.975 0.000 1.00 0.000 0.000 0.000
#> GSM553613 3 0.000 0.968 0.000 0.00 1.000 0.000 0.000
#> GSM553614 4 0.281 0.778 0.168 0.00 0.000 0.832 0.000
#> GSM553615 1 0.000 0.919 1.000 0.00 0.000 0.000 0.000
#> GSM553616 1 0.000 0.919 1.000 0.00 0.000 0.000 0.000
#> GSM553617 1 0.000 0.919 1.000 0.00 0.000 0.000 0.000
#> GSM553618 4 0.141 0.843 0.000 0.00 0.000 0.940 0.060
#> GSM553619 3 0.281 0.792 0.000 0.00 0.832 0.000 0.168
#> GSM553620 4 0.281 0.778 0.168 0.00 0.000 0.832 0.000
#> GSM553621 1 0.413 0.275 0.620 0.00 0.000 0.380 0.000
#> GSM553622 1 0.000 0.919 1.000 0.00 0.000 0.000 0.000
#> GSM553623 1 0.000 0.919 1.000 0.00 0.000 0.000 0.000
#> GSM553624 2 0.342 0.628 0.240 0.76 0.000 0.000 0.000
#> GSM553625 4 0.327 0.726 0.220 0.00 0.000 0.780 0.000
#> GSM553626 1 0.000 0.919 1.000 0.00 0.000 0.000 0.000
#> GSM553627 1 0.000 0.919 1.000 0.00 0.000 0.000 0.000
#> GSM553628 1 0.000 0.919 1.000 0.00 0.000 0.000 0.000
#> GSM553629 1 0.000 0.919 1.000 0.00 0.000 0.000 0.000
#> GSM553630 4 0.418 0.389 0.400 0.00 0.000 0.600 0.000
#> GSM553631 4 0.281 0.778 0.168 0.00 0.000 0.832 0.000
#> GSM553632 1 0.000 0.919 1.000 0.00 0.000 0.000 0.000
#> GSM553633 4 0.426 0.143 0.000 0.00 0.436 0.564 0.000
#> GSM553634 2 0.000 0.975 0.000 1.00 0.000 0.000 0.000
#> GSM553635 2 0.000 0.975 0.000 1.00 0.000 0.000 0.000
#> GSM553636 2 0.000 0.975 0.000 1.00 0.000 0.000 0.000
#> GSM553637 5 0.000 0.877 0.000 0.00 0.000 0.000 1.000
#> GSM553638 2 0.000 0.975 0.000 1.00 0.000 0.000 0.000
#> GSM553639 2 0.000 0.975 0.000 1.00 0.000 0.000 0.000
#> GSM553640 2 0.000 0.975 0.000 1.00 0.000 0.000 0.000
#> GSM553641 3 0.000 0.968 0.000 0.00 1.000 0.000 0.000
#> GSM553642 4 0.000 0.873 0.000 0.00 0.000 1.000 0.000
#> GSM553643 4 0.000 0.873 0.000 0.00 0.000 1.000 0.000
#> GSM553644 4 0.000 0.873 0.000 0.00 0.000 1.000 0.000
#> GSM553645 4 0.000 0.873 0.000 0.00 0.000 1.000 0.000
#> GSM553646 4 0.000 0.873 0.000 0.00 0.000 1.000 0.000
#> GSM553647 4 0.000 0.873 0.000 0.00 0.000 1.000 0.000
#> GSM553648 3 0.000 0.968 0.000 0.00 1.000 0.000 0.000
#> GSM553649 3 0.000 0.968 0.000 0.00 1.000 0.000 0.000
#> GSM553650 2 0.000 0.975 0.000 1.00 0.000 0.000 0.000
#> GSM553651 2 0.000 0.975 0.000 1.00 0.000 0.000 0.000
#> GSM553652 2 0.000 0.975 0.000 1.00 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
#> GSM553595 4 0.0000 0.790 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM553596 4 0.2340 0.717 0.000 0.000 0.000 0.852 0.148 0.000
#> GSM553597 4 0.0632 0.783 0.000 0.000 0.000 0.976 0.024 0.000
#> GSM553598 3 0.1141 0.942 0.000 0.000 0.948 0.000 0.052 0.000
#> GSM553599 1 0.0632 0.885 0.976 0.000 0.000 0.000 0.024 0.000
#> GSM553600 1 0.0363 0.889 0.988 0.000 0.000 0.000 0.000 0.012
#> GSM553601 1 0.3636 0.487 0.676 0.000 0.000 0.320 0.004 0.000
#> GSM553602 1 0.1500 0.864 0.936 0.000 0.000 0.000 0.052 0.012
#> GSM553603 4 0.0000 0.790 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM553604 1 0.4150 0.447 0.652 0.000 0.000 0.320 0.028 0.000
#> GSM553605 3 0.0000 0.989 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM553606 6 0.3023 0.702 0.000 0.000 0.232 0.000 0.000 0.768
#> GSM553607 6 0.0363 0.701 0.000 0.012 0.000 0.000 0.000 0.988
#> GSM553608 2 0.0000 0.950 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM553609 2 0.0146 0.949 0.000 0.996 0.000 0.000 0.000 0.004
#> GSM553610 6 0.3607 0.602 0.000 0.000 0.348 0.000 0.000 0.652
#> GSM553611 2 0.0000 0.950 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM553612 2 0.0000 0.950 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM553613 3 0.0000 0.989 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM553614 4 0.3728 0.544 0.344 0.000 0.000 0.652 0.004 0.000
#> GSM553615 1 0.0146 0.892 0.996 0.000 0.000 0.000 0.004 0.000
#> GSM553616 1 0.0146 0.892 0.996 0.000 0.000 0.000 0.004 0.000
#> GSM553617 1 0.0146 0.892 0.996 0.000 0.000 0.000 0.004 0.000
#> GSM553618 4 0.3835 0.567 0.000 0.000 0.000 0.684 0.300 0.016
#> GSM553619 5 0.2001 0.000 0.000 0.000 0.040 0.000 0.912 0.048
#> GSM553620 4 0.3288 0.609 0.276 0.000 0.000 0.724 0.000 0.000
#> GSM553621 1 0.4670 0.159 0.580 0.000 0.000 0.380 0.028 0.012
#> GSM553622 1 0.1074 0.874 0.960 0.000 0.000 0.000 0.028 0.012
#> GSM553623 1 0.0146 0.892 0.996 0.000 0.000 0.000 0.004 0.000
#> GSM553624 2 0.4110 0.323 0.376 0.608 0.000 0.000 0.016 0.000
#> GSM553625 4 0.3756 0.530 0.352 0.000 0.000 0.644 0.004 0.000
#> GSM553626 1 0.0000 0.891 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM553627 1 0.0692 0.884 0.976 0.000 0.000 0.004 0.020 0.000
#> GSM553628 1 0.0000 0.891 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM553629 1 0.0146 0.892 0.996 0.000 0.000 0.000 0.004 0.000
#> GSM553630 4 0.3756 0.413 0.400 0.000 0.000 0.600 0.000 0.000
#> GSM553631 4 0.4463 0.560 0.056 0.000 0.000 0.652 0.292 0.000
#> GSM553632 1 0.0363 0.889 0.988 0.000 0.000 0.000 0.000 0.012
#> GSM553633 4 0.3647 0.292 0.000 0.000 0.360 0.640 0.000 0.000
#> GSM553634 2 0.0547 0.942 0.000 0.980 0.000 0.000 0.020 0.000
#> GSM553635 2 0.0547 0.942 0.000 0.980 0.000 0.000 0.020 0.000
#> GSM553636 2 0.0363 0.947 0.000 0.988 0.000 0.000 0.012 0.000
#> GSM553637 6 0.0363 0.701 0.000 0.012 0.000 0.000 0.000 0.988
#> GSM553638 2 0.0000 0.950 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM553639 2 0.0363 0.947 0.000 0.988 0.000 0.000 0.012 0.000
#> GSM553640 2 0.0858 0.939 0.004 0.968 0.000 0.000 0.028 0.000
#> GSM553641 3 0.0000 0.989 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM553642 4 0.0146 0.790 0.000 0.000 0.000 0.996 0.004 0.000
#> GSM553643 4 0.0000 0.790 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM553644 4 0.0146 0.790 0.000 0.000 0.000 0.996 0.004 0.000
#> GSM553645 4 0.0146 0.790 0.000 0.000 0.000 0.996 0.004 0.000
#> GSM553646 4 0.0146 0.790 0.000 0.000 0.000 0.996 0.004 0.000
#> GSM553647 4 0.0000 0.790 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM553648 3 0.0000 0.989 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM553649 3 0.0000 0.989 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM553650 2 0.0000 0.950 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM553651 2 0.0363 0.947 0.000 0.988 0.000 0.000 0.012 0.000
#> GSM553652 2 0.0000 0.950 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 individual(p) k
#> MAD:mclust 55 0.60562 2
#> MAD:mclust 57 0.46096 3
#> MAD:mclust 54 0.00905 4
#> MAD:mclust 54 0.06476 5
#> MAD:mclust 51 0.02592 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.861 0.934 0.971 0.5060 0.494 0.494
#> 3 3 0.824 0.859 0.940 0.2594 0.789 0.609
#> 4 4 0.684 0.745 0.869 0.1729 0.770 0.456
#> 5 5 0.696 0.745 0.852 0.0661 0.863 0.529
#> 6 6 0.698 0.591 0.787 0.0358 0.894 0.561
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
#> GSM553595 1 0.7883 0.706 0.764 0.236
#> GSM553596 2 0.1633 0.956 0.024 0.976
#> GSM553597 1 0.0000 0.967 1.000 0.000
#> GSM553598 2 0.0000 0.973 0.000 1.000
#> GSM553599 1 0.0000 0.967 1.000 0.000
#> GSM553600 1 0.0000 0.967 1.000 0.000
#> GSM553601 1 0.0000 0.967 1.000 0.000
#> GSM553602 1 0.0000 0.967 1.000 0.000
#> GSM553603 1 0.0376 0.964 0.996 0.004
#> GSM553604 1 0.0000 0.967 1.000 0.000
#> GSM553605 2 0.0000 0.973 0.000 1.000
#> GSM553606 2 0.0000 0.973 0.000 1.000
#> GSM553607 2 0.0000 0.973 0.000 1.000
#> GSM553608 2 0.0000 0.973 0.000 1.000
#> GSM553609 2 0.0000 0.973 0.000 1.000
#> GSM553610 2 0.0000 0.973 0.000 1.000
#> GSM553611 2 0.0000 0.973 0.000 1.000
#> GSM553612 2 0.0000 0.973 0.000 1.000
#> GSM553613 2 0.0000 0.973 0.000 1.000
#> GSM553614 1 0.0000 0.967 1.000 0.000
#> GSM553615 1 0.0000 0.967 1.000 0.000
#> GSM553616 1 0.0000 0.967 1.000 0.000
#> GSM553617 1 0.0000 0.967 1.000 0.000
#> GSM553618 2 0.5629 0.854 0.132 0.868
#> GSM553619 1 0.9933 0.136 0.548 0.452
#> GSM553620 1 0.0000 0.967 1.000 0.000
#> GSM553621 1 0.0000 0.967 1.000 0.000
#> GSM553622 1 0.0000 0.967 1.000 0.000
#> GSM553623 1 0.0000 0.967 1.000 0.000
#> GSM553624 1 0.0376 0.964 0.996 0.004
#> GSM553625 1 0.0000 0.967 1.000 0.000
#> GSM553626 1 0.0000 0.967 1.000 0.000
#> GSM553627 1 0.0000 0.967 1.000 0.000
#> GSM553628 1 0.0000 0.967 1.000 0.000
#> GSM553629 1 0.0000 0.967 1.000 0.000
#> GSM553630 1 0.0000 0.967 1.000 0.000
#> GSM553631 1 0.0000 0.967 1.000 0.000
#> GSM553632 1 0.0000 0.967 1.000 0.000
#> GSM553633 2 0.0000 0.973 0.000 1.000
#> GSM553634 2 0.0938 0.965 0.012 0.988
#> GSM553635 2 0.0000 0.973 0.000 1.000
#> GSM553636 2 0.4431 0.896 0.092 0.908
#> GSM553637 2 0.0000 0.973 0.000 1.000
#> GSM553638 2 0.0000 0.973 0.000 1.000
#> GSM553639 2 0.0000 0.973 0.000 1.000
#> GSM553640 2 0.8207 0.681 0.256 0.744
#> GSM553641 2 0.0000 0.973 0.000 1.000
#> GSM553642 1 0.0000 0.967 1.000 0.000
#> GSM553643 1 0.5408 0.852 0.876 0.124
#> GSM553644 1 0.0000 0.967 1.000 0.000
#> GSM553645 2 0.0000 0.973 0.000 1.000
#> GSM553646 1 0.1184 0.955 0.984 0.016
#> GSM553647 1 0.5629 0.844 0.868 0.132
#> GSM553648 2 0.0000 0.973 0.000 1.000
#> GSM553649 2 0.0000 0.973 0.000 1.000
#> GSM553650 2 0.0000 0.973 0.000 1.000
#> GSM553651 2 0.6712 0.801 0.176 0.824
#> GSM553652 2 0.0000 0.973 0.000 1.000
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> GSM553595 1 0.5678 0.559 0.684 0.000 0.316
#> GSM553596 3 0.5845 0.512 0.308 0.004 0.688
#> GSM553597 1 0.0237 0.922 0.996 0.000 0.004
#> GSM553598 3 0.0000 0.916 0.000 0.000 1.000
#> GSM553599 1 0.0747 0.917 0.984 0.016 0.000
#> GSM553600 1 0.0892 0.915 0.980 0.020 0.000
#> GSM553601 1 0.0000 0.922 1.000 0.000 0.000
#> GSM553602 1 0.0000 0.922 1.000 0.000 0.000
#> GSM553603 1 0.0237 0.922 0.996 0.000 0.004
#> GSM553604 1 0.0237 0.922 0.996 0.000 0.004
#> GSM553605 3 0.0237 0.917 0.000 0.004 0.996
#> GSM553606 3 0.5905 0.470 0.000 0.352 0.648
#> GSM553607 2 0.2066 0.909 0.000 0.940 0.060
#> GSM553608 2 0.0000 0.950 0.000 1.000 0.000
#> GSM553609 2 0.0747 0.943 0.000 0.984 0.016
#> GSM553610 3 0.1964 0.883 0.000 0.056 0.944
#> GSM553611 2 0.0000 0.950 0.000 1.000 0.000
#> GSM553612 2 0.3816 0.820 0.000 0.852 0.148
#> GSM553613 3 0.0237 0.917 0.000 0.004 0.996
#> GSM553614 1 0.0000 0.922 1.000 0.000 0.000
#> GSM553615 1 0.1753 0.895 0.952 0.048 0.000
#> GSM553616 2 0.4235 0.761 0.176 0.824 0.000
#> GSM553617 1 0.0424 0.920 0.992 0.008 0.000
#> GSM553618 1 0.7493 -0.027 0.488 0.036 0.476
#> GSM553619 1 0.7205 0.628 0.708 0.192 0.100
#> GSM553620 1 0.0237 0.922 0.996 0.000 0.004
#> GSM553621 1 0.0237 0.922 0.996 0.000 0.004
#> GSM553622 1 0.0000 0.922 1.000 0.000 0.000
#> GSM553623 1 0.6225 0.222 0.568 0.432 0.000
#> GSM553624 2 0.4750 0.706 0.216 0.784 0.000
#> GSM553625 1 0.0237 0.922 0.996 0.000 0.004
#> GSM553626 1 0.0424 0.920 0.992 0.008 0.000
#> GSM553627 1 0.0000 0.922 1.000 0.000 0.000
#> GSM553628 1 0.1753 0.895 0.952 0.048 0.000
#> GSM553629 2 0.0424 0.947 0.008 0.992 0.000
#> GSM553630 1 0.0000 0.922 1.000 0.000 0.000
#> GSM553631 1 0.0237 0.922 0.996 0.004 0.000
#> GSM553632 1 0.0424 0.920 0.992 0.008 0.000
#> GSM553633 3 0.0424 0.912 0.008 0.000 0.992
#> GSM553634 2 0.0000 0.950 0.000 1.000 0.000
#> GSM553635 2 0.0000 0.950 0.000 1.000 0.000
#> GSM553636 2 0.1031 0.935 0.024 0.976 0.000
#> GSM553637 2 0.0892 0.941 0.000 0.980 0.020
#> GSM553638 2 0.0747 0.943 0.000 0.984 0.016
#> GSM553639 2 0.0000 0.950 0.000 1.000 0.000
#> GSM553640 2 0.0237 0.949 0.004 0.996 0.000
#> GSM553641 3 0.0237 0.917 0.000 0.004 0.996
#> GSM553642 1 0.0237 0.922 0.996 0.000 0.004
#> GSM553643 1 0.3752 0.807 0.856 0.000 0.144
#> GSM553644 1 0.0237 0.922 0.996 0.000 0.004
#> GSM553645 3 0.1031 0.903 0.024 0.000 0.976
#> GSM553646 1 0.2066 0.886 0.940 0.000 0.060
#> GSM553647 1 0.2537 0.870 0.920 0.000 0.080
#> GSM553648 3 0.0237 0.917 0.000 0.004 0.996
#> GSM553649 3 0.0237 0.917 0.000 0.004 0.996
#> GSM553650 2 0.0000 0.950 0.000 1.000 0.000
#> GSM553651 2 0.0237 0.949 0.004 0.996 0.000
#> GSM553652 2 0.0000 0.950 0.000 1.000 0.000
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> GSM553595 3 0.3751 0.7420 0.004 0.000 0.800 0.196
#> GSM553596 4 0.7242 0.0579 0.000 0.148 0.376 0.476
#> GSM553597 4 0.0000 0.7480 0.000 0.000 0.000 1.000
#> GSM553598 3 0.2124 0.8754 0.000 0.028 0.932 0.040
#> GSM553599 1 0.1151 0.7655 0.968 0.008 0.000 0.024
#> GSM553600 4 0.4855 0.2657 0.400 0.000 0.000 0.600
#> GSM553601 4 0.3377 0.6853 0.140 0.000 0.012 0.848
#> GSM553602 1 0.4040 0.6474 0.752 0.000 0.000 0.248
#> GSM553603 4 0.5582 0.6692 0.168 0.000 0.108 0.724
#> GSM553604 1 0.1406 0.7494 0.960 0.000 0.024 0.016
#> GSM553605 3 0.0336 0.8947 0.000 0.008 0.992 0.000
#> GSM553606 2 0.2149 0.8707 0.000 0.912 0.088 0.000
#> GSM553607 2 0.0188 0.9283 0.000 0.996 0.000 0.004
#> GSM553608 2 0.0592 0.9281 0.016 0.984 0.000 0.000
#> GSM553609 2 0.0000 0.9293 0.000 1.000 0.000 0.000
#> GSM553610 3 0.4624 0.4778 0.000 0.340 0.660 0.000
#> GSM553611 2 0.1902 0.9065 0.064 0.932 0.004 0.000
#> GSM553612 2 0.2654 0.8654 0.004 0.888 0.108 0.000
#> GSM553613 3 0.0336 0.8947 0.000 0.008 0.992 0.000
#> GSM553614 4 0.0000 0.7480 0.000 0.000 0.000 1.000
#> GSM553615 1 0.5244 0.3982 0.600 0.012 0.000 0.388
#> GSM553616 2 0.2256 0.8885 0.020 0.924 0.000 0.056
#> GSM553617 4 0.4761 0.3419 0.372 0.000 0.000 0.628
#> GSM553618 4 0.2546 0.7129 0.000 0.060 0.028 0.912
#> GSM553619 4 0.1867 0.7145 0.000 0.072 0.000 0.928
#> GSM553620 4 0.2081 0.7535 0.084 0.000 0.000 0.916
#> GSM553621 4 0.2408 0.7488 0.104 0.000 0.000 0.896
#> GSM553622 4 0.1867 0.7553 0.072 0.000 0.000 0.928
#> GSM553623 1 0.5147 0.6715 0.740 0.200 0.000 0.060
#> GSM553624 1 0.3873 0.6625 0.772 0.228 0.000 0.000
#> GSM553625 4 0.4250 0.6282 0.276 0.000 0.000 0.724
#> GSM553626 1 0.3311 0.7342 0.828 0.000 0.000 0.172
#> GSM553627 1 0.1661 0.7575 0.944 0.000 0.004 0.052
#> GSM553628 1 0.2704 0.7625 0.876 0.000 0.000 0.124
#> GSM553629 2 0.1520 0.9195 0.020 0.956 0.000 0.024
#> GSM553630 4 0.4776 0.4841 0.376 0.000 0.000 0.624
#> GSM553631 4 0.0000 0.7480 0.000 0.000 0.000 1.000
#> GSM553632 1 0.3688 0.7006 0.792 0.000 0.000 0.208
#> GSM553633 3 0.0188 0.8932 0.000 0.000 0.996 0.004
#> GSM553634 2 0.0000 0.9293 0.000 1.000 0.000 0.000
#> GSM553635 2 0.0000 0.9293 0.000 1.000 0.000 0.000
#> GSM553636 1 0.3208 0.7035 0.848 0.148 0.004 0.000
#> GSM553637 2 0.0000 0.9293 0.000 1.000 0.000 0.000
#> GSM553638 2 0.2662 0.8827 0.016 0.900 0.084 0.000
#> GSM553639 2 0.1792 0.9030 0.068 0.932 0.000 0.000
#> GSM553640 2 0.0707 0.9268 0.020 0.980 0.000 0.000
#> GSM553641 3 0.0336 0.8947 0.000 0.008 0.992 0.000
#> GSM553642 4 0.3972 0.7109 0.204 0.000 0.008 0.788
#> GSM553643 3 0.3149 0.8324 0.088 0.000 0.880 0.032
#> GSM553644 4 0.5018 0.5860 0.332 0.000 0.012 0.656
#> GSM553645 3 0.0592 0.8907 0.016 0.000 0.984 0.000
#> GSM553646 3 0.5694 0.6678 0.224 0.000 0.696 0.080
#> GSM553647 3 0.3052 0.8182 0.136 0.000 0.860 0.004
#> GSM553648 3 0.0336 0.8947 0.000 0.008 0.992 0.000
#> GSM553649 3 0.0188 0.8942 0.000 0.004 0.996 0.000
#> GSM553650 2 0.0592 0.9281 0.016 0.984 0.000 0.000
#> GSM553651 2 0.4989 0.0532 0.472 0.528 0.000 0.000
#> GSM553652 2 0.0188 0.9294 0.004 0.996 0.000 0.000
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> GSM553595 3 0.5444 0.562 0.000 0.000 0.656 0.204 0.140
#> GSM553596 5 0.4560 0.609 0.000 0.060 0.160 0.016 0.764
#> GSM553597 5 0.3039 0.635 0.000 0.000 0.000 0.192 0.808
#> GSM553598 3 0.4434 0.100 0.000 0.000 0.536 0.004 0.460
#> GSM553599 1 0.0955 0.756 0.968 0.004 0.000 0.000 0.028
#> GSM553600 5 0.5204 0.464 0.368 0.000 0.000 0.052 0.580
#> GSM553601 5 0.3255 0.708 0.136 0.000 0.012 0.012 0.840
#> GSM553602 1 0.4701 0.662 0.704 0.000 0.000 0.236 0.060
#> GSM553603 4 0.3563 0.822 0.032 0.000 0.044 0.852 0.072
#> GSM553604 4 0.4449 0.262 0.388 0.000 0.004 0.604 0.004
#> GSM553605 3 0.0162 0.882 0.000 0.004 0.996 0.000 0.000
#> GSM553606 2 0.0771 0.918 0.004 0.976 0.020 0.000 0.000
#> GSM553607 2 0.0451 0.921 0.004 0.988 0.000 0.000 0.008
#> GSM553608 2 0.0609 0.919 0.020 0.980 0.000 0.000 0.000
#> GSM553609 2 0.0000 0.921 0.000 1.000 0.000 0.000 0.000
#> GSM553610 2 0.3550 0.709 0.004 0.760 0.236 0.000 0.000
#> GSM553611 2 0.2127 0.870 0.108 0.892 0.000 0.000 0.000
#> GSM553612 2 0.2747 0.877 0.016 0.884 0.088 0.012 0.000
#> GSM553613 3 0.0566 0.876 0.004 0.012 0.984 0.000 0.000
#> GSM553614 5 0.3684 0.503 0.000 0.000 0.000 0.280 0.720
#> GSM553615 5 0.5343 0.481 0.340 0.000 0.000 0.068 0.592
#> GSM553616 2 0.3478 0.816 0.004 0.828 0.000 0.032 0.136
#> GSM553617 5 0.3673 0.714 0.096 0.028 0.000 0.036 0.840
#> GSM553618 5 0.2430 0.721 0.020 0.004 0.052 0.012 0.912
#> GSM553619 5 0.0880 0.718 0.000 0.000 0.000 0.032 0.968
#> GSM553620 4 0.2773 0.766 0.000 0.000 0.000 0.836 0.164
#> GSM553621 4 0.1965 0.820 0.000 0.000 0.000 0.904 0.096
#> GSM553622 4 0.3904 0.752 0.052 0.000 0.000 0.792 0.156
#> GSM553623 5 0.4622 0.380 0.440 0.012 0.000 0.000 0.548
#> GSM553624 1 0.2104 0.765 0.916 0.060 0.000 0.024 0.000
#> GSM553625 5 0.5996 0.492 0.144 0.000 0.004 0.264 0.588
#> GSM553626 1 0.3622 0.758 0.816 0.000 0.000 0.136 0.048
#> GSM553627 1 0.2377 0.768 0.872 0.000 0.000 0.128 0.000
#> GSM553628 1 0.3058 0.767 0.860 0.000 0.000 0.096 0.044
#> GSM553629 2 0.4156 0.794 0.064 0.820 0.000 0.056 0.060
#> GSM553630 4 0.1915 0.831 0.040 0.000 0.000 0.928 0.032
#> GSM553631 5 0.3812 0.675 0.032 0.004 0.000 0.168 0.796
#> GSM553632 1 0.4779 0.397 0.588 0.000 0.000 0.388 0.024
#> GSM553633 3 0.0992 0.869 0.000 0.000 0.968 0.008 0.024
#> GSM553634 2 0.0162 0.921 0.004 0.996 0.000 0.000 0.000
#> GSM553635 2 0.0162 0.921 0.000 0.996 0.000 0.000 0.004
#> GSM553636 1 0.1978 0.745 0.928 0.024 0.000 0.044 0.004
#> GSM553637 2 0.0324 0.921 0.004 0.992 0.000 0.000 0.004
#> GSM553638 2 0.4069 0.806 0.096 0.792 0.112 0.000 0.000
#> GSM553639 2 0.2471 0.849 0.136 0.864 0.000 0.000 0.000
#> GSM553640 2 0.0486 0.922 0.004 0.988 0.000 0.004 0.004
#> GSM553641 3 0.0000 0.883 0.000 0.000 1.000 0.000 0.000
#> GSM553642 4 0.1956 0.839 0.008 0.000 0.012 0.928 0.052
#> GSM553643 4 0.3612 0.670 0.000 0.000 0.268 0.732 0.000
#> GSM553644 4 0.1405 0.838 0.008 0.000 0.016 0.956 0.020
#> GSM553645 3 0.0404 0.879 0.000 0.000 0.988 0.012 0.000
#> GSM553646 4 0.1569 0.830 0.008 0.000 0.044 0.944 0.004
#> GSM553647 4 0.3391 0.761 0.012 0.000 0.188 0.800 0.000
#> GSM553648 3 0.0000 0.883 0.000 0.000 1.000 0.000 0.000
#> GSM553649 3 0.0162 0.882 0.000 0.004 0.996 0.000 0.000
#> GSM553650 2 0.0510 0.920 0.016 0.984 0.000 0.000 0.000
#> GSM553651 1 0.3942 0.542 0.728 0.260 0.000 0.012 0.000
#> GSM553652 2 0.0510 0.921 0.016 0.984 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
#> GSM553595 4 0.7415 0.3682 0.008 0.000 0.208 0.424 0.124 0.236
#> GSM553596 4 0.2247 0.7368 0.012 0.000 0.024 0.904 0.000 0.060
#> GSM553597 4 0.2412 0.7341 0.000 0.000 0.000 0.880 0.028 0.092
#> GSM553598 4 0.3606 0.5904 0.004 0.000 0.264 0.724 0.000 0.008
#> GSM553599 1 0.4366 -0.1780 0.540 0.004 0.000 0.016 0.000 0.440
#> GSM553600 1 0.5066 0.3684 0.632 0.000 0.000 0.248 0.004 0.116
#> GSM553601 4 0.3163 0.5394 0.212 0.000 0.004 0.780 0.000 0.004
#> GSM553602 1 0.3947 0.4400 0.780 0.000 0.000 0.008 0.116 0.096
#> GSM553603 5 0.4762 0.3885 0.380 0.000 0.020 0.000 0.576 0.024
#> GSM553604 6 0.5895 0.1768 0.180 0.000 0.016 0.000 0.260 0.544
#> GSM553605 3 0.0363 0.9338 0.000 0.000 0.988 0.000 0.000 0.012
#> GSM553606 2 0.0984 0.8873 0.000 0.968 0.012 0.008 0.000 0.012
#> GSM553607 2 0.0858 0.8846 0.000 0.968 0.000 0.004 0.000 0.028
#> GSM553608 2 0.1049 0.8849 0.008 0.960 0.000 0.000 0.000 0.032
#> GSM553609 2 0.0405 0.8890 0.000 0.988 0.000 0.004 0.000 0.008
#> GSM553610 2 0.3586 0.5876 0.000 0.712 0.280 0.004 0.000 0.004
#> GSM553611 2 0.2701 0.8018 0.104 0.864 0.004 0.000 0.000 0.028
#> GSM553612 2 0.3994 0.7451 0.000 0.776 0.116 0.008 0.000 0.100
#> GSM553613 3 0.0972 0.9259 0.000 0.008 0.964 0.000 0.000 0.028
#> GSM553614 4 0.3029 0.7064 0.000 0.004 0.000 0.840 0.120 0.036
#> GSM553615 1 0.3694 0.4622 0.784 0.000 0.000 0.140 0.000 0.076
#> GSM553616 4 0.6807 0.2119 0.000 0.332 0.000 0.440 0.096 0.132
#> GSM553617 4 0.3475 0.7036 0.084 0.028 0.000 0.832 0.000 0.056
#> GSM553618 4 0.1723 0.7322 0.036 0.000 0.036 0.928 0.000 0.000
#> GSM553619 4 0.0458 0.7312 0.016 0.000 0.000 0.984 0.000 0.000
#> GSM553620 5 0.2875 0.6388 0.000 0.000 0.000 0.052 0.852 0.096
#> GSM553621 5 0.1410 0.7111 0.004 0.000 0.000 0.008 0.944 0.044
#> GSM553622 5 0.4452 0.4881 0.312 0.000 0.000 0.040 0.644 0.004
#> GSM553623 1 0.6119 0.0564 0.440 0.012 0.000 0.360 0.000 0.188
#> GSM553624 1 0.4894 -0.0380 0.624 0.068 0.000 0.000 0.008 0.300
#> GSM553625 1 0.6088 0.3538 0.532 0.000 0.000 0.312 0.100 0.056
#> GSM553626 1 0.1333 0.4684 0.944 0.000 0.000 0.000 0.048 0.008
#> GSM553627 1 0.4526 -0.1718 0.512 0.000 0.000 0.000 0.032 0.456
#> GSM553628 1 0.0717 0.4607 0.976 0.000 0.000 0.000 0.016 0.008
#> GSM553629 1 0.5477 0.0831 0.496 0.420 0.000 0.004 0.020 0.060
#> GSM553630 5 0.1500 0.7368 0.052 0.000 0.000 0.000 0.936 0.012
#> GSM553631 1 0.6968 0.1471 0.432 0.012 0.000 0.232 0.280 0.044
#> GSM553632 1 0.2964 0.4242 0.792 0.000 0.000 0.000 0.204 0.004
#> GSM553633 3 0.3508 0.8203 0.036 0.000 0.832 0.080 0.000 0.052
#> GSM553634 2 0.0260 0.8885 0.000 0.992 0.000 0.000 0.000 0.008
#> GSM553635 2 0.0692 0.8881 0.000 0.976 0.000 0.004 0.000 0.020
#> GSM553636 6 0.4675 0.1940 0.392 0.048 0.000 0.000 0.000 0.560
#> GSM553637 2 0.0603 0.8870 0.000 0.980 0.000 0.004 0.000 0.016
#> GSM553638 2 0.4588 0.6945 0.032 0.740 0.140 0.000 0.000 0.088
#> GSM553639 2 0.3835 0.7177 0.060 0.772 0.000 0.004 0.000 0.164
#> GSM553640 2 0.1010 0.8815 0.004 0.960 0.000 0.000 0.000 0.036
#> GSM553641 3 0.0260 0.9340 0.000 0.000 0.992 0.000 0.000 0.008
#> GSM553642 5 0.1610 0.7318 0.084 0.000 0.000 0.000 0.916 0.000
#> GSM553643 5 0.4905 0.3180 0.052 0.000 0.420 0.000 0.524 0.004
#> GSM553644 5 0.1480 0.7357 0.040 0.000 0.000 0.000 0.940 0.020
#> GSM553645 3 0.2908 0.8657 0.008 0.000 0.840 0.004 0.008 0.140
#> GSM553646 5 0.2002 0.7190 0.008 0.000 0.020 0.000 0.916 0.056
#> GSM553647 5 0.4300 0.4535 0.028 0.000 0.364 0.000 0.608 0.000
#> GSM553648 3 0.0891 0.9313 0.000 0.000 0.968 0.008 0.000 0.024
#> GSM553649 3 0.0914 0.9290 0.000 0.000 0.968 0.000 0.016 0.016
#> GSM553650 2 0.0603 0.8876 0.004 0.980 0.000 0.000 0.000 0.016
#> GSM553651 6 0.5492 0.2986 0.152 0.312 0.000 0.000 0.000 0.536
#> GSM553652 2 0.1477 0.8756 0.000 0.940 0.000 0.008 0.004 0.048
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 individual(p) k
#> MAD:NMF 57 0.2102 2
#> MAD:NMF 55 0.1707 3
#> MAD:NMF 51 0.0110 4
#> MAD:NMF 51 0.0828 5
#> MAD:NMF 36 0.0639 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 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.615 0.794 0.894 0.4772 0.521 0.521
#> 3 3 0.739 0.780 0.851 0.3570 0.805 0.625
#> 4 4 0.834 0.925 0.941 0.1291 0.914 0.744
#> 5 5 0.859 0.813 0.899 0.0662 0.953 0.820
#> 6 6 0.851 0.784 0.877 0.0315 0.998 0.989
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
#> GSM553595 1 0.0376 0.975 0.996 0.004
#> GSM553596 2 0.9286 0.621 0.344 0.656
#> GSM553597 1 0.0376 0.975 0.996 0.004
#> GSM553598 2 0.9460 0.602 0.364 0.636
#> GSM553599 2 0.9460 0.602 0.364 0.636
#> GSM553600 1 0.0000 0.974 1.000 0.000
#> GSM553601 2 0.9922 0.464 0.448 0.552
#> GSM553602 1 0.0000 0.974 1.000 0.000
#> GSM553603 1 0.0376 0.975 0.996 0.004
#> GSM553604 2 0.9944 0.446 0.456 0.544
#> GSM553605 2 0.0000 0.814 0.000 1.000
#> GSM553606 2 0.0000 0.814 0.000 1.000
#> GSM553607 2 0.0000 0.814 0.000 1.000
#> GSM553608 2 0.0000 0.814 0.000 1.000
#> GSM553609 2 0.0000 0.814 0.000 1.000
#> GSM553610 2 0.0000 0.814 0.000 1.000
#> GSM553611 2 0.0000 0.814 0.000 1.000
#> GSM553612 2 0.0000 0.814 0.000 1.000
#> GSM553613 2 0.0000 0.814 0.000 1.000
#> GSM553614 1 0.0000 0.974 1.000 0.000
#> GSM553615 1 0.0376 0.975 0.996 0.004
#> GSM553616 2 0.9922 0.464 0.448 0.552
#> GSM553617 2 0.9460 0.602 0.364 0.636
#> GSM553618 2 0.9460 0.602 0.364 0.636
#> GSM553619 1 0.9491 0.136 0.632 0.368
#> GSM553620 1 0.0000 0.974 1.000 0.000
#> GSM553621 1 0.0000 0.974 1.000 0.000
#> GSM553622 1 0.0000 0.974 1.000 0.000
#> GSM553623 2 0.9460 0.602 0.364 0.636
#> GSM553624 2 0.9460 0.602 0.364 0.636
#> GSM553625 1 0.0376 0.975 0.996 0.004
#> GSM553626 1 0.0376 0.975 0.996 0.004
#> GSM553627 1 0.0376 0.975 0.996 0.004
#> GSM553628 1 0.0376 0.975 0.996 0.004
#> GSM553629 2 0.9954 0.437 0.460 0.540
#> GSM553630 1 0.0376 0.975 0.996 0.004
#> GSM553631 1 0.0376 0.975 0.996 0.004
#> GSM553632 1 0.0000 0.974 1.000 0.000
#> GSM553633 2 0.7883 0.704 0.236 0.764
#> GSM553634 2 0.0000 0.814 0.000 1.000
#> GSM553635 2 0.0000 0.814 0.000 1.000
#> GSM553636 2 0.0000 0.814 0.000 1.000
#> GSM553637 2 0.0000 0.814 0.000 1.000
#> GSM553638 2 0.0000 0.814 0.000 1.000
#> GSM553639 2 0.0000 0.814 0.000 1.000
#> GSM553640 2 0.0000 0.814 0.000 1.000
#> GSM553641 2 0.0000 0.814 0.000 1.000
#> GSM553642 1 0.0000 0.974 1.000 0.000
#> GSM553643 1 0.0376 0.975 0.996 0.004
#> GSM553644 1 0.0000 0.974 1.000 0.000
#> GSM553645 2 0.9922 0.464 0.448 0.552
#> GSM553646 1 0.0376 0.975 0.996 0.004
#> GSM553647 2 0.9922 0.464 0.448 0.552
#> GSM553648 2 0.0000 0.814 0.000 1.000
#> GSM553649 2 0.7883 0.704 0.236 0.764
#> GSM553650 2 0.0000 0.814 0.000 1.000
#> GSM553651 2 0.0000 0.814 0.000 1.000
#> GSM553652 2 0.0000 0.814 0.000 1.000
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> GSM553595 1 0.000 0.703 1.000 0.000 0.000
#> GSM553596 3 0.849 0.821 0.348 0.104 0.548
#> GSM553597 1 0.000 0.703 1.000 0.000 0.000
#> GSM553598 3 0.824 0.834 0.368 0.084 0.548
#> GSM553599 3 0.824 0.834 0.368 0.084 0.548
#> GSM553600 1 0.627 0.626 0.548 0.000 0.452
#> GSM553601 3 0.627 0.782 0.452 0.000 0.548
#> GSM553602 1 0.627 0.626 0.548 0.000 0.452
#> GSM553603 1 0.000 0.703 1.000 0.000 0.000
#> GSM553604 3 0.628 0.774 0.460 0.000 0.540
#> GSM553605 2 0.000 1.000 0.000 1.000 0.000
#> GSM553606 2 0.000 1.000 0.000 1.000 0.000
#> GSM553607 2 0.000 1.000 0.000 1.000 0.000
#> GSM553608 2 0.000 1.000 0.000 1.000 0.000
#> GSM553609 2 0.000 1.000 0.000 1.000 0.000
#> GSM553610 2 0.000 1.000 0.000 1.000 0.000
#> GSM553611 2 0.000 1.000 0.000 1.000 0.000
#> GSM553612 2 0.000 1.000 0.000 1.000 0.000
#> GSM553613 2 0.000 1.000 0.000 1.000 0.000
#> GSM553614 1 0.103 0.699 0.976 0.000 0.024
#> GSM553615 1 0.000 0.703 1.000 0.000 0.000
#> GSM553616 3 0.627 0.782 0.452 0.000 0.548
#> GSM553617 3 0.824 0.834 0.368 0.084 0.548
#> GSM553618 3 0.824 0.834 0.368 0.084 0.548
#> GSM553619 1 0.597 -0.426 0.636 0.000 0.364
#> GSM553620 1 0.627 0.626 0.548 0.000 0.452
#> GSM553621 1 0.627 0.626 0.548 0.000 0.452
#> GSM553622 1 0.627 0.626 0.548 0.000 0.452
#> GSM553623 3 0.824 0.834 0.368 0.084 0.548
#> GSM553624 3 0.824 0.834 0.368 0.084 0.548
#> GSM553625 1 0.000 0.703 1.000 0.000 0.000
#> GSM553626 1 0.000 0.703 1.000 0.000 0.000
#> GSM553627 1 0.000 0.703 1.000 0.000 0.000
#> GSM553628 1 0.000 0.703 1.000 0.000 0.000
#> GSM553629 3 0.629 0.769 0.464 0.000 0.536
#> GSM553630 1 0.000 0.703 1.000 0.000 0.000
#> GSM553631 1 0.000 0.703 1.000 0.000 0.000
#> GSM553632 1 0.627 0.626 0.548 0.000 0.452
#> GSM553633 3 0.911 0.730 0.240 0.212 0.548
#> GSM553634 2 0.000 1.000 0.000 1.000 0.000
#> GSM553635 2 0.000 1.000 0.000 1.000 0.000
#> GSM553636 2 0.000 1.000 0.000 1.000 0.000
#> GSM553637 2 0.000 1.000 0.000 1.000 0.000
#> GSM553638 2 0.000 1.000 0.000 1.000 0.000
#> GSM553639 2 0.000 1.000 0.000 1.000 0.000
#> GSM553640 2 0.000 1.000 0.000 1.000 0.000
#> GSM553641 3 0.648 0.275 0.004 0.448 0.548
#> GSM553642 1 0.627 0.626 0.548 0.000 0.452
#> GSM553643 1 0.000 0.703 1.000 0.000 0.000
#> GSM553644 1 0.626 0.626 0.552 0.000 0.448
#> GSM553645 3 0.627 0.782 0.452 0.000 0.548
#> GSM553646 1 0.000 0.703 1.000 0.000 0.000
#> GSM553647 3 0.627 0.782 0.452 0.000 0.548
#> GSM553648 3 0.648 0.275 0.004 0.448 0.548
#> GSM553649 3 0.911 0.730 0.240 0.212 0.548
#> GSM553650 2 0.000 1.000 0.000 1.000 0.000
#> GSM553651 2 0.000 1.000 0.000 1.000 0.000
#> GSM553652 2 0.000 1.000 0.000 1.000 0.000
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> GSM553595 4 0.0000 0.990 0.000 0.000 0.000 1.000
#> GSM553596 3 0.2654 0.864 0.000 0.004 0.888 0.108
#> GSM553597 4 0.0000 0.990 0.000 0.000 0.000 1.000
#> GSM553598 3 0.2704 0.871 0.000 0.000 0.876 0.124
#> GSM553599 3 0.2704 0.871 0.000 0.000 0.876 0.124
#> GSM553600 1 0.0000 0.989 1.000 0.000 0.000 0.000
#> GSM553601 3 0.3688 0.847 0.000 0.000 0.792 0.208
#> GSM553602 1 0.0000 0.989 1.000 0.000 0.000 0.000
#> GSM553603 4 0.0000 0.990 0.000 0.000 0.000 1.000
#> GSM553604 3 0.3764 0.841 0.000 0.000 0.784 0.216
#> GSM553605 2 0.2704 0.876 0.000 0.876 0.124 0.000
#> GSM553606 2 0.0000 0.994 0.000 1.000 0.000 0.000
#> GSM553607 2 0.0000 0.994 0.000 1.000 0.000 0.000
#> GSM553608 2 0.0000 0.994 0.000 1.000 0.000 0.000
#> GSM553609 2 0.0000 0.994 0.000 1.000 0.000 0.000
#> GSM553610 2 0.0000 0.994 0.000 1.000 0.000 0.000
#> GSM553611 2 0.0000 0.994 0.000 1.000 0.000 0.000
#> GSM553612 2 0.0000 0.994 0.000 1.000 0.000 0.000
#> GSM553613 2 0.0000 0.994 0.000 1.000 0.000 0.000
#> GSM553614 4 0.2530 0.872 0.112 0.000 0.000 0.888
#> GSM553615 4 0.0000 0.990 0.000 0.000 0.000 1.000
#> GSM553616 3 0.3688 0.847 0.000 0.000 0.792 0.208
#> GSM553617 3 0.2704 0.871 0.000 0.000 0.876 0.124
#> GSM553618 3 0.2704 0.871 0.000 0.000 0.876 0.124
#> GSM553619 3 0.4992 0.378 0.000 0.000 0.524 0.476
#> GSM553620 1 0.0921 0.972 0.972 0.000 0.000 0.028
#> GSM553621 1 0.0000 0.989 1.000 0.000 0.000 0.000
#> GSM553622 1 0.0000 0.989 1.000 0.000 0.000 0.000
#> GSM553623 3 0.2704 0.871 0.000 0.000 0.876 0.124
#> GSM553624 3 0.2704 0.871 0.000 0.000 0.876 0.124
#> GSM553625 4 0.0000 0.990 0.000 0.000 0.000 1.000
#> GSM553626 4 0.0000 0.990 0.000 0.000 0.000 1.000
#> GSM553627 4 0.0000 0.990 0.000 0.000 0.000 1.000
#> GSM553628 4 0.0000 0.990 0.000 0.000 0.000 1.000
#> GSM553629 3 0.3837 0.834 0.000 0.000 0.776 0.224
#> GSM553630 4 0.0000 0.990 0.000 0.000 0.000 1.000
#> GSM553631 4 0.0000 0.990 0.000 0.000 0.000 1.000
#> GSM553632 1 0.0000 0.989 1.000 0.000 0.000 0.000
#> GSM553633 3 0.0188 0.790 0.000 0.004 0.996 0.000
#> GSM553634 2 0.0000 0.994 0.000 1.000 0.000 0.000
#> GSM553635 2 0.0000 0.994 0.000 1.000 0.000 0.000
#> GSM553636 2 0.0000 0.994 0.000 1.000 0.000 0.000
#> GSM553637 2 0.0000 0.994 0.000 1.000 0.000 0.000
#> GSM553638 2 0.0000 0.994 0.000 1.000 0.000 0.000
#> GSM553639 2 0.0000 0.994 0.000 1.000 0.000 0.000
#> GSM553640 2 0.0000 0.994 0.000 1.000 0.000 0.000
#> GSM553641 3 0.3975 0.570 0.000 0.240 0.760 0.000
#> GSM553642 1 0.0000 0.989 1.000 0.000 0.000 0.000
#> GSM553643 4 0.0000 0.990 0.000 0.000 0.000 1.000
#> GSM553644 1 0.1389 0.955 0.952 0.000 0.000 0.048
#> GSM553645 3 0.3688 0.847 0.000 0.000 0.792 0.208
#> GSM553646 4 0.0000 0.990 0.000 0.000 0.000 1.000
#> GSM553647 3 0.3688 0.847 0.000 0.000 0.792 0.208
#> GSM553648 3 0.3975 0.570 0.000 0.240 0.760 0.000
#> GSM553649 3 0.0188 0.790 0.000 0.004 0.996 0.000
#> GSM553650 2 0.0000 0.994 0.000 1.000 0.000 0.000
#> GSM553651 2 0.0000 0.994 0.000 1.000 0.000 0.000
#> GSM553652 2 0.0000 0.994 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
#> GSM553595 4 0.1792 0.9489 0.000 0.000 0.000 0.916 0.084
#> GSM553596 5 0.4201 0.2658 0.000 0.000 0.408 0.000 0.592
#> GSM553597 4 0.1792 0.9489 0.000 0.000 0.000 0.916 0.084
#> GSM553598 5 0.3039 0.7136 0.000 0.000 0.192 0.000 0.808
#> GSM553599 5 0.2424 0.7571 0.000 0.000 0.132 0.000 0.868
#> GSM553600 1 0.0000 0.9867 1.000 0.000 0.000 0.000 0.000
#> GSM553601 5 0.0000 0.7876 0.000 0.000 0.000 0.000 1.000
#> GSM553602 1 0.0000 0.9867 1.000 0.000 0.000 0.000 0.000
#> GSM553603 4 0.1792 0.9489 0.000 0.000 0.000 0.916 0.084
#> GSM553604 5 0.0290 0.7837 0.000 0.000 0.000 0.008 0.992
#> GSM553605 3 0.4304 -0.3742 0.000 0.484 0.516 0.000 0.000
#> GSM553606 2 0.2377 0.9024 0.000 0.872 0.128 0.000 0.000
#> GSM553607 2 0.2377 0.9024 0.000 0.872 0.128 0.000 0.000
#> GSM553608 2 0.0000 0.9525 0.000 1.000 0.000 0.000 0.000
#> GSM553609 2 0.0162 0.9516 0.000 0.996 0.004 0.000 0.000
#> GSM553610 2 0.2377 0.9024 0.000 0.872 0.128 0.000 0.000
#> GSM553611 2 0.0000 0.9525 0.000 1.000 0.000 0.000 0.000
#> GSM553612 2 0.0162 0.9516 0.000 0.996 0.004 0.000 0.000
#> GSM553613 2 0.2377 0.9024 0.000 0.872 0.128 0.000 0.000
#> GSM553614 4 0.2179 0.8422 0.112 0.000 0.000 0.888 0.000
#> GSM553615 4 0.0000 0.9372 0.000 0.000 0.000 1.000 0.000
#> GSM553616 5 0.0000 0.7876 0.000 0.000 0.000 0.000 1.000
#> GSM553617 5 0.2471 0.7553 0.000 0.000 0.136 0.000 0.864
#> GSM553618 5 0.3003 0.7172 0.000 0.000 0.188 0.000 0.812
#> GSM553619 5 0.3885 0.4218 0.000 0.000 0.008 0.268 0.724
#> GSM553620 1 0.0794 0.9664 0.972 0.000 0.000 0.028 0.000
#> GSM553621 1 0.0000 0.9867 1.000 0.000 0.000 0.000 0.000
#> GSM553622 1 0.0000 0.9867 1.000 0.000 0.000 0.000 0.000
#> GSM553623 5 0.2424 0.7571 0.000 0.000 0.132 0.000 0.868
#> GSM553624 5 0.4045 0.4111 0.000 0.000 0.356 0.000 0.644
#> GSM553625 4 0.0000 0.9372 0.000 0.000 0.000 1.000 0.000
#> GSM553626 4 0.0000 0.9372 0.000 0.000 0.000 1.000 0.000
#> GSM553627 4 0.0000 0.9372 0.000 0.000 0.000 1.000 0.000
#> GSM553628 4 0.0000 0.9372 0.000 0.000 0.000 1.000 0.000
#> GSM553629 5 0.1121 0.7498 0.000 0.000 0.000 0.044 0.956
#> GSM553630 4 0.1792 0.9489 0.000 0.000 0.000 0.916 0.084
#> GSM553631 4 0.1792 0.9489 0.000 0.000 0.000 0.916 0.084
#> GSM553632 1 0.0000 0.9867 1.000 0.000 0.000 0.000 0.000
#> GSM553633 3 0.4210 0.1636 0.000 0.000 0.588 0.000 0.412
#> GSM553634 2 0.0000 0.9525 0.000 1.000 0.000 0.000 0.000
#> GSM553635 2 0.0000 0.9525 0.000 1.000 0.000 0.000 0.000
#> GSM553636 2 0.0000 0.9525 0.000 1.000 0.000 0.000 0.000
#> GSM553637 2 0.2377 0.9024 0.000 0.872 0.128 0.000 0.000
#> GSM553638 2 0.2377 0.9024 0.000 0.872 0.128 0.000 0.000
#> GSM553639 2 0.0000 0.9525 0.000 1.000 0.000 0.000 0.000
#> GSM553640 2 0.0000 0.9525 0.000 1.000 0.000 0.000 0.000
#> GSM553641 3 0.3013 0.4944 0.000 0.008 0.832 0.000 0.160
#> GSM553642 1 0.0000 0.9867 1.000 0.000 0.000 0.000 0.000
#> GSM553643 4 0.1792 0.9489 0.000 0.000 0.000 0.916 0.084
#> GSM553644 1 0.1197 0.9457 0.952 0.000 0.000 0.048 0.000
#> GSM553645 5 0.0000 0.7876 0.000 0.000 0.000 0.000 1.000
#> GSM553646 4 0.1792 0.9489 0.000 0.000 0.000 0.916 0.084
#> GSM553647 5 0.0000 0.7876 0.000 0.000 0.000 0.000 1.000
#> GSM553648 3 0.3013 0.4944 0.000 0.008 0.832 0.000 0.160
#> GSM553649 3 0.4287 0.0244 0.000 0.000 0.540 0.000 0.460
#> GSM553650 2 0.0000 0.9525 0.000 1.000 0.000 0.000 0.000
#> GSM553651 2 0.0000 0.9525 0.000 1.000 0.000 0.000 0.000
#> GSM553652 2 0.0000 0.9525 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
#> GSM553595 4 0.2309 0.903 0.000 0.000 0.000 0.888 0.084 0.028
#> GSM553596 5 0.3862 0.140 0.000 0.000 0.476 0.000 0.524 0.000
#> GSM553597 4 0.2309 0.903 0.000 0.000 0.000 0.888 0.084 0.028
#> GSM553598 5 0.3288 0.625 0.000 0.000 0.276 0.000 0.724 0.000
#> GSM553599 5 0.2178 0.749 0.000 0.000 0.132 0.000 0.868 0.000
#> GSM553600 1 0.0000 0.984 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM553601 5 0.0000 0.780 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM553602 1 0.0000 0.984 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM553603 4 0.2230 0.904 0.000 0.000 0.000 0.892 0.084 0.024
#> GSM553604 5 0.0260 0.776 0.000 0.000 0.000 0.008 0.992 0.000
#> GSM553605 6 0.4887 0.000 0.000 0.324 0.080 0.000 0.000 0.596
#> GSM553606 2 0.0000 0.679 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM553607 2 0.0000 0.679 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM553608 2 0.3515 0.862 0.000 0.676 0.000 0.000 0.000 0.324
#> GSM553609 2 0.3330 0.852 0.000 0.716 0.000 0.000 0.000 0.284
#> GSM553610 2 0.0000 0.679 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM553611 2 0.3499 0.862 0.000 0.680 0.000 0.000 0.000 0.320
#> GSM553612 2 0.3330 0.852 0.000 0.716 0.000 0.000 0.000 0.284
#> GSM553613 2 0.0000 0.679 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM553614 4 0.3062 0.787 0.112 0.000 0.000 0.836 0.000 0.052
#> GSM553615 4 0.1141 0.893 0.000 0.000 0.000 0.948 0.000 0.052
#> GSM553616 5 0.0000 0.780 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM553617 5 0.2219 0.748 0.000 0.000 0.136 0.000 0.864 0.000
#> GSM553618 5 0.3244 0.635 0.000 0.000 0.268 0.000 0.732 0.000
#> GSM553619 5 0.5861 0.300 0.000 0.000 0.156 0.240 0.576 0.028
#> GSM553620 1 0.0713 0.960 0.972 0.000 0.000 0.028 0.000 0.000
#> GSM553621 1 0.0000 0.984 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM553622 1 0.0000 0.984 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM553623 5 0.2178 0.749 0.000 0.000 0.132 0.000 0.868 0.000
#> GSM553624 5 0.3659 0.441 0.000 0.000 0.364 0.000 0.636 0.000
#> GSM553625 4 0.1075 0.894 0.000 0.000 0.000 0.952 0.000 0.048
#> GSM553626 4 0.1141 0.893 0.000 0.000 0.000 0.948 0.000 0.052
#> GSM553627 4 0.1075 0.894 0.000 0.000 0.000 0.952 0.000 0.048
#> GSM553628 4 0.1141 0.893 0.000 0.000 0.000 0.948 0.000 0.052
#> GSM553629 5 0.1007 0.748 0.000 0.000 0.000 0.044 0.956 0.000
#> GSM553630 4 0.1610 0.909 0.000 0.000 0.000 0.916 0.084 0.000
#> GSM553631 4 0.1753 0.910 0.000 0.000 0.000 0.912 0.084 0.004
#> GSM553632 1 0.0000 0.984 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM553633 3 0.3151 0.596 0.000 0.000 0.748 0.000 0.252 0.000
#> GSM553634 2 0.3499 0.862 0.000 0.680 0.000 0.000 0.000 0.320
#> GSM553635 2 0.3515 0.862 0.000 0.676 0.000 0.000 0.000 0.324
#> GSM553636 2 0.3515 0.862 0.000 0.676 0.000 0.000 0.000 0.324
#> GSM553637 2 0.0000 0.679 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM553638 2 0.0000 0.679 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM553639 2 0.3515 0.862 0.000 0.676 0.000 0.000 0.000 0.324
#> GSM553640 2 0.3515 0.862 0.000 0.676 0.000 0.000 0.000 0.324
#> GSM553641 3 0.2416 0.696 0.000 0.000 0.844 0.000 0.000 0.156
#> GSM553642 1 0.0000 0.984 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM553643 4 0.2230 0.904 0.000 0.000 0.000 0.892 0.084 0.024
#> GSM553644 1 0.1075 0.935 0.952 0.000 0.000 0.048 0.000 0.000
#> GSM553645 5 0.0000 0.780 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM553646 4 0.1753 0.910 0.000 0.000 0.000 0.912 0.084 0.004
#> GSM553647 5 0.0000 0.780 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM553648 3 0.2416 0.696 0.000 0.000 0.844 0.000 0.000 0.156
#> GSM553649 3 0.2378 0.660 0.000 0.000 0.848 0.000 0.152 0.000
#> GSM553650 2 0.3499 0.862 0.000 0.680 0.000 0.000 0.000 0.320
#> GSM553651 2 0.3515 0.862 0.000 0.676 0.000 0.000 0.000 0.324
#> GSM553652 2 0.3515 0.862 0.000 0.676 0.000 0.000 0.000 0.324
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 individual(p) k
#> ATC:hclust 51 0.417 2
#> ATC:hclust 55 0.631 3
#> ATC:hclust 57 0.677 4
#> ATC:hclust 50 0.884 5
#> ATC:hclust 54 0.292 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 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.995 0.997 0.4793 0.521 0.521
#> 3 3 0.842 0.905 0.950 0.3751 0.760 0.560
#> 4 4 0.761 0.802 0.830 0.1135 0.891 0.690
#> 5 5 0.748 0.688 0.820 0.0602 0.955 0.837
#> 6 6 0.811 0.814 0.835 0.0429 0.899 0.623
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
#> GSM553595 1 0.000 0.998 1.000 0.000
#> GSM553596 1 0.118 0.985 0.984 0.016
#> GSM553597 1 0.000 0.998 1.000 0.000
#> GSM553598 1 0.118 0.985 0.984 0.016
#> GSM553599 1 0.000 0.998 1.000 0.000
#> GSM553600 1 0.000 0.998 1.000 0.000
#> GSM553601 1 0.000 0.998 1.000 0.000
#> GSM553602 1 0.000 0.998 1.000 0.000
#> GSM553603 1 0.000 0.998 1.000 0.000
#> GSM553604 1 0.000 0.998 1.000 0.000
#> GSM553605 2 0.000 0.996 0.000 1.000
#> GSM553606 2 0.000 0.996 0.000 1.000
#> GSM553607 2 0.000 0.996 0.000 1.000
#> GSM553608 2 0.000 0.996 0.000 1.000
#> GSM553609 2 0.000 0.996 0.000 1.000
#> GSM553610 2 0.000 0.996 0.000 1.000
#> GSM553611 2 0.000 0.996 0.000 1.000
#> GSM553612 2 0.000 0.996 0.000 1.000
#> GSM553613 2 0.000 0.996 0.000 1.000
#> GSM553614 1 0.000 0.998 1.000 0.000
#> GSM553615 1 0.000 0.998 1.000 0.000
#> GSM553616 1 0.000 0.998 1.000 0.000
#> GSM553617 1 0.118 0.985 0.984 0.016
#> GSM553618 1 0.000 0.998 1.000 0.000
#> GSM553619 1 0.000 0.998 1.000 0.000
#> GSM553620 1 0.000 0.998 1.000 0.000
#> GSM553621 1 0.000 0.998 1.000 0.000
#> GSM553622 1 0.000 0.998 1.000 0.000
#> GSM553623 1 0.000 0.998 1.000 0.000
#> GSM553624 2 0.402 0.913 0.080 0.920
#> GSM553625 1 0.000 0.998 1.000 0.000
#> GSM553626 1 0.000 0.998 1.000 0.000
#> GSM553627 1 0.000 0.998 1.000 0.000
#> GSM553628 1 0.000 0.998 1.000 0.000
#> GSM553629 1 0.000 0.998 1.000 0.000
#> GSM553630 1 0.000 0.998 1.000 0.000
#> GSM553631 1 0.000 0.998 1.000 0.000
#> GSM553632 1 0.000 0.998 1.000 0.000
#> GSM553633 1 0.141 0.981 0.980 0.020
#> GSM553634 2 0.000 0.996 0.000 1.000
#> GSM553635 2 0.000 0.996 0.000 1.000
#> GSM553636 2 0.000 0.996 0.000 1.000
#> GSM553637 2 0.000 0.996 0.000 1.000
#> GSM553638 2 0.000 0.996 0.000 1.000
#> GSM553639 2 0.000 0.996 0.000 1.000
#> GSM553640 2 0.000 0.996 0.000 1.000
#> GSM553641 2 0.000 0.996 0.000 1.000
#> GSM553642 1 0.000 0.998 1.000 0.000
#> GSM553643 1 0.000 0.998 1.000 0.000
#> GSM553644 1 0.000 0.998 1.000 0.000
#> GSM553645 1 0.000 0.998 1.000 0.000
#> GSM553646 1 0.000 0.998 1.000 0.000
#> GSM553647 1 0.000 0.998 1.000 0.000
#> GSM553648 2 0.000 0.996 0.000 1.000
#> GSM553649 1 0.000 0.998 1.000 0.000
#> GSM553650 2 0.000 0.996 0.000 1.000
#> GSM553651 2 0.000 0.996 0.000 1.000
#> GSM553652 2 0.000 0.996 0.000 1.000
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> GSM553595 3 0.0000 0.933 0.000 0.000 1.000
#> GSM553596 3 0.0000 0.933 0.000 0.000 1.000
#> GSM553597 3 0.5098 0.642 0.248 0.000 0.752
#> GSM553598 3 0.0000 0.933 0.000 0.000 1.000
#> GSM553599 3 0.0000 0.933 0.000 0.000 1.000
#> GSM553600 1 0.0592 0.884 0.988 0.000 0.012
#> GSM553601 3 0.0000 0.933 0.000 0.000 1.000
#> GSM553602 1 0.0592 0.884 0.988 0.000 0.012
#> GSM553603 3 0.4504 0.722 0.196 0.000 0.804
#> GSM553604 3 0.0000 0.933 0.000 0.000 1.000
#> GSM553605 2 0.0592 0.994 0.012 0.988 0.000
#> GSM553606 2 0.0592 0.994 0.012 0.988 0.000
#> GSM553607 2 0.0592 0.994 0.012 0.988 0.000
#> GSM553608 2 0.0000 0.996 0.000 1.000 0.000
#> GSM553609 2 0.0000 0.996 0.000 1.000 0.000
#> GSM553610 2 0.0592 0.994 0.012 0.988 0.000
#> GSM553611 2 0.0000 0.996 0.000 1.000 0.000
#> GSM553612 2 0.0000 0.996 0.000 1.000 0.000
#> GSM553613 2 0.0592 0.994 0.012 0.988 0.000
#> GSM553614 1 0.0592 0.884 0.988 0.000 0.012
#> GSM553615 1 0.5178 0.762 0.744 0.000 0.256
#> GSM553616 3 0.0000 0.933 0.000 0.000 1.000
#> GSM553617 3 0.0000 0.933 0.000 0.000 1.000
#> GSM553618 3 0.0000 0.933 0.000 0.000 1.000
#> GSM553619 3 0.0000 0.933 0.000 0.000 1.000
#> GSM553620 1 0.0592 0.884 0.988 0.000 0.012
#> GSM553621 1 0.0592 0.884 0.988 0.000 0.012
#> GSM553622 1 0.0592 0.884 0.988 0.000 0.012
#> GSM553623 3 0.0000 0.933 0.000 0.000 1.000
#> GSM553624 3 0.0592 0.921 0.000 0.012 0.988
#> GSM553625 3 0.0000 0.933 0.000 0.000 1.000
#> GSM553626 1 0.5138 0.766 0.748 0.000 0.252
#> GSM553627 3 0.5098 0.642 0.248 0.000 0.752
#> GSM553628 1 0.5178 0.762 0.744 0.000 0.256
#> GSM553629 3 0.0000 0.933 0.000 0.000 1.000
#> GSM553630 1 0.5397 0.726 0.720 0.000 0.280
#> GSM553631 1 0.5178 0.762 0.744 0.000 0.256
#> GSM553632 1 0.0592 0.884 0.988 0.000 0.012
#> GSM553633 3 0.0000 0.933 0.000 0.000 1.000
#> GSM553634 2 0.0000 0.996 0.000 1.000 0.000
#> GSM553635 2 0.0000 0.996 0.000 1.000 0.000
#> GSM553636 2 0.0000 0.996 0.000 1.000 0.000
#> GSM553637 2 0.0592 0.994 0.012 0.988 0.000
#> GSM553638 2 0.0592 0.994 0.012 0.988 0.000
#> GSM553639 2 0.0000 0.996 0.000 1.000 0.000
#> GSM553640 2 0.0000 0.996 0.000 1.000 0.000
#> GSM553641 2 0.0592 0.994 0.012 0.988 0.000
#> GSM553642 1 0.0592 0.884 0.988 0.000 0.012
#> GSM553643 3 0.5098 0.642 0.248 0.000 0.752
#> GSM553644 1 0.0592 0.884 0.988 0.000 0.012
#> GSM553645 3 0.0000 0.933 0.000 0.000 1.000
#> GSM553646 1 0.4399 0.810 0.812 0.000 0.188
#> GSM553647 3 0.0000 0.933 0.000 0.000 1.000
#> GSM553648 3 0.5360 0.645 0.012 0.220 0.768
#> GSM553649 3 0.0000 0.933 0.000 0.000 1.000
#> GSM553650 2 0.0000 0.996 0.000 1.000 0.000
#> GSM553651 2 0.0000 0.996 0.000 1.000 0.000
#> GSM553652 2 0.0000 0.996 0.000 1.000 0.000
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> GSM553595 3 0.4866 0.0814 0.000 0.000 0.596 0.404
#> GSM553596 3 0.1637 0.8522 0.060 0.000 0.940 0.000
#> GSM553597 4 0.4585 0.6667 0.000 0.000 0.332 0.668
#> GSM553598 3 0.1637 0.8522 0.060 0.000 0.940 0.000
#> GSM553599 3 0.0000 0.8702 0.000 0.000 1.000 0.000
#> GSM553600 1 0.4898 1.0000 0.584 0.000 0.000 0.416
#> GSM553601 3 0.1867 0.8233 0.000 0.000 0.928 0.072
#> GSM553602 1 0.4898 1.0000 0.584 0.000 0.000 0.416
#> GSM553603 4 0.4585 0.6667 0.000 0.000 0.332 0.668
#> GSM553604 3 0.2216 0.8064 0.000 0.000 0.908 0.092
#> GSM553605 2 0.3688 0.8110 0.208 0.792 0.000 0.000
#> GSM553606 2 0.1118 0.8882 0.036 0.964 0.000 0.000
#> GSM553607 2 0.1118 0.8882 0.036 0.964 0.000 0.000
#> GSM553608 2 0.3356 0.8652 0.176 0.824 0.000 0.000
#> GSM553609 2 0.0000 0.8914 0.000 1.000 0.000 0.000
#> GSM553610 2 0.1118 0.8882 0.036 0.964 0.000 0.000
#> GSM553611 2 0.0921 0.8909 0.028 0.972 0.000 0.000
#> GSM553612 2 0.0000 0.8914 0.000 1.000 0.000 0.000
#> GSM553613 2 0.1118 0.8882 0.036 0.964 0.000 0.000
#> GSM553614 4 0.0592 0.5483 0.016 0.000 0.000 0.984
#> GSM553615 4 0.1302 0.6749 0.000 0.000 0.044 0.956
#> GSM553616 3 0.0000 0.8702 0.000 0.000 1.000 0.000
#> GSM553617 3 0.0000 0.8702 0.000 0.000 1.000 0.000
#> GSM553618 3 0.0000 0.8702 0.000 0.000 1.000 0.000
#> GSM553619 3 0.4804 0.1508 0.000 0.000 0.616 0.384
#> GSM553620 1 0.4898 1.0000 0.584 0.000 0.000 0.416
#> GSM553621 1 0.4898 1.0000 0.584 0.000 0.000 0.416
#> GSM553622 1 0.4898 1.0000 0.584 0.000 0.000 0.416
#> GSM553623 3 0.0000 0.8702 0.000 0.000 1.000 0.000
#> GSM553624 3 0.2530 0.7944 0.112 0.000 0.888 0.000
#> GSM553625 4 0.4898 0.4701 0.000 0.000 0.416 0.584
#> GSM553626 4 0.1302 0.6749 0.000 0.000 0.044 0.956
#> GSM553627 4 0.4585 0.6667 0.000 0.000 0.332 0.668
#> GSM553628 4 0.1302 0.6749 0.000 0.000 0.044 0.956
#> GSM553629 3 0.2216 0.8064 0.000 0.000 0.908 0.092
#> GSM553630 4 0.3801 0.7253 0.000 0.000 0.220 0.780
#> GSM553631 4 0.1302 0.6749 0.000 0.000 0.044 0.956
#> GSM553632 1 0.4898 1.0000 0.584 0.000 0.000 0.416
#> GSM553633 3 0.1637 0.8522 0.060 0.000 0.940 0.000
#> GSM553634 2 0.1022 0.8906 0.032 0.968 0.000 0.000
#> GSM553635 2 0.3400 0.8639 0.180 0.820 0.000 0.000
#> GSM553636 2 0.4250 0.8276 0.276 0.724 0.000 0.000
#> GSM553637 2 0.1118 0.8882 0.036 0.964 0.000 0.000
#> GSM553638 2 0.1118 0.8882 0.036 0.964 0.000 0.000
#> GSM553639 2 0.4250 0.8276 0.276 0.724 0.000 0.000
#> GSM553640 2 0.4103 0.8365 0.256 0.744 0.000 0.000
#> GSM553641 2 0.6337 0.6833 0.380 0.552 0.068 0.000
#> GSM553642 1 0.4898 1.0000 0.584 0.000 0.000 0.416
#> GSM553643 4 0.4585 0.6667 0.000 0.000 0.332 0.668
#> GSM553644 1 0.4898 1.0000 0.584 0.000 0.000 0.416
#> GSM553645 3 0.0000 0.8702 0.000 0.000 1.000 0.000
#> GSM553646 4 0.1118 0.6610 0.000 0.000 0.036 0.964
#> GSM553647 3 0.0000 0.8702 0.000 0.000 1.000 0.000
#> GSM553648 3 0.4406 0.6113 0.300 0.000 0.700 0.000
#> GSM553649 3 0.1637 0.8522 0.060 0.000 0.940 0.000
#> GSM553650 2 0.1022 0.8906 0.032 0.968 0.000 0.000
#> GSM553651 2 0.4250 0.8276 0.276 0.724 0.000 0.000
#> GSM553652 2 0.3356 0.8652 0.176 0.824 0.000 0.000
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> GSM553595 4 0.4974 0.143 0.000 0.000 0.032 0.560 0.408
#> GSM553596 5 0.1478 0.799 0.000 0.000 0.064 0.000 0.936
#> GSM553597 4 0.2054 0.788 0.000 0.000 0.028 0.920 0.052
#> GSM553598 5 0.1544 0.798 0.000 0.000 0.068 0.000 0.932
#> GSM553599 5 0.2388 0.846 0.000 0.000 0.028 0.072 0.900
#> GSM553600 1 0.1907 0.949 0.928 0.000 0.044 0.028 0.000
#> GSM553601 5 0.4201 0.744 0.000 0.000 0.044 0.204 0.752
#> GSM553602 1 0.0794 0.951 0.972 0.000 0.000 0.028 0.000
#> GSM553603 4 0.1430 0.791 0.000 0.000 0.004 0.944 0.052
#> GSM553604 5 0.4495 0.693 0.000 0.000 0.044 0.244 0.712
#> GSM553605 2 0.6652 -0.133 0.028 0.620 0.232 0.048 0.072
#> GSM553606 2 0.0000 0.689 0.000 1.000 0.000 0.000 0.000
#> GSM553607 2 0.0000 0.689 0.000 1.000 0.000 0.000 0.000
#> GSM553608 2 0.4235 0.495 0.000 0.576 0.424 0.000 0.000
#> GSM553609 2 0.0963 0.696 0.000 0.964 0.036 0.000 0.000
#> GSM553610 2 0.0000 0.689 0.000 1.000 0.000 0.000 0.000
#> GSM553611 2 0.1671 0.695 0.000 0.924 0.076 0.000 0.000
#> GSM553612 2 0.0963 0.696 0.000 0.964 0.036 0.000 0.000
#> GSM553613 2 0.0000 0.689 0.000 1.000 0.000 0.000 0.000
#> GSM553614 4 0.5382 0.632 0.128 0.000 0.212 0.660 0.000
#> GSM553615 4 0.4410 0.734 0.124 0.000 0.112 0.764 0.000
#> GSM553616 5 0.2628 0.841 0.000 0.000 0.028 0.088 0.884
#> GSM553617 5 0.2473 0.851 0.000 0.000 0.032 0.072 0.896
#> GSM553618 5 0.2208 0.852 0.000 0.000 0.020 0.072 0.908
#> GSM553619 4 0.5059 0.109 0.000 0.000 0.036 0.548 0.416
#> GSM553620 1 0.3002 0.932 0.856 0.000 0.116 0.028 0.000
#> GSM553621 1 0.0955 0.951 0.968 0.000 0.004 0.028 0.000
#> GSM553622 1 0.0794 0.951 0.972 0.000 0.000 0.028 0.000
#> GSM553623 5 0.2473 0.851 0.000 0.000 0.032 0.072 0.896
#> GSM553624 5 0.2983 0.844 0.000 0.000 0.056 0.076 0.868
#> GSM553625 4 0.3003 0.756 0.000 0.000 0.044 0.864 0.092
#> GSM553626 4 0.4210 0.746 0.124 0.000 0.096 0.780 0.000
#> GSM553627 4 0.2221 0.790 0.000 0.000 0.036 0.912 0.052
#> GSM553628 4 0.4210 0.746 0.124 0.000 0.096 0.780 0.000
#> GSM553629 5 0.4193 0.739 0.000 0.000 0.040 0.212 0.748
#> GSM553630 4 0.1444 0.794 0.012 0.000 0.000 0.948 0.040
#> GSM553631 4 0.3413 0.755 0.124 0.000 0.044 0.832 0.000
#> GSM553632 1 0.3283 0.913 0.832 0.000 0.140 0.028 0.000
#> GSM553633 5 0.1478 0.799 0.000 0.000 0.064 0.000 0.936
#> GSM553634 2 0.1792 0.693 0.000 0.916 0.084 0.000 0.000
#> GSM553635 2 0.4256 0.484 0.000 0.564 0.436 0.000 0.000
#> GSM553636 2 0.4446 0.425 0.000 0.520 0.476 0.004 0.000
#> GSM553637 2 0.0000 0.689 0.000 1.000 0.000 0.000 0.000
#> GSM553638 2 0.0000 0.689 0.000 1.000 0.000 0.000 0.000
#> GSM553639 2 0.4302 0.428 0.000 0.520 0.480 0.000 0.000
#> GSM553640 2 0.4291 0.451 0.000 0.536 0.464 0.000 0.000
#> GSM553641 3 0.7984 0.000 0.028 0.252 0.460 0.052 0.208
#> GSM553642 1 0.0955 0.951 0.968 0.000 0.004 0.028 0.000
#> GSM553643 4 0.1270 0.791 0.000 0.000 0.000 0.948 0.052
#> GSM553644 1 0.3002 0.932 0.856 0.000 0.116 0.028 0.000
#> GSM553645 5 0.1608 0.851 0.000 0.000 0.000 0.072 0.928
#> GSM553646 4 0.3012 0.756 0.124 0.000 0.024 0.852 0.000
#> GSM553647 5 0.2685 0.839 0.000 0.000 0.028 0.092 0.880
#> GSM553648 5 0.5626 0.237 0.028 0.000 0.292 0.052 0.628
#> GSM553649 5 0.1908 0.759 0.000 0.000 0.092 0.000 0.908
#> GSM553650 2 0.1792 0.693 0.000 0.916 0.084 0.000 0.000
#> GSM553651 2 0.4446 0.425 0.000 0.520 0.476 0.004 0.000
#> GSM553652 2 0.4242 0.491 0.000 0.572 0.428 0.000 0.000
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> GSM553595 5 0.6067 0.208 0.000 0.096 0.044 0.408 0.452 0.000
#> GSM553596 5 0.3156 0.731 0.000 0.020 0.180 0.000 0.800 0.000
#> GSM553597 4 0.2816 0.855 0.000 0.060 0.036 0.876 0.028 0.000
#> GSM553598 5 0.3802 0.696 0.000 0.044 0.208 0.000 0.748 0.000
#> GSM553599 5 0.0260 0.791 0.000 0.008 0.000 0.000 0.992 0.000
#> GSM553600 1 0.1983 0.934 0.916 0.060 0.012 0.012 0.000 0.000
#> GSM553601 5 0.2629 0.763 0.000 0.048 0.028 0.036 0.888 0.000
#> GSM553602 1 0.0363 0.939 0.988 0.000 0.000 0.012 0.000 0.000
#> GSM553603 4 0.0865 0.871 0.000 0.000 0.000 0.964 0.036 0.000
#> GSM553604 5 0.3481 0.730 0.000 0.052 0.044 0.068 0.836 0.000
#> GSM553605 3 0.4687 0.491 0.000 0.060 0.604 0.000 0.000 0.336
#> GSM553606 6 0.0806 0.915 0.008 0.000 0.000 0.020 0.000 0.972
#> GSM553607 6 0.0806 0.915 0.008 0.000 0.000 0.020 0.000 0.972
#> GSM553608 2 0.3961 0.892 0.004 0.556 0.000 0.000 0.000 0.440
#> GSM553609 6 0.1349 0.895 0.004 0.056 0.000 0.000 0.000 0.940
#> GSM553610 6 0.0806 0.915 0.008 0.000 0.000 0.020 0.000 0.972
#> GSM553611 6 0.1531 0.886 0.004 0.068 0.000 0.000 0.000 0.928
#> GSM553612 6 0.1349 0.895 0.004 0.056 0.000 0.000 0.000 0.940
#> GSM553613 6 0.0806 0.915 0.008 0.000 0.000 0.020 0.000 0.972
#> GSM553614 4 0.5131 0.748 0.028 0.200 0.100 0.672 0.000 0.000
#> GSM553615 4 0.4813 0.817 0.028 0.148 0.108 0.716 0.000 0.000
#> GSM553616 5 0.1003 0.786 0.000 0.020 0.016 0.000 0.964 0.000
#> GSM553617 5 0.1387 0.787 0.000 0.000 0.068 0.000 0.932 0.000
#> GSM553618 5 0.2258 0.786 0.000 0.044 0.060 0.000 0.896 0.000
#> GSM553619 5 0.6115 0.210 0.000 0.108 0.040 0.412 0.440 0.000
#> GSM553620 1 0.2913 0.919 0.860 0.092 0.036 0.012 0.000 0.000
#> GSM553621 1 0.0363 0.939 0.988 0.000 0.000 0.012 0.000 0.000
#> GSM553622 1 0.0363 0.939 0.988 0.000 0.000 0.012 0.000 0.000
#> GSM553623 5 0.1387 0.787 0.000 0.000 0.068 0.000 0.932 0.000
#> GSM553624 5 0.2367 0.775 0.000 0.016 0.088 0.008 0.888 0.000
#> GSM553625 4 0.4113 0.813 0.000 0.084 0.056 0.792 0.068 0.000
#> GSM553626 4 0.4057 0.846 0.028 0.092 0.092 0.788 0.000 0.000
#> GSM553627 4 0.2775 0.871 0.000 0.048 0.040 0.880 0.032 0.000
#> GSM553628 4 0.4057 0.846 0.028 0.092 0.092 0.788 0.000 0.000
#> GSM553629 5 0.3181 0.745 0.000 0.052 0.048 0.044 0.856 0.000
#> GSM553630 4 0.0951 0.878 0.008 0.000 0.004 0.968 0.020 0.000
#> GSM553631 4 0.1962 0.880 0.028 0.020 0.028 0.924 0.000 0.000
#> GSM553632 1 0.3561 0.880 0.812 0.120 0.056 0.012 0.000 0.000
#> GSM553633 5 0.3671 0.698 0.000 0.036 0.208 0.000 0.756 0.000
#> GSM553634 6 0.1858 0.853 0.004 0.092 0.000 0.000 0.000 0.904
#> GSM553635 2 0.3747 0.938 0.000 0.604 0.000 0.000 0.000 0.396
#> GSM553636 2 0.4138 0.938 0.000 0.620 0.008 0.008 0.000 0.364
#> GSM553637 6 0.0806 0.915 0.008 0.000 0.000 0.020 0.000 0.972
#> GSM553638 6 0.0363 0.914 0.000 0.000 0.000 0.012 0.000 0.988
#> GSM553639 2 0.3684 0.946 0.000 0.628 0.000 0.000 0.000 0.372
#> GSM553640 2 0.3684 0.946 0.000 0.628 0.000 0.000 0.000 0.372
#> GSM553641 3 0.3992 0.690 0.000 0.104 0.788 0.000 0.020 0.088
#> GSM553642 1 0.0363 0.939 0.988 0.000 0.000 0.012 0.000 0.000
#> GSM553643 4 0.1003 0.875 0.000 0.004 0.004 0.964 0.028 0.000
#> GSM553644 1 0.2913 0.919 0.860 0.092 0.036 0.012 0.000 0.000
#> GSM553645 5 0.1168 0.793 0.000 0.016 0.028 0.000 0.956 0.000
#> GSM553646 4 0.1528 0.876 0.028 0.012 0.016 0.944 0.000 0.000
#> GSM553647 5 0.1801 0.780 0.000 0.056 0.016 0.004 0.924 0.000
#> GSM553648 3 0.2980 0.563 0.000 0.012 0.808 0.000 0.180 0.000
#> GSM553649 5 0.4855 0.448 0.000 0.076 0.328 0.000 0.596 0.000
#> GSM553650 6 0.1806 0.860 0.004 0.088 0.000 0.000 0.000 0.908
#> GSM553651 2 0.4138 0.938 0.000 0.620 0.008 0.008 0.000 0.364
#> GSM553652 2 0.3966 0.889 0.004 0.552 0.000 0.000 0.000 0.444
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 individual(p) k
#> ATC:kmeans 58 0.4538 2
#> ATC:kmeans 58 0.3291 3
#> ATC:kmeans 55 0.7672 4
#> ATC:kmeans 46 0.3561 5
#> ATC:kmeans 54 0.0879 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 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 1.000 0.968 0.988 0.5070 0.494 0.494
#> 3 3 0.958 0.939 0.971 0.2164 0.856 0.715
#> 4 4 0.933 0.874 0.952 0.0760 0.973 0.928
#> 5 5 0.863 0.798 0.913 0.0398 0.951 0.864
#> 6 6 0.803 0.749 0.882 0.0360 0.979 0.935
suggest_best_k()
suggests the best \(k\) based on these statistics. The rules are as follows:
suggest_best_k(res)
#> [1] 4
#> attr(,"optional")
#> [1] 2 3
There is also optional best \(k\) = 2 3 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
#> GSM553595 1 0.000 0.986 1.000 0.000
#> GSM553596 2 0.000 0.987 0.000 1.000
#> GSM553597 1 0.000 0.986 1.000 0.000
#> GSM553598 2 0.000 0.987 0.000 1.000
#> GSM553599 1 0.000 0.986 1.000 0.000
#> GSM553600 1 0.000 0.986 1.000 0.000
#> GSM553601 1 0.000 0.986 1.000 0.000
#> GSM553602 1 0.000 0.986 1.000 0.000
#> GSM553603 1 0.000 0.986 1.000 0.000
#> GSM553604 1 0.000 0.986 1.000 0.000
#> GSM553605 2 0.000 0.987 0.000 1.000
#> GSM553606 2 0.000 0.987 0.000 1.000
#> GSM553607 2 0.000 0.987 0.000 1.000
#> GSM553608 2 0.000 0.987 0.000 1.000
#> GSM553609 2 0.000 0.987 0.000 1.000
#> GSM553610 2 0.000 0.987 0.000 1.000
#> GSM553611 2 0.000 0.987 0.000 1.000
#> GSM553612 2 0.000 0.987 0.000 1.000
#> GSM553613 2 0.000 0.987 0.000 1.000
#> GSM553614 1 0.000 0.986 1.000 0.000
#> GSM553615 1 0.000 0.986 1.000 0.000
#> GSM553616 1 0.000 0.986 1.000 0.000
#> GSM553617 2 0.000 0.987 0.000 1.000
#> GSM553618 1 0.000 0.986 1.000 0.000
#> GSM553619 1 0.000 0.986 1.000 0.000
#> GSM553620 1 0.000 0.986 1.000 0.000
#> GSM553621 1 0.000 0.986 1.000 0.000
#> GSM553622 1 0.000 0.986 1.000 0.000
#> GSM553623 2 0.900 0.528 0.316 0.684
#> GSM553624 2 0.000 0.987 0.000 1.000
#> GSM553625 1 0.000 0.986 1.000 0.000
#> GSM553626 1 0.000 0.986 1.000 0.000
#> GSM553627 1 0.000 0.986 1.000 0.000
#> GSM553628 1 0.000 0.986 1.000 0.000
#> GSM553629 1 0.000 0.986 1.000 0.000
#> GSM553630 1 0.000 0.986 1.000 0.000
#> GSM553631 1 0.000 0.986 1.000 0.000
#> GSM553632 1 0.000 0.986 1.000 0.000
#> GSM553633 2 0.000 0.987 0.000 1.000
#> GSM553634 2 0.000 0.987 0.000 1.000
#> GSM553635 2 0.000 0.987 0.000 1.000
#> GSM553636 2 0.000 0.987 0.000 1.000
#> GSM553637 2 0.000 0.987 0.000 1.000
#> GSM553638 2 0.000 0.987 0.000 1.000
#> GSM553639 2 0.000 0.987 0.000 1.000
#> GSM553640 2 0.000 0.987 0.000 1.000
#> GSM553641 2 0.000 0.987 0.000 1.000
#> GSM553642 1 0.000 0.986 1.000 0.000
#> GSM553643 1 0.000 0.986 1.000 0.000
#> GSM553644 1 0.000 0.986 1.000 0.000
#> GSM553645 1 0.000 0.986 1.000 0.000
#> GSM553646 1 0.000 0.986 1.000 0.000
#> GSM553647 1 0.000 0.986 1.000 0.000
#> GSM553648 2 0.000 0.987 0.000 1.000
#> GSM553649 1 0.971 0.326 0.600 0.400
#> GSM553650 2 0.000 0.987 0.000 1.000
#> GSM553651 2 0.000 0.987 0.000 1.000
#> GSM553652 2 0.000 0.987 0.000 1.000
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> GSM553595 1 0.0000 0.986 1.000 0.000 0.000
#> GSM553596 3 0.5988 0.449 0.000 0.368 0.632
#> GSM553597 1 0.0000 0.986 1.000 0.000 0.000
#> GSM553598 3 0.0000 0.830 0.000 0.000 1.000
#> GSM553599 3 0.0237 0.830 0.004 0.000 0.996
#> GSM553600 1 0.0000 0.986 1.000 0.000 0.000
#> GSM553601 1 0.1289 0.957 0.968 0.000 0.032
#> GSM553602 1 0.0000 0.986 1.000 0.000 0.000
#> GSM553603 1 0.0000 0.986 1.000 0.000 0.000
#> GSM553604 1 0.0000 0.986 1.000 0.000 0.000
#> GSM553605 2 0.0237 0.996 0.000 0.996 0.004
#> GSM553606 2 0.0000 0.999 0.000 1.000 0.000
#> GSM553607 2 0.0000 0.999 0.000 1.000 0.000
#> GSM553608 2 0.0000 0.999 0.000 1.000 0.000
#> GSM553609 2 0.0000 0.999 0.000 1.000 0.000
#> GSM553610 2 0.0000 0.999 0.000 1.000 0.000
#> GSM553611 2 0.0000 0.999 0.000 1.000 0.000
#> GSM553612 2 0.0000 0.999 0.000 1.000 0.000
#> GSM553613 2 0.0000 0.999 0.000 1.000 0.000
#> GSM553614 1 0.0000 0.986 1.000 0.000 0.000
#> GSM553615 1 0.0000 0.986 1.000 0.000 0.000
#> GSM553616 1 0.4702 0.723 0.788 0.000 0.212
#> GSM553617 3 0.0237 0.830 0.000 0.004 0.996
#> GSM553618 3 0.0000 0.830 0.000 0.000 1.000
#> GSM553619 1 0.2711 0.898 0.912 0.000 0.088
#> GSM553620 1 0.0000 0.986 1.000 0.000 0.000
#> GSM553621 1 0.0000 0.986 1.000 0.000 0.000
#> GSM553622 1 0.0000 0.986 1.000 0.000 0.000
#> GSM553623 3 0.0237 0.830 0.000 0.004 0.996
#> GSM553624 2 0.0000 0.999 0.000 1.000 0.000
#> GSM553625 1 0.0000 0.986 1.000 0.000 0.000
#> GSM553626 1 0.0000 0.986 1.000 0.000 0.000
#> GSM553627 1 0.0000 0.986 1.000 0.000 0.000
#> GSM553628 1 0.0000 0.986 1.000 0.000 0.000
#> GSM553629 1 0.0000 0.986 1.000 0.000 0.000
#> GSM553630 1 0.0000 0.986 1.000 0.000 0.000
#> GSM553631 1 0.0000 0.986 1.000 0.000 0.000
#> GSM553632 1 0.0000 0.986 1.000 0.000 0.000
#> GSM553633 3 0.5621 0.567 0.000 0.308 0.692
#> GSM553634 2 0.0000 0.999 0.000 1.000 0.000
#> GSM553635 2 0.0000 0.999 0.000 1.000 0.000
#> GSM553636 2 0.0000 0.999 0.000 1.000 0.000
#> GSM553637 2 0.0000 0.999 0.000 1.000 0.000
#> GSM553638 2 0.0000 0.999 0.000 1.000 0.000
#> GSM553639 2 0.0000 0.999 0.000 1.000 0.000
#> GSM553640 2 0.0000 0.999 0.000 1.000 0.000
#> GSM553641 2 0.0237 0.996 0.000 0.996 0.004
#> GSM553642 1 0.0000 0.986 1.000 0.000 0.000
#> GSM553643 1 0.0000 0.986 1.000 0.000 0.000
#> GSM553644 1 0.0000 0.986 1.000 0.000 0.000
#> GSM553645 3 0.6154 0.350 0.408 0.000 0.592
#> GSM553646 1 0.0000 0.986 1.000 0.000 0.000
#> GSM553647 1 0.0000 0.986 1.000 0.000 0.000
#> GSM553648 2 0.0237 0.996 0.000 0.996 0.004
#> GSM553649 3 0.5708 0.698 0.204 0.028 0.768
#> GSM553650 2 0.0000 0.999 0.000 1.000 0.000
#> GSM553651 2 0.0000 0.999 0.000 1.000 0.000
#> GSM553652 2 0.0000 0.999 0.000 1.000 0.000
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> GSM553595 1 0.0000 0.9632 1.000 0.000 0.000 0.000
#> GSM553596 3 0.3013 0.8001 0.000 0.080 0.888 0.032
#> GSM553597 1 0.0000 0.9632 1.000 0.000 0.000 0.000
#> GSM553598 4 0.3975 0.7459 0.000 0.000 0.240 0.760
#> GSM553599 4 0.0336 0.8871 0.000 0.000 0.008 0.992
#> GSM553600 1 0.0000 0.9632 1.000 0.000 0.000 0.000
#> GSM553601 1 0.3942 0.6994 0.764 0.000 0.000 0.236
#> GSM553602 1 0.0000 0.9632 1.000 0.000 0.000 0.000
#> GSM553603 1 0.0000 0.9632 1.000 0.000 0.000 0.000
#> GSM553604 1 0.0000 0.9632 1.000 0.000 0.000 0.000
#> GSM553605 2 0.4994 -0.0483 0.000 0.520 0.480 0.000
#> GSM553606 2 0.0000 0.9452 0.000 1.000 0.000 0.000
#> GSM553607 2 0.0000 0.9452 0.000 1.000 0.000 0.000
#> GSM553608 2 0.0000 0.9452 0.000 1.000 0.000 0.000
#> GSM553609 2 0.0000 0.9452 0.000 1.000 0.000 0.000
#> GSM553610 2 0.0000 0.9452 0.000 1.000 0.000 0.000
#> GSM553611 2 0.0000 0.9452 0.000 1.000 0.000 0.000
#> GSM553612 2 0.0000 0.9452 0.000 1.000 0.000 0.000
#> GSM553613 2 0.0000 0.9452 0.000 1.000 0.000 0.000
#> GSM553614 1 0.0000 0.9632 1.000 0.000 0.000 0.000
#> GSM553615 1 0.0000 0.9632 1.000 0.000 0.000 0.000
#> GSM553616 1 0.5080 0.3102 0.576 0.000 0.004 0.420
#> GSM553617 4 0.0000 0.8895 0.000 0.000 0.000 1.000
#> GSM553618 4 0.3266 0.8228 0.000 0.000 0.168 0.832
#> GSM553619 1 0.4040 0.6806 0.752 0.000 0.000 0.248
#> GSM553620 1 0.0000 0.9632 1.000 0.000 0.000 0.000
#> GSM553621 1 0.0000 0.9632 1.000 0.000 0.000 0.000
#> GSM553622 1 0.0000 0.9632 1.000 0.000 0.000 0.000
#> GSM553623 4 0.0000 0.8895 0.000 0.000 0.000 1.000
#> GSM553624 2 0.0000 0.9452 0.000 1.000 0.000 0.000
#> GSM553625 1 0.0000 0.9632 1.000 0.000 0.000 0.000
#> GSM553626 1 0.0000 0.9632 1.000 0.000 0.000 0.000
#> GSM553627 1 0.0000 0.9632 1.000 0.000 0.000 0.000
#> GSM553628 1 0.0000 0.9632 1.000 0.000 0.000 0.000
#> GSM553629 1 0.0000 0.9632 1.000 0.000 0.000 0.000
#> GSM553630 1 0.0000 0.9632 1.000 0.000 0.000 0.000
#> GSM553631 1 0.0000 0.9632 1.000 0.000 0.000 0.000
#> GSM553632 1 0.0000 0.9632 1.000 0.000 0.000 0.000
#> GSM553633 3 0.1388 0.8233 0.000 0.028 0.960 0.012
#> GSM553634 2 0.0000 0.9452 0.000 1.000 0.000 0.000
#> GSM553635 2 0.0000 0.9452 0.000 1.000 0.000 0.000
#> GSM553636 2 0.0000 0.9452 0.000 1.000 0.000 0.000
#> GSM553637 2 0.0000 0.9452 0.000 1.000 0.000 0.000
#> GSM553638 2 0.0000 0.9452 0.000 1.000 0.000 0.000
#> GSM553639 2 0.0000 0.9452 0.000 1.000 0.000 0.000
#> GSM553640 2 0.0000 0.9452 0.000 1.000 0.000 0.000
#> GSM553641 2 0.4992 -0.0330 0.000 0.524 0.476 0.000
#> GSM553642 1 0.0000 0.9632 1.000 0.000 0.000 0.000
#> GSM553643 1 0.0000 0.9632 1.000 0.000 0.000 0.000
#> GSM553644 1 0.0000 0.9632 1.000 0.000 0.000 0.000
#> GSM553645 3 0.1576 0.7775 0.048 0.000 0.948 0.004
#> GSM553646 1 0.0000 0.9632 1.000 0.000 0.000 0.000
#> GSM553647 1 0.0921 0.9402 0.972 0.000 0.028 0.000
#> GSM553648 3 0.4134 0.6067 0.000 0.260 0.740 0.000
#> GSM553649 3 0.0000 0.8053 0.000 0.000 1.000 0.000
#> GSM553650 2 0.0000 0.9452 0.000 1.000 0.000 0.000
#> GSM553651 2 0.0000 0.9452 0.000 1.000 0.000 0.000
#> GSM553652 2 0.0000 0.9452 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
#> GSM553595 4 0.1341 0.909 0.056 0.000 0.000 0.944 0.000
#> GSM553596 3 0.2769 0.253 0.064 0.024 0.892 0.000 0.020
#> GSM553597 4 0.0609 0.929 0.020 0.000 0.000 0.980 0.000
#> GSM553598 5 0.6472 0.294 0.224 0.000 0.284 0.000 0.492
#> GSM553599 5 0.1544 0.583 0.068 0.000 0.000 0.000 0.932
#> GSM553600 4 0.0162 0.933 0.004 0.000 0.000 0.996 0.000
#> GSM553601 4 0.3812 0.785 0.092 0.000 0.000 0.812 0.096
#> GSM553602 4 0.0162 0.933 0.004 0.000 0.000 0.996 0.000
#> GSM553603 4 0.0000 0.934 0.000 0.000 0.000 1.000 0.000
#> GSM553604 4 0.3336 0.744 0.228 0.000 0.000 0.772 0.000
#> GSM553605 3 0.4192 0.446 0.000 0.404 0.596 0.000 0.000
#> GSM553606 2 0.0000 0.999 0.000 1.000 0.000 0.000 0.000
#> GSM553607 2 0.0000 0.999 0.000 1.000 0.000 0.000 0.000
#> GSM553608 2 0.0000 0.999 0.000 1.000 0.000 0.000 0.000
#> GSM553609 2 0.0000 0.999 0.000 1.000 0.000 0.000 0.000
#> GSM553610 2 0.0000 0.999 0.000 1.000 0.000 0.000 0.000
#> GSM553611 2 0.0000 0.999 0.000 1.000 0.000 0.000 0.000
#> GSM553612 2 0.0000 0.999 0.000 1.000 0.000 0.000 0.000
#> GSM553613 2 0.0000 0.999 0.000 1.000 0.000 0.000 0.000
#> GSM553614 4 0.0404 0.932 0.012 0.000 0.000 0.988 0.000
#> GSM553615 4 0.0609 0.930 0.020 0.000 0.000 0.980 0.000
#> GSM553616 5 0.6536 0.127 0.184 0.000 0.004 0.332 0.480
#> GSM553617 5 0.0992 0.610 0.024 0.000 0.008 0.000 0.968
#> GSM553618 5 0.5778 0.424 0.272 0.000 0.132 0.000 0.596
#> GSM553619 4 0.4444 0.693 0.156 0.000 0.000 0.756 0.088
#> GSM553620 4 0.0162 0.934 0.004 0.000 0.000 0.996 0.000
#> GSM553621 4 0.0162 0.934 0.004 0.000 0.000 0.996 0.000
#> GSM553622 4 0.0000 0.934 0.000 0.000 0.000 1.000 0.000
#> GSM553623 5 0.0000 0.609 0.000 0.000 0.000 0.000 1.000
#> GSM553624 2 0.0404 0.986 0.012 0.988 0.000 0.000 0.000
#> GSM553625 4 0.1478 0.906 0.064 0.000 0.000 0.936 0.000
#> GSM553626 4 0.1043 0.919 0.040 0.000 0.000 0.960 0.000
#> GSM553627 4 0.1197 0.915 0.048 0.000 0.000 0.952 0.000
#> GSM553628 4 0.0794 0.925 0.028 0.000 0.000 0.972 0.000
#> GSM553629 4 0.3993 0.736 0.216 0.000 0.000 0.756 0.028
#> GSM553630 4 0.0162 0.934 0.004 0.000 0.000 0.996 0.000
#> GSM553631 4 0.0000 0.934 0.000 0.000 0.000 1.000 0.000
#> GSM553632 4 0.0162 0.933 0.004 0.000 0.000 0.996 0.000
#> GSM553633 3 0.2548 0.102 0.116 0.004 0.876 0.000 0.004
#> GSM553634 2 0.0000 0.999 0.000 1.000 0.000 0.000 0.000
#> GSM553635 2 0.0000 0.999 0.000 1.000 0.000 0.000 0.000
#> GSM553636 2 0.0000 0.999 0.000 1.000 0.000 0.000 0.000
#> GSM553637 2 0.0000 0.999 0.000 1.000 0.000 0.000 0.000
#> GSM553638 2 0.0000 0.999 0.000 1.000 0.000 0.000 0.000
#> GSM553639 2 0.0000 0.999 0.000 1.000 0.000 0.000 0.000
#> GSM553640 2 0.0000 0.999 0.000 1.000 0.000 0.000 0.000
#> GSM553641 3 0.4219 0.437 0.000 0.416 0.584 0.000 0.000
#> GSM553642 4 0.0162 0.934 0.004 0.000 0.000 0.996 0.000
#> GSM553643 4 0.0162 0.934 0.004 0.000 0.000 0.996 0.000
#> GSM553644 4 0.0162 0.934 0.004 0.000 0.000 0.996 0.000
#> GSM553645 1 0.4286 0.000 0.652 0.000 0.340 0.004 0.004
#> GSM553646 4 0.0162 0.934 0.004 0.000 0.000 0.996 0.000
#> GSM553647 4 0.4744 0.352 0.408 0.000 0.020 0.572 0.000
#> GSM553648 3 0.3424 0.461 0.000 0.240 0.760 0.000 0.000
#> GSM553649 3 0.1732 0.170 0.080 0.000 0.920 0.000 0.000
#> GSM553650 2 0.0000 0.999 0.000 1.000 0.000 0.000 0.000
#> GSM553651 2 0.0000 0.999 0.000 1.000 0.000 0.000 0.000
#> GSM553652 2 0.0000 0.999 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
#> GSM553595 1 0.3281 0.7433 0.840 0.000 0.016 0.000 0.088 0.056
#> GSM553596 3 0.3473 0.5968 0.000 0.016 0.848 0.032 0.060 0.044
#> GSM553597 1 0.2052 0.8225 0.912 0.000 0.004 0.000 0.056 0.028
#> GSM553598 4 0.2213 0.5039 0.000 0.000 0.100 0.888 0.004 0.008
#> GSM553599 5 0.4178 -0.4155 0.000 0.000 0.004 0.428 0.560 0.008
#> GSM553600 1 0.0993 0.8661 0.964 0.000 0.000 0.000 0.024 0.012
#> GSM553601 1 0.4062 0.7240 0.792 0.000 0.000 0.096 0.072 0.040
#> GSM553602 1 0.0622 0.8702 0.980 0.000 0.000 0.000 0.008 0.012
#> GSM553603 1 0.0146 0.8707 0.996 0.000 0.000 0.000 0.004 0.000
#> GSM553604 1 0.4827 0.4104 0.632 0.000 0.000 0.000 0.092 0.276
#> GSM553605 3 0.3309 0.6566 0.000 0.280 0.720 0.000 0.000 0.000
#> GSM553606 2 0.0146 0.9941 0.000 0.996 0.004 0.000 0.000 0.000
#> GSM553607 2 0.0146 0.9941 0.000 0.996 0.004 0.000 0.000 0.000
#> GSM553608 2 0.0000 0.9941 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM553609 2 0.0146 0.9941 0.000 0.996 0.004 0.000 0.000 0.000
#> GSM553610 2 0.0146 0.9941 0.000 0.996 0.004 0.000 0.000 0.000
#> GSM553611 2 0.0000 0.9941 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM553612 2 0.0146 0.9941 0.000 0.996 0.004 0.000 0.000 0.000
#> GSM553613 2 0.0146 0.9941 0.000 0.996 0.004 0.000 0.000 0.000
#> GSM553614 1 0.0291 0.8704 0.992 0.000 0.000 0.000 0.004 0.004
#> GSM553615 1 0.2331 0.8376 0.888 0.000 0.000 0.000 0.080 0.032
#> GSM553616 5 0.4165 0.2111 0.156 0.000 0.012 0.016 0.772 0.044
#> GSM553617 4 0.3861 0.4091 0.000 0.000 0.000 0.640 0.352 0.008
#> GSM553618 4 0.1078 0.5466 0.000 0.000 0.016 0.964 0.008 0.012
#> GSM553619 1 0.4158 0.4466 0.688 0.000 0.000 0.280 0.020 0.012
#> GSM553620 1 0.0000 0.8716 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM553621 1 0.0000 0.8716 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM553622 1 0.0520 0.8709 0.984 0.000 0.000 0.000 0.008 0.008
#> GSM553623 4 0.3955 0.3602 0.000 0.000 0.000 0.608 0.384 0.008
#> GSM553624 2 0.1498 0.9316 0.000 0.940 0.000 0.000 0.028 0.032
#> GSM553625 1 0.3215 0.7800 0.828 0.000 0.000 0.000 0.072 0.100
#> GSM553626 1 0.2856 0.8044 0.856 0.000 0.000 0.000 0.076 0.068
#> GSM553627 1 0.2966 0.7974 0.848 0.000 0.000 0.000 0.076 0.076
#> GSM553628 1 0.2857 0.8046 0.856 0.000 0.000 0.000 0.072 0.072
#> GSM553629 1 0.5660 0.0355 0.492 0.000 0.004 0.000 0.364 0.140
#> GSM553630 1 0.0000 0.8716 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM553631 1 0.0260 0.8717 0.992 0.000 0.000 0.000 0.000 0.008
#> GSM553632 1 0.1225 0.8625 0.952 0.000 0.000 0.000 0.036 0.012
#> GSM553633 3 0.4425 0.5423 0.000 0.012 0.736 0.056 0.008 0.188
#> GSM553634 2 0.0146 0.9941 0.000 0.996 0.004 0.000 0.000 0.000
#> GSM553635 2 0.0000 0.9941 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM553636 2 0.0000 0.9941 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM553637 2 0.0146 0.9941 0.000 0.996 0.004 0.000 0.000 0.000
#> GSM553638 2 0.0146 0.9941 0.000 0.996 0.004 0.000 0.000 0.000
#> GSM553639 2 0.0000 0.9941 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM553640 2 0.0000 0.9941 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM553641 3 0.3482 0.6189 0.000 0.316 0.684 0.000 0.000 0.000
#> GSM553642 1 0.0000 0.8716 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM553643 1 0.0725 0.8646 0.976 0.000 0.000 0.000 0.012 0.012
#> GSM553644 1 0.0000 0.8716 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM553645 6 0.2865 -0.1125 0.004 0.000 0.120 0.020 0.004 0.852
#> GSM553646 1 0.0291 0.8698 0.992 0.000 0.000 0.000 0.004 0.004
#> GSM553647 6 0.4950 0.0667 0.416 0.000 0.004 0.000 0.056 0.524
#> GSM553648 3 0.2697 0.6956 0.000 0.188 0.812 0.000 0.000 0.000
#> GSM553649 3 0.2958 0.5817 0.000 0.000 0.852 0.028 0.012 0.108
#> GSM553650 2 0.0000 0.9941 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM553651 2 0.0000 0.9941 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM553652 2 0.0000 0.9941 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 individual(p) k
#> ATC:skmeans 57 0.513 2
#> ATC:skmeans 56 0.706 3
#> ATC:skmeans 55 0.270 4
#> ATC:skmeans 47 0.796 5
#> ATC:skmeans 49 0.471 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 6.
#>
#> 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.978 0.992 0.4755 0.521 0.521
#> 3 3 1.000 0.989 0.995 0.3973 0.763 0.567
#> 4 4 1.000 0.994 0.998 0.1151 0.864 0.630
#> 5 5 0.931 0.868 0.945 0.0588 0.958 0.840
#> 6 6 1.000 0.935 0.975 0.0413 0.964 0.841
suggest_best_k()
suggests the best \(k\) based on these statistics. The rules are as follows:
suggest_best_k(res)
#> [1] 6
#> attr(,"optional")
#> [1] 2 3 4 5
There is also optional best \(k\) = 2 3 4 5 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
#> GSM553595 1 0.000 1.000 1.000 0.000
#> GSM553596 1 0.000 1.000 1.000 0.000
#> GSM553597 1 0.000 1.000 1.000 0.000
#> GSM553598 1 0.000 1.000 1.000 0.000
#> GSM553599 1 0.000 1.000 1.000 0.000
#> GSM553600 1 0.000 1.000 1.000 0.000
#> GSM553601 1 0.000 1.000 1.000 0.000
#> GSM553602 1 0.000 1.000 1.000 0.000
#> GSM553603 1 0.000 1.000 1.000 0.000
#> GSM553604 1 0.000 1.000 1.000 0.000
#> GSM553605 2 0.000 0.978 0.000 1.000
#> GSM553606 2 0.000 0.978 0.000 1.000
#> GSM553607 2 0.000 0.978 0.000 1.000
#> GSM553608 2 0.000 0.978 0.000 1.000
#> GSM553609 2 0.000 0.978 0.000 1.000
#> GSM553610 2 0.000 0.978 0.000 1.000
#> GSM553611 2 0.000 0.978 0.000 1.000
#> GSM553612 2 0.000 0.978 0.000 1.000
#> GSM553613 2 0.000 0.978 0.000 1.000
#> GSM553614 1 0.000 1.000 1.000 0.000
#> GSM553615 1 0.000 1.000 1.000 0.000
#> GSM553616 1 0.000 1.000 1.000 0.000
#> GSM553617 1 0.000 1.000 1.000 0.000
#> GSM553618 1 0.000 1.000 1.000 0.000
#> GSM553619 1 0.000 1.000 1.000 0.000
#> GSM553620 1 0.000 1.000 1.000 0.000
#> GSM553621 1 0.000 1.000 1.000 0.000
#> GSM553622 1 0.000 1.000 1.000 0.000
#> GSM553623 1 0.000 1.000 1.000 0.000
#> GSM553624 2 0.994 0.162 0.456 0.544
#> GSM553625 1 0.000 1.000 1.000 0.000
#> GSM553626 1 0.000 1.000 1.000 0.000
#> GSM553627 1 0.000 1.000 1.000 0.000
#> GSM553628 1 0.000 1.000 1.000 0.000
#> GSM553629 1 0.000 1.000 1.000 0.000
#> GSM553630 1 0.000 1.000 1.000 0.000
#> GSM553631 1 0.000 1.000 1.000 0.000
#> GSM553632 1 0.000 1.000 1.000 0.000
#> GSM553633 1 0.000 1.000 1.000 0.000
#> GSM553634 2 0.000 0.978 0.000 1.000
#> GSM553635 2 0.000 0.978 0.000 1.000
#> GSM553636 2 0.000 0.978 0.000 1.000
#> GSM553637 2 0.000 0.978 0.000 1.000
#> GSM553638 2 0.000 0.978 0.000 1.000
#> GSM553639 2 0.000 0.978 0.000 1.000
#> GSM553640 2 0.000 0.978 0.000 1.000
#> GSM553641 2 0.000 0.978 0.000 1.000
#> GSM553642 1 0.000 1.000 1.000 0.000
#> GSM553643 1 0.000 1.000 1.000 0.000
#> GSM553644 1 0.000 1.000 1.000 0.000
#> GSM553645 1 0.000 1.000 1.000 0.000
#> GSM553646 1 0.000 1.000 1.000 0.000
#> GSM553647 1 0.000 1.000 1.000 0.000
#> GSM553648 2 0.000 0.978 0.000 1.000
#> GSM553649 1 0.000 1.000 1.000 0.000
#> GSM553650 2 0.000 0.978 0.000 1.000
#> GSM553651 2 0.000 0.978 0.000 1.000
#> GSM553652 2 0.000 0.978 0.000 1.000
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> GSM553595 3 0.000 0.990 0.00 0.000 1.000
#> GSM553596 3 0.000 0.990 0.00 0.000 1.000
#> GSM553597 3 0.000 0.990 0.00 0.000 1.000
#> GSM553598 3 0.000 0.990 0.00 0.000 1.000
#> GSM553599 3 0.000 0.990 0.00 0.000 1.000
#> GSM553600 1 0.000 1.000 1.00 0.000 0.000
#> GSM553601 3 0.000 0.990 0.00 0.000 1.000
#> GSM553602 1 0.000 1.000 1.00 0.000 0.000
#> GSM553603 3 0.000 0.990 0.00 0.000 1.000
#> GSM553604 3 0.000 0.990 0.00 0.000 1.000
#> GSM553605 2 0.000 0.997 0.00 1.000 0.000
#> GSM553606 2 0.000 0.997 0.00 1.000 0.000
#> GSM553607 2 0.000 0.997 0.00 1.000 0.000
#> GSM553608 2 0.000 0.997 0.00 1.000 0.000
#> GSM553609 2 0.000 0.997 0.00 1.000 0.000
#> GSM553610 2 0.000 0.997 0.00 1.000 0.000
#> GSM553611 2 0.000 0.997 0.00 1.000 0.000
#> GSM553612 2 0.000 0.997 0.00 1.000 0.000
#> GSM553613 2 0.000 0.997 0.00 1.000 0.000
#> GSM553614 1 0.000 1.000 1.00 0.000 0.000
#> GSM553615 1 0.000 1.000 1.00 0.000 0.000
#> GSM553616 3 0.000 0.990 0.00 0.000 1.000
#> GSM553617 3 0.000 0.990 0.00 0.000 1.000
#> GSM553618 3 0.000 0.990 0.00 0.000 1.000
#> GSM553619 3 0.000 0.990 0.00 0.000 1.000
#> GSM553620 1 0.000 1.000 1.00 0.000 0.000
#> GSM553621 1 0.000 1.000 1.00 0.000 0.000
#> GSM553622 1 0.000 1.000 1.00 0.000 0.000
#> GSM553623 3 0.000 0.990 0.00 0.000 1.000
#> GSM553624 3 0.000 0.990 0.00 0.000 1.000
#> GSM553625 3 0.000 0.990 0.00 0.000 1.000
#> GSM553626 1 0.000 1.000 1.00 0.000 0.000
#> GSM553627 3 0.000 0.990 0.00 0.000 1.000
#> GSM553628 1 0.000 1.000 1.00 0.000 0.000
#> GSM553629 3 0.000 0.990 0.00 0.000 1.000
#> GSM553630 3 0.480 0.718 0.22 0.000 0.780
#> GSM553631 1 0.000 1.000 1.00 0.000 0.000
#> GSM553632 1 0.000 1.000 1.00 0.000 0.000
#> GSM553633 3 0.000 0.990 0.00 0.000 1.000
#> GSM553634 2 0.000 0.997 0.00 1.000 0.000
#> GSM553635 2 0.000 0.997 0.00 1.000 0.000
#> GSM553636 2 0.000 0.997 0.00 1.000 0.000
#> GSM553637 2 0.000 0.997 0.00 1.000 0.000
#> GSM553638 2 0.000 0.997 0.00 1.000 0.000
#> GSM553639 2 0.000 0.997 0.00 1.000 0.000
#> GSM553640 2 0.000 0.997 0.00 1.000 0.000
#> GSM553641 2 0.186 0.940 0.00 0.948 0.052
#> GSM553642 1 0.000 1.000 1.00 0.000 0.000
#> GSM553643 3 0.000 0.990 0.00 0.000 1.000
#> GSM553644 1 0.000 1.000 1.00 0.000 0.000
#> GSM553645 3 0.000 0.990 0.00 0.000 1.000
#> GSM553646 1 0.000 1.000 1.00 0.000 0.000
#> GSM553647 3 0.000 0.990 0.00 0.000 1.000
#> GSM553648 3 0.000 0.990 0.00 0.000 1.000
#> GSM553649 3 0.000 0.990 0.00 0.000 1.000
#> GSM553650 2 0.000 0.997 0.00 1.000 0.000
#> GSM553651 2 0.000 0.997 0.00 1.000 0.000
#> GSM553652 2 0.000 0.997 0.00 1.000 0.000
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> GSM553595 4 0.0188 0.995 0 0.000 0.004 0.996
#> GSM553596 3 0.0000 0.993 0 0.000 1.000 0.000
#> GSM553597 4 0.0000 1.000 0 0.000 0.000 1.000
#> GSM553598 3 0.0000 0.993 0 0.000 1.000 0.000
#> GSM553599 3 0.0000 0.993 0 0.000 1.000 0.000
#> GSM553600 1 0.0000 1.000 1 0.000 0.000 0.000
#> GSM553601 3 0.0000 0.993 0 0.000 1.000 0.000
#> GSM553602 1 0.0000 1.000 1 0.000 0.000 0.000
#> GSM553603 4 0.0000 1.000 0 0.000 0.000 1.000
#> GSM553604 3 0.2149 0.896 0 0.000 0.912 0.088
#> GSM553605 2 0.0000 0.997 0 1.000 0.000 0.000
#> GSM553606 2 0.0000 0.997 0 1.000 0.000 0.000
#> GSM553607 2 0.0000 0.997 0 1.000 0.000 0.000
#> GSM553608 2 0.0000 0.997 0 1.000 0.000 0.000
#> GSM553609 2 0.0000 0.997 0 1.000 0.000 0.000
#> GSM553610 2 0.0000 0.997 0 1.000 0.000 0.000
#> GSM553611 2 0.0000 0.997 0 1.000 0.000 0.000
#> GSM553612 2 0.0000 0.997 0 1.000 0.000 0.000
#> GSM553613 2 0.0000 0.997 0 1.000 0.000 0.000
#> GSM553614 4 0.0000 1.000 0 0.000 0.000 1.000
#> GSM553615 4 0.0000 1.000 0 0.000 0.000 1.000
#> GSM553616 3 0.0000 0.993 0 0.000 1.000 0.000
#> GSM553617 3 0.0000 0.993 0 0.000 1.000 0.000
#> GSM553618 3 0.0000 0.993 0 0.000 1.000 0.000
#> GSM553619 4 0.0000 1.000 0 0.000 0.000 1.000
#> GSM553620 1 0.0000 1.000 1 0.000 0.000 0.000
#> GSM553621 1 0.0000 1.000 1 0.000 0.000 0.000
#> GSM553622 1 0.0000 1.000 1 0.000 0.000 0.000
#> GSM553623 3 0.0000 0.993 0 0.000 1.000 0.000
#> GSM553624 3 0.0000 0.993 0 0.000 1.000 0.000
#> GSM553625 4 0.0000 1.000 0 0.000 0.000 1.000
#> GSM553626 4 0.0000 1.000 0 0.000 0.000 1.000
#> GSM553627 4 0.0000 1.000 0 0.000 0.000 1.000
#> GSM553628 4 0.0000 1.000 0 0.000 0.000 1.000
#> GSM553629 3 0.0000 0.993 0 0.000 1.000 0.000
#> GSM553630 4 0.0000 1.000 0 0.000 0.000 1.000
#> GSM553631 4 0.0000 1.000 0 0.000 0.000 1.000
#> GSM553632 1 0.0000 1.000 1 0.000 0.000 0.000
#> GSM553633 3 0.0000 0.993 0 0.000 1.000 0.000
#> GSM553634 2 0.0000 0.997 0 1.000 0.000 0.000
#> GSM553635 2 0.0000 0.997 0 1.000 0.000 0.000
#> GSM553636 2 0.0000 0.997 0 1.000 0.000 0.000
#> GSM553637 2 0.0000 0.997 0 1.000 0.000 0.000
#> GSM553638 2 0.0000 0.997 0 1.000 0.000 0.000
#> GSM553639 2 0.0000 0.997 0 1.000 0.000 0.000
#> GSM553640 2 0.0000 0.997 0 1.000 0.000 0.000
#> GSM553641 2 0.1474 0.939 0 0.948 0.052 0.000
#> GSM553642 1 0.0000 1.000 1 0.000 0.000 0.000
#> GSM553643 4 0.0000 1.000 0 0.000 0.000 1.000
#> GSM553644 1 0.0000 1.000 1 0.000 0.000 0.000
#> GSM553645 3 0.0000 0.993 0 0.000 1.000 0.000
#> GSM553646 4 0.0000 1.000 0 0.000 0.000 1.000
#> GSM553647 3 0.0000 0.993 0 0.000 1.000 0.000
#> GSM553648 3 0.0000 0.993 0 0.000 1.000 0.000
#> GSM553649 3 0.0000 0.993 0 0.000 1.000 0.000
#> GSM553650 2 0.0000 0.997 0 1.000 0.000 0.000
#> GSM553651 2 0.0000 0.997 0 1.000 0.000 0.000
#> GSM553652 2 0.0000 0.997 0 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
#> GSM553595 4 0.0162 0.995 0 0.000 0.000 0.996 0.004
#> GSM553596 5 0.0000 0.923 0 0.000 0.000 0.000 1.000
#> GSM553597 4 0.0000 1.000 0 0.000 0.000 1.000 0.000
#> GSM553598 5 0.0162 0.920 0 0.000 0.004 0.000 0.996
#> GSM553599 5 0.0000 0.923 0 0.000 0.000 0.000 1.000
#> GSM553600 1 0.0000 1.000 1 0.000 0.000 0.000 0.000
#> GSM553601 5 0.0000 0.923 0 0.000 0.000 0.000 1.000
#> GSM553602 1 0.0000 1.000 1 0.000 0.000 0.000 0.000
#> GSM553603 4 0.0000 1.000 0 0.000 0.000 1.000 0.000
#> GSM553604 5 0.1851 0.818 0 0.000 0.000 0.088 0.912
#> GSM553605 3 0.3480 0.562 0 0.248 0.752 0.000 0.000
#> GSM553606 2 0.0000 0.899 0 1.000 0.000 0.000 0.000
#> GSM553607 2 0.0000 0.899 0 1.000 0.000 0.000 0.000
#> GSM553608 2 0.2179 0.855 0 0.888 0.112 0.000 0.000
#> GSM553609 2 0.0000 0.899 0 1.000 0.000 0.000 0.000
#> GSM553610 2 0.0000 0.899 0 1.000 0.000 0.000 0.000
#> GSM553611 2 0.0703 0.897 0 0.976 0.024 0.000 0.000
#> GSM553612 2 0.0000 0.899 0 1.000 0.000 0.000 0.000
#> GSM553613 2 0.0000 0.899 0 1.000 0.000 0.000 0.000
#> GSM553614 4 0.0000 1.000 0 0.000 0.000 1.000 0.000
#> GSM553615 4 0.0000 1.000 0 0.000 0.000 1.000 0.000
#> GSM553616 5 0.0000 0.923 0 0.000 0.000 0.000 1.000
#> GSM553617 5 0.0000 0.923 0 0.000 0.000 0.000 1.000
#> GSM553618 5 0.0000 0.923 0 0.000 0.000 0.000 1.000
#> GSM553619 4 0.0000 1.000 0 0.000 0.000 1.000 0.000
#> GSM553620 1 0.0000 1.000 1 0.000 0.000 0.000 0.000
#> GSM553621 1 0.0000 1.000 1 0.000 0.000 0.000 0.000
#> GSM553622 1 0.0000 1.000 1 0.000 0.000 0.000 0.000
#> GSM553623 5 0.0000 0.923 0 0.000 0.000 0.000 1.000
#> GSM553624 5 0.0000 0.923 0 0.000 0.000 0.000 1.000
#> GSM553625 4 0.0000 1.000 0 0.000 0.000 1.000 0.000
#> GSM553626 4 0.0000 1.000 0 0.000 0.000 1.000 0.000
#> GSM553627 4 0.0000 1.000 0 0.000 0.000 1.000 0.000
#> GSM553628 4 0.0000 1.000 0 0.000 0.000 1.000 0.000
#> GSM553629 5 0.0000 0.923 0 0.000 0.000 0.000 1.000
#> GSM553630 4 0.0000 1.000 0 0.000 0.000 1.000 0.000
#> GSM553631 4 0.0000 1.000 0 0.000 0.000 1.000 0.000
#> GSM553632 1 0.0000 1.000 1 0.000 0.000 0.000 0.000
#> GSM553633 5 0.4242 0.310 0 0.000 0.428 0.000 0.572
#> GSM553634 2 0.0703 0.897 0 0.976 0.024 0.000 0.000
#> GSM553635 2 0.3534 0.735 0 0.744 0.256 0.000 0.000
#> GSM553636 3 0.4256 -0.180 0 0.436 0.564 0.000 0.000
#> GSM553637 2 0.0000 0.899 0 1.000 0.000 0.000 0.000
#> GSM553638 2 0.0000 0.899 0 1.000 0.000 0.000 0.000
#> GSM553639 2 0.3534 0.735 0 0.744 0.256 0.000 0.000
#> GSM553640 2 0.3534 0.735 0 0.744 0.256 0.000 0.000
#> GSM553641 3 0.0000 0.569 0 0.000 1.000 0.000 0.000
#> GSM553642 1 0.0000 1.000 1 0.000 0.000 0.000 0.000
#> GSM553643 4 0.0000 1.000 0 0.000 0.000 1.000 0.000
#> GSM553644 1 0.0000 1.000 1 0.000 0.000 0.000 0.000
#> GSM553645 5 0.0000 0.923 0 0.000 0.000 0.000 1.000
#> GSM553646 4 0.0000 1.000 0 0.000 0.000 1.000 0.000
#> GSM553647 5 0.0000 0.923 0 0.000 0.000 0.000 1.000
#> GSM553648 3 0.3534 0.364 0 0.000 0.744 0.000 0.256
#> GSM553649 5 0.4242 0.310 0 0.000 0.428 0.000 0.572
#> GSM553650 2 0.0703 0.897 0 0.976 0.024 0.000 0.000
#> GSM553651 2 0.3534 0.735 0 0.744 0.256 0.000 0.000
#> GSM553652 2 0.2230 0.853 0 0.884 0.116 0.000 0.000
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> GSM553595 4 0.0146 0.995 0 0.000 0.000 0.996 0.004 0.000
#> GSM553596 5 0.0000 0.922 0 0.000 0.000 0.000 1.000 0.000
#> GSM553597 4 0.0000 1.000 0 0.000 0.000 1.000 0.000 0.000
#> GSM553598 5 0.0146 0.919 0 0.000 0.004 0.000 0.996 0.000
#> GSM553599 5 0.0000 0.922 0 0.000 0.000 0.000 1.000 0.000
#> GSM553600 1 0.0000 1.000 1 0.000 0.000 0.000 0.000 0.000
#> GSM553601 5 0.0000 0.922 0 0.000 0.000 0.000 1.000 0.000
#> GSM553602 1 0.0000 1.000 1 0.000 0.000 0.000 0.000 0.000
#> GSM553603 4 0.0000 1.000 0 0.000 0.000 1.000 0.000 0.000
#> GSM553604 5 0.1663 0.823 0 0.000 0.000 0.088 0.912 0.000
#> GSM553605 3 0.0000 1.000 0 0.000 1.000 0.000 0.000 0.000
#> GSM553606 2 0.0000 0.960 0 1.000 0.000 0.000 0.000 0.000
#> GSM553607 2 0.0000 0.960 0 1.000 0.000 0.000 0.000 0.000
#> GSM553608 2 0.3695 0.421 0 0.624 0.000 0.000 0.000 0.376
#> GSM553609 2 0.0000 0.960 0 1.000 0.000 0.000 0.000 0.000
#> GSM553610 2 0.0000 0.960 0 1.000 0.000 0.000 0.000 0.000
#> GSM553611 2 0.0146 0.958 0 0.996 0.000 0.000 0.000 0.004
#> GSM553612 2 0.0000 0.960 0 1.000 0.000 0.000 0.000 0.000
#> GSM553613 2 0.0000 0.960 0 1.000 0.000 0.000 0.000 0.000
#> GSM553614 4 0.0000 1.000 0 0.000 0.000 1.000 0.000 0.000
#> GSM553615 4 0.0000 1.000 0 0.000 0.000 1.000 0.000 0.000
#> GSM553616 5 0.0000 0.922 0 0.000 0.000 0.000 1.000 0.000
#> GSM553617 5 0.0000 0.922 0 0.000 0.000 0.000 1.000 0.000
#> GSM553618 5 0.0000 0.922 0 0.000 0.000 0.000 1.000 0.000
#> GSM553619 4 0.0000 1.000 0 0.000 0.000 1.000 0.000 0.000
#> GSM553620 1 0.0000 1.000 1 0.000 0.000 0.000 0.000 0.000
#> GSM553621 1 0.0000 1.000 1 0.000 0.000 0.000 0.000 0.000
#> GSM553622 1 0.0000 1.000 1 0.000 0.000 0.000 0.000 0.000
#> GSM553623 5 0.0000 0.922 0 0.000 0.000 0.000 1.000 0.000
#> GSM553624 5 0.0000 0.922 0 0.000 0.000 0.000 1.000 0.000
#> GSM553625 4 0.0000 1.000 0 0.000 0.000 1.000 0.000 0.000
#> GSM553626 4 0.0000 1.000 0 0.000 0.000 1.000 0.000 0.000
#> GSM553627 4 0.0000 1.000 0 0.000 0.000 1.000 0.000 0.000
#> GSM553628 4 0.0000 1.000 0 0.000 0.000 1.000 0.000 0.000
#> GSM553629 5 0.0000 0.922 0 0.000 0.000 0.000 1.000 0.000
#> GSM553630 4 0.0000 1.000 0 0.000 0.000 1.000 0.000 0.000
#> GSM553631 4 0.0000 1.000 0 0.000 0.000 1.000 0.000 0.000
#> GSM553632 1 0.0000 1.000 1 0.000 0.000 0.000 0.000 0.000
#> GSM553633 5 0.3847 0.221 0 0.000 0.456 0.000 0.544 0.000
#> GSM553634 2 0.0547 0.950 0 0.980 0.000 0.000 0.000 0.020
#> GSM553635 6 0.0000 1.000 0 0.000 0.000 0.000 0.000 1.000
#> GSM553636 6 0.0000 1.000 0 0.000 0.000 0.000 0.000 1.000
#> GSM553637 2 0.0000 0.960 0 1.000 0.000 0.000 0.000 0.000
#> GSM553638 2 0.0000 0.960 0 1.000 0.000 0.000 0.000 0.000
#> GSM553639 6 0.0000 1.000 0 0.000 0.000 0.000 0.000 1.000
#> GSM553640 6 0.0000 1.000 0 0.000 0.000 0.000 0.000 1.000
#> GSM553641 3 0.0000 1.000 0 0.000 1.000 0.000 0.000 0.000
#> GSM553642 1 0.0000 1.000 1 0.000 0.000 0.000 0.000 0.000
#> GSM553643 4 0.0000 1.000 0 0.000 0.000 1.000 0.000 0.000
#> GSM553644 1 0.0000 1.000 1 0.000 0.000 0.000 0.000 0.000
#> GSM553645 5 0.0000 0.922 0 0.000 0.000 0.000 1.000 0.000
#> GSM553646 4 0.0000 1.000 0 0.000 0.000 1.000 0.000 0.000
#> GSM553647 5 0.0000 0.922 0 0.000 0.000 0.000 1.000 0.000
#> GSM553648 3 0.0000 1.000 0 0.000 1.000 0.000 0.000 0.000
#> GSM553649 5 0.3847 0.221 0 0.000 0.456 0.000 0.544 0.000
#> GSM553650 2 0.0547 0.950 0 0.980 0.000 0.000 0.000 0.020
#> GSM553651 6 0.0000 1.000 0 0.000 0.000 0.000 0.000 1.000
#> GSM553652 2 0.1007 0.932 0 0.956 0.000 0.000 0.000 0.044
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 individual(p) k
#> ATC:pam 57 0.346 2
#> ATC:pam 58 0.419 3
#> ATC:pam 58 0.719 4
#> ATC:pam 54 0.684 5
#> ATC:pam 55 0.205 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 0.965 0.985 0.4148 0.593 0.593
#> 3 3 0.690 0.823 0.867 0.5178 0.794 0.652
#> 4 4 0.614 0.755 0.869 0.0523 0.921 0.804
#> 5 5 0.802 0.815 0.880 0.1124 0.874 0.656
#> 6 6 0.652 0.392 0.673 0.0787 0.828 0.476
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
#> GSM553595 1 0.000 0.982 1.000 0.000
#> GSM553596 1 0.000 0.982 1.000 0.000
#> GSM553597 1 0.000 0.982 1.000 0.000
#> GSM553598 1 0.000 0.982 1.000 0.000
#> GSM553599 1 0.000 0.982 1.000 0.000
#> GSM553600 1 0.000 0.982 1.000 0.000
#> GSM553601 1 0.000 0.982 1.000 0.000
#> GSM553602 1 0.000 0.982 1.000 0.000
#> GSM553603 1 0.000 0.982 1.000 0.000
#> GSM553604 1 0.000 0.982 1.000 0.000
#> GSM553605 1 0.000 0.982 1.000 0.000
#> GSM553606 2 0.224 0.969 0.036 0.964
#> GSM553607 2 0.224 0.969 0.036 0.964
#> GSM553608 2 0.000 0.990 0.000 1.000
#> GSM553609 2 0.000 0.990 0.000 1.000
#> GSM553610 2 0.224 0.969 0.036 0.964
#> GSM553611 2 0.000 0.990 0.000 1.000
#> GSM553612 2 0.000 0.990 0.000 1.000
#> GSM553613 2 0.224 0.969 0.036 0.964
#> GSM553614 1 0.000 0.982 1.000 0.000
#> GSM553615 1 0.000 0.982 1.000 0.000
#> GSM553616 1 0.000 0.982 1.000 0.000
#> GSM553617 1 0.000 0.982 1.000 0.000
#> GSM553618 1 0.000 0.982 1.000 0.000
#> GSM553619 1 0.000 0.982 1.000 0.000
#> GSM553620 1 0.000 0.982 1.000 0.000
#> GSM553621 1 0.000 0.982 1.000 0.000
#> GSM553622 1 0.000 0.982 1.000 0.000
#> GSM553623 1 0.000 0.982 1.000 0.000
#> GSM553624 1 0.000 0.982 1.000 0.000
#> GSM553625 1 0.000 0.982 1.000 0.000
#> GSM553626 1 0.000 0.982 1.000 0.000
#> GSM553627 1 0.000 0.982 1.000 0.000
#> GSM553628 1 0.000 0.982 1.000 0.000
#> GSM553629 1 0.000 0.982 1.000 0.000
#> GSM553630 1 0.000 0.982 1.000 0.000
#> GSM553631 1 0.000 0.982 1.000 0.000
#> GSM553632 1 0.000 0.982 1.000 0.000
#> GSM553633 1 0.000 0.982 1.000 0.000
#> GSM553634 2 0.000 0.990 0.000 1.000
#> GSM553635 2 0.000 0.990 0.000 1.000
#> GSM553636 1 0.936 0.460 0.648 0.352
#> GSM553637 2 0.000 0.990 0.000 1.000
#> GSM553638 2 0.000 0.990 0.000 1.000
#> GSM553639 2 0.000 0.990 0.000 1.000
#> GSM553640 2 0.000 0.990 0.000 1.000
#> GSM553641 1 0.000 0.982 1.000 0.000
#> GSM553642 1 0.000 0.982 1.000 0.000
#> GSM553643 1 0.000 0.982 1.000 0.000
#> GSM553644 1 0.000 0.982 1.000 0.000
#> GSM553645 1 0.000 0.982 1.000 0.000
#> GSM553646 1 0.000 0.982 1.000 0.000
#> GSM553647 1 0.000 0.982 1.000 0.000
#> GSM553648 1 0.000 0.982 1.000 0.000
#> GSM553649 1 0.000 0.982 1.000 0.000
#> GSM553650 2 0.000 0.990 0.000 1.000
#> GSM553651 1 0.936 0.460 0.648 0.352
#> GSM553652 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
#> GSM553595 1 0.0000 0.724 1.000 0.000 0.000
#> GSM553596 1 0.2711 0.745 0.912 0.000 0.088
#> GSM553597 1 0.1529 0.705 0.960 0.000 0.040
#> GSM553598 3 0.5760 0.985 0.328 0.000 0.672
#> GSM553599 1 0.4485 0.580 0.844 0.020 0.136
#> GSM553600 3 0.5650 0.984 0.312 0.000 0.688
#> GSM553601 3 0.5760 0.985 0.328 0.000 0.672
#> GSM553602 3 0.5678 0.985 0.316 0.000 0.684
#> GSM553603 1 0.5254 0.744 0.736 0.000 0.264
#> GSM553604 1 0.5497 0.737 0.708 0.000 0.292
#> GSM553605 1 0.3995 0.655 0.868 0.016 0.116
#> GSM553606 2 0.2031 0.955 0.032 0.952 0.016
#> GSM553607 2 0.2031 0.955 0.032 0.952 0.016
#> GSM553608 2 0.0000 0.983 0.000 1.000 0.000
#> GSM553609 2 0.0000 0.983 0.000 1.000 0.000
#> GSM553610 2 0.2031 0.955 0.032 0.952 0.016
#> GSM553611 2 0.0000 0.983 0.000 1.000 0.000
#> GSM553612 2 0.0000 0.983 0.000 1.000 0.000
#> GSM553613 2 0.2031 0.955 0.032 0.952 0.016
#> GSM553614 1 0.1643 0.713 0.956 0.000 0.044
#> GSM553615 1 0.1529 0.705 0.960 0.000 0.040
#> GSM553616 1 0.2384 0.692 0.936 0.008 0.056
#> GSM553617 3 0.5760 0.985 0.328 0.000 0.672
#> GSM553618 3 0.5760 0.985 0.328 0.000 0.672
#> GSM553619 3 0.5650 0.984 0.312 0.000 0.688
#> GSM553620 3 0.5678 0.985 0.316 0.000 0.684
#> GSM553621 3 0.5706 0.984 0.320 0.000 0.680
#> GSM553622 3 0.5678 0.985 0.316 0.000 0.684
#> GSM553623 3 0.5785 0.980 0.332 0.000 0.668
#> GSM553624 1 0.2846 0.686 0.924 0.020 0.056
#> GSM553625 1 0.5650 0.725 0.688 0.000 0.312
#> GSM553626 1 0.4504 0.754 0.804 0.000 0.196
#> GSM553627 1 0.5058 0.750 0.756 0.000 0.244
#> GSM553628 1 0.5621 0.728 0.692 0.000 0.308
#> GSM553629 1 0.5216 0.749 0.740 0.000 0.260
#> GSM553630 1 0.5397 0.739 0.720 0.000 0.280
#> GSM553631 1 0.2448 0.677 0.924 0.000 0.076
#> GSM553632 1 0.5678 0.728 0.684 0.000 0.316
#> GSM553633 1 0.3377 0.644 0.896 0.012 0.092
#> GSM553634 2 0.0000 0.983 0.000 1.000 0.000
#> GSM553635 2 0.0000 0.983 0.000 1.000 0.000
#> GSM553636 1 0.5763 0.425 0.740 0.244 0.016
#> GSM553637 2 0.0237 0.982 0.004 0.996 0.000
#> GSM553638 2 0.0747 0.977 0.000 0.984 0.016
#> GSM553639 2 0.0000 0.983 0.000 1.000 0.000
#> GSM553640 2 0.0237 0.982 0.000 0.996 0.004
#> GSM553641 1 0.3886 0.632 0.880 0.024 0.096
#> GSM553642 1 0.5948 0.704 0.640 0.000 0.360
#> GSM553643 1 0.0000 0.724 1.000 0.000 0.000
#> GSM553644 1 0.6045 0.696 0.620 0.000 0.380
#> GSM553645 1 0.5650 0.725 0.688 0.000 0.312
#> GSM553646 1 0.5529 0.735 0.704 0.000 0.296
#> GSM553647 1 0.5138 0.750 0.748 0.000 0.252
#> GSM553648 1 0.3805 0.635 0.884 0.024 0.092
#> GSM553649 1 0.3340 0.667 0.880 0.000 0.120
#> GSM553650 2 0.0000 0.983 0.000 1.000 0.000
#> GSM553651 1 0.5723 0.431 0.744 0.240 0.016
#> GSM553652 2 0.0000 0.983 0.000 1.000 0.000
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> GSM553595 4 0.4008 0.7545 0.000 0.000 0.244 0.756
#> GSM553596 4 0.0469 0.8600 0.000 0.000 0.012 0.988
#> GSM553597 4 0.4500 0.7001 0.000 0.000 0.316 0.684
#> GSM553598 1 0.4500 0.6746 0.684 0.000 0.000 0.316
#> GSM553599 4 0.3760 0.7681 0.028 0.136 0.000 0.836
#> GSM553600 1 0.0000 0.7324 1.000 0.000 0.000 0.000
#> GSM553601 1 0.4500 0.6746 0.684 0.000 0.000 0.316
#> GSM553602 1 0.0000 0.7324 1.000 0.000 0.000 0.000
#> GSM553603 4 0.0000 0.8619 0.000 0.000 0.000 1.000
#> GSM553604 4 0.0000 0.8619 0.000 0.000 0.000 1.000
#> GSM553605 4 0.4605 0.6826 0.000 0.000 0.336 0.664
#> GSM553606 3 0.4500 1.0000 0.000 0.316 0.684 0.000
#> GSM553607 3 0.4500 1.0000 0.000 0.316 0.684 0.000
#> GSM553608 2 0.0000 0.8000 0.000 1.000 0.000 0.000
#> GSM553609 2 0.0469 0.7925 0.000 0.988 0.012 0.000
#> GSM553610 3 0.4500 1.0000 0.000 0.316 0.684 0.000
#> GSM553611 2 0.0188 0.7978 0.000 0.996 0.004 0.000
#> GSM553612 2 0.0592 0.7893 0.000 0.984 0.016 0.000
#> GSM553613 3 0.4500 1.0000 0.000 0.316 0.684 0.000
#> GSM553614 4 0.2814 0.8167 0.000 0.000 0.132 0.868
#> GSM553615 4 0.4500 0.7001 0.000 0.000 0.316 0.684
#> GSM553616 4 0.2868 0.7867 0.000 0.136 0.000 0.864
#> GSM553617 1 0.4500 0.6746 0.684 0.000 0.000 0.316
#> GSM553618 1 0.4500 0.6746 0.684 0.000 0.000 0.316
#> GSM553619 1 0.0000 0.7324 1.000 0.000 0.000 0.000
#> GSM553620 1 0.0000 0.7324 1.000 0.000 0.000 0.000
#> GSM553621 1 0.0000 0.7324 1.000 0.000 0.000 0.000
#> GSM553622 1 0.0000 0.7324 1.000 0.000 0.000 0.000
#> GSM553623 1 0.4585 0.6473 0.668 0.000 0.000 0.332
#> GSM553624 4 0.4222 0.6395 0.000 0.272 0.000 0.728
#> GSM553625 4 0.0000 0.8619 0.000 0.000 0.000 1.000
#> GSM553626 4 0.0000 0.8619 0.000 0.000 0.000 1.000
#> GSM553627 4 0.0000 0.8619 0.000 0.000 0.000 1.000
#> GSM553628 4 0.0000 0.8619 0.000 0.000 0.000 1.000
#> GSM553629 4 0.0000 0.8619 0.000 0.000 0.000 1.000
#> GSM553630 4 0.0000 0.8619 0.000 0.000 0.000 1.000
#> GSM553631 4 0.0336 0.8586 0.008 0.000 0.000 0.992
#> GSM553632 4 0.0000 0.8619 0.000 0.000 0.000 1.000
#> GSM553633 4 0.2589 0.8024 0.000 0.116 0.000 0.884
#> GSM553634 2 0.0000 0.8000 0.000 1.000 0.000 0.000
#> GSM553635 2 0.0000 0.8000 0.000 1.000 0.000 0.000
#> GSM553636 2 0.5508 0.0888 0.000 0.508 0.016 0.476
#> GSM553637 2 0.1474 0.7493 0.000 0.948 0.052 0.000
#> GSM553638 2 0.3569 0.4628 0.000 0.804 0.196 0.000
#> GSM553639 2 0.0000 0.8000 0.000 1.000 0.000 0.000
#> GSM553640 2 0.0000 0.8000 0.000 1.000 0.000 0.000
#> GSM553641 4 0.3554 0.7749 0.000 0.136 0.020 0.844
#> GSM553642 4 0.5511 0.4275 0.332 0.000 0.032 0.636
#> GSM553643 4 0.3837 0.7697 0.000 0.000 0.224 0.776
#> GSM553644 4 0.5511 0.4275 0.332 0.000 0.032 0.636
#> GSM553645 4 0.0000 0.8619 0.000 0.000 0.000 1.000
#> GSM553646 4 0.1488 0.8498 0.012 0.000 0.032 0.956
#> GSM553647 4 0.0000 0.8619 0.000 0.000 0.000 1.000
#> GSM553648 4 0.0895 0.8554 0.000 0.004 0.020 0.976
#> GSM553649 4 0.4008 0.7544 0.000 0.000 0.244 0.756
#> GSM553650 2 0.0000 0.8000 0.000 1.000 0.000 0.000
#> GSM553651 2 0.5508 0.0888 0.000 0.508 0.016 0.476
#> GSM553652 2 0.0000 0.8000 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
#> GSM553595 4 0.1430 0.786 0.052 0.000 0.004 0.944 0.000
#> GSM553596 4 0.0510 0.795 0.016 0.000 0.000 0.984 0.000
#> GSM553597 4 0.3300 0.647 0.204 0.000 0.004 0.792 0.000
#> GSM553598 5 0.0404 0.982 0.000 0.000 0.000 0.012 0.988
#> GSM553599 4 0.3728 0.639 0.044 0.004 0.004 0.824 0.124
#> GSM553600 5 0.0510 0.983 0.000 0.000 0.016 0.000 0.984
#> GSM553601 5 0.0566 0.981 0.000 0.000 0.004 0.012 0.984
#> GSM553602 5 0.0510 0.983 0.000 0.000 0.016 0.000 0.984
#> GSM553603 4 0.1121 0.778 0.044 0.000 0.000 0.956 0.000
#> GSM553604 1 0.4045 0.952 0.644 0.000 0.000 0.356 0.000
#> GSM553605 4 0.4425 0.577 0.244 0.000 0.040 0.716 0.000
#> GSM553606 3 0.1478 1.000 0.000 0.064 0.936 0.000 0.000
#> GSM553607 3 0.1478 1.000 0.000 0.064 0.936 0.000 0.000
#> GSM553608 2 0.0000 0.925 0.000 1.000 0.000 0.000 0.000
#> GSM553609 2 0.0162 0.924 0.000 0.996 0.004 0.000 0.000
#> GSM553610 3 0.1478 1.000 0.000 0.064 0.936 0.000 0.000
#> GSM553611 2 0.0162 0.924 0.000 0.996 0.004 0.000 0.000
#> GSM553612 2 0.0162 0.924 0.000 0.996 0.004 0.000 0.000
#> GSM553613 3 0.1478 1.000 0.000 0.064 0.936 0.000 0.000
#> GSM553614 4 0.0771 0.795 0.020 0.000 0.004 0.976 0.000
#> GSM553615 4 0.4201 0.495 0.328 0.000 0.008 0.664 0.000
#> GSM553616 4 0.3662 0.380 0.252 0.004 0.000 0.744 0.000
#> GSM553617 5 0.0671 0.979 0.000 0.000 0.004 0.016 0.980
#> GSM553618 5 0.0566 0.981 0.000 0.000 0.004 0.012 0.984
#> GSM553619 5 0.0000 0.982 0.000 0.000 0.000 0.000 1.000
#> GSM553620 5 0.0510 0.983 0.000 0.000 0.016 0.000 0.984
#> GSM553621 5 0.0510 0.983 0.000 0.000 0.016 0.000 0.984
#> GSM553622 5 0.0510 0.983 0.000 0.000 0.016 0.000 0.984
#> GSM553623 5 0.0671 0.979 0.000 0.000 0.004 0.016 0.980
#> GSM553624 4 0.4622 0.500 0.084 0.164 0.000 0.748 0.004
#> GSM553625 1 0.4015 0.951 0.652 0.000 0.000 0.348 0.000
#> GSM553626 1 0.4287 0.777 0.540 0.000 0.000 0.460 0.000
#> GSM553627 1 0.4015 0.951 0.652 0.000 0.000 0.348 0.000
#> GSM553628 1 0.4060 0.950 0.640 0.000 0.000 0.360 0.000
#> GSM553629 1 0.4045 0.953 0.644 0.000 0.000 0.356 0.000
#> GSM553630 4 0.1043 0.781 0.040 0.000 0.000 0.960 0.000
#> GSM553631 4 0.1282 0.778 0.044 0.000 0.000 0.952 0.004
#> GSM553632 4 0.1282 0.778 0.044 0.000 0.000 0.952 0.004
#> GSM553633 4 0.0671 0.795 0.016 0.000 0.004 0.980 0.000
#> GSM553634 2 0.0000 0.925 0.000 1.000 0.000 0.000 0.000
#> GSM553635 2 0.0000 0.925 0.000 1.000 0.000 0.000 0.000
#> GSM553636 4 0.6695 0.197 0.288 0.280 0.000 0.432 0.000
#> GSM553637 2 0.3612 0.605 0.000 0.732 0.268 0.000 0.000
#> GSM553638 2 0.4291 0.104 0.000 0.536 0.464 0.000 0.000
#> GSM553639 2 0.0000 0.925 0.000 1.000 0.000 0.000 0.000
#> GSM553640 2 0.0000 0.925 0.000 1.000 0.000 0.000 0.000
#> GSM553641 4 0.1116 0.793 0.028 0.004 0.004 0.964 0.000
#> GSM553642 4 0.1386 0.789 0.032 0.000 0.000 0.952 0.016
#> GSM553643 4 0.1205 0.791 0.040 0.000 0.004 0.956 0.000
#> GSM553644 4 0.1469 0.788 0.036 0.000 0.000 0.948 0.016
#> GSM553645 4 0.1478 0.769 0.064 0.000 0.000 0.936 0.000
#> GSM553646 4 0.0955 0.791 0.028 0.000 0.004 0.968 0.000
#> GSM553647 4 0.1197 0.785 0.048 0.000 0.000 0.952 0.000
#> GSM553648 4 0.0955 0.794 0.028 0.000 0.004 0.968 0.000
#> GSM553649 4 0.1484 0.788 0.048 0.000 0.008 0.944 0.000
#> GSM553650 2 0.0162 0.924 0.000 0.996 0.004 0.000 0.000
#> GSM553651 4 0.6695 0.197 0.288 0.280 0.000 0.432 0.000
#> GSM553652 2 0.0000 0.925 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
#> GSM553595 4 0.6039 -0.1500 0.000 0.000 0.252 0.392 0.356 0.000
#> GSM553596 4 0.4099 -0.1219 0.000 0.000 0.016 0.612 0.372 0.000
#> GSM553597 4 0.4322 0.0340 0.000 0.000 0.452 0.528 0.020 0.000
#> GSM553598 1 0.3695 0.6875 0.624 0.000 0.000 0.000 0.376 0.000
#> GSM553599 5 0.5562 0.2190 0.088 0.016 0.000 0.412 0.484 0.000
#> GSM553600 1 0.0000 0.6845 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM553601 1 0.3872 0.6794 0.604 0.004 0.000 0.000 0.392 0.000
#> GSM553602 1 0.0000 0.6845 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM553603 4 0.0000 0.4261 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM553604 5 0.3866 0.2112 0.000 0.000 0.000 0.484 0.516 0.000
#> GSM553605 3 0.4224 0.4479 0.000 0.000 0.684 0.004 0.276 0.036
#> GSM553606 6 0.1141 0.8825 0.000 0.052 0.000 0.000 0.000 0.948
#> GSM553607 6 0.1204 0.8818 0.000 0.056 0.000 0.000 0.000 0.944
#> GSM553608 2 0.1444 0.6246 0.000 0.928 0.000 0.000 0.000 0.072
#> GSM553609 2 0.3797 0.3528 0.000 0.580 0.000 0.000 0.000 0.420
#> GSM553610 6 0.1075 0.8808 0.000 0.048 0.000 0.000 0.000 0.952
#> GSM553611 2 0.3717 0.4045 0.000 0.616 0.000 0.000 0.000 0.384
#> GSM553612 2 0.3797 0.3528 0.000 0.580 0.000 0.000 0.000 0.420
#> GSM553613 6 0.1082 0.8709 0.000 0.040 0.004 0.000 0.000 0.956
#> GSM553614 4 0.3912 0.3742 0.000 0.000 0.224 0.732 0.044 0.000
#> GSM553615 3 0.4493 -0.0596 0.000 0.000 0.548 0.424 0.024 0.004
#> GSM553616 4 0.4219 -0.1794 0.000 0.020 0.000 0.592 0.388 0.000
#> GSM553617 1 0.3975 0.6767 0.600 0.008 0.000 0.000 0.392 0.000
#> GSM553618 1 0.3695 0.6875 0.624 0.000 0.000 0.000 0.376 0.000
#> GSM553619 1 0.3695 0.6875 0.624 0.000 0.000 0.000 0.376 0.000
#> GSM553620 1 0.0000 0.6845 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM553621 1 0.0806 0.6681 0.972 0.000 0.020 0.000 0.008 0.000
#> GSM553622 1 0.0000 0.6845 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM553623 1 0.4002 0.6656 0.588 0.008 0.000 0.000 0.404 0.000
#> GSM553624 4 0.5940 -0.2711 0.000 0.196 0.004 0.464 0.336 0.000
#> GSM553625 4 0.3266 0.2916 0.000 0.000 0.000 0.728 0.272 0.000
#> GSM553626 4 0.1957 0.3882 0.000 0.000 0.000 0.888 0.112 0.000
#> GSM553627 4 0.3309 0.2844 0.000 0.000 0.000 0.720 0.280 0.000
#> GSM553628 4 0.3266 0.2913 0.000 0.000 0.000 0.728 0.272 0.000
#> GSM553629 5 0.3907 0.2449 0.000 0.004 0.000 0.408 0.588 0.000
#> GSM553630 4 0.1074 0.4338 0.000 0.000 0.012 0.960 0.028 0.000
#> GSM553631 4 0.1049 0.4326 0.000 0.000 0.008 0.960 0.032 0.000
#> GSM553632 4 0.4152 0.2388 0.304 0.000 0.000 0.664 0.032 0.000
#> GSM553633 4 0.5058 -0.2723 0.000 0.000 0.076 0.500 0.424 0.000
#> GSM553634 2 0.3717 0.4082 0.000 0.616 0.000 0.000 0.000 0.384
#> GSM553635 2 0.1007 0.6143 0.000 0.956 0.000 0.000 0.000 0.044
#> GSM553636 2 0.5854 0.0428 0.000 0.568 0.196 0.220 0.012 0.004
#> GSM553637 6 0.3198 0.6407 0.000 0.260 0.000 0.000 0.000 0.740
#> GSM553638 6 0.2762 0.7591 0.000 0.196 0.000 0.000 0.000 0.804
#> GSM553639 2 0.1327 0.6246 0.000 0.936 0.000 0.000 0.000 0.064
#> GSM553640 2 0.1327 0.6246 0.000 0.936 0.000 0.000 0.000 0.064
#> GSM553641 3 0.6675 0.4834 0.000 0.020 0.436 0.244 0.288 0.012
#> GSM553642 4 0.5264 0.2623 0.304 0.000 0.100 0.588 0.008 0.000
#> GSM553643 4 0.4061 0.3599 0.000 0.000 0.248 0.708 0.044 0.000
#> GSM553644 4 0.5303 0.2615 0.304 0.000 0.104 0.584 0.008 0.000
#> GSM553645 4 0.3684 -0.0970 0.000 0.000 0.004 0.664 0.332 0.000
#> GSM553646 4 0.2003 0.4292 0.000 0.000 0.116 0.884 0.000 0.000
#> GSM553647 4 0.3668 -0.0915 0.000 0.000 0.004 0.668 0.328 0.000
#> GSM553648 3 0.6201 0.4720 0.000 0.008 0.436 0.260 0.296 0.000
#> GSM553649 5 0.4904 -0.1396 0.000 0.000 0.316 0.084 0.600 0.000
#> GSM553650 2 0.3765 0.3768 0.000 0.596 0.000 0.000 0.000 0.404
#> GSM553651 2 0.5831 0.0590 0.000 0.568 0.240 0.176 0.012 0.004
#> GSM553652 2 0.1663 0.6203 0.000 0.912 0.000 0.000 0.000 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 individual(p) k
#> ATC:mclust 56 0.26294 2
#> ATC:mclust 56 0.10991 3
#> ATC:mclust 53 0.06912 4
#> ATC:mclust 52 0.00518 5
#> ATC:mclust 22 0.22670 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.893 0.905 0.963 0.5049 0.491 0.491
#> 3 3 0.745 0.881 0.924 0.2541 0.782 0.595
#> 4 4 0.729 0.785 0.882 0.1042 0.947 0.855
#> 5 5 0.672 0.522 0.775 0.0802 0.956 0.863
#> 6 6 0.681 0.639 0.741 0.0427 0.858 0.535
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
#> GSM553595 1 0.000 0.974 1.000 0.000
#> GSM553596 2 0.388 0.888 0.076 0.924
#> GSM553597 1 0.000 0.974 1.000 0.000
#> GSM553598 2 0.184 0.926 0.028 0.972
#> GSM553599 1 0.644 0.776 0.836 0.164
#> GSM553600 1 0.000 0.974 1.000 0.000
#> GSM553601 1 0.000 0.974 1.000 0.000
#> GSM553602 1 0.000 0.974 1.000 0.000
#> GSM553603 1 0.000 0.974 1.000 0.000
#> GSM553604 1 0.000 0.974 1.000 0.000
#> GSM553605 2 0.000 0.944 0.000 1.000
#> GSM553606 2 0.000 0.944 0.000 1.000
#> GSM553607 2 0.000 0.944 0.000 1.000
#> GSM553608 2 0.000 0.944 0.000 1.000
#> GSM553609 2 0.000 0.944 0.000 1.000
#> GSM553610 2 0.000 0.944 0.000 1.000
#> GSM553611 2 0.000 0.944 0.000 1.000
#> GSM553612 2 0.000 0.944 0.000 1.000
#> GSM553613 2 0.000 0.944 0.000 1.000
#> GSM553614 1 0.000 0.974 1.000 0.000
#> GSM553615 1 0.000 0.974 1.000 0.000
#> GSM553616 1 0.118 0.959 0.984 0.016
#> GSM553617 2 0.680 0.775 0.180 0.820
#> GSM553618 1 0.998 -0.020 0.524 0.476
#> GSM553619 1 0.000 0.974 1.000 0.000
#> GSM553620 1 0.000 0.974 1.000 0.000
#> GSM553621 1 0.000 0.974 1.000 0.000
#> GSM553622 1 0.000 0.974 1.000 0.000
#> GSM553623 2 0.932 0.499 0.348 0.652
#> GSM553624 2 0.000 0.944 0.000 1.000
#> GSM553625 1 0.000 0.974 1.000 0.000
#> GSM553626 1 0.000 0.974 1.000 0.000
#> GSM553627 1 0.000 0.974 1.000 0.000
#> GSM553628 1 0.000 0.974 1.000 0.000
#> GSM553629 1 0.000 0.974 1.000 0.000
#> GSM553630 1 0.000 0.974 1.000 0.000
#> GSM553631 1 0.000 0.974 1.000 0.000
#> GSM553632 1 0.000 0.974 1.000 0.000
#> GSM553633 2 0.327 0.901 0.060 0.940
#> GSM553634 2 0.000 0.944 0.000 1.000
#> GSM553635 2 0.000 0.944 0.000 1.000
#> GSM553636 2 0.000 0.944 0.000 1.000
#> GSM553637 2 0.000 0.944 0.000 1.000
#> GSM553638 2 0.000 0.944 0.000 1.000
#> GSM553639 2 0.000 0.944 0.000 1.000
#> GSM553640 2 0.000 0.944 0.000 1.000
#> GSM553641 2 0.000 0.944 0.000 1.000
#> GSM553642 1 0.000 0.974 1.000 0.000
#> GSM553643 1 0.000 0.974 1.000 0.000
#> GSM553644 1 0.000 0.974 1.000 0.000
#> GSM553645 2 0.998 0.141 0.476 0.524
#> GSM553646 1 0.000 0.974 1.000 0.000
#> GSM553647 1 0.000 0.974 1.000 0.000
#> GSM553648 2 0.000 0.944 0.000 1.000
#> GSM553649 2 0.909 0.549 0.324 0.676
#> GSM553650 2 0.000 0.944 0.000 1.000
#> GSM553651 2 0.000 0.944 0.000 1.000
#> GSM553652 2 0.000 0.944 0.000 1.000
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> GSM553595 3 0.1529 0.784 0.040 0.000 0.960
#> GSM553596 3 0.4802 0.798 0.020 0.156 0.824
#> GSM553597 1 0.5363 0.705 0.724 0.000 0.276
#> GSM553598 3 0.7007 0.769 0.100 0.176 0.724
#> GSM553599 1 0.1170 0.915 0.976 0.008 0.016
#> GSM553600 1 0.0592 0.917 0.988 0.000 0.012
#> GSM553601 1 0.1163 0.910 0.972 0.000 0.028
#> GSM553602 1 0.0592 0.917 0.988 0.000 0.012
#> GSM553603 1 0.0892 0.915 0.980 0.000 0.020
#> GSM553604 1 0.1163 0.913 0.972 0.000 0.028
#> GSM553605 3 0.3412 0.796 0.000 0.124 0.876
#> GSM553606 2 0.0424 0.993 0.000 0.992 0.008
#> GSM553607 2 0.0237 0.995 0.000 0.996 0.004
#> GSM553608 2 0.0000 0.996 0.000 1.000 0.000
#> GSM553609 2 0.0000 0.996 0.000 1.000 0.000
#> GSM553610 2 0.0592 0.989 0.000 0.988 0.012
#> GSM553611 2 0.0000 0.996 0.000 1.000 0.000
#> GSM553612 2 0.0237 0.995 0.000 0.996 0.004
#> GSM553613 2 0.0592 0.989 0.000 0.988 0.012
#> GSM553614 1 0.1964 0.903 0.944 0.000 0.056
#> GSM553615 1 0.5138 0.734 0.748 0.000 0.252
#> GSM553616 1 0.0829 0.917 0.984 0.004 0.012
#> GSM553617 1 0.7366 0.517 0.668 0.260 0.072
#> GSM553618 3 0.5618 0.667 0.260 0.008 0.732
#> GSM553619 1 0.4002 0.789 0.840 0.000 0.160
#> GSM553620 1 0.1031 0.912 0.976 0.000 0.024
#> GSM553621 1 0.0592 0.917 0.988 0.000 0.012
#> GSM553622 1 0.0592 0.917 0.988 0.000 0.012
#> GSM553623 1 0.4677 0.785 0.840 0.132 0.028
#> GSM553624 2 0.0237 0.995 0.000 0.996 0.004
#> GSM553625 1 0.3340 0.860 0.880 0.000 0.120
#> GSM553626 1 0.0000 0.918 1.000 0.000 0.000
#> GSM553627 1 0.1964 0.903 0.944 0.000 0.056
#> GSM553628 1 0.0237 0.918 0.996 0.000 0.004
#> GSM553629 1 0.3918 0.838 0.856 0.004 0.140
#> GSM553630 1 0.0892 0.915 0.980 0.000 0.020
#> GSM553631 1 0.0000 0.918 1.000 0.000 0.000
#> GSM553632 1 0.0000 0.918 1.000 0.000 0.000
#> GSM553633 3 0.5842 0.780 0.036 0.196 0.768
#> GSM553634 2 0.0000 0.996 0.000 1.000 0.000
#> GSM553635 2 0.0000 0.996 0.000 1.000 0.000
#> GSM553636 2 0.0000 0.996 0.000 1.000 0.000
#> GSM553637 2 0.0237 0.995 0.000 0.996 0.004
#> GSM553638 2 0.0237 0.995 0.000 0.996 0.004
#> GSM553639 2 0.0000 0.996 0.000 1.000 0.000
#> GSM553640 2 0.0000 0.996 0.000 1.000 0.000
#> GSM553641 3 0.5431 0.695 0.000 0.284 0.716
#> GSM553642 1 0.0000 0.918 1.000 0.000 0.000
#> GSM553643 1 0.5291 0.716 0.732 0.000 0.268
#> GSM553644 1 0.0000 0.918 1.000 0.000 0.000
#> GSM553645 3 0.3038 0.779 0.104 0.000 0.896
#> GSM553646 1 0.1860 0.905 0.948 0.000 0.052
#> GSM553647 3 0.6026 0.404 0.376 0.000 0.624
#> GSM553648 3 0.5397 0.700 0.000 0.280 0.720
#> GSM553649 3 0.1289 0.788 0.032 0.000 0.968
#> GSM553650 2 0.0000 0.996 0.000 1.000 0.000
#> GSM553651 2 0.0592 0.985 0.000 0.988 0.012
#> GSM553652 2 0.0237 0.995 0.000 0.996 0.004
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> GSM553595 4 0.4720 0.554 0.004 0.000 0.324 0.672
#> GSM553596 3 0.2722 0.746 0.000 0.064 0.904 0.032
#> GSM553597 4 0.3919 0.787 0.056 0.000 0.104 0.840
#> GSM553598 3 0.6903 0.592 0.132 0.100 0.688 0.080
#> GSM553599 1 0.1940 0.813 0.924 0.000 0.000 0.076
#> GSM553600 1 0.0921 0.835 0.972 0.000 0.000 0.028
#> GSM553601 1 0.1940 0.813 0.924 0.000 0.000 0.076
#> GSM553602 1 0.0000 0.842 1.000 0.000 0.000 0.000
#> GSM553603 1 0.2704 0.812 0.876 0.000 0.000 0.124
#> GSM553604 1 0.3787 0.791 0.840 0.000 0.036 0.124
#> GSM553605 3 0.2335 0.745 0.000 0.060 0.920 0.020
#> GSM553606 2 0.1557 0.942 0.000 0.944 0.056 0.000
#> GSM553607 2 0.1022 0.960 0.000 0.968 0.032 0.000
#> GSM553608 2 0.0336 0.964 0.000 0.992 0.008 0.000
#> GSM553609 2 0.0336 0.967 0.000 0.992 0.008 0.000
#> GSM553610 2 0.1940 0.924 0.000 0.924 0.076 0.000
#> GSM553611 2 0.0469 0.967 0.000 0.988 0.012 0.000
#> GSM553612 2 0.0707 0.965 0.000 0.980 0.020 0.000
#> GSM553613 2 0.2216 0.907 0.000 0.908 0.092 0.000
#> GSM553614 1 0.5329 0.341 0.568 0.000 0.012 0.420
#> GSM553615 4 0.3037 0.769 0.100 0.000 0.020 0.880
#> GSM553616 1 0.3072 0.763 0.868 0.124 0.004 0.004
#> GSM553617 1 0.6379 0.625 0.724 0.076 0.124 0.076
#> GSM553618 3 0.7130 0.242 0.412 0.020 0.492 0.076
#> GSM553619 1 0.3542 0.778 0.864 0.000 0.060 0.076
#> GSM553620 1 0.1474 0.826 0.948 0.000 0.000 0.052
#> GSM553621 1 0.0188 0.842 0.996 0.000 0.000 0.004
#> GSM553622 1 0.0000 0.842 1.000 0.000 0.000 0.000
#> GSM553623 1 0.3174 0.796 0.888 0.028 0.008 0.076
#> GSM553624 2 0.0376 0.967 0.004 0.992 0.004 0.000
#> GSM553625 1 0.6440 0.340 0.564 0.000 0.080 0.356
#> GSM553626 1 0.1792 0.836 0.932 0.000 0.000 0.068
#> GSM553627 1 0.5069 0.567 0.664 0.000 0.016 0.320
#> GSM553628 1 0.2944 0.807 0.868 0.000 0.004 0.128
#> GSM553629 1 0.7782 0.263 0.512 0.116 0.036 0.336
#> GSM553630 1 0.1716 0.838 0.936 0.000 0.000 0.064
#> GSM553631 1 0.0592 0.843 0.984 0.000 0.000 0.016
#> GSM553632 1 0.2011 0.833 0.920 0.000 0.000 0.080
#> GSM553633 3 0.1902 0.751 0.000 0.064 0.932 0.004
#> GSM553634 2 0.0000 0.966 0.000 1.000 0.000 0.000
#> GSM553635 2 0.0895 0.957 0.000 0.976 0.020 0.004
#> GSM553636 2 0.1624 0.942 0.000 0.952 0.020 0.028
#> GSM553637 2 0.0707 0.965 0.000 0.980 0.020 0.000
#> GSM553638 2 0.0817 0.964 0.000 0.976 0.024 0.000
#> GSM553639 2 0.1042 0.955 0.000 0.972 0.020 0.008
#> GSM553640 2 0.0657 0.961 0.000 0.984 0.012 0.004
#> GSM553641 3 0.2760 0.717 0.000 0.128 0.872 0.000
#> GSM553642 1 0.1302 0.841 0.956 0.000 0.000 0.044
#> GSM553643 4 0.5742 0.724 0.168 0.000 0.120 0.712
#> GSM553644 1 0.1022 0.843 0.968 0.000 0.000 0.032
#> GSM553645 3 0.2945 0.699 0.024 0.016 0.904 0.056
#> GSM553646 1 0.3764 0.798 0.852 0.000 0.072 0.076
#> GSM553647 3 0.7065 0.127 0.216 0.000 0.572 0.212
#> GSM553648 3 0.2408 0.737 0.000 0.104 0.896 0.000
#> GSM553649 3 0.1798 0.715 0.000 0.016 0.944 0.040
#> GSM553650 2 0.0000 0.966 0.000 1.000 0.000 0.000
#> GSM553651 2 0.3051 0.878 0.000 0.884 0.028 0.088
#> GSM553652 2 0.0469 0.967 0.000 0.988 0.012 0.000
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> GSM553595 4 0.6040 0.3186 0.036 0.000 0.288 0.604 0.072
#> GSM553596 3 0.6035 0.4161 0.004 0.008 0.620 0.224 0.144
#> GSM553597 4 0.4553 0.6102 0.108 0.000 0.064 0.788 0.040
#> GSM553598 3 0.5613 0.2868 0.064 0.004 0.520 0.000 0.412
#> GSM553599 1 0.6459 -0.1806 0.504 0.000 0.180 0.004 0.312
#> GSM553600 1 0.1851 0.5677 0.912 0.000 0.000 0.000 0.088
#> GSM553601 1 0.5826 -0.0491 0.556 0.000 0.112 0.000 0.332
#> GSM553602 1 0.1043 0.5979 0.960 0.000 0.000 0.000 0.040
#> GSM553603 1 0.4387 0.4844 0.744 0.000 0.004 0.208 0.044
#> GSM553604 1 0.8034 -0.0376 0.444 0.000 0.168 0.220 0.168
#> GSM553605 3 0.4569 0.4682 0.000 0.120 0.784 0.056 0.040
#> GSM553606 2 0.1774 0.9180 0.000 0.932 0.052 0.000 0.016
#> GSM553607 2 0.1386 0.9307 0.000 0.952 0.032 0.000 0.016
#> GSM553608 2 0.0671 0.9434 0.000 0.980 0.000 0.004 0.016
#> GSM553609 2 0.0162 0.9445 0.000 0.996 0.004 0.000 0.000
#> GSM553610 2 0.1877 0.9109 0.000 0.924 0.064 0.000 0.012
#> GSM553611 2 0.0451 0.9448 0.000 0.988 0.008 0.000 0.004
#> GSM553612 2 0.0693 0.9441 0.000 0.980 0.008 0.000 0.012
#> GSM553613 2 0.2612 0.8576 0.000 0.868 0.124 0.000 0.008
#> GSM553614 1 0.4674 0.0808 0.568 0.000 0.000 0.416 0.016
#> GSM553615 4 0.3099 0.5863 0.124 0.000 0.000 0.848 0.028
#> GSM553616 1 0.7360 0.0622 0.540 0.088 0.004 0.148 0.220
#> GSM553617 5 0.6526 -0.0644 0.344 0.000 0.204 0.000 0.452
#> GSM553618 3 0.6539 -0.0508 0.200 0.000 0.432 0.000 0.368
#> GSM553619 1 0.6606 -0.3031 0.444 0.000 0.228 0.000 0.328
#> GSM553620 1 0.1851 0.5689 0.912 0.000 0.000 0.000 0.088
#> GSM553621 1 0.0771 0.6065 0.976 0.000 0.000 0.004 0.020
#> GSM553622 1 0.0510 0.6073 0.984 0.000 0.000 0.000 0.016
#> GSM553623 1 0.6504 -0.2640 0.460 0.000 0.168 0.004 0.368
#> GSM553624 2 0.5849 0.3673 0.004 0.548 0.012 0.060 0.376
#> GSM553625 4 0.7736 0.2991 0.280 0.000 0.088 0.444 0.188
#> GSM553626 1 0.4252 0.5041 0.780 0.000 0.004 0.072 0.144
#> GSM553627 1 0.6297 0.0439 0.508 0.000 0.008 0.356 0.128
#> GSM553628 1 0.4559 0.4833 0.748 0.000 0.000 0.152 0.100
#> GSM553629 5 0.7771 -0.2875 0.296 0.044 0.004 0.316 0.340
#> GSM553630 1 0.1990 0.6038 0.928 0.000 0.004 0.028 0.040
#> GSM553631 1 0.0451 0.6087 0.988 0.000 0.000 0.004 0.008
#> GSM553632 1 0.1571 0.6048 0.936 0.000 0.000 0.060 0.004
#> GSM553633 3 0.3282 0.6044 0.000 0.000 0.804 0.008 0.188
#> GSM553634 2 0.0162 0.9447 0.000 0.996 0.000 0.000 0.004
#> GSM553635 2 0.0290 0.9442 0.000 0.992 0.000 0.000 0.008
#> GSM553636 2 0.1251 0.9342 0.000 0.956 0.000 0.008 0.036
#> GSM553637 2 0.0566 0.9425 0.000 0.984 0.012 0.000 0.004
#> GSM553638 2 0.0671 0.9432 0.000 0.980 0.016 0.000 0.004
#> GSM553639 2 0.0510 0.9427 0.000 0.984 0.000 0.000 0.016
#> GSM553640 2 0.0671 0.9419 0.000 0.980 0.000 0.004 0.016
#> GSM553641 3 0.1549 0.6067 0.000 0.040 0.944 0.000 0.016
#> GSM553642 1 0.1410 0.6057 0.940 0.000 0.000 0.060 0.000
#> GSM553643 4 0.6613 0.5457 0.244 0.000 0.076 0.592 0.088
#> GSM553644 1 0.1410 0.6067 0.940 0.000 0.000 0.060 0.000
#> GSM553645 3 0.6226 0.4627 0.028 0.000 0.600 0.112 0.260
#> GSM553646 1 0.4261 0.5346 0.804 0.000 0.024 0.096 0.076
#> GSM553647 3 0.8035 -0.1381 0.156 0.000 0.428 0.260 0.156
#> GSM553648 3 0.2700 0.6186 0.000 0.024 0.884 0.004 0.088
#> GSM553649 3 0.2813 0.5262 0.000 0.000 0.868 0.108 0.024
#> GSM553650 2 0.0404 0.9434 0.000 0.988 0.000 0.000 0.012
#> GSM553651 2 0.2922 0.8705 0.000 0.872 0.000 0.072 0.056
#> GSM553652 2 0.0162 0.9445 0.000 0.996 0.000 0.000 0.004
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> GSM553595 4 0.5516 0.4569 0.056 0.000 0.136 0.700 0.032 0.076
#> GSM553596 4 0.6362 -0.0804 0.004 0.000 0.308 0.416 0.008 0.264
#> GSM553597 4 0.4287 0.5038 0.132 0.000 0.020 0.780 0.028 0.040
#> GSM553598 6 0.4601 0.4646 0.064 0.000 0.212 0.004 0.012 0.708
#> GSM553599 6 0.6013 0.6419 0.300 0.000 0.168 0.012 0.004 0.516
#> GSM553600 1 0.2100 0.7419 0.884 0.000 0.000 0.004 0.000 0.112
#> GSM553601 6 0.4242 0.5296 0.412 0.000 0.004 0.000 0.012 0.572
#> GSM553602 1 0.1471 0.7840 0.932 0.000 0.000 0.004 0.000 0.064
#> GSM553603 1 0.6316 0.2630 0.572 0.000 0.008 0.160 0.208 0.052
#> GSM553604 5 0.7576 0.4497 0.224 0.000 0.144 0.084 0.480 0.068
#> GSM553605 3 0.3972 0.5994 0.000 0.096 0.812 0.036 0.020 0.036
#> GSM553606 2 0.1349 0.9394 0.000 0.940 0.056 0.000 0.000 0.004
#> GSM553607 2 0.1442 0.9460 0.000 0.944 0.040 0.000 0.004 0.012
#> GSM553608 2 0.0912 0.9505 0.000 0.972 0.004 0.008 0.012 0.004
#> GSM553609 2 0.0260 0.9544 0.000 0.992 0.008 0.000 0.000 0.000
#> GSM553610 2 0.1663 0.9207 0.000 0.912 0.088 0.000 0.000 0.000
#> GSM553611 2 0.1116 0.9525 0.000 0.960 0.028 0.008 0.000 0.004
#> GSM553612 2 0.0964 0.9550 0.000 0.968 0.016 0.012 0.000 0.004
#> GSM553613 2 0.2738 0.8267 0.000 0.820 0.176 0.000 0.000 0.004
#> GSM553614 4 0.4483 0.3046 0.428 0.000 0.004 0.548 0.004 0.016
#> GSM553615 4 0.3668 0.4660 0.112 0.000 0.020 0.816 0.048 0.004
#> GSM553616 4 0.8237 0.0781 0.308 0.036 0.036 0.340 0.064 0.216
#> GSM553617 6 0.3823 0.6956 0.184 0.000 0.048 0.004 0.000 0.764
#> GSM553618 6 0.5074 0.4833 0.100 0.000 0.260 0.000 0.008 0.632
#> GSM553619 6 0.5196 0.6946 0.252 0.000 0.128 0.004 0.000 0.616
#> GSM553620 1 0.2092 0.7267 0.876 0.000 0.000 0.000 0.000 0.124
#> GSM553621 1 0.1124 0.7964 0.956 0.000 0.000 0.008 0.000 0.036
#> GSM553622 1 0.1152 0.7932 0.952 0.000 0.000 0.004 0.000 0.044
#> GSM553623 6 0.4707 0.7022 0.256 0.004 0.032 0.000 0.028 0.680
#> GSM553624 5 0.6448 0.0799 0.004 0.296 0.016 0.008 0.484 0.192
#> GSM553625 5 0.7740 0.4304 0.160 0.000 0.124 0.168 0.480 0.068
#> GSM553626 1 0.5171 0.3543 0.600 0.000 0.004 0.004 0.304 0.088
#> GSM553627 5 0.6251 0.2150 0.376 0.000 0.012 0.152 0.448 0.012
#> GSM553628 1 0.5348 0.4958 0.656 0.000 0.004 0.060 0.228 0.052
#> GSM553629 5 0.7914 0.0394 0.168 0.032 0.048 0.116 0.504 0.132
#> GSM553630 1 0.2965 0.7406 0.856 0.000 0.016 0.012 0.108 0.008
#> GSM553631 1 0.0922 0.8032 0.968 0.000 0.000 0.004 0.004 0.024
#> GSM553632 1 0.1003 0.7966 0.964 0.000 0.000 0.028 0.004 0.004
#> GSM553633 3 0.6212 0.4348 0.004 0.000 0.448 0.008 0.208 0.332
#> GSM553634 2 0.0146 0.9540 0.000 0.996 0.004 0.000 0.000 0.000
#> GSM553635 2 0.0622 0.9535 0.000 0.980 0.008 0.000 0.012 0.000
#> GSM553636 2 0.1850 0.9304 0.000 0.924 0.008 0.016 0.052 0.000
#> GSM553637 2 0.0858 0.9510 0.000 0.968 0.028 0.000 0.000 0.004
#> GSM553638 2 0.0790 0.9521 0.000 0.968 0.032 0.000 0.000 0.000
#> GSM553639 2 0.1121 0.9490 0.000 0.964 0.008 0.008 0.016 0.004
#> GSM553640 2 0.1225 0.9448 0.000 0.956 0.004 0.004 0.032 0.004
#> GSM553641 3 0.3236 0.6908 0.000 0.036 0.820 0.000 0.004 0.140
#> GSM553642 1 0.1500 0.7810 0.936 0.000 0.000 0.052 0.012 0.000
#> GSM553643 4 0.7006 0.0111 0.268 0.000 0.052 0.444 0.224 0.012
#> GSM553644 1 0.1578 0.7868 0.936 0.000 0.000 0.048 0.012 0.004
#> GSM553645 5 0.7242 0.1030 0.032 0.000 0.260 0.048 0.444 0.216
#> GSM553646 1 0.3981 0.6835 0.800 0.000 0.024 0.056 0.112 0.008
#> GSM553647 5 0.7676 0.3892 0.120 0.000 0.284 0.120 0.428 0.048
#> GSM553648 3 0.5378 0.5903 0.004 0.004 0.596 0.020 0.060 0.316
#> GSM553649 3 0.2939 0.6878 0.004 0.000 0.868 0.048 0.012 0.068
#> GSM553650 2 0.0405 0.9541 0.000 0.988 0.008 0.000 0.004 0.000
#> GSM553651 2 0.3480 0.8499 0.000 0.836 0.020 0.044 0.092 0.008
#> GSM553652 2 0.0551 0.9542 0.000 0.984 0.004 0.008 0.000 0.004
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 individual(p) k
#> ATC:NMF 55 0.461 2
#> ATC:NMF 57 0.158 3
#> ATC:NMF 53 0.216 4
#> ATC:NMF 37 0.206 5
#> ATC:NMF 39 0.147 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