Date: 2019-12-25 20:44:32 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 38950 rows and 60 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] 38950 60
The density distribution for each sample is visualized as in one column in the following heatmap. The clustering is based on the distance which is the Kolmogorov-Smirnov statistic between two distributions.
library(ComplexHeatmap)
densityHeatmap(mat, top_annotation = HeatmapAnnotation(df = get_anno(res_list),
col = get_anno_col(res_list)), ylab = "value", cluster_columns = TRUE, show_column_names = FALSE,
mc.cores = 4)
Folowing table shows the best k
(number of partitions) for each combination
of top-value methods and partition methods. Clicking on the method name in
the table goes to the section for a single combination of methods.
The cola vignette explains the definition of the metrics used for determining the best number of partitions.
suggest_best_k(res_list)
The best k | 1-PAC | Mean silhouette | Concordance | Optional k | ||
---|---|---|---|---|---|---|
SD:skmeans | 3 | 1.000 | 0.957 | 0.978 | ** | |
CV:hclust | 2 | 1.000 | 1.000 | 1.000 | ** | |
CV:skmeans | 4 | 1.000 | 0.993 | 0.995 | ** | 3 |
CV:pam | 4 | 1.000 | 0.961 | 0.985 | ** | 3 |
MAD:mclust | 2 | 1.000 | 0.977 | 0.990 | ** | |
ATC:kmeans | 3 | 1.000 | 0.990 | 0.978 | ** | |
ATC:skmeans | 6 | 1.000 | 0.974 | 0.983 | ** | 2,3,4,5 |
ATC:pam | 6 | 1.000 | 0.963 | 0.970 | ** | 3,5 |
ATC:mclust | 6 | 1.000 | 0.987 | 0.987 | ** | 2,3,4,5 |
ATC:NMF | 2 | 1.000 | 0.995 | 0.997 | ** | |
CV:NMF | 3 | 0.925 | 0.941 | 0.976 | * | |
SD:pam | 6 | 0.919 | 0.901 | 0.918 | * | 2,4,5 |
MAD:skmeans | 4 | 0.917 | 0.931 | 0.954 | * | 2,3 |
ATC:hclust | 5 | 0.916 | 0.945 | 0.979 | * | 2 |
MAD:pam | 4 | 0.906 | 0.911 | 0.927 | * | 3 |
CV:mclust | 4 | 0.904 | 0.913 | 0.967 | * | |
SD:NMF | 4 | 0.900 | 0.919 | 0.956 | * | |
MAD:NMF | 2 | 0.897 | 0.927 | 0.971 | ||
MAD:kmeans | 2 | 0.867 | 0.912 | 0.962 | ||
CV:kmeans | 3 | 0.861 | 0.899 | 0.950 | ||
SD:mclust | 4 | 0.759 | 0.818 | 0.908 | ||
SD:kmeans | 4 | 0.739 | 0.860 | 0.876 | ||
MAD:hclust | 2 | 0.733 | 0.890 | 0.945 | ||
SD:hclust | 3 | 0.696 | 0.869 | 0.925 |
**: 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.769 0.8644 0.944 0.467 0.519 0.519
#> CV:NMF 2 0.410 0.7213 0.881 0.470 0.494 0.494
#> MAD:NMF 2 0.897 0.9269 0.971 0.472 0.528 0.528
#> ATC:NMF 2 1.000 0.9947 0.997 0.453 0.548 0.548
#> SD:skmeans 2 0.733 0.8582 0.937 0.495 0.512 0.512
#> CV:skmeans 2 0.725 0.8686 0.936 0.496 0.492 0.492
#> MAD:skmeans 2 1.000 0.9933 0.997 0.490 0.512 0.512
#> ATC:skmeans 2 1.000 0.9603 0.985 0.507 0.492 0.492
#> SD:mclust 2 0.449 0.6865 0.823 0.310 0.790 0.790
#> CV:mclust 2 0.601 0.7570 0.868 0.322 0.765 0.765
#> MAD:mclust 2 1.000 0.9767 0.990 0.369 0.636 0.636
#> ATC:mclust 2 1.000 0.9989 0.999 0.381 0.619 0.619
#> SD:kmeans 2 0.285 -0.0418 0.628 0.398 0.790 0.790
#> CV:kmeans 2 0.308 0.6828 0.795 0.388 0.573 0.573
#> MAD:kmeans 2 0.867 0.9122 0.962 0.458 0.528 0.528
#> ATC:kmeans 2 0.619 0.7932 0.902 0.472 0.528 0.528
#> SD:pam 2 1.000 0.9359 0.976 0.405 0.587 0.587
#> CV:pam 2 0.448 0.7591 0.829 0.301 0.790 0.790
#> MAD:pam 2 0.864 0.9124 0.966 0.455 0.548 0.548
#> ATC:pam 2 0.691 0.8440 0.926 0.483 0.519 0.519
#> SD:hclust 2 0.564 0.8754 0.925 0.239 0.790 0.790
#> CV:hclust 2 1.000 1.0000 1.000 0.210 0.790 0.790
#> MAD:hclust 2 0.733 0.8905 0.945 0.446 0.528 0.528
#> ATC:hclust 2 1.000 1.0000 1.000 0.453 0.548 0.548
get_stats(res_list, k = 3)
#> k 1-PAC mean_silhouette concordance area_increased Rand Jaccard
#> SD:NMF 3 0.699 0.839 0.903 0.2755 0.771 0.609
#> CV:NMF 3 0.925 0.941 0.976 0.2497 0.742 0.554
#> MAD:NMF 3 0.621 0.694 0.867 0.3664 0.729 0.523
#> ATC:NMF 3 0.580 0.643 0.829 0.3211 0.745 0.575
#> SD:skmeans 3 1.000 0.957 0.978 0.3107 0.723 0.516
#> CV:skmeans 3 1.000 0.949 0.957 0.2486 0.685 0.469
#> MAD:skmeans 3 1.000 0.962 0.977 0.3411 0.760 0.561
#> ATC:skmeans 3 1.000 0.962 0.972 0.2592 0.831 0.667
#> SD:mclust 3 0.507 0.758 0.837 0.9837 0.409 0.311
#> CV:mclust 3 0.630 0.816 0.879 0.8027 0.662 0.569
#> MAD:mclust 3 0.579 0.821 0.880 0.7120 0.684 0.510
#> ATC:mclust 3 1.000 0.995 0.996 0.4806 0.817 0.704
#> SD:kmeans 3 0.537 0.584 0.786 0.4924 0.528 0.423
#> CV:kmeans 3 0.861 0.899 0.950 0.4302 0.777 0.647
#> MAD:kmeans 3 0.541 0.789 0.810 0.4017 0.729 0.526
#> ATC:kmeans 3 1.000 0.990 0.978 0.3815 0.734 0.530
#> SD:pam 3 0.721 0.924 0.907 0.5436 0.729 0.551
#> CV:pam 3 1.000 0.979 0.993 0.7845 0.678 0.593
#> MAD:pam 3 1.000 0.997 0.999 0.4410 0.723 0.526
#> ATC:pam 3 0.974 0.930 0.974 0.3766 0.677 0.450
#> SD:hclust 3 0.696 0.869 0.925 1.2785 0.678 0.593
#> CV:hclust 3 0.811 0.718 0.892 1.6784 0.605 0.500
#> MAD:hclust 3 0.625 0.830 0.896 0.2829 0.892 0.794
#> ATC:hclust 3 1.000 1.000 1.000 0.0449 0.980 0.963
get_stats(res_list, k = 4)
#> k 1-PAC mean_silhouette concordance area_increased Rand Jaccard
#> SD:NMF 4 0.900 0.919 0.956 0.2173 0.808 0.571
#> CV:NMF 4 0.892 0.912 0.959 0.2247 0.832 0.609
#> MAD:NMF 4 0.835 0.888 0.937 0.1213 0.820 0.552
#> ATC:NMF 4 0.525 0.605 0.799 0.1766 0.704 0.396
#> SD:skmeans 4 0.783 0.861 0.892 0.1270 0.913 0.756
#> CV:skmeans 4 1.000 0.993 0.995 0.1806 0.773 0.482
#> MAD:skmeans 4 0.917 0.931 0.954 0.1427 0.871 0.640
#> ATC:skmeans 4 1.000 0.951 0.978 0.1280 0.899 0.724
#> SD:mclust 4 0.759 0.818 0.908 0.1702 0.856 0.622
#> CV:mclust 4 0.904 0.913 0.967 0.2382 0.810 0.595
#> MAD:mclust 4 0.665 0.842 0.891 0.1226 0.762 0.457
#> ATC:mclust 4 1.000 0.978 0.991 0.2649 0.819 0.597
#> SD:kmeans 4 0.739 0.860 0.876 0.2126 0.825 0.572
#> CV:kmeans 4 0.677 0.906 0.898 0.2586 0.801 0.575
#> MAD:kmeans 4 0.617 0.470 0.756 0.1371 0.985 0.957
#> ATC:kmeans 4 0.830 0.862 0.873 0.1056 1.000 1.000
#> SD:pam 4 0.917 0.944 0.956 0.1487 0.923 0.782
#> CV:pam 4 1.000 0.961 0.985 0.3446 0.785 0.553
#> MAD:pam 4 0.906 0.911 0.927 0.0823 0.954 0.867
#> ATC:pam 4 0.830 0.916 0.945 0.0778 0.920 0.774
#> SD:hclust 4 0.747 0.793 0.899 0.1716 0.853 0.685
#> CV:hclust 4 0.666 0.791 0.890 0.1419 0.889 0.748
#> MAD:hclust 4 0.546 0.731 0.823 0.1681 0.937 0.849
#> ATC:hclust 4 0.765 0.980 0.938 0.3677 0.788 0.599
get_stats(res_list, k = 5)
#> k 1-PAC mean_silhouette concordance area_increased Rand Jaccard
#> SD:NMF 5 0.867 0.859 0.928 0.0975 0.905 0.666
#> CV:NMF 5 0.783 0.788 0.856 0.1018 0.903 0.669
#> MAD:NMF 5 0.852 0.806 0.899 0.0928 0.874 0.593
#> ATC:NMF 5 0.789 0.811 0.898 0.0970 0.811 0.466
#> SD:skmeans 5 0.824 0.876 0.902 0.0908 0.903 0.657
#> CV:skmeans 5 0.898 0.908 0.916 0.0842 0.901 0.651
#> MAD:skmeans 5 0.878 0.825 0.885 0.0619 0.938 0.754
#> ATC:skmeans 5 0.977 0.954 0.966 0.0432 0.969 0.887
#> SD:mclust 5 0.821 0.795 0.897 0.0851 0.893 0.650
#> CV:mclust 5 0.841 0.862 0.888 0.0942 0.906 0.671
#> MAD:mclust 5 0.604 0.722 0.748 0.0861 0.870 0.590
#> ATC:mclust 5 1.000 0.960 0.980 0.1024 0.855 0.546
#> SD:kmeans 5 0.747 0.678 0.797 0.0791 0.952 0.822
#> CV:kmeans 5 0.751 0.828 0.835 0.1028 1.000 1.000
#> MAD:kmeans 5 0.741 0.762 0.828 0.0778 0.830 0.518
#> ATC:kmeans 5 0.759 0.627 0.754 0.0596 0.881 0.649
#> SD:pam 5 0.910 0.935 0.962 0.0654 0.964 0.872
#> CV:pam 5 0.895 0.856 0.881 0.0521 0.964 0.872
#> MAD:pam 5 0.833 0.822 0.901 0.0859 0.941 0.805
#> ATC:pam 5 0.946 0.953 0.978 0.1029 0.906 0.689
#> SD:hclust 5 0.694 0.704 0.769 0.1652 0.872 0.609
#> CV:hclust 5 0.631 0.760 0.875 0.0175 0.997 0.991
#> MAD:hclust 5 0.673 0.688 0.830 0.1507 0.890 0.690
#> ATC:hclust 5 0.916 0.945 0.979 0.1086 0.968 0.900
get_stats(res_list, k = 6)
#> k 1-PAC mean_silhouette concordance area_increased Rand Jaccard
#> SD:NMF 6 0.843 0.830 0.890 0.0304 0.974 0.878
#> CV:NMF 6 0.837 0.782 0.864 0.0495 0.929 0.678
#> MAD:NMF 6 0.818 0.811 0.863 0.0359 0.958 0.812
#> ATC:NMF 6 0.790 0.743 0.853 0.0285 1.000 1.000
#> SD:skmeans 6 0.854 0.833 0.883 0.0393 0.944 0.737
#> CV:skmeans 6 0.875 0.883 0.902 0.0477 0.953 0.772
#> MAD:skmeans 6 0.843 0.835 0.871 0.0364 0.968 0.841
#> ATC:skmeans 6 1.000 0.974 0.983 0.0298 0.977 0.907
#> SD:mclust 6 0.838 0.851 0.905 0.0418 0.969 0.862
#> CV:mclust 6 0.891 0.838 0.929 0.0410 0.944 0.741
#> MAD:mclust 6 0.776 0.686 0.807 0.0632 0.920 0.650
#> ATC:mclust 6 1.000 0.987 0.987 0.0483 0.963 0.826
#> SD:kmeans 6 0.746 0.720 0.789 0.0454 0.932 0.722
#> CV:kmeans 6 0.783 0.687 0.760 0.0508 0.901 0.651
#> MAD:kmeans 6 0.783 0.762 0.803 0.0413 0.989 0.949
#> ATC:kmeans 6 0.761 0.766 0.810 0.0508 0.910 0.652
#> SD:pam 6 0.919 0.901 0.918 0.0788 0.937 0.740
#> CV:pam 6 0.796 0.683 0.806 0.0745 0.849 0.460
#> MAD:pam 6 0.841 0.822 0.835 0.0469 0.969 0.875
#> ATC:pam 6 1.000 0.963 0.970 0.0346 0.973 0.873
#> SD:hclust 6 0.711 0.555 0.781 0.0326 0.927 0.696
#> CV:hclust 6 0.704 0.697 0.850 0.1248 0.941 0.839
#> MAD:hclust 6 0.823 0.806 0.893 0.0555 0.941 0.759
#> ATC:hclust 6 0.876 0.912 0.959 0.0255 0.998 0.994
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 agent(p) time(p) k
#> SD:NMF 54 6.60e-02 1.66e-08 2
#> CV:NMF 51 6.32e-03 8.39e-06 2
#> MAD:NMF 59 8.40e-03 1.99e-07 2
#> ATC:NMF 60 3.37e-03 1.87e-04 2
#> SD:skmeans 55 9.67e-04 8.34e-07 2
#> CV:skmeans 58 6.85e-05 1.03e-04 2
#> MAD:skmeans 60 1.59e-04 1.38e-06 2
#> ATC:skmeans 58 3.98e-02 7.47e-06 2
#> SD:mclust 45 6.08e-01 8.44e-01 2
#> CV:mclust 58 5.89e-01 3.73e-01 2
#> MAD:mclust 59 9.94e-01 9.61e-13 2
#> ATC:mclust 60 1.00e+00 5.88e-13 2
#> SD:kmeans 7 NA NA 2
#> CV:kmeans 56 9.69e-02 1.67e-09 2
#> MAD:kmeans 59 2.29e-03 1.99e-07 2
#> ATC:kmeans 58 3.43e-03 1.51e-04 2
#> SD:pam 57 9.92e-01 2.57e-12 2
#> CV:pam 60 6.29e-01 3.81e-01 2
#> MAD:pam 58 2.57e-02 2.14e-08 2
#> ATC:pam 59 1.70e-01 5.11e-08 2
#> SD:hclust 60 6.29e-01 3.81e-01 2
#> CV:hclust 60 6.29e-01 3.81e-01 2
#> MAD:hclust 60 7.08e-03 1.38e-07 2
#> ATC:hclust 60 1.74e-02 1.87e-05 2
test_to_known_factors(res_list, k = 3)
#> n agent(p) time(p) k
#> SD:NMF 58 1.29e-01 1.32e-07 3
#> CV:NMF 58 3.37e-02 7.30e-07 3
#> MAD:NMF 44 3.69e-03 2.34e-09 3
#> ATC:NMF 47 2.68e-02 1.37e-04 3
#> SD:skmeans 59 3.63e-06 5.00e-10 3
#> CV:skmeans 60 6.88e-03 2.85e-06 3
#> MAD:skmeans 59 8.89e-07 2.14e-09 3
#> ATC:skmeans 60 2.76e-04 9.32e-09 3
#> SD:mclust 55 6.93e-04 9.16e-11 3
#> CV:mclust 51 3.03e-01 2.52e-09 3
#> MAD:mclust 60 7.99e-03 7.44e-12 3
#> ATC:mclust 60 9.12e-01 2.68e-11 3
#> SD:kmeans 37 3.25e-02 4.60e-08 3
#> CV:kmeans 60 9.51e-01 3.64e-11 3
#> MAD:kmeans 60 3.68e-07 4.50e-11 3
#> ATC:kmeans 60 3.27e-02 2.96e-14 3
#> SD:pam 59 5.98e-07 6.86e-11 3
#> CV:pam 59 9.40e-01 5.99e-11 3
#> MAD:pam 60 3.68e-07 4.50e-11 3
#> ATC:pam 57 1.22e-02 5.88e-14 3
#> SD:hclust 58 8.42e-01 8.84e-11 3
#> CV:hclust 50 3.29e-01 4.23e-09 3
#> MAD:hclust 60 1.22e-02 2.37e-06 3
#> ATC:hclust 60 2.29e-03 8.62e-05 3
test_to_known_factors(res_list, k = 4)
#> n agent(p) time(p) k
#> SD:NMF 60 7.07e-04 4.01e-10 4
#> CV:NMF 59 1.11e-03 3.39e-10 4
#> MAD:NMF 58 8.31e-04 2.49e-09 4
#> ATC:NMF 45 1.40e-01 1.73e-10 4
#> SD:skmeans 60 4.28e-05 7.18e-09 4
#> CV:skmeans 60 3.70e-05 9.96e-10 4
#> MAD:skmeans 59 5.85e-04 2.91e-18 4
#> ATC:skmeans 60 8.88e-04 2.11e-13 4
#> SD:mclust 55 5.00e-04 2.97e-09 4
#> CV:mclust 57 1.89e-04 1.46e-09 4
#> MAD:mclust 59 7.68e-01 4.57e-16 4
#> ATC:mclust 60 1.02e-01 3.82e-13 4
#> SD:kmeans 60 3.70e-05 9.96e-10 4
#> CV:kmeans 60 3.70e-05 9.96e-10 4
#> MAD:kmeans 34 2.13e-03 8.92e-07 4
#> ATC:kmeans 59 1.41e-02 8.98e-15 4
#> SD:pam 60 2.81e-05 5.60e-10 4
#> CV:pam 59 3.64e-05 7.47e-10 4
#> MAD:pam 60 4.94e-14 1.34e-09 4
#> ATC:pam 60 3.69e-03 7.23e-12 4
#> SD:hclust 52 2.02e-01 2.38e-11 4
#> CV:hclust 53 3.80e-01 1.18e-08 4
#> MAD:hclust 53 7.48e-02 2.48e-09 4
#> ATC:hclust 60 9.42e-03 9.68e-14 4
test_to_known_factors(res_list, k = 5)
#> n agent(p) time(p) k
#> SD:NMF 56 1.28e-02 3.87e-14 5
#> CV:NMF 53 1.57e-02 2.54e-13 5
#> MAD:NMF 53 9.74e-03 2.95e-14 5
#> ATC:NMF 57 1.49e-02 1.23e-13 5
#> SD:skmeans 60 6.96e-03 9.22e-16 5
#> CV:skmeans 59 6.78e-03 9.34e-17 5
#> MAD:skmeans 56 3.94e-03 3.60e-17 5
#> ATC:skmeans 59 1.59e-07 9.53e-12 5
#> SD:mclust 55 2.32e-03 3.07e-12 5
#> CV:mclust 58 8.95e-05 5.02e-10 5
#> MAD:mclust 54 7.34e-03 1.45e-15 5
#> ATC:mclust 60 1.37e-02 1.42e-15 5
#> SD:kmeans 54 4.08e-04 1.15e-11 5
#> CV:kmeans 60 3.70e-05 9.96e-10 5
#> MAD:kmeans 56 6.39e-04 2.45e-16 5
#> ATC:kmeans 46 2.28e-04 2.48e-13 5
#> SD:pam 60 7.83e-11 9.02e-09 5
#> CV:pam 58 1.08e-09 5.03e-09 5
#> MAD:pam 58 1.59e-11 1.19e-08 5
#> ATC:pam 60 2.86e-04 2.57e-16 5
#> SD:hclust 51 3.51e-03 9.30e-12 5
#> CV:hclust 52 3.45e-01 1.15e-08 5
#> MAD:hclust 50 1.26e-01 2.06e-14 5
#> ATC:hclust 59 2.01e-02 2.96e-13 5
test_to_known_factors(res_list, k = 6)
#> n agent(p) time(p) k
#> SD:NMF 57 7.96e-03 3.71e-14 6
#> CV:NMF 54 1.03e-02 1.32e-11 6
#> MAD:NMF 57 7.63e-03 7.29e-16 6
#> ATC:NMF 55 1.59e-02 1.38e-13 6
#> SD:skmeans 57 4.44e-08 9.07e-14 6
#> CV:skmeans 60 2.09e-09 5.37e-13 6
#> MAD:skmeans 59 7.51e-07 1.72e-15 6
#> ATC:skmeans 60 3.84e-07 5.17e-11 6
#> SD:mclust 60 1.73e-03 3.17e-10 6
#> CV:mclust 55 3.53e-03 5.54e-09 6
#> MAD:mclust 50 4.54e-02 1.47e-12 6
#> ATC:mclust 60 3.33e-02 8.94e-20 6
#> SD:kmeans 56 1.69e-03 5.56e-15 6
#> CV:kmeans 49 2.45e-03 1.20e-08 6
#> MAD:kmeans 60 4.51e-03 4.99e-17 6
#> ATC:kmeans 54 2.26e-04 2.30e-16 6
#> SD:pam 60 5.80e-16 1.03e-07 6
#> CV:pam 42 1.51e-08 1.21e-05 6
#> MAD:pam 58 2.60e-10 1.38e-07 6
#> ATC:pam 60 1.16e-08 3.51e-15 6
#> SD:hclust 38 1.25e-02 3.40e-09 6
#> CV:hclust 46 1.50e-03 5.73e-07 6
#> MAD:hclust 58 1.48e-04 2.24e-14 6
#> ATC:hclust 59 2.01e-02 2.96e-13 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 38950 rows and 60 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 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.564 0.875 0.925 0.2389 0.790 0.790
#> 3 3 0.696 0.869 0.925 1.2785 0.678 0.593
#> 4 4 0.747 0.793 0.899 0.1716 0.853 0.685
#> 5 5 0.694 0.704 0.769 0.1652 0.872 0.609
#> 6 6 0.711 0.555 0.781 0.0326 0.927 0.696
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
#> GSM154259 2 0.722 0.795 0.200 0.800
#> GSM154260 2 0.722 0.795 0.200 0.800
#> GSM154261 2 0.722 0.795 0.200 0.800
#> GSM154274 2 0.000 0.925 0.000 1.000
#> GSM154275 2 0.000 0.925 0.000 1.000
#> GSM154276 2 0.000 0.925 0.000 1.000
#> GSM154289 2 0.000 0.925 0.000 1.000
#> GSM154290 2 0.000 0.925 0.000 1.000
#> GSM154291 1 0.722 0.849 0.800 0.200
#> GSM154304 2 0.000 0.925 0.000 1.000
#> GSM154305 2 0.000 0.925 0.000 1.000
#> GSM154306 1 0.722 0.849 0.800 0.200
#> GSM154262 2 0.722 0.795 0.200 0.800
#> GSM154263 2 0.722 0.795 0.200 0.800
#> GSM154264 2 0.722 0.795 0.200 0.800
#> GSM154277 1 0.969 0.670 0.604 0.396
#> GSM154278 2 0.000 0.925 0.000 1.000
#> GSM154279 2 0.000 0.925 0.000 1.000
#> GSM154292 2 0.000 0.925 0.000 1.000
#> GSM154293 2 0.000 0.925 0.000 1.000
#> GSM154294 1 0.969 0.670 0.604 0.396
#> GSM154307 2 0.000 0.925 0.000 1.000
#> GSM154308 2 0.000 0.925 0.000 1.000
#> GSM154309 2 0.000 0.925 0.000 1.000
#> GSM154265 2 0.722 0.795 0.200 0.800
#> GSM154266 2 0.722 0.795 0.200 0.800
#> GSM154267 2 0.722 0.795 0.200 0.800
#> GSM154280 2 0.000 0.925 0.000 1.000
#> GSM154281 2 0.000 0.925 0.000 1.000
#> GSM154282 2 0.000 0.925 0.000 1.000
#> GSM154295 2 0.000 0.925 0.000 1.000
#> GSM154296 2 0.000 0.925 0.000 1.000
#> GSM154297 2 0.000 0.925 0.000 1.000
#> GSM154310 2 0.000 0.925 0.000 1.000
#> GSM154311 2 0.000 0.925 0.000 1.000
#> GSM154312 2 0.000 0.925 0.000 1.000
#> GSM154268 2 0.722 0.795 0.200 0.800
#> GSM154269 2 0.722 0.795 0.200 0.800
#> GSM154270 2 0.722 0.795 0.200 0.800
#> GSM154283 2 0.000 0.925 0.000 1.000
#> GSM154284 2 0.000 0.925 0.000 1.000
#> GSM154285 2 0.000 0.925 0.000 1.000
#> GSM154298 2 0.000 0.925 0.000 1.000
#> GSM154299 2 0.000 0.925 0.000 1.000
#> GSM154300 2 0.000 0.925 0.000 1.000
#> GSM154313 2 0.000 0.925 0.000 1.000
#> GSM154314 2 0.000 0.925 0.000 1.000
#> GSM154315 1 0.722 0.849 0.800 0.200
#> GSM154271 2 0.722 0.795 0.200 0.800
#> GSM154272 2 0.722 0.795 0.200 0.800
#> GSM154273 2 0.722 0.795 0.200 0.800
#> GSM154286 2 0.000 0.925 0.000 1.000
#> GSM154287 2 0.000 0.925 0.000 1.000
#> GSM154288 1 0.260 0.789 0.956 0.044
#> GSM154301 2 0.000 0.925 0.000 1.000
#> GSM154302 2 0.000 0.925 0.000 1.000
#> GSM154303 1 0.260 0.789 0.956 0.044
#> GSM154316 2 0.000 0.925 0.000 1.000
#> GSM154317 2 0.000 0.925 0.000 1.000
#> GSM154318 2 0.000 0.925 0.000 1.000
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> GSM154259 1 0.1411 1.000 0.964 0.036 0.000
#> GSM154260 1 0.1411 1.000 0.964 0.036 0.000
#> GSM154261 1 0.1411 1.000 0.964 0.036 0.000
#> GSM154274 2 0.0000 0.907 0.000 1.000 0.000
#> GSM154275 2 0.0000 0.907 0.000 1.000 0.000
#> GSM154276 2 0.0000 0.907 0.000 1.000 0.000
#> GSM154289 2 0.5891 0.734 0.036 0.764 0.200
#> GSM154290 2 0.0000 0.907 0.000 1.000 0.000
#> GSM154291 3 0.0000 0.753 0.000 0.000 1.000
#> GSM154304 2 0.5891 0.734 0.036 0.764 0.200
#> GSM154305 2 0.5891 0.734 0.036 0.764 0.200
#> GSM154306 3 0.0000 0.753 0.000 0.000 1.000
#> GSM154262 1 0.1411 1.000 0.964 0.036 0.000
#> GSM154263 1 0.1411 1.000 0.964 0.036 0.000
#> GSM154264 1 0.1411 1.000 0.964 0.036 0.000
#> GSM154277 3 0.6111 0.485 0.000 0.396 0.604
#> GSM154278 2 0.0000 0.907 0.000 1.000 0.000
#> GSM154279 2 0.0000 0.907 0.000 1.000 0.000
#> GSM154292 2 0.0000 0.907 0.000 1.000 0.000
#> GSM154293 2 0.0000 0.907 0.000 1.000 0.000
#> GSM154294 3 0.6111 0.485 0.000 0.396 0.604
#> GSM154307 2 0.5891 0.734 0.036 0.764 0.200
#> GSM154308 2 0.5891 0.734 0.036 0.764 0.200
#> GSM154309 2 0.5891 0.734 0.036 0.764 0.200
#> GSM154265 1 0.1411 1.000 0.964 0.036 0.000
#> GSM154266 1 0.1411 1.000 0.964 0.036 0.000
#> GSM154267 1 0.1411 1.000 0.964 0.036 0.000
#> GSM154280 2 0.0424 0.906 0.008 0.992 0.000
#> GSM154281 2 0.0424 0.906 0.008 0.992 0.000
#> GSM154282 2 0.0424 0.906 0.008 0.992 0.000
#> GSM154295 2 0.0424 0.906 0.008 0.992 0.000
#> GSM154296 2 0.0424 0.906 0.008 0.992 0.000
#> GSM154297 2 0.0424 0.906 0.008 0.992 0.000
#> GSM154310 2 0.0424 0.906 0.008 0.992 0.000
#> GSM154311 2 0.0424 0.906 0.008 0.992 0.000
#> GSM154312 2 0.0424 0.906 0.008 0.992 0.000
#> GSM154268 1 0.1411 1.000 0.964 0.036 0.000
#> GSM154269 1 0.1411 1.000 0.964 0.036 0.000
#> GSM154270 1 0.1411 1.000 0.964 0.036 0.000
#> GSM154283 2 0.0000 0.907 0.000 1.000 0.000
#> GSM154284 2 0.0000 0.907 0.000 1.000 0.000
#> GSM154285 2 0.0000 0.907 0.000 1.000 0.000
#> GSM154298 2 0.1999 0.882 0.036 0.952 0.012
#> GSM154299 2 0.1999 0.882 0.036 0.952 0.012
#> GSM154300 2 0.1411 0.887 0.036 0.964 0.000
#> GSM154313 2 0.5891 0.734 0.036 0.764 0.200
#> GSM154314 2 0.5891 0.734 0.036 0.764 0.200
#> GSM154315 3 0.0000 0.753 0.000 0.000 1.000
#> GSM154271 1 0.1411 1.000 0.964 0.036 0.000
#> GSM154272 1 0.1411 1.000 0.964 0.036 0.000
#> GSM154273 1 0.1411 1.000 0.964 0.036 0.000
#> GSM154286 2 0.2959 0.843 0.100 0.900 0.000
#> GSM154287 2 0.2959 0.843 0.100 0.900 0.000
#> GSM154288 3 0.5514 0.682 0.156 0.044 0.800
#> GSM154301 2 0.2959 0.843 0.100 0.900 0.000
#> GSM154302 2 0.2959 0.843 0.100 0.900 0.000
#> GSM154303 3 0.5514 0.682 0.156 0.044 0.800
#> GSM154316 2 0.2959 0.843 0.100 0.900 0.000
#> GSM154317 2 0.2959 0.843 0.100 0.900 0.000
#> GSM154318 2 0.2959 0.843 0.100 0.900 0.000
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> GSM154259 1 0.000 1.000 1.000 0.000 0.000 0.000
#> GSM154260 1 0.000 1.000 1.000 0.000 0.000 0.000
#> GSM154261 1 0.000 1.000 1.000 0.000 0.000 0.000
#> GSM154274 3 0.112 0.888 0.000 0.036 0.964 0.000
#> GSM154275 3 0.112 0.888 0.000 0.036 0.964 0.000
#> GSM154276 3 0.112 0.888 0.000 0.036 0.964 0.000
#> GSM154289 2 0.317 0.480 0.000 0.840 0.160 0.000
#> GSM154290 3 0.130 0.882 0.000 0.044 0.956 0.000
#> GSM154291 4 0.361 0.709 0.000 0.200 0.000 0.800
#> GSM154304 2 0.281 0.467 0.000 0.868 0.132 0.000
#> GSM154305 2 0.000 0.241 0.000 1.000 0.000 0.000
#> GSM154306 4 0.361 0.709 0.000 0.200 0.000 0.800
#> GSM154262 1 0.000 1.000 1.000 0.000 0.000 0.000
#> GSM154263 1 0.000 1.000 1.000 0.000 0.000 0.000
#> GSM154264 1 0.000 1.000 1.000 0.000 0.000 0.000
#> GSM154277 4 0.564 0.386 0.000 0.032 0.364 0.604
#> GSM154278 3 0.112 0.888 0.000 0.036 0.964 0.000
#> GSM154279 3 0.112 0.888 0.000 0.036 0.964 0.000
#> GSM154292 3 0.121 0.886 0.000 0.040 0.960 0.000
#> GSM154293 3 0.121 0.886 0.000 0.040 0.960 0.000
#> GSM154294 4 0.564 0.386 0.000 0.032 0.364 0.604
#> GSM154307 2 0.500 0.593 0.000 0.516 0.484 0.000
#> GSM154308 2 0.500 0.593 0.000 0.516 0.484 0.000
#> GSM154309 2 0.500 0.593 0.000 0.516 0.484 0.000
#> GSM154265 1 0.000 1.000 1.000 0.000 0.000 0.000
#> GSM154266 1 0.000 1.000 1.000 0.000 0.000 0.000
#> GSM154267 1 0.000 1.000 1.000 0.000 0.000 0.000
#> GSM154280 3 0.000 0.893 0.000 0.000 1.000 0.000
#> GSM154281 3 0.000 0.893 0.000 0.000 1.000 0.000
#> GSM154282 3 0.000 0.893 0.000 0.000 1.000 0.000
#> GSM154295 3 0.000 0.893 0.000 0.000 1.000 0.000
#> GSM154296 3 0.000 0.893 0.000 0.000 1.000 0.000
#> GSM154297 3 0.000 0.893 0.000 0.000 1.000 0.000
#> GSM154310 3 0.000 0.893 0.000 0.000 1.000 0.000
#> GSM154311 3 0.000 0.893 0.000 0.000 1.000 0.000
#> GSM154312 3 0.000 0.893 0.000 0.000 1.000 0.000
#> GSM154268 1 0.000 1.000 1.000 0.000 0.000 0.000
#> GSM154269 1 0.000 1.000 1.000 0.000 0.000 0.000
#> GSM154270 1 0.000 1.000 1.000 0.000 0.000 0.000
#> GSM154283 3 0.208 0.833 0.000 0.084 0.916 0.000
#> GSM154284 3 0.112 0.888 0.000 0.036 0.964 0.000
#> GSM154285 3 0.112 0.888 0.000 0.036 0.964 0.000
#> GSM154298 3 0.454 0.154 0.000 0.324 0.676 0.000
#> GSM154299 3 0.454 0.154 0.000 0.324 0.676 0.000
#> GSM154300 2 0.391 0.328 0.000 0.768 0.232 0.000
#> GSM154313 2 0.500 0.593 0.000 0.516 0.484 0.000
#> GSM154314 2 0.500 0.593 0.000 0.516 0.484 0.000
#> GSM154315 4 0.361 0.709 0.000 0.200 0.000 0.800
#> GSM154271 1 0.000 1.000 1.000 0.000 0.000 0.000
#> GSM154272 1 0.000 1.000 1.000 0.000 0.000 0.000
#> GSM154273 1 0.000 1.000 1.000 0.000 0.000 0.000
#> GSM154286 3 0.222 0.819 0.092 0.000 0.908 0.000
#> GSM154287 3 0.222 0.819 0.092 0.000 0.908 0.000
#> GSM154288 4 0.000 0.705 0.000 0.000 0.000 1.000
#> GSM154301 3 0.222 0.819 0.092 0.000 0.908 0.000
#> GSM154302 3 0.222 0.819 0.092 0.000 0.908 0.000
#> GSM154303 4 0.000 0.705 0.000 0.000 0.000 1.000
#> GSM154316 3 0.222 0.819 0.092 0.000 0.908 0.000
#> GSM154317 3 0.222 0.819 0.092 0.000 0.908 0.000
#> GSM154318 3 0.222 0.819 0.092 0.000 0.908 0.000
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> GSM154259 1 0.0880 0.978 0.968 0.000 0.032 0.000 0.000
#> GSM154260 1 0.0000 0.985 1.000 0.000 0.000 0.000 0.000
#> GSM154261 1 0.0000 0.985 1.000 0.000 0.000 0.000 0.000
#> GSM154274 5 0.3790 0.748 0.000 0.004 0.272 0.000 0.724
#> GSM154275 5 0.3790 0.748 0.000 0.004 0.272 0.000 0.724
#> GSM154276 5 0.3790 0.748 0.000 0.004 0.272 0.000 0.724
#> GSM154289 2 0.3339 0.555 0.000 0.840 0.048 0.000 0.112
#> GSM154290 5 0.4016 0.747 0.000 0.012 0.272 0.000 0.716
#> GSM154291 4 0.3109 0.791 0.000 0.200 0.000 0.800 0.000
#> GSM154304 2 0.2848 0.549 0.000 0.868 0.028 0.000 0.104
#> GSM154305 2 0.0162 0.379 0.000 0.996 0.000 0.000 0.004
#> GSM154306 4 0.3109 0.791 0.000 0.200 0.000 0.800 0.000
#> GSM154262 1 0.0880 0.978 0.968 0.000 0.032 0.000 0.000
#> GSM154263 1 0.0000 0.985 1.000 0.000 0.000 0.000 0.000
#> GSM154264 1 0.0000 0.985 1.000 0.000 0.000 0.000 0.000
#> GSM154277 5 0.4101 -0.387 0.000 0.000 0.000 0.372 0.628
#> GSM154278 5 0.4135 0.749 0.000 0.004 0.340 0.000 0.656
#> GSM154279 5 0.4135 0.749 0.000 0.004 0.340 0.000 0.656
#> GSM154292 5 0.3876 0.736 0.000 0.000 0.316 0.000 0.684
#> GSM154293 5 0.3876 0.736 0.000 0.000 0.316 0.000 0.684
#> GSM154294 4 0.4171 0.415 0.000 0.000 0.000 0.604 0.396
#> GSM154307 2 0.6443 0.622 0.000 0.504 0.248 0.000 0.248
#> GSM154308 2 0.6443 0.622 0.000 0.504 0.248 0.000 0.248
#> GSM154309 2 0.6443 0.622 0.000 0.504 0.248 0.000 0.248
#> GSM154265 1 0.0880 0.978 0.968 0.000 0.032 0.000 0.000
#> GSM154266 1 0.0000 0.985 1.000 0.000 0.000 0.000 0.000
#> GSM154267 1 0.0000 0.985 1.000 0.000 0.000 0.000 0.000
#> GSM154280 3 0.4201 0.296 0.000 0.000 0.592 0.000 0.408
#> GSM154281 3 0.4201 0.296 0.000 0.000 0.592 0.000 0.408
#> GSM154282 3 0.4201 0.296 0.000 0.000 0.592 0.000 0.408
#> GSM154295 3 0.0963 0.731 0.000 0.000 0.964 0.000 0.036
#> GSM154296 3 0.0963 0.731 0.000 0.000 0.964 0.000 0.036
#> GSM154297 3 0.0963 0.731 0.000 0.000 0.964 0.000 0.036
#> GSM154310 3 0.0963 0.731 0.000 0.000 0.964 0.000 0.036
#> GSM154311 3 0.0963 0.731 0.000 0.000 0.964 0.000 0.036
#> GSM154312 3 0.0963 0.731 0.000 0.000 0.964 0.000 0.036
#> GSM154268 1 0.0000 0.985 1.000 0.000 0.000 0.000 0.000
#> GSM154269 1 0.0880 0.978 0.968 0.000 0.032 0.000 0.000
#> GSM154270 1 0.0000 0.985 1.000 0.000 0.000 0.000 0.000
#> GSM154283 5 0.5155 0.692 0.000 0.052 0.352 0.000 0.596
#> GSM154284 5 0.3790 0.748 0.000 0.004 0.272 0.000 0.724
#> GSM154285 5 0.3790 0.748 0.000 0.004 0.272 0.000 0.724
#> GSM154298 5 0.6651 -0.110 0.000 0.312 0.248 0.000 0.440
#> GSM154299 5 0.6651 -0.110 0.000 0.312 0.248 0.000 0.440
#> GSM154300 2 0.3534 0.342 0.000 0.744 0.000 0.000 0.256
#> GSM154313 2 0.6443 0.622 0.000 0.504 0.248 0.000 0.248
#> GSM154314 2 0.6443 0.622 0.000 0.504 0.248 0.000 0.248
#> GSM154315 4 0.3109 0.791 0.000 0.200 0.000 0.800 0.000
#> GSM154271 1 0.0880 0.978 0.968 0.000 0.032 0.000 0.000
#> GSM154272 1 0.0880 0.978 0.968 0.000 0.032 0.000 0.000
#> GSM154273 1 0.0000 0.985 1.000 0.000 0.000 0.000 0.000
#> GSM154286 3 0.3734 0.770 0.060 0.000 0.812 0.000 0.128
#> GSM154287 3 0.3734 0.770 0.060 0.000 0.812 0.000 0.128
#> GSM154288 4 0.0162 0.774 0.000 0.000 0.000 0.996 0.004
#> GSM154301 3 0.3734 0.770 0.060 0.000 0.812 0.000 0.128
#> GSM154302 3 0.3734 0.770 0.060 0.000 0.812 0.000 0.128
#> GSM154303 4 0.0162 0.774 0.000 0.000 0.000 0.996 0.004
#> GSM154316 3 0.3734 0.770 0.060 0.000 0.812 0.000 0.128
#> GSM154317 3 0.3734 0.770 0.060 0.000 0.812 0.000 0.128
#> GSM154318 3 0.3734 0.770 0.060 0.000 0.812 0.000 0.128
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> GSM154259 1 0.1663 0.93368 0.912 0.000 0.088 0.000 0.000 0.000
#> GSM154260 1 0.0000 0.95639 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM154261 1 0.0000 0.95639 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM154274 5 0.6068 0.50900 0.000 0.360 0.264 0.000 0.376 0.000
#> GSM154275 5 0.6068 0.50900 0.000 0.360 0.264 0.000 0.376 0.000
#> GSM154276 5 0.6068 0.50900 0.000 0.360 0.264 0.000 0.376 0.000
#> GSM154289 2 0.5014 0.01512 0.000 0.492 0.012 0.000 0.452 0.044
#> GSM154290 5 0.6192 0.49793 0.000 0.364 0.264 0.000 0.368 0.004
#> GSM154291 4 0.3101 0.79785 0.000 0.000 0.000 0.756 0.000 0.244
#> GSM154304 2 0.4751 0.00765 0.000 0.500 0.000 0.000 0.452 0.048
#> GSM154305 5 0.4511 -0.31705 0.000 0.332 0.000 0.000 0.620 0.048
#> GSM154306 4 0.3101 0.79785 0.000 0.000 0.000 0.756 0.000 0.244
#> GSM154262 1 0.1663 0.93368 0.912 0.000 0.088 0.000 0.000 0.000
#> GSM154263 1 0.0000 0.95639 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM154264 1 0.0000 0.95639 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM154277 6 0.3371 0.00000 0.000 0.000 0.000 0.000 0.292 0.708
#> GSM154278 2 0.5862 -0.39159 0.000 0.428 0.196 0.000 0.376 0.000
#> GSM154279 2 0.5862 -0.39159 0.000 0.428 0.196 0.000 0.376 0.000
#> GSM154292 2 0.7062 -0.26836 0.000 0.424 0.176 0.000 0.296 0.104
#> GSM154293 2 0.7062 -0.26836 0.000 0.424 0.176 0.000 0.296 0.104
#> GSM154294 4 0.5019 0.09363 0.000 0.000 0.000 0.604 0.292 0.104
#> GSM154307 2 0.0000 0.47659 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM154308 2 0.0000 0.47659 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM154309 2 0.0000 0.47659 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM154265 1 0.1663 0.93368 0.912 0.000 0.088 0.000 0.000 0.000
#> GSM154266 1 0.0000 0.95639 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM154267 1 0.0000 0.95639 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM154280 3 0.4727 0.40561 0.000 0.100 0.660 0.000 0.240 0.000
#> GSM154281 3 0.4727 0.40561 0.000 0.100 0.660 0.000 0.240 0.000
#> GSM154282 3 0.4727 0.40561 0.000 0.100 0.660 0.000 0.240 0.000
#> GSM154295 3 0.2996 0.75724 0.000 0.228 0.772 0.000 0.000 0.000
#> GSM154296 3 0.2996 0.75724 0.000 0.228 0.772 0.000 0.000 0.000
#> GSM154297 3 0.2996 0.75724 0.000 0.228 0.772 0.000 0.000 0.000
#> GSM154310 3 0.2996 0.75724 0.000 0.228 0.772 0.000 0.000 0.000
#> GSM154311 3 0.2996 0.75724 0.000 0.228 0.772 0.000 0.000 0.000
#> GSM154312 3 0.2996 0.75724 0.000 0.228 0.772 0.000 0.000 0.000
#> GSM154268 1 0.0000 0.95639 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM154269 1 0.1663 0.93368 0.912 0.000 0.088 0.000 0.000 0.000
#> GSM154270 1 0.0000 0.95639 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM154283 2 0.5659 -0.24986 0.000 0.496 0.168 0.000 0.336 0.000
#> GSM154284 5 0.6068 0.50900 0.000 0.360 0.264 0.000 0.376 0.000
#> GSM154285 5 0.6068 0.50900 0.000 0.360 0.264 0.000 0.376 0.000
#> GSM154298 2 0.2730 0.34780 0.000 0.808 0.000 0.000 0.192 0.000
#> GSM154299 2 0.2730 0.34780 0.000 0.808 0.000 0.000 0.192 0.000
#> GSM154300 5 0.2996 -0.37737 0.000 0.228 0.000 0.000 0.772 0.000
#> GSM154313 2 0.0000 0.47659 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM154314 2 0.0000 0.47659 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM154315 4 0.3101 0.79785 0.000 0.000 0.000 0.756 0.000 0.244
#> GSM154271 1 0.1663 0.93368 0.912 0.000 0.088 0.000 0.000 0.000
#> GSM154272 1 0.1663 0.93368 0.912 0.000 0.088 0.000 0.000 0.000
#> GSM154273 1 0.0000 0.95639 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM154286 3 0.0146 0.78038 0.004 0.000 0.996 0.000 0.000 0.000
#> GSM154287 3 0.0146 0.78038 0.004 0.000 0.996 0.000 0.000 0.000
#> GSM154288 4 0.0146 0.74896 0.000 0.000 0.000 0.996 0.000 0.004
#> GSM154301 3 0.0146 0.78038 0.004 0.000 0.996 0.000 0.000 0.000
#> GSM154302 3 0.0146 0.78038 0.004 0.000 0.996 0.000 0.000 0.000
#> GSM154303 4 0.0146 0.74896 0.000 0.000 0.000 0.996 0.000 0.004
#> GSM154316 3 0.0146 0.78038 0.004 0.000 0.996 0.000 0.000 0.000
#> GSM154317 3 0.0146 0.78038 0.004 0.000 0.996 0.000 0.000 0.000
#> GSM154318 3 0.0146 0.78038 0.004 0.000 0.996 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 agent(p) time(p) k
#> SD:hclust 60 0.62902 3.81e-01 2
#> SD:hclust 58 0.84177 8.84e-11 3
#> SD:hclust 52 0.20174 2.38e-11 4
#> SD:hclust 51 0.00351 9.30e-12 5
#> SD:hclust 38 0.01251 3.40e-09 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 38950 rows and 60 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 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.285 -0.0418 0.628 0.3978 0.790 0.790
#> 3 3 0.537 0.5840 0.786 0.4924 0.528 0.423
#> 4 4 0.739 0.8601 0.876 0.2126 0.825 0.572
#> 5 5 0.747 0.6784 0.797 0.0791 0.952 0.822
#> 6 6 0.746 0.7204 0.789 0.0454 0.932 0.722
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
#> GSM154259 2 0.9635 0.32416 0.388 0.612
#> GSM154260 2 0.9635 0.32416 0.388 0.612
#> GSM154261 2 0.9635 0.32416 0.388 0.612
#> GSM154274 2 0.9988 -0.54414 0.480 0.520
#> GSM154275 2 0.9988 -0.54414 0.480 0.520
#> GSM154276 2 0.9988 -0.54414 0.480 0.520
#> GSM154289 2 0.9988 -0.54414 0.480 0.520
#> GSM154290 2 0.9988 -0.54414 0.480 0.520
#> GSM154291 1 0.9635 0.98129 0.612 0.388
#> GSM154304 2 0.9988 -0.54414 0.480 0.520
#> GSM154305 2 0.9993 -0.55992 0.484 0.516
#> GSM154306 1 0.9635 0.98129 0.612 0.388
#> GSM154262 2 0.9635 0.32416 0.388 0.612
#> GSM154263 2 0.9635 0.32416 0.388 0.612
#> GSM154264 2 0.9635 0.32416 0.388 0.612
#> GSM154277 1 0.9635 0.98129 0.612 0.388
#> GSM154278 2 0.9988 -0.54414 0.480 0.520
#> GSM154279 2 0.9988 -0.54414 0.480 0.520
#> GSM154292 2 0.9988 -0.54414 0.480 0.520
#> GSM154293 2 0.9988 -0.54414 0.480 0.520
#> GSM154294 1 0.9635 0.98129 0.612 0.388
#> GSM154307 2 0.9988 -0.54414 0.480 0.520
#> GSM154308 2 0.9988 -0.54414 0.480 0.520
#> GSM154309 2 0.9988 -0.54414 0.480 0.520
#> GSM154265 2 0.9635 0.32416 0.388 0.612
#> GSM154266 2 0.9635 0.32416 0.388 0.612
#> GSM154267 2 0.9635 0.32416 0.388 0.612
#> GSM154280 2 0.9286 -0.27034 0.344 0.656
#> GSM154281 2 0.9286 -0.27034 0.344 0.656
#> GSM154282 2 0.9286 -0.27034 0.344 0.656
#> GSM154295 2 0.9286 -0.27034 0.344 0.656
#> GSM154296 2 0.9460 -0.31799 0.364 0.636
#> GSM154297 2 0.9522 -0.33759 0.372 0.628
#> GSM154310 2 0.9286 -0.27034 0.344 0.656
#> GSM154311 2 0.9286 -0.27034 0.344 0.656
#> GSM154312 2 0.9286 -0.27034 0.344 0.656
#> GSM154268 2 0.9635 0.32416 0.388 0.612
#> GSM154269 2 0.9635 0.32416 0.388 0.612
#> GSM154270 2 0.9635 0.32416 0.388 0.612
#> GSM154283 2 0.9988 -0.54414 0.480 0.520
#> GSM154284 2 0.9988 -0.54414 0.480 0.520
#> GSM154285 2 0.9988 -0.54414 0.480 0.520
#> GSM154298 2 0.9988 -0.54414 0.480 0.520
#> GSM154299 2 0.9988 -0.54414 0.480 0.520
#> GSM154300 2 0.9988 -0.54414 0.480 0.520
#> GSM154313 2 0.9988 -0.54414 0.480 0.520
#> GSM154314 2 0.9988 -0.54414 0.480 0.520
#> GSM154315 1 0.9635 0.98129 0.612 0.388
#> GSM154271 2 0.9635 0.32416 0.388 0.612
#> GSM154272 2 0.9635 0.32416 0.388 0.612
#> GSM154273 2 0.9635 0.32416 0.388 0.612
#> GSM154286 2 0.0000 0.16769 0.000 1.000
#> GSM154287 2 0.0376 0.17035 0.004 0.996
#> GSM154288 1 0.9754 0.95239 0.592 0.408
#> GSM154301 2 0.6712 0.00487 0.176 0.824
#> GSM154302 2 0.6712 0.00487 0.176 0.824
#> GSM154303 1 0.9754 0.95239 0.592 0.408
#> GSM154316 2 0.6801 -0.00191 0.180 0.820
#> GSM154317 2 0.6712 0.00487 0.176 0.824
#> GSM154318 2 0.6712 0.00487 0.176 0.824
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> GSM154259 1 0.0592 0.9923 0.988 0.000 0.012
#> GSM154260 1 0.0592 0.9923 0.988 0.000 0.012
#> GSM154261 1 0.0592 0.9923 0.988 0.000 0.012
#> GSM154274 2 0.3267 0.6889 0.000 0.884 0.116
#> GSM154275 2 0.3267 0.6889 0.000 0.884 0.116
#> GSM154276 2 0.3267 0.6889 0.000 0.884 0.116
#> GSM154289 2 0.0000 0.6838 0.000 1.000 0.000
#> GSM154290 2 0.0000 0.6838 0.000 1.000 0.000
#> GSM154291 3 0.6291 0.3170 0.000 0.468 0.532
#> GSM154304 2 0.0237 0.6839 0.000 0.996 0.004
#> GSM154305 2 0.0237 0.6839 0.000 0.996 0.004
#> GSM154306 3 0.6291 0.3170 0.000 0.468 0.532
#> GSM154262 1 0.0000 0.9981 1.000 0.000 0.000
#> GSM154263 1 0.0000 0.9981 1.000 0.000 0.000
#> GSM154264 1 0.0000 0.9981 1.000 0.000 0.000
#> GSM154277 3 0.6215 0.3130 0.000 0.428 0.572
#> GSM154278 2 0.5058 0.5656 0.000 0.756 0.244
#> GSM154279 2 0.3267 0.6889 0.000 0.884 0.116
#> GSM154292 2 0.0000 0.6838 0.000 1.000 0.000
#> GSM154293 2 0.0000 0.6838 0.000 1.000 0.000
#> GSM154294 3 0.6291 0.3170 0.000 0.468 0.532
#> GSM154307 2 0.0237 0.6839 0.000 0.996 0.004
#> GSM154308 2 0.0237 0.6839 0.000 0.996 0.004
#> GSM154309 2 0.0237 0.6839 0.000 0.996 0.004
#> GSM154265 1 0.0000 0.9981 1.000 0.000 0.000
#> GSM154266 1 0.0000 0.9981 1.000 0.000 0.000
#> GSM154267 1 0.0000 0.9981 1.000 0.000 0.000
#> GSM154280 2 0.6260 0.3035 0.000 0.552 0.448
#> GSM154281 2 0.6260 0.3035 0.000 0.552 0.448
#> GSM154282 2 0.6260 0.3035 0.000 0.552 0.448
#> GSM154295 2 0.6267 0.3018 0.000 0.548 0.452
#> GSM154296 2 0.6267 0.3018 0.000 0.548 0.452
#> GSM154297 2 0.6267 0.3018 0.000 0.548 0.452
#> GSM154310 2 0.6267 0.3018 0.000 0.548 0.452
#> GSM154311 2 0.6267 0.3018 0.000 0.548 0.452
#> GSM154312 2 0.6267 0.3018 0.000 0.548 0.452
#> GSM154268 1 0.0000 0.9981 1.000 0.000 0.000
#> GSM154269 1 0.0000 0.9981 1.000 0.000 0.000
#> GSM154270 1 0.0000 0.9981 1.000 0.000 0.000
#> GSM154283 2 0.3267 0.6889 0.000 0.884 0.116
#> GSM154284 2 0.3267 0.6889 0.000 0.884 0.116
#> GSM154285 2 0.3267 0.6889 0.000 0.884 0.116
#> GSM154298 2 0.1529 0.6916 0.000 0.960 0.040
#> GSM154299 2 0.1860 0.6922 0.000 0.948 0.052
#> GSM154300 2 0.0000 0.6838 0.000 1.000 0.000
#> GSM154313 2 0.0237 0.6839 0.000 0.996 0.004
#> GSM154314 2 0.0237 0.6839 0.000 0.996 0.004
#> GSM154315 3 0.6291 0.3170 0.000 0.468 0.532
#> GSM154271 1 0.0000 0.9981 1.000 0.000 0.000
#> GSM154272 1 0.0000 0.9981 1.000 0.000 0.000
#> GSM154273 1 0.0000 0.9981 1.000 0.000 0.000
#> GSM154286 3 0.8840 0.0210 0.116 0.428 0.456
#> GSM154287 3 0.8840 0.0210 0.116 0.428 0.456
#> GSM154288 3 0.4750 0.3485 0.000 0.216 0.784
#> GSM154301 3 0.8740 0.0139 0.108 0.432 0.460
#> GSM154302 3 0.8740 0.0139 0.108 0.432 0.460
#> GSM154303 3 0.4702 0.3481 0.000 0.212 0.788
#> GSM154316 3 0.8740 0.0139 0.108 0.432 0.460
#> GSM154317 3 0.8740 0.0139 0.108 0.432 0.460
#> GSM154318 3 0.8740 0.0139 0.108 0.432 0.460
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> GSM154259 1 0.2530 0.944 0.896 0.000 0.004 0.100
#> GSM154260 1 0.0937 0.956 0.976 0.000 0.012 0.012
#> GSM154261 1 0.0937 0.956 0.976 0.000 0.012 0.012
#> GSM154274 2 0.4888 0.727 0.000 0.740 0.224 0.036
#> GSM154275 2 0.5123 0.720 0.000 0.724 0.232 0.044
#> GSM154276 2 0.5123 0.720 0.000 0.724 0.232 0.044
#> GSM154289 2 0.2530 0.781 0.000 0.888 0.000 0.112
#> GSM154290 2 0.2589 0.780 0.000 0.884 0.000 0.116
#> GSM154291 4 0.3402 0.841 0.000 0.164 0.004 0.832
#> GSM154304 2 0.2714 0.780 0.000 0.884 0.004 0.112
#> GSM154305 2 0.2589 0.777 0.000 0.884 0.000 0.116
#> GSM154306 4 0.3402 0.841 0.000 0.164 0.004 0.832
#> GSM154262 1 0.2149 0.949 0.912 0.000 0.000 0.088
#> GSM154263 1 0.0000 0.964 1.000 0.000 0.000 0.000
#> GSM154264 1 0.0000 0.964 1.000 0.000 0.000 0.000
#> GSM154277 4 0.5664 0.768 0.000 0.228 0.076 0.696
#> GSM154278 2 0.4343 0.715 0.000 0.732 0.264 0.004
#> GSM154279 2 0.4328 0.732 0.000 0.748 0.244 0.008
#> GSM154292 2 0.2089 0.811 0.000 0.932 0.020 0.048
#> GSM154293 2 0.2089 0.811 0.000 0.932 0.020 0.048
#> GSM154294 4 0.3870 0.831 0.000 0.208 0.004 0.788
#> GSM154307 2 0.2596 0.806 0.000 0.908 0.024 0.068
#> GSM154308 2 0.2596 0.806 0.000 0.908 0.024 0.068
#> GSM154309 2 0.2596 0.806 0.000 0.908 0.024 0.068
#> GSM154265 1 0.2149 0.949 0.912 0.000 0.000 0.088
#> GSM154266 1 0.0000 0.964 1.000 0.000 0.000 0.000
#> GSM154267 1 0.0000 0.964 1.000 0.000 0.000 0.000
#> GSM154280 3 0.2466 0.902 0.000 0.096 0.900 0.004
#> GSM154281 3 0.2466 0.902 0.000 0.096 0.900 0.004
#> GSM154282 3 0.2466 0.902 0.000 0.096 0.900 0.004
#> GSM154295 3 0.1716 0.930 0.000 0.064 0.936 0.000
#> GSM154296 3 0.1637 0.928 0.000 0.060 0.940 0.000
#> GSM154297 3 0.1637 0.928 0.000 0.060 0.940 0.000
#> GSM154310 3 0.1792 0.930 0.000 0.068 0.932 0.000
#> GSM154311 3 0.1792 0.930 0.000 0.068 0.932 0.000
#> GSM154312 3 0.1792 0.930 0.000 0.068 0.932 0.000
#> GSM154268 1 0.0000 0.964 1.000 0.000 0.000 0.000
#> GSM154269 1 0.2149 0.949 0.912 0.000 0.000 0.088
#> GSM154270 1 0.0000 0.964 1.000 0.000 0.000 0.000
#> GSM154283 2 0.4328 0.732 0.000 0.748 0.244 0.008
#> GSM154284 2 0.4453 0.731 0.000 0.744 0.244 0.012
#> GSM154285 2 0.4453 0.731 0.000 0.744 0.244 0.012
#> GSM154298 2 0.2892 0.811 0.000 0.896 0.068 0.036
#> GSM154299 2 0.2342 0.798 0.000 0.912 0.080 0.008
#> GSM154300 2 0.1004 0.804 0.000 0.972 0.024 0.004
#> GSM154313 2 0.2670 0.806 0.000 0.904 0.024 0.072
#> GSM154314 2 0.2670 0.806 0.000 0.904 0.024 0.072
#> GSM154315 4 0.3626 0.840 0.000 0.184 0.004 0.812
#> GSM154271 1 0.2149 0.949 0.912 0.000 0.000 0.088
#> GSM154272 1 0.2149 0.949 0.912 0.000 0.000 0.088
#> GSM154273 1 0.0000 0.964 1.000 0.000 0.000 0.000
#> GSM154286 3 0.3166 0.916 0.024 0.024 0.896 0.056
#> GSM154287 3 0.3166 0.919 0.024 0.024 0.896 0.056
#> GSM154288 4 0.4831 0.723 0.000 0.040 0.208 0.752
#> GSM154301 3 0.3268 0.919 0.024 0.028 0.892 0.056
#> GSM154302 3 0.3268 0.919 0.024 0.028 0.892 0.056
#> GSM154303 4 0.4764 0.705 0.000 0.032 0.220 0.748
#> GSM154316 3 0.3268 0.919 0.024 0.028 0.892 0.056
#> GSM154317 3 0.3268 0.919 0.024 0.028 0.892 0.056
#> GSM154318 3 0.3268 0.919 0.024 0.028 0.892 0.056
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> GSM154259 1 0.4400 0.803 0.672 0.000 0.000 0.020 0.308
#> GSM154260 1 0.1768 0.849 0.924 0.000 0.000 0.004 0.072
#> GSM154261 1 0.1768 0.849 0.924 0.000 0.000 0.004 0.072
#> GSM154274 5 0.6168 0.789 0.000 0.352 0.064 0.036 0.548
#> GSM154275 5 0.6157 0.791 0.000 0.348 0.064 0.036 0.552
#> GSM154276 5 0.6157 0.791 0.000 0.348 0.064 0.036 0.552
#> GSM154289 2 0.4069 0.529 0.000 0.788 0.000 0.076 0.136
#> GSM154290 2 0.4537 0.494 0.000 0.740 0.000 0.076 0.184
#> GSM154291 4 0.2011 0.853 0.000 0.088 0.000 0.908 0.004
#> GSM154304 2 0.4422 0.538 0.000 0.788 0.020 0.076 0.116
#> GSM154305 2 0.4044 0.536 0.000 0.800 0.004 0.076 0.120
#> GSM154306 4 0.2068 0.854 0.000 0.092 0.000 0.904 0.004
#> GSM154262 1 0.4347 0.822 0.716 0.000 0.004 0.024 0.256
#> GSM154263 1 0.0566 0.877 0.984 0.000 0.004 0.012 0.000
#> GSM154264 1 0.0451 0.877 0.988 0.000 0.004 0.008 0.000
#> GSM154277 4 0.5481 0.648 0.000 0.100 0.008 0.660 0.232
#> GSM154278 2 0.5731 -0.729 0.000 0.480 0.084 0.000 0.436
#> GSM154279 2 0.5734 -0.734 0.000 0.472 0.084 0.000 0.444
#> GSM154292 2 0.2577 0.592 0.000 0.892 0.016 0.008 0.084
#> GSM154293 2 0.2577 0.592 0.000 0.892 0.016 0.008 0.084
#> GSM154294 4 0.2929 0.830 0.000 0.180 0.000 0.820 0.000
#> GSM154307 2 0.2170 0.635 0.000 0.924 0.036 0.020 0.020
#> GSM154308 2 0.2170 0.635 0.000 0.924 0.036 0.020 0.020
#> GSM154309 2 0.2170 0.635 0.000 0.924 0.036 0.020 0.020
#> GSM154265 1 0.4132 0.821 0.720 0.000 0.000 0.020 0.260
#> GSM154266 1 0.0290 0.877 0.992 0.000 0.000 0.008 0.000
#> GSM154267 1 0.0162 0.877 0.996 0.000 0.000 0.004 0.000
#> GSM154280 3 0.4919 0.554 0.000 0.040 0.652 0.004 0.304
#> GSM154281 3 0.4919 0.554 0.000 0.040 0.652 0.004 0.304
#> GSM154282 3 0.4919 0.554 0.000 0.040 0.652 0.004 0.304
#> GSM154295 3 0.1697 0.866 0.000 0.060 0.932 0.000 0.008
#> GSM154296 3 0.1857 0.865 0.000 0.060 0.928 0.004 0.008
#> GSM154297 3 0.1857 0.865 0.000 0.060 0.928 0.004 0.008
#> GSM154310 3 0.1697 0.866 0.000 0.060 0.932 0.000 0.008
#> GSM154311 3 0.1697 0.866 0.000 0.060 0.932 0.000 0.008
#> GSM154312 3 0.1697 0.866 0.000 0.060 0.932 0.000 0.008
#> GSM154268 1 0.0162 0.878 0.996 0.000 0.000 0.004 0.000
#> GSM154269 1 0.4040 0.822 0.724 0.000 0.000 0.016 0.260
#> GSM154270 1 0.0000 0.877 1.000 0.000 0.000 0.000 0.000
#> GSM154283 2 0.5837 -0.719 0.000 0.464 0.080 0.004 0.452
#> GSM154284 5 0.5879 0.660 0.000 0.448 0.084 0.004 0.464
#> GSM154285 5 0.5879 0.660 0.000 0.448 0.084 0.004 0.464
#> GSM154298 2 0.2838 0.591 0.000 0.884 0.036 0.008 0.072
#> GSM154299 2 0.3806 0.462 0.000 0.796 0.024 0.008 0.172
#> GSM154300 2 0.3631 0.442 0.000 0.788 0.008 0.008 0.196
#> GSM154313 2 0.2263 0.625 0.000 0.920 0.036 0.020 0.024
#> GSM154314 2 0.2263 0.625 0.000 0.920 0.036 0.020 0.024
#> GSM154315 4 0.2329 0.853 0.000 0.124 0.000 0.876 0.000
#> GSM154271 1 0.4040 0.822 0.724 0.000 0.000 0.016 0.260
#> GSM154272 1 0.4040 0.822 0.724 0.000 0.000 0.016 0.260
#> GSM154273 1 0.0000 0.877 1.000 0.000 0.000 0.000 0.000
#> GSM154286 3 0.2551 0.853 0.000 0.012 0.904 0.040 0.044
#> GSM154287 3 0.2308 0.852 0.000 0.004 0.912 0.036 0.048
#> GSM154288 4 0.3707 0.803 0.000 0.008 0.108 0.828 0.056
#> GSM154301 3 0.2078 0.858 0.000 0.004 0.924 0.036 0.036
#> GSM154302 3 0.1822 0.864 0.000 0.004 0.936 0.036 0.024
#> GSM154303 4 0.3707 0.803 0.000 0.008 0.108 0.828 0.056
#> GSM154316 3 0.1822 0.864 0.000 0.004 0.936 0.036 0.024
#> GSM154317 3 0.1822 0.864 0.000 0.004 0.936 0.036 0.024
#> GSM154318 3 0.1822 0.864 0.000 0.004 0.936 0.036 0.024
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> GSM154259 1 0.4362 0.741 0.584 0.000 0.000 0.004 0.020 NA
#> GSM154260 1 0.3357 0.781 0.840 0.000 0.000 0.024 0.068 NA
#> GSM154261 1 0.3357 0.781 0.840 0.000 0.000 0.024 0.068 NA
#> GSM154274 5 0.5304 0.586 0.000 0.132 0.024 0.024 0.700 NA
#> GSM154275 5 0.5186 0.591 0.000 0.128 0.024 0.024 0.712 NA
#> GSM154276 5 0.5144 0.592 0.000 0.128 0.024 0.024 0.716 NA
#> GSM154289 2 0.5537 0.651 0.000 0.652 0.000 0.056 0.108 NA
#> GSM154290 2 0.5989 0.622 0.000 0.600 0.000 0.056 0.164 NA
#> GSM154291 4 0.1897 0.825 0.000 0.084 0.000 0.908 0.004 NA
#> GSM154304 2 0.5038 0.683 0.000 0.716 0.004 0.064 0.068 NA
#> GSM154305 2 0.5055 0.678 0.000 0.704 0.000 0.064 0.072 NA
#> GSM154306 4 0.1806 0.825 0.000 0.088 0.000 0.908 0.004 NA
#> GSM154262 1 0.3659 0.767 0.636 0.000 0.000 0.000 0.000 NA
#> GSM154263 1 0.0696 0.832 0.980 0.004 0.000 0.004 0.008 NA
#> GSM154264 1 0.0291 0.832 0.992 0.000 0.000 0.004 0.000 NA
#> GSM154277 4 0.5772 0.454 0.000 0.052 0.000 0.544 0.336 NA
#> GSM154278 5 0.4211 0.650 0.000 0.224 0.028 0.004 0.728 NA
#> GSM154279 5 0.3919 0.653 0.000 0.224 0.028 0.004 0.740 NA
#> GSM154292 2 0.2952 0.743 0.000 0.848 0.008 0.008 0.124 NA
#> GSM154293 2 0.2952 0.743 0.000 0.848 0.008 0.008 0.124 NA
#> GSM154294 4 0.2932 0.788 0.000 0.164 0.000 0.820 0.016 NA
#> GSM154307 2 0.1078 0.777 0.000 0.964 0.012 0.016 0.000 NA
#> GSM154308 2 0.1078 0.777 0.000 0.964 0.012 0.016 0.000 NA
#> GSM154309 2 0.1078 0.777 0.000 0.964 0.012 0.016 0.000 NA
#> GSM154265 1 0.3659 0.767 0.636 0.000 0.000 0.000 0.000 NA
#> GSM154266 1 0.0551 0.832 0.984 0.004 0.000 0.000 0.008 NA
#> GSM154267 1 0.0291 0.832 0.992 0.000 0.000 0.000 0.004 NA
#> GSM154280 5 0.5974 0.217 0.000 0.020 0.344 0.004 0.508 NA
#> GSM154281 5 0.5942 0.218 0.000 0.020 0.344 0.004 0.512 NA
#> GSM154282 5 0.5942 0.218 0.000 0.020 0.344 0.004 0.512 NA
#> GSM154295 3 0.5158 0.797 0.000 0.056 0.708 0.012 0.060 NA
#> GSM154296 3 0.5299 0.780 0.000 0.048 0.688 0.008 0.080 NA
#> GSM154297 3 0.5299 0.780 0.000 0.048 0.688 0.008 0.080 NA
#> GSM154310 3 0.5158 0.797 0.000 0.056 0.708 0.012 0.060 NA
#> GSM154311 3 0.5158 0.797 0.000 0.056 0.708 0.012 0.060 NA
#> GSM154312 3 0.5158 0.797 0.000 0.056 0.708 0.012 0.060 NA
#> GSM154268 1 0.0405 0.832 0.988 0.004 0.000 0.000 0.008 NA
#> GSM154269 1 0.3647 0.768 0.640 0.000 0.000 0.000 0.000 NA
#> GSM154270 1 0.0000 0.832 1.000 0.000 0.000 0.000 0.000 NA
#> GSM154283 5 0.4762 0.604 0.000 0.220 0.024 0.000 0.692 NA
#> GSM154284 5 0.4125 0.647 0.000 0.208 0.028 0.000 0.740 NA
#> GSM154285 5 0.4125 0.647 0.000 0.208 0.028 0.000 0.740 NA
#> GSM154298 2 0.3592 0.722 0.000 0.808 0.008 0.000 0.116 NA
#> GSM154299 2 0.4749 0.552 0.000 0.656 0.008 0.000 0.268 NA
#> GSM154300 2 0.5207 0.534 0.000 0.592 0.000 0.000 0.276 NA
#> GSM154313 2 0.2137 0.766 0.000 0.912 0.012 0.000 0.028 NA
#> GSM154314 2 0.2137 0.766 0.000 0.912 0.012 0.000 0.028 NA
#> GSM154315 4 0.2003 0.822 0.000 0.116 0.000 0.884 0.000 NA
#> GSM154271 1 0.3647 0.768 0.640 0.000 0.000 0.000 0.000 NA
#> GSM154272 1 0.3647 0.768 0.640 0.000 0.000 0.000 0.000 NA
#> GSM154273 1 0.0000 0.832 1.000 0.000 0.000 0.000 0.000 NA
#> GSM154286 3 0.0837 0.825 0.000 0.004 0.972 0.000 0.004 NA
#> GSM154287 3 0.0291 0.834 0.000 0.000 0.992 0.000 0.004 NA
#> GSM154288 4 0.4212 0.769 0.000 0.000 0.108 0.772 0.024 NA
#> GSM154301 3 0.0000 0.838 0.000 0.000 1.000 0.000 0.000 NA
#> GSM154302 3 0.0000 0.838 0.000 0.000 1.000 0.000 0.000 NA
#> GSM154303 4 0.4339 0.764 0.000 0.000 0.120 0.760 0.024 NA
#> GSM154316 3 0.0000 0.838 0.000 0.000 1.000 0.000 0.000 NA
#> GSM154317 3 0.0000 0.838 0.000 0.000 1.000 0.000 0.000 NA
#> GSM154318 3 0.0000 0.838 0.000 0.000 1.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 agent(p) time(p) k
#> SD:kmeans 7 NA NA 2
#> SD:kmeans 37 0.032453 4.60e-08 3
#> SD:kmeans 60 0.000037 9.96e-10 4
#> SD:kmeans 54 0.000408 1.15e-11 5
#> SD:kmeans 56 0.001692 5.56e-15 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 38950 rows and 60 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.733 0.858 0.937 0.4952 0.512 0.512
#> 3 3 1.000 0.957 0.978 0.3107 0.723 0.516
#> 4 4 0.783 0.861 0.892 0.1270 0.913 0.756
#> 5 5 0.824 0.876 0.902 0.0908 0.903 0.657
#> 6 6 0.854 0.833 0.883 0.0393 0.944 0.737
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
#> GSM154259 1 0.000 0.961 1.000 0.000
#> GSM154260 1 0.000 0.961 1.000 0.000
#> GSM154261 1 0.000 0.961 1.000 0.000
#> GSM154274 2 0.000 0.905 0.000 1.000
#> GSM154275 2 0.000 0.905 0.000 1.000
#> GSM154276 2 0.000 0.905 0.000 1.000
#> GSM154289 2 0.000 0.905 0.000 1.000
#> GSM154290 2 0.000 0.905 0.000 1.000
#> GSM154291 2 0.000 0.905 0.000 1.000
#> GSM154304 2 0.000 0.905 0.000 1.000
#> GSM154305 2 0.000 0.905 0.000 1.000
#> GSM154306 2 0.000 0.905 0.000 1.000
#> GSM154262 1 0.000 0.961 1.000 0.000
#> GSM154263 1 0.000 0.961 1.000 0.000
#> GSM154264 1 0.000 0.961 1.000 0.000
#> GSM154277 2 0.000 0.905 0.000 1.000
#> GSM154278 2 0.000 0.905 0.000 1.000
#> GSM154279 2 0.000 0.905 0.000 1.000
#> GSM154292 2 0.000 0.905 0.000 1.000
#> GSM154293 2 0.000 0.905 0.000 1.000
#> GSM154294 2 0.000 0.905 0.000 1.000
#> GSM154307 2 0.000 0.905 0.000 1.000
#> GSM154308 2 0.000 0.905 0.000 1.000
#> GSM154309 2 0.000 0.905 0.000 1.000
#> GSM154265 1 0.000 0.961 1.000 0.000
#> GSM154266 1 0.000 0.961 1.000 0.000
#> GSM154267 1 0.000 0.961 1.000 0.000
#> GSM154280 2 0.969 0.473 0.396 0.604
#> GSM154281 2 0.969 0.473 0.396 0.604
#> GSM154282 2 0.969 0.473 0.396 0.604
#> GSM154295 2 0.886 0.635 0.304 0.696
#> GSM154296 2 0.886 0.635 0.304 0.696
#> GSM154297 2 0.881 0.640 0.300 0.700
#> GSM154310 2 0.886 0.635 0.304 0.696
#> GSM154311 2 0.886 0.635 0.304 0.696
#> GSM154312 2 0.886 0.635 0.304 0.696
#> GSM154268 1 0.000 0.961 1.000 0.000
#> GSM154269 1 0.000 0.961 1.000 0.000
#> GSM154270 1 0.000 0.961 1.000 0.000
#> GSM154283 2 0.000 0.905 0.000 1.000
#> GSM154284 2 0.000 0.905 0.000 1.000
#> GSM154285 2 0.000 0.905 0.000 1.000
#> GSM154298 2 0.000 0.905 0.000 1.000
#> GSM154299 2 0.000 0.905 0.000 1.000
#> GSM154300 2 0.000 0.905 0.000 1.000
#> GSM154313 2 0.000 0.905 0.000 1.000
#> GSM154314 2 0.000 0.905 0.000 1.000
#> GSM154315 2 0.000 0.905 0.000 1.000
#> GSM154271 1 0.000 0.961 1.000 0.000
#> GSM154272 1 0.000 0.961 1.000 0.000
#> GSM154273 1 0.000 0.961 1.000 0.000
#> GSM154286 1 0.000 0.961 1.000 0.000
#> GSM154287 1 0.000 0.961 1.000 0.000
#> GSM154288 1 0.971 0.348 0.600 0.400
#> GSM154301 1 0.000 0.961 1.000 0.000
#> GSM154302 1 0.000 0.961 1.000 0.000
#> GSM154303 1 0.971 0.348 0.600 0.400
#> GSM154316 1 0.000 0.961 1.000 0.000
#> GSM154317 1 0.000 0.961 1.000 0.000
#> GSM154318 1 0.000 0.961 1.000 0.000
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> GSM154259 1 0.0000 0.990 1.000 0.000 0.000
#> GSM154260 1 0.0000 0.990 1.000 0.000 0.000
#> GSM154261 1 0.0000 0.990 1.000 0.000 0.000
#> GSM154274 2 0.1163 0.960 0.000 0.972 0.028
#> GSM154275 2 0.0592 0.965 0.000 0.988 0.012
#> GSM154276 2 0.0592 0.965 0.000 0.988 0.012
#> GSM154289 2 0.0000 0.967 0.000 1.000 0.000
#> GSM154290 2 0.0000 0.967 0.000 1.000 0.000
#> GSM154291 2 0.0237 0.966 0.000 0.996 0.004
#> GSM154304 2 0.0000 0.967 0.000 1.000 0.000
#> GSM154305 2 0.0237 0.966 0.000 0.996 0.004
#> GSM154306 2 0.0237 0.966 0.000 0.996 0.004
#> GSM154262 1 0.0000 0.990 1.000 0.000 0.000
#> GSM154263 1 0.0000 0.990 1.000 0.000 0.000
#> GSM154264 1 0.0000 0.990 1.000 0.000 0.000
#> GSM154277 2 0.0424 0.966 0.000 0.992 0.008
#> GSM154278 2 0.1163 0.960 0.000 0.972 0.028
#> GSM154279 2 0.1163 0.960 0.000 0.972 0.028
#> GSM154292 2 0.0000 0.967 0.000 1.000 0.000
#> GSM154293 2 0.0000 0.967 0.000 1.000 0.000
#> GSM154294 2 0.0237 0.966 0.000 0.996 0.004
#> GSM154307 2 0.0237 0.967 0.000 0.996 0.004
#> GSM154308 2 0.0000 0.967 0.000 1.000 0.000
#> GSM154309 2 0.0237 0.967 0.000 0.996 0.004
#> GSM154265 1 0.0000 0.990 1.000 0.000 0.000
#> GSM154266 1 0.0000 0.990 1.000 0.000 0.000
#> GSM154267 1 0.0000 0.990 1.000 0.000 0.000
#> GSM154280 3 0.0237 0.983 0.000 0.004 0.996
#> GSM154281 3 0.0237 0.983 0.000 0.004 0.996
#> GSM154282 3 0.0237 0.983 0.000 0.004 0.996
#> GSM154295 3 0.0237 0.983 0.000 0.004 0.996
#> GSM154296 3 0.0237 0.983 0.000 0.004 0.996
#> GSM154297 3 0.0237 0.983 0.000 0.004 0.996
#> GSM154310 3 0.0424 0.982 0.000 0.008 0.992
#> GSM154311 3 0.0424 0.982 0.000 0.008 0.992
#> GSM154312 3 0.0424 0.982 0.000 0.008 0.992
#> GSM154268 1 0.0000 0.990 1.000 0.000 0.000
#> GSM154269 1 0.0000 0.990 1.000 0.000 0.000
#> GSM154270 1 0.0000 0.990 1.000 0.000 0.000
#> GSM154283 2 0.1163 0.960 0.000 0.972 0.028
#> GSM154284 2 0.1163 0.960 0.000 0.972 0.028
#> GSM154285 2 0.1163 0.960 0.000 0.972 0.028
#> GSM154298 2 0.0747 0.964 0.000 0.984 0.016
#> GSM154299 2 0.0892 0.963 0.000 0.980 0.020
#> GSM154300 2 0.0237 0.967 0.000 0.996 0.004
#> GSM154313 2 0.0237 0.967 0.000 0.996 0.004
#> GSM154314 2 0.0237 0.967 0.000 0.996 0.004
#> GSM154315 2 0.0237 0.966 0.000 0.996 0.004
#> GSM154271 1 0.0000 0.990 1.000 0.000 0.000
#> GSM154272 1 0.0000 0.990 1.000 0.000 0.000
#> GSM154273 1 0.0000 0.990 1.000 0.000 0.000
#> GSM154286 1 0.3686 0.830 0.860 0.000 0.140
#> GSM154287 3 0.1643 0.966 0.044 0.000 0.956
#> GSM154288 2 0.5553 0.624 0.272 0.724 0.004
#> GSM154301 3 0.1289 0.975 0.032 0.000 0.968
#> GSM154302 3 0.1289 0.975 0.032 0.000 0.968
#> GSM154303 2 0.6095 0.363 0.000 0.608 0.392
#> GSM154316 3 0.1289 0.975 0.032 0.000 0.968
#> GSM154317 3 0.1289 0.975 0.032 0.000 0.968
#> GSM154318 3 0.1289 0.975 0.032 0.000 0.968
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> GSM154259 1 0.0000 0.988 1.000 0.000 0.000 0.000
#> GSM154260 1 0.0000 0.988 1.000 0.000 0.000 0.000
#> GSM154261 1 0.0000 0.988 1.000 0.000 0.000 0.000
#> GSM154274 2 0.4088 0.773 0.000 0.764 0.004 0.232
#> GSM154275 2 0.4155 0.769 0.000 0.756 0.004 0.240
#> GSM154276 2 0.4122 0.772 0.000 0.760 0.004 0.236
#> GSM154289 2 0.0000 0.850 0.000 1.000 0.000 0.000
#> GSM154290 2 0.0000 0.850 0.000 1.000 0.000 0.000
#> GSM154291 4 0.4817 0.843 0.000 0.388 0.000 0.612
#> GSM154304 2 0.0336 0.848 0.000 0.992 0.008 0.000
#> GSM154305 2 0.0469 0.842 0.000 0.988 0.000 0.012
#> GSM154306 4 0.4817 0.843 0.000 0.388 0.000 0.612
#> GSM154262 1 0.0000 0.988 1.000 0.000 0.000 0.000
#> GSM154263 1 0.0000 0.988 1.000 0.000 0.000 0.000
#> GSM154264 1 0.0000 0.988 1.000 0.000 0.000 0.000
#> GSM154277 4 0.4164 0.748 0.000 0.264 0.000 0.736
#> GSM154278 2 0.4088 0.773 0.000 0.764 0.004 0.232
#> GSM154279 2 0.4122 0.772 0.000 0.760 0.004 0.236
#> GSM154292 2 0.0000 0.850 0.000 1.000 0.000 0.000
#> GSM154293 2 0.0336 0.845 0.000 0.992 0.000 0.008
#> GSM154294 4 0.4817 0.843 0.000 0.388 0.000 0.612
#> GSM154307 2 0.0336 0.848 0.000 0.992 0.008 0.000
#> GSM154308 2 0.0336 0.848 0.000 0.992 0.008 0.000
#> GSM154309 2 0.0336 0.848 0.000 0.992 0.008 0.000
#> GSM154265 1 0.0000 0.988 1.000 0.000 0.000 0.000
#> GSM154266 1 0.0000 0.988 1.000 0.000 0.000 0.000
#> GSM154267 1 0.0000 0.988 1.000 0.000 0.000 0.000
#> GSM154280 3 0.4228 0.708 0.000 0.008 0.760 0.232
#> GSM154281 3 0.4228 0.708 0.000 0.008 0.760 0.232
#> GSM154282 3 0.4228 0.708 0.000 0.008 0.760 0.232
#> GSM154295 3 0.0188 0.872 0.000 0.004 0.996 0.000
#> GSM154296 3 0.0188 0.872 0.000 0.004 0.996 0.000
#> GSM154297 3 0.0188 0.872 0.000 0.004 0.996 0.000
#> GSM154310 3 0.0188 0.872 0.000 0.004 0.996 0.000
#> GSM154311 3 0.0188 0.872 0.000 0.004 0.996 0.000
#> GSM154312 3 0.0188 0.872 0.000 0.004 0.996 0.000
#> GSM154268 1 0.0000 0.988 1.000 0.000 0.000 0.000
#> GSM154269 1 0.0000 0.988 1.000 0.000 0.000 0.000
#> GSM154270 1 0.0000 0.988 1.000 0.000 0.000 0.000
#> GSM154283 2 0.4088 0.773 0.000 0.764 0.004 0.232
#> GSM154284 2 0.4122 0.772 0.000 0.760 0.004 0.236
#> GSM154285 2 0.4122 0.772 0.000 0.760 0.004 0.236
#> GSM154298 2 0.0000 0.850 0.000 1.000 0.000 0.000
#> GSM154299 2 0.1940 0.833 0.000 0.924 0.000 0.076
#> GSM154300 2 0.0817 0.847 0.000 0.976 0.000 0.024
#> GSM154313 2 0.0336 0.848 0.000 0.992 0.008 0.000
#> GSM154314 2 0.0336 0.848 0.000 0.992 0.008 0.000
#> GSM154315 4 0.4817 0.843 0.000 0.388 0.000 0.612
#> GSM154271 1 0.0000 0.988 1.000 0.000 0.000 0.000
#> GSM154272 1 0.0000 0.988 1.000 0.000 0.000 0.000
#> GSM154273 1 0.0000 0.988 1.000 0.000 0.000 0.000
#> GSM154286 1 0.3806 0.796 0.824 0.000 0.020 0.156
#> GSM154287 3 0.3577 0.849 0.012 0.000 0.832 0.156
#> GSM154288 4 0.4761 0.738 0.048 0.184 0.000 0.768
#> GSM154301 3 0.3306 0.854 0.004 0.000 0.840 0.156
#> GSM154302 3 0.3306 0.854 0.004 0.000 0.840 0.156
#> GSM154303 4 0.5042 0.658 0.000 0.136 0.096 0.768
#> GSM154316 3 0.3306 0.854 0.004 0.000 0.840 0.156
#> GSM154317 3 0.3306 0.854 0.004 0.000 0.840 0.156
#> GSM154318 3 0.3306 0.854 0.004 0.000 0.840 0.156
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> GSM154259 1 0.0000 0.981 1.000 0.000 0.000 0.000 0.000
#> GSM154260 1 0.0000 0.981 1.000 0.000 0.000 0.000 0.000
#> GSM154261 1 0.0000 0.981 1.000 0.000 0.000 0.000 0.000
#> GSM154274 5 0.2017 0.826 0.000 0.080 0.000 0.008 0.912
#> GSM154275 5 0.2017 0.826 0.000 0.080 0.000 0.008 0.912
#> GSM154276 5 0.2017 0.826 0.000 0.080 0.000 0.008 0.912
#> GSM154289 2 0.2193 0.880 0.000 0.900 0.000 0.008 0.092
#> GSM154290 2 0.2193 0.880 0.000 0.900 0.000 0.008 0.092
#> GSM154291 4 0.3950 0.845 0.000 0.136 0.000 0.796 0.068
#> GSM154304 2 0.2136 0.880 0.000 0.904 0.000 0.008 0.088
#> GSM154305 2 0.2136 0.880 0.000 0.904 0.000 0.008 0.088
#> GSM154306 4 0.3950 0.845 0.000 0.136 0.000 0.796 0.068
#> GSM154262 1 0.0000 0.981 1.000 0.000 0.000 0.000 0.000
#> GSM154263 1 0.0000 0.981 1.000 0.000 0.000 0.000 0.000
#> GSM154264 1 0.0000 0.981 1.000 0.000 0.000 0.000 0.000
#> GSM154277 4 0.4069 0.768 0.000 0.076 0.000 0.788 0.136
#> GSM154278 5 0.2690 0.847 0.000 0.156 0.000 0.000 0.844
#> GSM154279 5 0.2648 0.849 0.000 0.152 0.000 0.000 0.848
#> GSM154292 2 0.0451 0.927 0.000 0.988 0.000 0.004 0.008
#> GSM154293 2 0.0451 0.927 0.000 0.988 0.000 0.004 0.008
#> GSM154294 4 0.3421 0.841 0.000 0.204 0.000 0.788 0.008
#> GSM154307 2 0.0162 0.928 0.000 0.996 0.000 0.004 0.000
#> GSM154308 2 0.0162 0.928 0.000 0.996 0.000 0.004 0.000
#> GSM154309 2 0.0162 0.928 0.000 0.996 0.000 0.004 0.000
#> GSM154265 1 0.0000 0.981 1.000 0.000 0.000 0.000 0.000
#> GSM154266 1 0.0000 0.981 1.000 0.000 0.000 0.000 0.000
#> GSM154267 1 0.0000 0.981 1.000 0.000 0.000 0.000 0.000
#> GSM154280 5 0.3730 0.713 0.000 0.000 0.288 0.000 0.712
#> GSM154281 5 0.3730 0.713 0.000 0.000 0.288 0.000 0.712
#> GSM154282 5 0.3730 0.713 0.000 0.000 0.288 0.000 0.712
#> GSM154295 3 0.0162 0.840 0.000 0.004 0.996 0.000 0.000
#> GSM154296 3 0.0324 0.837 0.000 0.004 0.992 0.000 0.004
#> GSM154297 3 0.0324 0.837 0.000 0.004 0.992 0.000 0.004
#> GSM154310 3 0.0162 0.840 0.000 0.004 0.996 0.000 0.000
#> GSM154311 3 0.0162 0.840 0.000 0.004 0.996 0.000 0.000
#> GSM154312 3 0.0162 0.840 0.000 0.004 0.996 0.000 0.000
#> GSM154268 1 0.0000 0.981 1.000 0.000 0.000 0.000 0.000
#> GSM154269 1 0.0000 0.981 1.000 0.000 0.000 0.000 0.000
#> GSM154270 1 0.0000 0.981 1.000 0.000 0.000 0.000 0.000
#> GSM154283 5 0.2690 0.847 0.000 0.156 0.000 0.000 0.844
#> GSM154284 5 0.2648 0.849 0.000 0.152 0.000 0.000 0.848
#> GSM154285 5 0.2648 0.849 0.000 0.152 0.000 0.000 0.848
#> GSM154298 2 0.0703 0.923 0.000 0.976 0.000 0.000 0.024
#> GSM154299 2 0.2516 0.820 0.000 0.860 0.000 0.000 0.140
#> GSM154300 2 0.2629 0.823 0.000 0.860 0.000 0.004 0.136
#> GSM154313 2 0.0566 0.927 0.000 0.984 0.000 0.004 0.012
#> GSM154314 2 0.0566 0.927 0.000 0.984 0.000 0.004 0.012
#> GSM154315 4 0.3421 0.841 0.000 0.204 0.000 0.788 0.008
#> GSM154271 1 0.0000 0.981 1.000 0.000 0.000 0.000 0.000
#> GSM154272 1 0.0000 0.981 1.000 0.000 0.000 0.000 0.000
#> GSM154273 1 0.0000 0.981 1.000 0.000 0.000 0.000 0.000
#> GSM154286 1 0.4801 0.648 0.724 0.000 0.008 0.204 0.064
#> GSM154287 3 0.4527 0.834 0.000 0.000 0.732 0.204 0.064
#> GSM154288 4 0.0613 0.782 0.004 0.008 0.004 0.984 0.000
#> GSM154301 3 0.4527 0.834 0.000 0.000 0.732 0.204 0.064
#> GSM154302 3 0.4527 0.834 0.000 0.000 0.732 0.204 0.064
#> GSM154303 4 0.0579 0.780 0.000 0.008 0.008 0.984 0.000
#> GSM154316 3 0.4527 0.834 0.000 0.000 0.732 0.204 0.064
#> GSM154317 3 0.4527 0.834 0.000 0.000 0.732 0.204 0.064
#> GSM154318 3 0.4527 0.834 0.000 0.000 0.732 0.204 0.064
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> GSM154259 1 0.0547 0.988 0.980 0.000 0.020 0.000 0.000 0.000
#> GSM154260 1 0.0000 0.992 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM154261 1 0.0000 0.992 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM154274 5 0.4830 0.678 0.000 0.004 0.000 0.176 0.680 0.140
#> GSM154275 5 0.4865 0.677 0.000 0.004 0.000 0.176 0.676 0.144
#> GSM154276 5 0.4830 0.678 0.000 0.004 0.000 0.176 0.680 0.140
#> GSM154289 2 0.5934 0.626 0.000 0.620 0.000 0.168 0.076 0.136
#> GSM154290 2 0.5963 0.622 0.000 0.616 0.000 0.172 0.076 0.136
#> GSM154291 4 0.0937 0.814 0.000 0.040 0.000 0.960 0.000 0.000
#> GSM154304 2 0.4876 0.718 0.000 0.724 0.000 0.140 0.076 0.060
#> GSM154305 2 0.4876 0.718 0.000 0.724 0.000 0.140 0.076 0.060
#> GSM154306 4 0.1204 0.821 0.000 0.056 0.000 0.944 0.000 0.000
#> GSM154262 1 0.0547 0.988 0.980 0.000 0.020 0.000 0.000 0.000
#> GSM154263 1 0.0000 0.992 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM154264 1 0.0000 0.992 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM154277 4 0.2877 0.763 0.000 0.012 0.000 0.820 0.168 0.000
#> GSM154278 5 0.2163 0.788 0.000 0.096 0.000 0.008 0.892 0.004
#> GSM154279 5 0.2122 0.787 0.000 0.084 0.000 0.008 0.900 0.008
#> GSM154292 2 0.0146 0.854 0.000 0.996 0.000 0.004 0.000 0.000
#> GSM154293 2 0.0146 0.854 0.000 0.996 0.000 0.004 0.000 0.000
#> GSM154294 4 0.2697 0.819 0.000 0.188 0.000 0.812 0.000 0.000
#> GSM154307 2 0.0000 0.855 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM154308 2 0.0000 0.855 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM154309 2 0.0000 0.855 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM154265 1 0.0547 0.988 0.980 0.000 0.020 0.000 0.000 0.000
#> GSM154266 1 0.0000 0.992 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM154267 1 0.0000 0.992 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM154280 6 0.3975 0.484 0.000 0.000 0.000 0.008 0.392 0.600
#> GSM154281 6 0.3984 0.484 0.000 0.000 0.000 0.008 0.396 0.596
#> GSM154282 6 0.3984 0.484 0.000 0.000 0.000 0.008 0.396 0.596
#> GSM154295 6 0.2848 0.791 0.000 0.008 0.176 0.000 0.000 0.816
#> GSM154296 6 0.2810 0.793 0.000 0.008 0.156 0.000 0.004 0.832
#> GSM154297 6 0.2810 0.793 0.000 0.008 0.156 0.000 0.004 0.832
#> GSM154310 6 0.2882 0.790 0.000 0.008 0.180 0.000 0.000 0.812
#> GSM154311 6 0.2882 0.790 0.000 0.008 0.180 0.000 0.000 0.812
#> GSM154312 6 0.2882 0.790 0.000 0.008 0.180 0.000 0.000 0.812
#> GSM154268 1 0.0000 0.992 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM154269 1 0.0547 0.988 0.980 0.000 0.020 0.000 0.000 0.000
#> GSM154270 1 0.0000 0.992 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM154283 5 0.2147 0.781 0.000 0.084 0.000 0.000 0.896 0.020
#> GSM154284 5 0.1895 0.787 0.000 0.072 0.000 0.000 0.912 0.016
#> GSM154285 5 0.2066 0.786 0.000 0.072 0.000 0.000 0.904 0.024
#> GSM154298 2 0.1657 0.835 0.000 0.928 0.000 0.000 0.056 0.016
#> GSM154299 2 0.2981 0.766 0.000 0.820 0.000 0.000 0.160 0.020
#> GSM154300 2 0.3139 0.762 0.000 0.812 0.000 0.000 0.160 0.028
#> GSM154313 2 0.0914 0.850 0.000 0.968 0.000 0.000 0.016 0.016
#> GSM154314 2 0.1003 0.849 0.000 0.964 0.000 0.000 0.020 0.016
#> GSM154315 4 0.2980 0.819 0.000 0.180 0.000 0.808 0.012 0.000
#> GSM154271 1 0.0547 0.988 0.980 0.000 0.020 0.000 0.000 0.000
#> GSM154272 1 0.0547 0.988 0.980 0.000 0.020 0.000 0.000 0.000
#> GSM154273 1 0.0000 0.992 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM154286 3 0.2902 0.678 0.196 0.000 0.800 0.000 0.000 0.004
#> GSM154287 3 0.0000 0.928 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM154288 4 0.2697 0.782 0.000 0.000 0.188 0.812 0.000 0.000
#> GSM154301 3 0.0547 0.942 0.000 0.000 0.980 0.000 0.000 0.020
#> GSM154302 3 0.0547 0.942 0.000 0.000 0.980 0.000 0.000 0.020
#> GSM154303 4 0.2697 0.782 0.000 0.000 0.188 0.812 0.000 0.000
#> GSM154316 3 0.0547 0.942 0.000 0.000 0.980 0.000 0.000 0.020
#> GSM154317 3 0.0547 0.942 0.000 0.000 0.980 0.000 0.000 0.020
#> GSM154318 3 0.0547 0.942 0.000 0.000 0.980 0.000 0.000 0.020
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 agent(p) time(p) k
#> SD:skmeans 55 9.67e-04 8.34e-07 2
#> SD:skmeans 59 3.63e-06 5.00e-10 3
#> SD:skmeans 60 4.28e-05 7.18e-09 4
#> SD:skmeans 60 6.96e-03 9.22e-16 5
#> SD:skmeans 57 4.44e-08 9.07e-14 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 38950 rows and 60 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 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.936 0.976 0.4048 0.587 0.587
#> 3 3 0.721 0.924 0.907 0.5436 0.729 0.551
#> 4 4 0.917 0.944 0.956 0.1487 0.923 0.782
#> 5 5 0.910 0.935 0.962 0.0654 0.964 0.872
#> 6 6 0.919 0.901 0.918 0.0788 0.937 0.740
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 4 5
There is also optional best \(k\) = 2 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
#> GSM154259 1 0.000 0.938 1.000 0.000
#> GSM154260 1 0.000 0.938 1.000 0.000
#> GSM154261 1 0.000 0.938 1.000 0.000
#> GSM154274 2 0.000 0.988 0.000 1.000
#> GSM154275 2 0.000 0.988 0.000 1.000
#> GSM154276 2 0.000 0.988 0.000 1.000
#> GSM154289 2 0.000 0.988 0.000 1.000
#> GSM154290 2 0.000 0.988 0.000 1.000
#> GSM154291 2 0.000 0.988 0.000 1.000
#> GSM154304 2 0.000 0.988 0.000 1.000
#> GSM154305 2 0.000 0.988 0.000 1.000
#> GSM154306 2 0.000 0.988 0.000 1.000
#> GSM154262 1 0.000 0.938 1.000 0.000
#> GSM154263 1 0.000 0.938 1.000 0.000
#> GSM154264 1 0.000 0.938 1.000 0.000
#> GSM154277 2 0.000 0.988 0.000 1.000
#> GSM154278 2 0.000 0.988 0.000 1.000
#> GSM154279 2 0.000 0.988 0.000 1.000
#> GSM154292 2 0.000 0.988 0.000 1.000
#> GSM154293 2 0.000 0.988 0.000 1.000
#> GSM154294 2 0.000 0.988 0.000 1.000
#> GSM154307 2 0.000 0.988 0.000 1.000
#> GSM154308 2 0.000 0.988 0.000 1.000
#> GSM154309 2 0.000 0.988 0.000 1.000
#> GSM154265 1 0.000 0.938 1.000 0.000
#> GSM154266 1 0.000 0.938 1.000 0.000
#> GSM154267 1 0.000 0.938 1.000 0.000
#> GSM154280 2 0.000 0.988 0.000 1.000
#> GSM154281 2 0.000 0.988 0.000 1.000
#> GSM154282 2 0.000 0.988 0.000 1.000
#> GSM154295 2 0.000 0.988 0.000 1.000
#> GSM154296 2 0.000 0.988 0.000 1.000
#> GSM154297 2 0.000 0.988 0.000 1.000
#> GSM154310 2 0.000 0.988 0.000 1.000
#> GSM154311 2 0.000 0.988 0.000 1.000
#> GSM154312 2 0.000 0.988 0.000 1.000
#> GSM154268 1 0.000 0.938 1.000 0.000
#> GSM154269 1 0.000 0.938 1.000 0.000
#> GSM154270 1 0.000 0.938 1.000 0.000
#> GSM154283 2 0.000 0.988 0.000 1.000
#> GSM154284 2 0.000 0.988 0.000 1.000
#> GSM154285 2 0.000 0.988 0.000 1.000
#> GSM154298 2 0.000 0.988 0.000 1.000
#> GSM154299 2 0.000 0.988 0.000 1.000
#> GSM154300 2 0.000 0.988 0.000 1.000
#> GSM154313 2 0.000 0.988 0.000 1.000
#> GSM154314 2 0.000 0.988 0.000 1.000
#> GSM154315 2 0.000 0.988 0.000 1.000
#> GSM154271 1 0.000 0.938 1.000 0.000
#> GSM154272 1 0.000 0.938 1.000 0.000
#> GSM154273 1 0.000 0.938 1.000 0.000
#> GSM154286 1 0.998 0.117 0.524 0.476
#> GSM154287 1 0.998 0.117 0.524 0.476
#> GSM154288 2 0.000 0.988 0.000 1.000
#> GSM154301 2 0.904 0.492 0.320 0.680
#> GSM154302 2 0.163 0.967 0.024 0.976
#> GSM154303 2 0.000 0.988 0.000 1.000
#> GSM154316 2 0.141 0.970 0.020 0.980
#> GSM154317 2 0.118 0.974 0.016 0.984
#> GSM154318 2 0.416 0.899 0.084 0.916
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> GSM154259 1 0.0000 1.000 1 0.000 0.000
#> GSM154260 1 0.0000 1.000 1 0.000 0.000
#> GSM154261 1 0.0000 1.000 1 0.000 0.000
#> GSM154274 2 0.4974 0.920 0 0.764 0.236
#> GSM154275 2 0.4974 0.920 0 0.764 0.236
#> GSM154276 2 0.4974 0.920 0 0.764 0.236
#> GSM154289 2 0.4974 0.920 0 0.764 0.236
#> GSM154290 2 0.4974 0.920 0 0.764 0.236
#> GSM154291 2 0.0000 0.738 0 1.000 0.000
#> GSM154304 2 0.4974 0.920 0 0.764 0.236
#> GSM154305 2 0.4887 0.914 0 0.772 0.228
#> GSM154306 2 0.0000 0.738 0 1.000 0.000
#> GSM154262 1 0.0000 1.000 1 0.000 0.000
#> GSM154263 1 0.0000 1.000 1 0.000 0.000
#> GSM154264 1 0.0000 1.000 1 0.000 0.000
#> GSM154277 2 0.0000 0.738 0 1.000 0.000
#> GSM154278 2 0.4974 0.920 0 0.764 0.236
#> GSM154279 2 0.4974 0.920 0 0.764 0.236
#> GSM154292 2 0.4974 0.920 0 0.764 0.236
#> GSM154293 2 0.4974 0.920 0 0.764 0.236
#> GSM154294 2 0.0000 0.738 0 1.000 0.000
#> GSM154307 2 0.4974 0.920 0 0.764 0.236
#> GSM154308 2 0.4974 0.920 0 0.764 0.236
#> GSM154309 2 0.4974 0.920 0 0.764 0.236
#> GSM154265 1 0.0000 1.000 1 0.000 0.000
#> GSM154266 1 0.0000 1.000 1 0.000 0.000
#> GSM154267 1 0.0000 1.000 1 0.000 0.000
#> GSM154280 3 0.0000 0.980 0 0.000 1.000
#> GSM154281 3 0.0000 0.980 0 0.000 1.000
#> GSM154282 3 0.0000 0.980 0 0.000 1.000
#> GSM154295 3 0.0000 0.980 0 0.000 1.000
#> GSM154296 3 0.0000 0.980 0 0.000 1.000
#> GSM154297 3 0.0424 0.970 0 0.008 0.992
#> GSM154310 3 0.0000 0.980 0 0.000 1.000
#> GSM154311 3 0.0000 0.980 0 0.000 1.000
#> GSM154312 3 0.0000 0.980 0 0.000 1.000
#> GSM154268 1 0.0000 1.000 1 0.000 0.000
#> GSM154269 1 0.0000 1.000 1 0.000 0.000
#> GSM154270 1 0.0000 1.000 1 0.000 0.000
#> GSM154283 2 0.4974 0.920 0 0.764 0.236
#> GSM154284 2 0.4974 0.920 0 0.764 0.236
#> GSM154285 2 0.5363 0.876 0 0.724 0.276
#> GSM154298 2 0.4974 0.920 0 0.764 0.236
#> GSM154299 2 0.4974 0.920 0 0.764 0.236
#> GSM154300 2 0.4974 0.920 0 0.764 0.236
#> GSM154313 2 0.4974 0.920 0 0.764 0.236
#> GSM154314 2 0.4974 0.920 0 0.764 0.236
#> GSM154315 2 0.0000 0.738 0 1.000 0.000
#> GSM154271 1 0.0000 1.000 1 0.000 0.000
#> GSM154272 1 0.0000 1.000 1 0.000 0.000
#> GSM154273 1 0.0000 1.000 1 0.000 0.000
#> GSM154286 3 0.0000 0.980 0 0.000 1.000
#> GSM154287 3 0.0000 0.980 0 0.000 1.000
#> GSM154288 2 0.5706 0.212 0 0.680 0.320
#> GSM154301 3 0.0000 0.980 0 0.000 1.000
#> GSM154302 3 0.0000 0.980 0 0.000 1.000
#> GSM154303 3 0.5016 0.689 0 0.240 0.760
#> GSM154316 3 0.0000 0.980 0 0.000 1.000
#> GSM154317 3 0.0000 0.980 0 0.000 1.000
#> GSM154318 3 0.0000 0.980 0 0.000 1.000
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> GSM154259 1 0.000 1.000 1 0.000 0.000 0.000
#> GSM154260 1 0.000 1.000 1 0.000 0.000 0.000
#> GSM154261 1 0.000 1.000 1 0.000 0.000 0.000
#> GSM154274 2 0.000 0.996 0 1.000 0.000 0.000
#> GSM154275 2 0.000 0.996 0 1.000 0.000 0.000
#> GSM154276 2 0.000 0.996 0 1.000 0.000 0.000
#> GSM154289 2 0.000 0.996 0 1.000 0.000 0.000
#> GSM154290 2 0.000 0.996 0 1.000 0.000 0.000
#> GSM154291 4 0.391 0.862 0 0.232 0.000 0.768
#> GSM154304 2 0.000 0.996 0 1.000 0.000 0.000
#> GSM154305 2 0.000 0.996 0 1.000 0.000 0.000
#> GSM154306 4 0.391 0.862 0 0.232 0.000 0.768
#> GSM154262 1 0.000 1.000 1 0.000 0.000 0.000
#> GSM154263 1 0.000 1.000 1 0.000 0.000 0.000
#> GSM154264 1 0.000 1.000 1 0.000 0.000 0.000
#> GSM154277 2 0.000 0.996 0 1.000 0.000 0.000
#> GSM154278 2 0.000 0.996 0 1.000 0.000 0.000
#> GSM154279 2 0.000 0.996 0 1.000 0.000 0.000
#> GSM154292 2 0.000 0.996 0 1.000 0.000 0.000
#> GSM154293 2 0.000 0.996 0 1.000 0.000 0.000
#> GSM154294 4 0.404 0.844 0 0.248 0.000 0.752
#> GSM154307 2 0.000 0.996 0 1.000 0.000 0.000
#> GSM154308 2 0.000 0.996 0 1.000 0.000 0.000
#> GSM154309 2 0.000 0.996 0 1.000 0.000 0.000
#> GSM154265 1 0.000 1.000 1 0.000 0.000 0.000
#> GSM154266 1 0.000 1.000 1 0.000 0.000 0.000
#> GSM154267 1 0.000 1.000 1 0.000 0.000 0.000
#> GSM154280 3 0.000 0.892 0 0.000 1.000 0.000
#> GSM154281 3 0.000 0.892 0 0.000 1.000 0.000
#> GSM154282 3 0.000 0.892 0 0.000 1.000 0.000
#> GSM154295 3 0.000 0.892 0 0.000 1.000 0.000
#> GSM154296 3 0.000 0.892 0 0.000 1.000 0.000
#> GSM154297 3 0.000 0.892 0 0.000 1.000 0.000
#> GSM154310 3 0.000 0.892 0 0.000 1.000 0.000
#> GSM154311 3 0.000 0.892 0 0.000 1.000 0.000
#> GSM154312 3 0.000 0.892 0 0.000 1.000 0.000
#> GSM154268 1 0.000 1.000 1 0.000 0.000 0.000
#> GSM154269 1 0.000 1.000 1 0.000 0.000 0.000
#> GSM154270 1 0.000 1.000 1 0.000 0.000 0.000
#> GSM154283 2 0.000 0.996 0 1.000 0.000 0.000
#> GSM154284 2 0.000 0.996 0 1.000 0.000 0.000
#> GSM154285 2 0.187 0.898 0 0.928 0.072 0.000
#> GSM154298 2 0.000 0.996 0 1.000 0.000 0.000
#> GSM154299 2 0.000 0.996 0 1.000 0.000 0.000
#> GSM154300 2 0.000 0.996 0 1.000 0.000 0.000
#> GSM154313 2 0.000 0.996 0 1.000 0.000 0.000
#> GSM154314 2 0.000 0.996 0 1.000 0.000 0.000
#> GSM154315 4 0.391 0.862 0 0.232 0.000 0.768
#> GSM154271 1 0.000 1.000 1 0.000 0.000 0.000
#> GSM154272 1 0.000 1.000 1 0.000 0.000 0.000
#> GSM154273 1 0.000 1.000 1 0.000 0.000 0.000
#> GSM154286 3 0.391 0.853 0 0.000 0.768 0.232
#> GSM154287 3 0.391 0.853 0 0.000 0.768 0.232
#> GSM154288 4 0.000 0.704 0 0.000 0.000 1.000
#> GSM154301 3 0.391 0.853 0 0.000 0.768 0.232
#> GSM154302 3 0.391 0.853 0 0.000 0.768 0.232
#> GSM154303 4 0.000 0.704 0 0.000 0.000 1.000
#> GSM154316 3 0.391 0.853 0 0.000 0.768 0.232
#> GSM154317 3 0.391 0.853 0 0.000 0.768 0.232
#> GSM154318 3 0.391 0.853 0 0.000 0.768 0.232
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> GSM154259 1 0.000 1.000 1 0.000 0.0 0.00 0.000
#> GSM154260 1 0.000 1.000 1 0.000 0.0 0.00 0.000
#> GSM154261 1 0.000 1.000 1 0.000 0.0 0.00 0.000
#> GSM154274 2 0.311 0.829 0 0.800 0.0 0.20 0.000
#> GSM154275 2 0.311 0.829 0 0.800 0.0 0.20 0.000
#> GSM154276 2 0.311 0.829 0 0.800 0.0 0.20 0.000
#> GSM154289 2 0.311 0.829 0 0.800 0.0 0.20 0.000
#> GSM154290 2 0.311 0.829 0 0.800 0.0 0.20 0.000
#> GSM154291 4 0.000 0.773 0 0.000 0.0 1.00 0.000
#> GSM154304 2 0.311 0.829 0 0.800 0.0 0.20 0.000
#> GSM154305 2 0.311 0.829 0 0.800 0.0 0.20 0.000
#> GSM154306 4 0.000 0.773 0 0.000 0.0 1.00 0.000
#> GSM154262 1 0.000 1.000 1 0.000 0.0 0.00 0.000
#> GSM154263 1 0.000 1.000 1 0.000 0.0 0.00 0.000
#> GSM154264 1 0.000 1.000 1 0.000 0.0 0.00 0.000
#> GSM154277 2 0.000 0.926 0 1.000 0.0 0.00 0.000
#> GSM154278 2 0.000 0.926 0 1.000 0.0 0.00 0.000
#> GSM154279 2 0.000 0.926 0 1.000 0.0 0.00 0.000
#> GSM154292 2 0.000 0.926 0 1.000 0.0 0.00 0.000
#> GSM154293 2 0.000 0.926 0 1.000 0.0 0.00 0.000
#> GSM154294 4 0.327 0.738 0 0.220 0.0 0.78 0.000
#> GSM154307 2 0.000 0.926 0 1.000 0.0 0.00 0.000
#> GSM154308 2 0.000 0.926 0 1.000 0.0 0.00 0.000
#> GSM154309 2 0.000 0.926 0 1.000 0.0 0.00 0.000
#> GSM154265 1 0.000 1.000 1 0.000 0.0 0.00 0.000
#> GSM154266 1 0.000 1.000 1 0.000 0.0 0.00 0.000
#> GSM154267 1 0.000 1.000 1 0.000 0.0 0.00 0.000
#> GSM154280 5 0.000 1.000 0 0.000 0.0 0.00 1.000
#> GSM154281 5 0.000 1.000 0 0.000 0.0 0.00 1.000
#> GSM154282 5 0.000 1.000 0 0.000 0.0 0.00 1.000
#> GSM154295 5 0.000 1.000 0 0.000 0.0 0.00 1.000
#> GSM154296 5 0.000 1.000 0 0.000 0.0 0.00 1.000
#> GSM154297 5 0.000 1.000 0 0.000 0.0 0.00 1.000
#> GSM154310 5 0.000 1.000 0 0.000 0.0 0.00 1.000
#> GSM154311 5 0.000 1.000 0 0.000 0.0 0.00 1.000
#> GSM154312 5 0.000 1.000 0 0.000 0.0 0.00 1.000
#> GSM154268 1 0.000 1.000 1 0.000 0.0 0.00 0.000
#> GSM154269 1 0.000 1.000 1 0.000 0.0 0.00 0.000
#> GSM154270 1 0.000 1.000 1 0.000 0.0 0.00 0.000
#> GSM154283 2 0.000 0.926 0 1.000 0.0 0.00 0.000
#> GSM154284 2 0.000 0.926 0 1.000 0.0 0.00 0.000
#> GSM154285 2 0.161 0.882 0 0.928 0.0 0.00 0.072
#> GSM154298 2 0.000 0.926 0 1.000 0.0 0.00 0.000
#> GSM154299 2 0.000 0.926 0 1.000 0.0 0.00 0.000
#> GSM154300 2 0.000 0.926 0 1.000 0.0 0.00 0.000
#> GSM154313 2 0.000 0.926 0 1.000 0.0 0.00 0.000
#> GSM154314 2 0.000 0.926 0 1.000 0.0 0.00 0.000
#> GSM154315 4 0.311 0.752 0 0.200 0.0 0.80 0.000
#> GSM154271 1 0.000 1.000 1 0.000 0.0 0.00 0.000
#> GSM154272 1 0.000 1.000 1 0.000 0.0 0.00 0.000
#> GSM154273 1 0.000 1.000 1 0.000 0.0 0.00 0.000
#> GSM154286 3 0.000 1.000 0 0.000 1.0 0.00 0.000
#> GSM154287 3 0.000 1.000 0 0.000 1.0 0.00 0.000
#> GSM154288 4 0.311 0.734 0 0.000 0.2 0.80 0.000
#> GSM154301 3 0.000 1.000 0 0.000 1.0 0.00 0.000
#> GSM154302 3 0.000 1.000 0 0.000 1.0 0.00 0.000
#> GSM154303 4 0.311 0.734 0 0.000 0.2 0.80 0.000
#> GSM154316 3 0.000 1.000 0 0.000 1.0 0.00 0.000
#> GSM154317 3 0.000 1.000 0 0.000 1.0 0.00 0.000
#> GSM154318 3 0.000 1.000 0 0.000 1.0 0.00 0.000
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> GSM154259 1 0.1007 0.977 0.956 0.000 0.0 0.000 0.000 0.044
#> GSM154260 1 0.0000 0.982 1.000 0.000 0.0 0.000 0.000 0.000
#> GSM154261 1 0.0000 0.982 1.000 0.000 0.0 0.000 0.000 0.000
#> GSM154274 6 0.5253 1.000 0.000 0.192 0.0 0.200 0.000 0.608
#> GSM154275 6 0.5253 1.000 0.000 0.192 0.0 0.200 0.000 0.608
#> GSM154276 6 0.5253 1.000 0.000 0.192 0.0 0.200 0.000 0.608
#> GSM154289 6 0.5253 1.000 0.000 0.192 0.0 0.200 0.000 0.608
#> GSM154290 6 0.5253 1.000 0.000 0.192 0.0 0.200 0.000 0.608
#> GSM154291 4 0.0000 0.770 0.000 0.000 0.0 1.000 0.000 0.000
#> GSM154304 6 0.5253 1.000 0.000 0.192 0.0 0.200 0.000 0.608
#> GSM154305 6 0.5253 1.000 0.000 0.192 0.0 0.200 0.000 0.608
#> GSM154306 4 0.0000 0.770 0.000 0.000 0.0 1.000 0.000 0.000
#> GSM154262 1 0.1007 0.977 0.956 0.000 0.0 0.000 0.000 0.044
#> GSM154263 1 0.0000 0.982 1.000 0.000 0.0 0.000 0.000 0.000
#> GSM154264 1 0.0000 0.982 1.000 0.000 0.0 0.000 0.000 0.000
#> GSM154277 2 0.2597 0.564 0.000 0.824 0.0 0.176 0.000 0.000
#> GSM154278 2 0.2597 0.580 0.000 0.824 0.0 0.000 0.176 0.000
#> GSM154279 2 0.1765 0.668 0.000 0.904 0.0 0.000 0.096 0.000
#> GSM154292 2 0.0000 0.737 0.000 1.000 0.0 0.000 0.000 0.000
#> GSM154293 2 0.0000 0.737 0.000 1.000 0.0 0.000 0.000 0.000
#> GSM154294 4 0.2941 0.750 0.000 0.220 0.0 0.780 0.000 0.000
#> GSM154307 2 0.0000 0.737 0.000 1.000 0.0 0.000 0.000 0.000
#> GSM154308 2 0.0000 0.737 0.000 1.000 0.0 0.000 0.000 0.000
#> GSM154309 2 0.0000 0.737 0.000 1.000 0.0 0.000 0.000 0.000
#> GSM154265 1 0.1007 0.977 0.956 0.000 0.0 0.000 0.000 0.044
#> GSM154266 1 0.0632 0.980 0.976 0.000 0.0 0.000 0.000 0.024
#> GSM154267 1 0.0000 0.982 1.000 0.000 0.0 0.000 0.000 0.000
#> GSM154280 5 0.0000 1.000 0.000 0.000 0.0 0.000 1.000 0.000
#> GSM154281 5 0.0000 1.000 0.000 0.000 0.0 0.000 1.000 0.000
#> GSM154282 5 0.0000 1.000 0.000 0.000 0.0 0.000 1.000 0.000
#> GSM154295 5 0.0000 1.000 0.000 0.000 0.0 0.000 1.000 0.000
#> GSM154296 5 0.0000 1.000 0.000 0.000 0.0 0.000 1.000 0.000
#> GSM154297 5 0.0000 1.000 0.000 0.000 0.0 0.000 1.000 0.000
#> GSM154310 5 0.0000 1.000 0.000 0.000 0.0 0.000 1.000 0.000
#> GSM154311 5 0.0000 1.000 0.000 0.000 0.0 0.000 1.000 0.000
#> GSM154312 5 0.0000 1.000 0.000 0.000 0.0 0.000 1.000 0.000
#> GSM154268 1 0.0000 0.982 1.000 0.000 0.0 0.000 0.000 0.000
#> GSM154269 1 0.1007 0.977 0.956 0.000 0.0 0.000 0.000 0.044
#> GSM154270 1 0.0000 0.982 1.000 0.000 0.0 0.000 0.000 0.000
#> GSM154283 2 0.3607 0.779 0.000 0.652 0.0 0.000 0.000 0.348
#> GSM154284 2 0.3607 0.779 0.000 0.652 0.0 0.000 0.000 0.348
#> GSM154285 2 0.3742 0.776 0.000 0.648 0.0 0.000 0.004 0.348
#> GSM154298 2 0.3607 0.779 0.000 0.652 0.0 0.000 0.000 0.348
#> GSM154299 2 0.3607 0.779 0.000 0.652 0.0 0.000 0.000 0.348
#> GSM154300 2 0.3607 0.779 0.000 0.652 0.0 0.000 0.000 0.348
#> GSM154313 2 0.3607 0.779 0.000 0.652 0.0 0.000 0.000 0.348
#> GSM154314 2 0.3607 0.779 0.000 0.652 0.0 0.000 0.000 0.348
#> GSM154315 4 0.3566 0.789 0.000 0.096 0.0 0.800 0.000 0.104
#> GSM154271 1 0.1007 0.977 0.956 0.000 0.0 0.000 0.000 0.044
#> GSM154272 1 0.1007 0.977 0.956 0.000 0.0 0.000 0.000 0.044
#> GSM154273 1 0.0000 0.982 1.000 0.000 0.0 0.000 0.000 0.000
#> GSM154286 3 0.0000 1.000 0.000 0.000 1.0 0.000 0.000 0.000
#> GSM154287 3 0.0000 1.000 0.000 0.000 1.0 0.000 0.000 0.000
#> GSM154288 4 0.2793 0.767 0.000 0.000 0.2 0.800 0.000 0.000
#> GSM154301 3 0.0000 1.000 0.000 0.000 1.0 0.000 0.000 0.000
#> GSM154302 3 0.0000 1.000 0.000 0.000 1.0 0.000 0.000 0.000
#> GSM154303 4 0.2793 0.767 0.000 0.000 0.2 0.800 0.000 0.000
#> GSM154316 3 0.0000 1.000 0.000 0.000 1.0 0.000 0.000 0.000
#> GSM154317 3 0.0000 1.000 0.000 0.000 1.0 0.000 0.000 0.000
#> GSM154318 3 0.0000 1.000 0.000 0.000 1.0 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 agent(p) time(p) k
#> SD:pam 57 9.92e-01 2.57e-12 2
#> SD:pam 59 5.98e-07 6.86e-11 3
#> SD:pam 60 2.81e-05 5.60e-10 4
#> SD:pam 60 7.83e-11 9.02e-09 5
#> SD:pam 60 5.80e-16 1.03e-07 6
If matrix rows can be associated to genes, consider to use functional_enrichment(res,
...)
to perform function enrichment for the signature genes. See this vignette for more detailed explanations.
The object with results only for a single top-value method and a single partition method can be extracted as:
res = res_list["SD", "mclust"]
# you can also extract it by
# res = res_list["SD:mclust"]
A summary of res
and all the functions that can be applied to it:
res
#> A 'ConsensusPartition' object with k = 2, 3, 4, 5, 6.
#> On a matrix with 38950 rows and 60 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 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.449 0.686 0.823 0.3097 0.790 0.790
#> 3 3 0.507 0.758 0.837 0.9837 0.409 0.311
#> 4 4 0.759 0.818 0.908 0.1702 0.856 0.622
#> 5 5 0.821 0.795 0.897 0.0851 0.893 0.650
#> 6 6 0.838 0.851 0.905 0.0418 0.969 0.862
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
#> GSM154259 2 0.9996 0.418 0.488 0.512
#> GSM154260 2 0.9833 0.445 0.424 0.576
#> GSM154261 2 0.9996 0.418 0.488 0.512
#> GSM154274 2 0.0000 0.750 0.000 1.000
#> GSM154275 2 0.0000 0.750 0.000 1.000
#> GSM154276 2 0.0000 0.750 0.000 1.000
#> GSM154289 2 0.0000 0.750 0.000 1.000
#> GSM154290 2 0.0000 0.750 0.000 1.000
#> GSM154291 1 0.9608 0.971 0.616 0.384
#> GSM154304 2 0.0000 0.750 0.000 1.000
#> GSM154305 2 0.2423 0.703 0.040 0.960
#> GSM154306 1 0.9608 0.971 0.616 0.384
#> GSM154262 2 0.9996 0.418 0.488 0.512
#> GSM154263 2 0.9996 0.418 0.488 0.512
#> GSM154264 2 0.9996 0.418 0.488 0.512
#> GSM154277 1 0.9608 0.971 0.616 0.384
#> GSM154278 2 0.0000 0.750 0.000 1.000
#> GSM154279 2 0.0000 0.750 0.000 1.000
#> GSM154292 2 0.0000 0.750 0.000 1.000
#> GSM154293 2 0.0000 0.750 0.000 1.000
#> GSM154294 1 0.9608 0.971 0.616 0.384
#> GSM154307 2 0.0000 0.750 0.000 1.000
#> GSM154308 2 0.0000 0.750 0.000 1.000
#> GSM154309 2 0.0000 0.750 0.000 1.000
#> GSM154265 2 0.9996 0.418 0.488 0.512
#> GSM154266 2 0.9996 0.418 0.488 0.512
#> GSM154267 2 0.9996 0.418 0.488 0.512
#> GSM154280 2 0.0938 0.749 0.012 0.988
#> GSM154281 2 0.0938 0.749 0.012 0.988
#> GSM154282 2 0.0938 0.749 0.012 0.988
#> GSM154295 2 0.0938 0.749 0.012 0.988
#> GSM154296 2 0.0938 0.749 0.012 0.988
#> GSM154297 2 0.0938 0.749 0.012 0.988
#> GSM154310 2 0.0938 0.749 0.012 0.988
#> GSM154311 2 0.2603 0.739 0.044 0.956
#> GSM154312 2 0.2778 0.736 0.048 0.952
#> GSM154268 2 0.9996 0.418 0.488 0.512
#> GSM154269 2 0.9996 0.418 0.488 0.512
#> GSM154270 2 0.9996 0.418 0.488 0.512
#> GSM154283 2 0.0000 0.750 0.000 1.000
#> GSM154284 2 0.0000 0.750 0.000 1.000
#> GSM154285 2 0.0000 0.750 0.000 1.000
#> GSM154298 2 0.0000 0.750 0.000 1.000
#> GSM154299 2 0.0000 0.750 0.000 1.000
#> GSM154300 2 0.0000 0.750 0.000 1.000
#> GSM154313 2 0.0000 0.750 0.000 1.000
#> GSM154314 2 0.0000 0.750 0.000 1.000
#> GSM154315 1 0.9608 0.971 0.616 0.384
#> GSM154271 2 0.9996 0.418 0.488 0.512
#> GSM154272 2 0.9996 0.418 0.488 0.512
#> GSM154273 2 0.9996 0.418 0.488 0.512
#> GSM154286 2 0.5842 0.659 0.140 0.860
#> GSM154287 2 0.3733 0.725 0.072 0.928
#> GSM154288 1 0.9209 0.929 0.664 0.336
#> GSM154301 2 0.3733 0.725 0.072 0.928
#> GSM154302 2 0.3733 0.725 0.072 0.928
#> GSM154303 1 0.9209 0.929 0.664 0.336
#> GSM154316 2 0.3733 0.725 0.072 0.928
#> GSM154317 2 0.3733 0.725 0.072 0.928
#> GSM154318 2 0.3733 0.725 0.072 0.928
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> GSM154259 1 0.280 0.867 0.908 0.000 0.092
#> GSM154260 1 0.417 0.847 0.868 0.028 0.104
#> GSM154261 1 0.000 0.981 1.000 0.000 0.000
#> GSM154274 2 0.533 0.878 0.000 0.728 0.272
#> GSM154275 2 0.533 0.878 0.000 0.728 0.272
#> GSM154276 2 0.533 0.878 0.000 0.728 0.272
#> GSM154289 2 0.614 0.867 0.000 0.596 0.404
#> GSM154290 2 0.613 0.867 0.000 0.600 0.400
#> GSM154291 3 0.588 0.574 0.000 0.348 0.652
#> GSM154304 2 0.614 0.867 0.000 0.596 0.404
#> GSM154305 3 0.627 -0.502 0.000 0.452 0.548
#> GSM154306 3 0.588 0.574 0.000 0.348 0.652
#> GSM154262 1 0.000 0.981 1.000 0.000 0.000
#> GSM154263 1 0.000 0.981 1.000 0.000 0.000
#> GSM154264 1 0.000 0.981 1.000 0.000 0.000
#> GSM154277 3 0.630 0.489 0.000 0.476 0.524
#> GSM154278 2 0.536 0.875 0.000 0.724 0.276
#> GSM154279 2 0.533 0.878 0.000 0.728 0.272
#> GSM154292 2 0.611 0.870 0.000 0.604 0.396
#> GSM154293 2 0.614 0.867 0.000 0.596 0.404
#> GSM154294 3 0.588 0.574 0.000 0.348 0.652
#> GSM154307 2 0.614 0.867 0.000 0.596 0.404
#> GSM154308 2 0.614 0.867 0.000 0.596 0.404
#> GSM154309 2 0.614 0.867 0.000 0.596 0.404
#> GSM154265 1 0.000 0.981 1.000 0.000 0.000
#> GSM154266 1 0.000 0.981 1.000 0.000 0.000
#> GSM154267 1 0.000 0.981 1.000 0.000 0.000
#> GSM154280 3 0.579 0.284 0.000 0.332 0.668
#> GSM154281 3 0.579 0.284 0.000 0.332 0.668
#> GSM154282 3 0.579 0.284 0.000 0.332 0.668
#> GSM154295 3 0.348 0.576 0.000 0.128 0.872
#> GSM154296 3 0.348 0.576 0.000 0.128 0.872
#> GSM154297 3 0.348 0.576 0.000 0.128 0.872
#> GSM154310 3 0.327 0.587 0.000 0.116 0.884
#> GSM154311 3 0.380 0.670 0.092 0.024 0.884
#> GSM154312 3 0.353 0.677 0.108 0.008 0.884
#> GSM154268 1 0.000 0.981 1.000 0.000 0.000
#> GSM154269 1 0.000 0.981 1.000 0.000 0.000
#> GSM154270 1 0.000 0.981 1.000 0.000 0.000
#> GSM154283 2 0.533 0.878 0.000 0.728 0.272
#> GSM154284 2 0.533 0.878 0.000 0.728 0.272
#> GSM154285 2 0.533 0.878 0.000 0.728 0.272
#> GSM154298 2 0.588 0.878 0.000 0.652 0.348
#> GSM154299 2 0.533 0.878 0.000 0.728 0.272
#> GSM154300 2 0.533 0.878 0.000 0.728 0.272
#> GSM154313 2 0.614 0.867 0.000 0.596 0.404
#> GSM154314 2 0.614 0.867 0.000 0.596 0.404
#> GSM154315 3 0.588 0.574 0.000 0.348 0.652
#> GSM154271 1 0.000 0.981 1.000 0.000 0.000
#> GSM154272 1 0.000 0.981 1.000 0.000 0.000
#> GSM154273 1 0.000 0.981 1.000 0.000 0.000
#> GSM154286 3 0.353 0.679 0.108 0.008 0.884
#> GSM154287 3 0.335 0.679 0.108 0.004 0.888
#> GSM154288 3 0.700 0.567 0.048 0.280 0.672
#> GSM154301 3 0.312 0.680 0.108 0.000 0.892
#> GSM154302 3 0.312 0.680 0.108 0.000 0.892
#> GSM154303 3 0.700 0.567 0.048 0.280 0.672
#> GSM154316 3 0.312 0.680 0.108 0.000 0.892
#> GSM154317 3 0.312 0.680 0.108 0.000 0.892
#> GSM154318 3 0.312 0.680 0.108 0.000 0.892
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> GSM154259 1 0.0000 0.994 1.000 0.000 0.000 0.000
#> GSM154260 1 0.1940 0.915 0.924 0.000 0.000 0.076
#> GSM154261 1 0.0000 0.994 1.000 0.000 0.000 0.000
#> GSM154274 2 0.0000 0.835 0.000 1.000 0.000 0.000
#> GSM154275 2 0.0000 0.835 0.000 1.000 0.000 0.000
#> GSM154276 2 0.0000 0.835 0.000 1.000 0.000 0.000
#> GSM154289 2 0.3569 0.821 0.000 0.804 0.000 0.196
#> GSM154290 2 0.3311 0.826 0.000 0.828 0.000 0.172
#> GSM154291 4 0.0000 0.867 0.000 0.000 0.000 1.000
#> GSM154304 2 0.3610 0.820 0.000 0.800 0.000 0.200
#> GSM154305 2 0.3610 0.820 0.000 0.800 0.000 0.200
#> GSM154306 4 0.0000 0.867 0.000 0.000 0.000 1.000
#> GSM154262 1 0.0000 0.994 1.000 0.000 0.000 0.000
#> GSM154263 1 0.0000 0.994 1.000 0.000 0.000 0.000
#> GSM154264 1 0.0000 0.994 1.000 0.000 0.000 0.000
#> GSM154277 4 0.4222 0.681 0.000 0.272 0.000 0.728
#> GSM154278 2 0.3486 0.638 0.000 0.812 0.188 0.000
#> GSM154279 2 0.0000 0.835 0.000 1.000 0.000 0.000
#> GSM154292 2 0.3266 0.827 0.000 0.832 0.000 0.168
#> GSM154293 2 0.3311 0.826 0.000 0.828 0.000 0.172
#> GSM154294 4 0.0469 0.860 0.000 0.012 0.000 0.988
#> GSM154307 2 0.3610 0.820 0.000 0.800 0.000 0.200
#> GSM154308 2 0.3610 0.820 0.000 0.800 0.000 0.200
#> GSM154309 2 0.3610 0.820 0.000 0.800 0.000 0.200
#> GSM154265 1 0.0000 0.994 1.000 0.000 0.000 0.000
#> GSM154266 1 0.0000 0.994 1.000 0.000 0.000 0.000
#> GSM154267 1 0.0000 0.994 1.000 0.000 0.000 0.000
#> GSM154280 2 0.4477 0.414 0.000 0.688 0.312 0.000
#> GSM154281 2 0.4477 0.414 0.000 0.688 0.312 0.000
#> GSM154282 2 0.4477 0.414 0.000 0.688 0.312 0.000
#> GSM154295 3 0.4304 0.592 0.000 0.284 0.716 0.000
#> GSM154296 3 0.4948 0.363 0.000 0.440 0.560 0.000
#> GSM154297 3 0.4961 0.344 0.000 0.448 0.552 0.000
#> GSM154310 3 0.4193 0.616 0.000 0.268 0.732 0.000
#> GSM154311 3 0.0000 0.823 0.000 0.000 1.000 0.000
#> GSM154312 3 0.0000 0.823 0.000 0.000 1.000 0.000
#> GSM154268 1 0.0000 0.994 1.000 0.000 0.000 0.000
#> GSM154269 1 0.0000 0.994 1.000 0.000 0.000 0.000
#> GSM154270 1 0.0000 0.994 1.000 0.000 0.000 0.000
#> GSM154283 2 0.0000 0.835 0.000 1.000 0.000 0.000
#> GSM154284 2 0.0000 0.835 0.000 1.000 0.000 0.000
#> GSM154285 2 0.0000 0.835 0.000 1.000 0.000 0.000
#> GSM154298 2 0.1867 0.836 0.000 0.928 0.000 0.072
#> GSM154299 2 0.0000 0.835 0.000 1.000 0.000 0.000
#> GSM154300 2 0.0000 0.835 0.000 1.000 0.000 0.000
#> GSM154313 2 0.3610 0.820 0.000 0.800 0.000 0.200
#> GSM154314 2 0.3569 0.821 0.000 0.804 0.000 0.196
#> GSM154315 4 0.0000 0.867 0.000 0.000 0.000 1.000
#> GSM154271 1 0.0000 0.994 1.000 0.000 0.000 0.000
#> GSM154272 1 0.0000 0.994 1.000 0.000 0.000 0.000
#> GSM154273 1 0.0000 0.994 1.000 0.000 0.000 0.000
#> GSM154286 3 0.0188 0.820 0.000 0.000 0.996 0.004
#> GSM154287 3 0.0000 0.823 0.000 0.000 1.000 0.000
#> GSM154288 4 0.4194 0.753 0.028 0.000 0.172 0.800
#> GSM154301 3 0.0000 0.823 0.000 0.000 1.000 0.000
#> GSM154302 3 0.0000 0.823 0.000 0.000 1.000 0.000
#> GSM154303 4 0.4194 0.753 0.028 0.000 0.172 0.800
#> GSM154316 3 0.0000 0.823 0.000 0.000 1.000 0.000
#> GSM154317 3 0.0000 0.823 0.000 0.000 1.000 0.000
#> GSM154318 3 0.0000 0.823 0.000 0.000 1.000 0.000
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> GSM154259 1 0.0566 0.990 0.984 0.000 0.000 0.012 0.004
#> GSM154260 1 0.0794 0.969 0.972 0.000 0.000 0.028 0.000
#> GSM154261 1 0.0000 0.992 1.000 0.000 0.000 0.000 0.000
#> GSM154274 2 0.4641 0.302 0.000 0.532 0.012 0.000 0.456
#> GSM154275 5 0.0162 0.915 0.000 0.004 0.000 0.000 0.996
#> GSM154276 5 0.0162 0.915 0.000 0.004 0.000 0.000 0.996
#> GSM154289 2 0.0510 0.837 0.000 0.984 0.000 0.000 0.016
#> GSM154290 2 0.2852 0.753 0.000 0.828 0.000 0.000 0.172
#> GSM154291 4 0.1478 0.844 0.000 0.064 0.000 0.936 0.000
#> GSM154304 2 0.2471 0.782 0.000 0.864 0.000 0.136 0.000
#> GSM154305 2 0.3152 0.778 0.000 0.840 0.000 0.136 0.024
#> GSM154306 4 0.1478 0.844 0.000 0.064 0.000 0.936 0.000
#> GSM154262 1 0.0566 0.990 0.984 0.000 0.000 0.012 0.004
#> GSM154263 1 0.0000 0.992 1.000 0.000 0.000 0.000 0.000
#> GSM154264 1 0.0000 0.992 1.000 0.000 0.000 0.000 0.000
#> GSM154277 4 0.4270 0.633 0.000 0.048 0.000 0.748 0.204
#> GSM154278 2 0.4696 0.490 0.000 0.616 0.024 0.000 0.360
#> GSM154279 5 0.3109 0.658 0.000 0.200 0.000 0.000 0.800
#> GSM154292 2 0.0609 0.837 0.000 0.980 0.000 0.000 0.020
#> GSM154293 2 0.0290 0.838 0.000 0.992 0.000 0.000 0.008
#> GSM154294 4 0.3333 0.770 0.000 0.208 0.000 0.788 0.004
#> GSM154307 2 0.0162 0.835 0.000 0.996 0.000 0.004 0.000
#> GSM154308 2 0.0162 0.835 0.000 0.996 0.000 0.004 0.000
#> GSM154309 2 0.0162 0.835 0.000 0.996 0.000 0.004 0.000
#> GSM154265 1 0.0566 0.990 0.984 0.000 0.000 0.012 0.004
#> GSM154266 1 0.0000 0.992 1.000 0.000 0.000 0.000 0.000
#> GSM154267 1 0.0000 0.992 1.000 0.000 0.000 0.000 0.000
#> GSM154280 3 0.6563 0.121 0.000 0.208 0.436 0.000 0.356
#> GSM154281 3 0.6538 0.162 0.000 0.208 0.452 0.000 0.340
#> GSM154282 3 0.6552 0.143 0.000 0.208 0.444 0.000 0.348
#> GSM154295 3 0.1768 0.786 0.000 0.072 0.924 0.004 0.000
#> GSM154296 3 0.3934 0.699 0.000 0.076 0.800 0.000 0.124
#> GSM154297 3 0.3934 0.699 0.000 0.076 0.800 0.000 0.124
#> GSM154310 3 0.1704 0.788 0.000 0.068 0.928 0.004 0.000
#> GSM154311 3 0.0162 0.805 0.000 0.000 0.996 0.004 0.000
#> GSM154312 3 0.0162 0.805 0.000 0.000 0.996 0.004 0.000
#> GSM154268 1 0.0000 0.992 1.000 0.000 0.000 0.000 0.000
#> GSM154269 1 0.0566 0.990 0.984 0.000 0.000 0.012 0.004
#> GSM154270 1 0.0000 0.992 1.000 0.000 0.000 0.000 0.000
#> GSM154283 2 0.4298 0.530 0.000 0.640 0.008 0.000 0.352
#> GSM154284 5 0.0162 0.915 0.000 0.004 0.000 0.000 0.996
#> GSM154285 5 0.0703 0.907 0.000 0.024 0.000 0.000 0.976
#> GSM154298 2 0.1544 0.824 0.000 0.932 0.000 0.000 0.068
#> GSM154299 2 0.3305 0.713 0.000 0.776 0.000 0.000 0.224
#> GSM154300 2 0.3508 0.693 0.000 0.748 0.000 0.000 0.252
#> GSM154313 2 0.0162 0.837 0.000 0.996 0.000 0.000 0.004
#> GSM154314 2 0.0162 0.837 0.000 0.996 0.000 0.000 0.004
#> GSM154315 4 0.1671 0.843 0.000 0.076 0.000 0.924 0.000
#> GSM154271 1 0.0566 0.990 0.984 0.000 0.000 0.012 0.004
#> GSM154272 1 0.0566 0.990 0.984 0.000 0.000 0.012 0.004
#> GSM154273 1 0.0000 0.992 1.000 0.000 0.000 0.000 0.000
#> GSM154286 3 0.3035 0.695 0.136 0.000 0.848 0.008 0.008
#> GSM154287 3 0.0290 0.804 0.000 0.000 0.992 0.008 0.000
#> GSM154288 4 0.2690 0.782 0.000 0.000 0.156 0.844 0.000
#> GSM154301 3 0.0290 0.804 0.000 0.000 0.992 0.008 0.000
#> GSM154302 3 0.0290 0.804 0.000 0.000 0.992 0.008 0.000
#> GSM154303 4 0.2690 0.782 0.000 0.000 0.156 0.844 0.000
#> GSM154316 3 0.0880 0.800 0.000 0.000 0.968 0.032 0.000
#> GSM154317 3 0.0794 0.802 0.000 0.000 0.972 0.028 0.000
#> GSM154318 3 0.0794 0.802 0.000 0.000 0.972 0.028 0.000
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> GSM154259 6 0.1806 0.983 0.088 0.000 0.000 0.004 0.000 0.908
#> GSM154260 1 0.2520 0.811 0.844 0.000 0.000 0.152 0.000 0.004
#> GSM154261 1 0.0260 0.971 0.992 0.000 0.000 0.008 0.000 0.000
#> GSM154274 2 0.3830 0.589 0.000 0.620 0.000 0.000 0.376 0.004
#> GSM154275 5 0.1141 0.917 0.000 0.000 0.000 0.000 0.948 0.052
#> GSM154276 5 0.1141 0.917 0.000 0.000 0.000 0.000 0.948 0.052
#> GSM154289 2 0.0935 0.845 0.000 0.964 0.000 0.004 0.032 0.000
#> GSM154290 2 0.3791 0.716 0.000 0.732 0.000 0.032 0.236 0.000
#> GSM154291 4 0.0790 0.847 0.000 0.032 0.000 0.968 0.000 0.000
#> GSM154304 2 0.2562 0.776 0.000 0.828 0.000 0.172 0.000 0.000
#> GSM154305 2 0.4002 0.757 0.000 0.744 0.000 0.188 0.068 0.000
#> GSM154306 4 0.0713 0.846 0.000 0.028 0.000 0.972 0.000 0.000
#> GSM154262 6 0.1501 0.997 0.076 0.000 0.000 0.000 0.000 0.924
#> GSM154263 1 0.0000 0.977 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM154264 1 0.0000 0.977 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM154277 4 0.2980 0.685 0.000 0.000 0.000 0.800 0.192 0.008
#> GSM154278 2 0.3957 0.698 0.000 0.696 0.020 0.000 0.280 0.004
#> GSM154279 5 0.2092 0.795 0.000 0.124 0.000 0.000 0.876 0.000
#> GSM154292 2 0.0865 0.845 0.000 0.964 0.000 0.000 0.036 0.000
#> GSM154293 2 0.0632 0.844 0.000 0.976 0.000 0.000 0.024 0.000
#> GSM154294 4 0.2762 0.762 0.000 0.196 0.000 0.804 0.000 0.000
#> GSM154307 2 0.0260 0.840 0.000 0.992 0.000 0.008 0.000 0.000
#> GSM154308 2 0.0260 0.840 0.000 0.992 0.000 0.008 0.000 0.000
#> GSM154309 2 0.0260 0.840 0.000 0.992 0.000 0.008 0.000 0.000
#> GSM154265 6 0.1501 0.997 0.076 0.000 0.000 0.000 0.000 0.924
#> GSM154266 1 0.0000 0.977 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM154267 1 0.0000 0.977 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM154280 3 0.4634 0.568 0.000 0.080 0.656 0.000 0.264 0.000
#> GSM154281 3 0.4473 0.601 0.000 0.072 0.676 0.000 0.252 0.000
#> GSM154282 3 0.4516 0.588 0.000 0.072 0.668 0.000 0.260 0.000
#> GSM154295 3 0.0547 0.884 0.000 0.020 0.980 0.000 0.000 0.000
#> GSM154296 3 0.2487 0.827 0.000 0.032 0.876 0.000 0.092 0.000
#> GSM154297 3 0.2633 0.817 0.000 0.032 0.864 0.000 0.104 0.000
#> GSM154310 3 0.0146 0.889 0.000 0.004 0.996 0.000 0.000 0.000
#> GSM154311 3 0.0000 0.890 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM154312 3 0.0000 0.890 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM154268 1 0.0000 0.977 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM154269 6 0.1501 0.997 0.076 0.000 0.000 0.000 0.000 0.924
#> GSM154270 1 0.0000 0.977 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM154283 2 0.3383 0.724 0.000 0.728 0.000 0.000 0.268 0.004
#> GSM154284 5 0.0000 0.925 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM154285 5 0.0000 0.925 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM154298 2 0.1327 0.837 0.000 0.936 0.000 0.000 0.064 0.000
#> GSM154299 2 0.3215 0.746 0.000 0.756 0.000 0.000 0.240 0.004
#> GSM154300 2 0.3601 0.687 0.000 0.684 0.000 0.000 0.312 0.004
#> GSM154313 2 0.0000 0.840 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM154314 2 0.0000 0.840 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM154315 4 0.0865 0.847 0.000 0.036 0.000 0.964 0.000 0.000
#> GSM154271 6 0.1501 0.997 0.076 0.000 0.000 0.000 0.000 0.924
#> GSM154272 6 0.1501 0.997 0.076 0.000 0.000 0.000 0.000 0.924
#> GSM154273 1 0.0000 0.977 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM154286 3 0.1434 0.886 0.000 0.000 0.948 0.020 0.008 0.024
#> GSM154287 3 0.1092 0.887 0.000 0.000 0.960 0.020 0.000 0.020
#> GSM154288 4 0.2869 0.790 0.000 0.000 0.148 0.832 0.000 0.020
#> GSM154301 3 0.0692 0.889 0.000 0.000 0.976 0.004 0.000 0.020
#> GSM154302 3 0.0692 0.889 0.000 0.000 0.976 0.004 0.000 0.020
#> GSM154303 4 0.3053 0.784 0.000 0.000 0.168 0.812 0.000 0.020
#> GSM154316 3 0.0891 0.889 0.000 0.000 0.968 0.008 0.000 0.024
#> GSM154317 3 0.0891 0.889 0.000 0.000 0.968 0.008 0.000 0.024
#> GSM154318 3 0.0891 0.889 0.000 0.000 0.968 0.008 0.000 0.024
Heatmaps for the consensus matrix. It visualizes the probability of two samples to be in a same group.
consensus_heatmap(res, k = 2)
consensus_heatmap(res, k = 3)
consensus_heatmap(res, k = 4)
consensus_heatmap(res, k = 5)
consensus_heatmap(res, k = 6)
Heatmaps for the membership of samples in all partitions to see how consistent they are:
membership_heatmap(res, k = 2)
membership_heatmap(res, k = 3)
membership_heatmap(res, k = 4)
membership_heatmap(res, k = 5)
membership_heatmap(res, k = 6)
As soon as we have had the classes for columns, we can look for signatures which are significantly different between classes which can be candidate marks for certain classes. Following are the heatmaps for signatures.
Signature heatmaps where rows are scaled:
get_signatures(res, k = 2)
get_signatures(res, k = 3)
get_signatures(res, k = 4)
get_signatures(res, k = 5)
get_signatures(res, k = 6)
Signature heatmaps where rows are not scaled:
get_signatures(res, k = 2, scale_rows = FALSE)
get_signatures(res, k = 3, scale_rows = FALSE)
get_signatures(res, k = 4, scale_rows = FALSE)
get_signatures(res, k = 5, scale_rows = FALSE)
get_signatures(res, k = 6, scale_rows = FALSE)
Compare the overlap of signatures from different k:
compare_signatures(res)
get_signature()
returns a data frame invisibly. TO get the list of signatures, the function
call should be assigned to a variable explicitly. In following code, if plot
argument is set
to FALSE
, no heatmap is plotted while only the differential analysis is performed.
# code only for demonstration
tb = get_signature(res, k = ..., plot = FALSE)
An example of the output of tb
is:
#> which_row fdr mean_1 mean_2 scaled_mean_1 scaled_mean_2 km
#> 1 38 0.042760348 8.373488 9.131774 -0.5533452 0.5164555 1
#> 2 40 0.018707592 7.106213 8.469186 -0.6173731 0.5762149 1
#> 3 55 0.019134737 10.221463 11.207825 -0.6159697 0.5749050 1
#> 4 59 0.006059896 5.921854 7.869574 -0.6899429 0.6439467 1
#> 5 60 0.018055526 8.928898 10.211722 -0.6204761 0.5791110 1
#> 6 98 0.009384629 15.714769 14.887706 0.6635654 -0.6193277 2
...
The columns in tb
are:
which_row
: row indices corresponding to the input matrix.fdr
: FDR for the differential test. mean_x
: The mean value in group x.scaled_mean_x
: The mean value in group x after rows are scaled.km
: Row groups if k-means clustering is applied to rows.UMAP plot which shows how samples are separated.
dimension_reduction(res, k = 2, method = "UMAP")
dimension_reduction(res, k = 3, method = "UMAP")
dimension_reduction(res, k = 4, method = "UMAP")
dimension_reduction(res, k = 5, method = "UMAP")
dimension_reduction(res, k = 6, method = "UMAP")
Following heatmap shows how subgroups are split when increasing k
:
collect_classes(res)
Test correlation between subgroups and known annotations. If the known annotation is numeric, one-way ANOVA test is applied, and if the known annotation is discrete, chi-squared contingency table test is applied.
test_to_known_factors(res)
#> n agent(p) time(p) k
#> SD:mclust 45 0.608031 8.44e-01 2
#> SD:mclust 55 0.000693 9.16e-11 3
#> SD:mclust 55 0.000500 2.97e-09 4
#> SD:mclust 55 0.002321 3.07e-12 5
#> SD:mclust 60 0.001728 3.17e-10 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 38950 rows and 60 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 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.769 0.864 0.944 0.4670 0.519 0.519
#> 3 3 0.699 0.839 0.903 0.2755 0.771 0.609
#> 4 4 0.900 0.919 0.956 0.2173 0.808 0.571
#> 5 5 0.867 0.859 0.928 0.0975 0.905 0.666
#> 6 6 0.843 0.830 0.890 0.0304 0.974 0.878
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
#> GSM154259 1 0.0000 0.900 1.000 0.000
#> GSM154260 1 0.0000 0.900 1.000 0.000
#> GSM154261 1 0.0000 0.900 1.000 0.000
#> GSM154274 2 0.0376 0.955 0.004 0.996
#> GSM154275 2 0.0672 0.953 0.008 0.992
#> GSM154276 2 0.0000 0.958 0.000 1.000
#> GSM154289 2 0.0000 0.958 0.000 1.000
#> GSM154290 2 0.0000 0.958 0.000 1.000
#> GSM154291 2 0.0000 0.958 0.000 1.000
#> GSM154304 2 0.0000 0.958 0.000 1.000
#> GSM154305 2 0.0000 0.958 0.000 1.000
#> GSM154306 2 0.0000 0.958 0.000 1.000
#> GSM154262 1 0.0000 0.900 1.000 0.000
#> GSM154263 1 0.0000 0.900 1.000 0.000
#> GSM154264 1 0.0000 0.900 1.000 0.000
#> GSM154277 2 0.0000 0.958 0.000 1.000
#> GSM154278 2 0.2948 0.918 0.052 0.948
#> GSM154279 2 0.0000 0.958 0.000 1.000
#> GSM154292 2 0.0000 0.958 0.000 1.000
#> GSM154293 2 0.0000 0.958 0.000 1.000
#> GSM154294 2 0.0000 0.958 0.000 1.000
#> GSM154307 2 0.0000 0.958 0.000 1.000
#> GSM154308 2 0.0000 0.958 0.000 1.000
#> GSM154309 2 0.0000 0.958 0.000 1.000
#> GSM154265 1 0.0000 0.900 1.000 0.000
#> GSM154266 1 0.0000 0.900 1.000 0.000
#> GSM154267 1 0.0000 0.900 1.000 0.000
#> GSM154280 2 0.9491 0.372 0.368 0.632
#> GSM154281 1 0.9922 0.252 0.552 0.448
#> GSM154282 2 0.9129 0.479 0.328 0.672
#> GSM154295 2 0.7745 0.686 0.228 0.772
#> GSM154296 2 0.2423 0.929 0.040 0.960
#> GSM154297 2 0.0938 0.950 0.012 0.988
#> GSM154310 2 0.6801 0.763 0.180 0.820
#> GSM154311 2 0.3879 0.894 0.076 0.924
#> GSM154312 2 0.2423 0.929 0.040 0.960
#> GSM154268 1 0.0000 0.900 1.000 0.000
#> GSM154269 1 0.0000 0.900 1.000 0.000
#> GSM154270 1 0.0000 0.900 1.000 0.000
#> GSM154283 2 0.0000 0.958 0.000 1.000
#> GSM154284 2 0.0000 0.958 0.000 1.000
#> GSM154285 2 0.0000 0.958 0.000 1.000
#> GSM154298 2 0.0000 0.958 0.000 1.000
#> GSM154299 2 0.0000 0.958 0.000 1.000
#> GSM154300 2 0.0000 0.958 0.000 1.000
#> GSM154313 2 0.0000 0.958 0.000 1.000
#> GSM154314 2 0.0000 0.958 0.000 1.000
#> GSM154315 2 0.0000 0.958 0.000 1.000
#> GSM154271 1 0.0000 0.900 1.000 0.000
#> GSM154272 1 0.0000 0.900 1.000 0.000
#> GSM154273 1 0.0000 0.900 1.000 0.000
#> GSM154286 1 0.0000 0.900 1.000 0.000
#> GSM154287 1 0.0000 0.900 1.000 0.000
#> GSM154288 2 0.0000 0.958 0.000 1.000
#> GSM154301 1 0.4939 0.819 0.892 0.108
#> GSM154302 1 0.7056 0.733 0.808 0.192
#> GSM154303 2 0.0000 0.958 0.000 1.000
#> GSM154316 1 0.9850 0.313 0.572 0.428
#> GSM154317 1 0.9732 0.375 0.596 0.404
#> GSM154318 1 0.9795 0.346 0.584 0.416
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> GSM154259 1 0.000 0.935 1.000 0.000 0.000
#> GSM154260 1 0.000 0.935 1.000 0.000 0.000
#> GSM154261 1 0.000 0.935 1.000 0.000 0.000
#> GSM154274 2 0.455 0.867 0.000 0.800 0.200
#> GSM154275 2 0.455 0.867 0.000 0.800 0.200
#> GSM154276 2 0.455 0.867 0.000 0.800 0.200
#> GSM154289 2 0.455 0.867 0.000 0.800 0.200
#> GSM154290 2 0.455 0.867 0.000 0.800 0.200
#> GSM154291 3 0.000 0.960 0.000 0.000 1.000
#> GSM154304 2 0.455 0.867 0.000 0.800 0.200
#> GSM154305 2 0.455 0.867 0.000 0.800 0.200
#> GSM154306 3 0.000 0.960 0.000 0.000 1.000
#> GSM154262 1 0.000 0.935 1.000 0.000 0.000
#> GSM154263 1 0.000 0.935 1.000 0.000 0.000
#> GSM154264 1 0.000 0.935 1.000 0.000 0.000
#> GSM154277 3 0.000 0.960 0.000 0.000 1.000
#> GSM154278 2 0.406 0.861 0.000 0.836 0.164
#> GSM154279 2 0.455 0.867 0.000 0.800 0.200
#> GSM154292 2 0.455 0.867 0.000 0.800 0.200
#> GSM154293 2 0.455 0.867 0.000 0.800 0.200
#> GSM154294 3 0.000 0.960 0.000 0.000 1.000
#> GSM154307 2 0.440 0.866 0.000 0.812 0.188
#> GSM154308 2 0.455 0.867 0.000 0.800 0.200
#> GSM154309 2 0.455 0.867 0.000 0.800 0.200
#> GSM154265 1 0.000 0.935 1.000 0.000 0.000
#> GSM154266 1 0.000 0.935 1.000 0.000 0.000
#> GSM154267 1 0.000 0.935 1.000 0.000 0.000
#> GSM154280 2 0.000 0.796 0.000 1.000 0.000
#> GSM154281 2 0.000 0.796 0.000 1.000 0.000
#> GSM154282 2 0.000 0.796 0.000 1.000 0.000
#> GSM154295 2 0.000 0.796 0.000 1.000 0.000
#> GSM154296 2 0.000 0.796 0.000 1.000 0.000
#> GSM154297 2 0.000 0.796 0.000 1.000 0.000
#> GSM154310 2 0.000 0.796 0.000 1.000 0.000
#> GSM154311 2 0.000 0.796 0.000 1.000 0.000
#> GSM154312 2 0.000 0.796 0.000 1.000 0.000
#> GSM154268 1 0.000 0.935 1.000 0.000 0.000
#> GSM154269 1 0.000 0.935 1.000 0.000 0.000
#> GSM154270 1 0.000 0.935 1.000 0.000 0.000
#> GSM154283 2 0.418 0.863 0.000 0.828 0.172
#> GSM154284 2 0.455 0.867 0.000 0.800 0.200
#> GSM154285 2 0.455 0.867 0.000 0.800 0.200
#> GSM154298 2 0.418 0.863 0.000 0.828 0.172
#> GSM154299 2 0.455 0.867 0.000 0.800 0.200
#> GSM154300 2 0.455 0.867 0.000 0.800 0.200
#> GSM154313 2 0.263 0.832 0.000 0.916 0.084
#> GSM154314 2 0.455 0.867 0.000 0.800 0.200
#> GSM154315 3 0.000 0.960 0.000 0.000 1.000
#> GSM154271 1 0.000 0.935 1.000 0.000 0.000
#> GSM154272 1 0.000 0.935 1.000 0.000 0.000
#> GSM154273 1 0.000 0.935 1.000 0.000 0.000
#> GSM154286 1 0.455 0.774 0.800 0.200 0.000
#> GSM154287 1 0.455 0.774 0.800 0.200 0.000
#> GSM154288 3 0.000 0.960 0.000 0.000 1.000
#> GSM154301 1 0.579 0.599 0.668 0.332 0.000
#> GSM154302 1 0.546 0.667 0.712 0.288 0.000
#> GSM154303 3 0.429 0.742 0.000 0.180 0.820
#> GSM154316 2 0.546 0.407 0.288 0.712 0.000
#> GSM154317 2 0.460 0.550 0.204 0.796 0.000
#> GSM154318 2 0.628 -0.161 0.460 0.540 0.000
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> GSM154259 1 0.0000 1.000 1.000 0.000 0.000 0.000
#> GSM154260 1 0.0000 1.000 1.000 0.000 0.000 0.000
#> GSM154261 1 0.0000 1.000 1.000 0.000 0.000 0.000
#> GSM154274 2 0.0000 0.925 0.000 1.000 0.000 0.000
#> GSM154275 2 0.0469 0.924 0.000 0.988 0.000 0.012
#> GSM154276 2 0.0469 0.924 0.000 0.988 0.000 0.012
#> GSM154289 2 0.1716 0.910 0.000 0.936 0.000 0.064
#> GSM154290 2 0.1940 0.905 0.000 0.924 0.000 0.076
#> GSM154291 4 0.1940 0.932 0.000 0.076 0.000 0.924
#> GSM154304 2 0.2011 0.903 0.000 0.920 0.000 0.080
#> GSM154305 2 0.2011 0.903 0.000 0.920 0.000 0.080
#> GSM154306 4 0.1867 0.934 0.000 0.072 0.000 0.928
#> GSM154262 1 0.0000 1.000 1.000 0.000 0.000 0.000
#> GSM154263 1 0.0000 1.000 1.000 0.000 0.000 0.000
#> GSM154264 1 0.0000 1.000 1.000 0.000 0.000 0.000
#> GSM154277 4 0.2589 0.883 0.000 0.116 0.000 0.884
#> GSM154278 2 0.1109 0.915 0.000 0.968 0.028 0.004
#> GSM154279 2 0.0469 0.924 0.000 0.988 0.000 0.012
#> GSM154292 2 0.0000 0.925 0.000 1.000 0.000 0.000
#> GSM154293 2 0.0469 0.924 0.000 0.988 0.000 0.012
#> GSM154294 4 0.1474 0.940 0.000 0.052 0.000 0.948
#> GSM154307 2 0.4688 0.795 0.000 0.792 0.128 0.080
#> GSM154308 2 0.2197 0.901 0.000 0.916 0.004 0.080
#> GSM154309 2 0.2915 0.891 0.000 0.892 0.028 0.080
#> GSM154265 1 0.0000 1.000 1.000 0.000 0.000 0.000
#> GSM154266 1 0.0000 1.000 1.000 0.000 0.000 0.000
#> GSM154267 1 0.0000 1.000 1.000 0.000 0.000 0.000
#> GSM154280 2 0.6428 0.519 0.084 0.648 0.256 0.012
#> GSM154281 3 0.4295 0.646 0.000 0.240 0.752 0.008
#> GSM154282 2 0.5764 0.672 0.112 0.736 0.140 0.012
#> GSM154295 3 0.0000 0.939 0.000 0.000 1.000 0.000
#> GSM154296 3 0.1211 0.912 0.000 0.040 0.960 0.000
#> GSM154297 3 0.1211 0.912 0.000 0.040 0.960 0.000
#> GSM154310 3 0.0000 0.939 0.000 0.000 1.000 0.000
#> GSM154311 3 0.0188 0.938 0.000 0.000 0.996 0.004
#> GSM154312 3 0.0000 0.939 0.000 0.000 1.000 0.000
#> GSM154268 1 0.0000 1.000 1.000 0.000 0.000 0.000
#> GSM154269 1 0.0000 1.000 1.000 0.000 0.000 0.000
#> GSM154270 1 0.0000 1.000 1.000 0.000 0.000 0.000
#> GSM154283 2 0.0672 0.923 0.000 0.984 0.008 0.008
#> GSM154284 2 0.0469 0.924 0.000 0.988 0.000 0.012
#> GSM154285 2 0.0779 0.921 0.000 0.980 0.004 0.016
#> GSM154298 2 0.0000 0.925 0.000 1.000 0.000 0.000
#> GSM154299 2 0.0188 0.925 0.000 0.996 0.000 0.004
#> GSM154300 2 0.0336 0.924 0.000 0.992 0.000 0.008
#> GSM154313 2 0.2586 0.901 0.000 0.912 0.040 0.048
#> GSM154314 2 0.2011 0.903 0.000 0.920 0.000 0.080
#> GSM154315 4 0.0336 0.937 0.000 0.008 0.000 0.992
#> GSM154271 1 0.0000 1.000 1.000 0.000 0.000 0.000
#> GSM154272 1 0.0000 1.000 1.000 0.000 0.000 0.000
#> GSM154273 1 0.0000 1.000 1.000 0.000 0.000 0.000
#> GSM154286 3 0.4356 0.584 0.292 0.000 0.708 0.000
#> GSM154287 3 0.0188 0.937 0.004 0.000 0.996 0.000
#> GSM154288 4 0.0188 0.935 0.000 0.000 0.004 0.996
#> GSM154301 3 0.0188 0.938 0.000 0.000 0.996 0.004
#> GSM154302 3 0.0000 0.939 0.000 0.000 1.000 0.000
#> GSM154303 4 0.1118 0.916 0.000 0.000 0.036 0.964
#> GSM154316 3 0.0188 0.938 0.000 0.000 0.996 0.004
#> GSM154317 3 0.0000 0.939 0.000 0.000 1.000 0.000
#> GSM154318 3 0.0000 0.939 0.000 0.000 1.000 0.000
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> GSM154259 1 0.0693 0.986 0.980 0.000 0.008 0.000 0.012
#> GSM154260 1 0.0609 0.985 0.980 0.000 0.000 0.000 0.020
#> GSM154261 1 0.0609 0.985 0.980 0.000 0.000 0.000 0.020
#> GSM154274 5 0.2127 0.864 0.000 0.108 0.000 0.000 0.892
#> GSM154275 5 0.2930 0.808 0.004 0.164 0.000 0.000 0.832
#> GSM154276 5 0.2280 0.853 0.000 0.120 0.000 0.000 0.880
#> GSM154289 2 0.0290 0.950 0.000 0.992 0.000 0.000 0.008
#> GSM154290 2 0.0290 0.950 0.000 0.992 0.000 0.000 0.008
#> GSM154291 4 0.2966 0.799 0.000 0.184 0.000 0.816 0.000
#> GSM154304 2 0.0404 0.949 0.000 0.988 0.000 0.012 0.000
#> GSM154305 2 0.0404 0.949 0.000 0.988 0.000 0.012 0.000
#> GSM154306 4 0.3003 0.795 0.000 0.188 0.000 0.812 0.000
#> GSM154262 1 0.0290 0.990 0.992 0.000 0.000 0.000 0.008
#> GSM154263 1 0.0000 0.991 1.000 0.000 0.000 0.000 0.000
#> GSM154264 1 0.0404 0.988 0.988 0.000 0.000 0.000 0.012
#> GSM154277 4 0.3730 0.582 0.000 0.000 0.000 0.712 0.288
#> GSM154278 5 0.1121 0.882 0.000 0.044 0.000 0.000 0.956
#> GSM154279 5 0.0703 0.878 0.000 0.024 0.000 0.000 0.976
#> GSM154292 5 0.4305 0.148 0.000 0.488 0.000 0.000 0.512
#> GSM154293 2 0.2813 0.783 0.000 0.832 0.000 0.000 0.168
#> GSM154294 4 0.0963 0.874 0.000 0.036 0.000 0.964 0.000
#> GSM154307 2 0.0324 0.948 0.000 0.992 0.004 0.004 0.000
#> GSM154308 2 0.0162 0.950 0.000 0.996 0.000 0.004 0.000
#> GSM154309 2 0.0162 0.950 0.000 0.996 0.000 0.004 0.000
#> GSM154265 1 0.0451 0.989 0.988 0.000 0.004 0.000 0.008
#> GSM154266 1 0.0000 0.991 1.000 0.000 0.000 0.000 0.000
#> GSM154267 1 0.0162 0.990 0.996 0.000 0.000 0.000 0.004
#> GSM154280 5 0.0771 0.865 0.000 0.004 0.020 0.000 0.976
#> GSM154281 5 0.1041 0.863 0.000 0.004 0.032 0.000 0.964
#> GSM154282 5 0.0771 0.865 0.000 0.004 0.020 0.000 0.976
#> GSM154295 3 0.0963 0.861 0.000 0.000 0.964 0.000 0.036
#> GSM154296 3 0.4227 0.381 0.000 0.000 0.580 0.000 0.420
#> GSM154297 3 0.4249 0.353 0.000 0.000 0.568 0.000 0.432
#> GSM154310 3 0.1197 0.856 0.000 0.000 0.952 0.000 0.048
#> GSM154311 3 0.0162 0.867 0.000 0.000 0.996 0.000 0.004
#> GSM154312 3 0.0510 0.866 0.000 0.000 0.984 0.000 0.016
#> GSM154268 1 0.0000 0.991 1.000 0.000 0.000 0.000 0.000
#> GSM154269 1 0.0451 0.989 0.988 0.000 0.004 0.000 0.008
#> GSM154270 1 0.0404 0.988 0.988 0.000 0.000 0.000 0.012
#> GSM154283 5 0.1197 0.882 0.000 0.048 0.000 0.000 0.952
#> GSM154284 5 0.1121 0.882 0.000 0.044 0.000 0.000 0.956
#> GSM154285 5 0.0510 0.876 0.000 0.016 0.000 0.000 0.984
#> GSM154298 2 0.2852 0.767 0.000 0.828 0.000 0.000 0.172
#> GSM154299 5 0.2127 0.864 0.000 0.108 0.000 0.000 0.892
#> GSM154300 5 0.3932 0.598 0.000 0.328 0.000 0.000 0.672
#> GSM154313 2 0.0451 0.951 0.000 0.988 0.000 0.004 0.008
#> GSM154314 2 0.0451 0.951 0.000 0.988 0.000 0.004 0.008
#> GSM154315 4 0.0000 0.877 0.000 0.000 0.000 1.000 0.000
#> GSM154271 1 0.0290 0.990 0.992 0.000 0.000 0.000 0.008
#> GSM154272 1 0.0451 0.989 0.988 0.000 0.004 0.000 0.008
#> GSM154273 1 0.0404 0.988 0.988 0.000 0.000 0.000 0.012
#> GSM154286 3 0.6303 0.438 0.204 0.000 0.528 0.000 0.268
#> GSM154287 3 0.0162 0.867 0.000 0.000 0.996 0.000 0.004
#> GSM154288 4 0.0000 0.877 0.000 0.000 0.000 1.000 0.000
#> GSM154301 3 0.0162 0.863 0.000 0.000 0.996 0.000 0.004
#> GSM154302 3 0.0880 0.862 0.000 0.000 0.968 0.000 0.032
#> GSM154303 4 0.0290 0.874 0.000 0.000 0.008 0.992 0.000
#> GSM154316 3 0.0000 0.865 0.000 0.000 1.000 0.000 0.000
#> GSM154317 3 0.0162 0.867 0.000 0.000 0.996 0.000 0.004
#> GSM154318 3 0.0000 0.865 0.000 0.000 1.000 0.000 0.000
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> GSM154259 1 0.3975 0.577 0.544 0.000 0.004 0.000 0.000 0.452
#> GSM154260 1 0.3175 0.756 0.744 0.000 0.000 0.000 0.000 0.256
#> GSM154261 1 0.3175 0.756 0.744 0.000 0.000 0.000 0.000 0.256
#> GSM154274 5 0.2431 0.782 0.000 0.008 0.000 0.000 0.860 0.132
#> GSM154275 5 0.4407 0.577 0.004 0.024 0.000 0.000 0.592 0.380
#> GSM154276 5 0.3699 0.641 0.000 0.004 0.000 0.000 0.660 0.336
#> GSM154289 2 0.2730 0.872 0.000 0.836 0.000 0.000 0.012 0.152
#> GSM154290 2 0.2653 0.878 0.000 0.844 0.000 0.000 0.012 0.144
#> GSM154291 4 0.2830 0.802 0.000 0.144 0.000 0.836 0.000 0.020
#> GSM154304 2 0.1267 0.930 0.000 0.940 0.000 0.000 0.000 0.060
#> GSM154305 2 0.1267 0.930 0.000 0.940 0.000 0.000 0.000 0.060
#> GSM154306 4 0.3168 0.762 0.000 0.192 0.000 0.792 0.000 0.016
#> GSM154262 1 0.2597 0.831 0.824 0.000 0.000 0.000 0.000 0.176
#> GSM154263 1 0.0146 0.880 0.996 0.000 0.000 0.000 0.000 0.004
#> GSM154264 1 0.0937 0.878 0.960 0.000 0.000 0.000 0.000 0.040
#> GSM154277 4 0.3636 0.494 0.000 0.000 0.000 0.676 0.320 0.004
#> GSM154278 5 0.1010 0.813 0.000 0.004 0.000 0.000 0.960 0.036
#> GSM154279 5 0.0713 0.811 0.000 0.000 0.000 0.000 0.972 0.028
#> GSM154292 5 0.3641 0.707 0.000 0.224 0.000 0.000 0.748 0.028
#> GSM154293 5 0.4371 0.474 0.000 0.392 0.000 0.000 0.580 0.028
#> GSM154294 4 0.0937 0.865 0.000 0.040 0.000 0.960 0.000 0.000
#> GSM154307 2 0.0508 0.937 0.000 0.984 0.004 0.000 0.000 0.012
#> GSM154308 2 0.0000 0.939 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM154309 2 0.0291 0.939 0.000 0.992 0.004 0.000 0.000 0.004
#> GSM154265 1 0.2003 0.857 0.884 0.000 0.000 0.000 0.000 0.116
#> GSM154266 1 0.0260 0.880 0.992 0.000 0.000 0.000 0.000 0.008
#> GSM154267 1 0.0547 0.879 0.980 0.000 0.000 0.000 0.000 0.020
#> GSM154280 5 0.2019 0.776 0.000 0.000 0.088 0.000 0.900 0.012
#> GSM154281 5 0.1500 0.799 0.000 0.000 0.052 0.000 0.936 0.012
#> GSM154282 5 0.1049 0.808 0.000 0.000 0.032 0.000 0.960 0.008
#> GSM154295 3 0.0146 0.960 0.000 0.000 0.996 0.000 0.004 0.000
#> GSM154296 3 0.2301 0.886 0.000 0.000 0.884 0.000 0.096 0.020
#> GSM154297 3 0.2301 0.886 0.000 0.000 0.884 0.000 0.096 0.020
#> GSM154310 3 0.0363 0.958 0.000 0.000 0.988 0.000 0.000 0.012
#> GSM154311 3 0.0260 0.959 0.000 0.000 0.992 0.000 0.000 0.008
#> GSM154312 3 0.0260 0.959 0.000 0.000 0.992 0.000 0.000 0.008
#> GSM154268 1 0.0260 0.880 0.992 0.000 0.000 0.000 0.000 0.008
#> GSM154269 1 0.3515 0.719 0.676 0.000 0.000 0.000 0.000 0.324
#> GSM154270 1 0.1556 0.864 0.920 0.000 0.000 0.000 0.000 0.080
#> GSM154283 5 0.0891 0.812 0.000 0.008 0.000 0.000 0.968 0.024
#> GSM154284 5 0.0260 0.812 0.000 0.000 0.000 0.000 0.992 0.008
#> GSM154285 5 0.0458 0.812 0.000 0.000 0.000 0.000 0.984 0.016
#> GSM154298 5 0.5528 0.404 0.000 0.348 0.000 0.000 0.508 0.144
#> GSM154299 5 0.2179 0.801 0.000 0.064 0.000 0.000 0.900 0.036
#> GSM154300 5 0.4139 0.542 0.000 0.336 0.000 0.000 0.640 0.024
#> GSM154313 2 0.0692 0.933 0.000 0.976 0.004 0.000 0.000 0.020
#> GSM154314 2 0.0922 0.929 0.000 0.968 0.004 0.000 0.004 0.024
#> GSM154315 4 0.0000 0.870 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM154271 1 0.1204 0.874 0.944 0.000 0.000 0.000 0.000 0.056
#> GSM154272 1 0.1765 0.864 0.904 0.000 0.000 0.000 0.000 0.096
#> GSM154273 1 0.1863 0.855 0.896 0.000 0.000 0.000 0.000 0.104
#> GSM154286 3 0.2467 0.908 0.020 0.000 0.896 0.000 0.036 0.048
#> GSM154287 3 0.1387 0.934 0.000 0.000 0.932 0.000 0.000 0.068
#> GSM154288 4 0.0000 0.870 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM154301 3 0.1141 0.943 0.000 0.000 0.948 0.000 0.000 0.052
#> GSM154302 3 0.0260 0.960 0.000 0.000 0.992 0.000 0.000 0.008
#> GSM154303 4 0.0000 0.870 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM154316 3 0.0632 0.954 0.000 0.000 0.976 0.000 0.000 0.024
#> GSM154317 3 0.0146 0.960 0.000 0.000 0.996 0.000 0.000 0.004
#> GSM154318 3 0.0146 0.960 0.000 0.000 0.996 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 agent(p) time(p) k
#> SD:NMF 54 0.066014 1.66e-08 2
#> SD:NMF 58 0.129126 1.32e-07 3
#> SD:NMF 60 0.000707 4.01e-10 4
#> SD:NMF 56 0.012809 3.87e-14 5
#> SD:NMF 57 0.007960 3.71e-14 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 38950 rows and 60 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 1.000 1.000 1.000 0.2104 0.790 0.790
#> 3 3 0.811 0.718 0.892 1.6784 0.605 0.500
#> 4 4 0.666 0.791 0.890 0.1419 0.889 0.748
#> 5 5 0.631 0.760 0.875 0.0175 0.997 0.991
#> 6 6 0.704 0.697 0.850 0.1248 0.941 0.839
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
#> GSM154259 2 0 1 0 1
#> GSM154260 2 0 1 0 1
#> GSM154261 2 0 1 0 1
#> GSM154274 2 0 1 0 1
#> GSM154275 2 0 1 0 1
#> GSM154276 2 0 1 0 1
#> GSM154289 2 0 1 0 1
#> GSM154290 2 0 1 0 1
#> GSM154291 1 0 1 1 0
#> GSM154304 2 0 1 0 1
#> GSM154305 2 0 1 0 1
#> GSM154306 1 0 1 1 0
#> GSM154262 2 0 1 0 1
#> GSM154263 2 0 1 0 1
#> GSM154264 2 0 1 0 1
#> GSM154277 1 0 1 1 0
#> GSM154278 2 0 1 0 1
#> GSM154279 2 0 1 0 1
#> GSM154292 2 0 1 0 1
#> GSM154293 2 0 1 0 1
#> GSM154294 1 0 1 1 0
#> GSM154307 2 0 1 0 1
#> GSM154308 2 0 1 0 1
#> GSM154309 2 0 1 0 1
#> GSM154265 2 0 1 0 1
#> GSM154266 2 0 1 0 1
#> GSM154267 2 0 1 0 1
#> GSM154280 2 0 1 0 1
#> GSM154281 2 0 1 0 1
#> GSM154282 2 0 1 0 1
#> GSM154295 2 0 1 0 1
#> GSM154296 2 0 1 0 1
#> GSM154297 2 0 1 0 1
#> GSM154310 2 0 1 0 1
#> GSM154311 2 0 1 0 1
#> GSM154312 2 0 1 0 1
#> GSM154268 2 0 1 0 1
#> GSM154269 2 0 1 0 1
#> GSM154270 2 0 1 0 1
#> GSM154283 2 0 1 0 1
#> GSM154284 2 0 1 0 1
#> GSM154285 2 0 1 0 1
#> GSM154298 2 0 1 0 1
#> GSM154299 2 0 1 0 1
#> GSM154300 2 0 1 0 1
#> GSM154313 2 0 1 0 1
#> GSM154314 2 0 1 0 1
#> GSM154315 1 0 1 1 0
#> GSM154271 2 0 1 0 1
#> GSM154272 2 0 1 0 1
#> GSM154273 2 0 1 0 1
#> GSM154286 2 0 1 0 1
#> GSM154287 2 0 1 0 1
#> GSM154288 1 0 1 1 0
#> GSM154301 2 0 1 0 1
#> GSM154302 2 0 1 0 1
#> GSM154303 1 0 1 1 0
#> GSM154316 2 0 1 0 1
#> GSM154317 2 0 1 0 1
#> GSM154318 2 0 1 0 1
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> GSM154259 1 0.631 0.615 0.508 0.492 0
#> GSM154260 1 0.631 0.615 0.508 0.492 0
#> GSM154261 1 0.631 0.615 0.508 0.492 0
#> GSM154274 2 0.631 0.999 0.496 0.504 0
#> GSM154275 2 0.631 0.995 0.492 0.508 0
#> GSM154276 2 0.631 0.999 0.496 0.504 0
#> GSM154289 2 0.631 0.995 0.492 0.508 0
#> GSM154290 2 0.631 0.995 0.492 0.508 0
#> GSM154291 3 0.000 1.000 0.000 0.000 1
#> GSM154304 2 0.631 0.995 0.492 0.508 0
#> GSM154305 2 0.631 0.995 0.492 0.508 0
#> GSM154306 3 0.000 1.000 0.000 0.000 1
#> GSM154262 1 0.631 0.615 0.508 0.492 0
#> GSM154263 1 0.631 0.615 0.508 0.492 0
#> GSM154264 1 0.631 0.615 0.508 0.492 0
#> GSM154277 3 0.000 1.000 0.000 0.000 1
#> GSM154278 2 0.631 0.999 0.496 0.504 0
#> GSM154279 2 0.631 0.999 0.496 0.504 0
#> GSM154292 2 0.631 0.999 0.496 0.504 0
#> GSM154293 2 0.631 0.999 0.496 0.504 0
#> GSM154294 3 0.000 1.000 0.000 0.000 1
#> GSM154307 2 0.631 0.999 0.496 0.504 0
#> GSM154308 2 0.631 0.999 0.496 0.504 0
#> GSM154309 2 0.631 0.999 0.496 0.504 0
#> GSM154265 1 0.631 0.615 0.508 0.492 0
#> GSM154266 1 0.631 0.615 0.508 0.492 0
#> GSM154267 1 0.631 0.615 0.508 0.492 0
#> GSM154280 1 0.631 -0.983 0.508 0.492 0
#> GSM154281 1 0.631 -0.983 0.508 0.492 0
#> GSM154282 1 0.631 -0.983 0.508 0.492 0
#> GSM154295 2 0.631 0.999 0.496 0.504 0
#> GSM154296 2 0.631 0.999 0.496 0.504 0
#> GSM154297 2 0.631 0.999 0.496 0.504 0
#> GSM154310 2 0.631 0.999 0.496 0.504 0
#> GSM154311 2 0.631 0.999 0.496 0.504 0
#> GSM154312 2 0.631 0.999 0.496 0.504 0
#> GSM154268 1 0.631 0.615 0.508 0.492 0
#> GSM154269 1 0.631 0.615 0.508 0.492 0
#> GSM154270 1 0.631 0.615 0.508 0.492 0
#> GSM154283 2 0.631 0.999 0.496 0.504 0
#> GSM154284 2 0.631 0.999 0.496 0.504 0
#> GSM154285 2 0.631 0.999 0.496 0.504 0
#> GSM154298 2 0.631 0.999 0.496 0.504 0
#> GSM154299 2 0.631 0.999 0.496 0.504 0
#> GSM154300 2 0.631 0.995 0.492 0.508 0
#> GSM154313 2 0.631 0.999 0.496 0.504 0
#> GSM154314 2 0.631 0.999 0.496 0.504 0
#> GSM154315 3 0.000 1.000 0.000 0.000 1
#> GSM154271 1 0.631 0.615 0.508 0.492 0
#> GSM154272 1 0.631 0.615 0.508 0.492 0
#> GSM154273 1 0.631 0.615 0.508 0.492 0
#> GSM154286 1 0.000 0.266 1.000 0.000 0
#> GSM154287 1 0.000 0.266 1.000 0.000 0
#> GSM154288 3 0.000 1.000 0.000 0.000 1
#> GSM154301 1 0.000 0.266 1.000 0.000 0
#> GSM154302 1 0.000 0.266 1.000 0.000 0
#> GSM154303 3 0.000 1.000 0.000 0.000 1
#> GSM154316 1 0.000 0.266 1.000 0.000 0
#> GSM154317 1 0.000 0.266 1.000 0.000 0
#> GSM154318 1 0.000 0.266 1.000 0.000 0
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> GSM154259 1 0.0000 0.777 1.000 0.000 0.000 0.000
#> GSM154260 1 0.0000 0.777 1.000 0.000 0.000 0.000
#> GSM154261 1 0.0000 0.777 1.000 0.000 0.000 0.000
#> GSM154274 2 0.3649 0.867 0.000 0.796 0.204 0.000
#> GSM154275 2 0.4477 0.779 0.000 0.688 0.312 0.000
#> GSM154276 2 0.3649 0.867 0.000 0.796 0.204 0.000
#> GSM154289 2 0.4543 0.769 0.000 0.676 0.324 0.000
#> GSM154290 2 0.4477 0.779 0.000 0.688 0.312 0.000
#> GSM154291 4 0.0000 0.999 0.000 0.000 0.000 1.000
#> GSM154304 2 0.4585 0.762 0.000 0.668 0.332 0.000
#> GSM154305 3 0.1022 0.993 0.000 0.032 0.968 0.000
#> GSM154306 4 0.0000 0.999 0.000 0.000 0.000 1.000
#> GSM154262 1 0.0000 0.777 1.000 0.000 0.000 0.000
#> GSM154263 1 0.0000 0.777 1.000 0.000 0.000 0.000
#> GSM154264 1 0.0000 0.777 1.000 0.000 0.000 0.000
#> GSM154277 4 0.0336 0.993 0.000 0.000 0.008 0.992
#> GSM154278 2 0.3649 0.867 0.000 0.796 0.204 0.000
#> GSM154279 2 0.3649 0.867 0.000 0.796 0.204 0.000
#> GSM154292 2 0.3801 0.864 0.000 0.780 0.220 0.000
#> GSM154293 2 0.3801 0.864 0.000 0.780 0.220 0.000
#> GSM154294 4 0.0000 0.999 0.000 0.000 0.000 1.000
#> GSM154307 2 0.3801 0.864 0.000 0.780 0.220 0.000
#> GSM154308 2 0.3801 0.864 0.000 0.780 0.220 0.000
#> GSM154309 2 0.3801 0.864 0.000 0.780 0.220 0.000
#> GSM154265 1 0.0000 0.777 1.000 0.000 0.000 0.000
#> GSM154266 1 0.0000 0.777 1.000 0.000 0.000 0.000
#> GSM154267 1 0.0000 0.777 1.000 0.000 0.000 0.000
#> GSM154280 2 0.0469 0.757 0.012 0.988 0.000 0.000
#> GSM154281 2 0.0469 0.757 0.012 0.988 0.000 0.000
#> GSM154282 2 0.0469 0.757 0.012 0.988 0.000 0.000
#> GSM154295 2 0.0707 0.751 0.000 0.980 0.020 0.000
#> GSM154296 2 0.0707 0.751 0.000 0.980 0.020 0.000
#> GSM154297 2 0.0707 0.751 0.000 0.980 0.020 0.000
#> GSM154310 2 0.0707 0.751 0.000 0.980 0.020 0.000
#> GSM154311 2 0.0707 0.751 0.000 0.980 0.020 0.000
#> GSM154312 2 0.0707 0.751 0.000 0.980 0.020 0.000
#> GSM154268 1 0.0000 0.777 1.000 0.000 0.000 0.000
#> GSM154269 1 0.0000 0.777 1.000 0.000 0.000 0.000
#> GSM154270 1 0.0000 0.777 1.000 0.000 0.000 0.000
#> GSM154283 2 0.3726 0.867 0.000 0.788 0.212 0.000
#> GSM154284 2 0.3726 0.867 0.000 0.788 0.212 0.000
#> GSM154285 2 0.3726 0.867 0.000 0.788 0.212 0.000
#> GSM154298 2 0.3726 0.867 0.000 0.788 0.212 0.000
#> GSM154299 2 0.3726 0.867 0.000 0.788 0.212 0.000
#> GSM154300 3 0.1118 0.993 0.000 0.036 0.964 0.000
#> GSM154313 2 0.3764 0.865 0.000 0.784 0.216 0.000
#> GSM154314 2 0.3764 0.865 0.000 0.784 0.216 0.000
#> GSM154315 4 0.0000 0.999 0.000 0.000 0.000 1.000
#> GSM154271 1 0.0000 0.777 1.000 0.000 0.000 0.000
#> GSM154272 1 0.0000 0.777 1.000 0.000 0.000 0.000
#> GSM154273 1 0.0000 0.777 1.000 0.000 0.000 0.000
#> GSM154286 1 0.5695 0.442 0.500 0.476 0.024 0.000
#> GSM154287 1 0.5695 0.442 0.500 0.476 0.024 0.000
#> GSM154288 4 0.0000 0.999 0.000 0.000 0.000 1.000
#> GSM154301 1 0.5695 0.442 0.500 0.476 0.024 0.000
#> GSM154302 1 0.5695 0.442 0.500 0.476 0.024 0.000
#> GSM154303 4 0.0000 0.999 0.000 0.000 0.000 1.000
#> GSM154316 1 0.5695 0.442 0.500 0.476 0.024 0.000
#> GSM154317 1 0.5695 0.442 0.500 0.476 0.024 0.000
#> GSM154318 1 0.5695 0.442 0.500 0.476 0.024 0.000
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> GSM154259 1 0.0000 0.762 1.000 0.000 0.000 0.000 0.000
#> GSM154260 1 0.0000 0.762 1.000 0.000 0.000 0.000 0.000
#> GSM154261 1 0.0000 0.762 1.000 0.000 0.000 0.000 0.000
#> GSM154274 5 0.0000 0.859 0.000 0.000 0.000 0.000 1.000
#> GSM154275 5 0.2127 0.786 0.000 0.108 0.000 0.000 0.892
#> GSM154276 5 0.0000 0.859 0.000 0.000 0.000 0.000 1.000
#> GSM154289 5 0.2690 0.768 0.000 0.156 0.000 0.000 0.844
#> GSM154290 5 0.2561 0.777 0.000 0.144 0.000 0.000 0.856
#> GSM154291 4 0.0000 0.999 0.000 0.000 0.000 1.000 0.000
#> GSM154304 5 0.3636 0.704 0.000 0.272 0.000 0.000 0.728
#> GSM154305 2 0.1792 0.681 0.000 0.916 0.000 0.000 0.084
#> GSM154306 4 0.0000 0.999 0.000 0.000 0.000 1.000 0.000
#> GSM154262 1 0.0000 0.762 1.000 0.000 0.000 0.000 0.000
#> GSM154263 1 0.0000 0.762 1.000 0.000 0.000 0.000 0.000
#> GSM154264 1 0.0000 0.762 1.000 0.000 0.000 0.000 0.000
#> GSM154277 3 0.4309 0.000 0.000 0.084 0.768 0.148 0.000
#> GSM154278 5 0.0000 0.859 0.000 0.000 0.000 0.000 1.000
#> GSM154279 5 0.0000 0.859 0.000 0.000 0.000 0.000 1.000
#> GSM154292 5 0.0794 0.856 0.000 0.028 0.000 0.000 0.972
#> GSM154293 5 0.0794 0.856 0.000 0.028 0.000 0.000 0.972
#> GSM154294 4 0.0162 0.995 0.000 0.004 0.000 0.996 0.000
#> GSM154307 5 0.2329 0.833 0.000 0.124 0.000 0.000 0.876
#> GSM154308 5 0.2329 0.833 0.000 0.124 0.000 0.000 0.876
#> GSM154309 5 0.2329 0.833 0.000 0.124 0.000 0.000 0.876
#> GSM154265 1 0.0000 0.762 1.000 0.000 0.000 0.000 0.000
#> GSM154266 1 0.0000 0.762 1.000 0.000 0.000 0.000 0.000
#> GSM154267 1 0.0000 0.762 1.000 0.000 0.000 0.000 0.000
#> GSM154280 5 0.3530 0.788 0.012 0.000 0.204 0.000 0.784
#> GSM154281 5 0.3530 0.788 0.012 0.000 0.204 0.000 0.784
#> GSM154282 5 0.3530 0.788 0.012 0.000 0.204 0.000 0.784
#> GSM154295 5 0.3305 0.784 0.000 0.000 0.224 0.000 0.776
#> GSM154296 5 0.3305 0.784 0.000 0.000 0.224 0.000 0.776
#> GSM154297 5 0.3305 0.784 0.000 0.000 0.224 0.000 0.776
#> GSM154310 5 0.3305 0.784 0.000 0.000 0.224 0.000 0.776
#> GSM154311 5 0.3305 0.784 0.000 0.000 0.224 0.000 0.776
#> GSM154312 5 0.3305 0.784 0.000 0.000 0.224 0.000 0.776
#> GSM154268 1 0.0000 0.762 1.000 0.000 0.000 0.000 0.000
#> GSM154269 1 0.0000 0.762 1.000 0.000 0.000 0.000 0.000
#> GSM154270 1 0.0000 0.762 1.000 0.000 0.000 0.000 0.000
#> GSM154283 5 0.0290 0.858 0.000 0.008 0.000 0.000 0.992
#> GSM154284 5 0.0290 0.858 0.000 0.008 0.000 0.000 0.992
#> GSM154285 5 0.0290 0.858 0.000 0.008 0.000 0.000 0.992
#> GSM154298 5 0.0290 0.858 0.000 0.008 0.000 0.000 0.992
#> GSM154299 5 0.0290 0.858 0.000 0.008 0.000 0.000 0.992
#> GSM154300 2 0.3366 0.702 0.000 0.768 0.000 0.000 0.232
#> GSM154313 5 0.2020 0.842 0.000 0.100 0.000 0.000 0.900
#> GSM154314 5 0.2020 0.842 0.000 0.100 0.000 0.000 0.900
#> GSM154315 4 0.0000 0.999 0.000 0.000 0.000 1.000 0.000
#> GSM154271 1 0.0000 0.762 1.000 0.000 0.000 0.000 0.000
#> GSM154272 1 0.0000 0.762 1.000 0.000 0.000 0.000 0.000
#> GSM154273 1 0.0000 0.762 1.000 0.000 0.000 0.000 0.000
#> GSM154286 1 0.6467 0.439 0.496 0.000 0.232 0.000 0.272
#> GSM154287 1 0.6467 0.439 0.496 0.000 0.232 0.000 0.272
#> GSM154288 4 0.0000 0.999 0.000 0.000 0.000 1.000 0.000
#> GSM154301 1 0.6467 0.439 0.496 0.000 0.232 0.000 0.272
#> GSM154302 1 0.6467 0.439 0.496 0.000 0.232 0.000 0.272
#> GSM154303 4 0.0000 0.999 0.000 0.000 0.000 1.000 0.000
#> GSM154316 1 0.6467 0.439 0.496 0.000 0.232 0.000 0.272
#> GSM154317 1 0.6467 0.439 0.496 0.000 0.232 0.000 0.272
#> GSM154318 1 0.6467 0.439 0.496 0.000 0.232 0.000 0.272
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> GSM154259 1 0.3866 0.473 0.516 0.000 0.000 0.000 0.000 0.484
#> GSM154260 1 0.3866 0.714 0.516 0.000 0.484 0.000 0.000 0.000
#> GSM154261 1 0.3866 0.714 0.516 0.000 0.484 0.000 0.000 0.000
#> GSM154274 5 0.0547 0.746 0.000 0.000 0.020 0.000 0.980 0.000
#> GSM154275 5 0.2358 0.678 0.000 0.108 0.016 0.000 0.876 0.000
#> GSM154276 5 0.0547 0.746 0.000 0.000 0.020 0.000 0.980 0.000
#> GSM154289 5 0.2697 0.649 0.000 0.188 0.000 0.000 0.812 0.000
#> GSM154290 5 0.3037 0.659 0.000 0.176 0.016 0.000 0.808 0.000
#> GSM154291 4 0.0000 0.998 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM154304 5 0.3607 0.538 0.000 0.348 0.000 0.000 0.652 0.000
#> GSM154305 2 0.0000 0.461 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM154306 4 0.0000 0.998 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM154262 1 0.3866 0.473 0.516 0.000 0.000 0.000 0.000 0.484
#> GSM154263 1 0.3866 0.714 0.516 0.000 0.484 0.000 0.000 0.000
#> GSM154264 1 0.3866 0.714 0.516 0.000 0.484 0.000 0.000 0.000
#> GSM154277 6 0.3866 0.000 0.484 0.000 0.000 0.000 0.000 0.516
#> GSM154278 5 0.0547 0.746 0.000 0.000 0.020 0.000 0.980 0.000
#> GSM154279 5 0.0547 0.746 0.000 0.000 0.020 0.000 0.980 0.000
#> GSM154292 5 0.1168 0.744 0.000 0.028 0.016 0.000 0.956 0.000
#> GSM154293 5 0.1168 0.744 0.000 0.028 0.016 0.000 0.956 0.000
#> GSM154294 4 0.0260 0.992 0.000 0.000 0.000 0.992 0.000 0.008
#> GSM154307 5 0.2896 0.708 0.000 0.160 0.016 0.000 0.824 0.000
#> GSM154308 5 0.2896 0.708 0.000 0.160 0.016 0.000 0.824 0.000
#> GSM154309 5 0.2896 0.708 0.000 0.160 0.016 0.000 0.824 0.000
#> GSM154265 1 0.3866 0.473 0.516 0.000 0.000 0.000 0.000 0.484
#> GSM154266 1 0.3866 0.714 0.516 0.000 0.484 0.000 0.000 0.000
#> GSM154267 1 0.3866 0.714 0.516 0.000 0.484 0.000 0.000 0.000
#> GSM154280 5 0.3737 0.562 0.000 0.000 0.392 0.000 0.608 0.000
#> GSM154281 5 0.3737 0.562 0.000 0.000 0.392 0.000 0.608 0.000
#> GSM154282 5 0.3737 0.562 0.000 0.000 0.392 0.000 0.608 0.000
#> GSM154295 5 0.3862 0.441 0.000 0.000 0.476 0.000 0.524 0.000
#> GSM154296 5 0.3862 0.441 0.000 0.000 0.476 0.000 0.524 0.000
#> GSM154297 5 0.3862 0.441 0.000 0.000 0.476 0.000 0.524 0.000
#> GSM154310 5 0.3862 0.441 0.000 0.000 0.476 0.000 0.524 0.000
#> GSM154311 5 0.3862 0.441 0.000 0.000 0.476 0.000 0.524 0.000
#> GSM154312 5 0.3862 0.441 0.000 0.000 0.476 0.000 0.524 0.000
#> GSM154268 1 0.3866 0.714 0.516 0.000 0.484 0.000 0.000 0.000
#> GSM154269 1 0.3866 0.473 0.516 0.000 0.000 0.000 0.000 0.484
#> GSM154270 1 0.3866 0.714 0.516 0.000 0.484 0.000 0.000 0.000
#> GSM154283 5 0.0260 0.743 0.000 0.000 0.008 0.000 0.992 0.000
#> GSM154284 5 0.0260 0.743 0.000 0.000 0.008 0.000 0.992 0.000
#> GSM154285 5 0.0260 0.743 0.000 0.000 0.008 0.000 0.992 0.000
#> GSM154298 5 0.0000 0.742 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM154299 5 0.0146 0.742 0.000 0.000 0.004 0.000 0.996 0.000
#> GSM154300 2 0.3076 0.512 0.000 0.760 0.000 0.000 0.240 0.000
#> GSM154313 5 0.2092 0.718 0.000 0.124 0.000 0.000 0.876 0.000
#> GSM154314 5 0.2092 0.718 0.000 0.124 0.000 0.000 0.876 0.000
#> GSM154315 4 0.0000 0.998 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM154271 1 0.3866 0.473 0.516 0.000 0.000 0.000 0.000 0.484
#> GSM154272 1 0.3866 0.473 0.516 0.000 0.000 0.000 0.000 0.484
#> GSM154273 1 0.3866 0.714 0.516 0.000 0.484 0.000 0.000 0.000
#> GSM154286 3 0.3866 1.000 0.000 0.000 0.516 0.000 0.000 0.484
#> GSM154287 3 0.3866 1.000 0.000 0.000 0.516 0.000 0.000 0.484
#> GSM154288 4 0.0000 0.998 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM154301 3 0.3866 1.000 0.000 0.000 0.516 0.000 0.000 0.484
#> GSM154302 3 0.3866 1.000 0.000 0.000 0.516 0.000 0.000 0.484
#> GSM154303 4 0.0000 0.998 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM154316 3 0.3866 1.000 0.000 0.000 0.516 0.000 0.000 0.484
#> GSM154317 3 0.3866 1.000 0.000 0.000 0.516 0.000 0.000 0.484
#> GSM154318 3 0.3866 1.000 0.000 0.000 0.516 0.000 0.000 0.484
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 agent(p) time(p) k
#> CV:hclust 60 0.6290 3.81e-01 2
#> CV:hclust 50 0.3294 4.23e-09 3
#> CV:hclust 53 0.3795 1.18e-08 4
#> CV:hclust 52 0.3452 1.15e-08 5
#> CV:hclust 46 0.0015 5.73e-07 6
If matrix rows can be associated to genes, consider to use functional_enrichment(res,
...)
to perform function enrichment for the signature genes. See this vignette for more detailed explanations.
The object with results only for a single top-value method and a single partition method can be extracted as:
res = res_list["CV", "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 38950 rows and 60 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 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.308 0.683 0.795 0.3883 0.573 0.573
#> 3 3 0.861 0.899 0.950 0.4302 0.777 0.647
#> 4 4 0.677 0.906 0.898 0.2586 0.801 0.575
#> 5 5 0.751 0.828 0.835 0.1028 1.000 1.000
#> 6 6 0.783 0.687 0.760 0.0508 0.901 0.651
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
#> GSM154259 1 0.861 0.956 0.716 0.284
#> GSM154260 1 0.855 0.957 0.720 0.280
#> GSM154261 1 0.855 0.957 0.720 0.280
#> GSM154274 2 0.278 0.746 0.048 0.952
#> GSM154275 2 0.260 0.748 0.044 0.956
#> GSM154276 2 0.278 0.746 0.048 0.952
#> GSM154289 2 0.000 0.759 0.000 1.000
#> GSM154290 2 0.000 0.759 0.000 1.000
#> GSM154291 2 0.891 0.535 0.308 0.692
#> GSM154304 2 0.000 0.759 0.000 1.000
#> GSM154305 2 0.000 0.759 0.000 1.000
#> GSM154306 2 0.891 0.535 0.308 0.692
#> GSM154262 1 0.861 0.956 0.716 0.284
#> GSM154263 1 0.855 0.957 0.720 0.280
#> GSM154264 1 0.855 0.957 0.720 0.280
#> GSM154277 2 0.891 0.535 0.308 0.692
#> GSM154278 2 0.482 0.702 0.104 0.896
#> GSM154279 2 0.278 0.746 0.048 0.952
#> GSM154292 2 0.000 0.759 0.000 1.000
#> GSM154293 2 0.000 0.759 0.000 1.000
#> GSM154294 2 0.891 0.535 0.308 0.692
#> GSM154307 2 0.000 0.759 0.000 1.000
#> GSM154308 2 0.000 0.759 0.000 1.000
#> GSM154309 2 0.000 0.759 0.000 1.000
#> GSM154265 1 0.861 0.956 0.716 0.284
#> GSM154266 1 0.855 0.957 0.720 0.280
#> GSM154267 1 0.855 0.957 0.720 0.280
#> GSM154280 2 0.767 0.556 0.224 0.776
#> GSM154281 2 0.767 0.556 0.224 0.776
#> GSM154282 2 0.767 0.556 0.224 0.776
#> GSM154295 2 0.767 0.556 0.224 0.776
#> GSM154296 2 0.767 0.556 0.224 0.776
#> GSM154297 2 0.706 0.602 0.192 0.808
#> GSM154310 2 0.767 0.556 0.224 0.776
#> GSM154311 2 0.767 0.556 0.224 0.776
#> GSM154312 2 0.767 0.556 0.224 0.776
#> GSM154268 1 0.855 0.957 0.720 0.280
#> GSM154269 1 0.861 0.956 0.716 0.284
#> GSM154270 1 0.855 0.957 0.720 0.280
#> GSM154283 2 0.242 0.750 0.040 0.960
#> GSM154284 2 0.242 0.750 0.040 0.960
#> GSM154285 2 0.242 0.750 0.040 0.960
#> GSM154298 2 0.000 0.759 0.000 1.000
#> GSM154299 2 0.000 0.759 0.000 1.000
#> GSM154300 2 0.000 0.759 0.000 1.000
#> GSM154313 2 0.000 0.759 0.000 1.000
#> GSM154314 2 0.000 0.759 0.000 1.000
#> GSM154315 2 0.891 0.535 0.308 0.692
#> GSM154271 1 0.861 0.956 0.716 0.284
#> GSM154272 1 0.861 0.956 0.716 0.284
#> GSM154273 1 0.855 0.957 0.720 0.280
#> GSM154286 1 0.997 0.587 0.532 0.468
#> GSM154287 1 0.895 0.919 0.688 0.312
#> GSM154288 2 0.891 0.535 0.308 0.692
#> GSM154301 1 0.995 0.611 0.540 0.460
#> GSM154302 2 0.987 -0.237 0.432 0.568
#> GSM154303 2 0.891 0.535 0.308 0.692
#> GSM154316 2 0.983 -0.200 0.424 0.576
#> GSM154317 2 0.985 -0.219 0.428 0.572
#> GSM154318 2 0.983 -0.200 0.424 0.576
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> GSM154259 1 0.0237 0.995 0.996 0.000 0.004
#> GSM154260 1 0.0424 0.994 0.992 0.000 0.008
#> GSM154261 1 0.0424 0.994 0.992 0.000 0.008
#> GSM154274 2 0.0424 0.913 0.000 0.992 0.008
#> GSM154275 2 0.0747 0.915 0.000 0.984 0.016
#> GSM154276 2 0.0747 0.915 0.000 0.984 0.016
#> GSM154289 2 0.0747 0.915 0.000 0.984 0.016
#> GSM154290 2 0.0747 0.915 0.000 0.984 0.016
#> GSM154291 3 0.0592 1.000 0.000 0.012 0.988
#> GSM154304 2 0.0747 0.915 0.000 0.984 0.016
#> GSM154305 2 0.0747 0.915 0.000 0.984 0.016
#> GSM154306 3 0.0592 1.000 0.000 0.012 0.988
#> GSM154262 1 0.0237 0.995 0.996 0.000 0.004
#> GSM154263 1 0.0000 0.996 1.000 0.000 0.000
#> GSM154264 1 0.0424 0.994 0.992 0.000 0.008
#> GSM154277 3 0.0592 1.000 0.000 0.012 0.988
#> GSM154278 2 0.0000 0.911 0.000 1.000 0.000
#> GSM154279 2 0.0747 0.915 0.000 0.984 0.016
#> GSM154292 2 0.0747 0.915 0.000 0.984 0.016
#> GSM154293 2 0.0747 0.915 0.000 0.984 0.016
#> GSM154294 3 0.0592 1.000 0.000 0.012 0.988
#> GSM154307 2 0.0747 0.915 0.000 0.984 0.016
#> GSM154308 2 0.0747 0.915 0.000 0.984 0.016
#> GSM154309 2 0.0747 0.915 0.000 0.984 0.016
#> GSM154265 1 0.0237 0.995 0.996 0.000 0.004
#> GSM154266 1 0.0000 0.996 1.000 0.000 0.000
#> GSM154267 1 0.0424 0.994 0.992 0.000 0.008
#> GSM154280 2 0.0237 0.911 0.004 0.996 0.000
#> GSM154281 2 0.0237 0.911 0.004 0.996 0.000
#> GSM154282 2 0.0237 0.911 0.004 0.996 0.000
#> GSM154295 2 0.0237 0.911 0.004 0.996 0.000
#> GSM154296 2 0.0237 0.911 0.004 0.996 0.000
#> GSM154297 2 0.0237 0.911 0.004 0.996 0.000
#> GSM154310 2 0.0237 0.911 0.004 0.996 0.000
#> GSM154311 2 0.0237 0.911 0.004 0.996 0.000
#> GSM154312 2 0.0237 0.911 0.004 0.996 0.000
#> GSM154268 1 0.0000 0.996 1.000 0.000 0.000
#> GSM154269 1 0.0237 0.995 0.996 0.000 0.004
#> GSM154270 1 0.0424 0.994 0.992 0.000 0.008
#> GSM154283 2 0.0592 0.914 0.000 0.988 0.012
#> GSM154284 2 0.0747 0.915 0.000 0.984 0.016
#> GSM154285 2 0.0747 0.915 0.000 0.984 0.016
#> GSM154298 2 0.0747 0.915 0.000 0.984 0.016
#> GSM154299 2 0.0747 0.915 0.000 0.984 0.016
#> GSM154300 2 0.0747 0.915 0.000 0.984 0.016
#> GSM154313 2 0.0747 0.915 0.000 0.984 0.016
#> GSM154314 2 0.0747 0.915 0.000 0.984 0.016
#> GSM154315 3 0.0592 1.000 0.000 0.012 0.988
#> GSM154271 1 0.0237 0.995 0.996 0.000 0.004
#> GSM154272 1 0.0237 0.995 0.996 0.000 0.004
#> GSM154273 1 0.0424 0.994 0.992 0.000 0.008
#> GSM154286 2 0.5905 0.536 0.352 0.648 0.000
#> GSM154287 2 0.6169 0.517 0.360 0.636 0.004
#> GSM154288 3 0.0592 1.000 0.000 0.012 0.988
#> GSM154301 2 0.6169 0.517 0.360 0.636 0.004
#> GSM154302 2 0.5905 0.536 0.352 0.648 0.000
#> GSM154303 3 0.0592 1.000 0.000 0.012 0.988
#> GSM154316 2 0.5905 0.536 0.352 0.648 0.000
#> GSM154317 2 0.5905 0.536 0.352 0.648 0.000
#> GSM154318 2 0.5905 0.536 0.352 0.648 0.000
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> GSM154259 1 0.3123 0.912 0.844 0.000 0.156 0.000
#> GSM154260 1 0.0707 0.933 0.980 0.000 0.020 0.000
#> GSM154261 1 0.0707 0.933 0.980 0.000 0.020 0.000
#> GSM154274 2 0.2216 0.921 0.000 0.908 0.092 0.000
#> GSM154275 2 0.2216 0.921 0.000 0.908 0.092 0.000
#> GSM154276 2 0.2216 0.921 0.000 0.908 0.092 0.000
#> GSM154289 2 0.1022 0.935 0.000 0.968 0.032 0.000
#> GSM154290 2 0.0707 0.936 0.000 0.980 0.020 0.000
#> GSM154291 4 0.0000 0.994 0.000 0.000 0.000 1.000
#> GSM154304 2 0.1118 0.933 0.000 0.964 0.036 0.000
#> GSM154305 2 0.1118 0.933 0.000 0.964 0.036 0.000
#> GSM154306 4 0.0000 0.994 0.000 0.000 0.000 1.000
#> GSM154262 1 0.2921 0.917 0.860 0.000 0.140 0.000
#> GSM154263 1 0.0592 0.941 0.984 0.000 0.016 0.000
#> GSM154264 1 0.0000 0.939 1.000 0.000 0.000 0.000
#> GSM154277 4 0.1211 0.976 0.000 0.000 0.040 0.960
#> GSM154278 2 0.2216 0.917 0.000 0.908 0.092 0.000
#> GSM154279 2 0.2216 0.917 0.000 0.908 0.092 0.000
#> GSM154292 2 0.0592 0.947 0.000 0.984 0.016 0.000
#> GSM154293 2 0.0592 0.947 0.000 0.984 0.016 0.000
#> GSM154294 4 0.0000 0.994 0.000 0.000 0.000 1.000
#> GSM154307 2 0.1022 0.945 0.000 0.968 0.032 0.000
#> GSM154308 2 0.1022 0.945 0.000 0.968 0.032 0.000
#> GSM154309 2 0.1022 0.945 0.000 0.968 0.032 0.000
#> GSM154265 1 0.2921 0.917 0.860 0.000 0.140 0.000
#> GSM154266 1 0.0592 0.941 0.984 0.000 0.016 0.000
#> GSM154267 1 0.0000 0.939 1.000 0.000 0.000 0.000
#> GSM154280 3 0.4331 0.827 0.000 0.288 0.712 0.000
#> GSM154281 3 0.4331 0.827 0.000 0.288 0.712 0.000
#> GSM154282 3 0.4331 0.827 0.000 0.288 0.712 0.000
#> GSM154295 3 0.4222 0.827 0.000 0.272 0.728 0.000
#> GSM154296 3 0.4331 0.827 0.000 0.288 0.712 0.000
#> GSM154297 3 0.4331 0.827 0.000 0.288 0.712 0.000
#> GSM154310 3 0.4250 0.827 0.000 0.276 0.724 0.000
#> GSM154311 3 0.4250 0.827 0.000 0.276 0.724 0.000
#> GSM154312 3 0.4250 0.827 0.000 0.276 0.724 0.000
#> GSM154268 1 0.0592 0.941 0.984 0.000 0.016 0.000
#> GSM154269 1 0.2921 0.917 0.860 0.000 0.140 0.000
#> GSM154270 1 0.0000 0.939 1.000 0.000 0.000 0.000
#> GSM154283 2 0.2216 0.917 0.000 0.908 0.092 0.000
#> GSM154284 2 0.2149 0.918 0.000 0.912 0.088 0.000
#> GSM154285 2 0.2149 0.918 0.000 0.912 0.088 0.000
#> GSM154298 2 0.1118 0.945 0.000 0.964 0.036 0.000
#> GSM154299 2 0.0817 0.946 0.000 0.976 0.024 0.000
#> GSM154300 2 0.0817 0.936 0.000 0.976 0.024 0.000
#> GSM154313 2 0.1022 0.945 0.000 0.968 0.032 0.000
#> GSM154314 2 0.1022 0.945 0.000 0.968 0.032 0.000
#> GSM154315 4 0.0000 0.994 0.000 0.000 0.000 1.000
#> GSM154271 1 0.2921 0.917 0.860 0.000 0.140 0.000
#> GSM154272 1 0.2921 0.917 0.860 0.000 0.140 0.000
#> GSM154273 1 0.0000 0.939 1.000 0.000 0.000 0.000
#> GSM154286 3 0.5119 0.810 0.112 0.124 0.764 0.000
#> GSM154287 3 0.3958 0.724 0.112 0.052 0.836 0.000
#> GSM154288 4 0.0469 0.991 0.000 0.000 0.012 0.988
#> GSM154301 3 0.3958 0.724 0.112 0.052 0.836 0.000
#> GSM154302 3 0.5119 0.810 0.112 0.124 0.764 0.000
#> GSM154303 4 0.0469 0.991 0.000 0.000 0.012 0.988
#> GSM154316 3 0.5119 0.810 0.112 0.124 0.764 0.000
#> GSM154317 3 0.5119 0.810 0.112 0.124 0.764 0.000
#> GSM154318 3 0.5119 0.810 0.112 0.124 0.764 0.000
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> GSM154259 1 0.4597 0.839 0.696 0.000 0.044 0.000 NA
#> GSM154260 1 0.1571 0.864 0.936 0.000 0.000 0.004 NA
#> GSM154261 1 0.1502 0.864 0.940 0.000 0.000 0.004 NA
#> GSM154274 2 0.5111 0.691 0.000 0.500 0.036 0.000 NA
#> GSM154275 2 0.5112 0.690 0.000 0.496 0.036 0.000 NA
#> GSM154276 2 0.5112 0.690 0.000 0.496 0.036 0.000 NA
#> GSM154289 2 0.3086 0.770 0.000 0.816 0.004 0.000 NA
#> GSM154290 2 0.3300 0.771 0.000 0.792 0.004 0.000 NA
#> GSM154291 4 0.0162 0.988 0.000 0.004 0.000 0.996 NA
#> GSM154304 2 0.2806 0.747 0.000 0.844 0.004 0.000 NA
#> GSM154305 2 0.3123 0.746 0.000 0.812 0.004 0.000 NA
#> GSM154306 4 0.0162 0.988 0.000 0.004 0.000 0.996 NA
#> GSM154262 1 0.4413 0.849 0.724 0.000 0.044 0.000 NA
#> GSM154263 1 0.1662 0.888 0.936 0.000 0.004 0.004 NA
#> GSM154264 1 0.0324 0.883 0.992 0.000 0.000 0.004 NA
#> GSM154277 4 0.1892 0.951 0.000 0.004 0.000 0.916 NA
#> GSM154278 2 0.5155 0.706 0.000 0.596 0.052 0.000 NA
#> GSM154279 2 0.5176 0.708 0.000 0.572 0.048 0.000 NA
#> GSM154292 2 0.1914 0.796 0.000 0.924 0.016 0.000 NA
#> GSM154293 2 0.1914 0.796 0.000 0.924 0.016 0.000 NA
#> GSM154294 4 0.0324 0.987 0.000 0.004 0.000 0.992 NA
#> GSM154307 2 0.1845 0.772 0.000 0.928 0.016 0.000 NA
#> GSM154308 2 0.1774 0.771 0.000 0.932 0.016 0.000 NA
#> GSM154309 2 0.1845 0.772 0.000 0.928 0.016 0.000 NA
#> GSM154265 1 0.4355 0.851 0.732 0.000 0.044 0.000 NA
#> GSM154266 1 0.1430 0.888 0.944 0.000 0.004 0.000 NA
#> GSM154267 1 0.0000 0.884 1.000 0.000 0.000 0.000 NA
#> GSM154280 3 0.5182 0.721 0.000 0.068 0.632 0.000 NA
#> GSM154281 3 0.5200 0.716 0.000 0.068 0.628 0.000 NA
#> GSM154282 3 0.5200 0.716 0.000 0.068 0.628 0.000 NA
#> GSM154295 3 0.3806 0.868 0.000 0.104 0.812 0.000 NA
#> GSM154296 3 0.3812 0.867 0.000 0.096 0.812 0.000 NA
#> GSM154297 3 0.3812 0.867 0.000 0.096 0.812 0.000 NA
#> GSM154310 3 0.3800 0.867 0.000 0.108 0.812 0.000 NA
#> GSM154311 3 0.3800 0.867 0.000 0.108 0.812 0.000 NA
#> GSM154312 3 0.3800 0.867 0.000 0.108 0.812 0.000 NA
#> GSM154268 1 0.1430 0.888 0.944 0.000 0.004 0.000 NA
#> GSM154269 1 0.4355 0.851 0.732 0.000 0.044 0.000 NA
#> GSM154270 1 0.0000 0.884 1.000 0.000 0.000 0.000 NA
#> GSM154283 2 0.5123 0.702 0.000 0.572 0.044 0.000 NA
#> GSM154284 2 0.5182 0.703 0.000 0.544 0.044 0.000 NA
#> GSM154285 2 0.5182 0.703 0.000 0.544 0.044 0.000 NA
#> GSM154298 2 0.2723 0.786 0.000 0.864 0.012 0.000 NA
#> GSM154299 2 0.3355 0.787 0.000 0.804 0.012 0.000 NA
#> GSM154300 2 0.3366 0.787 0.000 0.768 0.000 0.000 NA
#> GSM154313 2 0.2189 0.766 0.000 0.904 0.012 0.000 NA
#> GSM154314 2 0.2189 0.766 0.000 0.904 0.012 0.000 NA
#> GSM154315 4 0.0162 0.988 0.000 0.004 0.000 0.996 NA
#> GSM154271 1 0.4355 0.851 0.732 0.000 0.044 0.000 NA
#> GSM154272 1 0.4355 0.851 0.732 0.000 0.044 0.000 NA
#> GSM154273 1 0.0000 0.884 1.000 0.000 0.000 0.000 NA
#> GSM154286 3 0.0671 0.859 0.004 0.016 0.980 0.000 NA
#> GSM154287 3 0.0671 0.836 0.004 0.000 0.980 0.000 NA
#> GSM154288 4 0.0727 0.985 0.000 0.004 0.004 0.980 NA
#> GSM154301 3 0.0671 0.836 0.004 0.000 0.980 0.000 NA
#> GSM154302 3 0.0771 0.862 0.004 0.020 0.976 0.000 NA
#> GSM154303 4 0.0727 0.985 0.000 0.004 0.004 0.980 NA
#> GSM154316 3 0.0771 0.862 0.004 0.020 0.976 0.000 NA
#> GSM154317 3 0.0771 0.862 0.004 0.020 0.976 0.000 NA
#> GSM154318 3 0.0771 0.862 0.004 0.020 0.976 0.000 NA
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> GSM154259 1 0.4862 0.7401 0.520 0.000 0.048 0.000 0.004 NA
#> GSM154260 1 0.2625 0.7685 0.872 0.000 0.000 0.000 0.072 NA
#> GSM154261 1 0.2448 0.7675 0.884 0.000 0.000 0.000 0.064 NA
#> GSM154274 5 0.4520 0.3973 0.000 0.228 0.004 0.000 0.692 NA
#> GSM154275 5 0.4983 0.3315 0.000 0.220 0.004 0.000 0.652 NA
#> GSM154276 5 0.4419 0.4007 0.000 0.220 0.004 0.000 0.704 NA
#> GSM154289 2 0.5328 0.5489 0.000 0.560 0.000 0.000 0.308 NA
#> GSM154290 2 0.5390 0.5276 0.000 0.540 0.000 0.000 0.328 NA
#> GSM154291 4 0.0000 0.9720 0.000 0.000 0.000 1.000 0.000 NA
#> GSM154304 2 0.4298 0.6532 0.000 0.740 0.004 0.000 0.140 NA
#> GSM154305 2 0.5010 0.6056 0.000 0.644 0.000 0.000 0.184 NA
#> GSM154306 4 0.0146 0.9716 0.000 0.000 0.004 0.996 0.000 NA
#> GSM154262 1 0.4822 0.7509 0.548 0.000 0.048 0.000 0.004 NA
#> GSM154263 1 0.2875 0.8041 0.852 0.000 0.000 0.000 0.052 NA
#> GSM154264 1 0.0508 0.7936 0.984 0.000 0.000 0.000 0.012 NA
#> GSM154277 4 0.3142 0.8855 0.000 0.004 0.004 0.836 0.032 NA
#> GSM154278 5 0.4109 0.4492 0.000 0.392 0.008 0.000 0.596 NA
#> GSM154279 5 0.4167 0.4778 0.000 0.344 0.008 0.000 0.636 NA
#> GSM154292 2 0.2809 0.7115 0.000 0.848 0.004 0.000 0.128 NA
#> GSM154293 2 0.2809 0.7115 0.000 0.848 0.004 0.000 0.128 NA
#> GSM154294 4 0.0146 0.9716 0.000 0.000 0.000 0.996 0.000 NA
#> GSM154307 2 0.1262 0.7315 0.000 0.956 0.008 0.000 0.020 NA
#> GSM154308 2 0.1346 0.7324 0.000 0.952 0.008 0.000 0.024 NA
#> GSM154309 2 0.1262 0.7315 0.000 0.956 0.008 0.000 0.020 NA
#> GSM154265 1 0.4690 0.7514 0.552 0.000 0.048 0.000 0.000 NA
#> GSM154266 1 0.2679 0.8037 0.864 0.000 0.000 0.000 0.040 NA
#> GSM154267 1 0.0146 0.7947 0.996 0.000 0.000 0.000 0.000 NA
#> GSM154280 5 0.6137 -0.0697 0.000 0.032 0.388 0.000 0.452 NA
#> GSM154281 5 0.6108 -0.0668 0.000 0.032 0.388 0.000 0.456 NA
#> GSM154282 5 0.6108 -0.0668 0.000 0.032 0.388 0.000 0.456 NA
#> GSM154295 3 0.5185 0.7863 0.000 0.080 0.700 0.000 0.080 NA
#> GSM154296 3 0.5346 0.7746 0.000 0.076 0.684 0.000 0.092 NA
#> GSM154297 3 0.5346 0.7746 0.000 0.076 0.684 0.000 0.092 NA
#> GSM154310 3 0.5185 0.7863 0.000 0.080 0.700 0.000 0.080 NA
#> GSM154311 3 0.5185 0.7863 0.000 0.080 0.700 0.000 0.080 NA
#> GSM154312 3 0.5185 0.7863 0.000 0.080 0.700 0.000 0.080 NA
#> GSM154268 1 0.2629 0.8041 0.868 0.000 0.000 0.000 0.040 NA
#> GSM154269 1 0.4682 0.7525 0.556 0.000 0.048 0.000 0.000 NA
#> GSM154270 1 0.0000 0.7953 1.000 0.000 0.000 0.000 0.000 NA
#> GSM154283 5 0.4983 0.4280 0.000 0.356 0.008 0.000 0.576 NA
#> GSM154284 5 0.4601 0.4824 0.000 0.308 0.008 0.000 0.640 NA
#> GSM154285 5 0.4717 0.4782 0.000 0.308 0.008 0.000 0.632 NA
#> GSM154298 2 0.3763 0.6548 0.000 0.788 0.008 0.000 0.144 NA
#> GSM154299 2 0.4286 0.5910 0.000 0.712 0.004 0.000 0.224 NA
#> GSM154300 2 0.5618 0.5221 0.000 0.536 0.000 0.000 0.268 NA
#> GSM154313 2 0.1873 0.7144 0.000 0.924 0.008 0.000 0.020 NA
#> GSM154314 2 0.1873 0.7144 0.000 0.924 0.008 0.000 0.020 NA
#> GSM154315 4 0.0000 0.9720 0.000 0.000 0.000 1.000 0.000 NA
#> GSM154271 1 0.4682 0.7525 0.556 0.000 0.048 0.000 0.000 NA
#> GSM154272 1 0.4682 0.7525 0.556 0.000 0.048 0.000 0.000 NA
#> GSM154273 1 0.0000 0.7953 1.000 0.000 0.000 0.000 0.000 NA
#> GSM154286 3 0.0696 0.8276 0.004 0.004 0.980 0.000 0.004 NA
#> GSM154287 3 0.0508 0.8235 0.004 0.000 0.984 0.000 0.000 NA
#> GSM154288 4 0.1088 0.9640 0.000 0.000 0.000 0.960 0.024 NA
#> GSM154301 3 0.0405 0.8261 0.004 0.000 0.988 0.000 0.000 NA
#> GSM154302 3 0.0291 0.8315 0.004 0.004 0.992 0.000 0.000 NA
#> GSM154303 4 0.1088 0.9640 0.000 0.000 0.000 0.960 0.024 NA
#> GSM154316 3 0.0291 0.8315 0.004 0.004 0.992 0.000 0.000 NA
#> GSM154317 3 0.0291 0.8315 0.004 0.004 0.992 0.000 0.000 NA
#> GSM154318 3 0.0291 0.8315 0.004 0.004 0.992 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 agent(p) time(p) k
#> CV:kmeans 56 0.096857 1.67e-09 2
#> CV:kmeans 60 0.951392 3.64e-11 3
#> CV:kmeans 60 0.000037 9.96e-10 4
#> CV:kmeans 60 0.000037 9.96e-10 5
#> CV:kmeans 49 0.002452 1.20e-08 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 38950 rows and 60 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 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.725 0.869 0.936 0.4957 0.492 0.492
#> 3 3 1.000 0.949 0.957 0.2486 0.685 0.469
#> 4 4 1.000 0.993 0.995 0.1806 0.773 0.482
#> 5 5 0.898 0.908 0.916 0.0842 0.901 0.651
#> 6 6 0.875 0.883 0.902 0.0477 0.953 0.772
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] 3
There is also optional best \(k\) = 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
#> GSM154259 1 0.000 0.869 1.000 0.000
#> GSM154260 1 0.000 0.869 1.000 0.000
#> GSM154261 1 0.000 0.869 1.000 0.000
#> GSM154274 2 0.000 0.991 0.000 1.000
#> GSM154275 2 0.000 0.991 0.000 1.000
#> GSM154276 2 0.000 0.991 0.000 1.000
#> GSM154289 2 0.000 0.991 0.000 1.000
#> GSM154290 2 0.000 0.991 0.000 1.000
#> GSM154291 2 0.000 0.991 0.000 1.000
#> GSM154304 2 0.000 0.991 0.000 1.000
#> GSM154305 2 0.000 0.991 0.000 1.000
#> GSM154306 2 0.000 0.991 0.000 1.000
#> GSM154262 1 0.000 0.869 1.000 0.000
#> GSM154263 1 0.000 0.869 1.000 0.000
#> GSM154264 1 0.000 0.869 1.000 0.000
#> GSM154277 2 0.000 0.991 0.000 1.000
#> GSM154278 2 0.000 0.991 0.000 1.000
#> GSM154279 2 0.000 0.991 0.000 1.000
#> GSM154292 2 0.000 0.991 0.000 1.000
#> GSM154293 2 0.000 0.991 0.000 1.000
#> GSM154294 2 0.000 0.991 0.000 1.000
#> GSM154307 2 0.000 0.991 0.000 1.000
#> GSM154308 2 0.000 0.991 0.000 1.000
#> GSM154309 2 0.000 0.991 0.000 1.000
#> GSM154265 1 0.000 0.869 1.000 0.000
#> GSM154266 1 0.000 0.869 1.000 0.000
#> GSM154267 1 0.000 0.869 1.000 0.000
#> GSM154280 1 0.973 0.505 0.596 0.404
#> GSM154281 1 0.973 0.505 0.596 0.404
#> GSM154282 1 0.973 0.505 0.596 0.404
#> GSM154295 1 0.973 0.505 0.596 0.404
#> GSM154296 1 0.975 0.497 0.592 0.408
#> GSM154297 1 0.978 0.488 0.588 0.412
#> GSM154310 1 0.973 0.505 0.596 0.404
#> GSM154311 1 0.973 0.505 0.596 0.404
#> GSM154312 1 0.973 0.505 0.596 0.404
#> GSM154268 1 0.000 0.869 1.000 0.000
#> GSM154269 1 0.000 0.869 1.000 0.000
#> GSM154270 1 0.000 0.869 1.000 0.000
#> GSM154283 2 0.000 0.991 0.000 1.000
#> GSM154284 2 0.000 0.991 0.000 1.000
#> GSM154285 2 0.000 0.991 0.000 1.000
#> GSM154298 2 0.000 0.991 0.000 1.000
#> GSM154299 2 0.000 0.991 0.000 1.000
#> GSM154300 2 0.000 0.991 0.000 1.000
#> GSM154313 2 0.000 0.991 0.000 1.000
#> GSM154314 2 0.000 0.991 0.000 1.000
#> GSM154315 2 0.000 0.991 0.000 1.000
#> GSM154271 1 0.000 0.869 1.000 0.000
#> GSM154272 1 0.000 0.869 1.000 0.000
#> GSM154273 1 0.000 0.869 1.000 0.000
#> GSM154286 1 0.000 0.869 1.000 0.000
#> GSM154287 1 0.000 0.869 1.000 0.000
#> GSM154288 2 0.482 0.866 0.104 0.896
#> GSM154301 1 0.000 0.869 1.000 0.000
#> GSM154302 1 0.000 0.869 1.000 0.000
#> GSM154303 2 0.482 0.866 0.104 0.896
#> GSM154316 1 0.000 0.869 1.000 0.000
#> GSM154317 1 0.000 0.869 1.000 0.000
#> GSM154318 1 0.000 0.869 1.000 0.000
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> GSM154259 1 0.000 0.969 1.000 0.000 0.000
#> GSM154260 1 0.000 0.969 1.000 0.000 0.000
#> GSM154261 1 0.000 0.969 1.000 0.000 0.000
#> GSM154274 2 0.280 0.962 0.000 0.908 0.092
#> GSM154275 2 0.280 0.962 0.000 0.908 0.092
#> GSM154276 2 0.280 0.962 0.000 0.908 0.092
#> GSM154289 2 0.280 0.962 0.000 0.908 0.092
#> GSM154290 2 0.280 0.962 0.000 0.908 0.092
#> GSM154291 3 0.000 0.959 0.000 0.000 1.000
#> GSM154304 2 0.280 0.962 0.000 0.908 0.092
#> GSM154305 3 0.362 0.844 0.000 0.136 0.864
#> GSM154306 3 0.000 0.959 0.000 0.000 1.000
#> GSM154262 1 0.000 0.969 1.000 0.000 0.000
#> GSM154263 1 0.000 0.969 1.000 0.000 0.000
#> GSM154264 1 0.000 0.969 1.000 0.000 0.000
#> GSM154277 3 0.000 0.959 0.000 0.000 1.000
#> GSM154278 2 0.245 0.956 0.000 0.924 0.076
#> GSM154279 2 0.280 0.962 0.000 0.908 0.092
#> GSM154292 2 0.280 0.962 0.000 0.908 0.092
#> GSM154293 3 0.382 0.828 0.000 0.148 0.852
#> GSM154294 3 0.000 0.959 0.000 0.000 1.000
#> GSM154307 2 0.280 0.962 0.000 0.908 0.092
#> GSM154308 2 0.280 0.962 0.000 0.908 0.092
#> GSM154309 2 0.280 0.962 0.000 0.908 0.092
#> GSM154265 1 0.000 0.969 1.000 0.000 0.000
#> GSM154266 1 0.000 0.969 1.000 0.000 0.000
#> GSM154267 1 0.000 0.969 1.000 0.000 0.000
#> GSM154280 2 0.000 0.919 0.000 1.000 0.000
#> GSM154281 2 0.000 0.919 0.000 1.000 0.000
#> GSM154282 2 0.000 0.919 0.000 1.000 0.000
#> GSM154295 2 0.000 0.919 0.000 1.000 0.000
#> GSM154296 2 0.000 0.919 0.000 1.000 0.000
#> GSM154297 2 0.000 0.919 0.000 1.000 0.000
#> GSM154310 2 0.000 0.919 0.000 1.000 0.000
#> GSM154311 2 0.000 0.919 0.000 1.000 0.000
#> GSM154312 2 0.000 0.919 0.000 1.000 0.000
#> GSM154268 1 0.000 0.969 1.000 0.000 0.000
#> GSM154269 1 0.000 0.969 1.000 0.000 0.000
#> GSM154270 1 0.000 0.969 1.000 0.000 0.000
#> GSM154283 2 0.280 0.962 0.000 0.908 0.092
#> GSM154284 2 0.280 0.962 0.000 0.908 0.092
#> GSM154285 2 0.280 0.962 0.000 0.908 0.092
#> GSM154298 2 0.280 0.962 0.000 0.908 0.092
#> GSM154299 2 0.280 0.962 0.000 0.908 0.092
#> GSM154300 2 0.288 0.959 0.000 0.904 0.096
#> GSM154313 2 0.280 0.962 0.000 0.908 0.092
#> GSM154314 2 0.280 0.962 0.000 0.908 0.092
#> GSM154315 3 0.000 0.959 0.000 0.000 1.000
#> GSM154271 1 0.000 0.969 1.000 0.000 0.000
#> GSM154272 1 0.000 0.969 1.000 0.000 0.000
#> GSM154273 1 0.000 0.969 1.000 0.000 0.000
#> GSM154286 1 0.263 0.935 0.916 0.084 0.000
#> GSM154287 1 0.280 0.931 0.908 0.092 0.000
#> GSM154288 3 0.000 0.959 0.000 0.000 1.000
#> GSM154301 1 0.280 0.931 0.908 0.092 0.000
#> GSM154302 1 0.280 0.931 0.908 0.092 0.000
#> GSM154303 3 0.000 0.959 0.000 0.000 1.000
#> GSM154316 1 0.280 0.931 0.908 0.092 0.000
#> GSM154317 1 0.280 0.931 0.908 0.092 0.000
#> GSM154318 1 0.280 0.931 0.908 0.092 0.000
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> GSM154259 1 0.0000 1.000 1.000 0.000 0.000 0.000
#> GSM154260 1 0.0000 1.000 1.000 0.000 0.000 0.000
#> GSM154261 1 0.0000 1.000 1.000 0.000 0.000 0.000
#> GSM154274 2 0.0188 0.995 0.000 0.996 0.004 0.000
#> GSM154275 2 0.0188 0.995 0.000 0.996 0.004 0.000
#> GSM154276 2 0.0188 0.995 0.000 0.996 0.004 0.000
#> GSM154289 2 0.0188 0.995 0.000 0.996 0.004 0.000
#> GSM154290 2 0.0000 0.995 0.000 1.000 0.000 0.000
#> GSM154291 4 0.0000 1.000 0.000 0.000 0.000 1.000
#> GSM154304 2 0.0188 0.995 0.000 0.996 0.004 0.000
#> GSM154305 2 0.0188 0.995 0.000 0.996 0.000 0.004
#> GSM154306 4 0.0000 1.000 0.000 0.000 0.000 1.000
#> GSM154262 1 0.0000 1.000 1.000 0.000 0.000 0.000
#> GSM154263 1 0.0000 1.000 1.000 0.000 0.000 0.000
#> GSM154264 1 0.0000 1.000 1.000 0.000 0.000 0.000
#> GSM154277 4 0.0000 1.000 0.000 0.000 0.000 1.000
#> GSM154278 2 0.0188 0.995 0.000 0.996 0.004 0.000
#> GSM154279 2 0.0188 0.995 0.000 0.996 0.004 0.000
#> GSM154292 2 0.0188 0.995 0.000 0.996 0.004 0.000
#> GSM154293 2 0.0336 0.992 0.000 0.992 0.000 0.008
#> GSM154294 4 0.0000 1.000 0.000 0.000 0.000 1.000
#> GSM154307 2 0.0188 0.995 0.000 0.996 0.004 0.000
#> GSM154308 2 0.0188 0.995 0.000 0.996 0.004 0.000
#> GSM154309 2 0.0188 0.995 0.000 0.996 0.004 0.000
#> GSM154265 1 0.0000 1.000 1.000 0.000 0.000 0.000
#> GSM154266 1 0.0000 1.000 1.000 0.000 0.000 0.000
#> GSM154267 1 0.0000 1.000 1.000 0.000 0.000 0.000
#> GSM154280 3 0.0188 0.984 0.000 0.004 0.996 0.000
#> GSM154281 3 0.0188 0.984 0.000 0.004 0.996 0.000
#> GSM154282 3 0.0188 0.984 0.000 0.004 0.996 0.000
#> GSM154295 3 0.0000 0.985 0.000 0.000 1.000 0.000
#> GSM154296 3 0.0000 0.985 0.000 0.000 1.000 0.000
#> GSM154297 3 0.0000 0.985 0.000 0.000 1.000 0.000
#> GSM154310 3 0.0188 0.984 0.000 0.004 0.996 0.000
#> GSM154311 3 0.0188 0.984 0.000 0.004 0.996 0.000
#> GSM154312 3 0.0188 0.984 0.000 0.004 0.996 0.000
#> GSM154268 1 0.0000 1.000 1.000 0.000 0.000 0.000
#> GSM154269 1 0.0000 1.000 1.000 0.000 0.000 0.000
#> GSM154270 1 0.0000 1.000 1.000 0.000 0.000 0.000
#> GSM154283 2 0.0336 0.994 0.000 0.992 0.008 0.000
#> GSM154284 2 0.0336 0.994 0.000 0.992 0.008 0.000
#> GSM154285 2 0.0336 0.994 0.000 0.992 0.008 0.000
#> GSM154298 2 0.0336 0.994 0.000 0.992 0.008 0.000
#> GSM154299 2 0.0188 0.995 0.000 0.996 0.004 0.000
#> GSM154300 2 0.0000 0.995 0.000 1.000 0.000 0.000
#> GSM154313 2 0.0336 0.994 0.000 0.992 0.008 0.000
#> GSM154314 2 0.0336 0.994 0.000 0.992 0.008 0.000
#> GSM154315 4 0.0000 1.000 0.000 0.000 0.000 1.000
#> GSM154271 1 0.0000 1.000 1.000 0.000 0.000 0.000
#> GSM154272 1 0.0000 1.000 1.000 0.000 0.000 0.000
#> GSM154273 1 0.0000 1.000 1.000 0.000 0.000 0.000
#> GSM154286 3 0.1940 0.920 0.076 0.000 0.924 0.000
#> GSM154287 3 0.0707 0.981 0.020 0.000 0.980 0.000
#> GSM154288 4 0.0000 1.000 0.000 0.000 0.000 1.000
#> GSM154301 3 0.0592 0.984 0.016 0.000 0.984 0.000
#> GSM154302 3 0.0592 0.984 0.016 0.000 0.984 0.000
#> GSM154303 4 0.0000 1.000 0.000 0.000 0.000 1.000
#> GSM154316 3 0.0592 0.984 0.016 0.000 0.984 0.000
#> GSM154317 3 0.0592 0.984 0.016 0.000 0.984 0.000
#> GSM154318 3 0.0592 0.984 0.016 0.000 0.984 0.000
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> GSM154259 1 0.0162 0.998 0.996 0.000 0.000 0.000 0.004
#> GSM154260 1 0.0000 0.998 1.000 0.000 0.000 0.000 0.000
#> GSM154261 1 0.0000 0.998 1.000 0.000 0.000 0.000 0.000
#> GSM154274 5 0.3636 0.826 0.000 0.272 0.000 0.000 0.728
#> GSM154275 5 0.3586 0.829 0.000 0.264 0.000 0.000 0.736
#> GSM154276 5 0.3586 0.829 0.000 0.264 0.000 0.000 0.736
#> GSM154289 2 0.1197 0.955 0.000 0.952 0.000 0.000 0.048
#> GSM154290 2 0.1410 0.947 0.000 0.940 0.000 0.000 0.060
#> GSM154291 4 0.0000 1.000 0.000 0.000 0.000 1.000 0.000
#> GSM154304 2 0.0963 0.956 0.000 0.964 0.000 0.000 0.036
#> GSM154305 2 0.1364 0.953 0.000 0.952 0.000 0.012 0.036
#> GSM154306 4 0.0000 1.000 0.000 0.000 0.000 1.000 0.000
#> GSM154262 1 0.0162 0.998 0.996 0.000 0.000 0.000 0.004
#> GSM154263 1 0.0000 0.998 1.000 0.000 0.000 0.000 0.000
#> GSM154264 1 0.0000 0.998 1.000 0.000 0.000 0.000 0.000
#> GSM154277 4 0.0000 1.000 0.000 0.000 0.000 1.000 0.000
#> GSM154278 5 0.3876 0.818 0.000 0.316 0.000 0.000 0.684
#> GSM154279 5 0.3752 0.834 0.000 0.292 0.000 0.000 0.708
#> GSM154292 2 0.0404 0.972 0.000 0.988 0.000 0.000 0.012
#> GSM154293 2 0.0771 0.967 0.000 0.976 0.000 0.020 0.004
#> GSM154294 4 0.0000 1.000 0.000 0.000 0.000 1.000 0.000
#> GSM154307 2 0.0000 0.974 0.000 1.000 0.000 0.000 0.000
#> GSM154308 2 0.0000 0.974 0.000 1.000 0.000 0.000 0.000
#> GSM154309 2 0.0000 0.974 0.000 1.000 0.000 0.000 0.000
#> GSM154265 1 0.0162 0.998 0.996 0.000 0.000 0.000 0.004
#> GSM154266 1 0.0000 0.998 1.000 0.000 0.000 0.000 0.000
#> GSM154267 1 0.0000 0.998 1.000 0.000 0.000 0.000 0.000
#> GSM154280 5 0.1270 0.629 0.000 0.000 0.052 0.000 0.948
#> GSM154281 5 0.1478 0.617 0.000 0.000 0.064 0.000 0.936
#> GSM154282 5 0.1341 0.626 0.000 0.000 0.056 0.000 0.944
#> GSM154295 3 0.3863 0.831 0.000 0.012 0.740 0.000 0.248
#> GSM154296 3 0.3863 0.831 0.000 0.012 0.740 0.000 0.248
#> GSM154297 3 0.3890 0.828 0.000 0.012 0.736 0.000 0.252
#> GSM154310 3 0.3863 0.831 0.000 0.012 0.740 0.000 0.248
#> GSM154311 3 0.3863 0.831 0.000 0.012 0.740 0.000 0.248
#> GSM154312 3 0.3863 0.831 0.000 0.012 0.740 0.000 0.248
#> GSM154268 1 0.0000 0.998 1.000 0.000 0.000 0.000 0.000
#> GSM154269 1 0.0162 0.998 0.996 0.000 0.000 0.000 0.004
#> GSM154270 1 0.0000 0.998 1.000 0.000 0.000 0.000 0.000
#> GSM154283 5 0.3837 0.821 0.000 0.308 0.000 0.000 0.692
#> GSM154284 5 0.3730 0.834 0.000 0.288 0.000 0.000 0.712
#> GSM154285 5 0.3730 0.834 0.000 0.288 0.000 0.000 0.712
#> GSM154298 2 0.0404 0.971 0.000 0.988 0.000 0.000 0.012
#> GSM154299 2 0.0794 0.965 0.000 0.972 0.000 0.000 0.028
#> GSM154300 2 0.0963 0.965 0.000 0.964 0.000 0.000 0.036
#> GSM154313 2 0.0290 0.973 0.000 0.992 0.000 0.000 0.008
#> GSM154314 2 0.0290 0.973 0.000 0.992 0.000 0.000 0.008
#> GSM154315 4 0.0000 1.000 0.000 0.000 0.000 1.000 0.000
#> GSM154271 1 0.0162 0.998 0.996 0.000 0.000 0.000 0.004
#> GSM154272 1 0.0162 0.998 0.996 0.000 0.000 0.000 0.004
#> GSM154273 1 0.0000 0.998 1.000 0.000 0.000 0.000 0.000
#> GSM154286 3 0.3816 0.483 0.304 0.000 0.696 0.000 0.000
#> GSM154287 3 0.0162 0.839 0.000 0.000 0.996 0.000 0.004
#> GSM154288 4 0.0000 1.000 0.000 0.000 0.000 1.000 0.000
#> GSM154301 3 0.0162 0.839 0.000 0.000 0.996 0.000 0.004
#> GSM154302 3 0.0000 0.840 0.000 0.000 1.000 0.000 0.000
#> GSM154303 4 0.0000 1.000 0.000 0.000 0.000 1.000 0.000
#> GSM154316 3 0.0000 0.840 0.000 0.000 1.000 0.000 0.000
#> GSM154317 3 0.0000 0.840 0.000 0.000 1.000 0.000 0.000
#> GSM154318 3 0.0000 0.840 0.000 0.000 1.000 0.000 0.000
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> GSM154259 1 0.1124 0.969 0.956 0.000 0.008 0.000 0.000 0.036
#> GSM154260 1 0.0547 0.974 0.980 0.000 0.000 0.000 0.000 0.020
#> GSM154261 1 0.0547 0.974 0.980 0.000 0.000 0.000 0.000 0.020
#> GSM154274 5 0.0993 0.785 0.000 0.024 0.000 0.000 0.964 0.012
#> GSM154275 5 0.1829 0.773 0.000 0.024 0.000 0.000 0.920 0.056
#> GSM154276 5 0.1092 0.785 0.000 0.020 0.000 0.000 0.960 0.020
#> GSM154289 2 0.3794 0.735 0.000 0.724 0.000 0.000 0.248 0.028
#> GSM154290 2 0.4172 0.705 0.000 0.680 0.000 0.000 0.280 0.040
#> GSM154291 4 0.0000 1.000 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM154304 2 0.2980 0.778 0.000 0.808 0.000 0.000 0.180 0.012
#> GSM154305 2 0.3403 0.764 0.000 0.768 0.000 0.000 0.212 0.020
#> GSM154306 4 0.0000 1.000 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM154262 1 0.1124 0.969 0.956 0.000 0.008 0.000 0.000 0.036
#> GSM154263 1 0.0146 0.975 0.996 0.000 0.000 0.000 0.000 0.004
#> GSM154264 1 0.0547 0.974 0.980 0.000 0.000 0.000 0.000 0.020
#> GSM154277 4 0.0000 1.000 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM154278 5 0.4122 0.834 0.000 0.212 0.000 0.000 0.724 0.064
#> GSM154279 5 0.3927 0.853 0.000 0.172 0.000 0.000 0.756 0.072
#> GSM154292 2 0.1168 0.850 0.000 0.956 0.000 0.000 0.016 0.028
#> GSM154293 2 0.1262 0.851 0.000 0.956 0.000 0.008 0.016 0.020
#> GSM154294 4 0.0000 1.000 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM154307 2 0.0820 0.853 0.000 0.972 0.000 0.000 0.012 0.016
#> GSM154308 2 0.0725 0.853 0.000 0.976 0.000 0.000 0.012 0.012
#> GSM154309 2 0.0820 0.853 0.000 0.972 0.000 0.000 0.012 0.016
#> GSM154265 1 0.1124 0.969 0.956 0.000 0.008 0.000 0.000 0.036
#> GSM154266 1 0.0000 0.975 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM154267 1 0.0547 0.974 0.980 0.000 0.000 0.000 0.000 0.020
#> GSM154280 6 0.2915 0.687 0.000 0.000 0.008 0.000 0.184 0.808
#> GSM154281 6 0.3161 0.680 0.000 0.000 0.008 0.000 0.216 0.776
#> GSM154282 6 0.3323 0.649 0.000 0.000 0.008 0.000 0.240 0.752
#> GSM154295 6 0.2805 0.853 0.000 0.004 0.184 0.000 0.000 0.812
#> GSM154296 6 0.2597 0.854 0.000 0.000 0.176 0.000 0.000 0.824
#> GSM154297 6 0.2597 0.854 0.000 0.000 0.176 0.000 0.000 0.824
#> GSM154310 6 0.2805 0.853 0.000 0.004 0.184 0.000 0.000 0.812
#> GSM154311 6 0.2838 0.851 0.000 0.004 0.188 0.000 0.000 0.808
#> GSM154312 6 0.2838 0.851 0.000 0.004 0.188 0.000 0.000 0.808
#> GSM154268 1 0.0000 0.975 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM154269 1 0.1124 0.969 0.956 0.000 0.008 0.000 0.000 0.036
#> GSM154270 1 0.0547 0.974 0.980 0.000 0.000 0.000 0.000 0.020
#> GSM154283 5 0.3923 0.834 0.000 0.192 0.000 0.000 0.748 0.060
#> GSM154284 5 0.3736 0.851 0.000 0.156 0.000 0.000 0.776 0.068
#> GSM154285 5 0.4199 0.841 0.000 0.164 0.000 0.000 0.736 0.100
#> GSM154298 2 0.2704 0.766 0.000 0.844 0.000 0.000 0.140 0.016
#> GSM154299 2 0.3422 0.722 0.000 0.792 0.000 0.000 0.168 0.040
#> GSM154300 2 0.3658 0.739 0.000 0.752 0.000 0.000 0.216 0.032
#> GSM154313 2 0.0909 0.845 0.000 0.968 0.000 0.000 0.020 0.012
#> GSM154314 2 0.0909 0.845 0.000 0.968 0.000 0.000 0.020 0.012
#> GSM154315 4 0.0000 1.000 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM154271 1 0.1124 0.969 0.956 0.000 0.008 0.000 0.000 0.036
#> GSM154272 1 0.1124 0.969 0.956 0.000 0.008 0.000 0.000 0.036
#> GSM154273 1 0.0547 0.974 0.980 0.000 0.000 0.000 0.000 0.020
#> GSM154286 3 0.2462 0.834 0.096 0.000 0.876 0.000 0.000 0.028
#> GSM154287 3 0.1225 0.918 0.012 0.000 0.952 0.000 0.000 0.036
#> GSM154288 4 0.0000 1.000 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM154301 3 0.0260 0.958 0.000 0.000 0.992 0.000 0.000 0.008
#> GSM154302 3 0.0260 0.958 0.000 0.000 0.992 0.000 0.000 0.008
#> GSM154303 4 0.0000 1.000 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM154316 3 0.0260 0.958 0.000 0.000 0.992 0.000 0.000 0.008
#> GSM154317 3 0.0260 0.958 0.000 0.000 0.992 0.000 0.000 0.008
#> GSM154318 3 0.0260 0.958 0.000 0.000 0.992 0.000 0.000 0.008
Heatmaps for the consensus matrix. It visualizes the probability of two samples to be in a same group.
consensus_heatmap(res, k = 2)
consensus_heatmap(res, k = 3)
consensus_heatmap(res, k = 4)
consensus_heatmap(res, k = 5)
consensus_heatmap(res, k = 6)
Heatmaps for the membership of samples in all partitions to see how consistent they are:
membership_heatmap(res, k = 2)
membership_heatmap(res, k = 3)
membership_heatmap(res, k = 4)
membership_heatmap(res, k = 5)
membership_heatmap(res, k = 6)
As soon as we have had the classes for columns, we can look for signatures which are significantly different between classes which can be candidate marks for certain classes. Following are the heatmaps for signatures.
Signature heatmaps where rows are scaled:
get_signatures(res, k = 2)
get_signatures(res, k = 3)
get_signatures(res, k = 4)
get_signatures(res, k = 5)
get_signatures(res, k = 6)
Signature heatmaps where rows are not scaled:
get_signatures(res, k = 2, scale_rows = FALSE)
get_signatures(res, k = 3, scale_rows = FALSE)
get_signatures(res, k = 4, scale_rows = FALSE)
get_signatures(res, k = 5, scale_rows = FALSE)
get_signatures(res, k = 6, scale_rows = FALSE)
Compare the overlap of signatures from different k:
compare_signatures(res)
get_signature()
returns a data frame invisibly. TO get the list of signatures, the function
call should be assigned to a variable explicitly. In following code, if plot
argument is set
to FALSE
, no heatmap is plotted while only the differential analysis is performed.
# code only for demonstration
tb = get_signature(res, k = ..., plot = FALSE)
An example of the output of tb
is:
#> which_row fdr mean_1 mean_2 scaled_mean_1 scaled_mean_2 km
#> 1 38 0.042760348 8.373488 9.131774 -0.5533452 0.5164555 1
#> 2 40 0.018707592 7.106213 8.469186 -0.6173731 0.5762149 1
#> 3 55 0.019134737 10.221463 11.207825 -0.6159697 0.5749050 1
#> 4 59 0.006059896 5.921854 7.869574 -0.6899429 0.6439467 1
#> 5 60 0.018055526 8.928898 10.211722 -0.6204761 0.5791110 1
#> 6 98 0.009384629 15.714769 14.887706 0.6635654 -0.6193277 2
...
The columns in tb
are:
which_row
: row indices corresponding to the input matrix.fdr
: FDR for the differential test. mean_x
: The mean value in group x.scaled_mean_x
: The mean value in group x after rows are scaled.km
: Row groups if k-means clustering is applied to rows.UMAP plot which shows how samples are separated.
dimension_reduction(res, k = 2, method = "UMAP")
dimension_reduction(res, k = 3, method = "UMAP")
dimension_reduction(res, k = 4, method = "UMAP")
dimension_reduction(res, k = 5, method = "UMAP")
dimension_reduction(res, k = 6, method = "UMAP")
Following heatmap shows how subgroups are split when increasing k
:
collect_classes(res)
Test correlation between subgroups and known annotations. If the known annotation is numeric, one-way ANOVA test is applied, and if the known annotation is discrete, chi-squared contingency table test is applied.
test_to_known_factors(res)
#> n agent(p) time(p) k
#> CV:skmeans 58 6.85e-05 1.03e-04 2
#> CV:skmeans 60 6.88e-03 2.85e-06 3
#> CV:skmeans 60 3.70e-05 9.96e-10 4
#> CV:skmeans 59 6.78e-03 9.34e-17 5
#> CV:skmeans 60 2.09e-09 5.37e-13 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 38950 rows and 60 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 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.448 0.759 0.829 0.3013 0.790 0.790
#> 3 3 1.000 0.979 0.993 0.7845 0.678 0.593
#> 4 4 1.000 0.961 0.985 0.3446 0.785 0.553
#> 5 5 0.895 0.856 0.881 0.0521 0.964 0.872
#> 6 6 0.796 0.683 0.806 0.0745 0.849 0.460
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] 3
There is also optional best \(k\) = 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
#> GSM154259 2 0.961 0.653 0.384 0.616
#> GSM154260 2 0.961 0.653 0.384 0.616
#> GSM154261 2 0.961 0.653 0.384 0.616
#> GSM154274 2 0.000 0.771 0.000 1.000
#> GSM154275 2 0.000 0.771 0.000 1.000
#> GSM154276 2 0.000 0.771 0.000 1.000
#> GSM154289 2 0.000 0.771 0.000 1.000
#> GSM154290 2 0.000 0.771 0.000 1.000
#> GSM154291 1 0.961 1.000 0.616 0.384
#> GSM154304 2 0.000 0.771 0.000 1.000
#> GSM154305 2 0.000 0.771 0.000 1.000
#> GSM154306 1 0.961 1.000 0.616 0.384
#> GSM154262 2 0.961 0.653 0.384 0.616
#> GSM154263 2 0.961 0.653 0.384 0.616
#> GSM154264 2 0.961 0.653 0.384 0.616
#> GSM154277 1 0.961 1.000 0.616 0.384
#> GSM154278 2 0.000 0.771 0.000 1.000
#> GSM154279 2 0.000 0.771 0.000 1.000
#> GSM154292 2 0.000 0.771 0.000 1.000
#> GSM154293 2 0.000 0.771 0.000 1.000
#> GSM154294 1 0.961 1.000 0.616 0.384
#> GSM154307 2 0.000 0.771 0.000 1.000
#> GSM154308 2 0.000 0.771 0.000 1.000
#> GSM154309 2 0.000 0.771 0.000 1.000
#> GSM154265 2 0.961 0.653 0.384 0.616
#> GSM154266 2 0.961 0.653 0.384 0.616
#> GSM154267 2 0.961 0.653 0.384 0.616
#> GSM154280 2 0.000 0.771 0.000 1.000
#> GSM154281 2 0.000 0.771 0.000 1.000
#> GSM154282 2 0.000 0.771 0.000 1.000
#> GSM154295 2 0.000 0.771 0.000 1.000
#> GSM154296 2 0.000 0.771 0.000 1.000
#> GSM154297 2 0.000 0.771 0.000 1.000
#> GSM154310 2 0.000 0.771 0.000 1.000
#> GSM154311 2 0.000 0.771 0.000 1.000
#> GSM154312 2 0.000 0.771 0.000 1.000
#> GSM154268 2 0.961 0.653 0.384 0.616
#> GSM154269 2 0.961 0.653 0.384 0.616
#> GSM154270 2 0.961 0.653 0.384 0.616
#> GSM154283 2 0.000 0.771 0.000 1.000
#> GSM154284 2 0.000 0.771 0.000 1.000
#> GSM154285 2 0.000 0.771 0.000 1.000
#> GSM154298 2 0.000 0.771 0.000 1.000
#> GSM154299 2 0.000 0.771 0.000 1.000
#> GSM154300 2 0.000 0.771 0.000 1.000
#> GSM154313 2 0.000 0.771 0.000 1.000
#> GSM154314 2 0.000 0.771 0.000 1.000
#> GSM154315 1 0.961 1.000 0.616 0.384
#> GSM154271 2 0.961 0.653 0.384 0.616
#> GSM154272 2 0.961 0.653 0.384 0.616
#> GSM154273 2 0.961 0.653 0.384 0.616
#> GSM154286 2 0.939 0.664 0.356 0.644
#> GSM154287 2 0.939 0.664 0.356 0.644
#> GSM154288 1 0.961 1.000 0.616 0.384
#> GSM154301 2 0.939 0.664 0.356 0.644
#> GSM154302 2 0.891 0.679 0.308 0.692
#> GSM154303 1 0.961 1.000 0.616 0.384
#> GSM154316 2 0.625 0.727 0.156 0.844
#> GSM154317 2 0.625 0.727 0.156 0.844
#> GSM154318 2 0.574 0.732 0.136 0.864
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> GSM154259 1 0.0000 1.000 1.000 0.000 0
#> GSM154260 1 0.0000 1.000 1.000 0.000 0
#> GSM154261 1 0.0000 1.000 1.000 0.000 0
#> GSM154274 2 0.0000 0.987 0.000 1.000 0
#> GSM154275 2 0.0000 0.987 0.000 1.000 0
#> GSM154276 2 0.0000 0.987 0.000 1.000 0
#> GSM154289 2 0.0000 0.987 0.000 1.000 0
#> GSM154290 2 0.0000 0.987 0.000 1.000 0
#> GSM154291 3 0.0000 1.000 0.000 0.000 1
#> GSM154304 2 0.0000 0.987 0.000 1.000 0
#> GSM154305 2 0.0000 0.987 0.000 1.000 0
#> GSM154306 3 0.0000 1.000 0.000 0.000 1
#> GSM154262 1 0.0000 1.000 1.000 0.000 0
#> GSM154263 1 0.0000 1.000 1.000 0.000 0
#> GSM154264 1 0.0000 1.000 1.000 0.000 0
#> GSM154277 3 0.0000 1.000 0.000 0.000 1
#> GSM154278 2 0.0000 0.987 0.000 1.000 0
#> GSM154279 2 0.0000 0.987 0.000 1.000 0
#> GSM154292 2 0.0000 0.987 0.000 1.000 0
#> GSM154293 2 0.0000 0.987 0.000 1.000 0
#> GSM154294 3 0.0000 1.000 0.000 0.000 1
#> GSM154307 2 0.0000 0.987 0.000 1.000 0
#> GSM154308 2 0.0000 0.987 0.000 1.000 0
#> GSM154309 2 0.0000 0.987 0.000 1.000 0
#> GSM154265 1 0.0000 1.000 1.000 0.000 0
#> GSM154266 1 0.0000 1.000 1.000 0.000 0
#> GSM154267 1 0.0000 1.000 1.000 0.000 0
#> GSM154280 2 0.0000 0.987 0.000 1.000 0
#> GSM154281 2 0.0000 0.987 0.000 1.000 0
#> GSM154282 2 0.0000 0.987 0.000 1.000 0
#> GSM154295 2 0.0000 0.987 0.000 1.000 0
#> GSM154296 2 0.0000 0.987 0.000 1.000 0
#> GSM154297 2 0.0000 0.987 0.000 1.000 0
#> GSM154310 2 0.0000 0.987 0.000 1.000 0
#> GSM154311 2 0.0000 0.987 0.000 1.000 0
#> GSM154312 2 0.0000 0.987 0.000 1.000 0
#> GSM154268 1 0.0000 1.000 1.000 0.000 0
#> GSM154269 1 0.0000 1.000 1.000 0.000 0
#> GSM154270 1 0.0000 1.000 1.000 0.000 0
#> GSM154283 2 0.0000 0.987 0.000 1.000 0
#> GSM154284 2 0.0000 0.987 0.000 1.000 0
#> GSM154285 2 0.0000 0.987 0.000 1.000 0
#> GSM154298 2 0.0000 0.987 0.000 1.000 0
#> GSM154299 2 0.0000 0.987 0.000 1.000 0
#> GSM154300 2 0.0000 0.987 0.000 1.000 0
#> GSM154313 2 0.0000 0.987 0.000 1.000 0
#> GSM154314 2 0.0000 0.987 0.000 1.000 0
#> GSM154315 3 0.0000 1.000 0.000 0.000 1
#> GSM154271 1 0.0000 1.000 1.000 0.000 0
#> GSM154272 1 0.0000 1.000 1.000 0.000 0
#> GSM154273 1 0.0000 1.000 1.000 0.000 0
#> GSM154286 2 0.0000 0.987 0.000 1.000 0
#> GSM154287 2 0.6244 0.215 0.440 0.560 0
#> GSM154288 3 0.0000 1.000 0.000 0.000 1
#> GSM154301 2 0.0237 0.983 0.004 0.996 0
#> GSM154302 2 0.0000 0.987 0.000 1.000 0
#> GSM154303 3 0.0000 1.000 0.000 0.000 1
#> GSM154316 2 0.0000 0.987 0.000 1.000 0
#> GSM154317 2 0.0000 0.987 0.000 1.000 0
#> GSM154318 2 0.0000 0.987 0.000 1.000 0
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> GSM154259 1 0.0000 1.000 1.000 0.000 0.000 0.000
#> GSM154260 1 0.0000 1.000 1.000 0.000 0.000 0.000
#> GSM154261 1 0.0000 1.000 1.000 0.000 0.000 0.000
#> GSM154274 2 0.2469 0.866 0.000 0.892 0.108 0.000
#> GSM154275 2 0.0000 0.981 0.000 1.000 0.000 0.000
#> GSM154276 2 0.0000 0.981 0.000 1.000 0.000 0.000
#> GSM154289 2 0.0000 0.981 0.000 1.000 0.000 0.000
#> GSM154290 2 0.0000 0.981 0.000 1.000 0.000 0.000
#> GSM154291 4 0.0000 1.000 0.000 0.000 0.000 1.000
#> GSM154304 2 0.0336 0.977 0.000 0.992 0.008 0.000
#> GSM154305 2 0.0188 0.979 0.000 0.996 0.004 0.000
#> GSM154306 4 0.0000 1.000 0.000 0.000 0.000 1.000
#> GSM154262 1 0.0000 1.000 1.000 0.000 0.000 0.000
#> GSM154263 1 0.0000 1.000 1.000 0.000 0.000 0.000
#> GSM154264 1 0.0000 1.000 1.000 0.000 0.000 0.000
#> GSM154277 2 0.0817 0.963 0.000 0.976 0.000 0.024
#> GSM154278 2 0.0336 0.977 0.000 0.992 0.008 0.000
#> GSM154279 2 0.0000 0.981 0.000 1.000 0.000 0.000
#> GSM154292 2 0.0000 0.981 0.000 1.000 0.000 0.000
#> GSM154293 2 0.0000 0.981 0.000 1.000 0.000 0.000
#> GSM154294 4 0.0000 1.000 0.000 0.000 0.000 1.000
#> GSM154307 2 0.0336 0.977 0.000 0.992 0.008 0.000
#> GSM154308 2 0.0000 0.981 0.000 1.000 0.000 0.000
#> GSM154309 2 0.3649 0.742 0.000 0.796 0.204 0.000
#> GSM154265 1 0.0000 1.000 1.000 0.000 0.000 0.000
#> GSM154266 1 0.0000 1.000 1.000 0.000 0.000 0.000
#> GSM154267 1 0.0000 1.000 1.000 0.000 0.000 0.000
#> GSM154280 3 0.1792 0.880 0.000 0.068 0.932 0.000
#> GSM154281 3 0.0000 0.956 0.000 0.000 1.000 0.000
#> GSM154282 3 0.0000 0.956 0.000 0.000 1.000 0.000
#> GSM154295 3 0.0000 0.956 0.000 0.000 1.000 0.000
#> GSM154296 3 0.0000 0.956 0.000 0.000 1.000 0.000
#> GSM154297 3 0.0000 0.956 0.000 0.000 1.000 0.000
#> GSM154310 3 0.0000 0.956 0.000 0.000 1.000 0.000
#> GSM154311 3 0.0000 0.956 0.000 0.000 1.000 0.000
#> GSM154312 3 0.0000 0.956 0.000 0.000 1.000 0.000
#> GSM154268 1 0.0000 1.000 1.000 0.000 0.000 0.000
#> GSM154269 1 0.0000 1.000 1.000 0.000 0.000 0.000
#> GSM154270 1 0.0000 1.000 1.000 0.000 0.000 0.000
#> GSM154283 2 0.0000 0.981 0.000 1.000 0.000 0.000
#> GSM154284 2 0.0000 0.981 0.000 1.000 0.000 0.000
#> GSM154285 2 0.0000 0.981 0.000 1.000 0.000 0.000
#> GSM154298 2 0.0000 0.981 0.000 1.000 0.000 0.000
#> GSM154299 2 0.0000 0.981 0.000 1.000 0.000 0.000
#> GSM154300 2 0.0000 0.981 0.000 1.000 0.000 0.000
#> GSM154313 2 0.0000 0.981 0.000 1.000 0.000 0.000
#> GSM154314 2 0.0000 0.981 0.000 1.000 0.000 0.000
#> GSM154315 4 0.0000 1.000 0.000 0.000 0.000 1.000
#> GSM154271 1 0.0000 1.000 1.000 0.000 0.000 0.000
#> GSM154272 1 0.0000 1.000 1.000 0.000 0.000 0.000
#> GSM154273 1 0.0000 1.000 1.000 0.000 0.000 0.000
#> GSM154286 3 0.1584 0.916 0.036 0.012 0.952 0.000
#> GSM154287 3 0.4916 0.270 0.424 0.000 0.576 0.000
#> GSM154288 4 0.0000 1.000 0.000 0.000 0.000 1.000
#> GSM154301 3 0.0000 0.956 0.000 0.000 1.000 0.000
#> GSM154302 3 0.0000 0.956 0.000 0.000 1.000 0.000
#> GSM154303 4 0.0000 1.000 0.000 0.000 0.000 1.000
#> GSM154316 3 0.0000 0.956 0.000 0.000 1.000 0.000
#> GSM154317 3 0.0000 0.956 0.000 0.000 1.000 0.000
#> GSM154318 3 0.0000 0.956 0.000 0.000 1.000 0.000
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> GSM154259 1 0.4304 0.737 0.516 0.000 0.000 0.000 0.484
#> GSM154260 1 0.4304 0.729 0.516 0.000 0.484 0.000 0.000
#> GSM154261 1 0.4304 0.729 0.516 0.000 0.484 0.000 0.000
#> GSM154274 2 0.2834 0.872 0.060 0.888 0.012 0.000 0.040
#> GSM154275 2 0.0404 0.971 0.000 0.988 0.012 0.000 0.000
#> GSM154276 2 0.0404 0.971 0.000 0.988 0.012 0.000 0.000
#> GSM154289 2 0.0404 0.971 0.000 0.988 0.012 0.000 0.000
#> GSM154290 2 0.0404 0.971 0.000 0.988 0.012 0.000 0.000
#> GSM154291 4 0.0000 1.000 0.000 0.000 0.000 1.000 0.000
#> GSM154304 2 0.0566 0.970 0.004 0.984 0.012 0.000 0.000
#> GSM154305 2 0.0404 0.971 0.000 0.988 0.012 0.000 0.000
#> GSM154306 4 0.0000 1.000 0.000 0.000 0.000 1.000 0.000
#> GSM154262 1 0.4304 0.737 0.516 0.000 0.000 0.000 0.484
#> GSM154263 1 0.4557 0.730 0.516 0.000 0.476 0.000 0.008
#> GSM154264 1 0.4304 0.729 0.516 0.000 0.484 0.000 0.000
#> GSM154277 2 0.0880 0.954 0.000 0.968 0.000 0.032 0.000
#> GSM154278 2 0.0324 0.970 0.004 0.992 0.000 0.000 0.004
#> GSM154279 2 0.0000 0.973 0.000 1.000 0.000 0.000 0.000
#> GSM154292 2 0.0000 0.973 0.000 1.000 0.000 0.000 0.000
#> GSM154293 2 0.0000 0.973 0.000 1.000 0.000 0.000 0.000
#> GSM154294 4 0.0000 1.000 0.000 0.000 0.000 1.000 0.000
#> GSM154307 2 0.0566 0.966 0.004 0.984 0.000 0.000 0.012
#> GSM154308 2 0.0404 0.971 0.000 0.988 0.012 0.000 0.000
#> GSM154309 2 0.4173 0.518 0.300 0.688 0.000 0.000 0.012
#> GSM154265 1 0.4304 0.737 0.516 0.000 0.000 0.000 0.484
#> GSM154266 1 0.6275 0.741 0.516 0.000 0.176 0.000 0.308
#> GSM154267 1 0.4304 0.729 0.516 0.000 0.484 0.000 0.000
#> GSM154280 5 0.5836 0.736 0.384 0.100 0.000 0.000 0.516
#> GSM154281 5 0.4304 0.967 0.484 0.000 0.000 0.000 0.516
#> GSM154282 5 0.4304 0.967 0.484 0.000 0.000 0.000 0.516
#> GSM154295 5 0.4304 0.967 0.484 0.000 0.000 0.000 0.516
#> GSM154296 5 0.4304 0.967 0.484 0.000 0.000 0.000 0.516
#> GSM154297 5 0.4304 0.967 0.484 0.000 0.000 0.000 0.516
#> GSM154310 5 0.4304 0.967 0.484 0.000 0.000 0.000 0.516
#> GSM154311 5 0.4304 0.967 0.484 0.000 0.000 0.000 0.516
#> GSM154312 5 0.4304 0.967 0.484 0.000 0.000 0.000 0.516
#> GSM154268 1 0.4653 0.738 0.516 0.000 0.012 0.000 0.472
#> GSM154269 1 0.4304 0.737 0.516 0.000 0.000 0.000 0.484
#> GSM154270 1 0.4304 0.729 0.516 0.000 0.484 0.000 0.000
#> GSM154283 2 0.0000 0.973 0.000 1.000 0.000 0.000 0.000
#> GSM154284 2 0.0000 0.973 0.000 1.000 0.000 0.000 0.000
#> GSM154285 2 0.0000 0.973 0.000 1.000 0.000 0.000 0.000
#> GSM154298 2 0.0000 0.973 0.000 1.000 0.000 0.000 0.000
#> GSM154299 2 0.0000 0.973 0.000 1.000 0.000 0.000 0.000
#> GSM154300 2 0.0000 0.973 0.000 1.000 0.000 0.000 0.000
#> GSM154313 2 0.0000 0.973 0.000 1.000 0.000 0.000 0.000
#> GSM154314 2 0.0000 0.973 0.000 1.000 0.000 0.000 0.000
#> GSM154315 4 0.0000 1.000 0.000 0.000 0.000 1.000 0.000
#> GSM154271 1 0.4304 0.737 0.516 0.000 0.000 0.000 0.484
#> GSM154272 1 0.4304 0.737 0.516 0.000 0.000 0.000 0.484
#> GSM154273 1 0.4304 0.729 0.516 0.000 0.484 0.000 0.000
#> GSM154286 3 0.3355 0.455 0.184 0.000 0.804 0.000 0.012
#> GSM154287 3 0.4307 0.192 0.000 0.000 0.504 0.000 0.496
#> GSM154288 4 0.0000 1.000 0.000 0.000 0.000 1.000 0.000
#> GSM154301 3 0.4658 0.693 0.484 0.000 0.504 0.000 0.012
#> GSM154302 3 0.4658 0.693 0.484 0.000 0.504 0.000 0.012
#> GSM154303 4 0.0000 1.000 0.000 0.000 0.000 1.000 0.000
#> GSM154316 3 0.4658 0.693 0.484 0.000 0.504 0.000 0.012
#> GSM154317 3 0.4658 0.693 0.484 0.000 0.504 0.000 0.012
#> GSM154318 3 0.4658 0.693 0.484 0.000 0.504 0.000 0.012
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> GSM154259 1 0.0000 0.93912 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM154260 3 0.3804 0.00414 0.424 0.000 0.576 0.000 0.000 0.000
#> GSM154261 3 0.3804 0.00414 0.424 0.000 0.576 0.000 0.000 0.000
#> GSM154274 6 0.4527 0.82260 0.000 0.236 0.000 0.000 0.084 0.680
#> GSM154275 6 0.3482 0.95018 0.000 0.316 0.000 0.000 0.000 0.684
#> GSM154276 6 0.3482 0.95018 0.000 0.316 0.000 0.000 0.000 0.684
#> GSM154289 6 0.3482 0.95018 0.000 0.316 0.000 0.000 0.000 0.684
#> GSM154290 6 0.3482 0.95018 0.000 0.316 0.000 0.000 0.000 0.684
#> GSM154291 4 0.0000 0.90799 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM154304 6 0.3482 0.95018 0.000 0.316 0.000 0.000 0.000 0.684
#> GSM154305 6 0.3482 0.95018 0.000 0.316 0.000 0.000 0.000 0.684
#> GSM154306 4 0.0000 0.90799 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM154262 1 0.0000 0.93912 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM154263 3 0.3810 -0.00538 0.428 0.000 0.572 0.000 0.000 0.000
#> GSM154264 3 0.3804 0.00414 0.424 0.000 0.576 0.000 0.000 0.000
#> GSM154277 4 0.3984 0.15660 0.000 0.396 0.000 0.596 0.000 0.008
#> GSM154278 5 0.4002 0.13720 0.000 0.404 0.000 0.000 0.588 0.008
#> GSM154279 2 0.0717 0.88828 0.000 0.976 0.000 0.000 0.016 0.008
#> GSM154292 2 0.0260 0.90308 0.000 0.992 0.000 0.000 0.000 0.008
#> GSM154293 2 0.0260 0.90308 0.000 0.992 0.000 0.000 0.000 0.008
#> GSM154294 4 0.0000 0.90799 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM154307 2 0.4855 0.34405 0.000 0.640 0.000 0.000 0.256 0.104
#> GSM154308 6 0.3810 0.76793 0.000 0.428 0.000 0.000 0.000 0.572
#> GSM154309 2 0.4085 0.46681 0.000 0.704 0.000 0.000 0.252 0.044
#> GSM154265 1 0.0000 0.93912 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM154266 1 0.1387 0.87501 0.932 0.000 0.068 0.000 0.000 0.000
#> GSM154267 3 0.3804 0.00414 0.424 0.000 0.576 0.000 0.000 0.000
#> GSM154280 5 0.0000 0.93455 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM154281 5 0.0000 0.93455 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM154282 5 0.0000 0.93455 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM154295 5 0.0000 0.93455 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM154296 5 0.0000 0.93455 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM154297 5 0.0000 0.93455 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM154310 5 0.0000 0.93455 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM154311 5 0.0000 0.93455 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM154312 5 0.0000 0.93455 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM154268 1 0.3151 0.61092 0.748 0.000 0.252 0.000 0.000 0.000
#> GSM154269 1 0.0000 0.93912 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM154270 3 0.3804 0.00414 0.424 0.000 0.576 0.000 0.000 0.000
#> GSM154283 2 0.0000 0.90667 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM154284 2 0.0000 0.90667 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM154285 2 0.0000 0.90667 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM154298 2 0.0000 0.90667 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM154299 2 0.0000 0.90667 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM154300 2 0.0260 0.90308 0.000 0.992 0.000 0.000 0.000 0.008
#> GSM154313 2 0.0000 0.90667 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM154314 2 0.0000 0.90667 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM154315 4 0.0000 0.90799 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM154271 1 0.0000 0.93912 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM154272 1 0.0000 0.93912 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM154273 3 0.3804 0.00414 0.424 0.000 0.576 0.000 0.000 0.000
#> GSM154286 3 0.3725 0.33189 0.000 0.000 0.676 0.000 0.008 0.316
#> GSM154287 3 0.6017 0.20621 0.260 0.000 0.424 0.000 0.000 0.316
#> GSM154288 4 0.0000 0.90799 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM154301 3 0.6017 0.22458 0.000 0.000 0.424 0.000 0.260 0.316
#> GSM154302 3 0.6017 0.22458 0.000 0.000 0.424 0.000 0.260 0.316
#> GSM154303 4 0.0000 0.90799 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM154316 3 0.6017 0.22458 0.000 0.000 0.424 0.000 0.260 0.316
#> GSM154317 3 0.6017 0.22458 0.000 0.000 0.424 0.000 0.260 0.316
#> GSM154318 3 0.6017 0.22458 0.000 0.000 0.424 0.000 0.260 0.316
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 agent(p) time(p) k
#> CV:pam 60 6.29e-01 3.81e-01 2
#> CV:pam 59 9.40e-01 5.99e-11 3
#> CV:pam 59 3.64e-05 7.47e-10 4
#> CV:pam 58 1.08e-09 5.03e-09 5
#> CV:pam 42 1.51e-08 1.21e-05 6
If matrix rows can be associated to genes, consider to use functional_enrichment(res,
...)
to perform function enrichment for the signature genes. See this vignette for more detailed explanations.
The object with results only for a single top-value method and a single partition method can be extracted as:
res = res_list["CV", "mclust"]
# you can also extract it by
# res = res_list["CV:mclust"]
A summary of res
and all the functions that can be applied to it:
res
#> A 'ConsensusPartition' object with k = 2, 3, 4, 5, 6.
#> On a matrix with 38950 rows and 60 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 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.601 0.757 0.868 0.3219 0.765 0.765
#> 3 3 0.630 0.816 0.879 0.8027 0.662 0.569
#> 4 4 0.904 0.913 0.967 0.2382 0.810 0.595
#> 5 5 0.841 0.862 0.888 0.0942 0.906 0.671
#> 6 6 0.891 0.838 0.929 0.0410 0.944 0.741
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
#> GSM154259 2 0.000 0.610 0.000 1.000
#> GSM154260 2 0.605 0.271 0.148 0.852
#> GSM154261 2 0.000 0.610 0.000 1.000
#> GSM154274 2 0.952 0.828 0.372 0.628
#> GSM154275 2 0.952 0.828 0.372 0.628
#> GSM154276 2 0.952 0.828 0.372 0.628
#> GSM154289 2 0.952 0.828 0.372 0.628
#> GSM154290 2 0.952 0.828 0.372 0.628
#> GSM154291 1 0.952 0.898 0.628 0.372
#> GSM154304 2 0.952 0.828 0.372 0.628
#> GSM154305 2 0.991 0.767 0.444 0.556
#> GSM154306 1 0.952 0.898 0.628 0.372
#> GSM154262 2 0.000 0.610 0.000 1.000
#> GSM154263 2 0.000 0.610 0.000 1.000
#> GSM154264 2 0.000 0.610 0.000 1.000
#> GSM154277 1 0.952 0.898 0.628 0.372
#> GSM154278 2 0.952 0.828 0.372 0.628
#> GSM154279 2 0.952 0.828 0.372 0.628
#> GSM154292 2 0.952 0.828 0.372 0.628
#> GSM154293 1 0.876 -0.351 0.704 0.296
#> GSM154294 1 0.952 0.898 0.628 0.372
#> GSM154307 2 0.952 0.828 0.372 0.628
#> GSM154308 2 0.952 0.828 0.372 0.628
#> GSM154309 2 0.952 0.828 0.372 0.628
#> GSM154265 2 0.000 0.610 0.000 1.000
#> GSM154266 2 0.000 0.610 0.000 1.000
#> GSM154267 2 0.000 0.610 0.000 1.000
#> GSM154280 2 0.861 0.834 0.284 0.716
#> GSM154281 2 0.861 0.834 0.284 0.716
#> GSM154282 2 0.861 0.834 0.284 0.716
#> GSM154295 2 0.861 0.834 0.284 0.716
#> GSM154296 2 0.861 0.834 0.284 0.716
#> GSM154297 2 0.861 0.834 0.284 0.716
#> GSM154310 2 0.861 0.834 0.284 0.716
#> GSM154311 2 0.861 0.834 0.284 0.716
#> GSM154312 2 0.861 0.834 0.284 0.716
#> GSM154268 2 0.000 0.610 0.000 1.000
#> GSM154269 2 0.000 0.610 0.000 1.000
#> GSM154270 2 0.000 0.610 0.000 1.000
#> GSM154283 2 0.952 0.828 0.372 0.628
#> GSM154284 2 0.952 0.828 0.372 0.628
#> GSM154285 2 0.952 0.828 0.372 0.628
#> GSM154298 2 0.952 0.828 0.372 0.628
#> GSM154299 2 0.952 0.828 0.372 0.628
#> GSM154300 2 0.952 0.828 0.372 0.628
#> GSM154313 2 0.952 0.828 0.372 0.628
#> GSM154314 2 0.952 0.828 0.372 0.628
#> GSM154315 1 0.952 0.898 0.628 0.372
#> GSM154271 2 0.000 0.610 0.000 1.000
#> GSM154272 2 0.000 0.610 0.000 1.000
#> GSM154273 2 0.000 0.610 0.000 1.000
#> GSM154286 2 0.833 0.825 0.264 0.736
#> GSM154287 2 0.861 0.834 0.284 0.716
#> GSM154288 1 0.952 0.898 0.628 0.372
#> GSM154301 2 0.861 0.834 0.284 0.716
#> GSM154302 2 0.861 0.834 0.284 0.716
#> GSM154303 1 0.952 0.898 0.628 0.372
#> GSM154316 2 0.861 0.834 0.284 0.716
#> GSM154317 2 0.861 0.834 0.284 0.716
#> GSM154318 2 0.861 0.834 0.284 0.716
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> GSM154259 1 0.1964 0.921 0.944 0.056 0.000
#> GSM154260 1 0.1411 0.940 0.964 0.036 0.000
#> GSM154261 1 0.0000 0.979 1.000 0.000 0.000
#> GSM154274 2 0.0000 0.830 0.000 1.000 0.000
#> GSM154275 2 0.0747 0.824 0.016 0.984 0.000
#> GSM154276 2 0.0747 0.824 0.016 0.984 0.000
#> GSM154289 2 0.0000 0.830 0.000 1.000 0.000
#> GSM154290 2 0.0747 0.824 0.016 0.984 0.000
#> GSM154291 3 0.3816 1.000 0.148 0.000 0.852
#> GSM154304 2 0.0000 0.830 0.000 1.000 0.000
#> GSM154305 2 0.0747 0.824 0.016 0.984 0.000
#> GSM154306 3 0.3816 1.000 0.148 0.000 0.852
#> GSM154262 1 0.0747 0.975 0.984 0.016 0.000
#> GSM154263 1 0.0000 0.979 1.000 0.000 0.000
#> GSM154264 1 0.0000 0.979 1.000 0.000 0.000
#> GSM154277 3 0.3816 1.000 0.148 0.000 0.852
#> GSM154278 2 0.0000 0.830 0.000 1.000 0.000
#> GSM154279 2 0.0747 0.824 0.016 0.984 0.000
#> GSM154292 2 0.0000 0.830 0.000 1.000 0.000
#> GSM154293 2 0.0000 0.830 0.000 1.000 0.000
#> GSM154294 3 0.3816 1.000 0.148 0.000 0.852
#> GSM154307 2 0.0000 0.830 0.000 1.000 0.000
#> GSM154308 2 0.0000 0.830 0.000 1.000 0.000
#> GSM154309 2 0.0000 0.830 0.000 1.000 0.000
#> GSM154265 1 0.0747 0.975 0.984 0.016 0.000
#> GSM154266 1 0.0000 0.979 1.000 0.000 0.000
#> GSM154267 1 0.0000 0.979 1.000 0.000 0.000
#> GSM154280 2 0.4178 0.778 0.000 0.828 0.172
#> GSM154281 2 0.4178 0.778 0.000 0.828 0.172
#> GSM154282 2 0.4178 0.778 0.000 0.828 0.172
#> GSM154295 2 0.4178 0.778 0.000 0.828 0.172
#> GSM154296 2 0.4178 0.778 0.000 0.828 0.172
#> GSM154297 2 0.4178 0.778 0.000 0.828 0.172
#> GSM154310 2 0.4178 0.778 0.000 0.828 0.172
#> GSM154311 2 0.9294 0.426 0.344 0.484 0.172
#> GSM154312 2 0.9294 0.426 0.344 0.484 0.172
#> GSM154268 1 0.0000 0.979 1.000 0.000 0.000
#> GSM154269 1 0.0747 0.975 0.984 0.016 0.000
#> GSM154270 1 0.0000 0.979 1.000 0.000 0.000
#> GSM154283 2 0.0000 0.830 0.000 1.000 0.000
#> GSM154284 2 0.0747 0.824 0.016 0.984 0.000
#> GSM154285 2 0.0747 0.824 0.016 0.984 0.000
#> GSM154298 2 0.0000 0.830 0.000 1.000 0.000
#> GSM154299 2 0.0000 0.830 0.000 1.000 0.000
#> GSM154300 2 0.0747 0.824 0.016 0.984 0.000
#> GSM154313 2 0.0000 0.830 0.000 1.000 0.000
#> GSM154314 2 0.0000 0.830 0.000 1.000 0.000
#> GSM154315 3 0.3816 1.000 0.148 0.000 0.852
#> GSM154271 1 0.0747 0.975 0.984 0.016 0.000
#> GSM154272 1 0.0747 0.975 0.984 0.016 0.000
#> GSM154273 1 0.0000 0.979 1.000 0.000 0.000
#> GSM154286 2 0.9318 0.413 0.352 0.476 0.172
#> GSM154287 2 0.9318 0.413 0.352 0.476 0.172
#> GSM154288 3 0.3816 1.000 0.148 0.000 0.852
#> GSM154301 2 0.9318 0.413 0.352 0.476 0.172
#> GSM154302 2 0.9318 0.413 0.352 0.476 0.172
#> GSM154303 3 0.3816 1.000 0.148 0.000 0.852
#> GSM154316 2 0.9318 0.413 0.352 0.476 0.172
#> GSM154317 2 0.9318 0.413 0.352 0.476 0.172
#> GSM154318 2 0.9318 0.413 0.352 0.476 0.172
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> GSM154259 1 0.0188 0.9957 0.996 0.000 0.004 0
#> GSM154260 1 0.0000 0.9997 1.000 0.000 0.000 0
#> GSM154261 1 0.0000 0.9997 1.000 0.000 0.000 0
#> GSM154274 2 0.0000 0.9517 0.000 1.000 0.000 0
#> GSM154275 2 0.0000 0.9517 0.000 1.000 0.000 0
#> GSM154276 2 0.0000 0.9517 0.000 1.000 0.000 0
#> GSM154289 2 0.0000 0.9517 0.000 1.000 0.000 0
#> GSM154290 2 0.0000 0.9517 0.000 1.000 0.000 0
#> GSM154291 4 0.0000 1.0000 0.000 0.000 0.000 1
#> GSM154304 2 0.0000 0.9517 0.000 1.000 0.000 0
#> GSM154305 2 0.0000 0.9517 0.000 1.000 0.000 0
#> GSM154306 4 0.0000 1.0000 0.000 0.000 0.000 1
#> GSM154262 1 0.0000 0.9997 1.000 0.000 0.000 0
#> GSM154263 1 0.0000 0.9997 1.000 0.000 0.000 0
#> GSM154264 1 0.0000 0.9997 1.000 0.000 0.000 0
#> GSM154277 4 0.0000 1.0000 0.000 0.000 0.000 1
#> GSM154278 2 0.2647 0.8235 0.000 0.880 0.120 0
#> GSM154279 2 0.0000 0.9517 0.000 1.000 0.000 0
#> GSM154292 2 0.0000 0.9517 0.000 1.000 0.000 0
#> GSM154293 2 0.0817 0.9311 0.000 0.976 0.024 0
#> GSM154294 4 0.0000 1.0000 0.000 0.000 0.000 1
#> GSM154307 2 0.0000 0.9517 0.000 1.000 0.000 0
#> GSM154308 2 0.0469 0.9418 0.000 0.988 0.012 0
#> GSM154309 2 0.0000 0.9517 0.000 1.000 0.000 0
#> GSM154265 1 0.0000 0.9997 1.000 0.000 0.000 0
#> GSM154266 1 0.0000 0.9997 1.000 0.000 0.000 0
#> GSM154267 1 0.0000 0.9997 1.000 0.000 0.000 0
#> GSM154280 2 0.4761 0.3397 0.000 0.628 0.372 0
#> GSM154281 3 0.4961 0.2125 0.000 0.448 0.552 0
#> GSM154282 2 0.4961 0.0889 0.000 0.552 0.448 0
#> GSM154295 3 0.2530 0.8444 0.000 0.112 0.888 0
#> GSM154296 3 0.3486 0.7733 0.000 0.188 0.812 0
#> GSM154297 3 0.3024 0.8136 0.000 0.148 0.852 0
#> GSM154310 3 0.2530 0.8444 0.000 0.112 0.888 0
#> GSM154311 3 0.0000 0.8966 0.000 0.000 1.000 0
#> GSM154312 3 0.0000 0.8966 0.000 0.000 1.000 0
#> GSM154268 1 0.0000 0.9997 1.000 0.000 0.000 0
#> GSM154269 1 0.0000 0.9997 1.000 0.000 0.000 0
#> GSM154270 1 0.0000 0.9997 1.000 0.000 0.000 0
#> GSM154283 2 0.0000 0.9517 0.000 1.000 0.000 0
#> GSM154284 2 0.0000 0.9517 0.000 1.000 0.000 0
#> GSM154285 2 0.0000 0.9517 0.000 1.000 0.000 0
#> GSM154298 2 0.0000 0.9517 0.000 1.000 0.000 0
#> GSM154299 2 0.0000 0.9517 0.000 1.000 0.000 0
#> GSM154300 2 0.0000 0.9517 0.000 1.000 0.000 0
#> GSM154313 2 0.0000 0.9517 0.000 1.000 0.000 0
#> GSM154314 2 0.0000 0.9517 0.000 1.000 0.000 0
#> GSM154315 4 0.0000 1.0000 0.000 0.000 0.000 1
#> GSM154271 1 0.0000 0.9997 1.000 0.000 0.000 0
#> GSM154272 1 0.0000 0.9997 1.000 0.000 0.000 0
#> GSM154273 1 0.0000 0.9997 1.000 0.000 0.000 0
#> GSM154286 3 0.0000 0.8966 0.000 0.000 1.000 0
#> GSM154287 3 0.0000 0.8966 0.000 0.000 1.000 0
#> GSM154288 4 0.0000 1.0000 0.000 0.000 0.000 1
#> GSM154301 3 0.0000 0.8966 0.000 0.000 1.000 0
#> GSM154302 3 0.0000 0.8966 0.000 0.000 1.000 0
#> GSM154303 4 0.0000 1.0000 0.000 0.000 0.000 1
#> GSM154316 3 0.0000 0.8966 0.000 0.000 1.000 0
#> GSM154317 3 0.0000 0.8966 0.000 0.000 1.000 0
#> GSM154318 3 0.0000 0.8966 0.000 0.000 1.000 0
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> GSM154259 1 0.0880 0.844 0.968 0.000 0.032 0.000 0.000
#> GSM154260 1 0.3395 0.909 0.764 0.000 0.000 0.000 0.236
#> GSM154261 1 0.3336 0.912 0.772 0.000 0.000 0.000 0.228
#> GSM154274 5 0.4397 0.641 0.000 0.432 0.004 0.000 0.564
#> GSM154275 5 0.3521 0.821 0.000 0.232 0.004 0.000 0.764
#> GSM154276 5 0.3521 0.821 0.000 0.232 0.004 0.000 0.764
#> GSM154289 2 0.1671 0.891 0.000 0.924 0.000 0.000 0.076
#> GSM154290 5 0.3684 0.824 0.000 0.280 0.000 0.000 0.720
#> GSM154291 4 0.0000 0.994 0.000 0.000 0.000 1.000 0.000
#> GSM154304 2 0.0290 0.937 0.000 0.992 0.000 0.000 0.008
#> GSM154305 5 0.4150 0.747 0.000 0.388 0.000 0.000 0.612
#> GSM154306 4 0.0000 0.994 0.000 0.000 0.000 1.000 0.000
#> GSM154262 1 0.0000 0.865 1.000 0.000 0.000 0.000 0.000
#> GSM154263 1 0.3336 0.912 0.772 0.000 0.000 0.000 0.228
#> GSM154264 1 0.3336 0.912 0.772 0.000 0.000 0.000 0.228
#> GSM154277 4 0.1041 0.966 0.000 0.032 0.000 0.964 0.004
#> GSM154278 2 0.3692 0.692 0.000 0.812 0.136 0.000 0.052
#> GSM154279 5 0.3838 0.830 0.000 0.280 0.004 0.000 0.716
#> GSM154292 2 0.0000 0.940 0.000 1.000 0.000 0.000 0.000
#> GSM154293 2 0.0000 0.940 0.000 1.000 0.000 0.000 0.000
#> GSM154294 4 0.0000 0.994 0.000 0.000 0.000 1.000 0.000
#> GSM154307 2 0.1121 0.922 0.000 0.956 0.000 0.000 0.044
#> GSM154308 2 0.0000 0.940 0.000 1.000 0.000 0.000 0.000
#> GSM154309 2 0.1121 0.922 0.000 0.956 0.000 0.000 0.044
#> GSM154265 1 0.0000 0.865 1.000 0.000 0.000 0.000 0.000
#> GSM154266 1 0.3305 0.912 0.776 0.000 0.000 0.000 0.224
#> GSM154267 1 0.3336 0.912 0.772 0.000 0.000 0.000 0.228
#> GSM154280 5 0.6518 0.178 0.000 0.192 0.396 0.000 0.412
#> GSM154281 3 0.3912 0.756 0.000 0.108 0.804 0.000 0.088
#> GSM154282 3 0.6373 -0.218 0.000 0.164 0.424 0.000 0.412
#> GSM154295 3 0.1282 0.899 0.000 0.004 0.952 0.000 0.044
#> GSM154296 3 0.1522 0.894 0.000 0.012 0.944 0.000 0.044
#> GSM154297 3 0.2879 0.825 0.000 0.100 0.868 0.000 0.032
#> GSM154310 3 0.1282 0.899 0.000 0.004 0.952 0.000 0.044
#> GSM154311 3 0.0000 0.918 0.000 0.000 1.000 0.000 0.000
#> GSM154312 3 0.0000 0.918 0.000 0.000 1.000 0.000 0.000
#> GSM154268 1 0.3305 0.912 0.776 0.000 0.000 0.000 0.224
#> GSM154269 1 0.0000 0.865 1.000 0.000 0.000 0.000 0.000
#> GSM154270 1 0.3336 0.912 0.772 0.000 0.000 0.000 0.228
#> GSM154283 2 0.1270 0.915 0.000 0.948 0.000 0.000 0.052
#> GSM154284 5 0.3612 0.831 0.000 0.268 0.000 0.000 0.732
#> GSM154285 5 0.3884 0.827 0.000 0.288 0.004 0.000 0.708
#> GSM154298 2 0.0162 0.939 0.000 0.996 0.000 0.000 0.004
#> GSM154299 2 0.0880 0.933 0.000 0.968 0.000 0.000 0.032
#> GSM154300 5 0.4227 0.708 0.000 0.420 0.000 0.000 0.580
#> GSM154313 2 0.0162 0.939 0.000 0.996 0.000 0.000 0.004
#> GSM154314 2 0.0162 0.939 0.000 0.996 0.000 0.000 0.004
#> GSM154315 4 0.0000 0.994 0.000 0.000 0.000 1.000 0.000
#> GSM154271 1 0.0000 0.865 1.000 0.000 0.000 0.000 0.000
#> GSM154272 1 0.0000 0.865 1.000 0.000 0.000 0.000 0.000
#> GSM154273 1 0.3336 0.912 0.772 0.000 0.000 0.000 0.228
#> GSM154286 3 0.0162 0.917 0.000 0.000 0.996 0.000 0.004
#> GSM154287 3 0.0000 0.918 0.000 0.000 1.000 0.000 0.000
#> GSM154288 4 0.0000 0.994 0.000 0.000 0.000 1.000 0.000
#> GSM154301 3 0.0000 0.918 0.000 0.000 1.000 0.000 0.000
#> GSM154302 3 0.0000 0.918 0.000 0.000 1.000 0.000 0.000
#> GSM154303 4 0.0000 0.994 0.000 0.000 0.000 1.000 0.000
#> GSM154316 3 0.0000 0.918 0.000 0.000 1.000 0.000 0.000
#> GSM154317 3 0.0000 0.918 0.000 0.000 1.000 0.000 0.000
#> GSM154318 3 0.0000 0.918 0.000 0.000 1.000 0.000 0.000
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> GSM154259 6 0.3101 0.691 0.244 0.000 0.000 0.000 0.000 0.756
#> GSM154260 1 0.0260 0.978 0.992 0.000 0.000 0.000 0.000 0.008
#> GSM154261 1 0.0000 0.985 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM154274 2 0.3862 0.105 0.000 0.524 0.000 0.000 0.476 0.000
#> GSM154275 5 0.0000 0.857 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM154276 5 0.0000 0.857 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM154289 2 0.1910 0.822 0.000 0.892 0.000 0.000 0.108 0.000
#> GSM154290 5 0.1267 0.859 0.000 0.060 0.000 0.000 0.940 0.000
#> GSM154291 4 0.0000 0.998 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM154304 2 0.1204 0.855 0.000 0.944 0.000 0.000 0.056 0.000
#> GSM154305 5 0.3515 0.431 0.000 0.324 0.000 0.000 0.676 0.000
#> GSM154306 4 0.0000 0.998 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM154262 6 0.0632 0.941 0.024 0.000 0.000 0.000 0.000 0.976
#> GSM154263 1 0.0363 0.992 0.988 0.000 0.000 0.000 0.000 0.012
#> GSM154264 1 0.0363 0.992 0.988 0.000 0.000 0.000 0.000 0.012
#> GSM154277 4 0.0000 0.998 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM154278 2 0.4192 0.153 0.000 0.572 0.412 0.000 0.016 0.000
#> GSM154279 5 0.1075 0.873 0.000 0.048 0.000 0.000 0.952 0.000
#> GSM154292 2 0.1444 0.847 0.000 0.928 0.000 0.000 0.072 0.000
#> GSM154293 2 0.2883 0.696 0.000 0.788 0.000 0.000 0.212 0.000
#> GSM154294 4 0.0000 0.998 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM154307 2 0.0000 0.868 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM154308 2 0.0000 0.868 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM154309 2 0.0000 0.868 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM154265 6 0.0363 0.947 0.012 0.000 0.000 0.000 0.000 0.988
#> GSM154266 1 0.0632 0.985 0.976 0.000 0.000 0.000 0.000 0.024
#> GSM154267 1 0.0363 0.992 0.988 0.000 0.000 0.000 0.000 0.012
#> GSM154280 3 0.5421 0.294 0.000 0.340 0.528 0.000 0.132 0.000
#> GSM154281 3 0.3725 0.541 0.000 0.316 0.676 0.000 0.008 0.000
#> GSM154282 3 0.5105 0.364 0.000 0.340 0.564 0.000 0.096 0.000
#> GSM154295 3 0.0000 0.874 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM154296 3 0.1141 0.844 0.000 0.052 0.948 0.000 0.000 0.000
#> GSM154297 3 0.3351 0.595 0.000 0.288 0.712 0.000 0.000 0.000
#> GSM154310 3 0.0000 0.874 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM154311 3 0.0000 0.874 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM154312 3 0.0000 0.874 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM154268 1 0.0632 0.985 0.976 0.000 0.000 0.000 0.000 0.024
#> GSM154269 6 0.0363 0.947 0.012 0.000 0.000 0.000 0.000 0.988
#> GSM154270 1 0.0363 0.992 0.988 0.000 0.000 0.000 0.000 0.012
#> GSM154283 2 0.0260 0.866 0.000 0.992 0.000 0.000 0.008 0.000
#> GSM154284 5 0.0937 0.874 0.000 0.040 0.000 0.000 0.960 0.000
#> GSM154285 5 0.1204 0.871 0.000 0.056 0.000 0.000 0.944 0.000
#> GSM154298 2 0.0000 0.868 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM154299 2 0.1387 0.850 0.000 0.932 0.000 0.000 0.068 0.000
#> GSM154300 5 0.3050 0.705 0.000 0.236 0.000 0.000 0.764 0.000
#> GSM154313 2 0.0000 0.868 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM154314 2 0.0000 0.868 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM154315 4 0.0000 0.998 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM154271 6 0.0363 0.947 0.012 0.000 0.000 0.000 0.000 0.988
#> GSM154272 6 0.0363 0.947 0.012 0.000 0.000 0.000 0.000 0.988
#> GSM154273 1 0.0363 0.992 0.988 0.000 0.000 0.000 0.000 0.012
#> GSM154286 3 0.0146 0.874 0.000 0.000 0.996 0.000 0.000 0.004
#> GSM154287 3 0.0146 0.874 0.000 0.000 0.996 0.000 0.000 0.004
#> GSM154288 4 0.0260 0.995 0.000 0.000 0.000 0.992 0.000 0.008
#> GSM154301 3 0.0146 0.874 0.000 0.000 0.996 0.000 0.000 0.004
#> GSM154302 3 0.0146 0.874 0.000 0.000 0.996 0.000 0.000 0.004
#> GSM154303 4 0.0260 0.995 0.000 0.000 0.000 0.992 0.000 0.008
#> GSM154316 3 0.0146 0.874 0.000 0.000 0.996 0.000 0.000 0.004
#> GSM154317 3 0.0146 0.874 0.000 0.000 0.996 0.000 0.000 0.004
#> GSM154318 3 0.0146 0.874 0.000 0.000 0.996 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 agent(p) time(p) k
#> CV:mclust 58 5.89e-01 3.73e-01 2
#> CV:mclust 51 3.03e-01 2.52e-09 3
#> CV:mclust 57 1.89e-04 1.46e-09 4
#> CV:mclust 58 8.95e-05 5.02e-10 5
#> CV:mclust 55 3.53e-03 5.54e-09 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 38950 rows and 60 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 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.410 0.721 0.881 0.4696 0.494 0.494
#> 3 3 0.925 0.941 0.976 0.2497 0.742 0.554
#> 4 4 0.892 0.912 0.959 0.2247 0.832 0.609
#> 5 5 0.783 0.788 0.856 0.1018 0.903 0.669
#> 6 6 0.837 0.782 0.864 0.0495 0.929 0.678
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
#> GSM154259 1 0.0000 0.8452 1.000 0.000
#> GSM154260 1 0.0000 0.8452 1.000 0.000
#> GSM154261 1 0.0000 0.8452 1.000 0.000
#> GSM154274 2 0.9775 0.3486 0.412 0.588
#> GSM154275 2 0.7674 0.7259 0.224 0.776
#> GSM154276 2 0.8555 0.6442 0.280 0.720
#> GSM154289 2 0.5059 0.8212 0.112 0.888
#> GSM154290 2 0.0000 0.8432 0.000 1.000
#> GSM154291 2 0.0672 0.8409 0.008 0.992
#> GSM154304 2 0.0000 0.8432 0.000 1.000
#> GSM154305 2 0.0000 0.8432 0.000 1.000
#> GSM154306 2 0.0938 0.8390 0.012 0.988
#> GSM154262 1 0.0000 0.8452 1.000 0.000
#> GSM154263 1 0.0000 0.8452 1.000 0.000
#> GSM154264 1 0.0000 0.8452 1.000 0.000
#> GSM154277 2 0.0376 0.8421 0.004 0.996
#> GSM154278 2 0.9996 0.0599 0.488 0.512
#> GSM154279 2 0.6712 0.7803 0.176 0.824
#> GSM154292 2 0.0000 0.8432 0.000 1.000
#> GSM154293 2 0.0000 0.8432 0.000 1.000
#> GSM154294 2 0.0000 0.8432 0.000 1.000
#> GSM154307 2 0.6343 0.7942 0.160 0.840
#> GSM154308 2 0.0000 0.8432 0.000 1.000
#> GSM154309 2 0.6148 0.8000 0.152 0.848
#> GSM154265 1 0.0000 0.8452 1.000 0.000
#> GSM154266 1 0.0000 0.8452 1.000 0.000
#> GSM154267 1 0.0000 0.8452 1.000 0.000
#> GSM154280 1 0.9970 0.0781 0.532 0.468
#> GSM154281 1 0.8443 0.6009 0.728 0.272
#> GSM154282 1 0.9996 -0.0116 0.512 0.488
#> GSM154295 1 0.9358 0.4409 0.648 0.352
#> GSM154296 2 0.9710 0.3847 0.400 0.600
#> GSM154297 2 0.9170 0.5479 0.332 0.668
#> GSM154310 1 0.9754 0.2905 0.592 0.408
#> GSM154311 1 0.9977 0.0613 0.528 0.472
#> GSM154312 2 0.9686 0.3959 0.396 0.604
#> GSM154268 1 0.0000 0.8452 1.000 0.000
#> GSM154269 1 0.0000 0.8452 1.000 0.000
#> GSM154270 1 0.0000 0.8452 1.000 0.000
#> GSM154283 2 0.6712 0.7803 0.176 0.824
#> GSM154284 2 0.5059 0.8213 0.112 0.888
#> GSM154285 2 0.6148 0.8003 0.152 0.848
#> GSM154298 2 0.2423 0.8410 0.040 0.960
#> GSM154299 2 0.2603 0.8403 0.044 0.956
#> GSM154300 2 0.0000 0.8432 0.000 1.000
#> GSM154313 2 0.5629 0.8118 0.132 0.868
#> GSM154314 2 0.0000 0.8432 0.000 1.000
#> GSM154315 2 0.0672 0.8409 0.008 0.992
#> GSM154271 1 0.0000 0.8452 1.000 0.000
#> GSM154272 1 0.0000 0.8452 1.000 0.000
#> GSM154273 1 0.0000 0.8452 1.000 0.000
#> GSM154286 1 0.0672 0.8422 0.992 0.008
#> GSM154287 1 0.0376 0.8437 0.996 0.004
#> GSM154288 2 0.1414 0.8344 0.020 0.980
#> GSM154301 1 0.1414 0.8363 0.980 0.020
#> GSM154302 1 0.5946 0.7532 0.856 0.144
#> GSM154303 2 0.1414 0.8344 0.020 0.980
#> GSM154316 1 0.7815 0.6618 0.768 0.232
#> GSM154317 1 0.7299 0.6964 0.796 0.204
#> GSM154318 1 0.7453 0.6874 0.788 0.212
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> GSM154259 1 0.000 0.909 1.000 0.000 0.000
#> GSM154260 1 0.296 0.833 0.900 0.000 0.100
#> GSM154261 1 0.000 0.909 1.000 0.000 0.000
#> GSM154274 2 0.000 1.000 0.000 1.000 0.000
#> GSM154275 2 0.000 1.000 0.000 1.000 0.000
#> GSM154276 2 0.000 1.000 0.000 1.000 0.000
#> GSM154289 2 0.000 1.000 0.000 1.000 0.000
#> GSM154290 2 0.000 1.000 0.000 1.000 0.000
#> GSM154291 3 0.000 1.000 0.000 0.000 1.000
#> GSM154304 2 0.000 1.000 0.000 1.000 0.000
#> GSM154305 2 0.000 1.000 0.000 1.000 0.000
#> GSM154306 3 0.000 1.000 0.000 0.000 1.000
#> GSM154262 1 0.000 0.909 1.000 0.000 0.000
#> GSM154263 1 0.000 0.909 1.000 0.000 0.000
#> GSM154264 1 0.000 0.909 1.000 0.000 0.000
#> GSM154277 3 0.000 1.000 0.000 0.000 1.000
#> GSM154278 2 0.000 1.000 0.000 1.000 0.000
#> GSM154279 2 0.000 1.000 0.000 1.000 0.000
#> GSM154292 2 0.000 1.000 0.000 1.000 0.000
#> GSM154293 2 0.000 1.000 0.000 1.000 0.000
#> GSM154294 3 0.000 1.000 0.000 0.000 1.000
#> GSM154307 2 0.000 1.000 0.000 1.000 0.000
#> GSM154308 2 0.000 1.000 0.000 1.000 0.000
#> GSM154309 2 0.000 1.000 0.000 1.000 0.000
#> GSM154265 1 0.000 0.909 1.000 0.000 0.000
#> GSM154266 1 0.000 0.909 1.000 0.000 0.000
#> GSM154267 1 0.000 0.909 1.000 0.000 0.000
#> GSM154280 2 0.000 1.000 0.000 1.000 0.000
#> GSM154281 2 0.000 1.000 0.000 1.000 0.000
#> GSM154282 2 0.000 1.000 0.000 1.000 0.000
#> GSM154295 2 0.000 1.000 0.000 1.000 0.000
#> GSM154296 2 0.000 1.000 0.000 1.000 0.000
#> GSM154297 2 0.000 1.000 0.000 1.000 0.000
#> GSM154310 2 0.000 1.000 0.000 1.000 0.000
#> GSM154311 2 0.000 1.000 0.000 1.000 0.000
#> GSM154312 2 0.000 1.000 0.000 1.000 0.000
#> GSM154268 1 0.000 0.909 1.000 0.000 0.000
#> GSM154269 1 0.000 0.909 1.000 0.000 0.000
#> GSM154270 1 0.000 0.909 1.000 0.000 0.000
#> GSM154283 2 0.000 1.000 0.000 1.000 0.000
#> GSM154284 2 0.000 1.000 0.000 1.000 0.000
#> GSM154285 2 0.000 1.000 0.000 1.000 0.000
#> GSM154298 2 0.000 1.000 0.000 1.000 0.000
#> GSM154299 2 0.000 1.000 0.000 1.000 0.000
#> GSM154300 2 0.000 1.000 0.000 1.000 0.000
#> GSM154313 2 0.000 1.000 0.000 1.000 0.000
#> GSM154314 2 0.000 1.000 0.000 1.000 0.000
#> GSM154315 3 0.000 1.000 0.000 0.000 1.000
#> GSM154271 1 0.000 0.909 1.000 0.000 0.000
#> GSM154272 1 0.000 0.909 1.000 0.000 0.000
#> GSM154273 1 0.000 0.909 1.000 0.000 0.000
#> GSM154286 1 0.000 0.909 1.000 0.000 0.000
#> GSM154287 1 0.000 0.909 1.000 0.000 0.000
#> GSM154288 3 0.000 1.000 0.000 0.000 1.000
#> GSM154301 1 0.296 0.826 0.900 0.100 0.000
#> GSM154302 1 0.418 0.752 0.828 0.172 0.000
#> GSM154303 3 0.000 1.000 0.000 0.000 1.000
#> GSM154316 1 0.693 0.499 0.624 0.348 0.028
#> GSM154317 1 0.625 0.299 0.556 0.444 0.000
#> GSM154318 1 0.502 0.671 0.760 0.240 0.000
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> GSM154259 1 0.4250 0.706 0.724 0.000 0.276 0
#> GSM154260 1 0.0000 0.924 1.000 0.000 0.000 0
#> GSM154261 1 0.0000 0.924 1.000 0.000 0.000 0
#> GSM154274 2 0.0000 0.954 0.000 1.000 0.000 0
#> GSM154275 2 0.0336 0.950 0.008 0.992 0.000 0
#> GSM154276 2 0.0469 0.947 0.012 0.988 0.000 0
#> GSM154289 2 0.0000 0.954 0.000 1.000 0.000 0
#> GSM154290 2 0.0000 0.954 0.000 1.000 0.000 0
#> GSM154291 4 0.0000 1.000 0.000 0.000 0.000 1
#> GSM154304 2 0.0000 0.954 0.000 1.000 0.000 0
#> GSM154305 2 0.0000 0.954 0.000 1.000 0.000 0
#> GSM154306 4 0.0000 1.000 0.000 0.000 0.000 1
#> GSM154262 1 0.1022 0.918 0.968 0.000 0.032 0
#> GSM154263 1 0.0188 0.924 0.996 0.000 0.004 0
#> GSM154264 1 0.0000 0.924 1.000 0.000 0.000 0
#> GSM154277 4 0.0000 1.000 0.000 0.000 0.000 1
#> GSM154278 2 0.2081 0.887 0.000 0.916 0.084 0
#> GSM154279 2 0.0336 0.950 0.008 0.992 0.000 0
#> GSM154292 2 0.0000 0.954 0.000 1.000 0.000 0
#> GSM154293 2 0.0000 0.954 0.000 1.000 0.000 0
#> GSM154294 4 0.0000 1.000 0.000 0.000 0.000 1
#> GSM154307 2 0.1022 0.933 0.000 0.968 0.032 0
#> GSM154308 2 0.0188 0.953 0.000 0.996 0.004 0
#> GSM154309 2 0.0188 0.953 0.000 0.996 0.004 0
#> GSM154265 1 0.3356 0.823 0.824 0.000 0.176 0
#> GSM154266 1 0.0336 0.924 0.992 0.000 0.008 0
#> GSM154267 1 0.0000 0.924 1.000 0.000 0.000 0
#> GSM154280 2 0.3801 0.715 0.000 0.780 0.220 0
#> GSM154281 2 0.4981 0.165 0.000 0.536 0.464 0
#> GSM154282 2 0.4605 0.780 0.108 0.800 0.092 0
#> GSM154295 3 0.0188 0.954 0.000 0.004 0.996 0
#> GSM154296 3 0.1940 0.886 0.000 0.076 0.924 0
#> GSM154297 3 0.2921 0.804 0.000 0.140 0.860 0
#> GSM154310 3 0.0336 0.951 0.000 0.008 0.992 0
#> GSM154311 3 0.0000 0.956 0.000 0.000 1.000 0
#> GSM154312 3 0.0000 0.956 0.000 0.000 1.000 0
#> GSM154268 1 0.0336 0.924 0.992 0.000 0.008 0
#> GSM154269 1 0.4382 0.674 0.704 0.000 0.296 0
#> GSM154270 1 0.0000 0.924 1.000 0.000 0.000 0
#> GSM154283 2 0.0000 0.954 0.000 1.000 0.000 0
#> GSM154284 2 0.0000 0.954 0.000 1.000 0.000 0
#> GSM154285 2 0.0000 0.954 0.000 1.000 0.000 0
#> GSM154298 2 0.0188 0.953 0.000 0.996 0.004 0
#> GSM154299 2 0.0000 0.954 0.000 1.000 0.000 0
#> GSM154300 2 0.0000 0.954 0.000 1.000 0.000 0
#> GSM154313 2 0.0188 0.953 0.000 0.996 0.004 0
#> GSM154314 2 0.0000 0.954 0.000 1.000 0.000 0
#> GSM154315 4 0.0000 1.000 0.000 0.000 0.000 1
#> GSM154271 1 0.1211 0.914 0.960 0.000 0.040 0
#> GSM154272 1 0.3074 0.844 0.848 0.000 0.152 0
#> GSM154273 1 0.0000 0.924 1.000 0.000 0.000 0
#> GSM154286 3 0.3528 0.750 0.192 0.000 0.808 0
#> GSM154287 3 0.0000 0.956 0.000 0.000 1.000 0
#> GSM154288 4 0.0000 1.000 0.000 0.000 0.000 1
#> GSM154301 3 0.0000 0.956 0.000 0.000 1.000 0
#> GSM154302 3 0.0000 0.956 0.000 0.000 1.000 0
#> GSM154303 4 0.0000 1.000 0.000 0.000 0.000 1
#> GSM154316 3 0.0000 0.956 0.000 0.000 1.000 0
#> GSM154317 3 0.0000 0.956 0.000 0.000 1.000 0
#> GSM154318 3 0.0000 0.956 0.000 0.000 1.000 0
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> GSM154259 1 0.3375 0.8211 0.840 0.056 0.104 0 0.000
#> GSM154260 1 0.3246 0.8612 0.808 0.184 0.000 0 0.008
#> GSM154261 1 0.3246 0.8612 0.808 0.184 0.000 0 0.008
#> GSM154274 5 0.1671 0.6656 0.000 0.076 0.000 0 0.924
#> GSM154275 5 0.3928 0.4510 0.004 0.296 0.000 0 0.700
#> GSM154276 5 0.2773 0.6742 0.000 0.164 0.000 0 0.836
#> GSM154289 2 0.3766 0.9747 0.000 0.728 0.004 0 0.268
#> GSM154290 2 0.3636 0.9718 0.000 0.728 0.000 0 0.272
#> GSM154291 4 0.0000 1.0000 0.000 0.000 0.000 1 0.000
#> GSM154304 2 0.3715 0.9709 0.000 0.736 0.004 0 0.260
#> GSM154305 2 0.3366 0.9360 0.000 0.768 0.000 0 0.232
#> GSM154306 4 0.0000 1.0000 0.000 0.000 0.000 1 0.000
#> GSM154262 1 0.1251 0.8840 0.956 0.036 0.008 0 0.000
#> GSM154263 1 0.0290 0.8902 0.992 0.008 0.000 0 0.000
#> GSM154264 1 0.3171 0.8639 0.816 0.176 0.000 0 0.008
#> GSM154277 4 0.0000 1.0000 0.000 0.000 0.000 1 0.000
#> GSM154278 5 0.0981 0.7056 0.008 0.012 0.008 0 0.972
#> GSM154279 5 0.1965 0.6821 0.000 0.096 0.000 0 0.904
#> GSM154292 5 0.4101 0.0409 0.000 0.372 0.000 0 0.628
#> GSM154293 5 0.4268 -0.2946 0.000 0.444 0.000 0 0.556
#> GSM154294 4 0.0000 1.0000 0.000 0.000 0.000 1 0.000
#> GSM154307 2 0.4141 0.9528 0.000 0.728 0.024 0 0.248
#> GSM154308 2 0.3910 0.9740 0.000 0.720 0.008 0 0.272
#> GSM154309 2 0.3992 0.9733 0.000 0.720 0.012 0 0.268
#> GSM154265 1 0.2149 0.8710 0.916 0.048 0.036 0 0.000
#> GSM154266 1 0.0324 0.8903 0.992 0.004 0.004 0 0.000
#> GSM154267 1 0.2806 0.8711 0.844 0.152 0.000 0 0.004
#> GSM154280 5 0.4364 0.5501 0.000 0.048 0.216 0 0.736
#> GSM154281 5 0.3452 0.5419 0.000 0.000 0.244 0 0.756
#> GSM154282 5 0.4452 0.6075 0.004 0.164 0.072 0 0.760
#> GSM154295 3 0.0963 0.9222 0.000 0.000 0.964 0 0.036
#> GSM154296 3 0.3932 0.4972 0.000 0.000 0.672 0 0.328
#> GSM154297 5 0.4201 0.2129 0.000 0.000 0.408 0 0.592
#> GSM154310 3 0.1331 0.9170 0.000 0.008 0.952 0 0.040
#> GSM154311 3 0.1041 0.9210 0.000 0.032 0.964 0 0.004
#> GSM154312 3 0.0955 0.9243 0.000 0.004 0.968 0 0.028
#> GSM154268 1 0.0324 0.8903 0.992 0.004 0.004 0 0.000
#> GSM154269 1 0.3622 0.8013 0.820 0.056 0.124 0 0.000
#> GSM154270 1 0.3246 0.8612 0.808 0.184 0.000 0 0.008
#> GSM154283 5 0.0404 0.7041 0.000 0.012 0.000 0 0.988
#> GSM154284 5 0.0162 0.7059 0.000 0.004 0.000 0 0.996
#> GSM154285 5 0.0290 0.7053 0.000 0.008 0.000 0 0.992
#> GSM154298 5 0.3242 0.4929 0.000 0.216 0.000 0 0.784
#> GSM154299 5 0.0794 0.6975 0.000 0.028 0.000 0 0.972
#> GSM154300 5 0.4262 -0.0432 0.000 0.440 0.000 0 0.560
#> GSM154313 2 0.3885 0.9753 0.000 0.724 0.008 0 0.268
#> GSM154314 2 0.4130 0.9496 0.000 0.696 0.012 0 0.292
#> GSM154315 4 0.0000 1.0000 0.000 0.000 0.000 1 0.000
#> GSM154271 1 0.0898 0.8895 0.972 0.020 0.008 0 0.000
#> GSM154272 1 0.2067 0.8728 0.920 0.048 0.032 0 0.000
#> GSM154273 1 0.3209 0.8626 0.812 0.180 0.000 0 0.008
#> GSM154286 3 0.4124 0.7817 0.140 0.012 0.796 0 0.052
#> GSM154287 3 0.0807 0.9247 0.012 0.012 0.976 0 0.000
#> GSM154288 4 0.0000 1.0000 0.000 0.000 0.000 1 0.000
#> GSM154301 3 0.0992 0.9202 0.008 0.024 0.968 0 0.000
#> GSM154302 3 0.0290 0.9286 0.000 0.000 0.992 0 0.008
#> GSM154303 4 0.0000 1.0000 0.000 0.000 0.000 1 0.000
#> GSM154316 3 0.0290 0.9293 0.000 0.008 0.992 0 0.000
#> GSM154317 3 0.0162 0.9297 0.000 0.004 0.996 0 0.000
#> GSM154318 3 0.0162 0.9297 0.000 0.004 0.996 0 0.000
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> GSM154259 1 0.2665 0.695 0.868 0.000 0.016 0.000 0.012 0.104
#> GSM154260 6 0.3728 0.717 0.228 0.012 0.000 0.004 0.008 0.748
#> GSM154261 6 0.2854 0.721 0.208 0.000 0.000 0.000 0.000 0.792
#> GSM154274 5 0.2249 0.796 0.004 0.032 0.000 0.000 0.900 0.064
#> GSM154275 6 0.5436 -0.248 0.000 0.120 0.000 0.000 0.404 0.476
#> GSM154276 5 0.4026 0.449 0.000 0.012 0.000 0.000 0.612 0.376
#> GSM154289 2 0.2688 0.871 0.000 0.868 0.000 0.000 0.064 0.068
#> GSM154290 2 0.2250 0.866 0.000 0.888 0.000 0.000 0.020 0.092
#> GSM154291 4 0.0000 0.999 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM154304 2 0.1152 0.887 0.000 0.952 0.000 0.000 0.004 0.044
#> GSM154305 2 0.1501 0.876 0.000 0.924 0.000 0.000 0.000 0.076
#> GSM154306 4 0.0146 0.998 0.000 0.000 0.000 0.996 0.000 0.004
#> GSM154262 1 0.1075 0.793 0.952 0.000 0.000 0.000 0.000 0.048
#> GSM154263 1 0.3595 0.589 0.704 0.000 0.000 0.000 0.008 0.288
#> GSM154264 6 0.3198 0.722 0.260 0.000 0.000 0.000 0.000 0.740
#> GSM154277 4 0.0146 0.998 0.000 0.000 0.000 0.996 0.000 0.004
#> GSM154278 5 0.1448 0.807 0.012 0.024 0.000 0.000 0.948 0.016
#> GSM154279 5 0.1500 0.797 0.000 0.012 0.000 0.000 0.936 0.052
#> GSM154292 5 0.3851 0.223 0.000 0.460 0.000 0.000 0.540 0.000
#> GSM154293 5 0.4116 0.351 0.000 0.416 0.000 0.012 0.572 0.000
#> GSM154294 4 0.0000 0.999 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM154307 2 0.1251 0.888 0.024 0.956 0.008 0.000 0.012 0.000
#> GSM154308 2 0.0790 0.895 0.000 0.968 0.000 0.000 0.032 0.000
#> GSM154309 2 0.1049 0.894 0.000 0.960 0.008 0.000 0.032 0.000
#> GSM154265 1 0.1674 0.800 0.924 0.000 0.004 0.000 0.004 0.068
#> GSM154266 1 0.3674 0.629 0.716 0.000 0.000 0.000 0.016 0.268
#> GSM154267 6 0.3782 0.395 0.412 0.000 0.000 0.000 0.000 0.588
#> GSM154280 5 0.4276 0.591 0.000 0.020 0.256 0.000 0.700 0.024
#> GSM154281 5 0.2877 0.713 0.000 0.000 0.168 0.000 0.820 0.012
#> GSM154282 5 0.3493 0.724 0.000 0.000 0.064 0.000 0.800 0.136
#> GSM154295 3 0.0508 0.949 0.000 0.000 0.984 0.000 0.004 0.012
#> GSM154296 3 0.1686 0.916 0.000 0.000 0.924 0.000 0.064 0.012
#> GSM154297 3 0.2170 0.880 0.000 0.000 0.888 0.000 0.100 0.012
#> GSM154310 3 0.0767 0.947 0.000 0.004 0.976 0.000 0.008 0.012
#> GSM154311 3 0.0951 0.949 0.020 0.000 0.968 0.000 0.008 0.004
#> GSM154312 3 0.0260 0.950 0.000 0.000 0.992 0.000 0.000 0.008
#> GSM154268 1 0.3445 0.665 0.744 0.000 0.000 0.000 0.012 0.244
#> GSM154269 1 0.0935 0.765 0.964 0.000 0.004 0.000 0.000 0.032
#> GSM154270 6 0.3101 0.730 0.244 0.000 0.000 0.000 0.000 0.756
#> GSM154283 5 0.1124 0.808 0.000 0.036 0.000 0.000 0.956 0.008
#> GSM154284 5 0.1418 0.807 0.000 0.032 0.000 0.000 0.944 0.024
#> GSM154285 5 0.0972 0.807 0.000 0.028 0.000 0.000 0.964 0.008
#> GSM154298 5 0.2823 0.712 0.000 0.204 0.000 0.000 0.796 0.000
#> GSM154299 5 0.1802 0.801 0.000 0.072 0.000 0.000 0.916 0.012
#> GSM154300 2 0.5277 0.197 0.000 0.528 0.000 0.000 0.364 0.108
#> GSM154313 2 0.0790 0.895 0.000 0.968 0.000 0.000 0.032 0.000
#> GSM154314 2 0.1204 0.881 0.000 0.944 0.000 0.000 0.056 0.000
#> GSM154315 4 0.0146 0.998 0.000 0.000 0.000 0.996 0.000 0.004
#> GSM154271 1 0.2053 0.787 0.888 0.000 0.000 0.000 0.004 0.108
#> GSM154272 1 0.0935 0.800 0.964 0.000 0.004 0.000 0.000 0.032
#> GSM154273 6 0.3198 0.723 0.260 0.000 0.000 0.000 0.000 0.740
#> GSM154286 3 0.1856 0.934 0.024 0.008 0.932 0.000 0.028 0.008
#> GSM154287 3 0.2793 0.874 0.112 0.000 0.856 0.000 0.004 0.028
#> GSM154288 4 0.0000 0.999 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM154301 3 0.2085 0.922 0.056 0.000 0.912 0.000 0.008 0.024
#> GSM154302 3 0.0291 0.951 0.004 0.000 0.992 0.000 0.000 0.004
#> GSM154303 4 0.0000 0.999 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM154316 3 0.1485 0.939 0.028 0.000 0.944 0.000 0.004 0.024
#> GSM154317 3 0.0622 0.950 0.012 0.000 0.980 0.000 0.000 0.008
#> GSM154318 3 0.0767 0.950 0.012 0.000 0.976 0.000 0.004 0.008
Heatmaps for the consensus matrix. It visualizes the probability of two samples to be in a same group.
consensus_heatmap(res, k = 2)
consensus_heatmap(res, k = 3)
consensus_heatmap(res, k = 4)
consensus_heatmap(res, k = 5)
consensus_heatmap(res, k = 6)
Heatmaps for the membership of samples in all partitions to see how consistent they are:
membership_heatmap(res, k = 2)
membership_heatmap(res, k = 3)
membership_heatmap(res, k = 4)
membership_heatmap(res, k = 5)
membership_heatmap(res, k = 6)
As soon as we have had the classes for columns, we can look for signatures which are significantly different between classes which can be candidate marks for certain classes. Following are the heatmaps for signatures.
Signature heatmaps where rows are scaled:
get_signatures(res, k = 2)
get_signatures(res, k = 3)
get_signatures(res, k = 4)
get_signatures(res, k = 5)
get_signatures(res, k = 6)
Signature heatmaps where rows are not scaled:
get_signatures(res, k = 2, scale_rows = FALSE)
get_signatures(res, k = 3, scale_rows = FALSE)
get_signatures(res, k = 4, scale_rows = FALSE)
get_signatures(res, k = 5, scale_rows = FALSE)
get_signatures(res, k = 6, scale_rows = FALSE)
Compare the overlap of signatures from different k:
compare_signatures(res)
get_signature()
returns a data frame invisibly. TO get the list of signatures, the function
call should be assigned to a variable explicitly. In following code, if plot
argument is set
to FALSE
, no heatmap is plotted while only the differential analysis is performed.
# code only for demonstration
tb = get_signature(res, k = ..., plot = FALSE)
An example of the output of tb
is:
#> which_row fdr mean_1 mean_2 scaled_mean_1 scaled_mean_2 km
#> 1 38 0.042760348 8.373488 9.131774 -0.5533452 0.5164555 1
#> 2 40 0.018707592 7.106213 8.469186 -0.6173731 0.5762149 1
#> 3 55 0.019134737 10.221463 11.207825 -0.6159697 0.5749050 1
#> 4 59 0.006059896 5.921854 7.869574 -0.6899429 0.6439467 1
#> 5 60 0.018055526 8.928898 10.211722 -0.6204761 0.5791110 1
#> 6 98 0.009384629 15.714769 14.887706 0.6635654 -0.6193277 2
...
The columns in tb
are:
which_row
: row indices corresponding to the input matrix.fdr
: FDR for the differential test. mean_x
: The mean value in group x.scaled_mean_x
: The mean value in group x after rows are scaled.km
: Row groups if k-means clustering is applied to rows.UMAP plot which shows how samples are separated.
dimension_reduction(res, k = 2, method = "UMAP")
dimension_reduction(res, k = 3, method = "UMAP")
dimension_reduction(res, k = 4, method = "UMAP")
dimension_reduction(res, k = 5, method = "UMAP")
dimension_reduction(res, k = 6, method = "UMAP")
Following heatmap shows how subgroups are split when increasing k
:
collect_classes(res)
Test correlation between subgroups and known annotations. If the known annotation is numeric, one-way ANOVA test is applied, and if the known annotation is discrete, chi-squared contingency table test is applied.
test_to_known_factors(res)
#> n agent(p) time(p) k
#> CV:NMF 51 0.00632 8.39e-06 2
#> CV:NMF 58 0.03367 7.30e-07 3
#> CV:NMF 59 0.00111 3.39e-10 4
#> CV:NMF 53 0.01570 2.54e-13 5
#> CV:NMF 54 0.01031 1.32e-11 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 38950 rows and 60 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.733 0.890 0.945 0.4456 0.528 0.528
#> 3 3 0.625 0.830 0.896 0.2829 0.892 0.794
#> 4 4 0.546 0.731 0.823 0.1681 0.937 0.849
#> 5 5 0.673 0.688 0.830 0.1507 0.890 0.690
#> 6 6 0.823 0.806 0.893 0.0555 0.941 0.759
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
#> GSM154259 1 0.000 0.873 1.000 0.000
#> GSM154260 1 0.000 0.873 1.000 0.000
#> GSM154261 1 0.000 0.873 1.000 0.000
#> GSM154274 2 0.000 0.971 0.000 1.000
#> GSM154275 2 0.000 0.971 0.000 1.000
#> GSM154276 2 0.000 0.971 0.000 1.000
#> GSM154289 2 0.000 0.971 0.000 1.000
#> GSM154290 2 0.000 0.971 0.000 1.000
#> GSM154291 2 0.000 0.971 0.000 1.000
#> GSM154304 2 0.000 0.971 0.000 1.000
#> GSM154305 2 0.000 0.971 0.000 1.000
#> GSM154306 2 0.000 0.971 0.000 1.000
#> GSM154262 1 0.000 0.873 1.000 0.000
#> GSM154263 1 0.000 0.873 1.000 0.000
#> GSM154264 1 0.000 0.873 1.000 0.000
#> GSM154277 2 0.000 0.971 0.000 1.000
#> GSM154278 2 0.000 0.971 0.000 1.000
#> GSM154279 2 0.000 0.971 0.000 1.000
#> GSM154292 2 0.000 0.971 0.000 1.000
#> GSM154293 2 0.000 0.971 0.000 1.000
#> GSM154294 2 0.000 0.971 0.000 1.000
#> GSM154307 2 0.000 0.971 0.000 1.000
#> GSM154308 2 0.000 0.971 0.000 1.000
#> GSM154309 2 0.000 0.971 0.000 1.000
#> GSM154265 1 0.000 0.873 1.000 0.000
#> GSM154266 1 0.000 0.873 1.000 0.000
#> GSM154267 1 0.000 0.873 1.000 0.000
#> GSM154280 2 0.311 0.939 0.056 0.944
#> GSM154281 2 0.311 0.939 0.056 0.944
#> GSM154282 2 0.311 0.939 0.056 0.944
#> GSM154295 2 0.311 0.939 0.056 0.944
#> GSM154296 2 0.311 0.939 0.056 0.944
#> GSM154297 2 0.311 0.939 0.056 0.944
#> GSM154310 2 0.311 0.939 0.056 0.944
#> GSM154311 2 0.311 0.939 0.056 0.944
#> GSM154312 2 0.311 0.939 0.056 0.944
#> GSM154268 1 0.000 0.873 1.000 0.000
#> GSM154269 1 0.000 0.873 1.000 0.000
#> GSM154270 1 0.000 0.873 1.000 0.000
#> GSM154283 2 0.000 0.971 0.000 1.000
#> GSM154284 2 0.000 0.971 0.000 1.000
#> GSM154285 2 0.000 0.971 0.000 1.000
#> GSM154298 2 0.000 0.971 0.000 1.000
#> GSM154299 2 0.000 0.971 0.000 1.000
#> GSM154300 2 0.000 0.971 0.000 1.000
#> GSM154313 2 0.000 0.971 0.000 1.000
#> GSM154314 2 0.000 0.971 0.000 1.000
#> GSM154315 2 0.000 0.971 0.000 1.000
#> GSM154271 1 0.000 0.873 1.000 0.000
#> GSM154272 1 0.000 0.873 1.000 0.000
#> GSM154273 1 0.000 0.873 1.000 0.000
#> GSM154286 1 0.929 0.599 0.656 0.344
#> GSM154287 1 0.929 0.599 0.656 0.344
#> GSM154288 2 0.722 0.737 0.200 0.800
#> GSM154301 1 0.929 0.599 0.656 0.344
#> GSM154302 1 0.929 0.599 0.656 0.344
#> GSM154303 2 0.722 0.737 0.200 0.800
#> GSM154316 1 0.929 0.599 0.656 0.344
#> GSM154317 1 0.929 0.599 0.656 0.344
#> GSM154318 1 0.929 0.599 0.656 0.344
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> GSM154259 1 0.000 0.788 1.000 0.000 0.000
#> GSM154260 1 0.000 0.788 1.000 0.000 0.000
#> GSM154261 1 0.000 0.788 1.000 0.000 0.000
#> GSM154274 2 0.296 0.929 0.000 0.900 0.100
#> GSM154275 2 0.296 0.929 0.000 0.900 0.100
#> GSM154276 2 0.296 0.929 0.000 0.900 0.100
#> GSM154289 2 0.304 0.927 0.000 0.896 0.104
#> GSM154290 2 0.296 0.929 0.000 0.900 0.100
#> GSM154291 3 0.280 0.880 0.000 0.092 0.908
#> GSM154304 2 0.304 0.927 0.000 0.896 0.104
#> GSM154305 2 0.304 0.927 0.000 0.896 0.104
#> GSM154306 3 0.280 0.880 0.000 0.092 0.908
#> GSM154262 1 0.000 0.788 1.000 0.000 0.000
#> GSM154263 1 0.000 0.788 1.000 0.000 0.000
#> GSM154264 1 0.000 0.788 1.000 0.000 0.000
#> GSM154277 2 0.369 0.763 0.000 0.860 0.140
#> GSM154278 2 0.000 0.927 0.000 1.000 0.000
#> GSM154279 2 0.000 0.927 0.000 1.000 0.000
#> GSM154292 2 0.000 0.927 0.000 1.000 0.000
#> GSM154293 2 0.000 0.927 0.000 1.000 0.000
#> GSM154294 3 0.455 0.830 0.000 0.200 0.800
#> GSM154307 2 0.254 0.934 0.000 0.920 0.080
#> GSM154308 2 0.254 0.934 0.000 0.920 0.080
#> GSM154309 2 0.254 0.934 0.000 0.920 0.080
#> GSM154265 1 0.000 0.788 1.000 0.000 0.000
#> GSM154266 1 0.000 0.788 1.000 0.000 0.000
#> GSM154267 1 0.000 0.788 1.000 0.000 0.000
#> GSM154280 2 0.210 0.905 0.004 0.944 0.052
#> GSM154281 2 0.210 0.905 0.004 0.944 0.052
#> GSM154282 2 0.210 0.905 0.004 0.944 0.052
#> GSM154295 2 0.378 0.917 0.004 0.864 0.132
#> GSM154296 2 0.378 0.917 0.004 0.864 0.132
#> GSM154297 2 0.378 0.917 0.004 0.864 0.132
#> GSM154310 2 0.378 0.917 0.004 0.864 0.132
#> GSM154311 2 0.378 0.917 0.004 0.864 0.132
#> GSM154312 2 0.378 0.917 0.004 0.864 0.132
#> GSM154268 1 0.000 0.788 1.000 0.000 0.000
#> GSM154269 1 0.000 0.788 1.000 0.000 0.000
#> GSM154270 1 0.000 0.788 1.000 0.000 0.000
#> GSM154283 2 0.000 0.927 0.000 1.000 0.000
#> GSM154284 2 0.000 0.927 0.000 1.000 0.000
#> GSM154285 2 0.000 0.927 0.000 1.000 0.000
#> GSM154298 2 0.000 0.927 0.000 1.000 0.000
#> GSM154299 2 0.000 0.927 0.000 1.000 0.000
#> GSM154300 2 0.000 0.927 0.000 1.000 0.000
#> GSM154313 2 0.254 0.934 0.000 0.920 0.080
#> GSM154314 2 0.254 0.934 0.000 0.920 0.080
#> GSM154315 3 0.280 0.880 0.000 0.092 0.908
#> GSM154271 1 0.000 0.788 1.000 0.000 0.000
#> GSM154272 1 0.000 0.788 1.000 0.000 0.000
#> GSM154273 1 0.000 0.788 1.000 0.000 0.000
#> GSM154286 1 0.828 0.504 0.564 0.344 0.092
#> GSM154287 1 0.828 0.504 0.564 0.344 0.092
#> GSM154288 3 0.341 0.780 0.124 0.000 0.876
#> GSM154301 1 0.828 0.504 0.564 0.344 0.092
#> GSM154302 1 0.828 0.504 0.564 0.344 0.092
#> GSM154303 3 0.341 0.780 0.124 0.000 0.876
#> GSM154316 1 0.828 0.504 0.564 0.344 0.092
#> GSM154317 1 0.828 0.504 0.564 0.344 0.092
#> GSM154318 1 0.828 0.504 0.564 0.344 0.092
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> GSM154259 1 0.0000 0.786 1.000 0.000 0.000 0.000
#> GSM154260 1 0.0000 0.786 1.000 0.000 0.000 0.000
#> GSM154261 1 0.0000 0.786 1.000 0.000 0.000 0.000
#> GSM154274 2 0.0921 0.788 0.000 0.972 0.028 0.000
#> GSM154275 2 0.0921 0.788 0.000 0.972 0.028 0.000
#> GSM154276 2 0.0921 0.788 0.000 0.972 0.028 0.000
#> GSM154289 3 0.3907 0.891 0.000 0.232 0.768 0.000
#> GSM154290 2 0.0921 0.788 0.000 0.972 0.028 0.000
#> GSM154291 4 0.4050 0.817 0.000 0.144 0.036 0.820
#> GSM154304 3 0.3907 0.891 0.000 0.232 0.768 0.000
#> GSM154305 3 0.3907 0.891 0.000 0.232 0.768 0.000
#> GSM154306 4 0.4050 0.817 0.000 0.144 0.036 0.820
#> GSM154262 1 0.0000 0.786 1.000 0.000 0.000 0.000
#> GSM154263 1 0.0000 0.786 1.000 0.000 0.000 0.000
#> GSM154264 1 0.0000 0.786 1.000 0.000 0.000 0.000
#> GSM154277 2 0.5266 0.640 0.000 0.752 0.108 0.140
#> GSM154278 2 0.2469 0.794 0.000 0.892 0.108 0.000
#> GSM154279 2 0.2469 0.794 0.000 0.892 0.108 0.000
#> GSM154292 2 0.2589 0.793 0.000 0.884 0.116 0.000
#> GSM154293 2 0.2589 0.793 0.000 0.884 0.116 0.000
#> GSM154294 4 0.4605 0.702 0.000 0.092 0.108 0.800
#> GSM154307 2 0.3444 0.666 0.000 0.816 0.184 0.000
#> GSM154308 2 0.3444 0.666 0.000 0.816 0.184 0.000
#> GSM154309 2 0.3444 0.666 0.000 0.816 0.184 0.000
#> GSM154265 1 0.0000 0.786 1.000 0.000 0.000 0.000
#> GSM154266 1 0.0000 0.786 1.000 0.000 0.000 0.000
#> GSM154267 1 0.0000 0.786 1.000 0.000 0.000 0.000
#> GSM154280 2 0.3837 0.753 0.000 0.776 0.224 0.000
#> GSM154281 2 0.3837 0.753 0.000 0.776 0.224 0.000
#> GSM154282 2 0.3837 0.753 0.000 0.776 0.224 0.000
#> GSM154295 2 0.3219 0.754 0.000 0.836 0.164 0.000
#> GSM154296 2 0.3219 0.754 0.000 0.836 0.164 0.000
#> GSM154297 2 0.3219 0.754 0.000 0.836 0.164 0.000
#> GSM154310 2 0.3219 0.754 0.000 0.836 0.164 0.000
#> GSM154311 2 0.3219 0.754 0.000 0.836 0.164 0.000
#> GSM154312 2 0.3219 0.754 0.000 0.836 0.164 0.000
#> GSM154268 1 0.0000 0.786 1.000 0.000 0.000 0.000
#> GSM154269 1 0.0000 0.786 1.000 0.000 0.000 0.000
#> GSM154270 1 0.0000 0.786 1.000 0.000 0.000 0.000
#> GSM154283 2 0.2647 0.797 0.000 0.880 0.120 0.000
#> GSM154284 2 0.2469 0.794 0.000 0.892 0.108 0.000
#> GSM154285 2 0.2469 0.794 0.000 0.892 0.108 0.000
#> GSM154298 2 0.4134 0.685 0.000 0.740 0.260 0.000
#> GSM154299 2 0.4040 0.686 0.000 0.752 0.248 0.000
#> GSM154300 3 0.3649 0.675 0.000 0.204 0.796 0.000
#> GSM154313 2 0.3444 0.666 0.000 0.816 0.184 0.000
#> GSM154314 2 0.3444 0.666 0.000 0.816 0.184 0.000
#> GSM154315 4 0.4050 0.817 0.000 0.144 0.036 0.820
#> GSM154271 1 0.0000 0.786 1.000 0.000 0.000 0.000
#> GSM154272 1 0.0000 0.786 1.000 0.000 0.000 0.000
#> GSM154273 1 0.0000 0.786 1.000 0.000 0.000 0.000
#> GSM154286 1 0.8900 0.461 0.468 0.280 0.124 0.128
#> GSM154287 1 0.8900 0.461 0.468 0.280 0.124 0.128
#> GSM154288 4 0.0779 0.764 0.016 0.000 0.004 0.980
#> GSM154301 1 0.8900 0.461 0.468 0.280 0.124 0.128
#> GSM154302 1 0.8900 0.461 0.468 0.280 0.124 0.128
#> GSM154303 4 0.0779 0.764 0.016 0.000 0.004 0.980
#> GSM154316 1 0.8900 0.461 0.468 0.280 0.124 0.128
#> GSM154317 1 0.8900 0.461 0.468 0.280 0.124 0.128
#> GSM154318 1 0.8900 0.461 0.468 0.280 0.124 0.128
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> GSM154259 1 0.0000 0.7943 1.000 0.000 0.000 0.000 0.000
#> GSM154260 1 0.0000 0.7943 1.000 0.000 0.000 0.000 0.000
#> GSM154261 1 0.0000 0.7943 1.000 0.000 0.000 0.000 0.000
#> GSM154274 5 0.3011 0.6960 0.000 0.000 0.140 0.016 0.844
#> GSM154275 5 0.2677 0.7063 0.000 0.000 0.112 0.016 0.872
#> GSM154276 5 0.2677 0.7063 0.000 0.000 0.112 0.016 0.872
#> GSM154289 2 0.5100 0.8656 0.000 0.592 0.372 0.024 0.012
#> GSM154290 5 0.2677 0.7063 0.000 0.000 0.112 0.016 0.872
#> GSM154291 4 0.1270 0.8571 0.000 0.000 0.052 0.948 0.000
#> GSM154304 2 0.5100 0.8656 0.000 0.592 0.372 0.024 0.012
#> GSM154305 2 0.5100 0.8656 0.000 0.592 0.372 0.024 0.012
#> GSM154306 4 0.1270 0.8571 0.000 0.000 0.052 0.948 0.000
#> GSM154262 1 0.0000 0.7943 1.000 0.000 0.000 0.000 0.000
#> GSM154263 1 0.0000 0.7943 1.000 0.000 0.000 0.000 0.000
#> GSM154264 1 0.0000 0.7943 1.000 0.000 0.000 0.000 0.000
#> GSM154277 5 0.2909 0.6369 0.000 0.000 0.012 0.140 0.848
#> GSM154278 5 0.1043 0.7425 0.000 0.000 0.040 0.000 0.960
#> GSM154279 5 0.0404 0.7413 0.000 0.000 0.012 0.000 0.988
#> GSM154292 5 0.4278 0.0733 0.000 0.000 0.452 0.000 0.548
#> GSM154293 5 0.4278 0.0733 0.000 0.000 0.452 0.000 0.548
#> GSM154294 4 0.3391 0.7009 0.000 0.000 0.012 0.800 0.188
#> GSM154307 3 0.0290 0.6865 0.000 0.000 0.992 0.000 0.008
#> GSM154308 3 0.0290 0.6865 0.000 0.000 0.992 0.000 0.008
#> GSM154309 3 0.0290 0.6865 0.000 0.000 0.992 0.000 0.008
#> GSM154265 1 0.0000 0.7943 1.000 0.000 0.000 0.000 0.000
#> GSM154266 1 0.0000 0.7943 1.000 0.000 0.000 0.000 0.000
#> GSM154267 1 0.0000 0.7943 1.000 0.000 0.000 0.000 0.000
#> GSM154280 5 0.4054 0.6028 0.000 0.248 0.020 0.000 0.732
#> GSM154281 5 0.4054 0.6028 0.000 0.248 0.020 0.000 0.732
#> GSM154282 5 0.4054 0.6028 0.000 0.248 0.020 0.000 0.732
#> GSM154295 3 0.3508 0.7369 0.000 0.252 0.748 0.000 0.000
#> GSM154296 3 0.3508 0.7369 0.000 0.252 0.748 0.000 0.000
#> GSM154297 3 0.3508 0.7369 0.000 0.252 0.748 0.000 0.000
#> GSM154310 3 0.3508 0.7369 0.000 0.252 0.748 0.000 0.000
#> GSM154311 3 0.3508 0.7369 0.000 0.252 0.748 0.000 0.000
#> GSM154312 3 0.3508 0.7369 0.000 0.252 0.748 0.000 0.000
#> GSM154268 1 0.0000 0.7943 1.000 0.000 0.000 0.000 0.000
#> GSM154269 1 0.0000 0.7943 1.000 0.000 0.000 0.000 0.000
#> GSM154270 1 0.0000 0.7943 1.000 0.000 0.000 0.000 0.000
#> GSM154283 5 0.1608 0.7387 0.000 0.000 0.072 0.000 0.928
#> GSM154284 5 0.0404 0.7413 0.000 0.000 0.012 0.000 0.988
#> GSM154285 5 0.0404 0.7413 0.000 0.000 0.012 0.000 0.988
#> GSM154298 3 0.3143 0.5208 0.000 0.000 0.796 0.000 0.204
#> GSM154299 3 0.3305 0.4946 0.000 0.000 0.776 0.000 0.224
#> GSM154300 2 0.6200 0.5878 0.000 0.548 0.196 0.000 0.256
#> GSM154313 3 0.0510 0.6882 0.000 0.000 0.984 0.000 0.016
#> GSM154314 3 0.0510 0.6882 0.000 0.000 0.984 0.000 0.016
#> GSM154315 4 0.1270 0.8571 0.000 0.000 0.052 0.948 0.000
#> GSM154271 1 0.0000 0.7943 1.000 0.000 0.000 0.000 0.000
#> GSM154272 1 0.0000 0.7943 1.000 0.000 0.000 0.000 0.000
#> GSM154273 1 0.0000 0.7943 1.000 0.000 0.000 0.000 0.000
#> GSM154286 1 0.6463 0.4695 0.444 0.408 0.008 0.000 0.140
#> GSM154287 1 0.6463 0.4695 0.444 0.408 0.008 0.000 0.140
#> GSM154288 4 0.2605 0.8142 0.000 0.148 0.000 0.852 0.000
#> GSM154301 1 0.6463 0.4695 0.444 0.408 0.008 0.000 0.140
#> GSM154302 1 0.6463 0.4695 0.444 0.408 0.008 0.000 0.140
#> GSM154303 4 0.2605 0.8142 0.000 0.148 0.000 0.852 0.000
#> GSM154316 1 0.6463 0.4695 0.444 0.408 0.008 0.000 0.140
#> GSM154317 1 0.6463 0.4695 0.444 0.408 0.008 0.000 0.140
#> GSM154318 1 0.6463 0.4695 0.444 0.408 0.008 0.000 0.140
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> GSM154259 1 0.0000 1.000 1 0.000 0.000 0.000 0.000 0.000
#> GSM154260 1 0.0000 1.000 1 0.000 0.000 0.000 0.000 0.000
#> GSM154261 1 0.0000 1.000 1 0.000 0.000 0.000 0.000 0.000
#> GSM154274 5 0.3027 0.690 0 0.028 0.000 0.000 0.824 0.148
#> GSM154275 5 0.2340 0.693 0 0.000 0.000 0.000 0.852 0.148
#> GSM154276 5 0.2340 0.693 0 0.000 0.000 0.000 0.852 0.148
#> GSM154289 6 0.2738 0.878 0 0.176 0.000 0.004 0.000 0.820
#> GSM154290 5 0.2340 0.693 0 0.000 0.000 0.000 0.852 0.148
#> GSM154291 4 0.0622 0.824 0 0.012 0.000 0.980 0.000 0.008
#> GSM154304 6 0.2738 0.878 0 0.176 0.000 0.004 0.000 0.820
#> GSM154305 6 0.2738 0.878 0 0.176 0.000 0.004 0.000 0.820
#> GSM154306 4 0.0622 0.824 0 0.012 0.000 0.980 0.000 0.008
#> GSM154262 1 0.0000 1.000 1 0.000 0.000 0.000 0.000 0.000
#> GSM154263 1 0.0000 1.000 1 0.000 0.000 0.000 0.000 0.000
#> GSM154264 1 0.0000 1.000 1 0.000 0.000 0.000 0.000 0.000
#> GSM154277 5 0.2260 0.667 0 0.000 0.000 0.140 0.860 0.000
#> GSM154278 5 0.0858 0.740 0 0.028 0.000 0.000 0.968 0.004
#> GSM154279 5 0.0146 0.742 0 0.000 0.000 0.000 0.996 0.004
#> GSM154292 5 0.3961 0.100 0 0.440 0.000 0.000 0.556 0.004
#> GSM154293 5 0.3961 0.100 0 0.440 0.000 0.000 0.556 0.004
#> GSM154294 4 0.2902 0.673 0 0.000 0.000 0.800 0.196 0.004
#> GSM154307 2 0.0260 0.743 0 0.992 0.000 0.000 0.000 0.008
#> GSM154308 2 0.0260 0.743 0 0.992 0.000 0.000 0.000 0.008
#> GSM154309 2 0.0260 0.743 0 0.992 0.000 0.000 0.000 0.008
#> GSM154265 1 0.0000 1.000 1 0.000 0.000 0.000 0.000 0.000
#> GSM154266 1 0.0000 1.000 1 0.000 0.000 0.000 0.000 0.000
#> GSM154267 1 0.0000 1.000 1 0.000 0.000 0.000 0.000 0.000
#> GSM154280 5 0.3175 0.595 0 0.000 0.256 0.000 0.744 0.000
#> GSM154281 5 0.3175 0.595 0 0.000 0.256 0.000 0.744 0.000
#> GSM154282 5 0.3175 0.595 0 0.000 0.256 0.000 0.744 0.000
#> GSM154295 2 0.3198 0.756 0 0.740 0.260 0.000 0.000 0.000
#> GSM154296 2 0.3198 0.756 0 0.740 0.260 0.000 0.000 0.000
#> GSM154297 2 0.3198 0.756 0 0.740 0.260 0.000 0.000 0.000
#> GSM154310 2 0.3198 0.756 0 0.740 0.260 0.000 0.000 0.000
#> GSM154311 2 0.3198 0.756 0 0.740 0.260 0.000 0.000 0.000
#> GSM154312 2 0.3198 0.756 0 0.740 0.260 0.000 0.000 0.000
#> GSM154268 1 0.0000 1.000 1 0.000 0.000 0.000 0.000 0.000
#> GSM154269 1 0.0000 1.000 1 0.000 0.000 0.000 0.000 0.000
#> GSM154270 1 0.0000 1.000 1 0.000 0.000 0.000 0.000 0.000
#> GSM154283 5 0.1644 0.728 0 0.076 0.000 0.000 0.920 0.004
#> GSM154284 5 0.0146 0.742 0 0.004 0.000 0.000 0.996 0.000
#> GSM154285 5 0.0146 0.742 0 0.004 0.000 0.000 0.996 0.000
#> GSM154298 2 0.2902 0.570 0 0.800 0.000 0.000 0.196 0.004
#> GSM154299 2 0.3109 0.537 0 0.772 0.000 0.000 0.224 0.004
#> GSM154300 6 0.5116 0.619 0 0.132 0.000 0.000 0.256 0.612
#> GSM154313 2 0.0000 0.743 0 1.000 0.000 0.000 0.000 0.000
#> GSM154314 2 0.0000 0.743 0 1.000 0.000 0.000 0.000 0.000
#> GSM154315 4 0.0622 0.824 0 0.012 0.000 0.980 0.000 0.008
#> GSM154271 1 0.0000 1.000 1 0.000 0.000 0.000 0.000 0.000
#> GSM154272 1 0.0000 1.000 1 0.000 0.000 0.000 0.000 0.000
#> GSM154273 1 0.0000 1.000 1 0.000 0.000 0.000 0.000 0.000
#> GSM154286 3 0.0000 1.000 0 0.000 1.000 0.000 0.000 0.000
#> GSM154287 3 0.0000 1.000 0 0.000 1.000 0.000 0.000 0.000
#> GSM154288 4 0.4666 0.743 0 0.000 0.144 0.688 0.000 0.168
#> GSM154301 3 0.0000 1.000 0 0.000 1.000 0.000 0.000 0.000
#> GSM154302 3 0.0000 1.000 0 0.000 1.000 0.000 0.000 0.000
#> GSM154303 4 0.4666 0.743 0 0.000 0.144 0.688 0.000 0.168
#> GSM154316 3 0.0000 1.000 0 0.000 1.000 0.000 0.000 0.000
#> GSM154317 3 0.0000 1.000 0 0.000 1.000 0.000 0.000 0.000
#> GSM154318 3 0.0000 1.000 0 0.000 1.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 agent(p) time(p) k
#> MAD:hclust 60 0.007084 1.38e-07 2
#> MAD:hclust 60 0.012158 2.37e-06 3
#> MAD:hclust 53 0.074833 2.48e-09 4
#> MAD:hclust 50 0.126179 2.06e-14 5
#> MAD:hclust 58 0.000148 2.24e-14 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 38950 rows and 60 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.867 0.912 0.962 0.4579 0.528 0.528
#> 3 3 0.541 0.789 0.810 0.4017 0.729 0.526
#> 4 4 0.617 0.470 0.756 0.1371 0.985 0.957
#> 5 5 0.741 0.762 0.828 0.0778 0.830 0.518
#> 6 6 0.783 0.762 0.803 0.0413 0.989 0.949
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
#> GSM154259 1 0.0000 0.915 1.000 0.000
#> GSM154260 1 0.0000 0.915 1.000 0.000
#> GSM154261 1 0.0000 0.915 1.000 0.000
#> GSM154274 2 0.0000 0.981 0.000 1.000
#> GSM154275 2 0.0000 0.981 0.000 1.000
#> GSM154276 2 0.0000 0.981 0.000 1.000
#> GSM154289 2 0.0000 0.981 0.000 1.000
#> GSM154290 2 0.0000 0.981 0.000 1.000
#> GSM154291 2 0.0000 0.981 0.000 1.000
#> GSM154304 2 0.0000 0.981 0.000 1.000
#> GSM154305 2 0.0000 0.981 0.000 1.000
#> GSM154306 2 0.0000 0.981 0.000 1.000
#> GSM154262 1 0.0000 0.915 1.000 0.000
#> GSM154263 1 0.0000 0.915 1.000 0.000
#> GSM154264 1 0.0000 0.915 1.000 0.000
#> GSM154277 2 0.0000 0.981 0.000 1.000
#> GSM154278 2 0.0000 0.981 0.000 1.000
#> GSM154279 2 0.0000 0.981 0.000 1.000
#> GSM154292 2 0.0000 0.981 0.000 1.000
#> GSM154293 2 0.0000 0.981 0.000 1.000
#> GSM154294 2 0.0000 0.981 0.000 1.000
#> GSM154307 2 0.0000 0.981 0.000 1.000
#> GSM154308 2 0.0000 0.981 0.000 1.000
#> GSM154309 2 0.0000 0.981 0.000 1.000
#> GSM154265 1 0.0000 0.915 1.000 0.000
#> GSM154266 1 0.0000 0.915 1.000 0.000
#> GSM154267 1 0.0000 0.915 1.000 0.000
#> GSM154280 2 0.0000 0.981 0.000 1.000
#> GSM154281 2 0.0000 0.981 0.000 1.000
#> GSM154282 2 0.0000 0.981 0.000 1.000
#> GSM154295 2 0.0000 0.981 0.000 1.000
#> GSM154296 2 0.0000 0.981 0.000 1.000
#> GSM154297 2 0.0000 0.981 0.000 1.000
#> GSM154310 2 0.0000 0.981 0.000 1.000
#> GSM154311 2 0.0000 0.981 0.000 1.000
#> GSM154312 2 0.0000 0.981 0.000 1.000
#> GSM154268 1 0.0000 0.915 1.000 0.000
#> GSM154269 1 0.0000 0.915 1.000 0.000
#> GSM154270 1 0.0000 0.915 1.000 0.000
#> GSM154283 2 0.0000 0.981 0.000 1.000
#> GSM154284 2 0.0000 0.981 0.000 1.000
#> GSM154285 2 0.0000 0.981 0.000 1.000
#> GSM154298 2 0.0000 0.981 0.000 1.000
#> GSM154299 2 0.0000 0.981 0.000 1.000
#> GSM154300 2 0.0000 0.981 0.000 1.000
#> GSM154313 2 0.0000 0.981 0.000 1.000
#> GSM154314 2 0.0000 0.981 0.000 1.000
#> GSM154315 2 0.0000 0.981 0.000 1.000
#> GSM154271 1 0.0000 0.915 1.000 0.000
#> GSM154272 1 0.0000 0.915 1.000 0.000
#> GSM154273 1 0.0000 0.915 1.000 0.000
#> GSM154286 1 0.0376 0.913 0.996 0.004
#> GSM154287 1 0.0376 0.913 0.996 0.004
#> GSM154288 2 0.8955 0.486 0.312 0.688
#> GSM154301 1 0.9087 0.592 0.676 0.324
#> GSM154302 1 0.9087 0.592 0.676 0.324
#> GSM154303 2 0.8861 0.504 0.304 0.696
#> GSM154316 1 0.9323 0.548 0.652 0.348
#> GSM154317 1 0.9209 0.572 0.664 0.336
#> GSM154318 1 0.9209 0.572 0.664 0.336
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> GSM154259 1 0.1753 0.970 0.952 0.000 0.048
#> GSM154260 1 0.0237 0.979 0.996 0.000 0.004
#> GSM154261 1 0.0237 0.979 0.996 0.000 0.004
#> GSM154274 2 0.5733 0.634 0.000 0.676 0.324
#> GSM154275 2 0.5958 0.646 0.008 0.692 0.300
#> GSM154276 2 0.5988 0.644 0.008 0.688 0.304
#> GSM154289 2 0.1753 0.808 0.000 0.952 0.048
#> GSM154290 2 0.0592 0.807 0.000 0.988 0.012
#> GSM154291 2 0.4062 0.722 0.000 0.836 0.164
#> GSM154304 2 0.1964 0.805 0.000 0.944 0.056
#> GSM154305 2 0.1289 0.806 0.000 0.968 0.032
#> GSM154306 2 0.4062 0.722 0.000 0.836 0.164
#> GSM154262 1 0.1643 0.971 0.956 0.000 0.044
#> GSM154263 1 0.0000 0.981 1.000 0.000 0.000
#> GSM154264 1 0.0000 0.981 1.000 0.000 0.000
#> GSM154277 2 0.6598 0.573 0.008 0.564 0.428
#> GSM154278 2 0.5785 0.615 0.000 0.668 0.332
#> GSM154279 2 0.6102 0.623 0.008 0.672 0.320
#> GSM154292 2 0.0237 0.809 0.000 0.996 0.004
#> GSM154293 2 0.0747 0.809 0.000 0.984 0.016
#> GSM154294 2 0.3941 0.729 0.000 0.844 0.156
#> GSM154307 2 0.2066 0.806 0.000 0.940 0.060
#> GSM154308 2 0.1753 0.807 0.000 0.952 0.048
#> GSM154309 2 0.2066 0.806 0.000 0.940 0.060
#> GSM154265 1 0.1643 0.971 0.956 0.000 0.044
#> GSM154266 1 0.0000 0.981 1.000 0.000 0.000
#> GSM154267 1 0.0000 0.981 1.000 0.000 0.000
#> GSM154280 3 0.5109 0.724 0.008 0.212 0.780
#> GSM154281 3 0.4702 0.727 0.000 0.212 0.788
#> GSM154282 3 0.5109 0.724 0.008 0.212 0.780
#> GSM154295 3 0.4750 0.740 0.000 0.216 0.784
#> GSM154296 3 0.4605 0.742 0.000 0.204 0.796
#> GSM154297 3 0.4605 0.742 0.000 0.204 0.796
#> GSM154310 3 0.4974 0.734 0.000 0.236 0.764
#> GSM154311 3 0.4974 0.734 0.000 0.236 0.764
#> GSM154312 3 0.4974 0.734 0.000 0.236 0.764
#> GSM154268 1 0.0000 0.981 1.000 0.000 0.000
#> GSM154269 1 0.1643 0.971 0.956 0.000 0.044
#> GSM154270 1 0.0000 0.981 1.000 0.000 0.000
#> GSM154283 2 0.5785 0.615 0.000 0.668 0.332
#> GSM154284 2 0.6102 0.623 0.008 0.672 0.320
#> GSM154285 2 0.6102 0.623 0.008 0.672 0.320
#> GSM154298 2 0.2165 0.807 0.000 0.936 0.064
#> GSM154299 2 0.3116 0.792 0.000 0.892 0.108
#> GSM154300 2 0.2356 0.800 0.000 0.928 0.072
#> GSM154313 2 0.2261 0.806 0.000 0.932 0.068
#> GSM154314 2 0.2261 0.806 0.000 0.932 0.068
#> GSM154315 2 0.3941 0.729 0.000 0.844 0.156
#> GSM154271 1 0.1643 0.971 0.956 0.000 0.044
#> GSM154272 1 0.1643 0.971 0.956 0.000 0.044
#> GSM154273 1 0.0000 0.981 1.000 0.000 0.000
#> GSM154286 3 0.6543 0.576 0.344 0.016 0.640
#> GSM154287 3 0.6369 0.614 0.316 0.016 0.668
#> GSM154288 3 0.6634 0.689 0.144 0.104 0.752
#> GSM154301 3 0.7304 0.744 0.228 0.084 0.688
#> GSM154302 3 0.7304 0.744 0.228 0.084 0.688
#> GSM154303 3 0.6634 0.689 0.144 0.104 0.752
#> GSM154316 3 0.7304 0.744 0.228 0.084 0.688
#> GSM154317 3 0.7304 0.744 0.228 0.084 0.688
#> GSM154318 3 0.7304 0.744 0.228 0.084 0.688
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> GSM154259 1 0.4417 0.8885 0.796 0.000 0.044 0.160
#> GSM154260 1 0.0707 0.9244 0.980 0.000 0.000 0.020
#> GSM154261 1 0.0707 0.9244 0.980 0.000 0.000 0.020
#> GSM154274 2 0.6911 -0.2894 0.000 0.504 0.112 0.384
#> GSM154275 2 0.6906 -0.3652 0.000 0.484 0.108 0.408
#> GSM154276 2 0.6906 -0.3652 0.000 0.484 0.108 0.408
#> GSM154289 2 0.1151 0.4922 0.000 0.968 0.008 0.024
#> GSM154290 2 0.1211 0.4802 0.000 0.960 0.000 0.040
#> GSM154291 2 0.5236 0.1174 0.000 0.560 0.008 0.432
#> GSM154304 2 0.3205 0.4969 0.000 0.872 0.104 0.024
#> GSM154305 2 0.1733 0.4961 0.000 0.948 0.024 0.028
#> GSM154306 2 0.5236 0.1174 0.000 0.560 0.008 0.432
#> GSM154262 1 0.3999 0.8975 0.824 0.000 0.036 0.140
#> GSM154263 1 0.0000 0.9308 1.000 0.000 0.000 0.000
#> GSM154264 1 0.0000 0.9308 1.000 0.000 0.000 0.000
#> GSM154277 4 0.5646 0.0000 0.000 0.296 0.048 0.656
#> GSM154278 2 0.7036 -0.2793 0.000 0.492 0.124 0.384
#> GSM154279 2 0.6994 -0.3441 0.000 0.472 0.116 0.412
#> GSM154292 2 0.1510 0.4862 0.000 0.956 0.016 0.028
#> GSM154293 2 0.1510 0.4862 0.000 0.956 0.016 0.028
#> GSM154294 2 0.5427 0.1324 0.000 0.568 0.016 0.416
#> GSM154307 2 0.3032 0.5061 0.000 0.868 0.124 0.008
#> GSM154308 2 0.2704 0.5060 0.000 0.876 0.124 0.000
#> GSM154309 2 0.3032 0.5061 0.000 0.868 0.124 0.008
#> GSM154265 1 0.4174 0.8951 0.816 0.000 0.044 0.140
#> GSM154266 1 0.0000 0.9308 1.000 0.000 0.000 0.000
#> GSM154267 1 0.0000 0.9308 1.000 0.000 0.000 0.000
#> GSM154280 3 0.7246 -0.0615 0.000 0.144 0.448 0.408
#> GSM154281 3 0.7213 -0.0505 0.000 0.140 0.452 0.408
#> GSM154282 3 0.7246 -0.0615 0.000 0.144 0.448 0.408
#> GSM154295 3 0.3505 0.7221 0.000 0.088 0.864 0.048
#> GSM154296 3 0.3732 0.7198 0.000 0.092 0.852 0.056
#> GSM154297 3 0.3732 0.7198 0.000 0.092 0.852 0.056
#> GSM154310 3 0.3505 0.7221 0.000 0.088 0.864 0.048
#> GSM154311 3 0.3505 0.7221 0.000 0.088 0.864 0.048
#> GSM154312 3 0.3505 0.7221 0.000 0.088 0.864 0.048
#> GSM154268 1 0.0000 0.9308 1.000 0.000 0.000 0.000
#> GSM154269 1 0.4174 0.8951 0.816 0.000 0.044 0.140
#> GSM154270 1 0.0000 0.9308 1.000 0.000 0.000 0.000
#> GSM154283 2 0.6988 -0.2771 0.000 0.500 0.120 0.380
#> GSM154284 2 0.6994 -0.3441 0.000 0.472 0.116 0.412
#> GSM154285 2 0.6994 -0.3441 0.000 0.472 0.116 0.412
#> GSM154298 2 0.3182 0.5076 0.000 0.876 0.096 0.028
#> GSM154299 2 0.4054 0.3215 0.000 0.796 0.016 0.188
#> GSM154300 2 0.3569 0.3062 0.000 0.804 0.000 0.196
#> GSM154313 2 0.3598 0.5035 0.000 0.848 0.124 0.028
#> GSM154314 2 0.3598 0.5035 0.000 0.848 0.124 0.028
#> GSM154315 2 0.5337 0.1216 0.000 0.564 0.012 0.424
#> GSM154271 1 0.4174 0.8951 0.816 0.000 0.044 0.140
#> GSM154272 1 0.4174 0.8951 0.816 0.000 0.044 0.140
#> GSM154273 1 0.0000 0.9308 1.000 0.000 0.000 0.000
#> GSM154286 3 0.3534 0.6648 0.148 0.004 0.840 0.008
#> GSM154287 3 0.2271 0.7245 0.076 0.000 0.916 0.008
#> GSM154288 3 0.5838 0.3625 0.012 0.016 0.560 0.412
#> GSM154301 3 0.1970 0.7391 0.060 0.008 0.932 0.000
#> GSM154302 3 0.1970 0.7391 0.060 0.008 0.932 0.000
#> GSM154303 3 0.5829 0.3685 0.012 0.016 0.564 0.408
#> GSM154316 3 0.1970 0.7391 0.060 0.008 0.932 0.000
#> GSM154317 3 0.1970 0.7391 0.060 0.008 0.932 0.000
#> GSM154318 3 0.1970 0.7391 0.060 0.008 0.932 0.000
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> GSM154259 1 0.1281 0.788 0.956 0.000 0.032 0.012 0.000
#> GSM154260 1 0.3990 0.859 0.688 0.000 0.000 0.308 0.004
#> GSM154261 1 0.3990 0.859 0.688 0.000 0.000 0.308 0.004
#> GSM154274 5 0.4644 0.809 0.000 0.156 0.016 0.068 0.760
#> GSM154275 5 0.4502 0.808 0.000 0.148 0.016 0.064 0.772
#> GSM154276 5 0.4419 0.813 0.000 0.140 0.016 0.064 0.780
#> GSM154289 2 0.3267 0.774 0.000 0.844 0.000 0.112 0.044
#> GSM154290 2 0.3620 0.769 0.000 0.824 0.000 0.108 0.068
#> GSM154291 4 0.5988 0.503 0.000 0.364 0.000 0.516 0.120
#> GSM154304 2 0.3052 0.783 0.000 0.868 0.008 0.092 0.032
#> GSM154305 2 0.2850 0.782 0.000 0.872 0.000 0.092 0.036
#> GSM154306 4 0.5996 0.501 0.000 0.368 0.000 0.512 0.120
#> GSM154262 1 0.0880 0.793 0.968 0.000 0.032 0.000 0.000
#> GSM154263 1 0.4161 0.863 0.704 0.000 0.000 0.280 0.016
#> GSM154264 1 0.3796 0.863 0.700 0.000 0.000 0.300 0.000
#> GSM154277 5 0.2632 0.745 0.000 0.072 0.004 0.032 0.892
#> GSM154278 5 0.3742 0.838 0.000 0.188 0.020 0.004 0.788
#> GSM154279 5 0.3438 0.843 0.000 0.172 0.020 0.000 0.808
#> GSM154292 2 0.1331 0.821 0.000 0.952 0.000 0.008 0.040
#> GSM154293 2 0.1331 0.821 0.000 0.952 0.000 0.008 0.040
#> GSM154294 2 0.6070 -0.564 0.000 0.444 0.000 0.436 0.120
#> GSM154307 2 0.1267 0.825 0.000 0.960 0.012 0.024 0.004
#> GSM154308 2 0.0912 0.825 0.000 0.972 0.012 0.016 0.000
#> GSM154309 2 0.1267 0.825 0.000 0.960 0.012 0.024 0.004
#> GSM154265 1 0.0880 0.793 0.968 0.000 0.032 0.000 0.000
#> GSM154266 1 0.4161 0.863 0.704 0.000 0.000 0.280 0.016
#> GSM154267 1 0.3796 0.863 0.700 0.000 0.000 0.300 0.000
#> GSM154280 5 0.4600 0.686 0.000 0.008 0.180 0.064 0.748
#> GSM154281 5 0.4600 0.686 0.000 0.008 0.180 0.064 0.748
#> GSM154282 5 0.4600 0.686 0.000 0.008 0.180 0.064 0.748
#> GSM154295 3 0.4454 0.853 0.000 0.056 0.800 0.084 0.060
#> GSM154296 3 0.4666 0.848 0.000 0.048 0.784 0.096 0.072
#> GSM154297 3 0.4666 0.848 0.000 0.048 0.784 0.096 0.072
#> GSM154310 3 0.4454 0.853 0.000 0.056 0.800 0.084 0.060
#> GSM154311 3 0.4454 0.853 0.000 0.056 0.800 0.084 0.060
#> GSM154312 3 0.4454 0.853 0.000 0.056 0.800 0.084 0.060
#> GSM154268 1 0.4161 0.863 0.704 0.000 0.000 0.280 0.016
#> GSM154269 1 0.0880 0.793 0.968 0.000 0.032 0.000 0.000
#> GSM154270 1 0.3796 0.863 0.700 0.000 0.000 0.300 0.000
#> GSM154283 5 0.4208 0.824 0.000 0.204 0.020 0.016 0.760
#> GSM154284 5 0.3594 0.843 0.000 0.172 0.020 0.004 0.804
#> GSM154285 5 0.3594 0.843 0.000 0.172 0.020 0.004 0.804
#> GSM154298 2 0.1710 0.820 0.000 0.944 0.012 0.024 0.020
#> GSM154299 2 0.3583 0.676 0.000 0.792 0.004 0.012 0.192
#> GSM154300 2 0.4042 0.664 0.000 0.756 0.000 0.032 0.212
#> GSM154313 2 0.1419 0.821 0.000 0.956 0.012 0.016 0.016
#> GSM154314 2 0.1419 0.821 0.000 0.956 0.012 0.016 0.016
#> GSM154315 4 0.6070 0.427 0.000 0.436 0.000 0.444 0.120
#> GSM154271 1 0.0880 0.793 0.968 0.000 0.032 0.000 0.000
#> GSM154272 1 0.0880 0.793 0.968 0.000 0.032 0.000 0.000
#> GSM154273 1 0.3796 0.863 0.700 0.000 0.000 0.300 0.000
#> GSM154286 3 0.1787 0.847 0.012 0.000 0.940 0.032 0.016
#> GSM154287 3 0.0671 0.871 0.016 0.000 0.980 0.000 0.004
#> GSM154288 4 0.6340 0.345 0.000 0.008 0.408 0.460 0.124
#> GSM154301 3 0.0566 0.873 0.012 0.000 0.984 0.000 0.004
#> GSM154302 3 0.0566 0.873 0.012 0.000 0.984 0.000 0.004
#> GSM154303 4 0.6343 0.337 0.000 0.008 0.412 0.456 0.124
#> GSM154316 3 0.0566 0.873 0.012 0.000 0.984 0.000 0.004
#> GSM154317 3 0.0566 0.873 0.012 0.000 0.984 0.000 0.004
#> GSM154318 3 0.0566 0.873 0.012 0.000 0.984 0.000 0.004
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> GSM154259 1 0.4251 0.692 0.520 0.000 0.004 0.004 0.004 NA
#> GSM154260 1 0.1844 0.780 0.928 0.000 0.000 0.016 0.016 NA
#> GSM154261 1 0.1844 0.780 0.928 0.000 0.000 0.016 0.016 NA
#> GSM154274 5 0.4255 0.785 0.000 0.072 0.004 0.016 0.764 NA
#> GSM154275 5 0.4237 0.784 0.000 0.060 0.008 0.016 0.768 NA
#> GSM154276 5 0.3934 0.788 0.000 0.060 0.004 0.016 0.792 NA
#> GSM154289 2 0.4943 0.684 0.000 0.656 0.000 0.040 0.040 NA
#> GSM154290 2 0.5582 0.663 0.000 0.612 0.004 0.040 0.076 NA
#> GSM154291 4 0.4433 0.744 0.000 0.188 0.000 0.728 0.016 NA
#> GSM154304 2 0.4613 0.722 0.000 0.724 0.004 0.052 0.028 NA
#> GSM154305 2 0.4546 0.717 0.000 0.724 0.000 0.052 0.032 NA
#> GSM154306 4 0.4298 0.745 0.000 0.200 0.000 0.732 0.016 NA
#> GSM154262 1 0.3950 0.714 0.564 0.000 0.004 0.000 0.000 NA
#> GSM154263 1 0.1483 0.800 0.944 0.000 0.000 0.036 0.008 NA
#> GSM154264 1 0.0146 0.801 0.996 0.000 0.000 0.000 0.004 NA
#> GSM154277 5 0.2945 0.817 0.000 0.028 0.004 0.064 0.872 NA
#> GSM154278 5 0.2540 0.843 0.000 0.104 0.004 0.000 0.872 NA
#> GSM154279 5 0.2051 0.845 0.000 0.096 0.004 0.004 0.896 NA
#> GSM154292 2 0.2772 0.793 0.000 0.876 0.000 0.016 0.060 NA
#> GSM154293 2 0.2772 0.793 0.000 0.876 0.000 0.016 0.060 NA
#> GSM154294 4 0.3729 0.722 0.000 0.296 0.000 0.692 0.012 NA
#> GSM154307 2 0.1167 0.803 0.000 0.960 0.008 0.012 0.000 NA
#> GSM154308 2 0.1167 0.803 0.000 0.960 0.008 0.012 0.000 NA
#> GSM154309 2 0.1167 0.803 0.000 0.960 0.008 0.012 0.000 NA
#> GSM154265 1 0.3950 0.714 0.564 0.000 0.004 0.000 0.000 NA
#> GSM154266 1 0.1370 0.801 0.948 0.000 0.000 0.036 0.004 NA
#> GSM154267 1 0.0000 0.801 1.000 0.000 0.000 0.000 0.000 NA
#> GSM154280 5 0.4560 0.732 0.000 0.008 0.176 0.020 0.736 NA
#> GSM154281 5 0.4225 0.737 0.000 0.008 0.172 0.020 0.760 NA
#> GSM154282 5 0.4225 0.737 0.000 0.008 0.172 0.020 0.760 NA
#> GSM154295 3 0.2344 0.773 0.000 0.076 0.892 0.004 0.028 NA
#> GSM154296 3 0.3201 0.757 0.000 0.068 0.860 0.016 0.040 NA
#> GSM154297 3 0.3201 0.757 0.000 0.068 0.860 0.016 0.040 NA
#> GSM154310 3 0.2344 0.773 0.000 0.076 0.892 0.004 0.028 NA
#> GSM154311 3 0.2344 0.773 0.000 0.076 0.892 0.004 0.028 NA
#> GSM154312 3 0.2344 0.773 0.000 0.076 0.892 0.004 0.028 NA
#> GSM154268 1 0.1370 0.801 0.948 0.000 0.000 0.036 0.004 NA
#> GSM154269 1 0.3950 0.714 0.564 0.000 0.004 0.000 0.000 NA
#> GSM154270 1 0.0000 0.801 1.000 0.000 0.000 0.000 0.000 NA
#> GSM154283 5 0.3373 0.818 0.000 0.116 0.004 0.008 0.828 NA
#> GSM154284 5 0.2205 0.844 0.000 0.088 0.004 0.004 0.896 NA
#> GSM154285 5 0.2758 0.842 0.000 0.088 0.008 0.004 0.872 NA
#> GSM154298 2 0.2086 0.791 0.000 0.920 0.008 0.008 0.028 NA
#> GSM154299 2 0.4124 0.671 0.000 0.740 0.004 0.008 0.208 NA
#> GSM154300 2 0.5531 0.631 0.000 0.620 0.004 0.016 0.224 NA
#> GSM154313 2 0.1210 0.797 0.000 0.960 0.008 0.004 0.008 NA
#> GSM154314 2 0.1210 0.797 0.000 0.960 0.008 0.004 0.008 NA
#> GSM154315 4 0.3650 0.731 0.000 0.280 0.000 0.708 0.012 NA
#> GSM154271 1 0.3950 0.714 0.564 0.000 0.004 0.000 0.000 NA
#> GSM154272 1 0.3950 0.714 0.564 0.000 0.004 0.000 0.000 NA
#> GSM154273 1 0.0000 0.801 1.000 0.000 0.000 0.000 0.000 NA
#> GSM154286 3 0.5557 0.703 0.004 0.000 0.632 0.168 0.020 NA
#> GSM154287 3 0.4040 0.794 0.000 0.000 0.756 0.112 0.000 NA
#> GSM154288 4 0.3636 0.619 0.000 0.000 0.108 0.812 0.016 NA
#> GSM154301 3 0.4001 0.796 0.000 0.000 0.760 0.112 0.000 NA
#> GSM154302 3 0.4100 0.798 0.000 0.004 0.760 0.112 0.000 NA
#> GSM154303 4 0.3677 0.606 0.000 0.000 0.120 0.804 0.012 NA
#> GSM154316 3 0.4100 0.798 0.000 0.004 0.760 0.112 0.000 NA
#> GSM154317 3 0.4100 0.798 0.000 0.004 0.760 0.112 0.000 NA
#> GSM154318 3 0.4100 0.798 0.000 0.004 0.760 0.112 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 agent(p) time(p) k
#> MAD:kmeans 59 2.29e-03 1.99e-07 2
#> MAD:kmeans 60 3.68e-07 4.50e-11 3
#> MAD:kmeans 34 2.13e-03 8.92e-07 4
#> MAD:kmeans 56 6.39e-04 2.45e-16 5
#> MAD:kmeans 60 4.51e-03 4.99e-17 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 38950 rows and 60 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 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.993 0.997 0.4897 0.512 0.512
#> 3 3 1.000 0.962 0.977 0.3411 0.760 0.561
#> 4 4 0.917 0.931 0.954 0.1427 0.871 0.640
#> 5 5 0.878 0.825 0.885 0.0619 0.938 0.754
#> 6 6 0.843 0.835 0.871 0.0364 0.968 0.841
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
#> GSM154259 1 0.000 1.000 1.000 0.000
#> GSM154260 1 0.000 1.000 1.000 0.000
#> GSM154261 1 0.000 1.000 1.000 0.000
#> GSM154274 2 0.000 0.994 0.000 1.000
#> GSM154275 2 0.000 0.994 0.000 1.000
#> GSM154276 2 0.000 0.994 0.000 1.000
#> GSM154289 2 0.000 0.994 0.000 1.000
#> GSM154290 2 0.000 0.994 0.000 1.000
#> GSM154291 2 0.000 0.994 0.000 1.000
#> GSM154304 2 0.000 0.994 0.000 1.000
#> GSM154305 2 0.000 0.994 0.000 1.000
#> GSM154306 2 0.000 0.994 0.000 1.000
#> GSM154262 1 0.000 1.000 1.000 0.000
#> GSM154263 1 0.000 1.000 1.000 0.000
#> GSM154264 1 0.000 1.000 1.000 0.000
#> GSM154277 2 0.000 0.994 0.000 1.000
#> GSM154278 2 0.000 0.994 0.000 1.000
#> GSM154279 2 0.000 0.994 0.000 1.000
#> GSM154292 2 0.000 0.994 0.000 1.000
#> GSM154293 2 0.000 0.994 0.000 1.000
#> GSM154294 2 0.000 0.994 0.000 1.000
#> GSM154307 2 0.000 0.994 0.000 1.000
#> GSM154308 2 0.000 0.994 0.000 1.000
#> GSM154309 2 0.000 0.994 0.000 1.000
#> GSM154265 1 0.000 1.000 1.000 0.000
#> GSM154266 1 0.000 1.000 1.000 0.000
#> GSM154267 1 0.000 1.000 1.000 0.000
#> GSM154280 2 0.358 0.931 0.068 0.932
#> GSM154281 2 0.358 0.931 0.068 0.932
#> GSM154282 2 0.358 0.931 0.068 0.932
#> GSM154295 2 0.000 0.994 0.000 1.000
#> GSM154296 2 0.000 0.994 0.000 1.000
#> GSM154297 2 0.000 0.994 0.000 1.000
#> GSM154310 2 0.000 0.994 0.000 1.000
#> GSM154311 2 0.000 0.994 0.000 1.000
#> GSM154312 2 0.000 0.994 0.000 1.000
#> GSM154268 1 0.000 1.000 1.000 0.000
#> GSM154269 1 0.000 1.000 1.000 0.000
#> GSM154270 1 0.000 1.000 1.000 0.000
#> GSM154283 2 0.000 0.994 0.000 1.000
#> GSM154284 2 0.000 0.994 0.000 1.000
#> GSM154285 2 0.000 0.994 0.000 1.000
#> GSM154298 2 0.000 0.994 0.000 1.000
#> GSM154299 2 0.000 0.994 0.000 1.000
#> GSM154300 2 0.000 0.994 0.000 1.000
#> GSM154313 2 0.000 0.994 0.000 1.000
#> GSM154314 2 0.000 0.994 0.000 1.000
#> GSM154315 2 0.000 0.994 0.000 1.000
#> GSM154271 1 0.000 1.000 1.000 0.000
#> GSM154272 1 0.000 1.000 1.000 0.000
#> GSM154273 1 0.000 1.000 1.000 0.000
#> GSM154286 1 0.000 1.000 1.000 0.000
#> GSM154287 1 0.000 1.000 1.000 0.000
#> GSM154288 1 0.000 1.000 1.000 0.000
#> GSM154301 1 0.000 1.000 1.000 0.000
#> GSM154302 1 0.000 1.000 1.000 0.000
#> GSM154303 1 0.000 1.000 1.000 0.000
#> GSM154316 1 0.000 1.000 1.000 0.000
#> GSM154317 1 0.000 1.000 1.000 0.000
#> GSM154318 1 0.000 1.000 1.000 0.000
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> GSM154259 1 0.0000 0.999 1.000 0.000 0.000
#> GSM154260 1 0.0000 0.999 1.000 0.000 0.000
#> GSM154261 1 0.0000 0.999 1.000 0.000 0.000
#> GSM154274 2 0.1529 0.973 0.000 0.960 0.040
#> GSM154275 2 0.1643 0.972 0.000 0.956 0.044
#> GSM154276 2 0.1643 0.972 0.000 0.956 0.044
#> GSM154289 2 0.0000 0.985 0.000 1.000 0.000
#> GSM154290 2 0.0000 0.985 0.000 1.000 0.000
#> GSM154291 2 0.0237 0.985 0.000 0.996 0.004
#> GSM154304 2 0.0000 0.985 0.000 1.000 0.000
#> GSM154305 2 0.0000 0.985 0.000 1.000 0.000
#> GSM154306 2 0.0237 0.985 0.000 0.996 0.004
#> GSM154262 1 0.0000 0.999 1.000 0.000 0.000
#> GSM154263 1 0.0000 0.999 1.000 0.000 0.000
#> GSM154264 1 0.0000 0.999 1.000 0.000 0.000
#> GSM154277 2 0.1643 0.972 0.000 0.956 0.044
#> GSM154278 2 0.1529 0.973 0.000 0.960 0.040
#> GSM154279 2 0.1643 0.972 0.000 0.956 0.044
#> GSM154292 2 0.0000 0.985 0.000 1.000 0.000
#> GSM154293 2 0.0000 0.985 0.000 1.000 0.000
#> GSM154294 2 0.0237 0.985 0.000 0.996 0.004
#> GSM154307 2 0.0000 0.985 0.000 1.000 0.000
#> GSM154308 2 0.0000 0.985 0.000 1.000 0.000
#> GSM154309 2 0.0000 0.985 0.000 1.000 0.000
#> GSM154265 1 0.0000 0.999 1.000 0.000 0.000
#> GSM154266 1 0.0000 0.999 1.000 0.000 0.000
#> GSM154267 1 0.0000 0.999 1.000 0.000 0.000
#> GSM154280 3 0.0000 0.933 0.000 0.000 1.000
#> GSM154281 3 0.0000 0.933 0.000 0.000 1.000
#> GSM154282 3 0.0000 0.933 0.000 0.000 1.000
#> GSM154295 3 0.1643 0.939 0.000 0.044 0.956
#> GSM154296 3 0.1643 0.939 0.000 0.044 0.956
#> GSM154297 3 0.1643 0.939 0.000 0.044 0.956
#> GSM154310 3 0.1643 0.939 0.000 0.044 0.956
#> GSM154311 3 0.1643 0.939 0.000 0.044 0.956
#> GSM154312 3 0.1643 0.939 0.000 0.044 0.956
#> GSM154268 1 0.0000 0.999 1.000 0.000 0.000
#> GSM154269 1 0.0000 0.999 1.000 0.000 0.000
#> GSM154270 1 0.0000 0.999 1.000 0.000 0.000
#> GSM154283 2 0.1529 0.973 0.000 0.960 0.040
#> GSM154284 2 0.1643 0.972 0.000 0.956 0.044
#> GSM154285 2 0.1643 0.972 0.000 0.956 0.044
#> GSM154298 2 0.0000 0.985 0.000 1.000 0.000
#> GSM154299 2 0.0237 0.985 0.000 0.996 0.004
#> GSM154300 2 0.0237 0.985 0.000 0.996 0.004
#> GSM154313 2 0.0000 0.985 0.000 1.000 0.000
#> GSM154314 2 0.0000 0.985 0.000 1.000 0.000
#> GSM154315 2 0.0237 0.985 0.000 0.996 0.004
#> GSM154271 1 0.0000 0.999 1.000 0.000 0.000
#> GSM154272 1 0.0000 0.999 1.000 0.000 0.000
#> GSM154273 1 0.0000 0.999 1.000 0.000 0.000
#> GSM154286 1 0.0000 0.999 1.000 0.000 0.000
#> GSM154287 3 0.6280 0.201 0.460 0.000 0.540
#> GSM154288 1 0.0661 0.986 0.988 0.008 0.004
#> GSM154301 3 0.1643 0.938 0.044 0.000 0.956
#> GSM154302 3 0.1643 0.938 0.044 0.000 0.956
#> GSM154303 3 0.1529 0.939 0.040 0.000 0.960
#> GSM154316 3 0.1643 0.938 0.044 0.000 0.956
#> GSM154317 3 0.1643 0.938 0.044 0.000 0.956
#> GSM154318 3 0.1643 0.938 0.044 0.000 0.956
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> GSM154259 1 0.000 0.975 1.000 0.000 0.000 0.000
#> GSM154260 1 0.000 0.975 1.000 0.000 0.000 0.000
#> GSM154261 1 0.000 0.975 1.000 0.000 0.000 0.000
#> GSM154274 4 0.276 0.935 0.000 0.128 0.000 0.872
#> GSM154275 4 0.228 0.947 0.000 0.096 0.000 0.904
#> GSM154276 4 0.228 0.947 0.000 0.096 0.000 0.904
#> GSM154289 2 0.000 0.976 0.000 1.000 0.000 0.000
#> GSM154290 2 0.000 0.976 0.000 1.000 0.000 0.000
#> GSM154291 2 0.164 0.945 0.000 0.940 0.000 0.060
#> GSM154304 2 0.000 0.976 0.000 1.000 0.000 0.000
#> GSM154305 2 0.000 0.976 0.000 1.000 0.000 0.000
#> GSM154306 2 0.164 0.945 0.000 0.940 0.000 0.060
#> GSM154262 1 0.000 0.975 1.000 0.000 0.000 0.000
#> GSM154263 1 0.000 0.975 1.000 0.000 0.000 0.000
#> GSM154264 1 0.000 0.975 1.000 0.000 0.000 0.000
#> GSM154277 4 0.179 0.931 0.000 0.068 0.000 0.932
#> GSM154278 4 0.276 0.935 0.000 0.128 0.000 0.872
#> GSM154279 4 0.228 0.947 0.000 0.096 0.000 0.904
#> GSM154292 2 0.000 0.976 0.000 1.000 0.000 0.000
#> GSM154293 2 0.000 0.976 0.000 1.000 0.000 0.000
#> GSM154294 2 0.164 0.945 0.000 0.940 0.000 0.060
#> GSM154307 2 0.000 0.976 0.000 1.000 0.000 0.000
#> GSM154308 2 0.000 0.976 0.000 1.000 0.000 0.000
#> GSM154309 2 0.000 0.976 0.000 1.000 0.000 0.000
#> GSM154265 1 0.000 0.975 1.000 0.000 0.000 0.000
#> GSM154266 1 0.000 0.975 1.000 0.000 0.000 0.000
#> GSM154267 1 0.000 0.975 1.000 0.000 0.000 0.000
#> GSM154280 4 0.164 0.869 0.000 0.000 0.060 0.940
#> GSM154281 4 0.164 0.869 0.000 0.000 0.060 0.940
#> GSM154282 4 0.164 0.869 0.000 0.000 0.060 0.940
#> GSM154295 3 0.179 0.924 0.000 0.000 0.932 0.068
#> GSM154296 3 0.179 0.924 0.000 0.000 0.932 0.068
#> GSM154297 3 0.179 0.924 0.000 0.000 0.932 0.068
#> GSM154310 3 0.179 0.924 0.000 0.000 0.932 0.068
#> GSM154311 3 0.179 0.924 0.000 0.000 0.932 0.068
#> GSM154312 3 0.179 0.924 0.000 0.000 0.932 0.068
#> GSM154268 1 0.000 0.975 1.000 0.000 0.000 0.000
#> GSM154269 1 0.000 0.975 1.000 0.000 0.000 0.000
#> GSM154270 1 0.000 0.975 1.000 0.000 0.000 0.000
#> GSM154283 4 0.276 0.935 0.000 0.128 0.000 0.872
#> GSM154284 4 0.228 0.947 0.000 0.096 0.000 0.904
#> GSM154285 4 0.228 0.947 0.000 0.096 0.000 0.904
#> GSM154298 2 0.000 0.976 0.000 1.000 0.000 0.000
#> GSM154299 2 0.179 0.919 0.000 0.932 0.000 0.068
#> GSM154300 2 0.194 0.910 0.000 0.924 0.000 0.076
#> GSM154313 2 0.000 0.976 0.000 1.000 0.000 0.000
#> GSM154314 2 0.000 0.976 0.000 1.000 0.000 0.000
#> GSM154315 2 0.164 0.945 0.000 0.940 0.000 0.060
#> GSM154271 1 0.000 0.975 1.000 0.000 0.000 0.000
#> GSM154272 1 0.000 0.975 1.000 0.000 0.000 0.000
#> GSM154273 1 0.000 0.975 1.000 0.000 0.000 0.000
#> GSM154286 1 0.179 0.916 0.932 0.000 0.068 0.000
#> GSM154287 3 0.489 0.252 0.412 0.000 0.588 0.000
#> GSM154288 1 0.685 0.608 0.664 0.208 0.068 0.060
#> GSM154301 3 0.000 0.923 0.000 0.000 1.000 0.000
#> GSM154302 3 0.000 0.923 0.000 0.000 1.000 0.000
#> GSM154303 3 0.164 0.882 0.000 0.000 0.940 0.060
#> GSM154316 3 0.000 0.923 0.000 0.000 1.000 0.000
#> GSM154317 3 0.000 0.923 0.000 0.000 1.000 0.000
#> GSM154318 3 0.000 0.923 0.000 0.000 1.000 0.000
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> GSM154259 1 0.0162 0.968 0.996 0.000 0.000 0.004 0.000
#> GSM154260 1 0.0000 0.968 1.000 0.000 0.000 0.000 0.000
#> GSM154261 1 0.0000 0.968 1.000 0.000 0.000 0.000 0.000
#> GSM154274 5 0.1403 0.907 0.000 0.024 0.000 0.024 0.952
#> GSM154275 5 0.0992 0.910 0.000 0.008 0.000 0.024 0.968
#> GSM154276 5 0.0992 0.910 0.000 0.008 0.000 0.024 0.968
#> GSM154289 2 0.1106 0.930 0.000 0.964 0.000 0.024 0.012
#> GSM154290 2 0.1195 0.929 0.000 0.960 0.000 0.028 0.012
#> GSM154291 4 0.4757 0.603 0.000 0.380 0.000 0.596 0.024
#> GSM154304 2 0.1012 0.932 0.000 0.968 0.000 0.020 0.012
#> GSM154305 2 0.1106 0.931 0.000 0.964 0.000 0.024 0.012
#> GSM154306 4 0.4768 0.602 0.000 0.384 0.000 0.592 0.024
#> GSM154262 1 0.0162 0.968 0.996 0.000 0.000 0.004 0.000
#> GSM154263 1 0.0000 0.968 1.000 0.000 0.000 0.000 0.000
#> GSM154264 1 0.0000 0.968 1.000 0.000 0.000 0.000 0.000
#> GSM154277 4 0.4617 0.148 0.000 0.012 0.000 0.552 0.436
#> GSM154278 5 0.1341 0.904 0.000 0.056 0.000 0.000 0.944
#> GSM154279 5 0.0609 0.916 0.000 0.020 0.000 0.000 0.980
#> GSM154292 2 0.0162 0.944 0.000 0.996 0.000 0.004 0.000
#> GSM154293 2 0.0162 0.944 0.000 0.996 0.000 0.004 0.000
#> GSM154294 4 0.4582 0.591 0.000 0.416 0.000 0.572 0.012
#> GSM154307 2 0.0162 0.947 0.000 0.996 0.004 0.000 0.000
#> GSM154308 2 0.0162 0.947 0.000 0.996 0.004 0.000 0.000
#> GSM154309 2 0.0162 0.947 0.000 0.996 0.004 0.000 0.000
#> GSM154265 1 0.0162 0.968 0.996 0.000 0.000 0.004 0.000
#> GSM154266 1 0.0000 0.968 1.000 0.000 0.000 0.000 0.000
#> GSM154267 1 0.0000 0.968 1.000 0.000 0.000 0.000 0.000
#> GSM154280 5 0.2929 0.824 0.000 0.000 0.180 0.000 0.820
#> GSM154281 5 0.2929 0.824 0.000 0.000 0.180 0.000 0.820
#> GSM154282 5 0.2929 0.824 0.000 0.000 0.180 0.000 0.820
#> GSM154295 3 0.0510 0.744 0.000 0.016 0.984 0.000 0.000
#> GSM154296 3 0.0671 0.742 0.000 0.016 0.980 0.000 0.004
#> GSM154297 3 0.0671 0.742 0.000 0.016 0.980 0.000 0.004
#> GSM154310 3 0.0510 0.744 0.000 0.016 0.984 0.000 0.000
#> GSM154311 3 0.0510 0.744 0.000 0.016 0.984 0.000 0.000
#> GSM154312 3 0.0510 0.744 0.000 0.016 0.984 0.000 0.000
#> GSM154268 1 0.0000 0.968 1.000 0.000 0.000 0.000 0.000
#> GSM154269 1 0.0162 0.968 0.996 0.000 0.000 0.004 0.000
#> GSM154270 1 0.0000 0.968 1.000 0.000 0.000 0.000 0.000
#> GSM154283 5 0.1341 0.904 0.000 0.056 0.000 0.000 0.944
#> GSM154284 5 0.0609 0.916 0.000 0.020 0.000 0.000 0.980
#> GSM154285 5 0.0609 0.916 0.000 0.020 0.000 0.000 0.980
#> GSM154298 2 0.0162 0.947 0.000 0.996 0.004 0.000 0.000
#> GSM154299 2 0.2674 0.778 0.000 0.856 0.004 0.000 0.140
#> GSM154300 2 0.2763 0.766 0.000 0.848 0.000 0.004 0.148
#> GSM154313 2 0.0162 0.947 0.000 0.996 0.004 0.000 0.000
#> GSM154314 2 0.0162 0.947 0.000 0.996 0.004 0.000 0.000
#> GSM154315 4 0.4582 0.591 0.000 0.416 0.000 0.572 0.012
#> GSM154271 1 0.0162 0.968 0.996 0.000 0.000 0.004 0.000
#> GSM154272 1 0.0162 0.968 0.996 0.000 0.000 0.004 0.000
#> GSM154273 1 0.0000 0.968 1.000 0.000 0.000 0.000 0.000
#> GSM154286 1 0.4903 0.361 0.576 0.000 0.016 0.400 0.008
#> GSM154287 3 0.6081 0.619 0.096 0.000 0.492 0.404 0.008
#> GSM154288 4 0.1372 0.418 0.024 0.004 0.000 0.956 0.016
#> GSM154301 3 0.4446 0.718 0.000 0.000 0.592 0.400 0.008
#> GSM154302 3 0.4446 0.718 0.000 0.000 0.592 0.400 0.008
#> GSM154303 4 0.1267 0.395 0.004 0.000 0.024 0.960 0.012
#> GSM154316 3 0.4446 0.718 0.000 0.000 0.592 0.400 0.008
#> GSM154317 3 0.4446 0.718 0.000 0.000 0.592 0.400 0.008
#> GSM154318 3 0.4446 0.718 0.000 0.000 0.592 0.400 0.008
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> GSM154259 1 0.1500 0.961 0.936 0.000 0.000 0.012 0.000 0.052
#> GSM154260 1 0.0000 0.974 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM154261 1 0.0000 0.974 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM154274 5 0.5404 0.649 0.000 0.020 0.000 0.196 0.636 0.148
#> GSM154275 5 0.5046 0.661 0.000 0.012 0.000 0.188 0.668 0.132
#> GSM154276 5 0.5009 0.663 0.000 0.012 0.000 0.188 0.672 0.128
#> GSM154289 2 0.4756 0.668 0.000 0.672 0.000 0.200 0.000 0.128
#> GSM154290 2 0.4919 0.660 0.000 0.664 0.000 0.204 0.004 0.128
#> GSM154291 4 0.1910 0.723 0.000 0.108 0.000 0.892 0.000 0.000
#> GSM154304 2 0.3023 0.803 0.000 0.828 0.000 0.140 0.000 0.032
#> GSM154305 2 0.3134 0.798 0.000 0.820 0.000 0.144 0.000 0.036
#> GSM154306 4 0.2416 0.733 0.000 0.156 0.000 0.844 0.000 0.000
#> GSM154262 1 0.1500 0.961 0.936 0.000 0.000 0.012 0.000 0.052
#> GSM154263 1 0.0000 0.974 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM154264 1 0.0000 0.974 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM154277 4 0.3695 0.407 0.000 0.000 0.000 0.624 0.376 0.000
#> GSM154278 5 0.3124 0.748 0.000 0.096 0.000 0.016 0.848 0.040
#> GSM154279 5 0.0717 0.781 0.000 0.000 0.000 0.008 0.976 0.016
#> GSM154292 2 0.0622 0.876 0.000 0.980 0.000 0.008 0.000 0.012
#> GSM154293 2 0.0622 0.876 0.000 0.980 0.000 0.008 0.000 0.012
#> GSM154294 4 0.3330 0.704 0.000 0.284 0.000 0.716 0.000 0.000
#> GSM154307 2 0.0820 0.878 0.000 0.972 0.000 0.016 0.000 0.012
#> GSM154308 2 0.0820 0.878 0.000 0.972 0.000 0.016 0.000 0.012
#> GSM154309 2 0.0820 0.878 0.000 0.972 0.000 0.016 0.000 0.012
#> GSM154265 1 0.1500 0.961 0.936 0.000 0.000 0.012 0.000 0.052
#> GSM154266 1 0.0000 0.974 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM154267 1 0.0000 0.974 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM154280 5 0.3896 0.705 0.000 0.000 0.000 0.052 0.744 0.204
#> GSM154281 5 0.3837 0.706 0.000 0.000 0.000 0.052 0.752 0.196
#> GSM154282 5 0.3807 0.706 0.000 0.000 0.000 0.052 0.756 0.192
#> GSM154295 6 0.3351 0.979 0.000 0.000 0.288 0.000 0.000 0.712
#> GSM154296 6 0.3290 0.959 0.000 0.000 0.252 0.000 0.004 0.744
#> GSM154297 6 0.3290 0.959 0.000 0.000 0.252 0.000 0.004 0.744
#> GSM154310 6 0.3351 0.979 0.000 0.000 0.288 0.000 0.000 0.712
#> GSM154311 6 0.3351 0.979 0.000 0.000 0.288 0.000 0.000 0.712
#> GSM154312 6 0.3351 0.979 0.000 0.000 0.288 0.000 0.000 0.712
#> GSM154268 1 0.0000 0.974 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM154269 1 0.1500 0.961 0.936 0.000 0.000 0.012 0.000 0.052
#> GSM154270 1 0.0000 0.974 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM154283 5 0.2933 0.742 0.000 0.096 0.000 0.008 0.856 0.040
#> GSM154284 5 0.0405 0.782 0.000 0.000 0.000 0.004 0.988 0.008
#> GSM154285 5 0.0777 0.781 0.000 0.000 0.000 0.004 0.972 0.024
#> GSM154298 2 0.1332 0.870 0.000 0.952 0.000 0.008 0.012 0.028
#> GSM154299 2 0.2418 0.825 0.000 0.884 0.000 0.008 0.092 0.016
#> GSM154300 2 0.2815 0.825 0.000 0.864 0.000 0.012 0.096 0.028
#> GSM154313 2 0.1036 0.873 0.000 0.964 0.000 0.004 0.008 0.024
#> GSM154314 2 0.1036 0.873 0.000 0.964 0.000 0.004 0.008 0.024
#> GSM154315 4 0.3330 0.704 0.000 0.284 0.000 0.716 0.000 0.000
#> GSM154271 1 0.1500 0.961 0.936 0.000 0.000 0.012 0.000 0.052
#> GSM154272 1 0.1500 0.961 0.936 0.000 0.000 0.012 0.000 0.052
#> GSM154273 1 0.0000 0.974 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM154286 3 0.4138 0.532 0.268 0.000 0.700 0.008 0.004 0.020
#> GSM154287 3 0.2177 0.811 0.032 0.000 0.908 0.008 0.000 0.052
#> GSM154288 4 0.3330 0.587 0.000 0.000 0.284 0.716 0.000 0.000
#> GSM154301 3 0.0000 0.886 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM154302 3 0.0000 0.886 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM154303 4 0.3330 0.587 0.000 0.000 0.284 0.716 0.000 0.000
#> GSM154316 3 0.0000 0.886 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM154317 3 0.0000 0.886 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM154318 3 0.0000 0.886 0.000 0.000 1.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 agent(p) time(p) k
#> MAD:skmeans 60 1.59e-04 1.38e-06 2
#> MAD:skmeans 59 8.89e-07 2.14e-09 3
#> MAD:skmeans 59 5.85e-04 2.91e-18 4
#> MAD:skmeans 56 3.94e-03 3.60e-17 5
#> MAD:skmeans 59 7.51e-07 1.72e-15 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 38950 rows and 60 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 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.864 0.912 0.966 0.4551 0.548 0.548
#> 3 3 1.000 0.997 0.999 0.4410 0.723 0.526
#> 4 4 0.906 0.911 0.927 0.0823 0.954 0.867
#> 5 5 0.833 0.822 0.901 0.0859 0.941 0.805
#> 6 6 0.841 0.822 0.835 0.0469 0.969 0.875
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] 3
There is also optional best \(k\) = 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
#> GSM154259 1 0.0000 0.9581 1.000 0.000
#> GSM154260 1 0.0000 0.9581 1.000 0.000
#> GSM154261 1 0.0000 0.9581 1.000 0.000
#> GSM154274 2 0.0000 0.9644 0.000 1.000
#> GSM154275 2 0.0000 0.9644 0.000 1.000
#> GSM154276 2 0.0000 0.9644 0.000 1.000
#> GSM154289 2 0.0000 0.9644 0.000 1.000
#> GSM154290 2 0.0000 0.9644 0.000 1.000
#> GSM154291 2 0.0000 0.9644 0.000 1.000
#> GSM154304 2 0.0000 0.9644 0.000 1.000
#> GSM154305 2 0.0000 0.9644 0.000 1.000
#> GSM154306 2 0.0000 0.9644 0.000 1.000
#> GSM154262 1 0.0000 0.9581 1.000 0.000
#> GSM154263 1 0.0000 0.9581 1.000 0.000
#> GSM154264 1 0.0000 0.9581 1.000 0.000
#> GSM154277 2 0.0000 0.9644 0.000 1.000
#> GSM154278 2 0.0000 0.9644 0.000 1.000
#> GSM154279 2 0.0000 0.9644 0.000 1.000
#> GSM154292 2 0.0000 0.9644 0.000 1.000
#> GSM154293 2 0.0000 0.9644 0.000 1.000
#> GSM154294 2 0.0000 0.9644 0.000 1.000
#> GSM154307 2 0.0000 0.9644 0.000 1.000
#> GSM154308 2 0.0000 0.9644 0.000 1.000
#> GSM154309 2 0.0000 0.9644 0.000 1.000
#> GSM154265 1 0.0000 0.9581 1.000 0.000
#> GSM154266 1 0.0000 0.9581 1.000 0.000
#> GSM154267 1 0.0000 0.9581 1.000 0.000
#> GSM154280 2 0.0376 0.9626 0.004 0.996
#> GSM154281 2 0.0376 0.9626 0.004 0.996
#> GSM154282 2 0.0376 0.9626 0.004 0.996
#> GSM154295 2 0.0376 0.9626 0.004 0.996
#> GSM154296 2 0.0376 0.9626 0.004 0.996
#> GSM154297 2 0.0376 0.9626 0.004 0.996
#> GSM154310 2 0.0376 0.9626 0.004 0.996
#> GSM154311 2 0.0376 0.9626 0.004 0.996
#> GSM154312 2 0.0376 0.9626 0.004 0.996
#> GSM154268 1 0.0000 0.9581 1.000 0.000
#> GSM154269 1 0.0000 0.9581 1.000 0.000
#> GSM154270 1 0.0000 0.9581 1.000 0.000
#> GSM154283 2 0.0000 0.9644 0.000 1.000
#> GSM154284 2 0.0000 0.9644 0.000 1.000
#> GSM154285 2 0.0000 0.9644 0.000 1.000
#> GSM154298 2 0.0000 0.9644 0.000 1.000
#> GSM154299 2 0.0000 0.9644 0.000 1.000
#> GSM154300 2 0.0000 0.9644 0.000 1.000
#> GSM154313 2 0.0000 0.9644 0.000 1.000
#> GSM154314 2 0.0000 0.9644 0.000 1.000
#> GSM154315 2 0.0000 0.9644 0.000 1.000
#> GSM154271 1 0.0000 0.9581 1.000 0.000
#> GSM154272 1 0.0000 0.9581 1.000 0.000
#> GSM154273 1 0.0000 0.9581 1.000 0.000
#> GSM154286 1 0.2778 0.9268 0.952 0.048
#> GSM154287 1 0.2778 0.9268 0.952 0.048
#> GSM154288 2 0.6712 0.7661 0.176 0.824
#> GSM154301 1 0.7674 0.7240 0.776 0.224
#> GSM154302 1 0.6531 0.8026 0.832 0.168
#> GSM154303 2 0.4939 0.8550 0.108 0.892
#> GSM154316 2 0.9998 -0.0144 0.492 0.508
#> GSM154317 2 0.9993 0.0181 0.484 0.516
#> GSM154318 1 0.8267 0.6629 0.740 0.260
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> GSM154259 1 0.0000 1.000 1 0.000 0.000
#> GSM154260 1 0.0000 1.000 1 0.000 0.000
#> GSM154261 1 0.0000 1.000 1 0.000 0.000
#> GSM154274 2 0.0000 1.000 0 1.000 0.000
#> GSM154275 2 0.0000 1.000 0 1.000 0.000
#> GSM154276 2 0.0000 1.000 0 1.000 0.000
#> GSM154289 2 0.0000 1.000 0 1.000 0.000
#> GSM154290 2 0.0000 1.000 0 1.000 0.000
#> GSM154291 2 0.0000 1.000 0 1.000 0.000
#> GSM154304 2 0.0000 1.000 0 1.000 0.000
#> GSM154305 2 0.0000 1.000 0 1.000 0.000
#> GSM154306 2 0.0000 1.000 0 1.000 0.000
#> GSM154262 1 0.0000 1.000 1 0.000 0.000
#> GSM154263 1 0.0000 1.000 1 0.000 0.000
#> GSM154264 1 0.0000 1.000 1 0.000 0.000
#> GSM154277 2 0.0000 1.000 0 1.000 0.000
#> GSM154278 2 0.0000 1.000 0 1.000 0.000
#> GSM154279 2 0.0000 1.000 0 1.000 0.000
#> GSM154292 2 0.0000 1.000 0 1.000 0.000
#> GSM154293 2 0.0000 1.000 0 1.000 0.000
#> GSM154294 2 0.0000 1.000 0 1.000 0.000
#> GSM154307 2 0.0000 1.000 0 1.000 0.000
#> GSM154308 2 0.0000 1.000 0 1.000 0.000
#> GSM154309 2 0.0000 1.000 0 1.000 0.000
#> GSM154265 1 0.0000 1.000 1 0.000 0.000
#> GSM154266 1 0.0000 1.000 1 0.000 0.000
#> GSM154267 1 0.0000 1.000 1 0.000 0.000
#> GSM154280 3 0.0237 0.993 0 0.004 0.996
#> GSM154281 3 0.0424 0.989 0 0.008 0.992
#> GSM154282 3 0.0424 0.989 0 0.008 0.992
#> GSM154295 3 0.0000 0.995 0 0.000 1.000
#> GSM154296 3 0.0000 0.995 0 0.000 1.000
#> GSM154297 3 0.1753 0.945 0 0.048 0.952
#> GSM154310 3 0.0000 0.995 0 0.000 1.000
#> GSM154311 3 0.0000 0.995 0 0.000 1.000
#> GSM154312 3 0.0000 0.995 0 0.000 1.000
#> GSM154268 1 0.0000 1.000 1 0.000 0.000
#> GSM154269 1 0.0000 1.000 1 0.000 0.000
#> GSM154270 1 0.0000 1.000 1 0.000 0.000
#> GSM154283 2 0.0000 1.000 0 1.000 0.000
#> GSM154284 2 0.0000 1.000 0 1.000 0.000
#> GSM154285 2 0.0000 1.000 0 1.000 0.000
#> GSM154298 2 0.0000 1.000 0 1.000 0.000
#> GSM154299 2 0.0000 1.000 0 1.000 0.000
#> GSM154300 2 0.0000 1.000 0 1.000 0.000
#> GSM154313 2 0.0000 1.000 0 1.000 0.000
#> GSM154314 2 0.0000 1.000 0 1.000 0.000
#> GSM154315 2 0.0000 1.000 0 1.000 0.000
#> GSM154271 1 0.0000 1.000 1 0.000 0.000
#> GSM154272 1 0.0000 1.000 1 0.000 0.000
#> GSM154273 1 0.0000 1.000 1 0.000 0.000
#> GSM154286 3 0.0000 0.995 0 0.000 1.000
#> GSM154287 3 0.0000 0.995 0 0.000 1.000
#> GSM154288 3 0.0237 0.993 0 0.004 0.996
#> GSM154301 3 0.0000 0.995 0 0.000 1.000
#> GSM154302 3 0.0000 0.995 0 0.000 1.000
#> GSM154303 3 0.0000 0.995 0 0.000 1.000
#> GSM154316 3 0.0000 0.995 0 0.000 1.000
#> GSM154317 3 0.0000 0.995 0 0.000 1.000
#> GSM154318 3 0.0000 0.995 0 0.000 1.000
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> GSM154259 1 0.000 1.000 1 0.0 0.0 0.0
#> GSM154260 1 0.000 1.000 1 0.0 0.0 0.0
#> GSM154261 1 0.000 1.000 1 0.0 0.0 0.0
#> GSM154274 2 0.000 0.942 0 1.0 0.0 0.0
#> GSM154275 2 0.000 0.942 0 1.0 0.0 0.0
#> GSM154276 2 0.000 0.942 0 1.0 0.0 0.0
#> GSM154289 2 0.000 0.942 0 1.0 0.0 0.0
#> GSM154290 2 0.000 0.942 0 1.0 0.0 0.0
#> GSM154291 2 0.485 0.562 0 0.6 0.0 0.4
#> GSM154304 2 0.000 0.942 0 1.0 0.0 0.0
#> GSM154305 2 0.000 0.942 0 1.0 0.0 0.0
#> GSM154306 2 0.485 0.562 0 0.6 0.0 0.4
#> GSM154262 1 0.000 1.000 1 0.0 0.0 0.0
#> GSM154263 1 0.000 1.000 1 0.0 0.0 0.0
#> GSM154264 1 0.000 1.000 1 0.0 0.0 0.0
#> GSM154277 2 0.000 0.942 0 1.0 0.0 0.0
#> GSM154278 2 0.000 0.942 0 1.0 0.0 0.0
#> GSM154279 2 0.000 0.942 0 1.0 0.0 0.0
#> GSM154292 2 0.000 0.942 0 1.0 0.0 0.0
#> GSM154293 2 0.000 0.942 0 1.0 0.0 0.0
#> GSM154294 2 0.485 0.562 0 0.6 0.0 0.4
#> GSM154307 2 0.000 0.942 0 1.0 0.0 0.0
#> GSM154308 2 0.000 0.942 0 1.0 0.0 0.0
#> GSM154309 2 0.000 0.942 0 1.0 0.0 0.0
#> GSM154265 1 0.000 1.000 1 0.0 0.0 0.0
#> GSM154266 1 0.000 1.000 1 0.0 0.0 0.0
#> GSM154267 1 0.000 1.000 1 0.0 0.0 0.0
#> GSM154280 3 0.000 1.000 0 0.0 1.0 0.0
#> GSM154281 3 0.000 1.000 0 0.0 1.0 0.0
#> GSM154282 3 0.000 1.000 0 0.0 1.0 0.0
#> GSM154295 3 0.000 1.000 0 0.0 1.0 0.0
#> GSM154296 3 0.000 1.000 0 0.0 1.0 0.0
#> GSM154297 3 0.000 1.000 0 0.0 1.0 0.0
#> GSM154310 3 0.000 1.000 0 0.0 1.0 0.0
#> GSM154311 3 0.000 1.000 0 0.0 1.0 0.0
#> GSM154312 3 0.000 1.000 0 0.0 1.0 0.0
#> GSM154268 1 0.000 1.000 1 0.0 0.0 0.0
#> GSM154269 1 0.000 1.000 1 0.0 0.0 0.0
#> GSM154270 1 0.000 1.000 1 0.0 0.0 0.0
#> GSM154283 2 0.000 0.942 0 1.0 0.0 0.0
#> GSM154284 2 0.000 0.942 0 1.0 0.0 0.0
#> GSM154285 2 0.000 0.942 0 1.0 0.0 0.0
#> GSM154298 2 0.000 0.942 0 1.0 0.0 0.0
#> GSM154299 2 0.000 0.942 0 1.0 0.0 0.0
#> GSM154300 2 0.000 0.942 0 1.0 0.0 0.0
#> GSM154313 2 0.000 0.942 0 1.0 0.0 0.0
#> GSM154314 2 0.000 0.942 0 1.0 0.0 0.0
#> GSM154315 2 0.485 0.562 0 0.6 0.0 0.4
#> GSM154271 1 0.000 1.000 1 0.0 0.0 0.0
#> GSM154272 1 0.000 1.000 1 0.0 0.0 0.0
#> GSM154273 1 0.000 1.000 1 0.0 0.0 0.0
#> GSM154286 4 0.485 0.816 0 0.0 0.4 0.6
#> GSM154287 4 0.485 0.816 0 0.0 0.4 0.6
#> GSM154288 4 0.000 0.525 0 0.0 0.0 1.0
#> GSM154301 4 0.485 0.816 0 0.0 0.4 0.6
#> GSM154302 4 0.485 0.816 0 0.0 0.4 0.6
#> GSM154303 4 0.000 0.525 0 0.0 0.0 1.0
#> GSM154316 4 0.485 0.816 0 0.0 0.4 0.6
#> GSM154317 4 0.485 0.816 0 0.0 0.4 0.6
#> GSM154318 4 0.485 0.816 0 0.0 0.4 0.6
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> GSM154259 1 0.242 0.9264 0.868 0.000 0.132 0.000 0.000
#> GSM154260 1 0.000 0.9452 1.000 0.000 0.000 0.000 0.000
#> GSM154261 1 0.000 0.9452 1.000 0.000 0.000 0.000 0.000
#> GSM154274 2 0.414 0.5835 0.000 0.616 0.000 0.384 0.000
#> GSM154275 2 0.414 0.5835 0.000 0.616 0.000 0.384 0.000
#> GSM154276 2 0.414 0.5835 0.000 0.616 0.000 0.384 0.000
#> GSM154289 2 0.414 0.5835 0.000 0.616 0.000 0.384 0.000
#> GSM154290 2 0.414 0.5835 0.000 0.616 0.000 0.384 0.000
#> GSM154291 4 0.000 0.5571 0.000 0.000 0.000 1.000 0.000
#> GSM154304 2 0.414 0.5835 0.000 0.616 0.000 0.384 0.000
#> GSM154305 2 0.414 0.5835 0.000 0.616 0.000 0.384 0.000
#> GSM154306 4 0.000 0.5571 0.000 0.000 0.000 1.000 0.000
#> GSM154262 1 0.242 0.9264 0.868 0.000 0.132 0.000 0.000
#> GSM154263 1 0.000 0.9452 1.000 0.000 0.000 0.000 0.000
#> GSM154264 1 0.000 0.9452 1.000 0.000 0.000 0.000 0.000
#> GSM154277 2 0.029 0.8403 0.000 0.992 0.000 0.008 0.000
#> GSM154278 2 0.029 0.8403 0.000 0.992 0.000 0.008 0.000
#> GSM154279 2 0.029 0.8403 0.000 0.992 0.000 0.008 0.000
#> GSM154292 2 0.029 0.8403 0.000 0.992 0.000 0.008 0.000
#> GSM154293 2 0.029 0.8403 0.000 0.992 0.000 0.008 0.000
#> GSM154294 4 0.411 0.5491 0.000 0.376 0.000 0.624 0.000
#> GSM154307 2 0.029 0.8403 0.000 0.992 0.000 0.008 0.000
#> GSM154308 2 0.029 0.8403 0.000 0.992 0.000 0.008 0.000
#> GSM154309 2 0.029 0.8403 0.000 0.992 0.000 0.008 0.000
#> GSM154265 1 0.242 0.9264 0.868 0.000 0.132 0.000 0.000
#> GSM154266 1 0.051 0.9450 0.984 0.000 0.016 0.000 0.000
#> GSM154267 1 0.000 0.9452 1.000 0.000 0.000 0.000 0.000
#> GSM154280 5 0.000 1.0000 0.000 0.000 0.000 0.000 1.000
#> GSM154281 5 0.000 1.0000 0.000 0.000 0.000 0.000 1.000
#> GSM154282 5 0.000 1.0000 0.000 0.000 0.000 0.000 1.000
#> GSM154295 5 0.000 1.0000 0.000 0.000 0.000 0.000 1.000
#> GSM154296 5 0.000 1.0000 0.000 0.000 0.000 0.000 1.000
#> GSM154297 5 0.000 1.0000 0.000 0.000 0.000 0.000 1.000
#> GSM154310 5 0.000 1.0000 0.000 0.000 0.000 0.000 1.000
#> GSM154311 5 0.000 1.0000 0.000 0.000 0.000 0.000 1.000
#> GSM154312 5 0.000 1.0000 0.000 0.000 0.000 0.000 1.000
#> GSM154268 1 0.112 0.9422 0.956 0.000 0.044 0.000 0.000
#> GSM154269 1 0.242 0.9264 0.868 0.000 0.132 0.000 0.000
#> GSM154270 1 0.000 0.9452 1.000 0.000 0.000 0.000 0.000
#> GSM154283 2 0.000 0.8393 0.000 1.000 0.000 0.000 0.000
#> GSM154284 2 0.000 0.8393 0.000 1.000 0.000 0.000 0.000
#> GSM154285 2 0.000 0.8393 0.000 1.000 0.000 0.000 0.000
#> GSM154298 2 0.000 0.8393 0.000 1.000 0.000 0.000 0.000
#> GSM154299 2 0.000 0.8393 0.000 1.000 0.000 0.000 0.000
#> GSM154300 2 0.000 0.8393 0.000 1.000 0.000 0.000 0.000
#> GSM154313 2 0.000 0.8393 0.000 1.000 0.000 0.000 0.000
#> GSM154314 2 0.000 0.8393 0.000 1.000 0.000 0.000 0.000
#> GSM154315 4 0.411 0.5491 0.000 0.376 0.000 0.624 0.000
#> GSM154271 1 0.242 0.9264 0.868 0.000 0.132 0.000 0.000
#> GSM154272 1 0.242 0.9264 0.868 0.000 0.132 0.000 0.000
#> GSM154273 1 0.000 0.9452 1.000 0.000 0.000 0.000 0.000
#> GSM154286 3 0.242 0.9049 0.000 0.000 0.868 0.000 0.132
#> GSM154287 3 0.000 0.7565 0.000 0.000 1.000 0.000 0.000
#> GSM154288 4 0.414 0.0738 0.000 0.000 0.384 0.616 0.000
#> GSM154301 3 0.242 0.9049 0.000 0.000 0.868 0.000 0.132
#> GSM154302 3 0.242 0.9049 0.000 0.000 0.868 0.000 0.132
#> GSM154303 3 0.418 0.2840 0.000 0.000 0.600 0.400 0.000
#> GSM154316 3 0.242 0.9049 0.000 0.000 0.868 0.000 0.132
#> GSM154317 3 0.242 0.9049 0.000 0.000 0.868 0.000 0.132
#> GSM154318 3 0.242 0.9049 0.000 0.000 0.868 0.000 0.132
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> GSM154259 6 0.3659 1.000 0.364 0.000 0.00 0.000 0.000 0.636
#> GSM154260 1 0.0000 0.982 1.000 0.000 0.00 0.000 0.000 0.000
#> GSM154261 1 0.0000 0.982 1.000 0.000 0.00 0.000 0.000 0.000
#> GSM154274 2 0.4047 0.667 0.000 0.604 0.00 0.384 0.000 0.012
#> GSM154275 2 0.4047 0.667 0.000 0.604 0.00 0.384 0.000 0.012
#> GSM154276 2 0.4047 0.667 0.000 0.604 0.00 0.384 0.000 0.012
#> GSM154289 2 0.4047 0.667 0.000 0.604 0.00 0.384 0.000 0.012
#> GSM154290 2 0.4047 0.667 0.000 0.604 0.00 0.384 0.000 0.012
#> GSM154291 4 0.0632 0.632 0.000 0.000 0.00 0.976 0.000 0.024
#> GSM154304 2 0.4047 0.667 0.000 0.604 0.00 0.384 0.000 0.012
#> GSM154305 2 0.4047 0.667 0.000 0.604 0.00 0.384 0.000 0.012
#> GSM154306 4 0.0632 0.632 0.000 0.000 0.00 0.976 0.000 0.024
#> GSM154262 6 0.3659 1.000 0.364 0.000 0.00 0.000 0.000 0.636
#> GSM154263 1 0.0000 0.982 1.000 0.000 0.00 0.000 0.000 0.000
#> GSM154264 1 0.0000 0.982 1.000 0.000 0.00 0.000 0.000 0.000
#> GSM154277 2 0.3659 0.701 0.000 0.636 0.00 0.000 0.000 0.364
#> GSM154278 2 0.4153 0.701 0.000 0.636 0.00 0.000 0.024 0.340
#> GSM154279 2 0.3620 0.706 0.000 0.648 0.00 0.000 0.000 0.352
#> GSM154292 2 0.3634 0.705 0.000 0.644 0.00 0.000 0.000 0.356
#> GSM154293 2 0.3659 0.701 0.000 0.636 0.00 0.000 0.000 0.364
#> GSM154294 4 0.4332 0.625 0.000 0.032 0.00 0.616 0.000 0.352
#> GSM154307 2 0.3578 0.709 0.000 0.660 0.00 0.000 0.000 0.340
#> GSM154308 2 0.3659 0.701 0.000 0.636 0.00 0.000 0.000 0.364
#> GSM154309 2 0.3647 0.703 0.000 0.640 0.00 0.000 0.000 0.360
#> GSM154265 6 0.3659 1.000 0.364 0.000 0.00 0.000 0.000 0.636
#> GSM154266 1 0.1714 0.831 0.908 0.000 0.00 0.000 0.000 0.092
#> GSM154267 1 0.0000 0.982 1.000 0.000 0.00 0.000 0.000 0.000
#> GSM154280 5 0.0000 1.000 0.000 0.000 0.00 0.000 1.000 0.000
#> GSM154281 5 0.0000 1.000 0.000 0.000 0.00 0.000 1.000 0.000
#> GSM154282 5 0.0000 1.000 0.000 0.000 0.00 0.000 1.000 0.000
#> GSM154295 5 0.0000 1.000 0.000 0.000 0.00 0.000 1.000 0.000
#> GSM154296 5 0.0000 1.000 0.000 0.000 0.00 0.000 1.000 0.000
#> GSM154297 5 0.0000 1.000 0.000 0.000 0.00 0.000 1.000 0.000
#> GSM154310 5 0.0000 1.000 0.000 0.000 0.00 0.000 1.000 0.000
#> GSM154311 5 0.0000 1.000 0.000 0.000 0.00 0.000 1.000 0.000
#> GSM154312 5 0.0000 1.000 0.000 0.000 0.00 0.000 1.000 0.000
#> GSM154268 1 0.0000 0.982 1.000 0.000 0.00 0.000 0.000 0.000
#> GSM154269 6 0.3659 1.000 0.364 0.000 0.00 0.000 0.000 0.636
#> GSM154270 1 0.0000 0.982 1.000 0.000 0.00 0.000 0.000 0.000
#> GSM154283 2 0.0000 0.727 0.000 1.000 0.00 0.000 0.000 0.000
#> GSM154284 2 0.0000 0.727 0.000 1.000 0.00 0.000 0.000 0.000
#> GSM154285 2 0.0000 0.727 0.000 1.000 0.00 0.000 0.000 0.000
#> GSM154298 2 0.0000 0.727 0.000 1.000 0.00 0.000 0.000 0.000
#> GSM154299 2 0.0000 0.727 0.000 1.000 0.00 0.000 0.000 0.000
#> GSM154300 2 0.0000 0.727 0.000 1.000 0.00 0.000 0.000 0.000
#> GSM154313 2 0.0000 0.727 0.000 1.000 0.00 0.000 0.000 0.000
#> GSM154314 2 0.0000 0.727 0.000 1.000 0.00 0.000 0.000 0.000
#> GSM154315 4 0.4524 0.630 0.000 0.048 0.00 0.616 0.000 0.336
#> GSM154271 6 0.3659 1.000 0.364 0.000 0.00 0.000 0.000 0.636
#> GSM154272 6 0.3659 1.000 0.364 0.000 0.00 0.000 0.000 0.636
#> GSM154273 1 0.0000 0.982 1.000 0.000 0.00 0.000 0.000 0.000
#> GSM154286 3 0.0000 0.933 0.000 0.000 1.00 0.000 0.000 0.000
#> GSM154287 3 0.0000 0.933 0.000 0.000 1.00 0.000 0.000 0.000
#> GSM154288 4 0.4218 0.249 0.000 0.000 0.36 0.616 0.000 0.024
#> GSM154301 3 0.0000 0.933 0.000 0.000 1.00 0.000 0.000 0.000
#> GSM154302 3 0.0000 0.933 0.000 0.000 1.00 0.000 0.000 0.000
#> GSM154303 3 0.3756 0.246 0.000 0.000 0.60 0.400 0.000 0.000
#> GSM154316 3 0.0000 0.933 0.000 0.000 1.00 0.000 0.000 0.000
#> GSM154317 3 0.0000 0.933 0.000 0.000 1.00 0.000 0.000 0.000
#> GSM154318 3 0.0000 0.933 0.000 0.000 1.00 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 agent(p) time(p) k
#> MAD:pam 58 2.57e-02 2.14e-08 2
#> MAD:pam 60 3.68e-07 4.50e-11 3
#> MAD:pam 60 4.94e-14 1.34e-09 4
#> MAD:pam 58 1.59e-11 1.19e-08 5
#> MAD:pam 58 2.60e-10 1.38e-07 6
If matrix rows can be associated to genes, consider to use functional_enrichment(res,
...)
to perform function enrichment for the signature genes. See this vignette for more detailed explanations.
The object with results only for a single top-value method and a single partition method can be extracted as:
res = res_list["MAD", "mclust"]
# you can also extract it by
# res = res_list["MAD:mclust"]
A summary of res
and all the functions that can be applied to it:
res
#> A 'ConsensusPartition' object with k = 2, 3, 4, 5, 6.
#> On a matrix with 38950 rows and 60 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 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.977 0.990 0.3686 0.636 0.636
#> 3 3 0.579 0.821 0.880 0.7120 0.684 0.510
#> 4 4 0.665 0.842 0.891 0.1226 0.762 0.457
#> 5 5 0.604 0.722 0.748 0.0861 0.870 0.590
#> 6 6 0.776 0.686 0.807 0.0632 0.920 0.650
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
#> GSM154259 1 0.4298 0.911 0.912 0.088
#> GSM154260 2 0.9754 0.292 0.408 0.592
#> GSM154261 1 0.0672 0.989 0.992 0.008
#> GSM154274 2 0.0000 0.990 0.000 1.000
#> GSM154275 2 0.0000 0.990 0.000 1.000
#> GSM154276 2 0.0000 0.990 0.000 1.000
#> GSM154289 2 0.0000 0.990 0.000 1.000
#> GSM154290 2 0.0000 0.990 0.000 1.000
#> GSM154291 2 0.0376 0.987 0.004 0.996
#> GSM154304 2 0.0000 0.990 0.000 1.000
#> GSM154305 2 0.0000 0.990 0.000 1.000
#> GSM154306 2 0.0376 0.987 0.004 0.996
#> GSM154262 1 0.0938 0.989 0.988 0.012
#> GSM154263 1 0.0376 0.990 0.996 0.004
#> GSM154264 1 0.0376 0.990 0.996 0.004
#> GSM154277 2 0.0376 0.987 0.004 0.996
#> GSM154278 2 0.0000 0.990 0.000 1.000
#> GSM154279 2 0.0000 0.990 0.000 1.000
#> GSM154292 2 0.0000 0.990 0.000 1.000
#> GSM154293 2 0.0000 0.990 0.000 1.000
#> GSM154294 2 0.0376 0.987 0.004 0.996
#> GSM154307 2 0.0000 0.990 0.000 1.000
#> GSM154308 2 0.0000 0.990 0.000 1.000
#> GSM154309 2 0.0000 0.990 0.000 1.000
#> GSM154265 1 0.0938 0.989 0.988 0.012
#> GSM154266 1 0.0376 0.990 0.996 0.004
#> GSM154267 1 0.0376 0.990 0.996 0.004
#> GSM154280 2 0.0000 0.990 0.000 1.000
#> GSM154281 2 0.0000 0.990 0.000 1.000
#> GSM154282 2 0.0000 0.990 0.000 1.000
#> GSM154295 2 0.0000 0.990 0.000 1.000
#> GSM154296 2 0.0000 0.990 0.000 1.000
#> GSM154297 2 0.0000 0.990 0.000 1.000
#> GSM154310 2 0.0000 0.990 0.000 1.000
#> GSM154311 2 0.0000 0.990 0.000 1.000
#> GSM154312 2 0.0000 0.990 0.000 1.000
#> GSM154268 1 0.0376 0.990 0.996 0.004
#> GSM154269 1 0.0938 0.989 0.988 0.012
#> GSM154270 1 0.0376 0.990 0.996 0.004
#> GSM154283 2 0.0000 0.990 0.000 1.000
#> GSM154284 2 0.0000 0.990 0.000 1.000
#> GSM154285 2 0.0000 0.990 0.000 1.000
#> GSM154298 2 0.0000 0.990 0.000 1.000
#> GSM154299 2 0.0000 0.990 0.000 1.000
#> GSM154300 2 0.0000 0.990 0.000 1.000
#> GSM154313 2 0.0000 0.990 0.000 1.000
#> GSM154314 2 0.0000 0.990 0.000 1.000
#> GSM154315 2 0.0376 0.987 0.004 0.996
#> GSM154271 1 0.0938 0.989 0.988 0.012
#> GSM154272 1 0.0938 0.989 0.988 0.012
#> GSM154273 1 0.0376 0.990 0.996 0.004
#> GSM154286 2 0.0000 0.990 0.000 1.000
#> GSM154287 2 0.0000 0.990 0.000 1.000
#> GSM154288 2 0.0376 0.987 0.004 0.996
#> GSM154301 2 0.0000 0.990 0.000 1.000
#> GSM154302 2 0.0000 0.990 0.000 1.000
#> GSM154303 2 0.0376 0.987 0.004 0.996
#> GSM154316 2 0.0000 0.990 0.000 1.000
#> GSM154317 2 0.0000 0.990 0.000 1.000
#> GSM154318 2 0.0000 0.990 0.000 1.000
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> GSM154259 1 0.3295 0.872 0.896 0.008 0.096
#> GSM154260 1 0.4465 0.747 0.820 0.004 0.176
#> GSM154261 1 0.0000 0.973 1.000 0.000 0.000
#> GSM154274 2 0.2537 0.780 0.000 0.920 0.080
#> GSM154275 2 0.3551 0.767 0.000 0.868 0.132
#> GSM154276 2 0.3267 0.766 0.000 0.884 0.116
#> GSM154289 2 0.5948 0.664 0.000 0.640 0.360
#> GSM154290 2 0.5733 0.698 0.000 0.676 0.324
#> GSM154291 3 0.3816 0.841 0.000 0.148 0.852
#> GSM154304 2 0.6095 0.626 0.000 0.608 0.392
#> GSM154305 2 0.6140 0.596 0.000 0.596 0.404
#> GSM154306 3 0.3816 0.841 0.000 0.148 0.852
#> GSM154262 1 0.0424 0.972 0.992 0.008 0.000
#> GSM154263 1 0.0237 0.973 0.996 0.004 0.000
#> GSM154264 1 0.0237 0.973 0.996 0.004 0.000
#> GSM154277 3 0.5733 0.664 0.000 0.324 0.676
#> GSM154278 2 0.1529 0.784 0.000 0.960 0.040
#> GSM154279 2 0.0592 0.771 0.000 0.988 0.012
#> GSM154292 2 0.5363 0.716 0.000 0.724 0.276
#> GSM154293 2 0.5397 0.713 0.000 0.720 0.280
#> GSM154294 3 0.4842 0.793 0.000 0.224 0.776
#> GSM154307 2 0.6111 0.622 0.000 0.604 0.396
#> GSM154308 2 0.6111 0.620 0.000 0.604 0.396
#> GSM154309 2 0.6111 0.622 0.000 0.604 0.396
#> GSM154265 1 0.0424 0.972 0.992 0.008 0.000
#> GSM154266 1 0.0237 0.973 0.996 0.004 0.000
#> GSM154267 1 0.0237 0.973 0.996 0.004 0.000
#> GSM154280 2 0.1753 0.784 0.000 0.952 0.048
#> GSM154281 2 0.1753 0.784 0.000 0.952 0.048
#> GSM154282 2 0.1643 0.783 0.000 0.956 0.044
#> GSM154295 3 0.3879 0.852 0.000 0.152 0.848
#> GSM154296 3 0.4555 0.816 0.000 0.200 0.800
#> GSM154297 3 0.4555 0.816 0.000 0.200 0.800
#> GSM154310 3 0.1964 0.881 0.000 0.056 0.944
#> GSM154311 3 0.2096 0.882 0.004 0.052 0.944
#> GSM154312 3 0.2096 0.882 0.004 0.052 0.944
#> GSM154268 1 0.0237 0.973 0.996 0.004 0.000
#> GSM154269 1 0.0424 0.972 0.992 0.008 0.000
#> GSM154270 1 0.0237 0.973 0.996 0.004 0.000
#> GSM154283 2 0.1031 0.778 0.000 0.976 0.024
#> GSM154284 2 0.0592 0.771 0.000 0.988 0.012
#> GSM154285 2 0.0592 0.771 0.000 0.988 0.012
#> GSM154298 2 0.5431 0.712 0.000 0.716 0.284
#> GSM154299 2 0.1529 0.784 0.000 0.960 0.040
#> GSM154300 2 0.1031 0.778 0.000 0.976 0.024
#> GSM154313 2 0.5529 0.704 0.000 0.704 0.296
#> GSM154314 2 0.5497 0.707 0.000 0.708 0.292
#> GSM154315 3 0.4654 0.810 0.000 0.208 0.792
#> GSM154271 1 0.0424 0.972 0.992 0.008 0.000
#> GSM154272 1 0.0424 0.972 0.992 0.008 0.000
#> GSM154273 1 0.0237 0.973 0.996 0.004 0.000
#> GSM154286 3 0.3742 0.867 0.036 0.072 0.892
#> GSM154287 3 0.1411 0.851 0.036 0.000 0.964
#> GSM154288 3 0.2356 0.877 0.000 0.072 0.928
#> GSM154301 3 0.0237 0.869 0.004 0.000 0.996
#> GSM154302 3 0.0237 0.869 0.004 0.000 0.996
#> GSM154303 3 0.2066 0.880 0.000 0.060 0.940
#> GSM154316 3 0.0237 0.869 0.004 0.000 0.996
#> GSM154317 3 0.0237 0.869 0.004 0.000 0.996
#> GSM154318 3 0.0237 0.869 0.004 0.000 0.996
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> GSM154259 1 0.2921 0.803 0.860 0.000 0.140 0.000
#> GSM154260 1 0.3978 0.790 0.836 0.000 0.108 0.056
#> GSM154261 1 0.0000 0.969 1.000 0.000 0.000 0.000
#> GSM154274 2 0.0000 0.961 0.000 1.000 0.000 0.000
#> GSM154275 2 0.0000 0.961 0.000 1.000 0.000 0.000
#> GSM154276 2 0.0000 0.961 0.000 1.000 0.000 0.000
#> GSM154289 3 0.5990 0.779 0.000 0.144 0.692 0.164
#> GSM154290 3 0.7227 0.637 0.000 0.256 0.544 0.200
#> GSM154291 4 0.1211 0.842 0.000 0.040 0.000 0.960
#> GSM154304 3 0.4920 0.802 0.000 0.068 0.768 0.164
#> GSM154305 3 0.5792 0.786 0.000 0.124 0.708 0.168
#> GSM154306 4 0.1211 0.842 0.000 0.040 0.000 0.960
#> GSM154262 1 0.0336 0.968 0.992 0.000 0.008 0.000
#> GSM154263 1 0.0000 0.969 1.000 0.000 0.000 0.000
#> GSM154264 1 0.0000 0.969 1.000 0.000 0.000 0.000
#> GSM154277 3 0.6005 0.672 0.000 0.324 0.616 0.060
#> GSM154278 2 0.0000 0.961 0.000 1.000 0.000 0.000
#> GSM154279 2 0.0000 0.961 0.000 1.000 0.000 0.000
#> GSM154292 3 0.6119 0.768 0.000 0.152 0.680 0.168
#> GSM154293 3 0.5800 0.785 0.000 0.128 0.708 0.164
#> GSM154294 4 0.4711 0.652 0.000 0.064 0.152 0.784
#> GSM154307 3 0.4920 0.802 0.000 0.068 0.768 0.164
#> GSM154308 3 0.4920 0.802 0.000 0.068 0.768 0.164
#> GSM154309 3 0.4920 0.802 0.000 0.068 0.768 0.164
#> GSM154265 1 0.0336 0.968 0.992 0.000 0.008 0.000
#> GSM154266 1 0.0000 0.969 1.000 0.000 0.000 0.000
#> GSM154267 1 0.0000 0.969 1.000 0.000 0.000 0.000
#> GSM154280 2 0.1022 0.941 0.000 0.968 0.000 0.032
#> GSM154281 2 0.1022 0.941 0.000 0.968 0.000 0.032
#> GSM154282 2 0.1022 0.941 0.000 0.968 0.000 0.032
#> GSM154295 3 0.3024 0.794 0.000 0.148 0.852 0.000
#> GSM154296 3 0.3583 0.791 0.000 0.180 0.816 0.004
#> GSM154297 3 0.3583 0.791 0.000 0.180 0.816 0.004
#> GSM154310 3 0.2704 0.790 0.000 0.124 0.876 0.000
#> GSM154311 3 0.2704 0.790 0.000 0.124 0.876 0.000
#> GSM154312 3 0.2704 0.790 0.000 0.124 0.876 0.000
#> GSM154268 1 0.0000 0.969 1.000 0.000 0.000 0.000
#> GSM154269 1 0.0336 0.968 0.992 0.000 0.008 0.000
#> GSM154270 1 0.0000 0.969 1.000 0.000 0.000 0.000
#> GSM154283 2 0.0469 0.953 0.000 0.988 0.000 0.012
#> GSM154284 2 0.0336 0.956 0.000 0.992 0.000 0.008
#> GSM154285 2 0.0000 0.961 0.000 1.000 0.000 0.000
#> GSM154298 3 0.5763 0.787 0.000 0.132 0.712 0.156
#> GSM154299 3 0.7242 0.469 0.000 0.376 0.476 0.148
#> GSM154300 2 0.4514 0.682 0.000 0.796 0.056 0.148
#> GSM154313 3 0.4920 0.802 0.000 0.068 0.768 0.164
#> GSM154314 3 0.4920 0.802 0.000 0.068 0.768 0.164
#> GSM154315 4 0.1211 0.838 0.000 0.040 0.000 0.960
#> GSM154271 1 0.0336 0.968 0.992 0.000 0.008 0.000
#> GSM154272 1 0.0336 0.968 0.992 0.000 0.008 0.000
#> GSM154273 1 0.0000 0.969 1.000 0.000 0.000 0.000
#> GSM154286 3 0.3768 0.684 0.008 0.184 0.808 0.000
#> GSM154287 3 0.2737 0.705 0.008 0.104 0.888 0.000
#> GSM154288 4 0.4054 0.765 0.000 0.016 0.188 0.796
#> GSM154301 3 0.0000 0.766 0.000 0.000 1.000 0.000
#> GSM154302 3 0.0000 0.766 0.000 0.000 1.000 0.000
#> GSM154303 4 0.3791 0.764 0.000 0.004 0.200 0.796
#> GSM154316 3 0.0000 0.766 0.000 0.000 1.000 0.000
#> GSM154317 3 0.0000 0.766 0.000 0.000 1.000 0.000
#> GSM154318 3 0.0000 0.766 0.000 0.000 1.000 0.000
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> GSM154259 1 0.0000 0.753 1.000 0.000 0.000 0.000 0.000
#> GSM154260 1 0.7108 0.659 0.624 0.124 0.076 0.140 0.036
#> GSM154261 1 0.4101 0.816 0.628 0.372 0.000 0.000 0.000
#> GSM154274 5 0.2927 0.780 0.000 0.000 0.040 0.092 0.868
#> GSM154275 5 0.1851 0.781 0.000 0.000 0.000 0.088 0.912
#> GSM154276 5 0.1851 0.781 0.000 0.000 0.000 0.088 0.912
#> GSM154289 2 0.7937 0.813 0.000 0.440 0.260 0.128 0.172
#> GSM154290 5 0.7840 -0.416 0.000 0.364 0.128 0.128 0.380
#> GSM154291 4 0.2054 0.795 0.000 0.072 0.004 0.916 0.008
#> GSM154304 2 0.7473 0.853 0.000 0.492 0.276 0.128 0.104
#> GSM154305 2 0.7473 0.853 0.000 0.492 0.276 0.128 0.104
#> GSM154306 4 0.1924 0.798 0.000 0.064 0.004 0.924 0.008
#> GSM154262 1 0.0000 0.753 1.000 0.000 0.000 0.000 0.000
#> GSM154263 1 0.4663 0.817 0.604 0.376 0.000 0.020 0.000
#> GSM154264 1 0.4663 0.817 0.604 0.376 0.000 0.020 0.000
#> GSM154277 5 0.7763 0.180 0.000 0.304 0.132 0.124 0.440
#> GSM154278 5 0.2929 0.792 0.000 0.076 0.044 0.004 0.876
#> GSM154279 5 0.1831 0.797 0.000 0.076 0.004 0.000 0.920
#> GSM154292 2 0.5695 0.836 0.000 0.612 0.256 0.000 0.132
#> GSM154293 2 0.5728 0.847 0.000 0.612 0.272 0.004 0.112
#> GSM154294 4 0.5721 0.492 0.000 0.344 0.068 0.576 0.012
#> GSM154307 2 0.7473 0.853 0.000 0.492 0.276 0.128 0.104
#> GSM154308 2 0.7473 0.853 0.000 0.492 0.276 0.128 0.104
#> GSM154309 2 0.7473 0.853 0.000 0.492 0.276 0.128 0.104
#> GSM154265 1 0.0000 0.753 1.000 0.000 0.000 0.000 0.000
#> GSM154266 1 0.4663 0.817 0.604 0.376 0.000 0.020 0.000
#> GSM154267 1 0.4651 0.818 0.608 0.372 0.000 0.020 0.000
#> GSM154280 5 0.1549 0.784 0.000 0.000 0.040 0.016 0.944
#> GSM154281 5 0.1549 0.784 0.000 0.000 0.040 0.016 0.944
#> GSM154282 5 0.1549 0.784 0.000 0.000 0.040 0.016 0.944
#> GSM154295 3 0.3327 0.769 0.000 0.000 0.828 0.028 0.144
#> GSM154296 3 0.4479 0.621 0.000 0.004 0.704 0.028 0.264
#> GSM154297 3 0.4503 0.617 0.000 0.004 0.700 0.028 0.268
#> GSM154310 3 0.3238 0.774 0.000 0.000 0.836 0.028 0.136
#> GSM154311 3 0.3238 0.774 0.000 0.000 0.836 0.028 0.136
#> GSM154312 3 0.3238 0.774 0.000 0.000 0.836 0.028 0.136
#> GSM154268 1 0.4663 0.817 0.604 0.376 0.000 0.020 0.000
#> GSM154269 1 0.0000 0.753 1.000 0.000 0.000 0.000 0.000
#> GSM154270 1 0.4663 0.817 0.604 0.376 0.000 0.020 0.000
#> GSM154283 5 0.3291 0.769 0.000 0.120 0.040 0.000 0.840
#> GSM154284 5 0.1831 0.796 0.000 0.076 0.000 0.004 0.920
#> GSM154285 5 0.1831 0.796 0.000 0.076 0.000 0.004 0.920
#> GSM154298 2 0.5598 0.845 0.000 0.612 0.276 0.000 0.112
#> GSM154299 2 0.5559 0.284 0.000 0.544 0.076 0.000 0.380
#> GSM154300 5 0.5151 0.271 0.000 0.396 0.044 0.000 0.560
#> GSM154313 2 0.5706 0.847 0.000 0.612 0.276 0.004 0.108
#> GSM154314 2 0.5706 0.847 0.000 0.612 0.276 0.004 0.108
#> GSM154315 4 0.3399 0.778 0.000 0.172 0.004 0.812 0.012
#> GSM154271 1 0.0000 0.753 1.000 0.000 0.000 0.000 0.000
#> GSM154272 1 0.0000 0.753 1.000 0.000 0.000 0.000 0.000
#> GSM154273 1 0.4663 0.817 0.604 0.376 0.000 0.020 0.000
#> GSM154286 3 0.7348 0.273 0.180 0.000 0.504 0.068 0.248
#> GSM154287 3 0.5258 0.507 0.140 0.000 0.680 0.000 0.180
#> GSM154288 4 0.3280 0.750 0.004 0.000 0.184 0.808 0.004
#> GSM154301 3 0.0000 0.773 0.000 0.000 1.000 0.000 0.000
#> GSM154302 3 0.0162 0.773 0.004 0.000 0.996 0.000 0.000
#> GSM154303 4 0.3160 0.748 0.004 0.000 0.188 0.808 0.000
#> GSM154316 3 0.0451 0.775 0.000 0.008 0.988 0.004 0.000
#> GSM154317 3 0.0451 0.775 0.000 0.008 0.988 0.004 0.000
#> GSM154318 3 0.0451 0.775 0.000 0.008 0.988 0.004 0.000
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> GSM154259 6 0.3770 0.7964 0.244 0.000 0.000 0.028 0.000 0.728
#> GSM154260 1 0.5367 0.1861 0.524 0.016 0.000 0.388 0.000 0.072
#> GSM154261 1 0.2164 0.7920 0.900 0.000 0.000 0.032 0.000 0.068
#> GSM154274 5 0.1401 0.7803 0.000 0.028 0.000 0.020 0.948 0.004
#> GSM154275 5 0.1485 0.7792 0.000 0.024 0.000 0.028 0.944 0.004
#> GSM154276 5 0.1485 0.7792 0.000 0.024 0.000 0.028 0.944 0.004
#> GSM154289 2 0.3833 -0.0157 0.000 0.556 0.000 0.000 0.444 0.000
#> GSM154290 5 0.5268 0.3709 0.000 0.344 0.000 0.016 0.568 0.072
#> GSM154291 4 0.2697 0.7047 0.000 0.188 0.000 0.812 0.000 0.000
#> GSM154304 2 0.0000 0.7358 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM154305 2 0.4847 -0.0759 0.000 0.500 0.000 0.056 0.444 0.000
#> GSM154306 4 0.2762 0.7036 0.000 0.196 0.000 0.804 0.000 0.000
#> GSM154262 6 0.3634 0.9556 0.356 0.000 0.000 0.000 0.000 0.644
#> GSM154263 1 0.0000 0.8933 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM154264 1 0.0000 0.8933 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM154277 5 0.6103 -0.1710 0.000 0.024 0.000 0.404 0.432 0.140
#> GSM154278 5 0.0870 0.7839 0.000 0.004 0.000 0.012 0.972 0.012
#> GSM154279 5 0.0767 0.7834 0.000 0.008 0.000 0.012 0.976 0.004
#> GSM154292 5 0.5380 0.0265 0.000 0.412 0.000 0.112 0.476 0.000
#> GSM154293 5 0.5380 0.0265 0.000 0.412 0.000 0.112 0.476 0.000
#> GSM154294 4 0.3898 0.3762 0.000 0.296 0.000 0.684 0.020 0.000
#> GSM154307 2 0.0260 0.7320 0.000 0.992 0.008 0.000 0.000 0.000
#> GSM154308 2 0.0000 0.7358 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM154309 2 0.0146 0.7346 0.000 0.996 0.004 0.000 0.000 0.000
#> GSM154265 6 0.3634 0.9556 0.356 0.000 0.000 0.000 0.000 0.644
#> GSM154266 1 0.0000 0.8933 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM154267 1 0.0000 0.8933 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM154280 5 0.0837 0.7768 0.000 0.000 0.004 0.004 0.972 0.020
#> GSM154281 5 0.0837 0.7768 0.000 0.000 0.004 0.004 0.972 0.020
#> GSM154282 5 0.0837 0.7768 0.000 0.000 0.004 0.004 0.972 0.020
#> GSM154295 3 0.5190 0.7529 0.000 0.016 0.660 0.008 0.088 0.228
#> GSM154296 3 0.5435 0.7284 0.000 0.016 0.628 0.004 0.120 0.232
#> GSM154297 3 0.5514 0.7258 0.000 0.020 0.624 0.004 0.120 0.232
#> GSM154310 3 0.3490 0.8123 0.000 0.016 0.836 0.008 0.080 0.060
#> GSM154311 3 0.3490 0.8123 0.000 0.016 0.836 0.008 0.080 0.060
#> GSM154312 3 0.3490 0.8123 0.000 0.016 0.836 0.008 0.080 0.060
#> GSM154268 1 0.0000 0.8933 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM154269 6 0.3634 0.9556 0.356 0.000 0.000 0.000 0.000 0.644
#> GSM154270 1 0.0000 0.8933 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM154283 5 0.1370 0.7760 0.000 0.012 0.000 0.036 0.948 0.004
#> GSM154284 5 0.0665 0.7839 0.000 0.008 0.000 0.004 0.980 0.008
#> GSM154285 5 0.0665 0.7839 0.000 0.008 0.000 0.004 0.980 0.008
#> GSM154298 2 0.2934 0.7031 0.000 0.844 0.000 0.112 0.044 0.000
#> GSM154299 5 0.4764 0.4843 0.000 0.232 0.000 0.108 0.660 0.000
#> GSM154300 5 0.4530 0.5227 0.000 0.208 0.000 0.100 0.692 0.000
#> GSM154313 2 0.2573 0.7109 0.000 0.864 0.000 0.112 0.024 0.000
#> GSM154314 2 0.2826 0.7086 0.000 0.856 0.000 0.112 0.024 0.008
#> GSM154315 4 0.2350 0.6980 0.000 0.100 0.000 0.880 0.020 0.000
#> GSM154271 6 0.3647 0.9538 0.360 0.000 0.000 0.000 0.000 0.640
#> GSM154272 6 0.3647 0.9538 0.360 0.000 0.000 0.000 0.000 0.640
#> GSM154273 1 0.0000 0.8933 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM154286 4 0.7595 0.2976 0.000 0.016 0.280 0.376 0.104 0.224
#> GSM154287 3 0.3837 0.7318 0.000 0.016 0.744 0.016 0.000 0.224
#> GSM154288 4 0.3943 0.7007 0.000 0.000 0.156 0.776 0.016 0.052
#> GSM154301 3 0.1605 0.8064 0.000 0.016 0.936 0.004 0.000 0.044
#> GSM154302 3 0.1718 0.8059 0.000 0.016 0.932 0.008 0.000 0.044
#> GSM154303 4 0.3715 0.6864 0.000 0.000 0.188 0.764 0.000 0.048
#> GSM154316 3 0.0291 0.8118 0.000 0.000 0.992 0.004 0.000 0.004
#> GSM154317 3 0.1152 0.8016 0.000 0.000 0.952 0.004 0.000 0.044
#> GSM154318 3 0.1152 0.8016 0.000 0.000 0.952 0.004 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 agent(p) time(p) k
#> MAD:mclust 59 0.99388 9.61e-13 2
#> MAD:mclust 60 0.00799 7.44e-12 3
#> MAD:mclust 59 0.76801 4.57e-16 4
#> MAD:mclust 54 0.00734 1.45e-15 5
#> MAD:mclust 50 0.04540 1.47e-12 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 38950 rows and 60 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.897 0.927 0.971 0.4716 0.528 0.528
#> 3 3 0.621 0.694 0.867 0.3664 0.729 0.523
#> 4 4 0.835 0.888 0.937 0.1213 0.820 0.552
#> 5 5 0.852 0.806 0.899 0.0928 0.874 0.593
#> 6 6 0.818 0.811 0.863 0.0359 0.958 0.812
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
#> GSM154259 1 0.0000 0.9595 1.000 0.000
#> GSM154260 1 0.0000 0.9595 1.000 0.000
#> GSM154261 1 0.0000 0.9595 1.000 0.000
#> GSM154274 2 0.0000 0.9726 0.000 1.000
#> GSM154275 2 0.0000 0.9726 0.000 1.000
#> GSM154276 2 0.0000 0.9726 0.000 1.000
#> GSM154289 2 0.0000 0.9726 0.000 1.000
#> GSM154290 2 0.0000 0.9726 0.000 1.000
#> GSM154291 2 0.0000 0.9726 0.000 1.000
#> GSM154304 2 0.0000 0.9726 0.000 1.000
#> GSM154305 2 0.0000 0.9726 0.000 1.000
#> GSM154306 2 0.0000 0.9726 0.000 1.000
#> GSM154262 1 0.0000 0.9595 1.000 0.000
#> GSM154263 1 0.0000 0.9595 1.000 0.000
#> GSM154264 1 0.0000 0.9595 1.000 0.000
#> GSM154277 2 0.0000 0.9726 0.000 1.000
#> GSM154278 2 0.0000 0.9726 0.000 1.000
#> GSM154279 2 0.0000 0.9726 0.000 1.000
#> GSM154292 2 0.0000 0.9726 0.000 1.000
#> GSM154293 2 0.0000 0.9726 0.000 1.000
#> GSM154294 2 0.0000 0.9726 0.000 1.000
#> GSM154307 2 0.0000 0.9726 0.000 1.000
#> GSM154308 2 0.0000 0.9726 0.000 1.000
#> GSM154309 2 0.0000 0.9726 0.000 1.000
#> GSM154265 1 0.0000 0.9595 1.000 0.000
#> GSM154266 1 0.0000 0.9595 1.000 0.000
#> GSM154267 1 0.0000 0.9595 1.000 0.000
#> GSM154280 2 0.8016 0.6615 0.244 0.756
#> GSM154281 2 0.9963 0.0913 0.464 0.536
#> GSM154282 2 0.7950 0.6685 0.240 0.760
#> GSM154295 2 0.0000 0.9726 0.000 1.000
#> GSM154296 2 0.0000 0.9726 0.000 1.000
#> GSM154297 2 0.0000 0.9726 0.000 1.000
#> GSM154310 2 0.0000 0.9726 0.000 1.000
#> GSM154311 2 0.0000 0.9726 0.000 1.000
#> GSM154312 2 0.0000 0.9726 0.000 1.000
#> GSM154268 1 0.0000 0.9595 1.000 0.000
#> GSM154269 1 0.0000 0.9595 1.000 0.000
#> GSM154270 1 0.0000 0.9595 1.000 0.000
#> GSM154283 2 0.0000 0.9726 0.000 1.000
#> GSM154284 2 0.0000 0.9726 0.000 1.000
#> GSM154285 2 0.0000 0.9726 0.000 1.000
#> GSM154298 2 0.0000 0.9726 0.000 1.000
#> GSM154299 2 0.0000 0.9726 0.000 1.000
#> GSM154300 2 0.0000 0.9726 0.000 1.000
#> GSM154313 2 0.0000 0.9726 0.000 1.000
#> GSM154314 2 0.0000 0.9726 0.000 1.000
#> GSM154315 2 0.0000 0.9726 0.000 1.000
#> GSM154271 1 0.0000 0.9595 1.000 0.000
#> GSM154272 1 0.0000 0.9595 1.000 0.000
#> GSM154273 1 0.0000 0.9595 1.000 0.000
#> GSM154286 1 0.0000 0.9595 1.000 0.000
#> GSM154287 1 0.0000 0.9595 1.000 0.000
#> GSM154288 2 0.0000 0.9726 0.000 1.000
#> GSM154301 1 0.0376 0.9568 0.996 0.004
#> GSM154302 1 0.0672 0.9538 0.992 0.008
#> GSM154303 2 0.0000 0.9726 0.000 1.000
#> GSM154316 1 0.9044 0.5435 0.680 0.320
#> GSM154317 1 0.8443 0.6368 0.728 0.272
#> GSM154318 1 0.7219 0.7487 0.800 0.200
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> GSM154259 1 0.0000 0.9970 1.000 0.000 0.000
#> GSM154260 1 0.0000 0.9970 1.000 0.000 0.000
#> GSM154261 1 0.0000 0.9970 1.000 0.000 0.000
#> GSM154274 2 0.6215 0.4205 0.000 0.572 0.428
#> GSM154275 2 0.0000 0.7463 0.000 1.000 0.000
#> GSM154276 2 0.0892 0.7512 0.000 0.980 0.020
#> GSM154289 2 0.6140 0.4722 0.000 0.596 0.404
#> GSM154290 2 0.3412 0.7410 0.000 0.876 0.124
#> GSM154291 2 0.0000 0.7463 0.000 1.000 0.000
#> GSM154304 2 0.6168 0.4567 0.000 0.588 0.412
#> GSM154305 2 0.3752 0.7356 0.000 0.856 0.144
#> GSM154306 2 0.0000 0.7463 0.000 1.000 0.000
#> GSM154262 1 0.0000 0.9970 1.000 0.000 0.000
#> GSM154263 1 0.0000 0.9970 1.000 0.000 0.000
#> GSM154264 1 0.0000 0.9970 1.000 0.000 0.000
#> GSM154277 2 0.0000 0.7463 0.000 1.000 0.000
#> GSM154278 3 0.6008 0.2387 0.000 0.372 0.628
#> GSM154279 2 0.2066 0.7508 0.000 0.940 0.060
#> GSM154292 2 0.4887 0.6889 0.000 0.772 0.228
#> GSM154293 2 0.4235 0.7223 0.000 0.824 0.176
#> GSM154294 2 0.0000 0.7463 0.000 1.000 0.000
#> GSM154307 3 0.5650 0.3820 0.000 0.312 0.688
#> GSM154308 2 0.6204 0.4300 0.000 0.576 0.424
#> GSM154309 3 0.6079 0.1893 0.000 0.388 0.612
#> GSM154265 1 0.0000 0.9970 1.000 0.000 0.000
#> GSM154266 1 0.0000 0.9970 1.000 0.000 0.000
#> GSM154267 1 0.0000 0.9970 1.000 0.000 0.000
#> GSM154280 2 0.9315 0.4136 0.220 0.520 0.260
#> GSM154281 3 0.6129 0.3523 0.008 0.324 0.668
#> GSM154282 2 0.9325 0.3977 0.252 0.520 0.228
#> GSM154295 3 0.0000 0.7417 0.000 0.000 1.000
#> GSM154296 3 0.0000 0.7417 0.000 0.000 1.000
#> GSM154297 3 0.0000 0.7417 0.000 0.000 1.000
#> GSM154310 3 0.0000 0.7417 0.000 0.000 1.000
#> GSM154311 3 0.0000 0.7417 0.000 0.000 1.000
#> GSM154312 3 0.0000 0.7417 0.000 0.000 1.000
#> GSM154268 1 0.0000 0.9970 1.000 0.000 0.000
#> GSM154269 1 0.0000 0.9970 1.000 0.000 0.000
#> GSM154270 1 0.0000 0.9970 1.000 0.000 0.000
#> GSM154283 2 0.6126 0.4795 0.000 0.600 0.400
#> GSM154284 2 0.0892 0.7512 0.000 0.980 0.020
#> GSM154285 2 0.0747 0.7505 0.000 0.984 0.016
#> GSM154298 3 0.6260 -0.0453 0.000 0.448 0.552
#> GSM154299 2 0.5560 0.6200 0.000 0.700 0.300
#> GSM154300 2 0.4504 0.7115 0.000 0.804 0.196
#> GSM154313 3 0.6215 0.0405 0.000 0.428 0.572
#> GSM154314 2 0.6225 0.4100 0.000 0.568 0.432
#> GSM154315 2 0.0000 0.7463 0.000 1.000 0.000
#> GSM154271 1 0.0000 0.9970 1.000 0.000 0.000
#> GSM154272 1 0.0000 0.9970 1.000 0.000 0.000
#> GSM154273 1 0.0000 0.9970 1.000 0.000 0.000
#> GSM154286 1 0.1643 0.9537 0.956 0.000 0.044
#> GSM154287 3 0.5621 0.3683 0.308 0.000 0.692
#> GSM154288 2 0.0237 0.7439 0.004 0.996 0.000
#> GSM154301 3 0.0592 0.7350 0.012 0.000 0.988
#> GSM154302 3 0.5591 0.3789 0.304 0.000 0.696
#> GSM154303 2 0.4504 0.5198 0.000 0.804 0.196
#> GSM154316 3 0.0000 0.7417 0.000 0.000 1.000
#> GSM154317 3 0.0000 0.7417 0.000 0.000 1.000
#> GSM154318 3 0.2448 0.6895 0.076 0.000 0.924
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> GSM154259 1 0.0592 0.973 0.984 0.000 0.016 0.000
#> GSM154260 1 0.0000 0.980 1.000 0.000 0.000 0.000
#> GSM154261 1 0.0000 0.980 1.000 0.000 0.000 0.000
#> GSM154274 2 0.0336 0.884 0.000 0.992 0.000 0.008
#> GSM154275 2 0.0707 0.877 0.020 0.980 0.000 0.000
#> GSM154276 2 0.0000 0.883 0.000 1.000 0.000 0.000
#> GSM154289 2 0.0000 0.883 0.000 1.000 0.000 0.000
#> GSM154290 2 0.0000 0.883 0.000 1.000 0.000 0.000
#> GSM154291 4 0.3610 0.852 0.000 0.200 0.000 0.800
#> GSM154304 2 0.0188 0.883 0.000 0.996 0.004 0.000
#> GSM154305 2 0.0000 0.883 0.000 1.000 0.000 0.000
#> GSM154306 4 0.3610 0.852 0.000 0.200 0.000 0.800
#> GSM154262 1 0.0188 0.979 0.996 0.000 0.004 0.000
#> GSM154263 1 0.0000 0.980 1.000 0.000 0.000 0.000
#> GSM154264 1 0.0000 0.980 1.000 0.000 0.000 0.000
#> GSM154277 4 0.1792 0.849 0.000 0.068 0.000 0.932
#> GSM154278 2 0.2987 0.856 0.000 0.880 0.016 0.104
#> GSM154279 2 0.2704 0.850 0.000 0.876 0.000 0.124
#> GSM154292 2 0.0469 0.884 0.000 0.988 0.000 0.012
#> GSM154293 2 0.0336 0.884 0.000 0.992 0.000 0.008
#> GSM154294 4 0.2868 0.882 0.000 0.136 0.000 0.864
#> GSM154307 2 0.2814 0.778 0.000 0.868 0.132 0.000
#> GSM154308 2 0.0188 0.883 0.000 0.996 0.004 0.000
#> GSM154309 2 0.1637 0.850 0.000 0.940 0.060 0.000
#> GSM154265 1 0.0592 0.973 0.984 0.000 0.016 0.000
#> GSM154266 1 0.0000 0.980 1.000 0.000 0.000 0.000
#> GSM154267 1 0.0000 0.980 1.000 0.000 0.000 0.000
#> GSM154280 2 0.7318 0.415 0.280 0.524 0.000 0.196
#> GSM154281 2 0.7590 0.553 0.172 0.600 0.040 0.188
#> GSM154282 2 0.7385 0.386 0.296 0.508 0.000 0.196
#> GSM154295 3 0.0000 0.974 0.000 0.000 1.000 0.000
#> GSM154296 3 0.2988 0.857 0.000 0.012 0.876 0.112
#> GSM154297 3 0.2988 0.857 0.000 0.012 0.876 0.112
#> GSM154310 3 0.0000 0.974 0.000 0.000 1.000 0.000
#> GSM154311 3 0.0000 0.974 0.000 0.000 1.000 0.000
#> GSM154312 3 0.0000 0.974 0.000 0.000 1.000 0.000
#> GSM154268 1 0.0000 0.980 1.000 0.000 0.000 0.000
#> GSM154269 1 0.0592 0.973 0.984 0.000 0.016 0.000
#> GSM154270 1 0.0000 0.980 1.000 0.000 0.000 0.000
#> GSM154283 2 0.2704 0.850 0.000 0.876 0.000 0.124
#> GSM154284 2 0.2814 0.845 0.000 0.868 0.000 0.132
#> GSM154285 2 0.3157 0.834 0.004 0.852 0.000 0.144
#> GSM154298 2 0.1398 0.880 0.000 0.956 0.004 0.040
#> GSM154299 2 0.2469 0.858 0.000 0.892 0.000 0.108
#> GSM154300 2 0.2408 0.860 0.000 0.896 0.000 0.104
#> GSM154313 2 0.0188 0.883 0.000 0.996 0.004 0.000
#> GSM154314 2 0.0188 0.883 0.000 0.996 0.004 0.000
#> GSM154315 4 0.1792 0.884 0.000 0.068 0.000 0.932
#> GSM154271 1 0.0336 0.977 0.992 0.000 0.008 0.000
#> GSM154272 1 0.0592 0.973 0.984 0.000 0.016 0.000
#> GSM154273 1 0.0000 0.980 1.000 0.000 0.000 0.000
#> GSM154286 1 0.3649 0.741 0.796 0.000 0.000 0.204
#> GSM154287 3 0.0000 0.974 0.000 0.000 1.000 0.000
#> GSM154288 4 0.0592 0.868 0.000 0.016 0.000 0.984
#> GSM154301 3 0.0000 0.974 0.000 0.000 1.000 0.000
#> GSM154302 3 0.0000 0.974 0.000 0.000 1.000 0.000
#> GSM154303 4 0.1302 0.852 0.000 0.000 0.044 0.956
#> GSM154316 3 0.0000 0.974 0.000 0.000 1.000 0.000
#> GSM154317 3 0.0000 0.974 0.000 0.000 1.000 0.000
#> GSM154318 3 0.0000 0.974 0.000 0.000 1.000 0.000
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> GSM154259 1 0.1403 0.9338 0.952 0.000 0.024 0.000 0.024
#> GSM154260 1 0.0703 0.9480 0.976 0.000 0.000 0.000 0.024
#> GSM154261 1 0.0703 0.9479 0.976 0.000 0.000 0.000 0.024
#> GSM154274 5 0.4060 0.5076 0.000 0.360 0.000 0.000 0.640
#> GSM154275 5 0.4640 0.3691 0.016 0.400 0.000 0.000 0.584
#> GSM154276 5 0.4415 0.3207 0.004 0.444 0.000 0.000 0.552
#> GSM154289 2 0.0404 0.9063 0.000 0.988 0.000 0.000 0.012
#> GSM154290 2 0.0510 0.9053 0.000 0.984 0.000 0.000 0.016
#> GSM154291 4 0.3039 0.7715 0.000 0.192 0.000 0.808 0.000
#> GSM154304 2 0.0290 0.9045 0.000 0.992 0.000 0.000 0.008
#> GSM154305 2 0.0963 0.8784 0.000 0.964 0.000 0.000 0.036
#> GSM154306 4 0.4074 0.5219 0.000 0.364 0.000 0.636 0.000
#> GSM154262 1 0.0290 0.9534 0.992 0.000 0.008 0.000 0.000
#> GSM154263 1 0.0000 0.9534 1.000 0.000 0.000 0.000 0.000
#> GSM154264 1 0.0404 0.9521 0.988 0.000 0.000 0.000 0.012
#> GSM154277 5 0.3424 0.5932 0.000 0.000 0.000 0.240 0.760
#> GSM154278 5 0.2230 0.7644 0.000 0.116 0.000 0.000 0.884
#> GSM154279 5 0.2020 0.7684 0.000 0.100 0.000 0.000 0.900
#> GSM154292 2 0.3586 0.5822 0.000 0.736 0.000 0.000 0.264
#> GSM154293 2 0.1544 0.8694 0.000 0.932 0.000 0.000 0.068
#> GSM154294 4 0.1792 0.8476 0.000 0.084 0.000 0.916 0.000
#> GSM154307 2 0.1331 0.8726 0.000 0.952 0.040 0.000 0.008
#> GSM154308 2 0.0290 0.9065 0.000 0.992 0.000 0.000 0.008
#> GSM154309 2 0.0865 0.8935 0.000 0.972 0.024 0.000 0.004
#> GSM154265 1 0.0671 0.9497 0.980 0.000 0.016 0.000 0.004
#> GSM154266 1 0.0162 0.9537 0.996 0.000 0.004 0.000 0.000
#> GSM154267 1 0.0162 0.9534 0.996 0.000 0.000 0.000 0.004
#> GSM154280 5 0.1908 0.7524 0.016 0.024 0.024 0.000 0.936
#> GSM154281 5 0.2472 0.7433 0.036 0.012 0.044 0.000 0.908
#> GSM154282 5 0.1978 0.7369 0.044 0.004 0.024 0.000 0.928
#> GSM154295 3 0.1124 0.9637 0.000 0.004 0.960 0.000 0.036
#> GSM154296 5 0.4448 0.0787 0.000 0.004 0.480 0.000 0.516
#> GSM154297 5 0.4331 0.3106 0.000 0.004 0.400 0.000 0.596
#> GSM154310 3 0.0771 0.9758 0.000 0.004 0.976 0.000 0.020
#> GSM154311 3 0.0771 0.9707 0.000 0.004 0.976 0.000 0.020
#> GSM154312 3 0.0771 0.9758 0.000 0.004 0.976 0.000 0.020
#> GSM154268 1 0.0162 0.9537 0.996 0.000 0.004 0.000 0.000
#> GSM154269 1 0.1018 0.9442 0.968 0.000 0.016 0.000 0.016
#> GSM154270 1 0.0510 0.9509 0.984 0.000 0.000 0.000 0.016
#> GSM154283 5 0.2179 0.7658 0.000 0.112 0.000 0.000 0.888
#> GSM154284 5 0.1908 0.7693 0.000 0.092 0.000 0.000 0.908
#> GSM154285 5 0.1732 0.7686 0.000 0.080 0.000 0.000 0.920
#> GSM154298 2 0.4066 0.4223 0.000 0.672 0.004 0.000 0.324
#> GSM154299 5 0.2690 0.7426 0.000 0.156 0.000 0.000 0.844
#> GSM154300 5 0.4138 0.3999 0.000 0.384 0.000 0.000 0.616
#> GSM154313 2 0.0290 0.9065 0.000 0.992 0.000 0.000 0.008
#> GSM154314 2 0.0451 0.9064 0.000 0.988 0.004 0.000 0.008
#> GSM154315 4 0.0162 0.8573 0.000 0.004 0.000 0.996 0.000
#> GSM154271 1 0.0290 0.9534 0.992 0.000 0.008 0.000 0.000
#> GSM154272 1 0.0510 0.9511 0.984 0.000 0.016 0.000 0.000
#> GSM154273 1 0.0510 0.9509 0.984 0.000 0.000 0.000 0.016
#> GSM154286 1 0.7053 0.2886 0.496 0.000 0.032 0.204 0.268
#> GSM154287 3 0.0404 0.9757 0.000 0.000 0.988 0.000 0.012
#> GSM154288 4 0.0000 0.8565 0.000 0.000 0.000 1.000 0.000
#> GSM154301 3 0.0404 0.9757 0.000 0.000 0.988 0.000 0.012
#> GSM154302 3 0.0955 0.9720 0.000 0.000 0.968 0.004 0.028
#> GSM154303 4 0.0000 0.8565 0.000 0.000 0.000 1.000 0.000
#> GSM154316 3 0.0324 0.9799 0.000 0.004 0.992 0.000 0.004
#> GSM154317 3 0.0290 0.9801 0.000 0.000 0.992 0.000 0.008
#> GSM154318 3 0.0162 0.9796 0.000 0.000 0.996 0.000 0.004
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> GSM154259 1 0.4439 0.595 0.540 0.000 0.028 0.000 0.000 NA
#> GSM154260 1 0.2597 0.815 0.824 0.000 0.000 0.000 0.000 NA
#> GSM154261 1 0.2631 0.812 0.820 0.000 0.000 0.000 0.000 NA
#> GSM154274 5 0.3854 0.762 0.000 0.136 0.000 0.000 0.772 NA
#> GSM154275 5 0.5358 0.636 0.012 0.112 0.000 0.000 0.600 NA
#> GSM154276 5 0.4526 0.716 0.000 0.132 0.000 0.000 0.704 NA
#> GSM154289 2 0.1531 0.870 0.000 0.928 0.000 0.000 0.004 NA
#> GSM154290 2 0.1757 0.865 0.000 0.916 0.000 0.000 0.008 NA
#> GSM154291 4 0.2907 0.839 0.000 0.152 0.000 0.828 0.000 NA
#> GSM154304 2 0.0632 0.882 0.000 0.976 0.000 0.000 0.000 NA
#> GSM154305 2 0.1713 0.867 0.000 0.928 0.000 0.000 0.028 NA
#> GSM154306 4 0.3201 0.784 0.000 0.208 0.000 0.780 0.000 NA
#> GSM154262 1 0.2300 0.859 0.856 0.000 0.000 0.000 0.000 NA
#> GSM154263 1 0.0146 0.891 0.996 0.000 0.000 0.000 0.000 NA
#> GSM154264 1 0.0632 0.888 0.976 0.000 0.000 0.000 0.000 NA
#> GSM154277 5 0.2805 0.736 0.000 0.000 0.000 0.184 0.812 NA
#> GSM154278 5 0.1498 0.863 0.000 0.028 0.000 0.000 0.940 NA
#> GSM154279 5 0.1257 0.864 0.000 0.028 0.000 0.000 0.952 NA
#> GSM154292 2 0.3103 0.714 0.000 0.784 0.000 0.000 0.208 NA
#> GSM154293 2 0.1806 0.847 0.000 0.908 0.000 0.000 0.088 NA
#> GSM154294 4 0.1141 0.904 0.000 0.052 0.000 0.948 0.000 NA
#> GSM154307 2 0.1010 0.877 0.000 0.960 0.004 0.000 0.000 NA
#> GSM154308 2 0.0000 0.883 0.000 1.000 0.000 0.000 0.000 NA
#> GSM154309 2 0.0363 0.884 0.000 0.988 0.000 0.000 0.000 NA
#> GSM154265 1 0.2135 0.866 0.872 0.000 0.000 0.000 0.000 NA
#> GSM154266 1 0.0000 0.891 1.000 0.000 0.000 0.000 0.000 NA
#> GSM154267 1 0.0363 0.890 0.988 0.000 0.000 0.000 0.000 NA
#> GSM154280 5 0.1320 0.852 0.000 0.000 0.036 0.000 0.948 NA
#> GSM154281 5 0.1074 0.855 0.000 0.000 0.028 0.000 0.960 NA
#> GSM154282 5 0.1074 0.855 0.000 0.000 0.028 0.000 0.960 NA
#> GSM154295 3 0.1615 0.861 0.000 0.004 0.928 0.000 0.004 NA
#> GSM154296 3 0.3735 0.786 0.000 0.004 0.792 0.000 0.120 NA
#> GSM154297 3 0.4047 0.757 0.000 0.004 0.760 0.000 0.152 NA
#> GSM154310 3 0.1643 0.860 0.000 0.008 0.924 0.000 0.000 NA
#> GSM154311 3 0.1908 0.856 0.000 0.004 0.900 0.000 0.000 NA
#> GSM154312 3 0.1674 0.860 0.000 0.004 0.924 0.000 0.004 NA
#> GSM154268 1 0.0458 0.890 0.984 0.000 0.000 0.000 0.000 NA
#> GSM154269 1 0.3578 0.714 0.660 0.000 0.000 0.000 0.000 NA
#> GSM154270 1 0.1204 0.879 0.944 0.000 0.000 0.000 0.000 NA
#> GSM154283 5 0.0972 0.864 0.000 0.028 0.000 0.000 0.964 NA
#> GSM154284 5 0.0972 0.864 0.000 0.028 0.000 0.000 0.964 NA
#> GSM154285 5 0.0713 0.864 0.000 0.028 0.000 0.000 0.972 NA
#> GSM154298 2 0.5197 0.402 0.000 0.568 0.000 0.000 0.320 NA
#> GSM154299 5 0.2263 0.844 0.000 0.056 0.000 0.000 0.896 NA
#> GSM154300 5 0.5636 0.222 0.000 0.308 0.000 0.000 0.516 NA
#> GSM154313 2 0.1500 0.871 0.000 0.936 0.012 0.000 0.000 NA
#> GSM154314 2 0.1606 0.871 0.000 0.932 0.008 0.000 0.004 NA
#> GSM154315 4 0.0146 0.909 0.000 0.004 0.000 0.996 0.000 NA
#> GSM154271 1 0.1444 0.881 0.928 0.000 0.000 0.000 0.000 NA
#> GSM154272 1 0.2278 0.864 0.868 0.000 0.004 0.000 0.000 NA
#> GSM154273 1 0.1204 0.879 0.944 0.000 0.000 0.000 0.000 NA
#> GSM154286 3 0.8240 0.177 0.180 0.000 0.360 0.140 0.256 NA
#> GSM154287 3 0.3271 0.718 0.008 0.000 0.760 0.000 0.000 NA
#> GSM154288 4 0.0000 0.909 0.000 0.000 0.000 1.000 0.000 NA
#> GSM154301 3 0.1501 0.843 0.000 0.000 0.924 0.000 0.000 NA
#> GSM154302 3 0.0405 0.865 0.000 0.000 0.988 0.000 0.004 NA
#> GSM154303 4 0.0000 0.909 0.000 0.000 0.000 1.000 0.000 NA
#> GSM154316 3 0.0790 0.859 0.000 0.000 0.968 0.000 0.000 NA
#> GSM154317 3 0.0146 0.865 0.000 0.000 0.996 0.000 0.000 NA
#> GSM154318 3 0.0363 0.864 0.000 0.000 0.988 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 agent(p) time(p) k
#> MAD:NMF 59 0.008402 1.99e-07 2
#> MAD:NMF 44 0.003685 2.34e-09 3
#> MAD:NMF 58 0.000831 2.49e-09 4
#> MAD:NMF 53 0.009744 2.95e-14 5
#> MAD:NMF 57 0.007629 7.29e-16 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 38950 rows and 60 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 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 1.000 1.000 1.000 0.4525 0.548 0.548
#> 3 3 1.000 1.000 1.000 0.0449 0.980 0.963
#> 4 4 0.765 0.980 0.938 0.3677 0.788 0.599
#> 5 5 0.916 0.945 0.979 0.1086 0.968 0.900
#> 6 6 0.876 0.912 0.959 0.0255 0.998 0.994
suggest_best_k()
suggests the best \(k\) based on these statistics. The rules are as follows:
suggest_best_k(res)
#> [1] 5
#> 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
#> GSM154259 1 0 1 1 0
#> GSM154260 1 0 1 1 0
#> GSM154261 1 0 1 1 0
#> GSM154274 1 0 1 1 0
#> GSM154275 1 0 1 1 0
#> GSM154276 1 0 1 1 0
#> GSM154289 2 0 1 0 1
#> GSM154290 2 0 1 0 1
#> GSM154291 2 0 1 0 1
#> GSM154304 2 0 1 0 1
#> GSM154305 2 0 1 0 1
#> GSM154306 2 0 1 0 1
#> GSM154262 1 0 1 1 0
#> GSM154263 1 0 1 1 0
#> GSM154264 1 0 1 1 0
#> GSM154277 1 0 1 1 0
#> GSM154278 1 0 1 1 0
#> GSM154279 1 0 1 1 0
#> GSM154292 2 0 1 0 1
#> GSM154293 2 0 1 0 1
#> GSM154294 2 0 1 0 1
#> GSM154307 2 0 1 0 1
#> GSM154308 2 0 1 0 1
#> GSM154309 2 0 1 0 1
#> GSM154265 1 0 1 1 0
#> GSM154266 1 0 1 1 0
#> GSM154267 1 0 1 1 0
#> GSM154280 1 0 1 1 0
#> GSM154281 1 0 1 1 0
#> GSM154282 1 0 1 1 0
#> GSM154295 1 0 1 1 0
#> GSM154296 1 0 1 1 0
#> GSM154297 1 0 1 1 0
#> GSM154310 1 0 1 1 0
#> GSM154311 1 0 1 1 0
#> GSM154312 1 0 1 1 0
#> GSM154268 1 0 1 1 0
#> GSM154269 1 0 1 1 0
#> GSM154270 1 0 1 1 0
#> GSM154283 1 0 1 1 0
#> GSM154284 1 0 1 1 0
#> GSM154285 1 0 1 1 0
#> GSM154298 2 0 1 0 1
#> GSM154299 2 0 1 0 1
#> GSM154300 2 0 1 0 1
#> GSM154313 2 0 1 0 1
#> GSM154314 2 0 1 0 1
#> GSM154315 2 0 1 0 1
#> GSM154271 1 0 1 1 0
#> GSM154272 1 0 1 1 0
#> GSM154273 1 0 1 1 0
#> GSM154286 1 0 1 1 0
#> GSM154287 1 0 1 1 0
#> GSM154288 2 0 1 0 1
#> GSM154301 1 0 1 1 0
#> GSM154302 1 0 1 1 0
#> GSM154303 2 0 1 0 1
#> GSM154316 1 0 1 1 0
#> GSM154317 1 0 1 1 0
#> GSM154318 1 0 1 1 0
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> GSM154259 1 0 1 1 0 0
#> GSM154260 1 0 1 1 0 0
#> GSM154261 1 0 1 1 0 0
#> GSM154274 1 0 1 1 0 0
#> GSM154275 1 0 1 1 0 0
#> GSM154276 1 0 1 1 0 0
#> GSM154289 2 0 1 0 1 0
#> GSM154290 2 0 1 0 1 0
#> GSM154291 2 0 1 0 1 0
#> GSM154304 2 0 1 0 1 0
#> GSM154305 2 0 1 0 1 0
#> GSM154306 2 0 1 0 1 0
#> GSM154262 1 0 1 1 0 0
#> GSM154263 1 0 1 1 0 0
#> GSM154264 1 0 1 1 0 0
#> GSM154277 1 0 1 1 0 0
#> GSM154278 1 0 1 1 0 0
#> GSM154279 1 0 1 1 0 0
#> GSM154292 2 0 1 0 1 0
#> GSM154293 2 0 1 0 1 0
#> GSM154294 2 0 1 0 1 0
#> GSM154307 2 0 1 0 1 0
#> GSM154308 2 0 1 0 1 0
#> GSM154309 2 0 1 0 1 0
#> GSM154265 1 0 1 1 0 0
#> GSM154266 1 0 1 1 0 0
#> GSM154267 1 0 1 1 0 0
#> GSM154280 1 0 1 1 0 0
#> GSM154281 1 0 1 1 0 0
#> GSM154282 1 0 1 1 0 0
#> GSM154295 1 0 1 1 0 0
#> GSM154296 1 0 1 1 0 0
#> GSM154297 1 0 1 1 0 0
#> GSM154310 1 0 1 1 0 0
#> GSM154311 1 0 1 1 0 0
#> GSM154312 1 0 1 1 0 0
#> GSM154268 1 0 1 1 0 0
#> GSM154269 1 0 1 1 0 0
#> GSM154270 1 0 1 1 0 0
#> GSM154283 1 0 1 1 0 0
#> GSM154284 1 0 1 1 0 0
#> GSM154285 1 0 1 1 0 0
#> GSM154298 2 0 1 0 1 0
#> GSM154299 2 0 1 0 1 0
#> GSM154300 2 0 1 0 1 0
#> GSM154313 2 0 1 0 1 0
#> GSM154314 2 0 1 0 1 0
#> GSM154315 2 0 1 0 1 0
#> GSM154271 1 0 1 1 0 0
#> GSM154272 1 0 1 1 0 0
#> GSM154273 1 0 1 1 0 0
#> GSM154286 1 0 1 1 0 0
#> GSM154287 1 0 1 1 0 0
#> GSM154288 3 0 1 0 0 1
#> GSM154301 1 0 1 1 0 0
#> GSM154302 1 0 1 1 0 0
#> GSM154303 3 0 1 0 0 1
#> GSM154316 1 0 1 1 0 0
#> GSM154317 1 0 1 1 0 0
#> GSM154318 1 0 1 1 0 0
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> GSM154259 1 0.3649 1.000 0.796 0.000 0.204 0
#> GSM154260 1 0.3649 1.000 0.796 0.000 0.204 0
#> GSM154261 1 0.3649 1.000 0.796 0.000 0.204 0
#> GSM154274 3 0.0000 0.999 0.000 0.000 1.000 0
#> GSM154275 3 0.0000 0.999 0.000 0.000 1.000 0
#> GSM154276 3 0.0000 0.999 0.000 0.000 1.000 0
#> GSM154289 2 0.0000 0.964 0.000 1.000 0.000 0
#> GSM154290 2 0.0000 0.964 0.000 1.000 0.000 0
#> GSM154291 2 0.0336 0.960 0.008 0.992 0.000 0
#> GSM154304 2 0.0000 0.964 0.000 1.000 0.000 0
#> GSM154305 2 0.3649 0.803 0.204 0.796 0.000 0
#> GSM154306 2 0.3649 0.803 0.204 0.796 0.000 0
#> GSM154262 1 0.3649 1.000 0.796 0.000 0.204 0
#> GSM154263 1 0.3649 1.000 0.796 0.000 0.204 0
#> GSM154264 1 0.3649 1.000 0.796 0.000 0.204 0
#> GSM154277 3 0.0000 0.999 0.000 0.000 1.000 0
#> GSM154278 3 0.0000 0.999 0.000 0.000 1.000 0
#> GSM154279 3 0.0000 0.999 0.000 0.000 1.000 0
#> GSM154292 2 0.0000 0.964 0.000 1.000 0.000 0
#> GSM154293 2 0.0000 0.964 0.000 1.000 0.000 0
#> GSM154294 2 0.0336 0.960 0.008 0.992 0.000 0
#> GSM154307 2 0.0000 0.964 0.000 1.000 0.000 0
#> GSM154308 2 0.0000 0.964 0.000 1.000 0.000 0
#> GSM154309 2 0.0000 0.964 0.000 1.000 0.000 0
#> GSM154265 1 0.3649 1.000 0.796 0.000 0.204 0
#> GSM154266 1 0.3649 1.000 0.796 0.000 0.204 0
#> GSM154267 1 0.3649 1.000 0.796 0.000 0.204 0
#> GSM154280 3 0.0188 0.996 0.004 0.000 0.996 0
#> GSM154281 3 0.0188 0.996 0.004 0.000 0.996 0
#> GSM154282 3 0.0188 0.996 0.004 0.000 0.996 0
#> GSM154295 3 0.0000 0.999 0.000 0.000 1.000 0
#> GSM154296 3 0.0000 0.999 0.000 0.000 1.000 0
#> GSM154297 3 0.0000 0.999 0.000 0.000 1.000 0
#> GSM154310 3 0.0000 0.999 0.000 0.000 1.000 0
#> GSM154311 3 0.0000 0.999 0.000 0.000 1.000 0
#> GSM154312 3 0.0000 0.999 0.000 0.000 1.000 0
#> GSM154268 1 0.3649 1.000 0.796 0.000 0.204 0
#> GSM154269 1 0.3649 1.000 0.796 0.000 0.204 0
#> GSM154270 1 0.3649 1.000 0.796 0.000 0.204 0
#> GSM154283 3 0.0000 0.999 0.000 0.000 1.000 0
#> GSM154284 3 0.0000 0.999 0.000 0.000 1.000 0
#> GSM154285 3 0.0000 0.999 0.000 0.000 1.000 0
#> GSM154298 2 0.0000 0.964 0.000 1.000 0.000 0
#> GSM154299 2 0.0000 0.964 0.000 1.000 0.000 0
#> GSM154300 2 0.0188 0.962 0.004 0.996 0.000 0
#> GSM154313 2 0.0000 0.964 0.000 1.000 0.000 0
#> GSM154314 2 0.0000 0.964 0.000 1.000 0.000 0
#> GSM154315 2 0.3649 0.803 0.204 0.796 0.000 0
#> GSM154271 1 0.3649 1.000 0.796 0.000 0.204 0
#> GSM154272 1 0.3649 1.000 0.796 0.000 0.204 0
#> GSM154273 1 0.3649 1.000 0.796 0.000 0.204 0
#> GSM154286 3 0.0188 0.996 0.004 0.000 0.996 0
#> GSM154287 3 0.0000 0.999 0.000 0.000 1.000 0
#> GSM154288 4 0.0000 1.000 0.000 0.000 0.000 1
#> GSM154301 3 0.0000 0.999 0.000 0.000 1.000 0
#> GSM154302 3 0.0000 0.999 0.000 0.000 1.000 0
#> GSM154303 4 0.0000 1.000 0.000 0.000 0.000 1
#> GSM154316 3 0.0000 0.999 0.000 0.000 1.000 0
#> GSM154317 3 0.0000 0.999 0.000 0.000 1.000 0
#> GSM154318 3 0.0000 0.999 0.000 0.000 1.000 0
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> GSM154259 1 0.0000 1.000 1.000 0.000 0.000 0.000 0
#> GSM154260 1 0.0000 1.000 1.000 0.000 0.000 0.000 0
#> GSM154261 1 0.0000 1.000 1.000 0.000 0.000 0.000 0
#> GSM154274 3 0.0000 0.959 0.000 0.000 1.000 0.000 0
#> GSM154275 3 0.0000 0.959 0.000 0.000 1.000 0.000 0
#> GSM154276 3 0.0000 0.959 0.000 0.000 1.000 0.000 0
#> GSM154289 2 0.0000 0.992 0.000 1.000 0.000 0.000 0
#> GSM154290 2 0.0000 0.992 0.000 1.000 0.000 0.000 0
#> GSM154291 2 0.1544 0.923 0.000 0.932 0.000 0.068 0
#> GSM154304 2 0.0000 0.992 0.000 1.000 0.000 0.000 0
#> GSM154305 4 0.0000 0.782 0.000 0.000 0.000 1.000 0
#> GSM154306 4 0.0000 0.782 0.000 0.000 0.000 1.000 0
#> GSM154262 1 0.0000 1.000 1.000 0.000 0.000 0.000 0
#> GSM154263 1 0.0000 1.000 1.000 0.000 0.000 0.000 0
#> GSM154264 1 0.0000 1.000 1.000 0.000 0.000 0.000 0
#> GSM154277 3 0.0000 0.959 0.000 0.000 1.000 0.000 0
#> GSM154278 3 0.0000 0.959 0.000 0.000 1.000 0.000 0
#> GSM154279 3 0.0000 0.959 0.000 0.000 1.000 0.000 0
#> GSM154292 2 0.0000 0.992 0.000 1.000 0.000 0.000 0
#> GSM154293 2 0.0000 0.992 0.000 1.000 0.000 0.000 0
#> GSM154294 2 0.0703 0.971 0.000 0.976 0.000 0.024 0
#> GSM154307 2 0.0000 0.992 0.000 1.000 0.000 0.000 0
#> GSM154308 2 0.0000 0.992 0.000 1.000 0.000 0.000 0
#> GSM154309 2 0.0000 0.992 0.000 1.000 0.000 0.000 0
#> GSM154265 1 0.0000 1.000 1.000 0.000 0.000 0.000 0
#> GSM154266 1 0.0000 1.000 1.000 0.000 0.000 0.000 0
#> GSM154267 1 0.0000 1.000 1.000 0.000 0.000 0.000 0
#> GSM154280 3 0.3074 0.758 0.196 0.000 0.804 0.000 0
#> GSM154281 3 0.3074 0.758 0.196 0.000 0.804 0.000 0
#> GSM154282 3 0.3074 0.758 0.196 0.000 0.804 0.000 0
#> GSM154295 3 0.0000 0.959 0.000 0.000 1.000 0.000 0
#> GSM154296 3 0.0000 0.959 0.000 0.000 1.000 0.000 0
#> GSM154297 3 0.0000 0.959 0.000 0.000 1.000 0.000 0
#> GSM154310 3 0.0000 0.959 0.000 0.000 1.000 0.000 0
#> GSM154311 3 0.0000 0.959 0.000 0.000 1.000 0.000 0
#> GSM154312 3 0.0000 0.959 0.000 0.000 1.000 0.000 0
#> GSM154268 1 0.0000 1.000 1.000 0.000 0.000 0.000 0
#> GSM154269 1 0.0000 1.000 1.000 0.000 0.000 0.000 0
#> GSM154270 1 0.0000 1.000 1.000 0.000 0.000 0.000 0
#> GSM154283 3 0.0000 0.959 0.000 0.000 1.000 0.000 0
#> GSM154284 3 0.0000 0.959 0.000 0.000 1.000 0.000 0
#> GSM154285 3 0.0000 0.959 0.000 0.000 1.000 0.000 0
#> GSM154298 2 0.0000 0.992 0.000 1.000 0.000 0.000 0
#> GSM154299 2 0.0000 0.992 0.000 1.000 0.000 0.000 0
#> GSM154300 4 0.4060 0.384 0.000 0.360 0.000 0.640 0
#> GSM154313 2 0.0000 0.992 0.000 1.000 0.000 0.000 0
#> GSM154314 2 0.0000 0.992 0.000 1.000 0.000 0.000 0
#> GSM154315 4 0.0000 0.782 0.000 0.000 0.000 1.000 0
#> GSM154271 1 0.0000 1.000 1.000 0.000 0.000 0.000 0
#> GSM154272 1 0.0000 1.000 1.000 0.000 0.000 0.000 0
#> GSM154273 1 0.0000 1.000 1.000 0.000 0.000 0.000 0
#> GSM154286 3 0.3074 0.758 0.196 0.000 0.804 0.000 0
#> GSM154287 3 0.0000 0.959 0.000 0.000 1.000 0.000 0
#> GSM154288 5 0.0000 1.000 0.000 0.000 0.000 0.000 1
#> GSM154301 3 0.0000 0.959 0.000 0.000 1.000 0.000 0
#> GSM154302 3 0.0000 0.959 0.000 0.000 1.000 0.000 0
#> GSM154303 5 0.0000 1.000 0.000 0.000 0.000 0.000 1
#> GSM154316 3 0.0000 0.959 0.000 0.000 1.000 0.000 0
#> GSM154317 3 0.0000 0.959 0.000 0.000 1.000 0.000 0
#> GSM154318 3 0.0000 0.959 0.000 0.000 1.000 0.000 0
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> GSM154259 1 0.0000 1.000 1.000 0.000 0.000 0.000 0.000 0
#> GSM154260 1 0.0000 1.000 1.000 0.000 0.000 0.000 0.000 0
#> GSM154261 1 0.0000 1.000 1.000 0.000 0.000 0.000 0.000 0
#> GSM154274 3 0.0632 0.895 0.000 0.000 0.976 0.000 0.024 0
#> GSM154275 3 0.0632 0.895 0.000 0.000 0.976 0.000 0.024 0
#> GSM154276 3 0.0632 0.895 0.000 0.000 0.976 0.000 0.024 0
#> GSM154289 2 0.0000 0.993 0.000 1.000 0.000 0.000 0.000 0
#> GSM154290 2 0.0000 0.993 0.000 1.000 0.000 0.000 0.000 0
#> GSM154291 2 0.1594 0.929 0.000 0.932 0.000 0.052 0.016 0
#> GSM154304 2 0.0000 0.993 0.000 1.000 0.000 0.000 0.000 0
#> GSM154305 4 0.0000 1.000 0.000 0.000 0.000 1.000 0.000 0
#> GSM154306 4 0.0000 1.000 0.000 0.000 0.000 1.000 0.000 0
#> GSM154262 1 0.0000 1.000 1.000 0.000 0.000 0.000 0.000 0
#> GSM154263 1 0.0000 1.000 1.000 0.000 0.000 0.000 0.000 0
#> GSM154264 1 0.0000 1.000 1.000 0.000 0.000 0.000 0.000 0
#> GSM154277 3 0.3390 0.670 0.000 0.000 0.704 0.000 0.296 0
#> GSM154278 3 0.0632 0.895 0.000 0.000 0.976 0.000 0.024 0
#> GSM154279 3 0.0632 0.895 0.000 0.000 0.976 0.000 0.024 0
#> GSM154292 2 0.0000 0.993 0.000 1.000 0.000 0.000 0.000 0
#> GSM154293 2 0.0000 0.993 0.000 1.000 0.000 0.000 0.000 0
#> GSM154294 2 0.0717 0.974 0.000 0.976 0.000 0.008 0.016 0
#> GSM154307 2 0.0000 0.993 0.000 1.000 0.000 0.000 0.000 0
#> GSM154308 2 0.0000 0.993 0.000 1.000 0.000 0.000 0.000 0
#> GSM154309 2 0.0000 0.993 0.000 1.000 0.000 0.000 0.000 0
#> GSM154265 1 0.0000 1.000 1.000 0.000 0.000 0.000 0.000 0
#> GSM154266 1 0.0000 1.000 1.000 0.000 0.000 0.000 0.000 0
#> GSM154267 1 0.0000 1.000 1.000 0.000 0.000 0.000 0.000 0
#> GSM154280 3 0.2762 0.726 0.196 0.000 0.804 0.000 0.000 0
#> GSM154281 3 0.2762 0.726 0.196 0.000 0.804 0.000 0.000 0
#> GSM154282 3 0.2762 0.726 0.196 0.000 0.804 0.000 0.000 0
#> GSM154295 3 0.0000 0.901 0.000 0.000 1.000 0.000 0.000 0
#> GSM154296 3 0.0000 0.901 0.000 0.000 1.000 0.000 0.000 0
#> GSM154297 3 0.0000 0.901 0.000 0.000 1.000 0.000 0.000 0
#> GSM154310 3 0.0000 0.901 0.000 0.000 1.000 0.000 0.000 0
#> GSM154311 3 0.0000 0.901 0.000 0.000 1.000 0.000 0.000 0
#> GSM154312 3 0.0000 0.901 0.000 0.000 1.000 0.000 0.000 0
#> GSM154268 1 0.0000 1.000 1.000 0.000 0.000 0.000 0.000 0
#> GSM154269 1 0.0000 1.000 1.000 0.000 0.000 0.000 0.000 0
#> GSM154270 1 0.0000 1.000 1.000 0.000 0.000 0.000 0.000 0
#> GSM154283 3 0.3390 0.670 0.000 0.000 0.704 0.000 0.296 0
#> GSM154284 3 0.3390 0.670 0.000 0.000 0.704 0.000 0.296 0
#> GSM154285 3 0.3390 0.670 0.000 0.000 0.704 0.000 0.296 0
#> GSM154298 2 0.0000 0.993 0.000 1.000 0.000 0.000 0.000 0
#> GSM154299 2 0.0000 0.993 0.000 1.000 0.000 0.000 0.000 0
#> GSM154300 5 0.3390 0.000 0.000 0.000 0.000 0.296 0.704 0
#> GSM154313 2 0.0000 0.993 0.000 1.000 0.000 0.000 0.000 0
#> GSM154314 2 0.0000 0.993 0.000 1.000 0.000 0.000 0.000 0
#> GSM154315 4 0.0000 1.000 0.000 0.000 0.000 1.000 0.000 0
#> GSM154271 1 0.0000 1.000 1.000 0.000 0.000 0.000 0.000 0
#> GSM154272 1 0.0000 1.000 1.000 0.000 0.000 0.000 0.000 0
#> GSM154273 1 0.0000 1.000 1.000 0.000 0.000 0.000 0.000 0
#> GSM154286 3 0.2762 0.726 0.196 0.000 0.804 0.000 0.000 0
#> GSM154287 3 0.0000 0.901 0.000 0.000 1.000 0.000 0.000 0
#> GSM154288 6 0.0000 1.000 0.000 0.000 0.000 0.000 0.000 1
#> GSM154301 3 0.0000 0.901 0.000 0.000 1.000 0.000 0.000 0
#> GSM154302 3 0.0000 0.901 0.000 0.000 1.000 0.000 0.000 0
#> GSM154303 6 0.0000 1.000 0.000 0.000 0.000 0.000 0.000 1
#> GSM154316 3 0.0000 0.901 0.000 0.000 1.000 0.000 0.000 0
#> GSM154317 3 0.0000 0.901 0.000 0.000 1.000 0.000 0.000 0
#> GSM154318 3 0.0000 0.901 0.000 0.000 1.000 0.000 0.000 0
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 agent(p) time(p) k
#> ATC:hclust 60 0.01735 1.87e-05 2
#> ATC:hclust 60 0.00229 8.62e-05 3
#> ATC:hclust 60 0.00942 9.68e-14 4
#> ATC:hclust 59 0.02005 2.96e-13 5
#> ATC:hclust 59 0.02005 2.96e-13 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 38950 rows and 60 columns.
#> Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'ATC' method.
#> Subgroups are detected by 'kmeans' method.
#> Performed in total 1250 partitions by row resampling.
#> Best k for subgroups seems to be 3.
#>
#> Following methods can be applied to this 'ConsensusPartition' object:
#> [1] "cola_report" "collect_classes" "collect_plots"
#> [4] "collect_stats" "colnames" "compare_signatures"
#> [7] "consensus_heatmap" "dimension_reduction" "functional_enrichment"
#> [10] "get_anno_col" "get_anno" "get_classes"
#> [13] "get_consensus" "get_matrix" "get_membership"
#> [16] "get_param" "get_signatures" "get_stats"
#> [19] "is_best_k" "is_stable_k" "membership_heatmap"
#> [22] "ncol" "nrow" "plot_ecdf"
#> [25] "rownames" "select_partition_number" "show"
#> [28] "suggest_best_k" "test_to_known_factors"
collect_plots()
function collects all the plots made from res
for all k
(number of partitions)
into one single page to provide an easy and fast comparison between different k
.
collect_plots(res)
The plots are:
k
and the heatmap of
predicted classes for each k
.k
.k
.k
.All the plots in panels can be made by individual functions and they are plotted later in this section.
select_partition_number()
produces several plots showing different
statistics for choosing “optimized” k
. There are following statistics:
k
;k
, the area increased is defined as \(A_k - A_{k-1}\).The detailed explanations of these statistics can be found in the cola vignette.
Generally speaking, lower PAC score, higher mean silhouette score or higher
concordance corresponds to better partition. Rand index and Jaccard index
measure how similar the current partition is compared to partition with k-1
.
If they are too similar, we won't accept k
is better than k-1
.
select_partition_number(res)
The numeric values for all these statistics can be obtained by get_stats()
.
get_stats(res)
#> k 1-PAC mean_silhouette concordance area_increased Rand Jaccard
#> 2 2 0.619 0.793 0.902 0.4719 0.528 0.528
#> 3 3 1.000 0.990 0.978 0.3815 0.734 0.530
#> 4 4 0.830 0.862 0.873 0.1056 1.000 1.000
#> 5 5 0.759 0.627 0.754 0.0596 0.881 0.649
#> 6 6 0.761 0.766 0.810 0.0508 0.910 0.652
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
#> GSM154259 1 0.000 0.838 1.000 0.000
#> GSM154260 1 0.000 0.838 1.000 0.000
#> GSM154261 1 0.000 0.838 1.000 0.000
#> GSM154274 1 0.955 0.575 0.624 0.376
#> GSM154275 1 0.760 0.710 0.780 0.220
#> GSM154276 1 0.955 0.575 0.624 0.376
#> GSM154289 2 0.000 0.952 0.000 1.000
#> GSM154290 2 0.000 0.952 0.000 1.000
#> GSM154291 2 0.000 0.952 0.000 1.000
#> GSM154304 2 0.000 0.952 0.000 1.000
#> GSM154305 2 0.000 0.952 0.000 1.000
#> GSM154306 2 0.000 0.952 0.000 1.000
#> GSM154262 1 0.000 0.838 1.000 0.000
#> GSM154263 1 0.000 0.838 1.000 0.000
#> GSM154264 1 0.000 0.838 1.000 0.000
#> GSM154277 2 0.966 0.127 0.392 0.608
#> GSM154278 1 0.955 0.575 0.624 0.376
#> GSM154279 1 0.955 0.575 0.624 0.376
#> GSM154292 2 0.000 0.952 0.000 1.000
#> GSM154293 2 0.000 0.952 0.000 1.000
#> GSM154294 2 0.000 0.952 0.000 1.000
#> GSM154307 2 0.000 0.952 0.000 1.000
#> GSM154308 2 0.000 0.952 0.000 1.000
#> GSM154309 2 0.000 0.952 0.000 1.000
#> GSM154265 1 0.000 0.838 1.000 0.000
#> GSM154266 1 0.000 0.838 1.000 0.000
#> GSM154267 1 0.000 0.838 1.000 0.000
#> GSM154280 1 0.000 0.838 1.000 0.000
#> GSM154281 1 0.000 0.838 1.000 0.000
#> GSM154282 1 0.000 0.838 1.000 0.000
#> GSM154295 1 0.955 0.575 0.624 0.376
#> GSM154296 1 0.955 0.575 0.624 0.376
#> GSM154297 1 0.955 0.575 0.624 0.376
#> GSM154310 1 0.955 0.575 0.624 0.376
#> GSM154311 1 0.955 0.575 0.624 0.376
#> GSM154312 1 0.955 0.575 0.624 0.376
#> GSM154268 1 0.000 0.838 1.000 0.000
#> GSM154269 1 0.000 0.838 1.000 0.000
#> GSM154270 1 0.000 0.838 1.000 0.000
#> GSM154283 2 0.000 0.952 0.000 1.000
#> GSM154284 1 0.955 0.575 0.624 0.376
#> GSM154285 1 0.955 0.575 0.624 0.376
#> GSM154298 2 0.000 0.952 0.000 1.000
#> GSM154299 2 0.000 0.952 0.000 1.000
#> GSM154300 2 0.000 0.952 0.000 1.000
#> GSM154313 2 0.000 0.952 0.000 1.000
#> GSM154314 2 0.000 0.952 0.000 1.000
#> GSM154315 2 0.000 0.952 0.000 1.000
#> GSM154271 1 0.000 0.838 1.000 0.000
#> GSM154272 1 0.000 0.838 1.000 0.000
#> GSM154273 1 0.000 0.838 1.000 0.000
#> GSM154286 1 0.000 0.838 1.000 0.000
#> GSM154287 1 0.000 0.838 1.000 0.000
#> GSM154288 2 0.000 0.952 0.000 1.000
#> GSM154301 1 0.000 0.838 1.000 0.000
#> GSM154302 1 0.000 0.838 1.000 0.000
#> GSM154303 2 0.969 0.111 0.396 0.604
#> GSM154316 1 0.932 0.603 0.652 0.348
#> GSM154317 1 0.000 0.838 1.000 0.000
#> GSM154318 1 0.000 0.838 1.000 0.000
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> GSM154259 1 0.2066 1.000 0.940 0.000 0.060
#> GSM154260 1 0.2066 1.000 0.940 0.000 0.060
#> GSM154261 1 0.2066 1.000 0.940 0.000 0.060
#> GSM154274 3 0.0000 0.995 0.000 0.000 1.000
#> GSM154275 3 0.0000 0.995 0.000 0.000 1.000
#> GSM154276 3 0.0000 0.995 0.000 0.000 1.000
#> GSM154289 2 0.0000 0.987 0.000 1.000 0.000
#> GSM154290 2 0.0000 0.987 0.000 1.000 0.000
#> GSM154291 2 0.1964 0.969 0.056 0.944 0.000
#> GSM154304 2 0.0000 0.987 0.000 1.000 0.000
#> GSM154305 2 0.1529 0.975 0.040 0.960 0.000
#> GSM154306 2 0.1964 0.969 0.056 0.944 0.000
#> GSM154262 1 0.2066 1.000 0.940 0.000 0.060
#> GSM154263 1 0.2066 1.000 0.940 0.000 0.060
#> GSM154264 1 0.2066 1.000 0.940 0.000 0.060
#> GSM154277 3 0.1182 0.973 0.012 0.012 0.976
#> GSM154278 3 0.0000 0.995 0.000 0.000 1.000
#> GSM154279 3 0.0000 0.995 0.000 0.000 1.000
#> GSM154292 2 0.0000 0.987 0.000 1.000 0.000
#> GSM154293 2 0.0000 0.987 0.000 1.000 0.000
#> GSM154294 2 0.0892 0.981 0.020 0.980 0.000
#> GSM154307 2 0.0000 0.987 0.000 1.000 0.000
#> GSM154308 2 0.0000 0.987 0.000 1.000 0.000
#> GSM154309 2 0.0000 0.987 0.000 1.000 0.000
#> GSM154265 1 0.2066 1.000 0.940 0.000 0.060
#> GSM154266 1 0.2066 1.000 0.940 0.000 0.060
#> GSM154267 1 0.2066 1.000 0.940 0.000 0.060
#> GSM154280 3 0.0000 0.995 0.000 0.000 1.000
#> GSM154281 3 0.0000 0.995 0.000 0.000 1.000
#> GSM154282 3 0.0000 0.995 0.000 0.000 1.000
#> GSM154295 3 0.0000 0.995 0.000 0.000 1.000
#> GSM154296 3 0.0000 0.995 0.000 0.000 1.000
#> GSM154297 3 0.0000 0.995 0.000 0.000 1.000
#> GSM154310 3 0.0000 0.995 0.000 0.000 1.000
#> GSM154311 3 0.0000 0.995 0.000 0.000 1.000
#> GSM154312 3 0.0000 0.995 0.000 0.000 1.000
#> GSM154268 1 0.2066 1.000 0.940 0.000 0.060
#> GSM154269 1 0.2066 1.000 0.940 0.000 0.060
#> GSM154270 1 0.2066 1.000 0.940 0.000 0.060
#> GSM154283 3 0.2066 0.929 0.000 0.060 0.940
#> GSM154284 3 0.0000 0.995 0.000 0.000 1.000
#> GSM154285 3 0.0000 0.995 0.000 0.000 1.000
#> GSM154298 2 0.0000 0.987 0.000 1.000 0.000
#> GSM154299 2 0.0000 0.987 0.000 1.000 0.000
#> GSM154300 2 0.1529 0.975 0.040 0.960 0.000
#> GSM154313 2 0.0000 0.987 0.000 1.000 0.000
#> GSM154314 2 0.0000 0.987 0.000 1.000 0.000
#> GSM154315 2 0.1964 0.969 0.056 0.944 0.000
#> GSM154271 1 0.2066 1.000 0.940 0.000 0.060
#> GSM154272 1 0.2066 1.000 0.940 0.000 0.060
#> GSM154273 1 0.2066 1.000 0.940 0.000 0.060
#> GSM154286 3 0.0000 0.995 0.000 0.000 1.000
#> GSM154287 3 0.0000 0.995 0.000 0.000 1.000
#> GSM154288 2 0.2066 0.967 0.060 0.940 0.000
#> GSM154301 3 0.0000 0.995 0.000 0.000 1.000
#> GSM154302 3 0.0000 0.995 0.000 0.000 1.000
#> GSM154303 3 0.1031 0.973 0.024 0.000 0.976
#> GSM154316 3 0.0000 0.995 0.000 0.000 1.000
#> GSM154317 3 0.0000 0.995 0.000 0.000 1.000
#> GSM154318 3 0.0000 0.995 0.000 0.000 1.000
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> GSM154259 1 0.2281 0.945 0.904 0.000 0.000 NA
#> GSM154260 1 0.1118 0.955 0.964 0.000 0.000 NA
#> GSM154261 1 0.1118 0.955 0.964 0.000 0.000 NA
#> GSM154274 3 0.0000 0.813 0.000 0.000 1.000 NA
#> GSM154275 3 0.0336 0.809 0.000 0.000 0.992 NA
#> GSM154276 3 0.0336 0.809 0.000 0.000 0.992 NA
#> GSM154289 2 0.4605 0.893 0.000 0.664 0.000 NA
#> GSM154290 2 0.4605 0.893 0.000 0.664 0.000 NA
#> GSM154291 2 0.0188 0.764 0.000 0.996 0.000 NA
#> GSM154304 2 0.4585 0.893 0.000 0.668 0.000 NA
#> GSM154305 2 0.0188 0.764 0.000 0.996 0.000 NA
#> GSM154306 2 0.0188 0.764 0.000 0.996 0.000 NA
#> GSM154262 1 0.2281 0.945 0.904 0.000 0.000 NA
#> GSM154263 1 0.0000 0.958 1.000 0.000 0.000 NA
#> GSM154264 1 0.1118 0.955 0.964 0.000 0.000 NA
#> GSM154277 3 0.3172 0.708 0.000 0.000 0.840 NA
#> GSM154278 3 0.0592 0.818 0.000 0.000 0.984 NA
#> GSM154279 3 0.0336 0.809 0.000 0.000 0.992 NA
#> GSM154292 2 0.4605 0.893 0.000 0.664 0.000 NA
#> GSM154293 2 0.4605 0.893 0.000 0.664 0.000 NA
#> GSM154294 2 0.4585 0.893 0.000 0.668 0.000 NA
#> GSM154307 2 0.4605 0.893 0.000 0.664 0.000 NA
#> GSM154308 2 0.4585 0.893 0.000 0.668 0.000 NA
#> GSM154309 2 0.4605 0.893 0.000 0.664 0.000 NA
#> GSM154265 1 0.2281 0.945 0.904 0.000 0.000 NA
#> GSM154266 1 0.0000 0.958 1.000 0.000 0.000 NA
#> GSM154267 1 0.1118 0.955 0.964 0.000 0.000 NA
#> GSM154280 3 0.4008 0.864 0.000 0.000 0.756 NA
#> GSM154281 3 0.4008 0.864 0.000 0.000 0.756 NA
#> GSM154282 3 0.4008 0.864 0.000 0.000 0.756 NA
#> GSM154295 3 0.4454 0.865 0.000 0.000 0.692 NA
#> GSM154296 3 0.4454 0.865 0.000 0.000 0.692 NA
#> GSM154297 3 0.4454 0.865 0.000 0.000 0.692 NA
#> GSM154310 3 0.4454 0.865 0.000 0.000 0.692 NA
#> GSM154311 3 0.4454 0.865 0.000 0.000 0.692 NA
#> GSM154312 3 0.4454 0.865 0.000 0.000 0.692 NA
#> GSM154268 1 0.0000 0.958 1.000 0.000 0.000 NA
#> GSM154269 1 0.2281 0.945 0.904 0.000 0.000 NA
#> GSM154270 1 0.1118 0.955 0.964 0.000 0.000 NA
#> GSM154283 3 0.1867 0.771 0.000 0.000 0.928 NA
#> GSM154284 3 0.0336 0.809 0.000 0.000 0.992 NA
#> GSM154285 3 0.0469 0.809 0.000 0.000 0.988 NA
#> GSM154298 2 0.4585 0.893 0.000 0.668 0.000 NA
#> GSM154299 2 0.4585 0.893 0.000 0.668 0.000 NA
#> GSM154300 2 0.0000 0.765 0.000 1.000 0.000 NA
#> GSM154313 2 0.4585 0.893 0.000 0.668 0.000 NA
#> GSM154314 2 0.4585 0.893 0.000 0.668 0.000 NA
#> GSM154315 2 0.0188 0.764 0.000 0.996 0.000 NA
#> GSM154271 1 0.2281 0.945 0.904 0.000 0.000 NA
#> GSM154272 1 0.2281 0.945 0.904 0.000 0.000 NA
#> GSM154273 1 0.1118 0.955 0.964 0.000 0.000 NA
#> GSM154286 3 0.4382 0.860 0.000 0.000 0.704 NA
#> GSM154287 3 0.4746 0.853 0.000 0.000 0.632 NA
#> GSM154288 2 0.6823 0.377 0.000 0.604 0.200 NA
#> GSM154301 3 0.4746 0.853 0.000 0.000 0.632 NA
#> GSM154302 3 0.4746 0.853 0.000 0.000 0.632 NA
#> GSM154303 3 0.4134 0.712 0.000 0.000 0.740 NA
#> GSM154316 3 0.4761 0.852 0.000 0.000 0.628 NA
#> GSM154317 3 0.4761 0.852 0.000 0.000 0.628 NA
#> GSM154318 3 0.4746 0.853 0.000 0.000 0.632 NA
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> GSM154259 1 0.4612 0.8363 0.736 0.180 0.084 0.000 0.000
#> GSM154260 1 0.1965 0.8702 0.924 0.024 0.052 0.000 0.000
#> GSM154261 1 0.1965 0.8702 0.924 0.024 0.052 0.000 0.000
#> GSM154274 5 0.0162 0.5213 0.000 0.000 0.004 0.000 0.996
#> GSM154275 5 0.0000 0.5221 0.000 0.000 0.000 0.000 1.000
#> GSM154276 5 0.0000 0.5221 0.000 0.000 0.000 0.000 1.000
#> GSM154289 2 0.4940 0.9660 0.000 0.576 0.032 0.392 0.000
#> GSM154290 2 0.4940 0.9660 0.000 0.576 0.032 0.392 0.000
#> GSM154291 4 0.0290 0.8488 0.000 0.008 0.000 0.992 0.000
#> GSM154304 2 0.4649 0.9694 0.000 0.580 0.016 0.404 0.000
#> GSM154305 4 0.0290 0.8463 0.000 0.008 0.000 0.992 0.000
#> GSM154306 4 0.0000 0.8519 0.000 0.000 0.000 1.000 0.000
#> GSM154262 1 0.4612 0.8363 0.736 0.180 0.084 0.000 0.000
#> GSM154263 1 0.0510 0.8795 0.984 0.000 0.016 0.000 0.000
#> GSM154264 1 0.1300 0.8751 0.956 0.016 0.028 0.000 0.000
#> GSM154277 5 0.3210 0.3168 0.000 0.000 0.212 0.000 0.788
#> GSM154278 5 0.0162 0.5213 0.000 0.000 0.004 0.000 0.996
#> GSM154279 5 0.0000 0.5221 0.000 0.000 0.000 0.000 1.000
#> GSM154292 2 0.4707 0.9691 0.000 0.588 0.020 0.392 0.000
#> GSM154293 2 0.4707 0.9691 0.000 0.588 0.020 0.392 0.000
#> GSM154294 2 0.4736 0.9647 0.000 0.576 0.020 0.404 0.000
#> GSM154307 2 0.4331 0.9736 0.000 0.596 0.004 0.400 0.000
#> GSM154308 2 0.4341 0.9733 0.000 0.592 0.004 0.404 0.000
#> GSM154309 2 0.4331 0.9736 0.000 0.596 0.004 0.400 0.000
#> GSM154265 1 0.4612 0.8363 0.736 0.180 0.084 0.000 0.000
#> GSM154266 1 0.0510 0.8795 0.984 0.000 0.016 0.000 0.000
#> GSM154267 1 0.1469 0.8752 0.948 0.016 0.036 0.000 0.000
#> GSM154280 5 0.4063 0.2092 0.000 0.012 0.280 0.000 0.708
#> GSM154281 5 0.4063 0.2092 0.000 0.012 0.280 0.000 0.708
#> GSM154282 5 0.4063 0.2092 0.000 0.012 0.280 0.000 0.708
#> GSM154295 5 0.5431 -0.3612 0.000 0.060 0.424 0.000 0.516
#> GSM154296 5 0.5431 -0.3612 0.000 0.060 0.424 0.000 0.516
#> GSM154297 5 0.5431 -0.3612 0.000 0.060 0.424 0.000 0.516
#> GSM154310 5 0.5431 -0.3612 0.000 0.060 0.424 0.000 0.516
#> GSM154311 5 0.5431 -0.3612 0.000 0.060 0.424 0.000 0.516
#> GSM154312 5 0.5431 -0.3612 0.000 0.060 0.424 0.000 0.516
#> GSM154268 1 0.0510 0.8795 0.984 0.000 0.016 0.000 0.000
#> GSM154269 1 0.4612 0.8363 0.736 0.180 0.084 0.000 0.000
#> GSM154270 1 0.1300 0.8751 0.956 0.016 0.028 0.000 0.000
#> GSM154283 5 0.2773 0.3916 0.000 0.112 0.020 0.000 0.868
#> GSM154284 5 0.0000 0.5221 0.000 0.000 0.000 0.000 1.000
#> GSM154285 5 0.0000 0.5221 0.000 0.000 0.000 0.000 1.000
#> GSM154298 2 0.4341 0.9724 0.000 0.592 0.004 0.404 0.000
#> GSM154299 2 0.4726 0.9710 0.000 0.580 0.020 0.400 0.000
#> GSM154300 4 0.1117 0.8225 0.000 0.020 0.016 0.964 0.000
#> GSM154313 2 0.4341 0.9724 0.000 0.592 0.004 0.404 0.000
#> GSM154314 2 0.4341 0.9724 0.000 0.592 0.004 0.404 0.000
#> GSM154315 4 0.0000 0.8519 0.000 0.000 0.000 1.000 0.000
#> GSM154271 1 0.4612 0.8363 0.736 0.180 0.084 0.000 0.000
#> GSM154272 1 0.4612 0.8363 0.736 0.180 0.084 0.000 0.000
#> GSM154273 1 0.1300 0.8751 0.956 0.016 0.028 0.000 0.000
#> GSM154286 5 0.4238 -0.0469 0.000 0.004 0.368 0.000 0.628
#> GSM154287 3 0.4574 0.7676 0.000 0.012 0.576 0.000 0.412
#> GSM154288 4 0.7315 0.4928 0.000 0.132 0.240 0.528 0.100
#> GSM154301 3 0.4210 0.7851 0.000 0.000 0.588 0.000 0.412
#> GSM154302 3 0.4210 0.7851 0.000 0.000 0.588 0.000 0.412
#> GSM154303 3 0.6398 -0.0522 0.000 0.132 0.460 0.008 0.400
#> GSM154316 3 0.4210 0.7851 0.000 0.000 0.588 0.000 0.412
#> GSM154317 3 0.4210 0.7851 0.000 0.000 0.588 0.000 0.412
#> GSM154318 3 0.4210 0.7851 0.000 0.000 0.588 0.000 0.412
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> GSM154259 1 0.0146 0.7416 0.996 0.000 0.000 0.000 0.000 NA
#> GSM154260 1 0.4555 0.7841 0.532 0.000 0.000 0.016 0.012 NA
#> GSM154261 1 0.4555 0.7841 0.532 0.000 0.000 0.016 0.012 NA
#> GSM154274 5 0.2300 0.9560 0.000 0.000 0.144 0.000 0.856 NA
#> GSM154275 5 0.2442 0.9526 0.000 0.000 0.144 0.000 0.852 NA
#> GSM154276 5 0.2300 0.9560 0.000 0.000 0.144 0.000 0.856 NA
#> GSM154289 2 0.2213 0.9143 0.000 0.888 0.000 0.008 0.004 NA
#> GSM154290 2 0.2213 0.9143 0.000 0.888 0.000 0.008 0.004 NA
#> GSM154291 4 0.3601 0.8306 0.000 0.312 0.000 0.684 0.004 NA
#> GSM154304 2 0.0547 0.9268 0.000 0.980 0.000 0.000 0.000 NA
#> GSM154305 4 0.3804 0.8202 0.000 0.336 0.000 0.656 0.000 NA
#> GSM154306 4 0.3499 0.8332 0.000 0.320 0.000 0.680 0.000 NA
#> GSM154262 1 0.0000 0.7432 1.000 0.000 0.000 0.000 0.000 NA
#> GSM154263 1 0.5070 0.7967 0.620 0.000 0.000 0.056 0.024 NA
#> GSM154264 1 0.3847 0.7908 0.544 0.000 0.000 0.000 0.000 NA
#> GSM154277 5 0.1007 0.8410 0.000 0.000 0.044 0.000 0.956 NA
#> GSM154278 5 0.2300 0.9560 0.000 0.000 0.144 0.000 0.856 NA
#> GSM154279 5 0.2300 0.9560 0.000 0.000 0.144 0.000 0.856 NA
#> GSM154292 2 0.1956 0.9214 0.000 0.908 0.000 0.008 0.004 NA
#> GSM154293 2 0.1956 0.9214 0.000 0.908 0.000 0.008 0.004 NA
#> GSM154294 2 0.2377 0.9120 0.000 0.892 0.000 0.024 0.008 NA
#> GSM154307 2 0.0000 0.9342 0.000 1.000 0.000 0.000 0.000 NA
#> GSM154308 2 0.0000 0.9342 0.000 1.000 0.000 0.000 0.000 NA
#> GSM154309 2 0.0000 0.9342 0.000 1.000 0.000 0.000 0.000 NA
#> GSM154265 1 0.0000 0.7432 1.000 0.000 0.000 0.000 0.000 NA
#> GSM154266 1 0.5070 0.7967 0.620 0.000 0.000 0.056 0.024 NA
#> GSM154267 1 0.4656 0.7907 0.544 0.000 0.000 0.028 0.008 NA
#> GSM154280 3 0.5243 0.2024 0.000 0.000 0.512 0.004 0.400 NA
#> GSM154281 3 0.5243 0.2024 0.000 0.000 0.512 0.004 0.400 NA
#> GSM154282 3 0.5243 0.2024 0.000 0.000 0.512 0.004 0.400 NA
#> GSM154295 3 0.4815 0.6849 0.000 0.000 0.728 0.044 0.124 NA
#> GSM154296 3 0.4815 0.6849 0.000 0.000 0.728 0.044 0.124 NA
#> GSM154297 3 0.4815 0.6849 0.000 0.000 0.728 0.044 0.124 NA
#> GSM154310 3 0.4815 0.6849 0.000 0.000 0.728 0.044 0.124 NA
#> GSM154311 3 0.4815 0.6849 0.000 0.000 0.728 0.044 0.124 NA
#> GSM154312 3 0.4815 0.6849 0.000 0.000 0.728 0.044 0.124 NA
#> GSM154268 1 0.5070 0.7967 0.620 0.000 0.000 0.056 0.024 NA
#> GSM154269 1 0.0000 0.7432 1.000 0.000 0.000 0.000 0.000 NA
#> GSM154270 1 0.3847 0.7908 0.544 0.000 0.000 0.000 0.000 NA
#> GSM154283 5 0.3542 0.8348 0.000 0.044 0.068 0.000 0.832 NA
#> GSM154284 5 0.2300 0.9560 0.000 0.000 0.144 0.000 0.856 NA
#> GSM154285 5 0.2300 0.9560 0.000 0.000 0.144 0.000 0.856 NA
#> GSM154298 2 0.0260 0.9326 0.000 0.992 0.000 0.000 0.000 NA
#> GSM154299 2 0.1949 0.9221 0.000 0.904 0.000 0.004 0.004 NA
#> GSM154300 4 0.4898 0.7794 0.000 0.328 0.000 0.604 0.008 NA
#> GSM154313 2 0.0260 0.9326 0.000 0.992 0.000 0.000 0.000 NA
#> GSM154314 2 0.0260 0.9326 0.000 0.992 0.000 0.000 0.000 NA
#> GSM154315 4 0.3499 0.8332 0.000 0.320 0.000 0.680 0.000 NA
#> GSM154271 1 0.0000 0.7432 1.000 0.000 0.000 0.000 0.000 NA
#> GSM154272 1 0.0000 0.7432 1.000 0.000 0.000 0.000 0.000 NA
#> GSM154273 1 0.3847 0.7908 0.544 0.000 0.000 0.000 0.000 NA
#> GSM154286 3 0.4400 0.4206 0.000 0.000 0.684 0.000 0.248 NA
#> GSM154287 3 0.1584 0.6874 0.008 0.000 0.928 0.000 0.000 NA
#> GSM154288 4 0.6477 0.4109 0.000 0.036 0.024 0.552 0.144 NA
#> GSM154301 3 0.0363 0.7070 0.000 0.000 0.988 0.000 0.000 NA
#> GSM154302 3 0.0363 0.7070 0.000 0.000 0.988 0.000 0.000 NA
#> GSM154303 3 0.7688 0.0871 0.000 0.000 0.304 0.220 0.224 NA
#> GSM154316 3 0.0405 0.7075 0.000 0.000 0.988 0.004 0.000 NA
#> GSM154317 3 0.0000 0.7078 0.000 0.000 1.000 0.000 0.000 NA
#> GSM154318 3 0.0363 0.7070 0.000 0.000 0.988 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 agent(p) time(p) k
#> ATC:kmeans 58 0.003426 1.51e-04 2
#> ATC:kmeans 60 0.032695 2.96e-14 3
#> ATC:kmeans 59 0.014108 8.98e-15 4
#> ATC:kmeans 46 0.000228 2.48e-13 5
#> ATC:kmeans 54 0.000226 2.30e-16 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 38950 rows and 60 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 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.960 0.985 0.5067 0.492 0.492
#> 3 3 1.000 0.962 0.972 0.2592 0.831 0.667
#> 4 4 1.000 0.951 0.978 0.1280 0.899 0.724
#> 5 5 0.977 0.954 0.966 0.0432 0.969 0.887
#> 6 6 1.000 0.974 0.983 0.0298 0.977 0.907
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
#> GSM154259 1 0.0000 0.9983 1.000 0.000
#> GSM154260 1 0.0000 0.9983 1.000 0.000
#> GSM154261 1 0.0000 0.9983 1.000 0.000
#> GSM154274 1 0.0000 0.9983 1.000 0.000
#> GSM154275 1 0.0000 0.9983 1.000 0.000
#> GSM154276 1 0.2778 0.9476 0.952 0.048
#> GSM154289 2 0.0000 0.9693 0.000 1.000
#> GSM154290 2 0.0000 0.9693 0.000 1.000
#> GSM154291 2 0.0000 0.9693 0.000 1.000
#> GSM154304 2 0.0000 0.9693 0.000 1.000
#> GSM154305 2 0.0000 0.9693 0.000 1.000
#> GSM154306 2 0.0000 0.9693 0.000 1.000
#> GSM154262 1 0.0000 0.9983 1.000 0.000
#> GSM154263 1 0.0000 0.9983 1.000 0.000
#> GSM154264 1 0.0000 0.9983 1.000 0.000
#> GSM154277 2 0.0000 0.9693 0.000 1.000
#> GSM154278 1 0.0000 0.9983 1.000 0.000
#> GSM154279 1 0.0000 0.9983 1.000 0.000
#> GSM154292 2 0.0000 0.9693 0.000 1.000
#> GSM154293 2 0.0000 0.9693 0.000 1.000
#> GSM154294 2 0.0000 0.9693 0.000 1.000
#> GSM154307 2 0.0000 0.9693 0.000 1.000
#> GSM154308 2 0.0000 0.9693 0.000 1.000
#> GSM154309 2 0.0000 0.9693 0.000 1.000
#> GSM154265 1 0.0000 0.9983 1.000 0.000
#> GSM154266 1 0.0000 0.9983 1.000 0.000
#> GSM154267 1 0.0000 0.9983 1.000 0.000
#> GSM154280 1 0.0000 0.9983 1.000 0.000
#> GSM154281 1 0.0000 0.9983 1.000 0.000
#> GSM154282 1 0.0000 0.9983 1.000 0.000
#> GSM154295 2 0.0938 0.9588 0.012 0.988
#> GSM154296 2 0.0000 0.9693 0.000 1.000
#> GSM154297 2 0.0000 0.9693 0.000 1.000
#> GSM154310 2 0.9358 0.4671 0.352 0.648
#> GSM154311 2 0.9993 0.0942 0.484 0.516
#> GSM154312 1 0.0000 0.9983 1.000 0.000
#> GSM154268 1 0.0000 0.9983 1.000 0.000
#> GSM154269 1 0.0000 0.9983 1.000 0.000
#> GSM154270 1 0.0000 0.9983 1.000 0.000
#> GSM154283 2 0.0000 0.9693 0.000 1.000
#> GSM154284 2 0.0000 0.9693 0.000 1.000
#> GSM154285 2 0.0000 0.9693 0.000 1.000
#> GSM154298 2 0.0000 0.9693 0.000 1.000
#> GSM154299 2 0.0000 0.9693 0.000 1.000
#> GSM154300 2 0.0000 0.9693 0.000 1.000
#> GSM154313 2 0.0000 0.9693 0.000 1.000
#> GSM154314 2 0.0000 0.9693 0.000 1.000
#> GSM154315 2 0.0000 0.9693 0.000 1.000
#> GSM154271 1 0.0000 0.9983 1.000 0.000
#> GSM154272 1 0.0000 0.9983 1.000 0.000
#> GSM154273 1 0.0000 0.9983 1.000 0.000
#> GSM154286 1 0.0000 0.9983 1.000 0.000
#> GSM154287 1 0.0000 0.9983 1.000 0.000
#> GSM154288 2 0.0000 0.9693 0.000 1.000
#> GSM154301 1 0.0000 0.9983 1.000 0.000
#> GSM154302 1 0.0000 0.9983 1.000 0.000
#> GSM154303 2 0.0000 0.9693 0.000 1.000
#> GSM154316 1 0.0000 0.9983 1.000 0.000
#> GSM154317 1 0.0000 0.9983 1.000 0.000
#> GSM154318 1 0.0000 0.9983 1.000 0.000
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> GSM154259 1 0.0000 0.984 1.000 0.000 0.000
#> GSM154260 1 0.0000 0.984 1.000 0.000 0.000
#> GSM154261 1 0.0000 0.984 1.000 0.000 0.000
#> GSM154274 1 0.2448 0.930 0.924 0.000 0.076
#> GSM154275 1 0.1860 0.947 0.948 0.000 0.052
#> GSM154276 1 0.2448 0.930 0.924 0.000 0.076
#> GSM154289 2 0.0000 0.993 0.000 1.000 0.000
#> GSM154290 2 0.0000 0.993 0.000 1.000 0.000
#> GSM154291 2 0.0000 0.993 0.000 1.000 0.000
#> GSM154304 2 0.0000 0.993 0.000 1.000 0.000
#> GSM154305 2 0.0000 0.993 0.000 1.000 0.000
#> GSM154306 2 0.0000 0.993 0.000 1.000 0.000
#> GSM154262 1 0.0000 0.984 1.000 0.000 0.000
#> GSM154263 1 0.0000 0.984 1.000 0.000 0.000
#> GSM154264 1 0.0000 0.984 1.000 0.000 0.000
#> GSM154277 2 0.1860 0.951 0.000 0.948 0.052
#> GSM154278 1 0.2448 0.930 0.924 0.000 0.076
#> GSM154279 1 0.2448 0.930 0.924 0.000 0.076
#> GSM154292 2 0.0000 0.993 0.000 1.000 0.000
#> GSM154293 2 0.0000 0.993 0.000 1.000 0.000
#> GSM154294 2 0.0000 0.993 0.000 1.000 0.000
#> GSM154307 2 0.0000 0.993 0.000 1.000 0.000
#> GSM154308 2 0.0000 0.993 0.000 1.000 0.000
#> GSM154309 2 0.0000 0.993 0.000 1.000 0.000
#> GSM154265 1 0.0000 0.984 1.000 0.000 0.000
#> GSM154266 1 0.0000 0.984 1.000 0.000 0.000
#> GSM154267 1 0.0000 0.984 1.000 0.000 0.000
#> GSM154280 1 0.0000 0.984 1.000 0.000 0.000
#> GSM154281 1 0.0000 0.984 1.000 0.000 0.000
#> GSM154282 1 0.0000 0.984 1.000 0.000 0.000
#> GSM154295 3 0.1860 0.901 0.000 0.052 0.948
#> GSM154296 3 0.1860 0.901 0.000 0.052 0.948
#> GSM154297 3 0.1860 0.901 0.000 0.052 0.948
#> GSM154310 3 0.2152 0.910 0.016 0.036 0.948
#> GSM154311 3 0.2152 0.914 0.036 0.016 0.948
#> GSM154312 3 0.1860 0.912 0.052 0.000 0.948
#> GSM154268 1 0.0000 0.984 1.000 0.000 0.000
#> GSM154269 1 0.0000 0.984 1.000 0.000 0.000
#> GSM154270 1 0.0000 0.984 1.000 0.000 0.000
#> GSM154283 2 0.0424 0.987 0.000 0.992 0.008
#> GSM154284 2 0.2280 0.944 0.008 0.940 0.052
#> GSM154285 2 0.1860 0.951 0.000 0.948 0.052
#> GSM154298 2 0.0000 0.993 0.000 1.000 0.000
#> GSM154299 2 0.0000 0.993 0.000 1.000 0.000
#> GSM154300 2 0.0000 0.993 0.000 1.000 0.000
#> GSM154313 2 0.0000 0.993 0.000 1.000 0.000
#> GSM154314 2 0.0000 0.993 0.000 1.000 0.000
#> GSM154315 2 0.0000 0.993 0.000 1.000 0.000
#> GSM154271 1 0.0000 0.984 1.000 0.000 0.000
#> GSM154272 1 0.0000 0.984 1.000 0.000 0.000
#> GSM154273 1 0.0000 0.984 1.000 0.000 0.000
#> GSM154286 1 0.0000 0.984 1.000 0.000 0.000
#> GSM154287 1 0.0000 0.984 1.000 0.000 0.000
#> GSM154288 2 0.0000 0.993 0.000 1.000 0.000
#> GSM154301 3 0.4887 0.807 0.228 0.000 0.772
#> GSM154302 3 0.4887 0.807 0.228 0.000 0.772
#> GSM154303 2 0.0000 0.993 0.000 1.000 0.000
#> GSM154316 3 0.2448 0.909 0.076 0.000 0.924
#> GSM154317 3 0.2448 0.909 0.076 0.000 0.924
#> GSM154318 3 0.4887 0.807 0.228 0.000 0.772
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> GSM154259 1 0.000 1.000 1.000 0.000 0.000 0.000
#> GSM154260 1 0.000 1.000 1.000 0.000 0.000 0.000
#> GSM154261 1 0.000 1.000 1.000 0.000 0.000 0.000
#> GSM154274 4 0.000 1.000 0.000 0.000 0.000 1.000
#> GSM154275 4 0.000 1.000 0.000 0.000 0.000 1.000
#> GSM154276 4 0.000 1.000 0.000 0.000 0.000 1.000
#> GSM154289 2 0.000 0.995 0.000 1.000 0.000 0.000
#> GSM154290 2 0.000 0.995 0.000 1.000 0.000 0.000
#> GSM154291 2 0.000 0.995 0.000 1.000 0.000 0.000
#> GSM154304 2 0.000 0.995 0.000 1.000 0.000 0.000
#> GSM154305 2 0.000 0.995 0.000 1.000 0.000 0.000
#> GSM154306 2 0.000 0.995 0.000 1.000 0.000 0.000
#> GSM154262 1 0.000 1.000 1.000 0.000 0.000 0.000
#> GSM154263 1 0.000 1.000 1.000 0.000 0.000 0.000
#> GSM154264 1 0.000 1.000 1.000 0.000 0.000 0.000
#> GSM154277 4 0.000 1.000 0.000 0.000 0.000 1.000
#> GSM154278 4 0.000 1.000 0.000 0.000 0.000 1.000
#> GSM154279 4 0.000 1.000 0.000 0.000 0.000 1.000
#> GSM154292 2 0.000 0.995 0.000 1.000 0.000 0.000
#> GSM154293 2 0.000 0.995 0.000 1.000 0.000 0.000
#> GSM154294 2 0.000 0.995 0.000 1.000 0.000 0.000
#> GSM154307 2 0.000 0.995 0.000 1.000 0.000 0.000
#> GSM154308 2 0.000 0.995 0.000 1.000 0.000 0.000
#> GSM154309 2 0.000 0.995 0.000 1.000 0.000 0.000
#> GSM154265 1 0.000 1.000 1.000 0.000 0.000 0.000
#> GSM154266 1 0.000 1.000 1.000 0.000 0.000 0.000
#> GSM154267 1 0.000 1.000 1.000 0.000 0.000 0.000
#> GSM154280 1 0.000 1.000 1.000 0.000 0.000 0.000
#> GSM154281 1 0.000 1.000 1.000 0.000 0.000 0.000
#> GSM154282 1 0.000 1.000 1.000 0.000 0.000 0.000
#> GSM154295 3 0.000 0.838 0.000 0.000 1.000 0.000
#> GSM154296 3 0.000 0.838 0.000 0.000 1.000 0.000
#> GSM154297 3 0.000 0.838 0.000 0.000 1.000 0.000
#> GSM154310 3 0.000 0.838 0.000 0.000 1.000 0.000
#> GSM154311 3 0.000 0.838 0.000 0.000 1.000 0.000
#> GSM154312 3 0.000 0.838 0.000 0.000 1.000 0.000
#> GSM154268 1 0.000 1.000 1.000 0.000 0.000 0.000
#> GSM154269 1 0.000 1.000 1.000 0.000 0.000 0.000
#> GSM154270 1 0.000 1.000 1.000 0.000 0.000 0.000
#> GSM154283 2 0.222 0.899 0.000 0.908 0.000 0.092
#> GSM154284 4 0.000 1.000 0.000 0.000 0.000 1.000
#> GSM154285 4 0.000 1.000 0.000 0.000 0.000 1.000
#> GSM154298 2 0.000 0.995 0.000 1.000 0.000 0.000
#> GSM154299 2 0.000 0.995 0.000 1.000 0.000 0.000
#> GSM154300 2 0.000 0.995 0.000 1.000 0.000 0.000
#> GSM154313 2 0.000 0.995 0.000 1.000 0.000 0.000
#> GSM154314 2 0.000 0.995 0.000 1.000 0.000 0.000
#> GSM154315 2 0.000 0.995 0.000 1.000 0.000 0.000
#> GSM154271 1 0.000 1.000 1.000 0.000 0.000 0.000
#> GSM154272 1 0.000 1.000 1.000 0.000 0.000 0.000
#> GSM154273 1 0.000 1.000 1.000 0.000 0.000 0.000
#> GSM154286 1 0.000 1.000 1.000 0.000 0.000 0.000
#> GSM154287 1 0.000 1.000 1.000 0.000 0.000 0.000
#> GSM154288 2 0.000 0.995 0.000 1.000 0.000 0.000
#> GSM154301 3 0.479 0.525 0.380 0.000 0.620 0.000
#> GSM154302 3 0.479 0.525 0.380 0.000 0.620 0.000
#> GSM154303 2 0.000 0.995 0.000 1.000 0.000 0.000
#> GSM154316 3 0.112 0.831 0.036 0.000 0.964 0.000
#> GSM154317 3 0.112 0.831 0.036 0.000 0.964 0.000
#> GSM154318 3 0.479 0.525 0.380 0.000 0.620 0.000
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> GSM154259 1 0.0000 0.995 1.000 0.000 0.000 0.000 0.000
#> GSM154260 1 0.0000 0.995 1.000 0.000 0.000 0.000 0.000
#> GSM154261 1 0.0000 0.995 1.000 0.000 0.000 0.000 0.000
#> GSM154274 5 0.0000 0.949 0.000 0.000 0.000 0.000 1.000
#> GSM154275 5 0.0000 0.949 0.000 0.000 0.000 0.000 1.000
#> GSM154276 5 0.0000 0.949 0.000 0.000 0.000 0.000 1.000
#> GSM154289 2 0.0000 0.986 0.000 1.000 0.000 0.000 0.000
#> GSM154290 2 0.0000 0.986 0.000 1.000 0.000 0.000 0.000
#> GSM154291 2 0.0510 0.978 0.000 0.984 0.000 0.016 0.000
#> GSM154304 2 0.0000 0.986 0.000 1.000 0.000 0.000 0.000
#> GSM154305 2 0.0000 0.986 0.000 1.000 0.000 0.000 0.000
#> GSM154306 2 0.0510 0.978 0.000 0.984 0.000 0.016 0.000
#> GSM154262 1 0.0000 0.995 1.000 0.000 0.000 0.000 0.000
#> GSM154263 1 0.0000 0.995 1.000 0.000 0.000 0.000 0.000
#> GSM154264 1 0.0000 0.995 1.000 0.000 0.000 0.000 0.000
#> GSM154277 5 0.3177 0.825 0.000 0.000 0.000 0.208 0.792
#> GSM154278 5 0.0000 0.949 0.000 0.000 0.000 0.000 1.000
#> GSM154279 5 0.0000 0.949 0.000 0.000 0.000 0.000 1.000
#> GSM154292 2 0.0000 0.986 0.000 1.000 0.000 0.000 0.000
#> GSM154293 2 0.0000 0.986 0.000 1.000 0.000 0.000 0.000
#> GSM154294 2 0.0510 0.978 0.000 0.984 0.000 0.016 0.000
#> GSM154307 2 0.0000 0.986 0.000 1.000 0.000 0.000 0.000
#> GSM154308 2 0.0000 0.986 0.000 1.000 0.000 0.000 0.000
#> GSM154309 2 0.0000 0.986 0.000 1.000 0.000 0.000 0.000
#> GSM154265 1 0.0000 0.995 1.000 0.000 0.000 0.000 0.000
#> GSM154266 1 0.0000 0.995 1.000 0.000 0.000 0.000 0.000
#> GSM154267 1 0.0000 0.995 1.000 0.000 0.000 0.000 0.000
#> GSM154280 1 0.0880 0.969 0.968 0.000 0.000 0.000 0.032
#> GSM154281 1 0.0880 0.969 0.968 0.000 0.000 0.000 0.032
#> GSM154282 1 0.0880 0.969 0.968 0.000 0.000 0.000 0.032
#> GSM154295 3 0.0000 1.000 0.000 0.000 1.000 0.000 0.000
#> GSM154296 3 0.0000 1.000 0.000 0.000 1.000 0.000 0.000
#> GSM154297 3 0.0000 1.000 0.000 0.000 1.000 0.000 0.000
#> GSM154310 3 0.0000 1.000 0.000 0.000 1.000 0.000 0.000
#> GSM154311 3 0.0000 1.000 0.000 0.000 1.000 0.000 0.000
#> GSM154312 3 0.0000 1.000 0.000 0.000 1.000 0.000 0.000
#> GSM154268 1 0.0000 0.995 1.000 0.000 0.000 0.000 0.000
#> GSM154269 1 0.0000 0.995 1.000 0.000 0.000 0.000 0.000
#> GSM154270 1 0.0000 0.995 1.000 0.000 0.000 0.000 0.000
#> GSM154283 2 0.0000 0.986 0.000 1.000 0.000 0.000 0.000
#> GSM154284 5 0.0000 0.949 0.000 0.000 0.000 0.000 1.000
#> GSM154285 5 0.3003 0.840 0.000 0.000 0.000 0.188 0.812
#> GSM154298 2 0.0000 0.986 0.000 1.000 0.000 0.000 0.000
#> GSM154299 2 0.0000 0.986 0.000 1.000 0.000 0.000 0.000
#> GSM154300 2 0.0162 0.984 0.000 0.996 0.000 0.004 0.000
#> GSM154313 2 0.0000 0.986 0.000 1.000 0.000 0.000 0.000
#> GSM154314 2 0.0000 0.986 0.000 1.000 0.000 0.000 0.000
#> GSM154315 2 0.0510 0.978 0.000 0.984 0.000 0.016 0.000
#> GSM154271 1 0.0000 0.995 1.000 0.000 0.000 0.000 0.000
#> GSM154272 1 0.0000 0.995 1.000 0.000 0.000 0.000 0.000
#> GSM154273 1 0.0000 0.995 1.000 0.000 0.000 0.000 0.000
#> GSM154286 1 0.0000 0.995 1.000 0.000 0.000 0.000 0.000
#> GSM154287 1 0.0000 0.995 1.000 0.000 0.000 0.000 0.000
#> GSM154288 2 0.3177 0.762 0.000 0.792 0.000 0.208 0.000
#> GSM154301 4 0.3875 0.847 0.048 0.000 0.160 0.792 0.000
#> GSM154302 4 0.3904 0.843 0.052 0.000 0.156 0.792 0.000
#> GSM154303 4 0.3452 0.446 0.000 0.244 0.000 0.756 0.000
#> GSM154316 4 0.3388 0.826 0.008 0.000 0.200 0.792 0.000
#> GSM154317 4 0.3388 0.826 0.008 0.000 0.200 0.792 0.000
#> GSM154318 4 0.3875 0.847 0.048 0.000 0.160 0.792 0.000
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> GSM154259 1 0.0000 0.988 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM154260 1 0.0000 0.988 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM154261 1 0.0000 0.988 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM154274 5 0.0000 0.995 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM154275 5 0.0146 0.994 0.000 0.000 0.000 0.004 0.996 0.000
#> GSM154276 5 0.0000 0.995 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM154289 2 0.0146 0.982 0.000 0.996 0.000 0.000 0.000 0.004
#> GSM154290 2 0.0000 0.981 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM154291 2 0.1501 0.932 0.000 0.924 0.000 0.076 0.000 0.000
#> GSM154304 2 0.0146 0.982 0.000 0.996 0.000 0.000 0.000 0.004
#> GSM154305 2 0.0000 0.981 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM154306 2 0.1444 0.935 0.000 0.928 0.000 0.072 0.000 0.000
#> GSM154262 1 0.0000 0.988 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM154263 1 0.0000 0.988 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM154264 1 0.0000 0.988 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM154277 4 0.0632 0.908 0.000 0.000 0.000 0.976 0.024 0.000
#> GSM154278 5 0.0146 0.994 0.000 0.000 0.000 0.000 0.996 0.004
#> GSM154279 5 0.0146 0.994 0.000 0.000 0.000 0.000 0.996 0.004
#> GSM154292 2 0.0000 0.981 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM154293 2 0.0000 0.981 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM154294 2 0.1444 0.935 0.000 0.928 0.000 0.072 0.000 0.000
#> GSM154307 2 0.0146 0.982 0.000 0.996 0.000 0.000 0.000 0.004
#> GSM154308 2 0.0146 0.982 0.000 0.996 0.000 0.000 0.000 0.004
#> GSM154309 2 0.0146 0.982 0.000 0.996 0.000 0.000 0.000 0.004
#> GSM154265 1 0.0000 0.988 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM154266 1 0.0000 0.988 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM154267 1 0.0000 0.988 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM154280 1 0.1882 0.937 0.928 0.000 0.000 0.020 0.028 0.024
#> GSM154281 1 0.1882 0.937 0.928 0.000 0.000 0.020 0.028 0.024
#> GSM154282 1 0.2032 0.930 0.920 0.000 0.000 0.020 0.036 0.024
#> GSM154295 3 0.0000 1.000 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM154296 3 0.0000 1.000 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM154297 3 0.0000 1.000 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM154310 3 0.0000 1.000 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM154311 3 0.0000 1.000 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM154312 3 0.0000 1.000 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM154268 1 0.0000 0.988 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM154269 1 0.0000 0.988 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM154270 1 0.0000 0.988 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM154283 2 0.0260 0.980 0.000 0.992 0.000 0.000 0.000 0.008
#> GSM154284 5 0.0405 0.989 0.000 0.000 0.000 0.008 0.988 0.004
#> GSM154285 4 0.2933 0.750 0.000 0.000 0.000 0.796 0.200 0.004
#> GSM154298 2 0.0146 0.982 0.000 0.996 0.000 0.000 0.000 0.004
#> GSM154299 2 0.0000 0.981 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM154300 2 0.0000 0.981 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM154313 2 0.0146 0.982 0.000 0.996 0.000 0.000 0.000 0.004
#> GSM154314 2 0.0146 0.982 0.000 0.996 0.000 0.000 0.000 0.004
#> GSM154315 2 0.1444 0.935 0.000 0.928 0.000 0.072 0.000 0.000
#> GSM154271 1 0.0000 0.988 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM154272 1 0.0000 0.988 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM154273 1 0.0000 0.988 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM154286 1 0.0520 0.979 0.984 0.000 0.000 0.008 0.000 0.008
#> GSM154287 1 0.0146 0.986 0.996 0.000 0.000 0.000 0.000 0.004
#> GSM154288 4 0.0632 0.898 0.000 0.024 0.000 0.976 0.000 0.000
#> GSM154301 6 0.0891 0.995 0.008 0.000 0.024 0.000 0.000 0.968
#> GSM154302 6 0.0806 0.992 0.008 0.000 0.020 0.000 0.000 0.972
#> GSM154303 4 0.0692 0.903 0.000 0.004 0.000 0.976 0.000 0.020
#> GSM154316 6 0.0858 0.994 0.004 0.000 0.028 0.000 0.000 0.968
#> GSM154317 6 0.0858 0.994 0.004 0.000 0.028 0.000 0.000 0.968
#> GSM154318 6 0.0891 0.995 0.008 0.000 0.024 0.000 0.000 0.968
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 agent(p) time(p) k
#> ATC:skmeans 58 3.98e-02 7.47e-06 2
#> ATC:skmeans 60 2.76e-04 9.32e-09 3
#> ATC:skmeans 60 8.88e-04 2.11e-13 4
#> ATC:skmeans 59 1.59e-07 9.53e-12 5
#> ATC:skmeans 60 3.84e-07 5.17e-11 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 38950 rows and 60 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 0.691 0.844 0.926 0.4828 0.519 0.519
#> 3 3 0.974 0.930 0.974 0.3766 0.677 0.450
#> 4 4 0.830 0.916 0.945 0.0778 0.920 0.774
#> 5 5 0.946 0.953 0.978 0.1029 0.906 0.689
#> 6 6 1.000 0.963 0.970 0.0346 0.973 0.873
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] 3 5
There is also optional best \(k\) = 3 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
#> GSM154259 1 0.000 0.971 1.000 0.000
#> GSM154260 1 0.000 0.971 1.000 0.000
#> GSM154261 1 0.000 0.971 1.000 0.000
#> GSM154274 2 0.939 0.582 0.356 0.644
#> GSM154275 2 0.939 0.582 0.356 0.644
#> GSM154276 2 0.939 0.582 0.356 0.644
#> GSM154289 2 0.000 0.876 0.000 1.000
#> GSM154290 2 0.000 0.876 0.000 1.000
#> GSM154291 2 0.000 0.876 0.000 1.000
#> GSM154304 2 0.000 0.876 0.000 1.000
#> GSM154305 2 0.000 0.876 0.000 1.000
#> GSM154306 2 0.000 0.876 0.000 1.000
#> GSM154262 1 0.000 0.971 1.000 0.000
#> GSM154263 1 0.000 0.971 1.000 0.000
#> GSM154264 1 0.000 0.971 1.000 0.000
#> GSM154277 2 0.000 0.876 0.000 1.000
#> GSM154278 2 0.939 0.582 0.356 0.644
#> GSM154279 2 0.939 0.582 0.356 0.644
#> GSM154292 2 0.000 0.876 0.000 1.000
#> GSM154293 2 0.000 0.876 0.000 1.000
#> GSM154294 2 0.000 0.876 0.000 1.000
#> GSM154307 2 0.000 0.876 0.000 1.000
#> GSM154308 2 0.000 0.876 0.000 1.000
#> GSM154309 2 0.000 0.876 0.000 1.000
#> GSM154265 1 0.000 0.971 1.000 0.000
#> GSM154266 1 0.000 0.971 1.000 0.000
#> GSM154267 1 0.000 0.971 1.000 0.000
#> GSM154280 1 0.163 0.958 0.976 0.024
#> GSM154281 1 0.163 0.958 0.976 0.024
#> GSM154282 1 0.163 0.958 0.976 0.024
#> GSM154295 2 0.939 0.582 0.356 0.644
#> GSM154296 2 0.000 0.876 0.000 1.000
#> GSM154297 2 0.163 0.862 0.024 0.976
#> GSM154310 2 0.939 0.582 0.356 0.644
#> GSM154311 2 0.939 0.582 0.356 0.644
#> GSM154312 2 0.939 0.582 0.356 0.644
#> GSM154268 1 0.000 0.971 1.000 0.000
#> GSM154269 1 0.000 0.971 1.000 0.000
#> GSM154270 1 0.000 0.971 1.000 0.000
#> GSM154283 2 0.000 0.876 0.000 1.000
#> GSM154284 2 0.000 0.876 0.000 1.000
#> GSM154285 2 0.000 0.876 0.000 1.000
#> GSM154298 2 0.000 0.876 0.000 1.000
#> GSM154299 2 0.000 0.876 0.000 1.000
#> GSM154300 2 0.000 0.876 0.000 1.000
#> GSM154313 2 0.000 0.876 0.000 1.000
#> GSM154314 2 0.000 0.876 0.000 1.000
#> GSM154315 2 0.000 0.876 0.000 1.000
#> GSM154271 1 0.000 0.971 1.000 0.000
#> GSM154272 1 0.000 0.971 1.000 0.000
#> GSM154273 1 0.000 0.971 1.000 0.000
#> GSM154286 1 0.163 0.958 0.976 0.024
#> GSM154287 1 0.000 0.971 1.000 0.000
#> GSM154288 2 0.000 0.876 0.000 1.000
#> GSM154301 1 0.163 0.958 0.976 0.024
#> GSM154302 1 0.961 0.201 0.616 0.384
#> GSM154303 2 0.000 0.876 0.000 1.000
#> GSM154316 2 0.939 0.582 0.356 0.644
#> GSM154317 2 0.939 0.582 0.356 0.644
#> GSM154318 1 0.163 0.958 0.976 0.024
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> GSM154259 1 0.000 0.971 1.000 0.000 0.000
#> GSM154260 1 0.000 0.971 1.000 0.000 0.000
#> GSM154261 1 0.000 0.971 1.000 0.000 0.000
#> GSM154274 3 0.000 0.988 0.000 0.000 1.000
#> GSM154275 3 0.000 0.988 0.000 0.000 1.000
#> GSM154276 3 0.000 0.988 0.000 0.000 1.000
#> GSM154289 2 0.000 0.947 0.000 1.000 0.000
#> GSM154290 2 0.000 0.947 0.000 1.000 0.000
#> GSM154291 2 0.000 0.947 0.000 1.000 0.000
#> GSM154304 2 0.000 0.947 0.000 1.000 0.000
#> GSM154305 2 0.000 0.947 0.000 1.000 0.000
#> GSM154306 2 0.000 0.947 0.000 1.000 0.000
#> GSM154262 1 0.000 0.971 1.000 0.000 0.000
#> GSM154263 1 0.000 0.971 1.000 0.000 0.000
#> GSM154264 1 0.000 0.971 1.000 0.000 0.000
#> GSM154277 3 0.435 0.761 0.000 0.184 0.816
#> GSM154278 3 0.000 0.988 0.000 0.000 1.000
#> GSM154279 3 0.000 0.988 0.000 0.000 1.000
#> GSM154292 2 0.000 0.947 0.000 1.000 0.000
#> GSM154293 2 0.000 0.947 0.000 1.000 0.000
#> GSM154294 2 0.000 0.947 0.000 1.000 0.000
#> GSM154307 2 0.000 0.947 0.000 1.000 0.000
#> GSM154308 2 0.000 0.947 0.000 1.000 0.000
#> GSM154309 2 0.000 0.947 0.000 1.000 0.000
#> GSM154265 1 0.000 0.971 1.000 0.000 0.000
#> GSM154266 1 0.000 0.971 1.000 0.000 0.000
#> GSM154267 1 0.000 0.971 1.000 0.000 0.000
#> GSM154280 3 0.000 0.988 0.000 0.000 1.000
#> GSM154281 3 0.000 0.988 0.000 0.000 1.000
#> GSM154282 3 0.000 0.988 0.000 0.000 1.000
#> GSM154295 3 0.000 0.988 0.000 0.000 1.000
#> GSM154296 3 0.000 0.988 0.000 0.000 1.000
#> GSM154297 3 0.000 0.988 0.000 0.000 1.000
#> GSM154310 3 0.000 0.988 0.000 0.000 1.000
#> GSM154311 3 0.000 0.988 0.000 0.000 1.000
#> GSM154312 3 0.000 0.988 0.000 0.000 1.000
#> GSM154268 1 0.000 0.971 1.000 0.000 0.000
#> GSM154269 1 0.000 0.971 1.000 0.000 0.000
#> GSM154270 1 0.000 0.971 1.000 0.000 0.000
#> GSM154283 2 0.625 0.222 0.000 0.556 0.444
#> GSM154284 3 0.164 0.947 0.000 0.044 0.956
#> GSM154285 3 0.116 0.963 0.000 0.028 0.972
#> GSM154298 2 0.000 0.947 0.000 1.000 0.000
#> GSM154299 2 0.000 0.947 0.000 1.000 0.000
#> GSM154300 2 0.000 0.947 0.000 1.000 0.000
#> GSM154313 2 0.000 0.947 0.000 1.000 0.000
#> GSM154314 2 0.000 0.947 0.000 1.000 0.000
#> GSM154315 2 0.000 0.947 0.000 1.000 0.000
#> GSM154271 1 0.000 0.971 1.000 0.000 0.000
#> GSM154272 1 0.000 0.971 1.000 0.000 0.000
#> GSM154273 1 0.000 0.971 1.000 0.000 0.000
#> GSM154286 3 0.000 0.988 0.000 0.000 1.000
#> GSM154287 1 0.615 0.325 0.592 0.000 0.408
#> GSM154288 2 0.625 0.222 0.000 0.556 0.444
#> GSM154301 3 0.000 0.988 0.000 0.000 1.000
#> GSM154302 3 0.000 0.988 0.000 0.000 1.000
#> GSM154303 3 0.000 0.988 0.000 0.000 1.000
#> GSM154316 3 0.000 0.988 0.000 0.000 1.000
#> GSM154317 3 0.000 0.988 0.000 0.000 1.000
#> GSM154318 3 0.000 0.988 0.000 0.000 1.000
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> GSM154259 1 0.0000 1.000 1.000 0.000 0.000 0.000
#> GSM154260 1 0.0000 1.000 1.000 0.000 0.000 0.000
#> GSM154261 1 0.0000 1.000 1.000 0.000 0.000 0.000
#> GSM154274 3 0.3271 0.881 0.000 0.012 0.856 0.132
#> GSM154275 3 0.2814 0.888 0.000 0.000 0.868 0.132
#> GSM154276 3 0.2814 0.888 0.000 0.000 0.868 0.132
#> GSM154289 2 0.0000 0.934 0.000 1.000 0.000 0.000
#> GSM154290 2 0.0188 0.932 0.000 0.996 0.004 0.000
#> GSM154291 4 0.2814 1.000 0.000 0.132 0.000 0.868
#> GSM154304 2 0.0000 0.934 0.000 1.000 0.000 0.000
#> GSM154305 4 0.2814 1.000 0.000 0.132 0.000 0.868
#> GSM154306 4 0.2814 1.000 0.000 0.132 0.000 0.868
#> GSM154262 1 0.0000 1.000 1.000 0.000 0.000 0.000
#> GSM154263 1 0.0000 1.000 1.000 0.000 0.000 0.000
#> GSM154264 1 0.0000 1.000 1.000 0.000 0.000 0.000
#> GSM154277 2 0.4312 0.734 0.000 0.812 0.056 0.132
#> GSM154278 3 0.2814 0.888 0.000 0.000 0.868 0.132
#> GSM154279 3 0.2814 0.888 0.000 0.000 0.868 0.132
#> GSM154292 2 0.0188 0.932 0.000 0.996 0.004 0.000
#> GSM154293 2 0.0000 0.934 0.000 1.000 0.000 0.000
#> GSM154294 2 0.0000 0.934 0.000 1.000 0.000 0.000
#> GSM154307 2 0.0000 0.934 0.000 1.000 0.000 0.000
#> GSM154308 2 0.0000 0.934 0.000 1.000 0.000 0.000
#> GSM154309 2 0.0000 0.934 0.000 1.000 0.000 0.000
#> GSM154265 1 0.0000 1.000 1.000 0.000 0.000 0.000
#> GSM154266 1 0.0000 1.000 1.000 0.000 0.000 0.000
#> GSM154267 1 0.0000 1.000 1.000 0.000 0.000 0.000
#> GSM154280 3 0.2814 0.888 0.000 0.000 0.868 0.132
#> GSM154281 3 0.2814 0.888 0.000 0.000 0.868 0.132
#> GSM154282 3 0.2814 0.888 0.000 0.000 0.868 0.132
#> GSM154295 3 0.0000 0.914 0.000 0.000 1.000 0.000
#> GSM154296 3 0.0000 0.914 0.000 0.000 1.000 0.000
#> GSM154297 3 0.0000 0.914 0.000 0.000 1.000 0.000
#> GSM154310 3 0.0000 0.914 0.000 0.000 1.000 0.000
#> GSM154311 3 0.0000 0.914 0.000 0.000 1.000 0.000
#> GSM154312 3 0.0000 0.914 0.000 0.000 1.000 0.000
#> GSM154268 1 0.0000 1.000 1.000 0.000 0.000 0.000
#> GSM154269 1 0.0000 1.000 1.000 0.000 0.000 0.000
#> GSM154270 1 0.0000 1.000 1.000 0.000 0.000 0.000
#> GSM154283 2 0.3099 0.813 0.000 0.876 0.020 0.104
#> GSM154284 3 0.6478 0.603 0.000 0.236 0.632 0.132
#> GSM154285 3 0.5932 0.704 0.000 0.172 0.696 0.132
#> GSM154298 2 0.0000 0.934 0.000 1.000 0.000 0.000
#> GSM154299 2 0.0000 0.934 0.000 1.000 0.000 0.000
#> GSM154300 2 0.3942 0.625 0.000 0.764 0.000 0.236
#> GSM154313 2 0.0000 0.934 0.000 1.000 0.000 0.000
#> GSM154314 2 0.0000 0.934 0.000 1.000 0.000 0.000
#> GSM154315 4 0.2814 1.000 0.000 0.132 0.000 0.868
#> GSM154271 1 0.0000 1.000 1.000 0.000 0.000 0.000
#> GSM154272 1 0.0000 1.000 1.000 0.000 0.000 0.000
#> GSM154273 1 0.0000 1.000 1.000 0.000 0.000 0.000
#> GSM154286 3 0.0000 0.914 0.000 0.000 1.000 0.000
#> GSM154287 3 0.2973 0.771 0.144 0.000 0.856 0.000
#> GSM154288 2 0.4795 0.604 0.000 0.696 0.012 0.292
#> GSM154301 3 0.0000 0.914 0.000 0.000 1.000 0.000
#> GSM154302 3 0.0000 0.914 0.000 0.000 1.000 0.000
#> GSM154303 3 0.1474 0.879 0.000 0.052 0.948 0.000
#> GSM154316 3 0.0000 0.914 0.000 0.000 1.000 0.000
#> GSM154317 3 0.0000 0.914 0.000 0.000 1.000 0.000
#> GSM154318 3 0.0000 0.914 0.000 0.000 1.000 0.000
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> GSM154259 1 0.0000 1.000 1 0.000 0.000 0.000 0.000
#> GSM154260 1 0.0000 1.000 1 0.000 0.000 0.000 0.000
#> GSM154261 1 0.0000 1.000 1 0.000 0.000 0.000 0.000
#> GSM154274 5 0.0794 0.952 0 0.000 0.028 0.000 0.972
#> GSM154275 5 0.0000 0.973 0 0.000 0.000 0.000 1.000
#> GSM154276 5 0.0000 0.973 0 0.000 0.000 0.000 1.000
#> GSM154289 2 0.0000 0.958 0 1.000 0.000 0.000 0.000
#> GSM154290 2 0.0000 0.958 0 1.000 0.000 0.000 0.000
#> GSM154291 4 0.0000 1.000 0 0.000 0.000 1.000 0.000
#> GSM154304 2 0.0000 0.958 0 1.000 0.000 0.000 0.000
#> GSM154305 4 0.0000 1.000 0 0.000 0.000 1.000 0.000
#> GSM154306 4 0.0000 1.000 0 0.000 0.000 1.000 0.000
#> GSM154262 1 0.0000 1.000 1 0.000 0.000 0.000 0.000
#> GSM154263 1 0.0000 1.000 1 0.000 0.000 0.000 0.000
#> GSM154264 1 0.0000 1.000 1 0.000 0.000 0.000 0.000
#> GSM154277 5 0.2843 0.780 0 0.144 0.008 0.000 0.848
#> GSM154278 5 0.0000 0.973 0 0.000 0.000 0.000 1.000
#> GSM154279 5 0.0000 0.973 0 0.000 0.000 0.000 1.000
#> GSM154292 2 0.0000 0.958 0 1.000 0.000 0.000 0.000
#> GSM154293 2 0.0000 0.958 0 1.000 0.000 0.000 0.000
#> GSM154294 2 0.0000 0.958 0 1.000 0.000 0.000 0.000
#> GSM154307 2 0.0000 0.958 0 1.000 0.000 0.000 0.000
#> GSM154308 2 0.0000 0.958 0 1.000 0.000 0.000 0.000
#> GSM154309 2 0.0000 0.958 0 1.000 0.000 0.000 0.000
#> GSM154265 1 0.0000 1.000 1 0.000 0.000 0.000 0.000
#> GSM154266 1 0.0000 1.000 1 0.000 0.000 0.000 0.000
#> GSM154267 1 0.0000 1.000 1 0.000 0.000 0.000 0.000
#> GSM154280 5 0.0000 0.973 0 0.000 0.000 0.000 1.000
#> GSM154281 5 0.0000 0.973 0 0.000 0.000 0.000 1.000
#> GSM154282 5 0.0000 0.973 0 0.000 0.000 0.000 1.000
#> GSM154295 3 0.0000 0.954 0 0.000 1.000 0.000 0.000
#> GSM154296 3 0.0000 0.954 0 0.000 1.000 0.000 0.000
#> GSM154297 3 0.0000 0.954 0 0.000 1.000 0.000 0.000
#> GSM154310 3 0.0000 0.954 0 0.000 1.000 0.000 0.000
#> GSM154311 3 0.0000 0.954 0 0.000 1.000 0.000 0.000
#> GSM154312 3 0.0000 0.954 0 0.000 1.000 0.000 0.000
#> GSM154268 1 0.0000 1.000 1 0.000 0.000 0.000 0.000
#> GSM154269 1 0.0000 1.000 1 0.000 0.000 0.000 0.000
#> GSM154270 1 0.0000 1.000 1 0.000 0.000 0.000 0.000
#> GSM154283 2 0.2358 0.851 0 0.888 0.008 0.000 0.104
#> GSM154284 5 0.0000 0.973 0 0.000 0.000 0.000 1.000
#> GSM154285 5 0.0703 0.956 0 0.000 0.024 0.000 0.976
#> GSM154298 2 0.0000 0.958 0 1.000 0.000 0.000 0.000
#> GSM154299 2 0.0000 0.958 0 1.000 0.000 0.000 0.000
#> GSM154300 2 0.3480 0.678 0 0.752 0.000 0.248 0.000
#> GSM154313 2 0.0000 0.958 0 1.000 0.000 0.000 0.000
#> GSM154314 2 0.0000 0.958 0 1.000 0.000 0.000 0.000
#> GSM154315 4 0.0000 1.000 0 0.000 0.000 1.000 0.000
#> GSM154271 1 0.0000 1.000 1 0.000 0.000 0.000 0.000
#> GSM154272 1 0.0000 1.000 1 0.000 0.000 0.000 0.000
#> GSM154273 1 0.0000 1.000 1 0.000 0.000 0.000 0.000
#> GSM154286 3 0.2648 0.851 0 0.000 0.848 0.000 0.152
#> GSM154287 3 0.2648 0.851 0 0.000 0.848 0.000 0.152
#> GSM154288 2 0.3612 0.708 0 0.764 0.008 0.228 0.000
#> GSM154301 3 0.0000 0.954 0 0.000 1.000 0.000 0.000
#> GSM154302 3 0.2561 0.857 0 0.000 0.856 0.000 0.144
#> GSM154303 3 0.1205 0.923 0 0.040 0.956 0.000 0.004
#> GSM154316 3 0.0000 0.954 0 0.000 1.000 0.000 0.000
#> GSM154317 3 0.0000 0.954 0 0.000 1.000 0.000 0.000
#> GSM154318 3 0.0963 0.936 0 0.000 0.964 0.000 0.036
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> GSM154259 1 0.0000 1.000 1 0.000 0.000 0.000 0.000 0.000
#> GSM154260 1 0.0000 1.000 1 0.000 0.000 0.000 0.000 0.000
#> GSM154261 1 0.0000 1.000 1 0.000 0.000 0.000 0.000 0.000
#> GSM154274 5 0.0458 0.977 0 0.000 0.000 0.000 0.984 0.016
#> GSM154275 5 0.0000 0.990 0 0.000 0.000 0.000 1.000 0.000
#> GSM154276 5 0.0000 0.990 0 0.000 0.000 0.000 1.000 0.000
#> GSM154289 2 0.0000 0.930 0 1.000 0.000 0.000 0.000 0.000
#> GSM154290 2 0.0000 0.930 0 1.000 0.000 0.000 0.000 0.000
#> GSM154291 4 0.0000 1.000 0 0.000 0.000 1.000 0.000 0.000
#> GSM154304 2 0.1575 0.932 0 0.936 0.032 0.000 0.000 0.032
#> GSM154305 4 0.0000 1.000 0 0.000 0.000 1.000 0.000 0.000
#> GSM154306 4 0.0000 1.000 0 0.000 0.000 1.000 0.000 0.000
#> GSM154262 1 0.0000 1.000 1 0.000 0.000 0.000 0.000 0.000
#> GSM154263 1 0.0000 1.000 1 0.000 0.000 0.000 0.000 0.000
#> GSM154264 1 0.0000 1.000 1 0.000 0.000 0.000 0.000 0.000
#> GSM154277 5 0.1349 0.928 0 0.056 0.000 0.000 0.940 0.004
#> GSM154278 5 0.0000 0.990 0 0.000 0.000 0.000 1.000 0.000
#> GSM154279 5 0.0000 0.990 0 0.000 0.000 0.000 1.000 0.000
#> GSM154292 2 0.0000 0.930 0 1.000 0.000 0.000 0.000 0.000
#> GSM154293 2 0.0000 0.930 0 1.000 0.000 0.000 0.000 0.000
#> GSM154294 2 0.0000 0.930 0 1.000 0.000 0.000 0.000 0.000
#> GSM154307 2 0.1575 0.932 0 0.936 0.032 0.000 0.000 0.032
#> GSM154308 2 0.1575 0.932 0 0.936 0.032 0.000 0.000 0.032
#> GSM154309 2 0.1575 0.932 0 0.936 0.032 0.000 0.000 0.032
#> GSM154265 1 0.0000 1.000 1 0.000 0.000 0.000 0.000 0.000
#> GSM154266 1 0.0000 1.000 1 0.000 0.000 0.000 0.000 0.000
#> GSM154267 1 0.0000 1.000 1 0.000 0.000 0.000 0.000 0.000
#> GSM154280 5 0.0000 0.990 0 0.000 0.000 0.000 1.000 0.000
#> GSM154281 5 0.0000 0.990 0 0.000 0.000 0.000 1.000 0.000
#> GSM154282 5 0.0000 0.990 0 0.000 0.000 0.000 1.000 0.000
#> GSM154295 6 0.0790 1.000 0 0.000 0.032 0.000 0.000 0.968
#> GSM154296 6 0.0790 1.000 0 0.000 0.032 0.000 0.000 0.968
#> GSM154297 6 0.0790 1.000 0 0.000 0.032 0.000 0.000 0.968
#> GSM154310 6 0.0790 1.000 0 0.000 0.032 0.000 0.000 0.968
#> GSM154311 6 0.0790 1.000 0 0.000 0.032 0.000 0.000 0.968
#> GSM154312 6 0.0790 1.000 0 0.000 0.032 0.000 0.000 0.968
#> GSM154268 1 0.0000 1.000 1 0.000 0.000 0.000 0.000 0.000
#> GSM154269 1 0.0000 1.000 1 0.000 0.000 0.000 0.000 0.000
#> GSM154270 1 0.0000 1.000 1 0.000 0.000 0.000 0.000 0.000
#> GSM154283 2 0.2006 0.842 0 0.892 0.000 0.000 0.104 0.004
#> GSM154284 5 0.0000 0.990 0 0.000 0.000 0.000 1.000 0.000
#> GSM154285 5 0.0260 0.984 0 0.000 0.000 0.000 0.992 0.008
#> GSM154298 2 0.1575 0.932 0 0.936 0.032 0.000 0.000 0.032
#> GSM154299 2 0.0000 0.930 0 1.000 0.000 0.000 0.000 0.000
#> GSM154300 2 0.3023 0.697 0 0.768 0.000 0.232 0.000 0.000
#> GSM154313 2 0.1575 0.932 0 0.936 0.032 0.000 0.000 0.032
#> GSM154314 2 0.1575 0.932 0 0.936 0.032 0.000 0.000 0.032
#> GSM154315 4 0.0000 1.000 0 0.000 0.000 1.000 0.000 0.000
#> GSM154271 1 0.0000 1.000 1 0.000 0.000 0.000 0.000 0.000
#> GSM154272 1 0.0000 1.000 1 0.000 0.000 0.000 0.000 0.000
#> GSM154273 1 0.0000 1.000 1 0.000 0.000 0.000 0.000 0.000
#> GSM154286 3 0.1267 0.946 0 0.000 0.940 0.000 0.060 0.000
#> GSM154287 3 0.1267 0.946 0 0.000 0.940 0.000 0.060 0.000
#> GSM154288 2 0.3641 0.684 0 0.748 0.028 0.224 0.000 0.000
#> GSM154301 3 0.1267 0.959 0 0.000 0.940 0.000 0.000 0.060
#> GSM154302 3 0.1267 0.946 0 0.000 0.940 0.000 0.060 0.000
#> GSM154303 3 0.1082 0.959 0 0.000 0.956 0.000 0.004 0.040
#> GSM154316 3 0.1267 0.959 0 0.000 0.940 0.000 0.000 0.060
#> GSM154317 3 0.1267 0.959 0 0.000 0.940 0.000 0.000 0.060
#> GSM154318 3 0.1461 0.961 0 0.000 0.940 0.000 0.016 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 agent(p) time(p) k
#> ATC:pam 59 1.70e-01 5.11e-08 2
#> ATC:pam 57 1.22e-02 5.88e-14 3
#> ATC:pam 60 3.69e-03 7.23e-12 4
#> ATC:pam 60 2.86e-04 2.57e-16 5
#> ATC:pam 60 1.16e-08 3.51e-15 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 38950 rows and 60 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 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 0.999 0.999 0.3814 0.619 0.619
#> 3 3 1 0.995 0.996 0.4806 0.817 0.704
#> 4 4 1 0.978 0.991 0.2649 0.819 0.597
#> 5 5 1 0.960 0.980 0.1024 0.855 0.546
#> 6 6 1 0.987 0.987 0.0483 0.963 0.826
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
#> GSM154259 1 0.000 0.998 1.000 0.000
#> GSM154260 1 0.204 0.967 0.968 0.032
#> GSM154261 1 0.000 0.998 1.000 0.000
#> GSM154274 2 0.000 1.000 0.000 1.000
#> GSM154275 2 0.000 1.000 0.000 1.000
#> GSM154276 2 0.000 1.000 0.000 1.000
#> GSM154289 2 0.000 1.000 0.000 1.000
#> GSM154290 2 0.000 1.000 0.000 1.000
#> GSM154291 2 0.000 1.000 0.000 1.000
#> GSM154304 2 0.000 1.000 0.000 1.000
#> GSM154305 2 0.000 1.000 0.000 1.000
#> GSM154306 2 0.000 1.000 0.000 1.000
#> GSM154262 1 0.000 0.998 1.000 0.000
#> GSM154263 1 0.000 0.998 1.000 0.000
#> GSM154264 1 0.000 0.998 1.000 0.000
#> GSM154277 2 0.000 1.000 0.000 1.000
#> GSM154278 2 0.000 1.000 0.000 1.000
#> GSM154279 2 0.000 1.000 0.000 1.000
#> GSM154292 2 0.000 1.000 0.000 1.000
#> GSM154293 2 0.000 1.000 0.000 1.000
#> GSM154294 2 0.000 1.000 0.000 1.000
#> GSM154307 2 0.000 1.000 0.000 1.000
#> GSM154308 2 0.000 1.000 0.000 1.000
#> GSM154309 2 0.000 1.000 0.000 1.000
#> GSM154265 1 0.000 0.998 1.000 0.000
#> GSM154266 1 0.000 0.998 1.000 0.000
#> GSM154267 1 0.000 0.998 1.000 0.000
#> GSM154280 2 0.000 1.000 0.000 1.000
#> GSM154281 2 0.000 1.000 0.000 1.000
#> GSM154282 2 0.000 1.000 0.000 1.000
#> GSM154295 2 0.000 1.000 0.000 1.000
#> GSM154296 2 0.000 1.000 0.000 1.000
#> GSM154297 2 0.000 1.000 0.000 1.000
#> GSM154310 2 0.000 1.000 0.000 1.000
#> GSM154311 2 0.000 1.000 0.000 1.000
#> GSM154312 2 0.000 1.000 0.000 1.000
#> GSM154268 1 0.000 0.998 1.000 0.000
#> GSM154269 1 0.000 0.998 1.000 0.000
#> GSM154270 1 0.000 0.998 1.000 0.000
#> GSM154283 2 0.000 1.000 0.000 1.000
#> GSM154284 2 0.000 1.000 0.000 1.000
#> GSM154285 2 0.000 1.000 0.000 1.000
#> GSM154298 2 0.000 1.000 0.000 1.000
#> GSM154299 2 0.000 1.000 0.000 1.000
#> GSM154300 2 0.000 1.000 0.000 1.000
#> GSM154313 2 0.000 1.000 0.000 1.000
#> GSM154314 2 0.000 1.000 0.000 1.000
#> GSM154315 2 0.000 1.000 0.000 1.000
#> GSM154271 1 0.000 0.998 1.000 0.000
#> GSM154272 1 0.000 0.998 1.000 0.000
#> GSM154273 1 0.000 0.998 1.000 0.000
#> GSM154286 2 0.000 1.000 0.000 1.000
#> GSM154287 2 0.000 1.000 0.000 1.000
#> GSM154288 2 0.000 1.000 0.000 1.000
#> GSM154301 2 0.000 1.000 0.000 1.000
#> GSM154302 2 0.000 1.000 0.000 1.000
#> GSM154303 2 0.000 1.000 0.000 1.000
#> GSM154316 2 0.000 1.000 0.000 1.000
#> GSM154317 2 0.000 1.000 0.000 1.000
#> GSM154318 2 0.000 1.000 0.000 1.000
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> GSM154259 1 0.1860 0.922 0.948 0.052 0.000
#> GSM154260 1 0.0000 0.995 1.000 0.000 0.000
#> GSM154261 1 0.0000 0.995 1.000 0.000 0.000
#> GSM154274 2 0.0237 0.996 0.000 0.996 0.004
#> GSM154275 2 0.0237 0.996 0.000 0.996 0.004
#> GSM154276 2 0.0237 0.996 0.000 0.996 0.004
#> GSM154289 2 0.0237 0.996 0.000 0.996 0.004
#> GSM154290 2 0.0237 0.996 0.000 0.996 0.004
#> GSM154291 3 0.0424 0.999 0.000 0.008 0.992
#> GSM154304 2 0.0237 0.996 0.000 0.996 0.004
#> GSM154305 3 0.0424 0.999 0.000 0.008 0.992
#> GSM154306 3 0.0424 0.999 0.000 0.008 0.992
#> GSM154262 1 0.0000 0.995 1.000 0.000 0.000
#> GSM154263 1 0.0000 0.995 1.000 0.000 0.000
#> GSM154264 1 0.0000 0.995 1.000 0.000 0.000
#> GSM154277 3 0.0237 0.994 0.000 0.004 0.996
#> GSM154278 2 0.0237 0.996 0.000 0.996 0.004
#> GSM154279 2 0.0237 0.996 0.000 0.996 0.004
#> GSM154292 2 0.0237 0.996 0.000 0.996 0.004
#> GSM154293 2 0.0237 0.996 0.000 0.996 0.004
#> GSM154294 3 0.0424 0.999 0.000 0.008 0.992
#> GSM154307 2 0.0237 0.996 0.000 0.996 0.004
#> GSM154308 2 0.0237 0.996 0.000 0.996 0.004
#> GSM154309 2 0.0237 0.996 0.000 0.996 0.004
#> GSM154265 1 0.0000 0.995 1.000 0.000 0.000
#> GSM154266 1 0.0000 0.995 1.000 0.000 0.000
#> GSM154267 1 0.0000 0.995 1.000 0.000 0.000
#> GSM154280 2 0.0237 0.996 0.000 0.996 0.004
#> GSM154281 2 0.0237 0.996 0.000 0.996 0.004
#> GSM154282 2 0.0237 0.996 0.000 0.996 0.004
#> GSM154295 2 0.0237 0.996 0.000 0.996 0.004
#> GSM154296 2 0.0000 0.996 0.000 1.000 0.000
#> GSM154297 2 0.0237 0.996 0.000 0.996 0.004
#> GSM154310 2 0.0237 0.996 0.000 0.996 0.004
#> GSM154311 2 0.0237 0.996 0.000 0.996 0.004
#> GSM154312 2 0.0237 0.996 0.000 0.996 0.004
#> GSM154268 1 0.0000 0.995 1.000 0.000 0.000
#> GSM154269 1 0.0000 0.995 1.000 0.000 0.000
#> GSM154270 1 0.0000 0.995 1.000 0.000 0.000
#> GSM154283 2 0.0237 0.996 0.000 0.996 0.004
#> GSM154284 2 0.0237 0.996 0.000 0.996 0.004
#> GSM154285 2 0.0237 0.996 0.000 0.996 0.004
#> GSM154298 2 0.0237 0.996 0.000 0.996 0.004
#> GSM154299 2 0.0237 0.996 0.000 0.996 0.004
#> GSM154300 3 0.0424 0.999 0.000 0.008 0.992
#> GSM154313 2 0.0237 0.996 0.000 0.996 0.004
#> GSM154314 2 0.0237 0.996 0.000 0.996 0.004
#> GSM154315 3 0.0424 0.999 0.000 0.008 0.992
#> GSM154271 1 0.0000 0.995 1.000 0.000 0.000
#> GSM154272 1 0.0000 0.995 1.000 0.000 0.000
#> GSM154273 1 0.0000 0.995 1.000 0.000 0.000
#> GSM154286 2 0.0000 0.996 0.000 1.000 0.000
#> GSM154287 2 0.0000 0.996 0.000 1.000 0.000
#> GSM154288 3 0.0424 0.999 0.000 0.008 0.992
#> GSM154301 2 0.0237 0.996 0.000 0.996 0.004
#> GSM154302 2 0.0237 0.996 0.000 0.996 0.004
#> GSM154303 3 0.0424 0.999 0.000 0.008 0.992
#> GSM154316 2 0.0237 0.996 0.000 0.996 0.004
#> GSM154317 2 0.0237 0.996 0.000 0.996 0.004
#> GSM154318 2 0.0237 0.996 0.000 0.996 0.004
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> GSM154259 1 0.000 1.000 1 0.000 0.000 0.000
#> GSM154260 1 0.000 1.000 1 0.000 0.000 0.000
#> GSM154261 1 0.000 1.000 1 0.000 0.000 0.000
#> GSM154274 3 0.000 1.000 0 0.000 1.000 0.000
#> GSM154275 3 0.000 1.000 0 0.000 1.000 0.000
#> GSM154276 3 0.000 1.000 0 0.000 1.000 0.000
#> GSM154289 2 0.000 1.000 0 1.000 0.000 0.000
#> GSM154290 2 0.000 1.000 0 1.000 0.000 0.000
#> GSM154291 4 0.000 0.910 0 0.000 0.000 1.000
#> GSM154304 2 0.000 1.000 0 1.000 0.000 0.000
#> GSM154305 4 0.000 0.910 0 0.000 0.000 1.000
#> GSM154306 4 0.000 0.910 0 0.000 0.000 1.000
#> GSM154262 1 0.000 1.000 1 0.000 0.000 0.000
#> GSM154263 1 0.000 1.000 1 0.000 0.000 0.000
#> GSM154264 1 0.000 1.000 1 0.000 0.000 0.000
#> GSM154277 3 0.000 1.000 0 0.000 1.000 0.000
#> GSM154278 3 0.000 1.000 0 0.000 1.000 0.000
#> GSM154279 3 0.000 1.000 0 0.000 1.000 0.000
#> GSM154292 2 0.000 1.000 0 1.000 0.000 0.000
#> GSM154293 2 0.000 1.000 0 1.000 0.000 0.000
#> GSM154294 4 0.369 0.704 0 0.208 0.000 0.792
#> GSM154307 2 0.000 1.000 0 1.000 0.000 0.000
#> GSM154308 2 0.000 1.000 0 1.000 0.000 0.000
#> GSM154309 2 0.000 1.000 0 1.000 0.000 0.000
#> GSM154265 1 0.000 1.000 1 0.000 0.000 0.000
#> GSM154266 1 0.000 1.000 1 0.000 0.000 0.000
#> GSM154267 1 0.000 1.000 1 0.000 0.000 0.000
#> GSM154280 3 0.000 1.000 0 0.000 1.000 0.000
#> GSM154281 3 0.000 1.000 0 0.000 1.000 0.000
#> GSM154282 3 0.000 1.000 0 0.000 1.000 0.000
#> GSM154295 3 0.000 1.000 0 0.000 1.000 0.000
#> GSM154296 3 0.000 1.000 0 0.000 1.000 0.000
#> GSM154297 3 0.000 1.000 0 0.000 1.000 0.000
#> GSM154310 3 0.000 1.000 0 0.000 1.000 0.000
#> GSM154311 3 0.000 1.000 0 0.000 1.000 0.000
#> GSM154312 3 0.000 1.000 0 0.000 1.000 0.000
#> GSM154268 1 0.000 1.000 1 0.000 0.000 0.000
#> GSM154269 1 0.000 1.000 1 0.000 0.000 0.000
#> GSM154270 1 0.000 1.000 1 0.000 0.000 0.000
#> GSM154283 3 0.000 1.000 0 0.000 1.000 0.000
#> GSM154284 3 0.000 1.000 0 0.000 1.000 0.000
#> GSM154285 3 0.000 1.000 0 0.000 1.000 0.000
#> GSM154298 2 0.000 1.000 0 1.000 0.000 0.000
#> GSM154299 2 0.000 1.000 0 1.000 0.000 0.000
#> GSM154300 4 0.000 0.910 0 0.000 0.000 1.000
#> GSM154313 2 0.000 1.000 0 1.000 0.000 0.000
#> GSM154314 2 0.000 1.000 0 1.000 0.000 0.000
#> GSM154315 4 0.000 0.910 0 0.000 0.000 1.000
#> GSM154271 1 0.000 1.000 1 0.000 0.000 0.000
#> GSM154272 1 0.000 1.000 1 0.000 0.000 0.000
#> GSM154273 1 0.000 1.000 1 0.000 0.000 0.000
#> GSM154286 3 0.000 1.000 0 0.000 1.000 0.000
#> GSM154287 3 0.000 1.000 0 0.000 1.000 0.000
#> GSM154288 4 0.000 0.910 0 0.000 0.000 1.000
#> GSM154301 3 0.000 1.000 0 0.000 1.000 0.000
#> GSM154302 3 0.000 1.000 0 0.000 1.000 0.000
#> GSM154303 4 0.454 0.526 0 0.000 0.324 0.676
#> GSM154316 3 0.000 1.000 0 0.000 1.000 0.000
#> GSM154317 3 0.000 1.000 0 0.000 1.000 0.000
#> GSM154318 3 0.000 1.000 0 0.000 1.000 0.000
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> GSM154259 1 0.0000 1.000 1 0.000 0.000 0.000 0.000
#> GSM154260 1 0.0000 1.000 1 0.000 0.000 0.000 0.000
#> GSM154261 1 0.0000 1.000 1 0.000 0.000 0.000 0.000
#> GSM154274 5 0.0000 0.968 0 0.000 0.000 0.000 1.000
#> GSM154275 5 0.0000 0.968 0 0.000 0.000 0.000 1.000
#> GSM154276 5 0.0000 0.968 0 0.000 0.000 0.000 1.000
#> GSM154289 5 0.1908 0.924 0 0.092 0.000 0.000 0.908
#> GSM154290 5 0.1908 0.924 0 0.092 0.000 0.000 0.908
#> GSM154291 4 0.0000 0.936 0 0.000 0.000 1.000 0.000
#> GSM154304 2 0.0000 1.000 0 1.000 0.000 0.000 0.000
#> GSM154305 4 0.0000 0.936 0 0.000 0.000 1.000 0.000
#> GSM154306 4 0.0000 0.936 0 0.000 0.000 1.000 0.000
#> GSM154262 1 0.0000 1.000 1 0.000 0.000 0.000 0.000
#> GSM154263 1 0.0000 1.000 1 0.000 0.000 0.000 0.000
#> GSM154264 1 0.0000 1.000 1 0.000 0.000 0.000 0.000
#> GSM154277 5 0.0510 0.962 0 0.000 0.000 0.016 0.984
#> GSM154278 5 0.0000 0.968 0 0.000 0.000 0.000 1.000
#> GSM154279 5 0.0000 0.968 0 0.000 0.000 0.000 1.000
#> GSM154292 5 0.1908 0.924 0 0.092 0.000 0.000 0.908
#> GSM154293 5 0.2020 0.917 0 0.100 0.000 0.000 0.900
#> GSM154294 4 0.0510 0.925 0 0.016 0.000 0.984 0.000
#> GSM154307 2 0.0000 1.000 0 1.000 0.000 0.000 0.000
#> GSM154308 2 0.0000 1.000 0 1.000 0.000 0.000 0.000
#> GSM154309 2 0.0000 1.000 0 1.000 0.000 0.000 0.000
#> GSM154265 1 0.0000 1.000 1 0.000 0.000 0.000 0.000
#> GSM154266 1 0.0000 1.000 1 0.000 0.000 0.000 0.000
#> GSM154267 1 0.0000 1.000 1 0.000 0.000 0.000 0.000
#> GSM154280 5 0.0162 0.967 0 0.000 0.004 0.000 0.996
#> GSM154281 5 0.0162 0.967 0 0.000 0.004 0.000 0.996
#> GSM154282 5 0.0162 0.967 0 0.000 0.004 0.000 0.996
#> GSM154295 3 0.0000 0.963 0 0.000 1.000 0.000 0.000
#> GSM154296 3 0.0510 0.969 0 0.000 0.984 0.000 0.016
#> GSM154297 3 0.0510 0.969 0 0.000 0.984 0.000 0.016
#> GSM154310 3 0.0000 0.963 0 0.000 1.000 0.000 0.000
#> GSM154311 3 0.0000 0.963 0 0.000 1.000 0.000 0.000
#> GSM154312 3 0.0000 0.963 0 0.000 1.000 0.000 0.000
#> GSM154268 1 0.0000 1.000 1 0.000 0.000 0.000 0.000
#> GSM154269 1 0.0000 1.000 1 0.000 0.000 0.000 0.000
#> GSM154270 1 0.0000 1.000 1 0.000 0.000 0.000 0.000
#> GSM154283 5 0.0000 0.968 0 0.000 0.000 0.000 1.000
#> GSM154284 5 0.0000 0.968 0 0.000 0.000 0.000 1.000
#> GSM154285 5 0.0000 0.968 0 0.000 0.000 0.000 1.000
#> GSM154298 2 0.0000 1.000 0 1.000 0.000 0.000 0.000
#> GSM154299 5 0.1908 0.924 0 0.092 0.000 0.000 0.908
#> GSM154300 4 0.3816 0.547 0 0.000 0.000 0.696 0.304
#> GSM154313 2 0.0000 1.000 0 1.000 0.000 0.000 0.000
#> GSM154314 2 0.0000 1.000 0 1.000 0.000 0.000 0.000
#> GSM154315 4 0.0000 0.936 0 0.000 0.000 1.000 0.000
#> GSM154271 1 0.0000 1.000 1 0.000 0.000 0.000 0.000
#> GSM154272 1 0.0000 1.000 1 0.000 0.000 0.000 0.000
#> GSM154273 1 0.0000 1.000 1 0.000 0.000 0.000 0.000
#> GSM154286 5 0.0703 0.956 0 0.000 0.024 0.000 0.976
#> GSM154287 3 0.3336 0.699 0 0.000 0.772 0.000 0.228
#> GSM154288 4 0.0000 0.936 0 0.000 0.000 1.000 0.000
#> GSM154301 3 0.0510 0.969 0 0.000 0.984 0.000 0.016
#> GSM154302 3 0.0510 0.969 0 0.000 0.984 0.000 0.016
#> GSM154303 4 0.0510 0.924 0 0.000 0.000 0.984 0.016
#> GSM154316 3 0.0510 0.969 0 0.000 0.984 0.000 0.016
#> GSM154317 3 0.0510 0.969 0 0.000 0.984 0.000 0.016
#> GSM154318 3 0.0510 0.969 0 0.000 0.984 0.000 0.016
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> GSM154259 1 0.0000 1.000 1 0.000 0.000 0.000 0.000 0.000
#> GSM154260 1 0.0000 1.000 1 0.000 0.000 0.000 0.000 0.000
#> GSM154261 1 0.0000 1.000 1 0.000 0.000 0.000 0.000 0.000
#> GSM154274 5 0.0547 0.978 0 0.000 0.000 0.000 0.980 0.020
#> GSM154275 5 0.0547 0.978 0 0.000 0.000 0.000 0.980 0.020
#> GSM154276 5 0.0547 0.978 0 0.000 0.000 0.000 0.980 0.020
#> GSM154289 6 0.1218 0.999 0 0.012 0.000 0.004 0.028 0.956
#> GSM154290 6 0.1218 0.999 0 0.012 0.000 0.004 0.028 0.956
#> GSM154291 4 0.0000 0.986 0 0.000 0.000 1.000 0.000 0.000
#> GSM154304 2 0.0000 1.000 0 1.000 0.000 0.000 0.000 0.000
#> GSM154305 4 0.0000 0.986 0 0.000 0.000 1.000 0.000 0.000
#> GSM154306 4 0.0000 0.986 0 0.000 0.000 1.000 0.000 0.000
#> GSM154262 1 0.0000 1.000 1 0.000 0.000 0.000 0.000 0.000
#> GSM154263 1 0.0000 1.000 1 0.000 0.000 0.000 0.000 0.000
#> GSM154264 1 0.0000 1.000 1 0.000 0.000 0.000 0.000 0.000
#> GSM154277 5 0.0777 0.975 0 0.000 0.000 0.004 0.972 0.024
#> GSM154278 5 0.0632 0.977 0 0.000 0.000 0.000 0.976 0.024
#> GSM154279 5 0.0547 0.978 0 0.000 0.000 0.000 0.980 0.020
#> GSM154292 6 0.1218 0.999 0 0.012 0.000 0.004 0.028 0.956
#> GSM154293 6 0.1232 0.994 0 0.016 0.000 0.004 0.024 0.956
#> GSM154294 4 0.0146 0.985 0 0.004 0.000 0.996 0.000 0.000
#> GSM154307 2 0.0000 1.000 0 1.000 0.000 0.000 0.000 0.000
#> GSM154308 2 0.0000 1.000 0 1.000 0.000 0.000 0.000 0.000
#> GSM154309 2 0.0000 1.000 0 1.000 0.000 0.000 0.000 0.000
#> GSM154265 1 0.0000 1.000 1 0.000 0.000 0.000 0.000 0.000
#> GSM154266 1 0.0000 1.000 1 0.000 0.000 0.000 0.000 0.000
#> GSM154267 1 0.0000 1.000 1 0.000 0.000 0.000 0.000 0.000
#> GSM154280 5 0.0363 0.969 0 0.000 0.000 0.000 0.988 0.012
#> GSM154281 5 0.0363 0.969 0 0.000 0.000 0.000 0.988 0.012
#> GSM154282 5 0.0363 0.969 0 0.000 0.000 0.000 0.988 0.012
#> GSM154295 3 0.0000 0.993 0 0.000 1.000 0.000 0.000 0.000
#> GSM154296 3 0.0000 0.993 0 0.000 1.000 0.000 0.000 0.000
#> GSM154297 3 0.0000 0.993 0 0.000 1.000 0.000 0.000 0.000
#> GSM154310 3 0.0000 0.993 0 0.000 1.000 0.000 0.000 0.000
#> GSM154311 3 0.0000 0.993 0 0.000 1.000 0.000 0.000 0.000
#> GSM154312 3 0.0000 0.993 0 0.000 1.000 0.000 0.000 0.000
#> GSM154268 1 0.0000 1.000 1 0.000 0.000 0.000 0.000 0.000
#> GSM154269 1 0.0000 1.000 1 0.000 0.000 0.000 0.000 0.000
#> GSM154270 1 0.0000 1.000 1 0.000 0.000 0.000 0.000 0.000
#> GSM154283 5 0.2442 0.849 0 0.000 0.000 0.004 0.852 0.144
#> GSM154284 5 0.0547 0.978 0 0.000 0.000 0.000 0.980 0.020
#> GSM154285 5 0.0547 0.978 0 0.000 0.000 0.000 0.980 0.020
#> GSM154298 2 0.0000 1.000 0 1.000 0.000 0.000 0.000 0.000
#> GSM154299 6 0.1218 0.999 0 0.012 0.000 0.004 0.028 0.956
#> GSM154300 4 0.0891 0.961 0 0.000 0.000 0.968 0.024 0.008
#> GSM154313 2 0.0000 1.000 0 1.000 0.000 0.000 0.000 0.000
#> GSM154314 2 0.0000 1.000 0 1.000 0.000 0.000 0.000 0.000
#> GSM154315 4 0.0000 0.986 0 0.000 0.000 1.000 0.000 0.000
#> GSM154271 1 0.0000 1.000 1 0.000 0.000 0.000 0.000 0.000
#> GSM154272 1 0.0000 1.000 1 0.000 0.000 0.000 0.000 0.000
#> GSM154273 1 0.0000 1.000 1 0.000 0.000 0.000 0.000 0.000
#> GSM154286 5 0.0363 0.969 0 0.000 0.000 0.000 0.988 0.012
#> GSM154287 3 0.1625 0.920 0 0.000 0.928 0.000 0.060 0.012
#> GSM154288 4 0.0865 0.975 0 0.000 0.000 0.964 0.000 0.036
#> GSM154301 3 0.0000 0.993 0 0.000 1.000 0.000 0.000 0.000
#> GSM154302 3 0.0000 0.993 0 0.000 1.000 0.000 0.000 0.000
#> GSM154303 4 0.0865 0.975 0 0.000 0.000 0.964 0.000 0.036
#> GSM154316 3 0.0000 0.993 0 0.000 1.000 0.000 0.000 0.000
#> GSM154317 3 0.0000 0.993 0 0.000 1.000 0.000 0.000 0.000
#> GSM154318 3 0.0000 0.993 0 0.000 1.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 agent(p) time(p) k
#> ATC:mclust 60 1.0000 5.88e-13 2
#> ATC:mclust 60 0.9117 2.68e-11 3
#> ATC:mclust 60 0.1018 3.82e-13 4
#> ATC:mclust 60 0.0137 1.42e-15 5
#> ATC:mclust 60 0.0333 8.94e-20 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 38950 rows and 60 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 1.000 0.995 0.997 0.4533 0.548 0.548
#> 3 3 0.580 0.643 0.829 0.3211 0.745 0.575
#> 4 4 0.525 0.605 0.799 0.1766 0.704 0.396
#> 5 5 0.789 0.811 0.898 0.0970 0.811 0.466
#> 6 6 0.790 0.743 0.853 0.0285 1.000 1.000
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
#> GSM154259 1 0.0000 0.997 1.000 0.000
#> GSM154260 1 0.0000 0.997 1.000 0.000
#> GSM154261 1 0.0000 0.997 1.000 0.000
#> GSM154274 1 0.0000 0.997 1.000 0.000
#> GSM154275 1 0.0000 0.997 1.000 0.000
#> GSM154276 1 0.0000 0.997 1.000 0.000
#> GSM154289 2 0.0000 0.998 0.000 1.000
#> GSM154290 2 0.0000 0.998 0.000 1.000
#> GSM154291 2 0.0000 0.998 0.000 1.000
#> GSM154304 2 0.0000 0.998 0.000 1.000
#> GSM154305 2 0.0000 0.998 0.000 1.000
#> GSM154306 2 0.0000 0.998 0.000 1.000
#> GSM154262 1 0.0000 0.997 1.000 0.000
#> GSM154263 1 0.0000 0.997 1.000 0.000
#> GSM154264 1 0.0000 0.997 1.000 0.000
#> GSM154277 1 0.4815 0.885 0.896 0.104
#> GSM154278 1 0.0000 0.997 1.000 0.000
#> GSM154279 1 0.0000 0.997 1.000 0.000
#> GSM154292 2 0.0000 0.998 0.000 1.000
#> GSM154293 2 0.0000 0.998 0.000 1.000
#> GSM154294 2 0.0000 0.998 0.000 1.000
#> GSM154307 2 0.0000 0.998 0.000 1.000
#> GSM154308 2 0.0000 0.998 0.000 1.000
#> GSM154309 2 0.0000 0.998 0.000 1.000
#> GSM154265 1 0.0000 0.997 1.000 0.000
#> GSM154266 1 0.0000 0.997 1.000 0.000
#> GSM154267 1 0.0000 0.997 1.000 0.000
#> GSM154280 1 0.0000 0.997 1.000 0.000
#> GSM154281 1 0.0000 0.997 1.000 0.000
#> GSM154282 1 0.0000 0.997 1.000 0.000
#> GSM154295 1 0.0376 0.994 0.996 0.004
#> GSM154296 1 0.0000 0.997 1.000 0.000
#> GSM154297 1 0.0376 0.994 0.996 0.004
#> GSM154310 1 0.0000 0.997 1.000 0.000
#> GSM154311 1 0.0000 0.997 1.000 0.000
#> GSM154312 1 0.0000 0.997 1.000 0.000
#> GSM154268 1 0.0000 0.997 1.000 0.000
#> GSM154269 1 0.0000 0.997 1.000 0.000
#> GSM154270 1 0.0000 0.997 1.000 0.000
#> GSM154283 2 0.1633 0.976 0.024 0.976
#> GSM154284 1 0.0000 0.997 1.000 0.000
#> GSM154285 1 0.0000 0.997 1.000 0.000
#> GSM154298 2 0.0000 0.998 0.000 1.000
#> GSM154299 2 0.0000 0.998 0.000 1.000
#> GSM154300 2 0.0000 0.998 0.000 1.000
#> GSM154313 2 0.0000 0.998 0.000 1.000
#> GSM154314 2 0.0000 0.998 0.000 1.000
#> GSM154315 2 0.0000 0.998 0.000 1.000
#> GSM154271 1 0.0000 0.997 1.000 0.000
#> GSM154272 1 0.0000 0.997 1.000 0.000
#> GSM154273 1 0.0000 0.997 1.000 0.000
#> GSM154286 1 0.0000 0.997 1.000 0.000
#> GSM154287 1 0.0000 0.997 1.000 0.000
#> GSM154288 2 0.0938 0.988 0.012 0.988
#> GSM154301 1 0.0000 0.997 1.000 0.000
#> GSM154302 1 0.0000 0.997 1.000 0.000
#> GSM154303 1 0.0672 0.990 0.992 0.008
#> GSM154316 1 0.0000 0.997 1.000 0.000
#> GSM154317 1 0.0000 0.997 1.000 0.000
#> GSM154318 1 0.0000 0.997 1.000 0.000
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> GSM154259 1 0.0000 0.861 1.000 0.000 0.000
#> GSM154260 1 0.5760 0.644 0.672 0.000 0.328
#> GSM154261 1 0.5216 0.722 0.740 0.000 0.260
#> GSM154274 1 0.6489 -0.173 0.540 0.456 0.004
#> GSM154275 1 0.5760 0.644 0.672 0.000 0.328
#> GSM154276 1 0.0000 0.861 1.000 0.000 0.000
#> GSM154289 2 0.0000 0.644 0.000 1.000 0.000
#> GSM154290 2 0.4291 0.328 0.000 0.820 0.180
#> GSM154291 3 0.6079 0.627 0.000 0.388 0.612
#> GSM154304 2 0.0000 0.644 0.000 1.000 0.000
#> GSM154305 3 0.6291 0.632 0.000 0.468 0.532
#> GSM154306 3 0.6286 0.636 0.000 0.464 0.536
#> GSM154262 1 0.0892 0.859 0.980 0.000 0.020
#> GSM154263 1 0.3038 0.831 0.896 0.000 0.104
#> GSM154264 1 0.5098 0.733 0.752 0.000 0.248
#> GSM154277 3 0.4555 0.352 0.200 0.000 0.800
#> GSM154278 1 0.6505 -0.213 0.528 0.468 0.004
#> GSM154279 1 0.0000 0.861 1.000 0.000 0.000
#> GSM154292 2 0.1031 0.617 0.000 0.976 0.024
#> GSM154293 2 0.0000 0.644 0.000 1.000 0.000
#> GSM154294 3 0.6280 0.638 0.000 0.460 0.540
#> GSM154307 2 0.0000 0.644 0.000 1.000 0.000
#> GSM154308 2 0.0000 0.644 0.000 1.000 0.000
#> GSM154309 2 0.0000 0.644 0.000 1.000 0.000
#> GSM154265 1 0.0000 0.861 1.000 0.000 0.000
#> GSM154266 1 0.2711 0.838 0.912 0.000 0.088
#> GSM154267 1 0.2796 0.836 0.908 0.000 0.092
#> GSM154280 1 0.0237 0.861 0.996 0.000 0.004
#> GSM154281 1 0.0000 0.861 1.000 0.000 0.000
#> GSM154282 1 0.0237 0.861 0.996 0.000 0.004
#> GSM154295 2 0.6489 0.363 0.456 0.540 0.004
#> GSM154296 2 0.6489 0.363 0.456 0.540 0.004
#> GSM154297 2 0.6489 0.363 0.456 0.540 0.004
#> GSM154310 2 0.6489 0.363 0.456 0.540 0.004
#> GSM154311 2 0.6495 0.353 0.460 0.536 0.004
#> GSM154312 2 0.6500 0.342 0.464 0.532 0.004
#> GSM154268 1 0.1031 0.859 0.976 0.000 0.024
#> GSM154269 1 0.0000 0.861 1.000 0.000 0.000
#> GSM154270 1 0.5397 0.702 0.720 0.000 0.280
#> GSM154283 2 0.2261 0.613 0.068 0.932 0.000
#> GSM154284 1 0.4663 0.789 0.828 0.016 0.156
#> GSM154285 1 0.5849 0.734 0.756 0.028 0.216
#> GSM154298 2 0.0000 0.644 0.000 1.000 0.000
#> GSM154299 2 0.3551 0.443 0.000 0.868 0.132
#> GSM154300 3 0.6291 0.632 0.000 0.468 0.532
#> GSM154313 2 0.0000 0.644 0.000 1.000 0.000
#> GSM154314 2 0.0000 0.644 0.000 1.000 0.000
#> GSM154315 3 0.6280 0.638 0.000 0.460 0.540
#> GSM154271 1 0.0000 0.861 1.000 0.000 0.000
#> GSM154272 1 0.0237 0.861 0.996 0.000 0.004
#> GSM154273 1 0.5465 0.693 0.712 0.000 0.288
#> GSM154286 1 0.4121 0.794 0.832 0.000 0.168
#> GSM154287 1 0.0237 0.859 0.996 0.000 0.004
#> GSM154288 3 0.0237 0.500 0.004 0.000 0.996
#> GSM154301 1 0.3500 0.743 0.880 0.116 0.004
#> GSM154302 1 0.0000 0.861 1.000 0.000 0.000
#> GSM154303 3 0.5621 0.106 0.308 0.000 0.692
#> GSM154316 1 0.0475 0.857 0.992 0.004 0.004
#> GSM154317 1 0.1765 0.829 0.956 0.040 0.004
#> GSM154318 1 0.0237 0.859 0.996 0.000 0.004
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> GSM154259 1 0.0000 0.8569 1.000 0.000 0.000 0.000
#> GSM154260 1 0.1389 0.8357 0.952 0.000 0.048 0.000
#> GSM154261 1 0.1118 0.8444 0.964 0.000 0.036 0.000
#> GSM154274 2 0.6245 0.4340 0.164 0.668 0.168 0.000
#> GSM154275 3 0.5100 0.6559 0.168 0.076 0.756 0.000
#> GSM154276 2 0.7341 -0.0196 0.164 0.476 0.360 0.000
#> GSM154289 2 0.3439 0.6087 0.000 0.868 0.084 0.048
#> GSM154290 2 0.6245 0.5420 0.000 0.668 0.168 0.164
#> GSM154291 4 0.1118 0.7176 0.000 0.000 0.036 0.964
#> GSM154304 4 0.5488 0.3727 0.000 0.452 0.016 0.532
#> GSM154305 4 0.0188 0.7312 0.000 0.004 0.000 0.996
#> GSM154306 4 0.0000 0.7306 0.000 0.000 0.000 1.000
#> GSM154262 1 0.0000 0.8569 1.000 0.000 0.000 0.000
#> GSM154263 1 0.0469 0.8547 0.988 0.000 0.012 0.000
#> GSM154264 1 0.0707 0.8520 0.980 0.000 0.020 0.000
#> GSM154277 3 0.4751 0.6403 0.120 0.052 0.808 0.020
#> GSM154278 2 0.6204 0.4395 0.160 0.672 0.168 0.000
#> GSM154279 2 0.7379 -0.0398 0.168 0.468 0.364 0.000
#> GSM154292 2 0.5985 0.5568 0.000 0.692 0.168 0.140
#> GSM154293 2 0.1545 0.6050 0.000 0.952 0.040 0.008
#> GSM154294 4 0.4100 0.6812 0.000 0.092 0.076 0.832
#> GSM154307 2 0.4313 0.1773 0.000 0.736 0.004 0.260
#> GSM154308 4 0.4804 0.5722 0.000 0.384 0.000 0.616
#> GSM154309 2 0.4313 0.1802 0.000 0.736 0.004 0.260
#> GSM154265 1 0.0000 0.8569 1.000 0.000 0.000 0.000
#> GSM154266 1 0.0336 0.8558 0.992 0.000 0.008 0.000
#> GSM154267 1 0.0188 0.8565 0.996 0.000 0.004 0.000
#> GSM154280 3 0.7483 0.4623 0.216 0.288 0.496 0.000
#> GSM154281 2 0.6911 0.1723 0.336 0.540 0.124 0.000
#> GSM154282 3 0.7677 0.2831 0.216 0.372 0.412 0.000
#> GSM154295 2 0.2480 0.5401 0.088 0.904 0.008 0.000
#> GSM154296 2 0.1743 0.5629 0.056 0.940 0.004 0.000
#> GSM154297 2 0.2888 0.5107 0.124 0.872 0.004 0.000
#> GSM154310 1 0.4990 0.5788 0.640 0.352 0.008 0.000
#> GSM154311 1 0.5285 0.3480 0.524 0.468 0.008 0.000
#> GSM154312 1 0.4917 0.6026 0.656 0.336 0.008 0.000
#> GSM154268 1 0.0188 0.8565 0.996 0.000 0.004 0.000
#> GSM154269 1 0.0000 0.8569 1.000 0.000 0.000 0.000
#> GSM154270 1 0.1022 0.8466 0.968 0.000 0.032 0.000
#> GSM154283 2 0.6204 0.5445 0.000 0.672 0.168 0.160
#> GSM154284 3 0.6602 0.5610 0.164 0.208 0.628 0.000
#> GSM154285 3 0.5388 0.6571 0.172 0.080 0.744 0.004
#> GSM154298 2 0.2081 0.5404 0.000 0.916 0.000 0.084
#> GSM154299 2 0.6251 0.5504 0.000 0.664 0.140 0.196
#> GSM154300 4 0.2266 0.6911 0.000 0.004 0.084 0.912
#> GSM154313 4 0.4999 0.4183 0.000 0.492 0.000 0.508
#> GSM154314 4 0.4713 0.5818 0.000 0.360 0.000 0.640
#> GSM154315 4 0.0188 0.7289 0.000 0.000 0.004 0.996
#> GSM154271 1 0.0000 0.8569 1.000 0.000 0.000 0.000
#> GSM154272 1 0.0188 0.8565 0.996 0.004 0.000 0.000
#> GSM154273 1 0.1118 0.8444 0.964 0.000 0.036 0.000
#> GSM154286 1 0.4500 0.4112 0.684 0.000 0.316 0.000
#> GSM154287 1 0.1118 0.8477 0.964 0.036 0.000 0.000
#> GSM154288 3 0.3486 0.3784 0.000 0.000 0.812 0.188
#> GSM154301 1 0.3972 0.7443 0.788 0.204 0.008 0.000
#> GSM154302 1 0.3529 0.7770 0.836 0.152 0.012 0.000
#> GSM154303 3 0.6179 0.1605 0.072 0.000 0.608 0.320
#> GSM154316 1 0.3900 0.7662 0.816 0.164 0.020 0.000
#> GSM154317 1 0.3893 0.7506 0.796 0.196 0.008 0.000
#> GSM154318 1 0.3583 0.7638 0.816 0.180 0.004 0.000
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> GSM154259 1 0.0898 0.9678 0.972 0.000 0.020 0.008 0.000
#> GSM154260 1 0.0451 0.9715 0.988 0.000 0.000 0.008 0.004
#> GSM154261 1 0.0451 0.9702 0.988 0.000 0.000 0.004 0.008
#> GSM154274 5 0.0898 0.8121 0.000 0.000 0.020 0.008 0.972
#> GSM154275 5 0.1557 0.8045 0.008 0.000 0.000 0.052 0.940
#> GSM154276 5 0.0451 0.8141 0.004 0.000 0.000 0.008 0.988
#> GSM154289 5 0.4536 0.5494 0.000 0.020 0.264 0.012 0.704
#> GSM154290 5 0.1560 0.8054 0.000 0.028 0.020 0.004 0.948
#> GSM154291 2 0.1502 0.8388 0.000 0.940 0.000 0.056 0.004
#> GSM154304 2 0.2853 0.8193 0.000 0.880 0.040 0.004 0.076
#> GSM154305 2 0.0162 0.8570 0.000 0.996 0.000 0.004 0.000
#> GSM154306 2 0.0794 0.8533 0.000 0.972 0.000 0.028 0.000
#> GSM154262 1 0.0693 0.9704 0.980 0.000 0.008 0.012 0.000
#> GSM154263 1 0.0290 0.9710 0.992 0.000 0.000 0.000 0.008
#> GSM154264 1 0.0290 0.9714 0.992 0.000 0.000 0.008 0.000
#> GSM154277 5 0.3857 0.5921 0.000 0.000 0.000 0.312 0.688
#> GSM154278 5 0.0609 0.8119 0.000 0.000 0.020 0.000 0.980
#> GSM154279 5 0.0613 0.8142 0.004 0.000 0.004 0.008 0.984
#> GSM154292 5 0.2886 0.7302 0.000 0.008 0.148 0.000 0.844
#> GSM154293 3 0.2536 0.7659 0.000 0.004 0.868 0.000 0.128
#> GSM154294 2 0.4480 0.7007 0.000 0.776 0.068 0.140 0.016
#> GSM154307 3 0.4428 0.5838 0.000 0.284 0.692 0.004 0.020
#> GSM154308 2 0.1924 0.8473 0.000 0.924 0.064 0.004 0.008
#> GSM154309 3 0.3819 0.7009 0.000 0.208 0.772 0.004 0.016
#> GSM154265 1 0.0898 0.9678 0.972 0.000 0.020 0.008 0.000
#> GSM154266 1 0.0162 0.9716 0.996 0.000 0.000 0.000 0.004
#> GSM154267 1 0.0290 0.9713 0.992 0.000 0.000 0.008 0.000
#> GSM154280 5 0.4402 0.6638 0.172 0.000 0.008 0.056 0.764
#> GSM154281 5 0.4249 0.5102 0.296 0.000 0.016 0.000 0.688
#> GSM154282 5 0.4256 0.7354 0.068 0.000 0.016 0.120 0.796
#> GSM154295 3 0.0703 0.8333 0.000 0.000 0.976 0.000 0.024
#> GSM154296 3 0.0932 0.8337 0.000 0.004 0.972 0.004 0.020
#> GSM154297 3 0.0609 0.8335 0.000 0.000 0.980 0.000 0.020
#> GSM154310 3 0.0794 0.8429 0.028 0.000 0.972 0.000 0.000
#> GSM154311 3 0.0880 0.8434 0.032 0.000 0.968 0.000 0.000
#> GSM154312 3 0.1043 0.8428 0.040 0.000 0.960 0.000 0.000
#> GSM154268 1 0.0693 0.9706 0.980 0.000 0.000 0.012 0.008
#> GSM154269 1 0.0912 0.9684 0.972 0.000 0.016 0.012 0.000
#> GSM154270 1 0.0566 0.9707 0.984 0.000 0.000 0.012 0.004
#> GSM154283 5 0.1442 0.8099 0.000 0.012 0.032 0.004 0.952
#> GSM154284 5 0.0992 0.8123 0.008 0.000 0.000 0.024 0.968
#> GSM154285 5 0.3163 0.7701 0.012 0.004 0.008 0.124 0.852
#> GSM154298 3 0.5107 0.4672 0.000 0.316 0.632 0.004 0.048
#> GSM154299 5 0.5897 0.0311 0.000 0.436 0.068 0.012 0.484
#> GSM154300 2 0.1830 0.8449 0.000 0.932 0.012 0.004 0.052
#> GSM154313 2 0.4183 0.4915 0.000 0.668 0.324 0.000 0.008
#> GSM154314 2 0.2349 0.8340 0.000 0.900 0.084 0.004 0.012
#> GSM154315 2 0.0794 0.8533 0.000 0.972 0.000 0.028 0.000
#> GSM154271 1 0.0898 0.9678 0.972 0.000 0.020 0.008 0.000
#> GSM154272 1 0.1117 0.9671 0.964 0.000 0.020 0.016 0.000
#> GSM154273 1 0.0404 0.9704 0.988 0.000 0.000 0.012 0.000
#> GSM154286 1 0.3255 0.8356 0.848 0.000 0.000 0.100 0.052
#> GSM154287 1 0.1788 0.9329 0.932 0.000 0.056 0.008 0.004
#> GSM154288 4 0.1648 0.9512 0.020 0.040 0.000 0.940 0.000
#> GSM154301 3 0.2233 0.8166 0.104 0.000 0.892 0.004 0.000
#> GSM154302 3 0.4351 0.7355 0.132 0.000 0.768 0.100 0.000
#> GSM154303 4 0.2263 0.9514 0.020 0.036 0.024 0.920 0.000
#> GSM154316 3 0.2914 0.8175 0.076 0.000 0.872 0.052 0.000
#> GSM154317 3 0.2249 0.8210 0.096 0.000 0.896 0.008 0.000
#> GSM154318 3 0.3366 0.7049 0.212 0.000 0.784 0.004 0.000
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> GSM154259 1 0.1429 0.945 0.940 0.000 0.004 0.004 0.000 0.052
#> GSM154260 1 0.1606 0.939 0.932 0.000 0.000 0.008 0.004 0.056
#> GSM154261 1 0.1141 0.947 0.948 0.000 0.000 0.000 0.000 0.052
#> GSM154274 5 0.4109 0.564 0.008 0.000 0.012 0.000 0.652 0.328
#> GSM154275 5 0.2203 0.717 0.016 0.000 0.000 0.004 0.896 0.084
#> GSM154276 5 0.3043 0.664 0.008 0.000 0.000 0.000 0.792 0.200
#> GSM154289 5 0.5777 0.366 0.000 0.016 0.120 0.000 0.500 0.364
#> GSM154290 5 0.4802 0.565 0.000 0.068 0.012 0.000 0.660 0.260
#> GSM154291 2 0.2404 0.693 0.000 0.872 0.000 0.112 0.000 0.016
#> GSM154304 2 0.4312 0.631 0.000 0.764 0.032 0.000 0.072 0.132
#> GSM154305 2 0.0000 0.733 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM154306 2 0.1124 0.729 0.000 0.956 0.000 0.036 0.000 0.008
#> GSM154262 1 0.0291 0.962 0.992 0.000 0.004 0.000 0.000 0.004
#> GSM154263 1 0.0363 0.962 0.988 0.000 0.000 0.000 0.000 0.012
#> GSM154264 1 0.0405 0.961 0.988 0.000 0.000 0.004 0.000 0.008
#> GSM154277 5 0.4828 0.608 0.000 0.000 0.000 0.176 0.668 0.156
#> GSM154278 5 0.1010 0.719 0.000 0.000 0.004 0.000 0.960 0.036
#> GSM154279 5 0.0632 0.720 0.000 0.000 0.000 0.000 0.976 0.024
#> GSM154292 5 0.4388 0.633 0.000 0.064 0.124 0.000 0.764 0.048
#> GSM154293 3 0.3233 0.774 0.000 0.020 0.848 0.004 0.092 0.036
#> GSM154294 2 0.4721 0.520 0.000 0.680 0.040 0.256 0.012 0.012
#> GSM154307 3 0.4543 0.369 0.000 0.356 0.604 0.000 0.004 0.036
#> GSM154308 2 0.2364 0.718 0.000 0.892 0.072 0.000 0.004 0.032
#> GSM154309 3 0.4253 0.510 0.000 0.296 0.668 0.000 0.004 0.032
#> GSM154265 1 0.0653 0.960 0.980 0.000 0.004 0.004 0.000 0.012
#> GSM154266 1 0.0260 0.962 0.992 0.000 0.000 0.000 0.000 0.008
#> GSM154267 1 0.0260 0.962 0.992 0.000 0.000 0.000 0.000 0.008
#> GSM154280 5 0.4702 0.654 0.084 0.000 0.000 0.024 0.716 0.176
#> GSM154281 5 0.3733 0.632 0.172 0.000 0.012 0.004 0.784 0.028
#> GSM154282 5 0.4078 0.690 0.056 0.000 0.000 0.036 0.784 0.124
#> GSM154295 3 0.0146 0.845 0.000 0.000 0.996 0.000 0.004 0.000
#> GSM154296 3 0.0993 0.842 0.000 0.000 0.964 0.000 0.012 0.024
#> GSM154297 3 0.0551 0.845 0.000 0.000 0.984 0.008 0.004 0.004
#> GSM154310 3 0.0520 0.847 0.008 0.000 0.984 0.000 0.000 0.008
#> GSM154311 3 0.0291 0.847 0.004 0.000 0.992 0.000 0.000 0.004
#> GSM154312 3 0.0551 0.846 0.008 0.000 0.984 0.004 0.000 0.004
#> GSM154268 1 0.0146 0.962 0.996 0.000 0.000 0.004 0.000 0.000
#> GSM154269 1 0.0748 0.959 0.976 0.000 0.004 0.004 0.000 0.016
#> GSM154270 1 0.0692 0.960 0.976 0.000 0.000 0.004 0.000 0.020
#> GSM154283 5 0.2859 0.705 0.000 0.000 0.016 0.000 0.828 0.156
#> GSM154284 5 0.2884 0.706 0.004 0.000 0.000 0.008 0.824 0.164
#> GSM154285 5 0.4705 0.574 0.008 0.000 0.000 0.044 0.612 0.336
#> GSM154298 3 0.5263 0.436 0.000 0.288 0.616 0.000 0.032 0.064
#> GSM154299 5 0.6848 0.133 0.000 0.312 0.072 0.000 0.432 0.184
#> GSM154300 2 0.4294 0.584 0.000 0.752 0.008 0.004 0.152 0.084
#> GSM154313 2 0.4803 0.134 0.000 0.528 0.424 0.000 0.004 0.044
#> GSM154314 2 0.4436 0.535 0.000 0.676 0.272 0.000 0.008 0.044
#> GSM154315 2 0.1196 0.729 0.000 0.952 0.000 0.040 0.000 0.008
#> GSM154271 1 0.0551 0.960 0.984 0.000 0.004 0.004 0.000 0.008
#> GSM154272 1 0.0508 0.961 0.984 0.000 0.004 0.000 0.000 0.012
#> GSM154273 1 0.0622 0.960 0.980 0.000 0.000 0.008 0.000 0.012
#> GSM154286 1 0.4272 0.716 0.748 0.000 0.000 0.080 0.012 0.160
#> GSM154287 1 0.2108 0.910 0.912 0.000 0.056 0.016 0.000 0.016
#> GSM154288 4 0.1293 0.941 0.004 0.016 0.000 0.956 0.004 0.020
#> GSM154301 3 0.2245 0.813 0.036 0.000 0.908 0.016 0.000 0.040
#> GSM154302 3 0.2807 0.803 0.028 0.000 0.868 0.088 0.000 0.016
#> GSM154303 4 0.0935 0.941 0.004 0.000 0.032 0.964 0.000 0.000
#> GSM154316 3 0.2252 0.822 0.012 0.000 0.900 0.072 0.000 0.016
#> GSM154317 3 0.1053 0.842 0.020 0.000 0.964 0.012 0.000 0.004
#> GSM154318 3 0.3991 0.596 0.212 0.000 0.744 0.016 0.000 0.028
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 agent(p) time(p) k
#> ATC:NMF 60 0.00337 1.87e-04 2
#> ATC:NMF 47 0.02677 1.37e-04 3
#> ATC:NMF 45 0.13999 1.73e-10 4
#> ATC:NMF 57 0.01489 1.23e-13 5
#> ATC:NMF 55 0.01588 1.38e-13 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