cola Report for GDS3603

Date: 2019-12-25 20:49:21 CET, cola version: 1.3.2

Document is loading...


Summary

All available functions which can be applied to this res_list object:

res_list
#> A 'ConsensusPartitionList' object with 24 methods.
#>   On a matrix with 7758 rows and 79 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] 7758   79

Density distribution

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)

plot of chunk density-heatmap

Suggest the best k

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:kmeans 3 1.000 0.986 0.991 **
CV:kmeans 3 1.000 0.969 0.979 **
CV:NMF 2 1.000 0.967 0.986 **
MAD:skmeans 3 1.000 0.954 0.982 ** 2
ATC:kmeans 2 1.000 0.955 0.973 **
ATC:mclust 2 1.000 0.970 0.969 **
CV:skmeans 3 0.999 0.955 0.981 ** 2
MAD:NMF 2 0.973 0.941 0.978 **
MAD:kmeans 3 0.954 0.960 0.975 ** 2
ATC:pam 6 0.937 0.859 0.941 * 4,5
ATC:NMF 2 0.922 0.926 0.972 *
SD:NMF 3 0.920 0.928 0.960 * 2
ATC:skmeans 6 0.911 0.902 0.919 * 2,3,4,5
SD:skmeans 4 0.902 0.894 0.940 * 2,3
MAD:pam 4 0.901 0.865 0.941 *
SD:mclust 5 0.810 0.843 0.885
ATC:hclust 6 0.803 0.836 0.887
CV:mclust 4 0.761 0.846 0.908
SD:hclust 2 0.679 0.854 0.927
MAD:hclust 2 0.625 0.876 0.937
CV:hclust 2 0.622 0.838 0.901
CV:pam 2 0.616 0.875 0.926
SD:pam 2 0.558 0.729 0.896
MAD:mclust 2 0.531 0.930 0.930

**: 1-PAC > 0.95, *: 1-PAC > 0.9

CDF of consensus matrices

Cumulative distribution function curves of consensus matrix for all methods.

collect_plots(res_list, fun = plot_ecdf)

plot of chunk collect-plots

Consensus heatmap

Consensus heatmaps for all methods. (What is a consensus heatmap?)

collect_plots(res_list, k = 2, fun = consensus_heatmap, mc.cores = 4)

plot of chunk tab-collect-consensus-heatmap-1

collect_plots(res_list, k = 3, fun = consensus_heatmap, mc.cores = 4)

plot of chunk tab-collect-consensus-heatmap-2

collect_plots(res_list, k = 4, fun = consensus_heatmap, mc.cores = 4)

plot of chunk tab-collect-consensus-heatmap-3

collect_plots(res_list, k = 5, fun = consensus_heatmap, mc.cores = 4)

plot of chunk tab-collect-consensus-heatmap-4

collect_plots(res_list, k = 6, fun = consensus_heatmap, mc.cores = 4)

plot of chunk tab-collect-consensus-heatmap-5

Membership heatmap

Membership heatmaps for all methods. (What is a membership heatmap?)

collect_plots(res_list, k = 2, fun = membership_heatmap, mc.cores = 4)

plot of chunk tab-collect-membership-heatmap-1

collect_plots(res_list, k = 3, fun = membership_heatmap, mc.cores = 4)

plot of chunk tab-collect-membership-heatmap-2

collect_plots(res_list, k = 4, fun = membership_heatmap, mc.cores = 4)

plot of chunk tab-collect-membership-heatmap-3

collect_plots(res_list, k = 5, fun = membership_heatmap, mc.cores = 4)

plot of chunk tab-collect-membership-heatmap-4

collect_plots(res_list, k = 6, fun = membership_heatmap, mc.cores = 4)

plot of chunk tab-collect-membership-heatmap-5

Signature heatmap

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)

plot of chunk tab-collect-get-signatures-1

collect_plots(res_list, k = 3, fun = get_signatures, mc.cores = 4)

plot of chunk tab-collect-get-signatures-2

collect_plots(res_list, k = 4, fun = get_signatures, mc.cores = 4)

plot of chunk tab-collect-get-signatures-3

collect_plots(res_list, k = 5, fun = get_signatures, mc.cores = 4)

plot of chunk tab-collect-get-signatures-4

collect_plots(res_list, k = 6, fun = get_signatures, mc.cores = 4)

plot of chunk tab-collect-get-signatures-5

Statistics table

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.973           0.944       0.979          0.502 0.498   0.498
#> CV:NMF      2 1.000           0.967       0.986          0.504 0.498   0.498
#> MAD:NMF     2 0.973           0.941       0.978          0.503 0.496   0.496
#> ATC:NMF     2 0.922           0.926       0.972          0.502 0.498   0.498
#> SD:skmeans  2 1.000           0.987       0.995          0.504 0.498   0.498
#> CV:skmeans  2 1.000           0.988       0.995          0.504 0.498   0.498
#> MAD:skmeans 2 1.000           0.986       0.994          0.504 0.496   0.496
#> ATC:skmeans 2 1.000           0.990       0.996          0.507 0.494   0.494
#> SD:mclust   2 0.293           0.718       0.821          0.362 0.705   0.705
#> CV:mclust   2 0.610           0.850       0.916          0.384 0.562   0.562
#> MAD:mclust  2 0.531           0.930       0.930          0.465 0.498   0.498
#> ATC:mclust  2 1.000           0.970       0.969          0.489 0.496   0.496
#> SD:kmeans   2 0.528           0.926       0.935          0.493 0.498   0.498
#> CV:kmeans   2 0.514           0.898       0.914          0.491 0.498   0.498
#> MAD:kmeans  2 1.000           0.964       0.968          0.498 0.498   0.498
#> ATC:kmeans  2 1.000           0.955       0.973          0.503 0.494   0.494
#> SD:pam      2 0.558           0.729       0.896          0.486 0.498   0.498
#> CV:pam      2 0.616           0.875       0.926          0.475 0.529   0.529
#> MAD:pam     2 0.637           0.790       0.915          0.498 0.496   0.496
#> ATC:pam     2 0.846           0.908       0.962          0.505 0.494   0.494
#> SD:hclust   2 0.679           0.854       0.927          0.494 0.496   0.496
#> CV:hclust   2 0.622           0.838       0.901          0.479 0.507   0.507
#> MAD:hclust  2 0.625           0.876       0.937          0.492 0.498   0.498
#> ATC:hclust  2 0.322           0.781       0.853          0.458 0.500   0.500
get_stats(res_list, k = 3)
#>             k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> SD:NMF      3 0.920           0.928       0.960          0.317 0.784   0.590
#> CV:NMF      3 0.786           0.861       0.920          0.310 0.765   0.562
#> MAD:NMF     3 0.892           0.913       0.957          0.317 0.776   0.576
#> ATC:NMF     3 0.871           0.876       0.948          0.308 0.736   0.518
#> SD:skmeans  3 0.983           0.955       0.982          0.311 0.784   0.590
#> CV:skmeans  3 0.999           0.955       0.981          0.313 0.775   0.577
#> MAD:skmeans 3 1.000           0.954       0.982          0.309 0.776   0.578
#> ATC:skmeans 3 0.982           0.960       0.983          0.310 0.756   0.544
#> SD:mclust   3 0.526           0.764       0.877          0.704 0.603   0.461
#> CV:mclust   3 0.819           0.821       0.901          0.702 0.679   0.474
#> MAD:mclust  3 0.537           0.722       0.870          0.281 0.620   0.395
#> ATC:mclust  3 0.885           0.958       0.963          0.331 0.771   0.569
#> SD:kmeans   3 1.000           0.986       0.991          0.328 0.794   0.607
#> CV:kmeans   3 1.000           0.969       0.979          0.335 0.794   0.607
#> MAD:kmeans  3 0.954           0.960       0.975          0.321 0.794   0.607
#> ATC:kmeans  3 0.833           0.936       0.949          0.314 0.774   0.572
#> SD:pam      3 0.481           0.555       0.778          0.334 0.791   0.603
#> CV:pam      3 0.520           0.749       0.851          0.351 0.804   0.643
#> MAD:pam     3 0.598           0.692       0.792          0.309 0.764   0.566
#> ATC:pam     3 0.686           0.838       0.926          0.285 0.741   0.527
#> SD:hclust   3 0.702           0.706       0.874          0.180 0.869   0.749
#> CV:hclust   3 0.671           0.747       0.872          0.182 0.962   0.926
#> MAD:hclust  3 0.632           0.805       0.900          0.209 0.903   0.805
#> ATC:hclust  3 0.486           0.825       0.874          0.356 0.825   0.656
get_stats(res_list, k = 4)
#>             k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> SD:NMF      4 0.623           0.655       0.821         0.1280 0.829   0.551
#> CV:NMF      4 0.596           0.616       0.795         0.1165 0.931   0.803
#> MAD:NMF     4 0.645           0.661       0.825         0.1272 0.819   0.530
#> ATC:NMF     4 0.602           0.655       0.824         0.1040 0.821   0.548
#> SD:skmeans  4 0.902           0.894       0.940         0.1258 0.895   0.699
#> CV:skmeans  4 0.703           0.433       0.797         0.1191 0.952   0.868
#> MAD:skmeans 4 0.892           0.923       0.954         0.1291 0.894   0.698
#> ATC:skmeans 4 0.947           0.955       0.970         0.1257 0.903   0.715
#> SD:mclust   4 0.729           0.804       0.845         0.1788 0.769   0.461
#> CV:mclust   4 0.761           0.846       0.908         0.1014 0.890   0.700
#> MAD:mclust  4 0.815           0.881       0.933         0.2440 0.783   0.487
#> ATC:mclust  4 0.732           0.731       0.883         0.1304 0.774   0.443
#> SD:kmeans   4 0.725           0.644       0.809         0.1114 0.969   0.913
#> CV:kmeans   4 0.743           0.775       0.851         0.1033 0.938   0.823
#> MAD:kmeans  4 0.743           0.700       0.793         0.1111 0.930   0.797
#> ATC:kmeans  4 0.746           0.681       0.835         0.1117 0.931   0.797
#> SD:pam      4 0.694           0.737       0.878         0.1562 0.830   0.557
#> CV:pam      4 0.629           0.665       0.826         0.1613 0.811   0.535
#> MAD:pam     4 0.901           0.865       0.941         0.1554 0.873   0.652
#> ATC:pam     4 0.928           0.932       0.967         0.1654 0.793   0.477
#> SD:hclust   4 0.675           0.776       0.888         0.0782 0.925   0.826
#> CV:hclust   4 0.697           0.754       0.869         0.1033 0.886   0.763
#> MAD:hclust  4 0.626           0.755       0.874         0.0672 0.968   0.922
#> ATC:hclust  4 0.766           0.801       0.853         0.0941 0.986   0.960
get_stats(res_list, k = 5)
#>             k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> SD:NMF      5 0.622           0.580       0.774         0.0603 0.920   0.704
#> CV:NMF      5 0.631           0.545       0.773         0.0778 0.813   0.450
#> MAD:NMF     5 0.611           0.592       0.768         0.0602 0.928   0.731
#> ATC:NMF     5 0.634           0.541       0.720         0.0584 0.870   0.608
#> SD:skmeans  5 0.774           0.784       0.877         0.0668 0.947   0.795
#> CV:skmeans  5 0.698           0.677       0.831         0.0754 0.836   0.536
#> MAD:skmeans 5 0.822           0.836       0.903         0.0619 0.943   0.779
#> ATC:skmeans 5 0.965           0.920       0.961         0.0625 0.932   0.741
#> SD:mclust   5 0.810           0.843       0.885         0.0735 0.872   0.572
#> CV:mclust   5 0.751           0.723       0.811         0.0622 0.990   0.965
#> MAD:mclust  5 0.884           0.828       0.916         0.0646 0.897   0.636
#> ATC:mclust  5 0.690           0.752       0.818         0.0609 0.957   0.830
#> SD:kmeans   5 0.676           0.676       0.799         0.0755 0.845   0.549
#> CV:kmeans   5 0.672           0.598       0.762         0.0768 0.932   0.769
#> MAD:kmeans  5 0.706           0.766       0.821         0.0744 0.884   0.617
#> ATC:kmeans  5 0.757           0.762       0.822         0.0675 0.882   0.602
#> SD:pam      5 0.728           0.730       0.848         0.0527 0.895   0.629
#> CV:pam      5 0.676           0.673       0.786         0.0480 0.911   0.684
#> MAD:pam     5 0.835           0.822       0.908         0.0501 0.914   0.682
#> ATC:pam     5 0.905           0.848       0.933         0.0494 0.950   0.800
#> SD:hclust   5 0.628           0.664       0.831         0.1465 0.930   0.810
#> CV:hclust   5 0.638           0.702       0.842         0.1268 0.940   0.840
#> MAD:hclust  5 0.618           0.568       0.760         0.1397 0.880   0.698
#> ATC:hclust  5 0.833           0.773       0.874         0.0675 0.964   0.888
get_stats(res_list, k = 6)
#>             k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> SD:NMF      6 0.631           0.521       0.740         0.0461 0.863   0.467
#> CV:NMF      6 0.619           0.452       0.693         0.0397 0.925   0.668
#> MAD:NMF     6 0.619           0.481       0.701         0.0461 0.882   0.524
#> ATC:NMF     6 0.637           0.498       0.736         0.0480 0.868   0.561
#> SD:skmeans  6 0.728           0.686       0.792         0.0410 0.993   0.968
#> CV:skmeans  6 0.689           0.593       0.751         0.0411 0.980   0.904
#> MAD:skmeans 6 0.765           0.724       0.805         0.0405 0.985   0.929
#> ATC:skmeans 6 0.911           0.902       0.919         0.0408 0.954   0.776
#> SD:mclust   6 0.736           0.697       0.833         0.0425 0.952   0.784
#> CV:mclust   6 0.725           0.464       0.752         0.0580 0.895   0.652
#> MAD:mclust  6 0.805           0.701       0.839         0.0353 0.920   0.653
#> ATC:mclust  6 0.868           0.826       0.924         0.0615 0.918   0.643
#> SD:kmeans   6 0.694           0.637       0.746         0.0456 0.949   0.767
#> CV:kmeans   6 0.664           0.466       0.713         0.0463 0.917   0.672
#> MAD:kmeans  6 0.730           0.583       0.764         0.0460 0.968   0.851
#> ATC:kmeans  6 0.820           0.728       0.804         0.0438 0.975   0.879
#> SD:pam      6 0.725           0.555       0.747         0.0394 0.967   0.847
#> CV:pam      6 0.685           0.568       0.784         0.0321 0.969   0.870
#> MAD:pam     6 0.805           0.670       0.802         0.0387 0.939   0.718
#> ATC:pam     6 0.937           0.859       0.941         0.0447 0.943   0.735
#> SD:hclust   6 0.663           0.647       0.783         0.0427 0.994   0.980
#> CV:hclust   6 0.621           0.652       0.826         0.0413 0.993   0.978
#> MAD:hclust  6 0.680           0.617       0.767         0.0557 0.919   0.758
#> ATC:hclust  6 0.803           0.836       0.887         0.0244 0.980   0.932

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)

plot of chunk tab-collect-stats-from-consensus-partition-list-1

collect_stats(res_list, k = 3)

plot of chunk tab-collect-stats-from-consensus-partition-list-2

collect_stats(res_list, k = 4)

plot of chunk tab-collect-stats-from-consensus-partition-list-3

collect_stats(res_list, k = 5)

plot of chunk tab-collect-stats-from-consensus-partition-list-4

collect_stats(res_list, k = 6)

plot of chunk tab-collect-stats-from-consensus-partition-list-5

Partition from all methods

Collect partitions from all methods:

collect_classes(res_list, k = 2)

plot of chunk tab-collect-classes-from-consensus-partition-list-1

collect_classes(res_list, k = 3)

plot of chunk tab-collect-classes-from-consensus-partition-list-2

collect_classes(res_list, k = 4)

plot of chunk tab-collect-classes-from-consensus-partition-list-3

collect_classes(res_list, k = 5)

plot of chunk tab-collect-classes-from-consensus-partition-list-4

collect_classes(res_list, k = 6)

plot of chunk tab-collect-classes-from-consensus-partition-list-5

Top rows overlap

Overlap of top rows from different top-row methods:

top_rows_overlap(res_list, top_n = 776, method = "euler")

plot of chunk tab-top-rows-overlap-by-euler-1

top_rows_overlap(res_list, top_n = 1552, method = "euler")

plot of chunk tab-top-rows-overlap-by-euler-2

top_rows_overlap(res_list, top_n = 2328, method = "euler")

plot of chunk tab-top-rows-overlap-by-euler-3

top_rows_overlap(res_list, top_n = 3103, method = "euler")

plot of chunk tab-top-rows-overlap-by-euler-4

top_rows_overlap(res_list, top_n = 3879, method = "euler")

plot of chunk tab-top-rows-overlap-by-euler-5

Also visualize the correspondance of rankings between different top-row methods:

top_rows_overlap(res_list, top_n = 776, method = "correspondance")

plot of chunk tab-top-rows-overlap-by-correspondance-1

top_rows_overlap(res_list, top_n = 1552, method = "correspondance")

plot of chunk tab-top-rows-overlap-by-correspondance-2

top_rows_overlap(res_list, top_n = 2328, method = "correspondance")

plot of chunk tab-top-rows-overlap-by-correspondance-3

top_rows_overlap(res_list, top_n = 3103, method = "correspondance")

plot of chunk tab-top-rows-overlap-by-correspondance-4

top_rows_overlap(res_list, top_n = 3879, method = "correspondance")

plot of chunk tab-top-rows-overlap-by-correspondance-5

Heatmaps of the top rows:

top_rows_heatmap(res_list, top_n = 776)

plot of chunk tab-top-rows-heatmap-1

top_rows_heatmap(res_list, top_n = 1552)

plot of chunk tab-top-rows-heatmap-2

top_rows_heatmap(res_list, top_n = 2328)

plot of chunk tab-top-rows-heatmap-3

top_rows_heatmap(res_list, top_n = 3103)

plot of chunk tab-top-rows-heatmap-4

top_rows_heatmap(res_list, top_n = 3879)

plot of chunk tab-top-rows-heatmap-5

Test to known annotations

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  time(p) k
#> SD:NMF      77 6.27e-07 2
#> CV:NMF      77 5.70e-07 2
#> MAD:NMF     75 1.02e-06 2
#> ATC:NMF     76 9.68e-07 2
#> SD:skmeans  78 3.66e-07 2
#> CV:skmeans  79 3.41e-07 2
#> MAD:skmeans 78 3.66e-07 2
#> ATC:skmeans 79 6.81e-06 2
#> SD:mclust   73 1.53e-02 2
#> CV:mclust   75 4.38e-04 2
#> MAD:mclust  79 3.41e-07 2
#> ATC:mclust  79 3.90e-07 2
#> SD:kmeans   79 3.41e-07 2
#> CV:kmeans   79 3.41e-07 2
#> MAD:kmeans  79 3.41e-07 2
#> ATC:kmeans  78 2.73e-06 2
#> SD:pam      65 7.62e-05 2
#> CV:pam      77 6.31e-02 2
#> MAD:pam     71 7.38e-06 2
#> ATC:pam     75 2.20e-04 2
#> SD:hclust   72 2.53e-07 2
#> CV:hclust   73 2.65e-07 2
#> MAD:hclust  75 3.82e-07 2
#> ATC:hclust  70 1.24e-07 2
test_to_known_factors(res_list, k = 3)
#>              n  time(p) k
#> SD:NMF      78 2.67e-05 3
#> CV:NMF      76 3.48e-05 3
#> MAD:NMF     75 4.07e-05 3
#> ATC:NMF     72 1.22e-05 3
#> SD:skmeans  78 2.67e-05 3
#> CV:skmeans  77 2.91e-05 3
#> MAD:skmeans 77 2.19e-05 3
#> ATC:skmeans 78 9.67e-06 3
#> SD:mclust   73 7.00e-03 3
#> CV:mclust   71 5.49e-05 3
#> MAD:mclust  70 2.12e-02 3
#> ATC:mclust  79 2.39e-06 3
#> SD:kmeans   79 1.69e-05 3
#> CV:kmeans   78 1.71e-05 3
#> MAD:kmeans  79 1.69e-05 3
#> ATC:kmeans  79 9.57e-06 3
#> SD:pam      51 5.28e-05 3
#> CV:pam      74 7.17e-07 3
#> MAD:pam     69 2.65e-07 3
#> ATC:pam     72 4.32e-06 3
#> SD:hclust   63 7.31e-06 3
#> CV:hclust   64 1.94e-04 3
#> MAD:hclust  72 2.14e-09 3
#> ATC:hclust  79 2.39e-06 3
test_to_known_factors(res_list, k = 4)
#>              n  time(p) k
#> SD:NMF      64 3.55e-04 4
#> CV:NMF      63 1.58e-03 4
#> MAD:NMF     64 3.55e-04 4
#> ATC:NMF     64 5.08e-04 4
#> SD:skmeans  78 3.11e-05 4
#> CV:skmeans  44 8.32e-02 4
#> MAD:skmeans 77 3.99e-05 4
#> ATC:skmeans 79 1.58e-05 4
#> SD:mclust   72 1.16e-03 4
#> CV:mclust   76 2.12e-08 4
#> MAD:mclust  77 5.62e-04 4
#> ATC:mclust  68 9.53e-06 4
#> SD:kmeans   64 1.86e-04 4
#> CV:kmeans   68 6.39e-04 4
#> MAD:kmeans  67 3.93e-04 4
#> ATC:kmeans  69 2.16e-04 4
#> SD:pam      67 1.18e-04 4
#> CV:pam      65 2.76e-05 4
#> MAD:pam     73 3.63e-04 4
#> ATC:pam     78 1.19e-06 4
#> SD:hclust   69 1.35e-07 4
#> CV:hclust   68 1.68e-08 4
#> MAD:hclust  70 1.24e-07 4
#> ATC:hclust  69 5.91e-06 4
test_to_known_factors(res_list, k = 5)
#>              n  time(p) k
#> SD:NMF      61 3.46e-04 5
#> CV:NMF      55 1.09e-03 5
#> MAD:NMF     59 9.64e-05 5
#> ATC:NMF     49 1.13e-02 5
#> SD:skmeans  72 3.03e-05 5
#> CV:skmeans  67 5.27e-07 5
#> MAD:skmeans 74 1.86e-05 5
#> ATC:skmeans 76 3.32e-06 5
#> SD:mclust   75 4.54e-06 5
#> CV:mclust   71 5.57e-08 5
#> MAD:mclust  72 2.19e-05 5
#> ATC:mclust  74 4.48e-06 5
#> SD:kmeans   68 4.99e-05 5
#> CV:kmeans   62 1.84e-06 5
#> MAD:kmeans  74 1.92e-05 5
#> ATC:kmeans  75 2.03e-06 5
#> SD:pam      68 1.96e-04 5
#> CV:pam      66 1.30e-05 5
#> MAD:pam     73 2.54e-05 5
#> ATC:pam     72 6.62e-06 5
#> SD:hclust   65 4.36e-07 5
#> CV:hclust   68 7.03e-08 5
#> MAD:hclust  53 1.32e-05 5
#> ATC:hclust  70 1.74e-05 5
test_to_known_factors(res_list, k = 6)
#>              n  time(p) k
#> SD:NMF      49 2.57e-03 6
#> CV:NMF      41 4.42e-05 6
#> MAD:NMF     46 1.46e-03 6
#> ATC:NMF     48 1.92e-05 6
#> SD:skmeans  71 1.71e-05 6
#> CV:skmeans  61 1.21e-05 6
#> MAD:skmeans 73 1.17e-05 6
#> ATC:skmeans 76 1.94e-05 6
#> SD:mclust   70 4.23e-05 6
#> CV:mclust   44 4.67e-04 6
#> MAD:mclust  61 5.94e-05 6
#> ATC:mclust  73 1.32e-05 6
#> SD:kmeans   67 1.42e-07 6
#> CV:kmeans   50 1.07e-01 6
#> MAD:kmeans  59 1.43e-04 6
#> ATC:kmeans  61 1.20e-05 6
#> SD:pam      52 8.95e-04 6
#> CV:pam      58 1.59e-05 6
#> MAD:pam     66 1.70e-05 6
#> ATC:pam     72 8.78e-05 6
#> SD:hclust   66 3.59e-09 6
#> CV:hclust   60 1.25e-08 6
#> MAD:hclust  62 1.01e-06 6
#> ATC:hclust  75 6.20e-06 6

Results for each method


SD:hclust

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 7758 rows and 79 columns.
#>   Top rows (776, 1552, 2328, 3103, 3879) are extracted by 'SD' method.
#>   Subgroups are detected by 'hclust' method.
#>   Performed in total 1250 partitions by row resampling.
#>   Best k for subgroups seems to be 2.
#> 
#> Following methods can be applied to this 'ConsensusPartition' object:
#>  [1] "cola_report"             "collect_classes"         "collect_plots"          
#>  [4] "collect_stats"           "colnames"                "compare_signatures"     
#>  [7] "consensus_heatmap"       "dimension_reduction"     "functional_enrichment"  
#> [10] "get_anno_col"            "get_anno"                "get_classes"            
#> [13] "get_consensus"           "get_matrix"              "get_membership"         
#> [16] "get_param"               "get_signatures"          "get_stats"              
#> [19] "is_best_k"               "is_stable_k"             "membership_heatmap"     
#> [22] "ncol"                    "nrow"                    "plot_ecdf"              
#> [25] "rownames"                "select_partition_number" "show"                   
#> [28] "suggest_best_k"          "test_to_known_factors"

collect_plots() function collects all the plots made from res for all k (number of partitions) into one single page to provide an easy and fast comparison between different k.

collect_plots(res)

plot of chunk SD-hclust-collect-plots

The plots are:

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:

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)

plot of chunk SD-hclust-select-partition-number

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.679           0.854       0.927         0.4937 0.496   0.496
#> 3 3 0.702           0.706       0.874         0.1800 0.869   0.749
#> 4 4 0.675           0.776       0.888         0.0782 0.925   0.826
#> 5 5 0.628           0.664       0.831         0.1465 0.930   0.810
#> 6 6 0.663           0.647       0.783         0.0427 0.994   0.980

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.

show/hide code output

cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#>          class entropy silhouette    p1    p2
#> GSM35441     2  0.0938      0.903 0.012 0.988
#> GSM35446     2  0.5408      0.843 0.124 0.876
#> GSM35449     2  0.0938      0.903 0.012 0.988
#> GSM35455     2  0.0938      0.903 0.012 0.988
#> GSM35458     2  0.2948      0.896 0.052 0.948
#> GSM35460     2  0.5408      0.843 0.124 0.876
#> GSM35461     2  0.9922      0.254 0.448 0.552
#> GSM35463     2  0.0938      0.903 0.012 0.988
#> GSM35472     2  0.9850      0.316 0.428 0.572
#> GSM35475     2  0.2236      0.899 0.036 0.964
#> GSM35483     2  0.0938      0.903 0.012 0.988
#> GSM35496     1  0.0938      0.936 0.988 0.012
#> GSM35497     2  0.0938      0.903 0.012 0.988
#> GSM35504     2  0.3879      0.885 0.076 0.924
#> GSM35508     2  0.0938      0.902 0.012 0.988
#> GSM35511     2  0.2236      0.899 0.036 0.964
#> GSM35512     2  0.9491      0.469 0.368 0.632
#> GSM35515     2  0.2948      0.896 0.052 0.948
#> GSM35519     2  0.9491      0.469 0.368 0.632
#> GSM35527     2  0.0938      0.902 0.012 0.988
#> GSM35532     2  0.2423      0.898 0.040 0.960
#> GSM35439     2  0.0938      0.903 0.012 0.988
#> GSM35443     1  0.0672      0.940 0.992 0.008
#> GSM35445     1  0.0672      0.940 0.992 0.008
#> GSM35448     2  0.4562      0.869 0.096 0.904
#> GSM35451     1  0.2236      0.928 0.964 0.036
#> GSM35454     1  0.2603      0.923 0.956 0.044
#> GSM35457     2  0.0938      0.903 0.012 0.988
#> GSM35465     2  0.3431      0.890 0.064 0.936
#> GSM35468     1  0.0000      0.940 1.000 0.000
#> GSM35471     1  0.3584      0.902 0.932 0.068
#> GSM35473     1  0.0376      0.939 0.996 0.004
#> GSM35477     1  0.2236      0.928 0.964 0.036
#> GSM35480     1  0.0000      0.940 1.000 0.000
#> GSM35482     1  0.0672      0.938 0.992 0.008
#> GSM35485     2  0.0938      0.903 0.012 0.988
#> GSM35489     2  0.4161      0.882 0.084 0.916
#> GSM35492     1  0.0000      0.940 1.000 0.000
#> GSM35495     2  0.9881      0.278 0.436 0.564
#> GSM35499     2  0.1633      0.903 0.024 0.976
#> GSM35502     1  0.0000      0.940 1.000 0.000
#> GSM35505     1  0.2603      0.923 0.956 0.044
#> GSM35507     1  0.8713      0.594 0.708 0.292
#> GSM35510     2  0.1633      0.903 0.024 0.976
#> GSM35514     1  0.0000      0.940 1.000 0.000
#> GSM35517     2  0.0938      0.903 0.012 0.988
#> GSM35520     2  0.3879      0.888 0.076 0.924
#> GSM35523     1  0.6148      0.814 0.848 0.152
#> GSM35529     2  0.0938      0.903 0.012 0.988
#> GSM35531     2  0.4161      0.882 0.084 0.916
#> GSM35534     2  0.0938      0.903 0.012 0.988
#> GSM35536     1  0.0376      0.940 0.996 0.004
#> GSM35538     1  0.0938      0.939 0.988 0.012
#> GSM35539     1  0.0376      0.940 0.996 0.004
#> GSM35540     2  0.2778      0.898 0.048 0.952
#> GSM35541     2  0.0938      0.903 0.012 0.988
#> GSM35442     1  0.0672      0.940 0.992 0.008
#> GSM35447     1  0.2603      0.923 0.956 0.044
#> GSM35450     1  0.1843      0.932 0.972 0.028
#> GSM35453     1  0.0376      0.939 0.996 0.004
#> GSM35456     1  0.6048      0.823 0.852 0.148
#> GSM35464     1  0.9323      0.473 0.652 0.348
#> GSM35467     1  0.0000      0.940 1.000 0.000
#> GSM35470     1  0.0672      0.938 0.992 0.008
#> GSM35479     1  0.0938      0.936 0.988 0.012
#> GSM35484     1  0.1414      0.936 0.980 0.020
#> GSM35488     1  0.0672      0.940 0.992 0.008
#> GSM35491     1  0.0000      0.940 1.000 0.000
#> GSM35494     1  0.0938      0.936 0.988 0.012
#> GSM35498     1  0.9323      0.473 0.652 0.348
#> GSM35501     1  0.0000      0.940 1.000 0.000
#> GSM35509     1  0.9044      0.518 0.680 0.320
#> GSM35513     1  0.0000      0.940 1.000 0.000
#> GSM35516     2  0.8386      0.660 0.268 0.732
#> GSM35522     1  0.6148      0.814 0.848 0.152
#> GSM35525     1  0.0000      0.940 1.000 0.000
#> GSM35528     1  0.0672      0.940 0.992 0.008
#> GSM35533     1  0.1414      0.936 0.980 0.020
#> GSM35537     1  0.0672      0.940 0.992 0.008

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>          class entropy silhouette    p1    p2    p3
#> GSM35441     2  0.0475      0.804 0.004 0.992 0.004
#> GSM35446     3  0.0424      0.594 0.000 0.008 0.992
#> GSM35449     2  0.0829      0.801 0.004 0.984 0.012
#> GSM35455     2  0.0829      0.801 0.004 0.984 0.012
#> GSM35458     3  0.7029      0.470 0.020 0.440 0.540
#> GSM35460     3  0.0424      0.594 0.000 0.008 0.992
#> GSM35461     1  0.9864     -0.187 0.416 0.296 0.288
#> GSM35463     2  0.1525      0.792 0.004 0.964 0.032
#> GSM35472     1  0.9921     -0.239 0.396 0.308 0.296
#> GSM35475     3  0.6215      0.494 0.000 0.428 0.572
#> GSM35483     2  0.1525      0.792 0.004 0.964 0.032
#> GSM35496     1  0.2261      0.877 0.932 0.000 0.068
#> GSM35497     2  0.0829      0.801 0.004 0.984 0.012
#> GSM35504     3  0.5291      0.504 0.000 0.268 0.732
#> GSM35508     2  0.6140     -0.119 0.000 0.596 0.404
#> GSM35511     3  0.6215      0.494 0.000 0.428 0.572
#> GSM35512     2  0.9996     -0.199 0.328 0.348 0.324
#> GSM35515     3  0.7029      0.470 0.020 0.440 0.540
#> GSM35519     2  0.9996     -0.199 0.328 0.348 0.324
#> GSM35527     2  0.6140     -0.119 0.000 0.596 0.404
#> GSM35532     3  0.6204      0.498 0.000 0.424 0.576
#> GSM35439     2  0.0237      0.804 0.004 0.996 0.000
#> GSM35443     1  0.0747      0.902 0.984 0.000 0.016
#> GSM35445     1  0.0592      0.903 0.988 0.000 0.012
#> GSM35448     3  0.1643      0.600 0.000 0.044 0.956
#> GSM35451     1  0.1411      0.894 0.964 0.036 0.000
#> GSM35454     1  0.2096      0.884 0.944 0.004 0.052
#> GSM35457     2  0.0661      0.804 0.004 0.988 0.008
#> GSM35465     2  0.2550      0.764 0.056 0.932 0.012
#> GSM35468     1  0.0000      0.903 1.000 0.000 0.000
#> GSM35471     1  0.2651      0.872 0.928 0.060 0.012
#> GSM35473     1  0.0424      0.903 0.992 0.000 0.008
#> GSM35477     1  0.1411      0.894 0.964 0.036 0.000
#> GSM35480     1  0.0000      0.903 1.000 0.000 0.000
#> GSM35482     1  0.1163      0.897 0.972 0.000 0.028
#> GSM35485     2  0.0237      0.804 0.004 0.996 0.000
#> GSM35489     2  0.4095      0.728 0.064 0.880 0.056
#> GSM35492     1  0.0000      0.903 1.000 0.000 0.000
#> GSM35495     3  0.5882      0.267 0.348 0.000 0.652
#> GSM35499     2  0.1774      0.797 0.016 0.960 0.024
#> GSM35502     1  0.0000      0.903 1.000 0.000 0.000
#> GSM35505     1  0.2096      0.884 0.944 0.004 0.052
#> GSM35507     1  0.6019      0.595 0.700 0.288 0.012
#> GSM35510     2  0.1774      0.797 0.016 0.960 0.024
#> GSM35514     1  0.0000      0.903 1.000 0.000 0.000
#> GSM35517     2  0.0237      0.804 0.004 0.996 0.000
#> GSM35520     2  0.5276      0.656 0.052 0.820 0.128
#> GSM35523     1  0.4110      0.789 0.844 0.152 0.004
#> GSM35529     2  0.0475      0.804 0.004 0.992 0.004
#> GSM35531     2  0.4095      0.728 0.064 0.880 0.056
#> GSM35534     2  0.0237      0.804 0.004 0.996 0.000
#> GSM35536     1  0.0237      0.903 0.996 0.004 0.000
#> GSM35538     1  0.0592      0.903 0.988 0.012 0.000
#> GSM35539     1  0.0237      0.903 0.996 0.004 0.000
#> GSM35540     2  0.2269      0.781 0.040 0.944 0.016
#> GSM35541     2  0.0237      0.804 0.004 0.996 0.000
#> GSM35442     1  0.0747      0.902 0.984 0.000 0.016
#> GSM35447     1  0.2096      0.884 0.944 0.004 0.052
#> GSM35450     1  0.1163      0.897 0.972 0.028 0.000
#> GSM35453     1  0.0424      0.903 0.992 0.000 0.008
#> GSM35456     1  0.4411      0.794 0.844 0.140 0.016
#> GSM35464     1  0.6404      0.494 0.644 0.344 0.012
#> GSM35467     1  0.0000      0.903 1.000 0.000 0.000
#> GSM35470     1  0.1163      0.897 0.972 0.000 0.028
#> GSM35479     1  0.2356      0.875 0.928 0.000 0.072
#> GSM35484     1  0.0983      0.901 0.980 0.016 0.004
#> GSM35488     1  0.0424      0.903 0.992 0.008 0.000
#> GSM35491     1  0.0000      0.903 1.000 0.000 0.000
#> GSM35494     1  0.2165      0.879 0.936 0.000 0.064
#> GSM35498     1  0.6404      0.494 0.644 0.344 0.012
#> GSM35501     1  0.0000      0.903 1.000 0.000 0.000
#> GSM35509     1  0.6140      0.398 0.596 0.000 0.404
#> GSM35513     1  0.0000      0.903 1.000 0.000 0.000
#> GSM35516     2  0.5881      0.419 0.256 0.728 0.016
#> GSM35522     1  0.4110      0.789 0.844 0.152 0.004
#> GSM35525     1  0.0000      0.903 1.000 0.000 0.000
#> GSM35528     1  0.0424      0.903 0.992 0.008 0.000
#> GSM35533     1  0.0983      0.901 0.980 0.016 0.004
#> GSM35537     1  0.0829      0.903 0.984 0.004 0.012

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>          class entropy silhouette    p1    p2    p3    p4
#> GSM35441     2  0.2714      0.846 0.000 0.884 0.112 0.004
#> GSM35446     4  0.0921      0.741 0.000 0.000 0.028 0.972
#> GSM35449     2  0.4088      0.736 0.000 0.764 0.232 0.004
#> GSM35455     2  0.4088      0.736 0.000 0.764 0.232 0.004
#> GSM35458     3  0.2775      0.596 0.020 0.084 0.896 0.000
#> GSM35460     4  0.0921      0.741 0.000 0.000 0.028 0.972
#> GSM35461     3  0.5993      0.396 0.408 0.028 0.556 0.008
#> GSM35463     2  0.1406      0.865 0.000 0.960 0.016 0.024
#> GSM35472     3  0.5822      0.413 0.392 0.028 0.576 0.004
#> GSM35475     3  0.1302      0.591 0.000 0.044 0.956 0.000
#> GSM35483     2  0.1520      0.863 0.000 0.956 0.020 0.024
#> GSM35496     1  0.2965      0.866 0.892 0.000 0.036 0.072
#> GSM35497     2  0.4088      0.736 0.000 0.764 0.232 0.004
#> GSM35504     4  0.5448      0.511 0.000 0.244 0.056 0.700
#> GSM35508     3  0.4720      0.343 0.000 0.324 0.672 0.004
#> GSM35511     3  0.1302      0.591 0.000 0.044 0.956 0.000
#> GSM35512     3  0.5560      0.476 0.324 0.028 0.644 0.004
#> GSM35515     3  0.2775      0.596 0.020 0.084 0.896 0.000
#> GSM35519     3  0.5560      0.476 0.324 0.028 0.644 0.004
#> GSM35527     3  0.4720      0.343 0.000 0.324 0.672 0.004
#> GSM35532     3  0.1211      0.588 0.000 0.040 0.960 0.000
#> GSM35439     2  0.0188      0.874 0.000 0.996 0.004 0.000
#> GSM35443     1  0.1284      0.909 0.964 0.000 0.024 0.012
#> GSM35445     1  0.0927      0.912 0.976 0.000 0.016 0.008
#> GSM35448     4  0.1837      0.735 0.000 0.028 0.028 0.944
#> GSM35451     1  0.1305      0.905 0.960 0.036 0.004 0.000
#> GSM35454     1  0.2076      0.891 0.932 0.004 0.056 0.008
#> GSM35457     2  0.2266      0.863 0.000 0.912 0.084 0.004
#> GSM35465     2  0.2901      0.854 0.040 0.908 0.036 0.016
#> GSM35468     1  0.0336      0.914 0.992 0.000 0.008 0.000
#> GSM35471     1  0.2287      0.881 0.924 0.060 0.012 0.004
#> GSM35473     1  0.0804      0.911 0.980 0.000 0.012 0.008
#> GSM35477     1  0.1305      0.905 0.960 0.036 0.004 0.000
#> GSM35480     1  0.0188      0.914 0.996 0.000 0.004 0.000
#> GSM35482     1  0.2124      0.893 0.932 0.000 0.028 0.040
#> GSM35485     2  0.0188      0.874 0.000 0.996 0.004 0.000
#> GSM35489     2  0.4198      0.786 0.052 0.828 0.116 0.004
#> GSM35492     1  0.0524      0.913 0.988 0.000 0.008 0.004
#> GSM35495     4  0.5492      0.325 0.328 0.000 0.032 0.640
#> GSM35499     2  0.2275      0.872 0.004 0.928 0.048 0.020
#> GSM35502     1  0.0188      0.913 0.996 0.000 0.004 0.000
#> GSM35505     1  0.2076      0.891 0.932 0.004 0.056 0.008
#> GSM35507     1  0.5182      0.566 0.692 0.284 0.012 0.012
#> GSM35510     2  0.2360      0.872 0.004 0.924 0.052 0.020
#> GSM35514     1  0.0188      0.913 0.996 0.000 0.004 0.000
#> GSM35517     2  0.0376      0.873 0.004 0.992 0.004 0.000
#> GSM35520     2  0.4973      0.706 0.040 0.752 0.204 0.004
#> GSM35523     1  0.3780      0.779 0.832 0.148 0.004 0.016
#> GSM35529     2  0.2334      0.859 0.000 0.908 0.088 0.004
#> GSM35531     2  0.4198      0.786 0.052 0.828 0.116 0.004
#> GSM35534     2  0.0188      0.874 0.000 0.996 0.004 0.000
#> GSM35536     1  0.0376      0.914 0.992 0.004 0.004 0.000
#> GSM35538     1  0.0657      0.913 0.984 0.012 0.004 0.000
#> GSM35539     1  0.0524      0.914 0.988 0.008 0.000 0.004
#> GSM35540     2  0.2694      0.865 0.024 0.916 0.044 0.016
#> GSM35541     2  0.0188      0.874 0.000 0.996 0.004 0.000
#> GSM35442     1  0.1284      0.909 0.964 0.000 0.024 0.012
#> GSM35447     1  0.2076      0.891 0.932 0.004 0.056 0.008
#> GSM35450     1  0.1109      0.908 0.968 0.028 0.004 0.000
#> GSM35453     1  0.0804      0.911 0.980 0.000 0.012 0.008
#> GSM35456     1  0.3873      0.791 0.832 0.144 0.016 0.008
#> GSM35464     1  0.5793      0.448 0.628 0.336 0.020 0.016
#> GSM35467     1  0.0188      0.913 0.996 0.000 0.004 0.000
#> GSM35470     1  0.2124      0.893 0.932 0.000 0.028 0.040
#> GSM35479     1  0.2949      0.862 0.888 0.000 0.024 0.088
#> GSM35484     1  0.0927      0.912 0.976 0.016 0.008 0.000
#> GSM35488     1  0.0524      0.914 0.988 0.008 0.004 0.000
#> GSM35491     1  0.0524      0.913 0.988 0.000 0.008 0.004
#> GSM35494     1  0.2845      0.869 0.896 0.000 0.028 0.076
#> GSM35498     1  0.5793      0.448 0.628 0.336 0.020 0.016
#> GSM35501     1  0.0188      0.913 0.996 0.000 0.004 0.000
#> GSM35509     1  0.5756      0.259 0.568 0.000 0.032 0.400
#> GSM35513     1  0.0188      0.913 0.996 0.000 0.004 0.000
#> GSM35516     2  0.4886      0.519 0.244 0.732 0.016 0.008
#> GSM35522     1  0.3780      0.779 0.832 0.148 0.004 0.016
#> GSM35525     1  0.0376      0.914 0.992 0.004 0.000 0.004
#> GSM35528     1  0.0524      0.914 0.988 0.008 0.004 0.000
#> GSM35533     1  0.0927      0.912 0.976 0.016 0.008 0.000
#> GSM35537     1  0.1262      0.912 0.968 0.008 0.008 0.016

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>          class entropy silhouette    p1    p2    p3    p4    p5
#> GSM35441     2  0.2952      0.834 0.000 0.868 0.020 0.008 0.104
#> GSM35446     4  0.1282      0.795 0.000 0.000 0.044 0.952 0.004
#> GSM35449     2  0.4542      0.698 0.000 0.724 0.036 0.008 0.232
#> GSM35455     2  0.4542      0.698 0.000 0.724 0.036 0.008 0.232
#> GSM35458     5  0.1960      0.690 0.020 0.048 0.004 0.000 0.928
#> GSM35460     4  0.1282      0.795 0.000 0.000 0.044 0.952 0.004
#> GSM35461     5  0.5274      0.432 0.056 0.000 0.372 0.000 0.572
#> GSM35463     2  0.2478      0.827 0.000 0.904 0.060 0.028 0.008
#> GSM35472     5  0.5068      0.466 0.044 0.000 0.364 0.000 0.592
#> GSM35475     5  0.0451      0.695 0.000 0.008 0.004 0.000 0.988
#> GSM35483     2  0.2629      0.822 0.000 0.896 0.064 0.032 0.008
#> GSM35496     3  0.3289      0.756 0.172 0.000 0.816 0.004 0.008
#> GSM35497     2  0.4542      0.698 0.000 0.724 0.036 0.008 0.232
#> GSM35504     4  0.4879      0.577 0.000 0.212 0.052 0.720 0.016
#> GSM35508     5  0.5295      0.414 0.000 0.280 0.064 0.008 0.648
#> GSM35511     5  0.0290      0.695 0.000 0.008 0.000 0.000 0.992
#> GSM35512     5  0.4697      0.556 0.036 0.000 0.304 0.000 0.660
#> GSM35515     5  0.1960      0.690 0.020 0.048 0.004 0.000 0.928
#> GSM35519     5  0.4697      0.556 0.036 0.000 0.304 0.000 0.660
#> GSM35527     5  0.5295      0.414 0.000 0.280 0.064 0.008 0.648
#> GSM35532     5  0.0162      0.693 0.000 0.004 0.000 0.000 0.996
#> GSM35439     2  0.0451      0.858 0.000 0.988 0.008 0.000 0.004
#> GSM35443     1  0.3910      0.509 0.720 0.000 0.272 0.000 0.008
#> GSM35445     1  0.3231      0.647 0.800 0.000 0.196 0.000 0.004
#> GSM35448     4  0.0693      0.785 0.000 0.008 0.012 0.980 0.000
#> GSM35451     1  0.1364      0.784 0.952 0.036 0.012 0.000 0.000
#> GSM35454     1  0.5112     -0.225 0.496 0.000 0.468 0.000 0.036
#> GSM35457     2  0.2429      0.851 0.000 0.900 0.020 0.004 0.076
#> GSM35465     2  0.3070      0.840 0.008 0.872 0.088 0.004 0.028
#> GSM35468     1  0.1341      0.775 0.944 0.000 0.056 0.000 0.000
#> GSM35471     1  0.2529      0.766 0.900 0.056 0.040 0.000 0.004
#> GSM35473     1  0.3039      0.647 0.808 0.000 0.192 0.000 0.000
#> GSM35477     1  0.1364      0.784 0.952 0.036 0.012 0.000 0.000
#> GSM35480     1  0.1270      0.782 0.948 0.000 0.052 0.000 0.000
#> GSM35482     3  0.3684      0.721 0.280 0.000 0.720 0.000 0.000
#> GSM35485     2  0.0451      0.858 0.000 0.988 0.008 0.000 0.004
#> GSM35489     2  0.3957      0.788 0.028 0.820 0.040 0.000 0.112
#> GSM35492     1  0.1410      0.773 0.940 0.000 0.060 0.000 0.000
#> GSM35495     4  0.5304      0.333 0.052 0.000 0.352 0.592 0.004
#> GSM35499     2  0.2705      0.855 0.004 0.900 0.048 0.012 0.036
#> GSM35502     1  0.0000      0.790 1.000 0.000 0.000 0.000 0.000
#> GSM35505     1  0.5112     -0.225 0.496 0.000 0.468 0.000 0.036
#> GSM35507     1  0.5416      0.468 0.656 0.256 0.080 0.004 0.004
#> GSM35510     2  0.2784      0.856 0.004 0.896 0.048 0.012 0.040
#> GSM35514     1  0.0162      0.790 0.996 0.000 0.004 0.000 0.000
#> GSM35517     2  0.0613      0.858 0.004 0.984 0.008 0.000 0.004
#> GSM35520     2  0.4551      0.705 0.012 0.744 0.044 0.000 0.200
#> GSM35523     1  0.4592      0.628 0.756 0.100 0.140 0.004 0.000
#> GSM35529     2  0.2490      0.847 0.000 0.896 0.020 0.004 0.080
#> GSM35531     2  0.3957      0.788 0.028 0.820 0.040 0.000 0.112
#> GSM35534     2  0.0613      0.858 0.000 0.984 0.008 0.004 0.004
#> GSM35536     1  0.0865      0.790 0.972 0.004 0.024 0.000 0.000
#> GSM35538     1  0.0807      0.790 0.976 0.012 0.012 0.000 0.000
#> GSM35539     1  0.1697      0.781 0.932 0.008 0.060 0.000 0.000
#> GSM35540     2  0.2934      0.847 0.004 0.880 0.076 0.004 0.036
#> GSM35541     2  0.0451      0.858 0.000 0.988 0.008 0.000 0.004
#> GSM35442     1  0.4046      0.459 0.696 0.000 0.296 0.000 0.008
#> GSM35447     1  0.5112     -0.225 0.496 0.000 0.468 0.000 0.036
#> GSM35450     1  0.1195      0.787 0.960 0.028 0.012 0.000 0.000
#> GSM35453     1  0.3143      0.632 0.796 0.000 0.204 0.000 0.000
#> GSM35456     1  0.3793      0.684 0.820 0.132 0.036 0.004 0.008
#> GSM35464     1  0.6020      0.362 0.588 0.304 0.092 0.004 0.012
#> GSM35467     1  0.0000      0.790 1.000 0.000 0.000 0.000 0.000
#> GSM35470     3  0.4278      0.330 0.452 0.000 0.548 0.000 0.000
#> GSM35479     3  0.3203      0.754 0.168 0.000 0.820 0.012 0.000
#> GSM35484     1  0.1179      0.792 0.964 0.016 0.016 0.000 0.004
#> GSM35488     1  0.0451      0.791 0.988 0.008 0.004 0.000 0.000
#> GSM35491     1  0.1410      0.773 0.940 0.000 0.060 0.000 0.000
#> GSM35494     3  0.3048      0.761 0.176 0.000 0.820 0.004 0.000
#> GSM35498     1  0.6020      0.362 0.588 0.304 0.092 0.004 0.012
#> GSM35501     1  0.0000      0.790 1.000 0.000 0.000 0.000 0.000
#> GSM35509     3  0.5969      0.198 0.108 0.000 0.544 0.344 0.004
#> GSM35513     1  0.0000      0.790 1.000 0.000 0.000 0.000 0.000
#> GSM35516     2  0.4597      0.559 0.240 0.720 0.028 0.004 0.008
#> GSM35522     1  0.4592      0.628 0.756 0.100 0.140 0.004 0.000
#> GSM35525     1  0.1638      0.778 0.932 0.004 0.064 0.000 0.000
#> GSM35528     1  0.0579      0.791 0.984 0.008 0.008 0.000 0.000
#> GSM35533     1  0.1179      0.792 0.964 0.016 0.016 0.000 0.004
#> GSM35537     1  0.3010      0.707 0.824 0.004 0.172 0.000 0.000

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>          class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM35441     2  0.3424     0.6736 0.000 0.772 0.000 0.204 0.024 0.000
#> GSM35446     6  0.0865     0.7814 0.000 0.000 0.036 0.000 0.000 0.964
#> GSM35449     2  0.4687     0.4149 0.000 0.604 0.000 0.336 0.060 0.000
#> GSM35455     2  0.4687     0.4149 0.000 0.604 0.000 0.336 0.060 0.000
#> GSM35458     5  0.4280     0.5860 0.020 0.040 0.000 0.212 0.728 0.000
#> GSM35460     6  0.0865     0.7814 0.000 0.000 0.036 0.000 0.000 0.964
#> GSM35461     5  0.3171     0.6033 0.012 0.000 0.204 0.000 0.784 0.000
#> GSM35463     2  0.3852     0.5525 0.000 0.732 0.016 0.240 0.000 0.012
#> GSM35472     5  0.2933     0.6181 0.000 0.000 0.200 0.000 0.796 0.004
#> GSM35475     5  0.2964     0.6398 0.000 0.004 0.000 0.204 0.792 0.000
#> GSM35483     2  0.4035     0.5281 0.000 0.712 0.016 0.256 0.000 0.016
#> GSM35496     3  0.1332     0.6773 0.028 0.000 0.952 0.000 0.012 0.008
#> GSM35497     2  0.4687     0.4149 0.000 0.604 0.000 0.336 0.060 0.000
#> GSM35504     6  0.4545     0.5143 0.000 0.184 0.004 0.092 0.004 0.716
#> GSM35508     4  0.5173     1.0000 0.000 0.160 0.000 0.616 0.224 0.000
#> GSM35511     5  0.2994     0.6371 0.000 0.004 0.000 0.208 0.788 0.000
#> GSM35512     5  0.2135     0.6559 0.000 0.000 0.128 0.000 0.872 0.000
#> GSM35515     5  0.4280     0.5860 0.020 0.040 0.000 0.212 0.728 0.000
#> GSM35519     5  0.2135     0.6559 0.000 0.000 0.128 0.000 0.872 0.000
#> GSM35527     4  0.5173     1.0000 0.000 0.160 0.000 0.616 0.224 0.000
#> GSM35532     5  0.2994     0.6382 0.000 0.000 0.000 0.208 0.788 0.004
#> GSM35439     2  0.0146     0.7508 0.000 0.996 0.000 0.004 0.000 0.000
#> GSM35443     1  0.4470     0.5776 0.696 0.000 0.228 0.004 0.072 0.000
#> GSM35445     1  0.3183     0.6841 0.788 0.000 0.200 0.004 0.008 0.000
#> GSM35448     6  0.0653     0.7697 0.000 0.004 0.004 0.012 0.000 0.980
#> GSM35451     1  0.1382     0.7976 0.948 0.036 0.008 0.008 0.000 0.000
#> GSM35454     1  0.6047     0.0174 0.448 0.000 0.320 0.004 0.228 0.000
#> GSM35457     2  0.2877     0.7179 0.000 0.820 0.000 0.168 0.012 0.000
#> GSM35465     2  0.3152     0.7146 0.000 0.792 0.008 0.196 0.004 0.000
#> GSM35468     1  0.1572     0.7918 0.936 0.000 0.028 0.000 0.036 0.000
#> GSM35471     1  0.2449     0.7842 0.896 0.056 0.024 0.024 0.000 0.000
#> GSM35473     1  0.2933     0.6842 0.796 0.000 0.200 0.000 0.004 0.000
#> GSM35477     1  0.1382     0.7976 0.948 0.036 0.008 0.008 0.000 0.000
#> GSM35480     1  0.1434     0.7961 0.940 0.000 0.048 0.012 0.000 0.000
#> GSM35482     3  0.3279     0.6201 0.148 0.000 0.816 0.008 0.028 0.000
#> GSM35485     2  0.0458     0.7481 0.000 0.984 0.000 0.016 0.000 0.000
#> GSM35489     2  0.3616     0.6720 0.020 0.808 0.004 0.028 0.140 0.000
#> GSM35492     1  0.1649     0.7902 0.932 0.000 0.032 0.000 0.036 0.000
#> GSM35495     6  0.3881     0.2877 0.004 0.000 0.396 0.000 0.000 0.600
#> GSM35499     2  0.2833     0.7401 0.000 0.836 0.000 0.148 0.004 0.012
#> GSM35502     1  0.0000     0.8026 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM35505     1  0.6047     0.0174 0.448 0.000 0.320 0.004 0.228 0.000
#> GSM35507     1  0.5526     0.4929 0.616 0.232 0.024 0.128 0.000 0.000
#> GSM35510     2  0.2872     0.7394 0.000 0.832 0.000 0.152 0.004 0.012
#> GSM35514     1  0.0146     0.8026 0.996 0.000 0.000 0.004 0.000 0.000
#> GSM35517     2  0.0260     0.7508 0.000 0.992 0.000 0.008 0.000 0.000
#> GSM35520     2  0.4232     0.5677 0.004 0.732 0.004 0.056 0.204 0.000
#> GSM35523     1  0.4890     0.6192 0.700 0.048 0.056 0.196 0.000 0.000
#> GSM35529     2  0.2912     0.7115 0.000 0.816 0.000 0.172 0.012 0.000
#> GSM35531     2  0.3616     0.6720 0.020 0.808 0.004 0.028 0.140 0.000
#> GSM35534     2  0.0777     0.7451 0.000 0.972 0.000 0.024 0.000 0.004
#> GSM35536     1  0.0862     0.8033 0.972 0.004 0.008 0.000 0.016 0.000
#> GSM35538     1  0.0767     0.8025 0.976 0.012 0.008 0.004 0.000 0.000
#> GSM35539     1  0.2263     0.7885 0.900 0.004 0.060 0.036 0.000 0.000
#> GSM35540     2  0.2979     0.7249 0.000 0.804 0.004 0.188 0.004 0.000
#> GSM35541     2  0.0146     0.7508 0.000 0.996 0.000 0.004 0.000 0.000
#> GSM35442     1  0.4632     0.5356 0.668 0.000 0.256 0.004 0.072 0.000
#> GSM35447     1  0.6047     0.0174 0.448 0.000 0.320 0.004 0.228 0.000
#> GSM35450     1  0.1116     0.8006 0.960 0.028 0.008 0.004 0.000 0.000
#> GSM35453     1  0.3023     0.6719 0.784 0.000 0.212 0.000 0.004 0.000
#> GSM35456     1  0.3982     0.6952 0.784 0.120 0.016 0.080 0.000 0.000
#> GSM35464     1  0.5905     0.3965 0.552 0.272 0.024 0.152 0.000 0.000
#> GSM35467     1  0.0000     0.8026 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM35470     3  0.4735     0.2133 0.392 0.000 0.564 0.008 0.036 0.000
#> GSM35479     3  0.1003     0.6700 0.020 0.000 0.964 0.000 0.000 0.016
#> GSM35484     1  0.1109     0.8050 0.964 0.016 0.012 0.004 0.004 0.000
#> GSM35488     1  0.0405     0.8032 0.988 0.008 0.000 0.004 0.000 0.000
#> GSM35491     1  0.1649     0.7902 0.932 0.000 0.032 0.000 0.036 0.000
#> GSM35494     3  0.0858     0.6805 0.028 0.000 0.968 0.000 0.000 0.004
#> GSM35498     1  0.5905     0.3965 0.552 0.272 0.024 0.152 0.000 0.000
#> GSM35501     1  0.0000     0.8026 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM35509     3  0.3861     0.1095 0.008 0.000 0.640 0.000 0.000 0.352
#> GSM35513     1  0.0000     0.8026 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM35516     2  0.4337     0.4742 0.224 0.712 0.008 0.056 0.000 0.000
#> GSM35522     1  0.4890     0.6192 0.700 0.048 0.056 0.196 0.000 0.000
#> GSM35525     1  0.2179     0.7862 0.900 0.000 0.064 0.036 0.000 0.000
#> GSM35528     1  0.0665     0.8035 0.980 0.008 0.004 0.008 0.000 0.000
#> GSM35533     1  0.1109     0.8050 0.964 0.016 0.012 0.004 0.004 0.000
#> GSM35537     1  0.3927     0.6919 0.756 0.000 0.172 0.072 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)

plot of chunk tab-SD-hclust-consensus-heatmap-1

consensus_heatmap(res, k = 3)

plot of chunk tab-SD-hclust-consensus-heatmap-2

consensus_heatmap(res, k = 4)

plot of chunk tab-SD-hclust-consensus-heatmap-3

consensus_heatmap(res, k = 5)

plot of chunk tab-SD-hclust-consensus-heatmap-4

consensus_heatmap(res, k = 6)

plot of chunk tab-SD-hclust-consensus-heatmap-5

Heatmaps for the membership of samples in all partitions to see how consistent they are:

membership_heatmap(res, k = 2)

plot of chunk tab-SD-hclust-membership-heatmap-1

membership_heatmap(res, k = 3)

plot of chunk tab-SD-hclust-membership-heatmap-2

membership_heatmap(res, k = 4)

plot of chunk tab-SD-hclust-membership-heatmap-3

membership_heatmap(res, k = 5)

plot of chunk tab-SD-hclust-membership-heatmap-4

membership_heatmap(res, k = 6)

plot of chunk tab-SD-hclust-membership-heatmap-5

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)

plot of chunk tab-SD-hclust-get-signatures-1

get_signatures(res, k = 3)

plot of chunk tab-SD-hclust-get-signatures-2

get_signatures(res, k = 4)

plot of chunk tab-SD-hclust-get-signatures-3

get_signatures(res, k = 5)

plot of chunk tab-SD-hclust-get-signatures-4

get_signatures(res, k = 6)

plot of chunk tab-SD-hclust-get-signatures-5

Signature heatmaps where rows are not scaled:

get_signatures(res, k = 2, scale_rows = FALSE)

plot of chunk tab-SD-hclust-get-signatures-no-scale-1

get_signatures(res, k = 3, scale_rows = FALSE)

plot of chunk tab-SD-hclust-get-signatures-no-scale-2

get_signatures(res, k = 4, scale_rows = FALSE)

plot of chunk tab-SD-hclust-get-signatures-no-scale-3

get_signatures(res, k = 5, scale_rows = FALSE)

plot of chunk tab-SD-hclust-get-signatures-no-scale-4

get_signatures(res, k = 6, scale_rows = FALSE)

plot of chunk tab-SD-hclust-get-signatures-no-scale-5

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk SD-hclust-signature_compare

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:

  1. which_row: row indices corresponding to the input matrix.
  2. fdr: FDR for the differential test.
  3. mean_x: The mean value in group x.
  4. scaled_mean_x: The mean value in group x after rows are scaled.
  5. 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")

plot of chunk tab-SD-hclust-dimension-reduction-1

dimension_reduction(res, k = 3, method = "UMAP")

plot of chunk tab-SD-hclust-dimension-reduction-2

dimension_reduction(res, k = 4, method = "UMAP")

plot of chunk tab-SD-hclust-dimension-reduction-3

dimension_reduction(res, k = 5, method = "UMAP")

plot of chunk tab-SD-hclust-dimension-reduction-4

dimension_reduction(res, k = 6, method = "UMAP")

plot of chunk tab-SD-hclust-dimension-reduction-5

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk SD-hclust-collect-classes

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  time(p) k
#> SD:hclust 72 2.53e-07 2
#> SD:hclust 63 7.31e-06 3
#> SD:hclust 69 1.35e-07 4
#> SD:hclust 65 4.36e-07 5
#> SD:hclust 66 3.59e-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.


SD:kmeans**

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 7758 rows and 79 columns.
#>   Top rows (776, 1552, 2328, 3103, 3879) are extracted by 'SD' method.
#>   Subgroups are detected by 'kmeans' method.
#>   Performed in total 1250 partitions by row resampling.
#>   Best k for subgroups seems to be 3.
#> 
#> Following methods can be applied to this 'ConsensusPartition' object:
#>  [1] "cola_report"             "collect_classes"         "collect_plots"          
#>  [4] "collect_stats"           "colnames"                "compare_signatures"     
#>  [7] "consensus_heatmap"       "dimension_reduction"     "functional_enrichment"  
#> [10] "get_anno_col"            "get_anno"                "get_classes"            
#> [13] "get_consensus"           "get_matrix"              "get_membership"         
#> [16] "get_param"               "get_signatures"          "get_stats"              
#> [19] "is_best_k"               "is_stable_k"             "membership_heatmap"     
#> [22] "ncol"                    "nrow"                    "plot_ecdf"              
#> [25] "rownames"                "select_partition_number" "show"                   
#> [28] "suggest_best_k"          "test_to_known_factors"

collect_plots() function collects all the plots made from res for all k (number of partitions) into one single page to provide an easy and fast comparison between different k.

collect_plots(res)

plot of chunk SD-kmeans-collect-plots

The plots are:

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:

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)

plot of chunk SD-kmeans-select-partition-number

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.528           0.926       0.935         0.4934 0.498   0.498
#> 3 3 1.000           0.986       0.991         0.3283 0.794   0.607
#> 4 4 0.725           0.644       0.809         0.1114 0.969   0.913
#> 5 5 0.676           0.676       0.799         0.0755 0.845   0.549
#> 6 6 0.694           0.637       0.746         0.0456 0.949   0.767

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.

show/hide code output

cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#>          class entropy silhouette    p1    p2
#> GSM35441     2  0.6048      0.934 0.148 0.852
#> GSM35446     2  0.0376      0.893 0.004 0.996
#> GSM35449     2  0.6048      0.934 0.148 0.852
#> GSM35455     2  0.6048      0.934 0.148 0.852
#> GSM35458     2  0.5519      0.933 0.128 0.872
#> GSM35460     2  0.0376      0.893 0.004 0.996
#> GSM35461     1  0.5946      0.876 0.856 0.144
#> GSM35463     2  0.5946      0.933 0.144 0.856
#> GSM35472     2  0.4161      0.848 0.084 0.916
#> GSM35475     2  0.1843      0.908 0.028 0.972
#> GSM35483     2  0.4815      0.928 0.104 0.896
#> GSM35496     1  0.5946      0.876 0.856 0.144
#> GSM35497     2  0.6048      0.934 0.148 0.852
#> GSM35504     2  0.0376      0.898 0.004 0.996
#> GSM35508     2  0.1843      0.908 0.028 0.972
#> GSM35511     2  0.0672      0.894 0.008 0.992
#> GSM35512     2  0.2043      0.886 0.032 0.968
#> GSM35515     2  0.5519      0.933 0.128 0.872
#> GSM35519     2  0.0672      0.894 0.008 0.992
#> GSM35527     2  0.1843      0.908 0.028 0.972
#> GSM35532     2  0.0672      0.894 0.008 0.992
#> GSM35439     2  0.6048      0.934 0.148 0.852
#> GSM35443     1  0.0376      0.953 0.996 0.004
#> GSM35445     1  0.1843      0.944 0.972 0.028
#> GSM35448     2  0.0376      0.893 0.004 0.996
#> GSM35451     1  0.0376      0.953 0.996 0.004
#> GSM35454     1  0.6048      0.875 0.852 0.148
#> GSM35457     2  0.6048      0.934 0.148 0.852
#> GSM35465     2  0.6048      0.934 0.148 0.852
#> GSM35468     1  0.0376      0.953 0.996 0.004
#> GSM35471     1  0.0672      0.952 0.992 0.008
#> GSM35473     1  0.1633      0.945 0.976 0.024
#> GSM35477     1  0.0376      0.953 0.996 0.004
#> GSM35480     1  0.1414      0.947 0.980 0.020
#> GSM35482     1  0.6048      0.875 0.852 0.148
#> GSM35485     2  0.5946      0.933 0.144 0.856
#> GSM35489     2  0.6048      0.934 0.148 0.852
#> GSM35492     1  0.0376      0.953 0.996 0.004
#> GSM35495     1  0.6247      0.870 0.844 0.156
#> GSM35499     2  0.5946      0.933 0.144 0.856
#> GSM35502     1  0.0376      0.953 0.996 0.004
#> GSM35505     1  0.6048      0.875 0.852 0.148
#> GSM35507     1  0.0376      0.953 0.996 0.004
#> GSM35510     2  0.5946      0.933 0.144 0.856
#> GSM35514     1  0.0376      0.953 0.996 0.004
#> GSM35517     2  0.6048      0.934 0.148 0.852
#> GSM35520     2  0.1633      0.906 0.024 0.976
#> GSM35523     1  0.0376      0.953 0.996 0.004
#> GSM35529     2  0.6048      0.934 0.148 0.852
#> GSM35531     2  0.6048      0.934 0.148 0.852
#> GSM35534     2  0.5946      0.933 0.144 0.856
#> GSM35536     1  0.0376      0.953 0.996 0.004
#> GSM35538     1  0.0376      0.953 0.996 0.004
#> GSM35539     1  0.0376      0.953 0.996 0.004
#> GSM35540     2  0.1633      0.906 0.024 0.976
#> GSM35541     2  0.6048      0.934 0.148 0.852
#> GSM35442     1  0.3879      0.919 0.924 0.076
#> GSM35447     1  0.6048      0.875 0.852 0.148
#> GSM35450     1  0.0376      0.953 0.996 0.004
#> GSM35453     1  0.2778      0.935 0.952 0.048
#> GSM35456     1  0.0672      0.952 0.992 0.008
#> GSM35464     2  0.6048      0.934 0.148 0.852
#> GSM35467     1  0.0376      0.953 0.996 0.004
#> GSM35470     1  0.2423      0.938 0.960 0.040
#> GSM35479     1  0.6048      0.875 0.852 0.148
#> GSM35484     1  0.0672      0.952 0.992 0.008
#> GSM35488     1  0.0376      0.953 0.996 0.004
#> GSM35491     1  0.0376      0.953 0.996 0.004
#> GSM35494     1  0.6048      0.875 0.852 0.148
#> GSM35498     1  0.0376      0.953 0.996 0.004
#> GSM35501     1  0.0376      0.953 0.996 0.004
#> GSM35509     1  0.6048      0.875 0.852 0.148
#> GSM35513     1  0.0376      0.953 0.996 0.004
#> GSM35516     2  0.6048      0.934 0.148 0.852
#> GSM35522     1  0.0376      0.953 0.996 0.004
#> GSM35525     1  0.0376      0.953 0.996 0.004
#> GSM35528     1  0.0376      0.953 0.996 0.004
#> GSM35533     1  0.0672      0.952 0.992 0.008
#> GSM35537     1  0.1184      0.948 0.984 0.016

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>          class entropy silhouette    p1    p2    p3
#> GSM35441     2  0.0000      0.997 0.000 1.000 0.000
#> GSM35446     3  0.0592      0.973 0.000 0.012 0.988
#> GSM35449     2  0.0237      0.996 0.000 0.996 0.004
#> GSM35455     2  0.0237      0.996 0.000 0.996 0.004
#> GSM35458     2  0.0592      0.990 0.000 0.988 0.012
#> GSM35460     3  0.0592      0.973 0.000 0.012 0.988
#> GSM35461     3  0.2356      0.915 0.072 0.000 0.928
#> GSM35463     2  0.0000      0.997 0.000 1.000 0.000
#> GSM35472     3  0.0424      0.973 0.000 0.008 0.992
#> GSM35475     2  0.1031      0.979 0.000 0.976 0.024
#> GSM35483     2  0.0000      0.997 0.000 1.000 0.000
#> GSM35496     3  0.0237      0.977 0.004 0.000 0.996
#> GSM35497     2  0.0237      0.996 0.000 0.996 0.004
#> GSM35504     2  0.0000      0.997 0.000 1.000 0.000
#> GSM35508     2  0.0237      0.996 0.000 0.996 0.004
#> GSM35511     3  0.4796      0.725 0.000 0.220 0.780
#> GSM35512     3  0.0000      0.975 0.000 0.000 1.000
#> GSM35515     2  0.0592      0.990 0.000 0.988 0.012
#> GSM35519     3  0.0747      0.970 0.000 0.016 0.984
#> GSM35527     2  0.0237      0.996 0.000 0.996 0.004
#> GSM35532     3  0.0747      0.970 0.000 0.016 0.984
#> GSM35439     2  0.0000      0.997 0.000 1.000 0.000
#> GSM35443     1  0.0424      0.995 0.992 0.000 0.008
#> GSM35445     1  0.0424      0.995 0.992 0.000 0.008
#> GSM35448     3  0.0892      0.969 0.000 0.020 0.980
#> GSM35451     1  0.0000      0.994 1.000 0.000 0.000
#> GSM35454     3  0.0237      0.977 0.004 0.000 0.996
#> GSM35457     2  0.0000      0.997 0.000 1.000 0.000
#> GSM35465     2  0.0000      0.997 0.000 1.000 0.000
#> GSM35468     1  0.0424      0.995 0.992 0.000 0.008
#> GSM35471     1  0.0237      0.993 0.996 0.000 0.004
#> GSM35473     1  0.0424      0.995 0.992 0.000 0.008
#> GSM35477     1  0.0000      0.994 1.000 0.000 0.000
#> GSM35480     1  0.0424      0.995 0.992 0.000 0.008
#> GSM35482     3  0.0237      0.977 0.004 0.000 0.996
#> GSM35485     2  0.0000      0.997 0.000 1.000 0.000
#> GSM35489     2  0.0000      0.997 0.000 1.000 0.000
#> GSM35492     1  0.0424      0.995 0.992 0.000 0.008
#> GSM35495     3  0.0237      0.977 0.004 0.000 0.996
#> GSM35499     2  0.0000      0.997 0.000 1.000 0.000
#> GSM35502     1  0.0424      0.995 0.992 0.000 0.008
#> GSM35505     3  0.0237      0.977 0.004 0.000 0.996
#> GSM35507     1  0.0000      0.994 1.000 0.000 0.000
#> GSM35510     2  0.0000      0.997 0.000 1.000 0.000
#> GSM35514     1  0.0424      0.995 0.992 0.000 0.008
#> GSM35517     2  0.0000      0.997 0.000 1.000 0.000
#> GSM35520     2  0.0424      0.992 0.000 0.992 0.008
#> GSM35523     1  0.0424      0.991 0.992 0.000 0.008
#> GSM35529     2  0.0000      0.997 0.000 1.000 0.000
#> GSM35531     2  0.0000      0.997 0.000 1.000 0.000
#> GSM35534     2  0.0000      0.997 0.000 1.000 0.000
#> GSM35536     1  0.0424      0.995 0.992 0.000 0.008
#> GSM35538     1  0.0000      0.994 1.000 0.000 0.000
#> GSM35539     1  0.0000      0.994 1.000 0.000 0.000
#> GSM35540     2  0.0000      0.997 0.000 1.000 0.000
#> GSM35541     2  0.0000      0.997 0.000 1.000 0.000
#> GSM35442     1  0.1411      0.973 0.964 0.000 0.036
#> GSM35447     3  0.0237      0.977 0.004 0.000 0.996
#> GSM35450     1  0.0000      0.994 1.000 0.000 0.000
#> GSM35453     1  0.0424      0.995 0.992 0.000 0.008
#> GSM35456     1  0.0000      0.994 1.000 0.000 0.000
#> GSM35464     2  0.0424      0.991 0.008 0.992 0.000
#> GSM35467     1  0.0424      0.995 0.992 0.000 0.008
#> GSM35470     1  0.0747      0.991 0.984 0.000 0.016
#> GSM35479     3  0.0237      0.977 0.004 0.000 0.996
#> GSM35484     1  0.0424      0.995 0.992 0.000 0.008
#> GSM35488     1  0.0000      0.994 1.000 0.000 0.000
#> GSM35491     1  0.0424      0.995 0.992 0.000 0.008
#> GSM35494     3  0.0237      0.977 0.004 0.000 0.996
#> GSM35498     1  0.0424      0.991 0.992 0.000 0.008
#> GSM35501     1  0.0424      0.995 0.992 0.000 0.008
#> GSM35509     3  0.0237      0.977 0.004 0.000 0.996
#> GSM35513     1  0.0424      0.995 0.992 0.000 0.008
#> GSM35516     2  0.0000      0.997 0.000 1.000 0.000
#> GSM35522     1  0.0424      0.991 0.992 0.000 0.008
#> GSM35525     1  0.0000      0.994 1.000 0.000 0.000
#> GSM35528     1  0.0000      0.994 1.000 0.000 0.000
#> GSM35533     1  0.0424      0.995 0.992 0.000 0.008
#> GSM35537     1  0.0424      0.991 0.992 0.000 0.008

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>          class entropy silhouette    p1    p2    p3    p4
#> GSM35441     2  0.2623      0.852 0.000 0.908 0.028 0.064
#> GSM35446     3  0.4697      0.690 0.000 0.000 0.644 0.356
#> GSM35449     2  0.4727      0.807 0.000 0.792 0.100 0.108
#> GSM35455     2  0.3840      0.831 0.000 0.844 0.052 0.104
#> GSM35458     2  0.6575      0.481 0.000 0.508 0.412 0.080
#> GSM35460     3  0.4713      0.690 0.000 0.000 0.640 0.360
#> GSM35461     3  0.3638      0.588 0.032 0.000 0.848 0.120
#> GSM35463     2  0.1584      0.853 0.000 0.952 0.012 0.036
#> GSM35472     3  0.4134      0.680 0.000 0.000 0.740 0.260
#> GSM35475     3  0.6477     -0.361 0.000 0.420 0.508 0.072
#> GSM35483     2  0.1488      0.854 0.000 0.956 0.012 0.032
#> GSM35496     3  0.4907      0.652 0.000 0.000 0.580 0.420
#> GSM35497     2  0.4669      0.808 0.000 0.796 0.100 0.104
#> GSM35504     2  0.2402      0.855 0.000 0.912 0.012 0.076
#> GSM35508     2  0.6352      0.684 0.000 0.632 0.260 0.108
#> GSM35511     3  0.4499      0.394 0.000 0.124 0.804 0.072
#> GSM35512     3  0.4134      0.680 0.000 0.000 0.740 0.260
#> GSM35515     2  0.6575      0.481 0.000 0.508 0.412 0.080
#> GSM35519     3  0.0188      0.548 0.000 0.004 0.996 0.000
#> GSM35527     2  0.6245      0.699 0.000 0.648 0.244 0.108
#> GSM35532     3  0.0376      0.546 0.000 0.004 0.992 0.004
#> GSM35439     2  0.0000      0.860 0.000 1.000 0.000 0.000
#> GSM35443     1  0.1406      0.758 0.960 0.000 0.024 0.016
#> GSM35445     1  0.0000      0.777 1.000 0.000 0.000 0.000
#> GSM35448     3  0.5511      0.671 0.000 0.028 0.620 0.352
#> GSM35451     1  0.4564      0.601 0.672 0.000 0.000 0.328
#> GSM35454     3  0.4989      0.608 0.000 0.000 0.528 0.472
#> GSM35457     2  0.2255      0.855 0.000 0.920 0.012 0.068
#> GSM35465     2  0.3271      0.838 0.000 0.856 0.012 0.132
#> GSM35468     1  0.0592      0.773 0.984 0.000 0.000 0.016
#> GSM35471     1  0.4967      0.406 0.548 0.000 0.000 0.452
#> GSM35473     1  0.0000      0.777 1.000 0.000 0.000 0.000
#> GSM35477     1  0.4564      0.601 0.672 0.000 0.000 0.328
#> GSM35480     1  0.2345      0.745 0.900 0.000 0.000 0.100
#> GSM35482     4  0.4989     -0.770 0.000 0.000 0.472 0.528
#> GSM35485     2  0.1284      0.856 0.000 0.964 0.012 0.024
#> GSM35489     2  0.0524      0.861 0.000 0.988 0.004 0.008
#> GSM35492     1  0.0592      0.773 0.984 0.000 0.000 0.016
#> GSM35495     3  0.4948      0.646 0.000 0.000 0.560 0.440
#> GSM35499     2  0.2714      0.838 0.000 0.884 0.004 0.112
#> GSM35502     1  0.0000      0.777 1.000 0.000 0.000 0.000
#> GSM35505     3  0.4761      0.685 0.000 0.000 0.628 0.372
#> GSM35507     1  0.6380      0.335 0.500 0.064 0.000 0.436
#> GSM35510     2  0.1743      0.858 0.000 0.940 0.004 0.056
#> GSM35514     1  0.0000      0.777 1.000 0.000 0.000 0.000
#> GSM35517     2  0.0000      0.860 0.000 1.000 0.000 0.000
#> GSM35520     2  0.5220      0.471 0.000 0.568 0.424 0.008
#> GSM35523     1  0.5168      0.314 0.504 0.000 0.004 0.492
#> GSM35529     2  0.2179      0.855 0.000 0.924 0.012 0.064
#> GSM35531     2  0.1624      0.856 0.000 0.952 0.028 0.020
#> GSM35534     2  0.1488      0.854 0.000 0.956 0.012 0.032
#> GSM35536     1  0.0000      0.777 1.000 0.000 0.000 0.000
#> GSM35538     1  0.3873      0.684 0.772 0.000 0.000 0.228
#> GSM35539     1  0.4277      0.647 0.720 0.000 0.000 0.280
#> GSM35540     2  0.3217      0.840 0.000 0.860 0.012 0.128
#> GSM35541     2  0.0469      0.859 0.000 0.988 0.000 0.012
#> GSM35442     1  0.3198      0.693 0.880 0.000 0.040 0.080
#> GSM35447     3  0.4679      0.689 0.000 0.000 0.648 0.352
#> GSM35450     1  0.4040      0.671 0.752 0.000 0.000 0.248
#> GSM35453     1  0.2198      0.719 0.920 0.000 0.008 0.072
#> GSM35456     1  0.4866      0.499 0.596 0.000 0.000 0.404
#> GSM35464     2  0.5537      0.486 0.016 0.588 0.004 0.392
#> GSM35467     1  0.0000      0.777 1.000 0.000 0.000 0.000
#> GSM35470     1  0.5497      0.387 0.524 0.000 0.016 0.460
#> GSM35479     3  0.5000      0.577 0.000 0.000 0.504 0.496
#> GSM35484     1  0.0000      0.777 1.000 0.000 0.000 0.000
#> GSM35488     1  0.0592      0.773 0.984 0.000 0.000 0.016
#> GSM35491     1  0.0592      0.773 0.984 0.000 0.000 0.016
#> GSM35494     3  0.5000      0.577 0.000 0.000 0.504 0.496
#> GSM35498     1  0.4989      0.371 0.528 0.000 0.000 0.472
#> GSM35501     1  0.0000      0.777 1.000 0.000 0.000 0.000
#> GSM35509     3  0.5000      0.583 0.000 0.000 0.504 0.496
#> GSM35513     1  0.0000      0.777 1.000 0.000 0.000 0.000
#> GSM35516     2  0.1389      0.852 0.000 0.952 0.000 0.048
#> GSM35522     4  0.5163     -0.633 0.480 0.000 0.004 0.516
#> GSM35525     1  0.3356      0.718 0.824 0.000 0.000 0.176
#> GSM35528     1  0.4356      0.647 0.708 0.000 0.000 0.292
#> GSM35533     1  0.0000      0.777 1.000 0.000 0.000 0.000
#> GSM35537     1  0.5137      0.411 0.544 0.000 0.004 0.452

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>          class entropy silhouette    p1    p2    p3    p4    p5
#> GSM35441     2  0.4073     0.7499 0.000 0.792 0.000 0.104 0.104
#> GSM35446     3  0.3409     0.7602 0.000 0.000 0.836 0.052 0.112
#> GSM35449     2  0.5223     0.6309 0.000 0.672 0.000 0.108 0.220
#> GSM35455     2  0.4918     0.6687 0.000 0.708 0.000 0.100 0.192
#> GSM35458     5  0.3224     0.6156 0.000 0.160 0.000 0.016 0.824
#> GSM35460     3  0.3307     0.7660 0.000 0.000 0.844 0.052 0.104
#> GSM35461     5  0.5842     0.0861 0.032 0.000 0.392 0.040 0.536
#> GSM35463     2  0.3247     0.7712 0.000 0.864 0.012 0.052 0.072
#> GSM35472     3  0.4482     0.4109 0.000 0.000 0.612 0.012 0.376
#> GSM35475     5  0.2511     0.6446 0.000 0.080 0.028 0.000 0.892
#> GSM35483     2  0.3316     0.7689 0.000 0.860 0.012 0.056 0.072
#> GSM35496     3  0.2983     0.7799 0.000 0.000 0.868 0.076 0.056
#> GSM35497     2  0.5130     0.6332 0.000 0.680 0.000 0.100 0.220
#> GSM35504     2  0.3704     0.7764 0.000 0.832 0.020 0.112 0.036
#> GSM35508     5  0.5968    -0.2027 0.000 0.444 0.000 0.108 0.448
#> GSM35511     5  0.2966     0.5877 0.000 0.016 0.136 0.000 0.848
#> GSM35512     3  0.4547     0.3617 0.000 0.000 0.588 0.012 0.400
#> GSM35515     5  0.3224     0.6156 0.000 0.160 0.000 0.016 0.824
#> GSM35519     5  0.4003     0.4319 0.000 0.000 0.288 0.008 0.704
#> GSM35527     2  0.5964     0.1379 0.000 0.464 0.000 0.108 0.428
#> GSM35532     5  0.3835     0.4615 0.000 0.000 0.260 0.008 0.732
#> GSM35439     2  0.1725     0.7982 0.000 0.936 0.000 0.020 0.044
#> GSM35443     1  0.2673     0.8223 0.892 0.000 0.004 0.044 0.060
#> GSM35445     1  0.1815     0.8410 0.940 0.000 0.016 0.024 0.020
#> GSM35448     3  0.5261     0.6864 0.000 0.048 0.736 0.084 0.132
#> GSM35451     4  0.4510     0.6330 0.432 0.000 0.000 0.560 0.008
#> GSM35454     3  0.2506     0.7921 0.008 0.000 0.904 0.052 0.036
#> GSM35457     2  0.3731     0.7652 0.000 0.816 0.000 0.112 0.072
#> GSM35465     2  0.4444     0.7405 0.000 0.748 0.000 0.180 0.072
#> GSM35468     1  0.1911     0.8455 0.932 0.000 0.004 0.028 0.036
#> GSM35471     4  0.4141     0.7493 0.248 0.000 0.024 0.728 0.000
#> GSM35473     1  0.1405     0.8481 0.956 0.000 0.008 0.016 0.020
#> GSM35477     4  0.4510     0.6330 0.432 0.000 0.000 0.560 0.008
#> GSM35480     1  0.3409     0.7402 0.844 0.000 0.016 0.116 0.024
#> GSM35482     3  0.2890     0.7547 0.000 0.000 0.836 0.160 0.004
#> GSM35485     2  0.2722     0.7836 0.000 0.892 0.008 0.040 0.060
#> GSM35489     2  0.2074     0.7982 0.000 0.920 0.000 0.036 0.044
#> GSM35492     1  0.1996     0.8438 0.928 0.000 0.004 0.032 0.036
#> GSM35495     3  0.1965     0.7985 0.000 0.000 0.924 0.052 0.024
#> GSM35499     2  0.2548     0.7921 0.000 0.876 0.004 0.116 0.004
#> GSM35502     1  0.0162     0.8582 0.996 0.000 0.000 0.004 0.000
#> GSM35505     3  0.2647     0.7884 0.008 0.000 0.892 0.024 0.076
#> GSM35507     4  0.4466     0.7007 0.176 0.076 0.000 0.748 0.000
#> GSM35510     2  0.2017     0.7979 0.000 0.912 0.000 0.080 0.008
#> GSM35514     1  0.0162     0.8582 0.996 0.000 0.000 0.004 0.000
#> GSM35517     2  0.1282     0.8007 0.000 0.952 0.000 0.004 0.044
#> GSM35520     5  0.4963     0.3991 0.000 0.352 0.040 0.000 0.608
#> GSM35523     4  0.4784     0.7385 0.204 0.000 0.056 0.728 0.012
#> GSM35529     2  0.3731     0.7652 0.000 0.816 0.000 0.112 0.072
#> GSM35531     2  0.3301     0.7723 0.000 0.864 0.024 0.036 0.076
#> GSM35534     2  0.3247     0.7712 0.000 0.864 0.012 0.052 0.072
#> GSM35536     1  0.0579     0.8558 0.984 0.000 0.000 0.008 0.008
#> GSM35538     1  0.4538    -0.4555 0.540 0.000 0.000 0.452 0.008
#> GSM35539     4  0.4542     0.5983 0.456 0.000 0.000 0.536 0.008
#> GSM35540     2  0.4289     0.7475 0.000 0.760 0.000 0.176 0.064
#> GSM35541     2  0.1597     0.7981 0.000 0.940 0.000 0.012 0.048
#> GSM35442     1  0.5231     0.6513 0.740 0.000 0.132 0.064 0.064
#> GSM35447     3  0.2990     0.7815 0.008 0.000 0.868 0.024 0.100
#> GSM35450     4  0.4560     0.5434 0.484 0.000 0.000 0.508 0.008
#> GSM35453     1  0.3674     0.7246 0.832 0.000 0.116 0.032 0.020
#> GSM35456     4  0.4127     0.7279 0.312 0.008 0.000 0.680 0.000
#> GSM35464     4  0.3944     0.3412 0.004 0.272 0.000 0.720 0.004
#> GSM35467     1  0.0162     0.8582 0.996 0.000 0.000 0.004 0.000
#> GSM35470     4  0.6003     0.6623 0.176 0.000 0.164 0.640 0.020
#> GSM35479     3  0.2753     0.7676 0.000 0.000 0.856 0.136 0.008
#> GSM35484     1  0.1772     0.8466 0.940 0.000 0.008 0.032 0.020
#> GSM35488     1  0.1750     0.8454 0.936 0.000 0.000 0.036 0.028
#> GSM35491     1  0.1996     0.8438 0.928 0.000 0.004 0.032 0.036
#> GSM35494     3  0.2488     0.7737 0.000 0.000 0.872 0.124 0.004
#> GSM35498     4  0.4192     0.7505 0.232 0.000 0.032 0.736 0.000
#> GSM35501     1  0.0162     0.8582 0.996 0.000 0.000 0.004 0.000
#> GSM35509     3  0.2179     0.7845 0.000 0.000 0.888 0.112 0.000
#> GSM35513     1  0.0162     0.8582 0.996 0.000 0.000 0.004 0.000
#> GSM35516     2  0.2514     0.7895 0.000 0.896 0.000 0.060 0.044
#> GSM35522     4  0.4524     0.7203 0.164 0.004 0.052 0.768 0.012
#> GSM35525     1  0.4109     0.2533 0.700 0.000 0.000 0.288 0.012
#> GSM35528     4  0.4886     0.5861 0.448 0.000 0.000 0.528 0.024
#> GSM35533     1  0.1934     0.8435 0.932 0.000 0.008 0.040 0.020
#> GSM35537     4  0.5693     0.7001 0.196 0.000 0.124 0.664 0.016

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>          class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM35441     2  0.4984     -0.283 0.000 0.512 0.000 0.020 0.032 0.436
#> GSM35446     3  0.3865      0.698 0.000 0.004 0.800 0.016 0.116 0.064
#> GSM35449     6  0.5695      0.719 0.000 0.356 0.000 0.016 0.112 0.516
#> GSM35455     6  0.5300      0.597 0.000 0.404 0.000 0.016 0.064 0.516
#> GSM35458     5  0.4621      0.564 0.000 0.088 0.000 0.016 0.716 0.180
#> GSM35460     3  0.3865      0.698 0.000 0.004 0.800 0.016 0.116 0.064
#> GSM35461     5  0.5059      0.571 0.016 0.000 0.188 0.032 0.704 0.060
#> GSM35463     2  0.2562      0.632 0.000 0.892 0.008 0.024 0.012 0.064
#> GSM35472     5  0.4303      0.290 0.000 0.000 0.392 0.012 0.588 0.008
#> GSM35475     5  0.2592      0.700 0.000 0.020 0.012 0.004 0.884 0.080
#> GSM35483     2  0.2562      0.632 0.000 0.892 0.008 0.024 0.012 0.064
#> GSM35496     3  0.5140      0.688 0.000 0.000 0.708 0.112 0.104 0.076
#> GSM35497     6  0.5695      0.719 0.000 0.356 0.000 0.016 0.112 0.516
#> GSM35504     2  0.5485      0.419 0.000 0.620 0.052 0.032 0.016 0.280
#> GSM35508     6  0.5514      0.679 0.000 0.176 0.000 0.000 0.272 0.552
#> GSM35511     5  0.2364      0.712 0.000 0.004 0.032 0.000 0.892 0.072
#> GSM35512     5  0.4077      0.458 0.000 0.000 0.320 0.012 0.660 0.008
#> GSM35515     5  0.4621      0.564 0.000 0.088 0.000 0.016 0.716 0.180
#> GSM35519     5  0.2191      0.698 0.000 0.000 0.120 0.000 0.876 0.004
#> GSM35527     6  0.5515      0.691 0.000 0.184 0.000 0.000 0.260 0.556
#> GSM35532     5  0.2070      0.712 0.000 0.000 0.092 0.000 0.896 0.012
#> GSM35439     2  0.0363      0.666 0.000 0.988 0.000 0.000 0.000 0.012
#> GSM35443     1  0.3469      0.820 0.828 0.000 0.000 0.032 0.036 0.104
#> GSM35445     1  0.3075      0.813 0.856 0.000 0.016 0.032 0.004 0.092
#> GSM35448     3  0.5539      0.613 0.000 0.028 0.692 0.040 0.116 0.124
#> GSM35451     4  0.4665      0.748 0.260 0.012 0.000 0.676 0.004 0.048
#> GSM35454     3  0.4163      0.732 0.012 0.000 0.800 0.060 0.044 0.084
#> GSM35457     2  0.4305     -0.114 0.000 0.544 0.000 0.020 0.000 0.436
#> GSM35465     2  0.5218     -0.217 0.000 0.480 0.000 0.092 0.000 0.428
#> GSM35468     1  0.3104      0.824 0.852 0.000 0.000 0.028 0.028 0.092
#> GSM35471     4  0.3248      0.791 0.136 0.016 0.016 0.828 0.000 0.004
#> GSM35473     1  0.2858      0.819 0.868 0.000 0.012 0.028 0.004 0.088
#> GSM35477     4  0.4665      0.748 0.260 0.012 0.000 0.676 0.004 0.048
#> GSM35480     1  0.3862      0.780 0.800 0.000 0.012 0.100 0.004 0.084
#> GSM35482     3  0.5069      0.673 0.000 0.000 0.680 0.200 0.032 0.088
#> GSM35485     2  0.1232      0.657 0.000 0.956 0.004 0.016 0.000 0.024
#> GSM35489     2  0.0891      0.664 0.000 0.968 0.000 0.008 0.000 0.024
#> GSM35492     1  0.3249      0.825 0.840 0.000 0.000 0.028 0.028 0.104
#> GSM35495     3  0.2477      0.746 0.000 0.000 0.896 0.024 0.032 0.048
#> GSM35499     2  0.3247      0.553 0.000 0.808 0.000 0.036 0.000 0.156
#> GSM35502     1  0.0603      0.852 0.980 0.000 0.000 0.016 0.000 0.004
#> GSM35505     3  0.4969      0.700 0.012 0.000 0.736 0.052 0.116 0.084
#> GSM35507     4  0.3528      0.766 0.076 0.048 0.000 0.832 0.000 0.044
#> GSM35510     2  0.3541      0.453 0.000 0.748 0.000 0.020 0.000 0.232
#> GSM35514     1  0.0603      0.852 0.980 0.000 0.000 0.016 0.000 0.004
#> GSM35517     2  0.0547      0.666 0.000 0.980 0.000 0.000 0.000 0.020
#> GSM35520     5  0.4078      0.474 0.000 0.320 0.024 0.000 0.656 0.000
#> GSM35523     4  0.3832      0.769 0.096 0.004 0.016 0.816 0.008 0.060
#> GSM35529     2  0.4300     -0.114 0.000 0.548 0.000 0.020 0.000 0.432
#> GSM35531     2  0.1363      0.649 0.000 0.952 0.012 0.004 0.028 0.004
#> GSM35534     2  0.2116      0.636 0.000 0.912 0.004 0.024 0.004 0.056
#> GSM35536     1  0.1924      0.837 0.920 0.000 0.000 0.028 0.004 0.048
#> GSM35538     4  0.4845      0.591 0.384 0.000 0.000 0.560 0.004 0.052
#> GSM35539     4  0.4449      0.742 0.272 0.000 0.000 0.672 0.004 0.052
#> GSM35540     2  0.5218     -0.207 0.000 0.480 0.000 0.092 0.000 0.428
#> GSM35541     2  0.0458      0.666 0.000 0.984 0.000 0.000 0.000 0.016
#> GSM35442     1  0.6715      0.627 0.596 0.000 0.096 0.092 0.052 0.164
#> GSM35447     3  0.5165      0.688 0.012 0.000 0.716 0.052 0.136 0.084
#> GSM35450     4  0.4602      0.687 0.320 0.000 0.000 0.628 0.004 0.048
#> GSM35453     1  0.4343      0.748 0.780 0.000 0.064 0.056 0.004 0.096
#> GSM35456     4  0.3722      0.780 0.192 0.024 0.008 0.772 0.000 0.004
#> GSM35464     4  0.4265      0.610 0.012 0.112 0.000 0.756 0.000 0.120
#> GSM35467     1  0.0603      0.852 0.980 0.000 0.000 0.016 0.000 0.004
#> GSM35470     4  0.6507      0.489 0.076 0.000 0.172 0.576 0.012 0.164
#> GSM35479     3  0.4031      0.722 0.000 0.000 0.772 0.124 0.008 0.096
#> GSM35484     1  0.2492      0.837 0.888 0.000 0.008 0.020 0.004 0.080
#> GSM35488     1  0.3179      0.820 0.848 0.000 0.000 0.032 0.028 0.092
#> GSM35491     1  0.3249      0.825 0.840 0.000 0.000 0.028 0.028 0.104
#> GSM35494     3  0.3716      0.734 0.000 0.000 0.792 0.128 0.004 0.076
#> GSM35498     4  0.3288      0.786 0.104 0.016 0.016 0.844 0.000 0.020
#> GSM35501     1  0.0603      0.852 0.980 0.000 0.000 0.016 0.000 0.004
#> GSM35509     3  0.2451      0.757 0.000 0.000 0.884 0.060 0.000 0.056
#> GSM35513     1  0.0603      0.852 0.980 0.000 0.000 0.016 0.000 0.004
#> GSM35516     2  0.0777      0.661 0.000 0.972 0.000 0.024 0.000 0.004
#> GSM35522     4  0.3907      0.758 0.080 0.004 0.016 0.812 0.008 0.080
#> GSM35525     1  0.4476      0.449 0.680 0.000 0.000 0.256 0.004 0.060
#> GSM35528     4  0.4972      0.730 0.256 0.000 0.000 0.656 0.024 0.064
#> GSM35533     1  0.2492      0.837 0.888 0.000 0.008 0.020 0.004 0.080
#> GSM35537     4  0.5549      0.611 0.076 0.000 0.128 0.688 0.012 0.096

Heatmaps for the consensus matrix. It visualizes the probability of two samples to be in a same group.

consensus_heatmap(res, k = 2)

plot of chunk tab-SD-kmeans-consensus-heatmap-1

consensus_heatmap(res, k = 3)

plot of chunk tab-SD-kmeans-consensus-heatmap-2

consensus_heatmap(res, k = 4)

plot of chunk tab-SD-kmeans-consensus-heatmap-3

consensus_heatmap(res, k = 5)

plot of chunk tab-SD-kmeans-consensus-heatmap-4

consensus_heatmap(res, k = 6)

plot of chunk tab-SD-kmeans-consensus-heatmap-5

Heatmaps for the membership of samples in all partitions to see how consistent they are:

membership_heatmap(res, k = 2)

plot of chunk tab-SD-kmeans-membership-heatmap-1

membership_heatmap(res, k = 3)

plot of chunk tab-SD-kmeans-membership-heatmap-2

membership_heatmap(res, k = 4)

plot of chunk tab-SD-kmeans-membership-heatmap-3

membership_heatmap(res, k = 5)

plot of chunk tab-SD-kmeans-membership-heatmap-4

membership_heatmap(res, k = 6)

plot of chunk tab-SD-kmeans-membership-heatmap-5

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)

plot of chunk tab-SD-kmeans-get-signatures-1

get_signatures(res, k = 3)

plot of chunk tab-SD-kmeans-get-signatures-2

get_signatures(res, k = 4)

plot of chunk tab-SD-kmeans-get-signatures-3

get_signatures(res, k = 5)

plot of chunk tab-SD-kmeans-get-signatures-4

get_signatures(res, k = 6)

plot of chunk tab-SD-kmeans-get-signatures-5

Signature heatmaps where rows are not scaled:

get_signatures(res, k = 2, scale_rows = FALSE)

plot of chunk tab-SD-kmeans-get-signatures-no-scale-1

get_signatures(res, k = 3, scale_rows = FALSE)

plot of chunk tab-SD-kmeans-get-signatures-no-scale-2

get_signatures(res, k = 4, scale_rows = FALSE)

plot of chunk tab-SD-kmeans-get-signatures-no-scale-3

get_signatures(res, k = 5, scale_rows = FALSE)

plot of chunk tab-SD-kmeans-get-signatures-no-scale-4

get_signatures(res, k = 6, scale_rows = FALSE)

plot of chunk tab-SD-kmeans-get-signatures-no-scale-5

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk SD-kmeans-signature_compare

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:

  1. which_row: row indices corresponding to the input matrix.
  2. fdr: FDR for the differential test.
  3. mean_x: The mean value in group x.
  4. scaled_mean_x: The mean value in group x after rows are scaled.
  5. 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")

plot of chunk tab-SD-kmeans-dimension-reduction-1

dimension_reduction(res, k = 3, method = "UMAP")

plot of chunk tab-SD-kmeans-dimension-reduction-2

dimension_reduction(res, k = 4, method = "UMAP")

plot of chunk tab-SD-kmeans-dimension-reduction-3

dimension_reduction(res, k = 5, method = "UMAP")

plot of chunk tab-SD-kmeans-dimension-reduction-4

dimension_reduction(res, k = 6, method = "UMAP")

plot of chunk tab-SD-kmeans-dimension-reduction-5

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk SD-kmeans-collect-classes

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  time(p) k
#> SD:kmeans 79 3.41e-07 2
#> SD:kmeans 79 1.69e-05 3
#> SD:kmeans 64 1.86e-04 4
#> SD:kmeans 68 4.99e-05 5
#> SD:kmeans 67 1.42e-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.


SD:skmeans*

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 7758 rows and 79 columns.
#>   Top rows (776, 1552, 2328, 3103, 3879) 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 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)

plot of chunk SD-skmeans-collect-plots

The plots are:

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:

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)

plot of chunk SD-skmeans-select-partition-number

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.987       0.995         0.5037 0.498   0.498
#> 3 3 0.983           0.955       0.982         0.3109 0.784   0.590
#> 4 4 0.902           0.894       0.940         0.1258 0.895   0.699
#> 5 5 0.774           0.784       0.877         0.0668 0.947   0.795
#> 6 6 0.728           0.686       0.792         0.0410 0.993   0.968

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.

show/hide code output

cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#>          class entropy silhouette    p1    p2
#> GSM35441     2  0.0000      1.000 0.000 1.000
#> GSM35446     2  0.0000      1.000 0.000 1.000
#> GSM35449     2  0.0000      1.000 0.000 1.000
#> GSM35455     2  0.0000      1.000 0.000 1.000
#> GSM35458     2  0.0000      1.000 0.000 1.000
#> GSM35460     2  0.0000      1.000 0.000 1.000
#> GSM35461     1  0.0000      0.990 1.000 0.000
#> GSM35463     2  0.0000      1.000 0.000 1.000
#> GSM35472     2  0.0376      0.996 0.004 0.996
#> GSM35475     2  0.0000      1.000 0.000 1.000
#> GSM35483     2  0.0000      1.000 0.000 1.000
#> GSM35496     1  0.0000      0.990 1.000 0.000
#> GSM35497     2  0.0000      1.000 0.000 1.000
#> GSM35504     2  0.0000      1.000 0.000 1.000
#> GSM35508     2  0.0000      1.000 0.000 1.000
#> GSM35511     2  0.0000      1.000 0.000 1.000
#> GSM35512     2  0.0000      1.000 0.000 1.000
#> GSM35515     2  0.0000      1.000 0.000 1.000
#> GSM35519     2  0.0000      1.000 0.000 1.000
#> GSM35527     2  0.0000      1.000 0.000 1.000
#> GSM35532     2  0.0000      1.000 0.000 1.000
#> GSM35439     2  0.0000      1.000 0.000 1.000
#> GSM35443     1  0.0000      0.990 1.000 0.000
#> GSM35445     1  0.0000      0.990 1.000 0.000
#> GSM35448     2  0.0000      1.000 0.000 1.000
#> GSM35451     1  0.0000      0.990 1.000 0.000
#> GSM35454     1  0.0000      0.990 1.000 0.000
#> GSM35457     2  0.0000      1.000 0.000 1.000
#> GSM35465     2  0.0000      1.000 0.000 1.000
#> GSM35468     1  0.0000      0.990 1.000 0.000
#> GSM35471     1  0.0000      0.990 1.000 0.000
#> GSM35473     1  0.0000      0.990 1.000 0.000
#> GSM35477     1  0.0000      0.990 1.000 0.000
#> GSM35480     1  0.0000      0.990 1.000 0.000
#> GSM35482     1  0.0000      0.990 1.000 0.000
#> GSM35485     2  0.0000      1.000 0.000 1.000
#> GSM35489     2  0.0000      1.000 0.000 1.000
#> GSM35492     1  0.0000      0.990 1.000 0.000
#> GSM35495     1  0.9491      0.422 0.632 0.368
#> GSM35499     2  0.0000      1.000 0.000 1.000
#> GSM35502     1  0.0000      0.990 1.000 0.000
#> GSM35505     1  0.0000      0.990 1.000 0.000
#> GSM35507     1  0.0000      0.990 1.000 0.000
#> GSM35510     2  0.0000      1.000 0.000 1.000
#> GSM35514     1  0.0000      0.990 1.000 0.000
#> GSM35517     2  0.0000      1.000 0.000 1.000
#> GSM35520     2  0.0000      1.000 0.000 1.000
#> GSM35523     1  0.0000      0.990 1.000 0.000
#> GSM35529     2  0.0000      1.000 0.000 1.000
#> GSM35531     2  0.0000      1.000 0.000 1.000
#> GSM35534     2  0.0000      1.000 0.000 1.000
#> GSM35536     1  0.0000      0.990 1.000 0.000
#> GSM35538     1  0.0000      0.990 1.000 0.000
#> GSM35539     1  0.0000      0.990 1.000 0.000
#> GSM35540     2  0.0000      1.000 0.000 1.000
#> GSM35541     2  0.0000      1.000 0.000 1.000
#> GSM35442     1  0.0000      0.990 1.000 0.000
#> GSM35447     1  0.2603      0.947 0.956 0.044
#> GSM35450     1  0.0000      0.990 1.000 0.000
#> GSM35453     1  0.0000      0.990 1.000 0.000
#> GSM35456     1  0.0000      0.990 1.000 0.000
#> GSM35464     2  0.0000      1.000 0.000 1.000
#> GSM35467     1  0.0000      0.990 1.000 0.000
#> GSM35470     1  0.0000      0.990 1.000 0.000
#> GSM35479     1  0.0000      0.990 1.000 0.000
#> GSM35484     1  0.0000      0.990 1.000 0.000
#> GSM35488     1  0.0000      0.990 1.000 0.000
#> GSM35491     1  0.0000      0.990 1.000 0.000
#> GSM35494     1  0.0000      0.990 1.000 0.000
#> GSM35498     1  0.0000      0.990 1.000 0.000
#> GSM35501     1  0.0000      0.990 1.000 0.000
#> GSM35509     1  0.0938      0.979 0.988 0.012
#> GSM35513     1  0.0000      0.990 1.000 0.000
#> GSM35516     2  0.0000      1.000 0.000 1.000
#> GSM35522     1  0.0000      0.990 1.000 0.000
#> GSM35525     1  0.0000      0.990 1.000 0.000
#> GSM35528     1  0.0000      0.990 1.000 0.000
#> GSM35533     1  0.0000      0.990 1.000 0.000
#> GSM35537     1  0.0000      0.990 1.000 0.000

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>          class entropy silhouette    p1    p2    p3
#> GSM35441     2  0.0000      0.988 0.000 1.000 0.000
#> GSM35446     3  0.0000      0.960 0.000 0.000 1.000
#> GSM35449     2  0.0000      0.988 0.000 1.000 0.000
#> GSM35455     2  0.0000      0.988 0.000 1.000 0.000
#> GSM35458     2  0.0000      0.988 0.000 1.000 0.000
#> GSM35460     3  0.0000      0.960 0.000 0.000 1.000
#> GSM35461     3  0.0000      0.960 0.000 0.000 1.000
#> GSM35463     2  0.0000      0.988 0.000 1.000 0.000
#> GSM35472     3  0.0000      0.960 0.000 0.000 1.000
#> GSM35475     2  0.5529      0.571 0.000 0.704 0.296
#> GSM35483     2  0.0000      0.988 0.000 1.000 0.000
#> GSM35496     3  0.0000      0.960 0.000 0.000 1.000
#> GSM35497     2  0.0000      0.988 0.000 1.000 0.000
#> GSM35504     2  0.0000      0.988 0.000 1.000 0.000
#> GSM35508     2  0.0000      0.988 0.000 1.000 0.000
#> GSM35511     3  0.4750      0.697 0.000 0.216 0.784
#> GSM35512     3  0.0000      0.960 0.000 0.000 1.000
#> GSM35515     2  0.0000      0.988 0.000 1.000 0.000
#> GSM35519     3  0.0000      0.960 0.000 0.000 1.000
#> GSM35527     2  0.0000      0.988 0.000 1.000 0.000
#> GSM35532     3  0.0000      0.960 0.000 0.000 1.000
#> GSM35439     2  0.0000      0.988 0.000 1.000 0.000
#> GSM35443     1  0.0000      0.985 1.000 0.000 0.000
#> GSM35445     1  0.0000      0.985 1.000 0.000 0.000
#> GSM35448     3  0.0000      0.960 0.000 0.000 1.000
#> GSM35451     1  0.0000      0.985 1.000 0.000 0.000
#> GSM35454     3  0.0000      0.960 0.000 0.000 1.000
#> GSM35457     2  0.0000      0.988 0.000 1.000 0.000
#> GSM35465     2  0.0000      0.988 0.000 1.000 0.000
#> GSM35468     1  0.0000      0.985 1.000 0.000 0.000
#> GSM35471     1  0.0000      0.985 1.000 0.000 0.000
#> GSM35473     1  0.0000      0.985 1.000 0.000 0.000
#> GSM35477     1  0.0000      0.985 1.000 0.000 0.000
#> GSM35480     1  0.0000      0.985 1.000 0.000 0.000
#> GSM35482     3  0.0000      0.960 0.000 0.000 1.000
#> GSM35485     2  0.0000      0.988 0.000 1.000 0.000
#> GSM35489     2  0.0000      0.988 0.000 1.000 0.000
#> GSM35492     1  0.0000      0.985 1.000 0.000 0.000
#> GSM35495     3  0.0000      0.960 0.000 0.000 1.000
#> GSM35499     2  0.0000      0.988 0.000 1.000 0.000
#> GSM35502     1  0.0000      0.985 1.000 0.000 0.000
#> GSM35505     3  0.0000      0.960 0.000 0.000 1.000
#> GSM35507     1  0.4842      0.711 0.776 0.224 0.000
#> GSM35510     2  0.0000      0.988 0.000 1.000 0.000
#> GSM35514     1  0.0000      0.985 1.000 0.000 0.000
#> GSM35517     2  0.0000      0.988 0.000 1.000 0.000
#> GSM35520     2  0.0747      0.973 0.000 0.984 0.016
#> GSM35523     1  0.0000      0.985 1.000 0.000 0.000
#> GSM35529     2  0.0000      0.988 0.000 1.000 0.000
#> GSM35531     2  0.0000      0.988 0.000 1.000 0.000
#> GSM35534     2  0.0000      0.988 0.000 1.000 0.000
#> GSM35536     1  0.0000      0.985 1.000 0.000 0.000
#> GSM35538     1  0.0000      0.985 1.000 0.000 0.000
#> GSM35539     1  0.0000      0.985 1.000 0.000 0.000
#> GSM35540     2  0.0000      0.988 0.000 1.000 0.000
#> GSM35541     2  0.0000      0.988 0.000 1.000 0.000
#> GSM35442     3  0.6280      0.126 0.460 0.000 0.540
#> GSM35447     3  0.0000      0.960 0.000 0.000 1.000
#> GSM35450     1  0.0000      0.985 1.000 0.000 0.000
#> GSM35453     1  0.2537      0.907 0.920 0.000 0.080
#> GSM35456     1  0.0000      0.985 1.000 0.000 0.000
#> GSM35464     2  0.0000      0.988 0.000 1.000 0.000
#> GSM35467     1  0.0000      0.985 1.000 0.000 0.000
#> GSM35470     1  0.3192      0.869 0.888 0.000 0.112
#> GSM35479     3  0.0000      0.960 0.000 0.000 1.000
#> GSM35484     1  0.0000      0.985 1.000 0.000 0.000
#> GSM35488     1  0.0000      0.985 1.000 0.000 0.000
#> GSM35491     1  0.0000      0.985 1.000 0.000 0.000
#> GSM35494     3  0.0000      0.960 0.000 0.000 1.000
#> GSM35498     1  0.0000      0.985 1.000 0.000 0.000
#> GSM35501     1  0.0000      0.985 1.000 0.000 0.000
#> GSM35509     3  0.0000      0.960 0.000 0.000 1.000
#> GSM35513     1  0.0000      0.985 1.000 0.000 0.000
#> GSM35516     2  0.0000      0.988 0.000 1.000 0.000
#> GSM35522     1  0.0000      0.985 1.000 0.000 0.000
#> GSM35525     1  0.0000      0.985 1.000 0.000 0.000
#> GSM35528     1  0.0000      0.985 1.000 0.000 0.000
#> GSM35533     1  0.0000      0.985 1.000 0.000 0.000
#> GSM35537     1  0.0000      0.985 1.000 0.000 0.000

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>          class entropy silhouette    p1    p2    p3    p4
#> GSM35441     2  0.0000      0.966 0.000 1.000 0.000 0.000
#> GSM35446     3  0.0000      0.956 0.000 0.000 1.000 0.000
#> GSM35449     2  0.0188      0.965 0.000 0.996 0.000 0.004
#> GSM35455     2  0.0188      0.965 0.000 0.996 0.000 0.004
#> GSM35458     2  0.2408      0.920 0.000 0.920 0.044 0.036
#> GSM35460     3  0.0188      0.956 0.000 0.000 0.996 0.004
#> GSM35461     3  0.1584      0.944 0.012 0.000 0.952 0.036
#> GSM35463     2  0.0000      0.966 0.000 1.000 0.000 0.000
#> GSM35472     3  0.0707      0.951 0.000 0.000 0.980 0.020
#> GSM35475     2  0.5200      0.621 0.000 0.700 0.264 0.036
#> GSM35483     2  0.0000      0.966 0.000 1.000 0.000 0.000
#> GSM35496     3  0.0921      0.952 0.000 0.000 0.972 0.028
#> GSM35497     2  0.0188      0.965 0.000 0.996 0.000 0.004
#> GSM35504     2  0.0000      0.966 0.000 1.000 0.000 0.000
#> GSM35508     2  0.0804      0.959 0.000 0.980 0.008 0.012
#> GSM35511     3  0.4707      0.701 0.000 0.204 0.760 0.036
#> GSM35512     3  0.0817      0.950 0.000 0.000 0.976 0.024
#> GSM35515     2  0.2494      0.917 0.000 0.916 0.048 0.036
#> GSM35519     3  0.1305      0.943 0.000 0.004 0.960 0.036
#> GSM35527     2  0.0336      0.964 0.000 0.992 0.000 0.008
#> GSM35532     3  0.1118      0.945 0.000 0.000 0.964 0.036
#> GSM35439     2  0.0000      0.966 0.000 1.000 0.000 0.000
#> GSM35443     1  0.0707      0.927 0.980 0.000 0.000 0.020
#> GSM35445     1  0.0000      0.941 1.000 0.000 0.000 0.000
#> GSM35448     3  0.0188      0.956 0.000 0.000 0.996 0.004
#> GSM35451     4  0.3873      0.802 0.228 0.000 0.000 0.772
#> GSM35454     3  0.1211      0.948 0.000 0.000 0.960 0.040
#> GSM35457     2  0.0336      0.964 0.000 0.992 0.000 0.008
#> GSM35465     2  0.2011      0.915 0.000 0.920 0.000 0.080
#> GSM35468     1  0.0188      0.940 0.996 0.000 0.000 0.004
#> GSM35471     4  0.1302      0.860 0.044 0.000 0.000 0.956
#> GSM35473     1  0.0000      0.941 1.000 0.000 0.000 0.000
#> GSM35477     4  0.3764      0.811 0.216 0.000 0.000 0.784
#> GSM35480     1  0.2345      0.852 0.900 0.000 0.000 0.100
#> GSM35482     3  0.2216      0.915 0.000 0.000 0.908 0.092
#> GSM35485     2  0.0000      0.966 0.000 1.000 0.000 0.000
#> GSM35489     2  0.0336      0.964 0.000 0.992 0.000 0.008
#> GSM35492     1  0.0188      0.940 0.996 0.000 0.000 0.004
#> GSM35495     3  0.0817      0.953 0.000 0.000 0.976 0.024
#> GSM35499     2  0.1389      0.941 0.000 0.952 0.000 0.048
#> GSM35502     1  0.0000      0.941 1.000 0.000 0.000 0.000
#> GSM35505     3  0.0000      0.956 0.000 0.000 1.000 0.000
#> GSM35507     4  0.2111      0.843 0.024 0.044 0.000 0.932
#> GSM35510     2  0.0469      0.962 0.000 0.988 0.000 0.012
#> GSM35514     1  0.0000      0.941 1.000 0.000 0.000 0.000
#> GSM35517     2  0.0000      0.966 0.000 1.000 0.000 0.000
#> GSM35520     2  0.3082      0.887 0.000 0.884 0.084 0.032
#> GSM35523     4  0.1118      0.858 0.036 0.000 0.000 0.964
#> GSM35529     2  0.0000      0.966 0.000 1.000 0.000 0.000
#> GSM35531     2  0.1256      0.949 0.000 0.964 0.028 0.008
#> GSM35534     2  0.0000      0.966 0.000 1.000 0.000 0.000
#> GSM35536     1  0.0000      0.941 1.000 0.000 0.000 0.000
#> GSM35538     1  0.4989     -0.216 0.528 0.000 0.000 0.472
#> GSM35539     4  0.4040      0.783 0.248 0.000 0.000 0.752
#> GSM35540     2  0.1792      0.926 0.000 0.932 0.000 0.068
#> GSM35541     2  0.0000      0.966 0.000 1.000 0.000 0.000
#> GSM35442     1  0.2739      0.855 0.904 0.000 0.060 0.036
#> GSM35447     3  0.0000      0.956 0.000 0.000 1.000 0.000
#> GSM35450     4  0.4661      0.639 0.348 0.000 0.000 0.652
#> GSM35453     1  0.1398      0.902 0.956 0.000 0.040 0.004
#> GSM35456     4  0.2021      0.860 0.056 0.012 0.000 0.932
#> GSM35464     4  0.2345      0.802 0.000 0.100 0.000 0.900
#> GSM35467     1  0.0000      0.941 1.000 0.000 0.000 0.000
#> GSM35470     4  0.5639      0.564 0.324 0.000 0.040 0.636
#> GSM35479     3  0.1557      0.941 0.000 0.000 0.944 0.056
#> GSM35484     1  0.0000      0.941 1.000 0.000 0.000 0.000
#> GSM35488     1  0.0188      0.940 0.996 0.000 0.000 0.004
#> GSM35491     1  0.0188      0.940 0.996 0.000 0.000 0.004
#> GSM35494     3  0.1557      0.941 0.000 0.000 0.944 0.056
#> GSM35498     4  0.1211      0.860 0.040 0.000 0.000 0.960
#> GSM35501     1  0.0000      0.941 1.000 0.000 0.000 0.000
#> GSM35509     3  0.1557      0.941 0.000 0.000 0.944 0.056
#> GSM35513     1  0.0000      0.941 1.000 0.000 0.000 0.000
#> GSM35516     2  0.0817      0.956 0.000 0.976 0.000 0.024
#> GSM35522     4  0.1209      0.857 0.032 0.004 0.000 0.964
#> GSM35525     1  0.3219      0.748 0.836 0.000 0.000 0.164
#> GSM35528     4  0.3873      0.801 0.228 0.000 0.000 0.772
#> GSM35533     1  0.0000      0.941 1.000 0.000 0.000 0.000
#> GSM35537     4  0.2466      0.849 0.096 0.000 0.004 0.900

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>          class entropy silhouette    p1    p2    p3    p4    p5
#> GSM35441     2  0.2561     0.8286 0.000 0.856 0.000 0.000 0.144
#> GSM35446     3  0.1851     0.8527 0.000 0.000 0.912 0.000 0.088
#> GSM35449     2  0.3857     0.6635 0.000 0.688 0.000 0.000 0.312
#> GSM35455     2  0.3305     0.7673 0.000 0.776 0.000 0.000 0.224
#> GSM35458     5  0.1732     0.7825 0.000 0.080 0.000 0.000 0.920
#> GSM35460     3  0.1197     0.8737 0.000 0.000 0.952 0.000 0.048
#> GSM35461     5  0.4757     0.3540 0.024 0.000 0.380 0.000 0.596
#> GSM35463     2  0.1202     0.8583 0.000 0.960 0.004 0.004 0.032
#> GSM35472     3  0.4166     0.4325 0.004 0.000 0.648 0.000 0.348
#> GSM35475     5  0.2304     0.7963 0.000 0.048 0.044 0.000 0.908
#> GSM35483     2  0.1644     0.8552 0.000 0.940 0.008 0.004 0.048
#> GSM35496     3  0.1605     0.8703 0.004 0.000 0.944 0.012 0.040
#> GSM35497     2  0.3857     0.6680 0.000 0.688 0.000 0.000 0.312
#> GSM35504     2  0.2032     0.8598 0.000 0.924 0.020 0.004 0.052
#> GSM35508     2  0.4307     0.2635 0.000 0.504 0.000 0.000 0.496
#> GSM35511     5  0.2818     0.7774 0.000 0.012 0.132 0.000 0.856
#> GSM35512     3  0.4359     0.2596 0.004 0.000 0.584 0.000 0.412
#> GSM35515     5  0.1732     0.7825 0.000 0.080 0.000 0.000 0.920
#> GSM35519     5  0.3143     0.7336 0.000 0.000 0.204 0.000 0.796
#> GSM35527     2  0.4161     0.5283 0.000 0.608 0.000 0.000 0.392
#> GSM35532     5  0.3210     0.7253 0.000 0.000 0.212 0.000 0.788
#> GSM35439     2  0.1124     0.8584 0.000 0.960 0.004 0.000 0.036
#> GSM35443     1  0.1544     0.8883 0.932 0.000 0.000 0.000 0.068
#> GSM35445     1  0.1117     0.9089 0.964 0.000 0.020 0.000 0.016
#> GSM35448     3  0.2569     0.8402 0.000 0.032 0.896 0.004 0.068
#> GSM35451     4  0.3769     0.7814 0.180 0.000 0.000 0.788 0.032
#> GSM35454     3  0.0898     0.8743 0.000 0.000 0.972 0.008 0.020
#> GSM35457     2  0.1892     0.8525 0.000 0.916 0.000 0.004 0.080
#> GSM35465     2  0.3410     0.8248 0.000 0.840 0.000 0.068 0.092
#> GSM35468     1  0.0955     0.9143 0.968 0.000 0.000 0.004 0.028
#> GSM35471     4  0.0162     0.8123 0.004 0.000 0.000 0.996 0.000
#> GSM35473     1  0.0566     0.9175 0.984 0.000 0.000 0.004 0.012
#> GSM35477     4  0.3694     0.7861 0.172 0.000 0.000 0.796 0.032
#> GSM35480     1  0.3122     0.8299 0.860 0.000 0.016 0.108 0.016
#> GSM35482     3  0.1731     0.8558 0.004 0.000 0.932 0.060 0.004
#> GSM35485     2  0.1205     0.8580 0.000 0.956 0.004 0.000 0.040
#> GSM35489     2  0.0880     0.8620 0.000 0.968 0.000 0.000 0.032
#> GSM35492     1  0.0794     0.9132 0.972 0.000 0.000 0.000 0.028
#> GSM35495     3  0.0404     0.8785 0.000 0.000 0.988 0.000 0.012
#> GSM35499     2  0.1403     0.8564 0.000 0.952 0.000 0.024 0.024
#> GSM35502     1  0.0162     0.9193 0.996 0.000 0.000 0.004 0.000
#> GSM35505     3  0.1270     0.8763 0.000 0.000 0.948 0.000 0.052
#> GSM35507     4  0.1597     0.8071 0.008 0.020 0.000 0.948 0.024
#> GSM35510     2  0.1282     0.8598 0.000 0.952 0.000 0.004 0.044
#> GSM35514     1  0.0162     0.9193 0.996 0.000 0.000 0.004 0.000
#> GSM35517     2  0.0880     0.8623 0.000 0.968 0.000 0.000 0.032
#> GSM35520     5  0.4192     0.6699 0.000 0.232 0.032 0.000 0.736
#> GSM35523     4  0.0324     0.8120 0.004 0.000 0.000 0.992 0.004
#> GSM35529     2  0.1908     0.8495 0.000 0.908 0.000 0.000 0.092
#> GSM35531     2  0.3080     0.7818 0.000 0.852 0.020 0.004 0.124
#> GSM35534     2  0.1492     0.8560 0.000 0.948 0.008 0.004 0.040
#> GSM35536     1  0.0451     0.9178 0.988 0.000 0.000 0.004 0.008
#> GSM35538     1  0.4736     0.0834 0.576 0.000 0.000 0.404 0.020
#> GSM35539     4  0.3863     0.7122 0.248 0.000 0.000 0.740 0.012
#> GSM35540     2  0.3165     0.8338 0.000 0.848 0.000 0.036 0.116
#> GSM35541     2  0.1124     0.8584 0.000 0.960 0.004 0.000 0.036
#> GSM35442     1  0.3919     0.7868 0.816 0.000 0.100 0.008 0.076
#> GSM35447     3  0.1908     0.8605 0.000 0.000 0.908 0.000 0.092
#> GSM35450     4  0.4697     0.4718 0.388 0.000 0.000 0.592 0.020
#> GSM35453     1  0.2519     0.8425 0.884 0.000 0.100 0.000 0.016
#> GSM35456     4  0.1668     0.8161 0.032 0.000 0.000 0.940 0.028
#> GSM35464     4  0.2824     0.7425 0.000 0.096 0.000 0.872 0.032
#> GSM35467     1  0.0162     0.9193 0.996 0.000 0.000 0.004 0.000
#> GSM35470     4  0.7028     0.3235 0.256 0.000 0.280 0.448 0.016
#> GSM35479     3  0.1205     0.8681 0.000 0.000 0.956 0.040 0.004
#> GSM35484     1  0.0566     0.9184 0.984 0.000 0.000 0.004 0.012
#> GSM35488     1  0.0898     0.9166 0.972 0.000 0.000 0.008 0.020
#> GSM35491     1  0.0794     0.9132 0.972 0.000 0.000 0.000 0.028
#> GSM35494     3  0.1331     0.8670 0.000 0.000 0.952 0.040 0.008
#> GSM35498     4  0.0451     0.8114 0.004 0.000 0.000 0.988 0.008
#> GSM35501     1  0.0162     0.9193 0.996 0.000 0.000 0.004 0.000
#> GSM35509     3  0.0510     0.8769 0.000 0.000 0.984 0.016 0.000
#> GSM35513     1  0.0162     0.9193 0.996 0.000 0.000 0.004 0.000
#> GSM35516     2  0.1914     0.8445 0.000 0.924 0.000 0.016 0.060
#> GSM35522     4  0.0324     0.8120 0.004 0.000 0.000 0.992 0.004
#> GSM35525     1  0.3579     0.6329 0.756 0.000 0.000 0.240 0.004
#> GSM35528     4  0.3757     0.7549 0.208 0.000 0.000 0.772 0.020
#> GSM35533     1  0.0771     0.9165 0.976 0.000 0.000 0.004 0.020
#> GSM35537     4  0.3512     0.7650 0.088 0.000 0.068 0.840 0.004

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>          class entropy silhouette    p1    p2    p3    p4    p5 p6
#> GSM35441     2  0.1584     0.7111 0.000 0.928 0.000 0.000 0.064 NA
#> GSM35446     3  0.2263     0.8058 0.000 0.000 0.884 0.000 0.100 NA
#> GSM35449     2  0.3658     0.5887 0.000 0.752 0.000 0.000 0.216 NA
#> GSM35455     2  0.2909     0.6630 0.000 0.836 0.000 0.000 0.136 NA
#> GSM35458     5  0.2000     0.7906 0.004 0.032 0.000 0.000 0.916 NA
#> GSM35460     3  0.1265     0.8374 0.000 0.000 0.948 0.000 0.044 NA
#> GSM35461     5  0.5339     0.5717 0.028 0.000 0.180 0.000 0.656 NA
#> GSM35463     2  0.3756     0.6881 0.000 0.600 0.000 0.000 0.000 NA
#> GSM35472     3  0.4591     0.2049 0.000 0.000 0.552 0.000 0.408 NA
#> GSM35475     5  0.1218     0.7992 0.000 0.028 0.004 0.000 0.956 NA
#> GSM35483     2  0.4319     0.6784 0.000 0.576 0.000 0.000 0.024 NA
#> GSM35496     3  0.3324     0.7971 0.000 0.000 0.824 0.004 0.060 NA
#> GSM35497     2  0.3558     0.5945 0.000 0.760 0.000 0.000 0.212 NA
#> GSM35504     2  0.3736     0.7255 0.000 0.788 0.020 0.000 0.032 NA
#> GSM35508     2  0.4241     0.3665 0.000 0.608 0.000 0.000 0.368 NA
#> GSM35511     5  0.0972     0.8013 0.000 0.008 0.028 0.000 0.964 NA
#> GSM35512     5  0.4517     0.0707 0.000 0.000 0.444 0.000 0.524 NA
#> GSM35515     5  0.2000     0.7906 0.004 0.032 0.000 0.000 0.916 NA
#> GSM35519     5  0.2263     0.7762 0.000 0.000 0.100 0.000 0.884 NA
#> GSM35527     2  0.4065     0.4787 0.000 0.672 0.000 0.000 0.300 NA
#> GSM35532     5  0.1918     0.7862 0.000 0.000 0.088 0.000 0.904 NA
#> GSM35439     2  0.3819     0.7119 0.000 0.652 0.000 0.000 0.008 NA
#> GSM35443     1  0.3695     0.7556 0.776 0.000 0.000 0.000 0.060 NA
#> GSM35445     1  0.2862     0.7935 0.864 0.000 0.048 0.000 0.008 NA
#> GSM35448     3  0.3972     0.7299 0.000 0.016 0.784 0.000 0.076 NA
#> GSM35451     4  0.4584     0.6711 0.196 0.000 0.000 0.700 0.004 NA
#> GSM35454     3  0.1946     0.8258 0.004 0.000 0.912 0.000 0.012 NA
#> GSM35457     2  0.1074     0.7203 0.000 0.960 0.000 0.000 0.028 NA
#> GSM35465     2  0.3851     0.6547 0.000 0.804 0.000 0.096 0.028 NA
#> GSM35468     1  0.2357     0.8088 0.872 0.000 0.000 0.000 0.012 NA
#> GSM35471     4  0.1204     0.7314 0.000 0.000 0.000 0.944 0.000 NA
#> GSM35473     1  0.1524     0.8249 0.932 0.000 0.000 0.000 0.008 NA
#> GSM35477     4  0.4584     0.6694 0.196 0.000 0.000 0.700 0.004 NA
#> GSM35480     1  0.4681     0.6726 0.732 0.000 0.032 0.140 0.000 NA
#> GSM35482     3  0.3686     0.7665 0.000 0.000 0.796 0.060 0.008 NA
#> GSM35485     2  0.3872     0.6920 0.000 0.604 0.000 0.000 0.004 NA
#> GSM35489     2  0.3383     0.7333 0.000 0.728 0.000 0.000 0.004 NA
#> GSM35492     1  0.2572     0.8011 0.852 0.000 0.000 0.000 0.012 NA
#> GSM35495     3  0.0363     0.8439 0.000 0.000 0.988 0.000 0.012 NA
#> GSM35499     2  0.3017     0.7358 0.000 0.816 0.000 0.020 0.000 NA
#> GSM35502     1  0.0000     0.8342 1.000 0.000 0.000 0.000 0.000 NA
#> GSM35505     3  0.2575     0.8220 0.004 0.000 0.880 0.000 0.044 NA
#> GSM35507     4  0.2933     0.7135 0.008 0.032 0.000 0.860 0.004 NA
#> GSM35510     2  0.1327     0.7351 0.000 0.936 0.000 0.000 0.000 NA
#> GSM35514     1  0.0000     0.8342 1.000 0.000 0.000 0.000 0.000 NA
#> GSM35517     2  0.3151     0.7334 0.000 0.748 0.000 0.000 0.000 NA
#> GSM35520     5  0.4787     0.6049 0.000 0.104 0.020 0.000 0.708 NA
#> GSM35523     4  0.2135     0.7183 0.000 0.000 0.000 0.872 0.000 NA
#> GSM35529     2  0.1124     0.7175 0.000 0.956 0.000 0.000 0.036 NA
#> GSM35531     2  0.5522     0.5960 0.000 0.492 0.008 0.004 0.088 NA
#> GSM35534     2  0.4212     0.6719 0.000 0.560 0.000 0.000 0.016 NA
#> GSM35536     1  0.0458     0.8339 0.984 0.000 0.000 0.000 0.000 NA
#> GSM35538     1  0.5033    -0.1790 0.476 0.000 0.000 0.452 0.000 NA
#> GSM35539     4  0.4381     0.6270 0.236 0.000 0.000 0.692 0.000 NA
#> GSM35540     2  0.4389     0.6325 0.000 0.772 0.000 0.084 0.068 NA
#> GSM35541     2  0.3515     0.7148 0.000 0.676 0.000 0.000 0.000 NA
#> GSM35442     1  0.6017     0.5836 0.592 0.000 0.116 0.000 0.068 NA
#> GSM35447     3  0.3382     0.7852 0.004 0.000 0.820 0.000 0.112 NA
#> GSM35450     4  0.4855     0.4887 0.328 0.000 0.000 0.596 0.000 NA
#> GSM35453     1  0.4342     0.6868 0.740 0.000 0.152 0.000 0.008 NA
#> GSM35456     4  0.3863     0.7174 0.092 0.008 0.000 0.796 0.004 NA
#> GSM35464     4  0.4824     0.5901 0.000 0.180 0.000 0.680 0.004 NA
#> GSM35467     1  0.0000     0.8342 1.000 0.000 0.000 0.000 0.000 NA
#> GSM35470     4  0.7660     0.1275 0.124 0.000 0.292 0.308 0.008 NA
#> GSM35479     3  0.2301     0.8201 0.000 0.000 0.884 0.020 0.000 NA
#> GSM35484     1  0.1655     0.8236 0.932 0.000 0.000 0.008 0.008 NA
#> GSM35488     1  0.3263     0.7866 0.832 0.000 0.000 0.040 0.012 NA
#> GSM35491     1  0.2489     0.8044 0.860 0.000 0.000 0.000 0.012 NA
#> GSM35494     3  0.1946     0.8314 0.000 0.000 0.912 0.012 0.004 NA
#> GSM35498     4  0.2520     0.7134 0.000 0.000 0.000 0.844 0.004 NA
#> GSM35501     1  0.0146     0.8340 0.996 0.000 0.000 0.000 0.000 NA
#> GSM35509     3  0.0777     0.8432 0.000 0.000 0.972 0.004 0.000 NA
#> GSM35513     1  0.0146     0.8343 0.996 0.000 0.000 0.000 0.000 NA
#> GSM35516     2  0.4341     0.6942 0.000 0.616 0.000 0.024 0.004 NA
#> GSM35522     4  0.2135     0.7183 0.000 0.000 0.000 0.872 0.000 NA
#> GSM35525     1  0.4814     0.3575 0.616 0.000 0.000 0.304 0.000 NA
#> GSM35528     4  0.5112     0.6423 0.196 0.000 0.000 0.652 0.008 NA
#> GSM35533     1  0.2182     0.8153 0.904 0.000 0.000 0.020 0.008 NA
#> GSM35537     4  0.5488     0.6058 0.032 0.000 0.100 0.640 0.004 NA

Heatmaps for the consensus matrix. It visualizes the probability of two samples to be in a same group.

consensus_heatmap(res, k = 2)

plot of chunk tab-SD-skmeans-consensus-heatmap-1

consensus_heatmap(res, k = 3)

plot of chunk tab-SD-skmeans-consensus-heatmap-2

consensus_heatmap(res, k = 4)

plot of chunk tab-SD-skmeans-consensus-heatmap-3

consensus_heatmap(res, k = 5)

plot of chunk tab-SD-skmeans-consensus-heatmap-4

consensus_heatmap(res, k = 6)

plot of chunk tab-SD-skmeans-consensus-heatmap-5

Heatmaps for the membership of samples in all partitions to see how consistent they are:

membership_heatmap(res, k = 2)

plot of chunk tab-SD-skmeans-membership-heatmap-1

membership_heatmap(res, k = 3)

plot of chunk tab-SD-skmeans-membership-heatmap-2

membership_heatmap(res, k = 4)

plot of chunk tab-SD-skmeans-membership-heatmap-3

membership_heatmap(res, k = 5)

plot of chunk tab-SD-skmeans-membership-heatmap-4

membership_heatmap(res, k = 6)

plot of chunk tab-SD-skmeans-membership-heatmap-5

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)

plot of chunk tab-SD-skmeans-get-signatures-1

get_signatures(res, k = 3)

plot of chunk tab-SD-skmeans-get-signatures-2

get_signatures(res, k = 4)

plot of chunk tab-SD-skmeans-get-signatures-3

get_signatures(res, k = 5)

plot of chunk tab-SD-skmeans-get-signatures-4

get_signatures(res, k = 6)

plot of chunk tab-SD-skmeans-get-signatures-5

Signature heatmaps where rows are not scaled:

get_signatures(res, k = 2, scale_rows = FALSE)

plot of chunk tab-SD-skmeans-get-signatures-no-scale-1

get_signatures(res, k = 3, scale_rows = FALSE)

plot of chunk tab-SD-skmeans-get-signatures-no-scale-2

get_signatures(res, k = 4, scale_rows = FALSE)

plot of chunk tab-SD-skmeans-get-signatures-no-scale-3

get_signatures(res, k = 5, scale_rows = FALSE)

plot of chunk tab-SD-skmeans-get-signatures-no-scale-4

get_signatures(res, k = 6, scale_rows = FALSE)

plot of chunk tab-SD-skmeans-get-signatures-no-scale-5

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk SD-skmeans-signature_compare

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:

  1. which_row: row indices corresponding to the input matrix.
  2. fdr: FDR for the differential test.
  3. mean_x: The mean value in group x.
  4. scaled_mean_x: The mean value in group x after rows are scaled.
  5. 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")

plot of chunk tab-SD-skmeans-dimension-reduction-1

dimension_reduction(res, k = 3, method = "UMAP")

plot of chunk tab-SD-skmeans-dimension-reduction-2

dimension_reduction(res, k = 4, method = "UMAP")

plot of chunk tab-SD-skmeans-dimension-reduction-3

dimension_reduction(res, k = 5, method = "UMAP")

plot of chunk tab-SD-skmeans-dimension-reduction-4

dimension_reduction(res, k = 6, method = "UMAP")

plot of chunk tab-SD-skmeans-dimension-reduction-5

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk SD-skmeans-collect-classes

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  time(p) k
#> SD:skmeans 78 3.66e-07 2
#> SD:skmeans 78 2.67e-05 3
#> SD:skmeans 78 3.11e-05 4
#> SD:skmeans 72 3.03e-05 5
#> SD:skmeans 71 1.71e-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.


SD:pam

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 7758 rows and 79 columns.
#>   Top rows (776, 1552, 2328, 3103, 3879) are extracted by 'SD' method.
#>   Subgroups are detected by 'pam' method.
#>   Performed in total 1250 partitions by row resampling.
#>   Best k for subgroups seems to be 2.
#> 
#> Following methods can be applied to this 'ConsensusPartition' object:
#>  [1] "cola_report"             "collect_classes"         "collect_plots"          
#>  [4] "collect_stats"           "colnames"                "compare_signatures"     
#>  [7] "consensus_heatmap"       "dimension_reduction"     "functional_enrichment"  
#> [10] "get_anno_col"            "get_anno"                "get_classes"            
#> [13] "get_consensus"           "get_matrix"              "get_membership"         
#> [16] "get_param"               "get_signatures"          "get_stats"              
#> [19] "is_best_k"               "is_stable_k"             "membership_heatmap"     
#> [22] "ncol"                    "nrow"                    "plot_ecdf"              
#> [25] "rownames"                "select_partition_number" "show"                   
#> [28] "suggest_best_k"          "test_to_known_factors"

collect_plots() function collects all the plots made from res for all k (number of partitions) into one single page to provide an easy and fast comparison between different k.

collect_plots(res)

plot of chunk SD-pam-collect-plots

The plots are:

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:

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)

plot of chunk SD-pam-select-partition-number

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.558           0.729       0.896         0.4864 0.498   0.498
#> 3 3 0.481           0.555       0.778         0.3343 0.791   0.603
#> 4 4 0.694           0.737       0.878         0.1562 0.830   0.557
#> 5 5 0.728           0.730       0.848         0.0527 0.895   0.629
#> 6 6 0.725           0.555       0.747         0.0394 0.967   0.847

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.

show/hide code output

cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#>          class entropy silhouette    p1    p2
#> GSM35441     2  0.0000    0.84779 0.000 1.000
#> GSM35446     2  0.9427    0.46385 0.360 0.640
#> GSM35449     2  0.0376    0.84667 0.004 0.996
#> GSM35455     2  0.0000    0.84779 0.000 1.000
#> GSM35458     1  1.0000   -0.13907 0.504 0.496
#> GSM35460     2  0.9608    0.41779 0.384 0.616
#> GSM35461     1  0.8267    0.56331 0.740 0.260
#> GSM35463     2  0.0000    0.84779 0.000 1.000
#> GSM35472     2  0.9710    0.38315 0.400 0.600
#> GSM35475     2  0.9933    0.26238 0.452 0.548
#> GSM35483     2  0.0000    0.84779 0.000 1.000
#> GSM35496     1  0.0000    0.88958 1.000 0.000
#> GSM35497     2  0.0000    0.84779 0.000 1.000
#> GSM35504     2  0.0000    0.84779 0.000 1.000
#> GSM35508     2  0.0000    0.84779 0.000 1.000
#> GSM35511     2  0.6531    0.72924 0.168 0.832
#> GSM35512     2  0.9970    0.22131 0.468 0.532
#> GSM35515     1  0.9922    0.03963 0.552 0.448
#> GSM35519     2  0.9815    0.34201 0.420 0.580
#> GSM35527     2  0.0000    0.84779 0.000 1.000
#> GSM35532     2  0.7950    0.65111 0.240 0.760
#> GSM35439     2  0.0000    0.84779 0.000 1.000
#> GSM35443     1  0.0000    0.88958 1.000 0.000
#> GSM35445     1  0.0000    0.88958 1.000 0.000
#> GSM35448     2  0.1184    0.84326 0.016 0.984
#> GSM35451     1  0.3114    0.85687 0.944 0.056
#> GSM35454     2  0.9998    0.10728 0.492 0.508
#> GSM35457     2  0.0376    0.84667 0.004 0.996
#> GSM35465     2  0.0938    0.84455 0.012 0.988
#> GSM35468     1  0.0000    0.88958 1.000 0.000
#> GSM35471     1  0.4815    0.81777 0.896 0.104
#> GSM35473     1  0.0000    0.88958 1.000 0.000
#> GSM35477     1  0.0000    0.88958 1.000 0.000
#> GSM35480     1  0.0000    0.88958 1.000 0.000
#> GSM35482     1  0.3733    0.84542 0.928 0.072
#> GSM35485     2  0.0000    0.84779 0.000 1.000
#> GSM35489     2  0.0376    0.84710 0.004 0.996
#> GSM35492     1  0.0000    0.88958 1.000 0.000
#> GSM35495     1  0.9977    0.00291 0.528 0.472
#> GSM35499     2  0.2423    0.83254 0.040 0.960
#> GSM35502     1  0.0000    0.88958 1.000 0.000
#> GSM35505     1  0.9993   -0.06335 0.516 0.484
#> GSM35507     1  0.6148    0.76989 0.848 0.152
#> GSM35510     2  0.0000    0.84779 0.000 1.000
#> GSM35514     1  0.0000    0.88958 1.000 0.000
#> GSM35517     2  0.0000    0.84779 0.000 1.000
#> GSM35520     2  0.9358    0.47770 0.352 0.648
#> GSM35523     1  0.4562    0.81922 0.904 0.096
#> GSM35529     2  0.0000    0.84779 0.000 1.000
#> GSM35531     2  0.4815    0.78996 0.104 0.896
#> GSM35534     2  0.0000    0.84779 0.000 1.000
#> GSM35536     1  0.0000    0.88958 1.000 0.000
#> GSM35538     1  0.0000    0.88958 1.000 0.000
#> GSM35539     1  0.0000    0.88958 1.000 0.000
#> GSM35540     2  0.1843    0.83856 0.028 0.972
#> GSM35541     2  0.0000    0.84779 0.000 1.000
#> GSM35442     1  0.0000    0.88958 1.000 0.000
#> GSM35447     1  0.9815    0.13806 0.580 0.420
#> GSM35450     1  0.0000    0.88958 1.000 0.000
#> GSM35453     1  0.0000    0.88958 1.000 0.000
#> GSM35456     1  0.5629    0.79208 0.868 0.132
#> GSM35464     2  0.3114    0.82384 0.056 0.944
#> GSM35467     1  0.0000    0.88958 1.000 0.000
#> GSM35470     1  0.0000    0.88958 1.000 0.000
#> GSM35479     1  0.0376    0.88761 0.996 0.004
#> GSM35484     1  0.5059    0.79625 0.888 0.112
#> GSM35488     1  0.0000    0.88958 1.000 0.000
#> GSM35491     1  0.0000    0.88958 1.000 0.000
#> GSM35494     1  0.2423    0.86714 0.960 0.040
#> GSM35498     1  0.8909    0.51031 0.692 0.308
#> GSM35501     1  0.0000    0.88958 1.000 0.000
#> GSM35509     1  0.4562    0.82524 0.904 0.096
#> GSM35513     1  0.0000    0.88958 1.000 0.000
#> GSM35516     2  0.0000    0.84779 0.000 1.000
#> GSM35522     2  0.9993    0.02235 0.484 0.516
#> GSM35525     1  0.0000    0.88958 1.000 0.000
#> GSM35528     1  0.0000    0.88958 1.000 0.000
#> GSM35533     1  0.0000    0.88958 1.000 0.000
#> GSM35537     1  0.0000    0.88958 1.000 0.000

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>          class entropy silhouette    p1    p2    p3
#> GSM35441     2  0.0000     0.8930 0.000 1.000 0.000
#> GSM35446     3  0.4842     0.5042 0.000 0.224 0.776
#> GSM35449     2  0.1411     0.8749 0.000 0.964 0.036
#> GSM35455     2  0.0000     0.8930 0.000 1.000 0.000
#> GSM35458     1  0.8318     0.2057 0.600 0.284 0.116
#> GSM35460     3  0.3879     0.5495 0.000 0.152 0.848
#> GSM35461     3  0.5760     0.4075 0.328 0.000 0.672
#> GSM35463     2  0.0000     0.8930 0.000 1.000 0.000
#> GSM35472     3  0.6438     0.5376 0.136 0.100 0.764
#> GSM35475     3  0.9243     0.4039 0.192 0.288 0.520
#> GSM35483     2  0.0592     0.8899 0.000 0.988 0.012
#> GSM35496     3  0.5650     0.4193 0.312 0.000 0.688
#> GSM35497     2  0.0000     0.8930 0.000 1.000 0.000
#> GSM35504     2  0.1031     0.8855 0.000 0.976 0.024
#> GSM35508     2  0.0000     0.8930 0.000 1.000 0.000
#> GSM35511     3  0.6936     0.1103 0.016 0.460 0.524
#> GSM35512     3  0.7027     0.4432 0.296 0.044 0.660
#> GSM35515     1  0.8468     0.1416 0.576 0.308 0.116
#> GSM35519     3  0.8753     0.4831 0.188 0.224 0.588
#> GSM35527     2  0.0237     0.8921 0.000 0.996 0.004
#> GSM35532     3  0.7123     0.3135 0.032 0.364 0.604
#> GSM35439     2  0.0000     0.8930 0.000 1.000 0.000
#> GSM35443     1  0.4062     0.6140 0.836 0.000 0.164
#> GSM35445     1  0.4702     0.6157 0.788 0.000 0.212
#> GSM35448     3  0.5529     0.4224 0.000 0.296 0.704
#> GSM35451     1  0.6204     0.5123 0.576 0.000 0.424
#> GSM35454     3  0.6680    -0.4640 0.484 0.008 0.508
#> GSM35457     2  0.1411     0.8749 0.000 0.964 0.036
#> GSM35465     2  0.3412     0.7975 0.000 0.876 0.124
#> GSM35468     1  0.1411     0.6541 0.964 0.000 0.036
#> GSM35471     1  0.6274     0.4826 0.544 0.000 0.456
#> GSM35473     1  0.1411     0.6523 0.964 0.000 0.036
#> GSM35477     1  0.6215     0.5093 0.572 0.000 0.428
#> GSM35480     1  0.6126     0.5215 0.600 0.000 0.400
#> GSM35482     3  0.6295    -0.4527 0.472 0.000 0.528
#> GSM35485     2  0.0424     0.8904 0.000 0.992 0.008
#> GSM35489     2  0.0424     0.8904 0.000 0.992 0.008
#> GSM35492     1  0.1289     0.6529 0.968 0.000 0.032
#> GSM35495     3  0.1315     0.4862 0.008 0.020 0.972
#> GSM35499     2  0.6260     0.2300 0.000 0.552 0.448
#> GSM35502     1  0.0000     0.6646 1.000 0.000 0.000
#> GSM35505     3  0.8410     0.1144 0.360 0.096 0.544
#> GSM35507     1  0.6793     0.4722 0.536 0.012 0.452
#> GSM35510     2  0.3116     0.7999 0.000 0.892 0.108
#> GSM35514     1  0.0592     0.6624 0.988 0.000 0.012
#> GSM35517     2  0.0000     0.8930 0.000 1.000 0.000
#> GSM35520     2  0.9258     0.0232 0.256 0.528 0.216
#> GSM35523     1  0.6267     0.4867 0.548 0.000 0.452
#> GSM35529     2  0.0000     0.8930 0.000 1.000 0.000
#> GSM35531     2  0.7180     0.5461 0.116 0.716 0.168
#> GSM35534     2  0.0424     0.8904 0.000 0.992 0.008
#> GSM35536     1  0.0000     0.6646 1.000 0.000 0.000
#> GSM35538     1  0.0237     0.6652 0.996 0.000 0.004
#> GSM35539     1  0.5859     0.5490 0.656 0.000 0.344
#> GSM35540     2  0.3879     0.7667 0.000 0.848 0.152
#> GSM35541     2  0.0000     0.8930 0.000 1.000 0.000
#> GSM35442     1  0.2066     0.6388 0.940 0.000 0.060
#> GSM35447     1  0.6730     0.2164 0.680 0.036 0.284
#> GSM35450     1  0.5529     0.5635 0.704 0.000 0.296
#> GSM35453     1  0.1529     0.6535 0.960 0.000 0.040
#> GSM35456     1  0.6274     0.4826 0.544 0.000 0.456
#> GSM35464     2  0.4178     0.7433 0.000 0.828 0.172
#> GSM35467     1  0.0237     0.6641 0.996 0.000 0.004
#> GSM35470     1  0.6267     0.4867 0.548 0.000 0.452
#> GSM35479     3  0.5098     0.1446 0.248 0.000 0.752
#> GSM35484     1  0.3502     0.6415 0.896 0.020 0.084
#> GSM35488     1  0.1289     0.6529 0.968 0.000 0.032
#> GSM35491     1  0.2796     0.6490 0.908 0.000 0.092
#> GSM35494     1  0.6309     0.4352 0.504 0.000 0.496
#> GSM35498     3  0.9014    -0.2887 0.408 0.132 0.460
#> GSM35501     1  0.0237     0.6652 0.996 0.000 0.004
#> GSM35509     3  0.1529     0.4544 0.040 0.000 0.960
#> GSM35513     1  0.0747     0.6611 0.984 0.000 0.016
#> GSM35516     2  0.2116     0.8626 0.012 0.948 0.040
#> GSM35522     3  0.9725     0.0022 0.272 0.276 0.452
#> GSM35525     1  0.4750     0.6126 0.784 0.000 0.216
#> GSM35528     1  0.4062     0.6153 0.836 0.000 0.164
#> GSM35533     1  0.6180     0.5175 0.584 0.000 0.416
#> GSM35537     1  0.6267     0.4867 0.548 0.000 0.452

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>          class entropy silhouette    p1    p2    p3    p4
#> GSM35441     2  0.0000     0.9149 0.000 1.000 0.000 0.000
#> GSM35446     3  0.0188     0.8663 0.000 0.000 0.996 0.004
#> GSM35449     2  0.0000     0.9149 0.000 1.000 0.000 0.000
#> GSM35455     2  0.0000     0.9149 0.000 1.000 0.000 0.000
#> GSM35458     1  0.4070     0.7407 0.836 0.016 0.124 0.024
#> GSM35460     3  0.0188     0.8663 0.000 0.000 0.996 0.004
#> GSM35461     3  0.6888     0.1067 0.448 0.000 0.448 0.104
#> GSM35463     2  0.0000     0.9149 0.000 1.000 0.000 0.000
#> GSM35472     3  0.3051     0.8343 0.028 0.000 0.884 0.088
#> GSM35475     3  0.2816     0.8513 0.064 0.036 0.900 0.000
#> GSM35483     2  0.2976     0.8418 0.000 0.872 0.120 0.008
#> GSM35496     3  0.3966     0.8133 0.072 0.000 0.840 0.088
#> GSM35497     2  0.0000     0.9149 0.000 1.000 0.000 0.000
#> GSM35504     2  0.0336     0.9114 0.000 0.992 0.008 0.000
#> GSM35508     2  0.0000     0.9149 0.000 1.000 0.000 0.000
#> GSM35511     3  0.2385     0.8575 0.028 0.052 0.920 0.000
#> GSM35512     3  0.0921     0.8682 0.028 0.000 0.972 0.000
#> GSM35515     1  0.3958     0.7500 0.844 0.016 0.116 0.024
#> GSM35519     3  0.2456     0.8640 0.040 0.028 0.924 0.008
#> GSM35527     2  0.0000     0.9149 0.000 1.000 0.000 0.000
#> GSM35532     3  0.2023     0.8671 0.028 0.028 0.940 0.004
#> GSM35439     2  0.0000     0.9149 0.000 1.000 0.000 0.000
#> GSM35443     1  0.2773     0.7749 0.880 0.000 0.004 0.116
#> GSM35445     4  0.6733     0.2409 0.416 0.000 0.092 0.492
#> GSM35448     3  0.0469     0.8663 0.000 0.012 0.988 0.000
#> GSM35451     4  0.1302     0.7982 0.044 0.000 0.000 0.956
#> GSM35454     4  0.6684     0.3203 0.336 0.000 0.104 0.560
#> GSM35457     2  0.0000     0.9149 0.000 1.000 0.000 0.000
#> GSM35465     2  0.0921     0.9018 0.000 0.972 0.000 0.028
#> GSM35468     1  0.0779     0.8438 0.980 0.000 0.004 0.016
#> GSM35471     4  0.0188     0.8033 0.004 0.000 0.000 0.996
#> GSM35473     1  0.1211     0.8365 0.960 0.000 0.040 0.000
#> GSM35477     4  0.2345     0.7730 0.100 0.000 0.000 0.900
#> GSM35480     4  0.1211     0.7998 0.040 0.000 0.000 0.960
#> GSM35482     4  0.3128     0.7669 0.076 0.000 0.040 0.884
#> GSM35485     2  0.2647     0.8444 0.000 0.880 0.120 0.000
#> GSM35489     2  0.2345     0.8595 0.000 0.900 0.100 0.000
#> GSM35492     1  0.0188     0.8437 0.996 0.000 0.004 0.000
#> GSM35495     3  0.2408     0.8161 0.000 0.000 0.896 0.104
#> GSM35499     2  0.5168     0.1554 0.000 0.504 0.004 0.492
#> GSM35502     1  0.4697     0.3471 0.644 0.000 0.000 0.356
#> GSM35505     3  0.2593     0.8080 0.104 0.000 0.892 0.004
#> GSM35507     4  0.0000     0.8032 0.000 0.000 0.000 1.000
#> GSM35510     2  0.0000     0.9149 0.000 1.000 0.000 0.000
#> GSM35514     1  0.0921     0.8411 0.972 0.000 0.000 0.028
#> GSM35517     2  0.0000     0.9149 0.000 1.000 0.000 0.000
#> GSM35520     3  0.6413     0.6351 0.104 0.216 0.668 0.012
#> GSM35523     4  0.0000     0.8032 0.000 0.000 0.000 1.000
#> GSM35529     2  0.0000     0.9149 0.000 1.000 0.000 0.000
#> GSM35531     2  0.7717     0.4388 0.020 0.548 0.212 0.220
#> GSM35534     2  0.2647     0.8444 0.000 0.880 0.120 0.000
#> GSM35536     1  0.1022     0.8399 0.968 0.000 0.000 0.032
#> GSM35538     4  0.5000     0.0154 0.500 0.000 0.000 0.500
#> GSM35539     4  0.2469     0.7678 0.108 0.000 0.000 0.892
#> GSM35540     2  0.2530     0.8462 0.000 0.888 0.000 0.112
#> GSM35541     2  0.0000     0.9149 0.000 1.000 0.000 0.000
#> GSM35442     1  0.1151     0.8389 0.968 0.000 0.024 0.008
#> GSM35447     1  0.4746     0.3962 0.632 0.000 0.368 0.000
#> GSM35450     4  0.2868     0.7456 0.136 0.000 0.000 0.864
#> GSM35453     1  0.5535     0.5969 0.720 0.000 0.088 0.192
#> GSM35456     4  0.0000     0.8032 0.000 0.000 0.000 1.000
#> GSM35464     2  0.2868     0.8251 0.000 0.864 0.000 0.136
#> GSM35467     1  0.0817     0.8429 0.976 0.000 0.000 0.024
#> GSM35470     4  0.0000     0.8032 0.000 0.000 0.000 1.000
#> GSM35479     4  0.2011     0.7785 0.000 0.000 0.080 0.920
#> GSM35484     1  0.2060     0.8330 0.932 0.000 0.016 0.052
#> GSM35488     1  0.0188     0.8444 0.996 0.000 0.000 0.004
#> GSM35491     1  0.1305     0.8374 0.960 0.000 0.004 0.036
#> GSM35494     4  0.2466     0.7688 0.004 0.000 0.096 0.900
#> GSM35498     4  0.4907     0.2171 0.420 0.000 0.000 0.580
#> GSM35501     1  0.4999    -0.0833 0.508 0.000 0.000 0.492
#> GSM35509     4  0.5000    -0.0137 0.000 0.000 0.496 0.504
#> GSM35513     1  0.0707     0.8439 0.980 0.000 0.000 0.020
#> GSM35516     2  0.2868     0.8093 0.000 0.864 0.000 0.136
#> GSM35522     4  0.0000     0.8032 0.000 0.000 0.000 1.000
#> GSM35525     4  0.4331     0.5713 0.288 0.000 0.000 0.712
#> GSM35528     4  0.4655     0.4269 0.312 0.000 0.004 0.684
#> GSM35533     4  0.1557     0.7951 0.056 0.000 0.000 0.944
#> GSM35537     4  0.0000     0.8032 0.000 0.000 0.000 1.000

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>          class entropy silhouette    p1    p2    p3    p4    p5
#> GSM35441     2  0.0000      0.927 0.000 1.000 0.000 0.000 0.000
#> GSM35446     5  0.4161      0.231 0.000 0.000 0.392 0.000 0.608
#> GSM35449     2  0.0404      0.925 0.000 0.988 0.012 0.000 0.000
#> GSM35455     2  0.0000      0.927 0.000 1.000 0.000 0.000 0.000
#> GSM35458     1  0.4429      0.753 0.764 0.000 0.060 0.008 0.168
#> GSM35460     3  0.4249      0.130 0.000 0.000 0.568 0.000 0.432
#> GSM35461     1  0.4821      0.236 0.516 0.000 0.000 0.020 0.464
#> GSM35463     2  0.2020      0.896 0.000 0.900 0.100 0.000 0.000
#> GSM35472     5  0.1717      0.780 0.004 0.000 0.052 0.008 0.936
#> GSM35475     5  0.1831      0.777 0.004 0.000 0.076 0.000 0.920
#> GSM35483     2  0.3617      0.850 0.000 0.824 0.128 0.004 0.044
#> GSM35496     5  0.6021      0.373 0.104 0.000 0.268 0.020 0.608
#> GSM35497     2  0.0000      0.927 0.000 1.000 0.000 0.000 0.000
#> GSM35504     2  0.0963      0.919 0.000 0.964 0.036 0.000 0.000
#> GSM35508     2  0.0000      0.927 0.000 1.000 0.000 0.000 0.000
#> GSM35511     5  0.0794      0.812 0.000 0.000 0.028 0.000 0.972
#> GSM35512     5  0.0162      0.803 0.004 0.000 0.000 0.000 0.996
#> GSM35515     1  0.4248      0.765 0.780 0.000 0.056 0.008 0.156
#> GSM35519     5  0.0794      0.812 0.000 0.000 0.028 0.000 0.972
#> GSM35527     2  0.0000      0.927 0.000 1.000 0.000 0.000 0.000
#> GSM35532     5  0.0794      0.812 0.000 0.000 0.028 0.000 0.972
#> GSM35439     2  0.1608      0.908 0.000 0.928 0.072 0.000 0.000
#> GSM35443     1  0.3134      0.808 0.848 0.000 0.000 0.032 0.120
#> GSM35445     3  0.5747      0.567 0.212 0.000 0.620 0.168 0.000
#> GSM35448     3  0.3210      0.502 0.000 0.000 0.788 0.000 0.212
#> GSM35451     4  0.1410      0.834 0.060 0.000 0.000 0.940 0.000
#> GSM35454     3  0.3639      0.625 0.024 0.000 0.792 0.184 0.000
#> GSM35457     2  0.0000      0.927 0.000 1.000 0.000 0.000 0.000
#> GSM35465     2  0.0703      0.917 0.000 0.976 0.000 0.024 0.000
#> GSM35468     1  0.2873      0.813 0.860 0.000 0.000 0.020 0.120
#> GSM35471     4  0.0992      0.836 0.008 0.000 0.024 0.968 0.000
#> GSM35473     1  0.1121      0.798 0.956 0.000 0.044 0.000 0.000
#> GSM35477     4  0.1908      0.825 0.092 0.000 0.000 0.908 0.000
#> GSM35480     4  0.1907      0.838 0.028 0.000 0.044 0.928 0.000
#> GSM35482     4  0.5557      0.328 0.020 0.000 0.368 0.572 0.040
#> GSM35485     2  0.3460      0.852 0.000 0.828 0.128 0.000 0.044
#> GSM35489     2  0.3322      0.868 0.000 0.848 0.104 0.004 0.044
#> GSM35492     1  0.2280      0.817 0.880 0.000 0.000 0.000 0.120
#> GSM35495     3  0.4276      0.510 0.000 0.000 0.716 0.028 0.256
#> GSM35499     2  0.4960      0.624 0.000 0.688 0.080 0.232 0.000
#> GSM35502     1  0.4114      0.206 0.624 0.000 0.000 0.376 0.000
#> GSM35505     3  0.4808      0.544 0.108 0.000 0.724 0.000 0.168
#> GSM35507     4  0.1544      0.826 0.000 0.000 0.068 0.932 0.000
#> GSM35510     2  0.0000      0.927 0.000 1.000 0.000 0.000 0.000
#> GSM35514     1  0.0162      0.813 0.996 0.000 0.000 0.004 0.000
#> GSM35517     2  0.0000      0.927 0.000 1.000 0.000 0.000 0.000
#> GSM35520     5  0.5431      0.609 0.036 0.092 0.144 0.004 0.724
#> GSM35523     4  0.2127      0.814 0.000 0.000 0.108 0.892 0.000
#> GSM35529     2  0.0000      0.927 0.000 1.000 0.000 0.000 0.000
#> GSM35531     3  0.7567      0.153 0.020 0.336 0.464 0.128 0.052
#> GSM35534     2  0.3460      0.852 0.000 0.828 0.128 0.000 0.044
#> GSM35536     1  0.0290      0.812 0.992 0.000 0.000 0.008 0.000
#> GSM35538     4  0.3424      0.697 0.240 0.000 0.000 0.760 0.000
#> GSM35539     4  0.1908      0.825 0.092 0.000 0.000 0.908 0.000
#> GSM35540     2  0.2628      0.857 0.000 0.884 0.028 0.088 0.000
#> GSM35541     2  0.0000      0.927 0.000 1.000 0.000 0.000 0.000
#> GSM35442     1  0.2583      0.812 0.864 0.000 0.000 0.004 0.132
#> GSM35447     3  0.4944      0.555 0.208 0.000 0.700 0.000 0.092
#> GSM35450     4  0.2127      0.817 0.108 0.000 0.000 0.892 0.000
#> GSM35453     3  0.4620      0.415 0.392 0.000 0.592 0.016 0.000
#> GSM35456     4  0.1544      0.826 0.000 0.000 0.068 0.932 0.000
#> GSM35464     2  0.3130      0.832 0.000 0.856 0.048 0.096 0.000
#> GSM35467     1  0.0162      0.813 0.996 0.000 0.000 0.004 0.000
#> GSM35470     4  0.2286      0.814 0.000 0.000 0.108 0.888 0.004
#> GSM35479     3  0.4074      0.331 0.000 0.000 0.636 0.364 0.000
#> GSM35484     1  0.2507      0.787 0.900 0.000 0.016 0.072 0.012
#> GSM35488     1  0.1041      0.820 0.964 0.000 0.000 0.004 0.032
#> GSM35491     1  0.2439      0.817 0.876 0.000 0.000 0.004 0.120
#> GSM35494     3  0.2929      0.606 0.000 0.000 0.820 0.180 0.000
#> GSM35498     1  0.5513      0.223 0.524 0.000 0.068 0.408 0.000
#> GSM35501     4  0.4101      0.497 0.372 0.000 0.000 0.628 0.000
#> GSM35509     3  0.3639      0.612 0.000 0.000 0.812 0.144 0.044
#> GSM35513     1  0.0162      0.813 0.996 0.000 0.000 0.004 0.000
#> GSM35516     2  0.3375      0.842 0.000 0.840 0.056 0.104 0.000
#> GSM35522     4  0.2127      0.814 0.000 0.000 0.108 0.892 0.000
#> GSM35525     4  0.2813      0.773 0.168 0.000 0.000 0.832 0.000
#> GSM35528     4  0.3960      0.766 0.100 0.000 0.032 0.824 0.044
#> GSM35533     4  0.1478      0.834 0.064 0.000 0.000 0.936 0.000
#> GSM35537     4  0.2127      0.814 0.000 0.000 0.108 0.892 0.000

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>          class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM35441     2  0.0000    0.83015 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM35446     5  0.3717    0.22346 0.000 0.000 0.384 0.000 0.616 0.000
#> GSM35449     2  0.1663    0.80918 0.000 0.912 0.000 0.000 0.000 0.088
#> GSM35455     2  0.0000    0.83015 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM35458     1  0.5383    0.61399 0.684 0.000 0.076 0.000 0.120 0.120
#> GSM35460     3  0.3515    0.39968 0.000 0.000 0.676 0.000 0.324 0.000
#> GSM35461     1  0.3371    0.47924 0.708 0.000 0.000 0.000 0.292 0.000
#> GSM35463     2  0.3885    0.69761 0.000 0.684 0.012 0.000 0.004 0.300
#> GSM35472     5  0.3272    0.70410 0.080 0.000 0.076 0.008 0.836 0.000
#> GSM35475     5  0.5413    0.64277 0.100 0.000 0.064 0.000 0.672 0.164
#> GSM35483     2  0.5454    0.60047 0.000 0.576 0.012 0.000 0.112 0.300
#> GSM35496     5  0.7321    0.32240 0.172 0.000 0.176 0.232 0.420 0.000
#> GSM35497     2  0.0000    0.83015 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM35504     2  0.1296    0.82042 0.000 0.952 0.012 0.000 0.004 0.032
#> GSM35508     2  0.0000    0.83015 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM35511     5  0.0146    0.74698 0.004 0.000 0.000 0.000 0.996 0.000
#> GSM35512     5  0.2527    0.73671 0.084 0.000 0.000 0.000 0.876 0.040
#> GSM35515     1  0.5223    0.62532 0.700 0.000 0.076 0.000 0.108 0.116
#> GSM35519     5  0.1196    0.74276 0.008 0.000 0.000 0.000 0.952 0.040
#> GSM35527     2  0.0146    0.83009 0.000 0.996 0.000 0.000 0.000 0.004
#> GSM35532     5  0.0260    0.74545 0.000 0.000 0.000 0.000 0.992 0.008
#> GSM35439     2  0.3672    0.71518 0.000 0.712 0.008 0.000 0.004 0.276
#> GSM35443     1  0.0806    0.81148 0.972 0.000 0.000 0.008 0.020 0.000
#> GSM35445     3  0.4853    0.68115 0.120 0.000 0.728 0.052 0.000 0.100
#> GSM35448     3  0.4074    0.63569 0.000 0.000 0.752 0.000 0.140 0.108
#> GSM35451     4  0.4384   -0.23566 0.016 0.000 0.004 0.520 0.000 0.460
#> GSM35454     3  0.3748    0.74226 0.028 0.000 0.812 0.092 0.000 0.068
#> GSM35457     2  0.0000    0.83015 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM35465     2  0.0260    0.82746 0.000 0.992 0.000 0.008 0.000 0.000
#> GSM35468     1  0.0547    0.81455 0.980 0.000 0.000 0.000 0.020 0.000
#> GSM35471     4  0.3774    0.00162 0.000 0.000 0.000 0.592 0.000 0.408
#> GSM35473     1  0.2624    0.81208 0.856 0.000 0.020 0.000 0.000 0.124
#> GSM35477     4  0.4529   -0.26729 0.024 0.000 0.004 0.512 0.000 0.460
#> GSM35480     4  0.3758    0.13555 0.008 0.000 0.000 0.668 0.000 0.324
#> GSM35482     4  0.4478    0.24417 0.076 0.000 0.192 0.720 0.012 0.000
#> GSM35485     2  0.5454    0.60047 0.000 0.576 0.012 0.000 0.112 0.300
#> GSM35489     2  0.5654    0.63458 0.000 0.604 0.004 0.036 0.088 0.268
#> GSM35492     1  0.0547    0.81455 0.980 0.000 0.000 0.000 0.020 0.000
#> GSM35495     3  0.1765    0.71197 0.000 0.000 0.904 0.000 0.096 0.000
#> GSM35499     2  0.4981    0.51617 0.000 0.584 0.004 0.340 0.000 0.072
#> GSM35502     1  0.5878    0.25628 0.504 0.000 0.008 0.176 0.000 0.312
#> GSM35505     3  0.4090    0.72542 0.068 0.000 0.792 0.000 0.048 0.092
#> GSM35507     4  0.2996    0.35271 0.000 0.000 0.000 0.772 0.000 0.228
#> GSM35510     2  0.0000    0.83015 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM35514     1  0.2402    0.81452 0.856 0.000 0.004 0.000 0.000 0.140
#> GSM35517     2  0.0458    0.82950 0.000 0.984 0.000 0.000 0.000 0.016
#> GSM35520     5  0.5022    0.52645 0.012 0.008 0.044 0.000 0.604 0.332
#> GSM35523     4  0.0000    0.44763 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM35529     2  0.0000    0.83015 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM35531     6  0.6219   -0.01461 0.028 0.080 0.144 0.000 0.112 0.636
#> GSM35534     2  0.5454    0.60047 0.000 0.576 0.012 0.000 0.112 0.300
#> GSM35536     1  0.2872    0.80631 0.832 0.000 0.004 0.012 0.000 0.152
#> GSM35538     6  0.5287    0.33114 0.076 0.000 0.008 0.424 0.000 0.492
#> GSM35539     4  0.4468   -0.36768 0.020 0.000 0.004 0.488 0.000 0.488
#> GSM35540     2  0.2631    0.74275 0.000 0.840 0.000 0.152 0.000 0.008
#> GSM35541     2  0.0547    0.82939 0.000 0.980 0.000 0.000 0.000 0.020
#> GSM35442     1  0.0713    0.81061 0.972 0.000 0.000 0.000 0.028 0.000
#> GSM35447     3  0.3674    0.71092 0.160 0.000 0.792 0.004 0.036 0.008
#> GSM35450     6  0.4467    0.19807 0.020 0.000 0.004 0.480 0.000 0.496
#> GSM35453     3  0.4499    0.63038 0.216 0.000 0.704 0.008 0.000 0.072
#> GSM35456     4  0.3217    0.35256 0.008 0.000 0.000 0.768 0.000 0.224
#> GSM35464     2  0.3606    0.63890 0.000 0.728 0.000 0.256 0.000 0.016
#> GSM35467     1  0.2402    0.81452 0.856 0.000 0.004 0.000 0.000 0.140
#> GSM35470     4  0.0000    0.44763 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM35479     3  0.3860    0.34883 0.000 0.000 0.528 0.472 0.000 0.000
#> GSM35484     1  0.4304    0.67227 0.704 0.000 0.020 0.028 0.000 0.248
#> GSM35488     1  0.1806    0.82193 0.908 0.000 0.000 0.000 0.004 0.088
#> GSM35491     1  0.0547    0.81455 0.980 0.000 0.000 0.000 0.020 0.000
#> GSM35494     3  0.1863    0.73814 0.000 0.000 0.896 0.104 0.000 0.000
#> GSM35498     4  0.3999   -0.18072 0.496 0.000 0.000 0.500 0.000 0.004
#> GSM35501     6  0.5341    0.31437 0.108 0.000 0.008 0.304 0.000 0.580
#> GSM35509     3  0.1814    0.73863 0.000 0.000 0.900 0.100 0.000 0.000
#> GSM35513     1  0.2402    0.81452 0.856 0.000 0.004 0.000 0.000 0.140
#> GSM35516     2  0.4589    0.41993 0.000 0.504 0.000 0.036 0.000 0.460
#> GSM35522     4  0.0000    0.44763 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM35525     6  0.4877    0.28026 0.040 0.000 0.008 0.464 0.000 0.488
#> GSM35528     4  0.4865    0.20416 0.096 0.000 0.000 0.652 0.004 0.248
#> GSM35533     4  0.4461   -0.25980 0.020 0.000 0.004 0.512 0.000 0.464
#> GSM35537     4  0.0000    0.44763 0.000 0.000 0.000 1.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)

plot of chunk tab-SD-pam-consensus-heatmap-1

consensus_heatmap(res, k = 3)

plot of chunk tab-SD-pam-consensus-heatmap-2

consensus_heatmap(res, k = 4)

plot of chunk tab-SD-pam-consensus-heatmap-3

consensus_heatmap(res, k = 5)

plot of chunk tab-SD-pam-consensus-heatmap-4

consensus_heatmap(res, k = 6)

plot of chunk tab-SD-pam-consensus-heatmap-5

Heatmaps for the membership of samples in all partitions to see how consistent they are:

membership_heatmap(res, k = 2)

plot of chunk tab-SD-pam-membership-heatmap-1

membership_heatmap(res, k = 3)

plot of chunk tab-SD-pam-membership-heatmap-2

membership_heatmap(res, k = 4)

plot of chunk tab-SD-pam-membership-heatmap-3

membership_heatmap(res, k = 5)

plot of chunk tab-SD-pam-membership-heatmap-4

membership_heatmap(res, k = 6)

plot of chunk tab-SD-pam-membership-heatmap-5

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)

plot of chunk tab-SD-pam-get-signatures-1

get_signatures(res, k = 3)

plot of chunk tab-SD-pam-get-signatures-2

get_signatures(res, k = 4)

plot of chunk tab-SD-pam-get-signatures-3

get_signatures(res, k = 5)

plot of chunk tab-SD-pam-get-signatures-4

get_signatures(res, k = 6)

plot of chunk tab-SD-pam-get-signatures-5

Signature heatmaps where rows are not scaled:

get_signatures(res, k = 2, scale_rows = FALSE)

plot of chunk tab-SD-pam-get-signatures-no-scale-1

get_signatures(res, k = 3, scale_rows = FALSE)

plot of chunk tab-SD-pam-get-signatures-no-scale-2

get_signatures(res, k = 4, scale_rows = FALSE)

plot of chunk tab-SD-pam-get-signatures-no-scale-3

get_signatures(res, k = 5, scale_rows = FALSE)

plot of chunk tab-SD-pam-get-signatures-no-scale-4

get_signatures(res, k = 6, scale_rows = FALSE)

plot of chunk tab-SD-pam-get-signatures-no-scale-5

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk SD-pam-signature_compare

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:

  1. which_row: row indices corresponding to the input matrix.
  2. fdr: FDR for the differential test.
  3. mean_x: The mean value in group x.
  4. scaled_mean_x: The mean value in group x after rows are scaled.
  5. 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")

plot of chunk tab-SD-pam-dimension-reduction-1

dimension_reduction(res, k = 3, method = "UMAP")

plot of chunk tab-SD-pam-dimension-reduction-2

dimension_reduction(res, k = 4, method = "UMAP")

plot of chunk tab-SD-pam-dimension-reduction-3

dimension_reduction(res, k = 5, method = "UMAP")

plot of chunk tab-SD-pam-dimension-reduction-4

dimension_reduction(res, k = 6, method = "UMAP")

plot of chunk tab-SD-pam-dimension-reduction-5

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk SD-pam-collect-classes

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  time(p) k
#> SD:pam 65 7.62e-05 2
#> SD:pam 51 5.28e-05 3
#> SD:pam 67 1.18e-04 4
#> SD:pam 68 1.96e-04 5
#> SD:pam 52 8.95e-04 6

If matrix rows can be associated to genes, consider to use functional_enrichment(res, ...) to perform function enrichment for the signature genes. See this vignette for more detailed explanations.


SD:mclust

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 7758 rows and 79 columns.
#>   Top rows (776, 1552, 2328, 3103, 3879) 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 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)

plot of chunk SD-mclust-collect-plots

The plots are:

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:

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)

plot of chunk SD-mclust-select-partition-number

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.293           0.718       0.821         0.3619 0.705   0.705
#> 3 3 0.526           0.764       0.877         0.7037 0.603   0.461
#> 4 4 0.729           0.804       0.845         0.1788 0.769   0.461
#> 5 5 0.810           0.843       0.885         0.0735 0.872   0.572
#> 6 6 0.736           0.697       0.833         0.0425 0.952   0.784

suggest_best_k() suggests the best \(k\) based on these statistics. The rules are as follows:

suggest_best_k(res)
#> [1] 5

Following shows the table of the partitions (You need to click the show/hide code output link to see it). The membership matrix (columns with name p*) is inferred by clue::cl_consensus() function with the SE method. Basically the value in the membership matrix represents the probability to belong to a certain group. The finall class label for an item is determined with the group with highest probability it belongs to.

In get_classes() function, the entropy is calculated from the membership matrix and the silhouette score is calculated from the consensus matrix.

show/hide code output

cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#>          class entropy silhouette    p1    p2
#> GSM35441     2   0.644     0.7285 0.164 0.836
#> GSM35446     2   0.000     0.7849 0.000 1.000
#> GSM35449     2   0.644     0.7285 0.164 0.836
#> GSM35455     2   0.644     0.7285 0.164 0.836
#> GSM35458     2   0.000     0.7849 0.000 1.000
#> GSM35460     2   0.000     0.7849 0.000 1.000
#> GSM35461     2   0.595     0.7442 0.144 0.856
#> GSM35463     2   0.644     0.7285 0.164 0.836
#> GSM35472     2   0.311     0.7757 0.056 0.944
#> GSM35475     2   0.000     0.7849 0.000 1.000
#> GSM35483     2   0.644     0.7285 0.164 0.836
#> GSM35496     2   0.595     0.7442 0.144 0.856
#> GSM35497     2   0.644     0.7285 0.164 0.836
#> GSM35504     2   0.000     0.7849 0.000 1.000
#> GSM35508     2   0.634     0.7306 0.160 0.840
#> GSM35511     2   0.000     0.7849 0.000 1.000
#> GSM35512     2   0.224     0.7804 0.036 0.964
#> GSM35515     2   0.000     0.7849 0.000 1.000
#> GSM35519     2   0.000     0.7849 0.000 1.000
#> GSM35527     2   0.644     0.7285 0.164 0.836
#> GSM35532     2   0.000     0.7849 0.000 1.000
#> GSM35439     2   0.595     0.7378 0.144 0.856
#> GSM35443     1   0.904     0.7873 0.680 0.320
#> GSM35445     2   0.929     0.4138 0.344 0.656
#> GSM35448     2   0.000     0.7849 0.000 1.000
#> GSM35451     2   0.808     0.6202 0.248 0.752
#> GSM35454     2   0.595     0.7442 0.144 0.856
#> GSM35457     2   0.644     0.7285 0.164 0.836
#> GSM35465     2   0.644     0.7285 0.164 0.836
#> GSM35468     1   0.738     0.9360 0.792 0.208
#> GSM35471     2   0.595     0.7442 0.144 0.856
#> GSM35473     1   0.788     0.9119 0.764 0.236
#> GSM35477     2   0.855     0.5632 0.280 0.720
#> GSM35480     2   0.866     0.5472 0.288 0.712
#> GSM35482     2   0.595     0.7442 0.144 0.856
#> GSM35485     2   0.644     0.7285 0.164 0.836
#> GSM35489     2   0.644     0.7285 0.164 0.836
#> GSM35492     1   0.745     0.9337 0.788 0.212
#> GSM35495     2   0.574     0.7480 0.136 0.864
#> GSM35499     2   0.295     0.7721 0.052 0.948
#> GSM35502     1   0.644     0.9309 0.836 0.164
#> GSM35505     2   0.595     0.7442 0.144 0.856
#> GSM35507     2   0.595     0.7442 0.144 0.856
#> GSM35510     2   0.634     0.7306 0.160 0.840
#> GSM35514     1   0.644     0.9309 0.836 0.164
#> GSM35517     2   0.644     0.7285 0.164 0.836
#> GSM35520     2   0.000     0.7849 0.000 1.000
#> GSM35523     2   0.738     0.6778 0.208 0.792
#> GSM35529     2   0.644     0.7285 0.164 0.836
#> GSM35531     2   0.000     0.7849 0.000 1.000
#> GSM35534     2   0.644     0.7285 0.164 0.836
#> GSM35536     1   0.644     0.9309 0.836 0.164
#> GSM35538     2   1.000    -0.1447 0.496 0.504
#> GSM35539     2   0.992     0.0859 0.448 0.552
#> GSM35540     2   0.204     0.7779 0.032 0.968
#> GSM35541     2   0.644     0.7285 0.164 0.836
#> GSM35442     2   0.595     0.7442 0.144 0.856
#> GSM35447     2   0.584     0.7462 0.140 0.860
#> GSM35450     2   0.994     0.0466 0.456 0.544
#> GSM35453     2   0.745     0.6721 0.212 0.788
#> GSM35456     2   0.595     0.7442 0.144 0.856
#> GSM35464     2   0.184     0.7820 0.028 0.972
#> GSM35467     1   0.644     0.9309 0.836 0.164
#> GSM35470     2   0.775     0.6503 0.228 0.772
#> GSM35479     2   0.595     0.7442 0.144 0.856
#> GSM35484     1   0.767     0.9245 0.776 0.224
#> GSM35488     1   0.738     0.9360 0.792 0.208
#> GSM35491     1   0.738     0.9360 0.792 0.208
#> GSM35494     2   0.595     0.7442 0.144 0.856
#> GSM35498     2   0.605     0.7409 0.148 0.852
#> GSM35501     1   0.644     0.9309 0.836 0.164
#> GSM35509     2   0.595     0.7442 0.144 0.856
#> GSM35513     1   0.644     0.9309 0.836 0.164
#> GSM35516     2   0.563     0.7427 0.132 0.868
#> GSM35522     2   0.625     0.7340 0.156 0.844
#> GSM35525     2   0.997    -0.0103 0.468 0.532
#> GSM35528     2   0.981     0.1594 0.420 0.580
#> GSM35533     1   0.891     0.7963 0.692 0.308
#> GSM35537     2   0.821     0.6067 0.256 0.744

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>          class entropy silhouette    p1    p2    p3
#> GSM35441     2  0.0000     0.9175 0.000 1.000 0.000
#> GSM35446     3  0.0237     0.8217 0.000 0.004 0.996
#> GSM35449     2  0.0000     0.9175 0.000 1.000 0.000
#> GSM35455     2  0.0000     0.9175 0.000 1.000 0.000
#> GSM35458     3  0.3879     0.7935 0.000 0.152 0.848
#> GSM35460     3  0.0237     0.8217 0.000 0.004 0.996
#> GSM35461     3  0.3359     0.8031 0.084 0.016 0.900
#> GSM35463     2  0.0747     0.9193 0.000 0.984 0.016
#> GSM35472     3  0.0892     0.8192 0.000 0.020 0.980
#> GSM35475     3  0.3879     0.7935 0.000 0.152 0.848
#> GSM35483     2  0.1289     0.9138 0.000 0.968 0.032
#> GSM35496     3  0.0747     0.8191 0.000 0.016 0.984
#> GSM35497     2  0.0000     0.9175 0.000 1.000 0.000
#> GSM35504     3  0.3619     0.7942 0.000 0.136 0.864
#> GSM35508     3  0.6286     0.2726 0.000 0.464 0.536
#> GSM35511     3  0.3116     0.8089 0.000 0.108 0.892
#> GSM35512     3  0.0747     0.8191 0.000 0.016 0.984
#> GSM35515     3  0.3879     0.7935 0.000 0.152 0.848
#> GSM35519     3  0.1411     0.8205 0.000 0.036 0.964
#> GSM35527     2  0.6008     0.2906 0.000 0.628 0.372
#> GSM35532     3  0.0892     0.8192 0.000 0.020 0.980
#> GSM35439     2  0.1337     0.9168 0.012 0.972 0.016
#> GSM35443     1  0.5167     0.7579 0.792 0.016 0.192
#> GSM35445     1  0.6192     0.2834 0.580 0.000 0.420
#> GSM35448     3  0.0237     0.8217 0.000 0.004 0.996
#> GSM35451     3  0.5733     0.5998 0.324 0.000 0.676
#> GSM35454     3  0.0592     0.8218 0.012 0.000 0.988
#> GSM35457     2  0.0829     0.9205 0.012 0.984 0.004
#> GSM35465     2  0.3618     0.8293 0.012 0.884 0.104
#> GSM35468     1  0.0747     0.8546 0.984 0.016 0.000
#> GSM35471     3  0.5431     0.6477 0.284 0.000 0.716
#> GSM35473     1  0.2625     0.8481 0.916 0.000 0.084
#> GSM35477     1  0.5926     0.4525 0.644 0.000 0.356
#> GSM35480     3  0.6291     0.1492 0.468 0.000 0.532
#> GSM35482     3  0.0592     0.8210 0.012 0.000 0.988
#> GSM35485     2  0.0747     0.9193 0.000 0.984 0.016
#> GSM35489     2  0.0829     0.9205 0.012 0.984 0.004
#> GSM35492     1  0.1337     0.8563 0.972 0.016 0.012
#> GSM35495     3  0.0000     0.8216 0.000 0.000 1.000
#> GSM35499     3  0.5678     0.6135 0.000 0.316 0.684
#> GSM35502     1  0.0000     0.8579 1.000 0.000 0.000
#> GSM35505     3  0.0000     0.8216 0.000 0.000 1.000
#> GSM35507     3  0.5953     0.6587 0.280 0.012 0.708
#> GSM35510     2  0.6252     0.0348 0.000 0.556 0.444
#> GSM35514     1  0.0000     0.8579 1.000 0.000 0.000
#> GSM35517     2  0.0829     0.9205 0.012 0.984 0.004
#> GSM35520     3  0.4805     0.7669 0.012 0.176 0.812
#> GSM35523     3  0.5591     0.6310 0.304 0.000 0.696
#> GSM35529     2  0.0829     0.9205 0.012 0.984 0.004
#> GSM35531     3  0.5406     0.7278 0.012 0.224 0.764
#> GSM35534     2  0.0747     0.9193 0.000 0.984 0.016
#> GSM35536     1  0.0000     0.8579 1.000 0.000 0.000
#> GSM35538     1  0.4121     0.7914 0.832 0.000 0.168
#> GSM35539     1  0.5216     0.6703 0.740 0.000 0.260
#> GSM35540     3  0.5812     0.6804 0.012 0.264 0.724
#> GSM35541     2  0.0829     0.9205 0.012 0.984 0.004
#> GSM35442     3  0.4277     0.7810 0.132 0.016 0.852
#> GSM35447     3  0.0000     0.8216 0.000 0.000 1.000
#> GSM35450     1  0.4555     0.7611 0.800 0.000 0.200
#> GSM35453     3  0.4121     0.7580 0.168 0.000 0.832
#> GSM35456     3  0.5327     0.6627 0.272 0.000 0.728
#> GSM35464     3  0.7084     0.5635 0.036 0.336 0.628
#> GSM35467     1  0.0000     0.8579 1.000 0.000 0.000
#> GSM35470     3  0.5178     0.6884 0.256 0.000 0.744
#> GSM35479     3  0.0000     0.8216 0.000 0.000 1.000
#> GSM35484     1  0.1860     0.8562 0.948 0.000 0.052
#> GSM35488     1  0.0747     0.8546 0.984 0.016 0.000
#> GSM35491     1  0.0237     0.8579 0.996 0.004 0.000
#> GSM35494     3  0.0000     0.8216 0.000 0.000 1.000
#> GSM35498     3  0.5621     0.6247 0.308 0.000 0.692
#> GSM35501     1  0.0000     0.8579 1.000 0.000 0.000
#> GSM35509     3  0.0000     0.8216 0.000 0.000 1.000
#> GSM35513     1  0.0000     0.8579 1.000 0.000 0.000
#> GSM35516     2  0.1399     0.9138 0.004 0.968 0.028
#> GSM35522     3  0.5431     0.6592 0.284 0.000 0.716
#> GSM35525     1  0.4452     0.7690 0.808 0.000 0.192
#> GSM35528     1  0.5219     0.7613 0.788 0.016 0.196
#> GSM35533     1  0.3267     0.8355 0.884 0.000 0.116
#> GSM35537     3  0.5621     0.6247 0.308 0.000 0.692

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>          class entropy silhouette    p1    p2    p3    p4
#> GSM35441     2  0.0817      0.927 0.024 0.976 0.000 0.000
#> GSM35446     3  0.0000      0.831 0.000 0.000 1.000 0.000
#> GSM35449     2  0.0817      0.927 0.024 0.976 0.000 0.000
#> GSM35455     2  0.0817      0.927 0.024 0.976 0.000 0.000
#> GSM35458     3  0.5152      0.800 0.316 0.020 0.664 0.000
#> GSM35460     3  0.0000      0.831 0.000 0.000 1.000 0.000
#> GSM35461     3  0.4836      0.802 0.320 0.000 0.672 0.008
#> GSM35463     2  0.0336      0.933 0.000 0.992 0.008 0.000
#> GSM35472     3  0.3837      0.822 0.224 0.000 0.776 0.000
#> GSM35475     3  0.4564      0.804 0.328 0.000 0.672 0.000
#> GSM35483     2  0.0188      0.933 0.000 0.996 0.004 0.000
#> GSM35496     3  0.2973      0.829 0.144 0.000 0.856 0.000
#> GSM35497     2  0.0817      0.927 0.024 0.976 0.000 0.000
#> GSM35504     3  0.4994      0.114 0.000 0.480 0.520 0.000
#> GSM35508     2  0.5530      0.405 0.032 0.632 0.336 0.000
#> GSM35511     3  0.4564      0.804 0.328 0.000 0.672 0.000
#> GSM35512     3  0.4522      0.806 0.320 0.000 0.680 0.000
#> GSM35515     3  0.4957      0.802 0.320 0.012 0.668 0.000
#> GSM35519     3  0.4564      0.804 0.328 0.000 0.672 0.000
#> GSM35527     2  0.3441      0.816 0.024 0.856 0.120 0.000
#> GSM35532     3  0.4564      0.804 0.328 0.000 0.672 0.000
#> GSM35439     2  0.0336      0.933 0.000 0.992 0.000 0.008
#> GSM35443     1  0.6819      0.757 0.564 0.000 0.124 0.312
#> GSM35445     4  0.4372      0.675 0.056 0.012 0.104 0.828
#> GSM35448     3  0.0000      0.831 0.000 0.000 1.000 0.000
#> GSM35451     4  0.0188      0.873 0.000 0.004 0.000 0.996
#> GSM35454     3  0.0000      0.831 0.000 0.000 1.000 0.000
#> GSM35457     2  0.0336      0.933 0.000 0.992 0.000 0.008
#> GSM35465     2  0.0336      0.933 0.000 0.992 0.000 0.008
#> GSM35468     1  0.4477      0.936 0.688 0.000 0.000 0.312
#> GSM35471     4  0.0657      0.868 0.000 0.012 0.004 0.984
#> GSM35473     1  0.7200      0.701 0.500 0.008 0.112 0.380
#> GSM35477     4  0.0188      0.873 0.000 0.004 0.000 0.996
#> GSM35480     4  0.0657      0.868 0.000 0.012 0.004 0.984
#> GSM35482     3  0.1824      0.809 0.000 0.004 0.936 0.060
#> GSM35485     2  0.0188      0.933 0.000 0.996 0.004 0.000
#> GSM35489     2  0.0336      0.933 0.000 0.992 0.000 0.008
#> GSM35492     1  0.4477      0.936 0.688 0.000 0.000 0.312
#> GSM35495     3  0.0000      0.831 0.000 0.000 1.000 0.000
#> GSM35499     2  0.0469      0.930 0.000 0.988 0.012 0.000
#> GSM35502     1  0.4564      0.943 0.672 0.000 0.000 0.328
#> GSM35505     3  0.0336      0.830 0.000 0.008 0.992 0.000
#> GSM35507     4  0.0707      0.856 0.000 0.020 0.000 0.980
#> GSM35510     2  0.0188      0.933 0.000 0.996 0.004 0.000
#> GSM35514     1  0.4564      0.943 0.672 0.000 0.000 0.328
#> GSM35517     2  0.0188      0.933 0.000 0.996 0.000 0.004
#> GSM35520     3  0.6418      0.719 0.140 0.180 0.672 0.008
#> GSM35523     4  0.0376      0.873 0.000 0.004 0.004 0.992
#> GSM35529     2  0.0336      0.933 0.000 0.992 0.000 0.008
#> GSM35531     2  0.3577      0.776 0.000 0.832 0.156 0.012
#> GSM35534     2  0.0188      0.933 0.000 0.996 0.004 0.000
#> GSM35536     1  0.4564      0.943 0.672 0.000 0.000 0.328
#> GSM35538     4  0.0592      0.861 0.016 0.000 0.000 0.984
#> GSM35539     4  0.0188      0.873 0.000 0.004 0.000 0.996
#> GSM35540     2  0.5099      0.322 0.000 0.612 0.380 0.008
#> GSM35541     2  0.0188      0.933 0.000 0.996 0.000 0.004
#> GSM35442     3  0.5026      0.502 0.016 0.000 0.672 0.312
#> GSM35447     3  0.0672      0.829 0.000 0.008 0.984 0.008
#> GSM35450     4  0.0188      0.873 0.000 0.004 0.000 0.996
#> GSM35453     3  0.4792      0.500 0.000 0.008 0.680 0.312
#> GSM35456     4  0.0657      0.868 0.000 0.012 0.004 0.984
#> GSM35464     2  0.2647      0.844 0.000 0.880 0.000 0.120
#> GSM35467     1  0.4564      0.943 0.672 0.000 0.000 0.328
#> GSM35470     4  0.4905      0.256 0.000 0.004 0.364 0.632
#> GSM35479     3  0.0188      0.830 0.000 0.004 0.996 0.000
#> GSM35484     4  0.5459     -0.573 0.476 0.008 0.004 0.512
#> GSM35488     1  0.4477      0.936 0.688 0.000 0.000 0.312
#> GSM35491     1  0.4522      0.941 0.680 0.000 0.000 0.320
#> GSM35494     3  0.0188      0.830 0.000 0.004 0.996 0.000
#> GSM35498     4  0.0188      0.873 0.000 0.004 0.000 0.996
#> GSM35501     1  0.4564      0.943 0.672 0.000 0.000 0.328
#> GSM35509     3  0.0000      0.831 0.000 0.000 1.000 0.000
#> GSM35513     1  0.4564      0.943 0.672 0.000 0.000 0.328
#> GSM35516     2  0.0188      0.933 0.000 0.996 0.004 0.000
#> GSM35522     4  0.0376      0.873 0.000 0.004 0.004 0.992
#> GSM35525     4  0.0188      0.869 0.004 0.000 0.000 0.996
#> GSM35528     4  0.0921      0.855 0.028 0.000 0.000 0.972
#> GSM35533     4  0.4755      0.333 0.260 0.012 0.004 0.724
#> GSM35537     4  0.0376      0.873 0.000 0.004 0.004 0.992

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>          class entropy silhouette    p1    p2    p3    p4    p5
#> GSM35441     2  0.3027     0.8821 0.000 0.876 0.012 0.072 0.040
#> GSM35446     3  0.4142     0.7343 0.000 0.012 0.752 0.016 0.220
#> GSM35449     2  0.3103     0.8817 0.000 0.872 0.012 0.072 0.044
#> GSM35455     2  0.3027     0.8821 0.000 0.876 0.012 0.072 0.040
#> GSM35458     5  0.2054     0.8786 0.000 0.004 0.008 0.072 0.916
#> GSM35460     3  0.2378     0.8168 0.000 0.012 0.908 0.016 0.064
#> GSM35461     5  0.3906     0.7316 0.068 0.000 0.132 0.000 0.800
#> GSM35463     2  0.0000     0.9458 0.000 1.000 0.000 0.000 0.000
#> GSM35472     3  0.4803     0.3909 0.020 0.000 0.536 0.000 0.444
#> GSM35475     5  0.1894     0.8789 0.000 0.000 0.008 0.072 0.920
#> GSM35483     2  0.0000     0.9458 0.000 1.000 0.000 0.000 0.000
#> GSM35496     3  0.3365     0.7727 0.044 0.000 0.836 0.000 0.120
#> GSM35497     2  0.3027     0.8821 0.000 0.876 0.012 0.072 0.040
#> GSM35504     2  0.0798     0.9386 0.000 0.976 0.000 0.008 0.016
#> GSM35508     2  0.3709     0.8532 0.000 0.840 0.020 0.072 0.068
#> GSM35511     5  0.1942     0.8798 0.000 0.000 0.012 0.068 0.920
#> GSM35512     5  0.3659     0.6039 0.012 0.000 0.220 0.000 0.768
#> GSM35515     5  0.2054     0.8786 0.000 0.004 0.008 0.072 0.916
#> GSM35519     5  0.0404     0.8678 0.000 0.000 0.012 0.000 0.988
#> GSM35527     2  0.3316     0.8758 0.000 0.860 0.012 0.072 0.056
#> GSM35532     5  0.0404     0.8678 0.000 0.000 0.012 0.000 0.988
#> GSM35439     2  0.0000     0.9458 0.000 1.000 0.000 0.000 0.000
#> GSM35443     1  0.0404     0.8960 0.988 0.000 0.000 0.000 0.012
#> GSM35445     1  0.2424     0.8570 0.868 0.000 0.000 0.132 0.000
#> GSM35448     3  0.4301     0.7245 0.000 0.016 0.740 0.016 0.228
#> GSM35451     4  0.1908     0.9149 0.092 0.000 0.000 0.908 0.000
#> GSM35454     3  0.1205     0.8360 0.000 0.000 0.956 0.040 0.004
#> GSM35457     2  0.0290     0.9450 0.000 0.992 0.000 0.000 0.008
#> GSM35465     2  0.0290     0.9450 0.000 0.992 0.000 0.000 0.008
#> GSM35468     1  0.0404     0.8960 0.988 0.000 0.000 0.000 0.012
#> GSM35471     4  0.1851     0.9152 0.088 0.000 0.000 0.912 0.000
#> GSM35473     1  0.1478     0.9037 0.936 0.000 0.000 0.064 0.000
#> GSM35477     4  0.1908     0.9149 0.092 0.000 0.000 0.908 0.000
#> GSM35480     4  0.4300     0.1730 0.476 0.000 0.000 0.524 0.000
#> GSM35482     3  0.2297     0.8129 0.020 0.000 0.912 0.060 0.008
#> GSM35485     2  0.0000     0.9458 0.000 1.000 0.000 0.000 0.000
#> GSM35489     2  0.0000     0.9458 0.000 1.000 0.000 0.000 0.000
#> GSM35492     1  0.0404     0.8960 0.988 0.000 0.000 0.000 0.012
#> GSM35495     3  0.0510     0.8347 0.000 0.000 0.984 0.016 0.000
#> GSM35499     2  0.0290     0.9450 0.000 0.992 0.000 0.000 0.008
#> GSM35502     1  0.1043     0.9111 0.960 0.000 0.000 0.040 0.000
#> GSM35505     3  0.3921     0.7791 0.000 0.000 0.784 0.044 0.172
#> GSM35507     4  0.2011     0.9137 0.088 0.004 0.000 0.908 0.000
#> GSM35510     2  0.0290     0.9450 0.000 0.992 0.000 0.000 0.008
#> GSM35514     1  0.1043     0.9111 0.960 0.000 0.000 0.040 0.000
#> GSM35517     2  0.0000     0.9458 0.000 1.000 0.000 0.000 0.000
#> GSM35520     5  0.3013     0.7416 0.000 0.160 0.008 0.000 0.832
#> GSM35523     4  0.1851     0.9152 0.088 0.000 0.000 0.912 0.000
#> GSM35529     2  0.0290     0.9450 0.000 0.992 0.000 0.000 0.008
#> GSM35531     2  0.0404     0.9412 0.000 0.988 0.000 0.000 0.012
#> GSM35534     2  0.0000     0.9458 0.000 1.000 0.000 0.000 0.000
#> GSM35536     1  0.1043     0.9111 0.960 0.000 0.000 0.040 0.000
#> GSM35538     1  0.2074     0.8757 0.896 0.000 0.000 0.104 0.000
#> GSM35539     4  0.2280     0.9034 0.120 0.000 0.000 0.880 0.000
#> GSM35540     2  0.0510     0.9417 0.000 0.984 0.000 0.000 0.016
#> GSM35541     2  0.0000     0.9458 0.000 1.000 0.000 0.000 0.000
#> GSM35442     1  0.2775     0.8224 0.884 0.000 0.076 0.004 0.036
#> GSM35447     3  0.4588     0.7341 0.000 0.000 0.720 0.060 0.220
#> GSM35450     4  0.3242     0.8130 0.216 0.000 0.000 0.784 0.000
#> GSM35453     1  0.2754     0.8833 0.884 0.000 0.032 0.080 0.004
#> GSM35456     4  0.2248     0.9068 0.088 0.012 0.000 0.900 0.000
#> GSM35464     2  0.3983     0.4940 0.000 0.660 0.000 0.340 0.000
#> GSM35467     1  0.1043     0.9111 0.960 0.000 0.000 0.040 0.000
#> GSM35470     4  0.4338     0.6965 0.280 0.000 0.024 0.696 0.000
#> GSM35479     3  0.0703     0.8361 0.000 0.000 0.976 0.024 0.000
#> GSM35484     1  0.2424     0.8538 0.868 0.000 0.000 0.132 0.000
#> GSM35488     1  0.0404     0.8960 0.988 0.000 0.000 0.000 0.012
#> GSM35491     1  0.0566     0.8981 0.984 0.000 0.000 0.004 0.012
#> GSM35494     3  0.1410     0.8260 0.000 0.000 0.940 0.060 0.000
#> GSM35498     4  0.1851     0.9152 0.088 0.000 0.000 0.912 0.000
#> GSM35501     1  0.1043     0.9111 0.960 0.000 0.000 0.040 0.000
#> GSM35509     3  0.0609     0.8346 0.000 0.000 0.980 0.020 0.000
#> GSM35513     1  0.1043     0.9111 0.960 0.000 0.000 0.040 0.000
#> GSM35516     2  0.0000     0.9458 0.000 1.000 0.000 0.000 0.000
#> GSM35522     4  0.1851     0.9152 0.088 0.000 0.000 0.912 0.000
#> GSM35525     1  0.1410     0.9049 0.940 0.000 0.000 0.060 0.000
#> GSM35528     1  0.4617    -0.0827 0.552 0.000 0.000 0.436 0.012
#> GSM35533     1  0.3242     0.7378 0.784 0.000 0.000 0.216 0.000
#> GSM35537     4  0.2424     0.8941 0.132 0.000 0.000 0.868 0.000

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>          class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM35441     2  0.2838     0.5850 0.000 0.808 0.000 0.000 0.004 0.188
#> GSM35446     3  0.5786     0.6109 0.000 0.012 0.604 0.028 0.256 0.100
#> GSM35449     2  0.2871     0.5815 0.000 0.804 0.000 0.000 0.004 0.192
#> GSM35455     2  0.2838     0.5850 0.000 0.808 0.000 0.000 0.004 0.188
#> GSM35458     5  0.4072     0.7207 0.004 0.040 0.000 0.004 0.736 0.216
#> GSM35460     3  0.4498     0.7385 0.000 0.012 0.768 0.028 0.096 0.096
#> GSM35461     5  0.3531     0.6813 0.032 0.000 0.152 0.008 0.804 0.004
#> GSM35463     2  0.1141     0.7264 0.000 0.948 0.000 0.000 0.000 0.052
#> GSM35472     5  0.4274    -0.1617 0.004 0.000 0.432 0.000 0.552 0.012
#> GSM35475     5  0.2902     0.7631 0.000 0.004 0.000 0.000 0.800 0.196
#> GSM35483     2  0.1663     0.7406 0.000 0.912 0.000 0.000 0.000 0.088
#> GSM35496     3  0.3194     0.7038 0.012 0.000 0.808 0.004 0.172 0.004
#> GSM35497     2  0.2838     0.5850 0.000 0.808 0.000 0.000 0.004 0.188
#> GSM35504     6  0.3756     0.6467 0.000 0.352 0.000 0.004 0.000 0.644
#> GSM35508     6  0.4189     0.5045 0.000 0.376 0.000 0.000 0.020 0.604
#> GSM35511     5  0.0865     0.7778 0.000 0.000 0.000 0.000 0.964 0.036
#> GSM35512     5  0.2809     0.6206 0.004 0.000 0.168 0.000 0.824 0.004
#> GSM35515     5  0.3332     0.7507 0.004 0.004 0.000 0.004 0.772 0.216
#> GSM35519     5  0.0260     0.7743 0.000 0.000 0.000 0.000 0.992 0.008
#> GSM35527     6  0.3872     0.4917 0.000 0.392 0.000 0.000 0.004 0.604
#> GSM35532     5  0.0146     0.7720 0.000 0.000 0.000 0.000 0.996 0.004
#> GSM35439     2  0.1267     0.7479 0.000 0.940 0.000 0.000 0.000 0.060
#> GSM35443     1  0.0653     0.8422 0.980 0.000 0.012 0.004 0.004 0.000
#> GSM35445     1  0.3891     0.8154 0.768 0.004 0.064 0.164 0.000 0.000
#> GSM35448     3  0.5889     0.6019 0.000 0.016 0.596 0.028 0.260 0.100
#> GSM35451     4  0.1082     0.8611 0.040 0.004 0.000 0.956 0.000 0.000
#> GSM35454     3  0.0547     0.8118 0.000 0.000 0.980 0.020 0.000 0.000
#> GSM35457     2  0.1863     0.6407 0.000 0.896 0.000 0.000 0.000 0.104
#> GSM35465     2  0.2793     0.4589 0.000 0.800 0.000 0.000 0.000 0.200
#> GSM35468     1  0.0653     0.8422 0.980 0.000 0.012 0.004 0.004 0.000
#> GSM35471     4  0.1296     0.8594 0.032 0.012 0.004 0.952 0.000 0.000
#> GSM35473     1  0.2714     0.8626 0.848 0.004 0.012 0.136 0.000 0.000
#> GSM35477     4  0.1082     0.8611 0.040 0.004 0.000 0.956 0.000 0.000
#> GSM35480     4  0.4191     0.2326 0.388 0.004 0.012 0.596 0.000 0.000
#> GSM35482     3  0.1700     0.7733 0.000 0.004 0.916 0.080 0.000 0.000
#> GSM35485     2  0.1556     0.7462 0.000 0.920 0.000 0.000 0.000 0.080
#> GSM35489     2  0.1700     0.7462 0.000 0.916 0.004 0.000 0.000 0.080
#> GSM35492     1  0.0653     0.8422 0.980 0.000 0.012 0.004 0.004 0.000
#> GSM35495     3  0.2221     0.8065 0.000 0.000 0.896 0.032 0.000 0.072
#> GSM35499     2  0.3847    -0.4382 0.000 0.544 0.000 0.000 0.000 0.456
#> GSM35502     1  0.1957     0.8773 0.888 0.000 0.000 0.112 0.000 0.000
#> GSM35505     3  0.3098     0.7374 0.000 0.000 0.812 0.024 0.164 0.000
#> GSM35507     4  0.1151     0.8598 0.032 0.012 0.000 0.956 0.000 0.000
#> GSM35510     6  0.3862     0.4983 0.000 0.476 0.000 0.000 0.000 0.524
#> GSM35514     1  0.1863     0.8787 0.896 0.000 0.000 0.104 0.000 0.000
#> GSM35517     2  0.0146     0.7379 0.000 0.996 0.000 0.000 0.000 0.004
#> GSM35520     5  0.4375     0.6661 0.000 0.120 0.004 0.000 0.732 0.144
#> GSM35523     4  0.0935     0.8618 0.032 0.004 0.000 0.964 0.000 0.000
#> GSM35529     2  0.2631     0.4770 0.000 0.820 0.000 0.000 0.000 0.180
#> GSM35531     2  0.3032     0.6979 0.000 0.852 0.004 0.020 0.016 0.108
#> GSM35534     2  0.1714     0.7404 0.000 0.908 0.000 0.000 0.000 0.092
#> GSM35536     1  0.1863     0.8787 0.896 0.000 0.000 0.104 0.000 0.000
#> GSM35538     1  0.2135     0.8717 0.872 0.000 0.000 0.128 0.000 0.000
#> GSM35539     4  0.2135     0.8048 0.128 0.000 0.000 0.872 0.000 0.000
#> GSM35540     6  0.3795     0.6520 0.000 0.364 0.004 0.000 0.000 0.632
#> GSM35541     2  0.0146     0.7379 0.000 0.996 0.000 0.000 0.000 0.004
#> GSM35442     1  0.3434     0.7434 0.820 0.000 0.132 0.012 0.032 0.004
#> GSM35447     3  0.3949     0.6811 0.000 0.004 0.748 0.036 0.208 0.004
#> GSM35450     4  0.2558     0.7769 0.156 0.004 0.000 0.840 0.000 0.000
#> GSM35453     1  0.4530     0.7677 0.716 0.004 0.144 0.136 0.000 0.000
#> GSM35456     4  0.1296     0.8594 0.032 0.012 0.004 0.952 0.000 0.000
#> GSM35464     4  0.4097    -0.1138 0.000 0.488 0.000 0.504 0.000 0.008
#> GSM35467     1  0.1863     0.8787 0.896 0.000 0.000 0.104 0.000 0.000
#> GSM35470     4  0.4800     0.6441 0.124 0.004 0.192 0.680 0.000 0.000
#> GSM35479     3  0.0717     0.8135 0.000 0.000 0.976 0.016 0.000 0.008
#> GSM35484     1  0.2879     0.8379 0.816 0.004 0.004 0.176 0.000 0.000
#> GSM35488     1  0.0653     0.8422 0.980 0.000 0.012 0.004 0.004 0.000
#> GSM35491     1  0.0767     0.8435 0.976 0.000 0.012 0.008 0.004 0.000
#> GSM35494     3  0.0632     0.8109 0.000 0.000 0.976 0.024 0.000 0.000
#> GSM35498     4  0.0935     0.8618 0.032 0.004 0.000 0.964 0.000 0.000
#> GSM35501     1  0.2003     0.8762 0.884 0.000 0.000 0.116 0.000 0.000
#> GSM35509     3  0.2039     0.8082 0.000 0.000 0.904 0.020 0.000 0.076
#> GSM35513     1  0.1863     0.8787 0.896 0.000 0.000 0.104 0.000 0.000
#> GSM35516     2  0.1701     0.7454 0.000 0.920 0.000 0.008 0.000 0.072
#> GSM35522     4  0.1049     0.8611 0.032 0.008 0.000 0.960 0.000 0.000
#> GSM35525     1  0.2003     0.8762 0.884 0.000 0.000 0.116 0.000 0.000
#> GSM35528     1  0.4218     0.0995 0.584 0.000 0.012 0.400 0.004 0.000
#> GSM35533     1  0.3521     0.7287 0.724 0.004 0.004 0.268 0.000 0.000
#> GSM35537     4  0.2600     0.8247 0.084 0.004 0.036 0.876 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)

plot of chunk tab-SD-mclust-consensus-heatmap-1

consensus_heatmap(res, k = 3)

plot of chunk tab-SD-mclust-consensus-heatmap-2

consensus_heatmap(res, k = 4)

plot of chunk tab-SD-mclust-consensus-heatmap-3

consensus_heatmap(res, k = 5)

plot of chunk tab-SD-mclust-consensus-heatmap-4

consensus_heatmap(res, k = 6)

plot of chunk tab-SD-mclust-consensus-heatmap-5

Heatmaps for the membership of samples in all partitions to see how consistent they are:

membership_heatmap(res, k = 2)

plot of chunk tab-SD-mclust-membership-heatmap-1

membership_heatmap(res, k = 3)

plot of chunk tab-SD-mclust-membership-heatmap-2

membership_heatmap(res, k = 4)

plot of chunk tab-SD-mclust-membership-heatmap-3

membership_heatmap(res, k = 5)

plot of chunk tab-SD-mclust-membership-heatmap-4

membership_heatmap(res, k = 6)

plot of chunk tab-SD-mclust-membership-heatmap-5

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)

plot of chunk tab-SD-mclust-get-signatures-1

get_signatures(res, k = 3)

plot of chunk tab-SD-mclust-get-signatures-2

get_signatures(res, k = 4)

plot of chunk tab-SD-mclust-get-signatures-3

get_signatures(res, k = 5)

plot of chunk tab-SD-mclust-get-signatures-4

get_signatures(res, k = 6)

plot of chunk tab-SD-mclust-get-signatures-5

Signature heatmaps where rows are not scaled:

get_signatures(res, k = 2, scale_rows = FALSE)

plot of chunk tab-SD-mclust-get-signatures-no-scale-1

get_signatures(res, k = 3, scale_rows = FALSE)

plot of chunk tab-SD-mclust-get-signatures-no-scale-2

get_signatures(res, k = 4, scale_rows = FALSE)

plot of chunk tab-SD-mclust-get-signatures-no-scale-3

get_signatures(res, k = 5, scale_rows = FALSE)

plot of chunk tab-SD-mclust-get-signatures-no-scale-4

get_signatures(res, k = 6, scale_rows = FALSE)

plot of chunk tab-SD-mclust-get-signatures-no-scale-5

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk SD-mclust-signature_compare

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:

  1. which_row: row indices corresponding to the input matrix.
  2. fdr: FDR for the differential test.
  3. mean_x: The mean value in group x.
  4. scaled_mean_x: The mean value in group x after rows are scaled.
  5. 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")

plot of chunk tab-SD-mclust-dimension-reduction-1

dimension_reduction(res, k = 3, method = "UMAP")

plot of chunk tab-SD-mclust-dimension-reduction-2

dimension_reduction(res, k = 4, method = "UMAP")

plot of chunk tab-SD-mclust-dimension-reduction-3

dimension_reduction(res, k = 5, method = "UMAP")

plot of chunk tab-SD-mclust-dimension-reduction-4

dimension_reduction(res, k = 6, method = "UMAP")

plot of chunk tab-SD-mclust-dimension-reduction-5

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk SD-mclust-collect-classes

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  time(p) k
#> SD:mclust 73 1.53e-02 2
#> SD:mclust 73 7.00e-03 3
#> SD:mclust 72 1.16e-03 4
#> SD:mclust 75 4.54e-06 5
#> SD:mclust 70 4.23e-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.


SD:NMF*

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 7758 rows and 79 columns.
#>   Top rows (776, 1552, 2328, 3103, 3879) 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 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)

plot of chunk SD-NMF-collect-plots

The plots are:

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:

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)

plot of chunk SD-NMF-select-partition-number

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.973           0.944       0.979         0.5021 0.498   0.498
#> 3 3 0.920           0.928       0.960         0.3166 0.784   0.590
#> 4 4 0.623           0.655       0.821         0.1280 0.829   0.551
#> 5 5 0.622           0.580       0.774         0.0603 0.920   0.704
#> 6 6 0.631           0.521       0.740         0.0461 0.863   0.467

suggest_best_k() suggests the best \(k\) based on these statistics. The rules are as follows:

suggest_best_k(res)
#> [1] 3
#> attr(,"optional")
#> [1] 2

There is also optional best \(k\) = 2 that is worth to check.

Following shows the table of the partitions (You need to click the show/hide code output link to see it). The membership matrix (columns with name p*) is inferred by clue::cl_consensus() function with the SE method. Basically the value in the membership matrix represents the probability to belong to a certain group. The finall class label for an item is determined with the group with highest probability it belongs to.

In get_classes() function, the entropy is calculated from the membership matrix and the silhouette score is calculated from the consensus matrix.

show/hide code output

cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#>          class entropy silhouette    p1    p2
#> GSM35441     2  0.0000     0.9767 0.000 1.000
#> GSM35446     2  0.0000     0.9767 0.000 1.000
#> GSM35449     2  0.0000     0.9767 0.000 1.000
#> GSM35455     2  0.0000     0.9767 0.000 1.000
#> GSM35458     2  0.0000     0.9767 0.000 1.000
#> GSM35460     2  0.0000     0.9767 0.000 1.000
#> GSM35461     1  0.0000     0.9781 1.000 0.000
#> GSM35463     2  0.0000     0.9767 0.000 1.000
#> GSM35472     2  0.8813     0.5557 0.300 0.700
#> GSM35475     2  0.0000     0.9767 0.000 1.000
#> GSM35483     2  0.0000     0.9767 0.000 1.000
#> GSM35496     1  0.0000     0.9781 1.000 0.000
#> GSM35497     2  0.0000     0.9767 0.000 1.000
#> GSM35504     2  0.0000     0.9767 0.000 1.000
#> GSM35508     2  0.0000     0.9767 0.000 1.000
#> GSM35511     2  0.0000     0.9767 0.000 1.000
#> GSM35512     2  0.9988     0.0456 0.480 0.520
#> GSM35515     2  0.0000     0.9767 0.000 1.000
#> GSM35519     2  0.0000     0.9767 0.000 1.000
#> GSM35527     2  0.0000     0.9767 0.000 1.000
#> GSM35532     2  0.0000     0.9767 0.000 1.000
#> GSM35439     2  0.0000     0.9767 0.000 1.000
#> GSM35443     1  0.0000     0.9781 1.000 0.000
#> GSM35445     1  0.0000     0.9781 1.000 0.000
#> GSM35448     2  0.0000     0.9767 0.000 1.000
#> GSM35451     1  0.0000     0.9781 1.000 0.000
#> GSM35454     1  0.0000     0.9781 1.000 0.000
#> GSM35457     2  0.0000     0.9767 0.000 1.000
#> GSM35465     2  0.0000     0.9767 0.000 1.000
#> GSM35468     1  0.0000     0.9781 1.000 0.000
#> GSM35471     1  0.0000     0.9781 1.000 0.000
#> GSM35473     1  0.0000     0.9781 1.000 0.000
#> GSM35477     1  0.0000     0.9781 1.000 0.000
#> GSM35480     1  0.0000     0.9781 1.000 0.000
#> GSM35482     1  0.0000     0.9781 1.000 0.000
#> GSM35485     2  0.0000     0.9767 0.000 1.000
#> GSM35489     2  0.0000     0.9767 0.000 1.000
#> GSM35492     1  0.0000     0.9781 1.000 0.000
#> GSM35495     1  0.9608     0.3716 0.616 0.384
#> GSM35499     2  0.0000     0.9767 0.000 1.000
#> GSM35502     1  0.0000     0.9781 1.000 0.000
#> GSM35505     1  0.0000     0.9781 1.000 0.000
#> GSM35507     1  0.6712     0.7789 0.824 0.176
#> GSM35510     2  0.0000     0.9767 0.000 1.000
#> GSM35514     1  0.0000     0.9781 1.000 0.000
#> GSM35517     2  0.0000     0.9767 0.000 1.000
#> GSM35520     2  0.0000     0.9767 0.000 1.000
#> GSM35523     1  0.0000     0.9781 1.000 0.000
#> GSM35529     2  0.0000     0.9767 0.000 1.000
#> GSM35531     2  0.0000     0.9767 0.000 1.000
#> GSM35534     2  0.0000     0.9767 0.000 1.000
#> GSM35536     1  0.0000     0.9781 1.000 0.000
#> GSM35538     1  0.0000     0.9781 1.000 0.000
#> GSM35539     1  0.0000     0.9781 1.000 0.000
#> GSM35540     2  0.0000     0.9767 0.000 1.000
#> GSM35541     2  0.0000     0.9767 0.000 1.000
#> GSM35442     1  0.0000     0.9781 1.000 0.000
#> GSM35447     1  0.0000     0.9781 1.000 0.000
#> GSM35450     1  0.0000     0.9781 1.000 0.000
#> GSM35453     1  0.0000     0.9781 1.000 0.000
#> GSM35456     1  0.0000     0.9781 1.000 0.000
#> GSM35464     2  0.0376     0.9730 0.004 0.996
#> GSM35467     1  0.0000     0.9781 1.000 0.000
#> GSM35470     1  0.0000     0.9781 1.000 0.000
#> GSM35479     1  0.0000     0.9781 1.000 0.000
#> GSM35484     1  0.0000     0.9781 1.000 0.000
#> GSM35488     1  0.0000     0.9781 1.000 0.000
#> GSM35491     1  0.0000     0.9781 1.000 0.000
#> GSM35494     1  0.0000     0.9781 1.000 0.000
#> GSM35498     1  0.0000     0.9781 1.000 0.000
#> GSM35501     1  0.0000     0.9781 1.000 0.000
#> GSM35509     1  0.9044     0.5250 0.680 0.320
#> GSM35513     1  0.0000     0.9781 1.000 0.000
#> GSM35516     2  0.0000     0.9767 0.000 1.000
#> GSM35522     1  0.0376     0.9745 0.996 0.004
#> GSM35525     1  0.0000     0.9781 1.000 0.000
#> GSM35528     1  0.0000     0.9781 1.000 0.000
#> GSM35533     1  0.0000     0.9781 1.000 0.000
#> GSM35537     1  0.0000     0.9781 1.000 0.000

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>          class entropy silhouette    p1    p2    p3
#> GSM35441     2  0.0000      0.971 0.000 1.000 0.000
#> GSM35446     3  0.1163      0.926 0.000 0.028 0.972
#> GSM35449     2  0.0237      0.971 0.000 0.996 0.004
#> GSM35455     2  0.0000      0.971 0.000 1.000 0.000
#> GSM35458     2  0.0592      0.968 0.000 0.988 0.012
#> GSM35460     3  0.0892      0.930 0.000 0.020 0.980
#> GSM35461     3  0.3267      0.857 0.116 0.000 0.884
#> GSM35463     2  0.0475      0.969 0.004 0.992 0.004
#> GSM35472     3  0.0661      0.934 0.004 0.008 0.988
#> GSM35475     2  0.4605      0.768 0.000 0.796 0.204
#> GSM35483     2  0.0592      0.968 0.000 0.988 0.012
#> GSM35496     3  0.0747      0.935 0.016 0.000 0.984
#> GSM35497     2  0.0237      0.971 0.000 0.996 0.004
#> GSM35504     2  0.1964      0.941 0.000 0.944 0.056
#> GSM35508     2  0.2066      0.939 0.000 0.940 0.060
#> GSM35511     3  0.3816      0.815 0.000 0.148 0.852
#> GSM35512     3  0.0592      0.933 0.000 0.012 0.988
#> GSM35515     2  0.1031      0.963 0.000 0.976 0.024
#> GSM35519     3  0.1163      0.927 0.000 0.028 0.972
#> GSM35527     2  0.1289      0.958 0.000 0.968 0.032
#> GSM35532     3  0.1411      0.922 0.000 0.036 0.964
#> GSM35439     2  0.0983      0.962 0.016 0.980 0.004
#> GSM35443     1  0.1163      0.955 0.972 0.000 0.028
#> GSM35445     1  0.1163      0.955 0.972 0.000 0.028
#> GSM35448     3  0.4002      0.799 0.000 0.160 0.840
#> GSM35451     1  0.1267      0.946 0.972 0.024 0.004
#> GSM35454     3  0.1964      0.914 0.056 0.000 0.944
#> GSM35457     2  0.0000      0.971 0.000 1.000 0.000
#> GSM35465     2  0.0000      0.971 0.000 1.000 0.000
#> GSM35468     1  0.0747      0.960 0.984 0.000 0.016
#> GSM35471     1  0.0661      0.956 0.988 0.008 0.004
#> GSM35473     1  0.1031      0.957 0.976 0.000 0.024
#> GSM35477     1  0.0983      0.952 0.980 0.016 0.004
#> GSM35480     1  0.0592      0.961 0.988 0.000 0.012
#> GSM35482     3  0.1031      0.933 0.024 0.000 0.976
#> GSM35485     2  0.0237      0.971 0.000 0.996 0.004
#> GSM35489     2  0.0424      0.969 0.008 0.992 0.000
#> GSM35492     1  0.0892      0.959 0.980 0.000 0.020
#> GSM35495     3  0.0237      0.935 0.004 0.000 0.996
#> GSM35499     2  0.0000      0.971 0.000 1.000 0.000
#> GSM35502     1  0.0424      0.961 0.992 0.000 0.008
#> GSM35505     3  0.0892      0.934 0.020 0.000 0.980
#> GSM35507     1  0.5365      0.674 0.744 0.252 0.004
#> GSM35510     2  0.0237      0.971 0.000 0.996 0.004
#> GSM35514     1  0.0424      0.961 0.992 0.000 0.008
#> GSM35517     2  0.0475      0.969 0.004 0.992 0.004
#> GSM35520     2  0.3752      0.852 0.000 0.856 0.144
#> GSM35523     1  0.0661      0.961 0.988 0.004 0.008
#> GSM35529     2  0.0237      0.971 0.000 0.996 0.004
#> GSM35531     2  0.0237      0.971 0.004 0.996 0.000
#> GSM35534     2  0.0000      0.971 0.000 1.000 0.000
#> GSM35536     1  0.0592      0.961 0.988 0.000 0.012
#> GSM35538     1  0.0237      0.960 0.996 0.004 0.000
#> GSM35539     1  0.0000      0.961 1.000 0.000 0.000
#> GSM35540     2  0.2796      0.911 0.000 0.908 0.092
#> GSM35541     2  0.0661      0.967 0.008 0.988 0.004
#> GSM35442     3  0.6045      0.381 0.380 0.000 0.620
#> GSM35447     3  0.0592      0.935 0.012 0.000 0.988
#> GSM35450     1  0.0424      0.958 0.992 0.008 0.000
#> GSM35453     1  0.4399      0.779 0.812 0.000 0.188
#> GSM35456     1  0.2200      0.920 0.940 0.056 0.004
#> GSM35464     2  0.1525      0.950 0.032 0.964 0.004
#> GSM35467     1  0.0592      0.961 0.988 0.000 0.012
#> GSM35470     1  0.4974      0.705 0.764 0.000 0.236
#> GSM35479     3  0.1163      0.931 0.028 0.000 0.972
#> GSM35484     1  0.0424      0.961 0.992 0.000 0.008
#> GSM35488     1  0.0237      0.961 0.996 0.000 0.004
#> GSM35491     1  0.0892      0.959 0.980 0.000 0.020
#> GSM35494     3  0.1529      0.926 0.040 0.000 0.960
#> GSM35498     1  0.0592      0.956 0.988 0.012 0.000
#> GSM35501     1  0.0592      0.961 0.988 0.000 0.012
#> GSM35509     3  0.0237      0.935 0.004 0.000 0.996
#> GSM35513     1  0.0424      0.961 0.992 0.000 0.008
#> GSM35516     2  0.1267      0.956 0.024 0.972 0.004
#> GSM35522     1  0.2301      0.916 0.936 0.060 0.004
#> GSM35525     1  0.0592      0.961 0.988 0.000 0.012
#> GSM35528     1  0.0475      0.961 0.992 0.004 0.004
#> GSM35533     1  0.0424      0.961 0.992 0.000 0.008
#> GSM35537     1  0.1964      0.933 0.944 0.000 0.056

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>          class entropy silhouette    p1    p2    p3    p4
#> GSM35441     2  0.1022     0.7801 0.000 0.968 0.000 0.032
#> GSM35446     3  0.0895     0.7869 0.000 0.020 0.976 0.004
#> GSM35449     2  0.1211     0.7781 0.000 0.960 0.000 0.040
#> GSM35455     2  0.1211     0.7781 0.000 0.960 0.000 0.040
#> GSM35458     2  0.5507     0.6418 0.096 0.780 0.060 0.064
#> GSM35460     3  0.1722     0.7912 0.000 0.008 0.944 0.048
#> GSM35461     3  0.6830     0.2014 0.420 0.012 0.500 0.068
#> GSM35463     2  0.4941     0.0460 0.000 0.564 0.000 0.436
#> GSM35472     3  0.3030     0.7706 0.024 0.036 0.904 0.036
#> GSM35475     2  0.6381     0.5901 0.096 0.724 0.116 0.064
#> GSM35483     2  0.0469     0.7815 0.000 0.988 0.000 0.012
#> GSM35496     3  0.1837     0.7904 0.028 0.000 0.944 0.028
#> GSM35497     2  0.0592     0.7814 0.000 0.984 0.000 0.016
#> GSM35504     4  0.6705     0.1659 0.000 0.440 0.088 0.472
#> GSM35508     2  0.1182     0.7776 0.000 0.968 0.016 0.016
#> GSM35511     2  0.6042     0.2919 0.000 0.580 0.368 0.052
#> GSM35512     3  0.4842     0.7255 0.048 0.088 0.816 0.048
#> GSM35515     2  0.5780     0.6269 0.100 0.764 0.072 0.064
#> GSM35519     2  0.7450     0.0414 0.048 0.476 0.416 0.060
#> GSM35527     2  0.1042     0.7811 0.000 0.972 0.008 0.020
#> GSM35532     3  0.6032     0.2653 0.004 0.380 0.576 0.040
#> GSM35439     2  0.1022     0.7786 0.000 0.968 0.000 0.032
#> GSM35443     1  0.3323     0.7790 0.876 0.000 0.064 0.060
#> GSM35445     1  0.2796     0.8535 0.892 0.000 0.016 0.092
#> GSM35448     3  0.4163     0.7612 0.000 0.076 0.828 0.096
#> GSM35451     4  0.5112     0.0769 0.436 0.004 0.000 0.560
#> GSM35454     3  0.4054     0.7465 0.016 0.000 0.796 0.188
#> GSM35457     2  0.4898     0.1254 0.000 0.584 0.000 0.416
#> GSM35465     4  0.4866     0.3662 0.000 0.404 0.000 0.596
#> GSM35468     1  0.1109     0.8528 0.968 0.000 0.004 0.028
#> GSM35471     4  0.2081     0.6619 0.084 0.000 0.000 0.916
#> GSM35473     1  0.1004     0.8711 0.972 0.000 0.004 0.024
#> GSM35477     1  0.4655     0.6234 0.684 0.004 0.000 0.312
#> GSM35480     1  0.5184     0.6557 0.672 0.000 0.024 0.304
#> GSM35482     3  0.2714     0.7839 0.004 0.000 0.884 0.112
#> GSM35485     2  0.0921     0.7802 0.000 0.972 0.000 0.028
#> GSM35489     2  0.2589     0.7199 0.000 0.884 0.000 0.116
#> GSM35492     1  0.2002     0.8321 0.936 0.000 0.020 0.044
#> GSM35495     3  0.2647     0.7811 0.000 0.000 0.880 0.120
#> GSM35499     4  0.4647     0.5221 0.000 0.288 0.008 0.704
#> GSM35502     1  0.1211     0.8696 0.960 0.000 0.000 0.040
#> GSM35505     3  0.3037     0.7637 0.076 0.000 0.888 0.036
#> GSM35507     4  0.4440     0.6718 0.136 0.060 0.000 0.804
#> GSM35510     4  0.4991     0.3777 0.000 0.388 0.004 0.608
#> GSM35514     1  0.0817     0.8677 0.976 0.000 0.000 0.024
#> GSM35517     2  0.1474     0.7688 0.000 0.948 0.000 0.052
#> GSM35520     2  0.3056     0.7225 0.000 0.888 0.072 0.040
#> GSM35523     4  0.2662     0.6505 0.084 0.000 0.016 0.900
#> GSM35529     2  0.4040     0.5445 0.000 0.752 0.000 0.248
#> GSM35531     2  0.0844     0.7750 0.004 0.980 0.012 0.004
#> GSM35534     2  0.0000     0.7796 0.000 1.000 0.000 0.000
#> GSM35536     1  0.0000     0.8677 1.000 0.000 0.000 0.000
#> GSM35538     1  0.2281     0.8549 0.904 0.000 0.000 0.096
#> GSM35539     1  0.4584     0.6555 0.696 0.000 0.004 0.300
#> GSM35540     4  0.6968     0.3079 0.000 0.392 0.116 0.492
#> GSM35541     2  0.2760     0.7046 0.000 0.872 0.000 0.128
#> GSM35442     1  0.5848     0.3263 0.616 0.000 0.336 0.048
#> GSM35447     3  0.4830     0.7184 0.124 0.024 0.804 0.048
#> GSM35450     1  0.3764     0.7670 0.784 0.000 0.000 0.216
#> GSM35453     1  0.4171     0.7943 0.824 0.000 0.116 0.060
#> GSM35456     4  0.3743     0.6431 0.160 0.016 0.000 0.824
#> GSM35464     4  0.5062     0.5485 0.024 0.284 0.000 0.692
#> GSM35467     1  0.0707     0.8667 0.980 0.000 0.000 0.020
#> GSM35470     3  0.7188     0.3902 0.204 0.000 0.552 0.244
#> GSM35479     3  0.3710     0.7460 0.004 0.000 0.804 0.192
#> GSM35484     1  0.1118     0.8690 0.964 0.000 0.000 0.036
#> GSM35488     1  0.0592     0.8708 0.984 0.000 0.000 0.016
#> GSM35491     1  0.0592     0.8623 0.984 0.000 0.000 0.016
#> GSM35494     3  0.3257     0.7701 0.004 0.000 0.844 0.152
#> GSM35498     4  0.3768     0.6189 0.184 0.008 0.000 0.808
#> GSM35501     1  0.1557     0.8667 0.944 0.000 0.000 0.056
#> GSM35509     3  0.3528     0.7489 0.000 0.000 0.808 0.192
#> GSM35513     1  0.0817     0.8653 0.976 0.000 0.000 0.024
#> GSM35516     2  0.4776     0.2365 0.000 0.624 0.000 0.376
#> GSM35522     4  0.2088     0.6585 0.064 0.004 0.004 0.928
#> GSM35525     1  0.3306     0.8190 0.840 0.000 0.004 0.156
#> GSM35528     1  0.3172     0.8183 0.840 0.000 0.000 0.160
#> GSM35533     1  0.2345     0.8541 0.900 0.000 0.000 0.100
#> GSM35537     4  0.7031     0.1612 0.152 0.000 0.296 0.552

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>          class entropy silhouette    p1    p2    p3    p4    p5
#> GSM35441     5  0.3151     0.6875 0.000 0.020 0.000 0.144 0.836
#> GSM35446     3  0.2676     0.7372 0.000 0.080 0.884 0.000 0.036
#> GSM35449     5  0.3300     0.6538 0.000 0.004 0.000 0.204 0.792
#> GSM35455     5  0.3016     0.6905 0.000 0.020 0.000 0.132 0.848
#> GSM35458     5  0.2429     0.6564 0.076 0.004 0.020 0.000 0.900
#> GSM35460     3  0.2228     0.7403 0.000 0.076 0.908 0.004 0.012
#> GSM35461     3  0.6874     0.2938 0.332 0.000 0.460 0.016 0.192
#> GSM35463     2  0.3085     0.6958 0.000 0.852 0.000 0.032 0.116
#> GSM35472     3  0.2605     0.7007 0.000 0.000 0.852 0.000 0.148
#> GSM35475     5  0.3275     0.6324 0.068 0.008 0.064 0.000 0.860
#> GSM35483     2  0.3957     0.6696 0.000 0.712 0.000 0.008 0.280
#> GSM35496     3  0.2012     0.7337 0.000 0.000 0.920 0.020 0.060
#> GSM35497     5  0.2411     0.7011 0.000 0.008 0.000 0.108 0.884
#> GSM35504     2  0.5104     0.6782 0.000 0.748 0.044 0.084 0.124
#> GSM35508     5  0.2450     0.6986 0.000 0.000 0.028 0.076 0.896
#> GSM35511     5  0.3489     0.5345 0.004 0.004 0.208 0.000 0.784
#> GSM35512     3  0.3719     0.6621 0.012 0.004 0.776 0.000 0.208
#> GSM35515     5  0.2670     0.6498 0.080 0.004 0.028 0.000 0.888
#> GSM35519     5  0.5053     0.2993 0.048 0.004 0.304 0.000 0.644
#> GSM35527     5  0.2389     0.7005 0.000 0.000 0.004 0.116 0.880
#> GSM35532     3  0.4306     0.1707 0.000 0.000 0.508 0.000 0.492
#> GSM35439     5  0.4238     0.5454 0.004 0.228 0.000 0.028 0.740
#> GSM35443     1  0.2842     0.7748 0.888 0.000 0.044 0.012 0.056
#> GSM35445     1  0.5079     0.6416 0.700 0.232 0.028 0.040 0.000
#> GSM35448     2  0.4292     0.3055 0.000 0.704 0.272 0.000 0.024
#> GSM35451     4  0.5019     0.0523 0.436 0.032 0.000 0.532 0.000
#> GSM35454     3  0.5111     0.4242 0.000 0.408 0.552 0.040 0.000
#> GSM35457     4  0.4803    -0.0648 0.000 0.020 0.000 0.536 0.444
#> GSM35465     4  0.3081     0.5799 0.000 0.012 0.000 0.832 0.156
#> GSM35468     1  0.1503     0.8142 0.952 0.000 0.008 0.020 0.020
#> GSM35471     4  0.3584     0.6353 0.056 0.060 0.032 0.852 0.000
#> GSM35473     1  0.1278     0.8137 0.960 0.016 0.004 0.020 0.000
#> GSM35477     1  0.4152     0.5877 0.692 0.012 0.000 0.296 0.000
#> GSM35480     1  0.5406     0.6285 0.680 0.060 0.028 0.232 0.000
#> GSM35482     3  0.3004     0.7149 0.000 0.008 0.864 0.108 0.020
#> GSM35485     2  0.4387     0.5963 0.004 0.652 0.000 0.008 0.336
#> GSM35489     5  0.4887     0.5865 0.000 0.132 0.000 0.148 0.720
#> GSM35492     1  0.1787     0.8072 0.940 0.000 0.012 0.016 0.032
#> GSM35495     3  0.3229     0.7201 0.000 0.128 0.840 0.032 0.000
#> GSM35499     2  0.4701     0.5121 0.000 0.712 0.004 0.232 0.052
#> GSM35502     1  0.0880     0.8149 0.968 0.000 0.000 0.032 0.000
#> GSM35505     3  0.5024     0.4892 0.032 0.368 0.596 0.000 0.004
#> GSM35507     4  0.2125     0.6627 0.024 0.004 0.000 0.920 0.052
#> GSM35510     4  0.6495    -0.1222 0.000 0.328 0.000 0.468 0.204
#> GSM35514     1  0.0771     0.8128 0.976 0.004 0.000 0.000 0.020
#> GSM35517     5  0.4433     0.5679 0.000 0.200 0.000 0.060 0.740
#> GSM35520     5  0.2992     0.6518 0.008 0.072 0.044 0.000 0.876
#> GSM35523     4  0.2027     0.6695 0.040 0.000 0.008 0.928 0.024
#> GSM35529     5  0.4451     0.4673 0.000 0.016 0.000 0.340 0.644
#> GSM35531     5  0.5711    -0.2395 0.032 0.468 0.020 0.004 0.476
#> GSM35534     2  0.4003     0.6600 0.008 0.704 0.000 0.000 0.288
#> GSM35536     1  0.0727     0.8171 0.980 0.000 0.004 0.012 0.004
#> GSM35538     1  0.2648     0.7580 0.848 0.000 0.000 0.152 0.000
#> GSM35539     4  0.4688    -0.0831 0.456 0.008 0.004 0.532 0.000
#> GSM35540     4  0.4837     0.5258 0.000 0.016 0.076 0.744 0.164
#> GSM35541     5  0.4863     0.4403 0.000 0.272 0.000 0.056 0.672
#> GSM35442     1  0.5434     0.4517 0.644 0.000 0.276 0.012 0.068
#> GSM35447     3  0.6165     0.6080 0.100 0.196 0.648 0.000 0.056
#> GSM35450     1  0.3578     0.7053 0.784 0.008 0.004 0.204 0.000
#> GSM35453     1  0.4044     0.7302 0.804 0.028 0.140 0.028 0.000
#> GSM35456     4  0.5611     0.4998 0.152 0.212 0.000 0.636 0.000
#> GSM35464     4  0.2511     0.6376 0.004 0.016 0.000 0.892 0.088
#> GSM35467     1  0.0566     0.8144 0.984 0.004 0.000 0.000 0.012
#> GSM35470     4  0.6253     0.2327 0.136 0.004 0.356 0.504 0.000
#> GSM35479     3  0.3691     0.6647 0.000 0.040 0.804 0.156 0.000
#> GSM35484     1  0.2516     0.7492 0.860 0.140 0.000 0.000 0.000
#> GSM35488     1  0.1443     0.8140 0.948 0.000 0.004 0.044 0.004
#> GSM35491     1  0.1186     0.8162 0.964 0.000 0.008 0.020 0.008
#> GSM35494     3  0.2450     0.7312 0.000 0.048 0.900 0.052 0.000
#> GSM35498     4  0.1914     0.6680 0.060 0.000 0.000 0.924 0.016
#> GSM35501     1  0.0703     0.8152 0.976 0.000 0.000 0.024 0.000
#> GSM35509     3  0.3051     0.7229 0.000 0.076 0.864 0.060 0.000
#> GSM35513     1  0.0693     0.8138 0.980 0.008 0.000 0.000 0.012
#> GSM35516     2  0.5617     0.5568 0.008 0.592 0.000 0.072 0.328
#> GSM35522     4  0.1750     0.6675 0.028 0.000 0.000 0.936 0.036
#> GSM35525     1  0.4283     0.6071 0.692 0.004 0.012 0.292 0.000
#> GSM35528     1  0.4802     0.1306 0.504 0.000 0.004 0.480 0.012
#> GSM35533     1  0.5426     0.2781 0.496 0.456 0.008 0.040 0.000
#> GSM35537     4  0.5029     0.5302 0.080 0.008 0.204 0.708 0.000

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>          class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM35441     5  0.4905    0.58449 0.000 0.080 0.000 0.200 0.692 0.028
#> GSM35446     3  0.3240    0.71073 0.000 0.056 0.840 0.000 0.012 0.092
#> GSM35449     5  0.4695    0.42418 0.000 0.016 0.000 0.336 0.616 0.032
#> GSM35455     5  0.2622    0.68140 0.000 0.024 0.000 0.104 0.868 0.004
#> GSM35458     5  0.2793    0.66710 0.044 0.020 0.000 0.000 0.876 0.060
#> GSM35460     3  0.1793    0.74497 0.000 0.032 0.928 0.000 0.004 0.036
#> GSM35461     6  0.4624    0.54628 0.044 0.000 0.124 0.004 0.076 0.752
#> GSM35463     2  0.2716    0.53545 0.000 0.868 0.000 0.028 0.096 0.008
#> GSM35472     3  0.4434    0.07985 0.000 0.000 0.544 0.000 0.028 0.428
#> GSM35475     5  0.4289    0.46753 0.012 0.004 0.008 0.000 0.636 0.340
#> GSM35483     2  0.4539    0.41562 0.000 0.644 0.004 0.000 0.304 0.048
#> GSM35496     3  0.2963    0.66131 0.000 0.004 0.828 0.000 0.016 0.152
#> GSM35497     5  0.2255    0.69053 0.000 0.004 0.000 0.088 0.892 0.016
#> GSM35504     2  0.6690    0.37372 0.000 0.476 0.296 0.016 0.180 0.032
#> GSM35508     5  0.2596    0.68080 0.000 0.016 0.008 0.024 0.892 0.060
#> GSM35511     5  0.3898    0.62609 0.000 0.012 0.060 0.000 0.780 0.148
#> GSM35512     6  0.4396    0.29628 0.000 0.000 0.352 0.000 0.036 0.612
#> GSM35515     5  0.2614    0.66953 0.044 0.012 0.000 0.000 0.884 0.060
#> GSM35519     6  0.4528    0.48395 0.000 0.004 0.132 0.000 0.148 0.716
#> GSM35527     5  0.3266    0.67661 0.000 0.016 0.004 0.096 0.844 0.040
#> GSM35532     5  0.5725    0.25300 0.000 0.000 0.280 0.000 0.512 0.208
#> GSM35439     5  0.3699    0.58532 0.012 0.176 0.000 0.000 0.780 0.032
#> GSM35443     6  0.3303    0.53863 0.212 0.000 0.004 0.004 0.004 0.776
#> GSM35445     1  0.4926    0.57842 0.656 0.268 0.012 0.008 0.000 0.056
#> GSM35448     2  0.5524    0.17168 0.000 0.532 0.372 0.000 0.064 0.032
#> GSM35451     4  0.3931    0.64887 0.088 0.052 0.000 0.804 0.000 0.056
#> GSM35454     3  0.5342    0.30502 0.012 0.396 0.516 0.000 0.000 0.076
#> GSM35457     4  0.4093    0.54601 0.000 0.056 0.000 0.736 0.204 0.004
#> GSM35465     4  0.1621    0.71057 0.000 0.008 0.004 0.936 0.048 0.004
#> GSM35468     1  0.3081    0.64594 0.776 0.000 0.000 0.000 0.004 0.220
#> GSM35471     4  0.2875    0.69887 0.052 0.032 0.028 0.880 0.000 0.008
#> GSM35473     1  0.1562    0.77246 0.940 0.024 0.000 0.000 0.004 0.032
#> GSM35477     4  0.5497    0.46320 0.204 0.024 0.000 0.628 0.000 0.144
#> GSM35480     1  0.3288    0.73770 0.860 0.028 0.036 0.020 0.000 0.056
#> GSM35482     3  0.2525    0.73547 0.004 0.012 0.904 0.028 0.016 0.036
#> GSM35485     2  0.4002    0.39384 0.000 0.660 0.000 0.000 0.320 0.020
#> GSM35489     4  0.7121    0.15967 0.000 0.208 0.000 0.464 0.164 0.164
#> GSM35492     6  0.3850    0.34314 0.340 0.004 0.000 0.004 0.000 0.652
#> GSM35495     3  0.2058    0.73911 0.000 0.036 0.908 0.000 0.000 0.056
#> GSM35499     2  0.4517   -0.05120 0.000 0.528 0.000 0.444 0.024 0.004
#> GSM35502     1  0.0964    0.77116 0.968 0.004 0.000 0.000 0.012 0.016
#> GSM35505     6  0.5373    0.40825 0.004 0.152 0.248 0.000 0.000 0.596
#> GSM35507     4  0.0717    0.72142 0.000 0.000 0.000 0.976 0.016 0.008
#> GSM35510     4  0.5426    0.30266 0.000 0.312 0.008 0.576 0.100 0.004
#> GSM35514     1  0.1974    0.76938 0.920 0.012 0.000 0.000 0.020 0.048
#> GSM35517     5  0.3837    0.60395 0.000 0.180 0.000 0.044 0.768 0.008
#> GSM35520     5  0.5161    0.52345 0.000 0.112 0.012 0.000 0.640 0.236
#> GSM35523     4  0.4094    0.65857 0.100 0.020 0.056 0.804 0.016 0.004
#> GSM35529     5  0.4593    0.43801 0.000 0.040 0.000 0.352 0.604 0.004
#> GSM35531     6  0.5912    0.16322 0.004 0.292 0.000 0.060 0.072 0.572
#> GSM35534     2  0.4234    0.37763 0.000 0.644 0.000 0.000 0.324 0.032
#> GSM35536     1  0.1732    0.76207 0.920 0.004 0.000 0.004 0.000 0.072
#> GSM35538     1  0.3967    0.70858 0.776 0.008 0.000 0.084 0.000 0.132
#> GSM35539     1  0.3462    0.67810 0.792 0.004 0.016 0.180 0.000 0.008
#> GSM35540     4  0.3834    0.65872 0.000 0.020 0.116 0.804 0.056 0.004
#> GSM35541     5  0.4488    0.41073 0.000 0.304 0.000 0.012 0.652 0.032
#> GSM35442     6  0.5596    0.51948 0.228 0.000 0.164 0.004 0.008 0.596
#> GSM35447     6  0.6113    0.19522 0.008 0.184 0.340 0.000 0.004 0.464
#> GSM35450     1  0.4988    0.63757 0.688 0.024 0.000 0.184 0.000 0.104
#> GSM35453     1  0.1887    0.76261 0.924 0.016 0.048 0.000 0.000 0.012
#> GSM35456     1  0.7070    0.25771 0.448 0.196 0.004 0.264 0.000 0.088
#> GSM35464     4  0.0862    0.71986 0.000 0.008 0.000 0.972 0.016 0.004
#> GSM35467     1  0.1692    0.77067 0.932 0.008 0.000 0.000 0.012 0.048
#> GSM35470     3  0.5888    0.33428 0.264 0.008 0.568 0.148 0.004 0.008
#> GSM35479     3  0.2193    0.72285 0.036 0.004 0.916 0.032 0.004 0.008
#> GSM35484     1  0.6137    0.24134 0.424 0.312 0.000 0.004 0.000 0.260
#> GSM35488     1  0.3571    0.65082 0.760 0.004 0.000 0.020 0.000 0.216
#> GSM35491     6  0.4550    0.00583 0.448 0.008 0.000 0.020 0.000 0.524
#> GSM35494     3  0.2050    0.72471 0.048 0.008 0.920 0.012 0.000 0.012
#> GSM35498     4  0.1026    0.72130 0.008 0.008 0.012 0.968 0.000 0.004
#> GSM35501     1  0.0653    0.77125 0.980 0.004 0.000 0.000 0.004 0.012
#> GSM35509     3  0.0964    0.74794 0.000 0.004 0.968 0.012 0.000 0.016
#> GSM35513     1  0.2282    0.76639 0.900 0.020 0.000 0.000 0.012 0.068
#> GSM35516     2  0.5382    0.28415 0.000 0.612 0.000 0.284 0.060 0.044
#> GSM35522     4  0.3227    0.69454 0.060 0.016 0.040 0.864 0.016 0.004
#> GSM35525     1  0.2210    0.74884 0.908 0.004 0.016 0.064 0.004 0.004
#> GSM35528     4  0.4815   -0.00191 0.452 0.008 0.004 0.512 0.004 0.020
#> GSM35533     2  0.5370   -0.22668 0.420 0.492 0.000 0.012 0.000 0.076
#> GSM35537     1  0.6604    0.18140 0.468 0.012 0.300 0.200 0.008 0.012

Heatmaps for the consensus matrix. It visualizes the probability of two samples to be in a same group.

consensus_heatmap(res, k = 2)

plot of chunk tab-SD-NMF-consensus-heatmap-1

consensus_heatmap(res, k = 3)

plot of chunk tab-SD-NMF-consensus-heatmap-2

consensus_heatmap(res, k = 4)

plot of chunk tab-SD-NMF-consensus-heatmap-3

consensus_heatmap(res, k = 5)

plot of chunk tab-SD-NMF-consensus-heatmap-4

consensus_heatmap(res, k = 6)

plot of chunk tab-SD-NMF-consensus-heatmap-5

Heatmaps for the membership of samples in all partitions to see how consistent they are:

membership_heatmap(res, k = 2)

plot of chunk tab-SD-NMF-membership-heatmap-1

membership_heatmap(res, k = 3)

plot of chunk tab-SD-NMF-membership-heatmap-2

membership_heatmap(res, k = 4)

plot of chunk tab-SD-NMF-membership-heatmap-3

membership_heatmap(res, k = 5)

plot of chunk tab-SD-NMF-membership-heatmap-4

membership_heatmap(res, k = 6)

plot of chunk tab-SD-NMF-membership-heatmap-5

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)

plot of chunk tab-SD-NMF-get-signatures-1

get_signatures(res, k = 3)

plot of chunk tab-SD-NMF-get-signatures-2

get_signatures(res, k = 4)

plot of chunk tab-SD-NMF-get-signatures-3

get_signatures(res, k = 5)

plot of chunk tab-SD-NMF-get-signatures-4

get_signatures(res, k = 6)

plot of chunk tab-SD-NMF-get-signatures-5

Signature heatmaps where rows are not scaled:

get_signatures(res, k = 2, scale_rows = FALSE)

plot of chunk tab-SD-NMF-get-signatures-no-scale-1

get_signatures(res, k = 3, scale_rows = FALSE)

plot of chunk tab-SD-NMF-get-signatures-no-scale-2

get_signatures(res, k = 4, scale_rows = FALSE)

plot of chunk tab-SD-NMF-get-signatures-no-scale-3

get_signatures(res, k = 5, scale_rows = FALSE)

plot of chunk tab-SD-NMF-get-signatures-no-scale-4

get_signatures(res, k = 6, scale_rows = FALSE)

plot of chunk tab-SD-NMF-get-signatures-no-scale-5

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk SD-NMF-signature_compare

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:

  1. which_row: row indices corresponding to the input matrix.
  2. fdr: FDR for the differential test.
  3. mean_x: The mean value in group x.
  4. scaled_mean_x: The mean value in group x after rows are scaled.
  5. 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")

plot of chunk tab-SD-NMF-dimension-reduction-1

dimension_reduction(res, k = 3, method = "UMAP")

plot of chunk tab-SD-NMF-dimension-reduction-2

dimension_reduction(res, k = 4, method = "UMAP")

plot of chunk tab-SD-NMF-dimension-reduction-3

dimension_reduction(res, k = 5, method = "UMAP")

plot of chunk tab-SD-NMF-dimension-reduction-4

dimension_reduction(res, k = 6, method = "UMAP")

plot of chunk tab-SD-NMF-dimension-reduction-5

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk SD-NMF-collect-classes

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  time(p) k
#> SD:NMF 77 6.27e-07 2
#> SD:NMF 78 2.67e-05 3
#> SD:NMF 64 3.55e-04 4
#> SD:NMF 61 3.46e-04 5
#> SD:NMF 49 2.57e-03 6

If matrix rows can be associated to genes, consider to use functional_enrichment(res, ...) to perform function enrichment for the signature genes. See this vignette for more detailed explanations.


CV:hclust

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 7758 rows and 79 columns.
#>   Top rows (776, 1552, 2328, 3103, 3879) 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)

plot of chunk CV-hclust-collect-plots

The plots are:

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:

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)

plot of chunk CV-hclust-select-partition-number

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.622           0.838       0.901         0.4786 0.507   0.507
#> 3 3 0.671           0.747       0.872         0.1817 0.962   0.926
#> 4 4 0.697           0.754       0.869         0.1033 0.886   0.763
#> 5 5 0.638           0.702       0.842         0.1268 0.940   0.840
#> 6 6 0.621           0.652       0.826         0.0413 0.993   0.978

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.

show/hide code output

cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#>          class entropy silhouette    p1    p2
#> GSM35441     2  0.3879     0.9430 0.076 0.924
#> GSM35446     2  0.6247     0.8306 0.156 0.844
#> GSM35449     2  0.3733     0.9429 0.072 0.928
#> GSM35455     2  0.3733     0.9429 0.072 0.928
#> GSM35458     2  0.6148     0.8750 0.152 0.848
#> GSM35460     2  0.6247     0.8306 0.156 0.844
#> GSM35461     1  0.9993     0.0984 0.516 0.484
#> GSM35463     2  0.3431     0.9410 0.064 0.936
#> GSM35472     1  0.9983     0.1195 0.524 0.476
#> GSM35475     2  0.3114     0.9263 0.056 0.944
#> GSM35483     2  0.3584     0.9414 0.068 0.932
#> GSM35496     1  0.3584     0.8542 0.932 0.068
#> GSM35497     2  0.3733     0.9429 0.072 0.928
#> GSM35504     2  0.3733     0.9420 0.072 0.928
#> GSM35508     2  0.2948     0.9311 0.052 0.948
#> GSM35511     2  0.3114     0.9263 0.056 0.944
#> GSM35512     1  0.9998     0.0666 0.508 0.492
#> GSM35515     2  0.6148     0.8750 0.152 0.848
#> GSM35519     1  0.9998     0.0666 0.508 0.492
#> GSM35527     2  0.2948     0.9311 0.052 0.948
#> GSM35532     2  0.3431     0.9196 0.064 0.936
#> GSM35439     2  0.3584     0.9414 0.068 0.932
#> GSM35443     1  0.1633     0.8959 0.976 0.024
#> GSM35445     1  0.0938     0.8989 0.988 0.012
#> GSM35448     2  0.6531     0.8596 0.168 0.832
#> GSM35451     1  0.1843     0.8971 0.972 0.028
#> GSM35454     1  0.1414     0.8916 0.980 0.020
#> GSM35457     2  0.4022     0.9425 0.080 0.920
#> GSM35465     2  0.6973     0.8483 0.188 0.812
#> GSM35468     1  0.1184     0.9001 0.984 0.016
#> GSM35471     1  0.4161     0.8600 0.916 0.084
#> GSM35473     1  0.0938     0.8989 0.988 0.012
#> GSM35477     1  0.1843     0.8971 0.972 0.028
#> GSM35480     1  0.0938     0.8989 0.988 0.012
#> GSM35482     1  0.3114     0.8700 0.944 0.056
#> GSM35485     2  0.3584     0.9414 0.068 0.932
#> GSM35489     2  0.4022     0.9412 0.080 0.920
#> GSM35492     1  0.1184     0.9001 0.984 0.016
#> GSM35495     2  0.8955     0.5473 0.312 0.688
#> GSM35499     2  0.4022     0.9414 0.080 0.920
#> GSM35502     1  0.1184     0.9001 0.984 0.016
#> GSM35505     1  0.1414     0.8916 0.980 0.020
#> GSM35507     1  0.9087     0.5239 0.676 0.324
#> GSM35510     2  0.3733     0.9429 0.072 0.928
#> GSM35514     1  0.1184     0.9001 0.984 0.016
#> GSM35517     2  0.3733     0.9424 0.072 0.928
#> GSM35520     2  0.4161     0.9397 0.084 0.916
#> GSM35523     1  0.3733     0.8703 0.928 0.072
#> GSM35529     2  0.4022     0.9425 0.080 0.920
#> GSM35531     2  0.4022     0.9412 0.080 0.920
#> GSM35534     2  0.3431     0.9410 0.064 0.936
#> GSM35536     1  0.1184     0.9001 0.984 0.016
#> GSM35538     1  0.1184     0.9001 0.984 0.016
#> GSM35539     1  0.1184     0.9001 0.984 0.016
#> GSM35540     2  0.6887     0.8538 0.184 0.816
#> GSM35541     2  0.3584     0.9414 0.068 0.932
#> GSM35442     1  0.1633     0.8959 0.976 0.024
#> GSM35447     1  0.1843     0.8904 0.972 0.028
#> GSM35450     1  0.1184     0.9001 0.984 0.016
#> GSM35453     1  0.0376     0.8961 0.996 0.004
#> GSM35456     1  0.4298     0.8614 0.912 0.088
#> GSM35464     1  0.9552     0.4026 0.624 0.376
#> GSM35467     1  0.1184     0.9001 0.984 0.016
#> GSM35470     1  0.1633     0.8921 0.976 0.024
#> GSM35479     1  0.3733     0.8542 0.928 0.072
#> GSM35484     1  0.1414     0.8991 0.980 0.020
#> GSM35488     1  0.1184     0.9001 0.984 0.016
#> GSM35491     1  0.1184     0.9001 0.984 0.016
#> GSM35494     1  0.3733     0.8542 0.928 0.072
#> GSM35498     1  0.9552     0.4026 0.624 0.376
#> GSM35501     1  0.1184     0.9001 0.984 0.016
#> GSM35509     1  0.8327     0.6798 0.736 0.264
#> GSM35513     1  0.1184     0.9001 0.984 0.016
#> GSM35516     2  0.4161     0.9403 0.084 0.916
#> GSM35522     1  0.3733     0.8703 0.928 0.072
#> GSM35525     1  0.1184     0.9001 0.984 0.016
#> GSM35528     1  0.1184     0.9001 0.984 0.016
#> GSM35533     1  0.1414     0.8991 0.980 0.020
#> GSM35537     1  0.3274     0.8793 0.940 0.060

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>          class entropy silhouette    p1    p2    p3
#> GSM35441     2  0.1765      0.820 0.040 0.956 0.004
#> GSM35446     3  0.0747      0.882 0.000 0.016 0.984
#> GSM35449     2  0.2297      0.819 0.036 0.944 0.020
#> GSM35455     2  0.2297      0.819 0.036 0.944 0.020
#> GSM35458     2  0.8765      0.325 0.116 0.504 0.380
#> GSM35460     3  0.0747      0.882 0.000 0.016 0.984
#> GSM35461     1  0.9306      0.161 0.480 0.348 0.172
#> GSM35463     2  0.3846      0.758 0.016 0.876 0.108
#> GSM35472     1  0.9306      0.168 0.488 0.336 0.176
#> GSM35475     2  0.6647      0.451 0.012 0.592 0.396
#> GSM35483     2  0.3910      0.760 0.020 0.876 0.104
#> GSM35496     1  0.3272      0.828 0.904 0.016 0.080
#> GSM35497     2  0.2297      0.819 0.036 0.944 0.020
#> GSM35504     2  0.5335      0.675 0.008 0.760 0.232
#> GSM35508     2  0.6737      0.477 0.016 0.600 0.384
#> GSM35511     2  0.6661      0.444 0.012 0.588 0.400
#> GSM35512     1  0.9379      0.142 0.472 0.348 0.180
#> GSM35515     2  0.8765      0.325 0.116 0.504 0.380
#> GSM35519     1  0.9379      0.142 0.472 0.348 0.180
#> GSM35527     2  0.6737      0.477 0.016 0.600 0.384
#> GSM35532     2  0.6924      0.418 0.020 0.580 0.400
#> GSM35439     2  0.1525      0.818 0.032 0.964 0.004
#> GSM35443     1  0.1170      0.875 0.976 0.016 0.008
#> GSM35445     1  0.0829      0.880 0.984 0.004 0.012
#> GSM35448     3  0.2682      0.832 0.004 0.076 0.920
#> GSM35451     1  0.0892      0.879 0.980 0.020 0.000
#> GSM35454     1  0.1411      0.869 0.964 0.000 0.036
#> GSM35457     2  0.2063      0.820 0.044 0.948 0.008
#> GSM35465     2  0.3879      0.716 0.152 0.848 0.000
#> GSM35468     1  0.0424      0.882 0.992 0.008 0.000
#> GSM35471     1  0.2537      0.838 0.920 0.080 0.000
#> GSM35473     1  0.0829      0.880 0.984 0.004 0.012
#> GSM35477     1  0.0892      0.879 0.980 0.020 0.000
#> GSM35480     1  0.0237      0.881 0.996 0.004 0.000
#> GSM35482     1  0.2773      0.850 0.928 0.024 0.048
#> GSM35485     2  0.2031      0.817 0.032 0.952 0.016
#> GSM35489     2  0.1878      0.819 0.044 0.952 0.004
#> GSM35492     1  0.0424      0.882 0.992 0.008 0.000
#> GSM35495     3  0.5292      0.727 0.172 0.028 0.800
#> GSM35499     2  0.1878      0.818 0.044 0.952 0.004
#> GSM35502     1  0.0424      0.882 0.992 0.008 0.000
#> GSM35505     1  0.1411      0.869 0.964 0.000 0.036
#> GSM35507     1  0.5859      0.494 0.656 0.344 0.000
#> GSM35510     2  0.1647      0.819 0.036 0.960 0.004
#> GSM35514     1  0.0424      0.882 0.992 0.008 0.000
#> GSM35517     2  0.1765      0.821 0.040 0.956 0.004
#> GSM35520     2  0.6007      0.705 0.044 0.764 0.192
#> GSM35523     1  0.2165      0.853 0.936 0.064 0.000
#> GSM35529     2  0.2063      0.820 0.044 0.948 0.008
#> GSM35531     2  0.1878      0.819 0.044 0.952 0.004
#> GSM35534     2  0.3461      0.785 0.024 0.900 0.076
#> GSM35536     1  0.0424      0.882 0.992 0.008 0.000
#> GSM35538     1  0.0424      0.882 0.992 0.008 0.000
#> GSM35539     1  0.0424      0.882 0.992 0.008 0.000
#> GSM35540     2  0.4047      0.719 0.148 0.848 0.004
#> GSM35541     2  0.1525      0.818 0.032 0.964 0.004
#> GSM35442     1  0.1170      0.875 0.976 0.016 0.008
#> GSM35447     1  0.1765      0.868 0.956 0.004 0.040
#> GSM35450     1  0.0424      0.882 0.992 0.008 0.000
#> GSM35453     1  0.0892      0.876 0.980 0.000 0.020
#> GSM35456     1  0.2537      0.844 0.920 0.080 0.000
#> GSM35464     1  0.6111      0.375 0.604 0.396 0.000
#> GSM35467     1  0.0424      0.882 0.992 0.008 0.000
#> GSM35470     1  0.1482      0.871 0.968 0.020 0.012
#> GSM35479     1  0.3445      0.822 0.896 0.016 0.088
#> GSM35484     1  0.0661      0.881 0.988 0.008 0.004
#> GSM35488     1  0.0424      0.882 0.992 0.008 0.000
#> GSM35491     1  0.0424      0.882 0.992 0.008 0.000
#> GSM35494     1  0.3359      0.825 0.900 0.016 0.084
#> GSM35498     1  0.6111      0.375 0.604 0.396 0.000
#> GSM35501     1  0.0424      0.882 0.992 0.008 0.000
#> GSM35509     1  0.6629      0.421 0.624 0.016 0.360
#> GSM35513     1  0.0424      0.882 0.992 0.008 0.000
#> GSM35516     2  0.1860      0.818 0.052 0.948 0.000
#> GSM35522     1  0.2165      0.853 0.936 0.064 0.000
#> GSM35525     1  0.0424      0.882 0.992 0.008 0.000
#> GSM35528     1  0.0424      0.882 0.992 0.008 0.000
#> GSM35533     1  0.0661      0.881 0.988 0.008 0.004
#> GSM35537     1  0.1860      0.862 0.948 0.052 0.000

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>          class entropy silhouette    p1    p2    p3    p4
#> GSM35441     2  0.3893      0.745 0.008 0.796 0.196 0.000
#> GSM35446     4  0.1004      0.878 0.000 0.004 0.024 0.972
#> GSM35449     2  0.4977      0.385 0.000 0.540 0.460 0.000
#> GSM35455     2  0.4977      0.385 0.000 0.540 0.460 0.000
#> GSM35458     3  0.4224      0.562 0.100 0.076 0.824 0.000
#> GSM35460     4  0.1004      0.878 0.000 0.004 0.024 0.972
#> GSM35461     3  0.5976      0.339 0.452 0.024 0.516 0.008
#> GSM35463     2  0.3486      0.729 0.000 0.864 0.044 0.092
#> GSM35472     3  0.6096      0.318 0.460 0.024 0.504 0.012
#> GSM35475     3  0.1940      0.559 0.000 0.076 0.924 0.000
#> GSM35483     2  0.3734      0.728 0.004 0.856 0.044 0.096
#> GSM35496     1  0.3301      0.842 0.876 0.000 0.048 0.076
#> GSM35497     2  0.4967      0.399 0.000 0.548 0.452 0.000
#> GSM35504     2  0.5363      0.597 0.000 0.720 0.064 0.216
#> GSM35508     3  0.2921      0.538 0.000 0.140 0.860 0.000
#> GSM35511     3  0.2125      0.558 0.000 0.076 0.920 0.004
#> GSM35512     3  0.6082      0.358 0.444 0.024 0.520 0.012
#> GSM35515     3  0.4224      0.562 0.100 0.076 0.824 0.000
#> GSM35519     3  0.6082      0.358 0.444 0.024 0.520 0.012
#> GSM35527     3  0.2921      0.538 0.000 0.140 0.860 0.000
#> GSM35532     3  0.2234      0.556 0.004 0.064 0.924 0.008
#> GSM35439     2  0.0524      0.813 0.008 0.988 0.004 0.000
#> GSM35443     1  0.1305      0.904 0.960 0.000 0.036 0.004
#> GSM35445     1  0.0657      0.913 0.984 0.000 0.012 0.004
#> GSM35448     4  0.2089      0.840 0.000 0.048 0.020 0.932
#> GSM35451     1  0.0592      0.913 0.984 0.016 0.000 0.000
#> GSM35454     1  0.1510      0.903 0.956 0.000 0.016 0.028
#> GSM35457     2  0.3636      0.760 0.008 0.820 0.172 0.000
#> GSM35465     2  0.5121      0.690 0.116 0.764 0.120 0.000
#> GSM35468     1  0.0188      0.917 0.996 0.004 0.000 0.000
#> GSM35471     1  0.1940      0.866 0.924 0.076 0.000 0.000
#> GSM35473     1  0.0657      0.913 0.984 0.000 0.012 0.004
#> GSM35477     1  0.0592      0.913 0.984 0.016 0.000 0.000
#> GSM35480     1  0.0000      0.916 1.000 0.000 0.000 0.000
#> GSM35482     1  0.2759      0.869 0.904 0.000 0.052 0.044
#> GSM35485     2  0.0992      0.811 0.008 0.976 0.012 0.004
#> GSM35489     2  0.1042      0.815 0.020 0.972 0.008 0.000
#> GSM35492     1  0.0188      0.917 0.996 0.004 0.000 0.000
#> GSM35495     4  0.4485      0.674 0.152 0.000 0.052 0.796
#> GSM35499     2  0.1411      0.816 0.020 0.960 0.020 0.000
#> GSM35502     1  0.0188      0.917 0.996 0.004 0.000 0.000
#> GSM35505     1  0.1510      0.903 0.956 0.000 0.016 0.028
#> GSM35507     1  0.5925      0.408 0.648 0.284 0.068 0.000
#> GSM35510     2  0.1284      0.816 0.012 0.964 0.024 0.000
#> GSM35514     1  0.0188      0.917 0.996 0.004 0.000 0.000
#> GSM35517     2  0.1151      0.814 0.024 0.968 0.008 0.000
#> GSM35520     2  0.5184      0.579 0.024 0.672 0.304 0.000
#> GSM35523     1  0.2131      0.876 0.932 0.032 0.036 0.000
#> GSM35529     2  0.3636      0.760 0.008 0.820 0.172 0.000
#> GSM35531     2  0.1042      0.815 0.020 0.972 0.008 0.000
#> GSM35534     2  0.2443      0.771 0.000 0.916 0.024 0.060
#> GSM35536     1  0.0188      0.917 0.996 0.004 0.000 0.000
#> GSM35538     1  0.0188      0.917 0.996 0.004 0.000 0.000
#> GSM35539     1  0.0188      0.917 0.996 0.004 0.000 0.000
#> GSM35540     2  0.5266      0.684 0.108 0.752 0.140 0.000
#> GSM35541     2  0.0524      0.813 0.008 0.988 0.004 0.000
#> GSM35442     1  0.1305      0.904 0.960 0.000 0.036 0.004
#> GSM35447     1  0.1733      0.900 0.948 0.000 0.024 0.028
#> GSM35450     1  0.0188      0.917 0.996 0.004 0.000 0.000
#> GSM35453     1  0.1059      0.909 0.972 0.000 0.012 0.016
#> GSM35456     1  0.2334      0.856 0.908 0.088 0.004 0.000
#> GSM35464     1  0.6519      0.262 0.584 0.320 0.096 0.000
#> GSM35467     1  0.0188      0.917 0.996 0.004 0.000 0.000
#> GSM35470     1  0.1576      0.898 0.948 0.000 0.048 0.004
#> GSM35479     1  0.3439      0.834 0.868 0.000 0.048 0.084
#> GSM35484     1  0.0376      0.916 0.992 0.004 0.000 0.004
#> GSM35488     1  0.0188      0.917 0.996 0.004 0.000 0.000
#> GSM35491     1  0.0188      0.917 0.996 0.004 0.000 0.000
#> GSM35494     1  0.3370      0.838 0.872 0.000 0.048 0.080
#> GSM35498     1  0.6519      0.262 0.584 0.320 0.096 0.000
#> GSM35501     1  0.0188      0.917 0.996 0.004 0.000 0.000
#> GSM35509     1  0.5855      0.398 0.600 0.000 0.044 0.356
#> GSM35513     1  0.0188      0.917 0.996 0.004 0.000 0.000
#> GSM35516     2  0.1452      0.810 0.036 0.956 0.008 0.000
#> GSM35522     1  0.2131      0.876 0.932 0.032 0.036 0.000
#> GSM35525     1  0.0188      0.917 0.996 0.004 0.000 0.000
#> GSM35528     1  0.0188      0.917 0.996 0.004 0.000 0.000
#> GSM35533     1  0.0376      0.916 0.992 0.004 0.000 0.004
#> GSM35537     1  0.1837      0.888 0.944 0.028 0.028 0.000

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>          class entropy silhouette    p1    p2    p3    p4    p5
#> GSM35441     2  0.3565      0.744 0.000 0.800 0.024 0.000 0.176
#> GSM35446     4  0.1608      0.894 0.000 0.000 0.072 0.928 0.000
#> GSM35449     2  0.4655      0.318 0.000 0.512 0.012 0.000 0.476
#> GSM35455     2  0.4653      0.326 0.000 0.516 0.012 0.000 0.472
#> GSM35458     5  0.2965      0.660 0.084 0.028 0.012 0.000 0.876
#> GSM35460     4  0.1608      0.894 0.000 0.000 0.072 0.928 0.000
#> GSM35461     5  0.6349      0.343 0.212 0.000 0.268 0.000 0.520
#> GSM35463     2  0.4214      0.696 0.000 0.788 0.088 0.120 0.004
#> GSM35472     5  0.6380      0.326 0.204 0.000 0.288 0.000 0.508
#> GSM35475     5  0.0404      0.666 0.000 0.012 0.000 0.000 0.988
#> GSM35483     2  0.4519      0.676 0.000 0.764 0.120 0.112 0.004
#> GSM35496     3  0.2970      0.819 0.168 0.000 0.828 0.000 0.004
#> GSM35497     2  0.4641      0.357 0.000 0.532 0.012 0.000 0.456
#> GSM35504     2  0.5724      0.527 0.000 0.640 0.076 0.260 0.024
#> GSM35508     5  0.2077      0.640 0.000 0.084 0.008 0.000 0.908
#> GSM35511     5  0.0566      0.666 0.000 0.012 0.004 0.000 0.984
#> GSM35512     5  0.6319      0.357 0.204 0.000 0.272 0.000 0.524
#> GSM35515     5  0.2965      0.660 0.084 0.028 0.012 0.000 0.876
#> GSM35519     5  0.6319      0.357 0.204 0.000 0.272 0.000 0.524
#> GSM35527     5  0.2077      0.640 0.000 0.084 0.008 0.000 0.908
#> GSM35532     5  0.0798      0.666 0.000 0.008 0.016 0.000 0.976
#> GSM35439     2  0.0486      0.804 0.000 0.988 0.004 0.004 0.004
#> GSM35443     1  0.3496      0.717 0.788 0.000 0.200 0.000 0.012
#> GSM35445     1  0.2284      0.809 0.896 0.000 0.096 0.004 0.004
#> GSM35448     4  0.0162      0.852 0.000 0.000 0.004 0.996 0.000
#> GSM35451     1  0.0566      0.844 0.984 0.012 0.004 0.000 0.000
#> GSM35454     1  0.4305      0.541 0.688 0.000 0.296 0.004 0.012
#> GSM35457     2  0.3398      0.763 0.004 0.828 0.024 0.000 0.144
#> GSM35465     2  0.4810      0.724 0.056 0.776 0.080 0.000 0.088
#> GSM35468     1  0.1410      0.836 0.940 0.000 0.060 0.000 0.000
#> GSM35471     1  0.2172      0.802 0.908 0.076 0.016 0.000 0.000
#> GSM35473     1  0.2052      0.819 0.912 0.000 0.080 0.004 0.004
#> GSM35477     1  0.0566      0.844 0.984 0.012 0.004 0.000 0.000
#> GSM35480     1  0.0162      0.844 0.996 0.000 0.004 0.000 0.000
#> GSM35482     3  0.4456      0.642 0.320 0.000 0.660 0.000 0.020
#> GSM35485     2  0.0671      0.802 0.000 0.980 0.016 0.004 0.000
#> GSM35489     2  0.1016      0.806 0.012 0.972 0.004 0.004 0.008
#> GSM35492     1  0.1671      0.828 0.924 0.000 0.076 0.000 0.000
#> GSM35495     4  0.3970      0.692 0.020 0.000 0.236 0.744 0.000
#> GSM35499     2  0.0960      0.806 0.008 0.972 0.016 0.000 0.004
#> GSM35502     1  0.0162      0.844 0.996 0.000 0.004 0.000 0.000
#> GSM35505     1  0.4305      0.541 0.688 0.000 0.296 0.004 0.012
#> GSM35507     1  0.6229      0.348 0.588 0.292 0.080 0.000 0.040
#> GSM35510     2  0.0854      0.806 0.004 0.976 0.012 0.000 0.008
#> GSM35514     1  0.0000      0.843 1.000 0.000 0.000 0.000 0.000
#> GSM35517     2  0.0510      0.805 0.016 0.984 0.000 0.000 0.000
#> GSM35520     2  0.4280      0.555 0.008 0.676 0.004 0.000 0.312
#> GSM35523     1  0.3161      0.773 0.860 0.032 0.100 0.000 0.008
#> GSM35529     2  0.3398      0.763 0.004 0.828 0.024 0.000 0.144
#> GSM35531     2  0.1016      0.806 0.012 0.972 0.004 0.004 0.008
#> GSM35534     2  0.3033      0.754 0.000 0.864 0.052 0.084 0.000
#> GSM35536     1  0.0510      0.846 0.984 0.000 0.016 0.000 0.000
#> GSM35538     1  0.0404      0.844 0.988 0.000 0.012 0.000 0.000
#> GSM35539     1  0.0162      0.844 0.996 0.000 0.004 0.000 0.000
#> GSM35540     2  0.4972      0.719 0.044 0.760 0.088 0.000 0.108
#> GSM35541     2  0.0486      0.804 0.000 0.988 0.004 0.004 0.004
#> GSM35442     1  0.3628      0.695 0.772 0.000 0.216 0.000 0.012
#> GSM35447     1  0.4492      0.526 0.680 0.000 0.296 0.004 0.020
#> GSM35450     1  0.0162      0.844 0.996 0.000 0.004 0.000 0.000
#> GSM35453     1  0.2877      0.766 0.848 0.000 0.144 0.004 0.004
#> GSM35456     1  0.2170      0.793 0.904 0.088 0.004 0.000 0.004
#> GSM35464     1  0.6818      0.218 0.516 0.332 0.088 0.000 0.064
#> GSM35467     1  0.0162      0.844 0.996 0.000 0.004 0.000 0.000
#> GSM35470     1  0.4213      0.532 0.680 0.000 0.308 0.000 0.012
#> GSM35479     3  0.3250      0.818 0.168 0.000 0.820 0.008 0.004
#> GSM35484     1  0.1116      0.841 0.964 0.004 0.028 0.004 0.000
#> GSM35488     1  0.1197      0.841 0.952 0.000 0.048 0.000 0.000
#> GSM35491     1  0.1671      0.828 0.924 0.000 0.076 0.000 0.000
#> GSM35494     3  0.3128      0.819 0.168 0.000 0.824 0.004 0.004
#> GSM35498     1  0.6818      0.218 0.516 0.332 0.088 0.000 0.064
#> GSM35501     1  0.0162      0.844 0.996 0.000 0.004 0.000 0.000
#> GSM35509     3  0.5192      0.394 0.076 0.000 0.644 0.280 0.000
#> GSM35513     1  0.0162      0.844 0.996 0.000 0.004 0.000 0.000
#> GSM35516     2  0.0794      0.801 0.028 0.972 0.000 0.000 0.000
#> GSM35522     1  0.3161      0.773 0.860 0.032 0.100 0.000 0.008
#> GSM35525     1  0.0510      0.845 0.984 0.000 0.016 0.000 0.000
#> GSM35528     1  0.1197      0.841 0.952 0.000 0.048 0.000 0.000
#> GSM35533     1  0.1116      0.841 0.964 0.004 0.028 0.004 0.000
#> GSM35537     1  0.3023      0.782 0.868 0.028 0.096 0.000 0.008

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>          class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM35441     2  0.3332     0.6792 0.000 0.808 0.000 0.048 0.144 0.000
#> GSM35446     6  0.0937     0.8820 0.000 0.000 0.040 0.000 0.000 0.960
#> GSM35449     2  0.4705     0.3517 0.000 0.520 0.000 0.036 0.440 0.004
#> GSM35455     2  0.4701     0.3598 0.000 0.524 0.000 0.036 0.436 0.004
#> GSM35458     5  0.2770     0.6339 0.068 0.024 0.004 0.024 0.880 0.000
#> GSM35460     6  0.0937     0.8820 0.000 0.000 0.040 0.000 0.000 0.960
#> GSM35461     5  0.6274     0.3849 0.168 0.000 0.292 0.036 0.504 0.000
#> GSM35463     2  0.4076     0.0585 0.000 0.592 0.000 0.396 0.000 0.012
#> GSM35472     5  0.6270     0.3654 0.160 0.000 0.308 0.036 0.496 0.000
#> GSM35475     5  0.0260     0.6428 0.000 0.008 0.000 0.000 0.992 0.000
#> GSM35483     4  0.3012     0.0000 0.000 0.196 0.000 0.796 0.000 0.008
#> GSM35496     3  0.1528     0.8001 0.012 0.000 0.944 0.016 0.000 0.028
#> GSM35497     2  0.4682     0.3898 0.000 0.540 0.000 0.036 0.420 0.004
#> GSM35504     2  0.5988    -0.2613 0.000 0.488 0.000 0.340 0.016 0.156
#> GSM35508     5  0.2579     0.5858 0.000 0.088 0.000 0.032 0.876 0.004
#> GSM35511     5  0.0146     0.6427 0.000 0.004 0.000 0.000 0.996 0.000
#> GSM35512     5  0.6223     0.3930 0.160 0.000 0.292 0.036 0.512 0.000
#> GSM35515     5  0.2770     0.6339 0.068 0.024 0.004 0.024 0.880 0.000
#> GSM35519     5  0.6223     0.3930 0.160 0.000 0.292 0.036 0.512 0.000
#> GSM35527     5  0.2579     0.5858 0.000 0.088 0.000 0.032 0.876 0.004
#> GSM35532     5  0.0508     0.6428 0.000 0.000 0.012 0.004 0.984 0.000
#> GSM35439     2  0.0363     0.7219 0.000 0.988 0.000 0.012 0.000 0.000
#> GSM35443     1  0.3878     0.7082 0.736 0.000 0.228 0.032 0.004 0.000
#> GSM35445     1  0.2983     0.7880 0.832 0.000 0.136 0.032 0.000 0.000
#> GSM35448     6  0.1007     0.8208 0.000 0.000 0.000 0.044 0.000 0.956
#> GSM35451     1  0.0725     0.8369 0.976 0.012 0.000 0.012 0.000 0.000
#> GSM35454     1  0.5033     0.4746 0.572 0.000 0.364 0.052 0.008 0.004
#> GSM35457     2  0.3078     0.6963 0.000 0.836 0.000 0.056 0.108 0.000
#> GSM35465     2  0.4481     0.6484 0.032 0.784 0.040 0.092 0.052 0.000
#> GSM35468     1  0.2088     0.8209 0.904 0.000 0.068 0.028 0.000 0.000
#> GSM35471     1  0.2395     0.8079 0.892 0.076 0.012 0.020 0.000 0.000
#> GSM35473     1  0.2633     0.8066 0.864 0.000 0.104 0.032 0.000 0.000
#> GSM35477     1  0.0725     0.8369 0.976 0.012 0.000 0.012 0.000 0.000
#> GSM35480     1  0.0717     0.8359 0.976 0.000 0.008 0.016 0.000 0.000
#> GSM35482     3  0.3385     0.5703 0.172 0.000 0.796 0.028 0.004 0.000
#> GSM35485     2  0.0937     0.7133 0.000 0.960 0.000 0.040 0.000 0.000
#> GSM35489     2  0.1007     0.7224 0.008 0.968 0.004 0.016 0.004 0.000
#> GSM35492     1  0.2309     0.8129 0.888 0.000 0.084 0.028 0.000 0.000
#> GSM35495     6  0.3161     0.6920 0.000 0.000 0.216 0.008 0.000 0.776
#> GSM35499     2  0.1065     0.7241 0.008 0.964 0.008 0.020 0.000 0.000
#> GSM35502     1  0.0291     0.8365 0.992 0.000 0.004 0.004 0.000 0.000
#> GSM35505     1  0.5033     0.4746 0.572 0.000 0.364 0.052 0.008 0.004
#> GSM35507     1  0.6125     0.4189 0.564 0.296 0.040 0.076 0.024 0.000
#> GSM35510     2  0.0837     0.7245 0.004 0.972 0.004 0.020 0.000 0.000
#> GSM35514     1  0.0146     0.8356 0.996 0.000 0.000 0.004 0.000 0.000
#> GSM35517     2  0.0717     0.7218 0.016 0.976 0.000 0.008 0.000 0.000
#> GSM35520     2  0.4052     0.4319 0.004 0.676 0.008 0.008 0.304 0.000
#> GSM35523     1  0.3504     0.7626 0.832 0.032 0.060 0.076 0.000 0.000
#> GSM35529     2  0.3078     0.6963 0.000 0.836 0.000 0.056 0.108 0.000
#> GSM35531     2  0.1007     0.7224 0.008 0.968 0.004 0.016 0.004 0.000
#> GSM35534     2  0.2980     0.5596 0.000 0.800 0.000 0.192 0.000 0.008
#> GSM35536     1  0.0820     0.8386 0.972 0.000 0.016 0.012 0.000 0.000
#> GSM35538     1  0.0622     0.8372 0.980 0.000 0.008 0.012 0.000 0.000
#> GSM35539     1  0.0405     0.8369 0.988 0.000 0.004 0.008 0.000 0.000
#> GSM35540     2  0.4664     0.6483 0.020 0.768 0.048 0.092 0.072 0.000
#> GSM35541     2  0.0458     0.7208 0.000 0.984 0.000 0.016 0.000 0.000
#> GSM35442     1  0.3979     0.6901 0.720 0.000 0.244 0.032 0.004 0.000
#> GSM35447     1  0.5206     0.4599 0.564 0.000 0.364 0.052 0.016 0.004
#> GSM35450     1  0.0363     0.8356 0.988 0.000 0.000 0.012 0.000 0.000
#> GSM35453     1  0.3621     0.7353 0.772 0.000 0.192 0.032 0.000 0.004
#> GSM35456     1  0.2432     0.8054 0.888 0.080 0.008 0.024 0.000 0.000
#> GSM35464     1  0.6694     0.2871 0.488 0.340 0.048 0.084 0.040 0.000
#> GSM35467     1  0.0291     0.8365 0.992 0.000 0.004 0.004 0.000 0.000
#> GSM35470     1  0.4495     0.4773 0.580 0.000 0.388 0.028 0.004 0.000
#> GSM35479     3  0.1750     0.7978 0.012 0.000 0.932 0.016 0.000 0.040
#> GSM35484     1  0.1793     0.8311 0.928 0.004 0.032 0.036 0.000 0.000
#> GSM35488     1  0.1845     0.8267 0.920 0.000 0.052 0.028 0.000 0.000
#> GSM35491     1  0.2309     0.8129 0.888 0.000 0.084 0.028 0.000 0.000
#> GSM35494     3  0.1605     0.8008 0.012 0.000 0.940 0.016 0.000 0.032
#> GSM35498     1  0.6694     0.2871 0.488 0.340 0.048 0.084 0.040 0.000
#> GSM35501     1  0.0405     0.8372 0.988 0.000 0.004 0.008 0.000 0.000
#> GSM35509     3  0.3707     0.4563 0.000 0.000 0.680 0.008 0.000 0.312
#> GSM35513     1  0.0291     0.8365 0.992 0.000 0.004 0.004 0.000 0.000
#> GSM35516     2  0.1074     0.7149 0.028 0.960 0.000 0.012 0.000 0.000
#> GSM35522     1  0.3504     0.7626 0.832 0.032 0.060 0.076 0.000 0.000
#> GSM35525     1  0.0603     0.8367 0.980 0.000 0.016 0.004 0.000 0.000
#> GSM35528     1  0.1845     0.8267 0.920 0.000 0.052 0.028 0.000 0.000
#> GSM35533     1  0.1793     0.8311 0.928 0.004 0.032 0.036 0.000 0.000
#> GSM35537     1  0.3378     0.7691 0.840 0.028 0.064 0.068 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)

plot of chunk tab-CV-hclust-consensus-heatmap-1

consensus_heatmap(res, k = 3)

plot of chunk tab-CV-hclust-consensus-heatmap-2

consensus_heatmap(res, k = 4)

plot of chunk tab-CV-hclust-consensus-heatmap-3

consensus_heatmap(res, k = 5)

plot of chunk tab-CV-hclust-consensus-heatmap-4

consensus_heatmap(res, k = 6)

plot of chunk tab-CV-hclust-consensus-heatmap-5

Heatmaps for the membership of samples in all partitions to see how consistent they are:

membership_heatmap(res, k = 2)

plot of chunk tab-CV-hclust-membership-heatmap-1

membership_heatmap(res, k = 3)

plot of chunk tab-CV-hclust-membership-heatmap-2

membership_heatmap(res, k = 4)

plot of chunk tab-CV-hclust-membership-heatmap-3

membership_heatmap(res, k = 5)

plot of chunk tab-CV-hclust-membership-heatmap-4

membership_heatmap(res, k = 6)

plot of chunk tab-CV-hclust-membership-heatmap-5

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)

plot of chunk tab-CV-hclust-get-signatures-1

get_signatures(res, k = 3)

plot of chunk tab-CV-hclust-get-signatures-2

get_signatures(res, k = 4)

plot of chunk tab-CV-hclust-get-signatures-3

get_signatures(res, k = 5)

plot of chunk tab-CV-hclust-get-signatures-4

get_signatures(res, k = 6)

plot of chunk tab-CV-hclust-get-signatures-5

Signature heatmaps where rows are not scaled:

get_signatures(res, k = 2, scale_rows = FALSE)

plot of chunk tab-CV-hclust-get-signatures-no-scale-1

get_signatures(res, k = 3, scale_rows = FALSE)

plot of chunk tab-CV-hclust-get-signatures-no-scale-2

get_signatures(res, k = 4, scale_rows = FALSE)

plot of chunk tab-CV-hclust-get-signatures-no-scale-3

get_signatures(res, k = 5, scale_rows = FALSE)

plot of chunk tab-CV-hclust-get-signatures-no-scale-4

get_signatures(res, k = 6, scale_rows = FALSE)

plot of chunk tab-CV-hclust-get-signatures-no-scale-5

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk CV-hclust-signature_compare

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:

  1. which_row: row indices corresponding to the input matrix.
  2. fdr: FDR for the differential test.
  3. mean_x: The mean value in group x.
  4. scaled_mean_x: The mean value in group x after rows are scaled.
  5. 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")

plot of chunk tab-CV-hclust-dimension-reduction-1

dimension_reduction(res, k = 3, method = "UMAP")

plot of chunk tab-CV-hclust-dimension-reduction-2

dimension_reduction(res, k = 4, method = "UMAP")

plot of chunk tab-CV-hclust-dimension-reduction-3

dimension_reduction(res, k = 5, method = "UMAP")

plot of chunk tab-CV-hclust-dimension-reduction-4

dimension_reduction(res, k = 6, method = "UMAP")

plot of chunk tab-CV-hclust-dimension-reduction-5

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk CV-hclust-collect-classes

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  time(p) k
#> CV:hclust 73 2.65e-07 2
#> CV:hclust 64 1.94e-04 3
#> CV:hclust 68 1.68e-08 4
#> CV:hclust 68 7.03e-08 5
#> CV:hclust 60 1.25e-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.


CV:kmeans**

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 7758 rows and 79 columns.
#>   Top rows (776, 1552, 2328, 3103, 3879) 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)

plot of chunk CV-kmeans-collect-plots

The plots are:

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:

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)

plot of chunk CV-kmeans-select-partition-number

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.514           0.898       0.914         0.4911 0.498   0.498
#> 3 3 1.000           0.969       0.979         0.3353 0.794   0.607
#> 4 4 0.743           0.775       0.851         0.1033 0.938   0.823
#> 5 5 0.672           0.598       0.762         0.0768 0.932   0.769
#> 6 6 0.664           0.466       0.713         0.0463 0.917   0.672

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.

show/hide code output

cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#>          class entropy silhouette    p1    p2
#> GSM35441     2  0.7299      0.903 0.204 0.796
#> GSM35446     2  0.0000      0.859 0.000 1.000
#> GSM35449     2  0.7299      0.903 0.204 0.796
#> GSM35455     2  0.7299      0.903 0.204 0.796
#> GSM35458     2  0.7219      0.904 0.200 0.800
#> GSM35460     2  0.0000      0.859 0.000 1.000
#> GSM35461     1  0.7056      0.826 0.808 0.192
#> GSM35463     2  0.6973      0.904 0.188 0.812
#> GSM35472     2  0.1414      0.859 0.020 0.980
#> GSM35475     2  0.2236      0.873 0.036 0.964
#> GSM35483     2  0.4022      0.888 0.080 0.920
#> GSM35496     1  0.7056      0.826 0.808 0.192
#> GSM35497     2  0.7299      0.903 0.204 0.796
#> GSM35504     2  0.0376      0.861 0.004 0.996
#> GSM35508     2  0.2236      0.873 0.036 0.964
#> GSM35511     2  0.0938      0.861 0.012 0.988
#> GSM35512     2  0.1414      0.859 0.020 0.980
#> GSM35515     2  0.6712      0.903 0.176 0.824
#> GSM35519     2  0.0938      0.861 0.012 0.988
#> GSM35527     2  0.2603      0.876 0.044 0.956
#> GSM35532     2  0.0938      0.861 0.012 0.988
#> GSM35439     2  0.7219      0.903 0.200 0.800
#> GSM35443     1  0.0000      0.935 1.000 0.000
#> GSM35445     1  0.2603      0.923 0.956 0.044
#> GSM35448     2  0.0000      0.859 0.000 1.000
#> GSM35451     1  0.0376      0.935 0.996 0.004
#> GSM35454     1  0.7219      0.828 0.800 0.200
#> GSM35457     2  0.7219      0.903 0.200 0.800
#> GSM35465     2  0.7219      0.903 0.200 0.800
#> GSM35468     1  0.0000      0.935 1.000 0.000
#> GSM35471     1  0.0672      0.933 0.992 0.008
#> GSM35473     1  0.2603      0.923 0.956 0.044
#> GSM35477     1  0.0376      0.935 0.996 0.004
#> GSM35480     1  0.1633      0.930 0.976 0.024
#> GSM35482     1  0.7139      0.827 0.804 0.196
#> GSM35485     2  0.7056      0.904 0.192 0.808
#> GSM35489     2  0.7219      0.903 0.200 0.800
#> GSM35492     1  0.0000      0.935 1.000 0.000
#> GSM35495     1  0.7299      0.825 0.796 0.204
#> GSM35499     2  0.7056      0.904 0.192 0.808
#> GSM35502     1  0.0000      0.935 1.000 0.000
#> GSM35505     1  0.7299      0.825 0.796 0.204
#> GSM35507     1  0.0376      0.935 0.996 0.004
#> GSM35510     2  0.7056      0.904 0.192 0.808
#> GSM35514     1  0.0000      0.935 1.000 0.000
#> GSM35517     2  0.7139      0.904 0.196 0.804
#> GSM35520     2  0.2236      0.875 0.036 0.964
#> GSM35523     1  0.0376      0.935 0.996 0.004
#> GSM35529     2  0.7219      0.903 0.200 0.800
#> GSM35531     2  0.7139      0.904 0.196 0.804
#> GSM35534     2  0.6973      0.904 0.188 0.812
#> GSM35536     1  0.0000      0.935 1.000 0.000
#> GSM35538     1  0.0000      0.935 1.000 0.000
#> GSM35539     1  0.0376      0.935 0.996 0.004
#> GSM35540     2  0.2603      0.877 0.044 0.956
#> GSM35541     2  0.7139      0.904 0.196 0.804
#> GSM35442     1  0.4815      0.887 0.896 0.104
#> GSM35447     1  0.7376      0.823 0.792 0.208
#> GSM35450     1  0.0376      0.935 0.996 0.004
#> GSM35453     1  0.4298      0.902 0.912 0.088
#> GSM35456     1  0.0938      0.932 0.988 0.012
#> GSM35464     2  0.7815      0.875 0.232 0.768
#> GSM35467     1  0.0000      0.935 1.000 0.000
#> GSM35470     1  0.2948      0.917 0.948 0.052
#> GSM35479     1  0.7299      0.825 0.796 0.204
#> GSM35484     1  0.0938      0.932 0.988 0.012
#> GSM35488     1  0.0000      0.935 1.000 0.000
#> GSM35491     1  0.0000      0.935 1.000 0.000
#> GSM35494     1  0.7299      0.825 0.796 0.204
#> GSM35498     1  0.0376      0.935 0.996 0.004
#> GSM35501     1  0.0000      0.935 1.000 0.000
#> GSM35509     1  0.7299      0.825 0.796 0.204
#> GSM35513     1  0.0000      0.935 1.000 0.000
#> GSM35516     2  0.7139      0.904 0.196 0.804
#> GSM35522     1  0.0376      0.935 0.996 0.004
#> GSM35525     1  0.0000      0.935 1.000 0.000
#> GSM35528     1  0.0000      0.935 1.000 0.000
#> GSM35533     1  0.0938      0.932 0.988 0.012
#> GSM35537     1  0.1414      0.931 0.980 0.020

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>          class entropy silhouette    p1    p2    p3
#> GSM35441     2  0.0424      0.981 0.000 0.992 0.008
#> GSM35446     3  0.0892      0.963 0.000 0.020 0.980
#> GSM35449     2  0.1031      0.976 0.000 0.976 0.024
#> GSM35455     2  0.0892      0.977 0.000 0.980 0.020
#> GSM35458     2  0.1031      0.976 0.000 0.976 0.024
#> GSM35460     3  0.0892      0.963 0.000 0.020 0.980
#> GSM35461     3  0.2187      0.960 0.028 0.024 0.948
#> GSM35463     2  0.1289      0.974 0.000 0.968 0.032
#> GSM35472     3  0.1289      0.960 0.000 0.032 0.968
#> GSM35475     2  0.1163      0.974 0.000 0.972 0.028
#> GSM35483     2  0.1289      0.974 0.000 0.968 0.032
#> GSM35496     3  0.1585      0.963 0.028 0.008 0.964
#> GSM35497     2  0.1031      0.976 0.000 0.976 0.024
#> GSM35504     2  0.1411      0.972 0.000 0.964 0.036
#> GSM35508     2  0.1031      0.976 0.000 0.976 0.024
#> GSM35511     3  0.2625      0.922 0.000 0.084 0.916
#> GSM35512     3  0.1289      0.960 0.000 0.032 0.968
#> GSM35515     2  0.1031      0.976 0.000 0.976 0.024
#> GSM35519     3  0.1529      0.957 0.000 0.040 0.960
#> GSM35527     2  0.1031      0.976 0.000 0.976 0.024
#> GSM35532     3  0.1289      0.960 0.000 0.032 0.968
#> GSM35439     2  0.0424      0.982 0.000 0.992 0.008
#> GSM35443     1  0.0000      0.985 1.000 0.000 0.000
#> GSM35445     1  0.0000      0.985 1.000 0.000 0.000
#> GSM35448     3  0.1031      0.962 0.000 0.024 0.976
#> GSM35451     1  0.0000      0.985 1.000 0.000 0.000
#> GSM35454     3  0.1129      0.968 0.020 0.004 0.976
#> GSM35457     2  0.0237      0.982 0.000 0.996 0.004
#> GSM35465     2  0.0237      0.982 0.000 0.996 0.004
#> GSM35468     1  0.0000      0.985 1.000 0.000 0.000
#> GSM35471     1  0.0000      0.985 1.000 0.000 0.000
#> GSM35473     1  0.0000      0.985 1.000 0.000 0.000
#> GSM35477     1  0.0000      0.985 1.000 0.000 0.000
#> GSM35480     1  0.0000      0.985 1.000 0.000 0.000
#> GSM35482     3  0.1964      0.952 0.056 0.000 0.944
#> GSM35485     2  0.1289      0.974 0.000 0.968 0.032
#> GSM35489     2  0.0237      0.982 0.000 0.996 0.004
#> GSM35492     1  0.0000      0.985 1.000 0.000 0.000
#> GSM35495     3  0.1170      0.966 0.008 0.016 0.976
#> GSM35499     2  0.1289      0.974 0.000 0.968 0.032
#> GSM35502     1  0.0000      0.985 1.000 0.000 0.000
#> GSM35505     3  0.1129      0.968 0.020 0.004 0.976
#> GSM35507     1  0.5988      0.411 0.632 0.368 0.000
#> GSM35510     2  0.1289      0.974 0.000 0.968 0.032
#> GSM35514     1  0.0000      0.985 1.000 0.000 0.000
#> GSM35517     2  0.0592      0.981 0.000 0.988 0.012
#> GSM35520     2  0.0592      0.981 0.000 0.988 0.012
#> GSM35523     1  0.0000      0.985 1.000 0.000 0.000
#> GSM35529     2  0.0237      0.982 0.000 0.996 0.004
#> GSM35531     2  0.0747      0.980 0.000 0.984 0.016
#> GSM35534     2  0.1289      0.974 0.000 0.968 0.032
#> GSM35536     1  0.0000      0.985 1.000 0.000 0.000
#> GSM35538     1  0.0000      0.985 1.000 0.000 0.000
#> GSM35539     1  0.0000      0.985 1.000 0.000 0.000
#> GSM35540     2  0.0237      0.982 0.000 0.996 0.004
#> GSM35541     2  0.0592      0.981 0.000 0.988 0.012
#> GSM35442     1  0.1031      0.964 0.976 0.000 0.024
#> GSM35447     3  0.1129      0.968 0.020 0.004 0.976
#> GSM35450     1  0.0000      0.985 1.000 0.000 0.000
#> GSM35453     1  0.0747      0.972 0.984 0.000 0.016
#> GSM35456     1  0.0000      0.985 1.000 0.000 0.000
#> GSM35464     2  0.0747      0.975 0.016 0.984 0.000
#> GSM35467     1  0.0000      0.985 1.000 0.000 0.000
#> GSM35470     1  0.0592      0.975 0.988 0.000 0.012
#> GSM35479     3  0.1964      0.952 0.056 0.000 0.944
#> GSM35484     1  0.0000      0.985 1.000 0.000 0.000
#> GSM35488     1  0.0000      0.985 1.000 0.000 0.000
#> GSM35491     1  0.0000      0.985 1.000 0.000 0.000
#> GSM35494     3  0.1964      0.952 0.056 0.000 0.944
#> GSM35498     1  0.0000      0.985 1.000 0.000 0.000
#> GSM35501     1  0.0000      0.985 1.000 0.000 0.000
#> GSM35509     3  0.1170      0.967 0.016 0.008 0.976
#> GSM35513     1  0.0000      0.985 1.000 0.000 0.000
#> GSM35516     2  0.0747      0.980 0.000 0.984 0.016
#> GSM35522     1  0.0000      0.985 1.000 0.000 0.000
#> GSM35525     1  0.0000      0.985 1.000 0.000 0.000
#> GSM35528     1  0.0000      0.985 1.000 0.000 0.000
#> GSM35533     1  0.0000      0.985 1.000 0.000 0.000
#> GSM35537     1  0.0000      0.985 1.000 0.000 0.000

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>          class entropy silhouette    p1    p2    p3    p4
#> GSM35441     2  0.2011      0.831 0.000 0.920 0.000 0.080
#> GSM35446     3  0.1118      0.916 0.000 0.000 0.964 0.036
#> GSM35449     2  0.4477      0.460 0.000 0.688 0.000 0.312
#> GSM35455     2  0.4134      0.580 0.000 0.740 0.000 0.260
#> GSM35458     4  0.5070      0.462 0.000 0.416 0.004 0.580
#> GSM35460     3  0.1022      0.917 0.000 0.000 0.968 0.032
#> GSM35461     4  0.5873      0.163 0.036 0.000 0.416 0.548
#> GSM35463     2  0.2124      0.828 0.000 0.924 0.008 0.068
#> GSM35472     3  0.3870      0.739 0.000 0.004 0.788 0.208
#> GSM35475     4  0.5386      0.509 0.000 0.368 0.020 0.612
#> GSM35483     2  0.2124      0.828 0.000 0.924 0.008 0.068
#> GSM35496     3  0.2401      0.881 0.004 0.000 0.904 0.092
#> GSM35497     2  0.4477      0.460 0.000 0.688 0.000 0.312
#> GSM35504     2  0.3542      0.778 0.000 0.864 0.060 0.076
#> GSM35508     4  0.5070      0.445 0.000 0.416 0.004 0.580
#> GSM35511     4  0.5955      0.403 0.000 0.056 0.328 0.616
#> GSM35512     3  0.3870      0.739 0.000 0.004 0.788 0.208
#> GSM35515     4  0.5070      0.462 0.000 0.416 0.004 0.580
#> GSM35519     4  0.5535      0.234 0.000 0.020 0.420 0.560
#> GSM35527     4  0.4972      0.342 0.000 0.456 0.000 0.544
#> GSM35532     4  0.5119      0.173 0.000 0.004 0.440 0.556
#> GSM35439     2  0.0188      0.857 0.000 0.996 0.000 0.004
#> GSM35443     1  0.2198      0.860 0.920 0.000 0.008 0.072
#> GSM35445     1  0.2739      0.861 0.904 0.000 0.036 0.060
#> GSM35448     3  0.2480      0.876 0.000 0.008 0.904 0.088
#> GSM35451     1  0.3486      0.854 0.812 0.000 0.000 0.188
#> GSM35454     3  0.1305      0.914 0.000 0.004 0.960 0.036
#> GSM35457     2  0.1940      0.833 0.000 0.924 0.000 0.076
#> GSM35465     2  0.2704      0.820 0.000 0.876 0.000 0.124
#> GSM35468     1  0.1022      0.879 0.968 0.000 0.000 0.032
#> GSM35471     1  0.4353      0.828 0.756 0.000 0.012 0.232
#> GSM35473     1  0.1661      0.875 0.944 0.000 0.004 0.052
#> GSM35477     1  0.3486      0.854 0.812 0.000 0.000 0.188
#> GSM35480     1  0.1716      0.880 0.936 0.000 0.000 0.064
#> GSM35482     3  0.1743      0.911 0.004 0.000 0.940 0.056
#> GSM35485     2  0.1824      0.836 0.000 0.936 0.004 0.060
#> GSM35489     2  0.0469      0.857 0.000 0.988 0.000 0.012
#> GSM35492     1  0.1022      0.879 0.968 0.000 0.000 0.032
#> GSM35495     3  0.0336      0.921 0.000 0.000 0.992 0.008
#> GSM35499     2  0.1978      0.837 0.000 0.928 0.004 0.068
#> GSM35502     1  0.1118      0.879 0.964 0.000 0.000 0.036
#> GSM35505     3  0.1396      0.918 0.004 0.004 0.960 0.032
#> GSM35507     1  0.8000      0.334 0.436 0.308 0.008 0.248
#> GSM35510     2  0.0895      0.856 0.000 0.976 0.004 0.020
#> GSM35514     1  0.1118      0.879 0.964 0.000 0.000 0.036
#> GSM35517     2  0.0188      0.857 0.000 0.996 0.000 0.004
#> GSM35520     2  0.3355      0.693 0.000 0.836 0.004 0.160
#> GSM35523     1  0.4642      0.821 0.740 0.000 0.020 0.240
#> GSM35529     2  0.1940      0.833 0.000 0.924 0.000 0.076
#> GSM35531     2  0.0592      0.856 0.000 0.984 0.000 0.016
#> GSM35534     2  0.1824      0.836 0.000 0.936 0.004 0.060
#> GSM35536     1  0.0707      0.881 0.980 0.000 0.000 0.020
#> GSM35538     1  0.2921      0.867 0.860 0.000 0.000 0.140
#> GSM35539     1  0.3172      0.862 0.840 0.000 0.000 0.160
#> GSM35540     2  0.2831      0.820 0.000 0.876 0.004 0.120
#> GSM35541     2  0.0336      0.857 0.000 0.992 0.000 0.008
#> GSM35442     1  0.2984      0.844 0.888 0.000 0.028 0.084
#> GSM35447     3  0.1675      0.917 0.004 0.004 0.948 0.044
#> GSM35450     1  0.3074      0.865 0.848 0.000 0.000 0.152
#> GSM35453     1  0.3858      0.814 0.844 0.000 0.100 0.056
#> GSM35456     1  0.5833      0.796 0.676 0.052 0.008 0.264
#> GSM35464     2  0.5640      0.529 0.052 0.688 0.004 0.256
#> GSM35467     1  0.1118      0.879 0.964 0.000 0.000 0.036
#> GSM35470     1  0.4720      0.843 0.768 0.000 0.044 0.188
#> GSM35479     3  0.1305      0.914 0.004 0.000 0.960 0.036
#> GSM35484     1  0.1902      0.877 0.932 0.004 0.000 0.064
#> GSM35488     1  0.0592      0.881 0.984 0.000 0.000 0.016
#> GSM35491     1  0.1022      0.879 0.968 0.000 0.000 0.032
#> GSM35494     3  0.1209      0.916 0.004 0.000 0.964 0.032
#> GSM35498     1  0.4599      0.822 0.736 0.000 0.016 0.248
#> GSM35501     1  0.1118      0.879 0.964 0.000 0.000 0.036
#> GSM35509     3  0.0817      0.919 0.000 0.000 0.976 0.024
#> GSM35513     1  0.1118      0.879 0.964 0.000 0.000 0.036
#> GSM35516     2  0.0592      0.857 0.000 0.984 0.000 0.016
#> GSM35522     1  0.4642      0.821 0.740 0.000 0.020 0.240
#> GSM35525     1  0.1867      0.881 0.928 0.000 0.000 0.072
#> GSM35528     1  0.3266      0.862 0.832 0.000 0.000 0.168
#> GSM35533     1  0.1902      0.877 0.932 0.004 0.000 0.064
#> GSM35537     1  0.4711      0.826 0.740 0.000 0.024 0.236

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>          class entropy silhouette    p1    p2    p3    p4    p5
#> GSM35441     2  0.4002     0.7525 0.000 0.796 0.000 0.084 0.120
#> GSM35446     3  0.2448     0.8395 0.000 0.000 0.892 0.088 0.020
#> GSM35449     2  0.5483     0.2855 0.000 0.512 0.000 0.064 0.424
#> GSM35455     2  0.5396     0.3985 0.000 0.560 0.000 0.064 0.376
#> GSM35458     5  0.3241     0.7726 0.000 0.144 0.000 0.024 0.832
#> GSM35460     3  0.2208     0.8404 0.000 0.000 0.908 0.072 0.020
#> GSM35461     5  0.5252     0.4953 0.008 0.000 0.272 0.064 0.656
#> GSM35463     2  0.3564     0.7288 0.000 0.820 0.008 0.148 0.024
#> GSM35472     3  0.4477     0.6622 0.000 0.000 0.708 0.040 0.252
#> GSM35475     5  0.1952     0.7999 0.000 0.084 0.004 0.000 0.912
#> GSM35483     2  0.4037     0.7058 0.000 0.784 0.012 0.176 0.028
#> GSM35496     3  0.3688     0.8042 0.000 0.000 0.816 0.060 0.124
#> GSM35497     2  0.5478     0.2912 0.000 0.516 0.000 0.064 0.420
#> GSM35504     2  0.5331     0.6630 0.000 0.712 0.064 0.184 0.040
#> GSM35508     5  0.3569     0.7679 0.000 0.104 0.000 0.068 0.828
#> GSM35511     5  0.2824     0.7726 0.000 0.008 0.088 0.024 0.880
#> GSM35512     3  0.4552     0.6444 0.000 0.000 0.696 0.040 0.264
#> GSM35515     5  0.3241     0.7726 0.000 0.144 0.000 0.024 0.832
#> GSM35519     5  0.4186     0.6771 0.000 0.004 0.184 0.044 0.768
#> GSM35527     5  0.4277     0.6982 0.000 0.156 0.000 0.076 0.768
#> GSM35532     5  0.3732     0.6886 0.000 0.000 0.176 0.032 0.792
#> GSM35439     2  0.0693     0.8078 0.000 0.980 0.000 0.008 0.012
#> GSM35443     1  0.4754     0.5471 0.736 0.000 0.008 0.184 0.072
#> GSM35445     1  0.3275     0.5894 0.860 0.000 0.064 0.068 0.008
#> GSM35448     3  0.4219     0.7462 0.000 0.020 0.772 0.184 0.024
#> GSM35451     1  0.4774    -0.2218 0.540 0.012 0.000 0.444 0.004
#> GSM35454     3  0.2747     0.8473 0.016 0.000 0.884 0.088 0.012
#> GSM35457     2  0.3865     0.7577 0.000 0.808 0.000 0.092 0.100
#> GSM35465     2  0.4761     0.7136 0.000 0.728 0.000 0.168 0.104
#> GSM35468     1  0.3612     0.5861 0.800 0.000 0.000 0.172 0.028
#> GSM35471     4  0.4837     0.4734 0.424 0.016 0.004 0.556 0.000
#> GSM35473     1  0.2339     0.6264 0.912 0.000 0.028 0.052 0.008
#> GSM35477     1  0.4783    -0.2388 0.532 0.012 0.000 0.452 0.004
#> GSM35480     1  0.2609     0.6203 0.896 0.000 0.028 0.068 0.008
#> GSM35482     3  0.2813     0.8457 0.000 0.000 0.868 0.108 0.024
#> GSM35485     2  0.2006     0.7857 0.000 0.916 0.000 0.072 0.012
#> GSM35489     2  0.1697     0.8045 0.000 0.932 0.000 0.060 0.008
#> GSM35492     1  0.3612     0.5861 0.800 0.000 0.000 0.172 0.028
#> GSM35495     3  0.0963     0.8586 0.000 0.000 0.964 0.036 0.000
#> GSM35499     2  0.1522     0.8075 0.000 0.944 0.000 0.044 0.012
#> GSM35502     1  0.0000     0.6541 1.000 0.000 0.000 0.000 0.000
#> GSM35505     3  0.2850     0.8477 0.016 0.000 0.880 0.088 0.016
#> GSM35507     4  0.6462     0.4769 0.168 0.240 0.000 0.572 0.020
#> GSM35510     2  0.1281     0.8091 0.000 0.956 0.000 0.032 0.012
#> GSM35514     1  0.0162     0.6536 0.996 0.000 0.000 0.004 0.000
#> GSM35517     2  0.0404     0.8085 0.000 0.988 0.000 0.000 0.012
#> GSM35520     2  0.3722     0.6909 0.000 0.796 0.004 0.024 0.176
#> GSM35523     4  0.5173     0.6096 0.348 0.012 0.004 0.612 0.024
#> GSM35529     2  0.3912     0.7570 0.000 0.804 0.000 0.088 0.108
#> GSM35531     2  0.0794     0.8063 0.000 0.972 0.000 0.028 0.000
#> GSM35534     2  0.2873     0.7564 0.000 0.860 0.000 0.120 0.020
#> GSM35536     1  0.1041     0.6492 0.964 0.000 0.000 0.032 0.004
#> GSM35538     1  0.4251     0.0844 0.624 0.000 0.000 0.372 0.004
#> GSM35539     1  0.4331    -0.0119 0.596 0.000 0.000 0.400 0.004
#> GSM35540     2  0.4797     0.7102 0.000 0.724 0.000 0.172 0.104
#> GSM35541     2  0.0798     0.8063 0.000 0.976 0.000 0.016 0.008
#> GSM35442     1  0.6396     0.4302 0.620 0.000 0.076 0.224 0.080
#> GSM35447     3  0.2850     0.8477 0.016 0.000 0.880 0.088 0.016
#> GSM35450     1  0.4288     0.0490 0.612 0.000 0.000 0.384 0.004
#> GSM35453     1  0.4326     0.5037 0.784 0.000 0.124 0.084 0.008
#> GSM35456     1  0.6127    -0.3182 0.484 0.076 0.012 0.424 0.004
#> GSM35464     4  0.5411     0.0841 0.012 0.380 0.000 0.568 0.040
#> GSM35467     1  0.0000     0.6541 1.000 0.000 0.000 0.000 0.000
#> GSM35470     4  0.6434     0.2021 0.404 0.000 0.072 0.484 0.040
#> GSM35479     3  0.1877     0.8561 0.000 0.000 0.924 0.064 0.012
#> GSM35484     1  0.2647     0.6297 0.892 0.000 0.024 0.076 0.008
#> GSM35488     1  0.3409     0.5818 0.816 0.000 0.000 0.160 0.024
#> GSM35491     1  0.3612     0.5861 0.800 0.000 0.000 0.172 0.028
#> GSM35494     3  0.1410     0.8604 0.000 0.000 0.940 0.060 0.000
#> GSM35498     4  0.5061     0.6096 0.340 0.020 0.004 0.624 0.012
#> GSM35501     1  0.0000     0.6541 1.000 0.000 0.000 0.000 0.000
#> GSM35509     3  0.0880     0.8637 0.000 0.000 0.968 0.032 0.000
#> GSM35513     1  0.0162     0.6536 0.996 0.000 0.000 0.004 0.000
#> GSM35516     2  0.0771     0.8076 0.000 0.976 0.000 0.020 0.004
#> GSM35522     4  0.5144     0.6132 0.340 0.012 0.004 0.620 0.024
#> GSM35525     1  0.3550     0.4560 0.760 0.000 0.000 0.236 0.004
#> GSM35528     1  0.4827    -0.2567 0.504 0.000 0.000 0.476 0.020
#> GSM35533     1  0.2734     0.6331 0.888 0.000 0.028 0.076 0.008
#> GSM35537     4  0.5215     0.5059 0.380 0.000 0.016 0.580 0.024

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>          class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM35441     2  0.4351     0.5520 0.000 0.676 0.000 0.044 0.276 0.004
#> GSM35446     3  0.2701     0.6139 0.000 0.000 0.864 0.028 0.004 0.104
#> GSM35449     5  0.4481     0.0291 0.000 0.416 0.000 0.024 0.556 0.004
#> GSM35455     5  0.4504    -0.0237 0.000 0.432 0.000 0.024 0.540 0.004
#> GSM35458     5  0.4354     0.3142 0.008 0.044 0.000 0.020 0.748 0.180
#> GSM35460     3  0.2701     0.6139 0.000 0.000 0.864 0.028 0.004 0.104
#> GSM35461     6  0.6105     0.0000 0.004 0.000 0.192 0.008 0.316 0.480
#> GSM35463     2  0.4834     0.5589 0.000 0.672 0.008 0.076 0.004 0.240
#> GSM35472     3  0.5740    -0.3948 0.000 0.000 0.436 0.000 0.168 0.396
#> GSM35475     5  0.3874     0.0431 0.000 0.012 0.008 0.000 0.704 0.276
#> GSM35483     2  0.5465     0.4922 0.000 0.600 0.020 0.088 0.004 0.288
#> GSM35496     3  0.5218     0.3719 0.000 0.000 0.624 0.044 0.048 0.284
#> GSM35497     5  0.4487     0.0172 0.000 0.420 0.000 0.024 0.552 0.004
#> GSM35504     2  0.6942     0.4148 0.000 0.488 0.076 0.096 0.032 0.308
#> GSM35508     5  0.1390     0.3842 0.000 0.032 0.000 0.004 0.948 0.016
#> GSM35511     5  0.4047    -0.0112 0.000 0.000 0.036 0.004 0.716 0.244
#> GSM35512     3  0.5764    -0.4234 0.000 0.000 0.424 0.000 0.172 0.404
#> GSM35515     5  0.4354     0.3142 0.008 0.044 0.000 0.020 0.748 0.180
#> GSM35519     5  0.5274    -0.5831 0.000 0.000 0.100 0.000 0.492 0.408
#> GSM35527     5  0.1946     0.4059 0.000 0.072 0.000 0.004 0.912 0.012
#> GSM35532     5  0.5077    -0.4351 0.000 0.000 0.088 0.000 0.552 0.360
#> GSM35439     2  0.1010     0.7380 0.000 0.960 0.000 0.004 0.036 0.000
#> GSM35443     1  0.5095     0.5763 0.676 0.000 0.004 0.132 0.012 0.176
#> GSM35445     1  0.4605     0.6114 0.760 0.000 0.096 0.056 0.004 0.084
#> GSM35448     3  0.5696     0.3538 0.000 0.036 0.572 0.076 0.004 0.312
#> GSM35451     4  0.4361     0.5252 0.424 0.000 0.000 0.552 0.000 0.024
#> GSM35454     3  0.4832     0.5883 0.048 0.008 0.740 0.052 0.004 0.148
#> GSM35457     2  0.4327     0.5615 0.000 0.688 0.000 0.048 0.260 0.004
#> GSM35465     2  0.5456     0.4913 0.000 0.596 0.000 0.152 0.244 0.008
#> GSM35468     1  0.4546     0.6017 0.728 0.000 0.000 0.128 0.012 0.132
#> GSM35471     4  0.3831     0.6507 0.244 0.008 0.004 0.732 0.000 0.012
#> GSM35473     1  0.3471     0.6573 0.840 0.000 0.040 0.040 0.004 0.076
#> GSM35477     4  0.4361     0.5252 0.424 0.000 0.000 0.552 0.000 0.024
#> GSM35480     1  0.4258     0.6309 0.776 0.000 0.028 0.120 0.004 0.072
#> GSM35482     3  0.4482     0.5521 0.000 0.000 0.708 0.124 0.000 0.168
#> GSM35485     2  0.2152     0.7095 0.000 0.904 0.000 0.024 0.004 0.068
#> GSM35489     2  0.2003     0.7283 0.000 0.912 0.000 0.044 0.044 0.000
#> GSM35492     1  0.4621     0.6031 0.720 0.000 0.000 0.128 0.012 0.140
#> GSM35495     3  0.1524     0.6395 0.000 0.000 0.932 0.008 0.000 0.060
#> GSM35499     2  0.1760     0.7372 0.000 0.928 0.000 0.048 0.004 0.020
#> GSM35502     1  0.1003     0.6932 0.964 0.000 0.000 0.028 0.004 0.004
#> GSM35505     3  0.4853     0.5814 0.044 0.008 0.728 0.044 0.004 0.172
#> GSM35507     4  0.5000     0.5392 0.060 0.180 0.000 0.700 0.060 0.000
#> GSM35510     2  0.1857     0.7374 0.000 0.928 0.000 0.028 0.032 0.012
#> GSM35514     1  0.1003     0.6932 0.964 0.000 0.000 0.028 0.004 0.004
#> GSM35517     2  0.1080     0.7388 0.000 0.960 0.000 0.004 0.032 0.004
#> GSM35520     2  0.4643     0.4862 0.000 0.700 0.004 0.000 0.176 0.120
#> GSM35523     4  0.3732     0.6670 0.180 0.012 0.000 0.776 0.000 0.032
#> GSM35529     2  0.4289     0.5594 0.000 0.688 0.000 0.044 0.264 0.004
#> GSM35531     2  0.1180     0.7397 0.000 0.960 0.000 0.016 0.012 0.012
#> GSM35534     2  0.4203     0.5945 0.000 0.720 0.000 0.056 0.004 0.220
#> GSM35536     1  0.1913     0.6682 0.908 0.000 0.000 0.080 0.000 0.012
#> GSM35538     1  0.4331    -0.4252 0.516 0.000 0.000 0.464 0.000 0.020
#> GSM35539     4  0.4322     0.4956 0.452 0.000 0.000 0.528 0.000 0.020
#> GSM35540     2  0.5572     0.4774 0.000 0.580 0.000 0.168 0.244 0.008
#> GSM35541     2  0.1036     0.7395 0.000 0.964 0.000 0.008 0.024 0.004
#> GSM35442     1  0.6847     0.4198 0.508 0.000 0.084 0.136 0.012 0.260
#> GSM35447     3  0.4509     0.5875 0.044 0.000 0.744 0.040 0.004 0.168
#> GSM35450     4  0.4325     0.4707 0.456 0.000 0.000 0.524 0.000 0.020
#> GSM35453     1  0.5160     0.5423 0.700 0.000 0.160 0.048 0.004 0.088
#> GSM35456     4  0.5255     0.5104 0.328 0.028 0.008 0.596 0.000 0.040
#> GSM35464     4  0.4836     0.2982 0.000 0.268 0.000 0.644 0.084 0.004
#> GSM35467     1  0.1003     0.6932 0.964 0.000 0.000 0.028 0.004 0.004
#> GSM35470     4  0.6767     0.3583 0.208 0.000 0.100 0.508 0.000 0.184
#> GSM35479     3  0.2733     0.6379 0.000 0.000 0.864 0.080 0.000 0.056
#> GSM35484     1  0.4259     0.6359 0.784 0.000 0.040 0.092 0.004 0.080
#> GSM35488     1  0.4454     0.5944 0.736 0.000 0.000 0.144 0.012 0.108
#> GSM35491     1  0.4621     0.6031 0.720 0.000 0.000 0.128 0.012 0.140
#> GSM35494     3  0.3052     0.6422 0.004 0.000 0.848 0.068 0.000 0.080
#> GSM35498     4  0.3642     0.6655 0.160 0.016 0.000 0.796 0.004 0.024
#> GSM35501     1  0.1003     0.6932 0.964 0.000 0.000 0.028 0.004 0.004
#> GSM35509     3  0.0993     0.6546 0.000 0.000 0.964 0.024 0.000 0.012
#> GSM35513     1  0.1003     0.6932 0.964 0.000 0.000 0.028 0.004 0.004
#> GSM35516     2  0.1346     0.7382 0.000 0.952 0.000 0.024 0.008 0.016
#> GSM35522     4  0.3732     0.6670 0.180 0.012 0.000 0.776 0.000 0.032
#> GSM35525     1  0.4066     0.3132 0.692 0.000 0.000 0.272 0.000 0.036
#> GSM35528     4  0.5305     0.4242 0.400 0.000 0.000 0.516 0.012 0.072
#> GSM35533     1  0.4357     0.6342 0.776 0.000 0.040 0.096 0.004 0.084
#> GSM35537     4  0.4661     0.6280 0.176 0.000 0.036 0.724 0.000 0.064

Heatmaps for the consensus matrix. It visualizes the probability of two samples to be in a same group.

consensus_heatmap(res, k = 2)

plot of chunk tab-CV-kmeans-consensus-heatmap-1

consensus_heatmap(res, k = 3)

plot of chunk tab-CV-kmeans-consensus-heatmap-2

consensus_heatmap(res, k = 4)

plot of chunk tab-CV-kmeans-consensus-heatmap-3

consensus_heatmap(res, k = 5)

plot of chunk tab-CV-kmeans-consensus-heatmap-4

consensus_heatmap(res, k = 6)

plot of chunk tab-CV-kmeans-consensus-heatmap-5

Heatmaps for the membership of samples in all partitions to see how consistent they are:

membership_heatmap(res, k = 2)

plot of chunk tab-CV-kmeans-membership-heatmap-1

membership_heatmap(res, k = 3)

plot of chunk tab-CV-kmeans-membership-heatmap-2

membership_heatmap(res, k = 4)

plot of chunk tab-CV-kmeans-membership-heatmap-3

membership_heatmap(res, k = 5)

plot of chunk tab-CV-kmeans-membership-heatmap-4

membership_heatmap(res, k = 6)

plot of chunk tab-CV-kmeans-membership-heatmap-5

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)

plot of chunk tab-CV-kmeans-get-signatures-1

get_signatures(res, k = 3)

plot of chunk tab-CV-kmeans-get-signatures-2

get_signatures(res, k = 4)

plot of chunk tab-CV-kmeans-get-signatures-3

get_signatures(res, k = 5)

plot of chunk tab-CV-kmeans-get-signatures-4

get_signatures(res, k = 6)

plot of chunk tab-CV-kmeans-get-signatures-5

Signature heatmaps where rows are not scaled:

get_signatures(res, k = 2, scale_rows = FALSE)

plot of chunk tab-CV-kmeans-get-signatures-no-scale-1

get_signatures(res, k = 3, scale_rows = FALSE)

plot of chunk tab-CV-kmeans-get-signatures-no-scale-2

get_signatures(res, k = 4, scale_rows = FALSE)

plot of chunk tab-CV-kmeans-get-signatures-no-scale-3

get_signatures(res, k = 5, scale_rows = FALSE)

plot of chunk tab-CV-kmeans-get-signatures-no-scale-4

get_signatures(res, k = 6, scale_rows = FALSE)

plot of chunk tab-CV-kmeans-get-signatures-no-scale-5

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk CV-kmeans-signature_compare

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:

  1. which_row: row indices corresponding to the input matrix.
  2. fdr: FDR for the differential test.
  3. mean_x: The mean value in group x.
  4. scaled_mean_x: The mean value in group x after rows are scaled.
  5. 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")

plot of chunk tab-CV-kmeans-dimension-reduction-1

dimension_reduction(res, k = 3, method = "UMAP")

plot of chunk tab-CV-kmeans-dimension-reduction-2

dimension_reduction(res, k = 4, method = "UMAP")

plot of chunk tab-CV-kmeans-dimension-reduction-3

dimension_reduction(res, k = 5, method = "UMAP")

plot of chunk tab-CV-kmeans-dimension-reduction-4

dimension_reduction(res, k = 6, method = "UMAP")

plot of chunk tab-CV-kmeans-dimension-reduction-5

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk CV-kmeans-collect-classes

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  time(p) k
#> CV:kmeans 79 3.41e-07 2
#> CV:kmeans 78 1.71e-05 3
#> CV:kmeans 68 6.39e-04 4
#> CV:kmeans 62 1.84e-06 5
#> CV:kmeans 50 1.07e-01 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.


CV:skmeans**

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 7758 rows and 79 columns.
#>   Top rows (776, 1552, 2328, 3103, 3879) are extracted by 'CV' method.
#>   Subgroups are detected by 'skmeans' method.
#>   Performed in total 1250 partitions by row resampling.
#>   Best k for subgroups seems to be 3.
#> 
#> Following methods can be applied to this 'ConsensusPartition' object:
#>  [1] "cola_report"             "collect_classes"         "collect_plots"          
#>  [4] "collect_stats"           "colnames"                "compare_signatures"     
#>  [7] "consensus_heatmap"       "dimension_reduction"     "functional_enrichment"  
#> [10] "get_anno_col"            "get_anno"                "get_classes"            
#> [13] "get_consensus"           "get_matrix"              "get_membership"         
#> [16] "get_param"               "get_signatures"          "get_stats"              
#> [19] "is_best_k"               "is_stable_k"             "membership_heatmap"     
#> [22] "ncol"                    "nrow"                    "plot_ecdf"              
#> [25] "rownames"                "select_partition_number" "show"                   
#> [28] "suggest_best_k"          "test_to_known_factors"

collect_plots() function collects all the plots made from res for all k (number of partitions) into one single page to provide an easy and fast comparison between different k.

collect_plots(res)

plot of chunk CV-skmeans-collect-plots

The plots are:

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:

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)

plot of chunk CV-skmeans-select-partition-number

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.988       0.995         0.5037 0.498   0.498
#> 3 3 0.999           0.955       0.981         0.3132 0.775   0.577
#> 4 4 0.703           0.433       0.797         0.1191 0.952   0.868
#> 5 5 0.698           0.677       0.831         0.0754 0.836   0.536
#> 6 6 0.689           0.593       0.751         0.0411 0.980   0.904

suggest_best_k() suggests the best \(k\) based on these statistics. The rules are as follows:

suggest_best_k(res)
#> [1] 3
#> attr(,"optional")
#> [1] 2

There is also optional best \(k\) = 2 that is worth to check.

Following shows the table of the partitions (You need to click the show/hide code output link to see it). The membership matrix (columns with name p*) is inferred by clue::cl_consensus() function with the SE method. Basically the value in the membership matrix represents the probability to belong to a certain group. The finall class label for an item is determined with the group with highest probability it belongs to.

In get_classes() function, the entropy is calculated from the membership matrix and the silhouette score is calculated from the consensus matrix.

show/hide code output

cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#>          class entropy silhouette    p1    p2
#> GSM35441     2  0.0000      1.000 0.000 1.000
#> GSM35446     2  0.0000      1.000 0.000 1.000
#> GSM35449     2  0.0000      1.000 0.000 1.000
#> GSM35455     2  0.0000      1.000 0.000 1.000
#> GSM35458     2  0.0000      1.000 0.000 1.000
#> GSM35460     2  0.0000      1.000 0.000 1.000
#> GSM35461     1  0.0000      0.990 1.000 0.000
#> GSM35463     2  0.0000      1.000 0.000 1.000
#> GSM35472     2  0.0000      1.000 0.000 1.000
#> GSM35475     2  0.0000      1.000 0.000 1.000
#> GSM35483     2  0.0000      1.000 0.000 1.000
#> GSM35496     1  0.0000      0.990 1.000 0.000
#> GSM35497     2  0.0000      1.000 0.000 1.000
#> GSM35504     2  0.0000      1.000 0.000 1.000
#> GSM35508     2  0.0000      1.000 0.000 1.000
#> GSM35511     2  0.0000      1.000 0.000 1.000
#> GSM35512     2  0.0000      1.000 0.000 1.000
#> GSM35515     2  0.0000      1.000 0.000 1.000
#> GSM35519     2  0.0000      1.000 0.000 1.000
#> GSM35527     2  0.0000      1.000 0.000 1.000
#> GSM35532     2  0.0000      1.000 0.000 1.000
#> GSM35439     2  0.0000      1.000 0.000 1.000
#> GSM35443     1  0.0000      0.990 1.000 0.000
#> GSM35445     1  0.0000      0.990 1.000 0.000
#> GSM35448     2  0.0000      1.000 0.000 1.000
#> GSM35451     1  0.0000      0.990 1.000 0.000
#> GSM35454     1  0.0000      0.990 1.000 0.000
#> GSM35457     2  0.0000      1.000 0.000 1.000
#> GSM35465     2  0.0000      1.000 0.000 1.000
#> GSM35468     1  0.0000      0.990 1.000 0.000
#> GSM35471     1  0.0000      0.990 1.000 0.000
#> GSM35473     1  0.0000      0.990 1.000 0.000
#> GSM35477     1  0.0000      0.990 1.000 0.000
#> GSM35480     1  0.0000      0.990 1.000 0.000
#> GSM35482     1  0.0000      0.990 1.000 0.000
#> GSM35485     2  0.0000      1.000 0.000 1.000
#> GSM35489     2  0.0000      1.000 0.000 1.000
#> GSM35492     1  0.0000      0.990 1.000 0.000
#> GSM35495     1  0.7376      0.744 0.792 0.208
#> GSM35499     2  0.0000      1.000 0.000 1.000
#> GSM35502     1  0.0000      0.990 1.000 0.000
#> GSM35505     1  0.0000      0.990 1.000 0.000
#> GSM35507     1  0.6048      0.829 0.852 0.148
#> GSM35510     2  0.0000      1.000 0.000 1.000
#> GSM35514     1  0.0000      0.990 1.000 0.000
#> GSM35517     2  0.0000      1.000 0.000 1.000
#> GSM35520     2  0.0000      1.000 0.000 1.000
#> GSM35523     1  0.0000      0.990 1.000 0.000
#> GSM35529     2  0.0000      1.000 0.000 1.000
#> GSM35531     2  0.0000      1.000 0.000 1.000
#> GSM35534     2  0.0000      1.000 0.000 1.000
#> GSM35536     1  0.0000      0.990 1.000 0.000
#> GSM35538     1  0.0000      0.990 1.000 0.000
#> GSM35539     1  0.0000      0.990 1.000 0.000
#> GSM35540     2  0.0000      1.000 0.000 1.000
#> GSM35541     2  0.0000      1.000 0.000 1.000
#> GSM35442     1  0.0000      0.990 1.000 0.000
#> GSM35447     1  0.2948      0.942 0.948 0.052
#> GSM35450     1  0.0000      0.990 1.000 0.000
#> GSM35453     1  0.0000      0.990 1.000 0.000
#> GSM35456     1  0.0000      0.990 1.000 0.000
#> GSM35464     2  0.0376      0.996 0.004 0.996
#> GSM35467     1  0.0000      0.990 1.000 0.000
#> GSM35470     1  0.0000      0.990 1.000 0.000
#> GSM35479     1  0.0000      0.990 1.000 0.000
#> GSM35484     1  0.0000      0.990 1.000 0.000
#> GSM35488     1  0.0000      0.990 1.000 0.000
#> GSM35491     1  0.0000      0.990 1.000 0.000
#> GSM35494     1  0.0000      0.990 1.000 0.000
#> GSM35498     1  0.0000      0.990 1.000 0.000
#> GSM35501     1  0.0000      0.990 1.000 0.000
#> GSM35509     1  0.1414      0.973 0.980 0.020
#> GSM35513     1  0.0000      0.990 1.000 0.000
#> GSM35516     2  0.0000      1.000 0.000 1.000
#> GSM35522     1  0.0000      0.990 1.000 0.000
#> GSM35525     1  0.0000      0.990 1.000 0.000
#> GSM35528     1  0.0000      0.990 1.000 0.000
#> GSM35533     1  0.0000      0.990 1.000 0.000
#> GSM35537     1  0.0000      0.990 1.000 0.000

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>          class entropy silhouette    p1    p2    p3
#> GSM35441     2  0.0000      0.973 0.000 1.000 0.000
#> GSM35446     3  0.0000      0.995 0.000 0.000 1.000
#> GSM35449     2  0.0000      0.973 0.000 1.000 0.000
#> GSM35455     2  0.0000      0.973 0.000 1.000 0.000
#> GSM35458     2  0.0000      0.973 0.000 1.000 0.000
#> GSM35460     3  0.0000      0.995 0.000 0.000 1.000
#> GSM35461     3  0.0000      0.995 0.000 0.000 1.000
#> GSM35463     2  0.0000      0.973 0.000 1.000 0.000
#> GSM35472     3  0.0000      0.995 0.000 0.000 1.000
#> GSM35475     2  0.6126      0.334 0.000 0.600 0.400
#> GSM35483     2  0.0000      0.973 0.000 1.000 0.000
#> GSM35496     3  0.0000      0.995 0.000 0.000 1.000
#> GSM35497     2  0.0000      0.973 0.000 1.000 0.000
#> GSM35504     2  0.0747      0.961 0.000 0.984 0.016
#> GSM35508     2  0.0237      0.970 0.000 0.996 0.004
#> GSM35511     3  0.2537      0.908 0.000 0.080 0.920
#> GSM35512     3  0.0000      0.995 0.000 0.000 1.000
#> GSM35515     2  0.0592      0.964 0.000 0.988 0.012
#> GSM35519     3  0.0000      0.995 0.000 0.000 1.000
#> GSM35527     2  0.0000      0.973 0.000 1.000 0.000
#> GSM35532     3  0.0000      0.995 0.000 0.000 1.000
#> GSM35439     2  0.0000      0.973 0.000 1.000 0.000
#> GSM35443     1  0.0237      0.975 0.996 0.000 0.004
#> GSM35445     1  0.1643      0.942 0.956 0.000 0.044
#> GSM35448     3  0.0000      0.995 0.000 0.000 1.000
#> GSM35451     1  0.0000      0.978 1.000 0.000 0.000
#> GSM35454     3  0.0000      0.995 0.000 0.000 1.000
#> GSM35457     2  0.0000      0.973 0.000 1.000 0.000
#> GSM35465     2  0.0000      0.973 0.000 1.000 0.000
#> GSM35468     1  0.0000      0.978 1.000 0.000 0.000
#> GSM35471     1  0.0000      0.978 1.000 0.000 0.000
#> GSM35473     1  0.0237      0.975 0.996 0.000 0.004
#> GSM35477     1  0.0000      0.978 1.000 0.000 0.000
#> GSM35480     1  0.0000      0.978 1.000 0.000 0.000
#> GSM35482     3  0.0000      0.995 0.000 0.000 1.000
#> GSM35485     2  0.0000      0.973 0.000 1.000 0.000
#> GSM35489     2  0.0000      0.973 0.000 1.000 0.000
#> GSM35492     1  0.0000      0.978 1.000 0.000 0.000
#> GSM35495     3  0.0000      0.995 0.000 0.000 1.000
#> GSM35499     2  0.0000      0.973 0.000 1.000 0.000
#> GSM35502     1  0.0000      0.978 1.000 0.000 0.000
#> GSM35505     3  0.0000      0.995 0.000 0.000 1.000
#> GSM35507     2  0.5016      0.681 0.240 0.760 0.000
#> GSM35510     2  0.0000      0.973 0.000 1.000 0.000
#> GSM35514     1  0.0000      0.978 1.000 0.000 0.000
#> GSM35517     2  0.0000      0.973 0.000 1.000 0.000
#> GSM35520     2  0.1643      0.935 0.000 0.956 0.044
#> GSM35523     1  0.0000      0.978 1.000 0.000 0.000
#> GSM35529     2  0.0000      0.973 0.000 1.000 0.000
#> GSM35531     2  0.0000      0.973 0.000 1.000 0.000
#> GSM35534     2  0.0000      0.973 0.000 1.000 0.000
#> GSM35536     1  0.0000      0.978 1.000 0.000 0.000
#> GSM35538     1  0.0000      0.978 1.000 0.000 0.000
#> GSM35539     1  0.0000      0.978 1.000 0.000 0.000
#> GSM35540     2  0.0000      0.973 0.000 1.000 0.000
#> GSM35541     2  0.0000      0.973 0.000 1.000 0.000
#> GSM35442     1  0.6154      0.338 0.592 0.000 0.408
#> GSM35447     3  0.0000      0.995 0.000 0.000 1.000
#> GSM35450     1  0.0000      0.978 1.000 0.000 0.000
#> GSM35453     1  0.2878      0.892 0.904 0.000 0.096
#> GSM35456     1  0.0892      0.960 0.980 0.020 0.000
#> GSM35464     2  0.0000      0.973 0.000 1.000 0.000
#> GSM35467     1  0.0000      0.978 1.000 0.000 0.000
#> GSM35470     1  0.3192      0.874 0.888 0.000 0.112
#> GSM35479     3  0.0000      0.995 0.000 0.000 1.000
#> GSM35484     1  0.0000      0.978 1.000 0.000 0.000
#> GSM35488     1  0.0000      0.978 1.000 0.000 0.000
#> GSM35491     1  0.0000      0.978 1.000 0.000 0.000
#> GSM35494     3  0.0000      0.995 0.000 0.000 1.000
#> GSM35498     1  0.0000      0.978 1.000 0.000 0.000
#> GSM35501     1  0.0000      0.978 1.000 0.000 0.000
#> GSM35509     3  0.0000      0.995 0.000 0.000 1.000
#> GSM35513     1  0.0000      0.978 1.000 0.000 0.000
#> GSM35516     2  0.0000      0.973 0.000 1.000 0.000
#> GSM35522     1  0.0000      0.978 1.000 0.000 0.000
#> GSM35525     1  0.0000      0.978 1.000 0.000 0.000
#> GSM35528     1  0.0000      0.978 1.000 0.000 0.000
#> GSM35533     1  0.0000      0.978 1.000 0.000 0.000
#> GSM35537     1  0.0000      0.978 1.000 0.000 0.000

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>          class entropy silhouette    p1    p2    p3    p4
#> GSM35441     2  0.1940     0.8816 0.000 0.924 0.000 0.076
#> GSM35446     3  0.0376     0.8997 0.000 0.004 0.992 0.004
#> GSM35449     2  0.3907     0.8264 0.000 0.768 0.000 0.232
#> GSM35455     2  0.3356     0.8504 0.000 0.824 0.000 0.176
#> GSM35458     2  0.4836     0.7528 0.000 0.672 0.008 0.320
#> GSM35460     3  0.0188     0.9002 0.000 0.000 0.996 0.004
#> GSM35461     3  0.4193     0.7863 0.000 0.000 0.732 0.268
#> GSM35463     2  0.0524     0.8863 0.000 0.988 0.004 0.008
#> GSM35472     3  0.3024     0.8549 0.000 0.000 0.852 0.148
#> GSM35475     2  0.7344     0.4826 0.000 0.504 0.180 0.316
#> GSM35483     2  0.1510     0.8812 0.000 0.956 0.028 0.016
#> GSM35496     3  0.1867     0.8842 0.000 0.000 0.928 0.072
#> GSM35497     2  0.3801     0.8300 0.000 0.780 0.000 0.220
#> GSM35504     2  0.2255     0.8625 0.000 0.920 0.068 0.012
#> GSM35508     2  0.4980     0.7633 0.000 0.680 0.016 0.304
#> GSM35511     3  0.6634     0.6189 0.000 0.108 0.580 0.312
#> GSM35512     3  0.3074     0.8535 0.000 0.000 0.848 0.152
#> GSM35515     2  0.4957     0.7488 0.000 0.668 0.012 0.320
#> GSM35519     3  0.4718     0.7676 0.000 0.012 0.708 0.280
#> GSM35527     2  0.4193     0.8022 0.000 0.732 0.000 0.268
#> GSM35532     3  0.4483     0.7709 0.000 0.004 0.712 0.284
#> GSM35439     2  0.0000     0.8869 0.000 1.000 0.000 0.000
#> GSM35443     1  0.5353    -0.5168 0.556 0.000 0.012 0.432
#> GSM35445     1  0.7483    -0.6817 0.456 0.000 0.184 0.360
#> GSM35448     3  0.0895     0.8934 0.000 0.020 0.976 0.004
#> GSM35451     1  0.3123     0.2718 0.844 0.000 0.000 0.156
#> GSM35454     3  0.0921     0.8850 0.000 0.000 0.972 0.028
#> GSM35457     2  0.1637     0.8838 0.000 0.940 0.000 0.060
#> GSM35465     2  0.3486     0.8189 0.000 0.812 0.000 0.188
#> GSM35468     1  0.4761    -0.2695 0.628 0.000 0.000 0.372
#> GSM35471     1  0.4428     0.2711 0.720 0.004 0.000 0.276
#> GSM35473     1  0.6290    -0.4538 0.568 0.000 0.068 0.364
#> GSM35477     1  0.3266     0.2725 0.832 0.000 0.000 0.168
#> GSM35480     1  0.5929    -0.3926 0.596 0.000 0.048 0.356
#> GSM35482     3  0.0707     0.8988 0.000 0.000 0.980 0.020
#> GSM35485     2  0.0188     0.8866 0.000 0.996 0.000 0.004
#> GSM35489     2  0.0921     0.8872 0.000 0.972 0.000 0.028
#> GSM35492     1  0.4761    -0.2695 0.628 0.000 0.000 0.372
#> GSM35495     3  0.0000     0.8997 0.000 0.000 1.000 0.000
#> GSM35499     2  0.2888     0.8328 0.000 0.872 0.004 0.124
#> GSM35502     1  0.4713    -0.2560 0.640 0.000 0.000 0.360
#> GSM35505     3  0.0469     0.8966 0.000 0.000 0.988 0.012
#> GSM35507     1  0.7591     0.1666 0.452 0.208 0.000 0.340
#> GSM35510     2  0.0707     0.8855 0.000 0.980 0.000 0.020
#> GSM35514     1  0.4713    -0.2560 0.640 0.000 0.000 0.360
#> GSM35517     2  0.0188     0.8869 0.000 0.996 0.000 0.004
#> GSM35520     2  0.4417     0.8215 0.000 0.796 0.044 0.160
#> GSM35523     1  0.4500     0.2664 0.684 0.000 0.000 0.316
#> GSM35529     2  0.1474     0.8840 0.000 0.948 0.000 0.052
#> GSM35531     2  0.0188     0.8866 0.000 0.996 0.000 0.004
#> GSM35534     2  0.0188     0.8866 0.000 0.996 0.000 0.004
#> GSM35536     1  0.4679    -0.2498 0.648 0.000 0.000 0.352
#> GSM35538     1  0.1557     0.1357 0.944 0.000 0.000 0.056
#> GSM35539     1  0.1389     0.2288 0.952 0.000 0.000 0.048
#> GSM35540     2  0.3528     0.8306 0.000 0.808 0.000 0.192
#> GSM35541     2  0.0000     0.8869 0.000 1.000 0.000 0.000
#> GSM35442     4  0.7221     0.0000 0.428 0.000 0.140 0.432
#> GSM35447     3  0.0336     0.9000 0.000 0.000 0.992 0.008
#> GSM35450     1  0.0336     0.2028 0.992 0.000 0.000 0.008
#> GSM35453     1  0.7768    -0.6885 0.400 0.000 0.240 0.360
#> GSM35456     1  0.7334     0.2067 0.552 0.140 0.012 0.296
#> GSM35464     1  0.7924    -0.0626 0.340 0.332 0.000 0.328
#> GSM35467     1  0.4713    -0.2560 0.640 0.000 0.000 0.360
#> GSM35470     1  0.6620    -0.3734 0.576 0.000 0.104 0.320
#> GSM35479     3  0.0188     0.8992 0.000 0.000 0.996 0.004
#> GSM35484     1  0.6335    -0.4392 0.572 0.004 0.060 0.364
#> GSM35488     1  0.4746    -0.2663 0.632 0.000 0.000 0.368
#> GSM35491     1  0.4761    -0.2695 0.628 0.000 0.000 0.372
#> GSM35494     3  0.0336     0.8984 0.000 0.000 0.992 0.008
#> GSM35498     1  0.5090     0.2593 0.660 0.016 0.000 0.324
#> GSM35501     1  0.4697    -0.2521 0.644 0.000 0.000 0.356
#> GSM35509     3  0.0000     0.8997 0.000 0.000 1.000 0.000
#> GSM35513     1  0.4713    -0.2560 0.640 0.000 0.000 0.360
#> GSM35516     2  0.1398     0.8794 0.004 0.956 0.000 0.040
#> GSM35522     1  0.4814     0.2649 0.676 0.008 0.000 0.316
#> GSM35525     1  0.4304    -0.1846 0.716 0.000 0.000 0.284
#> GSM35528     1  0.2814     0.2520 0.868 0.000 0.000 0.132
#> GSM35533     1  0.5957    -0.3997 0.588 0.000 0.048 0.364
#> GSM35537     1  0.4882     0.2171 0.708 0.000 0.020 0.272

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>          class entropy silhouette    p1    p2    p3    p4    p5
#> GSM35441     2  0.4248     0.6809 0.000 0.728 0.000 0.032 0.240
#> GSM35446     3  0.0771     0.8986 0.000 0.004 0.976 0.000 0.020
#> GSM35449     5  0.4538     0.3610 0.000 0.364 0.000 0.016 0.620
#> GSM35455     2  0.4627     0.1785 0.000 0.544 0.000 0.012 0.444
#> GSM35458     5  0.2166     0.7513 0.004 0.072 0.000 0.012 0.912
#> GSM35460     3  0.0290     0.9010 0.000 0.000 0.992 0.000 0.008
#> GSM35461     5  0.5092     0.4284 0.008 0.000 0.276 0.052 0.664
#> GSM35463     2  0.0566     0.8505 0.000 0.984 0.012 0.000 0.004
#> GSM35472     3  0.4288     0.5464 0.000 0.000 0.664 0.012 0.324
#> GSM35475     5  0.2228     0.7550 0.000 0.048 0.040 0.000 0.912
#> GSM35483     2  0.2230     0.8152 0.000 0.912 0.044 0.000 0.044
#> GSM35496     3  0.2653     0.8489 0.000 0.000 0.880 0.024 0.096
#> GSM35497     5  0.4537     0.2763 0.000 0.396 0.000 0.012 0.592
#> GSM35504     2  0.3270     0.7743 0.000 0.852 0.100 0.004 0.044
#> GSM35508     5  0.2645     0.7405 0.000 0.096 0.008 0.012 0.884
#> GSM35511     5  0.2358     0.7185 0.000 0.008 0.104 0.000 0.888
#> GSM35512     3  0.4201     0.5341 0.000 0.000 0.664 0.008 0.328
#> GSM35515     5  0.2102     0.7513 0.004 0.068 0.000 0.012 0.916
#> GSM35519     5  0.3282     0.6368 0.000 0.000 0.188 0.008 0.804
#> GSM35527     5  0.3123     0.6913 0.000 0.160 0.000 0.012 0.828
#> GSM35532     5  0.3551     0.6001 0.000 0.000 0.220 0.008 0.772
#> GSM35439     2  0.1364     0.8574 0.000 0.952 0.000 0.012 0.036
#> GSM35443     1  0.4509     0.6642 0.752 0.000 0.000 0.152 0.096
#> GSM35445     1  0.2989     0.7006 0.852 0.000 0.132 0.008 0.008
#> GSM35448     3  0.2761     0.8168 0.000 0.104 0.872 0.000 0.024
#> GSM35451     4  0.4547     0.4480 0.400 0.000 0.000 0.588 0.012
#> GSM35454     3  0.0902     0.8955 0.008 0.004 0.976 0.004 0.008
#> GSM35457     2  0.3714     0.7944 0.000 0.812 0.000 0.056 0.132
#> GSM35465     2  0.5341     0.6664 0.000 0.664 0.000 0.212 0.124
#> GSM35468     1  0.3413     0.7124 0.832 0.000 0.000 0.124 0.044
#> GSM35471     4  0.3132     0.7226 0.172 0.000 0.000 0.820 0.008
#> GSM35473     1  0.1788     0.7447 0.932 0.000 0.056 0.004 0.008
#> GSM35477     4  0.4564     0.4909 0.372 0.000 0.000 0.612 0.016
#> GSM35480     1  0.3257     0.7149 0.860 0.000 0.052 0.080 0.008
#> GSM35482     3  0.2914     0.8537 0.000 0.000 0.872 0.076 0.052
#> GSM35485     2  0.0404     0.8536 0.000 0.988 0.000 0.000 0.012
#> GSM35489     2  0.2359     0.8431 0.000 0.904 0.000 0.036 0.060
#> GSM35492     1  0.3622     0.7070 0.816 0.000 0.000 0.136 0.048
#> GSM35495     3  0.0000     0.9010 0.000 0.000 1.000 0.000 0.000
#> GSM35499     2  0.2291     0.8357 0.000 0.908 0.008 0.072 0.012
#> GSM35502     1  0.0566     0.7557 0.984 0.000 0.000 0.012 0.004
#> GSM35505     3  0.1095     0.8941 0.012 0.008 0.968 0.000 0.012
#> GSM35507     4  0.3120     0.7233 0.032 0.064 0.000 0.876 0.028
#> GSM35510     2  0.1493     0.8564 0.000 0.948 0.000 0.028 0.024
#> GSM35514     1  0.0324     0.7558 0.992 0.000 0.000 0.004 0.004
#> GSM35517     2  0.1124     0.8579 0.000 0.960 0.000 0.004 0.036
#> GSM35520     5  0.5296     0.1740 0.000 0.468 0.048 0.000 0.484
#> GSM35523     4  0.1764     0.7473 0.064 0.000 0.000 0.928 0.008
#> GSM35529     2  0.3573     0.7856 0.000 0.812 0.000 0.036 0.152
#> GSM35531     2  0.1087     0.8525 0.000 0.968 0.008 0.008 0.016
#> GSM35534     2  0.0693     0.8492 0.000 0.980 0.012 0.000 0.008
#> GSM35536     1  0.0404     0.7566 0.988 0.000 0.000 0.012 0.000
#> GSM35538     1  0.4555     0.2539 0.636 0.000 0.000 0.344 0.020
#> GSM35539     1  0.4747    -0.2369 0.496 0.000 0.000 0.488 0.016
#> GSM35540     2  0.5902     0.5747 0.000 0.600 0.000 0.192 0.208
#> GSM35541     2  0.0898     0.8571 0.000 0.972 0.000 0.008 0.020
#> GSM35442     1  0.6425     0.5576 0.644 0.000 0.140 0.132 0.084
#> GSM35447     3  0.0865     0.9004 0.004 0.000 0.972 0.000 0.024
#> GSM35450     1  0.4708    -0.0596 0.548 0.000 0.000 0.436 0.016
#> GSM35453     1  0.4070     0.5751 0.728 0.000 0.256 0.004 0.012
#> GSM35456     4  0.5939     0.6216 0.236 0.116 0.004 0.632 0.012
#> GSM35464     4  0.3807     0.6159 0.004 0.176 0.000 0.792 0.028
#> GSM35467     1  0.0566     0.7570 0.984 0.000 0.000 0.012 0.004
#> GSM35470     1  0.7454     0.0443 0.376 0.000 0.208 0.372 0.044
#> GSM35479     3  0.1485     0.8896 0.000 0.000 0.948 0.032 0.020
#> GSM35484     1  0.2569     0.7424 0.912 0.012 0.032 0.028 0.016
#> GSM35488     1  0.3321     0.7165 0.832 0.000 0.000 0.136 0.032
#> GSM35491     1  0.3460     0.7112 0.828 0.000 0.000 0.128 0.044
#> GSM35494     3  0.0912     0.8986 0.000 0.000 0.972 0.016 0.012
#> GSM35498     4  0.0451     0.7359 0.008 0.000 0.000 0.988 0.004
#> GSM35501     1  0.0451     0.7565 0.988 0.000 0.000 0.008 0.004
#> GSM35509     3  0.0451     0.9008 0.000 0.000 0.988 0.004 0.008
#> GSM35513     1  0.0162     0.7561 0.996 0.000 0.000 0.004 0.000
#> GSM35516     2  0.1082     0.8559 0.000 0.964 0.000 0.028 0.008
#> GSM35522     4  0.1628     0.7490 0.056 0.000 0.000 0.936 0.008
#> GSM35525     1  0.3967     0.5027 0.724 0.000 0.000 0.264 0.012
#> GSM35528     4  0.4661     0.4527 0.312 0.000 0.000 0.656 0.032
#> GSM35533     1  0.2452     0.7370 0.908 0.000 0.028 0.052 0.012
#> GSM35537     4  0.4707     0.6330 0.184 0.000 0.040 0.748 0.028

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>          class entropy silhouette    p1    p2    p3    p4    p5 p6
#> GSM35441     2  0.5650      0.507 0.000 0.588 0.000 0.016 0.236 NA
#> GSM35446     3  0.1700      0.842 0.000 0.000 0.928 0.000 0.024 NA
#> GSM35449     5  0.5216      0.423 0.000 0.256 0.000 0.004 0.612 NA
#> GSM35455     5  0.5484      0.075 0.000 0.392 0.000 0.000 0.480 NA
#> GSM35458     5  0.0972      0.710 0.000 0.008 0.000 0.000 0.964 NA
#> GSM35460     3  0.0891      0.847 0.000 0.000 0.968 0.000 0.008 NA
#> GSM35461     5  0.6407      0.256 0.020 0.000 0.220 0.012 0.512 NA
#> GSM35463     2  0.2455      0.734 0.000 0.872 0.012 0.000 0.004 NA
#> GSM35472     3  0.5271      0.509 0.000 0.000 0.592 0.004 0.284 NA
#> GSM35475     5  0.1511      0.709 0.000 0.012 0.012 0.000 0.944 NA
#> GSM35483     2  0.4121      0.676 0.000 0.772 0.032 0.000 0.048 NA
#> GSM35496     3  0.3714      0.796 0.000 0.000 0.800 0.020 0.044 NA
#> GSM35497     5  0.5085      0.404 0.000 0.272 0.000 0.000 0.608 NA
#> GSM35504     2  0.5561      0.636 0.000 0.664 0.088 0.004 0.068 NA
#> GSM35508     5  0.2221      0.692 0.000 0.032 0.000 0.000 0.896 NA
#> GSM35511     5  0.1921      0.691 0.000 0.000 0.052 0.000 0.916 NA
#> GSM35512     3  0.5049      0.551 0.000 0.000 0.624 0.004 0.268 NA
#> GSM35515     5  0.0972      0.710 0.000 0.008 0.000 0.000 0.964 NA
#> GSM35519     5  0.4100      0.587 0.000 0.004 0.148 0.004 0.764 NA
#> GSM35527     5  0.3520      0.639 0.000 0.100 0.000 0.000 0.804 NA
#> GSM35532     5  0.3566      0.593 0.000 0.000 0.156 0.000 0.788 NA
#> GSM35439     2  0.2129      0.767 0.000 0.904 0.000 0.000 0.040 NA
#> GSM35443     1  0.5222      0.550 0.616 0.000 0.004 0.052 0.028 NA
#> GSM35445     1  0.4840      0.534 0.680 0.000 0.152 0.004 0.000 NA
#> GSM35448     3  0.4251      0.724 0.000 0.116 0.768 0.000 0.024 NA
#> GSM35451     4  0.5495      0.224 0.404 0.000 0.000 0.468 0.000 NA
#> GSM35454     3  0.2695      0.808 0.004 0.008 0.844 0.000 0.000 NA
#> GSM35457     2  0.5547      0.616 0.000 0.640 0.000 0.036 0.148 NA
#> GSM35465     2  0.7078      0.440 0.000 0.448 0.000 0.228 0.108 NA
#> GSM35468     1  0.4593      0.596 0.680 0.000 0.000 0.048 0.016 NA
#> GSM35471     4  0.3274      0.629 0.096 0.000 0.000 0.824 0.000 NA
#> GSM35473     1  0.2848      0.660 0.856 0.000 0.036 0.004 0.000 NA
#> GSM35477     4  0.5523      0.307 0.360 0.000 0.000 0.500 0.000 NA
#> GSM35480     1  0.4999      0.536 0.704 0.000 0.036 0.144 0.000 NA
#> GSM35482     3  0.3702      0.800 0.000 0.000 0.808 0.072 0.016 NA
#> GSM35485     2  0.1524      0.758 0.000 0.932 0.000 0.000 0.008 NA
#> GSM35489     2  0.3694      0.743 0.000 0.804 0.000 0.016 0.056 NA
#> GSM35492     1  0.4615      0.593 0.676 0.000 0.000 0.048 0.016 NA
#> GSM35495     3  0.0603      0.849 0.000 0.004 0.980 0.000 0.000 NA
#> GSM35499     2  0.3541      0.752 0.000 0.812 0.008 0.044 0.004 NA
#> GSM35502     1  0.0363      0.681 0.988 0.000 0.000 0.012 0.000 NA
#> GSM35505     3  0.2420      0.821 0.004 0.004 0.864 0.000 0.000 NA
#> GSM35507     4  0.4324      0.632 0.016 0.044 0.000 0.760 0.016 NA
#> GSM35510     2  0.3121      0.756 0.000 0.824 0.000 0.008 0.020 NA
#> GSM35514     1  0.0603      0.682 0.980 0.000 0.000 0.004 0.000 NA
#> GSM35517     2  0.2164      0.768 0.000 0.908 0.000 0.008 0.028 NA
#> GSM35520     5  0.5489      0.179 0.000 0.412 0.032 0.000 0.500 NA
#> GSM35523     4  0.1341      0.659 0.024 0.000 0.000 0.948 0.000 NA
#> GSM35529     2  0.5228      0.607 0.000 0.648 0.000 0.012 0.172 NA
#> GSM35531     2  0.2203      0.759 0.000 0.896 0.004 0.000 0.016 NA
#> GSM35534     2  0.1970      0.745 0.000 0.900 0.000 0.000 0.008 NA
#> GSM35536     1  0.1845      0.678 0.920 0.000 0.000 0.028 0.000 NA
#> GSM35538     1  0.4887      0.313 0.624 0.000 0.000 0.280 0.000 NA
#> GSM35539     1  0.5226     -0.149 0.460 0.000 0.000 0.448 0.000 NA
#> GSM35540     2  0.7431      0.347 0.000 0.392 0.000 0.232 0.164 NA
#> GSM35541     2  0.1863      0.768 0.000 0.920 0.000 0.000 0.036 NA
#> GSM35442     1  0.6706      0.380 0.456 0.000 0.108 0.048 0.024 NA
#> GSM35447     3  0.2680      0.828 0.004 0.000 0.856 0.000 0.016 NA
#> GSM35450     1  0.5290      0.109 0.544 0.000 0.000 0.340 0.000 NA
#> GSM35453     1  0.5287      0.404 0.588 0.000 0.288 0.004 0.000 NA
#> GSM35456     4  0.6792      0.447 0.248 0.080 0.000 0.480 0.000 NA
#> GSM35464     4  0.5118      0.507 0.000 0.108 0.000 0.688 0.036 NA
#> GSM35467     1  0.0520      0.683 0.984 0.000 0.000 0.008 0.000 NA
#> GSM35470     4  0.7950      0.116 0.176 0.000 0.220 0.304 0.016 NA
#> GSM35479     3  0.2365      0.830 0.000 0.000 0.888 0.040 0.000 NA
#> GSM35484     1  0.4178      0.607 0.748 0.012 0.020 0.020 0.000 NA
#> GSM35488     1  0.4594      0.604 0.700 0.000 0.000 0.072 0.012 NA
#> GSM35491     1  0.4615      0.593 0.676 0.000 0.000 0.048 0.016 NA
#> GSM35494     3  0.1867      0.843 0.000 0.000 0.916 0.020 0.000 NA
#> GSM35498     4  0.1858      0.651 0.004 0.000 0.000 0.904 0.000 NA
#> GSM35501     1  0.0508      0.680 0.984 0.000 0.000 0.012 0.000 NA
#> GSM35509     3  0.0777      0.849 0.000 0.000 0.972 0.004 0.000 NA
#> GSM35513     1  0.0458      0.683 0.984 0.000 0.000 0.000 0.000 NA
#> GSM35516     2  0.2933      0.753 0.000 0.852 0.000 0.032 0.008 NA
#> GSM35522     4  0.1245      0.659 0.016 0.000 0.000 0.952 0.000 NA
#> GSM35525     1  0.4212      0.452 0.688 0.000 0.000 0.264 0.000 NA
#> GSM35528     4  0.5771      0.294 0.252 0.000 0.000 0.532 0.004 NA
#> GSM35533     1  0.4279      0.616 0.752 0.004 0.016 0.056 0.000 NA
#> GSM35537     4  0.4924      0.565 0.096 0.000 0.076 0.728 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)

plot of chunk tab-CV-skmeans-consensus-heatmap-1

consensus_heatmap(res, k = 3)

plot of chunk tab-CV-skmeans-consensus-heatmap-2

consensus_heatmap(res, k = 4)

plot of chunk tab-CV-skmeans-consensus-heatmap-3

consensus_heatmap(res, k = 5)

plot of chunk tab-CV-skmeans-consensus-heatmap-4

consensus_heatmap(res, k = 6)

plot of chunk tab-CV-skmeans-consensus-heatmap-5

Heatmaps for the membership of samples in all partitions to see how consistent they are:

membership_heatmap(res, k = 2)

plot of chunk tab-CV-skmeans-membership-heatmap-1

membership_heatmap(res, k = 3)

plot of chunk tab-CV-skmeans-membership-heatmap-2

membership_heatmap(res, k = 4)

plot of chunk tab-CV-skmeans-membership-heatmap-3

membership_heatmap(res, k = 5)

plot of chunk tab-CV-skmeans-membership-heatmap-4

membership_heatmap(res, k = 6)

plot of chunk tab-CV-skmeans-membership-heatmap-5

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)

plot of chunk tab-CV-skmeans-get-signatures-1

get_signatures(res, k = 3)

plot of chunk tab-CV-skmeans-get-signatures-2

get_signatures(res, k = 4)

plot of chunk tab-CV-skmeans-get-signatures-3

get_signatures(res, k = 5)

plot of chunk tab-CV-skmeans-get-signatures-4

get_signatures(res, k = 6)

plot of chunk tab-CV-skmeans-get-signatures-5

Signature heatmaps where rows are not scaled:

get_signatures(res, k = 2, scale_rows = FALSE)

plot of chunk tab-CV-skmeans-get-signatures-no-scale-1

get_signatures(res, k = 3, scale_rows = FALSE)

plot of chunk tab-CV-skmeans-get-signatures-no-scale-2

get_signatures(res, k = 4, scale_rows = FALSE)

plot of chunk tab-CV-skmeans-get-signatures-no-scale-3

get_signatures(res, k = 5, scale_rows = FALSE)

plot of chunk tab-CV-skmeans-get-signatures-no-scale-4

get_signatures(res, k = 6, scale_rows = FALSE)

plot of chunk tab-CV-skmeans-get-signatures-no-scale-5

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk CV-skmeans-signature_compare

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:

  1. which_row: row indices corresponding to the input matrix.
  2. fdr: FDR for the differential test.
  3. mean_x: The mean value in group x.
  4. scaled_mean_x: The mean value in group x after rows are scaled.
  5. 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")

plot of chunk tab-CV-skmeans-dimension-reduction-1

dimension_reduction(res, k = 3, method = "UMAP")

plot of chunk tab-CV-skmeans-dimension-reduction-2

dimension_reduction(res, k = 4, method = "UMAP")

plot of chunk tab-CV-skmeans-dimension-reduction-3

dimension_reduction(res, k = 5, method = "UMAP")

plot of chunk tab-CV-skmeans-dimension-reduction-4

dimension_reduction(res, k = 6, method = "UMAP")

plot of chunk tab-CV-skmeans-dimension-reduction-5

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk CV-skmeans-collect-classes

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  time(p) k
#> CV:skmeans 79 3.41e-07 2
#> CV:skmeans 77 2.91e-05 3
#> CV:skmeans 44 8.32e-02 4
#> CV:skmeans 67 5.27e-07 5
#> CV:skmeans 61 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.


CV:pam

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 7758 rows and 79 columns.
#>   Top rows (776, 1552, 2328, 3103, 3879) 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 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)

plot of chunk CV-pam-collect-plots

The plots are:

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:

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)

plot of chunk CV-pam-select-partition-number

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.616           0.875       0.926         0.4746 0.529   0.529
#> 3 3 0.520           0.749       0.851         0.3512 0.804   0.643
#> 4 4 0.629           0.665       0.826         0.1613 0.811   0.535
#> 5 5 0.676           0.673       0.786         0.0480 0.911   0.684
#> 6 6 0.685           0.568       0.784         0.0321 0.969   0.870

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.

show/hide code output

cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#>          class entropy silhouette    p1    p2
#> GSM35441     2  0.0938      0.945 0.012 0.988
#> GSM35446     1  0.9323      0.601 0.652 0.348
#> GSM35449     2  0.1184      0.945 0.016 0.984
#> GSM35455     2  0.0000      0.945 0.000 1.000
#> GSM35458     1  0.9044      0.634 0.680 0.320
#> GSM35460     1  0.7674      0.787 0.776 0.224
#> GSM35461     1  0.3879      0.899 0.924 0.076
#> GSM35463     2  0.0672      0.944 0.008 0.992
#> GSM35472     1  0.6712      0.828 0.824 0.176
#> GSM35475     1  0.9248      0.615 0.660 0.340
#> GSM35483     2  0.0376      0.945 0.004 0.996
#> GSM35496     1  0.2043      0.913 0.968 0.032
#> GSM35497     2  0.0000      0.945 0.000 1.000
#> GSM35504     2  0.2778      0.926 0.048 0.952
#> GSM35508     2  0.0376      0.946 0.004 0.996
#> GSM35511     2  0.4022      0.896 0.080 0.920
#> GSM35512     1  0.7139      0.815 0.804 0.196
#> GSM35515     1  0.7376      0.797 0.792 0.208
#> GSM35519     1  0.7528      0.795 0.784 0.216
#> GSM35527     2  0.0376      0.946 0.004 0.996
#> GSM35532     2  0.9000      0.490 0.316 0.684
#> GSM35439     2  0.0938      0.945 0.012 0.988
#> GSM35443     1  0.2043      0.913 0.968 0.032
#> GSM35445     1  0.0376      0.910 0.996 0.004
#> GSM35448     2  0.4815      0.873 0.104 0.896
#> GSM35451     1  0.2236      0.910 0.964 0.036
#> GSM35454     1  0.5946      0.855 0.856 0.144
#> GSM35457     2  0.1184      0.944 0.016 0.984
#> GSM35465     2  0.1633      0.942 0.024 0.976
#> GSM35468     1  0.1414      0.913 0.980 0.020
#> GSM35471     1  0.4022      0.897 0.920 0.080
#> GSM35473     1  0.0376      0.910 0.996 0.004
#> GSM35477     1  0.1843      0.911 0.972 0.028
#> GSM35480     1  0.1633      0.914 0.976 0.024
#> GSM35482     1  0.3274      0.907 0.940 0.060
#> GSM35485     2  0.0672      0.944 0.008 0.992
#> GSM35489     2  0.0938      0.945 0.012 0.988
#> GSM35492     1  0.0000      0.910 1.000 0.000
#> GSM35495     1  0.7056      0.821 0.808 0.192
#> GSM35499     2  0.3584      0.916 0.068 0.932
#> GSM35502     1  0.0000      0.910 1.000 0.000
#> GSM35505     1  0.3733      0.894 0.928 0.072
#> GSM35507     1  0.9170      0.559 0.668 0.332
#> GSM35510     2  0.0376      0.945 0.004 0.996
#> GSM35514     1  0.0000      0.910 1.000 0.000
#> GSM35517     2  0.0000      0.945 0.000 1.000
#> GSM35520     1  0.9983      0.293 0.524 0.476
#> GSM35523     1  0.6531      0.834 0.832 0.168
#> GSM35529     2  0.0376      0.946 0.004 0.996
#> GSM35531     2  0.3733      0.911 0.072 0.928
#> GSM35534     2  0.0000      0.945 0.000 1.000
#> GSM35536     1  0.0000      0.910 1.000 0.000
#> GSM35538     1  0.0376      0.911 0.996 0.004
#> GSM35539     1  0.1184      0.913 0.984 0.016
#> GSM35540     2  0.3431      0.919 0.064 0.936
#> GSM35541     2  0.0672      0.944 0.008 0.992
#> GSM35442     1  0.1843      0.913 0.972 0.028
#> GSM35447     1  0.4939      0.885 0.892 0.108
#> GSM35450     1  0.0000      0.910 1.000 0.000
#> GSM35453     1  0.0000      0.910 1.000 0.000
#> GSM35456     1  0.5946      0.851 0.856 0.144
#> GSM35464     2  0.3733      0.914 0.072 0.928
#> GSM35467     1  0.0000      0.910 1.000 0.000
#> GSM35470     1  0.2236      0.913 0.964 0.036
#> GSM35479     1  0.2236      0.913 0.964 0.036
#> GSM35484     1  0.2043      0.913 0.968 0.032
#> GSM35488     1  0.0000      0.910 1.000 0.000
#> GSM35491     1  0.1414      0.913 0.980 0.020
#> GSM35494     1  0.2778      0.912 0.952 0.048
#> GSM35498     2  0.8081      0.684 0.248 0.752
#> GSM35501     1  0.0000      0.910 1.000 0.000
#> GSM35509     1  0.3584      0.905 0.932 0.068
#> GSM35513     1  0.0000      0.910 1.000 0.000
#> GSM35516     2  0.0672      0.944 0.008 0.992
#> GSM35522     2  0.6712      0.808 0.176 0.824
#> GSM35525     1  0.0000      0.910 1.000 0.000
#> GSM35528     1  0.2043      0.914 0.968 0.032
#> GSM35533     1  0.2043      0.912 0.968 0.032
#> GSM35537     1  0.2603      0.911 0.956 0.044

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>          class entropy silhouette    p1    p2    p3
#> GSM35441     2  0.0747     0.8745 0.000 0.984 0.016
#> GSM35446     3  0.1031     0.7984 0.000 0.024 0.976
#> GSM35449     2  0.0237     0.8767 0.000 0.996 0.004
#> GSM35455     2  0.0000     0.8763 0.000 1.000 0.000
#> GSM35458     1  0.8546     0.4407 0.588 0.276 0.136
#> GSM35460     3  0.1129     0.8006 0.004 0.020 0.976
#> GSM35461     3  0.4521     0.7713 0.180 0.004 0.816
#> GSM35463     2  0.1964     0.8632 0.000 0.944 0.056
#> GSM35472     3  0.3213     0.8057 0.092 0.008 0.900
#> GSM35475     3  0.7880     0.7007 0.164 0.168 0.668
#> GSM35483     2  0.2261     0.8527 0.000 0.932 0.068
#> GSM35496     3  0.4062     0.7813 0.164 0.000 0.836
#> GSM35497     2  0.0000     0.8763 0.000 1.000 0.000
#> GSM35504     2  0.3686     0.8009 0.000 0.860 0.140
#> GSM35508     2  0.0237     0.8755 0.000 0.996 0.004
#> GSM35511     3  0.6416     0.5693 0.020 0.304 0.676
#> GSM35512     3  0.4475     0.7950 0.144 0.016 0.840
#> GSM35515     1  0.7899     0.6186 0.664 0.144 0.192
#> GSM35519     3  0.5060     0.7889 0.156 0.028 0.816
#> GSM35527     2  0.0000     0.8763 0.000 1.000 0.000
#> GSM35532     3  0.4446     0.7874 0.032 0.112 0.856
#> GSM35439     2  0.0237     0.8766 0.000 0.996 0.004
#> GSM35443     1  0.4834     0.7530 0.792 0.004 0.204
#> GSM35445     1  0.2625     0.8098 0.916 0.000 0.084
#> GSM35448     3  0.4291     0.6953 0.000 0.180 0.820
#> GSM35451     1  0.4178     0.7860 0.828 0.000 0.172
#> GSM35454     1  0.6836     0.6461 0.572 0.016 0.412
#> GSM35457     2  0.0592     0.8754 0.000 0.988 0.012
#> GSM35465     2  0.1289     0.8696 0.000 0.968 0.032
#> GSM35468     1  0.3619     0.7909 0.864 0.000 0.136
#> GSM35471     1  0.5706     0.7264 0.680 0.000 0.320
#> GSM35473     1  0.0892     0.8058 0.980 0.000 0.020
#> GSM35477     1  0.3941     0.7913 0.844 0.000 0.156
#> GSM35480     1  0.4887     0.7799 0.772 0.000 0.228
#> GSM35482     1  0.6264     0.6997 0.616 0.004 0.380
#> GSM35485     2  0.0892     0.8746 0.000 0.980 0.020
#> GSM35489     2  0.0747     0.8758 0.000 0.984 0.016
#> GSM35492     1  0.2066     0.7932 0.940 0.000 0.060
#> GSM35495     3  0.1491     0.7952 0.016 0.016 0.968
#> GSM35499     2  0.5650     0.5864 0.000 0.688 0.312
#> GSM35502     1  0.0237     0.8073 0.996 0.000 0.004
#> GSM35505     1  0.5315     0.7209 0.772 0.012 0.216
#> GSM35507     1  0.9133     0.5159 0.528 0.176 0.296
#> GSM35510     2  0.1031     0.8737 0.000 0.976 0.024
#> GSM35514     1  0.0424     0.8071 0.992 0.000 0.008
#> GSM35517     2  0.1031     0.8737 0.000 0.976 0.024
#> GSM35520     2  0.8140    -0.1675 0.456 0.476 0.068
#> GSM35523     1  0.7367     0.6923 0.648 0.060 0.292
#> GSM35529     2  0.0000     0.8763 0.000 1.000 0.000
#> GSM35531     2  0.4189     0.8146 0.056 0.876 0.068
#> GSM35534     2  0.1031     0.8737 0.000 0.976 0.024
#> GSM35536     1  0.0237     0.8064 0.996 0.000 0.004
#> GSM35538     1  0.0424     0.8089 0.992 0.000 0.008
#> GSM35539     1  0.4062     0.7910 0.836 0.000 0.164
#> GSM35540     2  0.3752     0.7792 0.000 0.856 0.144
#> GSM35541     2  0.0000     0.8763 0.000 1.000 0.000
#> GSM35442     1  0.4399     0.7672 0.812 0.000 0.188
#> GSM35447     1  0.5681     0.6951 0.748 0.016 0.236
#> GSM35450     1  0.3619     0.7917 0.864 0.000 0.136
#> GSM35453     1  0.1289     0.8097 0.968 0.000 0.032
#> GSM35456     1  0.6172     0.7274 0.680 0.012 0.308
#> GSM35464     2  0.4178     0.7440 0.000 0.828 0.172
#> GSM35467     1  0.0237     0.8064 0.996 0.000 0.004
#> GSM35470     1  0.4842     0.7718 0.776 0.000 0.224
#> GSM35479     3  0.6126    -0.0216 0.400 0.000 0.600
#> GSM35484     1  0.3965     0.8056 0.860 0.008 0.132
#> GSM35488     1  0.1753     0.7953 0.952 0.000 0.048
#> GSM35491     1  0.3267     0.7952 0.884 0.000 0.116
#> GSM35494     1  0.6033     0.7159 0.660 0.004 0.336
#> GSM35498     2  0.9135     0.3074 0.208 0.544 0.248
#> GSM35501     1  0.0237     0.8073 0.996 0.000 0.004
#> GSM35509     3  0.1878     0.7667 0.044 0.004 0.952
#> GSM35513     1  0.0237     0.8064 0.996 0.000 0.004
#> GSM35516     2  0.1529     0.8701 0.000 0.960 0.040
#> GSM35522     2  0.9111     0.2993 0.176 0.532 0.292
#> GSM35525     1  0.2959     0.8021 0.900 0.000 0.100
#> GSM35528     1  0.4172     0.7863 0.840 0.004 0.156
#> GSM35533     1  0.4605     0.7797 0.796 0.000 0.204
#> GSM35537     1  0.5722     0.7400 0.704 0.004 0.292

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>          class entropy silhouette    p1    p2    p3    p4
#> GSM35441     2  0.0188     0.9300 0.000 0.996 0.004 0.000
#> GSM35446     3  0.0524     0.8333 0.000 0.004 0.988 0.008
#> GSM35449     2  0.0188     0.9300 0.000 0.996 0.004 0.000
#> GSM35455     2  0.0188     0.9300 0.000 0.996 0.004 0.000
#> GSM35458     1  0.5126     0.6381 0.792 0.116 0.028 0.064
#> GSM35460     3  0.0524     0.8333 0.000 0.004 0.988 0.008
#> GSM35461     1  0.6626     0.1545 0.544 0.000 0.364 0.092
#> GSM35463     2  0.3051     0.8808 0.000 0.884 0.028 0.088
#> GSM35472     3  0.2915     0.8412 0.080 0.000 0.892 0.028
#> GSM35475     3  0.3557     0.8241 0.108 0.036 0.856 0.000
#> GSM35483     2  0.4387     0.8083 0.000 0.804 0.052 0.144
#> GSM35496     3  0.3612     0.8250 0.100 0.000 0.856 0.044
#> GSM35497     2  0.0188     0.9300 0.000 0.996 0.004 0.000
#> GSM35504     2  0.4940     0.7884 0.000 0.776 0.128 0.096
#> GSM35508     2  0.0564     0.9290 0.004 0.988 0.004 0.004
#> GSM35511     3  0.3858     0.8014 0.056 0.100 0.844 0.000
#> GSM35512     3  0.2376     0.8458 0.068 0.000 0.916 0.016
#> GSM35515     1  0.4149     0.6901 0.840 0.032 0.020 0.108
#> GSM35519     3  0.3700     0.8300 0.096 0.008 0.860 0.036
#> GSM35527     2  0.0376     0.9295 0.000 0.992 0.004 0.004
#> GSM35532     3  0.3161     0.8434 0.056 0.028 0.896 0.020
#> GSM35439     2  0.0000     0.9297 0.000 1.000 0.000 0.000
#> GSM35443     1  0.3196     0.6939 0.856 0.000 0.008 0.136
#> GSM35445     1  0.5979     0.5400 0.692 0.000 0.136 0.172
#> GSM35448     3  0.2319     0.8160 0.000 0.040 0.924 0.036
#> GSM35451     4  0.2814     0.6762 0.132 0.000 0.000 0.868
#> GSM35454     4  0.7648    -0.1135 0.392 0.008 0.160 0.440
#> GSM35457     2  0.0336     0.9293 0.000 0.992 0.000 0.008
#> GSM35465     2  0.0817     0.9248 0.000 0.976 0.000 0.024
#> GSM35468     1  0.2546     0.7161 0.900 0.000 0.008 0.092
#> GSM35471     4  0.0376     0.7007 0.004 0.000 0.004 0.992
#> GSM35473     1  0.1936     0.7224 0.940 0.000 0.032 0.028
#> GSM35477     4  0.4776     0.4042 0.376 0.000 0.000 0.624
#> GSM35480     4  0.2670     0.7033 0.072 0.000 0.024 0.904
#> GSM35482     1  0.6082     0.0891 0.480 0.000 0.044 0.476
#> GSM35485     2  0.0376     0.9287 0.000 0.992 0.004 0.004
#> GSM35489     2  0.0469     0.9290 0.000 0.988 0.000 0.012
#> GSM35492     1  0.0672     0.7241 0.984 0.000 0.008 0.008
#> GSM35495     3  0.1675     0.8286 0.004 0.004 0.948 0.044
#> GSM35499     4  0.5296    -0.2376 0.000 0.496 0.008 0.496
#> GSM35502     1  0.4994    -0.1367 0.520 0.000 0.000 0.480
#> GSM35505     3  0.5349     0.2590 0.368 0.004 0.616 0.012
#> GSM35507     4  0.1109     0.6958 0.004 0.028 0.000 0.968
#> GSM35510     2  0.0376     0.9287 0.000 0.992 0.004 0.004
#> GSM35514     1  0.2216     0.6973 0.908 0.000 0.000 0.092
#> GSM35517     2  0.0376     0.9287 0.000 0.992 0.004 0.004
#> GSM35520     2  0.6186     0.6268 0.196 0.692 0.100 0.012
#> GSM35523     4  0.1389     0.6953 0.048 0.000 0.000 0.952
#> GSM35529     2  0.0188     0.9300 0.000 0.996 0.004 0.000
#> GSM35531     2  0.5460     0.7862 0.032 0.768 0.060 0.140
#> GSM35534     2  0.1305     0.9165 0.000 0.960 0.036 0.004
#> GSM35536     1  0.1867     0.7109 0.928 0.000 0.000 0.072
#> GSM35538     4  0.4999     0.1268 0.492 0.000 0.000 0.508
#> GSM35539     4  0.4193     0.5721 0.268 0.000 0.000 0.732
#> GSM35540     2  0.2814     0.8521 0.000 0.868 0.000 0.132
#> GSM35541     2  0.0188     0.9300 0.000 0.996 0.004 0.000
#> GSM35442     1  0.3032     0.7005 0.868 0.000 0.008 0.124
#> GSM35447     1  0.4675     0.6291 0.736 0.000 0.244 0.020
#> GSM35450     4  0.3266     0.6591 0.168 0.000 0.000 0.832
#> GSM35453     1  0.6327     0.4535 0.652 0.000 0.132 0.216
#> GSM35456     4  0.0657     0.7028 0.012 0.000 0.004 0.984
#> GSM35464     2  0.3074     0.8317 0.000 0.848 0.000 0.152
#> GSM35467     1  0.1474     0.7166 0.948 0.000 0.000 0.052
#> GSM35470     4  0.4428     0.5019 0.276 0.000 0.004 0.720
#> GSM35479     4  0.3229     0.6669 0.072 0.000 0.048 0.880
#> GSM35484     1  0.4098     0.6716 0.784 0.000 0.012 0.204
#> GSM35488     1  0.0336     0.7230 0.992 0.000 0.000 0.008
#> GSM35491     1  0.1807     0.7258 0.940 0.000 0.008 0.052
#> GSM35494     4  0.5619     0.5847 0.124 0.000 0.152 0.724
#> GSM35498     1  0.5636     0.2522 0.544 0.016 0.004 0.436
#> GSM35501     1  0.4985    -0.1289 0.532 0.000 0.000 0.468
#> GSM35509     3  0.5158     0.1929 0.000 0.004 0.524 0.472
#> GSM35513     1  0.1637     0.7156 0.940 0.000 0.000 0.060
#> GSM35516     2  0.3404     0.8685 0.000 0.864 0.032 0.104
#> GSM35522     4  0.0657     0.6993 0.004 0.012 0.000 0.984
#> GSM35525     4  0.4866     0.3573 0.404 0.000 0.000 0.596
#> GSM35528     4  0.5203     0.1956 0.416 0.000 0.008 0.576
#> GSM35533     4  0.2860     0.6891 0.100 0.004 0.008 0.888
#> GSM35537     4  0.1474     0.6958 0.052 0.000 0.000 0.948

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>          class entropy silhouette    p1    p2    p3    p4    p5
#> GSM35441     2  0.0162      0.895 0.000 0.996 0.000 0.000 0.004
#> GSM35446     5  0.4126      0.373 0.000 0.000 0.380 0.000 0.620
#> GSM35449     2  0.0162      0.895 0.000 0.996 0.000 0.000 0.004
#> GSM35455     2  0.0162      0.895 0.000 0.996 0.000 0.000 0.004
#> GSM35458     1  0.6024      0.618 0.668 0.016 0.196 0.024 0.096
#> GSM35460     5  0.3949      0.505 0.000 0.000 0.332 0.000 0.668
#> GSM35461     1  0.5720      0.442 0.596 0.000 0.020 0.060 0.324
#> GSM35463     2  0.3275      0.850 0.000 0.860 0.064 0.068 0.008
#> GSM35472     5  0.1701      0.831 0.016 0.000 0.028 0.012 0.944
#> GSM35475     5  0.3495      0.713 0.032 0.000 0.152 0.000 0.816
#> GSM35483     2  0.4747      0.762 0.000 0.764 0.116 0.100 0.020
#> GSM35496     5  0.2522      0.815 0.028 0.000 0.056 0.012 0.904
#> GSM35497     2  0.0162      0.895 0.000 0.996 0.000 0.000 0.004
#> GSM35504     2  0.5360      0.623 0.000 0.676 0.244 0.052 0.028
#> GSM35508     2  0.2032      0.872 0.000 0.924 0.052 0.004 0.020
#> GSM35511     5  0.1808      0.812 0.004 0.020 0.040 0.000 0.936
#> GSM35512     5  0.1644      0.834 0.012 0.004 0.028 0.008 0.948
#> GSM35515     1  0.5833      0.625 0.676 0.004 0.192 0.032 0.096
#> GSM35519     5  0.1383      0.833 0.012 0.008 0.012 0.008 0.960
#> GSM35527     2  0.0854      0.892 0.000 0.976 0.012 0.004 0.008
#> GSM35532     5  0.0566      0.830 0.004 0.000 0.012 0.000 0.984
#> GSM35439     2  0.0404      0.894 0.000 0.988 0.012 0.000 0.000
#> GSM35443     1  0.3275      0.752 0.860 0.000 0.008 0.068 0.064
#> GSM35445     3  0.5656      0.484 0.316 0.000 0.592 0.088 0.004
#> GSM35448     3  0.4511      0.257 0.000 0.000 0.628 0.016 0.356
#> GSM35451     4  0.2624      0.683 0.116 0.000 0.012 0.872 0.000
#> GSM35454     3  0.5808      0.560 0.064 0.004 0.600 0.316 0.016
#> GSM35457     2  0.0290      0.895 0.000 0.992 0.000 0.008 0.000
#> GSM35465     2  0.0865      0.891 0.000 0.972 0.000 0.024 0.004
#> GSM35468     1  0.2369      0.774 0.908 0.000 0.004 0.032 0.056
#> GSM35471     4  0.0798      0.678 0.016 0.000 0.008 0.976 0.000
#> GSM35473     1  0.2206      0.743 0.912 0.000 0.068 0.016 0.004
#> GSM35477     4  0.4735      0.610 0.284 0.000 0.044 0.672 0.000
#> GSM35480     4  0.3651      0.669 0.060 0.000 0.108 0.828 0.004
#> GSM35482     4  0.7123      0.124 0.368 0.000 0.220 0.392 0.020
#> GSM35485     2  0.0880      0.891 0.000 0.968 0.032 0.000 0.000
#> GSM35489     2  0.0955      0.893 0.000 0.968 0.028 0.004 0.000
#> GSM35492     1  0.1764      0.774 0.928 0.000 0.008 0.000 0.064
#> GSM35495     3  0.4564      0.234 0.000 0.000 0.612 0.016 0.372
#> GSM35499     2  0.5582      0.445 0.000 0.564 0.060 0.368 0.008
#> GSM35502     4  0.5243      0.466 0.412 0.000 0.048 0.540 0.000
#> GSM35505     3  0.5794      0.543 0.228 0.004 0.624 0.000 0.144
#> GSM35507     4  0.1989      0.659 0.004 0.032 0.028 0.932 0.004
#> GSM35510     2  0.0510      0.894 0.000 0.984 0.016 0.000 0.000
#> GSM35514     1  0.2770      0.704 0.880 0.000 0.044 0.076 0.000
#> GSM35517     2  0.0404      0.895 0.000 0.988 0.012 0.000 0.000
#> GSM35520     2  0.6470      0.555 0.168 0.644 0.076 0.004 0.108
#> GSM35523     4  0.3523      0.639 0.048 0.000 0.096 0.844 0.012
#> GSM35529     2  0.0162      0.895 0.000 0.996 0.000 0.000 0.004
#> GSM35531     2  0.6272      0.650 0.036 0.668 0.096 0.176 0.024
#> GSM35534     2  0.1914      0.878 0.000 0.924 0.060 0.000 0.016
#> GSM35536     1  0.2708      0.715 0.884 0.000 0.044 0.072 0.000
#> GSM35538     4  0.5022      0.567 0.332 0.000 0.048 0.620 0.000
#> GSM35539     4  0.4028      0.664 0.192 0.000 0.040 0.768 0.000
#> GSM35540     2  0.3161      0.827 0.000 0.860 0.032 0.100 0.008
#> GSM35541     2  0.0000      0.895 0.000 1.000 0.000 0.000 0.000
#> GSM35442     1  0.2938      0.763 0.880 0.000 0.008 0.048 0.064
#> GSM35447     3  0.5331      0.458 0.344 0.000 0.600 0.008 0.048
#> GSM35450     4  0.2966      0.680 0.136 0.000 0.016 0.848 0.000
#> GSM35453     1  0.5891     -0.219 0.476 0.000 0.448 0.060 0.016
#> GSM35456     4  0.1492      0.668 0.008 0.000 0.040 0.948 0.004
#> GSM35464     2  0.3510      0.801 0.000 0.832 0.032 0.128 0.008
#> GSM35467     1  0.0693      0.761 0.980 0.000 0.008 0.012 0.000
#> GSM35470     4  0.5611      0.585 0.236 0.000 0.092 0.656 0.016
#> GSM35479     4  0.4972      0.531 0.060 0.000 0.196 0.724 0.020
#> GSM35484     1  0.3280      0.700 0.812 0.000 0.012 0.176 0.000
#> GSM35488     1  0.1331      0.774 0.952 0.000 0.008 0.000 0.040
#> GSM35491     1  0.2199      0.775 0.916 0.000 0.008 0.016 0.060
#> GSM35494     3  0.5721      0.535 0.084 0.000 0.640 0.256 0.020
#> GSM35498     1  0.5308      0.447 0.628 0.004 0.044 0.316 0.008
#> GSM35501     4  0.5255      0.522 0.388 0.000 0.052 0.560 0.000
#> GSM35509     3  0.5422      0.464 0.000 0.000 0.580 0.348 0.072
#> GSM35513     1  0.1992      0.737 0.924 0.000 0.044 0.032 0.000
#> GSM35516     2  0.3325      0.838 0.000 0.852 0.032 0.104 0.012
#> GSM35522     4  0.2679      0.646 0.004 0.004 0.096 0.884 0.012
#> GSM35525     4  0.4822      0.608 0.288 0.000 0.048 0.664 0.000
#> GSM35528     4  0.5336      0.291 0.428 0.000 0.008 0.528 0.036
#> GSM35533     4  0.2853      0.681 0.076 0.004 0.040 0.880 0.000
#> GSM35537     4  0.3661      0.640 0.056 0.000 0.096 0.836 0.012

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>          class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM35441     2  0.0000     0.8450 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM35446     3  0.3997    -0.0992 0.000 0.000 0.508 0.000 0.488 0.004
#> GSM35449     2  0.0260     0.8454 0.000 0.992 0.000 0.000 0.000 0.008
#> GSM35455     2  0.0000     0.8450 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM35458     1  0.4999     0.2883 0.500 0.008 0.000 0.004 0.040 0.448
#> GSM35460     5  0.4338     0.0173 0.000 0.000 0.484 0.000 0.496 0.020
#> GSM35461     1  0.4945     0.3864 0.636 0.000 0.004 0.020 0.296 0.044
#> GSM35463     2  0.5315     0.7591 0.000 0.704 0.100 0.044 0.016 0.136
#> GSM35472     5  0.1749     0.7881 0.024 0.000 0.036 0.000 0.932 0.008
#> GSM35475     5  0.4435     0.5304 0.024 0.000 0.004 0.000 0.580 0.392
#> GSM35483     2  0.5873     0.7092 0.000 0.652 0.148 0.056 0.016 0.128
#> GSM35496     5  0.3296     0.7408 0.044 0.000 0.044 0.000 0.848 0.064
#> GSM35497     2  0.0000     0.8450 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM35504     2  0.5561     0.5852 0.000 0.632 0.240 0.020 0.016 0.092
#> GSM35508     2  0.4584     0.7043 0.000 0.736 0.068 0.000 0.036 0.160
#> GSM35511     5  0.3701     0.7175 0.012 0.000 0.072 0.000 0.804 0.112
#> GSM35512     5  0.1708     0.7915 0.024 0.000 0.040 0.000 0.932 0.004
#> GSM35515     1  0.4772     0.2912 0.504 0.000 0.000 0.004 0.040 0.452
#> GSM35519     5  0.1313     0.7933 0.028 0.000 0.016 0.000 0.952 0.004
#> GSM35527     2  0.3155     0.7839 0.000 0.840 0.068 0.004 0.000 0.088
#> GSM35532     5  0.1218     0.7888 0.012 0.000 0.004 0.000 0.956 0.028
#> GSM35439     2  0.2145     0.8347 0.000 0.900 0.028 0.000 0.000 0.072
#> GSM35443     1  0.1976     0.6819 0.924 0.000 0.004 0.032 0.032 0.008
#> GSM35445     3  0.4703     0.5451 0.236 0.000 0.684 0.064 0.000 0.016
#> GSM35448     3  0.3094     0.5495 0.000 0.000 0.824 0.000 0.140 0.036
#> GSM35451     4  0.1075     0.6178 0.048 0.000 0.000 0.952 0.000 0.000
#> GSM35454     3  0.4451     0.5611 0.056 0.000 0.744 0.164 0.000 0.036
#> GSM35457     2  0.0146     0.8446 0.000 0.996 0.000 0.004 0.000 0.000
#> GSM35465     2  0.0717     0.8420 0.000 0.976 0.000 0.008 0.000 0.016
#> GSM35468     1  0.0922     0.7046 0.968 0.000 0.004 0.004 0.024 0.000
#> GSM35471     4  0.0993     0.5980 0.000 0.000 0.012 0.964 0.000 0.024
#> GSM35473     1  0.2045     0.6813 0.920 0.000 0.024 0.028 0.000 0.028
#> GSM35477     4  0.2872     0.5592 0.152 0.000 0.004 0.832 0.000 0.012
#> GSM35480     4  0.4194     0.5242 0.048 0.000 0.048 0.776 0.000 0.128
#> GSM35482     6  0.7927     0.0000 0.276 0.000 0.140 0.256 0.020 0.308
#> GSM35485     2  0.2563     0.8309 0.000 0.880 0.040 0.004 0.000 0.076
#> GSM35489     2  0.2688     0.8250 0.000 0.868 0.064 0.000 0.000 0.068
#> GSM35492     1  0.1194     0.7022 0.956 0.000 0.004 0.000 0.032 0.008
#> GSM35495     3  0.3263     0.5466 0.000 0.000 0.800 0.004 0.176 0.020
#> GSM35499     2  0.6062     0.4860 0.000 0.564 0.036 0.192 0.000 0.208
#> GSM35502     4  0.4217     0.3497 0.296 0.000 0.008 0.672 0.000 0.024
#> GSM35505     3  0.4225     0.6184 0.152 0.000 0.768 0.004 0.048 0.028
#> GSM35507     4  0.4080     0.4553 0.004 0.080 0.016 0.784 0.000 0.116
#> GSM35510     2  0.0436     0.8456 0.000 0.988 0.004 0.004 0.000 0.004
#> GSM35514     1  0.2734     0.6366 0.864 0.000 0.008 0.104 0.000 0.024
#> GSM35517     2  0.1194     0.8442 0.000 0.956 0.008 0.004 0.000 0.032
#> GSM35520     2  0.7408     0.5153 0.088 0.532 0.088 0.004 0.096 0.192
#> GSM35523     4  0.4657     0.2815 0.016 0.000 0.032 0.656 0.004 0.292
#> GSM35529     2  0.0000     0.8450 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM35531     2  0.7285     0.4177 0.036 0.488 0.124 0.276 0.008 0.068
#> GSM35534     2  0.4436     0.7832 0.000 0.752 0.096 0.004 0.016 0.132
#> GSM35536     1  0.3219     0.5887 0.808 0.000 0.008 0.168 0.000 0.016
#> GSM35538     4  0.3197     0.5298 0.176 0.000 0.008 0.804 0.000 0.012
#> GSM35539     4  0.2112     0.6076 0.088 0.000 0.000 0.896 0.000 0.016
#> GSM35540     2  0.2932     0.7729 0.000 0.836 0.004 0.020 0.000 0.140
#> GSM35541     2  0.0000     0.8450 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM35442     1  0.1647     0.6939 0.940 0.000 0.004 0.016 0.032 0.008
#> GSM35447     3  0.4378     0.5715 0.252 0.000 0.700 0.008 0.008 0.032
#> GSM35450     4  0.1349     0.6179 0.056 0.000 0.000 0.940 0.000 0.004
#> GSM35453     3  0.5574     0.2823 0.392 0.000 0.504 0.084 0.000 0.020
#> GSM35456     4  0.2971     0.5138 0.004 0.000 0.020 0.832 0.000 0.144
#> GSM35464     2  0.3304     0.7446 0.000 0.816 0.004 0.040 0.000 0.140
#> GSM35467     1  0.1370     0.6942 0.948 0.000 0.004 0.036 0.000 0.012
#> GSM35470     4  0.6250    -0.0134 0.176 0.000 0.024 0.532 0.008 0.260
#> GSM35479     4  0.6751    -0.2461 0.048 0.000 0.148 0.480 0.016 0.308
#> GSM35484     1  0.3349     0.5104 0.748 0.000 0.008 0.244 0.000 0.000
#> GSM35488     1  0.1007     0.7048 0.968 0.000 0.004 0.016 0.008 0.004
#> GSM35491     1  0.1116     0.7035 0.960 0.000 0.004 0.000 0.028 0.008
#> GSM35494     3  0.5770     0.4163 0.052 0.000 0.656 0.136 0.012 0.144
#> GSM35498     1  0.5456     0.1515 0.656 0.004 0.028 0.168 0.000 0.144
#> GSM35501     4  0.4012     0.4402 0.256 0.000 0.008 0.712 0.000 0.024
#> GSM35509     3  0.5484     0.3637 0.000 0.000 0.644 0.172 0.032 0.152
#> GSM35513     1  0.2588     0.6568 0.876 0.000 0.008 0.092 0.000 0.024
#> GSM35516     2  0.4251     0.7765 0.000 0.768 0.012 0.136 0.008 0.076
#> GSM35522     4  0.4235     0.3112 0.000 0.000 0.032 0.672 0.004 0.292
#> GSM35525     4  0.3183     0.5509 0.164 0.000 0.008 0.812 0.000 0.016
#> GSM35528     1  0.4862    -0.2917 0.480 0.000 0.004 0.480 0.020 0.016
#> GSM35533     4  0.1750     0.6130 0.040 0.000 0.016 0.932 0.000 0.012
#> GSM35537     4  0.4813     0.2756 0.024 0.000 0.032 0.648 0.004 0.292

Heatmaps for the consensus matrix. It visualizes the probability of two samples to be in a same group.

consensus_heatmap(res, k = 2)

plot of chunk tab-CV-pam-consensus-heatmap-1

consensus_heatmap(res, k = 3)

plot of chunk tab-CV-pam-consensus-heatmap-2

consensus_heatmap(res, k = 4)

plot of chunk tab-CV-pam-consensus-heatmap-3

consensus_heatmap(res, k = 5)

plot of chunk tab-CV-pam-consensus-heatmap-4

consensus_heatmap(res, k = 6)

plot of chunk tab-CV-pam-consensus-heatmap-5

Heatmaps for the membership of samples in all partitions to see how consistent they are:

membership_heatmap(res, k = 2)

plot of chunk tab-CV-pam-membership-heatmap-1

membership_heatmap(res, k = 3)

plot of chunk tab-CV-pam-membership-heatmap-2

membership_heatmap(res, k = 4)

plot of chunk tab-CV-pam-membership-heatmap-3

membership_heatmap(res, k = 5)

plot of chunk tab-CV-pam-membership-heatmap-4

membership_heatmap(res, k = 6)

plot of chunk tab-CV-pam-membership-heatmap-5

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)

plot of chunk tab-CV-pam-get-signatures-1

get_signatures(res, k = 3)

plot of chunk tab-CV-pam-get-signatures-2

get_signatures(res, k = 4)

plot of chunk tab-CV-pam-get-signatures-3

get_signatures(res, k = 5)

plot of chunk tab-CV-pam-get-signatures-4

get_signatures(res, k = 6)

plot of chunk tab-CV-pam-get-signatures-5

Signature heatmaps where rows are not scaled:

get_signatures(res, k = 2, scale_rows = FALSE)

plot of chunk tab-CV-pam-get-signatures-no-scale-1

get_signatures(res, k = 3, scale_rows = FALSE)

plot of chunk tab-CV-pam-get-signatures-no-scale-2

get_signatures(res, k = 4, scale_rows = FALSE)

plot of chunk tab-CV-pam-get-signatures-no-scale-3

get_signatures(res, k = 5, scale_rows = FALSE)

plot of chunk tab-CV-pam-get-signatures-no-scale-4

get_signatures(res, k = 6, scale_rows = FALSE)

plot of chunk tab-CV-pam-get-signatures-no-scale-5

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk CV-pam-signature_compare

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:

  1. which_row: row indices corresponding to the input matrix.
  2. fdr: FDR for the differential test.
  3. mean_x: The mean value in group x.
  4. scaled_mean_x: The mean value in group x after rows are scaled.
  5. 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")

plot of chunk tab-CV-pam-dimension-reduction-1

dimension_reduction(res, k = 3, method = "UMAP")

plot of chunk tab-CV-pam-dimension-reduction-2

dimension_reduction(res, k = 4, method = "UMAP")

plot of chunk tab-CV-pam-dimension-reduction-3

dimension_reduction(res, k = 5, method = "UMAP")

plot of chunk tab-CV-pam-dimension-reduction-4

dimension_reduction(res, k = 6, method = "UMAP")

plot of chunk tab-CV-pam-dimension-reduction-5

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk CV-pam-collect-classes

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  time(p) k
#> CV:pam 77 6.31e-02 2
#> CV:pam 74 7.17e-07 3
#> CV:pam 65 2.76e-05 4
#> CV:pam 66 1.30e-05 5
#> CV:pam 58 1.59e-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.


CV:mclust

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 7758 rows and 79 columns.
#>   Top rows (776, 1552, 2328, 3103, 3879) 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)

plot of chunk CV-mclust-collect-plots

The plots are:

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:

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)

plot of chunk CV-mclust-select-partition-number

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.610           0.850       0.916         0.3839 0.562   0.562
#> 3 3 0.819           0.821       0.901         0.7017 0.679   0.474
#> 4 4 0.761           0.846       0.908         0.1014 0.890   0.700
#> 5 5 0.751           0.723       0.811         0.0622 0.990   0.965
#> 6 6 0.725           0.464       0.752         0.0580 0.895   0.652

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.

show/hide code output

cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#>          class entropy silhouette    p1    p2
#> GSM35441     2  0.0000     0.9589 0.000 1.000
#> GSM35446     2  0.0000     0.9589 0.000 1.000
#> GSM35449     2  0.0000     0.9589 0.000 1.000
#> GSM35455     2  0.0000     0.9589 0.000 1.000
#> GSM35458     2  0.0000     0.9589 0.000 1.000
#> GSM35460     2  0.0000     0.9589 0.000 1.000
#> GSM35461     2  0.1184     0.9498 0.016 0.984
#> GSM35463     2  0.0000     0.9589 0.000 1.000
#> GSM35472     2  0.0000     0.9589 0.000 1.000
#> GSM35475     2  0.0000     0.9589 0.000 1.000
#> GSM35483     2  0.0000     0.9589 0.000 1.000
#> GSM35496     2  0.1184     0.9498 0.016 0.984
#> GSM35497     2  0.0000     0.9589 0.000 1.000
#> GSM35504     2  0.0000     0.9589 0.000 1.000
#> GSM35508     2  0.0000     0.9589 0.000 1.000
#> GSM35511     2  0.0000     0.9589 0.000 1.000
#> GSM35512     2  0.0000     0.9589 0.000 1.000
#> GSM35515     2  0.0000     0.9589 0.000 1.000
#> GSM35519     2  0.0000     0.9589 0.000 1.000
#> GSM35527     2  0.0000     0.9589 0.000 1.000
#> GSM35532     2  0.0000     0.9589 0.000 1.000
#> GSM35439     2  0.0000     0.9589 0.000 1.000
#> GSM35443     1  0.9993     0.4126 0.516 0.484
#> GSM35445     2  0.9580     0.1022 0.380 0.620
#> GSM35448     2  0.0000     0.9589 0.000 1.000
#> GSM35451     1  0.9608     0.6555 0.616 0.384
#> GSM35454     2  0.1184     0.9498 0.016 0.984
#> GSM35457     2  0.0000     0.9589 0.000 1.000
#> GSM35465     2  0.0000     0.9589 0.000 1.000
#> GSM35468     1  0.6712     0.8101 0.824 0.176
#> GSM35471     2  0.9522     0.1338 0.372 0.628
#> GSM35473     1  0.8909     0.7504 0.692 0.308
#> GSM35477     1  0.8861     0.7531 0.696 0.304
#> GSM35480     1  0.9209     0.7247 0.664 0.336
#> GSM35482     2  0.1184     0.9498 0.016 0.984
#> GSM35485     2  0.0000     0.9589 0.000 1.000
#> GSM35489     2  0.0000     0.9589 0.000 1.000
#> GSM35492     1  0.6887     0.8084 0.816 0.184
#> GSM35495     2  0.0938     0.9522 0.012 0.988
#> GSM35499     2  0.0000     0.9589 0.000 1.000
#> GSM35502     1  0.0000     0.7717 1.000 0.000
#> GSM35505     2  0.1184     0.9498 0.016 0.984
#> GSM35507     2  0.1184     0.9498 0.016 0.984
#> GSM35510     2  0.0000     0.9589 0.000 1.000
#> GSM35514     1  0.5737     0.8076 0.864 0.136
#> GSM35517     2  0.0000     0.9589 0.000 1.000
#> GSM35520     2  0.0000     0.9589 0.000 1.000
#> GSM35523     1  0.9491     0.6814 0.632 0.368
#> GSM35529     2  0.0000     0.9589 0.000 1.000
#> GSM35531     2  0.0000     0.9589 0.000 1.000
#> GSM35534     2  0.0000     0.9589 0.000 1.000
#> GSM35536     1  0.0000     0.7717 1.000 0.000
#> GSM35538     1  0.1184     0.7777 0.984 0.016
#> GSM35539     1  0.3431     0.7874 0.936 0.064
#> GSM35540     2  0.0000     0.9589 0.000 1.000
#> GSM35541     2  0.0000     0.9589 0.000 1.000
#> GSM35442     2  0.2043     0.9335 0.032 0.968
#> GSM35447     2  0.1184     0.9498 0.016 0.984
#> GSM35450     1  0.6438     0.7968 0.836 0.164
#> GSM35453     2  0.3879     0.8788 0.076 0.924
#> GSM35456     2  0.1184     0.9498 0.016 0.984
#> GSM35464     2  0.0000     0.9589 0.000 1.000
#> GSM35467     1  0.0000     0.7717 1.000 0.000
#> GSM35470     1  0.9850     0.5683 0.572 0.428
#> GSM35479     2  0.1184     0.9498 0.016 0.984
#> GSM35484     1  0.9491     0.6835 0.632 0.368
#> GSM35488     1  0.6623     0.8106 0.828 0.172
#> GSM35491     1  0.6623     0.8106 0.828 0.172
#> GSM35494     2  0.1184     0.9498 0.016 0.984
#> GSM35498     2  0.7674     0.6039 0.224 0.776
#> GSM35501     1  0.0000     0.7717 1.000 0.000
#> GSM35509     2  0.1184     0.9498 0.016 0.984
#> GSM35513     1  0.0000     0.7717 1.000 0.000
#> GSM35516     2  0.0000     0.9589 0.000 1.000
#> GSM35522     2  0.9635     0.0755 0.388 0.612
#> GSM35525     1  0.0000     0.7717 1.000 0.000
#> GSM35528     1  0.7815     0.7933 0.768 0.232
#> GSM35533     1  0.9491     0.6831 0.632 0.368
#> GSM35537     1  0.9087     0.7370 0.676 0.324

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>          class entropy silhouette    p1    p2    p3
#> GSM35441     2  0.1163     0.8205 0.000 0.972 0.028
#> GSM35446     3  0.1031     0.9153 0.000 0.024 0.976
#> GSM35449     2  0.1289     0.8215 0.000 0.968 0.032
#> GSM35455     2  0.1163     0.8205 0.000 0.972 0.028
#> GSM35458     2  0.6280     0.3243 0.000 0.540 0.460
#> GSM35460     3  0.1031     0.9153 0.000 0.024 0.976
#> GSM35461     3  0.3805     0.8392 0.092 0.024 0.884
#> GSM35463     2  0.2537     0.8145 0.000 0.920 0.080
#> GSM35472     3  0.1031     0.9030 0.000 0.024 0.976
#> GSM35475     2  0.6291     0.3045 0.000 0.532 0.468
#> GSM35483     2  0.2796     0.8085 0.000 0.908 0.092
#> GSM35496     3  0.1267     0.9042 0.004 0.024 0.972
#> GSM35497     2  0.1163     0.8205 0.000 0.972 0.028
#> GSM35504     2  0.6308     0.2380 0.000 0.508 0.492
#> GSM35508     2  0.6280     0.3243 0.000 0.540 0.460
#> GSM35511     3  0.4178     0.7397 0.000 0.172 0.828
#> GSM35512     3  0.1031     0.9030 0.000 0.024 0.976
#> GSM35515     2  0.6280     0.3243 0.000 0.540 0.460
#> GSM35519     3  0.2878     0.8490 0.000 0.096 0.904
#> GSM35527     2  0.6235     0.3553 0.000 0.564 0.436
#> GSM35532     3  0.1529     0.8977 0.000 0.040 0.960
#> GSM35439     2  0.1832     0.8270 0.036 0.956 0.008
#> GSM35443     1  0.3181     0.9369 0.912 0.024 0.064
#> GSM35445     1  0.3752     0.9190 0.884 0.020 0.096
#> GSM35448     3  0.1031     0.9153 0.000 0.024 0.976
#> GSM35451     1  0.1832     0.9490 0.956 0.008 0.036
#> GSM35454     3  0.1315     0.9155 0.008 0.020 0.972
#> GSM35457     2  0.1647     0.8255 0.036 0.960 0.004
#> GSM35465     2  0.1999     0.8272 0.036 0.952 0.012
#> GSM35468     1  0.2879     0.9400 0.924 0.024 0.052
#> GSM35471     1  0.3141     0.9370 0.912 0.020 0.068
#> GSM35473     1  0.3587     0.9255 0.892 0.020 0.088
#> GSM35477     1  0.1832     0.9490 0.956 0.008 0.036
#> GSM35480     1  0.3325     0.9333 0.904 0.020 0.076
#> GSM35482     3  0.1529     0.8992 0.040 0.000 0.960
#> GSM35485     2  0.1529     0.8253 0.000 0.960 0.040
#> GSM35489     2  0.1832     0.8270 0.036 0.956 0.008
#> GSM35492     1  0.2982     0.9392 0.920 0.024 0.056
#> GSM35495     3  0.1129     0.9169 0.004 0.020 0.976
#> GSM35499     2  0.2356     0.8169 0.000 0.928 0.072
#> GSM35502     1  0.0000     0.9391 1.000 0.000 0.000
#> GSM35505     3  0.1129     0.9169 0.004 0.020 0.976
#> GSM35507     2  0.6606     0.6250 0.236 0.716 0.048
#> GSM35510     2  0.1411     0.8257 0.000 0.964 0.036
#> GSM35514     1  0.1031     0.9481 0.976 0.000 0.024
#> GSM35517     2  0.1453     0.8290 0.024 0.968 0.008
#> GSM35520     2  0.7438     0.3600 0.036 0.536 0.428
#> GSM35523     1  0.1765     0.9494 0.956 0.004 0.040
#> GSM35529     2  0.1999     0.8251 0.036 0.952 0.012
#> GSM35531     2  0.2810     0.8251 0.036 0.928 0.036
#> GSM35534     2  0.1643     0.8253 0.000 0.956 0.044
#> GSM35536     1  0.0000     0.9391 1.000 0.000 0.000
#> GSM35538     1  0.0000     0.9391 1.000 0.000 0.000
#> GSM35539     1  0.0237     0.9406 0.996 0.000 0.004
#> GSM35540     2  0.5111     0.7682 0.036 0.820 0.144
#> GSM35541     2  0.1620     0.8290 0.024 0.964 0.012
#> GSM35442     3  0.7188    -0.0302 0.484 0.024 0.492
#> GSM35447     3  0.1129     0.9169 0.004 0.020 0.976
#> GSM35450     1  0.1015     0.9448 0.980 0.008 0.012
#> GSM35453     1  0.6627     0.5095 0.644 0.020 0.336
#> GSM35456     1  0.3325     0.9334 0.904 0.020 0.076
#> GSM35464     2  0.2269     0.8276 0.040 0.944 0.016
#> GSM35467     1  0.0000     0.9391 1.000 0.000 0.000
#> GSM35470     1  0.2537     0.9395 0.920 0.000 0.080
#> GSM35479     3  0.1647     0.9027 0.036 0.004 0.960
#> GSM35484     1  0.3234     0.9353 0.908 0.020 0.072
#> GSM35488     1  0.2879     0.9400 0.924 0.024 0.052
#> GSM35491     1  0.1529     0.9492 0.960 0.000 0.040
#> GSM35494     3  0.1129     0.9169 0.004 0.020 0.976
#> GSM35498     1  0.1860     0.9487 0.948 0.000 0.052
#> GSM35501     1  0.0000     0.9391 1.000 0.000 0.000
#> GSM35509     3  0.1129     0.9169 0.004 0.020 0.976
#> GSM35513     1  0.0000     0.9391 1.000 0.000 0.000
#> GSM35516     2  0.1643     0.8253 0.000 0.956 0.044
#> GSM35522     1  0.1989     0.9486 0.948 0.004 0.048
#> GSM35525     1  0.0000     0.9391 1.000 0.000 0.000
#> GSM35528     1  0.2879     0.9400 0.924 0.024 0.052
#> GSM35533     1  0.3234     0.9353 0.908 0.020 0.072
#> GSM35537     1  0.1753     0.9492 0.952 0.000 0.048

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>          class entropy silhouette    p1    p2    p3    p4
#> GSM35441     2  0.3907      0.686 0.000 0.768 0.000 0.232
#> GSM35446     3  0.0469      0.908 0.000 0.000 0.988 0.012
#> GSM35449     4  0.4955      0.215 0.000 0.444 0.000 0.556
#> GSM35455     2  0.4406      0.556 0.000 0.700 0.000 0.300
#> GSM35458     4  0.3550      0.838 0.000 0.044 0.096 0.860
#> GSM35460     3  0.0469      0.908 0.000 0.000 0.988 0.012
#> GSM35461     4  0.4832      0.711 0.056 0.000 0.176 0.768
#> GSM35463     2  0.0469      0.923 0.000 0.988 0.012 0.000
#> GSM35472     3  0.4406      0.582 0.000 0.000 0.700 0.300
#> GSM35475     4  0.2805      0.835 0.000 0.012 0.100 0.888
#> GSM35483     2  0.0707      0.919 0.000 0.980 0.020 0.000
#> GSM35496     3  0.3837      0.707 0.000 0.000 0.776 0.224
#> GSM35497     4  0.4888      0.310 0.000 0.412 0.000 0.588
#> GSM35504     2  0.3893      0.716 0.000 0.796 0.196 0.008
#> GSM35508     4  0.3279      0.840 0.000 0.032 0.096 0.872
#> GSM35511     4  0.2530      0.831 0.000 0.004 0.100 0.896
#> GSM35512     3  0.3907      0.696 0.000 0.000 0.768 0.232
#> GSM35515     4  0.3372      0.840 0.000 0.036 0.096 0.868
#> GSM35519     4  0.3105      0.828 0.000 0.012 0.120 0.868
#> GSM35527     4  0.4362      0.810 0.000 0.088 0.096 0.816
#> GSM35532     4  0.2831      0.819 0.000 0.004 0.120 0.876
#> GSM35439     2  0.0336      0.924 0.008 0.992 0.000 0.000
#> GSM35443     1  0.4072      0.784 0.748 0.000 0.000 0.252
#> GSM35445     1  0.3157      0.835 0.852 0.004 0.144 0.000
#> GSM35448     3  0.0469      0.908 0.000 0.000 0.988 0.012
#> GSM35451     1  0.0000      0.918 1.000 0.000 0.000 0.000
#> GSM35454     3  0.0000      0.910 0.000 0.000 1.000 0.000
#> GSM35457     2  0.0524      0.922 0.004 0.988 0.000 0.008
#> GSM35465     2  0.0895      0.917 0.004 0.976 0.000 0.020
#> GSM35468     1  0.2408      0.906 0.896 0.000 0.000 0.104
#> GSM35471     1  0.0779      0.915 0.980 0.004 0.016 0.000
#> GSM35473     1  0.2714      0.863 0.884 0.004 0.112 0.000
#> GSM35477     1  0.0000      0.918 1.000 0.000 0.000 0.000
#> GSM35480     1  0.2053      0.892 0.924 0.004 0.072 0.000
#> GSM35482     3  0.3822      0.775 0.120 0.004 0.844 0.032
#> GSM35485     2  0.0188      0.925 0.000 0.996 0.004 0.000
#> GSM35489     2  0.0188      0.923 0.004 0.996 0.000 0.000
#> GSM35492     1  0.2973      0.887 0.856 0.000 0.000 0.144
#> GSM35495     3  0.0000      0.910 0.000 0.000 1.000 0.000
#> GSM35499     2  0.0336      0.923 0.000 0.992 0.008 0.000
#> GSM35502     1  0.2345      0.906 0.900 0.000 0.000 0.100
#> GSM35505     3  0.0188      0.910 0.000 0.004 0.996 0.000
#> GSM35507     1  0.4624      0.475 0.660 0.340 0.000 0.000
#> GSM35510     2  0.0188      0.925 0.000 0.996 0.004 0.000
#> GSM35514     1  0.2281      0.907 0.904 0.000 0.000 0.096
#> GSM35517     2  0.0188      0.924 0.004 0.996 0.000 0.000
#> GSM35520     2  0.3556      0.793 0.004 0.864 0.096 0.036
#> GSM35523     1  0.0188      0.918 0.996 0.004 0.000 0.000
#> GSM35529     2  0.1743      0.893 0.004 0.940 0.000 0.056
#> GSM35531     2  0.0336      0.924 0.008 0.992 0.000 0.000
#> GSM35534     2  0.0188      0.925 0.000 0.996 0.004 0.000
#> GSM35536     1  0.2345      0.906 0.900 0.000 0.000 0.100
#> GSM35538     1  0.0000      0.918 1.000 0.000 0.000 0.000
#> GSM35539     1  0.0000      0.918 1.000 0.000 0.000 0.000
#> GSM35540     2  0.4434      0.706 0.004 0.772 0.016 0.208
#> GSM35541     2  0.0188      0.924 0.004 0.996 0.000 0.000
#> GSM35442     1  0.5257      0.720 0.752 0.000 0.104 0.144
#> GSM35447     3  0.0188      0.910 0.000 0.004 0.996 0.000
#> GSM35450     1  0.0000      0.918 1.000 0.000 0.000 0.000
#> GSM35453     1  0.4456      0.693 0.716 0.004 0.280 0.000
#> GSM35456     1  0.2845      0.869 0.896 0.076 0.028 0.000
#> GSM35464     2  0.1042      0.913 0.020 0.972 0.000 0.008
#> GSM35467     1  0.2345      0.906 0.900 0.000 0.000 0.100
#> GSM35470     1  0.0779      0.918 0.980 0.004 0.016 0.000
#> GSM35479     3  0.0657      0.904 0.012 0.004 0.984 0.000
#> GSM35484     1  0.1209      0.911 0.964 0.004 0.032 0.000
#> GSM35488     1  0.2408      0.906 0.896 0.000 0.000 0.104
#> GSM35491     1  0.2466      0.907 0.900 0.004 0.000 0.096
#> GSM35494     3  0.0188      0.910 0.000 0.004 0.996 0.000
#> GSM35498     1  0.0188      0.918 0.996 0.004 0.000 0.000
#> GSM35501     1  0.2216      0.909 0.908 0.000 0.000 0.092
#> GSM35509     3  0.0188      0.910 0.000 0.004 0.996 0.000
#> GSM35513     1  0.2345      0.906 0.900 0.000 0.000 0.100
#> GSM35516     2  0.0188      0.925 0.000 0.996 0.004 0.000
#> GSM35522     1  0.0336      0.918 0.992 0.008 0.000 0.000
#> GSM35525     1  0.1398      0.918 0.956 0.004 0.000 0.040
#> GSM35528     1  0.1211      0.917 0.960 0.000 0.000 0.040
#> GSM35533     1  0.1209      0.911 0.964 0.004 0.032 0.000
#> GSM35537     1  0.0188      0.918 0.996 0.004 0.000 0.000

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>          class entropy silhouette    p1    p2    p3 p4    p5
#> GSM35441     2  0.4434      0.269 0.000 0.536 0.000 NA 0.460
#> GSM35446     3  0.4227      0.858 0.000 0.000 0.580 NA 0.000
#> GSM35449     5  0.4251      0.164 0.000 0.372 0.000 NA 0.624
#> GSM35455     5  0.4451     -0.242 0.000 0.492 0.000 NA 0.504
#> GSM35458     5  0.0671      0.686 0.000 0.016 0.004 NA 0.980
#> GSM35460     3  0.4227      0.858 0.000 0.000 0.580 NA 0.000
#> GSM35461     5  0.5380      0.405 0.004 0.000 0.464 NA 0.488
#> GSM35463     2  0.1197      0.839 0.000 0.952 0.000 NA 0.000
#> GSM35472     3  0.2280      0.458 0.000 0.000 0.880 NA 0.120
#> GSM35475     5  0.0963      0.682 0.000 0.000 0.036 NA 0.964
#> GSM35483     2  0.1608      0.830 0.000 0.928 0.000 NA 0.000
#> GSM35496     3  0.1430      0.558 0.000 0.000 0.944 NA 0.052
#> GSM35497     5  0.4166      0.228 0.000 0.348 0.000 NA 0.648
#> GSM35504     2  0.1956      0.824 0.000 0.916 0.008 NA 0.000
#> GSM35508     5  0.0324      0.689 0.000 0.004 0.000 NA 0.992
#> GSM35511     5  0.4060      0.540 0.000 0.000 0.360 NA 0.640
#> GSM35512     3  0.1608      0.535 0.000 0.000 0.928 NA 0.072
#> GSM35515     5  0.0451      0.689 0.000 0.008 0.004 NA 0.988
#> GSM35519     5  0.4262      0.473 0.000 0.000 0.440 NA 0.560
#> GSM35527     5  0.0451      0.688 0.000 0.008 0.000 NA 0.988
#> GSM35532     5  0.4210      0.501 0.000 0.000 0.412 NA 0.588
#> GSM35439     2  0.0727      0.836 0.004 0.980 0.000 NA 0.012
#> GSM35443     1  0.2353      0.824 0.908 0.000 0.004 NA 0.028
#> GSM35445     1  0.3427      0.814 0.796 0.000 0.012 NA 0.000
#> GSM35448     3  0.4227      0.858 0.000 0.000 0.580 NA 0.000
#> GSM35451     1  0.4030      0.742 0.648 0.000 0.000 NA 0.000
#> GSM35454     3  0.4210      0.859 0.000 0.000 0.588 NA 0.000
#> GSM35457     2  0.3579      0.681 0.000 0.756 0.000 NA 0.240
#> GSM35465     2  0.3210      0.715 0.000 0.788 0.000 NA 0.212
#> GSM35468     1  0.1697      0.831 0.932 0.000 0.008 NA 0.000
#> GSM35471     1  0.4101      0.732 0.628 0.000 0.000 NA 0.000
#> GSM35473     1  0.2079      0.833 0.916 0.000 0.020 NA 0.000
#> GSM35477     1  0.3796      0.770 0.700 0.000 0.000 NA 0.000
#> GSM35480     1  0.3455      0.815 0.784 0.000 0.008 NA 0.000
#> GSM35482     3  0.3142      0.633 0.048 0.004 0.876 NA 0.012
#> GSM35485     2  0.1270      0.838 0.000 0.948 0.000 NA 0.000
#> GSM35489     2  0.1732      0.810 0.000 0.920 0.000 NA 0.080
#> GSM35492     1  0.1857      0.830 0.928 0.000 0.008 NA 0.004
#> GSM35495     3  0.4192      0.861 0.000 0.000 0.596 NA 0.000
#> GSM35499     2  0.1270      0.838 0.000 0.948 0.000 NA 0.000
#> GSM35502     1  0.1410      0.832 0.940 0.000 0.000 NA 0.000
#> GSM35505     3  0.4182      0.861 0.000 0.000 0.600 NA 0.000
#> GSM35507     1  0.6474      0.512 0.528 0.284 0.008 NA 0.000
#> GSM35510     2  0.1270      0.838 0.000 0.948 0.000 NA 0.000
#> GSM35514     1  0.0451      0.838 0.988 0.000 0.004 NA 0.000
#> GSM35517     2  0.0290      0.840 0.000 0.992 0.000 NA 0.000
#> GSM35520     2  0.3048      0.721 0.000 0.820 0.004 NA 0.176
#> GSM35523     1  0.3741      0.795 0.732 0.004 0.000 NA 0.000
#> GSM35529     2  0.4066      0.560 0.000 0.672 0.000 NA 0.324
#> GSM35531     2  0.0703      0.841 0.000 0.976 0.000 NA 0.000
#> GSM35534     2  0.1270      0.838 0.000 0.948 0.000 NA 0.000
#> GSM35536     1  0.0290      0.838 0.992 0.000 0.000 NA 0.000
#> GSM35538     1  0.1341      0.841 0.944 0.000 0.000 NA 0.000
#> GSM35539     1  0.3210      0.807 0.788 0.000 0.000 NA 0.000
#> GSM35540     2  0.4425      0.275 0.000 0.544 0.004 NA 0.452
#> GSM35541     2  0.0566      0.840 0.004 0.984 0.000 NA 0.000
#> GSM35442     1  0.4294      0.729 0.780 0.000 0.148 NA 0.008
#> GSM35447     3  0.4182      0.861 0.000 0.000 0.600 NA 0.000
#> GSM35450     1  0.3913      0.759 0.676 0.000 0.000 NA 0.000
#> GSM35453     1  0.3297      0.798 0.848 0.000 0.068 NA 0.000
#> GSM35456     1  0.6515      0.509 0.440 0.196 0.000 NA 0.000
#> GSM35464     2  0.3607      0.738 0.008 0.804 0.008 NA 0.176
#> GSM35467     1  0.1341      0.831 0.944 0.000 0.000 NA 0.000
#> GSM35470     1  0.2650      0.827 0.892 0.004 0.036 NA 0.000
#> GSM35479     3  0.4150      0.851 0.000 0.000 0.612 NA 0.000
#> GSM35484     1  0.3999      0.757 0.656 0.000 0.000 NA 0.000
#> GSM35488     1  0.1408      0.835 0.948 0.000 0.008 NA 0.000
#> GSM35491     1  0.1443      0.835 0.948 0.004 0.004 NA 0.000
#> GSM35494     3  0.4161      0.859 0.000 0.000 0.608 NA 0.000
#> GSM35498     1  0.4088      0.787 0.712 0.004 0.008 NA 0.000
#> GSM35501     1  0.1270      0.835 0.948 0.000 0.000 NA 0.000
#> GSM35509     3  0.4182      0.861 0.000 0.000 0.600 NA 0.000
#> GSM35513     1  0.1341      0.831 0.944 0.000 0.000 NA 0.000
#> GSM35516     2  0.0865      0.842 0.004 0.972 0.000 NA 0.000
#> GSM35522     1  0.4066      0.761 0.672 0.004 0.000 NA 0.000
#> GSM35525     1  0.1270      0.834 0.948 0.000 0.000 NA 0.000
#> GSM35528     1  0.1764      0.838 0.928 0.000 0.008 NA 0.000
#> GSM35533     1  0.4264      0.737 0.620 0.000 0.004 NA 0.000
#> GSM35537     1  0.1928      0.840 0.920 0.004 0.004 NA 0.000

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>          class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM35441     6  0.1556     0.5949 0.000 0.080 0.000 0.000 0.000 0.920
#> GSM35446     3  0.1908     0.8543 0.000 0.000 0.900 0.096 0.000 0.004
#> GSM35449     6  0.1116     0.6228 0.000 0.028 0.000 0.004 0.008 0.960
#> GSM35455     6  0.1204     0.6087 0.000 0.056 0.000 0.000 0.000 0.944
#> GSM35458     6  0.3782     0.4874 0.000 0.000 0.000 0.004 0.360 0.636
#> GSM35460     3  0.1908     0.8543 0.000 0.000 0.900 0.096 0.000 0.004
#> GSM35461     5  0.3328     0.6748 0.000 0.000 0.064 0.120 0.816 0.000
#> GSM35463     2  0.0291     0.7572 0.000 0.992 0.004 0.000 0.000 0.004
#> GSM35472     5  0.3584     0.5554 0.000 0.000 0.308 0.004 0.688 0.000
#> GSM35475     6  0.3937     0.3992 0.000 0.000 0.000 0.004 0.424 0.572
#> GSM35483     2  0.0291     0.7572 0.000 0.992 0.004 0.000 0.000 0.004
#> GSM35496     5  0.3782     0.4619 0.000 0.000 0.360 0.004 0.636 0.000
#> GSM35497     6  0.1059     0.6258 0.000 0.016 0.000 0.004 0.016 0.964
#> GSM35504     2  0.0858     0.7472 0.000 0.968 0.028 0.004 0.000 0.000
#> GSM35508     6  0.3819     0.4752 0.000 0.000 0.000 0.004 0.372 0.624
#> GSM35511     5  0.1588     0.6344 0.000 0.000 0.000 0.004 0.924 0.072
#> GSM35512     5  0.3714     0.5068 0.000 0.000 0.340 0.004 0.656 0.000
#> GSM35515     6  0.3807     0.4803 0.000 0.000 0.000 0.004 0.368 0.628
#> GSM35519     5  0.1720     0.6950 0.000 0.000 0.032 0.000 0.928 0.040
#> GSM35527     6  0.3930     0.4796 0.000 0.004 0.000 0.004 0.364 0.628
#> GSM35532     5  0.1461     0.6821 0.000 0.000 0.016 0.000 0.940 0.044
#> GSM35439     2  0.3807     0.5931 0.000 0.628 0.000 0.004 0.000 0.368
#> GSM35443     1  0.3288     0.4720 0.724 0.000 0.000 0.276 0.000 0.000
#> GSM35445     1  0.4044     0.3320 0.744 0.000 0.076 0.180 0.000 0.000
#> GSM35448     3  0.1908     0.8543 0.000 0.000 0.900 0.096 0.000 0.004
#> GSM35451     1  0.3979    -0.6547 0.540 0.000 0.004 0.456 0.000 0.000
#> GSM35454     3  0.1082     0.8813 0.000 0.000 0.956 0.004 0.040 0.000
#> GSM35457     6  0.3684     0.1824 0.000 0.332 0.000 0.004 0.000 0.664
#> GSM35465     6  0.3756     0.1723 0.000 0.352 0.000 0.004 0.000 0.644
#> GSM35468     1  0.3288     0.4720 0.724 0.000 0.000 0.276 0.000 0.000
#> GSM35471     1  0.3998    -0.6489 0.504 0.000 0.004 0.492 0.000 0.000
#> GSM35473     1  0.2858     0.4409 0.844 0.000 0.032 0.124 0.000 0.000
#> GSM35477     1  0.3833    -0.6385 0.556 0.000 0.000 0.444 0.000 0.000
#> GSM35480     1  0.3572     0.3242 0.764 0.000 0.032 0.204 0.000 0.000
#> GSM35482     3  0.4692    -0.0789 0.000 0.004 0.532 0.036 0.428 0.000
#> GSM35485     2  0.1958     0.7499 0.000 0.896 0.004 0.000 0.000 0.100
#> GSM35489     2  0.3982     0.3807 0.000 0.536 0.000 0.004 0.000 0.460
#> GSM35492     1  0.3288     0.4720 0.724 0.000 0.000 0.276 0.000 0.000
#> GSM35495     3  0.1141     0.8718 0.000 0.000 0.948 0.052 0.000 0.000
#> GSM35499     2  0.0146     0.7555 0.000 0.996 0.004 0.000 0.000 0.000
#> GSM35502     1  0.1267     0.5162 0.940 0.000 0.000 0.060 0.000 0.000
#> GSM35505     3  0.0937     0.8832 0.000 0.000 0.960 0.000 0.040 0.000
#> GSM35507     4  0.6010     0.6543 0.408 0.048 0.000 0.460 0.000 0.084
#> GSM35510     2  0.0146     0.7555 0.000 0.996 0.004 0.000 0.000 0.000
#> GSM35514     1  0.0000     0.5113 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM35517     2  0.3850     0.6327 0.000 0.652 0.004 0.004 0.000 0.340
#> GSM35520     2  0.6098     0.2385 0.000 0.516 0.028 0.000 0.300 0.156
#> GSM35523     1  0.3982    -0.5853 0.536 0.004 0.000 0.460 0.000 0.000
#> GSM35529     6  0.2793     0.4684 0.000 0.200 0.000 0.000 0.000 0.800
#> GSM35531     2  0.4709     0.6087 0.024 0.696 0.000 0.220 0.000 0.060
#> GSM35534     2  0.0692     0.7591 0.000 0.976 0.004 0.000 0.000 0.020
#> GSM35536     1  0.0000     0.5113 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM35538     1  0.0865     0.4875 0.964 0.000 0.000 0.036 0.000 0.000
#> GSM35539     1  0.2135     0.3574 0.872 0.000 0.000 0.128 0.000 0.000
#> GSM35540     6  0.4317     0.5337 0.000 0.252 0.000 0.000 0.060 0.688
#> GSM35541     2  0.3850     0.6327 0.000 0.652 0.004 0.004 0.000 0.340
#> GSM35442     1  0.5514     0.3889 0.608 0.000 0.056 0.276 0.060 0.000
#> GSM35447     3  0.0937     0.8832 0.000 0.000 0.960 0.000 0.040 0.000
#> GSM35450     1  0.3807    -0.4753 0.628 0.000 0.004 0.368 0.000 0.000
#> GSM35453     1  0.4912     0.3053 0.696 0.000 0.168 0.116 0.020 0.000
#> GSM35456     4  0.5777     0.5754 0.372 0.156 0.004 0.468 0.000 0.000
#> GSM35464     6  0.5986    -0.0350 0.012 0.356 0.000 0.164 0.000 0.468
#> GSM35467     1  0.1267     0.5162 0.940 0.000 0.000 0.060 0.000 0.000
#> GSM35470     1  0.3848     0.4649 0.692 0.004 0.000 0.292 0.012 0.000
#> GSM35479     3  0.0865     0.8836 0.000 0.000 0.964 0.000 0.036 0.000
#> GSM35484     1  0.4002    -0.3891 0.588 0.000 0.008 0.404 0.000 0.000
#> GSM35488     1  0.3221     0.4780 0.736 0.000 0.000 0.264 0.000 0.000
#> GSM35491     1  0.3215     0.4849 0.756 0.004 0.000 0.240 0.000 0.000
#> GSM35494     3  0.0937     0.8832 0.000 0.000 0.960 0.000 0.040 0.000
#> GSM35498     4  0.3996     0.5346 0.484 0.004 0.000 0.512 0.000 0.000
#> GSM35501     1  0.1141     0.5163 0.948 0.000 0.000 0.052 0.000 0.000
#> GSM35509     3  0.0363     0.8787 0.000 0.000 0.988 0.012 0.000 0.000
#> GSM35513     1  0.1204     0.5173 0.944 0.000 0.000 0.056 0.000 0.000
#> GSM35516     2  0.3834     0.6899 0.000 0.728 0.004 0.024 0.000 0.244
#> GSM35522     4  0.3999     0.6312 0.496 0.004 0.000 0.500 0.000 0.000
#> GSM35525     1  0.1444     0.5143 0.928 0.000 0.000 0.072 0.000 0.000
#> GSM35528     1  0.3330     0.4745 0.716 0.000 0.000 0.284 0.000 0.000
#> GSM35533     1  0.4238    -0.4425 0.540 0.000 0.016 0.444 0.000 0.000
#> GSM35537     1  0.2805     0.4907 0.812 0.004 0.000 0.184 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)

plot of chunk tab-CV-mclust-consensus-heatmap-1

consensus_heatmap(res, k = 3)

plot of chunk tab-CV-mclust-consensus-heatmap-2

consensus_heatmap(res, k = 4)

plot of chunk tab-CV-mclust-consensus-heatmap-3

consensus_heatmap(res, k = 5)

plot of chunk tab-CV-mclust-consensus-heatmap-4

consensus_heatmap(res, k = 6)

plot of chunk tab-CV-mclust-consensus-heatmap-5

Heatmaps for the membership of samples in all partitions to see how consistent they are:

membership_heatmap(res, k = 2)

plot of chunk tab-CV-mclust-membership-heatmap-1

membership_heatmap(res, k = 3)

plot of chunk tab-CV-mclust-membership-heatmap-2

membership_heatmap(res, k = 4)

plot of chunk tab-CV-mclust-membership-heatmap-3

membership_heatmap(res, k = 5)

plot of chunk tab-CV-mclust-membership-heatmap-4

membership_heatmap(res, k = 6)

plot of chunk tab-CV-mclust-membership-heatmap-5

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)

plot of chunk tab-CV-mclust-get-signatures-1

get_signatures(res, k = 3)

plot of chunk tab-CV-mclust-get-signatures-2

get_signatures(res, k = 4)

plot of chunk tab-CV-mclust-get-signatures-3

get_signatures(res, k = 5)

plot of chunk tab-CV-mclust-get-signatures-4

get_signatures(res, k = 6)

plot of chunk tab-CV-mclust-get-signatures-5

Signature heatmaps where rows are not scaled:

get_signatures(res, k = 2, scale_rows = FALSE)

plot of chunk tab-CV-mclust-get-signatures-no-scale-1

get_signatures(res, k = 3, scale_rows = FALSE)

plot of chunk tab-CV-mclust-get-signatures-no-scale-2

get_signatures(res, k = 4, scale_rows = FALSE)

plot of chunk tab-CV-mclust-get-signatures-no-scale-3

get_signatures(res, k = 5, scale_rows = FALSE)

plot of chunk tab-CV-mclust-get-signatures-no-scale-4

get_signatures(res, k = 6, scale_rows = FALSE)

plot of chunk tab-CV-mclust-get-signatures-no-scale-5

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk CV-mclust-signature_compare

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:

  1. which_row: row indices corresponding to the input matrix.
  2. fdr: FDR for the differential test.
  3. mean_x: The mean value in group x.
  4. scaled_mean_x: The mean value in group x after rows are scaled.
  5. 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")

plot of chunk tab-CV-mclust-dimension-reduction-1

dimension_reduction(res, k = 3, method = "UMAP")

plot of chunk tab-CV-mclust-dimension-reduction-2

dimension_reduction(res, k = 4, method = "UMAP")

plot of chunk tab-CV-mclust-dimension-reduction-3

dimension_reduction(res, k = 5, method = "UMAP")

plot of chunk tab-CV-mclust-dimension-reduction-4

dimension_reduction(res, k = 6, method = "UMAP")

plot of chunk tab-CV-mclust-dimension-reduction-5

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk CV-mclust-collect-classes

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  time(p) k
#> CV:mclust 75 4.38e-04 2
#> CV:mclust 71 5.49e-05 3
#> CV:mclust 76 2.12e-08 4
#> CV:mclust 71 5.57e-08 5
#> CV:mclust 44 4.67e-04 6

If matrix rows can be associated to genes, consider to use functional_enrichment(res, ...) to perform function enrichment for the signature genes. See this vignette for more detailed explanations.


CV:NMF**

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 7758 rows and 79 columns.
#>   Top rows (776, 1552, 2328, 3103, 3879) are extracted by 'CV' method.
#>   Subgroups are detected by 'NMF' method.
#>   Performed in total 1250 partitions by row resampling.
#>   Best k for subgroups seems to be 2.
#> 
#> Following methods can be applied to this 'ConsensusPartition' object:
#>  [1] "cola_report"             "collect_classes"         "collect_plots"          
#>  [4] "collect_stats"           "colnames"                "compare_signatures"     
#>  [7] "consensus_heatmap"       "dimension_reduction"     "functional_enrichment"  
#> [10] "get_anno_col"            "get_anno"                "get_classes"            
#> [13] "get_consensus"           "get_matrix"              "get_membership"         
#> [16] "get_param"               "get_signatures"          "get_stats"              
#> [19] "is_best_k"               "is_stable_k"             "membership_heatmap"     
#> [22] "ncol"                    "nrow"                    "plot_ecdf"              
#> [25] "rownames"                "select_partition_number" "show"                   
#> [28] "suggest_best_k"          "test_to_known_factors"

collect_plots() function collects all the plots made from res for all k (number of partitions) into one single page to provide an easy and fast comparison between different k.

collect_plots(res)

plot of chunk CV-NMF-collect-plots

The plots are:

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:

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)

plot of chunk CV-NMF-select-partition-number

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.967       0.986         0.5043 0.498   0.498
#> 3 3 0.786           0.861       0.920         0.3105 0.765   0.562
#> 4 4 0.596           0.616       0.795         0.1165 0.931   0.803
#> 5 5 0.631           0.545       0.773         0.0778 0.813   0.450
#> 6 6 0.619           0.452       0.693         0.0397 0.925   0.668

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.

show/hide code output

cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#>          class entropy silhouette    p1    p2
#> GSM35441     2  0.0000      0.998 0.000 1.000
#> GSM35446     2  0.0000      0.998 0.000 1.000
#> GSM35449     2  0.0000      0.998 0.000 1.000
#> GSM35455     2  0.0000      0.998 0.000 1.000
#> GSM35458     2  0.0000      0.998 0.000 1.000
#> GSM35460     2  0.0000      0.998 0.000 1.000
#> GSM35461     1  0.0000      0.975 1.000 0.000
#> GSM35463     2  0.0000      0.998 0.000 1.000
#> GSM35472     2  0.1184      0.984 0.016 0.984
#> GSM35475     2  0.0000      0.998 0.000 1.000
#> GSM35483     2  0.0000      0.998 0.000 1.000
#> GSM35496     1  0.0000      0.975 1.000 0.000
#> GSM35497     2  0.0000      0.998 0.000 1.000
#> GSM35504     2  0.0000      0.998 0.000 1.000
#> GSM35508     2  0.0000      0.998 0.000 1.000
#> GSM35511     2  0.0000      0.998 0.000 1.000
#> GSM35512     2  0.1184      0.984 0.016 0.984
#> GSM35515     2  0.0000      0.998 0.000 1.000
#> GSM35519     2  0.0000      0.998 0.000 1.000
#> GSM35527     2  0.0000      0.998 0.000 1.000
#> GSM35532     2  0.0000      0.998 0.000 1.000
#> GSM35439     2  0.0000      0.998 0.000 1.000
#> GSM35443     1  0.0000      0.975 1.000 0.000
#> GSM35445     1  0.0000      0.975 1.000 0.000
#> GSM35448     2  0.0000      0.998 0.000 1.000
#> GSM35451     1  0.0000      0.975 1.000 0.000
#> GSM35454     1  0.0000      0.975 1.000 0.000
#> GSM35457     2  0.0000      0.998 0.000 1.000
#> GSM35465     2  0.0000      0.998 0.000 1.000
#> GSM35468     1  0.0000      0.975 1.000 0.000
#> GSM35471     1  0.0000      0.975 1.000 0.000
#> GSM35473     1  0.0000      0.975 1.000 0.000
#> GSM35477     1  0.0000      0.975 1.000 0.000
#> GSM35480     1  0.0000      0.975 1.000 0.000
#> GSM35482     1  0.0376      0.972 0.996 0.004
#> GSM35485     2  0.0000      0.998 0.000 1.000
#> GSM35489     2  0.0000      0.998 0.000 1.000
#> GSM35492     1  0.0000      0.975 1.000 0.000
#> GSM35495     1  0.9775      0.326 0.588 0.412
#> GSM35499     2  0.0000      0.998 0.000 1.000
#> GSM35502     1  0.0000      0.975 1.000 0.000
#> GSM35505     1  0.0000      0.975 1.000 0.000
#> GSM35507     1  0.7815      0.702 0.768 0.232
#> GSM35510     2  0.0000      0.998 0.000 1.000
#> GSM35514     1  0.0000      0.975 1.000 0.000
#> GSM35517     2  0.0000      0.998 0.000 1.000
#> GSM35520     2  0.0000      0.998 0.000 1.000
#> GSM35523     1  0.0000      0.975 1.000 0.000
#> GSM35529     2  0.0000      0.998 0.000 1.000
#> GSM35531     2  0.0672      0.991 0.008 0.992
#> GSM35534     2  0.0000      0.998 0.000 1.000
#> GSM35536     1  0.0000      0.975 1.000 0.000
#> GSM35538     1  0.0000      0.975 1.000 0.000
#> GSM35539     1  0.0000      0.975 1.000 0.000
#> GSM35540     2  0.0000      0.998 0.000 1.000
#> GSM35541     2  0.0000      0.998 0.000 1.000
#> GSM35442     1  0.0000      0.975 1.000 0.000
#> GSM35447     1  0.1414      0.958 0.980 0.020
#> GSM35450     1  0.0000      0.975 1.000 0.000
#> GSM35453     1  0.0000      0.975 1.000 0.000
#> GSM35456     1  0.0000      0.975 1.000 0.000
#> GSM35464     2  0.1414      0.980 0.020 0.980
#> GSM35467     1  0.0000      0.975 1.000 0.000
#> GSM35470     1  0.0000      0.975 1.000 0.000
#> GSM35479     1  0.0000      0.975 1.000 0.000
#> GSM35484     1  0.0000      0.975 1.000 0.000
#> GSM35488     1  0.0000      0.975 1.000 0.000
#> GSM35491     1  0.0000      0.975 1.000 0.000
#> GSM35494     1  0.0000      0.975 1.000 0.000
#> GSM35498     1  0.0000      0.975 1.000 0.000
#> GSM35501     1  0.0000      0.975 1.000 0.000
#> GSM35509     1  0.9427      0.457 0.640 0.360
#> GSM35513     1  0.0000      0.975 1.000 0.000
#> GSM35516     2  0.0000      0.998 0.000 1.000
#> GSM35522     1  0.0000      0.975 1.000 0.000
#> GSM35525     1  0.0000      0.975 1.000 0.000
#> GSM35528     1  0.0000      0.975 1.000 0.000
#> GSM35533     1  0.0000      0.975 1.000 0.000
#> GSM35537     1  0.0000      0.975 1.000 0.000

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>          class entropy silhouette    p1    p2    p3
#> GSM35441     2  0.0237     0.9215 0.000 0.996 0.004
#> GSM35446     3  0.2711     0.8485 0.000 0.088 0.912
#> GSM35449     2  0.0892     0.9201 0.000 0.980 0.020
#> GSM35455     2  0.0424     0.9215 0.000 0.992 0.008
#> GSM35458     2  0.0892     0.9211 0.000 0.980 0.020
#> GSM35460     3  0.2261     0.8582 0.000 0.068 0.932
#> GSM35461     3  0.3038     0.8606 0.104 0.000 0.896
#> GSM35463     2  0.1905     0.9043 0.016 0.956 0.028
#> GSM35472     3  0.2173     0.8689 0.008 0.048 0.944
#> GSM35475     2  0.6062     0.3967 0.000 0.616 0.384
#> GSM35483     2  0.1411     0.9147 0.000 0.964 0.036
#> GSM35496     3  0.2261     0.8779 0.068 0.000 0.932
#> GSM35497     2  0.0892     0.9201 0.000 0.980 0.020
#> GSM35504     2  0.3551     0.8477 0.000 0.868 0.132
#> GSM35508     2  0.3752     0.8314 0.000 0.856 0.144
#> GSM35511     3  0.5098     0.6608 0.000 0.248 0.752
#> GSM35512     3  0.2301     0.8645 0.004 0.060 0.936
#> GSM35515     2  0.1753     0.9093 0.000 0.952 0.048
#> GSM35519     3  0.3340     0.8265 0.000 0.120 0.880
#> GSM35527     2  0.2165     0.8996 0.000 0.936 0.064
#> GSM35532     3  0.3267     0.8300 0.000 0.116 0.884
#> GSM35439     2  0.2550     0.8897 0.040 0.936 0.024
#> GSM35443     1  0.2711     0.9049 0.912 0.000 0.088
#> GSM35445     1  0.2448     0.9184 0.924 0.000 0.076
#> GSM35448     3  0.4796     0.7087 0.000 0.220 0.780
#> GSM35451     1  0.2903     0.9007 0.924 0.048 0.028
#> GSM35454     3  0.4291     0.7755 0.180 0.000 0.820
#> GSM35457     2  0.0000     0.9212 0.000 1.000 0.000
#> GSM35465     2  0.0000     0.9212 0.000 1.000 0.000
#> GSM35468     1  0.1643     0.9324 0.956 0.000 0.044
#> GSM35471     1  0.2564     0.9126 0.936 0.028 0.036
#> GSM35473     1  0.1753     0.9307 0.952 0.000 0.048
#> GSM35477     1  0.2793     0.9041 0.928 0.044 0.028
#> GSM35480     1  0.1163     0.9389 0.972 0.000 0.028
#> GSM35482     3  0.2356     0.8761 0.072 0.000 0.928
#> GSM35485     2  0.1453     0.9112 0.008 0.968 0.024
#> GSM35489     2  0.0592     0.9186 0.012 0.988 0.000
#> GSM35492     1  0.1753     0.9311 0.952 0.000 0.048
#> GSM35495     3  0.1525     0.8799 0.032 0.004 0.964
#> GSM35499     2  0.1525     0.9210 0.004 0.964 0.032
#> GSM35502     1  0.0747     0.9392 0.984 0.000 0.016
#> GSM35505     3  0.2448     0.8732 0.076 0.000 0.924
#> GSM35507     2  0.7188    -0.0219 0.488 0.488 0.024
#> GSM35510     2  0.1031     0.9189 0.000 0.976 0.024
#> GSM35514     1  0.1031     0.9385 0.976 0.000 0.024
#> GSM35517     2  0.0237     0.9207 0.000 0.996 0.004
#> GSM35520     2  0.3816     0.8265 0.000 0.852 0.148
#> GSM35523     1  0.1491     0.9385 0.968 0.016 0.016
#> GSM35529     2  0.0892     0.9201 0.000 0.980 0.020
#> GSM35531     2  0.0747     0.9176 0.016 0.984 0.000
#> GSM35534     2  0.0592     0.9222 0.000 0.988 0.012
#> GSM35536     1  0.1289     0.9366 0.968 0.000 0.032
#> GSM35538     1  0.1170     0.9346 0.976 0.016 0.008
#> GSM35539     1  0.0424     0.9369 0.992 0.008 0.000
#> GSM35540     2  0.2796     0.8792 0.000 0.908 0.092
#> GSM35541     2  0.1337     0.9126 0.012 0.972 0.016
#> GSM35442     3  0.6274     0.1560 0.456 0.000 0.544
#> GSM35447     3  0.1964     0.8792 0.056 0.000 0.944
#> GSM35450     1  0.1919     0.9219 0.956 0.024 0.020
#> GSM35453     1  0.5138     0.6826 0.748 0.000 0.252
#> GSM35456     1  0.4636     0.8278 0.848 0.116 0.036
#> GSM35464     2  0.2846     0.8796 0.056 0.924 0.020
#> GSM35467     1  0.0892     0.9390 0.980 0.000 0.020
#> GSM35470     1  0.5465     0.6122 0.712 0.000 0.288
#> GSM35479     3  0.3267     0.8513 0.116 0.000 0.884
#> GSM35484     1  0.2031     0.9208 0.952 0.016 0.032
#> GSM35488     1  0.1453     0.9397 0.968 0.008 0.024
#> GSM35491     1  0.1643     0.9324 0.956 0.000 0.044
#> GSM35494     3  0.3340     0.8477 0.120 0.000 0.880
#> GSM35498     1  0.1453     0.9344 0.968 0.024 0.008
#> GSM35501     1  0.0892     0.9390 0.980 0.000 0.020
#> GSM35509     3  0.1647     0.8801 0.036 0.004 0.960
#> GSM35513     1  0.0747     0.9393 0.984 0.000 0.016
#> GSM35516     2  0.2806     0.8845 0.040 0.928 0.032
#> GSM35522     1  0.2772     0.8899 0.916 0.080 0.004
#> GSM35525     1  0.1289     0.9366 0.968 0.000 0.032
#> GSM35528     1  0.1774     0.9368 0.960 0.024 0.016
#> GSM35533     1  0.1878     0.9290 0.952 0.004 0.044
#> GSM35537     1  0.2711     0.9034 0.912 0.000 0.088

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>          class entropy silhouette    p1    p2    p3    p4
#> GSM35441     2  0.0707     0.7417 0.000 0.980 0.000 0.020
#> GSM35446     3  0.2773     0.7574 0.000 0.004 0.880 0.116
#> GSM35449     2  0.0844     0.7369 0.004 0.980 0.004 0.012
#> GSM35455     2  0.0592     0.7408 0.000 0.984 0.000 0.016
#> GSM35458     2  0.3550     0.6740 0.040 0.880 0.056 0.024
#> GSM35460     3  0.2654     0.7625 0.000 0.004 0.888 0.108
#> GSM35461     3  0.5984     0.5380 0.248 0.048 0.684 0.020
#> GSM35463     4  0.4164     0.5508 0.000 0.264 0.000 0.736
#> GSM35472     3  0.1890     0.7514 0.000 0.056 0.936 0.008
#> GSM35475     2  0.5620     0.5065 0.028 0.732 0.200 0.040
#> GSM35483     2  0.4898     0.1728 0.000 0.584 0.000 0.416
#> GSM35496     3  0.1631     0.7606 0.016 0.008 0.956 0.020
#> GSM35497     2  0.0524     0.7373 0.000 0.988 0.004 0.008
#> GSM35504     4  0.6182     0.4865 0.000 0.276 0.088 0.636
#> GSM35508     2  0.2256     0.7088 0.000 0.924 0.056 0.020
#> GSM35511     3  0.5493     0.2477 0.000 0.456 0.528 0.016
#> GSM35512     3  0.3253     0.7268 0.008 0.100 0.876 0.016
#> GSM35515     2  0.3550     0.6740 0.040 0.880 0.056 0.024
#> GSM35519     3  0.5581     0.4892 0.008 0.340 0.632 0.020
#> GSM35527     2  0.1174     0.7314 0.000 0.968 0.020 0.012
#> GSM35532     3  0.4857     0.5693 0.000 0.284 0.700 0.016
#> GSM35439     2  0.2676     0.7305 0.012 0.896 0.000 0.092
#> GSM35443     1  0.3432     0.7342 0.860 0.012 0.120 0.008
#> GSM35445     1  0.6111     0.3866 0.556 0.000 0.052 0.392
#> GSM35448     3  0.5768     0.3798 0.000 0.028 0.516 0.456
#> GSM35451     1  0.5062     0.5860 0.680 0.020 0.000 0.300
#> GSM35454     3  0.4992     0.4159 0.000 0.000 0.524 0.476
#> GSM35457     2  0.3355     0.6808 0.004 0.836 0.000 0.160
#> GSM35465     2  0.4053     0.6066 0.004 0.768 0.000 0.228
#> GSM35468     1  0.1356     0.7883 0.960 0.000 0.032 0.008
#> GSM35471     4  0.4188     0.3367 0.244 0.004 0.000 0.752
#> GSM35473     1  0.1733     0.7947 0.948 0.000 0.028 0.024
#> GSM35477     1  0.3591     0.7378 0.824 0.008 0.000 0.168
#> GSM35480     1  0.5247     0.6516 0.684 0.000 0.032 0.284
#> GSM35482     3  0.1489     0.7643 0.004 0.000 0.952 0.044
#> GSM35485     2  0.4072     0.5892 0.000 0.748 0.000 0.252
#> GSM35489     2  0.3448     0.6933 0.004 0.828 0.000 0.168
#> GSM35492     1  0.1722     0.7828 0.944 0.000 0.048 0.008
#> GSM35495     3  0.4008     0.6971 0.000 0.000 0.756 0.244
#> GSM35499     4  0.3356     0.6043 0.000 0.176 0.000 0.824
#> GSM35502     1  0.0657     0.7942 0.984 0.000 0.004 0.012
#> GSM35505     3  0.4387     0.6998 0.012 0.000 0.752 0.236
#> GSM35507     2  0.7916    -0.2471 0.316 0.356 0.000 0.328
#> GSM35510     4  0.4996    -0.0732 0.000 0.484 0.000 0.516
#> GSM35514     1  0.0672     0.7929 0.984 0.000 0.008 0.008
#> GSM35517     2  0.2216     0.7310 0.000 0.908 0.000 0.092
#> GSM35520     2  0.3464     0.7011 0.000 0.868 0.056 0.076
#> GSM35523     1  0.5762     0.5053 0.608 0.040 0.000 0.352
#> GSM35529     2  0.2081     0.7317 0.000 0.916 0.000 0.084
#> GSM35531     2  0.4630     0.6119 0.016 0.732 0.000 0.252
#> GSM35534     2  0.4543     0.4453 0.000 0.676 0.000 0.324
#> GSM35536     1  0.0524     0.7942 0.988 0.000 0.008 0.004
#> GSM35538     1  0.1022     0.7930 0.968 0.000 0.000 0.032
#> GSM35539     1  0.2973     0.7613 0.856 0.000 0.000 0.144
#> GSM35540     2  0.4290     0.6590 0.000 0.800 0.036 0.164
#> GSM35541     2  0.3528     0.6883 0.000 0.808 0.000 0.192
#> GSM35442     1  0.5463     0.0482 0.500 0.004 0.488 0.008
#> GSM35447     3  0.2515     0.7677 0.012 0.004 0.912 0.072
#> GSM35450     1  0.2921     0.7622 0.860 0.000 0.000 0.140
#> GSM35453     1  0.5690     0.6444 0.700 0.000 0.216 0.084
#> GSM35456     4  0.4761     0.5092 0.184 0.048 0.000 0.768
#> GSM35464     2  0.4910     0.5095 0.020 0.704 0.000 0.276
#> GSM35467     1  0.0188     0.7939 0.996 0.000 0.004 0.000
#> GSM35470     1  0.6791     0.3714 0.508 0.000 0.392 0.100
#> GSM35479     3  0.2081     0.7585 0.000 0.000 0.916 0.084
#> GSM35484     1  0.3831     0.6770 0.792 0.000 0.004 0.204
#> GSM35488     1  0.0937     0.7954 0.976 0.000 0.012 0.012
#> GSM35491     1  0.1305     0.7887 0.960 0.000 0.036 0.004
#> GSM35494     3  0.2081     0.7614 0.000 0.000 0.916 0.084
#> GSM35498     1  0.5775     0.5724 0.660 0.048 0.004 0.288
#> GSM35501     1  0.1209     0.7931 0.964 0.000 0.004 0.032
#> GSM35509     3  0.3311     0.7413 0.000 0.000 0.828 0.172
#> GSM35513     1  0.0672     0.7939 0.984 0.000 0.008 0.008
#> GSM35516     2  0.5298     0.3580 0.016 0.612 0.000 0.372
#> GSM35522     1  0.6324     0.4267 0.572 0.072 0.000 0.356
#> GSM35525     1  0.1890     0.7907 0.936 0.000 0.008 0.056
#> GSM35528     1  0.2820     0.7857 0.904 0.020 0.008 0.068
#> GSM35533     1  0.5408     0.1928 0.500 0.000 0.012 0.488
#> GSM35537     1  0.6506     0.6259 0.652 0.004 0.200 0.144

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>          class entropy silhouette    p1    p2    p3    p4    p5
#> GSM35441     2  0.2416    0.73109 0.000 0.888 0.000 0.100 0.012
#> GSM35446     3  0.3002    0.72327 0.000 0.028 0.856 0.000 0.116
#> GSM35449     2  0.3123    0.67668 0.000 0.812 0.000 0.184 0.004
#> GSM35455     2  0.2248    0.73595 0.000 0.900 0.000 0.088 0.012
#> GSM35458     2  0.2075    0.71257 0.040 0.924 0.032 0.000 0.004
#> GSM35460     3  0.2748    0.73129 0.000 0.008 0.880 0.016 0.096
#> GSM35461     3  0.6233    0.53626 0.208 0.156 0.616 0.016 0.004
#> GSM35463     5  0.2969    0.55560 0.000 0.128 0.000 0.020 0.852
#> GSM35472     3  0.3088    0.70894 0.012 0.108 0.864 0.008 0.008
#> GSM35475     2  0.2853    0.68424 0.040 0.880 0.076 0.000 0.004
#> GSM35483     5  0.4118    0.34067 0.000 0.336 0.000 0.004 0.660
#> GSM35496     3  0.2450    0.73776 0.016 0.024 0.916 0.036 0.008
#> GSM35497     2  0.1544    0.73959 0.000 0.932 0.000 0.068 0.000
#> GSM35504     5  0.3880    0.57062 0.000 0.096 0.052 0.024 0.828
#> GSM35508     2  0.2529    0.73141 0.000 0.900 0.040 0.056 0.004
#> GSM35511     2  0.4064    0.50272 0.000 0.716 0.272 0.004 0.008
#> GSM35512     3  0.3613    0.68063 0.016 0.160 0.812 0.000 0.012
#> GSM35515     2  0.2313    0.70639 0.040 0.912 0.044 0.000 0.004
#> GSM35519     2  0.4726    0.34378 0.024 0.644 0.328 0.000 0.004
#> GSM35527     2  0.2295    0.73609 0.000 0.900 0.008 0.088 0.004
#> GSM35532     3  0.4562    0.22769 0.004 0.444 0.548 0.000 0.004
#> GSM35439     2  0.3299    0.67624 0.004 0.828 0.000 0.016 0.152
#> GSM35443     1  0.2623    0.77275 0.900 0.048 0.044 0.004 0.004
#> GSM35445     1  0.5972    0.22960 0.480 0.000 0.036 0.040 0.444
#> GSM35448     5  0.5018    0.28535 0.000 0.052 0.284 0.004 0.660
#> GSM35451     4  0.5324    0.39371 0.340 0.004 0.000 0.600 0.056
#> GSM35454     5  0.4906   -0.00240 0.004 0.000 0.380 0.024 0.592
#> GSM35457     4  0.4974   -0.09335 0.000 0.464 0.000 0.508 0.028
#> GSM35465     4  0.3779    0.52042 0.000 0.200 0.000 0.776 0.024
#> GSM35468     1  0.1334    0.81894 0.960 0.012 0.004 0.020 0.004
#> GSM35471     4  0.4423    0.57753 0.048 0.000 0.024 0.780 0.148
#> GSM35473     1  0.0671    0.82087 0.980 0.000 0.000 0.016 0.004
#> GSM35477     4  0.4576    0.12607 0.456 0.004 0.000 0.536 0.004
#> GSM35480     1  0.7172    0.31718 0.460 0.000 0.040 0.172 0.328
#> GSM35482     3  0.2396    0.73300 0.004 0.008 0.900 0.084 0.004
#> GSM35485     2  0.4306   -0.01373 0.000 0.508 0.000 0.000 0.492
#> GSM35489     2  0.4509    0.64325 0.000 0.752 0.000 0.152 0.096
#> GSM35492     1  0.1664    0.80635 0.948 0.020 0.020 0.008 0.004
#> GSM35495     3  0.3400    0.70846 0.000 0.000 0.828 0.036 0.136
#> GSM35499     5  0.3304    0.55943 0.000 0.052 0.004 0.092 0.852
#> GSM35502     1  0.1043    0.81489 0.960 0.000 0.000 0.040 0.000
#> GSM35505     3  0.5431    0.23378 0.048 0.004 0.500 0.000 0.448
#> GSM35507     4  0.1770    0.65702 0.008 0.048 0.000 0.936 0.008
#> GSM35510     5  0.6597    0.28901 0.000 0.244 0.000 0.296 0.460
#> GSM35514     1  0.0727    0.81921 0.980 0.012 0.000 0.004 0.004
#> GSM35517     2  0.3193    0.68535 0.000 0.840 0.000 0.028 0.132
#> GSM35520     2  0.2228    0.72194 0.008 0.916 0.020 0.000 0.056
#> GSM35523     4  0.1130    0.66342 0.012 0.004 0.012 0.968 0.004
#> GSM35529     2  0.4138    0.57231 0.000 0.708 0.000 0.276 0.016
#> GSM35531     2  0.5049    0.00481 0.024 0.500 0.004 0.000 0.472
#> GSM35534     5  0.4235    0.14856 0.000 0.424 0.000 0.000 0.576
#> GSM35536     1  0.0566    0.82100 0.984 0.004 0.000 0.012 0.000
#> GSM35538     1  0.2424    0.75502 0.868 0.000 0.000 0.132 0.000
#> GSM35539     4  0.4613    0.23895 0.408 0.000 0.004 0.580 0.008
#> GSM35540     4  0.5447    0.45803 0.000 0.200 0.128 0.668 0.004
#> GSM35541     2  0.4073    0.59920 0.000 0.752 0.000 0.032 0.216
#> GSM35442     1  0.5258    0.40654 0.628 0.040 0.320 0.008 0.004
#> GSM35447     3  0.5377    0.63038 0.056 0.044 0.704 0.000 0.196
#> GSM35450     1  0.3582    0.64368 0.768 0.000 0.000 0.224 0.008
#> GSM35453     1  0.4891    0.64999 0.732 0.000 0.196 0.036 0.036
#> GSM35456     5  0.5733   -0.07933 0.060 0.004 0.004 0.436 0.496
#> GSM35464     4  0.2597    0.62740 0.000 0.092 0.000 0.884 0.024
#> GSM35467     1  0.0613    0.81952 0.984 0.008 0.000 0.004 0.004
#> GSM35470     3  0.6489   -0.01500 0.144 0.000 0.444 0.404 0.008
#> GSM35479     3  0.2953    0.71617 0.004 0.000 0.868 0.100 0.028
#> GSM35484     1  0.3741    0.61578 0.732 0.000 0.000 0.004 0.264
#> GSM35488     1  0.1430    0.81243 0.944 0.004 0.000 0.052 0.000
#> GSM35491     1  0.0865    0.82115 0.972 0.004 0.000 0.024 0.000
#> GSM35494     3  0.2075    0.73889 0.004 0.000 0.924 0.040 0.032
#> GSM35498     4  0.1280    0.66771 0.024 0.008 0.008 0.960 0.000
#> GSM35501     1  0.0794    0.81886 0.972 0.000 0.000 0.028 0.000
#> GSM35509     3  0.2843    0.73025 0.000 0.000 0.876 0.048 0.076
#> GSM35513     1  0.0579    0.81879 0.984 0.008 0.000 0.000 0.008
#> GSM35516     5  0.5296   -0.02220 0.000 0.468 0.000 0.048 0.484
#> GSM35522     4  0.0451    0.66337 0.004 0.008 0.000 0.988 0.000
#> GSM35525     1  0.4302    0.44352 0.648 0.000 0.004 0.344 0.004
#> GSM35528     4  0.4183    0.44450 0.324 0.008 0.000 0.668 0.000
#> GSM35533     5  0.4722    0.07402 0.368 0.000 0.000 0.024 0.608
#> GSM35537     4  0.4253    0.53970 0.032 0.000 0.204 0.756 0.008

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>          class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM35441     5  0.6787     0.4134 0.000 0.076 0.000 0.264 0.472 0.188
#> GSM35446     3  0.3224     0.6208 0.000 0.084 0.848 0.000 0.036 0.032
#> GSM35449     5  0.3930     0.5931 0.000 0.004 0.000 0.156 0.768 0.072
#> GSM35455     5  0.2094     0.6791 0.000 0.008 0.000 0.068 0.908 0.016
#> GSM35458     5  0.2973     0.6506 0.024 0.000 0.000 0.004 0.836 0.136
#> GSM35460     3  0.1760     0.6393 0.000 0.048 0.928 0.000 0.004 0.020
#> GSM35461     6  0.7122     0.2227 0.076 0.000 0.276 0.008 0.204 0.436
#> GSM35463     2  0.3180     0.4600 0.000 0.852 0.004 0.012 0.072 0.060
#> GSM35472     3  0.4270     0.4720 0.000 0.004 0.724 0.008 0.044 0.220
#> GSM35475     5  0.3318     0.6133 0.020 0.000 0.024 0.000 0.824 0.132
#> GSM35483     2  0.4531     0.3923 0.000 0.692 0.012 0.000 0.240 0.056
#> GSM35496     3  0.3100     0.6058 0.000 0.004 0.848 0.012 0.028 0.108
#> GSM35497     5  0.2670     0.6802 0.000 0.020 0.000 0.052 0.884 0.044
#> GSM35504     2  0.5906     0.4150 0.000 0.652 0.128 0.012 0.132 0.076
#> GSM35508     5  0.2734     0.6272 0.000 0.000 0.008 0.024 0.864 0.104
#> GSM35511     5  0.3268     0.5767 0.000 0.000 0.076 0.000 0.824 0.100
#> GSM35512     3  0.4438     0.3061 0.000 0.000 0.628 0.000 0.044 0.328
#> GSM35515     5  0.2128     0.6550 0.032 0.000 0.000 0.004 0.908 0.056
#> GSM35519     6  0.6120     0.2097 0.000 0.008 0.308 0.000 0.228 0.456
#> GSM35527     5  0.2979     0.6359 0.000 0.000 0.004 0.056 0.852 0.088
#> GSM35532     3  0.5439    -0.0494 0.000 0.000 0.472 0.000 0.408 0.120
#> GSM35439     5  0.6079     0.4420 0.004 0.188 0.000 0.024 0.556 0.228
#> GSM35443     1  0.5005     0.2220 0.488 0.000 0.040 0.004 0.008 0.460
#> GSM35445     2  0.5938    -0.0280 0.400 0.480 0.020 0.012 0.000 0.088
#> GSM35448     2  0.5921     0.0285 0.000 0.508 0.372 0.004 0.072 0.044
#> GSM35451     4  0.4979     0.5178 0.248 0.040 0.000 0.664 0.000 0.048
#> GSM35454     3  0.5000     0.2728 0.000 0.432 0.512 0.012 0.000 0.044
#> GSM35457     4  0.5461     0.4244 0.000 0.076 0.000 0.664 0.180 0.080
#> GSM35465     4  0.3067     0.6229 0.000 0.016 0.004 0.852 0.104 0.024
#> GSM35468     1  0.3500     0.6755 0.768 0.000 0.000 0.028 0.000 0.204
#> GSM35471     4  0.3760     0.6248 0.032 0.096 0.024 0.824 0.000 0.024
#> GSM35473     1  0.1296     0.7533 0.952 0.012 0.000 0.004 0.000 0.032
#> GSM35477     4  0.4585     0.3749 0.324 0.016 0.000 0.632 0.000 0.028
#> GSM35480     1  0.6355     0.3233 0.552 0.256 0.012 0.044 0.000 0.136
#> GSM35482     3  0.2067     0.6303 0.000 0.004 0.916 0.048 0.004 0.028
#> GSM35485     2  0.5418     0.2595 0.000 0.596 0.004 0.008 0.280 0.112
#> GSM35489     4  0.7376     0.0520 0.000 0.204 0.000 0.408 0.164 0.224
#> GSM35492     1  0.4024     0.4468 0.592 0.000 0.004 0.004 0.000 0.400
#> GSM35495     3  0.1983     0.6398 0.000 0.060 0.916 0.012 0.000 0.012
#> GSM35499     2  0.5122     0.2675 0.000 0.628 0.016 0.292 0.008 0.056
#> GSM35502     1  0.1219     0.7481 0.948 0.000 0.000 0.004 0.000 0.048
#> GSM35505     3  0.6148     0.0398 0.020 0.164 0.452 0.000 0.000 0.364
#> GSM35507     4  0.1979     0.6573 0.008 0.004 0.004 0.924 0.048 0.012
#> GSM35510     4  0.6097     0.0737 0.000 0.404 0.004 0.464 0.080 0.048
#> GSM35514     1  0.3222     0.6991 0.844 0.012 0.000 0.004 0.040 0.100
#> GSM35517     5  0.4911     0.5700 0.000 0.156 0.000 0.040 0.712 0.092
#> GSM35520     5  0.5690     0.4589 0.000 0.152 0.012 0.000 0.560 0.276
#> GSM35523     4  0.3769     0.6316 0.100 0.000 0.044 0.816 0.004 0.036
#> GSM35529     5  0.5907     0.1864 0.000 0.032 0.000 0.420 0.452 0.096
#> GSM35531     6  0.6929    -0.2387 0.004 0.312 0.004 0.072 0.152 0.456
#> GSM35534     2  0.6102     0.1158 0.000 0.492 0.004 0.008 0.292 0.204
#> GSM35536     1  0.1049     0.7556 0.960 0.000 0.000 0.008 0.000 0.032
#> GSM35538     1  0.2206     0.7468 0.904 0.008 0.000 0.064 0.000 0.024
#> GSM35539     1  0.4616     0.3329 0.596 0.000 0.004 0.360 0.000 0.040
#> GSM35540     4  0.4527     0.6034 0.000 0.024 0.100 0.772 0.080 0.024
#> GSM35541     5  0.6862     0.2345 0.000 0.292 0.000 0.072 0.440 0.196
#> GSM35442     6  0.6217     0.0866 0.208 0.000 0.380 0.012 0.000 0.400
#> GSM35447     3  0.5994     0.3574 0.020 0.144 0.576 0.000 0.012 0.248
#> GSM35450     1  0.4253     0.6694 0.752 0.016 0.004 0.176 0.000 0.052
#> GSM35453     1  0.4287     0.6535 0.772 0.024 0.136 0.008 0.000 0.060
#> GSM35456     2  0.7113     0.1393 0.316 0.444 0.008 0.068 0.008 0.156
#> GSM35464     4  0.1929     0.6516 0.004 0.008 0.000 0.924 0.048 0.016
#> GSM35467     1  0.0547     0.7525 0.980 0.000 0.000 0.000 0.000 0.020
#> GSM35470     3  0.5786     0.2894 0.108 0.000 0.600 0.244 0.000 0.048
#> GSM35479     3  0.2641     0.6021 0.000 0.004 0.876 0.072 0.000 0.048
#> GSM35484     1  0.5372     0.2761 0.528 0.364 0.000 0.004 0.000 0.104
#> GSM35488     1  0.2979     0.7327 0.840 0.000 0.000 0.044 0.000 0.116
#> GSM35491     1  0.4163     0.5633 0.656 0.008 0.000 0.016 0.000 0.320
#> GSM35494     3  0.3176     0.6222 0.016 0.024 0.856 0.008 0.004 0.092
#> GSM35498     4  0.1657     0.6588 0.012 0.000 0.040 0.936 0.000 0.012
#> GSM35501     1  0.0713     0.7528 0.972 0.000 0.000 0.000 0.000 0.028
#> GSM35509     3  0.1710     0.6378 0.000 0.020 0.936 0.028 0.000 0.016
#> GSM35513     1  0.0858     0.7532 0.968 0.000 0.000 0.000 0.004 0.028
#> GSM35516     2  0.6456     0.3468 0.020 0.592 0.000 0.132 0.184 0.072
#> GSM35522     4  0.3613     0.6458 0.076 0.004 0.036 0.840 0.012 0.032
#> GSM35525     1  0.3706     0.6579 0.772 0.000 0.000 0.172 0.000 0.056
#> GSM35528     4  0.4768     0.1305 0.416 0.000 0.000 0.532 0.000 0.052
#> GSM35533     2  0.5227    -0.1652 0.460 0.480 0.008 0.020 0.000 0.032
#> GSM35537     4  0.6675     0.3279 0.204 0.004 0.264 0.480 0.000 0.048

Heatmaps for the consensus matrix. It visualizes the probability of two samples to be in a same group.

consensus_heatmap(res, k = 2)

plot of chunk tab-CV-NMF-consensus-heatmap-1

consensus_heatmap(res, k = 3)

plot of chunk tab-CV-NMF-consensus-heatmap-2

consensus_heatmap(res, k = 4)

plot of chunk tab-CV-NMF-consensus-heatmap-3

consensus_heatmap(res, k = 5)

plot of chunk tab-CV-NMF-consensus-heatmap-4

consensus_heatmap(res, k = 6)

plot of chunk tab-CV-NMF-consensus-heatmap-5

Heatmaps for the membership of samples in all partitions to see how consistent they are:

membership_heatmap(res, k = 2)

plot of chunk tab-CV-NMF-membership-heatmap-1

membership_heatmap(res, k = 3)

plot of chunk tab-CV-NMF-membership-heatmap-2

membership_heatmap(res, k = 4)

plot of chunk tab-CV-NMF-membership-heatmap-3

membership_heatmap(res, k = 5)

plot of chunk tab-CV-NMF-membership-heatmap-4

membership_heatmap(res, k = 6)

plot of chunk tab-CV-NMF-membership-heatmap-5

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)

plot of chunk tab-CV-NMF-get-signatures-1

get_signatures(res, k = 3)

plot of chunk tab-CV-NMF-get-signatures-2

get_signatures(res, k = 4)

plot of chunk tab-CV-NMF-get-signatures-3

get_signatures(res, k = 5)

plot of chunk tab-CV-NMF-get-signatures-4

get_signatures(res, k = 6)

plot of chunk tab-CV-NMF-get-signatures-5

Signature heatmaps where rows are not scaled:

get_signatures(res, k = 2, scale_rows = FALSE)

plot of chunk tab-CV-NMF-get-signatures-no-scale-1

get_signatures(res, k = 3, scale_rows = FALSE)

plot of chunk tab-CV-NMF-get-signatures-no-scale-2

get_signatures(res, k = 4, scale_rows = FALSE)

plot of chunk tab-CV-NMF-get-signatures-no-scale-3

get_signatures(res, k = 5, scale_rows = FALSE)

plot of chunk tab-CV-NMF-get-signatures-no-scale-4

get_signatures(res, k = 6, scale_rows = FALSE)

plot of chunk tab-CV-NMF-get-signatures-no-scale-5

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk CV-NMF-signature_compare

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:

  1. which_row: row indices corresponding to the input matrix.
  2. fdr: FDR for the differential test.
  3. mean_x: The mean value in group x.
  4. scaled_mean_x: The mean value in group x after rows are scaled.
  5. 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")

plot of chunk tab-CV-NMF-dimension-reduction-1

dimension_reduction(res, k = 3, method = "UMAP")

plot of chunk tab-CV-NMF-dimension-reduction-2

dimension_reduction(res, k = 4, method = "UMAP")

plot of chunk tab-CV-NMF-dimension-reduction-3

dimension_reduction(res, k = 5, method = "UMAP")

plot of chunk tab-CV-NMF-dimension-reduction-4

dimension_reduction(res, k = 6, method = "UMAP")

plot of chunk tab-CV-NMF-dimension-reduction-5

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk CV-NMF-collect-classes

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  time(p) k
#> CV:NMF 77 5.70e-07 2
#> CV:NMF 76 3.48e-05 3
#> CV:NMF 63 1.58e-03 4
#> CV:NMF 55 1.09e-03 5
#> CV:NMF 41 4.42e-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.


MAD:hclust

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 7758 rows and 79 columns.
#>   Top rows (776, 1552, 2328, 3103, 3879) 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)

plot of chunk MAD-hclust-collect-plots

The plots are:

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:

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)

plot of chunk MAD-hclust-select-partition-number

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.625           0.876       0.937         0.4917 0.498   0.498
#> 3 3 0.632           0.805       0.900         0.2088 0.903   0.805
#> 4 4 0.626           0.755       0.874         0.0672 0.968   0.922
#> 5 5 0.618           0.568       0.760         0.1397 0.880   0.698
#> 6 6 0.680           0.617       0.767         0.0557 0.919   0.758

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.

show/hide code output

cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#>          class entropy silhouette    p1    p2
#> GSM35441     2  0.0000      0.913 0.000 1.000
#> GSM35446     2  0.4815      0.877 0.104 0.896
#> GSM35449     2  0.0000      0.913 0.000 1.000
#> GSM35455     2  0.0000      0.913 0.000 1.000
#> GSM35458     2  0.4161      0.893 0.084 0.916
#> GSM35460     2  0.4815      0.877 0.104 0.896
#> GSM35461     1  0.8661      0.606 0.712 0.288
#> GSM35463     2  0.0000      0.913 0.000 1.000
#> GSM35472     2  0.9866      0.289 0.432 0.568
#> GSM35475     2  0.3879      0.897 0.076 0.924
#> GSM35483     2  0.0000      0.913 0.000 1.000
#> GSM35496     1  0.0000      0.943 1.000 0.000
#> GSM35497     2  0.0000      0.913 0.000 1.000
#> GSM35504     2  0.3879      0.896 0.076 0.924
#> GSM35508     2  0.0000      0.913 0.000 1.000
#> GSM35511     2  0.3584      0.898 0.068 0.932
#> GSM35512     2  0.9661      0.401 0.392 0.608
#> GSM35515     2  0.4161      0.893 0.084 0.916
#> GSM35519     2  0.9661      0.401 0.392 0.608
#> GSM35527     2  0.0000      0.913 0.000 1.000
#> GSM35532     2  0.4161      0.891 0.084 0.916
#> GSM35439     2  0.0000      0.913 0.000 1.000
#> GSM35443     1  0.2043      0.931 0.968 0.032
#> GSM35445     1  0.0000      0.943 1.000 0.000
#> GSM35448     2  0.4431      0.887 0.092 0.908
#> GSM35451     1  0.1414      0.939 0.980 0.020
#> GSM35454     1  0.6343      0.817 0.840 0.160
#> GSM35457     2  0.0000      0.913 0.000 1.000
#> GSM35465     2  0.2236      0.906 0.036 0.964
#> GSM35468     1  0.0672      0.942 0.992 0.008
#> GSM35471     1  0.2236      0.930 0.964 0.036
#> GSM35473     1  0.0000      0.943 1.000 0.000
#> GSM35477     1  0.1414      0.939 0.980 0.020
#> GSM35480     1  0.0000      0.943 1.000 0.000
#> GSM35482     1  0.0376      0.943 0.996 0.004
#> GSM35485     2  0.0376      0.914 0.004 0.996
#> GSM35489     2  0.4690      0.874 0.100 0.900
#> GSM35492     1  0.0672      0.942 0.992 0.008
#> GSM35495     2  0.9661      0.410 0.392 0.608
#> GSM35499     2  0.0376      0.914 0.004 0.996
#> GSM35502     1  0.0000      0.943 1.000 0.000
#> GSM35505     1  0.6343      0.817 0.840 0.160
#> GSM35507     1  0.7376      0.761 0.792 0.208
#> GSM35510     2  0.0376      0.914 0.004 0.996
#> GSM35514     1  0.0000      0.943 1.000 0.000
#> GSM35517     2  0.0000      0.913 0.000 1.000
#> GSM35520     2  0.4815      0.871 0.104 0.896
#> GSM35523     1  0.5519      0.852 0.872 0.128
#> GSM35529     2  0.0000      0.913 0.000 1.000
#> GSM35531     2  0.4690      0.874 0.100 0.900
#> GSM35534     2  0.0938      0.913 0.012 0.988
#> GSM35536     1  0.0000      0.943 1.000 0.000
#> GSM35538     1  0.0000      0.943 1.000 0.000
#> GSM35539     1  0.0000      0.943 1.000 0.000
#> GSM35540     2  0.0376      0.914 0.004 0.996
#> GSM35541     2  0.0000      0.913 0.000 1.000
#> GSM35442     1  0.2043      0.931 0.968 0.032
#> GSM35447     1  0.6343      0.817 0.840 0.160
#> GSM35450     1  0.1414      0.939 0.980 0.020
#> GSM35453     1  0.0000      0.943 1.000 0.000
#> GSM35456     1  0.3274      0.916 0.940 0.060
#> GSM35464     1  0.7528      0.749 0.784 0.216
#> GSM35467     1  0.0000      0.943 1.000 0.000
#> GSM35470     1  0.0000      0.943 1.000 0.000
#> GSM35479     1  0.0376      0.943 0.996 0.004
#> GSM35484     1  0.1184      0.940 0.984 0.016
#> GSM35488     1  0.0000      0.943 1.000 0.000
#> GSM35491     1  0.0672      0.942 0.992 0.008
#> GSM35494     1  0.0376      0.943 0.996 0.004
#> GSM35498     1  0.7528      0.749 0.784 0.216
#> GSM35501     1  0.0000      0.943 1.000 0.000
#> GSM35509     1  0.7376      0.749 0.792 0.208
#> GSM35513     1  0.0000      0.943 1.000 0.000
#> GSM35516     2  0.3584      0.896 0.068 0.932
#> GSM35522     1  0.5519      0.852 0.872 0.128
#> GSM35525     1  0.0000      0.943 1.000 0.000
#> GSM35528     1  0.0000      0.943 1.000 0.000
#> GSM35533     1  0.1184      0.940 0.984 0.016
#> GSM35537     1  0.0000      0.943 1.000 0.000

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>          class entropy silhouette    p1    p2    p3
#> GSM35441     2  0.0592      0.896 0.000 0.988 0.012
#> GSM35446     3  0.0237      0.671 0.000 0.004 0.996
#> GSM35449     2  0.0592      0.896 0.000 0.988 0.012
#> GSM35455     2  0.0592      0.896 0.000 0.988 0.012
#> GSM35458     3  0.5731      0.663 0.020 0.228 0.752
#> GSM35460     3  0.0237      0.671 0.000 0.004 0.996
#> GSM35461     1  0.7084      0.403 0.628 0.036 0.336
#> GSM35463     2  0.0000      0.895 0.000 1.000 0.000
#> GSM35472     3  0.8857      0.486 0.344 0.132 0.524
#> GSM35475     3  0.5493      0.657 0.012 0.232 0.756
#> GSM35483     2  0.0000      0.895 0.000 1.000 0.000
#> GSM35496     1  0.2796      0.872 0.908 0.000 0.092
#> GSM35497     2  0.0592      0.896 0.000 0.988 0.012
#> GSM35504     3  0.6154      0.194 0.000 0.408 0.592
#> GSM35508     2  0.5882      0.433 0.000 0.652 0.348
#> GSM35511     3  0.4842      0.657 0.000 0.224 0.776
#> GSM35512     3  0.8793      0.556 0.308 0.140 0.552
#> GSM35515     3  0.5731      0.663 0.020 0.228 0.752
#> GSM35519     3  0.8793      0.556 0.308 0.140 0.552
#> GSM35527     2  0.5882      0.433 0.000 0.652 0.348
#> GSM35532     3  0.4883      0.669 0.004 0.208 0.788
#> GSM35439     2  0.0000      0.895 0.000 1.000 0.000
#> GSM35443     1  0.1751      0.910 0.960 0.012 0.028
#> GSM35445     1  0.0000      0.924 1.000 0.000 0.000
#> GSM35448     3  0.0747      0.671 0.000 0.016 0.984
#> GSM35451     1  0.0892      0.920 0.980 0.020 0.000
#> GSM35454     1  0.4741      0.785 0.828 0.020 0.152
#> GSM35457     2  0.0592      0.896 0.000 0.988 0.012
#> GSM35465     2  0.2434      0.866 0.036 0.940 0.024
#> GSM35468     1  0.0424      0.923 0.992 0.008 0.000
#> GSM35471     1  0.1411      0.912 0.964 0.036 0.000
#> GSM35473     1  0.0000      0.924 1.000 0.000 0.000
#> GSM35477     1  0.0892      0.920 0.980 0.020 0.000
#> GSM35480     1  0.0000      0.924 1.000 0.000 0.000
#> GSM35482     1  0.2496      0.890 0.928 0.004 0.068
#> GSM35485     2  0.0237      0.893 0.004 0.996 0.000
#> GSM35489     2  0.6299      0.655 0.096 0.772 0.132
#> GSM35492     1  0.0424      0.923 0.992 0.008 0.000
#> GSM35495     3  0.5591      0.497 0.304 0.000 0.696
#> GSM35499     2  0.1765      0.884 0.004 0.956 0.040
#> GSM35502     1  0.0000      0.924 1.000 0.000 0.000
#> GSM35505     1  0.4741      0.785 0.828 0.020 0.152
#> GSM35507     1  0.4654      0.729 0.792 0.208 0.000
#> GSM35510     2  0.1765      0.884 0.004 0.956 0.040
#> GSM35514     1  0.0000      0.924 1.000 0.000 0.000
#> GSM35517     2  0.0000      0.895 0.000 1.000 0.000
#> GSM35520     2  0.7782      0.450 0.100 0.652 0.248
#> GSM35523     1  0.3482      0.825 0.872 0.128 0.000
#> GSM35529     2  0.0592      0.896 0.000 0.988 0.012
#> GSM35531     2  0.6299      0.655 0.096 0.772 0.132
#> GSM35534     2  0.0983      0.889 0.004 0.980 0.016
#> GSM35536     1  0.0000      0.924 1.000 0.000 0.000
#> GSM35538     1  0.0000      0.924 1.000 0.000 0.000
#> GSM35539     1  0.0000      0.924 1.000 0.000 0.000
#> GSM35540     2  0.1765      0.884 0.004 0.956 0.040
#> GSM35541     2  0.0000      0.895 0.000 1.000 0.000
#> GSM35442     1  0.1751      0.910 0.960 0.012 0.028
#> GSM35447     1  0.4741      0.785 0.828 0.020 0.152
#> GSM35450     1  0.0892      0.920 0.980 0.020 0.000
#> GSM35453     1  0.0000      0.924 1.000 0.000 0.000
#> GSM35456     1  0.2066      0.897 0.940 0.060 0.000
#> GSM35464     1  0.4750      0.717 0.784 0.216 0.000
#> GSM35467     1  0.0000      0.924 1.000 0.000 0.000
#> GSM35470     1  0.0592      0.922 0.988 0.000 0.012
#> GSM35479     1  0.2796      0.873 0.908 0.000 0.092
#> GSM35484     1  0.0747      0.921 0.984 0.016 0.000
#> GSM35488     1  0.0000      0.924 1.000 0.000 0.000
#> GSM35491     1  0.0424      0.923 0.992 0.008 0.000
#> GSM35494     1  0.2796      0.873 0.908 0.000 0.092
#> GSM35498     1  0.4750      0.717 0.784 0.216 0.000
#> GSM35501     1  0.0000      0.924 1.000 0.000 0.000
#> GSM35509     1  0.5529      0.596 0.704 0.000 0.296
#> GSM35513     1  0.0000      0.924 1.000 0.000 0.000
#> GSM35516     2  0.2261      0.828 0.068 0.932 0.000
#> GSM35522     1  0.3482      0.825 0.872 0.128 0.000
#> GSM35525     1  0.0000      0.924 1.000 0.000 0.000
#> GSM35528     1  0.0000      0.924 1.000 0.000 0.000
#> GSM35533     1  0.0747      0.921 0.984 0.016 0.000
#> GSM35537     1  0.0424      0.923 0.992 0.000 0.008

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>          class entropy silhouette    p1    p2    p3    p4
#> GSM35441     2  0.2149      0.864 0.000 0.912 0.088 0.000
#> GSM35446     4  0.2530      0.694 0.000 0.000 0.112 0.888
#> GSM35449     2  0.2868      0.841 0.000 0.864 0.136 0.000
#> GSM35455     2  0.2868      0.841 0.000 0.864 0.136 0.000
#> GSM35458     3  0.1767      0.562 0.012 0.044 0.944 0.000
#> GSM35460     4  0.2530      0.694 0.000 0.000 0.112 0.888
#> GSM35461     1  0.5756      0.352 0.568 0.000 0.400 0.032
#> GSM35463     2  0.1022      0.860 0.000 0.968 0.000 0.032
#> GSM35472     3  0.5827      0.314 0.316 0.000 0.632 0.052
#> GSM35475     3  0.1489      0.559 0.004 0.044 0.952 0.000
#> GSM35483     2  0.1022      0.860 0.000 0.968 0.000 0.032
#> GSM35496     1  0.4100      0.837 0.832 0.000 0.092 0.076
#> GSM35497     2  0.2868      0.841 0.000 0.864 0.136 0.000
#> GSM35504     4  0.7002      0.226 0.000 0.352 0.128 0.520
#> GSM35508     3  0.5778     -0.125 0.000 0.472 0.500 0.028
#> GSM35511     3  0.1677      0.550 0.000 0.040 0.948 0.012
#> GSM35512     3  0.5417      0.359 0.284 0.000 0.676 0.040
#> GSM35515     3  0.1767      0.562 0.012 0.044 0.944 0.000
#> GSM35519     3  0.5417      0.359 0.284 0.000 0.676 0.040
#> GSM35527     3  0.5778     -0.125 0.000 0.472 0.500 0.028
#> GSM35532     3  0.1284      0.541 0.000 0.024 0.964 0.012
#> GSM35439     2  0.1022      0.860 0.000 0.968 0.000 0.032
#> GSM35443     1  0.2363      0.887 0.920 0.000 0.056 0.024
#> GSM35445     1  0.1042      0.902 0.972 0.000 0.008 0.020
#> GSM35448     4  0.2988      0.690 0.000 0.012 0.112 0.876
#> GSM35451     1  0.1247      0.900 0.968 0.012 0.004 0.016
#> GSM35454     1  0.4805      0.760 0.780 0.004 0.164 0.052
#> GSM35457     2  0.2216      0.863 0.000 0.908 0.092 0.000
#> GSM35465     2  0.3202      0.851 0.024 0.888 0.076 0.012
#> GSM35468     1  0.1629      0.900 0.952 0.000 0.024 0.024
#> GSM35471     1  0.1920      0.893 0.944 0.028 0.004 0.024
#> GSM35473     1  0.1042      0.902 0.972 0.000 0.008 0.020
#> GSM35477     1  0.1247      0.900 0.968 0.012 0.004 0.016
#> GSM35480     1  0.0469      0.905 0.988 0.000 0.000 0.012
#> GSM35482     1  0.3667      0.858 0.856 0.000 0.056 0.088
#> GSM35485     2  0.1209      0.859 0.004 0.964 0.000 0.032
#> GSM35489     2  0.6070      0.637 0.076 0.712 0.188 0.024
#> GSM35492     1  0.1629      0.900 0.952 0.000 0.024 0.024
#> GSM35495     4  0.6112      0.342 0.248 0.000 0.096 0.656
#> GSM35499     2  0.2799      0.857 0.000 0.884 0.108 0.008
#> GSM35502     1  0.0000      0.905 1.000 0.000 0.000 0.000
#> GSM35505     1  0.4805      0.760 0.780 0.004 0.164 0.052
#> GSM35507     1  0.5036      0.712 0.760 0.192 0.012 0.036
#> GSM35510     2  0.2799      0.857 0.000 0.884 0.108 0.008
#> GSM35514     1  0.0000      0.905 1.000 0.000 0.000 0.000
#> GSM35517     2  0.1022      0.860 0.000 0.968 0.000 0.032
#> GSM35520     2  0.6705      0.413 0.080 0.592 0.316 0.012
#> GSM35523     1  0.4059      0.804 0.832 0.124 0.004 0.040
#> GSM35529     2  0.2216      0.863 0.000 0.908 0.092 0.000
#> GSM35531     2  0.6070      0.637 0.076 0.712 0.188 0.024
#> GSM35534     2  0.1576      0.852 0.004 0.948 0.000 0.048
#> GSM35536     1  0.0000      0.905 1.000 0.000 0.000 0.000
#> GSM35538     1  0.0000      0.905 1.000 0.000 0.000 0.000
#> GSM35539     1  0.0592      0.904 0.984 0.000 0.000 0.016
#> GSM35540     2  0.2799      0.857 0.000 0.884 0.108 0.008
#> GSM35541     2  0.1022      0.860 0.000 0.968 0.000 0.032
#> GSM35442     1  0.2363      0.887 0.920 0.000 0.056 0.024
#> GSM35447     1  0.4805      0.760 0.780 0.004 0.164 0.052
#> GSM35450     1  0.1247      0.900 0.968 0.012 0.004 0.016
#> GSM35453     1  0.1042      0.902 0.972 0.000 0.008 0.020
#> GSM35456     1  0.2467      0.880 0.920 0.052 0.004 0.024
#> GSM35464     1  0.5114      0.700 0.752 0.200 0.012 0.036
#> GSM35467     1  0.0000      0.905 1.000 0.000 0.000 0.000
#> GSM35470     1  0.1938      0.897 0.936 0.000 0.012 0.052
#> GSM35479     1  0.3803      0.837 0.836 0.000 0.032 0.132
#> GSM35484     1  0.1640      0.903 0.956 0.012 0.012 0.020
#> GSM35488     1  0.0000      0.905 1.000 0.000 0.000 0.000
#> GSM35491     1  0.1629      0.900 0.952 0.000 0.024 0.024
#> GSM35494     1  0.3803      0.837 0.836 0.000 0.032 0.132
#> GSM35498     1  0.5114      0.700 0.752 0.200 0.012 0.036
#> GSM35501     1  0.0000      0.905 1.000 0.000 0.000 0.000
#> GSM35509     1  0.5657      0.560 0.644 0.000 0.044 0.312
#> GSM35513     1  0.0000      0.905 1.000 0.000 0.000 0.000
#> GSM35516     2  0.2816      0.807 0.064 0.900 0.000 0.036
#> GSM35522     1  0.4059      0.804 0.832 0.124 0.004 0.040
#> GSM35525     1  0.0592      0.904 0.984 0.000 0.000 0.016
#> GSM35528     1  0.0000      0.905 1.000 0.000 0.000 0.000
#> GSM35533     1  0.1640      0.903 0.956 0.012 0.012 0.020
#> GSM35537     1  0.1474      0.900 0.948 0.000 0.000 0.052

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>          class entropy silhouette    p1    p2    p3    p4    p5
#> GSM35441     2  0.2388      0.714 0.000 0.900 0.000 0.028 0.072
#> GSM35446     3  0.4169      0.338 0.000 0.000 0.732 0.240 0.028
#> GSM35449     2  0.3323      0.658 0.000 0.844 0.000 0.056 0.100
#> GSM35455     2  0.3323      0.658 0.000 0.844 0.000 0.056 0.100
#> GSM35458     5  0.4370      0.259 0.008 0.004 0.000 0.332 0.656
#> GSM35460     3  0.4169      0.338 0.000 0.000 0.732 0.240 0.028
#> GSM35461     5  0.5532      0.226 0.224 0.000 0.092 0.016 0.668
#> GSM35463     2  0.2471      0.719 0.000 0.864 0.000 0.136 0.000
#> GSM35472     5  0.1948      0.398 0.024 0.000 0.036 0.008 0.932
#> GSM35475     5  0.4370      0.252 0.004 0.008 0.000 0.332 0.656
#> GSM35483     2  0.2516      0.716 0.000 0.860 0.000 0.140 0.000
#> GSM35496     5  0.7944     -0.234 0.316 0.000 0.264 0.076 0.344
#> GSM35497     2  0.3323      0.658 0.000 0.844 0.000 0.056 0.100
#> GSM35504     4  0.7646      0.172 0.000 0.320 0.312 0.324 0.044
#> GSM35508     4  0.6460      0.570 0.000 0.404 0.000 0.416 0.180
#> GSM35511     5  0.4253      0.246 0.000 0.004 0.004 0.332 0.660
#> GSM35512     5  0.1093      0.400 0.020 0.004 0.004 0.004 0.968
#> GSM35515     5  0.4370      0.259 0.008 0.004 0.000 0.332 0.656
#> GSM35519     5  0.1093      0.400 0.020 0.004 0.004 0.004 0.968
#> GSM35527     4  0.6460      0.570 0.000 0.404 0.000 0.416 0.180
#> GSM35532     5  0.4181      0.261 0.000 0.004 0.004 0.316 0.676
#> GSM35439     2  0.2127      0.732 0.000 0.892 0.000 0.108 0.000
#> GSM35443     1  0.4377      0.715 0.796 0.000 0.088 0.024 0.092
#> GSM35445     1  0.2605      0.794 0.900 0.000 0.060 0.024 0.016
#> GSM35448     3  0.4276      0.328 0.000 0.000 0.716 0.256 0.028
#> GSM35451     1  0.1573      0.815 0.948 0.008 0.004 0.036 0.004
#> GSM35454     5  0.6462      0.115 0.428 0.004 0.084 0.024 0.460
#> GSM35457     2  0.2069      0.720 0.000 0.912 0.000 0.012 0.076
#> GSM35465     2  0.3384      0.666 0.000 0.848 0.004 0.088 0.060
#> GSM35468     1  0.3169      0.778 0.868 0.000 0.084 0.024 0.024
#> GSM35471     1  0.3739      0.771 0.844 0.020 0.060 0.072 0.004
#> GSM35473     1  0.2502      0.796 0.904 0.000 0.060 0.024 0.012
#> GSM35477     1  0.1573      0.815 0.948 0.008 0.004 0.036 0.004
#> GSM35480     1  0.2104      0.809 0.916 0.000 0.060 0.024 0.000
#> GSM35482     1  0.8033     -0.300 0.328 0.000 0.280 0.084 0.308
#> GSM35485     2  0.2286      0.731 0.004 0.888 0.000 0.108 0.000
#> GSM35489     2  0.5367      0.495 0.024 0.672 0.000 0.056 0.248
#> GSM35492     1  0.3313      0.772 0.860 0.000 0.088 0.024 0.028
#> GSM35495     3  0.2632      0.406 0.040 0.000 0.888 0.000 0.072
#> GSM35499     2  0.3062      0.693 0.000 0.868 0.004 0.048 0.080
#> GSM35502     1  0.0162      0.823 0.996 0.000 0.000 0.004 0.000
#> GSM35505     5  0.6462      0.115 0.428 0.004 0.084 0.024 0.460
#> GSM35507     1  0.6939      0.527 0.616 0.132 0.084 0.156 0.012
#> GSM35510     2  0.3062      0.693 0.000 0.868 0.004 0.048 0.080
#> GSM35514     1  0.0162      0.823 0.996 0.000 0.000 0.004 0.000
#> GSM35517     2  0.2127      0.732 0.000 0.892 0.000 0.108 0.000
#> GSM35520     2  0.6270      0.211 0.028 0.568 0.000 0.096 0.308
#> GSM35523     1  0.6682      0.541 0.620 0.068 0.136 0.172 0.004
#> GSM35529     2  0.2069      0.720 0.000 0.912 0.000 0.012 0.076
#> GSM35531     2  0.5367      0.495 0.024 0.672 0.000 0.056 0.248
#> GSM35534     2  0.2646      0.722 0.004 0.868 0.004 0.124 0.000
#> GSM35536     1  0.0000      0.823 1.000 0.000 0.000 0.000 0.000
#> GSM35538     1  0.0000      0.823 1.000 0.000 0.000 0.000 0.000
#> GSM35539     1  0.2676      0.783 0.884 0.000 0.080 0.036 0.000
#> GSM35540     2  0.3062      0.693 0.000 0.868 0.004 0.048 0.080
#> GSM35541     2  0.2127      0.732 0.000 0.892 0.000 0.108 0.000
#> GSM35442     1  0.4377      0.715 0.796 0.000 0.088 0.024 0.092
#> GSM35447     5  0.6462      0.115 0.428 0.004 0.084 0.024 0.460
#> GSM35450     1  0.1573      0.815 0.948 0.008 0.004 0.036 0.004
#> GSM35453     1  0.2605      0.794 0.900 0.000 0.060 0.024 0.016
#> GSM35456     1  0.4325      0.749 0.812 0.036 0.076 0.072 0.004
#> GSM35464     1  0.7013      0.515 0.608 0.140 0.084 0.156 0.012
#> GSM35467     1  0.0162      0.823 0.996 0.000 0.000 0.004 0.000
#> GSM35470     1  0.6798      0.450 0.596 0.000 0.200 0.088 0.116
#> GSM35479     3  0.7964      0.143 0.304 0.000 0.336 0.076 0.284
#> GSM35484     1  0.2599      0.814 0.908 0.008 0.032 0.040 0.012
#> GSM35488     1  0.0000      0.823 1.000 0.000 0.000 0.000 0.000
#> GSM35491     1  0.3313      0.772 0.860 0.000 0.088 0.024 0.028
#> GSM35494     3  0.7964      0.143 0.304 0.000 0.336 0.076 0.284
#> GSM35498     1  0.7013      0.515 0.608 0.140 0.084 0.156 0.012
#> GSM35501     1  0.0162      0.823 0.996 0.000 0.000 0.004 0.000
#> GSM35509     3  0.6747      0.262 0.172 0.000 0.540 0.028 0.260
#> GSM35513     1  0.0162      0.823 0.996 0.000 0.000 0.004 0.000
#> GSM35516     2  0.3493      0.674 0.060 0.832 0.000 0.108 0.000
#> GSM35522     1  0.6682      0.541 0.620 0.068 0.136 0.172 0.004
#> GSM35525     1  0.2676      0.783 0.884 0.000 0.080 0.036 0.000
#> GSM35528     1  0.0000      0.823 1.000 0.000 0.000 0.000 0.000
#> GSM35533     1  0.2599      0.814 0.908 0.008 0.032 0.040 0.012
#> GSM35537     1  0.5632      0.639 0.704 0.000 0.156 0.084 0.056

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>          class entropy silhouette    p1    p2    p3    p4    p5 p6
#> GSM35441     2  0.1838    0.76753 0.000 0.916 0.000 0.000 0.068 NA
#> GSM35446     4  0.0458    0.74211 0.000 0.000 0.016 0.984 0.000 NA
#> GSM35449     2  0.2747    0.73040 0.000 0.860 0.004 0.000 0.108 NA
#> GSM35455     2  0.2747    0.73040 0.000 0.860 0.004 0.000 0.108 NA
#> GSM35458     5  0.0436    0.64464 0.004 0.004 0.000 0.000 0.988 NA
#> GSM35460     4  0.0458    0.74211 0.000 0.000 0.016 0.984 0.000 NA
#> GSM35461     5  0.7529    0.14980 0.188 0.000 0.192 0.000 0.360 NA
#> GSM35463     2  0.3468    0.72442 0.000 0.712 0.000 0.004 0.000 NA
#> GSM35472     5  0.5591    0.52478 0.000 0.000 0.116 0.028 0.604 NA
#> GSM35475     5  0.0405    0.64414 0.000 0.008 0.000 0.000 0.988 NA
#> GSM35483     2  0.3595    0.71960 0.000 0.704 0.000 0.008 0.000 NA
#> GSM35496     3  0.1938    0.72230 0.020 0.000 0.920 0.000 0.052 NA
#> GSM35497     2  0.2747    0.73040 0.000 0.860 0.004 0.000 0.108 NA
#> GSM35504     4  0.5538    0.32356 0.000 0.332 0.004 0.568 0.028 NA
#> GSM35508     5  0.6088    0.05287 0.000 0.404 0.012 0.000 0.408 NA
#> GSM35511     5  0.0551    0.64010 0.000 0.004 0.000 0.008 0.984 NA
#> GSM35512     5  0.5277    0.54670 0.000 0.004 0.076 0.024 0.636 NA
#> GSM35515     5  0.0436    0.64464 0.004 0.004 0.000 0.000 0.988 NA
#> GSM35519     5  0.5277    0.54670 0.000 0.004 0.076 0.024 0.636 NA
#> GSM35527     5  0.6088    0.05287 0.000 0.404 0.012 0.000 0.408 NA
#> GSM35532     5  0.1026    0.63865 0.000 0.004 0.012 0.008 0.968 NA
#> GSM35439     2  0.2823    0.76139 0.000 0.796 0.000 0.000 0.000 NA
#> GSM35443     1  0.4443    0.64939 0.756 0.000 0.136 0.000 0.044 NA
#> GSM35445     1  0.2510    0.73174 0.872 0.000 0.100 0.000 0.000 NA
#> GSM35448     4  0.0000    0.73820 0.000 0.000 0.000 1.000 0.000 NA
#> GSM35451     1  0.1787    0.75986 0.920 0.000 0.008 0.000 0.004 NA
#> GSM35454     1  0.7716    0.00895 0.380 0.000 0.172 0.020 0.140 NA
#> GSM35457     2  0.1398    0.76890 0.000 0.940 0.000 0.000 0.052 NA
#> GSM35465     2  0.2745    0.73147 0.000 0.860 0.008 0.000 0.020 NA
#> GSM35468     1  0.3167    0.71306 0.836 0.000 0.120 0.000 0.012 NA
#> GSM35471     1  0.3896    0.69163 0.780 0.008 0.052 0.000 0.004 NA
#> GSM35473     1  0.2432    0.73357 0.876 0.000 0.100 0.000 0.000 NA
#> GSM35477     1  0.1787    0.75986 0.920 0.000 0.008 0.000 0.004 NA
#> GSM35480     1  0.2331    0.74867 0.888 0.000 0.032 0.000 0.000 NA
#> GSM35482     3  0.2077    0.73589 0.040 0.000 0.920 0.008 0.024 NA
#> GSM35485     2  0.3023    0.75234 0.000 0.768 0.000 0.000 0.000 NA
#> GSM35489     2  0.5982    0.58524 0.016 0.568 0.008 0.000 0.180 NA
#> GSM35492     1  0.3281    0.70882 0.828 0.000 0.124 0.000 0.012 NA
#> GSM35495     4  0.3607    0.30177 0.000 0.000 0.348 0.652 0.000 NA
#> GSM35499     2  0.2476    0.75214 0.000 0.892 0.004 0.004 0.040 NA
#> GSM35502     1  0.0000    0.76771 1.000 0.000 0.000 0.000 0.000 NA
#> GSM35505     1  0.7716    0.00895 0.380 0.000 0.172 0.020 0.140 NA
#> GSM35507     1  0.6276    0.44835 0.548 0.116 0.060 0.000 0.004 NA
#> GSM35510     2  0.2476    0.75214 0.000 0.892 0.004 0.004 0.040 NA
#> GSM35514     1  0.0000    0.76771 1.000 0.000 0.000 0.000 0.000 NA
#> GSM35517     2  0.2823    0.76139 0.000 0.796 0.000 0.000 0.000 NA
#> GSM35520     2  0.6379    0.37136 0.016 0.472 0.008 0.000 0.304 NA
#> GSM35523     1  0.6302    0.40545 0.532 0.056 0.144 0.000 0.000 NA
#> GSM35529     2  0.1398    0.76890 0.000 0.940 0.000 0.000 0.052 NA
#> GSM35531     2  0.5982    0.58524 0.016 0.568 0.008 0.000 0.180 NA
#> GSM35534     2  0.3514    0.74659 0.000 0.752 0.000 0.020 0.000 NA
#> GSM35536     1  0.0260    0.76767 0.992 0.000 0.000 0.000 0.000 NA
#> GSM35538     1  0.0603    0.76700 0.980 0.000 0.004 0.000 0.000 NA
#> GSM35539     1  0.3297    0.70389 0.820 0.000 0.068 0.000 0.000 NA
#> GSM35540     2  0.2476    0.75214 0.000 0.892 0.004 0.004 0.040 NA
#> GSM35541     2  0.2823    0.76139 0.000 0.796 0.000 0.000 0.000 NA
#> GSM35442     1  0.4443    0.64939 0.756 0.000 0.136 0.000 0.044 NA
#> GSM35447     1  0.7716    0.00895 0.380 0.000 0.172 0.020 0.140 NA
#> GSM35450     1  0.1787    0.75986 0.920 0.000 0.008 0.000 0.004 NA
#> GSM35453     1  0.2510    0.73174 0.872 0.000 0.100 0.000 0.000 NA
#> GSM35456     1  0.4309    0.66290 0.744 0.020 0.044 0.000 0.004 NA
#> GSM35464     1  0.6344    0.43696 0.540 0.124 0.060 0.000 0.004 NA
#> GSM35467     1  0.0000    0.76771 1.000 0.000 0.000 0.000 0.000 NA
#> GSM35470     3  0.4905    0.21699 0.344 0.000 0.580 0.000 0.000 NA
#> GSM35479     3  0.1549    0.74268 0.020 0.000 0.936 0.044 0.000 NA
#> GSM35484     1  0.2461    0.75877 0.888 0.000 0.044 0.000 0.004 NA
#> GSM35488     1  0.0603    0.76700 0.980 0.000 0.004 0.000 0.000 NA
#> GSM35491     1  0.3281    0.70882 0.828 0.000 0.124 0.000 0.012 NA
#> GSM35494     3  0.1549    0.74268 0.020 0.000 0.936 0.044 0.000 NA
#> GSM35498     1  0.6344    0.43696 0.540 0.124 0.060 0.000 0.004 NA
#> GSM35501     1  0.0000    0.76771 1.000 0.000 0.000 0.000 0.000 NA
#> GSM35509     3  0.3265    0.48319 0.004 0.000 0.748 0.248 0.000 NA
#> GSM35513     1  0.0000    0.76771 1.000 0.000 0.000 0.000 0.000 NA
#> GSM35516     2  0.4003    0.73354 0.048 0.740 0.004 0.000 0.000 NA
#> GSM35522     1  0.6302    0.40545 0.532 0.056 0.144 0.000 0.000 NA
#> GSM35525     1  0.3297    0.70389 0.820 0.000 0.068 0.000 0.000 NA
#> GSM35528     1  0.0603    0.76700 0.980 0.000 0.004 0.000 0.000 NA
#> GSM35533     1  0.2461    0.75877 0.888 0.000 0.044 0.000 0.004 NA
#> GSM35537     1  0.5432    0.18034 0.480 0.000 0.400 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)

plot of chunk tab-MAD-hclust-consensus-heatmap-1

consensus_heatmap(res, k = 3)

plot of chunk tab-MAD-hclust-consensus-heatmap-2

consensus_heatmap(res, k = 4)

plot of chunk tab-MAD-hclust-consensus-heatmap-3

consensus_heatmap(res, k = 5)

plot of chunk tab-MAD-hclust-consensus-heatmap-4

consensus_heatmap(res, k = 6)

plot of chunk tab-MAD-hclust-consensus-heatmap-5

Heatmaps for the membership of samples in all partitions to see how consistent they are:

membership_heatmap(res, k = 2)

plot of chunk tab-MAD-hclust-membership-heatmap-1

membership_heatmap(res, k = 3)

plot of chunk tab-MAD-hclust-membership-heatmap-2

membership_heatmap(res, k = 4)

plot of chunk tab-MAD-hclust-membership-heatmap-3

membership_heatmap(res, k = 5)

plot of chunk tab-MAD-hclust-membership-heatmap-4

membership_heatmap(res, k = 6)

plot of chunk tab-MAD-hclust-membership-heatmap-5

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)

plot of chunk tab-MAD-hclust-get-signatures-1

get_signatures(res, k = 3)

plot of chunk tab-MAD-hclust-get-signatures-2

get_signatures(res, k = 4)

plot of chunk tab-MAD-hclust-get-signatures-3

get_signatures(res, k = 5)

plot of chunk tab-MAD-hclust-get-signatures-4

get_signatures(res, k = 6)

plot of chunk tab-MAD-hclust-get-signatures-5

Signature heatmaps where rows are not scaled:

get_signatures(res, k = 2, scale_rows = FALSE)

plot of chunk tab-MAD-hclust-get-signatures-no-scale-1

get_signatures(res, k = 3, scale_rows = FALSE)

plot of chunk tab-MAD-hclust-get-signatures-no-scale-2

get_signatures(res, k = 4, scale_rows = FALSE)

plot of chunk tab-MAD-hclust-get-signatures-no-scale-3

get_signatures(res, k = 5, scale_rows = FALSE)

plot of chunk tab-MAD-hclust-get-signatures-no-scale-4

get_signatures(res, k = 6, scale_rows = FALSE)

plot of chunk tab-MAD-hclust-get-signatures-no-scale-5

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk MAD-hclust-signature_compare

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:

  1. which_row: row indices corresponding to the input matrix.
  2. fdr: FDR for the differential test.
  3. mean_x: The mean value in group x.
  4. scaled_mean_x: The mean value in group x after rows are scaled.
  5. 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")

plot of chunk tab-MAD-hclust-dimension-reduction-1

dimension_reduction(res, k = 3, method = "UMAP")

plot of chunk tab-MAD-hclust-dimension-reduction-2

dimension_reduction(res, k = 4, method = "UMAP")

plot of chunk tab-MAD-hclust-dimension-reduction-3

dimension_reduction(res, k = 5, method = "UMAP")

plot of chunk tab-MAD-hclust-dimension-reduction-4

dimension_reduction(res, k = 6, method = "UMAP")

plot of chunk tab-MAD-hclust-dimension-reduction-5

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk MAD-hclust-collect-classes

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  time(p) k
#> MAD:hclust 75 3.82e-07 2
#> MAD:hclust 72 2.14e-09 3
#> MAD:hclust 70 1.24e-07 4
#> MAD:hclust 53 1.32e-05 5
#> MAD:hclust 62 1.01e-06 6

If matrix rows can be associated to genes, consider to use functional_enrichment(res, ...) to perform function enrichment for the signature genes. See this vignette for more detailed explanations.


MAD:kmeans**

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 7758 rows and 79 columns.
#>   Top rows (776, 1552, 2328, 3103, 3879) 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 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)

plot of chunk MAD-kmeans-collect-plots

The plots are:

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:

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)

plot of chunk MAD-kmeans-select-partition-number

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.964       0.968         0.4981 0.498   0.498
#> 3 3 0.954           0.960       0.975         0.3208 0.794   0.607
#> 4 4 0.743           0.700       0.793         0.1111 0.930   0.797
#> 5 5 0.706           0.766       0.821         0.0744 0.884   0.617
#> 6 6 0.730           0.583       0.764         0.0460 0.968   0.851

suggest_best_k() suggests the best \(k\) based on these statistics. The rules are as follows:

suggest_best_k(res)
#> [1] 3
#> attr(,"optional")
#> [1] 2

There is also optional best \(k\) = 2 that is worth to check.

Following shows the table of the partitions (You need to click the show/hide code output link to see it). The membership matrix (columns with name p*) is inferred by clue::cl_consensus() function with the SE method. Basically the value in the membership matrix represents the probability to belong to a certain group. The finall class label for an item is determined with the group with highest probability it belongs to.

In get_classes() function, the entropy is calculated from the membership matrix and the silhouette score is calculated from the consensus matrix.

show/hide code output

cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#>          class entropy silhouette    p1    p2
#> GSM35441     2  0.3431      0.970 0.064 0.936
#> GSM35446     2  0.0376      0.949 0.004 0.996
#> GSM35449     2  0.3431      0.970 0.064 0.936
#> GSM35455     2  0.3431      0.970 0.064 0.936
#> GSM35458     2  0.3431      0.970 0.064 0.936
#> GSM35460     2  0.0376      0.949 0.004 0.996
#> GSM35461     1  0.3431      0.944 0.936 0.064
#> GSM35463     2  0.3431      0.970 0.064 0.936
#> GSM35472     2  0.4690      0.878 0.100 0.900
#> GSM35475     2  0.0938      0.955 0.012 0.988
#> GSM35483     2  0.3114      0.968 0.056 0.944
#> GSM35496     1  0.3431      0.944 0.936 0.064
#> GSM35497     2  0.3431      0.970 0.064 0.936
#> GSM35504     2  0.0376      0.949 0.004 0.996
#> GSM35508     2  0.0672      0.954 0.008 0.992
#> GSM35511     2  0.0376      0.949 0.004 0.996
#> GSM35512     2  0.4690      0.878 0.100 0.900
#> GSM35515     2  0.3274      0.969 0.060 0.940
#> GSM35519     2  0.0376      0.949 0.004 0.996
#> GSM35527     2  0.0938      0.955 0.012 0.988
#> GSM35532     2  0.0376      0.949 0.004 0.996
#> GSM35439     2  0.3431      0.970 0.064 0.936
#> GSM35443     1  0.0376      0.980 0.996 0.004
#> GSM35445     1  0.0376      0.977 0.996 0.004
#> GSM35448     2  0.0376      0.949 0.004 0.996
#> GSM35451     1  0.0376      0.980 0.996 0.004
#> GSM35454     1  0.3431      0.944 0.936 0.064
#> GSM35457     2  0.3431      0.970 0.064 0.936
#> GSM35465     2  0.3431      0.970 0.064 0.936
#> GSM35468     1  0.0376      0.980 0.996 0.004
#> GSM35471     1  0.0376      0.980 0.996 0.004
#> GSM35473     1  0.0000      0.978 1.000 0.000
#> GSM35477     1  0.0376      0.980 0.996 0.004
#> GSM35480     1  0.0000      0.978 1.000 0.000
#> GSM35482     1  0.3431      0.944 0.936 0.064
#> GSM35485     2  0.3431      0.970 0.064 0.936
#> GSM35489     2  0.3431      0.970 0.064 0.936
#> GSM35492     1  0.0376      0.980 0.996 0.004
#> GSM35495     1  0.6247      0.862 0.844 0.156
#> GSM35499     2  0.3431      0.970 0.064 0.936
#> GSM35502     1  0.0376      0.980 0.996 0.004
#> GSM35505     1  0.3431      0.944 0.936 0.064
#> GSM35507     1  0.0376      0.980 0.996 0.004
#> GSM35510     2  0.3431      0.970 0.064 0.936
#> GSM35514     1  0.0376      0.980 0.996 0.004
#> GSM35517     2  0.3431      0.970 0.064 0.936
#> GSM35520     2  0.0000      0.951 0.000 1.000
#> GSM35523     1  0.0376      0.980 0.996 0.004
#> GSM35529     2  0.3431      0.970 0.064 0.936
#> GSM35531     2  0.3431      0.970 0.064 0.936
#> GSM35534     2  0.3431      0.970 0.064 0.936
#> GSM35536     1  0.0376      0.980 0.996 0.004
#> GSM35538     1  0.0376      0.980 0.996 0.004
#> GSM35539     1  0.0376      0.980 0.996 0.004
#> GSM35540     2  0.0376      0.949 0.004 0.996
#> GSM35541     2  0.3431      0.970 0.064 0.936
#> GSM35442     1  0.1633      0.968 0.976 0.024
#> GSM35447     1  0.3431      0.944 0.936 0.064
#> GSM35450     1  0.0376      0.980 0.996 0.004
#> GSM35453     1  0.0938      0.974 0.988 0.012
#> GSM35456     1  0.0376      0.980 0.996 0.004
#> GSM35464     2  0.3431      0.970 0.064 0.936
#> GSM35467     1  0.0376      0.980 0.996 0.004
#> GSM35470     1  0.0938      0.974 0.988 0.012
#> GSM35479     1  0.3431      0.944 0.936 0.064
#> GSM35484     1  0.0376      0.980 0.996 0.004
#> GSM35488     1  0.0376      0.980 0.996 0.004
#> GSM35491     1  0.0376      0.980 0.996 0.004
#> GSM35494     1  0.3431      0.944 0.936 0.064
#> GSM35498     1  0.0376      0.980 0.996 0.004
#> GSM35501     1  0.0376      0.980 0.996 0.004
#> GSM35509     1  0.3431      0.944 0.936 0.064
#> GSM35513     1  0.0376      0.980 0.996 0.004
#> GSM35516     2  0.3431      0.970 0.064 0.936
#> GSM35522     1  0.0376      0.980 0.996 0.004
#> GSM35525     1  0.0376      0.980 0.996 0.004
#> GSM35528     1  0.0376      0.980 0.996 0.004
#> GSM35533     1  0.0376      0.980 0.996 0.004
#> GSM35537     1  0.0672      0.975 0.992 0.008

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>          class entropy silhouette    p1    p2    p3
#> GSM35441     2  0.0237      0.966 0.000 0.996 0.004
#> GSM35446     3  0.1163      0.965 0.000 0.028 0.972
#> GSM35449     2  0.0237      0.966 0.000 0.996 0.004
#> GSM35455     2  0.0237      0.966 0.000 0.996 0.004
#> GSM35458     2  0.4235      0.803 0.000 0.824 0.176
#> GSM35460     3  0.1031      0.968 0.000 0.024 0.976
#> GSM35461     3  0.0592      0.975 0.012 0.000 0.988
#> GSM35463     2  0.0237      0.966 0.000 0.996 0.004
#> GSM35472     3  0.0892      0.970 0.000 0.020 0.980
#> GSM35475     2  0.5016      0.711 0.000 0.760 0.240
#> GSM35483     2  0.0237      0.966 0.000 0.996 0.004
#> GSM35496     3  0.0424      0.976 0.008 0.000 0.992
#> GSM35497     2  0.0237      0.966 0.000 0.996 0.004
#> GSM35504     2  0.0237      0.966 0.000 0.996 0.004
#> GSM35508     2  0.0237      0.966 0.000 0.996 0.004
#> GSM35511     3  0.4178      0.793 0.000 0.172 0.828
#> GSM35512     3  0.0424      0.974 0.000 0.008 0.992
#> GSM35515     2  0.4235      0.803 0.000 0.824 0.176
#> GSM35519     3  0.1163      0.965 0.000 0.028 0.972
#> GSM35527     2  0.0237      0.966 0.000 0.996 0.004
#> GSM35532     3  0.1163      0.965 0.000 0.028 0.972
#> GSM35439     2  0.0237      0.966 0.000 0.996 0.004
#> GSM35443     1  0.0892      0.985 0.980 0.000 0.020
#> GSM35445     1  0.0892      0.985 0.980 0.000 0.020
#> GSM35448     3  0.1163      0.965 0.000 0.028 0.972
#> GSM35451     1  0.0237      0.982 0.996 0.000 0.004
#> GSM35454     3  0.0424      0.976 0.008 0.000 0.992
#> GSM35457     2  0.0237      0.966 0.000 0.996 0.004
#> GSM35465     2  0.0237      0.966 0.000 0.996 0.004
#> GSM35468     1  0.0892      0.985 0.980 0.000 0.020
#> GSM35471     1  0.0592      0.980 0.988 0.000 0.012
#> GSM35473     1  0.0892      0.985 0.980 0.000 0.020
#> GSM35477     1  0.0237      0.982 0.996 0.000 0.004
#> GSM35480     1  0.0892      0.985 0.980 0.000 0.020
#> GSM35482     3  0.0424      0.976 0.008 0.000 0.992
#> GSM35485     2  0.0237      0.966 0.000 0.996 0.004
#> GSM35489     2  0.0237      0.966 0.000 0.996 0.004
#> GSM35492     1  0.0892      0.985 0.980 0.000 0.020
#> GSM35495     3  0.0424      0.976 0.008 0.000 0.992
#> GSM35499     2  0.0237      0.966 0.000 0.996 0.004
#> GSM35502     1  0.0892      0.985 0.980 0.000 0.020
#> GSM35505     3  0.0592      0.975 0.012 0.000 0.988
#> GSM35507     1  0.1525      0.957 0.964 0.032 0.004
#> GSM35510     2  0.0237      0.966 0.000 0.996 0.004
#> GSM35514     1  0.0892      0.985 0.980 0.000 0.020
#> GSM35517     2  0.0237      0.966 0.000 0.996 0.004
#> GSM35520     2  0.4346      0.788 0.000 0.816 0.184
#> GSM35523     1  0.0592      0.980 0.988 0.000 0.012
#> GSM35529     2  0.0237      0.966 0.000 0.996 0.004
#> GSM35531     2  0.0237      0.966 0.000 0.996 0.004
#> GSM35534     2  0.0237      0.966 0.000 0.996 0.004
#> GSM35536     1  0.0892      0.985 0.980 0.000 0.020
#> GSM35538     1  0.0000      0.982 1.000 0.000 0.000
#> GSM35539     1  0.0237      0.982 0.996 0.000 0.004
#> GSM35540     2  0.0237      0.966 0.000 0.996 0.004
#> GSM35541     2  0.0237      0.966 0.000 0.996 0.004
#> GSM35442     1  0.3879      0.846 0.848 0.000 0.152
#> GSM35447     3  0.0592      0.975 0.012 0.000 0.988
#> GSM35450     1  0.0000      0.982 1.000 0.000 0.000
#> GSM35453     1  0.0892      0.985 0.980 0.000 0.020
#> GSM35456     1  0.0237      0.982 0.996 0.000 0.004
#> GSM35464     2  0.1315      0.948 0.020 0.972 0.008
#> GSM35467     1  0.0892      0.985 0.980 0.000 0.020
#> GSM35470     1  0.1163      0.981 0.972 0.000 0.028
#> GSM35479     3  0.0424      0.976 0.008 0.000 0.992
#> GSM35484     1  0.0892      0.985 0.980 0.000 0.020
#> GSM35488     1  0.0237      0.983 0.996 0.000 0.004
#> GSM35491     1  0.0892      0.985 0.980 0.000 0.020
#> GSM35494     3  0.0424      0.976 0.008 0.000 0.992
#> GSM35498     1  0.0592      0.980 0.988 0.000 0.012
#> GSM35501     1  0.0892      0.985 0.980 0.000 0.020
#> GSM35509     3  0.0424      0.976 0.008 0.000 0.992
#> GSM35513     1  0.0892      0.985 0.980 0.000 0.020
#> GSM35516     2  0.0237      0.966 0.000 0.996 0.004
#> GSM35522     1  0.0592      0.980 0.988 0.000 0.012
#> GSM35525     1  0.0000      0.982 1.000 0.000 0.000
#> GSM35528     1  0.0237      0.982 0.996 0.000 0.004
#> GSM35533     1  0.0892      0.985 0.980 0.000 0.020
#> GSM35537     1  0.0592      0.980 0.988 0.000 0.012

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>          class entropy silhouette    p1    p2    p3    p4
#> GSM35441     2  0.0921      0.869 0.000 0.972 0.000 0.028
#> GSM35446     3  0.0592      0.833 0.000 0.000 0.984 0.016
#> GSM35449     2  0.1557      0.864 0.000 0.944 0.000 0.056
#> GSM35455     2  0.1118      0.868 0.000 0.964 0.000 0.036
#> GSM35458     2  0.7581      0.339 0.000 0.424 0.196 0.380
#> GSM35460     3  0.0336      0.834 0.000 0.000 0.992 0.008
#> GSM35461     3  0.3591      0.808 0.008 0.000 0.824 0.168
#> GSM35463     2  0.2149      0.868 0.000 0.912 0.000 0.088
#> GSM35472     3  0.2149      0.816 0.000 0.000 0.912 0.088
#> GSM35475     4  0.7887     -0.355 0.000 0.292 0.332 0.376
#> GSM35483     2  0.2149      0.868 0.000 0.912 0.000 0.088
#> GSM35496     3  0.3569      0.797 0.000 0.000 0.804 0.196
#> GSM35497     2  0.1474      0.865 0.000 0.948 0.000 0.052
#> GSM35504     2  0.0336      0.871 0.000 0.992 0.000 0.008
#> GSM35508     2  0.3688      0.773 0.000 0.792 0.000 0.208
#> GSM35511     3  0.6058      0.617 0.000 0.068 0.624 0.308
#> GSM35512     3  0.2760      0.800 0.000 0.000 0.872 0.128
#> GSM35515     2  0.7581      0.339 0.000 0.424 0.196 0.380
#> GSM35519     3  0.4483      0.703 0.000 0.004 0.712 0.284
#> GSM35527     2  0.3219      0.806 0.000 0.836 0.000 0.164
#> GSM35532     3  0.4483      0.703 0.000 0.004 0.712 0.284
#> GSM35439     2  0.2149      0.868 0.000 0.912 0.000 0.088
#> GSM35443     1  0.0592      0.793 0.984 0.000 0.000 0.016
#> GSM35445     1  0.0000      0.810 1.000 0.000 0.000 0.000
#> GSM35448     3  0.0927      0.832 0.000 0.008 0.976 0.016
#> GSM35451     1  0.4624      0.220 0.660 0.000 0.000 0.340
#> GSM35454     3  0.3528      0.792 0.000 0.000 0.808 0.192
#> GSM35457     2  0.0817      0.869 0.000 0.976 0.000 0.024
#> GSM35465     2  0.1211      0.866 0.000 0.960 0.000 0.040
#> GSM35468     1  0.0000      0.810 1.000 0.000 0.000 0.000
#> GSM35471     4  0.5509      0.657 0.424 0.004 0.012 0.560
#> GSM35473     1  0.0000      0.810 1.000 0.000 0.000 0.000
#> GSM35477     1  0.4624      0.220 0.660 0.000 0.000 0.340
#> GSM35480     1  0.2216      0.711 0.908 0.000 0.000 0.092
#> GSM35482     3  0.4072      0.757 0.000 0.000 0.748 0.252
#> GSM35485     2  0.2081      0.868 0.000 0.916 0.000 0.084
#> GSM35489     2  0.2011      0.869 0.000 0.920 0.000 0.080
#> GSM35492     1  0.0000      0.810 1.000 0.000 0.000 0.000
#> GSM35495     3  0.2973      0.810 0.000 0.000 0.856 0.144
#> GSM35499     2  0.0921      0.870 0.000 0.972 0.000 0.028
#> GSM35502     1  0.0000      0.810 1.000 0.000 0.000 0.000
#> GSM35505     3  0.0817      0.834 0.000 0.000 0.976 0.024
#> GSM35507     4  0.6857      0.534 0.404 0.104 0.000 0.492
#> GSM35510     2  0.0000      0.871 0.000 1.000 0.000 0.000
#> GSM35514     1  0.0000      0.810 1.000 0.000 0.000 0.000
#> GSM35517     2  0.1867      0.871 0.000 0.928 0.000 0.072
#> GSM35520     2  0.7896      0.134 0.000 0.360 0.292 0.348
#> GSM35523     4  0.5500      0.663 0.420 0.004 0.012 0.564
#> GSM35529     2  0.0921      0.869 0.000 0.972 0.000 0.028
#> GSM35531     2  0.3796      0.835 0.000 0.848 0.056 0.096
#> GSM35534     2  0.2149      0.868 0.000 0.912 0.000 0.088
#> GSM35536     1  0.0000      0.810 1.000 0.000 0.000 0.000
#> GSM35538     1  0.4431      0.322 0.696 0.000 0.000 0.304
#> GSM35539     1  0.4564      0.258 0.672 0.000 0.000 0.328
#> GSM35540     2  0.1211      0.866 0.000 0.960 0.000 0.040
#> GSM35541     2  0.2011      0.870 0.000 0.920 0.000 0.080
#> GSM35442     1  0.2996      0.677 0.892 0.000 0.044 0.064
#> GSM35447     3  0.0000      0.834 0.000 0.000 1.000 0.000
#> GSM35450     1  0.4543      0.271 0.676 0.000 0.000 0.324
#> GSM35453     1  0.1545      0.757 0.952 0.000 0.008 0.040
#> GSM35456     1  0.5155     -0.391 0.528 0.004 0.000 0.468
#> GSM35464     2  0.4776      0.409 0.000 0.624 0.000 0.376
#> GSM35467     1  0.0000      0.810 1.000 0.000 0.000 0.000
#> GSM35470     4  0.5571      0.629 0.396 0.000 0.024 0.580
#> GSM35479     3  0.4072      0.757 0.000 0.000 0.748 0.252
#> GSM35484     1  0.0000      0.810 1.000 0.000 0.000 0.000
#> GSM35488     1  0.0000      0.810 1.000 0.000 0.000 0.000
#> GSM35491     1  0.0000      0.810 1.000 0.000 0.000 0.000
#> GSM35494     3  0.4072      0.757 0.000 0.000 0.748 0.252
#> GSM35498     4  0.5500      0.663 0.420 0.004 0.012 0.564
#> GSM35501     1  0.0000      0.810 1.000 0.000 0.000 0.000
#> GSM35509     3  0.4040      0.759 0.000 0.000 0.752 0.248
#> GSM35513     1  0.0000      0.810 1.000 0.000 0.000 0.000
#> GSM35516     2  0.2081      0.869 0.000 0.916 0.000 0.084
#> GSM35522     4  0.5500      0.663 0.420 0.004 0.012 0.564
#> GSM35525     1  0.1716      0.756 0.936 0.000 0.000 0.064
#> GSM35528     1  0.4564      0.258 0.672 0.000 0.000 0.328
#> GSM35533     1  0.0000      0.810 1.000 0.000 0.000 0.000
#> GSM35537     4  0.5300      0.641 0.408 0.000 0.012 0.580

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>          class entropy silhouette    p1    p2    p3    p4    p5
#> GSM35441     2  0.1943      0.786 0.000 0.924 0.000 0.020 0.056
#> GSM35446     3  0.3958      0.711 0.000 0.000 0.776 0.040 0.184
#> GSM35449     2  0.2850      0.759 0.000 0.872 0.000 0.036 0.092
#> GSM35455     2  0.2359      0.778 0.000 0.904 0.000 0.036 0.060
#> GSM35458     5  0.2856      0.750 0.000 0.104 0.008 0.016 0.872
#> GSM35460     3  0.3810      0.723 0.000 0.000 0.792 0.040 0.168
#> GSM35461     3  0.5087      0.195 0.016 0.000 0.516 0.012 0.456
#> GSM35463     2  0.5159      0.745 0.000 0.704 0.004 0.156 0.136
#> GSM35472     3  0.4505      0.459 0.000 0.000 0.604 0.012 0.384
#> GSM35475     5  0.2221      0.771 0.000 0.052 0.036 0.000 0.912
#> GSM35483     2  0.5196      0.743 0.000 0.700 0.004 0.160 0.136
#> GSM35496     3  0.2592      0.756 0.000 0.000 0.892 0.056 0.052
#> GSM35497     2  0.2850      0.759 0.000 0.872 0.000 0.036 0.092
#> GSM35504     2  0.2830      0.774 0.000 0.884 0.016 0.080 0.020
#> GSM35508     2  0.5063      0.425 0.000 0.632 0.000 0.056 0.312
#> GSM35511     5  0.3594      0.687 0.000 0.020 0.172 0.004 0.804
#> GSM35512     3  0.4659      0.162 0.000 0.000 0.496 0.012 0.492
#> GSM35515     5  0.2856      0.750 0.000 0.104 0.008 0.016 0.872
#> GSM35519     5  0.3835      0.590 0.000 0.000 0.244 0.012 0.744
#> GSM35527     2  0.4885      0.501 0.000 0.668 0.000 0.056 0.276
#> GSM35532     5  0.3550      0.608 0.000 0.000 0.236 0.004 0.760
#> GSM35439     2  0.4364      0.771 0.000 0.768 0.000 0.112 0.120
#> GSM35443     1  0.2351      0.918 0.916 0.000 0.028 0.020 0.036
#> GSM35445     1  0.1569      0.931 0.944 0.000 0.044 0.008 0.004
#> GSM35448     3  0.5196      0.667 0.000 0.016 0.712 0.092 0.180
#> GSM35451     4  0.4235      0.794 0.336 0.000 0.000 0.656 0.008
#> GSM35454     3  0.1471      0.760 0.004 0.000 0.952 0.024 0.020
#> GSM35457     2  0.1872      0.787 0.000 0.928 0.000 0.020 0.052
#> GSM35465     2  0.2291      0.784 0.000 0.908 0.000 0.036 0.056
#> GSM35468     1  0.1267      0.936 0.960 0.000 0.004 0.012 0.024
#> GSM35471     4  0.4337      0.829 0.196 0.000 0.056 0.748 0.000
#> GSM35473     1  0.1041      0.935 0.964 0.000 0.032 0.000 0.004
#> GSM35477     4  0.4235      0.794 0.336 0.000 0.000 0.656 0.008
#> GSM35480     1  0.2694      0.862 0.892 0.000 0.032 0.068 0.008
#> GSM35482     3  0.2573      0.734 0.000 0.000 0.880 0.104 0.016
#> GSM35485     2  0.4877      0.758 0.000 0.732 0.004 0.136 0.128
#> GSM35489     2  0.4210      0.776 0.000 0.780 0.000 0.096 0.124
#> GSM35492     1  0.1612      0.934 0.948 0.000 0.012 0.016 0.024
#> GSM35495     3  0.1907      0.764 0.000 0.000 0.928 0.044 0.028
#> GSM35499     2  0.1408      0.795 0.000 0.948 0.000 0.044 0.008
#> GSM35502     1  0.0324      0.940 0.992 0.000 0.000 0.004 0.004
#> GSM35505     3  0.2597      0.746 0.004 0.000 0.872 0.004 0.120
#> GSM35507     4  0.5253      0.778 0.140 0.100 0.024 0.732 0.004
#> GSM35510     2  0.0566      0.796 0.000 0.984 0.000 0.012 0.004
#> GSM35514     1  0.0324      0.940 0.992 0.000 0.000 0.004 0.004
#> GSM35517     2  0.4111      0.777 0.000 0.788 0.000 0.092 0.120
#> GSM35520     5  0.3310      0.736 0.000 0.136 0.024 0.004 0.836
#> GSM35523     4  0.4845      0.822 0.188 0.000 0.076 0.728 0.008
#> GSM35529     2  0.1965      0.786 0.000 0.924 0.000 0.024 0.052
#> GSM35531     2  0.5076      0.710 0.000 0.692 0.000 0.108 0.200
#> GSM35534     2  0.5159      0.745 0.000 0.704 0.004 0.156 0.136
#> GSM35536     1  0.0404      0.938 0.988 0.000 0.000 0.012 0.000
#> GSM35538     4  0.4331      0.716 0.400 0.000 0.000 0.596 0.004
#> GSM35539     4  0.4252      0.792 0.340 0.000 0.000 0.652 0.008
#> GSM35540     2  0.2209      0.786 0.000 0.912 0.000 0.032 0.056
#> GSM35541     2  0.4361      0.773 0.000 0.768 0.000 0.108 0.124
#> GSM35442     1  0.3904      0.815 0.820 0.000 0.116 0.020 0.044
#> GSM35447     3  0.2964      0.734 0.004 0.000 0.840 0.004 0.152
#> GSM35450     4  0.4211      0.773 0.360 0.000 0.000 0.636 0.004
#> GSM35453     1  0.2233      0.868 0.892 0.000 0.104 0.000 0.004
#> GSM35456     4  0.4243      0.826 0.244 0.004 0.016 0.732 0.004
#> GSM35464     4  0.4108      0.453 0.000 0.308 0.000 0.684 0.008
#> GSM35467     1  0.0324      0.940 0.992 0.000 0.000 0.004 0.004
#> GSM35470     4  0.5963      0.732 0.152 0.000 0.196 0.636 0.016
#> GSM35479     3  0.2573      0.738 0.000 0.000 0.880 0.104 0.016
#> GSM35484     1  0.1280      0.939 0.960 0.000 0.024 0.008 0.008
#> GSM35488     1  0.0912      0.936 0.972 0.000 0.000 0.016 0.012
#> GSM35491     1  0.1507      0.935 0.952 0.000 0.012 0.012 0.024
#> GSM35494     3  0.2305      0.738 0.000 0.000 0.896 0.092 0.012
#> GSM35498     4  0.4359      0.828 0.188 0.000 0.052 0.756 0.004
#> GSM35501     1  0.0324      0.940 0.992 0.000 0.000 0.004 0.004
#> GSM35509     3  0.2124      0.747 0.000 0.000 0.900 0.096 0.004
#> GSM35513     1  0.0324      0.940 0.992 0.000 0.000 0.004 0.004
#> GSM35516     2  0.4361      0.774 0.000 0.768 0.000 0.108 0.124
#> GSM35522     4  0.4965      0.821 0.184 0.004 0.076 0.728 0.008
#> GSM35525     1  0.2416      0.817 0.888 0.000 0.000 0.100 0.012
#> GSM35528     4  0.4283      0.786 0.348 0.000 0.000 0.644 0.008
#> GSM35533     1  0.1280      0.939 0.960 0.000 0.024 0.008 0.008
#> GSM35537     4  0.5680      0.776 0.176 0.000 0.160 0.656 0.008

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>          class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM35441     2  0.0405     0.5077 0.000 0.988 0.000 0.000 0.004 0.008
#> GSM35446     3  0.5319     0.6065 0.000 0.000 0.616 0.008 0.236 0.140
#> GSM35449     2  0.2388     0.4936 0.000 0.904 0.004 0.016 0.036 0.040
#> GSM35455     2  0.2076     0.4987 0.000 0.920 0.004 0.016 0.020 0.040
#> GSM35458     5  0.4489     0.6774 0.008 0.104 0.000 0.000 0.724 0.164
#> GSM35460     3  0.5161     0.6253 0.000 0.000 0.640 0.008 0.220 0.132
#> GSM35461     5  0.5330     0.3525 0.012 0.000 0.320 0.000 0.576 0.092
#> GSM35463     6  0.3955     0.9504 0.000 0.436 0.000 0.004 0.000 0.560
#> GSM35472     3  0.4264     0.1340 0.000 0.000 0.496 0.000 0.488 0.016
#> GSM35475     5  0.2507     0.7464 0.000 0.040 0.004 0.000 0.884 0.072
#> GSM35483     6  0.4056     0.9653 0.000 0.416 0.000 0.004 0.004 0.576
#> GSM35496     3  0.3155     0.6907 0.008 0.000 0.864 0.056 0.040 0.032
#> GSM35497     2  0.2388     0.4936 0.000 0.904 0.004 0.016 0.036 0.040
#> GSM35504     2  0.4070     0.0718 0.000 0.672 0.008 0.008 0.004 0.308
#> GSM35508     2  0.5101     0.3094 0.000 0.668 0.004 0.024 0.228 0.076
#> GSM35511     5  0.2558     0.7381 0.000 0.036 0.040 0.004 0.896 0.024
#> GSM35512     5  0.4026     0.2923 0.000 0.000 0.348 0.000 0.636 0.016
#> GSM35515     5  0.4489     0.6774 0.008 0.104 0.000 0.000 0.724 0.164
#> GSM35519     5  0.2212     0.7043 0.000 0.000 0.112 0.000 0.880 0.008
#> GSM35527     2  0.4577     0.3743 0.000 0.740 0.004 0.024 0.156 0.076
#> GSM35532     5  0.1714     0.7186 0.000 0.000 0.092 0.000 0.908 0.000
#> GSM35439     2  0.4262    -0.5237 0.000 0.560 0.000 0.004 0.012 0.424
#> GSM35443     1  0.3454     0.8742 0.836 0.000 0.016 0.012 0.036 0.100
#> GSM35445     1  0.3091     0.8742 0.856 0.000 0.044 0.012 0.004 0.084
#> GSM35448     3  0.6035     0.5178 0.000 0.000 0.504 0.012 0.212 0.272
#> GSM35451     4  0.3139     0.8239 0.152 0.000 0.000 0.816 0.000 0.032
#> GSM35454     3  0.3983     0.6911 0.012 0.000 0.796 0.012 0.064 0.116
#> GSM35457     2  0.0291     0.5045 0.000 0.992 0.000 0.004 0.000 0.004
#> GSM35465     2  0.1672     0.4907 0.000 0.932 0.000 0.048 0.004 0.016
#> GSM35468     1  0.2545     0.8901 0.888 0.000 0.000 0.020 0.024 0.068
#> GSM35471     4  0.1718     0.8269 0.044 0.000 0.016 0.932 0.000 0.008
#> GSM35473     1  0.1969     0.8955 0.920 0.000 0.020 0.004 0.004 0.052
#> GSM35477     4  0.3139     0.8239 0.152 0.000 0.000 0.816 0.000 0.032
#> GSM35480     1  0.3676     0.8446 0.828 0.000 0.040 0.068 0.004 0.060
#> GSM35482     3  0.2933     0.6790 0.008 0.000 0.860 0.096 0.004 0.032
#> GSM35485     2  0.4226    -0.7294 0.000 0.504 0.000 0.004 0.008 0.484
#> GSM35489     2  0.4364    -0.5153 0.000 0.556 0.000 0.008 0.012 0.424
#> GSM35492     1  0.2422     0.8899 0.892 0.000 0.000 0.012 0.024 0.072
#> GSM35495     3  0.3787     0.7056 0.000 0.000 0.804 0.020 0.072 0.104
#> GSM35499     2  0.3660     0.2672 0.000 0.772 0.000 0.036 0.004 0.188
#> GSM35502     1  0.0622     0.9058 0.980 0.000 0.000 0.012 0.008 0.000
#> GSM35505     3  0.5126     0.6362 0.012 0.000 0.668 0.004 0.196 0.120
#> GSM35507     4  0.2919     0.8075 0.032 0.056 0.008 0.880 0.004 0.020
#> GSM35510     2  0.2234     0.3801 0.000 0.872 0.000 0.004 0.000 0.124
#> GSM35514     1  0.0622     0.9058 0.980 0.000 0.000 0.012 0.008 0.000
#> GSM35517     2  0.4041    -0.4778 0.000 0.584 0.000 0.004 0.004 0.408
#> GSM35520     5  0.3421     0.7174 0.000 0.044 0.016 0.000 0.824 0.116
#> GSM35523     4  0.3018     0.8144 0.040 0.000 0.032 0.876 0.016 0.036
#> GSM35529     2  0.0000     0.5066 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM35531     2  0.5022    -0.6186 0.000 0.496 0.000 0.004 0.060 0.440
#> GSM35534     6  0.3930     0.9675 0.000 0.420 0.000 0.000 0.004 0.576
#> GSM35536     1  0.1148     0.9034 0.960 0.000 0.000 0.020 0.004 0.016
#> GSM35538     4  0.4022     0.7100 0.272 0.000 0.000 0.700 0.008 0.020
#> GSM35539     4  0.3651     0.8208 0.160 0.000 0.000 0.792 0.016 0.032
#> GSM35540     2  0.1245     0.5022 0.000 0.952 0.000 0.032 0.000 0.016
#> GSM35541     2  0.3930    -0.5060 0.000 0.576 0.000 0.000 0.004 0.420
#> GSM35442     1  0.5503     0.7585 0.692 0.000 0.116 0.024 0.040 0.128
#> GSM35447     3  0.5173     0.6185 0.008 0.000 0.648 0.004 0.224 0.116
#> GSM35450     4  0.3550     0.7998 0.188 0.000 0.000 0.780 0.008 0.024
#> GSM35453     1  0.3275     0.8588 0.848 0.000 0.068 0.016 0.004 0.064
#> GSM35456     4  0.2729     0.8321 0.080 0.000 0.008 0.876 0.004 0.032
#> GSM35464     4  0.3129     0.7278 0.000 0.152 0.000 0.820 0.004 0.024
#> GSM35467     1  0.0622     0.9058 0.980 0.000 0.000 0.012 0.008 0.000
#> GSM35470     4  0.5989     0.4221 0.032 0.000 0.324 0.548 0.016 0.080
#> GSM35479     3  0.3292     0.6739 0.008 0.000 0.840 0.088 0.004 0.060
#> GSM35484     1  0.2849     0.8942 0.872 0.000 0.016 0.020 0.008 0.084
#> GSM35488     1  0.2449     0.8928 0.896 0.000 0.000 0.024 0.024 0.056
#> GSM35491     1  0.2422     0.8899 0.892 0.000 0.000 0.012 0.024 0.072
#> GSM35494     3  0.2763     0.6849 0.008 0.000 0.868 0.088 0.000 0.036
#> GSM35498     4  0.1988     0.8233 0.040 0.000 0.016 0.924 0.004 0.016
#> GSM35501     1  0.0622     0.9058 0.980 0.000 0.000 0.012 0.008 0.000
#> GSM35509     3  0.2645     0.7023 0.000 0.000 0.880 0.056 0.008 0.056
#> GSM35513     1  0.0622     0.9058 0.980 0.000 0.000 0.012 0.008 0.000
#> GSM35516     2  0.4887    -0.4936 0.000 0.536 0.000 0.044 0.008 0.412
#> GSM35522     4  0.3018     0.8144 0.040 0.000 0.032 0.876 0.016 0.036
#> GSM35525     1  0.3422     0.8038 0.832 0.000 0.008 0.112 0.016 0.032
#> GSM35528     4  0.3735     0.8111 0.172 0.000 0.000 0.780 0.012 0.036
#> GSM35533     1  0.2952     0.8924 0.864 0.000 0.016 0.020 0.008 0.092
#> GSM35537     4  0.5573     0.5177 0.024 0.000 0.284 0.608 0.016 0.068

Heatmaps for the consensus matrix. It visualizes the probability of two samples to be in a same group.

consensus_heatmap(res, k = 2)

plot of chunk tab-MAD-kmeans-consensus-heatmap-1

consensus_heatmap(res, k = 3)

plot of chunk tab-MAD-kmeans-consensus-heatmap-2

consensus_heatmap(res, k = 4)

plot of chunk tab-MAD-kmeans-consensus-heatmap-3

consensus_heatmap(res, k = 5)

plot of chunk tab-MAD-kmeans-consensus-heatmap-4

consensus_heatmap(res, k = 6)

plot of chunk tab-MAD-kmeans-consensus-heatmap-5

Heatmaps for the membership of samples in all partitions to see how consistent they are:

membership_heatmap(res, k = 2)

plot of chunk tab-MAD-kmeans-membership-heatmap-1

membership_heatmap(res, k = 3)

plot of chunk tab-MAD-kmeans-membership-heatmap-2

membership_heatmap(res, k = 4)

plot of chunk tab-MAD-kmeans-membership-heatmap-3

membership_heatmap(res, k = 5)

plot of chunk tab-MAD-kmeans-membership-heatmap-4

membership_heatmap(res, k = 6)

plot of chunk tab-MAD-kmeans-membership-heatmap-5

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)

plot of chunk tab-MAD-kmeans-get-signatures-1

get_signatures(res, k = 3)

plot of chunk tab-MAD-kmeans-get-signatures-2

get_signatures(res, k = 4)

plot of chunk tab-MAD-kmeans-get-signatures-3

get_signatures(res, k = 5)

plot of chunk tab-MAD-kmeans-get-signatures-4

get_signatures(res, k = 6)

plot of chunk tab-MAD-kmeans-get-signatures-5

Signature heatmaps where rows are not scaled:

get_signatures(res, k = 2, scale_rows = FALSE)

plot of chunk tab-MAD-kmeans-get-signatures-no-scale-1

get_signatures(res, k = 3, scale_rows = FALSE)

plot of chunk tab-MAD-kmeans-get-signatures-no-scale-2

get_signatures(res, k = 4, scale_rows = FALSE)

plot of chunk tab-MAD-kmeans-get-signatures-no-scale-3

get_signatures(res, k = 5, scale_rows = FALSE)

plot of chunk tab-MAD-kmeans-get-signatures-no-scale-4

get_signatures(res, k = 6, scale_rows = FALSE)

plot of chunk tab-MAD-kmeans-get-signatures-no-scale-5

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk MAD-kmeans-signature_compare

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:

  1. which_row: row indices corresponding to the input matrix.
  2. fdr: FDR for the differential test.
  3. mean_x: The mean value in group x.
  4. scaled_mean_x: The mean value in group x after rows are scaled.
  5. 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")

plot of chunk tab-MAD-kmeans-dimension-reduction-1

dimension_reduction(res, k = 3, method = "UMAP")

plot of chunk tab-MAD-kmeans-dimension-reduction-2

dimension_reduction(res, k = 4, method = "UMAP")

plot of chunk tab-MAD-kmeans-dimension-reduction-3

dimension_reduction(res, k = 5, method = "UMAP")

plot of chunk tab-MAD-kmeans-dimension-reduction-4

dimension_reduction(res, k = 6, method = "UMAP")

plot of chunk tab-MAD-kmeans-dimension-reduction-5

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk MAD-kmeans-collect-classes

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  time(p) k
#> MAD:kmeans 79 3.41e-07 2
#> MAD:kmeans 79 1.69e-05 3
#> MAD:kmeans 67 3.93e-04 4
#> MAD:kmeans 74 1.92e-05 5
#> MAD:kmeans 59 1.43e-04 6

If matrix rows can be associated to genes, consider to use functional_enrichment(res, ...) to perform function enrichment for the signature genes. See this vignette for more detailed explanations.


MAD:skmeans**

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 7758 rows and 79 columns.
#>   Top rows (776, 1552, 2328, 3103, 3879) are extracted by 'MAD' method.
#>   Subgroups are detected by 'skmeans' method.
#>   Performed in total 1250 partitions by row resampling.
#>   Best k for subgroups seems to be 3.
#> 
#> Following methods can be applied to this 'ConsensusPartition' object:
#>  [1] "cola_report"             "collect_classes"         "collect_plots"          
#>  [4] "collect_stats"           "colnames"                "compare_signatures"     
#>  [7] "consensus_heatmap"       "dimension_reduction"     "functional_enrichment"  
#> [10] "get_anno_col"            "get_anno"                "get_classes"            
#> [13] "get_consensus"           "get_matrix"              "get_membership"         
#> [16] "get_param"               "get_signatures"          "get_stats"              
#> [19] "is_best_k"               "is_stable_k"             "membership_heatmap"     
#> [22] "ncol"                    "nrow"                    "plot_ecdf"              
#> [25] "rownames"                "select_partition_number" "show"                   
#> [28] "suggest_best_k"          "test_to_known_factors"

collect_plots() function collects all the plots made from res for all k (number of partitions) into one single page to provide an easy and fast comparison between different k.

collect_plots(res)

plot of chunk MAD-skmeans-collect-plots

The plots are:

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:

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)

plot of chunk MAD-skmeans-select-partition-number

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.986       0.994         0.5043 0.496   0.496
#> 3 3 1.000           0.954       0.982         0.3086 0.776   0.578
#> 4 4 0.892           0.923       0.954         0.1291 0.894   0.698
#> 5 5 0.822           0.836       0.903         0.0619 0.943   0.779
#> 6 6 0.765           0.724       0.805         0.0405 0.985   0.929

suggest_best_k() suggests the best \(k\) based on these statistics. The rules are as follows:

suggest_best_k(res)
#> [1] 3
#> attr(,"optional")
#> [1] 2

There is also optional best \(k\) = 2 that is worth to check.

Following shows the table of the partitions (You need to click the show/hide code output link to see it). The membership matrix (columns with name p*) is inferred by clue::cl_consensus() function with the SE method. Basically the value in the membership matrix represents the probability to belong to a certain group. The finall class label for an item is determined with the group with highest probability it belongs to.

In get_classes() function, the entropy is calculated from the membership matrix and the silhouette score is calculated from the consensus matrix.

show/hide code output

cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#>          class entropy silhouette    p1    p2
#> GSM35441     2  0.0000      0.990 0.000 1.000
#> GSM35446     2  0.0000      0.990 0.000 1.000
#> GSM35449     2  0.0000      0.990 0.000 1.000
#> GSM35455     2  0.0000      0.990 0.000 1.000
#> GSM35458     2  0.0000      0.990 0.000 1.000
#> GSM35460     2  0.0000      0.990 0.000 1.000
#> GSM35461     1  0.0000      0.997 1.000 0.000
#> GSM35463     2  0.0000      0.990 0.000 1.000
#> GSM35472     2  0.0000      0.990 0.000 1.000
#> GSM35475     2  0.0000      0.990 0.000 1.000
#> GSM35483     2  0.0000      0.990 0.000 1.000
#> GSM35496     1  0.0000      0.997 1.000 0.000
#> GSM35497     2  0.0000      0.990 0.000 1.000
#> GSM35504     2  0.0000      0.990 0.000 1.000
#> GSM35508     2  0.0000      0.990 0.000 1.000
#> GSM35511     2  0.0000      0.990 0.000 1.000
#> GSM35512     2  0.0000      0.990 0.000 1.000
#> GSM35515     2  0.0000      0.990 0.000 1.000
#> GSM35519     2  0.0000      0.990 0.000 1.000
#> GSM35527     2  0.0000      0.990 0.000 1.000
#> GSM35532     2  0.0000      0.990 0.000 1.000
#> GSM35439     2  0.0000      0.990 0.000 1.000
#> GSM35443     1  0.0000      0.997 1.000 0.000
#> GSM35445     1  0.0000      0.997 1.000 0.000
#> GSM35448     2  0.0000      0.990 0.000 1.000
#> GSM35451     1  0.0000      0.997 1.000 0.000
#> GSM35454     1  0.0000      0.997 1.000 0.000
#> GSM35457     2  0.0000      0.990 0.000 1.000
#> GSM35465     2  0.0000      0.990 0.000 1.000
#> GSM35468     1  0.0000      0.997 1.000 0.000
#> GSM35471     1  0.0000      0.997 1.000 0.000
#> GSM35473     1  0.0000      0.997 1.000 0.000
#> GSM35477     1  0.0000      0.997 1.000 0.000
#> GSM35480     1  0.0000      0.997 1.000 0.000
#> GSM35482     1  0.0000      0.997 1.000 0.000
#> GSM35485     2  0.0000      0.990 0.000 1.000
#> GSM35489     2  0.0000      0.990 0.000 1.000
#> GSM35492     1  0.0000      0.997 1.000 0.000
#> GSM35495     2  0.9358      0.453 0.352 0.648
#> GSM35499     2  0.0000      0.990 0.000 1.000
#> GSM35502     1  0.0000      0.997 1.000 0.000
#> GSM35505     1  0.0000      0.997 1.000 0.000
#> GSM35507     1  0.0376      0.994 0.996 0.004
#> GSM35510     2  0.0000      0.990 0.000 1.000
#> GSM35514     1  0.0000      0.997 1.000 0.000
#> GSM35517     2  0.0000      0.990 0.000 1.000
#> GSM35520     2  0.0000      0.990 0.000 1.000
#> GSM35523     1  0.0000      0.997 1.000 0.000
#> GSM35529     2  0.0000      0.990 0.000 1.000
#> GSM35531     2  0.0000      0.990 0.000 1.000
#> GSM35534     2  0.0000      0.990 0.000 1.000
#> GSM35536     1  0.0000      0.997 1.000 0.000
#> GSM35538     1  0.0000      0.997 1.000 0.000
#> GSM35539     1  0.0000      0.997 1.000 0.000
#> GSM35540     2  0.0000      0.990 0.000 1.000
#> GSM35541     2  0.0000      0.990 0.000 1.000
#> GSM35442     1  0.0000      0.997 1.000 0.000
#> GSM35447     1  0.4298      0.902 0.912 0.088
#> GSM35450     1  0.0000      0.997 1.000 0.000
#> GSM35453     1  0.0000      0.997 1.000 0.000
#> GSM35456     1  0.0000      0.997 1.000 0.000
#> GSM35464     2  0.0000      0.990 0.000 1.000
#> GSM35467     1  0.0000      0.997 1.000 0.000
#> GSM35470     1  0.0000      0.997 1.000 0.000
#> GSM35479     1  0.0000      0.997 1.000 0.000
#> GSM35484     1  0.0000      0.997 1.000 0.000
#> GSM35488     1  0.0000      0.997 1.000 0.000
#> GSM35491     1  0.0000      0.997 1.000 0.000
#> GSM35494     1  0.0000      0.997 1.000 0.000
#> GSM35498     1  0.0000      0.997 1.000 0.000
#> GSM35501     1  0.0000      0.997 1.000 0.000
#> GSM35509     1  0.1184      0.982 0.984 0.016
#> GSM35513     1  0.0000      0.997 1.000 0.000
#> GSM35516     2  0.0000      0.990 0.000 1.000
#> GSM35522     1  0.0000      0.997 1.000 0.000
#> GSM35525     1  0.0000      0.997 1.000 0.000
#> GSM35528     1  0.0000      0.997 1.000 0.000
#> GSM35533     1  0.0000      0.997 1.000 0.000
#> GSM35537     1  0.0000      0.997 1.000 0.000

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>          class entropy silhouette    p1    p2    p3
#> GSM35441     2  0.0000      0.964 0.000 1.000 0.000
#> GSM35446     3  0.0000      0.992 0.000 0.000 1.000
#> GSM35449     2  0.0000      0.964 0.000 1.000 0.000
#> GSM35455     2  0.0000      0.964 0.000 1.000 0.000
#> GSM35458     2  0.0237      0.960 0.000 0.996 0.004
#> GSM35460     3  0.0000      0.992 0.000 0.000 1.000
#> GSM35461     3  0.0000      0.992 0.000 0.000 1.000
#> GSM35463     2  0.0000      0.964 0.000 1.000 0.000
#> GSM35472     3  0.0000      0.992 0.000 0.000 1.000
#> GSM35475     2  0.6215      0.244 0.000 0.572 0.428
#> GSM35483     2  0.0000      0.964 0.000 1.000 0.000
#> GSM35496     3  0.0000      0.992 0.000 0.000 1.000
#> GSM35497     2  0.0000      0.964 0.000 1.000 0.000
#> GSM35504     2  0.0000      0.964 0.000 1.000 0.000
#> GSM35508     2  0.0000      0.964 0.000 1.000 0.000
#> GSM35511     3  0.3551      0.841 0.000 0.132 0.868
#> GSM35512     3  0.0000      0.992 0.000 0.000 1.000
#> GSM35515     2  0.0237      0.960 0.000 0.996 0.004
#> GSM35519     3  0.0000      0.992 0.000 0.000 1.000
#> GSM35527     2  0.0000      0.964 0.000 1.000 0.000
#> GSM35532     3  0.0000      0.992 0.000 0.000 1.000
#> GSM35439     2  0.0000      0.964 0.000 1.000 0.000
#> GSM35443     1  0.0000      0.989 1.000 0.000 0.000
#> GSM35445     1  0.0000      0.989 1.000 0.000 0.000
#> GSM35448     3  0.0000      0.992 0.000 0.000 1.000
#> GSM35451     1  0.0000      0.989 1.000 0.000 0.000
#> GSM35454     3  0.0000      0.992 0.000 0.000 1.000
#> GSM35457     2  0.0000      0.964 0.000 1.000 0.000
#> GSM35465     2  0.0000      0.964 0.000 1.000 0.000
#> GSM35468     1  0.0000      0.989 1.000 0.000 0.000
#> GSM35471     1  0.0000      0.989 1.000 0.000 0.000
#> GSM35473     1  0.0000      0.989 1.000 0.000 0.000
#> GSM35477     1  0.0000      0.989 1.000 0.000 0.000
#> GSM35480     1  0.0000      0.989 1.000 0.000 0.000
#> GSM35482     3  0.0000      0.992 0.000 0.000 1.000
#> GSM35485     2  0.0000      0.964 0.000 1.000 0.000
#> GSM35489     2  0.0000      0.964 0.000 1.000 0.000
#> GSM35492     1  0.0000      0.989 1.000 0.000 0.000
#> GSM35495     3  0.0000      0.992 0.000 0.000 1.000
#> GSM35499     2  0.0000      0.964 0.000 1.000 0.000
#> GSM35502     1  0.0000      0.989 1.000 0.000 0.000
#> GSM35505     3  0.0000      0.992 0.000 0.000 1.000
#> GSM35507     2  0.6180      0.283 0.416 0.584 0.000
#> GSM35510     2  0.0000      0.964 0.000 1.000 0.000
#> GSM35514     1  0.0000      0.989 1.000 0.000 0.000
#> GSM35517     2  0.0000      0.964 0.000 1.000 0.000
#> GSM35520     2  0.2711      0.877 0.000 0.912 0.088
#> GSM35523     1  0.0000      0.989 1.000 0.000 0.000
#> GSM35529     2  0.0000      0.964 0.000 1.000 0.000
#> GSM35531     2  0.0000      0.964 0.000 1.000 0.000
#> GSM35534     2  0.0000      0.964 0.000 1.000 0.000
#> GSM35536     1  0.0000      0.989 1.000 0.000 0.000
#> GSM35538     1  0.0000      0.989 1.000 0.000 0.000
#> GSM35539     1  0.0000      0.989 1.000 0.000 0.000
#> GSM35540     2  0.0000      0.964 0.000 1.000 0.000
#> GSM35541     2  0.0000      0.964 0.000 1.000 0.000
#> GSM35442     1  0.5560      0.576 0.700 0.000 0.300
#> GSM35447     3  0.0000      0.992 0.000 0.000 1.000
#> GSM35450     1  0.0000      0.989 1.000 0.000 0.000
#> GSM35453     1  0.0000      0.989 1.000 0.000 0.000
#> GSM35456     1  0.0000      0.989 1.000 0.000 0.000
#> GSM35464     2  0.0000      0.964 0.000 1.000 0.000
#> GSM35467     1  0.0000      0.989 1.000 0.000 0.000
#> GSM35470     1  0.1163      0.963 0.972 0.000 0.028
#> GSM35479     3  0.0000      0.992 0.000 0.000 1.000
#> GSM35484     1  0.0000      0.989 1.000 0.000 0.000
#> GSM35488     1  0.0000      0.989 1.000 0.000 0.000
#> GSM35491     1  0.0000      0.989 1.000 0.000 0.000
#> GSM35494     3  0.0000      0.992 0.000 0.000 1.000
#> GSM35498     1  0.0000      0.989 1.000 0.000 0.000
#> GSM35501     1  0.0000      0.989 1.000 0.000 0.000
#> GSM35509     3  0.0000      0.992 0.000 0.000 1.000
#> GSM35513     1  0.0000      0.989 1.000 0.000 0.000
#> GSM35516     2  0.0000      0.964 0.000 1.000 0.000
#> GSM35522     1  0.0000      0.989 1.000 0.000 0.000
#> GSM35525     1  0.0000      0.989 1.000 0.000 0.000
#> GSM35528     1  0.0000      0.989 1.000 0.000 0.000
#> GSM35533     1  0.0000      0.989 1.000 0.000 0.000
#> GSM35537     1  0.0000      0.989 1.000 0.000 0.000

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>          class entropy silhouette    p1    p2    p3    p4
#> GSM35441     2  0.0188      0.968 0.000 0.996 0.000 0.004
#> GSM35446     3  0.0000      0.950 0.000 0.000 1.000 0.000
#> GSM35449     2  0.0188      0.968 0.000 0.996 0.000 0.004
#> GSM35455     2  0.0188      0.968 0.000 0.996 0.000 0.004
#> GSM35458     2  0.2281      0.895 0.000 0.904 0.096 0.000
#> GSM35460     3  0.0000      0.950 0.000 0.000 1.000 0.000
#> GSM35461     3  0.1059      0.943 0.016 0.000 0.972 0.012
#> GSM35463     2  0.0000      0.968 0.000 1.000 0.000 0.000
#> GSM35472     3  0.0000      0.950 0.000 0.000 1.000 0.000
#> GSM35475     2  0.4804      0.424 0.000 0.616 0.384 0.000
#> GSM35483     2  0.0000      0.968 0.000 1.000 0.000 0.000
#> GSM35496     3  0.2011      0.932 0.000 0.000 0.920 0.080
#> GSM35497     2  0.0188      0.968 0.000 0.996 0.000 0.004
#> GSM35504     2  0.0188      0.968 0.000 0.996 0.000 0.004
#> GSM35508     2  0.0188      0.968 0.000 0.996 0.000 0.004
#> GSM35511     3  0.2760      0.814 0.000 0.128 0.872 0.000
#> GSM35512     3  0.0000      0.950 0.000 0.000 1.000 0.000
#> GSM35515     2  0.2281      0.895 0.000 0.904 0.096 0.000
#> GSM35519     3  0.0000      0.950 0.000 0.000 1.000 0.000
#> GSM35527     2  0.0188      0.968 0.000 0.996 0.000 0.004
#> GSM35532     3  0.0000      0.950 0.000 0.000 1.000 0.000
#> GSM35439     2  0.0000      0.968 0.000 1.000 0.000 0.000
#> GSM35443     1  0.0000      0.992 1.000 0.000 0.000 0.000
#> GSM35445     1  0.0000      0.992 1.000 0.000 0.000 0.000
#> GSM35448     3  0.0000      0.950 0.000 0.000 1.000 0.000
#> GSM35451     4  0.2704      0.863 0.124 0.000 0.000 0.876
#> GSM35454     3  0.2081      0.930 0.000 0.000 0.916 0.084
#> GSM35457     2  0.0188      0.968 0.000 0.996 0.000 0.004
#> GSM35465     2  0.0592      0.960 0.000 0.984 0.000 0.016
#> GSM35468     1  0.0000      0.992 1.000 0.000 0.000 0.000
#> GSM35471     4  0.0188      0.864 0.004 0.000 0.000 0.996
#> GSM35473     1  0.0000      0.992 1.000 0.000 0.000 0.000
#> GSM35477     4  0.2704      0.863 0.124 0.000 0.000 0.876
#> GSM35480     1  0.1637      0.928 0.940 0.000 0.000 0.060
#> GSM35482     3  0.2647      0.910 0.000 0.000 0.880 0.120
#> GSM35485     2  0.0000      0.968 0.000 1.000 0.000 0.000
#> GSM35489     2  0.0000      0.968 0.000 1.000 0.000 0.000
#> GSM35492     1  0.0000      0.992 1.000 0.000 0.000 0.000
#> GSM35495     3  0.1716      0.937 0.000 0.000 0.936 0.064
#> GSM35499     2  0.0188      0.968 0.000 0.996 0.000 0.004
#> GSM35502     1  0.0000      0.992 1.000 0.000 0.000 0.000
#> GSM35505     3  0.0000      0.950 0.000 0.000 1.000 0.000
#> GSM35507     4  0.1867      0.847 0.000 0.072 0.000 0.928
#> GSM35510     2  0.0188      0.968 0.000 0.996 0.000 0.004
#> GSM35514     1  0.0000      0.992 1.000 0.000 0.000 0.000
#> GSM35517     2  0.0188      0.968 0.000 0.996 0.000 0.004
#> GSM35520     2  0.2868      0.857 0.000 0.864 0.136 0.000
#> GSM35523     4  0.0188      0.864 0.004 0.000 0.000 0.996
#> GSM35529     2  0.0188      0.968 0.000 0.996 0.000 0.004
#> GSM35531     2  0.1302      0.938 0.000 0.956 0.044 0.000
#> GSM35534     2  0.0000      0.968 0.000 1.000 0.000 0.000
#> GSM35536     1  0.0000      0.992 1.000 0.000 0.000 0.000
#> GSM35538     4  0.4898      0.457 0.416 0.000 0.000 0.584
#> GSM35539     4  0.3219      0.843 0.164 0.000 0.000 0.836
#> GSM35540     2  0.0188      0.968 0.000 0.996 0.000 0.004
#> GSM35541     2  0.0000      0.968 0.000 1.000 0.000 0.000
#> GSM35442     1  0.0336      0.984 0.992 0.000 0.008 0.000
#> GSM35447     3  0.0000      0.950 0.000 0.000 1.000 0.000
#> GSM35450     4  0.3726      0.801 0.212 0.000 0.000 0.788
#> GSM35453     1  0.0000      0.992 1.000 0.000 0.000 0.000
#> GSM35456     4  0.2174      0.874 0.052 0.020 0.000 0.928
#> GSM35464     4  0.2704      0.814 0.000 0.124 0.000 0.876
#> GSM35467     1  0.0000      0.992 1.000 0.000 0.000 0.000
#> GSM35470     4  0.4509      0.622 0.288 0.000 0.004 0.708
#> GSM35479     3  0.2647      0.910 0.000 0.000 0.880 0.120
#> GSM35484     1  0.0000      0.992 1.000 0.000 0.000 0.000
#> GSM35488     1  0.0000      0.992 1.000 0.000 0.000 0.000
#> GSM35491     1  0.0000      0.992 1.000 0.000 0.000 0.000
#> GSM35494     3  0.2647      0.910 0.000 0.000 0.880 0.120
#> GSM35498     4  0.0188      0.864 0.004 0.000 0.000 0.996
#> GSM35501     1  0.0000      0.992 1.000 0.000 0.000 0.000
#> GSM35509     3  0.2469      0.917 0.000 0.000 0.892 0.108
#> GSM35513     1  0.0000      0.992 1.000 0.000 0.000 0.000
#> GSM35516     2  0.0000      0.968 0.000 1.000 0.000 0.000
#> GSM35522     4  0.0000      0.862 0.000 0.000 0.000 1.000
#> GSM35525     1  0.1557      0.932 0.944 0.000 0.000 0.056
#> GSM35528     4  0.3074      0.850 0.152 0.000 0.000 0.848
#> GSM35533     1  0.0000      0.992 1.000 0.000 0.000 0.000
#> GSM35537     4  0.1022      0.867 0.032 0.000 0.000 0.968

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>          class entropy silhouette    p1    p2    p3    p4    p5
#> GSM35441     2  0.0703      0.923 0.000 0.976 0.000 0.000 0.024
#> GSM35446     3  0.3210      0.745 0.000 0.000 0.788 0.000 0.212
#> GSM35449     2  0.1732      0.899 0.000 0.920 0.000 0.000 0.080
#> GSM35455     2  0.1043      0.919 0.000 0.960 0.000 0.000 0.040
#> GSM35458     5  0.1732      0.755 0.000 0.080 0.000 0.000 0.920
#> GSM35460     3  0.2127      0.833 0.000 0.000 0.892 0.000 0.108
#> GSM35461     5  0.4915      0.326 0.020 0.000 0.420 0.004 0.556
#> GSM35463     2  0.1894      0.917 0.000 0.920 0.000 0.008 0.072
#> GSM35472     3  0.4060      0.423 0.000 0.000 0.640 0.000 0.360
#> GSM35475     5  0.1750      0.777 0.000 0.036 0.028 0.000 0.936
#> GSM35483     2  0.2295      0.911 0.000 0.900 0.004 0.008 0.088
#> GSM35496     3  0.1216      0.852 0.000 0.000 0.960 0.020 0.020
#> GSM35497     2  0.2020      0.884 0.000 0.900 0.000 0.000 0.100
#> GSM35504     2  0.0912      0.923 0.000 0.972 0.016 0.000 0.012
#> GSM35508     2  0.3857      0.585 0.000 0.688 0.000 0.000 0.312
#> GSM35511     5  0.2660      0.767 0.000 0.008 0.128 0.000 0.864
#> GSM35512     5  0.4287      0.139 0.000 0.000 0.460 0.000 0.540
#> GSM35515     5  0.1732      0.755 0.000 0.080 0.000 0.000 0.920
#> GSM35519     5  0.2605      0.759 0.000 0.000 0.148 0.000 0.852
#> GSM35527     2  0.2516      0.848 0.000 0.860 0.000 0.000 0.140
#> GSM35532     5  0.2561      0.761 0.000 0.000 0.144 0.000 0.856
#> GSM35439     2  0.1956      0.916 0.000 0.916 0.000 0.008 0.076
#> GSM35443     1  0.0771      0.962 0.976 0.000 0.000 0.004 0.020
#> GSM35445     1  0.0324      0.974 0.992 0.000 0.004 0.000 0.004
#> GSM35448     3  0.3914      0.729 0.000 0.016 0.760 0.004 0.220
#> GSM35451     4  0.2179      0.827 0.100 0.000 0.000 0.896 0.004
#> GSM35454     3  0.0798      0.854 0.008 0.000 0.976 0.000 0.016
#> GSM35457     2  0.0404      0.924 0.000 0.988 0.000 0.000 0.012
#> GSM35465     2  0.1493      0.914 0.000 0.948 0.000 0.024 0.028
#> GSM35468     1  0.0162      0.976 0.996 0.000 0.000 0.004 0.000
#> GSM35471     4  0.0693      0.826 0.000 0.000 0.012 0.980 0.008
#> GSM35473     1  0.0162      0.976 0.996 0.000 0.000 0.000 0.004
#> GSM35477     4  0.2068      0.829 0.092 0.000 0.000 0.904 0.004
#> GSM35480     1  0.1952      0.902 0.912 0.000 0.000 0.084 0.004
#> GSM35482     3  0.1408      0.838 0.000 0.000 0.948 0.044 0.008
#> GSM35485     2  0.2017      0.915 0.000 0.912 0.000 0.008 0.080
#> GSM35489     2  0.1408      0.924 0.000 0.948 0.000 0.008 0.044
#> GSM35492     1  0.0162      0.976 0.996 0.000 0.000 0.004 0.000
#> GSM35495     3  0.0703      0.856 0.000 0.000 0.976 0.000 0.024
#> GSM35499     2  0.0703      0.922 0.000 0.976 0.000 0.000 0.024
#> GSM35502     1  0.0000      0.976 1.000 0.000 0.000 0.000 0.000
#> GSM35505     3  0.2127      0.836 0.000 0.000 0.892 0.000 0.108
#> GSM35507     4  0.1485      0.818 0.000 0.032 0.000 0.948 0.020
#> GSM35510     2  0.0290      0.924 0.000 0.992 0.000 0.000 0.008
#> GSM35514     1  0.0000      0.976 1.000 0.000 0.000 0.000 0.000
#> GSM35517     2  0.1197      0.926 0.000 0.952 0.000 0.000 0.048
#> GSM35520     5  0.2006      0.764 0.000 0.072 0.012 0.000 0.916
#> GSM35523     4  0.1310      0.823 0.000 0.000 0.024 0.956 0.020
#> GSM35529     2  0.0404      0.924 0.000 0.988 0.000 0.000 0.012
#> GSM35531     2  0.3443      0.835 0.000 0.816 0.012 0.008 0.164
#> GSM35534     2  0.2463      0.904 0.000 0.888 0.004 0.008 0.100
#> GSM35536     1  0.0000      0.976 1.000 0.000 0.000 0.000 0.000
#> GSM35538     4  0.4375      0.405 0.420 0.000 0.000 0.576 0.004
#> GSM35539     4  0.2843      0.812 0.144 0.000 0.000 0.848 0.008
#> GSM35540     2  0.1408      0.918 0.000 0.948 0.000 0.008 0.044
#> GSM35541     2  0.1764      0.919 0.000 0.928 0.000 0.008 0.064
#> GSM35442     1  0.2032      0.917 0.924 0.000 0.052 0.004 0.020
#> GSM35447     3  0.2891      0.786 0.000 0.000 0.824 0.000 0.176
#> GSM35450     4  0.3266      0.775 0.200 0.000 0.000 0.796 0.004
#> GSM35453     1  0.0566      0.970 0.984 0.000 0.012 0.000 0.004
#> GSM35456     4  0.1503      0.829 0.020 0.008 0.000 0.952 0.020
#> GSM35464     4  0.3106      0.730 0.000 0.140 0.000 0.840 0.020
#> GSM35467     1  0.0000      0.976 1.000 0.000 0.000 0.000 0.000
#> GSM35470     4  0.7121      0.318 0.240 0.000 0.308 0.432 0.020
#> GSM35479     3  0.1549      0.834 0.000 0.000 0.944 0.040 0.016
#> GSM35484     1  0.0162      0.976 0.996 0.000 0.000 0.000 0.004
#> GSM35488     1  0.0290      0.974 0.992 0.000 0.000 0.008 0.000
#> GSM35491     1  0.0162      0.976 0.996 0.000 0.000 0.004 0.000
#> GSM35494     3  0.1331      0.840 0.000 0.000 0.952 0.040 0.008
#> GSM35498     4  0.1106      0.824 0.000 0.000 0.012 0.964 0.024
#> GSM35501     1  0.0000      0.976 1.000 0.000 0.000 0.000 0.000
#> GSM35509     3  0.0404      0.853 0.000 0.000 0.988 0.012 0.000
#> GSM35513     1  0.0000      0.976 1.000 0.000 0.000 0.000 0.000
#> GSM35516     2  0.1914      0.921 0.000 0.924 0.000 0.016 0.060
#> GSM35522     4  0.1310      0.823 0.000 0.000 0.024 0.956 0.020
#> GSM35525     1  0.2886      0.801 0.844 0.000 0.000 0.148 0.008
#> GSM35528     4  0.2806      0.808 0.152 0.000 0.000 0.844 0.004
#> GSM35533     1  0.0162      0.976 0.996 0.000 0.000 0.000 0.004
#> GSM35537     4  0.4697      0.732 0.068 0.000 0.152 0.760 0.020

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>          class entropy silhouette    p1    p2    p3    p4    p5 p6
#> GSM35441     2  0.0632     0.7791 0.000 0.976 0.000 0.000 0.024 NA
#> GSM35446     3  0.4312     0.5305 0.000 0.000 0.676 0.000 0.272 NA
#> GSM35449     2  0.2384     0.7346 0.000 0.884 0.000 0.000 0.084 NA
#> GSM35455     2  0.1856     0.7633 0.000 0.920 0.000 0.000 0.048 NA
#> GSM35458     5  0.2445     0.7448 0.000 0.020 0.000 0.000 0.872 NA
#> GSM35460     3  0.3279     0.6543 0.000 0.000 0.796 0.000 0.176 NA
#> GSM35461     5  0.5719     0.5110 0.032 0.000 0.224 0.004 0.616 NA
#> GSM35463     2  0.3961     0.7015 0.000 0.556 0.000 0.000 0.004 NA
#> GSM35472     5  0.4703    -0.0426 0.000 0.000 0.464 0.000 0.492 NA
#> GSM35475     5  0.1124     0.7715 0.000 0.008 0.000 0.000 0.956 NA
#> GSM35483     2  0.4314     0.6891 0.000 0.536 0.000 0.000 0.020 NA
#> GSM35496     3  0.3224     0.7057 0.000 0.000 0.824 0.004 0.040 NA
#> GSM35497     2  0.2436     0.7373 0.000 0.880 0.000 0.000 0.088 NA
#> GSM35504     2  0.2778     0.7779 0.000 0.824 0.008 0.000 0.000 NA
#> GSM35508     2  0.3782     0.5791 0.000 0.740 0.000 0.000 0.224 NA
#> GSM35511     5  0.0713     0.7755 0.000 0.000 0.028 0.000 0.972 NA
#> GSM35512     5  0.4180     0.3592 0.000 0.000 0.348 0.000 0.628 NA
#> GSM35515     5  0.2445     0.7448 0.000 0.020 0.000 0.000 0.872 NA
#> GSM35519     5  0.1196     0.7700 0.000 0.000 0.040 0.000 0.952 NA
#> GSM35527     2  0.2798     0.7114 0.000 0.852 0.000 0.000 0.112 NA
#> GSM35532     5  0.0713     0.7757 0.000 0.000 0.028 0.000 0.972 NA
#> GSM35439     2  0.4064     0.7306 0.000 0.624 0.000 0.000 0.016 NA
#> GSM35443     1  0.2398     0.8876 0.888 0.000 0.004 0.004 0.016 NA
#> GSM35445     1  0.2364     0.8888 0.892 0.000 0.032 0.004 0.000 NA
#> GSM35448     3  0.5405     0.4905 0.000 0.008 0.612 0.000 0.208 NA
#> GSM35451     4  0.2630     0.7854 0.064 0.000 0.000 0.872 0.000 NA
#> GSM35454     3  0.2315     0.7122 0.008 0.000 0.892 0.000 0.016 NA
#> GSM35457     2  0.0146     0.7814 0.000 0.996 0.000 0.000 0.000 NA
#> GSM35465     2  0.1765     0.7638 0.000 0.924 0.000 0.024 0.000 NA
#> GSM35468     1  0.1411     0.9075 0.936 0.000 0.000 0.004 0.000 NA
#> GSM35471     4  0.1010     0.7860 0.000 0.000 0.004 0.960 0.000 NA
#> GSM35473     1  0.1196     0.9112 0.952 0.000 0.008 0.000 0.000 NA
#> GSM35477     4  0.2629     0.7856 0.060 0.000 0.000 0.872 0.000 NA
#> GSM35480     1  0.3627     0.8171 0.808 0.000 0.008 0.092 0.000 NA
#> GSM35482     3  0.3219     0.7003 0.000 0.000 0.820 0.012 0.020 NA
#> GSM35485     2  0.4123     0.7068 0.000 0.568 0.000 0.000 0.012 NA
#> GSM35489     2  0.3383     0.7671 0.000 0.728 0.000 0.000 0.004 NA
#> GSM35492     1  0.1471     0.9063 0.932 0.000 0.000 0.004 0.000 NA
#> GSM35495     3  0.1196     0.7262 0.000 0.000 0.952 0.000 0.040 NA
#> GSM35499     2  0.2320     0.7868 0.000 0.864 0.000 0.004 0.000 NA
#> GSM35502     1  0.0363     0.9174 0.988 0.000 0.000 0.000 0.000 NA
#> GSM35505     3  0.3936     0.6633 0.008 0.000 0.780 0.000 0.124 NA
#> GSM35507     4  0.2122     0.7746 0.000 0.024 0.000 0.900 0.000 NA
#> GSM35510     2  0.1141     0.7876 0.000 0.948 0.000 0.000 0.000 NA
#> GSM35514     1  0.0146     0.9177 0.996 0.000 0.000 0.000 0.000 NA
#> GSM35517     2  0.3081     0.7770 0.000 0.776 0.000 0.000 0.004 NA
#> GSM35520     5  0.2491     0.7249 0.000 0.020 0.000 0.000 0.868 NA
#> GSM35523     4  0.3029     0.7561 0.000 0.000 0.036 0.840 0.004 NA
#> GSM35529     2  0.0146     0.7812 0.000 0.996 0.000 0.000 0.004 NA
#> GSM35531     2  0.4895     0.6449 0.000 0.496 0.000 0.000 0.060 NA
#> GSM35534     2  0.4453     0.6821 0.000 0.528 0.000 0.000 0.028 NA
#> GSM35536     1  0.0458     0.9171 0.984 0.000 0.000 0.000 0.000 NA
#> GSM35538     4  0.4783     0.2861 0.428 0.000 0.000 0.520 0.000 NA
#> GSM35539     4  0.3644     0.7599 0.120 0.000 0.000 0.792 0.000 NA
#> GSM35540     2  0.1851     0.7672 0.000 0.924 0.004 0.004 0.012 NA
#> GSM35541     2  0.3756     0.7390 0.000 0.644 0.000 0.000 0.004 NA
#> GSM35442     1  0.4729     0.7480 0.720 0.000 0.092 0.008 0.012 NA
#> GSM35447     3  0.4746     0.5412 0.008 0.000 0.672 0.000 0.240 NA
#> GSM35450     4  0.4117     0.6792 0.228 0.000 0.000 0.716 0.000 NA
#> GSM35453     1  0.2499     0.8802 0.880 0.000 0.048 0.000 0.000 NA
#> GSM35456     4  0.2001     0.7774 0.004 0.004 0.000 0.900 0.000 NA
#> GSM35464     4  0.4787     0.6058 0.000 0.220 0.000 0.672 0.004 NA
#> GSM35467     1  0.0000     0.9175 1.000 0.000 0.000 0.000 0.000 NA
#> GSM35470     3  0.7594    -0.0631 0.136 0.000 0.340 0.264 0.004 NA
#> GSM35479     3  0.2876     0.7092 0.000 0.000 0.844 0.016 0.008 NA
#> GSM35484     1  0.1542     0.9098 0.936 0.000 0.004 0.008 0.000 NA
#> GSM35488     1  0.2201     0.8921 0.896 0.000 0.000 0.028 0.000 NA
#> GSM35491     1  0.1349     0.9086 0.940 0.000 0.000 0.004 0.000 NA
#> GSM35494     3  0.2784     0.7109 0.000 0.000 0.848 0.012 0.008 NA
#> GSM35498     4  0.2906     0.7675 0.000 0.004 0.016 0.844 0.004 NA
#> GSM35501     1  0.0363     0.9174 0.988 0.000 0.000 0.000 0.000 NA
#> GSM35509     3  0.1616     0.7294 0.000 0.000 0.932 0.000 0.020 NA
#> GSM35513     1  0.0000     0.9175 1.000 0.000 0.000 0.000 0.000 NA
#> GSM35516     2  0.4428     0.7366 0.000 0.624 0.000 0.032 0.004 NA
#> GSM35522     4  0.2882     0.7596 0.000 0.000 0.028 0.848 0.004 NA
#> GSM35525     1  0.4186     0.6496 0.728 0.000 0.000 0.192 0.000 NA
#> GSM35528     4  0.4032     0.7509 0.140 0.000 0.000 0.764 0.004 NA
#> GSM35533     1  0.1923     0.9029 0.916 0.000 0.004 0.016 0.000 NA
#> GSM35537     4  0.6806     0.3752 0.064 0.000 0.220 0.484 0.004 NA

Heatmaps for the consensus matrix. It visualizes the probability of two samples to be in a same group.

consensus_heatmap(res, k = 2)

plot of chunk tab-MAD-skmeans-consensus-heatmap-1

consensus_heatmap(res, k = 3)

plot of chunk tab-MAD-skmeans-consensus-heatmap-2

consensus_heatmap(res, k = 4)

plot of chunk tab-MAD-skmeans-consensus-heatmap-3

consensus_heatmap(res, k = 5)

plot of chunk tab-MAD-skmeans-consensus-heatmap-4

consensus_heatmap(res, k = 6)

plot of chunk tab-MAD-skmeans-consensus-heatmap-5

Heatmaps for the membership of samples in all partitions to see how consistent they are:

membership_heatmap(res, k = 2)

plot of chunk tab-MAD-skmeans-membership-heatmap-1

membership_heatmap(res, k = 3)

plot of chunk tab-MAD-skmeans-membership-heatmap-2

membership_heatmap(res, k = 4)

plot of chunk tab-MAD-skmeans-membership-heatmap-3

membership_heatmap(res, k = 5)

plot of chunk tab-MAD-skmeans-membership-heatmap-4

membership_heatmap(res, k = 6)

plot of chunk tab-MAD-skmeans-membership-heatmap-5

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)

plot of chunk tab-MAD-skmeans-get-signatures-1

get_signatures(res, k = 3)

plot of chunk tab-MAD-skmeans-get-signatures-2

get_signatures(res, k = 4)

plot of chunk tab-MAD-skmeans-get-signatures-3

get_signatures(res, k = 5)

plot of chunk tab-MAD-skmeans-get-signatures-4

get_signatures(res, k = 6)

plot of chunk tab-MAD-skmeans-get-signatures-5

Signature heatmaps where rows are not scaled:

get_signatures(res, k = 2, scale_rows = FALSE)

plot of chunk tab-MAD-skmeans-get-signatures-no-scale-1

get_signatures(res, k = 3, scale_rows = FALSE)

plot of chunk tab-MAD-skmeans-get-signatures-no-scale-2

get_signatures(res, k = 4, scale_rows = FALSE)

plot of chunk tab-MAD-skmeans-get-signatures-no-scale-3

get_signatures(res, k = 5, scale_rows = FALSE)

plot of chunk tab-MAD-skmeans-get-signatures-no-scale-4

get_signatures(res, k = 6, scale_rows = FALSE)

plot of chunk tab-MAD-skmeans-get-signatures-no-scale-5

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk MAD-skmeans-signature_compare

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:

  1. which_row: row indices corresponding to the input matrix.
  2. fdr: FDR for the differential test.
  3. mean_x: The mean value in group x.
  4. scaled_mean_x: The mean value in group x after rows are scaled.
  5. 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")

plot of chunk tab-MAD-skmeans-dimension-reduction-1

dimension_reduction(res, k = 3, method = "UMAP")

plot of chunk tab-MAD-skmeans-dimension-reduction-2

dimension_reduction(res, k = 4, method = "UMAP")

plot of chunk tab-MAD-skmeans-dimension-reduction-3

dimension_reduction(res, k = 5, method = "UMAP")

plot of chunk tab-MAD-skmeans-dimension-reduction-4

dimension_reduction(res, k = 6, method = "UMAP")

plot of chunk tab-MAD-skmeans-dimension-reduction-5

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk MAD-skmeans-collect-classes

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  time(p) k
#> MAD:skmeans 78 3.66e-07 2
#> MAD:skmeans 77 2.19e-05 3
#> MAD:skmeans 77 3.99e-05 4
#> MAD:skmeans 74 1.86e-05 5
#> MAD:skmeans 73 1.17e-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.


MAD:pam*

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 7758 rows and 79 columns.
#>   Top rows (776, 1552, 2328, 3103, 3879) 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)

plot of chunk MAD-pam-collect-plots

The plots are:

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:

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)

plot of chunk MAD-pam-select-partition-number

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.637           0.790       0.915         0.4976 0.496   0.496
#> 3 3 0.598           0.692       0.792         0.3094 0.764   0.566
#> 4 4 0.901           0.865       0.941         0.1554 0.873   0.652
#> 5 5 0.835           0.822       0.908         0.0501 0.914   0.682
#> 6 6 0.805           0.670       0.802         0.0387 0.939   0.718

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.

show/hide code output

cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#>          class entropy silhouette    p1    p2
#> GSM35441     2  0.0000     0.9012 0.000 1.000
#> GSM35446     2  0.6438     0.7847 0.164 0.836
#> GSM35449     2  0.0000     0.9012 0.000 1.000
#> GSM35455     2  0.0000     0.9012 0.000 1.000
#> GSM35458     1  0.9954     0.0660 0.540 0.460
#> GSM35460     2  0.6973     0.7593 0.188 0.812
#> GSM35461     1  0.2043     0.8779 0.968 0.032
#> GSM35463     2  0.0000     0.9012 0.000 1.000
#> GSM35472     2  0.7453     0.7303 0.212 0.788
#> GSM35475     2  0.9881     0.2741 0.436 0.564
#> GSM35483     2  0.0000     0.9012 0.000 1.000
#> GSM35496     1  0.0000     0.8976 1.000 0.000
#> GSM35497     2  0.0000     0.9012 0.000 1.000
#> GSM35504     2  0.0000     0.9012 0.000 1.000
#> GSM35508     2  0.0000     0.9012 0.000 1.000
#> GSM35511     2  0.4562     0.8433 0.096 0.904
#> GSM35512     2  0.9248     0.5303 0.340 0.660
#> GSM35515     1  0.9775     0.2323 0.588 0.412
#> GSM35519     2  0.7950     0.6973 0.240 0.760
#> GSM35527     2  0.0000     0.9012 0.000 1.000
#> GSM35532     2  0.4431     0.8465 0.092 0.908
#> GSM35439     2  0.0000     0.9012 0.000 1.000
#> GSM35443     1  0.0000     0.8976 1.000 0.000
#> GSM35445     1  0.0000     0.8976 1.000 0.000
#> GSM35448     2  0.1184     0.8937 0.016 0.984
#> GSM35451     1  0.3879     0.8459 0.924 0.076
#> GSM35454     2  0.9933     0.1862 0.452 0.548
#> GSM35457     2  0.0000     0.9012 0.000 1.000
#> GSM35465     2  0.0000     0.9012 0.000 1.000
#> GSM35468     1  0.0000     0.8976 1.000 0.000
#> GSM35471     1  0.8327     0.6147 0.736 0.264
#> GSM35473     1  0.0000     0.8976 1.000 0.000
#> GSM35477     1  0.0672     0.8955 0.992 0.008
#> GSM35480     1  0.0376     0.8971 0.996 0.004
#> GSM35482     1  0.3733     0.8490 0.928 0.072
#> GSM35485     2  0.0000     0.9012 0.000 1.000
#> GSM35489     2  0.0000     0.9012 0.000 1.000
#> GSM35492     1  0.0000     0.8976 1.000 0.000
#> GSM35495     2  0.8207     0.6700 0.256 0.744
#> GSM35499     2  0.0000     0.9012 0.000 1.000
#> GSM35502     1  0.0000     0.8976 1.000 0.000
#> GSM35505     1  0.9996    -0.0171 0.512 0.488
#> GSM35507     1  0.8955     0.5416 0.688 0.312
#> GSM35510     2  0.0000     0.9012 0.000 1.000
#> GSM35514     1  0.0000     0.8976 1.000 0.000
#> GSM35517     2  0.0000     0.9012 0.000 1.000
#> GSM35520     2  0.6343     0.7866 0.160 0.840
#> GSM35523     1  0.1843     0.8842 0.972 0.028
#> GSM35529     2  0.0000     0.9012 0.000 1.000
#> GSM35531     2  0.0938     0.8958 0.012 0.988
#> GSM35534     2  0.0000     0.9012 0.000 1.000
#> GSM35536     1  0.0000     0.8976 1.000 0.000
#> GSM35538     1  0.0000     0.8976 1.000 0.000
#> GSM35539     1  0.0672     0.8955 0.992 0.008
#> GSM35540     2  0.0000     0.9012 0.000 1.000
#> GSM35541     2  0.0000     0.9012 0.000 1.000
#> GSM35442     1  0.0000     0.8976 1.000 0.000
#> GSM35447     1  0.9635     0.2973 0.612 0.388
#> GSM35450     1  0.0376     0.8971 0.996 0.004
#> GSM35453     1  0.0000     0.8976 1.000 0.000
#> GSM35456     1  0.8327     0.6170 0.736 0.264
#> GSM35464     2  0.1184     0.8925 0.016 0.984
#> GSM35467     1  0.0000     0.8976 1.000 0.000
#> GSM35470     1  0.0376     0.8971 0.996 0.004
#> GSM35479     1  0.0376     0.8971 0.996 0.004
#> GSM35484     1  0.0938     0.8921 0.988 0.012
#> GSM35488     1  0.0000     0.8976 1.000 0.000
#> GSM35491     1  0.0000     0.8976 1.000 0.000
#> GSM35494     1  0.1633     0.8861 0.976 0.024
#> GSM35498     1  0.9933     0.1714 0.548 0.452
#> GSM35501     1  0.0000     0.8976 1.000 0.000
#> GSM35509     1  0.8555     0.5888 0.720 0.280
#> GSM35513     1  0.0000     0.8976 1.000 0.000
#> GSM35516     2  0.0000     0.9012 0.000 1.000
#> GSM35522     2  0.9795     0.1976 0.416 0.584
#> GSM35525     1  0.0000     0.8976 1.000 0.000
#> GSM35528     1  0.0376     0.8971 0.996 0.004
#> GSM35533     1  0.0376     0.8971 0.996 0.004
#> GSM35537     1  0.0376     0.8971 0.996 0.004

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>          class entropy silhouette    p1    p2    p3
#> GSM35441     2  0.0000      0.964 0.000 1.000 0.000
#> GSM35446     3  0.8310      0.622 0.184 0.184 0.632
#> GSM35449     2  0.0000      0.964 0.000 1.000 0.000
#> GSM35455     2  0.0000      0.964 0.000 1.000 0.000
#> GSM35458     3  0.9757     -0.125 0.324 0.244 0.432
#> GSM35460     3  0.8042      0.612 0.248 0.116 0.636
#> GSM35461     3  0.0747      0.549 0.016 0.000 0.984
#> GSM35463     2  0.0000      0.964 0.000 1.000 0.000
#> GSM35472     3  0.6044      0.661 0.056 0.172 0.772
#> GSM35475     3  0.5318      0.636 0.016 0.204 0.780
#> GSM35483     2  0.0000      0.964 0.000 1.000 0.000
#> GSM35496     3  0.0424      0.560 0.008 0.000 0.992
#> GSM35497     2  0.0000      0.964 0.000 1.000 0.000
#> GSM35504     2  0.1411      0.932 0.036 0.964 0.000
#> GSM35508     2  0.0000      0.964 0.000 1.000 0.000
#> GSM35511     3  0.6079      0.423 0.000 0.388 0.612
#> GSM35512     3  0.1643      0.598 0.000 0.044 0.956
#> GSM35515     3  0.9598     -0.105 0.304 0.228 0.468
#> GSM35519     3  0.4861      0.644 0.008 0.192 0.800
#> GSM35527     2  0.0000      0.964 0.000 1.000 0.000
#> GSM35532     3  0.6470      0.473 0.012 0.356 0.632
#> GSM35439     2  0.0000      0.964 0.000 1.000 0.000
#> GSM35443     1  0.6026      0.685 0.624 0.000 0.376
#> GSM35445     1  0.4887      0.690 0.772 0.000 0.228
#> GSM35448     3  0.8303      0.618 0.172 0.196 0.632
#> GSM35451     1  0.0237      0.690 0.996 0.000 0.004
#> GSM35454     1  0.4121      0.515 0.832 0.000 0.168
#> GSM35457     2  0.0000      0.964 0.000 1.000 0.000
#> GSM35465     2  0.0661      0.955 0.008 0.988 0.004
#> GSM35468     1  0.5968      0.693 0.636 0.000 0.364
#> GSM35471     1  0.0892      0.681 0.980 0.000 0.020
#> GSM35473     1  0.6079      0.679 0.612 0.000 0.388
#> GSM35477     1  0.0237      0.690 0.996 0.000 0.004
#> GSM35480     1  0.0747      0.683 0.984 0.000 0.016
#> GSM35482     1  0.1860      0.666 0.948 0.000 0.052
#> GSM35485     2  0.0000      0.964 0.000 1.000 0.000
#> GSM35489     2  0.0000      0.964 0.000 1.000 0.000
#> GSM35492     1  0.5968      0.693 0.636 0.000 0.364
#> GSM35495     3  0.6318      0.518 0.356 0.008 0.636
#> GSM35499     2  0.4465      0.750 0.176 0.820 0.004
#> GSM35502     1  0.5948      0.695 0.640 0.000 0.360
#> GSM35505     3  0.6848      0.330 0.416 0.016 0.568
#> GSM35507     1  0.1878      0.655 0.952 0.044 0.004
#> GSM35510     2  0.3482      0.819 0.128 0.872 0.000
#> GSM35514     1  0.5968      0.693 0.636 0.000 0.364
#> GSM35517     2  0.0000      0.964 0.000 1.000 0.000
#> GSM35520     3  0.8097      0.443 0.072 0.388 0.540
#> GSM35523     1  0.0237      0.690 0.996 0.000 0.004
#> GSM35529     2  0.0000      0.964 0.000 1.000 0.000
#> GSM35531     2  0.2486      0.897 0.008 0.932 0.060
#> GSM35534     2  0.0000      0.964 0.000 1.000 0.000
#> GSM35536     1  0.5948      0.695 0.640 0.000 0.360
#> GSM35538     1  0.5926      0.696 0.644 0.000 0.356
#> GSM35539     1  0.0237      0.690 0.996 0.000 0.004
#> GSM35540     2  0.0983      0.949 0.016 0.980 0.004
#> GSM35541     2  0.0000      0.964 0.000 1.000 0.000
#> GSM35442     1  0.6168      0.648 0.588 0.000 0.412
#> GSM35447     3  0.6019      0.128 0.288 0.012 0.700
#> GSM35450     1  0.0000      0.690 1.000 0.000 0.000
#> GSM35453     1  0.6140      0.672 0.596 0.000 0.404
#> GSM35456     1  0.1015      0.682 0.980 0.008 0.012
#> GSM35464     2  0.4110      0.785 0.152 0.844 0.004
#> GSM35467     1  0.5968      0.693 0.636 0.000 0.364
#> GSM35470     1  0.0237      0.690 0.996 0.000 0.004
#> GSM35479     1  0.5650      0.165 0.688 0.000 0.312
#> GSM35484     1  0.6079      0.679 0.612 0.000 0.388
#> GSM35488     1  0.5968      0.693 0.636 0.000 0.364
#> GSM35491     1  0.5968      0.693 0.636 0.000 0.364
#> GSM35494     1  0.1643      0.668 0.956 0.000 0.044
#> GSM35498     1  0.3425      0.566 0.884 0.112 0.004
#> GSM35501     1  0.5926      0.696 0.644 0.000 0.356
#> GSM35509     3  0.6204      0.442 0.424 0.000 0.576
#> GSM35513     1  0.5968      0.693 0.636 0.000 0.364
#> GSM35516     2  0.0237      0.961 0.004 0.996 0.000
#> GSM35522     1  0.5690      0.258 0.708 0.288 0.004
#> GSM35525     1  0.5098      0.703 0.752 0.000 0.248
#> GSM35528     1  0.5882      0.697 0.652 0.000 0.348
#> GSM35533     1  0.0592      0.685 0.988 0.000 0.012
#> GSM35537     1  0.0237      0.690 0.996 0.000 0.004

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>          class entropy silhouette    p1    p2    p3    p4
#> GSM35441     2  0.0000      0.982 0.000 1.000 0.000 0.000
#> GSM35446     3  0.0000      0.927 0.000 0.000 1.000 0.000
#> GSM35449     2  0.0000      0.982 0.000 1.000 0.000 0.000
#> GSM35455     2  0.0000      0.982 0.000 1.000 0.000 0.000
#> GSM35458     1  0.0657      0.925 0.984 0.004 0.012 0.000
#> GSM35460     3  0.0000      0.927 0.000 0.000 1.000 0.000
#> GSM35461     3  0.4790      0.409 0.380 0.000 0.620 0.000
#> GSM35463     2  0.0000      0.982 0.000 1.000 0.000 0.000
#> GSM35472     3  0.0000      0.927 0.000 0.000 1.000 0.000
#> GSM35475     3  0.1256      0.915 0.028 0.008 0.964 0.000
#> GSM35483     2  0.0336      0.977 0.000 0.992 0.008 0.000
#> GSM35496     3  0.1022      0.917 0.032 0.000 0.968 0.000
#> GSM35497     2  0.0000      0.982 0.000 1.000 0.000 0.000
#> GSM35504     2  0.0188      0.979 0.000 0.996 0.004 0.000
#> GSM35508     2  0.0000      0.982 0.000 1.000 0.000 0.000
#> GSM35511     3  0.0592      0.922 0.000 0.016 0.984 0.000
#> GSM35512     3  0.0000      0.927 0.000 0.000 1.000 0.000
#> GSM35515     1  0.0469      0.928 0.988 0.000 0.012 0.000
#> GSM35519     3  0.0336      0.926 0.000 0.008 0.992 0.000
#> GSM35527     2  0.0000      0.982 0.000 1.000 0.000 0.000
#> GSM35532     3  0.0336      0.926 0.000 0.008 0.992 0.000
#> GSM35439     2  0.0000      0.982 0.000 1.000 0.000 0.000
#> GSM35443     1  0.0000      0.936 1.000 0.000 0.000 0.000
#> GSM35445     4  0.5933      0.312 0.408 0.000 0.040 0.552
#> GSM35448     3  0.0000      0.927 0.000 0.000 1.000 0.000
#> GSM35451     4  0.0000      0.884 0.000 0.000 0.000 1.000
#> GSM35454     1  0.7013      0.214 0.516 0.000 0.128 0.356
#> GSM35457     2  0.0000      0.982 0.000 1.000 0.000 0.000
#> GSM35465     2  0.0000      0.982 0.000 1.000 0.000 0.000
#> GSM35468     1  0.0000      0.936 1.000 0.000 0.000 0.000
#> GSM35471     4  0.0000      0.884 0.000 0.000 0.000 1.000
#> GSM35473     1  0.0000      0.936 1.000 0.000 0.000 0.000
#> GSM35477     4  0.0469      0.879 0.012 0.000 0.000 0.988
#> GSM35480     4  0.0000      0.884 0.000 0.000 0.000 1.000
#> GSM35482     4  0.2830      0.832 0.040 0.000 0.060 0.900
#> GSM35485     2  0.0336      0.977 0.000 0.992 0.008 0.000
#> GSM35489     2  0.0188      0.980 0.000 0.996 0.004 0.000
#> GSM35492     1  0.0000      0.936 1.000 0.000 0.000 0.000
#> GSM35495     3  0.1637      0.893 0.000 0.000 0.940 0.060
#> GSM35499     2  0.2216      0.897 0.000 0.908 0.000 0.092
#> GSM35502     1  0.4730      0.305 0.636 0.000 0.000 0.364
#> GSM35505     3  0.1211      0.911 0.040 0.000 0.960 0.000
#> GSM35507     4  0.0000      0.884 0.000 0.000 0.000 1.000
#> GSM35510     2  0.0000      0.982 0.000 1.000 0.000 0.000
#> GSM35514     1  0.0000      0.936 1.000 0.000 0.000 0.000
#> GSM35517     2  0.0000      0.982 0.000 1.000 0.000 0.000
#> GSM35520     3  0.1520      0.916 0.024 0.020 0.956 0.000
#> GSM35523     4  0.0000      0.884 0.000 0.000 0.000 1.000
#> GSM35529     2  0.0000      0.982 0.000 1.000 0.000 0.000
#> GSM35531     2  0.4365      0.744 0.000 0.784 0.188 0.028
#> GSM35534     2  0.0336      0.977 0.000 0.992 0.008 0.000
#> GSM35536     1  0.0000      0.936 1.000 0.000 0.000 0.000
#> GSM35538     4  0.4382      0.597 0.296 0.000 0.000 0.704
#> GSM35539     4  0.0000      0.884 0.000 0.000 0.000 1.000
#> GSM35540     2  0.0000      0.982 0.000 1.000 0.000 0.000
#> GSM35541     2  0.0000      0.982 0.000 1.000 0.000 0.000
#> GSM35442     1  0.0000      0.936 1.000 0.000 0.000 0.000
#> GSM35447     3  0.2888      0.836 0.124 0.000 0.872 0.004
#> GSM35450     4  0.0000      0.884 0.000 0.000 0.000 1.000
#> GSM35453     1  0.2036      0.887 0.936 0.000 0.032 0.032
#> GSM35456     4  0.0188      0.883 0.004 0.000 0.000 0.996
#> GSM35464     2  0.0188      0.979 0.000 0.996 0.000 0.004
#> GSM35467     1  0.0000      0.936 1.000 0.000 0.000 0.000
#> GSM35470     4  0.0000      0.884 0.000 0.000 0.000 1.000
#> GSM35479     4  0.1022      0.868 0.000 0.000 0.032 0.968
#> GSM35484     1  0.0000      0.936 1.000 0.000 0.000 0.000
#> GSM35488     1  0.0000      0.936 1.000 0.000 0.000 0.000
#> GSM35491     1  0.0000      0.936 1.000 0.000 0.000 0.000
#> GSM35494     4  0.1209      0.868 0.004 0.000 0.032 0.964
#> GSM35498     4  0.4972      0.127 0.456 0.000 0.000 0.544
#> GSM35501     4  0.4776      0.451 0.376 0.000 0.000 0.624
#> GSM35509     3  0.4406      0.576 0.000 0.000 0.700 0.300
#> GSM35513     1  0.0000      0.936 1.000 0.000 0.000 0.000
#> GSM35516     2  0.1867      0.918 0.000 0.928 0.000 0.072
#> GSM35522     4  0.0000      0.884 0.000 0.000 0.000 1.000
#> GSM35525     4  0.3610      0.725 0.200 0.000 0.000 0.800
#> GSM35528     4  0.4134      0.648 0.260 0.000 0.000 0.740
#> GSM35533     4  0.0000      0.884 0.000 0.000 0.000 1.000
#> GSM35537     4  0.0000      0.884 0.000 0.000 0.000 1.000

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>          class entropy silhouette    p1    p2    p3    p4    p5
#> GSM35441     2  0.0000     0.9586 0.000 1.000 0.000 0.000 0.000
#> GSM35446     5  0.2690     0.7220 0.000 0.000 0.156 0.000 0.844
#> GSM35449     2  0.0290     0.9577 0.000 0.992 0.008 0.000 0.000
#> GSM35455     2  0.0000     0.9586 0.000 1.000 0.000 0.000 0.000
#> GSM35458     1  0.1117     0.9156 0.964 0.000 0.016 0.000 0.020
#> GSM35460     3  0.4088     0.4191 0.000 0.000 0.632 0.000 0.368
#> GSM35461     1  0.4088     0.3779 0.632 0.000 0.000 0.000 0.368
#> GSM35463     2  0.2377     0.9029 0.000 0.872 0.128 0.000 0.000
#> GSM35472     5  0.0609     0.8641 0.000 0.000 0.020 0.000 0.980
#> GSM35475     5  0.0609     0.8624 0.000 0.000 0.020 0.000 0.980
#> GSM35483     2  0.3098     0.8766 0.000 0.836 0.148 0.000 0.016
#> GSM35496     5  0.6390    -0.0563 0.168 0.000 0.396 0.000 0.436
#> GSM35497     2  0.0000     0.9586 0.000 1.000 0.000 0.000 0.000
#> GSM35504     2  0.1851     0.9239 0.000 0.912 0.088 0.000 0.000
#> GSM35508     2  0.0000     0.9586 0.000 1.000 0.000 0.000 0.000
#> GSM35511     5  0.0000     0.8702 0.000 0.000 0.000 0.000 1.000
#> GSM35512     5  0.0404     0.8671 0.000 0.000 0.012 0.000 0.988
#> GSM35515     1  0.1549     0.9003 0.944 0.000 0.016 0.000 0.040
#> GSM35519     5  0.0000     0.8702 0.000 0.000 0.000 0.000 1.000
#> GSM35527     2  0.0000     0.9586 0.000 1.000 0.000 0.000 0.000
#> GSM35532     5  0.0000     0.8702 0.000 0.000 0.000 0.000 1.000
#> GSM35439     2  0.2230     0.9104 0.000 0.884 0.116 0.000 0.000
#> GSM35443     1  0.0000     0.9354 1.000 0.000 0.000 0.000 0.000
#> GSM35445     3  0.4444     0.7144 0.088 0.000 0.756 0.156 0.000
#> GSM35448     3  0.2230     0.6783 0.000 0.000 0.884 0.000 0.116
#> GSM35451     4  0.0000     0.8974 0.000 0.000 0.000 1.000 0.000
#> GSM35454     3  0.3474     0.7447 0.020 0.000 0.824 0.148 0.008
#> GSM35457     2  0.0000     0.9586 0.000 1.000 0.000 0.000 0.000
#> GSM35465     2  0.0324     0.9561 0.000 0.992 0.004 0.004 0.000
#> GSM35468     1  0.0000     0.9354 1.000 0.000 0.000 0.000 0.000
#> GSM35471     4  0.0162     0.8975 0.000 0.000 0.004 0.996 0.000
#> GSM35473     1  0.0162     0.9352 0.996 0.000 0.004 0.000 0.000
#> GSM35477     4  0.0000     0.8974 0.000 0.000 0.000 1.000 0.000
#> GSM35480     4  0.1043     0.8903 0.000 0.000 0.040 0.960 0.000
#> GSM35482     3  0.3728     0.6700 0.008 0.000 0.748 0.244 0.000
#> GSM35485     2  0.2873     0.8920 0.000 0.856 0.128 0.000 0.016
#> GSM35489     2  0.0865     0.9514 0.000 0.972 0.024 0.000 0.004
#> GSM35492     1  0.0000     0.9354 1.000 0.000 0.000 0.000 0.000
#> GSM35495     3  0.3282     0.6829 0.000 0.000 0.804 0.008 0.188
#> GSM35499     2  0.1774     0.9170 0.000 0.932 0.016 0.052 0.000
#> GSM35502     1  0.4238     0.3231 0.628 0.000 0.004 0.368 0.000
#> GSM35505     3  0.3727     0.6669 0.016 0.000 0.768 0.000 0.216
#> GSM35507     4  0.0510     0.8961 0.000 0.000 0.016 0.984 0.000
#> GSM35510     2  0.0000     0.9586 0.000 1.000 0.000 0.000 0.000
#> GSM35514     1  0.0162     0.9352 0.996 0.000 0.004 0.000 0.000
#> GSM35517     2  0.0000     0.9586 0.000 1.000 0.000 0.000 0.000
#> GSM35520     5  0.2787     0.7555 0.004 0.004 0.136 0.000 0.856
#> GSM35523     4  0.1197     0.8878 0.000 0.000 0.048 0.952 0.000
#> GSM35529     2  0.0000     0.9586 0.000 1.000 0.000 0.000 0.000
#> GSM35531     3  0.6084     0.2673 0.000 0.336 0.568 0.048 0.048
#> GSM35534     2  0.2873     0.8920 0.000 0.856 0.128 0.000 0.016
#> GSM35536     1  0.0162     0.9352 0.996 0.000 0.004 0.000 0.000
#> GSM35538     4  0.2536     0.8046 0.128 0.000 0.004 0.868 0.000
#> GSM35539     4  0.0000     0.8974 0.000 0.000 0.000 1.000 0.000
#> GSM35540     2  0.0324     0.9561 0.000 0.992 0.004 0.004 0.000
#> GSM35541     2  0.0000     0.9586 0.000 1.000 0.000 0.000 0.000
#> GSM35442     1  0.0000     0.9354 1.000 0.000 0.000 0.000 0.000
#> GSM35447     3  0.4042     0.6694 0.032 0.000 0.756 0.000 0.212
#> GSM35450     4  0.0162     0.8963 0.000 0.000 0.004 0.996 0.000
#> GSM35453     3  0.3612     0.5837 0.268 0.000 0.732 0.000 0.000
#> GSM35456     4  0.0510     0.8961 0.000 0.000 0.016 0.984 0.000
#> GSM35464     2  0.0693     0.9500 0.000 0.980 0.012 0.008 0.000
#> GSM35467     1  0.0162     0.9352 0.996 0.000 0.004 0.000 0.000
#> GSM35470     4  0.1197     0.8878 0.000 0.000 0.048 0.952 0.000
#> GSM35479     3  0.3366     0.6860 0.000 0.000 0.768 0.232 0.000
#> GSM35484     1  0.0324     0.9332 0.992 0.000 0.004 0.004 0.000
#> GSM35488     1  0.0000     0.9354 1.000 0.000 0.000 0.000 0.000
#> GSM35491     1  0.0000     0.9354 1.000 0.000 0.000 0.000 0.000
#> GSM35494     3  0.2605     0.7365 0.000 0.000 0.852 0.148 0.000
#> GSM35498     4  0.4747     0.0272 0.484 0.000 0.016 0.500 0.000
#> GSM35501     4  0.3884     0.5946 0.288 0.000 0.004 0.708 0.000
#> GSM35509     3  0.2969     0.7407 0.000 0.000 0.852 0.128 0.020
#> GSM35513     1  0.0162     0.9352 0.996 0.000 0.004 0.000 0.000
#> GSM35516     2  0.1872     0.9272 0.000 0.928 0.020 0.052 0.000
#> GSM35522     4  0.1197     0.8878 0.000 0.000 0.048 0.952 0.000
#> GSM35525     4  0.2179     0.8317 0.100 0.000 0.004 0.896 0.000
#> GSM35528     4  0.2389     0.8213 0.116 0.000 0.004 0.880 0.000
#> GSM35533     4  0.0000     0.8974 0.000 0.000 0.000 1.000 0.000
#> GSM35537     4  0.1197     0.8878 0.000 0.000 0.048 0.952 0.000

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>          class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM35441     6  0.3867      0.934 0.000 0.488 0.000 0.000 0.000 0.512
#> GSM35446     5  0.2664      0.674 0.000 0.000 0.184 0.000 0.816 0.000
#> GSM35449     2  0.3804     -0.705 0.000 0.576 0.000 0.000 0.000 0.424
#> GSM35455     6  0.3867      0.934 0.000 0.488 0.000 0.000 0.000 0.512
#> GSM35458     1  0.4617      0.686 0.720 0.020 0.016 0.000 0.036 0.208
#> GSM35460     3  0.3828      0.125 0.000 0.000 0.560 0.000 0.440 0.000
#> GSM35461     1  0.3797      0.241 0.580 0.000 0.000 0.000 0.420 0.000
#> GSM35463     2  0.0000      0.529 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM35472     5  0.0713      0.814 0.000 0.000 0.028 0.000 0.972 0.000
#> GSM35475     5  0.3794      0.722 0.000 0.128 0.016 0.000 0.796 0.060
#> GSM35483     2  0.0622      0.526 0.000 0.980 0.012 0.000 0.008 0.000
#> GSM35496     5  0.6447      0.427 0.096 0.000 0.176 0.000 0.560 0.168
#> GSM35497     6  0.3867      0.934 0.000 0.488 0.000 0.000 0.000 0.512
#> GSM35504     2  0.3672     -0.529 0.000 0.632 0.000 0.000 0.000 0.368
#> GSM35508     6  0.3869      0.917 0.000 0.500 0.000 0.000 0.000 0.500
#> GSM35511     5  0.0000      0.820 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM35512     5  0.0458      0.818 0.000 0.000 0.016 0.000 0.984 0.000
#> GSM35515     1  0.4295      0.693 0.728 0.000 0.016 0.000 0.048 0.208
#> GSM35519     5  0.0260      0.820 0.000 0.008 0.000 0.000 0.992 0.000
#> GSM35527     2  0.3869     -0.930 0.000 0.500 0.000 0.000 0.000 0.500
#> GSM35532     5  0.0000      0.820 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM35439     2  0.1075      0.514 0.000 0.952 0.000 0.000 0.000 0.048
#> GSM35443     1  0.0000      0.865 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM35445     3  0.2052      0.816 0.028 0.000 0.912 0.056 0.000 0.004
#> GSM35448     3  0.3422      0.720 0.000 0.168 0.792 0.000 0.040 0.000
#> GSM35451     4  0.0000      0.889 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM35454     3  0.1458      0.826 0.016 0.016 0.948 0.020 0.000 0.000
#> GSM35457     6  0.3867      0.934 0.000 0.488 0.000 0.000 0.000 0.512
#> GSM35465     6  0.3860      0.917 0.000 0.472 0.000 0.000 0.000 0.528
#> GSM35468     1  0.0000      0.865 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM35471     4  0.1245      0.888 0.000 0.000 0.016 0.952 0.000 0.032
#> GSM35473     1  0.0603      0.865 0.980 0.000 0.004 0.000 0.000 0.016
#> GSM35477     4  0.0000      0.889 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM35480     4  0.3351      0.832 0.004 0.000 0.028 0.800 0.000 0.168
#> GSM35482     3  0.5286      0.537 0.008 0.000 0.608 0.120 0.000 0.264
#> GSM35485     2  0.0260      0.531 0.000 0.992 0.000 0.000 0.008 0.000
#> GSM35489     2  0.2632      0.332 0.000 0.832 0.000 0.000 0.004 0.164
#> GSM35492     1  0.0000      0.865 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM35495     3  0.1226      0.817 0.000 0.000 0.952 0.004 0.040 0.004
#> GSM35499     6  0.4356      0.727 0.000 0.432 0.016 0.004 0.000 0.548
#> GSM35502     1  0.4370      0.181 0.536 0.000 0.004 0.444 0.000 0.016
#> GSM35505     3  0.2089      0.816 0.020 0.020 0.916 0.000 0.044 0.000
#> GSM35507     4  0.2094      0.878 0.000 0.000 0.020 0.900 0.000 0.080
#> GSM35510     6  0.3867      0.934 0.000 0.488 0.000 0.000 0.000 0.512
#> GSM35514     1  0.0603      0.865 0.980 0.000 0.004 0.000 0.000 0.016
#> GSM35517     2  0.3869     -0.930 0.000 0.500 0.000 0.000 0.000 0.500
#> GSM35520     5  0.4855      0.383 0.000 0.460 0.000 0.000 0.484 0.056
#> GSM35523     4  0.3789      0.800 0.000 0.000 0.024 0.716 0.000 0.260
#> GSM35529     6  0.3867      0.934 0.000 0.488 0.000 0.000 0.000 0.512
#> GSM35531     2  0.5614      0.161 0.000 0.632 0.164 0.168 0.036 0.000
#> GSM35534     2  0.0260      0.531 0.000 0.992 0.000 0.000 0.008 0.000
#> GSM35536     1  0.0748      0.864 0.976 0.000 0.004 0.004 0.000 0.016
#> GSM35538     4  0.0748      0.880 0.016 0.000 0.004 0.976 0.000 0.004
#> GSM35539     4  0.0000      0.889 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM35540     6  0.3854      0.903 0.000 0.464 0.000 0.000 0.000 0.536
#> GSM35541     6  0.3869      0.917 0.000 0.500 0.000 0.000 0.000 0.500
#> GSM35442     1  0.0000      0.865 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM35447     3  0.2125      0.811 0.016 0.004 0.908 0.000 0.068 0.004
#> GSM35450     4  0.0291      0.887 0.000 0.000 0.004 0.992 0.000 0.004
#> GSM35453     3  0.2312      0.773 0.112 0.000 0.876 0.000 0.000 0.012
#> GSM35456     4  0.2094      0.878 0.000 0.000 0.020 0.900 0.000 0.080
#> GSM35464     6  0.3923      0.794 0.000 0.416 0.004 0.000 0.000 0.580
#> GSM35467     1  0.0603      0.865 0.980 0.000 0.004 0.000 0.000 0.016
#> GSM35470     4  0.3789      0.800 0.000 0.000 0.024 0.716 0.000 0.260
#> GSM35479     3  0.4474      0.635 0.000 0.000 0.704 0.108 0.000 0.188
#> GSM35484     1  0.1218      0.853 0.956 0.000 0.004 0.028 0.000 0.012
#> GSM35488     1  0.0291      0.865 0.992 0.000 0.000 0.004 0.000 0.004
#> GSM35491     1  0.0000      0.865 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM35494     3  0.0993      0.822 0.000 0.000 0.964 0.024 0.000 0.012
#> GSM35498     1  0.5488      0.256 0.548 0.000 0.020 0.348 0.000 0.084
#> GSM35501     4  0.2765      0.764 0.132 0.000 0.004 0.848 0.000 0.016
#> GSM35509     3  0.0692      0.824 0.000 0.000 0.976 0.020 0.000 0.004
#> GSM35513     1  0.0603      0.865 0.980 0.000 0.004 0.000 0.000 0.016
#> GSM35516     2  0.3803      0.384 0.000 0.780 0.004 0.068 0.000 0.148
#> GSM35522     4  0.3789      0.800 0.000 0.000 0.024 0.716 0.000 0.260
#> GSM35525     4  0.1148      0.884 0.016 0.000 0.004 0.960 0.000 0.020
#> GSM35528     4  0.2176      0.863 0.080 0.000 0.000 0.896 0.000 0.024
#> GSM35533     4  0.0146      0.890 0.000 0.000 0.000 0.996 0.000 0.004
#> GSM35537     4  0.3789      0.800 0.000 0.000 0.024 0.716 0.000 0.260

Heatmaps for the consensus matrix. It visualizes the probability of two samples to be in a same group.

consensus_heatmap(res, k = 2)

plot of chunk tab-MAD-pam-consensus-heatmap-1

consensus_heatmap(res, k = 3)

plot of chunk tab-MAD-pam-consensus-heatmap-2

consensus_heatmap(res, k = 4)

plot of chunk tab-MAD-pam-consensus-heatmap-3

consensus_heatmap(res, k = 5)

plot of chunk tab-MAD-pam-consensus-heatmap-4

consensus_heatmap(res, k = 6)

plot of chunk tab-MAD-pam-consensus-heatmap-5

Heatmaps for the membership of samples in all partitions to see how consistent they are:

membership_heatmap(res, k = 2)

plot of chunk tab-MAD-pam-membership-heatmap-1

membership_heatmap(res, k = 3)

plot of chunk tab-MAD-pam-membership-heatmap-2

membership_heatmap(res, k = 4)

plot of chunk tab-MAD-pam-membership-heatmap-3

membership_heatmap(res, k = 5)

plot of chunk tab-MAD-pam-membership-heatmap-4

membership_heatmap(res, k = 6)

plot of chunk tab-MAD-pam-membership-heatmap-5

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)

plot of chunk tab-MAD-pam-get-signatures-1

get_signatures(res, k = 3)

plot of chunk tab-MAD-pam-get-signatures-2

get_signatures(res, k = 4)

plot of chunk tab-MAD-pam-get-signatures-3

get_signatures(res, k = 5)

plot of chunk tab-MAD-pam-get-signatures-4

get_signatures(res, k = 6)

plot of chunk tab-MAD-pam-get-signatures-5

Signature heatmaps where rows are not scaled:

get_signatures(res, k = 2, scale_rows = FALSE)

plot of chunk tab-MAD-pam-get-signatures-no-scale-1

get_signatures(res, k = 3, scale_rows = FALSE)

plot of chunk tab-MAD-pam-get-signatures-no-scale-2

get_signatures(res, k = 4, scale_rows = FALSE)

plot of chunk tab-MAD-pam-get-signatures-no-scale-3

get_signatures(res, k = 5, scale_rows = FALSE)

plot of chunk tab-MAD-pam-get-signatures-no-scale-4

get_signatures(res, k = 6, scale_rows = FALSE)

plot of chunk tab-MAD-pam-get-signatures-no-scale-5

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk MAD-pam-signature_compare

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:

  1. which_row: row indices corresponding to the input matrix.
  2. fdr: FDR for the differential test.
  3. mean_x: The mean value in group x.
  4. scaled_mean_x: The mean value in group x after rows are scaled.
  5. 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")

plot of chunk tab-MAD-pam-dimension-reduction-1

dimension_reduction(res, k = 3, method = "UMAP")

plot of chunk tab-MAD-pam-dimension-reduction-2

dimension_reduction(res, k = 4, method = "UMAP")

plot of chunk tab-MAD-pam-dimension-reduction-3

dimension_reduction(res, k = 5, method = "UMAP")

plot of chunk tab-MAD-pam-dimension-reduction-4

dimension_reduction(res, k = 6, method = "UMAP")

plot of chunk tab-MAD-pam-dimension-reduction-5

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk MAD-pam-collect-classes

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  time(p) k
#> MAD:pam 71 7.38e-06 2
#> MAD:pam 69 2.65e-07 3
#> MAD:pam 73 3.63e-04 4
#> MAD:pam 73 2.54e-05 5
#> MAD:pam 66 1.70e-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.


MAD:mclust

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 7758 rows and 79 columns.
#>   Top rows (776, 1552, 2328, 3103, 3879) 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)

plot of chunk MAD-mclust-collect-plots

The plots are:

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:

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)

plot of chunk MAD-mclust-select-partition-number

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.531           0.930       0.930         0.4653 0.498   0.498
#> 3 3 0.537           0.722       0.870         0.2812 0.620   0.395
#> 4 4 0.815           0.881       0.933         0.2440 0.783   0.487
#> 5 5 0.884           0.828       0.916         0.0646 0.897   0.636
#> 6 6 0.805           0.701       0.839         0.0353 0.920   0.653

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.

show/hide code output

cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#>          class entropy silhouette    p1    p2
#> GSM35441     2  0.0000      0.966 0.000 1.000
#> GSM35446     2  0.2778      0.958 0.048 0.952
#> GSM35449     2  0.0000      0.966 0.000 1.000
#> GSM35455     2  0.0000      0.966 0.000 1.000
#> GSM35458     2  0.2778      0.958 0.048 0.952
#> GSM35460     2  0.2778      0.958 0.048 0.952
#> GSM35461     1  0.6148      0.933 0.848 0.152
#> GSM35463     2  0.0000      0.966 0.000 1.000
#> GSM35472     2  0.2948      0.955 0.052 0.948
#> GSM35475     2  0.2778      0.958 0.048 0.952
#> GSM35483     2  0.0000      0.966 0.000 1.000
#> GSM35496     1  0.6148      0.933 0.848 0.152
#> GSM35497     2  0.0000      0.966 0.000 1.000
#> GSM35504     2  0.2778      0.958 0.048 0.952
#> GSM35508     2  0.0000      0.966 0.000 1.000
#> GSM35511     2  0.2778      0.958 0.048 0.952
#> GSM35512     2  0.2948      0.955 0.052 0.948
#> GSM35515     2  0.2778      0.958 0.048 0.952
#> GSM35519     2  0.2778      0.958 0.048 0.952
#> GSM35527     2  0.0000      0.966 0.000 1.000
#> GSM35532     2  0.2778      0.958 0.048 0.952
#> GSM35439     2  0.0000      0.966 0.000 1.000
#> GSM35443     1  0.1843      0.890 0.972 0.028
#> GSM35445     1  0.5629      0.931 0.868 0.132
#> GSM35448     2  0.2778      0.958 0.048 0.952
#> GSM35451     1  0.6048      0.934 0.852 0.148
#> GSM35454     1  0.6148      0.933 0.848 0.152
#> GSM35457     2  0.0000      0.966 0.000 1.000
#> GSM35465     2  0.0000      0.966 0.000 1.000
#> GSM35468     1  0.0000      0.878 1.000 0.000
#> GSM35471     1  0.6148      0.933 0.848 0.152
#> GSM35473     1  0.0000      0.878 1.000 0.000
#> GSM35477     1  0.5946      0.935 0.856 0.144
#> GSM35480     1  0.5946      0.935 0.856 0.144
#> GSM35482     1  0.6148      0.933 0.848 0.152
#> GSM35485     2  0.0000      0.966 0.000 1.000
#> GSM35489     2  0.0000      0.966 0.000 1.000
#> GSM35492     1  0.0000      0.878 1.000 0.000
#> GSM35495     1  0.6148      0.933 0.848 0.152
#> GSM35499     2  0.1414      0.964 0.020 0.980
#> GSM35502     1  0.0000      0.878 1.000 0.000
#> GSM35505     1  0.6887      0.901 0.816 0.184
#> GSM35507     1  0.6148      0.933 0.848 0.152
#> GSM35510     2  0.0376      0.966 0.004 0.996
#> GSM35514     1  0.0000      0.878 1.000 0.000
#> GSM35517     2  0.0000      0.966 0.000 1.000
#> GSM35520     2  0.2778      0.958 0.048 0.952
#> GSM35523     1  0.6148      0.933 0.848 0.152
#> GSM35529     2  0.0000      0.966 0.000 1.000
#> GSM35531     2  0.2778      0.958 0.048 0.952
#> GSM35534     2  0.0000      0.966 0.000 1.000
#> GSM35536     1  0.0000      0.878 1.000 0.000
#> GSM35538     1  0.5946      0.935 0.856 0.144
#> GSM35539     1  0.5946      0.935 0.856 0.144
#> GSM35540     2  0.2423      0.960 0.040 0.960
#> GSM35541     2  0.0000      0.966 0.000 1.000
#> GSM35442     1  0.6048      0.934 0.852 0.148
#> GSM35447     2  0.8608      0.564 0.284 0.716
#> GSM35450     1  0.5946      0.935 0.856 0.144
#> GSM35453     1  0.5946      0.935 0.856 0.144
#> GSM35456     1  0.6148      0.933 0.848 0.152
#> GSM35464     1  0.8443      0.781 0.728 0.272
#> GSM35467     1  0.0000      0.878 1.000 0.000
#> GSM35470     1  0.6048      0.934 0.852 0.148
#> GSM35479     1  0.6148      0.933 0.848 0.152
#> GSM35484     1  0.0672      0.882 0.992 0.008
#> GSM35488     1  0.0000      0.878 1.000 0.000
#> GSM35491     1  0.0000      0.878 1.000 0.000
#> GSM35494     1  0.6148      0.933 0.848 0.152
#> GSM35498     1  0.6148      0.933 0.848 0.152
#> GSM35501     1  0.0000      0.878 1.000 0.000
#> GSM35509     1  0.6148      0.933 0.848 0.152
#> GSM35513     1  0.0000      0.878 1.000 0.000
#> GSM35516     2  0.0000      0.966 0.000 1.000
#> GSM35522     1  0.6148      0.933 0.848 0.152
#> GSM35525     1  0.5946      0.935 0.856 0.144
#> GSM35528     1  0.5946      0.935 0.856 0.144
#> GSM35533     1  0.2603      0.898 0.956 0.044
#> GSM35537     1  0.5946      0.935 0.856 0.144

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>          class entropy silhouette    p1    p2    p3
#> GSM35441     2  0.0000     0.9086 0.000 1.000 0.000
#> GSM35446     3  0.0592     0.7972 0.000 0.012 0.988
#> GSM35449     2  0.0000     0.9086 0.000 1.000 0.000
#> GSM35455     2  0.0000     0.9086 0.000 1.000 0.000
#> GSM35458     3  0.5016     0.6968 0.000 0.240 0.760
#> GSM35460     3  0.0592     0.7972 0.000 0.012 0.988
#> GSM35461     3  0.0000     0.7977 0.000 0.000 1.000
#> GSM35463     2  0.0000     0.9086 0.000 1.000 0.000
#> GSM35472     3  0.0592     0.7972 0.000 0.012 0.988
#> GSM35475     3  0.4842     0.7071 0.000 0.224 0.776
#> GSM35483     2  0.1529     0.8930 0.000 0.960 0.040
#> GSM35496     3  0.0000     0.7977 0.000 0.000 1.000
#> GSM35497     2  0.0000     0.9086 0.000 1.000 0.000
#> GSM35504     3  0.5016     0.6968 0.000 0.240 0.760
#> GSM35508     2  0.5733     0.5078 0.000 0.676 0.324
#> GSM35511     3  0.0592     0.7972 0.000 0.012 0.988
#> GSM35512     3  0.0592     0.7972 0.000 0.012 0.988
#> GSM35515     3  0.5016     0.6968 0.000 0.240 0.760
#> GSM35519     3  0.0747     0.7967 0.000 0.016 0.984
#> GSM35527     2  0.4235     0.7780 0.000 0.824 0.176
#> GSM35532     3  0.0592     0.7972 0.000 0.012 0.988
#> GSM35439     2  0.1289     0.8978 0.000 0.968 0.032
#> GSM35443     1  0.5905     0.4214 0.648 0.000 0.352
#> GSM35445     3  0.6192     0.3312 0.420 0.000 0.580
#> GSM35448     3  0.0592     0.7972 0.000 0.012 0.988
#> GSM35451     3  0.5098     0.7108 0.248 0.000 0.752
#> GSM35454     3  0.0000     0.7977 0.000 0.000 1.000
#> GSM35457     2  0.0000     0.9086 0.000 1.000 0.000
#> GSM35465     2  0.3816     0.8071 0.000 0.852 0.148
#> GSM35468     1  0.0000     0.7782 1.000 0.000 0.000
#> GSM35471     3  0.5016     0.7178 0.240 0.000 0.760
#> GSM35473     1  0.2878     0.7375 0.904 0.000 0.096
#> GSM35477     3  0.5216     0.6969 0.260 0.000 0.740
#> GSM35480     3  0.5948     0.4958 0.360 0.000 0.640
#> GSM35482     3  0.0000     0.7977 0.000 0.000 1.000
#> GSM35485     2  0.0000     0.9086 0.000 1.000 0.000
#> GSM35489     2  0.0000     0.9086 0.000 1.000 0.000
#> GSM35492     1  0.0592     0.7761 0.988 0.000 0.012
#> GSM35495     3  0.0000     0.7977 0.000 0.000 1.000
#> GSM35499     2  0.5988     0.3987 0.000 0.632 0.368
#> GSM35502     1  0.0000     0.7782 1.000 0.000 0.000
#> GSM35505     3  0.0237     0.7980 0.000 0.004 0.996
#> GSM35507     3  0.5201     0.7199 0.236 0.004 0.760
#> GSM35510     2  0.4452     0.7488 0.000 0.808 0.192
#> GSM35514     1  0.0000     0.7782 1.000 0.000 0.000
#> GSM35517     2  0.0000     0.9086 0.000 1.000 0.000
#> GSM35520     3  0.5016     0.6968 0.000 0.240 0.760
#> GSM35523     3  0.5098     0.7108 0.248 0.000 0.752
#> GSM35529     2  0.0000     0.9086 0.000 1.000 0.000
#> GSM35531     3  0.5016     0.6968 0.000 0.240 0.760
#> GSM35534     2  0.1753     0.8884 0.000 0.952 0.048
#> GSM35536     1  0.0000     0.7782 1.000 0.000 0.000
#> GSM35538     1  0.6260     0.1540 0.552 0.000 0.448
#> GSM35539     3  0.5760     0.5783 0.328 0.000 0.672
#> GSM35540     3  0.5098     0.6898 0.000 0.248 0.752
#> GSM35541     2  0.0000     0.9086 0.000 1.000 0.000
#> GSM35442     3  0.4974     0.7230 0.236 0.000 0.764
#> GSM35447     3  0.0237     0.7980 0.000 0.004 0.996
#> GSM35450     1  0.6299     0.0617 0.524 0.000 0.476
#> GSM35453     3  0.5138     0.7102 0.252 0.000 0.748
#> GSM35456     3  0.5058     0.7144 0.244 0.000 0.756
#> GSM35464     3  0.6168     0.7183 0.224 0.036 0.740
#> GSM35467     1  0.0000     0.7782 1.000 0.000 0.000
#> GSM35470     3  0.5016     0.7178 0.240 0.000 0.760
#> GSM35479     3  0.0000     0.7977 0.000 0.000 1.000
#> GSM35484     1  0.3551     0.7120 0.868 0.000 0.132
#> GSM35488     1  0.0000     0.7782 1.000 0.000 0.000
#> GSM35491     1  0.0000     0.7782 1.000 0.000 0.000
#> GSM35494     3  0.0000     0.7977 0.000 0.000 1.000
#> GSM35498     3  0.5098     0.7108 0.248 0.000 0.752
#> GSM35501     1  0.0000     0.7782 1.000 0.000 0.000
#> GSM35509     3  0.0000     0.7977 0.000 0.000 1.000
#> GSM35513     1  0.0000     0.7782 1.000 0.000 0.000
#> GSM35516     2  0.0592     0.9047 0.000 0.988 0.012
#> GSM35522     3  0.5098     0.7108 0.248 0.000 0.752
#> GSM35525     1  0.6299     0.0600 0.524 0.000 0.476
#> GSM35528     1  0.6308    -0.0190 0.508 0.000 0.492
#> GSM35533     1  0.6026     0.3660 0.624 0.000 0.376
#> GSM35537     3  0.5098     0.7108 0.248 0.000 0.752

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>          class entropy silhouette    p1    p2    p3    p4
#> GSM35441     2  0.0000      0.941 0.000 1.000 0.000 0.000
#> GSM35446     3  0.0336      0.918 0.008 0.000 0.992 0.000
#> GSM35449     2  0.0000      0.941 0.000 1.000 0.000 0.000
#> GSM35455     2  0.0000      0.941 0.000 1.000 0.000 0.000
#> GSM35458     3  0.0804      0.917 0.008 0.012 0.980 0.000
#> GSM35460     3  0.0336      0.918 0.008 0.000 0.992 0.000
#> GSM35461     3  0.3351      0.884 0.148 0.000 0.844 0.008
#> GSM35463     2  0.0000      0.941 0.000 1.000 0.000 0.000
#> GSM35472     3  0.0188      0.918 0.004 0.000 0.996 0.000
#> GSM35475     3  0.0804      0.917 0.008 0.012 0.980 0.000
#> GSM35483     2  0.0188      0.941 0.000 0.996 0.004 0.000
#> GSM35496     3  0.3324      0.889 0.136 0.000 0.852 0.012
#> GSM35497     2  0.0000      0.941 0.000 1.000 0.000 0.000
#> GSM35504     2  0.4382      0.592 0.000 0.704 0.296 0.000
#> GSM35508     2  0.0188      0.940 0.000 0.996 0.004 0.000
#> GSM35511     3  0.0657      0.917 0.012 0.004 0.984 0.000
#> GSM35512     3  0.0469      0.917 0.012 0.000 0.988 0.000
#> GSM35515     3  0.0804      0.917 0.008 0.012 0.980 0.000
#> GSM35519     3  0.0657      0.917 0.012 0.004 0.984 0.000
#> GSM35527     2  0.0000      0.941 0.000 1.000 0.000 0.000
#> GSM35532     3  0.0657      0.917 0.012 0.004 0.984 0.000
#> GSM35439     2  0.0188      0.941 0.000 0.996 0.004 0.000
#> GSM35443     1  0.2924      0.839 0.884 0.000 0.100 0.016
#> GSM35445     1  0.7566      0.311 0.480 0.000 0.228 0.292
#> GSM35448     3  0.0927      0.916 0.008 0.016 0.976 0.000
#> GSM35451     4  0.0188      0.925 0.004 0.000 0.000 0.996
#> GSM35454     3  0.3674      0.896 0.116 0.000 0.848 0.036
#> GSM35457     2  0.0000      0.941 0.000 1.000 0.000 0.000
#> GSM35465     2  0.0188      0.939 0.000 0.996 0.004 0.000
#> GSM35468     1  0.0707      0.928 0.980 0.000 0.000 0.020
#> GSM35471     4  0.0000      0.924 0.000 0.000 0.000 1.000
#> GSM35473     1  0.1724      0.907 0.948 0.000 0.032 0.020
#> GSM35477     4  0.0592      0.921 0.016 0.000 0.000 0.984
#> GSM35480     4  0.2530      0.832 0.112 0.000 0.000 0.888
#> GSM35482     3  0.3674      0.896 0.116 0.000 0.848 0.036
#> GSM35485     2  0.0188      0.941 0.000 0.996 0.004 0.000
#> GSM35489     2  0.0188      0.941 0.000 0.996 0.004 0.000
#> GSM35492     1  0.0895      0.926 0.976 0.000 0.004 0.020
#> GSM35495     3  0.3674      0.896 0.116 0.000 0.848 0.036
#> GSM35499     2  0.0817      0.926 0.000 0.976 0.024 0.000
#> GSM35502     1  0.0707      0.928 0.980 0.000 0.000 0.020
#> GSM35505     3  0.2675      0.908 0.100 0.000 0.892 0.008
#> GSM35507     4  0.0376      0.923 0.004 0.004 0.000 0.992
#> GSM35510     2  0.0188      0.939 0.000 0.996 0.004 0.000
#> GSM35514     1  0.0707      0.928 0.980 0.000 0.000 0.020
#> GSM35517     2  0.0000      0.941 0.000 1.000 0.000 0.000
#> GSM35520     3  0.0927      0.916 0.008 0.016 0.976 0.000
#> GSM35523     4  0.0000      0.924 0.000 0.000 0.000 1.000
#> GSM35529     2  0.0000      0.941 0.000 1.000 0.000 0.000
#> GSM35531     2  0.4564      0.560 0.000 0.672 0.328 0.000
#> GSM35534     2  0.0188      0.941 0.000 0.996 0.004 0.000
#> GSM35536     1  0.0707      0.928 0.980 0.000 0.000 0.020
#> GSM35538     4  0.2081      0.883 0.084 0.000 0.000 0.916
#> GSM35539     4  0.0000      0.924 0.000 0.000 0.000 1.000
#> GSM35540     2  0.4040      0.676 0.000 0.752 0.248 0.000
#> GSM35541     2  0.0000      0.941 0.000 1.000 0.000 0.000
#> GSM35442     3  0.3479      0.876 0.148 0.000 0.840 0.012
#> GSM35447     3  0.1211      0.919 0.040 0.000 0.960 0.000
#> GSM35450     4  0.1118      0.911 0.036 0.000 0.000 0.964
#> GSM35453     3  0.3711      0.872 0.140 0.000 0.836 0.024
#> GSM35456     4  0.0188      0.925 0.004 0.000 0.000 0.996
#> GSM35464     2  0.4560      0.569 0.004 0.700 0.000 0.296
#> GSM35467     1  0.0707      0.928 0.980 0.000 0.000 0.020
#> GSM35470     4  0.6717      0.279 0.108 0.000 0.332 0.560
#> GSM35479     3  0.3674      0.896 0.116 0.000 0.848 0.036
#> GSM35484     1  0.2048      0.899 0.928 0.000 0.008 0.064
#> GSM35488     1  0.0707      0.928 0.980 0.000 0.000 0.020
#> GSM35491     1  0.0707      0.928 0.980 0.000 0.000 0.020
#> GSM35494     3  0.3674      0.896 0.116 0.000 0.848 0.036
#> GSM35498     4  0.0188      0.925 0.004 0.000 0.000 0.996
#> GSM35501     1  0.0707      0.928 0.980 0.000 0.000 0.020
#> GSM35509     3  0.3674      0.896 0.116 0.000 0.848 0.036
#> GSM35513     1  0.0707      0.928 0.980 0.000 0.000 0.020
#> GSM35516     2  0.0188      0.941 0.000 0.996 0.004 0.000
#> GSM35522     4  0.0000      0.924 0.000 0.000 0.000 1.000
#> GSM35525     4  0.2921      0.819 0.140 0.000 0.000 0.860
#> GSM35528     4  0.1557      0.903 0.056 0.000 0.000 0.944
#> GSM35533     1  0.4882      0.629 0.708 0.000 0.020 0.272
#> GSM35537     4  0.1474      0.894 0.052 0.000 0.000 0.948

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>          class entropy silhouette    p1    p2    p3    p4    p5
#> GSM35441     2  0.0000     0.9590 0.000 1.000 0.000 0.000 0.000
#> GSM35446     5  0.2648     0.7953 0.000 0.000 0.152 0.000 0.848
#> GSM35449     2  0.1608     0.9525 0.000 0.928 0.072 0.000 0.000
#> GSM35455     2  0.0162     0.9589 0.000 0.996 0.004 0.000 0.000
#> GSM35458     5  0.0000     0.8684 0.000 0.000 0.000 0.000 1.000
#> GSM35460     5  0.4302     0.0805 0.000 0.000 0.480 0.000 0.520
#> GSM35461     3  0.6700     0.2688 0.252 0.000 0.416 0.000 0.332
#> GSM35463     2  0.0000     0.9590 0.000 1.000 0.000 0.000 0.000
#> GSM35472     5  0.2605     0.7986 0.000 0.000 0.148 0.000 0.852
#> GSM35475     5  0.0000     0.8684 0.000 0.000 0.000 0.000 1.000
#> GSM35483     2  0.0000     0.9590 0.000 1.000 0.000 0.000 0.000
#> GSM35496     3  0.1792     0.8646 0.000 0.000 0.916 0.000 0.084
#> GSM35497     2  0.0000     0.9590 0.000 1.000 0.000 0.000 0.000
#> GSM35504     2  0.1851     0.9488 0.000 0.912 0.088 0.000 0.000
#> GSM35508     2  0.1892     0.9501 0.000 0.916 0.080 0.000 0.004
#> GSM35511     5  0.0162     0.8702 0.000 0.000 0.004 0.000 0.996
#> GSM35512     5  0.0963     0.8605 0.000 0.000 0.036 0.000 0.964
#> GSM35515     5  0.0000     0.8684 0.000 0.000 0.000 0.000 1.000
#> GSM35519     5  0.0162     0.8702 0.000 0.000 0.004 0.000 0.996
#> GSM35527     2  0.1792     0.9504 0.000 0.916 0.084 0.000 0.000
#> GSM35532     5  0.0162     0.8702 0.000 0.000 0.004 0.000 0.996
#> GSM35439     2  0.0000     0.9590 0.000 1.000 0.000 0.000 0.000
#> GSM35443     1  0.1197     0.8785 0.952 0.000 0.048 0.000 0.000
#> GSM35445     1  0.0955     0.8988 0.968 0.000 0.004 0.028 0.000
#> GSM35448     5  0.2648     0.7953 0.000 0.000 0.152 0.000 0.848
#> GSM35451     4  0.0000     0.8913 0.000 0.000 0.000 1.000 0.000
#> GSM35454     3  0.1792     0.8646 0.000 0.000 0.916 0.000 0.084
#> GSM35457     2  0.1792     0.9504 0.000 0.916 0.084 0.000 0.000
#> GSM35465     2  0.1792     0.9504 0.000 0.916 0.084 0.000 0.000
#> GSM35468     1  0.0000     0.9118 1.000 0.000 0.000 0.000 0.000
#> GSM35471     4  0.0000     0.8913 0.000 0.000 0.000 1.000 0.000
#> GSM35473     1  0.0000     0.9118 1.000 0.000 0.000 0.000 0.000
#> GSM35477     4  0.0000     0.8913 0.000 0.000 0.000 1.000 0.000
#> GSM35480     1  0.3661     0.6094 0.724 0.000 0.000 0.276 0.000
#> GSM35482     3  0.1792     0.8646 0.000 0.000 0.916 0.000 0.084
#> GSM35485     2  0.0000     0.9590 0.000 1.000 0.000 0.000 0.000
#> GSM35489     2  0.0000     0.9590 0.000 1.000 0.000 0.000 0.000
#> GSM35492     1  0.0000     0.9118 1.000 0.000 0.000 0.000 0.000
#> GSM35495     3  0.1792     0.8646 0.000 0.000 0.916 0.000 0.084
#> GSM35499     2  0.1792     0.9504 0.000 0.916 0.084 0.000 0.000
#> GSM35502     1  0.0000     0.9118 1.000 0.000 0.000 0.000 0.000
#> GSM35505     3  0.4283     0.1652 0.000 0.000 0.544 0.000 0.456
#> GSM35507     4  0.0000     0.8913 0.000 0.000 0.000 1.000 0.000
#> GSM35510     2  0.1792     0.9504 0.000 0.916 0.084 0.000 0.000
#> GSM35514     1  0.0000     0.9118 1.000 0.000 0.000 0.000 0.000
#> GSM35517     2  0.0000     0.9590 0.000 1.000 0.000 0.000 0.000
#> GSM35520     5  0.0162     0.8702 0.000 0.000 0.004 0.000 0.996
#> GSM35523     4  0.0000     0.8913 0.000 0.000 0.000 1.000 0.000
#> GSM35529     2  0.1792     0.9504 0.000 0.916 0.084 0.000 0.000
#> GSM35531     2  0.2813     0.7956 0.000 0.832 0.000 0.000 0.168
#> GSM35534     2  0.0162     0.9570 0.000 0.996 0.000 0.000 0.004
#> GSM35536     1  0.0000     0.9118 1.000 0.000 0.000 0.000 0.000
#> GSM35538     1  0.4268     0.1866 0.556 0.000 0.000 0.444 0.000
#> GSM35539     4  0.0290     0.8883 0.008 0.000 0.000 0.992 0.000
#> GSM35540     2  0.1851     0.9488 0.000 0.912 0.088 0.000 0.000
#> GSM35541     2  0.0000     0.9590 0.000 1.000 0.000 0.000 0.000
#> GSM35442     1  0.5654     0.1135 0.536 0.000 0.380 0.000 0.084
#> GSM35447     5  0.3816     0.5311 0.000 0.000 0.304 0.000 0.696
#> GSM35450     4  0.0963     0.8725 0.036 0.000 0.000 0.964 0.000
#> GSM35453     1  0.1952     0.8320 0.912 0.000 0.004 0.000 0.084
#> GSM35456     4  0.0000     0.8913 0.000 0.000 0.000 1.000 0.000
#> GSM35464     4  0.3949     0.4691 0.000 0.332 0.000 0.668 0.000
#> GSM35467     1  0.0000     0.9118 1.000 0.000 0.000 0.000 0.000
#> GSM35470     4  0.6299     0.0327 0.416 0.000 0.152 0.432 0.000
#> GSM35479     3  0.1792     0.8646 0.000 0.000 0.916 0.000 0.084
#> GSM35484     1  0.0162     0.9102 0.996 0.000 0.000 0.004 0.000
#> GSM35488     1  0.0000     0.9118 1.000 0.000 0.000 0.000 0.000
#> GSM35491     1  0.0000     0.9118 1.000 0.000 0.000 0.000 0.000
#> GSM35494     3  0.1792     0.8646 0.000 0.000 0.916 0.000 0.084
#> GSM35498     4  0.0000     0.8913 0.000 0.000 0.000 1.000 0.000
#> GSM35501     1  0.0000     0.9118 1.000 0.000 0.000 0.000 0.000
#> GSM35509     3  0.1792     0.8646 0.000 0.000 0.916 0.000 0.084
#> GSM35513     1  0.0000     0.9118 1.000 0.000 0.000 0.000 0.000
#> GSM35516     2  0.0000     0.9590 0.000 1.000 0.000 0.000 0.000
#> GSM35522     4  0.0000     0.8913 0.000 0.000 0.000 1.000 0.000
#> GSM35525     1  0.2179     0.8259 0.888 0.000 0.000 0.112 0.000
#> GSM35528     4  0.2377     0.7920 0.128 0.000 0.000 0.872 0.000
#> GSM35533     1  0.1121     0.8889 0.956 0.000 0.000 0.044 0.000
#> GSM35537     4  0.2471     0.7838 0.136 0.000 0.000 0.864 0.000

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>          class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM35441     2  0.3330    0.71769 0.000 0.716 0.000 0.000 0.000 0.284
#> GSM35446     5  0.2542    0.84144 0.000 0.000 0.080 0.000 0.876 0.044
#> GSM35449     2  0.3126    0.73644 0.000 0.752 0.000 0.000 0.000 0.248
#> GSM35455     2  0.3330    0.71769 0.000 0.716 0.000 0.000 0.000 0.284
#> GSM35458     6  0.3634    0.25075 0.000 0.000 0.000 0.000 0.356 0.644
#> GSM35460     5  0.4530    0.38652 0.000 0.000 0.356 0.000 0.600 0.044
#> GSM35461     3  0.5990    0.30931 0.224 0.000 0.500 0.000 0.268 0.008
#> GSM35463     2  0.3390    0.69660 0.000 0.704 0.000 0.000 0.000 0.296
#> GSM35472     5  0.1714    0.84838 0.000 0.000 0.092 0.000 0.908 0.000
#> GSM35475     6  0.3782    0.15425 0.000 0.000 0.000 0.000 0.412 0.588
#> GSM35483     6  0.3706    0.31312 0.000 0.380 0.000 0.000 0.000 0.620
#> GSM35496     3  0.0551    0.78700 0.004 0.000 0.984 0.000 0.004 0.008
#> GSM35497     2  0.3330    0.71769 0.000 0.716 0.000 0.000 0.000 0.284
#> GSM35504     2  0.2266    0.67242 0.000 0.880 0.000 0.000 0.012 0.108
#> GSM35508     2  0.0363    0.76790 0.000 0.988 0.000 0.000 0.000 0.012
#> GSM35511     5  0.1625    0.83159 0.000 0.000 0.012 0.000 0.928 0.060
#> GSM35512     5  0.0790    0.85885 0.000 0.000 0.032 0.000 0.968 0.000
#> GSM35515     6  0.3774    0.16406 0.000 0.000 0.000 0.000 0.408 0.592
#> GSM35519     5  0.2070    0.80802 0.000 0.000 0.012 0.000 0.896 0.092
#> GSM35527     2  0.0146    0.76745 0.000 0.996 0.000 0.000 0.000 0.004
#> GSM35532     5  0.0363    0.85456 0.000 0.000 0.012 0.000 0.988 0.000
#> GSM35439     6  0.3482    0.44622 0.000 0.316 0.000 0.000 0.000 0.684
#> GSM35443     1  0.0405    0.93223 0.988 0.000 0.000 0.000 0.004 0.008
#> GSM35445     1  0.1471    0.89787 0.932 0.000 0.064 0.004 0.000 0.000
#> GSM35448     5  0.2608    0.83975 0.000 0.000 0.080 0.000 0.872 0.048
#> GSM35451     4  0.0000    0.85158 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM35454     3  0.0000    0.79124 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM35457     2  0.2092    0.77188 0.000 0.876 0.000 0.000 0.000 0.124
#> GSM35465     2  0.0865    0.77623 0.000 0.964 0.000 0.000 0.000 0.036
#> GSM35468     1  0.0000    0.93558 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM35471     4  0.0000    0.85158 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM35473     1  0.0146    0.93520 0.996 0.000 0.000 0.004 0.000 0.000
#> GSM35477     4  0.0260    0.84853 0.000 0.000 0.000 0.992 0.000 0.008
#> GSM35480     1  0.3493    0.67198 0.756 0.000 0.008 0.228 0.000 0.008
#> GSM35482     3  0.0000    0.79124 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM35485     6  0.3634    0.38248 0.000 0.356 0.000 0.000 0.000 0.644
#> GSM35489     6  0.3592    0.40348 0.000 0.344 0.000 0.000 0.000 0.656
#> GSM35492     1  0.0000    0.93558 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM35495     3  0.0632    0.78130 0.000 0.000 0.976 0.000 0.000 0.024
#> GSM35499     2  0.0790    0.75063 0.000 0.968 0.000 0.000 0.000 0.032
#> GSM35502     1  0.0146    0.93520 0.996 0.000 0.000 0.004 0.000 0.000
#> GSM35505     3  0.4100    0.31548 0.004 0.000 0.600 0.000 0.388 0.008
#> GSM35507     4  0.0146    0.84853 0.000 0.004 0.000 0.996 0.000 0.000
#> GSM35510     2  0.1327    0.72802 0.000 0.936 0.000 0.000 0.000 0.064
#> GSM35514     1  0.0000    0.93558 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM35517     2  0.3330    0.71355 0.000 0.716 0.000 0.000 0.000 0.284
#> GSM35520     6  0.3907    0.15254 0.000 0.000 0.004 0.000 0.408 0.588
#> GSM35523     4  0.0000    0.85158 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM35529     2  0.1204    0.77798 0.000 0.944 0.000 0.000 0.000 0.056
#> GSM35531     6  0.2608    0.52424 0.000 0.080 0.000 0.000 0.048 0.872
#> GSM35534     6  0.3409    0.45801 0.000 0.300 0.000 0.000 0.000 0.700
#> GSM35536     1  0.0000    0.93558 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM35538     1  0.1196    0.90970 0.952 0.000 0.000 0.040 0.000 0.008
#> GSM35539     4  0.3945    0.36407 0.380 0.000 0.000 0.612 0.000 0.008
#> GSM35540     2  0.1802    0.71176 0.000 0.916 0.000 0.000 0.012 0.072
#> GSM35541     2  0.3351    0.70860 0.000 0.712 0.000 0.000 0.000 0.288
#> GSM35442     1  0.2573    0.82697 0.856 0.000 0.132 0.000 0.004 0.008
#> GSM35447     3  0.4269    0.28909 0.004 0.000 0.580 0.004 0.404 0.008
#> GSM35450     4  0.4051    0.22740 0.432 0.000 0.000 0.560 0.000 0.008
#> GSM35453     1  0.2191    0.84713 0.876 0.000 0.120 0.004 0.000 0.000
#> GSM35456     4  0.0000    0.85158 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM35464     4  0.3555    0.58212 0.000 0.176 0.000 0.780 0.000 0.044
#> GSM35467     1  0.0000    0.93558 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM35470     3  0.4989    0.42195 0.100 0.000 0.632 0.264 0.000 0.004
#> GSM35479     3  0.0000    0.79124 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM35484     1  0.0146    0.93520 0.996 0.000 0.000 0.004 0.000 0.000
#> GSM35488     1  0.0000    0.93558 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM35491     1  0.0000    0.93558 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM35494     3  0.0000    0.79124 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM35498     4  0.0000    0.85158 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM35501     1  0.0146    0.93520 0.996 0.000 0.000 0.004 0.000 0.000
#> GSM35509     3  0.0547    0.78359 0.000 0.000 0.980 0.000 0.000 0.020
#> GSM35513     1  0.0000    0.93558 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM35516     6  0.3620    0.39380 0.000 0.352 0.000 0.000 0.000 0.648
#> GSM35522     4  0.0000    0.85158 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM35525     1  0.0806    0.92496 0.972 0.000 0.000 0.020 0.000 0.008
#> GSM35528     1  0.4080   -0.00281 0.536 0.000 0.000 0.456 0.000 0.008
#> GSM35533     1  0.0937    0.91616 0.960 0.000 0.000 0.040 0.000 0.000
#> GSM35537     4  0.3419    0.73134 0.116 0.000 0.056 0.820 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)

plot of chunk tab-MAD-mclust-consensus-heatmap-1

consensus_heatmap(res, k = 3)

plot of chunk tab-MAD-mclust-consensus-heatmap-2

consensus_heatmap(res, k = 4)

plot of chunk tab-MAD-mclust-consensus-heatmap-3

consensus_heatmap(res, k = 5)

plot of chunk tab-MAD-mclust-consensus-heatmap-4

consensus_heatmap(res, k = 6)

plot of chunk tab-MAD-mclust-consensus-heatmap-5

Heatmaps for the membership of samples in all partitions to see how consistent they are:

membership_heatmap(res, k = 2)

plot of chunk tab-MAD-mclust-membership-heatmap-1

membership_heatmap(res, k = 3)

plot of chunk tab-MAD-mclust-membership-heatmap-2

membership_heatmap(res, k = 4)

plot of chunk tab-MAD-mclust-membership-heatmap-3

membership_heatmap(res, k = 5)

plot of chunk tab-MAD-mclust-membership-heatmap-4

membership_heatmap(res, k = 6)

plot of chunk tab-MAD-mclust-membership-heatmap-5

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)

plot of chunk tab-MAD-mclust-get-signatures-1

get_signatures(res, k = 3)

plot of chunk tab-MAD-mclust-get-signatures-2

get_signatures(res, k = 4)

plot of chunk tab-MAD-mclust-get-signatures-3

get_signatures(res, k = 5)

plot of chunk tab-MAD-mclust-get-signatures-4

get_signatures(res, k = 6)

plot of chunk tab-MAD-mclust-get-signatures-5

Signature heatmaps where rows are not scaled:

get_signatures(res, k = 2, scale_rows = FALSE)

plot of chunk tab-MAD-mclust-get-signatures-no-scale-1

get_signatures(res, k = 3, scale_rows = FALSE)

plot of chunk tab-MAD-mclust-get-signatures-no-scale-2

get_signatures(res, k = 4, scale_rows = FALSE)

plot of chunk tab-MAD-mclust-get-signatures-no-scale-3

get_signatures(res, k = 5, scale_rows = FALSE)

plot of chunk tab-MAD-mclust-get-signatures-no-scale-4

get_signatures(res, k = 6, scale_rows = FALSE)

plot of chunk tab-MAD-mclust-get-signatures-no-scale-5

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk MAD-mclust-signature_compare

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:

  1. which_row: row indices corresponding to the input matrix.
  2. fdr: FDR for the differential test.
  3. mean_x: The mean value in group x.
  4. scaled_mean_x: The mean value in group x after rows are scaled.
  5. 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")

plot of chunk tab-MAD-mclust-dimension-reduction-1

dimension_reduction(res, k = 3, method = "UMAP")

plot of chunk tab-MAD-mclust-dimension-reduction-2

dimension_reduction(res, k = 4, method = "UMAP")

plot of chunk tab-MAD-mclust-dimension-reduction-3

dimension_reduction(res, k = 5, method = "UMAP")

plot of chunk tab-MAD-mclust-dimension-reduction-4

dimension_reduction(res, k = 6, method = "UMAP")

plot of chunk tab-MAD-mclust-dimension-reduction-5

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk MAD-mclust-collect-classes

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  time(p) k
#> MAD:mclust 79 3.41e-07 2
#> MAD:mclust 70 2.12e-02 3
#> MAD:mclust 77 5.62e-04 4
#> MAD:mclust 72 2.19e-05 5
#> MAD:mclust 61 5.94e-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.


MAD:NMF**

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 7758 rows and 79 columns.
#>   Top rows (776, 1552, 2328, 3103, 3879) 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)

plot of chunk MAD-NMF-collect-plots

The plots are:

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:

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)

plot of chunk MAD-NMF-select-partition-number

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.973           0.941       0.978         0.5030 0.496   0.496
#> 3 3 0.892           0.913       0.957         0.3169 0.776   0.576
#> 4 4 0.645           0.661       0.825         0.1272 0.819   0.530
#> 5 5 0.611           0.592       0.768         0.0602 0.928   0.731
#> 6 6 0.619           0.481       0.701         0.0461 0.882   0.524

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.

show/hide code output

cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#>          class entropy silhouette    p1    p2
#> GSM35441     2  0.0000      0.968 0.000 1.000
#> GSM35446     2  0.0000      0.968 0.000 1.000
#> GSM35449     2  0.0000      0.968 0.000 1.000
#> GSM35455     2  0.0000      0.968 0.000 1.000
#> GSM35458     2  0.1414      0.952 0.020 0.980
#> GSM35460     2  0.0000      0.968 0.000 1.000
#> GSM35461     1  0.0000      0.983 1.000 0.000
#> GSM35463     2  0.0000      0.968 0.000 1.000
#> GSM35472     2  0.6623      0.779 0.172 0.828
#> GSM35475     2  0.0000      0.968 0.000 1.000
#> GSM35483     2  0.0000      0.968 0.000 1.000
#> GSM35496     1  0.0000      0.983 1.000 0.000
#> GSM35497     2  0.0000      0.968 0.000 1.000
#> GSM35504     2  0.0000      0.968 0.000 1.000
#> GSM35508     2  0.0000      0.968 0.000 1.000
#> GSM35511     2  0.0000      0.968 0.000 1.000
#> GSM35512     2  0.9954      0.157 0.460 0.540
#> GSM35515     2  0.1414      0.952 0.020 0.980
#> GSM35519     2  0.0000      0.968 0.000 1.000
#> GSM35527     2  0.0000      0.968 0.000 1.000
#> GSM35532     2  0.0000      0.968 0.000 1.000
#> GSM35439     2  0.0000      0.968 0.000 1.000
#> GSM35443     1  0.0000      0.983 1.000 0.000
#> GSM35445     1  0.0000      0.983 1.000 0.000
#> GSM35448     2  0.0000      0.968 0.000 1.000
#> GSM35451     1  0.0000      0.983 1.000 0.000
#> GSM35454     1  0.0000      0.983 1.000 0.000
#> GSM35457     2  0.0000      0.968 0.000 1.000
#> GSM35465     2  0.0000      0.968 0.000 1.000
#> GSM35468     1  0.0000      0.983 1.000 0.000
#> GSM35471     1  0.0000      0.983 1.000 0.000
#> GSM35473     1  0.0000      0.983 1.000 0.000
#> GSM35477     1  0.0000      0.983 1.000 0.000
#> GSM35480     1  0.0000      0.983 1.000 0.000
#> GSM35482     1  0.0000      0.983 1.000 0.000
#> GSM35485     2  0.0000      0.968 0.000 1.000
#> GSM35489     2  0.0000      0.968 0.000 1.000
#> GSM35492     1  0.0000      0.983 1.000 0.000
#> GSM35495     2  0.9850      0.260 0.428 0.572
#> GSM35499     2  0.0000      0.968 0.000 1.000
#> GSM35502     1  0.0000      0.983 1.000 0.000
#> GSM35505     1  0.0000      0.983 1.000 0.000
#> GSM35507     1  0.9129      0.496 0.672 0.328
#> GSM35510     2  0.0000      0.968 0.000 1.000
#> GSM35514     1  0.0000      0.983 1.000 0.000
#> GSM35517     2  0.0000      0.968 0.000 1.000
#> GSM35520     2  0.0000      0.968 0.000 1.000
#> GSM35523     1  0.0000      0.983 1.000 0.000
#> GSM35529     2  0.0000      0.968 0.000 1.000
#> GSM35531     2  0.0000      0.968 0.000 1.000
#> GSM35534     2  0.0000      0.968 0.000 1.000
#> GSM35536     1  0.0000      0.983 1.000 0.000
#> GSM35538     1  0.0000      0.983 1.000 0.000
#> GSM35539     1  0.0000      0.983 1.000 0.000
#> GSM35540     2  0.0000      0.968 0.000 1.000
#> GSM35541     2  0.0000      0.968 0.000 1.000
#> GSM35442     1  0.0000      0.983 1.000 0.000
#> GSM35447     1  0.0000      0.983 1.000 0.000
#> GSM35450     1  0.0000      0.983 1.000 0.000
#> GSM35453     1  0.0000      0.983 1.000 0.000
#> GSM35456     1  0.0000      0.983 1.000 0.000
#> GSM35464     2  0.0376      0.965 0.004 0.996
#> GSM35467     1  0.0000      0.983 1.000 0.000
#> GSM35470     1  0.0000      0.983 1.000 0.000
#> GSM35479     1  0.0000      0.983 1.000 0.000
#> GSM35484     1  0.0000      0.983 1.000 0.000
#> GSM35488     1  0.0000      0.983 1.000 0.000
#> GSM35491     1  0.0000      0.983 1.000 0.000
#> GSM35494     1  0.0000      0.983 1.000 0.000
#> GSM35498     1  0.0000      0.983 1.000 0.000
#> GSM35501     1  0.0000      0.983 1.000 0.000
#> GSM35509     1  0.9286      0.454 0.656 0.344
#> GSM35513     1  0.0000      0.983 1.000 0.000
#> GSM35516     2  0.0000      0.968 0.000 1.000
#> GSM35522     1  0.0000      0.983 1.000 0.000
#> GSM35525     1  0.0000      0.983 1.000 0.000
#> GSM35528     1  0.0000      0.983 1.000 0.000
#> GSM35533     1  0.0000      0.983 1.000 0.000
#> GSM35537     1  0.0000      0.983 1.000 0.000

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>          class entropy silhouette    p1    p2    p3
#> GSM35441     2  0.0237      0.961 0.000 0.996 0.004
#> GSM35446     3  0.0424      0.918 0.000 0.008 0.992
#> GSM35449     2  0.0237      0.961 0.000 0.996 0.004
#> GSM35455     2  0.0237      0.961 0.000 0.996 0.004
#> GSM35458     2  0.2269      0.936 0.016 0.944 0.040
#> GSM35460     3  0.0237      0.920 0.000 0.004 0.996
#> GSM35461     3  0.3686      0.844 0.140 0.000 0.860
#> GSM35463     2  0.0237      0.959 0.004 0.996 0.000
#> GSM35472     3  0.0237      0.920 0.000 0.004 0.996
#> GSM35475     3  0.5810      0.437 0.000 0.336 0.664
#> GSM35483     2  0.0424      0.960 0.000 0.992 0.008
#> GSM35496     3  0.1753      0.911 0.048 0.000 0.952
#> GSM35497     2  0.0237      0.961 0.000 0.996 0.004
#> GSM35504     2  0.2878      0.902 0.000 0.904 0.096
#> GSM35508     2  0.3038      0.895 0.000 0.896 0.104
#> GSM35511     3  0.0747      0.914 0.000 0.016 0.984
#> GSM35512     3  0.0000      0.921 0.000 0.000 1.000
#> GSM35515     2  0.3851      0.860 0.004 0.860 0.136
#> GSM35519     3  0.0237      0.920 0.000 0.004 0.996
#> GSM35527     2  0.1753      0.937 0.000 0.952 0.048
#> GSM35532     3  0.0237      0.920 0.000 0.004 0.996
#> GSM35439     2  0.0237      0.959 0.004 0.996 0.000
#> GSM35443     1  0.0424      0.965 0.992 0.000 0.008
#> GSM35445     1  0.0424      0.965 0.992 0.000 0.008
#> GSM35448     3  0.2448      0.865 0.000 0.076 0.924
#> GSM35451     1  0.1860      0.930 0.948 0.052 0.000
#> GSM35454     3  0.2959      0.882 0.100 0.000 0.900
#> GSM35457     2  0.0000      0.961 0.000 1.000 0.000
#> GSM35465     2  0.0000      0.961 0.000 1.000 0.000
#> GSM35468     1  0.0424      0.965 0.992 0.000 0.008
#> GSM35471     1  0.0892      0.956 0.980 0.020 0.000
#> GSM35473     1  0.0424      0.965 0.992 0.000 0.008
#> GSM35477     1  0.1289      0.947 0.968 0.032 0.000
#> GSM35480     1  0.0237      0.966 0.996 0.000 0.004
#> GSM35482     3  0.1860      0.909 0.052 0.000 0.948
#> GSM35485     2  0.0000      0.961 0.000 1.000 0.000
#> GSM35489     2  0.0237      0.959 0.004 0.996 0.000
#> GSM35492     1  0.0424      0.965 0.992 0.000 0.008
#> GSM35495     3  0.0237      0.921 0.004 0.000 0.996
#> GSM35499     2  0.0237      0.961 0.000 0.996 0.004
#> GSM35502     1  0.0237      0.966 0.996 0.000 0.004
#> GSM35505     3  0.0747      0.920 0.016 0.000 0.984
#> GSM35507     1  0.6111      0.379 0.604 0.396 0.000
#> GSM35510     2  0.0237      0.961 0.000 0.996 0.004
#> GSM35514     1  0.0237      0.966 0.996 0.000 0.004
#> GSM35517     2  0.0000      0.961 0.000 1.000 0.000
#> GSM35520     2  0.6008      0.455 0.000 0.628 0.372
#> GSM35523     1  0.0237      0.965 0.996 0.004 0.000
#> GSM35529     2  0.0237      0.961 0.000 0.996 0.004
#> GSM35531     2  0.0237      0.959 0.004 0.996 0.000
#> GSM35534     2  0.0424      0.960 0.000 0.992 0.008
#> GSM35536     1  0.0237      0.966 0.996 0.000 0.004
#> GSM35538     1  0.0237      0.965 0.996 0.004 0.000
#> GSM35539     1  0.0237      0.965 0.996 0.004 0.000
#> GSM35540     2  0.3619      0.866 0.000 0.864 0.136
#> GSM35541     2  0.0237      0.959 0.004 0.996 0.000
#> GSM35442     3  0.6045      0.432 0.380 0.000 0.620
#> GSM35447     3  0.0592      0.921 0.012 0.000 0.988
#> GSM35450     1  0.0237      0.965 0.996 0.004 0.000
#> GSM35453     1  0.1753      0.933 0.952 0.000 0.048
#> GSM35456     1  0.3116      0.875 0.892 0.108 0.000
#> GSM35464     2  0.0592      0.954 0.012 0.988 0.000
#> GSM35467     1  0.0237      0.966 0.996 0.000 0.004
#> GSM35470     1  0.3038      0.872 0.896 0.000 0.104
#> GSM35479     3  0.2356      0.900 0.072 0.000 0.928
#> GSM35484     1  0.0000      0.965 1.000 0.000 0.000
#> GSM35488     1  0.0000      0.965 1.000 0.000 0.000
#> GSM35491     1  0.0424      0.965 0.992 0.000 0.008
#> GSM35494     3  0.3116      0.875 0.108 0.000 0.892
#> GSM35498     1  0.1031      0.953 0.976 0.024 0.000
#> GSM35501     1  0.0237      0.966 0.996 0.000 0.004
#> GSM35509     3  0.0237      0.921 0.004 0.000 0.996
#> GSM35513     1  0.0237      0.966 0.996 0.000 0.004
#> GSM35516     2  0.0424      0.957 0.008 0.992 0.000
#> GSM35522     1  0.2625      0.901 0.916 0.084 0.000
#> GSM35525     1  0.0237      0.966 0.996 0.000 0.004
#> GSM35528     1  0.0237      0.965 0.996 0.004 0.000
#> GSM35533     1  0.0000      0.965 1.000 0.000 0.000
#> GSM35537     1  0.0747      0.960 0.984 0.000 0.016

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>          class entropy silhouette    p1    p2    p3    p4
#> GSM35441     2  0.1902     0.7595 0.000 0.932 0.004 0.064
#> GSM35446     3  0.1545     0.7605 0.000 0.040 0.952 0.008
#> GSM35449     2  0.2868     0.7063 0.000 0.864 0.000 0.136
#> GSM35455     2  0.1792     0.7562 0.000 0.932 0.000 0.068
#> GSM35458     2  0.5756     0.5888 0.176 0.728 0.084 0.012
#> GSM35460     3  0.1637     0.7684 0.000 0.000 0.940 0.060
#> GSM35461     3  0.5811     0.1380 0.468 0.012 0.508 0.012
#> GSM35463     2  0.4776     0.2562 0.000 0.624 0.000 0.376
#> GSM35472     3  0.1575     0.7587 0.012 0.028 0.956 0.004
#> GSM35475     2  0.6019     0.5835 0.128 0.716 0.144 0.012
#> GSM35483     2  0.0657     0.7671 0.000 0.984 0.004 0.012
#> GSM35496     3  0.1807     0.7712 0.008 0.000 0.940 0.052
#> GSM35497     2  0.0895     0.7677 0.000 0.976 0.004 0.020
#> GSM35504     2  0.6330    -0.1147 0.000 0.492 0.060 0.448
#> GSM35508     2  0.1488     0.7612 0.000 0.956 0.032 0.012
#> GSM35511     2  0.5919     0.2316 0.020 0.564 0.404 0.012
#> GSM35512     3  0.3909     0.7233 0.052 0.080 0.856 0.012
#> GSM35515     2  0.5981     0.5831 0.164 0.716 0.108 0.012
#> GSM35519     2  0.6746     0.1380 0.064 0.520 0.404 0.012
#> GSM35527     2  0.1211     0.7659 0.000 0.960 0.000 0.040
#> GSM35532     3  0.6012     0.1919 0.024 0.404 0.560 0.012
#> GSM35439     2  0.0921     0.7668 0.000 0.972 0.000 0.028
#> GSM35443     1  0.1890     0.8300 0.936 0.000 0.056 0.008
#> GSM35445     1  0.2589     0.8625 0.884 0.000 0.000 0.116
#> GSM35448     3  0.3706     0.7334 0.000 0.112 0.848 0.040
#> GSM35451     4  0.4883     0.4188 0.288 0.016 0.000 0.696
#> GSM35454     3  0.3658     0.7539 0.020 0.000 0.836 0.144
#> GSM35457     4  0.4994     0.1732 0.000 0.480 0.000 0.520
#> GSM35465     4  0.4454     0.5480 0.000 0.308 0.000 0.692
#> GSM35468     1  0.0188     0.8754 0.996 0.000 0.004 0.000
#> GSM35471     4  0.1585     0.6924 0.040 0.004 0.004 0.952
#> GSM35473     1  0.0707     0.8851 0.980 0.000 0.000 0.020
#> GSM35477     1  0.4661     0.6161 0.652 0.000 0.000 0.348
#> GSM35480     1  0.4576     0.7487 0.728 0.000 0.012 0.260
#> GSM35482     3  0.3172     0.7477 0.000 0.000 0.840 0.160
#> GSM35485     2  0.0707     0.7672 0.000 0.980 0.000 0.020
#> GSM35489     2  0.2216     0.7419 0.000 0.908 0.000 0.092
#> GSM35492     1  0.0469     0.8709 0.988 0.000 0.012 0.000
#> GSM35495     3  0.2647     0.7597 0.000 0.000 0.880 0.120
#> GSM35499     4  0.4713     0.4679 0.000 0.360 0.000 0.640
#> GSM35502     1  0.1302     0.8848 0.956 0.000 0.000 0.044
#> GSM35505     3  0.4305     0.6977 0.160 0.020 0.808 0.012
#> GSM35507     4  0.2563     0.7104 0.020 0.072 0.000 0.908
#> GSM35510     4  0.4761     0.4465 0.000 0.372 0.000 0.628
#> GSM35514     1  0.0592     0.8840 0.984 0.000 0.000 0.016
#> GSM35517     2  0.2011     0.7496 0.000 0.920 0.000 0.080
#> GSM35520     2  0.3623     0.6896 0.016 0.856 0.116 0.012
#> GSM35523     4  0.1629     0.6674 0.024 0.000 0.024 0.952
#> GSM35529     2  0.4164     0.5235 0.000 0.736 0.000 0.264
#> GSM35531     2  0.1139     0.7609 0.008 0.972 0.012 0.008
#> GSM35534     2  0.0188     0.7648 0.000 0.996 0.004 0.000
#> GSM35536     1  0.0921     0.8857 0.972 0.000 0.000 0.028
#> GSM35538     1  0.2647     0.8575 0.880 0.000 0.000 0.120
#> GSM35539     1  0.4790     0.5806 0.620 0.000 0.000 0.380
#> GSM35540     4  0.6876     0.4748 0.000 0.288 0.140 0.572
#> GSM35541     2  0.2469     0.7298 0.000 0.892 0.000 0.108
#> GSM35442     1  0.4382     0.4777 0.704 0.000 0.296 0.000
#> GSM35447     3  0.5767     0.6331 0.220 0.060 0.708 0.012
#> GSM35450     1  0.4008     0.7659 0.756 0.000 0.000 0.244
#> GSM35453     1  0.2996     0.8573 0.892 0.000 0.044 0.064
#> GSM35456     4  0.3080     0.6926 0.096 0.024 0.000 0.880
#> GSM35464     4  0.3831     0.6475 0.004 0.204 0.000 0.792
#> GSM35467     1  0.0592     0.8839 0.984 0.000 0.000 0.016
#> GSM35470     3  0.7367     0.2652 0.160 0.000 0.436 0.404
#> GSM35479     3  0.3942     0.6911 0.000 0.000 0.764 0.236
#> GSM35484     1  0.0921     0.8861 0.972 0.000 0.000 0.028
#> GSM35488     1  0.1211     0.8865 0.960 0.000 0.000 0.040
#> GSM35491     1  0.0524     0.8799 0.988 0.000 0.004 0.008
#> GSM35494     3  0.3649     0.7222 0.000 0.000 0.796 0.204
#> GSM35498     4  0.2048     0.6941 0.064 0.008 0.000 0.928
#> GSM35501     1  0.1474     0.8842 0.948 0.000 0.000 0.052
#> GSM35509     3  0.3486     0.7315 0.000 0.000 0.812 0.188
#> GSM35513     1  0.0188     0.8797 0.996 0.000 0.000 0.004
#> GSM35516     2  0.4790     0.2437 0.000 0.620 0.000 0.380
#> GSM35522     4  0.0967     0.6905 0.016 0.004 0.004 0.976
#> GSM35525     1  0.3726     0.7989 0.788 0.000 0.000 0.212
#> GSM35528     1  0.3907     0.7800 0.768 0.000 0.000 0.232
#> GSM35533     1  0.1557     0.8837 0.944 0.000 0.000 0.056
#> GSM35537     4  0.6726     0.0884 0.124 0.000 0.292 0.584

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>          class entropy silhouette    p1    p2    p3    p4    p5
#> GSM35441     5  0.3958     0.5667 0.000 0.040 0.000 0.184 0.776
#> GSM35446     3  0.2491     0.7673 0.000 0.036 0.896 0.000 0.068
#> GSM35449     5  0.3966     0.4248 0.000 0.000 0.000 0.336 0.664
#> GSM35455     5  0.3745     0.5692 0.000 0.024 0.000 0.196 0.780
#> GSM35458     5  0.3733     0.5308 0.160 0.004 0.032 0.000 0.804
#> GSM35460     3  0.1597     0.7772 0.000 0.024 0.948 0.008 0.020
#> GSM35461     3  0.6927     0.2036 0.372 0.000 0.384 0.008 0.236
#> GSM35463     2  0.3003     0.7457 0.000 0.864 0.000 0.044 0.092
#> GSM35472     3  0.2439     0.7407 0.004 0.000 0.876 0.000 0.120
#> GSM35475     5  0.3812     0.5391 0.128 0.008 0.048 0.000 0.816
#> GSM35483     2  0.3003     0.7504 0.000 0.812 0.000 0.000 0.188
#> GSM35496     3  0.1662     0.7709 0.004 0.000 0.936 0.004 0.056
#> GSM35497     5  0.2824     0.5954 0.000 0.020 0.000 0.116 0.864
#> GSM35504     2  0.5244     0.7051 0.000 0.740 0.048 0.100 0.112
#> GSM35508     5  0.2586     0.6022 0.000 0.012 0.012 0.084 0.892
#> GSM35511     5  0.4003     0.4266 0.008 0.000 0.288 0.000 0.704
#> GSM35512     3  0.3890     0.6127 0.012 0.000 0.736 0.000 0.252
#> GSM35515     5  0.3835     0.5274 0.156 0.000 0.048 0.000 0.796
#> GSM35519     5  0.5029     0.3316 0.060 0.000 0.292 0.000 0.648
#> GSM35527     5  0.3289     0.5865 0.000 0.008 0.004 0.172 0.816
#> GSM35532     5  0.4517     0.0490 0.008 0.000 0.436 0.000 0.556
#> GSM35439     5  0.4491     0.2668 0.000 0.328 0.000 0.020 0.652
#> GSM35443     1  0.2450     0.7711 0.896 0.000 0.028 0.000 0.076
#> GSM35445     1  0.5744     0.6596 0.652 0.228 0.020 0.100 0.000
#> GSM35448     2  0.3901     0.5273 0.000 0.776 0.196 0.004 0.024
#> GSM35451     4  0.5338     0.0869 0.392 0.040 0.000 0.560 0.008
#> GSM35454     3  0.6269     0.4210 0.012 0.364 0.512 0.112 0.000
#> GSM35457     4  0.4822     0.3303 0.000 0.032 0.000 0.616 0.352
#> GSM35465     4  0.3438     0.6252 0.000 0.020 0.000 0.808 0.172
#> GSM35468     1  0.0865     0.8222 0.972 0.000 0.000 0.004 0.024
#> GSM35471     4  0.3954     0.6230 0.060 0.048 0.060 0.832 0.000
#> GSM35473     1  0.2291     0.8225 0.908 0.036 0.000 0.056 0.000
#> GSM35477     1  0.4244     0.6734 0.712 0.016 0.000 0.268 0.004
#> GSM35480     1  0.5093     0.7298 0.732 0.060 0.036 0.172 0.000
#> GSM35482     3  0.2005     0.7723 0.000 0.004 0.924 0.056 0.016
#> GSM35485     2  0.3814     0.6874 0.000 0.720 0.000 0.004 0.276
#> GSM35489     5  0.5091     0.3905 0.000 0.236 0.000 0.088 0.676
#> GSM35492     1  0.1443     0.8101 0.948 0.000 0.004 0.004 0.044
#> GSM35495     3  0.2654     0.7599 0.000 0.084 0.884 0.032 0.000
#> GSM35499     2  0.4714     0.6645 0.000 0.724 0.000 0.192 0.084
#> GSM35502     1  0.0771     0.8297 0.976 0.004 0.000 0.020 0.000
#> GSM35505     3  0.5680     0.5446 0.016 0.340 0.596 0.012 0.036
#> GSM35507     4  0.2488     0.6748 0.004 0.000 0.000 0.872 0.124
#> GSM35510     4  0.6478    -0.1636 0.000 0.368 0.000 0.444 0.188
#> GSM35514     1  0.0451     0.8274 0.988 0.004 0.000 0.000 0.008
#> GSM35517     5  0.4990     0.2424 0.000 0.324 0.000 0.048 0.628
#> GSM35520     5  0.3543     0.5231 0.008 0.124 0.036 0.000 0.832
#> GSM35523     4  0.2703     0.6899 0.024 0.000 0.020 0.896 0.060
#> GSM35529     5  0.4987     0.3968 0.000 0.044 0.000 0.340 0.616
#> GSM35531     2  0.4806     0.4757 0.008 0.600 0.008 0.004 0.380
#> GSM35534     2  0.3074     0.7481 0.000 0.804 0.000 0.000 0.196
#> GSM35536     1  0.0451     0.8294 0.988 0.004 0.000 0.008 0.000
#> GSM35538     1  0.1908     0.8166 0.908 0.000 0.000 0.092 0.000
#> GSM35539     1  0.4713     0.3712 0.544 0.016 0.000 0.440 0.000
#> GSM35540     4  0.4957     0.5946 0.000 0.008 0.092 0.724 0.176
#> GSM35541     5  0.5216    -0.1354 0.000 0.436 0.000 0.044 0.520
#> GSM35442     1  0.4971     0.5362 0.704 0.000 0.212 0.004 0.080
#> GSM35447     3  0.6683     0.6145 0.076 0.204 0.624 0.012 0.084
#> GSM35450     1  0.3326     0.7812 0.824 0.024 0.000 0.152 0.000
#> GSM35453     1  0.4001     0.7902 0.820 0.024 0.056 0.100 0.000
#> GSM35456     4  0.4478     0.5916 0.144 0.088 0.000 0.764 0.004
#> GSM35464     4  0.2864     0.6615 0.000 0.012 0.000 0.852 0.136
#> GSM35467     1  0.0451     0.8274 0.988 0.004 0.000 0.000 0.008
#> GSM35470     4  0.6504     0.1293 0.196 0.000 0.356 0.448 0.000
#> GSM35479     3  0.2777     0.7335 0.000 0.016 0.864 0.120 0.000
#> GSM35484     1  0.3171     0.7499 0.816 0.176 0.000 0.008 0.000
#> GSM35488     1  0.0798     0.8294 0.976 0.000 0.000 0.016 0.008
#> GSM35491     1  0.0798     0.8281 0.976 0.000 0.000 0.008 0.016
#> GSM35494     3  0.3073     0.7357 0.004 0.024 0.856 0.116 0.000
#> GSM35498     4  0.2770     0.6933 0.044 0.000 0.000 0.880 0.076
#> GSM35501     1  0.1697     0.8241 0.932 0.008 0.000 0.060 0.000
#> GSM35509     3  0.2438     0.7611 0.000 0.040 0.900 0.060 0.000
#> GSM35513     1  0.0451     0.8274 0.988 0.004 0.000 0.000 0.008
#> GSM35516     2  0.5628     0.6575 0.000 0.624 0.000 0.132 0.244
#> GSM35522     4  0.2577     0.6911 0.016 0.000 0.008 0.892 0.084
#> GSM35525     1  0.3427     0.7609 0.796 0.012 0.000 0.192 0.000
#> GSM35528     1  0.5002     0.4385 0.612 0.000 0.000 0.344 0.044
#> GSM35533     1  0.5850     0.3570 0.476 0.428 0.000 0.096 0.000
#> GSM35537     4  0.6082     0.4276 0.140 0.020 0.216 0.624 0.000

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>          class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM35441     5  0.5260    0.51835 0.000 0.064 0.000 0.304 0.604 0.028
#> GSM35446     3  0.3997    0.68752 0.000 0.108 0.776 0.000 0.008 0.108
#> GSM35449     4  0.4684   -0.06568 0.000 0.008 0.000 0.520 0.444 0.028
#> GSM35455     5  0.2833    0.68362 0.000 0.012 0.000 0.148 0.836 0.004
#> GSM35458     5  0.2649    0.68111 0.036 0.012 0.000 0.000 0.880 0.072
#> GSM35460     3  0.2095    0.77029 0.000 0.016 0.904 0.000 0.004 0.076
#> GSM35461     6  0.4468    0.50868 0.060 0.000 0.076 0.000 0.100 0.764
#> GSM35463     2  0.2189    0.54165 0.000 0.904 0.000 0.032 0.060 0.004
#> GSM35472     3  0.4868    0.24492 0.000 0.008 0.560 0.004 0.036 0.392
#> GSM35475     5  0.3452    0.58461 0.004 0.004 0.000 0.000 0.736 0.256
#> GSM35483     2  0.4160    0.42409 0.008 0.684 0.000 0.000 0.284 0.024
#> GSM35496     3  0.2944    0.72072 0.000 0.012 0.832 0.000 0.008 0.148
#> GSM35497     5  0.2426    0.70122 0.000 0.012 0.000 0.092 0.884 0.012
#> GSM35504     2  0.6508    0.49451 0.000 0.556 0.236 0.056 0.136 0.016
#> GSM35508     5  0.3508    0.68783 0.000 0.016 0.004 0.100 0.828 0.052
#> GSM35511     5  0.3525    0.63744 0.000 0.004 0.068 0.000 0.808 0.120
#> GSM35512     6  0.4993    0.14711 0.000 0.000 0.360 0.000 0.080 0.560
#> GSM35515     5  0.2402    0.68369 0.032 0.012 0.000 0.000 0.896 0.060
#> GSM35519     6  0.5083    0.36349 0.000 0.004 0.120 0.000 0.244 0.632
#> GSM35527     5  0.3757    0.66800 0.000 0.016 0.000 0.164 0.784 0.036
#> GSM35532     5  0.5587    0.34418 0.000 0.004 0.252 0.000 0.564 0.180
#> GSM35439     5  0.4392    0.57631 0.024 0.188 0.000 0.012 0.744 0.032
#> GSM35443     6  0.3668    0.41281 0.256 0.008 0.000 0.000 0.008 0.728
#> GSM35445     1  0.6133    0.35584 0.484 0.352 0.016 0.008 0.000 0.140
#> GSM35448     2  0.4962    0.32882 0.000 0.608 0.320 0.000 0.060 0.012
#> GSM35451     4  0.5204    0.52720 0.128 0.072 0.000 0.700 0.000 0.100
#> GSM35454     2  0.5227   -0.15583 0.000 0.456 0.452 0.000 0.000 0.092
#> GSM35457     4  0.3395    0.54782 0.000 0.056 0.000 0.816 0.124 0.004
#> GSM35465     4  0.1498    0.61162 0.000 0.032 0.000 0.940 0.028 0.000
#> GSM35468     1  0.3818    0.58968 0.720 0.004 0.000 0.012 0.004 0.260
#> GSM35471     4  0.3625    0.61274 0.064 0.024 0.044 0.840 0.000 0.028
#> GSM35473     1  0.1644    0.74225 0.932 0.028 0.000 0.000 0.000 0.040
#> GSM35477     4  0.5928    0.39653 0.216 0.028 0.000 0.572 0.000 0.184
#> GSM35480     1  0.3467    0.68952 0.848 0.028 0.056 0.016 0.000 0.052
#> GSM35482     3  0.2073    0.77054 0.004 0.016 0.920 0.008 0.004 0.048
#> GSM35485     2  0.4064    0.29620 0.000 0.624 0.000 0.000 0.360 0.016
#> GSM35489     4  0.7115    0.09808 0.000 0.244 0.000 0.452 0.140 0.164
#> GSM35492     6  0.4353    0.20211 0.360 0.012 0.000 0.008 0.004 0.616
#> GSM35495     3  0.2190    0.76946 0.000 0.040 0.900 0.000 0.000 0.060
#> GSM35499     2  0.4837    0.03890 0.000 0.528 0.000 0.428 0.016 0.028
#> GSM35502     1  0.0405    0.74272 0.988 0.000 0.000 0.000 0.004 0.008
#> GSM35505     6  0.5438    0.25999 0.000 0.160 0.280 0.000 0.000 0.560
#> GSM35507     4  0.0924    0.62545 0.004 0.008 0.008 0.972 0.008 0.000
#> GSM35510     4  0.4993    0.26142 0.000 0.316 0.004 0.600 0.080 0.000
#> GSM35514     1  0.2089    0.73974 0.916 0.020 0.000 0.000 0.020 0.044
#> GSM35517     5  0.4871    0.55445 0.000 0.184 0.000 0.108 0.692 0.016
#> GSM35520     5  0.4497    0.60203 0.000 0.100 0.004 0.000 0.712 0.184
#> GSM35523     4  0.5824    0.49521 0.140 0.012 0.144 0.656 0.004 0.044
#> GSM35529     5  0.4514    0.46386 0.000 0.040 0.000 0.372 0.588 0.000
#> GSM35531     6  0.6115    0.02338 0.008 0.340 0.000 0.060 0.068 0.524
#> GSM35534     2  0.4550    0.40181 0.008 0.652 0.000 0.000 0.296 0.044
#> GSM35536     1  0.2211    0.73449 0.900 0.008 0.000 0.008 0.004 0.080
#> GSM35538     1  0.3613    0.66295 0.772 0.008 0.000 0.024 0.000 0.196
#> GSM35539     1  0.3686    0.67458 0.816 0.004 0.020 0.108 0.000 0.052
#> GSM35540     4  0.4585    0.50236 0.000 0.028 0.208 0.720 0.036 0.008
#> GSM35541     5  0.5082    0.40985 0.000 0.296 0.000 0.048 0.624 0.032
#> GSM35442     6  0.5331    0.46784 0.252 0.004 0.128 0.000 0.004 0.612
#> GSM35447     6  0.6585    0.08654 0.008 0.244 0.324 0.000 0.016 0.408
#> GSM35450     1  0.5042    0.60814 0.684 0.020 0.000 0.152 0.000 0.144
#> GSM35453     1  0.2015    0.73450 0.916 0.012 0.056 0.000 0.000 0.016
#> GSM35456     4  0.6715    0.06711 0.388 0.160 0.004 0.396 0.000 0.052
#> GSM35464     4  0.0909    0.61974 0.000 0.020 0.000 0.968 0.012 0.000
#> GSM35467     1  0.1599    0.74201 0.940 0.024 0.000 0.000 0.008 0.028
#> GSM35470     3  0.6433    0.21197 0.304 0.004 0.508 0.128 0.000 0.056
#> GSM35479     3  0.1396    0.75211 0.012 0.004 0.952 0.008 0.000 0.024
#> GSM35484     1  0.6133    0.17251 0.416 0.248 0.000 0.004 0.000 0.332
#> GSM35488     1  0.3916    0.53322 0.680 0.000 0.000 0.020 0.000 0.300
#> GSM35491     6  0.4605   -0.00682 0.416 0.016 0.000 0.016 0.000 0.552
#> GSM35494     3  0.0862    0.76921 0.008 0.004 0.972 0.000 0.000 0.016
#> GSM35498     4  0.1901    0.62896 0.024 0.016 0.012 0.932 0.000 0.016
#> GSM35501     1  0.0551    0.74250 0.984 0.004 0.000 0.000 0.004 0.008
#> GSM35509     3  0.0748    0.77792 0.000 0.004 0.976 0.004 0.000 0.016
#> GSM35513     1  0.2146    0.73772 0.908 0.024 0.000 0.000 0.008 0.060
#> GSM35516     2  0.6124    0.01989 0.008 0.464 0.000 0.408 0.068 0.052
#> GSM35522     4  0.4194    0.58539 0.072 0.012 0.068 0.804 0.004 0.040
#> GSM35525     1  0.3165    0.70114 0.860 0.004 0.028 0.056 0.000 0.052
#> GSM35528     4  0.5468   -0.04513 0.448 0.004 0.008 0.460 0.000 0.080
#> GSM35533     1  0.5243    0.27172 0.460 0.456 0.000 0.004 0.000 0.080
#> GSM35537     1  0.6760    0.24242 0.496 0.008 0.272 0.172 0.004 0.048

Heatmaps for the consensus matrix. It visualizes the probability of two samples to be in a same group.

consensus_heatmap(res, k = 2)

plot of chunk tab-MAD-NMF-consensus-heatmap-1

consensus_heatmap(res, k = 3)

plot of chunk tab-MAD-NMF-consensus-heatmap-2

consensus_heatmap(res, k = 4)

plot of chunk tab-MAD-NMF-consensus-heatmap-3

consensus_heatmap(res, k = 5)

plot of chunk tab-MAD-NMF-consensus-heatmap-4

consensus_heatmap(res, k = 6)

plot of chunk tab-MAD-NMF-consensus-heatmap-5

Heatmaps for the membership of samples in all partitions to see how consistent they are:

membership_heatmap(res, k = 2)

plot of chunk tab-MAD-NMF-membership-heatmap-1

membership_heatmap(res, k = 3)

plot of chunk tab-MAD-NMF-membership-heatmap-2

membership_heatmap(res, k = 4)

plot of chunk tab-MAD-NMF-membership-heatmap-3

membership_heatmap(res, k = 5)

plot of chunk tab-MAD-NMF-membership-heatmap-4

membership_heatmap(res, k = 6)

plot of chunk tab-MAD-NMF-membership-heatmap-5

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)

plot of chunk tab-MAD-NMF-get-signatures-1

get_signatures(res, k = 3)

plot of chunk tab-MAD-NMF-get-signatures-2

get_signatures(res, k = 4)

plot of chunk tab-MAD-NMF-get-signatures-3

get_signatures(res, k = 5)

plot of chunk tab-MAD-NMF-get-signatures-4

get_signatures(res, k = 6)

plot of chunk tab-MAD-NMF-get-signatures-5

Signature heatmaps where rows are not scaled:

get_signatures(res, k = 2, scale_rows = FALSE)

plot of chunk tab-MAD-NMF-get-signatures-no-scale-1

get_signatures(res, k = 3, scale_rows = FALSE)

plot of chunk tab-MAD-NMF-get-signatures-no-scale-2

get_signatures(res, k = 4, scale_rows = FALSE)

plot of chunk tab-MAD-NMF-get-signatures-no-scale-3

get_signatures(res, k = 5, scale_rows = FALSE)

plot of chunk tab-MAD-NMF-get-signatures-no-scale-4

get_signatures(res, k = 6, scale_rows = FALSE)

plot of chunk tab-MAD-NMF-get-signatures-no-scale-5

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk MAD-NMF-signature_compare

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:

  1. which_row: row indices corresponding to the input matrix.
  2. fdr: FDR for the differential test.
  3. mean_x: The mean value in group x.
  4. scaled_mean_x: The mean value in group x after rows are scaled.
  5. 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")

plot of chunk tab-MAD-NMF-dimension-reduction-1

dimension_reduction(res, k = 3, method = "UMAP")

plot of chunk tab-MAD-NMF-dimension-reduction-2

dimension_reduction(res, k = 4, method = "UMAP")

plot of chunk tab-MAD-NMF-dimension-reduction-3

dimension_reduction(res, k = 5, method = "UMAP")

plot of chunk tab-MAD-NMF-dimension-reduction-4

dimension_reduction(res, k = 6, method = "UMAP")

plot of chunk tab-MAD-NMF-dimension-reduction-5

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk MAD-NMF-collect-classes

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  time(p) k
#> MAD:NMF 75 1.02e-06 2
#> MAD:NMF 75 4.07e-05 3
#> MAD:NMF 64 3.55e-04 4
#> MAD:NMF 59 9.64e-05 5
#> MAD:NMF 46 1.46e-03 6

If matrix rows can be associated to genes, consider to use functional_enrichment(res, ...) to perform function enrichment for the signature genes. See this vignette for more detailed explanations.


ATC:hclust

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 7758 rows and 79 columns.
#>   Top rows (776, 1552, 2328, 3103, 3879) 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 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)

plot of chunk ATC-hclust-collect-plots

The plots are:

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:

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)

plot of chunk ATC-hclust-select-partition-number

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.322           0.781       0.853         0.4580 0.500   0.500
#> 3 3 0.486           0.825       0.874         0.3563 0.825   0.656
#> 4 4 0.766           0.801       0.853         0.0941 0.986   0.960
#> 5 5 0.833           0.773       0.874         0.0675 0.964   0.888
#> 6 6 0.803           0.836       0.887         0.0244 0.980   0.932

suggest_best_k() suggests the best \(k\) based on these statistics. The rules are as follows:

suggest_best_k(res)
#> [1] 6

Following shows the table of the partitions (You need to click the show/hide code output link to see it). The membership matrix (columns with name p*) is inferred by clue::cl_consensus() function with the SE method. Basically the value in the membership matrix represents the probability to belong to a certain group. The finall class label for an item is determined with the group with highest probability it belongs to.

In get_classes() function, the entropy is calculated from the membership matrix and the silhouette score is calculated from the consensus matrix.

show/hide code output

cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#>          class entropy silhouette    p1    p2
#> GSM35441     2  0.6148      0.772 0.152 0.848
#> GSM35446     2  0.0000      0.710 0.000 1.000
#> GSM35449     2  0.6148      0.772 0.152 0.848
#> GSM35455     2  0.6148      0.772 0.152 0.848
#> GSM35458     2  0.9358      0.670 0.352 0.648
#> GSM35460     2  0.0000      0.710 0.000 1.000
#> GSM35461     1  0.9970     -0.367 0.532 0.468
#> GSM35463     2  0.8443      0.732 0.272 0.728
#> GSM35472     2  0.9922      0.538 0.448 0.552
#> GSM35475     2  0.9358      0.670 0.352 0.648
#> GSM35483     2  0.8443      0.732 0.272 0.728
#> GSM35496     2  0.9850      0.329 0.428 0.572
#> GSM35497     2  0.6148      0.772 0.152 0.848
#> GSM35504     2  0.6148      0.772 0.152 0.848
#> GSM35508     2  0.0000      0.710 0.000 1.000
#> GSM35511     2  0.0000      0.710 0.000 1.000
#> GSM35512     2  0.9922      0.538 0.448 0.552
#> GSM35515     2  0.9358      0.670 0.352 0.648
#> GSM35519     2  0.9922      0.538 0.448 0.552
#> GSM35527     2  0.0000      0.710 0.000 1.000
#> GSM35532     2  0.0000      0.710 0.000 1.000
#> GSM35439     2  0.8443      0.732 0.272 0.728
#> GSM35443     1  0.0000      0.980 1.000 0.000
#> GSM35445     1  0.0000      0.980 1.000 0.000
#> GSM35448     2  0.1414      0.720 0.020 0.980
#> GSM35451     1  0.0000      0.980 1.000 0.000
#> GSM35454     2  0.9983      0.488 0.476 0.524
#> GSM35457     2  0.6148      0.772 0.152 0.848
#> GSM35465     2  0.6148      0.772 0.152 0.848
#> GSM35468     1  0.0000      0.980 1.000 0.000
#> GSM35471     1  0.0000      0.980 1.000 0.000
#> GSM35473     1  0.0000      0.980 1.000 0.000
#> GSM35477     1  0.0000      0.980 1.000 0.000
#> GSM35480     1  0.0000      0.980 1.000 0.000
#> GSM35482     2  0.9850      0.329 0.428 0.572
#> GSM35485     2  0.8443      0.732 0.272 0.728
#> GSM35489     2  0.8443      0.732 0.272 0.728
#> GSM35492     1  0.0000      0.980 1.000 0.000
#> GSM35495     2  0.9427      0.473 0.360 0.640
#> GSM35499     2  0.6148      0.772 0.152 0.848
#> GSM35502     1  0.0000      0.980 1.000 0.000
#> GSM35505     2  0.9983      0.488 0.476 0.524
#> GSM35507     1  0.0000      0.980 1.000 0.000
#> GSM35510     2  0.6148      0.772 0.152 0.848
#> GSM35514     1  0.0000      0.980 1.000 0.000
#> GSM35517     2  0.8443      0.732 0.272 0.728
#> GSM35520     2  0.9358      0.670 0.352 0.648
#> GSM35523     1  0.0000      0.980 1.000 0.000
#> GSM35529     2  0.6148      0.772 0.152 0.848
#> GSM35531     2  0.8443      0.732 0.272 0.728
#> GSM35534     2  0.8443      0.732 0.272 0.728
#> GSM35536     1  0.0000      0.980 1.000 0.000
#> GSM35538     1  0.0000      0.980 1.000 0.000
#> GSM35539     1  0.0000      0.980 1.000 0.000
#> GSM35540     2  0.6148      0.772 0.152 0.848
#> GSM35541     2  0.8443      0.732 0.272 0.728
#> GSM35442     1  0.0000      0.980 1.000 0.000
#> GSM35447     2  0.9970      0.504 0.468 0.532
#> GSM35450     1  0.0000      0.980 1.000 0.000
#> GSM35453     1  0.0000      0.980 1.000 0.000
#> GSM35456     1  0.0000      0.980 1.000 0.000
#> GSM35464     1  0.0376      0.974 0.996 0.004
#> GSM35467     1  0.0000      0.980 1.000 0.000
#> GSM35470     1  0.0000      0.980 1.000 0.000
#> GSM35479     2  0.9850      0.329 0.428 0.572
#> GSM35484     1  0.0000      0.980 1.000 0.000
#> GSM35488     1  0.0000      0.980 1.000 0.000
#> GSM35491     1  0.0000      0.980 1.000 0.000
#> GSM35494     2  0.9850      0.329 0.428 0.572
#> GSM35498     1  0.0000      0.980 1.000 0.000
#> GSM35501     1  0.0000      0.980 1.000 0.000
#> GSM35509     2  0.9580      0.436 0.380 0.620
#> GSM35513     1  0.0000      0.980 1.000 0.000
#> GSM35516     2  0.9323      0.683 0.348 0.652
#> GSM35522     1  0.0000      0.980 1.000 0.000
#> GSM35525     1  0.0000      0.980 1.000 0.000
#> GSM35528     1  0.0000      0.980 1.000 0.000
#> GSM35533     1  0.0000      0.980 1.000 0.000
#> GSM35537     1  0.0000      0.980 1.000 0.000

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>          class entropy silhouette    p1    p2    p3
#> GSM35441     2   0.000      0.865 0.000 1.000 0.000
#> GSM35446     3   0.388      0.548 0.000 0.152 0.848
#> GSM35449     2   0.000      0.865 0.000 1.000 0.000
#> GSM35455     2   0.000      0.865 0.000 1.000 0.000
#> GSM35458     3   0.723      0.653 0.080 0.228 0.692
#> GSM35460     3   0.388      0.548 0.000 0.152 0.848
#> GSM35461     3   0.928      0.660 0.328 0.176 0.496
#> GSM35463     2   0.334      0.844 0.120 0.880 0.000
#> GSM35472     3   0.835      0.705 0.176 0.196 0.628
#> GSM35475     3   0.723      0.653 0.080 0.228 0.692
#> GSM35483     2   0.685      0.731 0.120 0.740 0.140
#> GSM35496     3   0.593      0.587 0.356 0.000 0.644
#> GSM35497     2   0.000      0.865 0.000 1.000 0.000
#> GSM35504     2   0.341      0.785 0.000 0.876 0.124
#> GSM35508     2   0.586      0.508 0.000 0.656 0.344
#> GSM35511     3   0.418      0.545 0.000 0.172 0.828
#> GSM35512     3   0.835      0.705 0.176 0.196 0.628
#> GSM35515     3   0.723      0.653 0.080 0.228 0.692
#> GSM35519     3   0.835      0.705 0.176 0.196 0.628
#> GSM35527     2   0.586      0.508 0.000 0.656 0.344
#> GSM35532     3   0.418      0.545 0.000 0.172 0.828
#> GSM35439     2   0.334      0.844 0.120 0.880 0.000
#> GSM35443     1   0.000      0.963 1.000 0.000 0.000
#> GSM35445     1   0.000      0.963 1.000 0.000 0.000
#> GSM35448     3   0.440      0.538 0.000 0.188 0.812
#> GSM35451     1   0.196      0.955 0.944 0.000 0.056
#> GSM35454     3   0.865      0.698 0.204 0.196 0.600
#> GSM35457     2   0.000      0.865 0.000 1.000 0.000
#> GSM35465     2   0.000      0.865 0.000 1.000 0.000
#> GSM35468     1   0.000      0.963 1.000 0.000 0.000
#> GSM35471     1   0.196      0.955 0.944 0.000 0.056
#> GSM35473     1   0.000      0.963 1.000 0.000 0.000
#> GSM35477     1   0.196      0.955 0.944 0.000 0.056
#> GSM35480     1   0.000      0.963 1.000 0.000 0.000
#> GSM35482     3   0.593      0.587 0.356 0.000 0.644
#> GSM35485     2   0.334      0.844 0.120 0.880 0.000
#> GSM35489     2   0.334      0.844 0.120 0.880 0.000
#> GSM35492     1   0.000      0.963 1.000 0.000 0.000
#> GSM35495     3   0.536      0.688 0.220 0.012 0.768
#> GSM35499     2   0.000      0.865 0.000 1.000 0.000
#> GSM35502     1   0.000      0.963 1.000 0.000 0.000
#> GSM35505     3   0.865      0.698 0.204 0.196 0.600
#> GSM35507     1   0.196      0.955 0.944 0.000 0.056
#> GSM35510     2   0.000      0.865 0.000 1.000 0.000
#> GSM35514     1   0.000      0.963 1.000 0.000 0.000
#> GSM35517     2   0.334      0.844 0.120 0.880 0.000
#> GSM35520     3   0.723      0.653 0.080 0.228 0.692
#> GSM35523     1   0.220      0.953 0.940 0.004 0.056
#> GSM35529     2   0.000      0.865 0.000 1.000 0.000
#> GSM35531     2   0.334      0.844 0.120 0.880 0.000
#> GSM35534     2   0.334      0.844 0.120 0.880 0.000
#> GSM35536     1   0.000      0.963 1.000 0.000 0.000
#> GSM35538     1   0.196      0.955 0.944 0.000 0.056
#> GSM35539     1   0.196      0.955 0.944 0.000 0.056
#> GSM35540     2   0.000      0.865 0.000 1.000 0.000
#> GSM35541     2   0.334      0.844 0.120 0.880 0.000
#> GSM35442     1   0.000      0.963 1.000 0.000 0.000
#> GSM35447     3   0.857      0.701 0.196 0.196 0.608
#> GSM35450     1   0.196      0.955 0.944 0.000 0.056
#> GSM35453     1   0.000      0.963 1.000 0.000 0.000
#> GSM35456     1   0.196      0.955 0.944 0.000 0.056
#> GSM35464     1   0.220      0.953 0.940 0.004 0.056
#> GSM35467     1   0.000      0.963 1.000 0.000 0.000
#> GSM35470     1   0.141      0.936 0.964 0.000 0.036
#> GSM35479     3   0.593      0.587 0.356 0.000 0.644
#> GSM35484     1   0.196      0.955 0.944 0.000 0.056
#> GSM35488     1   0.000      0.963 1.000 0.000 0.000
#> GSM35491     1   0.000      0.963 1.000 0.000 0.000
#> GSM35494     3   0.593      0.587 0.356 0.000 0.644
#> GSM35498     1   0.196      0.955 0.944 0.000 0.056
#> GSM35501     1   0.000      0.963 1.000 0.000 0.000
#> GSM35509     3   0.558      0.672 0.240 0.012 0.748
#> GSM35513     1   0.000      0.963 1.000 0.000 0.000
#> GSM35516     2   0.557      0.752 0.140 0.804 0.056
#> GSM35522     1   0.220      0.953 0.940 0.004 0.056
#> GSM35525     1   0.000      0.963 1.000 0.000 0.000
#> GSM35528     1   0.196      0.955 0.944 0.000 0.056
#> GSM35533     1   0.196      0.955 0.944 0.000 0.056
#> GSM35537     1   0.141      0.936 0.964 0.000 0.036

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>          class entropy silhouette    p1    p2    p3    p4
#> GSM35441     2  0.2011      0.866 0.000 0.920 0.000 0.080
#> GSM35446     3  0.4624      0.368 0.000 0.000 0.660 0.340
#> GSM35449     2  0.2011      0.866 0.000 0.920 0.000 0.080
#> GSM35455     2  0.2011      0.866 0.000 0.920 0.000 0.080
#> GSM35458     3  0.6109      0.609 0.004 0.224 0.676 0.096
#> GSM35460     3  0.4624      0.368 0.000 0.000 0.660 0.340
#> GSM35461     3  0.6971      0.598 0.128 0.188 0.652 0.032
#> GSM35463     2  0.1716      0.859 0.064 0.936 0.000 0.000
#> GSM35472     3  0.4458      0.656 0.008 0.196 0.780 0.016
#> GSM35475     3  0.6109      0.609 0.004 0.224 0.676 0.096
#> GSM35483     2  0.5334      0.706 0.064 0.792 0.072 0.072
#> GSM35496     3  0.5758      0.493 0.128 0.000 0.712 0.160
#> GSM35497     2  0.2011      0.866 0.000 0.920 0.000 0.080
#> GSM35504     2  0.5339      0.266 0.000 0.600 0.016 0.384
#> GSM35508     4  0.3803      1.000 0.000 0.132 0.032 0.836
#> GSM35511     3  0.4985      0.228 0.000 0.000 0.532 0.468
#> GSM35512     3  0.4458      0.656 0.008 0.196 0.780 0.016
#> GSM35515     3  0.6109      0.609 0.004 0.224 0.676 0.096
#> GSM35519     3  0.4458      0.656 0.008 0.196 0.780 0.016
#> GSM35527     4  0.3803      1.000 0.000 0.132 0.032 0.836
#> GSM35532     3  0.4985      0.228 0.000 0.000 0.532 0.468
#> GSM35439     2  0.1716      0.859 0.064 0.936 0.000 0.000
#> GSM35443     1  0.0336      0.954 0.992 0.000 0.008 0.000
#> GSM35445     1  0.0336      0.954 0.992 0.000 0.008 0.000
#> GSM35448     3  0.5639      0.390 0.000 0.040 0.636 0.324
#> GSM35451     1  0.1792      0.950 0.932 0.000 0.068 0.000
#> GSM35454     3  0.4348      0.653 0.024 0.196 0.780 0.000
#> GSM35457     2  0.2011      0.866 0.000 0.920 0.000 0.080
#> GSM35465     2  0.2011      0.866 0.000 0.920 0.000 0.080
#> GSM35468     1  0.0000      0.957 1.000 0.000 0.000 0.000
#> GSM35471     1  0.1792      0.950 0.932 0.000 0.068 0.000
#> GSM35473     1  0.0000      0.957 1.000 0.000 0.000 0.000
#> GSM35477     1  0.1792      0.950 0.932 0.000 0.068 0.000
#> GSM35480     1  0.0000      0.957 1.000 0.000 0.000 0.000
#> GSM35482     3  0.5758      0.493 0.128 0.000 0.712 0.160
#> GSM35485     2  0.1716      0.859 0.064 0.936 0.000 0.000
#> GSM35489     2  0.1716      0.859 0.064 0.936 0.000 0.000
#> GSM35492     1  0.0000      0.957 1.000 0.000 0.000 0.000
#> GSM35495     3  0.2466      0.582 0.004 0.000 0.900 0.096
#> GSM35499     2  0.2011      0.866 0.000 0.920 0.000 0.080
#> GSM35502     1  0.0000      0.957 1.000 0.000 0.000 0.000
#> GSM35505     3  0.4348      0.653 0.024 0.196 0.780 0.000
#> GSM35507     1  0.1792      0.950 0.932 0.000 0.068 0.000
#> GSM35510     2  0.2011      0.866 0.000 0.920 0.000 0.080
#> GSM35514     1  0.0000      0.957 1.000 0.000 0.000 0.000
#> GSM35517     2  0.2048      0.859 0.064 0.928 0.000 0.008
#> GSM35520     3  0.6109      0.609 0.004 0.224 0.676 0.096
#> GSM35523     1  0.1978      0.948 0.928 0.004 0.068 0.000
#> GSM35529     2  0.2011      0.866 0.000 0.920 0.000 0.080
#> GSM35531     2  0.1716      0.859 0.064 0.936 0.000 0.000
#> GSM35534     2  0.1716      0.859 0.064 0.936 0.000 0.000
#> GSM35536     1  0.0000      0.957 1.000 0.000 0.000 0.000
#> GSM35538     1  0.1792      0.950 0.932 0.000 0.068 0.000
#> GSM35539     1  0.1792      0.950 0.932 0.000 0.068 0.000
#> GSM35540     2  0.2011      0.866 0.000 0.920 0.000 0.080
#> GSM35541     2  0.1716      0.859 0.064 0.936 0.000 0.000
#> GSM35442     1  0.0336      0.954 0.992 0.000 0.008 0.000
#> GSM35447     3  0.4136      0.655 0.016 0.196 0.788 0.000
#> GSM35450     1  0.1792      0.950 0.932 0.000 0.068 0.000
#> GSM35453     1  0.0336      0.954 0.992 0.000 0.008 0.000
#> GSM35456     1  0.1792      0.950 0.932 0.000 0.068 0.000
#> GSM35464     1  0.1978      0.948 0.928 0.004 0.068 0.000
#> GSM35467     1  0.0000      0.957 1.000 0.000 0.000 0.000
#> GSM35470     1  0.1854      0.915 0.940 0.000 0.048 0.012
#> GSM35479     3  0.5758      0.493 0.128 0.000 0.712 0.160
#> GSM35484     1  0.1792      0.950 0.932 0.000 0.068 0.000
#> GSM35488     1  0.0000      0.957 1.000 0.000 0.000 0.000
#> GSM35491     1  0.0000      0.957 1.000 0.000 0.000 0.000
#> GSM35494     3  0.5758      0.493 0.128 0.000 0.712 0.160
#> GSM35498     1  0.1792      0.950 0.932 0.000 0.068 0.000
#> GSM35501     1  0.0000      0.957 1.000 0.000 0.000 0.000
#> GSM35509     3  0.3479      0.554 0.012 0.000 0.840 0.148
#> GSM35513     1  0.0000      0.957 1.000 0.000 0.000 0.000
#> GSM35516     2  0.3621      0.770 0.072 0.860 0.068 0.000
#> GSM35522     1  0.1978      0.948 0.928 0.004 0.068 0.000
#> GSM35525     1  0.0000      0.957 1.000 0.000 0.000 0.000
#> GSM35528     1  0.1792      0.950 0.932 0.000 0.068 0.000
#> GSM35533     1  0.1792      0.950 0.932 0.000 0.068 0.000
#> GSM35537     1  0.1854      0.915 0.940 0.000 0.048 0.012

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>          class entropy silhouette    p1    p2    p3    p4    p5
#> GSM35441     2  0.0000     0.8786 0.000 1.000 0.000 0.000 0.000
#> GSM35446     3  0.5736     0.0567 0.000 0.000 0.512 0.088 0.400
#> GSM35449     2  0.0000     0.8786 0.000 1.000 0.000 0.000 0.000
#> GSM35455     2  0.0000     0.8786 0.000 1.000 0.000 0.000 0.000
#> GSM35458     5  0.2642     0.7014 0.004 0.024 0.084 0.000 0.888
#> GSM35460     3  0.5736     0.0567 0.000 0.000 0.512 0.088 0.400
#> GSM35461     5  0.5263     0.2314 0.100 0.000 0.240 0.000 0.660
#> GSM35463     2  0.2648     0.8696 0.000 0.848 0.000 0.152 0.000
#> GSM35472     5  0.0324     0.7204 0.004 0.000 0.004 0.000 0.992
#> GSM35475     5  0.2642     0.7014 0.004 0.024 0.084 0.000 0.888
#> GSM35483     2  0.5983     0.6854 0.000 0.680 0.072 0.152 0.096
#> GSM35496     3  0.4322     0.5663 0.088 0.000 0.768 0.000 0.144
#> GSM35497     2  0.0000     0.8786 0.000 1.000 0.000 0.000 0.000
#> GSM35504     2  0.6405     0.1758 0.000 0.620 0.148 0.188 0.044
#> GSM35508     4  0.4955     1.0000 0.000 0.148 0.124 0.724 0.004
#> GSM35511     5  0.6540     0.1352 0.000 0.000 0.300 0.228 0.472
#> GSM35512     5  0.0324     0.7204 0.004 0.000 0.004 0.000 0.992
#> GSM35515     5  0.2642     0.7014 0.004 0.024 0.084 0.000 0.888
#> GSM35519     5  0.0324     0.7204 0.004 0.000 0.004 0.000 0.992
#> GSM35527     4  0.4955     1.0000 0.000 0.148 0.124 0.724 0.004
#> GSM35532     5  0.6540     0.1352 0.000 0.000 0.300 0.228 0.472
#> GSM35439     2  0.2648     0.8696 0.000 0.848 0.000 0.152 0.000
#> GSM35443     1  0.0290     0.9413 0.992 0.000 0.008 0.000 0.000
#> GSM35445     1  0.0290     0.9413 0.992 0.000 0.008 0.000 0.000
#> GSM35448     3  0.5785    -0.0374 0.000 0.004 0.484 0.076 0.436
#> GSM35451     1  0.2068     0.9300 0.904 0.000 0.004 0.092 0.000
#> GSM35454     5  0.1399     0.7014 0.020 0.000 0.028 0.000 0.952
#> GSM35457     2  0.0000     0.8786 0.000 1.000 0.000 0.000 0.000
#> GSM35465     2  0.0000     0.8786 0.000 1.000 0.000 0.000 0.000
#> GSM35468     1  0.0000     0.9446 1.000 0.000 0.000 0.000 0.000
#> GSM35471     1  0.2124     0.9286 0.900 0.000 0.004 0.096 0.000
#> GSM35473     1  0.0000     0.9446 1.000 0.000 0.000 0.000 0.000
#> GSM35477     1  0.2068     0.9300 0.904 0.000 0.004 0.092 0.000
#> GSM35480     1  0.0000     0.9446 1.000 0.000 0.000 0.000 0.000
#> GSM35482     3  0.4322     0.5663 0.088 0.000 0.768 0.000 0.144
#> GSM35485     2  0.2648     0.8696 0.000 0.848 0.000 0.152 0.000
#> GSM35489     2  0.2648     0.8696 0.000 0.848 0.000 0.152 0.000
#> GSM35492     1  0.0000     0.9446 1.000 0.000 0.000 0.000 0.000
#> GSM35495     5  0.4307    -0.2764 0.000 0.000 0.500 0.000 0.500
#> GSM35499     2  0.0000     0.8786 0.000 1.000 0.000 0.000 0.000
#> GSM35502     1  0.0000     0.9446 1.000 0.000 0.000 0.000 0.000
#> GSM35505     5  0.1399     0.7014 0.020 0.000 0.028 0.000 0.952
#> GSM35507     1  0.2723     0.9136 0.864 0.000 0.012 0.124 0.000
#> GSM35510     2  0.0000     0.8786 0.000 1.000 0.000 0.000 0.000
#> GSM35514     1  0.0000     0.9446 1.000 0.000 0.000 0.000 0.000
#> GSM35517     2  0.2561     0.8709 0.000 0.856 0.000 0.144 0.000
#> GSM35520     5  0.2642     0.7014 0.004 0.024 0.084 0.000 0.888
#> GSM35523     1  0.2881     0.9112 0.860 0.004 0.012 0.124 0.000
#> GSM35529     2  0.0000     0.8786 0.000 1.000 0.000 0.000 0.000
#> GSM35531     2  0.2648     0.8696 0.000 0.848 0.000 0.152 0.000
#> GSM35534     2  0.2648     0.8696 0.000 0.848 0.000 0.152 0.000
#> GSM35536     1  0.0000     0.9446 1.000 0.000 0.000 0.000 0.000
#> GSM35538     1  0.2011     0.9312 0.908 0.000 0.004 0.088 0.000
#> GSM35539     1  0.2011     0.9312 0.908 0.000 0.004 0.088 0.000
#> GSM35540     2  0.0000     0.8786 0.000 1.000 0.000 0.000 0.000
#> GSM35541     2  0.2648     0.8696 0.000 0.848 0.000 0.152 0.000
#> GSM35442     1  0.0290     0.9413 0.992 0.000 0.008 0.000 0.000
#> GSM35447     5  0.1106     0.7089 0.012 0.000 0.024 0.000 0.964
#> GSM35450     1  0.2011     0.9312 0.908 0.000 0.004 0.088 0.000
#> GSM35453     1  0.0290     0.9413 0.992 0.000 0.008 0.000 0.000
#> GSM35456     1  0.2723     0.9136 0.864 0.000 0.012 0.124 0.000
#> GSM35464     1  0.2833     0.9136 0.864 0.004 0.012 0.120 0.000
#> GSM35467     1  0.0000     0.9446 1.000 0.000 0.000 0.000 0.000
#> GSM35470     1  0.2139     0.8894 0.916 0.000 0.052 0.000 0.032
#> GSM35479     3  0.4322     0.5663 0.088 0.000 0.768 0.000 0.144
#> GSM35484     1  0.1792     0.9335 0.916 0.000 0.000 0.084 0.000
#> GSM35488     1  0.0000     0.9446 1.000 0.000 0.000 0.000 0.000
#> GSM35491     1  0.0000     0.9446 1.000 0.000 0.000 0.000 0.000
#> GSM35494     3  0.4322     0.5663 0.088 0.000 0.768 0.000 0.144
#> GSM35498     1  0.2723     0.9136 0.864 0.000 0.012 0.124 0.000
#> GSM35501     1  0.0000     0.9446 1.000 0.000 0.000 0.000 0.000
#> GSM35509     3  0.4201     0.3190 0.000 0.000 0.592 0.000 0.408
#> GSM35513     1  0.0000     0.9446 1.000 0.000 0.000 0.000 0.000
#> GSM35516     2  0.3461     0.8039 0.004 0.772 0.000 0.224 0.000
#> GSM35522     1  0.2881     0.9112 0.860 0.004 0.012 0.124 0.000
#> GSM35525     1  0.0000     0.9446 1.000 0.000 0.000 0.000 0.000
#> GSM35528     1  0.2011     0.9312 0.908 0.000 0.004 0.088 0.000
#> GSM35533     1  0.1792     0.9335 0.916 0.000 0.000 0.084 0.000
#> GSM35537     1  0.2139     0.8894 0.916 0.000 0.052 0.000 0.032

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>          class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM35441     2  0.0000      0.879 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM35446     4  0.1334      0.738 0.000 0.000 0.032 0.948 0.020 0.000
#> GSM35449     2  0.0000      0.879 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM35455     2  0.0000      0.879 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM35458     5  0.0000      0.846 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM35460     4  0.1334      0.738 0.000 0.000 0.032 0.948 0.020 0.000
#> GSM35461     5  0.4256      0.194 0.016 0.000 0.464 0.000 0.520 0.000
#> GSM35463     2  0.2378      0.870 0.000 0.848 0.000 0.000 0.000 0.152
#> GSM35472     5  0.2053      0.872 0.000 0.000 0.108 0.004 0.888 0.000
#> GSM35475     5  0.0000      0.846 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM35483     2  0.5257      0.684 0.000 0.668 0.000 0.028 0.160 0.144
#> GSM35496     3  0.0260      0.746 0.008 0.000 0.992 0.000 0.000 0.000
#> GSM35497     2  0.0000      0.879 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM35504     2  0.5766      0.211 0.000 0.620 0.000 0.172 0.044 0.164
#> GSM35508     6  0.4313      1.000 0.000 0.148 0.000 0.124 0.000 0.728
#> GSM35511     4  0.3893      0.693 0.000 0.000 0.000 0.768 0.092 0.140
#> GSM35512     5  0.2053      0.872 0.000 0.000 0.108 0.004 0.888 0.000
#> GSM35515     5  0.0000      0.846 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM35519     5  0.2053      0.872 0.000 0.000 0.108 0.004 0.888 0.000
#> GSM35527     6  0.4313      1.000 0.000 0.148 0.000 0.124 0.000 0.728
#> GSM35532     4  0.3893      0.693 0.000 0.000 0.000 0.768 0.092 0.140
#> GSM35439     2  0.2378      0.870 0.000 0.848 0.000 0.000 0.000 0.152
#> GSM35443     1  0.1643      0.926 0.924 0.000 0.068 0.008 0.000 0.000
#> GSM35445     1  0.1643      0.926 0.924 0.000 0.068 0.008 0.000 0.000
#> GSM35448     4  0.3670      0.509 0.000 0.000 0.012 0.704 0.284 0.000
#> GSM35451     1  0.1307      0.912 0.952 0.000 0.008 0.008 0.000 0.032
#> GSM35454     5  0.2784      0.855 0.008 0.000 0.132 0.012 0.848 0.000
#> GSM35457     2  0.0000      0.879 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM35465     2  0.0000      0.879 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM35468     1  0.1524      0.929 0.932 0.000 0.060 0.008 0.000 0.000
#> GSM35471     1  0.1453      0.909 0.944 0.000 0.008 0.008 0.000 0.040
#> GSM35473     1  0.1524      0.929 0.932 0.000 0.060 0.008 0.000 0.000
#> GSM35477     1  0.1307      0.912 0.952 0.000 0.008 0.008 0.000 0.032
#> GSM35480     1  0.1267      0.929 0.940 0.000 0.060 0.000 0.000 0.000
#> GSM35482     3  0.0260      0.746 0.008 0.000 0.992 0.000 0.000 0.000
#> GSM35485     2  0.2378      0.870 0.000 0.848 0.000 0.000 0.000 0.152
#> GSM35489     2  0.2378      0.870 0.000 0.848 0.000 0.000 0.000 0.152
#> GSM35492     1  0.1524      0.929 0.932 0.000 0.060 0.008 0.000 0.000
#> GSM35495     3  0.6095      0.170 0.000 0.000 0.360 0.360 0.280 0.000
#> GSM35499     2  0.0000      0.879 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM35502     1  0.1524      0.929 0.932 0.000 0.060 0.008 0.000 0.000
#> GSM35505     5  0.2784      0.855 0.008 0.000 0.132 0.012 0.848 0.000
#> GSM35507     1  0.2656      0.862 0.860 0.000 0.008 0.012 0.000 0.120
#> GSM35510     2  0.0000      0.879 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM35514     1  0.1524      0.929 0.932 0.000 0.060 0.008 0.000 0.000
#> GSM35517     2  0.2300      0.871 0.000 0.856 0.000 0.000 0.000 0.144
#> GSM35520     5  0.0000      0.846 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM35523     1  0.2798      0.859 0.856 0.004 0.008 0.012 0.000 0.120
#> GSM35529     2  0.0000      0.879 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM35531     2  0.2378      0.870 0.000 0.848 0.000 0.000 0.000 0.152
#> GSM35534     2  0.2378      0.870 0.000 0.848 0.000 0.000 0.000 0.152
#> GSM35536     1  0.1524      0.929 0.932 0.000 0.060 0.008 0.000 0.000
#> GSM35538     1  0.1149      0.914 0.960 0.000 0.008 0.008 0.000 0.024
#> GSM35539     1  0.1149      0.914 0.960 0.000 0.008 0.008 0.000 0.024
#> GSM35540     2  0.0000      0.879 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM35541     2  0.2378      0.870 0.000 0.848 0.000 0.000 0.000 0.152
#> GSM35442     1  0.1643      0.926 0.924 0.000 0.068 0.008 0.000 0.000
#> GSM35447     5  0.2489      0.862 0.000 0.000 0.128 0.012 0.860 0.000
#> GSM35450     1  0.1149      0.914 0.960 0.000 0.008 0.008 0.000 0.024
#> GSM35453     1  0.1643      0.926 0.924 0.000 0.068 0.008 0.000 0.000
#> GSM35456     1  0.2656      0.862 0.860 0.000 0.008 0.012 0.000 0.120
#> GSM35464     1  0.2687      0.862 0.860 0.004 0.004 0.012 0.000 0.120
#> GSM35467     1  0.1524      0.929 0.932 0.000 0.060 0.008 0.000 0.000
#> GSM35470     1  0.2558      0.877 0.840 0.000 0.156 0.004 0.000 0.000
#> GSM35479     3  0.0260      0.746 0.008 0.000 0.992 0.000 0.000 0.000
#> GSM35484     1  0.0993      0.917 0.964 0.000 0.000 0.012 0.000 0.024
#> GSM35488     1  0.1267      0.929 0.940 0.000 0.060 0.000 0.000 0.000
#> GSM35491     1  0.1524      0.929 0.932 0.000 0.060 0.008 0.000 0.000
#> GSM35494     3  0.0260      0.746 0.008 0.000 0.992 0.000 0.000 0.000
#> GSM35498     1  0.2656      0.862 0.860 0.000 0.008 0.012 0.000 0.120
#> GSM35501     1  0.1524      0.929 0.932 0.000 0.060 0.008 0.000 0.000
#> GSM35509     3  0.5705      0.378 0.000 0.000 0.516 0.204 0.280 0.000
#> GSM35513     1  0.1524      0.929 0.932 0.000 0.060 0.008 0.000 0.000
#> GSM35516     2  0.3812      0.804 0.056 0.772 0.000 0.004 0.000 0.168
#> GSM35522     1  0.2798      0.859 0.856 0.004 0.008 0.012 0.000 0.120
#> GSM35525     1  0.1267      0.929 0.940 0.000 0.060 0.000 0.000 0.000
#> GSM35528     1  0.1149      0.914 0.960 0.000 0.008 0.008 0.000 0.024
#> GSM35533     1  0.0993      0.917 0.964 0.000 0.000 0.012 0.000 0.024
#> GSM35537     1  0.2558      0.877 0.840 0.000 0.156 0.004 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)

plot of chunk tab-ATC-hclust-consensus-heatmap-1

consensus_heatmap(res, k = 3)

plot of chunk tab-ATC-hclust-consensus-heatmap-2

consensus_heatmap(res, k = 4)

plot of chunk tab-ATC-hclust-consensus-heatmap-3

consensus_heatmap(res, k = 5)

plot of chunk tab-ATC-hclust-consensus-heatmap-4

consensus_heatmap(res, k = 6)

plot of chunk tab-ATC-hclust-consensus-heatmap-5

Heatmaps for the membership of samples in all partitions to see how consistent they are:

membership_heatmap(res, k = 2)

plot of chunk tab-ATC-hclust-membership-heatmap-1

membership_heatmap(res, k = 3)

plot of chunk tab-ATC-hclust-membership-heatmap-2

membership_heatmap(res, k = 4)

plot of chunk tab-ATC-hclust-membership-heatmap-3

membership_heatmap(res, k = 5)

plot of chunk tab-ATC-hclust-membership-heatmap-4

membership_heatmap(res, k = 6)

plot of chunk tab-ATC-hclust-membership-heatmap-5

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)

plot of chunk tab-ATC-hclust-get-signatures-1

get_signatures(res, k = 3)

plot of chunk tab-ATC-hclust-get-signatures-2

get_signatures(res, k = 4)

plot of chunk tab-ATC-hclust-get-signatures-3

get_signatures(res, k = 5)

plot of chunk tab-ATC-hclust-get-signatures-4

get_signatures(res, k = 6)

plot of chunk tab-ATC-hclust-get-signatures-5

Signature heatmaps where rows are not scaled:

get_signatures(res, k = 2, scale_rows = FALSE)

plot of chunk tab-ATC-hclust-get-signatures-no-scale-1

get_signatures(res, k = 3, scale_rows = FALSE)

plot of chunk tab-ATC-hclust-get-signatures-no-scale-2

get_signatures(res, k = 4, scale_rows = FALSE)

plot of chunk tab-ATC-hclust-get-signatures-no-scale-3

get_signatures(res, k = 5, scale_rows = FALSE)

plot of chunk tab-ATC-hclust-get-signatures-no-scale-4

get_signatures(res, k = 6, scale_rows = FALSE)

plot of chunk tab-ATC-hclust-get-signatures-no-scale-5

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk ATC-hclust-signature_compare

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:

  1. which_row: row indices corresponding to the input matrix.
  2. fdr: FDR for the differential test.
  3. mean_x: The mean value in group x.
  4. scaled_mean_x: The mean value in group x after rows are scaled.
  5. 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")

plot of chunk tab-ATC-hclust-dimension-reduction-1

dimension_reduction(res, k = 3, method = "UMAP")

plot of chunk tab-ATC-hclust-dimension-reduction-2

dimension_reduction(res, k = 4, method = "UMAP")

plot of chunk tab-ATC-hclust-dimension-reduction-3

dimension_reduction(res, k = 5, method = "UMAP")

plot of chunk tab-ATC-hclust-dimension-reduction-4

dimension_reduction(res, k = 6, method = "UMAP")

plot of chunk tab-ATC-hclust-dimension-reduction-5

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk ATC-hclust-collect-classes

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  time(p) k
#> ATC:hclust 70 1.24e-07 2
#> ATC:hclust 79 2.39e-06 3
#> ATC:hclust 69 5.91e-06 4
#> ATC:hclust 70 1.74e-05 5
#> ATC:hclust 75 6.20e-06 6

If matrix rows can be associated to genes, consider to use functional_enrichment(res, ...) to perform function enrichment for the signature genes. See this vignette for more detailed explanations.


ATC:kmeans**

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 7758 rows and 79 columns.
#>   Top rows (776, 1552, 2328, 3103, 3879) are extracted by 'ATC' method.
#>   Subgroups are detected by 'kmeans' method.
#>   Performed in total 1250 partitions by row resampling.
#>   Best k for subgroups seems to be 2.
#> 
#> Following methods can be applied to this 'ConsensusPartition' object:
#>  [1] "cola_report"             "collect_classes"         "collect_plots"          
#>  [4] "collect_stats"           "colnames"                "compare_signatures"     
#>  [7] "consensus_heatmap"       "dimension_reduction"     "functional_enrichment"  
#> [10] "get_anno_col"            "get_anno"                "get_classes"            
#> [13] "get_consensus"           "get_matrix"              "get_membership"         
#> [16] "get_param"               "get_signatures"          "get_stats"              
#> [19] "is_best_k"               "is_stable_k"             "membership_heatmap"     
#> [22] "ncol"                    "nrow"                    "plot_ecdf"              
#> [25] "rownames"                "select_partition_number" "show"                   
#> [28] "suggest_best_k"          "test_to_known_factors"

collect_plots() function collects all the plots made from res for all k (number of partitions) into one single page to provide an easy and fast comparison between different k.

collect_plots(res)

plot of chunk ATC-kmeans-collect-plots

The plots are:

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:

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)

plot of chunk ATC-kmeans-select-partition-number

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.955       0.973         0.5031 0.494   0.494
#> 3 3 0.833           0.936       0.949         0.3139 0.774   0.572
#> 4 4 0.746           0.681       0.835         0.1117 0.931   0.797
#> 5 5 0.757           0.762       0.822         0.0675 0.882   0.602
#> 6 6 0.820           0.728       0.804         0.0438 0.975   0.879

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.

show/hide code output

cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#>          class entropy silhouette    p1    p2
#> GSM35441     2  0.2948   0.955633 0.052 0.948
#> GSM35446     2  0.0672   0.951900 0.008 0.992
#> GSM35449     2  0.2948   0.955633 0.052 0.948
#> GSM35455     2  0.2948   0.955633 0.052 0.948
#> GSM35458     2  0.0672   0.951900 0.008 0.992
#> GSM35460     2  0.0672   0.951900 0.008 0.992
#> GSM35461     1  0.2948   0.950536 0.948 0.052
#> GSM35463     2  0.2948   0.955633 0.052 0.948
#> GSM35472     2  0.0672   0.951900 0.008 0.992
#> GSM35475     2  0.0672   0.951900 0.008 0.992
#> GSM35483     2  0.0000   0.951210 0.000 1.000
#> GSM35496     1  0.2948   0.950536 0.948 0.052
#> GSM35497     2  0.2948   0.955633 0.052 0.948
#> GSM35504     2  0.0000   0.951210 0.000 1.000
#> GSM35508     2  0.0000   0.951210 0.000 1.000
#> GSM35511     2  0.0672   0.951900 0.008 0.992
#> GSM35512     2  0.0672   0.951900 0.008 0.992
#> GSM35515     2  0.0672   0.951900 0.008 0.992
#> GSM35519     2  0.0672   0.951900 0.008 0.992
#> GSM35527     2  0.0000   0.951210 0.000 1.000
#> GSM35532     2  0.0672   0.951900 0.008 0.992
#> GSM35439     2  0.2948   0.955633 0.052 0.948
#> GSM35443     1  0.0000   0.990406 1.000 0.000
#> GSM35445     1  0.0000   0.990406 1.000 0.000
#> GSM35448     2  0.0672   0.951900 0.008 0.992
#> GSM35451     1  0.0672   0.984115 0.992 0.008
#> GSM35454     1  0.0672   0.985164 0.992 0.008
#> GSM35457     2  0.2948   0.955633 0.052 0.948
#> GSM35465     2  0.2948   0.955633 0.052 0.948
#> GSM35468     1  0.0000   0.990406 1.000 0.000
#> GSM35471     1  0.0000   0.990406 1.000 0.000
#> GSM35473     1  0.0000   0.990406 1.000 0.000
#> GSM35477     1  0.0000   0.990406 1.000 0.000
#> GSM35480     1  0.0000   0.990406 1.000 0.000
#> GSM35482     1  0.2948   0.950536 0.948 0.052
#> GSM35485     2  0.2948   0.955633 0.052 0.948
#> GSM35489     2  0.2948   0.955633 0.052 0.948
#> GSM35492     1  0.0000   0.990406 1.000 0.000
#> GSM35495     2  0.3431   0.916883 0.064 0.936
#> GSM35499     2  0.2948   0.955633 0.052 0.948
#> GSM35502     1  0.0000   0.990406 1.000 0.000
#> GSM35505     1  0.2948   0.950536 0.948 0.052
#> GSM35507     1  0.0672   0.984115 0.992 0.008
#> GSM35510     2  0.2948   0.955633 0.052 0.948
#> GSM35514     1  0.0000   0.990406 1.000 0.000
#> GSM35517     2  0.2948   0.955633 0.052 0.948
#> GSM35520     2  0.0000   0.951210 0.000 1.000
#> GSM35523     1  0.0000   0.990406 1.000 0.000
#> GSM35529     2  0.2948   0.955633 0.052 0.948
#> GSM35531     2  0.2948   0.955633 0.052 0.948
#> GSM35534     2  0.2948   0.955633 0.052 0.948
#> GSM35536     1  0.0000   0.990406 1.000 0.000
#> GSM35538     1  0.0000   0.990406 1.000 0.000
#> GSM35539     1  0.0000   0.990406 1.000 0.000
#> GSM35540     2  0.0000   0.951210 0.000 1.000
#> GSM35541     2  0.2948   0.955633 0.052 0.948
#> GSM35442     1  0.0376   0.987920 0.996 0.004
#> GSM35447     2  0.9998   0.000135 0.492 0.508
#> GSM35450     1  0.0000   0.990406 1.000 0.000
#> GSM35453     1  0.0000   0.990406 1.000 0.000
#> GSM35456     1  0.0000   0.990406 1.000 0.000
#> GSM35464     2  0.2948   0.955633 0.052 0.948
#> GSM35467     1  0.0000   0.990406 1.000 0.000
#> GSM35470     1  0.0000   0.990406 1.000 0.000
#> GSM35479     1  0.2948   0.950536 0.948 0.052
#> GSM35484     1  0.0000   0.990406 1.000 0.000
#> GSM35488     1  0.0000   0.990406 1.000 0.000
#> GSM35491     1  0.0000   0.990406 1.000 0.000
#> GSM35494     1  0.2948   0.950536 0.948 0.052
#> GSM35498     1  0.0000   0.990406 1.000 0.000
#> GSM35501     1  0.0000   0.990406 1.000 0.000
#> GSM35509     2  0.6048   0.824308 0.148 0.852
#> GSM35513     1  0.0000   0.990406 1.000 0.000
#> GSM35516     2  0.2948   0.955633 0.052 0.948
#> GSM35522     1  0.0672   0.984115 0.992 0.008
#> GSM35525     1  0.0000   0.990406 1.000 0.000
#> GSM35528     1  0.0000   0.990406 1.000 0.000
#> GSM35533     1  0.0000   0.990406 1.000 0.000
#> GSM35537     1  0.0000   0.990406 1.000 0.000

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>          class entropy silhouette    p1    p2    p3
#> GSM35441     2  0.0000      0.980 0.000 1.000 0.000
#> GSM35446     3  0.3192      0.918 0.000 0.112 0.888
#> GSM35449     2  0.0000      0.980 0.000 1.000 0.000
#> GSM35455     2  0.0000      0.980 0.000 1.000 0.000
#> GSM35458     3  0.3192      0.918 0.000 0.112 0.888
#> GSM35460     3  0.3192      0.918 0.000 0.112 0.888
#> GSM35461     3  0.4178      0.805 0.172 0.000 0.828
#> GSM35463     2  0.0000      0.980 0.000 1.000 0.000
#> GSM35472     3  0.3116      0.918 0.000 0.108 0.892
#> GSM35475     3  0.3192      0.918 0.000 0.112 0.888
#> GSM35483     2  0.0000      0.980 0.000 1.000 0.000
#> GSM35496     3  0.2066      0.896 0.060 0.000 0.940
#> GSM35497     2  0.0000      0.980 0.000 1.000 0.000
#> GSM35504     2  0.0000      0.980 0.000 1.000 0.000
#> GSM35508     2  0.5058      0.629 0.000 0.756 0.244
#> GSM35511     3  0.3192      0.918 0.000 0.112 0.888
#> GSM35512     3  0.1753      0.914 0.000 0.048 0.952
#> GSM35515     3  0.3192      0.918 0.000 0.112 0.888
#> GSM35519     3  0.3192      0.918 0.000 0.112 0.888
#> GSM35527     2  0.0000      0.980 0.000 1.000 0.000
#> GSM35532     3  0.3192      0.918 0.000 0.112 0.888
#> GSM35439     2  0.0000      0.980 0.000 1.000 0.000
#> GSM35443     1  0.0747      0.964 0.984 0.000 0.016
#> GSM35445     1  0.0747      0.964 0.984 0.000 0.016
#> GSM35448     3  0.3192      0.918 0.000 0.112 0.888
#> GSM35451     1  0.1753      0.946 0.952 0.000 0.048
#> GSM35454     3  0.4235      0.800 0.176 0.000 0.824
#> GSM35457     2  0.0000      0.980 0.000 1.000 0.000
#> GSM35465     2  0.0000      0.980 0.000 1.000 0.000
#> GSM35468     1  0.0747      0.964 0.984 0.000 0.016
#> GSM35471     1  0.2878      0.928 0.904 0.000 0.096
#> GSM35473     1  0.0747      0.964 0.984 0.000 0.016
#> GSM35477     1  0.1753      0.946 0.952 0.000 0.048
#> GSM35480     1  0.0747      0.964 0.984 0.000 0.016
#> GSM35482     3  0.2261      0.893 0.068 0.000 0.932
#> GSM35485     2  0.0000      0.980 0.000 1.000 0.000
#> GSM35489     2  0.0000      0.980 0.000 1.000 0.000
#> GSM35492     1  0.0747      0.964 0.984 0.000 0.016
#> GSM35495     3  0.1753      0.914 0.000 0.048 0.952
#> GSM35499     2  0.0000      0.980 0.000 1.000 0.000
#> GSM35502     1  0.0747      0.964 0.984 0.000 0.016
#> GSM35505     3  0.2066      0.896 0.060 0.000 0.940
#> GSM35507     1  0.7133      0.708 0.712 0.192 0.096
#> GSM35510     2  0.0000      0.980 0.000 1.000 0.000
#> GSM35514     1  0.0747      0.964 0.984 0.000 0.016
#> GSM35517     2  0.0000      0.980 0.000 1.000 0.000
#> GSM35520     3  0.3192      0.918 0.000 0.112 0.888
#> GSM35523     1  0.2878      0.928 0.904 0.000 0.096
#> GSM35529     2  0.0000      0.980 0.000 1.000 0.000
#> GSM35531     2  0.0000      0.980 0.000 1.000 0.000
#> GSM35534     2  0.0000      0.980 0.000 1.000 0.000
#> GSM35536     1  0.0747      0.964 0.984 0.000 0.016
#> GSM35538     1  0.1753      0.946 0.952 0.000 0.048
#> GSM35539     1  0.1753      0.946 0.952 0.000 0.048
#> GSM35540     2  0.0000      0.980 0.000 1.000 0.000
#> GSM35541     2  0.0000      0.980 0.000 1.000 0.000
#> GSM35442     1  0.0747      0.964 0.984 0.000 0.016
#> GSM35447     3  0.1753      0.899 0.048 0.000 0.952
#> GSM35450     1  0.1753      0.946 0.952 0.000 0.048
#> GSM35453     1  0.0747      0.964 0.984 0.000 0.016
#> GSM35456     1  0.2878      0.928 0.904 0.000 0.096
#> GSM35464     2  0.3610      0.869 0.016 0.888 0.096
#> GSM35467     1  0.0747      0.964 0.984 0.000 0.016
#> GSM35470     1  0.1163      0.959 0.972 0.000 0.028
#> GSM35479     3  0.2261      0.893 0.068 0.000 0.932
#> GSM35484     1  0.0424      0.963 0.992 0.000 0.008
#> GSM35488     1  0.0000      0.961 1.000 0.000 0.000
#> GSM35491     1  0.0747      0.964 0.984 0.000 0.016
#> GSM35494     3  0.4346      0.790 0.184 0.000 0.816
#> GSM35498     1  0.2878      0.928 0.904 0.000 0.096
#> GSM35501     1  0.0747      0.964 0.984 0.000 0.016
#> GSM35509     3  0.1753      0.914 0.000 0.048 0.952
#> GSM35513     1  0.0747      0.964 0.984 0.000 0.016
#> GSM35516     2  0.2492      0.917 0.016 0.936 0.048
#> GSM35522     1  0.2878      0.928 0.904 0.000 0.096
#> GSM35525     1  0.0592      0.963 0.988 0.000 0.012
#> GSM35528     1  0.1753      0.946 0.952 0.000 0.048
#> GSM35533     1  0.0892      0.961 0.980 0.000 0.020
#> GSM35537     1  0.2165      0.939 0.936 0.000 0.064

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>          class entropy silhouette    p1    p2    p3    p4
#> GSM35441     2  0.0336      0.905 0.000 0.992 0.000 0.008
#> GSM35446     3  0.1211      0.829 0.000 0.000 0.960 0.040
#> GSM35449     2  0.0000      0.904 0.000 1.000 0.000 0.000
#> GSM35455     2  0.0000      0.904 0.000 1.000 0.000 0.000
#> GSM35458     3  0.1716      0.821 0.000 0.000 0.936 0.064
#> GSM35460     3  0.2408      0.838 0.000 0.000 0.896 0.104
#> GSM35461     3  0.6041      0.735 0.060 0.000 0.608 0.332
#> GSM35463     2  0.3074      0.889 0.000 0.848 0.000 0.152
#> GSM35472     3  0.1637      0.841 0.000 0.000 0.940 0.060
#> GSM35475     3  0.1716      0.821 0.000 0.000 0.936 0.064
#> GSM35483     2  0.6243      0.743 0.000 0.668 0.172 0.160
#> GSM35496     3  0.5349      0.765 0.024 0.000 0.640 0.336
#> GSM35497     2  0.0000      0.904 0.000 1.000 0.000 0.000
#> GSM35504     2  0.1970      0.872 0.000 0.932 0.008 0.060
#> GSM35508     2  0.6532      0.325 0.000 0.548 0.368 0.084
#> GSM35511     3  0.1637      0.823 0.000 0.000 0.940 0.060
#> GSM35512     3  0.2216      0.840 0.000 0.000 0.908 0.092
#> GSM35515     3  0.1716      0.821 0.000 0.000 0.936 0.064
#> GSM35519     3  0.0592      0.834 0.000 0.000 0.984 0.016
#> GSM35527     2  0.2882      0.846 0.000 0.892 0.024 0.084
#> GSM35532     3  0.1474      0.826 0.000 0.000 0.948 0.052
#> GSM35439     2  0.3074      0.889 0.000 0.848 0.000 0.152
#> GSM35443     1  0.0000      0.779 1.000 0.000 0.000 0.000
#> GSM35445     1  0.0000      0.779 1.000 0.000 0.000 0.000
#> GSM35448     3  0.1118      0.831 0.000 0.000 0.964 0.036
#> GSM35451     1  0.4985     -0.434 0.532 0.000 0.000 0.468
#> GSM35454     3  0.6200      0.705 0.064 0.000 0.580 0.356
#> GSM35457     2  0.0000      0.904 0.000 1.000 0.000 0.000
#> GSM35465     2  0.0000      0.904 0.000 1.000 0.000 0.000
#> GSM35468     1  0.0000      0.779 1.000 0.000 0.000 0.000
#> GSM35471     4  0.4961      0.633 0.448 0.000 0.000 0.552
#> GSM35473     1  0.0000      0.779 1.000 0.000 0.000 0.000
#> GSM35477     1  0.4985     -0.434 0.532 0.000 0.000 0.468
#> GSM35480     1  0.0000      0.779 1.000 0.000 0.000 0.000
#> GSM35482     3  0.5565      0.754 0.032 0.000 0.624 0.344
#> GSM35485     2  0.3074      0.889 0.000 0.848 0.000 0.152
#> GSM35489     2  0.3074      0.889 0.000 0.848 0.000 0.152
#> GSM35492     1  0.0000      0.779 1.000 0.000 0.000 0.000
#> GSM35495     3  0.4277      0.801 0.000 0.000 0.720 0.280
#> GSM35499     2  0.2216      0.898 0.000 0.908 0.000 0.092
#> GSM35502     1  0.0000      0.779 1.000 0.000 0.000 0.000
#> GSM35505     3  0.4222      0.804 0.000 0.000 0.728 0.272
#> GSM35507     4  0.6933      0.584 0.300 0.140 0.000 0.560
#> GSM35510     2  0.0000      0.904 0.000 1.000 0.000 0.000
#> GSM35514     1  0.0000      0.779 1.000 0.000 0.000 0.000
#> GSM35517     2  0.1557      0.903 0.000 0.944 0.000 0.056
#> GSM35520     3  0.2413      0.810 0.000 0.020 0.916 0.064
#> GSM35523     4  0.4877      0.674 0.408 0.000 0.000 0.592
#> GSM35529     2  0.0188      0.903 0.000 0.996 0.000 0.004
#> GSM35531     2  0.3074      0.889 0.000 0.848 0.000 0.152
#> GSM35534     2  0.3074      0.889 0.000 0.848 0.000 0.152
#> GSM35536     1  0.0000      0.779 1.000 0.000 0.000 0.000
#> GSM35538     1  0.4888     -0.238 0.588 0.000 0.000 0.412
#> GSM35539     1  0.4888     -0.238 0.588 0.000 0.000 0.412
#> GSM35540     2  0.0000      0.904 0.000 1.000 0.000 0.000
#> GSM35541     2  0.2868      0.893 0.000 0.864 0.000 0.136
#> GSM35442     1  0.2737      0.622 0.888 0.000 0.008 0.104
#> GSM35447     3  0.2216      0.841 0.000 0.000 0.908 0.092
#> GSM35450     1  0.4888     -0.238 0.588 0.000 0.000 0.412
#> GSM35453     1  0.1211      0.727 0.960 0.000 0.000 0.040
#> GSM35456     4  0.4961      0.633 0.448 0.000 0.000 0.552
#> GSM35464     4  0.4941     -0.142 0.000 0.436 0.000 0.564
#> GSM35467     1  0.0000      0.779 1.000 0.000 0.000 0.000
#> GSM35470     1  0.5000     -0.481 0.500 0.000 0.000 0.500
#> GSM35479     3  0.5442      0.763 0.028 0.000 0.636 0.336
#> GSM35484     1  0.0000      0.779 1.000 0.000 0.000 0.000
#> GSM35488     1  0.0000      0.779 1.000 0.000 0.000 0.000
#> GSM35491     1  0.0000      0.779 1.000 0.000 0.000 0.000
#> GSM35494     3  0.6561      0.692 0.092 0.000 0.564 0.344
#> GSM35498     4  0.4898      0.672 0.416 0.000 0.000 0.584
#> GSM35501     1  0.0000      0.779 1.000 0.000 0.000 0.000
#> GSM35509     3  0.4605      0.776 0.000 0.000 0.664 0.336
#> GSM35513     1  0.0000      0.779 1.000 0.000 0.000 0.000
#> GSM35516     2  0.3400      0.873 0.000 0.820 0.000 0.180
#> GSM35522     4  0.5638      0.676 0.388 0.028 0.000 0.584
#> GSM35525     1  0.0000      0.779 1.000 0.000 0.000 0.000
#> GSM35528     1  0.4888     -0.238 0.588 0.000 0.000 0.412
#> GSM35533     1  0.0188      0.774 0.996 0.000 0.000 0.004
#> GSM35537     4  0.4999      0.411 0.492 0.000 0.000 0.508

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>          class entropy silhouette    p1    p2    p3    p4    p5
#> GSM35441     2  0.0290      0.836 0.000 0.992 0.000 0.008 0.000
#> GSM35446     5  0.4762      0.757 0.000 0.000 0.236 0.064 0.700
#> GSM35449     2  0.0000      0.835 0.000 1.000 0.000 0.000 0.000
#> GSM35455     2  0.0000      0.835 0.000 1.000 0.000 0.000 0.000
#> GSM35458     5  0.3632      0.763 0.000 0.004 0.176 0.020 0.800
#> GSM35460     5  0.5245      0.684 0.000 0.000 0.328 0.064 0.608
#> GSM35461     3  0.1408      0.694 0.008 0.000 0.948 0.000 0.044
#> GSM35463     2  0.5317      0.798 0.000 0.688 0.008 0.196 0.108
#> GSM35472     5  0.4425      0.542 0.000 0.000 0.452 0.004 0.544
#> GSM35475     5  0.3456      0.763 0.000 0.000 0.184 0.016 0.800
#> GSM35483     2  0.6597      0.558 0.000 0.484 0.008 0.176 0.332
#> GSM35496     3  0.0981      0.711 0.008 0.000 0.972 0.008 0.012
#> GSM35497     2  0.0000      0.835 0.000 1.000 0.000 0.000 0.000
#> GSM35504     2  0.2992      0.750 0.000 0.868 0.000 0.068 0.064
#> GSM35508     5  0.6156      0.261 0.000 0.376 0.008 0.108 0.508
#> GSM35511     5  0.4373      0.741 0.000 0.000 0.160 0.080 0.760
#> GSM35512     5  0.4425      0.528 0.000 0.000 0.452 0.004 0.544
#> GSM35515     5  0.3632      0.763 0.000 0.004 0.176 0.020 0.800
#> GSM35519     5  0.3728      0.762 0.000 0.000 0.244 0.008 0.748
#> GSM35527     2  0.4406      0.648 0.000 0.764 0.000 0.108 0.128
#> GSM35532     5  0.4201      0.768 0.000 0.000 0.204 0.044 0.752
#> GSM35439     2  0.5481      0.792 0.000 0.672 0.008 0.200 0.120
#> GSM35443     1  0.0162      0.988 0.996 0.000 0.004 0.000 0.000
#> GSM35445     1  0.0162      0.988 0.996 0.000 0.004 0.000 0.000
#> GSM35448     5  0.4398      0.763 0.000 0.000 0.240 0.040 0.720
#> GSM35451     4  0.4227      0.836 0.292 0.000 0.000 0.692 0.016
#> GSM35454     3  0.1280      0.699 0.024 0.000 0.960 0.008 0.008
#> GSM35457     2  0.0000      0.835 0.000 1.000 0.000 0.000 0.000
#> GSM35465     2  0.0324      0.834 0.000 0.992 0.000 0.004 0.004
#> GSM35468     1  0.0000      0.990 1.000 0.000 0.000 0.000 0.000
#> GSM35471     4  0.4799      0.843 0.228 0.000 0.060 0.708 0.004
#> GSM35473     1  0.0000      0.990 1.000 0.000 0.000 0.000 0.000
#> GSM35477     4  0.4227      0.836 0.292 0.000 0.000 0.692 0.016
#> GSM35480     1  0.0290      0.985 0.992 0.000 0.008 0.000 0.000
#> GSM35482     3  0.0981      0.711 0.008 0.000 0.972 0.008 0.012
#> GSM35485     2  0.5481      0.792 0.000 0.672 0.008 0.200 0.120
#> GSM35489     2  0.5317      0.798 0.000 0.688 0.008 0.196 0.108
#> GSM35492     1  0.0000      0.990 1.000 0.000 0.000 0.000 0.000
#> GSM35495     3  0.2179      0.614 0.000 0.000 0.896 0.004 0.100
#> GSM35499     2  0.3341      0.830 0.000 0.840 0.008 0.128 0.024
#> GSM35502     1  0.0000      0.990 1.000 0.000 0.000 0.000 0.000
#> GSM35505     3  0.2877      0.554 0.004 0.000 0.848 0.004 0.144
#> GSM35507     4  0.5567      0.766 0.128 0.084 0.060 0.724 0.004
#> GSM35510     2  0.0000      0.835 0.000 1.000 0.000 0.000 0.000
#> GSM35514     1  0.0000      0.990 1.000 0.000 0.000 0.000 0.000
#> GSM35517     2  0.2597      0.835 0.000 0.884 0.000 0.092 0.024
#> GSM35520     5  0.3943      0.750 0.000 0.028 0.156 0.016 0.800
#> GSM35523     4  0.5391      0.789 0.164 0.000 0.140 0.688 0.008
#> GSM35529     2  0.0404      0.831 0.000 0.988 0.000 0.012 0.000
#> GSM35531     2  0.5568      0.786 0.000 0.660 0.008 0.212 0.120
#> GSM35534     2  0.5481      0.792 0.000 0.672 0.008 0.200 0.120
#> GSM35536     1  0.0000      0.990 1.000 0.000 0.000 0.000 0.000
#> GSM35538     4  0.4822      0.801 0.344 0.000 0.008 0.628 0.020
#> GSM35539     4  0.4920      0.795 0.348 0.000 0.008 0.620 0.024
#> GSM35540     2  0.0566      0.831 0.000 0.984 0.000 0.012 0.004
#> GSM35541     2  0.5008      0.807 0.000 0.724 0.008 0.160 0.108
#> GSM35442     1  0.1341      0.921 0.944 0.000 0.056 0.000 0.000
#> GSM35447     3  0.4562     -0.491 0.000 0.000 0.496 0.008 0.496
#> GSM35450     4  0.4822      0.801 0.344 0.000 0.008 0.628 0.020
#> GSM35453     1  0.0703      0.962 0.976 0.000 0.024 0.000 0.000
#> GSM35456     4  0.4799      0.842 0.228 0.000 0.060 0.708 0.004
#> GSM35464     4  0.3010      0.543 0.000 0.172 0.000 0.824 0.004
#> GSM35467     1  0.0000      0.990 1.000 0.000 0.000 0.000 0.000
#> GSM35470     3  0.7012     -0.297 0.288 0.000 0.388 0.316 0.008
#> GSM35479     3  0.0981      0.711 0.008 0.000 0.972 0.008 0.012
#> GSM35484     1  0.0162      0.988 0.996 0.000 0.004 0.000 0.000
#> GSM35488     1  0.0162      0.987 0.996 0.000 0.000 0.000 0.004
#> GSM35491     1  0.0000      0.990 1.000 0.000 0.000 0.000 0.000
#> GSM35494     3  0.0740      0.709 0.008 0.000 0.980 0.008 0.004
#> GSM35498     4  0.5063      0.801 0.164 0.000 0.120 0.712 0.004
#> GSM35501     1  0.0000      0.990 1.000 0.000 0.000 0.000 0.000
#> GSM35509     3  0.0898      0.706 0.000 0.000 0.972 0.008 0.020
#> GSM35513     1  0.0000      0.990 1.000 0.000 0.000 0.000 0.000
#> GSM35516     2  0.5666      0.772 0.000 0.640 0.008 0.240 0.112
#> GSM35522     4  0.5644      0.785 0.140 0.028 0.116 0.708 0.008
#> GSM35525     1  0.0740      0.974 0.980 0.000 0.008 0.004 0.008
#> GSM35528     4  0.4905      0.800 0.344 0.000 0.008 0.624 0.024
#> GSM35533     1  0.0566      0.980 0.984 0.000 0.012 0.000 0.004
#> GSM35537     3  0.6955     -0.341 0.248 0.000 0.388 0.356 0.008

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>          class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM35441     2  0.3961      0.389 0.000 0.556 0.000 0.004 0.000 0.440
#> GSM35446     5  0.3831      0.796 0.000 0.000 0.044 0.028 0.796 0.132
#> GSM35449     2  0.3975      0.374 0.000 0.544 0.000 0.004 0.000 0.452
#> GSM35455     2  0.3971      0.382 0.000 0.548 0.000 0.004 0.000 0.448
#> GSM35458     5  0.3111      0.809 0.000 0.016 0.040 0.020 0.868 0.056
#> GSM35460     5  0.5385      0.725 0.000 0.000 0.168 0.036 0.660 0.136
#> GSM35461     3  0.2563      0.773 0.000 0.000 0.880 0.004 0.076 0.040
#> GSM35463     2  0.0725      0.547 0.000 0.976 0.000 0.012 0.000 0.012
#> GSM35472     5  0.3714      0.681 0.000 0.000 0.264 0.008 0.720 0.008
#> GSM35475     5  0.1988      0.822 0.000 0.016 0.040 0.004 0.924 0.016
#> GSM35483     2  0.3613      0.254 0.000 0.772 0.000 0.008 0.196 0.024
#> GSM35496     3  0.0748      0.818 0.000 0.000 0.976 0.004 0.016 0.004
#> GSM35497     2  0.3971      0.382 0.000 0.548 0.000 0.004 0.000 0.448
#> GSM35504     6  0.4170      0.357 0.000 0.328 0.000 0.020 0.004 0.648
#> GSM35508     6  0.4929      0.443 0.000 0.040 0.004 0.032 0.260 0.664
#> GSM35511     5  0.3129      0.775 0.000 0.000 0.004 0.024 0.820 0.152
#> GSM35512     5  0.3644      0.694 0.000 0.000 0.252 0.008 0.732 0.008
#> GSM35515     5  0.3111      0.809 0.000 0.016 0.040 0.020 0.868 0.056
#> GSM35519     5  0.1644      0.825 0.000 0.012 0.052 0.000 0.932 0.004
#> GSM35527     6  0.4519      0.560 0.000 0.248 0.004 0.028 0.024 0.696
#> GSM35532     5  0.3399      0.794 0.000 0.000 0.024 0.024 0.820 0.132
#> GSM35439     2  0.0622      0.543 0.000 0.980 0.000 0.008 0.012 0.000
#> GSM35443     1  0.1788      0.940 0.916 0.000 0.004 0.004 0.000 0.076
#> GSM35445     1  0.1588      0.943 0.924 0.000 0.004 0.000 0.000 0.072
#> GSM35448     5  0.3784      0.805 0.000 0.000 0.048 0.036 0.808 0.108
#> GSM35451     4  0.3092      0.927 0.104 0.000 0.000 0.836 0.000 0.060
#> GSM35454     3  0.2118      0.800 0.004 0.000 0.916 0.012 0.020 0.048
#> GSM35457     2  0.3971      0.382 0.000 0.548 0.000 0.004 0.000 0.448
#> GSM35465     2  0.3975      0.378 0.000 0.544 0.000 0.004 0.000 0.452
#> GSM35468     1  0.0000      0.961 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM35471     4  0.2020      0.928 0.096 0.000 0.008 0.896 0.000 0.000
#> GSM35473     1  0.0363      0.961 0.988 0.000 0.000 0.000 0.000 0.012
#> GSM35477     4  0.3092      0.927 0.104 0.000 0.000 0.836 0.000 0.060
#> GSM35480     1  0.1049      0.957 0.960 0.000 0.008 0.000 0.000 0.032
#> GSM35482     3  0.0622      0.819 0.000 0.000 0.980 0.008 0.012 0.000
#> GSM35485     2  0.0622      0.543 0.000 0.980 0.000 0.008 0.012 0.000
#> GSM35489     2  0.0260      0.547 0.000 0.992 0.000 0.008 0.000 0.000
#> GSM35492     1  0.1285      0.951 0.944 0.000 0.004 0.000 0.000 0.052
#> GSM35495     3  0.2170      0.786 0.000 0.000 0.908 0.016 0.060 0.016
#> GSM35499     2  0.3690      0.462 0.000 0.684 0.000 0.008 0.000 0.308
#> GSM35502     1  0.0363      0.961 0.988 0.000 0.000 0.000 0.000 0.012
#> GSM35505     3  0.4590      0.467 0.000 0.000 0.668 0.012 0.272 0.048
#> GSM35507     4  0.2844      0.905 0.060 0.028 0.008 0.880 0.000 0.024
#> GSM35510     2  0.3971      0.382 0.000 0.548 0.000 0.004 0.000 0.448
#> GSM35514     1  0.0363      0.961 0.988 0.000 0.000 0.000 0.000 0.012
#> GSM35517     2  0.3288      0.478 0.000 0.724 0.000 0.000 0.000 0.276
#> GSM35520     5  0.1921      0.819 0.000 0.032 0.024 0.004 0.928 0.012
#> GSM35523     4  0.3682      0.894 0.080 0.000 0.028 0.824 0.004 0.064
#> GSM35529     2  0.3982      0.355 0.000 0.536 0.000 0.004 0.000 0.460
#> GSM35531     2  0.1078      0.531 0.000 0.964 0.000 0.016 0.008 0.012
#> GSM35534     2  0.0622      0.543 0.000 0.980 0.000 0.008 0.012 0.000
#> GSM35536     1  0.0146      0.961 0.996 0.000 0.000 0.000 0.000 0.004
#> GSM35538     4  0.3469      0.918 0.120 0.000 0.004 0.812 0.000 0.064
#> GSM35539     4  0.3883      0.912 0.120 0.000 0.008 0.792 0.004 0.076
#> GSM35540     2  0.4120      0.327 0.000 0.524 0.000 0.004 0.004 0.468
#> GSM35541     2  0.0632      0.548 0.000 0.976 0.000 0.000 0.000 0.024
#> GSM35442     1  0.2685      0.906 0.872 0.000 0.044 0.004 0.000 0.080
#> GSM35447     5  0.4022      0.614 0.000 0.000 0.288 0.008 0.688 0.016
#> GSM35450     4  0.3469      0.918 0.120 0.000 0.004 0.812 0.000 0.064
#> GSM35453     1  0.1148      0.953 0.960 0.000 0.016 0.004 0.000 0.020
#> GSM35456     4  0.2555      0.925 0.096 0.000 0.008 0.876 0.000 0.020
#> GSM35464     4  0.2436      0.826 0.000 0.088 0.000 0.880 0.000 0.032
#> GSM35467     1  0.0363      0.961 0.988 0.000 0.000 0.000 0.000 0.012
#> GSM35470     3  0.6858      0.327 0.168 0.000 0.512 0.212 0.004 0.104
#> GSM35479     3  0.0964      0.817 0.000 0.000 0.968 0.016 0.012 0.004
#> GSM35484     1  0.1949      0.934 0.904 0.000 0.004 0.004 0.000 0.088
#> GSM35488     1  0.0777      0.956 0.972 0.000 0.004 0.000 0.000 0.024
#> GSM35491     1  0.1285      0.951 0.944 0.000 0.004 0.000 0.000 0.052
#> GSM35494     3  0.0622      0.819 0.000 0.000 0.980 0.008 0.012 0.000
#> GSM35498     4  0.2595      0.922 0.084 0.000 0.016 0.880 0.000 0.020
#> GSM35501     1  0.0363      0.961 0.988 0.000 0.000 0.000 0.000 0.012
#> GSM35509     3  0.1167      0.817 0.000 0.000 0.960 0.020 0.012 0.008
#> GSM35513     1  0.0363      0.961 0.988 0.000 0.000 0.000 0.000 0.012
#> GSM35516     2  0.2199      0.451 0.000 0.892 0.000 0.088 0.000 0.020
#> GSM35522     4  0.3615      0.894 0.072 0.004 0.020 0.832 0.004 0.068
#> GSM35525     1  0.1554      0.941 0.940 0.000 0.008 0.004 0.004 0.044
#> GSM35528     4  0.3731      0.917 0.116 0.000 0.004 0.800 0.004 0.076
#> GSM35533     1  0.2261      0.923 0.884 0.000 0.004 0.008 0.000 0.104
#> GSM35537     3  0.6730      0.277 0.128 0.000 0.508 0.264 0.004 0.096

Heatmaps for the consensus matrix. It visualizes the probability of two samples to be in a same group.

consensus_heatmap(res, k = 2)

plot of chunk tab-ATC-kmeans-consensus-heatmap-1

consensus_heatmap(res, k = 3)

plot of chunk tab-ATC-kmeans-consensus-heatmap-2

consensus_heatmap(res, k = 4)

plot of chunk tab-ATC-kmeans-consensus-heatmap-3

consensus_heatmap(res, k = 5)

plot of chunk tab-ATC-kmeans-consensus-heatmap-4

consensus_heatmap(res, k = 6)

plot of chunk tab-ATC-kmeans-consensus-heatmap-5

Heatmaps for the membership of samples in all partitions to see how consistent they are:

membership_heatmap(res, k = 2)

plot of chunk tab-ATC-kmeans-membership-heatmap-1

membership_heatmap(res, k = 3)

plot of chunk tab-ATC-kmeans-membership-heatmap-2

membership_heatmap(res, k = 4)

plot of chunk tab-ATC-kmeans-membership-heatmap-3

membership_heatmap(res, k = 5)

plot of chunk tab-ATC-kmeans-membership-heatmap-4

membership_heatmap(res, k = 6)

plot of chunk tab-ATC-kmeans-membership-heatmap-5

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)

plot of chunk tab-ATC-kmeans-get-signatures-1

get_signatures(res, k = 3)

plot of chunk tab-ATC-kmeans-get-signatures-2

get_signatures(res, k = 4)

plot of chunk tab-ATC-kmeans-get-signatures-3

get_signatures(res, k = 5)

plot of chunk tab-ATC-kmeans-get-signatures-4

get_signatures(res, k = 6)

plot of chunk tab-ATC-kmeans-get-signatures-5

Signature heatmaps where rows are not scaled:

get_signatures(res, k = 2, scale_rows = FALSE)

plot of chunk tab-ATC-kmeans-get-signatures-no-scale-1

get_signatures(res, k = 3, scale_rows = FALSE)

plot of chunk tab-ATC-kmeans-get-signatures-no-scale-2

get_signatures(res, k = 4, scale_rows = FALSE)

plot of chunk tab-ATC-kmeans-get-signatures-no-scale-3

get_signatures(res, k = 5, scale_rows = FALSE)

plot of chunk tab-ATC-kmeans-get-signatures-no-scale-4

get_signatures(res, k = 6, scale_rows = FALSE)

plot of chunk tab-ATC-kmeans-get-signatures-no-scale-5

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk ATC-kmeans-signature_compare

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:

  1. which_row: row indices corresponding to the input matrix.
  2. fdr: FDR for the differential test.
  3. mean_x: The mean value in group x.
  4. scaled_mean_x: The mean value in group x after rows are scaled.
  5. 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")

plot of chunk tab-ATC-kmeans-dimension-reduction-1

dimension_reduction(res, k = 3, method = "UMAP")

plot of chunk tab-ATC-kmeans-dimension-reduction-2

dimension_reduction(res, k = 4, method = "UMAP")

plot of chunk tab-ATC-kmeans-dimension-reduction-3

dimension_reduction(res, k = 5, method = "UMAP")

plot of chunk tab-ATC-kmeans-dimension-reduction-4

dimension_reduction(res, k = 6, method = "UMAP")

plot of chunk tab-ATC-kmeans-dimension-reduction-5

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk ATC-kmeans-collect-classes

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  time(p) k
#> ATC:kmeans 78 2.73e-06 2
#> ATC:kmeans 79 9.57e-06 3
#> ATC:kmeans 69 2.16e-04 4
#> ATC:kmeans 75 2.03e-06 5
#> ATC:kmeans 61 1.20e-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.


ATC:skmeans*

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 7758 rows and 79 columns.
#>   Top rows (776, 1552, 2328, 3103, 3879) 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)

plot of chunk ATC-skmeans-collect-plots

The plots are:

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:

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)

plot of chunk ATC-skmeans-select-partition-number

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.990       0.996         0.5066 0.494   0.494
#> 3 3 0.982           0.960       0.983         0.3098 0.756   0.544
#> 4 4 0.947           0.955       0.970         0.1257 0.903   0.715
#> 5 5 0.965           0.920       0.961         0.0625 0.932   0.741
#> 6 6 0.911           0.902       0.919         0.0408 0.954   0.776

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.

show/hide code output

cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#>          class entropy silhouette    p1    p2
#> GSM35441     2   0.000      0.991 0.000 1.000
#> GSM35446     2   0.000      0.991 0.000 1.000
#> GSM35449     2   0.000      0.991 0.000 1.000
#> GSM35455     2   0.000      0.991 0.000 1.000
#> GSM35458     2   0.000      0.991 0.000 1.000
#> GSM35460     2   0.000      0.991 0.000 1.000
#> GSM35461     1   0.000      1.000 1.000 0.000
#> GSM35463     2   0.000      0.991 0.000 1.000
#> GSM35472     2   0.000      0.991 0.000 1.000
#> GSM35475     2   0.000      0.991 0.000 1.000
#> GSM35483     2   0.000      0.991 0.000 1.000
#> GSM35496     1   0.000      1.000 1.000 0.000
#> GSM35497     2   0.000      0.991 0.000 1.000
#> GSM35504     2   0.000      0.991 0.000 1.000
#> GSM35508     2   0.000      0.991 0.000 1.000
#> GSM35511     2   0.000      0.991 0.000 1.000
#> GSM35512     2   0.000      0.991 0.000 1.000
#> GSM35515     2   0.000      0.991 0.000 1.000
#> GSM35519     2   0.000      0.991 0.000 1.000
#> GSM35527     2   0.000      0.991 0.000 1.000
#> GSM35532     2   0.000      0.991 0.000 1.000
#> GSM35439     2   0.000      0.991 0.000 1.000
#> GSM35443     1   0.000      1.000 1.000 0.000
#> GSM35445     1   0.000      1.000 1.000 0.000
#> GSM35448     2   0.000      0.991 0.000 1.000
#> GSM35451     1   0.000      1.000 1.000 0.000
#> GSM35454     1   0.000      1.000 1.000 0.000
#> GSM35457     2   0.000      0.991 0.000 1.000
#> GSM35465     2   0.000      0.991 0.000 1.000
#> GSM35468     1   0.000      1.000 1.000 0.000
#> GSM35471     1   0.000      1.000 1.000 0.000
#> GSM35473     1   0.000      1.000 1.000 0.000
#> GSM35477     1   0.000      1.000 1.000 0.000
#> GSM35480     1   0.000      1.000 1.000 0.000
#> GSM35482     1   0.000      1.000 1.000 0.000
#> GSM35485     2   0.000      0.991 0.000 1.000
#> GSM35489     2   0.000      0.991 0.000 1.000
#> GSM35492     1   0.000      1.000 1.000 0.000
#> GSM35495     2   0.000      0.991 0.000 1.000
#> GSM35499     2   0.000      0.991 0.000 1.000
#> GSM35502     1   0.000      1.000 1.000 0.000
#> GSM35505     1   0.000      1.000 1.000 0.000
#> GSM35507     1   0.000      1.000 1.000 0.000
#> GSM35510     2   0.000      0.991 0.000 1.000
#> GSM35514     1   0.000      1.000 1.000 0.000
#> GSM35517     2   0.000      0.991 0.000 1.000
#> GSM35520     2   0.000      0.991 0.000 1.000
#> GSM35523     1   0.000      1.000 1.000 0.000
#> GSM35529     2   0.000      0.991 0.000 1.000
#> GSM35531     2   0.000      0.991 0.000 1.000
#> GSM35534     2   0.000      0.991 0.000 1.000
#> GSM35536     1   0.000      1.000 1.000 0.000
#> GSM35538     1   0.000      1.000 1.000 0.000
#> GSM35539     1   0.000      1.000 1.000 0.000
#> GSM35540     2   0.000      0.991 0.000 1.000
#> GSM35541     2   0.000      0.991 0.000 1.000
#> GSM35442     1   0.000      1.000 1.000 0.000
#> GSM35447     2   0.827      0.651 0.260 0.740
#> GSM35450     1   0.000      1.000 1.000 0.000
#> GSM35453     1   0.000      1.000 1.000 0.000
#> GSM35456     1   0.000      1.000 1.000 0.000
#> GSM35464     2   0.000      0.991 0.000 1.000
#> GSM35467     1   0.000      1.000 1.000 0.000
#> GSM35470     1   0.000      1.000 1.000 0.000
#> GSM35479     1   0.000      1.000 1.000 0.000
#> GSM35484     1   0.000      1.000 1.000 0.000
#> GSM35488     1   0.000      1.000 1.000 0.000
#> GSM35491     1   0.000      1.000 1.000 0.000
#> GSM35494     1   0.000      1.000 1.000 0.000
#> GSM35498     1   0.000      1.000 1.000 0.000
#> GSM35501     1   0.000      1.000 1.000 0.000
#> GSM35509     2   0.430      0.900 0.088 0.912
#> GSM35513     1   0.000      1.000 1.000 0.000
#> GSM35516     2   0.000      0.991 0.000 1.000
#> GSM35522     1   0.000      1.000 1.000 0.000
#> GSM35525     1   0.000      1.000 1.000 0.000
#> GSM35528     1   0.000      1.000 1.000 0.000
#> GSM35533     1   0.000      1.000 1.000 0.000
#> GSM35537     1   0.000      1.000 1.000 0.000

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>          class entropy silhouette    p1    p2    p3
#> GSM35441     2  0.0000      0.969 0.000 1.000 0.000
#> GSM35446     3  0.0000      0.967 0.000 0.000 1.000
#> GSM35449     2  0.0000      0.969 0.000 1.000 0.000
#> GSM35455     2  0.0000      0.969 0.000 1.000 0.000
#> GSM35458     3  0.0000      0.967 0.000 0.000 1.000
#> GSM35460     3  0.0000      0.967 0.000 0.000 1.000
#> GSM35461     3  0.4399      0.788 0.188 0.000 0.812
#> GSM35463     2  0.0000      0.969 0.000 1.000 0.000
#> GSM35472     3  0.0000      0.967 0.000 0.000 1.000
#> GSM35475     3  0.0000      0.967 0.000 0.000 1.000
#> GSM35483     2  0.0000      0.969 0.000 1.000 0.000
#> GSM35496     3  0.0000      0.967 0.000 0.000 1.000
#> GSM35497     2  0.0000      0.969 0.000 1.000 0.000
#> GSM35504     2  0.0000      0.969 0.000 1.000 0.000
#> GSM35508     2  0.5465      0.574 0.000 0.712 0.288
#> GSM35511     3  0.0000      0.967 0.000 0.000 1.000
#> GSM35512     3  0.0000      0.967 0.000 0.000 1.000
#> GSM35515     3  0.0000      0.967 0.000 0.000 1.000
#> GSM35519     3  0.0000      0.967 0.000 0.000 1.000
#> GSM35527     2  0.0000      0.969 0.000 1.000 0.000
#> GSM35532     3  0.0000      0.967 0.000 0.000 1.000
#> GSM35439     2  0.0000      0.969 0.000 1.000 0.000
#> GSM35443     1  0.0000      0.998 1.000 0.000 0.000
#> GSM35445     1  0.0000      0.998 1.000 0.000 0.000
#> GSM35448     3  0.0000      0.967 0.000 0.000 1.000
#> GSM35451     1  0.0000      0.998 1.000 0.000 0.000
#> GSM35454     3  0.4555      0.773 0.200 0.000 0.800
#> GSM35457     2  0.0000      0.969 0.000 1.000 0.000
#> GSM35465     2  0.0000      0.969 0.000 1.000 0.000
#> GSM35468     1  0.0000      0.998 1.000 0.000 0.000
#> GSM35471     1  0.0000      0.998 1.000 0.000 0.000
#> GSM35473     1  0.0000      0.998 1.000 0.000 0.000
#> GSM35477     1  0.0000      0.998 1.000 0.000 0.000
#> GSM35480     1  0.0000      0.998 1.000 0.000 0.000
#> GSM35482     3  0.0592      0.958 0.012 0.000 0.988
#> GSM35485     2  0.0000      0.969 0.000 1.000 0.000
#> GSM35489     2  0.0000      0.969 0.000 1.000 0.000
#> GSM35492     1  0.0000      0.998 1.000 0.000 0.000
#> GSM35495     3  0.0000      0.967 0.000 0.000 1.000
#> GSM35499     2  0.0000      0.969 0.000 1.000 0.000
#> GSM35502     1  0.0000      0.998 1.000 0.000 0.000
#> GSM35505     3  0.0000      0.967 0.000 0.000 1.000
#> GSM35507     2  0.6079      0.357 0.388 0.612 0.000
#> GSM35510     2  0.0000      0.969 0.000 1.000 0.000
#> GSM35514     1  0.0000      0.998 1.000 0.000 0.000
#> GSM35517     2  0.0000      0.969 0.000 1.000 0.000
#> GSM35520     3  0.0592      0.958 0.000 0.012 0.988
#> GSM35523     1  0.0000      0.998 1.000 0.000 0.000
#> GSM35529     2  0.0000      0.969 0.000 1.000 0.000
#> GSM35531     2  0.0000      0.969 0.000 1.000 0.000
#> GSM35534     2  0.0000      0.969 0.000 1.000 0.000
#> GSM35536     1  0.0000      0.998 1.000 0.000 0.000
#> GSM35538     1  0.0000      0.998 1.000 0.000 0.000
#> GSM35539     1  0.0000      0.998 1.000 0.000 0.000
#> GSM35540     2  0.0000      0.969 0.000 1.000 0.000
#> GSM35541     2  0.0000      0.969 0.000 1.000 0.000
#> GSM35442     1  0.0000      0.998 1.000 0.000 0.000
#> GSM35447     3  0.0000      0.967 0.000 0.000 1.000
#> GSM35450     1  0.0000      0.998 1.000 0.000 0.000
#> GSM35453     1  0.0000      0.998 1.000 0.000 0.000
#> GSM35456     1  0.0000      0.998 1.000 0.000 0.000
#> GSM35464     2  0.0000      0.969 0.000 1.000 0.000
#> GSM35467     1  0.0000      0.998 1.000 0.000 0.000
#> GSM35470     1  0.0000      0.998 1.000 0.000 0.000
#> GSM35479     3  0.0000      0.967 0.000 0.000 1.000
#> GSM35484     1  0.0000      0.998 1.000 0.000 0.000
#> GSM35488     1  0.0000      0.998 1.000 0.000 0.000
#> GSM35491     1  0.0000      0.998 1.000 0.000 0.000
#> GSM35494     3  0.4555      0.773 0.200 0.000 0.800
#> GSM35498     1  0.0000      0.998 1.000 0.000 0.000
#> GSM35501     1  0.0000      0.998 1.000 0.000 0.000
#> GSM35509     3  0.0000      0.967 0.000 0.000 1.000
#> GSM35513     1  0.0000      0.998 1.000 0.000 0.000
#> GSM35516     2  0.0000      0.969 0.000 1.000 0.000
#> GSM35522     1  0.1643      0.952 0.956 0.044 0.000
#> GSM35525     1  0.0000      0.998 1.000 0.000 0.000
#> GSM35528     1  0.0000      0.998 1.000 0.000 0.000
#> GSM35533     1  0.0000      0.998 1.000 0.000 0.000
#> GSM35537     1  0.0000      0.998 1.000 0.000 0.000

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>          class entropy silhouette    p1    p2    p3    p4
#> GSM35441     2  0.0000      0.988 0.000 1.000 0.000 0.000
#> GSM35446     3  0.0000      0.922 0.000 0.000 1.000 0.000
#> GSM35449     2  0.0000      0.988 0.000 1.000 0.000 0.000
#> GSM35455     2  0.0000      0.988 0.000 1.000 0.000 0.000
#> GSM35458     3  0.0000      0.922 0.000 0.000 1.000 0.000
#> GSM35460     3  0.0000      0.922 0.000 0.000 1.000 0.000
#> GSM35461     3  0.4540      0.804 0.196 0.000 0.772 0.032
#> GSM35463     2  0.0000      0.988 0.000 1.000 0.000 0.000
#> GSM35472     3  0.0000      0.922 0.000 0.000 1.000 0.000
#> GSM35475     3  0.0000      0.922 0.000 0.000 1.000 0.000
#> GSM35483     2  0.0336      0.981 0.000 0.992 0.008 0.000
#> GSM35496     3  0.4375      0.820 0.180 0.000 0.788 0.032
#> GSM35497     2  0.0000      0.988 0.000 1.000 0.000 0.000
#> GSM35504     2  0.0000      0.988 0.000 1.000 0.000 0.000
#> GSM35508     2  0.3907      0.701 0.000 0.768 0.232 0.000
#> GSM35511     3  0.0000      0.922 0.000 0.000 1.000 0.000
#> GSM35512     3  0.0000      0.922 0.000 0.000 1.000 0.000
#> GSM35515     3  0.0000      0.922 0.000 0.000 1.000 0.000
#> GSM35519     3  0.0000      0.922 0.000 0.000 1.000 0.000
#> GSM35527     2  0.0000      0.988 0.000 1.000 0.000 0.000
#> GSM35532     3  0.0000      0.922 0.000 0.000 1.000 0.000
#> GSM35439     2  0.0000      0.988 0.000 1.000 0.000 0.000
#> GSM35443     1  0.0000      0.992 1.000 0.000 0.000 0.000
#> GSM35445     1  0.0000      0.992 1.000 0.000 0.000 0.000
#> GSM35448     3  0.0000      0.922 0.000 0.000 1.000 0.000
#> GSM35451     4  0.1022      0.995 0.032 0.000 0.000 0.968
#> GSM35454     3  0.4540      0.804 0.196 0.000 0.772 0.032
#> GSM35457     2  0.0000      0.988 0.000 1.000 0.000 0.000
#> GSM35465     2  0.0000      0.988 0.000 1.000 0.000 0.000
#> GSM35468     1  0.0000      0.992 1.000 0.000 0.000 0.000
#> GSM35471     4  0.1022      0.995 0.032 0.000 0.000 0.968
#> GSM35473     1  0.0000      0.992 1.000 0.000 0.000 0.000
#> GSM35477     4  0.1022      0.995 0.032 0.000 0.000 0.968
#> GSM35480     1  0.0000      0.992 1.000 0.000 0.000 0.000
#> GSM35482     3  0.4375      0.820 0.180 0.000 0.788 0.032
#> GSM35485     2  0.0000      0.988 0.000 1.000 0.000 0.000
#> GSM35489     2  0.0000      0.988 0.000 1.000 0.000 0.000
#> GSM35492     1  0.0000      0.992 1.000 0.000 0.000 0.000
#> GSM35495     3  0.1022      0.915 0.000 0.000 0.968 0.032
#> GSM35499     2  0.0000      0.988 0.000 1.000 0.000 0.000
#> GSM35502     1  0.0000      0.992 1.000 0.000 0.000 0.000
#> GSM35505     3  0.2699      0.890 0.068 0.000 0.904 0.028
#> GSM35507     4  0.1109      0.992 0.028 0.004 0.000 0.968
#> GSM35510     2  0.0000      0.988 0.000 1.000 0.000 0.000
#> GSM35514     1  0.0000      0.992 1.000 0.000 0.000 0.000
#> GSM35517     2  0.0000      0.988 0.000 1.000 0.000 0.000
#> GSM35520     3  0.2011      0.857 0.000 0.080 0.920 0.000
#> GSM35523     4  0.0921      0.993 0.028 0.000 0.000 0.972
#> GSM35529     2  0.0000      0.988 0.000 1.000 0.000 0.000
#> GSM35531     2  0.0000      0.988 0.000 1.000 0.000 0.000
#> GSM35534     2  0.0000      0.988 0.000 1.000 0.000 0.000
#> GSM35536     1  0.0000      0.992 1.000 0.000 0.000 0.000
#> GSM35538     4  0.1022      0.995 0.032 0.000 0.000 0.968
#> GSM35539     4  0.1022      0.995 0.032 0.000 0.000 0.968
#> GSM35540     2  0.0000      0.988 0.000 1.000 0.000 0.000
#> GSM35541     2  0.0000      0.988 0.000 1.000 0.000 0.000
#> GSM35442     1  0.0336      0.985 0.992 0.000 0.000 0.008
#> GSM35447     3  0.0336      0.921 0.000 0.000 0.992 0.008
#> GSM35450     4  0.1022      0.995 0.032 0.000 0.000 0.968
#> GSM35453     1  0.0188      0.988 0.996 0.000 0.000 0.004
#> GSM35456     4  0.1022      0.995 0.032 0.000 0.000 0.968
#> GSM35464     4  0.1022      0.959 0.000 0.032 0.000 0.968
#> GSM35467     1  0.0000      0.992 1.000 0.000 0.000 0.000
#> GSM35470     1  0.0592      0.981 0.984 0.000 0.000 0.016
#> GSM35479     3  0.4375      0.820 0.180 0.000 0.788 0.032
#> GSM35484     1  0.0000      0.992 1.000 0.000 0.000 0.000
#> GSM35488     1  0.0000      0.992 1.000 0.000 0.000 0.000
#> GSM35491     1  0.0000      0.992 1.000 0.000 0.000 0.000
#> GSM35494     3  0.4579      0.799 0.200 0.000 0.768 0.032
#> GSM35498     4  0.0921      0.993 0.028 0.000 0.000 0.972
#> GSM35501     1  0.0000      0.992 1.000 0.000 0.000 0.000
#> GSM35509     3  0.1022      0.915 0.000 0.000 0.968 0.032
#> GSM35513     1  0.0000      0.992 1.000 0.000 0.000 0.000
#> GSM35516     2  0.0000      0.988 0.000 1.000 0.000 0.000
#> GSM35522     4  0.0921      0.993 0.028 0.000 0.000 0.972
#> GSM35525     1  0.0000      0.992 1.000 0.000 0.000 0.000
#> GSM35528     4  0.1022      0.995 0.032 0.000 0.000 0.968
#> GSM35533     1  0.0000      0.992 1.000 0.000 0.000 0.000
#> GSM35537     1  0.2973      0.836 0.856 0.000 0.000 0.144

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>          class entropy silhouette    p1    p2    p3    p4    p5
#> GSM35441     2  0.0000      0.970 0.000 1.000 0.000 0.000 0.000
#> GSM35446     5  0.0609      0.941 0.000 0.000 0.020 0.000 0.980
#> GSM35449     2  0.0000      0.970 0.000 1.000 0.000 0.000 0.000
#> GSM35455     2  0.0000      0.970 0.000 1.000 0.000 0.000 0.000
#> GSM35458     5  0.0162      0.940 0.000 0.000 0.004 0.000 0.996
#> GSM35460     5  0.2424      0.879 0.000 0.000 0.132 0.000 0.868
#> GSM35461     3  0.0807      0.854 0.012 0.000 0.976 0.000 0.012
#> GSM35463     2  0.0960      0.964 0.000 0.972 0.016 0.008 0.004
#> GSM35472     5  0.2471      0.875 0.000 0.000 0.136 0.000 0.864
#> GSM35475     5  0.0162      0.942 0.000 0.000 0.004 0.000 0.996
#> GSM35483     2  0.4884      0.353 0.000 0.584 0.016 0.008 0.392
#> GSM35496     3  0.0579      0.854 0.008 0.000 0.984 0.000 0.008
#> GSM35497     2  0.0000      0.970 0.000 1.000 0.000 0.000 0.000
#> GSM35504     2  0.0000      0.970 0.000 1.000 0.000 0.000 0.000
#> GSM35508     5  0.2020      0.852 0.000 0.100 0.000 0.000 0.900
#> GSM35511     5  0.0290      0.943 0.000 0.000 0.008 0.000 0.992
#> GSM35512     5  0.2516      0.872 0.000 0.000 0.140 0.000 0.860
#> GSM35515     5  0.0162      0.940 0.000 0.000 0.004 0.000 0.996
#> GSM35519     5  0.0290      0.943 0.000 0.000 0.008 0.000 0.992
#> GSM35527     2  0.0162      0.968 0.000 0.996 0.000 0.000 0.004
#> GSM35532     5  0.0290      0.943 0.000 0.000 0.008 0.000 0.992
#> GSM35439     2  0.1087      0.963 0.000 0.968 0.016 0.008 0.008
#> GSM35443     1  0.0000      1.000 1.000 0.000 0.000 0.000 0.000
#> GSM35445     1  0.0000      1.000 1.000 0.000 0.000 0.000 0.000
#> GSM35448     5  0.0510      0.942 0.000 0.000 0.016 0.000 0.984
#> GSM35451     4  0.0290      0.969 0.008 0.000 0.000 0.992 0.000
#> GSM35454     3  0.0693      0.854 0.012 0.000 0.980 0.000 0.008
#> GSM35457     2  0.0000      0.970 0.000 1.000 0.000 0.000 0.000
#> GSM35465     2  0.0000      0.970 0.000 1.000 0.000 0.000 0.000
#> GSM35468     1  0.0000      1.000 1.000 0.000 0.000 0.000 0.000
#> GSM35471     4  0.0290      0.969 0.008 0.000 0.000 0.992 0.000
#> GSM35473     1  0.0000      1.000 1.000 0.000 0.000 0.000 0.000
#> GSM35477     4  0.0290      0.969 0.008 0.000 0.000 0.992 0.000
#> GSM35480     1  0.0000      1.000 1.000 0.000 0.000 0.000 0.000
#> GSM35482     3  0.0579      0.854 0.008 0.000 0.984 0.000 0.008
#> GSM35485     2  0.1087      0.963 0.000 0.968 0.016 0.008 0.008
#> GSM35489     2  0.0960      0.964 0.000 0.972 0.016 0.008 0.004
#> GSM35492     1  0.0000      1.000 1.000 0.000 0.000 0.000 0.000
#> GSM35495     3  0.0703      0.846 0.000 0.000 0.976 0.000 0.024
#> GSM35499     2  0.0000      0.970 0.000 1.000 0.000 0.000 0.000
#> GSM35502     1  0.0000      1.000 1.000 0.000 0.000 0.000 0.000
#> GSM35505     3  0.3519      0.605 0.008 0.000 0.776 0.000 0.216
#> GSM35507     4  0.0290      0.965 0.000 0.008 0.000 0.992 0.000
#> GSM35510     2  0.0000      0.970 0.000 1.000 0.000 0.000 0.000
#> GSM35514     1  0.0000      1.000 1.000 0.000 0.000 0.000 0.000
#> GSM35517     2  0.0000      0.970 0.000 1.000 0.000 0.000 0.000
#> GSM35520     5  0.0000      0.940 0.000 0.000 0.000 0.000 1.000
#> GSM35523     4  0.0290      0.964 0.000 0.000 0.008 0.992 0.000
#> GSM35529     2  0.0000      0.970 0.000 1.000 0.000 0.000 0.000
#> GSM35531     2  0.1087      0.963 0.000 0.968 0.016 0.008 0.008
#> GSM35534     2  0.1087      0.963 0.000 0.968 0.016 0.008 0.008
#> GSM35536     1  0.0000      1.000 1.000 0.000 0.000 0.000 0.000
#> GSM35538     4  0.1608      0.932 0.072 0.000 0.000 0.928 0.000
#> GSM35539     4  0.1908      0.909 0.092 0.000 0.000 0.908 0.000
#> GSM35540     2  0.0000      0.970 0.000 1.000 0.000 0.000 0.000
#> GSM35541     2  0.0960      0.964 0.000 0.972 0.016 0.008 0.004
#> GSM35442     1  0.0162      0.995 0.996 0.000 0.004 0.000 0.000
#> GSM35447     5  0.2690      0.854 0.000 0.000 0.156 0.000 0.844
#> GSM35450     4  0.1478      0.939 0.064 0.000 0.000 0.936 0.000
#> GSM35453     1  0.0000      1.000 1.000 0.000 0.000 0.000 0.000
#> GSM35456     4  0.0290      0.969 0.008 0.000 0.000 0.992 0.000
#> GSM35464     4  0.0290      0.965 0.000 0.008 0.000 0.992 0.000
#> GSM35467     1  0.0000      1.000 1.000 0.000 0.000 0.000 0.000
#> GSM35470     3  0.4743      0.170 0.472 0.000 0.512 0.016 0.000
#> GSM35479     3  0.0579      0.854 0.008 0.000 0.984 0.000 0.008
#> GSM35484     1  0.0000      1.000 1.000 0.000 0.000 0.000 0.000
#> GSM35488     1  0.0000      1.000 1.000 0.000 0.000 0.000 0.000
#> GSM35491     1  0.0000      1.000 1.000 0.000 0.000 0.000 0.000
#> GSM35494     3  0.0693      0.854 0.012 0.000 0.980 0.000 0.008
#> GSM35498     4  0.0324      0.967 0.004 0.000 0.004 0.992 0.000
#> GSM35501     1  0.0000      1.000 1.000 0.000 0.000 0.000 0.000
#> GSM35509     3  0.0609      0.848 0.000 0.000 0.980 0.000 0.020
#> GSM35513     1  0.0000      1.000 1.000 0.000 0.000 0.000 0.000
#> GSM35516     2  0.0960      0.964 0.000 0.972 0.016 0.008 0.004
#> GSM35522     4  0.0290      0.965 0.000 0.008 0.000 0.992 0.000
#> GSM35525     1  0.0000      1.000 1.000 0.000 0.000 0.000 0.000
#> GSM35528     4  0.1478      0.939 0.064 0.000 0.000 0.936 0.000
#> GSM35533     1  0.0000      1.000 1.000 0.000 0.000 0.000 0.000
#> GSM35537     3  0.5280      0.233 0.440 0.000 0.512 0.048 0.000

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>          class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM35441     2  0.0363      0.951 0.000 0.988 0.000 0.000 0.000 0.012
#> GSM35446     5  0.1225      0.922 0.000 0.000 0.036 0.000 0.952 0.012
#> GSM35449     2  0.0000      0.958 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM35455     2  0.0000      0.958 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM35458     5  0.1152      0.917 0.000 0.004 0.000 0.000 0.952 0.044
#> GSM35460     5  0.2968      0.827 0.000 0.000 0.168 0.000 0.816 0.016
#> GSM35461     3  0.1176      0.815 0.000 0.000 0.956 0.000 0.020 0.024
#> GSM35463     6  0.3221      0.965 0.000 0.264 0.000 0.000 0.000 0.736
#> GSM35472     5  0.3176      0.829 0.000 0.000 0.156 0.000 0.812 0.032
#> GSM35475     5  0.0363      0.930 0.000 0.000 0.000 0.000 0.988 0.012
#> GSM35483     6  0.4377      0.814 0.000 0.160 0.000 0.000 0.120 0.720
#> GSM35496     3  0.0000      0.829 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM35497     2  0.0000      0.958 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM35504     2  0.0405      0.953 0.000 0.988 0.000 0.000 0.004 0.008
#> GSM35508     2  0.3404      0.639 0.000 0.760 0.000 0.000 0.224 0.016
#> GSM35511     5  0.0146      0.930 0.000 0.000 0.000 0.000 0.996 0.004
#> GSM35512     5  0.3027      0.838 0.000 0.000 0.148 0.000 0.824 0.028
#> GSM35515     5  0.1152      0.917 0.000 0.004 0.000 0.000 0.952 0.044
#> GSM35519     5  0.0146      0.930 0.000 0.000 0.000 0.000 0.996 0.004
#> GSM35527     2  0.0820      0.938 0.000 0.972 0.000 0.000 0.016 0.012
#> GSM35532     5  0.0146      0.930 0.000 0.000 0.000 0.000 0.996 0.004
#> GSM35439     6  0.3198      0.964 0.000 0.260 0.000 0.000 0.000 0.740
#> GSM35443     1  0.0000      0.994 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM35445     1  0.0000      0.994 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM35448     5  0.0914      0.928 0.000 0.000 0.016 0.000 0.968 0.016
#> GSM35451     4  0.1204      0.931 0.000 0.000 0.000 0.944 0.000 0.056
#> GSM35454     3  0.0935      0.820 0.000 0.000 0.964 0.000 0.004 0.032
#> GSM35457     2  0.0146      0.956 0.000 0.996 0.000 0.000 0.000 0.004
#> GSM35465     2  0.0260      0.955 0.000 0.992 0.000 0.000 0.000 0.008
#> GSM35468     1  0.0000      0.994 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM35471     4  0.0146      0.934 0.000 0.000 0.000 0.996 0.000 0.004
#> GSM35473     1  0.0000      0.994 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM35477     4  0.1204      0.931 0.000 0.000 0.000 0.944 0.000 0.056
#> GSM35480     1  0.0146      0.991 0.996 0.000 0.000 0.000 0.000 0.004
#> GSM35482     3  0.0000      0.829 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM35485     6  0.3221      0.965 0.000 0.264 0.000 0.000 0.000 0.736
#> GSM35489     6  0.3221      0.965 0.000 0.264 0.000 0.000 0.000 0.736
#> GSM35492     1  0.0000      0.994 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM35495     3  0.1334      0.813 0.000 0.000 0.948 0.000 0.020 0.032
#> GSM35499     2  0.0363      0.955 0.000 0.988 0.000 0.000 0.000 0.012
#> GSM35502     1  0.0000      0.994 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM35505     3  0.4453      0.185 0.000 0.000 0.592 0.000 0.372 0.036
#> GSM35507     4  0.1075      0.930 0.000 0.000 0.000 0.952 0.000 0.048
#> GSM35510     2  0.0146      0.956 0.000 0.996 0.000 0.000 0.000 0.004
#> GSM35514     1  0.0000      0.994 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM35517     2  0.1007      0.913 0.000 0.956 0.000 0.000 0.000 0.044
#> GSM35520     5  0.0260      0.929 0.000 0.000 0.000 0.000 0.992 0.008
#> GSM35523     4  0.2006      0.900 0.000 0.000 0.004 0.892 0.000 0.104
#> GSM35529     2  0.0000      0.958 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM35531     6  0.3221      0.965 0.000 0.264 0.000 0.000 0.000 0.736
#> GSM35534     6  0.3175      0.961 0.000 0.256 0.000 0.000 0.000 0.744
#> GSM35536     1  0.0000      0.994 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM35538     4  0.2258      0.907 0.060 0.000 0.000 0.896 0.000 0.044
#> GSM35539     4  0.2837      0.875 0.088 0.000 0.000 0.856 0.000 0.056
#> GSM35540     2  0.0458      0.952 0.000 0.984 0.000 0.000 0.000 0.016
#> GSM35541     6  0.3221      0.965 0.000 0.264 0.000 0.000 0.000 0.736
#> GSM35442     1  0.0146      0.991 0.996 0.000 0.004 0.000 0.000 0.000
#> GSM35447     5  0.2442      0.896 0.000 0.000 0.068 0.000 0.884 0.048
#> GSM35450     4  0.2134      0.912 0.052 0.000 0.000 0.904 0.000 0.044
#> GSM35453     1  0.0000      0.994 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM35456     4  0.1007      0.931 0.000 0.000 0.000 0.956 0.000 0.044
#> GSM35464     4  0.1075      0.930 0.000 0.000 0.000 0.952 0.000 0.048
#> GSM35467     1  0.0000      0.994 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM35470     3  0.5749      0.270 0.392 0.000 0.492 0.028 0.000 0.088
#> GSM35479     3  0.0000      0.829 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM35484     1  0.0547      0.978 0.980 0.000 0.000 0.000 0.000 0.020
#> GSM35488     1  0.0000      0.994 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM35491     1  0.0000      0.994 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM35494     3  0.0000      0.829 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM35498     4  0.1075      0.930 0.000 0.000 0.000 0.952 0.000 0.048
#> GSM35501     1  0.0000      0.994 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM35509     3  0.0000      0.829 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM35513     1  0.0000      0.994 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM35516     6  0.3348      0.923 0.000 0.216 0.000 0.016 0.000 0.768
#> GSM35522     4  0.1863      0.903 0.000 0.000 0.000 0.896 0.000 0.104
#> GSM35525     1  0.1088      0.957 0.960 0.000 0.000 0.024 0.000 0.016
#> GSM35528     4  0.2265      0.911 0.052 0.000 0.000 0.896 0.000 0.052
#> GSM35533     1  0.1074      0.959 0.960 0.000 0.000 0.012 0.000 0.028
#> GSM35537     3  0.6136      0.322 0.360 0.000 0.492 0.060 0.000 0.088

Heatmaps for the consensus matrix. It visualizes the probability of two samples to be in a same group.

consensus_heatmap(res, k = 2)

plot of chunk tab-ATC-skmeans-consensus-heatmap-1

consensus_heatmap(res, k = 3)

plot of chunk tab-ATC-skmeans-consensus-heatmap-2

consensus_heatmap(res, k = 4)

plot of chunk tab-ATC-skmeans-consensus-heatmap-3

consensus_heatmap(res, k = 5)

plot of chunk tab-ATC-skmeans-consensus-heatmap-4

consensus_heatmap(res, k = 6)

plot of chunk tab-ATC-skmeans-consensus-heatmap-5

Heatmaps for the membership of samples in all partitions to see how consistent they are:

membership_heatmap(res, k = 2)

plot of chunk tab-ATC-skmeans-membership-heatmap-1

membership_heatmap(res, k = 3)

plot of chunk tab-ATC-skmeans-membership-heatmap-2

membership_heatmap(res, k = 4)

plot of chunk tab-ATC-skmeans-membership-heatmap-3

membership_heatmap(res, k = 5)

plot of chunk tab-ATC-skmeans-membership-heatmap-4

membership_heatmap(res, k = 6)

plot of chunk tab-ATC-skmeans-membership-heatmap-5

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)

plot of chunk tab-ATC-skmeans-get-signatures-1

get_signatures(res, k = 3)

plot of chunk tab-ATC-skmeans-get-signatures-2

get_signatures(res, k = 4)

plot of chunk tab-ATC-skmeans-get-signatures-3

get_signatures(res, k = 5)

plot of chunk tab-ATC-skmeans-get-signatures-4

get_signatures(res, k = 6)

plot of chunk tab-ATC-skmeans-get-signatures-5

Signature heatmaps where rows are not scaled:

get_signatures(res, k = 2, scale_rows = FALSE)

plot of chunk tab-ATC-skmeans-get-signatures-no-scale-1

get_signatures(res, k = 3, scale_rows = FALSE)

plot of chunk tab-ATC-skmeans-get-signatures-no-scale-2

get_signatures(res, k = 4, scale_rows = FALSE)

plot of chunk tab-ATC-skmeans-get-signatures-no-scale-3

get_signatures(res, k = 5, scale_rows = FALSE)

plot of chunk tab-ATC-skmeans-get-signatures-no-scale-4

get_signatures(res, k = 6, scale_rows = FALSE)

plot of chunk tab-ATC-skmeans-get-signatures-no-scale-5

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk ATC-skmeans-signature_compare

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:

  1. which_row: row indices corresponding to the input matrix.
  2. fdr: FDR for the differential test.
  3. mean_x: The mean value in group x.
  4. scaled_mean_x: The mean value in group x after rows are scaled.
  5. 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")

plot of chunk tab-ATC-skmeans-dimension-reduction-1

dimension_reduction(res, k = 3, method = "UMAP")

plot of chunk tab-ATC-skmeans-dimension-reduction-2

dimension_reduction(res, k = 4, method = "UMAP")

plot of chunk tab-ATC-skmeans-dimension-reduction-3

dimension_reduction(res, k = 5, method = "UMAP")

plot of chunk tab-ATC-skmeans-dimension-reduction-4

dimension_reduction(res, k = 6, method = "UMAP")

plot of chunk tab-ATC-skmeans-dimension-reduction-5

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk ATC-skmeans-collect-classes

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  time(p) k
#> ATC:skmeans 79 6.81e-06 2
#> ATC:skmeans 78 9.67e-06 3
#> ATC:skmeans 79 1.58e-05 4
#> ATC:skmeans 76 3.32e-06 5
#> ATC:skmeans 76 1.94e-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.


ATC:pam*

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 7758 rows and 79 columns.
#>   Top rows (776, 1552, 2328, 3103, 3879) 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)

plot of chunk ATC-pam-collect-plots

The plots are:

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:

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)

plot of chunk ATC-pam-select-partition-number

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.846           0.908       0.962         0.5051 0.494   0.494
#> 3 3 0.686           0.838       0.926         0.2845 0.741   0.527
#> 4 4 0.928           0.932       0.967         0.1654 0.793   0.477
#> 5 5 0.905           0.848       0.933         0.0494 0.950   0.800
#> 6 6 0.937           0.859       0.941         0.0447 0.943   0.735

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] 4 5

There is also optional best \(k\) = 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.

show/hide code output

cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#>          class entropy silhouette    p1    p2
#> GSM35441     2  0.0000      0.951 0.000 1.000
#> GSM35446     2  0.0376      0.950 0.004 0.996
#> GSM35449     2  0.0000      0.951 0.000 1.000
#> GSM35455     2  0.0000      0.951 0.000 1.000
#> GSM35458     1  0.9427      0.441 0.640 0.360
#> GSM35460     2  0.0376      0.950 0.004 0.996
#> GSM35461     1  0.0000      0.965 1.000 0.000
#> GSM35463     2  0.0000      0.951 0.000 1.000
#> GSM35472     2  0.0376      0.950 0.004 0.996
#> GSM35475     2  0.9580      0.364 0.380 0.620
#> GSM35483     2  0.0000      0.951 0.000 1.000
#> GSM35496     1  0.0000      0.965 1.000 0.000
#> GSM35497     2  0.0000      0.951 0.000 1.000
#> GSM35504     2  0.0000      0.951 0.000 1.000
#> GSM35508     2  0.0000      0.951 0.000 1.000
#> GSM35511     2  0.0376      0.950 0.004 0.996
#> GSM35512     1  0.8608      0.590 0.716 0.284
#> GSM35515     1  0.9427      0.441 0.640 0.360
#> GSM35519     2  0.0376      0.950 0.004 0.996
#> GSM35527     2  0.0000      0.951 0.000 1.000
#> GSM35532     2  0.0376      0.950 0.004 0.996
#> GSM35439     2  0.0000      0.951 0.000 1.000
#> GSM35443     1  0.0000      0.965 1.000 0.000
#> GSM35445     1  0.0000      0.965 1.000 0.000
#> GSM35448     2  0.0376      0.950 0.004 0.996
#> GSM35451     1  0.0000      0.965 1.000 0.000
#> GSM35454     1  0.0000      0.965 1.000 0.000
#> GSM35457     2  0.0000      0.951 0.000 1.000
#> GSM35465     2  0.0000      0.951 0.000 1.000
#> GSM35468     1  0.0000      0.965 1.000 0.000
#> GSM35471     1  0.8861      0.525 0.696 0.304
#> GSM35473     1  0.0000      0.965 1.000 0.000
#> GSM35477     1  0.0000      0.965 1.000 0.000
#> GSM35480     1  0.0000      0.965 1.000 0.000
#> GSM35482     1  0.0000      0.965 1.000 0.000
#> GSM35485     2  0.0000      0.951 0.000 1.000
#> GSM35489     2  0.0000      0.951 0.000 1.000
#> GSM35492     1  0.0000      0.965 1.000 0.000
#> GSM35495     2  0.6623      0.786 0.172 0.828
#> GSM35499     2  0.0000      0.951 0.000 1.000
#> GSM35502     1  0.0000      0.965 1.000 0.000
#> GSM35505     1  0.0000      0.965 1.000 0.000
#> GSM35507     2  0.7602      0.722 0.220 0.780
#> GSM35510     2  0.0000      0.951 0.000 1.000
#> GSM35514     1  0.0000      0.965 1.000 0.000
#> GSM35517     2  0.0000      0.951 0.000 1.000
#> GSM35520     2  0.0376      0.950 0.004 0.996
#> GSM35523     1  0.0000      0.965 1.000 0.000
#> GSM35529     2  0.0000      0.951 0.000 1.000
#> GSM35531     2  0.0376      0.950 0.004 0.996
#> GSM35534     2  0.0000      0.951 0.000 1.000
#> GSM35536     1  0.0000      0.965 1.000 0.000
#> GSM35538     1  0.0000      0.965 1.000 0.000
#> GSM35539     1  0.0000      0.965 1.000 0.000
#> GSM35540     2  0.0000      0.951 0.000 1.000
#> GSM35541     2  0.0000      0.951 0.000 1.000
#> GSM35442     1  0.0000      0.965 1.000 0.000
#> GSM35447     1  0.0000      0.965 1.000 0.000
#> GSM35450     1  0.0000      0.965 1.000 0.000
#> GSM35453     1  0.0000      0.965 1.000 0.000
#> GSM35456     1  0.0000      0.965 1.000 0.000
#> GSM35464     2  0.0000      0.951 0.000 1.000
#> GSM35467     1  0.0000      0.965 1.000 0.000
#> GSM35470     1  0.0000      0.965 1.000 0.000
#> GSM35479     1  0.0000      0.965 1.000 0.000
#> GSM35484     1  0.0000      0.965 1.000 0.000
#> GSM35488     1  0.0000      0.965 1.000 0.000
#> GSM35491     1  0.0000      0.965 1.000 0.000
#> GSM35494     1  0.0000      0.965 1.000 0.000
#> GSM35498     2  0.9552      0.430 0.376 0.624
#> GSM35501     1  0.0000      0.965 1.000 0.000
#> GSM35509     2  0.6712      0.781 0.176 0.824
#> GSM35513     1  0.0000      0.965 1.000 0.000
#> GSM35516     2  0.0000      0.951 0.000 1.000
#> GSM35522     2  0.9170      0.522 0.332 0.668
#> GSM35525     1  0.0000      0.965 1.000 0.000
#> GSM35528     1  0.0000      0.965 1.000 0.000
#> GSM35533     1  0.0000      0.965 1.000 0.000
#> GSM35537     1  0.0000      0.965 1.000 0.000

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>          class entropy silhouette    p1    p2    p3
#> GSM35441     2  0.0000      0.926 0.000 1.000 0.000
#> GSM35446     3  0.3551      0.742 0.000 0.132 0.868
#> GSM35449     2  0.0000      0.926 0.000 1.000 0.000
#> GSM35455     2  0.0000      0.926 0.000 1.000 0.000
#> GSM35458     3  0.6339      0.426 0.360 0.008 0.632
#> GSM35460     3  0.0424      0.808 0.000 0.008 0.992
#> GSM35461     3  0.3879      0.750 0.152 0.000 0.848
#> GSM35463     2  0.0000      0.926 0.000 1.000 0.000
#> GSM35472     3  0.0237      0.809 0.000 0.004 0.996
#> GSM35475     3  0.0424      0.808 0.000 0.008 0.992
#> GSM35483     2  0.5835      0.465 0.000 0.660 0.340
#> GSM35496     3  0.5560      0.562 0.300 0.000 0.700
#> GSM35497     2  0.0000      0.926 0.000 1.000 0.000
#> GSM35504     2  0.0000      0.926 0.000 1.000 0.000
#> GSM35508     2  0.0237      0.923 0.000 0.996 0.004
#> GSM35511     3  0.3551      0.742 0.000 0.132 0.868
#> GSM35512     3  0.0000      0.808 0.000 0.000 1.000
#> GSM35515     3  0.6155      0.496 0.328 0.008 0.664
#> GSM35519     3  0.0424      0.808 0.000 0.008 0.992
#> GSM35527     2  0.0000      0.926 0.000 1.000 0.000
#> GSM35532     3  0.3551      0.742 0.000 0.132 0.868
#> GSM35439     2  0.0000      0.926 0.000 1.000 0.000
#> GSM35443     1  0.0000      0.949 1.000 0.000 0.000
#> GSM35445     1  0.0000      0.949 1.000 0.000 0.000
#> GSM35448     3  0.3412      0.748 0.000 0.124 0.876
#> GSM35451     1  0.3482      0.859 0.872 0.000 0.128
#> GSM35454     1  0.5138      0.680 0.748 0.000 0.252
#> GSM35457     2  0.0000      0.926 0.000 1.000 0.000
#> GSM35465     2  0.0000      0.926 0.000 1.000 0.000
#> GSM35468     1  0.0000      0.949 1.000 0.000 0.000
#> GSM35471     1  0.3551      0.855 0.868 0.000 0.132
#> GSM35473     1  0.0000      0.949 1.000 0.000 0.000
#> GSM35477     1  0.3192      0.872 0.888 0.000 0.112
#> GSM35480     1  0.0000      0.949 1.000 0.000 0.000
#> GSM35482     3  0.6140      0.337 0.404 0.000 0.596
#> GSM35485     2  0.0000      0.926 0.000 1.000 0.000
#> GSM35489     2  0.0000      0.926 0.000 1.000 0.000
#> GSM35492     1  0.0000      0.949 1.000 0.000 0.000
#> GSM35495     3  0.0000      0.808 0.000 0.000 1.000
#> GSM35499     2  0.0000      0.926 0.000 1.000 0.000
#> GSM35502     1  0.0000      0.949 1.000 0.000 0.000
#> GSM35505     3  0.4291      0.729 0.180 0.000 0.820
#> GSM35507     1  0.3551      0.855 0.868 0.000 0.132
#> GSM35510     2  0.0000      0.926 0.000 1.000 0.000
#> GSM35514     1  0.0000      0.949 1.000 0.000 0.000
#> GSM35517     2  0.0000      0.926 0.000 1.000 0.000
#> GSM35520     3  0.3551      0.742 0.000 0.132 0.868
#> GSM35523     1  0.3551      0.855 0.868 0.000 0.132
#> GSM35529     2  0.0000      0.926 0.000 1.000 0.000
#> GSM35531     2  0.9173      0.267 0.304 0.520 0.176
#> GSM35534     2  0.3192      0.825 0.000 0.888 0.112
#> GSM35536     1  0.0000      0.949 1.000 0.000 0.000
#> GSM35538     1  0.0000      0.949 1.000 0.000 0.000
#> GSM35539     1  0.0000      0.949 1.000 0.000 0.000
#> GSM35540     2  0.0000      0.926 0.000 1.000 0.000
#> GSM35541     2  0.0000      0.926 0.000 1.000 0.000
#> GSM35442     1  0.0000      0.949 1.000 0.000 0.000
#> GSM35447     3  0.2448      0.793 0.076 0.000 0.924
#> GSM35450     1  0.0000      0.949 1.000 0.000 0.000
#> GSM35453     1  0.0000      0.949 1.000 0.000 0.000
#> GSM35456     1  0.3551      0.855 0.868 0.000 0.132
#> GSM35464     2  0.3551      0.799 0.000 0.868 0.132
#> GSM35467     1  0.0000      0.949 1.000 0.000 0.000
#> GSM35470     1  0.0424      0.945 0.992 0.000 0.008
#> GSM35479     3  0.6062      0.386 0.384 0.000 0.616
#> GSM35484     1  0.0000      0.949 1.000 0.000 0.000
#> GSM35488     1  0.0000      0.949 1.000 0.000 0.000
#> GSM35491     1  0.0000      0.949 1.000 0.000 0.000
#> GSM35494     1  0.4974      0.709 0.764 0.000 0.236
#> GSM35498     1  0.3551      0.855 0.868 0.000 0.132
#> GSM35501     1  0.0000      0.949 1.000 0.000 0.000
#> GSM35509     3  0.0000      0.808 0.000 0.000 1.000
#> GSM35513     1  0.0000      0.949 1.000 0.000 0.000
#> GSM35516     2  0.3412      0.808 0.000 0.876 0.124
#> GSM35522     2  0.8101      0.491 0.228 0.640 0.132
#> GSM35525     1  0.0000      0.949 1.000 0.000 0.000
#> GSM35528     1  0.0424      0.945 0.992 0.000 0.008
#> GSM35533     1  0.0000      0.949 1.000 0.000 0.000
#> GSM35537     1  0.0424      0.945 0.992 0.000 0.008

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>          class entropy silhouette    p1    p2    p3    p4
#> GSM35441     2  0.0000      0.987 0.000 1.000 0.000 0.000
#> GSM35446     3  0.0000      0.988 0.000 0.000 1.000 0.000
#> GSM35449     2  0.0000      0.987 0.000 1.000 0.000 0.000
#> GSM35455     2  0.0000      0.987 0.000 1.000 0.000 0.000
#> GSM35458     3  0.0469      0.978 0.012 0.000 0.988 0.000
#> GSM35460     3  0.0000      0.988 0.000 0.000 1.000 0.000
#> GSM35461     1  0.2814      0.845 0.868 0.000 0.132 0.000
#> GSM35463     2  0.0000      0.987 0.000 1.000 0.000 0.000
#> GSM35472     3  0.0000      0.988 0.000 0.000 1.000 0.000
#> GSM35475     3  0.0000      0.988 0.000 0.000 1.000 0.000
#> GSM35483     3  0.3024      0.819 0.000 0.148 0.852 0.000
#> GSM35496     1  0.2814      0.845 0.868 0.000 0.132 0.000
#> GSM35497     2  0.0000      0.987 0.000 1.000 0.000 0.000
#> GSM35504     2  0.0000      0.987 0.000 1.000 0.000 0.000
#> GSM35508     2  0.0000      0.987 0.000 1.000 0.000 0.000
#> GSM35511     3  0.0000      0.988 0.000 0.000 1.000 0.000
#> GSM35512     3  0.0000      0.988 0.000 0.000 1.000 0.000
#> GSM35515     3  0.0336      0.982 0.008 0.000 0.992 0.000
#> GSM35519     3  0.0000      0.988 0.000 0.000 1.000 0.000
#> GSM35527     2  0.0000      0.987 0.000 1.000 0.000 0.000
#> GSM35532     3  0.0000      0.988 0.000 0.000 1.000 0.000
#> GSM35439     2  0.0000      0.987 0.000 1.000 0.000 0.000
#> GSM35443     1  0.0000      0.948 1.000 0.000 0.000 0.000
#> GSM35445     1  0.0000      0.948 1.000 0.000 0.000 0.000
#> GSM35448     3  0.0000      0.988 0.000 0.000 1.000 0.000
#> GSM35451     4  0.0000      0.946 0.000 0.000 0.000 1.000
#> GSM35454     4  0.0707      0.938 0.020 0.000 0.000 0.980
#> GSM35457     2  0.0000      0.987 0.000 1.000 0.000 0.000
#> GSM35465     2  0.0000      0.987 0.000 1.000 0.000 0.000
#> GSM35468     1  0.0000      0.948 1.000 0.000 0.000 0.000
#> GSM35471     4  0.0000      0.946 0.000 0.000 0.000 1.000
#> GSM35473     1  0.0000      0.948 1.000 0.000 0.000 0.000
#> GSM35477     4  0.0000      0.946 0.000 0.000 0.000 1.000
#> GSM35480     1  0.0707      0.936 0.980 0.000 0.000 0.020
#> GSM35482     1  0.5990      0.665 0.688 0.000 0.124 0.188
#> GSM35485     2  0.0000      0.987 0.000 1.000 0.000 0.000
#> GSM35489     2  0.0000      0.987 0.000 1.000 0.000 0.000
#> GSM35492     1  0.0000      0.948 1.000 0.000 0.000 0.000
#> GSM35495     3  0.0000      0.988 0.000 0.000 1.000 0.000
#> GSM35499     2  0.0000      0.987 0.000 1.000 0.000 0.000
#> GSM35502     1  0.0000      0.948 1.000 0.000 0.000 0.000
#> GSM35505     3  0.0188      0.985 0.004 0.000 0.996 0.000
#> GSM35507     4  0.0000      0.946 0.000 0.000 0.000 1.000
#> GSM35510     2  0.0000      0.987 0.000 1.000 0.000 0.000
#> GSM35514     1  0.0000      0.948 1.000 0.000 0.000 0.000
#> GSM35517     2  0.0000      0.987 0.000 1.000 0.000 0.000
#> GSM35520     3  0.0000      0.988 0.000 0.000 1.000 0.000
#> GSM35523     4  0.0000      0.946 0.000 0.000 0.000 1.000
#> GSM35529     2  0.0000      0.987 0.000 1.000 0.000 0.000
#> GSM35531     4  0.2542      0.883 0.000 0.084 0.012 0.904
#> GSM35534     2  0.4040      0.663 0.000 0.752 0.248 0.000
#> GSM35536     1  0.0000      0.948 1.000 0.000 0.000 0.000
#> GSM35538     4  0.1118      0.929 0.036 0.000 0.000 0.964
#> GSM35539     4  0.0000      0.946 0.000 0.000 0.000 1.000
#> GSM35540     2  0.0000      0.987 0.000 1.000 0.000 0.000
#> GSM35541     2  0.0000      0.987 0.000 1.000 0.000 0.000
#> GSM35442     1  0.0000      0.948 1.000 0.000 0.000 0.000
#> GSM35447     3  0.0000      0.988 0.000 0.000 1.000 0.000
#> GSM35450     4  0.0000      0.946 0.000 0.000 0.000 1.000
#> GSM35453     1  0.0000      0.948 1.000 0.000 0.000 0.000
#> GSM35456     4  0.0000      0.946 0.000 0.000 0.000 1.000
#> GSM35464     4  0.0707      0.937 0.000 0.020 0.000 0.980
#> GSM35467     1  0.0000      0.948 1.000 0.000 0.000 0.000
#> GSM35470     4  0.2081      0.892 0.084 0.000 0.000 0.916
#> GSM35479     1  0.3398      0.863 0.872 0.000 0.060 0.068
#> GSM35484     1  0.0000      0.948 1.000 0.000 0.000 0.000
#> GSM35488     1  0.0000      0.948 1.000 0.000 0.000 0.000
#> GSM35491     1  0.0000      0.948 1.000 0.000 0.000 0.000
#> GSM35494     1  0.5408      0.291 0.576 0.000 0.016 0.408
#> GSM35498     4  0.0000      0.946 0.000 0.000 0.000 1.000
#> GSM35501     1  0.0000      0.948 1.000 0.000 0.000 0.000
#> GSM35509     4  0.3873      0.719 0.000 0.000 0.228 0.772
#> GSM35513     1  0.0000      0.948 1.000 0.000 0.000 0.000
#> GSM35516     4  0.1302      0.922 0.000 0.044 0.000 0.956
#> GSM35522     4  0.0000      0.946 0.000 0.000 0.000 1.000
#> GSM35525     1  0.0707      0.936 0.980 0.000 0.000 0.020
#> GSM35528     4  0.0000      0.946 0.000 0.000 0.000 1.000
#> GSM35533     4  0.3123      0.815 0.156 0.000 0.000 0.844
#> GSM35537     4  0.4382      0.568 0.296 0.000 0.000 0.704

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>          class entropy silhouette    p1    p2    p3    p4    p5
#> GSM35441     2  0.0000     0.9734 0.000 1.000 0.000 0.000 0.000
#> GSM35446     5  0.0000     0.9464 0.000 0.000 0.000 0.000 1.000
#> GSM35449     2  0.0000     0.9734 0.000 1.000 0.000 0.000 0.000
#> GSM35455     2  0.0000     0.9734 0.000 1.000 0.000 0.000 0.000
#> GSM35458     5  0.1357     0.9150 0.004 0.000 0.048 0.000 0.948
#> GSM35460     3  0.4273     0.3268 0.000 0.000 0.552 0.000 0.448
#> GSM35461     3  0.6739     0.2809 0.348 0.000 0.392 0.000 0.260
#> GSM35463     2  0.0703     0.9611 0.000 0.976 0.024 0.000 0.000
#> GSM35472     5  0.1121     0.9095 0.000 0.000 0.044 0.000 0.956
#> GSM35475     5  0.0000     0.9464 0.000 0.000 0.000 0.000 1.000
#> GSM35483     5  0.3146     0.7992 0.000 0.092 0.052 0.000 0.856
#> GSM35496     3  0.1341     0.8004 0.000 0.000 0.944 0.000 0.056
#> GSM35497     2  0.0000     0.9734 0.000 1.000 0.000 0.000 0.000
#> GSM35504     2  0.0000     0.9734 0.000 1.000 0.000 0.000 0.000
#> GSM35508     2  0.0000     0.9734 0.000 1.000 0.000 0.000 0.000
#> GSM35511     5  0.0000     0.9464 0.000 0.000 0.000 0.000 1.000
#> GSM35512     5  0.0000     0.9464 0.000 0.000 0.000 0.000 1.000
#> GSM35515     5  0.1041     0.9273 0.004 0.000 0.032 0.000 0.964
#> GSM35519     5  0.0000     0.9464 0.000 0.000 0.000 0.000 1.000
#> GSM35527     2  0.0000     0.9734 0.000 1.000 0.000 0.000 0.000
#> GSM35532     5  0.0000     0.9464 0.000 0.000 0.000 0.000 1.000
#> GSM35439     2  0.1661     0.9324 0.000 0.940 0.024 0.000 0.036
#> GSM35443     1  0.0000     0.9424 1.000 0.000 0.000 0.000 0.000
#> GSM35445     1  0.0000     0.9424 1.000 0.000 0.000 0.000 0.000
#> GSM35448     5  0.1410     0.8949 0.000 0.000 0.060 0.000 0.940
#> GSM35451     4  0.0000     0.8742 0.000 0.000 0.000 1.000 0.000
#> GSM35454     4  0.4452     0.0417 0.004 0.000 0.496 0.500 0.000
#> GSM35457     2  0.0000     0.9734 0.000 1.000 0.000 0.000 0.000
#> GSM35465     2  0.0000     0.9734 0.000 1.000 0.000 0.000 0.000
#> GSM35468     1  0.0000     0.9424 1.000 0.000 0.000 0.000 0.000
#> GSM35471     4  0.0000     0.8742 0.000 0.000 0.000 1.000 0.000
#> GSM35473     1  0.0000     0.9424 1.000 0.000 0.000 0.000 0.000
#> GSM35477     4  0.0000     0.8742 0.000 0.000 0.000 1.000 0.000
#> GSM35480     1  0.4126     0.4054 0.620 0.000 0.000 0.380 0.000
#> GSM35482     3  0.1341     0.8004 0.000 0.000 0.944 0.000 0.056
#> GSM35485     2  0.1818     0.9245 0.000 0.932 0.024 0.000 0.044
#> GSM35489     2  0.0703     0.9611 0.000 0.976 0.024 0.000 0.000
#> GSM35492     1  0.0000     0.9424 1.000 0.000 0.000 0.000 0.000
#> GSM35495     3  0.3932     0.5642 0.000 0.000 0.672 0.000 0.328
#> GSM35499     2  0.0404     0.9678 0.000 0.988 0.012 0.000 0.000
#> GSM35502     1  0.0000     0.9424 1.000 0.000 0.000 0.000 0.000
#> GSM35505     5  0.3003     0.7190 0.000 0.000 0.188 0.000 0.812
#> GSM35507     4  0.0000     0.8742 0.000 0.000 0.000 1.000 0.000
#> GSM35510     2  0.0000     0.9734 0.000 1.000 0.000 0.000 0.000
#> GSM35514     1  0.0000     0.9424 1.000 0.000 0.000 0.000 0.000
#> GSM35517     2  0.0000     0.9734 0.000 1.000 0.000 0.000 0.000
#> GSM35520     5  0.0404     0.9409 0.000 0.000 0.012 0.000 0.988
#> GSM35523     4  0.0000     0.8742 0.000 0.000 0.000 1.000 0.000
#> GSM35529     2  0.0000     0.9734 0.000 1.000 0.000 0.000 0.000
#> GSM35531     4  0.3782     0.7481 0.000 0.084 0.024 0.836 0.056
#> GSM35534     2  0.4292     0.6098 0.000 0.704 0.024 0.000 0.272
#> GSM35536     1  0.0000     0.9424 1.000 0.000 0.000 0.000 0.000
#> GSM35538     4  0.0510     0.8645 0.016 0.000 0.000 0.984 0.000
#> GSM35539     4  0.0000     0.8742 0.000 0.000 0.000 1.000 0.000
#> GSM35540     2  0.0000     0.9734 0.000 1.000 0.000 0.000 0.000
#> GSM35541     2  0.0000     0.9734 0.000 1.000 0.000 0.000 0.000
#> GSM35442     1  0.0000     0.9424 1.000 0.000 0.000 0.000 0.000
#> GSM35447     5  0.0000     0.9464 0.000 0.000 0.000 0.000 1.000
#> GSM35450     4  0.0000     0.8742 0.000 0.000 0.000 1.000 0.000
#> GSM35453     1  0.0000     0.9424 1.000 0.000 0.000 0.000 0.000
#> GSM35456     4  0.0000     0.8742 0.000 0.000 0.000 1.000 0.000
#> GSM35464     4  0.4264     0.4042 0.000 0.376 0.004 0.620 0.000
#> GSM35467     1  0.0000     0.9424 1.000 0.000 0.000 0.000 0.000
#> GSM35470     4  0.0992     0.8584 0.008 0.000 0.024 0.968 0.000
#> GSM35479     3  0.1341     0.8004 0.000 0.000 0.944 0.000 0.056
#> GSM35484     1  0.0000     0.9424 1.000 0.000 0.000 0.000 0.000
#> GSM35488     1  0.0162     0.9387 0.996 0.000 0.000 0.004 0.000
#> GSM35491     1  0.0000     0.9424 1.000 0.000 0.000 0.000 0.000
#> GSM35494     3  0.1605     0.7721 0.004 0.000 0.944 0.040 0.012
#> GSM35498     4  0.0000     0.8742 0.000 0.000 0.000 1.000 0.000
#> GSM35501     1  0.0000     0.9424 1.000 0.000 0.000 0.000 0.000
#> GSM35509     3  0.1430     0.7991 0.000 0.000 0.944 0.004 0.052
#> GSM35513     1  0.0000     0.9424 1.000 0.000 0.000 0.000 0.000
#> GSM35516     4  0.4779     0.3510 0.000 0.388 0.024 0.588 0.000
#> GSM35522     4  0.0000     0.8742 0.000 0.000 0.000 1.000 0.000
#> GSM35525     1  0.4126     0.4054 0.620 0.000 0.000 0.380 0.000
#> GSM35528     4  0.0000     0.8742 0.000 0.000 0.000 1.000 0.000
#> GSM35533     4  0.3452     0.6082 0.244 0.000 0.000 0.756 0.000
#> GSM35537     4  0.2329     0.7783 0.000 0.000 0.124 0.876 0.000

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>          class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM35441     2  0.0000     0.9990 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM35446     5  0.0000     0.9608 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM35449     2  0.0000     0.9990 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM35455     2  0.0000     0.9990 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM35458     5  0.1152     0.9325 0.000 0.000 0.044 0.000 0.952 0.004
#> GSM35460     3  0.3833     0.2791 0.000 0.000 0.556 0.000 0.444 0.000
#> GSM35461     3  0.6034     0.2451 0.348 0.000 0.400 0.000 0.252 0.000
#> GSM35463     6  0.0146     0.9256 0.000 0.004 0.000 0.000 0.000 0.996
#> GSM35472     5  0.0000     0.9608 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM35475     5  0.0000     0.9608 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM35483     6  0.0260     0.9197 0.000 0.000 0.000 0.000 0.008 0.992
#> GSM35496     3  0.1007     0.7483 0.000 0.000 0.956 0.000 0.044 0.000
#> GSM35497     2  0.0000     0.9990 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM35504     2  0.0000     0.9990 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM35508     2  0.0000     0.9990 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM35511     5  0.0000     0.9608 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM35512     5  0.0000     0.9608 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM35515     5  0.1152     0.9325 0.000 0.000 0.044 0.000 0.952 0.004
#> GSM35519     5  0.0000     0.9608 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM35527     2  0.0000     0.9990 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM35532     5  0.0000     0.9608 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM35439     6  0.0260     0.9253 0.000 0.008 0.000 0.000 0.000 0.992
#> GSM35443     1  0.0000     0.9344 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM35445     1  0.0000     0.9344 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM35448     5  0.1267     0.9041 0.000 0.000 0.060 0.000 0.940 0.000
#> GSM35451     4  0.0000     0.9316 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM35454     3  0.3857     0.0937 0.000 0.000 0.532 0.468 0.000 0.000
#> GSM35457     2  0.0000     0.9990 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM35465     2  0.0146     0.9953 0.000 0.996 0.000 0.000 0.000 0.004
#> GSM35468     1  0.0000     0.9344 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM35471     4  0.0000     0.9316 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM35473     1  0.0000     0.9344 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM35477     4  0.0146     0.9307 0.000 0.000 0.000 0.996 0.000 0.004
#> GSM35480     1  0.3828     0.2331 0.560 0.000 0.000 0.440 0.000 0.000
#> GSM35482     3  0.1007     0.7483 0.000 0.000 0.956 0.000 0.044 0.000
#> GSM35485     6  0.0260     0.9253 0.000 0.008 0.000 0.000 0.000 0.992
#> GSM35489     6  0.0146     0.9256 0.000 0.004 0.000 0.000 0.000 0.996
#> GSM35492     1  0.0000     0.9344 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM35495     3  0.3499     0.5206 0.000 0.000 0.680 0.000 0.320 0.000
#> GSM35499     6  0.3833     0.1990 0.000 0.444 0.000 0.000 0.000 0.556
#> GSM35502     1  0.0000     0.9344 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM35505     5  0.2697     0.7226 0.000 0.000 0.188 0.000 0.812 0.000
#> GSM35507     4  0.0146     0.9307 0.000 0.000 0.000 0.996 0.000 0.004
#> GSM35510     2  0.0000     0.9990 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM35514     1  0.0000     0.9344 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM35517     2  0.0000     0.9990 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM35520     5  0.0865     0.9330 0.000 0.000 0.000 0.000 0.964 0.036
#> GSM35523     4  0.0000     0.9316 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM35529     2  0.0000     0.9990 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM35531     6  0.0146     0.9218 0.000 0.000 0.000 0.004 0.000 0.996
#> GSM35534     6  0.0260     0.9253 0.000 0.008 0.000 0.000 0.000 0.992
#> GSM35536     1  0.0000     0.9344 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM35538     4  0.0458     0.9202 0.016 0.000 0.000 0.984 0.000 0.000
#> GSM35539     4  0.0000     0.9316 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM35540     2  0.0260     0.9923 0.000 0.992 0.000 0.000 0.000 0.008
#> GSM35541     2  0.0000     0.9990 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM35442     1  0.0000     0.9344 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM35447     5  0.0000     0.9608 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM35450     4  0.0000     0.9316 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM35453     1  0.0000     0.9344 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM35456     4  0.0146     0.9307 0.000 0.000 0.000 0.996 0.000 0.004
#> GSM35464     4  0.5116     0.3143 0.000 0.344 0.000 0.560 0.000 0.096
#> GSM35467     1  0.0000     0.9344 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM35470     4  0.0891     0.9127 0.008 0.000 0.024 0.968 0.000 0.000
#> GSM35479     3  0.1007     0.7483 0.000 0.000 0.956 0.000 0.044 0.000
#> GSM35484     1  0.0000     0.9344 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM35488     1  0.0146     0.9307 0.996 0.000 0.000 0.004 0.000 0.000
#> GSM35491     1  0.0000     0.9344 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM35494     3  0.1124     0.7248 0.000 0.000 0.956 0.036 0.008 0.000
#> GSM35498     4  0.0146     0.9307 0.000 0.000 0.000 0.996 0.000 0.004
#> GSM35501     1  0.0000     0.9344 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM35509     3  0.1007     0.7483 0.000 0.000 0.956 0.000 0.044 0.000
#> GSM35513     1  0.0000     0.9344 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM35516     6  0.0146     0.9256 0.000 0.004 0.000 0.000 0.000 0.996
#> GSM35522     4  0.0000     0.9316 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM35525     1  0.3828     0.2331 0.560 0.000 0.000 0.440 0.000 0.000
#> GSM35528     4  0.0000     0.9316 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM35533     4  0.2823     0.6814 0.204 0.000 0.000 0.796 0.000 0.000
#> GSM35537     4  0.2135     0.8097 0.000 0.000 0.128 0.872 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)

plot of chunk tab-ATC-pam-consensus-heatmap-1

consensus_heatmap(res, k = 3)

plot of chunk tab-ATC-pam-consensus-heatmap-2

consensus_heatmap(res, k = 4)

plot of chunk tab-ATC-pam-consensus-heatmap-3

consensus_heatmap(res, k = 5)

plot of chunk tab-ATC-pam-consensus-heatmap-4

consensus_heatmap(res, k = 6)

plot of chunk tab-ATC-pam-consensus-heatmap-5

Heatmaps for the membership of samples in all partitions to see how consistent they are:

membership_heatmap(res, k = 2)

plot of chunk tab-ATC-pam-membership-heatmap-1

membership_heatmap(res, k = 3)

plot of chunk tab-ATC-pam-membership-heatmap-2

membership_heatmap(res, k = 4)

plot of chunk tab-ATC-pam-membership-heatmap-3

membership_heatmap(res, k = 5)

plot of chunk tab-ATC-pam-membership-heatmap-4

membership_heatmap(res, k = 6)

plot of chunk tab-ATC-pam-membership-heatmap-5

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)

plot of chunk tab-ATC-pam-get-signatures-1

get_signatures(res, k = 3)

plot of chunk tab-ATC-pam-get-signatures-2

get_signatures(res, k = 4)

plot of chunk tab-ATC-pam-get-signatures-3

get_signatures(res, k = 5)

plot of chunk tab-ATC-pam-get-signatures-4

get_signatures(res, k = 6)

plot of chunk tab-ATC-pam-get-signatures-5

Signature heatmaps where rows are not scaled:

get_signatures(res, k = 2, scale_rows = FALSE)

plot of chunk tab-ATC-pam-get-signatures-no-scale-1

get_signatures(res, k = 3, scale_rows = FALSE)

plot of chunk tab-ATC-pam-get-signatures-no-scale-2

get_signatures(res, k = 4, scale_rows = FALSE)

plot of chunk tab-ATC-pam-get-signatures-no-scale-3

get_signatures(res, k = 5, scale_rows = FALSE)

plot of chunk tab-ATC-pam-get-signatures-no-scale-4

get_signatures(res, k = 6, scale_rows = FALSE)

plot of chunk tab-ATC-pam-get-signatures-no-scale-5

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk ATC-pam-signature_compare

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:

  1. which_row: row indices corresponding to the input matrix.
  2. fdr: FDR for the differential test.
  3. mean_x: The mean value in group x.
  4. scaled_mean_x: The mean value in group x after rows are scaled.
  5. 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")

plot of chunk tab-ATC-pam-dimension-reduction-1

dimension_reduction(res, k = 3, method = "UMAP")

plot of chunk tab-ATC-pam-dimension-reduction-2

dimension_reduction(res, k = 4, method = "UMAP")

plot of chunk tab-ATC-pam-dimension-reduction-3

dimension_reduction(res, k = 5, method = "UMAP")

plot of chunk tab-ATC-pam-dimension-reduction-4

dimension_reduction(res, k = 6, method = "UMAP")

plot of chunk tab-ATC-pam-dimension-reduction-5

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk ATC-pam-collect-classes

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  time(p) k
#> ATC:pam 75 2.20e-04 2
#> ATC:pam 72 4.32e-06 3
#> ATC:pam 78 1.19e-06 4
#> ATC:pam 72 6.62e-06 5
#> ATC:pam 72 8.78e-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.


ATC:mclust**

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 7758 rows and 79 columns.
#>   Top rows (776, 1552, 2328, 3103, 3879) are extracted by 'ATC' method.
#>   Subgroups are detected by 'mclust' method.
#>   Performed in total 1250 partitions by row resampling.
#>   Best k for subgroups seems to be 2.
#> 
#> Following methods can be applied to this 'ConsensusPartition' object:
#>  [1] "cola_report"             "collect_classes"         "collect_plots"          
#>  [4] "collect_stats"           "colnames"                "compare_signatures"     
#>  [7] "consensus_heatmap"       "dimension_reduction"     "functional_enrichment"  
#> [10] "get_anno_col"            "get_anno"                "get_classes"            
#> [13] "get_consensus"           "get_matrix"              "get_membership"         
#> [16] "get_param"               "get_signatures"          "get_stats"              
#> [19] "is_best_k"               "is_stable_k"             "membership_heatmap"     
#> [22] "ncol"                    "nrow"                    "plot_ecdf"              
#> [25] "rownames"                "select_partition_number" "show"                   
#> [28] "suggest_best_k"          "test_to_known_factors"

collect_plots() function collects all the plots made from res for all k (number of partitions) into one single page to provide an easy and fast comparison between different k.

collect_plots(res)

plot of chunk ATC-mclust-collect-plots

The plots are:

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:

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)

plot of chunk ATC-mclust-select-partition-number

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.970       0.969         0.4893 0.496   0.496
#> 3 3 0.885           0.958       0.963         0.3309 0.771   0.569
#> 4 4 0.732           0.731       0.883         0.1304 0.774   0.443
#> 5 5 0.690           0.752       0.818         0.0609 0.957   0.830
#> 6 6 0.868           0.826       0.924         0.0615 0.918   0.643

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.

show/hide code output

cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#>          class entropy silhouette    p1    p2
#> GSM35441     2  0.0000      0.997 0.000 1.000
#> GSM35446     2  0.0000      0.997 0.000 1.000
#> GSM35449     2  0.0000      0.997 0.000 1.000
#> GSM35455     2  0.0000      0.997 0.000 1.000
#> GSM35458     2  0.0000      0.997 0.000 1.000
#> GSM35460     2  0.0000      0.997 0.000 1.000
#> GSM35461     1  0.3879      0.966 0.924 0.076
#> GSM35463     2  0.0000      0.997 0.000 1.000
#> GSM35472     2  0.0000      0.997 0.000 1.000
#> GSM35475     2  0.0000      0.997 0.000 1.000
#> GSM35483     2  0.0000      0.997 0.000 1.000
#> GSM35496     1  0.3879      0.966 0.924 0.076
#> GSM35497     2  0.0000      0.997 0.000 1.000
#> GSM35504     2  0.0000      0.997 0.000 1.000
#> GSM35508     2  0.0000      0.997 0.000 1.000
#> GSM35511     2  0.0000      0.997 0.000 1.000
#> GSM35512     2  0.0000      0.997 0.000 1.000
#> GSM35515     2  0.0000      0.997 0.000 1.000
#> GSM35519     2  0.0000      0.997 0.000 1.000
#> GSM35527     2  0.0000      0.997 0.000 1.000
#> GSM35532     2  0.0000      0.997 0.000 1.000
#> GSM35439     2  0.0000      0.997 0.000 1.000
#> GSM35443     1  0.0938      0.946 0.988 0.012
#> GSM35445     1  0.0000      0.941 1.000 0.000
#> GSM35448     2  0.0000      0.997 0.000 1.000
#> GSM35451     1  0.3879      0.966 0.924 0.076
#> GSM35454     1  0.3879      0.966 0.924 0.076
#> GSM35457     2  0.0000      0.997 0.000 1.000
#> GSM35465     2  0.0000      0.997 0.000 1.000
#> GSM35468     1  0.0000      0.941 1.000 0.000
#> GSM35471     1  0.3879      0.966 0.924 0.076
#> GSM35473     1  0.0000      0.941 1.000 0.000
#> GSM35477     1  0.3879      0.966 0.924 0.076
#> GSM35480     1  0.3879      0.966 0.924 0.076
#> GSM35482     1  0.3879      0.966 0.924 0.076
#> GSM35485     2  0.0000      0.997 0.000 1.000
#> GSM35489     2  0.0000      0.997 0.000 1.000
#> GSM35492     1  0.0000      0.941 1.000 0.000
#> GSM35495     1  0.9000      0.631 0.684 0.316
#> GSM35499     2  0.0000      0.997 0.000 1.000
#> GSM35502     1  0.0000      0.941 1.000 0.000
#> GSM35505     2  0.4690      0.879 0.100 0.900
#> GSM35507     1  0.3879      0.966 0.924 0.076
#> GSM35510     2  0.0000      0.997 0.000 1.000
#> GSM35514     1  0.0000      0.941 1.000 0.000
#> GSM35517     2  0.0000      0.997 0.000 1.000
#> GSM35520     2  0.0000      0.997 0.000 1.000
#> GSM35523     1  0.3879      0.966 0.924 0.076
#> GSM35529     2  0.0000      0.997 0.000 1.000
#> GSM35531     2  0.0000      0.997 0.000 1.000
#> GSM35534     2  0.0000      0.997 0.000 1.000
#> GSM35536     1  0.0000      0.941 1.000 0.000
#> GSM35538     1  0.3879      0.966 0.924 0.076
#> GSM35539     1  0.3879      0.966 0.924 0.076
#> GSM35540     2  0.0000      0.997 0.000 1.000
#> GSM35541     2  0.0000      0.997 0.000 1.000
#> GSM35442     1  0.3879      0.966 0.924 0.076
#> GSM35447     2  0.0000      0.997 0.000 1.000
#> GSM35450     1  0.3879      0.966 0.924 0.076
#> GSM35453     1  0.3879      0.966 0.924 0.076
#> GSM35456     1  0.3879      0.966 0.924 0.076
#> GSM35464     1  0.3879      0.966 0.924 0.076
#> GSM35467     1  0.0000      0.941 1.000 0.000
#> GSM35470     1  0.3879      0.966 0.924 0.076
#> GSM35479     1  0.3879      0.966 0.924 0.076
#> GSM35484     1  0.1414      0.949 0.980 0.020
#> GSM35488     1  0.1633      0.951 0.976 0.024
#> GSM35491     1  0.0000      0.941 1.000 0.000
#> GSM35494     1  0.3879      0.966 0.924 0.076
#> GSM35498     1  0.3879      0.966 0.924 0.076
#> GSM35501     1  0.0000      0.941 1.000 0.000
#> GSM35509     1  0.3879      0.966 0.924 0.076
#> GSM35513     1  0.0000      0.941 1.000 0.000
#> GSM35516     2  0.0000      0.997 0.000 1.000
#> GSM35522     1  0.3879      0.966 0.924 0.076
#> GSM35525     1  0.3879      0.966 0.924 0.076
#> GSM35528     1  0.3879      0.966 0.924 0.076
#> GSM35533     1  0.1414      0.949 0.980 0.020
#> GSM35537     1  0.3879      0.966 0.924 0.076

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>          class entropy silhouette    p1    p2    p3
#> GSM35441     2  0.0424      0.995 0.000 0.992 0.008
#> GSM35446     3  0.2448      0.909 0.000 0.076 0.924
#> GSM35449     2  0.0000      0.991 0.000 1.000 0.000
#> GSM35455     2  0.0000      0.991 0.000 1.000 0.000
#> GSM35458     3  0.2711      0.892 0.000 0.088 0.912
#> GSM35460     3  0.2448      0.909 0.000 0.076 0.924
#> GSM35461     3  0.3851      0.878 0.136 0.004 0.860
#> GSM35463     2  0.0424      0.995 0.000 0.992 0.008
#> GSM35472     3  0.1163      0.919 0.000 0.028 0.972
#> GSM35475     3  0.1289      0.917 0.000 0.032 0.968
#> GSM35483     2  0.0592      0.993 0.000 0.988 0.012
#> GSM35496     3  0.3851      0.878 0.136 0.004 0.860
#> GSM35497     2  0.0000      0.991 0.000 1.000 0.000
#> GSM35504     2  0.0424      0.995 0.000 0.992 0.008
#> GSM35508     2  0.0892      0.983 0.000 0.980 0.020
#> GSM35511     3  0.2448      0.909 0.000 0.076 0.924
#> GSM35512     3  0.1163      0.919 0.000 0.028 0.972
#> GSM35515     3  0.1031      0.917 0.000 0.024 0.976
#> GSM35519     3  0.1753      0.915 0.000 0.048 0.952
#> GSM35527     2  0.0892      0.983 0.000 0.980 0.020
#> GSM35532     3  0.2448      0.909 0.000 0.076 0.924
#> GSM35439     2  0.0424      0.995 0.000 0.992 0.008
#> GSM35443     1  0.0237      0.979 0.996 0.000 0.004
#> GSM35445     1  0.1031      0.972 0.976 0.000 0.024
#> GSM35448     3  0.2448      0.909 0.000 0.076 0.924
#> GSM35451     1  0.1170      0.981 0.976 0.016 0.008
#> GSM35454     3  0.3851      0.878 0.136 0.004 0.860
#> GSM35457     2  0.0000      0.991 0.000 1.000 0.000
#> GSM35465     2  0.0000      0.991 0.000 1.000 0.000
#> GSM35468     1  0.1031      0.972 0.976 0.000 0.024
#> GSM35471     1  0.1170      0.981 0.976 0.016 0.008
#> GSM35473     1  0.1031      0.972 0.976 0.000 0.024
#> GSM35477     1  0.1170      0.981 0.976 0.016 0.008
#> GSM35480     1  0.0661      0.981 0.988 0.004 0.008
#> GSM35482     3  0.3851      0.878 0.136 0.004 0.860
#> GSM35485     2  0.0424      0.995 0.000 0.992 0.008
#> GSM35489     2  0.0424      0.995 0.000 0.992 0.008
#> GSM35492     1  0.1031      0.972 0.976 0.000 0.024
#> GSM35495     3  0.1267      0.912 0.024 0.004 0.972
#> GSM35499     2  0.0424      0.995 0.000 0.992 0.008
#> GSM35502     1  0.1031      0.972 0.976 0.000 0.024
#> GSM35505     3  0.1399      0.919 0.004 0.028 0.968
#> GSM35507     1  0.1170      0.981 0.976 0.016 0.008
#> GSM35510     2  0.0000      0.991 0.000 1.000 0.000
#> GSM35514     1  0.1031      0.972 0.976 0.000 0.024
#> GSM35517     2  0.0424      0.995 0.000 0.992 0.008
#> GSM35520     3  0.4842      0.740 0.000 0.224 0.776
#> GSM35523     1  0.1170      0.981 0.976 0.016 0.008
#> GSM35529     2  0.0000      0.991 0.000 1.000 0.000
#> GSM35531     2  0.0424      0.995 0.000 0.992 0.008
#> GSM35534     2  0.0424      0.995 0.000 0.992 0.008
#> GSM35536     1  0.0892      0.973 0.980 0.000 0.020
#> GSM35538     1  0.1170      0.981 0.976 0.016 0.008
#> GSM35539     1  0.1170      0.981 0.976 0.016 0.008
#> GSM35540     2  0.0424      0.995 0.000 0.992 0.008
#> GSM35541     2  0.0424      0.995 0.000 0.992 0.008
#> GSM35442     1  0.1129      0.977 0.976 0.004 0.020
#> GSM35447     3  0.1163      0.919 0.000 0.028 0.972
#> GSM35450     1  0.1170      0.981 0.976 0.016 0.008
#> GSM35453     1  0.1399      0.978 0.968 0.004 0.028
#> GSM35456     1  0.1170      0.981 0.976 0.016 0.008
#> GSM35464     1  0.1585      0.973 0.964 0.028 0.008
#> GSM35467     1  0.1031      0.972 0.976 0.000 0.024
#> GSM35470     1  0.1129      0.977 0.976 0.004 0.020
#> GSM35479     3  0.3851      0.878 0.136 0.004 0.860
#> GSM35484     1  0.0424      0.980 0.992 0.000 0.008
#> GSM35488     1  0.1015      0.981 0.980 0.012 0.008
#> GSM35491     1  0.1031      0.972 0.976 0.000 0.024
#> GSM35494     3  0.3851      0.878 0.136 0.004 0.860
#> GSM35498     1  0.1170      0.981 0.976 0.016 0.008
#> GSM35501     1  0.1031      0.972 0.976 0.000 0.024
#> GSM35509     3  0.3851      0.878 0.136 0.004 0.860
#> GSM35513     1  0.1031      0.972 0.976 0.000 0.024
#> GSM35516     2  0.0424      0.995 0.000 0.992 0.008
#> GSM35522     1  0.1170      0.981 0.976 0.016 0.008
#> GSM35525     1  0.1170      0.981 0.976 0.016 0.008
#> GSM35528     1  0.1170      0.981 0.976 0.016 0.008
#> GSM35533     1  0.0848      0.981 0.984 0.008 0.008
#> GSM35537     1  0.1129      0.977 0.976 0.004 0.020

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>          class entropy silhouette    p1    p2    p3    p4
#> GSM35441     2  0.1118      0.809 0.000 0.964 0.036 0.000
#> GSM35446     3  0.0000      0.841 0.000 0.000 1.000 0.000
#> GSM35449     2  0.0000      0.833 0.000 1.000 0.000 0.000
#> GSM35455     2  0.0000      0.833 0.000 1.000 0.000 0.000
#> GSM35458     3  0.0000      0.841 0.000 0.000 1.000 0.000
#> GSM35460     3  0.0000      0.841 0.000 0.000 1.000 0.000
#> GSM35461     4  0.4222      0.745 0.272 0.000 0.000 0.728
#> GSM35463     2  0.4925      0.254 0.000 0.572 0.428 0.000
#> GSM35472     3  0.0000      0.841 0.000 0.000 1.000 0.000
#> GSM35475     3  0.0000      0.841 0.000 0.000 1.000 0.000
#> GSM35483     3  0.4382      0.498 0.000 0.296 0.704 0.000
#> GSM35496     4  0.4222      0.745 0.272 0.000 0.000 0.728
#> GSM35497     2  0.0000      0.833 0.000 1.000 0.000 0.000
#> GSM35504     2  0.0000      0.833 0.000 1.000 0.000 0.000
#> GSM35508     2  0.0000      0.833 0.000 1.000 0.000 0.000
#> GSM35511     3  0.0000      0.841 0.000 0.000 1.000 0.000
#> GSM35512     3  0.0000      0.841 0.000 0.000 1.000 0.000
#> GSM35515     3  0.0000      0.841 0.000 0.000 1.000 0.000
#> GSM35519     3  0.0000      0.841 0.000 0.000 1.000 0.000
#> GSM35527     2  0.0000      0.833 0.000 1.000 0.000 0.000
#> GSM35532     3  0.0000      0.841 0.000 0.000 1.000 0.000
#> GSM35439     3  0.4955      0.160 0.000 0.444 0.556 0.000
#> GSM35443     1  0.3219      0.783 0.836 0.000 0.000 0.164
#> GSM35445     1  0.0592      0.873 0.984 0.000 0.000 0.016
#> GSM35448     3  0.0000      0.841 0.000 0.000 1.000 0.000
#> GSM35451     4  0.0000      0.825 0.000 0.000 0.000 1.000
#> GSM35454     4  0.4222      0.745 0.272 0.000 0.000 0.728
#> GSM35457     2  0.0000      0.833 0.000 1.000 0.000 0.000
#> GSM35465     2  0.0000      0.833 0.000 1.000 0.000 0.000
#> GSM35468     1  0.0000      0.877 1.000 0.000 0.000 0.000
#> GSM35471     4  0.0000      0.825 0.000 0.000 0.000 1.000
#> GSM35473     1  0.0000      0.877 1.000 0.000 0.000 0.000
#> GSM35477     4  0.0000      0.825 0.000 0.000 0.000 1.000
#> GSM35480     4  0.4222      0.745 0.272 0.000 0.000 0.728
#> GSM35482     4  0.4222      0.745 0.272 0.000 0.000 0.728
#> GSM35485     3  0.4955      0.160 0.000 0.444 0.556 0.000
#> GSM35489     2  0.4925      0.254 0.000 0.572 0.428 0.000
#> GSM35492     1  0.0000      0.877 1.000 0.000 0.000 0.000
#> GSM35495     4  0.5292      0.687 0.064 0.000 0.208 0.728
#> GSM35499     2  0.0188      0.831 0.000 0.996 0.004 0.000
#> GSM35502     1  0.0000      0.877 1.000 0.000 0.000 0.000
#> GSM35505     3  0.2999      0.703 0.004 0.000 0.864 0.132
#> GSM35507     4  0.0000      0.825 0.000 0.000 0.000 1.000
#> GSM35510     2  0.0000      0.833 0.000 1.000 0.000 0.000
#> GSM35514     1  0.0000      0.877 1.000 0.000 0.000 0.000
#> GSM35517     2  0.4925      0.254 0.000 0.572 0.428 0.000
#> GSM35520     3  0.0000      0.841 0.000 0.000 1.000 0.000
#> GSM35523     4  0.0000      0.825 0.000 0.000 0.000 1.000
#> GSM35529     2  0.0000      0.833 0.000 1.000 0.000 0.000
#> GSM35531     3  0.4948      0.173 0.000 0.440 0.560 0.000
#> GSM35534     3  0.4948      0.173 0.000 0.440 0.560 0.000
#> GSM35536     1  0.1557      0.857 0.944 0.000 0.000 0.056
#> GSM35538     4  0.0000      0.825 0.000 0.000 0.000 1.000
#> GSM35539     4  0.0000      0.825 0.000 0.000 0.000 1.000
#> GSM35540     2  0.0000      0.833 0.000 1.000 0.000 0.000
#> GSM35541     2  0.4925      0.254 0.000 0.572 0.428 0.000
#> GSM35442     1  0.3266      0.779 0.832 0.000 0.000 0.168
#> GSM35447     3  0.0000      0.841 0.000 0.000 1.000 0.000
#> GSM35450     4  0.0000      0.825 0.000 0.000 0.000 1.000
#> GSM35453     1  0.3219      0.783 0.836 0.000 0.000 0.164
#> GSM35456     4  0.0000      0.825 0.000 0.000 0.000 1.000
#> GSM35464     4  0.0000      0.825 0.000 0.000 0.000 1.000
#> GSM35467     1  0.0000      0.877 1.000 0.000 0.000 0.000
#> GSM35470     4  0.4222      0.745 0.272 0.000 0.000 0.728
#> GSM35479     4  0.4222      0.745 0.272 0.000 0.000 0.728
#> GSM35484     1  0.4193      0.630 0.732 0.000 0.000 0.268
#> GSM35488     1  0.4925      0.152 0.572 0.000 0.000 0.428
#> GSM35491     1  0.0000      0.877 1.000 0.000 0.000 0.000
#> GSM35494     4  0.4222      0.745 0.272 0.000 0.000 0.728
#> GSM35498     4  0.0000      0.825 0.000 0.000 0.000 1.000
#> GSM35501     1  0.0000      0.877 1.000 0.000 0.000 0.000
#> GSM35509     4  0.4222      0.745 0.272 0.000 0.000 0.728
#> GSM35513     1  0.0000      0.877 1.000 0.000 0.000 0.000
#> GSM35516     2  0.4967      0.174 0.000 0.548 0.452 0.000
#> GSM35522     4  0.0000      0.825 0.000 0.000 0.000 1.000
#> GSM35525     4  0.4222      0.745 0.272 0.000 0.000 0.728
#> GSM35528     4  0.0000      0.825 0.000 0.000 0.000 1.000
#> GSM35533     1  0.4222      0.622 0.728 0.000 0.000 0.272
#> GSM35537     4  0.4222      0.745 0.272 0.000 0.000 0.728

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>          class entropy silhouette    p1    p2    p3    p4    p5
#> GSM35441     2  0.0510      0.758 0.000 0.984 0.000 0.000 0.016
#> GSM35446     5  0.0000      0.960 0.000 0.000 0.000 0.000 1.000
#> GSM35449     2  0.0000      0.774 0.000 1.000 0.000 0.000 0.000
#> GSM35455     2  0.0000      0.774 0.000 1.000 0.000 0.000 0.000
#> GSM35458     5  0.0162      0.959 0.000 0.000 0.004 0.000 0.996
#> GSM35460     5  0.0609      0.940 0.000 0.000 0.000 0.020 0.980
#> GSM35461     4  0.5720      0.516 0.000 0.000 0.124 0.600 0.276
#> GSM35463     3  0.5935      1.000 0.000 0.268 0.580 0.000 0.152
#> GSM35472     5  0.0290      0.953 0.000 0.000 0.000 0.008 0.992
#> GSM35475     5  0.0162      0.959 0.000 0.000 0.004 0.000 0.996
#> GSM35483     5  0.3333      0.607 0.000 0.208 0.004 0.000 0.788
#> GSM35496     4  0.5720      0.516 0.000 0.000 0.124 0.600 0.276
#> GSM35497     2  0.0000      0.774 0.000 1.000 0.000 0.000 0.000
#> GSM35504     2  0.3661      0.559 0.000 0.724 0.000 0.000 0.276
#> GSM35508     2  0.3661      0.559 0.000 0.724 0.000 0.000 0.276
#> GSM35511     5  0.0000      0.960 0.000 0.000 0.000 0.000 1.000
#> GSM35512     5  0.0000      0.960 0.000 0.000 0.000 0.000 1.000
#> GSM35515     5  0.0162      0.959 0.000 0.000 0.004 0.000 0.996
#> GSM35519     5  0.0162      0.959 0.000 0.000 0.004 0.000 0.996
#> GSM35527     2  0.3661      0.559 0.000 0.724 0.000 0.000 0.276
#> GSM35532     5  0.0000      0.960 0.000 0.000 0.000 0.000 1.000
#> GSM35439     3  0.5935      1.000 0.000 0.268 0.580 0.000 0.152
#> GSM35443     1  0.2561      0.822 0.856 0.000 0.000 0.144 0.000
#> GSM35445     1  0.0162      0.895 0.996 0.000 0.000 0.004 0.000
#> GSM35448     5  0.0000      0.960 0.000 0.000 0.000 0.000 1.000
#> GSM35451     4  0.3661      0.676 0.000 0.000 0.276 0.724 0.000
#> GSM35454     4  0.6235      0.507 0.076 0.000 0.048 0.600 0.276
#> GSM35457     2  0.0000      0.774 0.000 1.000 0.000 0.000 0.000
#> GSM35465     2  0.0000      0.774 0.000 1.000 0.000 0.000 0.000
#> GSM35468     1  0.0000      0.896 1.000 0.000 0.000 0.000 0.000
#> GSM35471     4  0.2516      0.707 0.000 0.000 0.140 0.860 0.000
#> GSM35473     1  0.0000      0.896 1.000 0.000 0.000 0.000 0.000
#> GSM35477     4  0.3707      0.673 0.000 0.000 0.284 0.716 0.000
#> GSM35480     4  0.6172      0.379 0.288 0.000 0.152 0.556 0.004
#> GSM35482     4  0.5720      0.516 0.000 0.000 0.124 0.600 0.276
#> GSM35485     3  0.5935      1.000 0.000 0.268 0.580 0.000 0.152
#> GSM35489     3  0.5935      1.000 0.000 0.268 0.580 0.000 0.152
#> GSM35492     1  0.0000      0.896 1.000 0.000 0.000 0.000 0.000
#> GSM35495     4  0.5368      0.468 0.000 0.000 0.072 0.596 0.332
#> GSM35499     2  0.0000      0.774 0.000 1.000 0.000 0.000 0.000
#> GSM35502     1  0.0000      0.896 1.000 0.000 0.000 0.000 0.000
#> GSM35505     5  0.2471      0.796 0.000 0.000 0.000 0.136 0.864
#> GSM35507     4  0.2674      0.708 0.000 0.000 0.140 0.856 0.004
#> GSM35510     2  0.0000      0.774 0.000 1.000 0.000 0.000 0.000
#> GSM35514     1  0.0000      0.896 1.000 0.000 0.000 0.000 0.000
#> GSM35517     2  0.6298     -0.728 0.000 0.436 0.412 0.000 0.152
#> GSM35520     5  0.0162      0.959 0.000 0.000 0.004 0.000 0.996
#> GSM35523     4  0.0609      0.712 0.000 0.000 0.000 0.980 0.020
#> GSM35529     2  0.0000      0.774 0.000 1.000 0.000 0.000 0.000
#> GSM35531     3  0.5935      1.000 0.000 0.268 0.580 0.000 0.152
#> GSM35534     3  0.5935      1.000 0.000 0.268 0.580 0.000 0.152
#> GSM35536     1  0.0000      0.896 1.000 0.000 0.000 0.000 0.000
#> GSM35538     4  0.3730      0.672 0.000 0.000 0.288 0.712 0.000
#> GSM35539     4  0.3661      0.677 0.000 0.000 0.276 0.724 0.000
#> GSM35540     2  0.3661      0.559 0.000 0.724 0.000 0.000 0.276
#> GSM35541     3  0.5935      1.000 0.000 0.268 0.580 0.000 0.152
#> GSM35442     1  0.5905      0.428 0.580 0.000 0.000 0.144 0.276
#> GSM35447     5  0.0000      0.960 0.000 0.000 0.000 0.000 1.000
#> GSM35450     4  0.3730      0.672 0.000 0.000 0.288 0.712 0.000
#> GSM35453     1  0.3011      0.814 0.844 0.000 0.000 0.140 0.016
#> GSM35456     4  0.2516      0.707 0.000 0.000 0.140 0.860 0.000
#> GSM35464     4  0.2653      0.674 0.000 0.096 0.024 0.880 0.000
#> GSM35467     1  0.0000      0.896 1.000 0.000 0.000 0.000 0.000
#> GSM35470     4  0.2873      0.651 0.120 0.000 0.000 0.860 0.020
#> GSM35479     4  0.5720      0.516 0.000 0.000 0.124 0.600 0.276
#> GSM35484     1  0.2890      0.807 0.836 0.000 0.000 0.160 0.004
#> GSM35488     1  0.5576      0.243 0.536 0.000 0.076 0.388 0.000
#> GSM35491     1  0.0000      0.896 1.000 0.000 0.000 0.000 0.000
#> GSM35494     4  0.5720      0.516 0.000 0.000 0.124 0.600 0.276
#> GSM35498     4  0.2674      0.708 0.000 0.000 0.140 0.856 0.004
#> GSM35501     1  0.0000      0.896 1.000 0.000 0.000 0.000 0.000
#> GSM35509     4  0.5720      0.516 0.000 0.000 0.124 0.600 0.276
#> GSM35513     1  0.0000      0.896 1.000 0.000 0.000 0.000 0.000
#> GSM35516     3  0.5935      1.000 0.000 0.268 0.580 0.000 0.152
#> GSM35522     4  0.0609      0.712 0.000 0.000 0.000 0.980 0.020
#> GSM35525     4  0.4840      0.613 0.124 0.000 0.152 0.724 0.000
#> GSM35528     4  0.3684      0.675 0.000 0.000 0.280 0.720 0.000
#> GSM35533     1  0.2930      0.805 0.832 0.000 0.000 0.164 0.004
#> GSM35537     4  0.2561      0.669 0.096 0.000 0.000 0.884 0.020

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>          class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM35441     2  0.0547      0.872 0.000 0.980 0.000 0.000 0.000 0.020
#> GSM35446     5  0.0937      0.922 0.000 0.000 0.040 0.000 0.960 0.000
#> GSM35449     2  0.0000      0.884 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM35455     2  0.0000      0.884 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM35458     5  0.0000      0.918 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM35460     5  0.3309      0.630 0.000 0.000 0.280 0.000 0.720 0.000
#> GSM35461     3  0.4893      0.469 0.340 0.000 0.584 0.000 0.076 0.000
#> GSM35463     6  0.0000      0.891 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM35472     5  0.3288      0.638 0.000 0.000 0.276 0.000 0.724 0.000
#> GSM35475     5  0.0000      0.918 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM35483     6  0.4167      0.348 0.000 0.000 0.020 0.000 0.368 0.612
#> GSM35496     3  0.0000      0.836 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM35497     2  0.0000      0.884 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM35504     2  0.3748      0.744 0.000 0.784 0.108 0.000 0.108 0.000
#> GSM35508     2  0.4972      0.513 0.000 0.620 0.272 0.000 0.108 0.000
#> GSM35511     5  0.2135      0.846 0.000 0.000 0.128 0.000 0.872 0.000
#> GSM35512     5  0.0937      0.922 0.000 0.000 0.040 0.000 0.960 0.000
#> GSM35515     5  0.0000      0.918 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM35519     5  0.0000      0.918 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM35527     2  0.4972      0.513 0.000 0.620 0.272 0.000 0.108 0.000
#> GSM35532     5  0.0937      0.922 0.000 0.000 0.040 0.000 0.960 0.000
#> GSM35439     6  0.0000      0.891 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM35443     1  0.0000      0.940 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM35445     1  0.0000      0.940 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM35448     5  0.0790      0.923 0.000 0.000 0.032 0.000 0.968 0.000
#> GSM35451     4  0.0000      0.920 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM35454     3  0.4859      0.536 0.304 0.000 0.612 0.000 0.084 0.000
#> GSM35457     2  0.0000      0.884 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM35465     2  0.0000      0.884 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM35468     1  0.0000      0.940 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM35471     4  0.0547      0.919 0.000 0.000 0.020 0.980 0.000 0.000
#> GSM35473     1  0.0000      0.940 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM35477     4  0.0000      0.920 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM35480     1  0.3725      0.574 0.676 0.000 0.008 0.316 0.000 0.000
#> GSM35482     3  0.0000      0.836 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM35485     6  0.0000      0.891 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM35489     6  0.0000      0.891 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM35492     1  0.0000      0.940 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM35495     3  0.2178      0.740 0.000 0.000 0.868 0.000 0.132 0.000
#> GSM35499     2  0.0146      0.881 0.000 0.996 0.000 0.000 0.000 0.004
#> GSM35502     1  0.0000      0.940 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM35505     5  0.1075      0.916 0.000 0.000 0.048 0.000 0.952 0.000
#> GSM35507     4  0.0713      0.916 0.000 0.000 0.028 0.972 0.000 0.000
#> GSM35510     2  0.0000      0.884 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM35514     1  0.0000      0.940 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM35517     6  0.3867      0.062 0.000 0.488 0.000 0.000 0.000 0.512
#> GSM35520     5  0.0000      0.918 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM35523     4  0.3531      0.476 0.000 0.000 0.328 0.672 0.000 0.000
#> GSM35529     2  0.0000      0.884 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM35531     6  0.0000      0.891 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM35534     6  0.0000      0.891 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM35536     1  0.0000      0.940 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM35538     4  0.0000      0.920 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM35539     4  0.0000      0.920 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM35540     2  0.3748      0.744 0.000 0.784 0.108 0.000 0.108 0.000
#> GSM35541     6  0.0000      0.891 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM35442     1  0.1958      0.837 0.896 0.000 0.100 0.000 0.004 0.000
#> GSM35447     5  0.0713      0.923 0.000 0.000 0.028 0.000 0.972 0.000
#> GSM35450     4  0.0000      0.920 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM35453     1  0.0937      0.903 0.960 0.000 0.040 0.000 0.000 0.000
#> GSM35456     4  0.0547      0.919 0.000 0.000 0.020 0.980 0.000 0.000
#> GSM35464     4  0.0865      0.911 0.000 0.000 0.036 0.964 0.000 0.000
#> GSM35467     1  0.0000      0.940 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM35470     3  0.2772      0.704 0.004 0.000 0.816 0.180 0.000 0.000
#> GSM35479     3  0.0000      0.836 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM35484     1  0.0146      0.938 0.996 0.000 0.000 0.004 0.000 0.000
#> GSM35488     1  0.0713      0.922 0.972 0.000 0.000 0.028 0.000 0.000
#> GSM35491     1  0.0000      0.940 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM35494     3  0.0000      0.836 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM35498     4  0.0790      0.914 0.000 0.000 0.032 0.968 0.000 0.000
#> GSM35501     1  0.0000      0.940 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM35509     3  0.0000      0.836 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM35513     1  0.0000      0.940 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM35516     6  0.0000      0.891 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM35522     4  0.3531      0.476 0.000 0.000 0.328 0.672 0.000 0.000
#> GSM35525     1  0.3838      0.286 0.552 0.000 0.000 0.448 0.000 0.000
#> GSM35528     4  0.0000      0.920 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM35533     1  0.0146      0.938 0.996 0.000 0.000 0.004 0.000 0.000
#> GSM35537     3  0.2562      0.714 0.000 0.000 0.828 0.172 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)

plot of chunk tab-ATC-mclust-consensus-heatmap-1

consensus_heatmap(res, k = 3)

plot of chunk tab-ATC-mclust-consensus-heatmap-2

consensus_heatmap(res, k = 4)

plot of chunk tab-ATC-mclust-consensus-heatmap-3

consensus_heatmap(res, k = 5)

plot of chunk tab-ATC-mclust-consensus-heatmap-4

consensus_heatmap(res, k = 6)

plot of chunk tab-ATC-mclust-consensus-heatmap-5

Heatmaps for the membership of samples in all partitions to see how consistent they are:

membership_heatmap(res, k = 2)

plot of chunk tab-ATC-mclust-membership-heatmap-1

membership_heatmap(res, k = 3)

plot of chunk tab-ATC-mclust-membership-heatmap-2

membership_heatmap(res, k = 4)

plot of chunk tab-ATC-mclust-membership-heatmap-3

membership_heatmap(res, k = 5)

plot of chunk tab-ATC-mclust-membership-heatmap-4

membership_heatmap(res, k = 6)

plot of chunk tab-ATC-mclust-membership-heatmap-5

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)

plot of chunk tab-ATC-mclust-get-signatures-1

get_signatures(res, k = 3)

plot of chunk tab-ATC-mclust-get-signatures-2

get_signatures(res, k = 4)

plot of chunk tab-ATC-mclust-get-signatures-3

get_signatures(res, k = 5)

plot of chunk tab-ATC-mclust-get-signatures-4

get_signatures(res, k = 6)

plot of chunk tab-ATC-mclust-get-signatures-5

Signature heatmaps where rows are not scaled:

get_signatures(res, k = 2, scale_rows = FALSE)

plot of chunk tab-ATC-mclust-get-signatures-no-scale-1

get_signatures(res, k = 3, scale_rows = FALSE)

plot of chunk tab-ATC-mclust-get-signatures-no-scale-2

get_signatures(res, k = 4, scale_rows = FALSE)

plot of chunk tab-ATC-mclust-get-signatures-no-scale-3

get_signatures(res, k = 5, scale_rows = FALSE)

plot of chunk tab-ATC-mclust-get-signatures-no-scale-4

get_signatures(res, k = 6, scale_rows = FALSE)

plot of chunk tab-ATC-mclust-get-signatures-no-scale-5

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk ATC-mclust-signature_compare

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:

  1. which_row: row indices corresponding to the input matrix.
  2. fdr: FDR for the differential test.
  3. mean_x: The mean value in group x.
  4. scaled_mean_x: The mean value in group x after rows are scaled.
  5. 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")

plot of chunk tab-ATC-mclust-dimension-reduction-1

dimension_reduction(res, k = 3, method = "UMAP")

plot of chunk tab-ATC-mclust-dimension-reduction-2

dimension_reduction(res, k = 4, method = "UMAP")

plot of chunk tab-ATC-mclust-dimension-reduction-3

dimension_reduction(res, k = 5, method = "UMAP")

plot of chunk tab-ATC-mclust-dimension-reduction-4

dimension_reduction(res, k = 6, method = "UMAP")

plot of chunk tab-ATC-mclust-dimension-reduction-5

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk ATC-mclust-collect-classes

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  time(p) k
#> ATC:mclust 79 3.90e-07 2
#> ATC:mclust 79 2.39e-06 3
#> ATC:mclust 68 9.53e-06 4
#> ATC:mclust 74 4.48e-06 5
#> ATC:mclust 73 1.32e-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.


ATC:NMF*

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 7758 rows and 79 columns.
#>   Top rows (776, 1552, 2328, 3103, 3879) 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)

plot of chunk ATC-NMF-collect-plots

The plots are:

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:

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)

plot of chunk ATC-NMF-select-partition-number

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.922           0.926       0.972         0.5015 0.498   0.498
#> 3 3 0.871           0.876       0.948         0.3084 0.736   0.518
#> 4 4 0.602           0.655       0.824         0.1040 0.821   0.548
#> 5 5 0.634           0.541       0.720         0.0584 0.870   0.608
#> 6 6 0.637           0.498       0.736         0.0480 0.868   0.561

suggest_best_k() suggests the best \(k\) based on these statistics. The rules are as follows:

suggest_best_k(res)
#> [1] 2

Following shows the table of the partitions (You need to click the show/hide code output link to see it). The membership matrix (columns with name p*) is inferred by clue::cl_consensus() function with the SE method. Basically the value in the membership matrix represents the probability to belong to a certain group. The finall class label for an item is determined with the group with highest probability it belongs to.

In get_classes() function, the entropy is calculated from the membership matrix and the silhouette score is calculated from the consensus matrix.

show/hide code output

cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#>          class entropy silhouette    p1    p2
#> GSM35441     2  0.0000    0.97093 0.000 1.000
#> GSM35446     2  0.0000    0.97093 0.000 1.000
#> GSM35449     2  0.0000    0.97093 0.000 1.000
#> GSM35455     2  0.0000    0.97093 0.000 1.000
#> GSM35458     2  0.6438    0.79871 0.164 0.836
#> GSM35460     2  0.0000    0.97093 0.000 1.000
#> GSM35461     1  0.0000    0.96913 1.000 0.000
#> GSM35463     2  0.0000    0.97093 0.000 1.000
#> GSM35472     2  0.0000    0.97093 0.000 1.000
#> GSM35475     2  0.0376    0.96808 0.004 0.996
#> GSM35483     2  0.0000    0.97093 0.000 1.000
#> GSM35496     1  0.0000    0.96913 1.000 0.000
#> GSM35497     2  0.0000    0.97093 0.000 1.000
#> GSM35504     2  0.0000    0.97093 0.000 1.000
#> GSM35508     2  0.0000    0.97093 0.000 1.000
#> GSM35511     2  0.0000    0.97093 0.000 1.000
#> GSM35512     1  0.9427    0.42765 0.640 0.360
#> GSM35515     2  0.6247    0.80954 0.156 0.844
#> GSM35519     2  0.0000    0.97093 0.000 1.000
#> GSM35527     2  0.0000    0.97093 0.000 1.000
#> GSM35532     2  0.0000    0.97093 0.000 1.000
#> GSM35439     2  0.0000    0.97093 0.000 1.000
#> GSM35443     1  0.0000    0.96913 1.000 0.000
#> GSM35445     1  0.0000    0.96913 1.000 0.000
#> GSM35448     2  0.0000    0.97093 0.000 1.000
#> GSM35451     1  0.0000    0.96913 1.000 0.000
#> GSM35454     1  0.0000    0.96913 1.000 0.000
#> GSM35457     2  0.0000    0.97093 0.000 1.000
#> GSM35465     2  0.0000    0.97093 0.000 1.000
#> GSM35468     1  0.0000    0.96913 1.000 0.000
#> GSM35471     1  0.0000    0.96913 1.000 0.000
#> GSM35473     1  0.0000    0.96913 1.000 0.000
#> GSM35477     1  0.0000    0.96913 1.000 0.000
#> GSM35480     1  0.0000    0.96913 1.000 0.000
#> GSM35482     1  0.0000    0.96913 1.000 0.000
#> GSM35485     2  0.0000    0.97093 0.000 1.000
#> GSM35489     2  0.0000    0.97093 0.000 1.000
#> GSM35492     1  0.0000    0.96913 1.000 0.000
#> GSM35495     1  1.0000   -0.00581 0.504 0.496
#> GSM35499     2  0.0000    0.97093 0.000 1.000
#> GSM35502     1  0.0000    0.96913 1.000 0.000
#> GSM35505     1  0.0000    0.96913 1.000 0.000
#> GSM35507     1  0.8861    0.55275 0.696 0.304
#> GSM35510     2  0.0000    0.97093 0.000 1.000
#> GSM35514     1  0.0000    0.96913 1.000 0.000
#> GSM35517     2  0.0000    0.97093 0.000 1.000
#> GSM35520     2  0.0000    0.97093 0.000 1.000
#> GSM35523     1  0.0000    0.96913 1.000 0.000
#> GSM35529     2  0.0000    0.97093 0.000 1.000
#> GSM35531     2  0.1633    0.95232 0.024 0.976
#> GSM35534     2  0.0000    0.97093 0.000 1.000
#> GSM35536     1  0.0000    0.96913 1.000 0.000
#> GSM35538     1  0.0000    0.96913 1.000 0.000
#> GSM35539     1  0.0000    0.96913 1.000 0.000
#> GSM35540     2  0.0000    0.97093 0.000 1.000
#> GSM35541     2  0.0000    0.97093 0.000 1.000
#> GSM35442     1  0.0000    0.96913 1.000 0.000
#> GSM35447     1  0.0376    0.96563 0.996 0.004
#> GSM35450     1  0.0000    0.96913 1.000 0.000
#> GSM35453     1  0.0000    0.96913 1.000 0.000
#> GSM35456     1  0.0000    0.96913 1.000 0.000
#> GSM35464     2  0.5178    0.85892 0.116 0.884
#> GSM35467     1  0.0000    0.96913 1.000 0.000
#> GSM35470     1  0.0000    0.96913 1.000 0.000
#> GSM35479     1  0.0000    0.96913 1.000 0.000
#> GSM35484     1  0.0000    0.96913 1.000 0.000
#> GSM35488     1  0.0000    0.96913 1.000 0.000
#> GSM35491     1  0.0000    0.96913 1.000 0.000
#> GSM35494     1  0.0000    0.96913 1.000 0.000
#> GSM35498     1  0.0000    0.96913 1.000 0.000
#> GSM35501     1  0.0000    0.96913 1.000 0.000
#> GSM35509     2  0.9998    0.00433 0.492 0.508
#> GSM35513     1  0.0000    0.96913 1.000 0.000
#> GSM35516     2  0.0938    0.96190 0.012 0.988
#> GSM35522     1  0.3584    0.90237 0.932 0.068
#> GSM35525     1  0.0000    0.96913 1.000 0.000
#> GSM35528     1  0.0000    0.96913 1.000 0.000
#> GSM35533     1  0.0000    0.96913 1.000 0.000
#> GSM35537     1  0.0000    0.96913 1.000 0.000

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>          class entropy silhouette    p1    p2    p3
#> GSM35441     2  0.0000     0.9301 0.000 1.000 0.000
#> GSM35446     3  0.0000     0.8761 0.000 0.000 1.000
#> GSM35449     2  0.0000     0.9301 0.000 1.000 0.000
#> GSM35455     2  0.0000     0.9301 0.000 1.000 0.000
#> GSM35458     3  0.6955     0.4241 0.032 0.332 0.636
#> GSM35460     3  0.0000     0.8761 0.000 0.000 1.000
#> GSM35461     3  0.6154     0.4050 0.408 0.000 0.592
#> GSM35463     2  0.0000     0.9301 0.000 1.000 0.000
#> GSM35472     3  0.0000     0.8761 0.000 0.000 1.000
#> GSM35475     3  0.0000     0.8761 0.000 0.000 1.000
#> GSM35483     2  0.0424     0.9248 0.000 0.992 0.008
#> GSM35496     3  0.3267     0.8265 0.116 0.000 0.884
#> GSM35497     2  0.0000     0.9301 0.000 1.000 0.000
#> GSM35504     2  0.1411     0.9038 0.000 0.964 0.036
#> GSM35508     2  0.6168     0.2843 0.000 0.588 0.412
#> GSM35511     3  0.0000     0.8761 0.000 0.000 1.000
#> GSM35512     3  0.0000     0.8761 0.000 0.000 1.000
#> GSM35515     3  0.0000     0.8761 0.000 0.000 1.000
#> GSM35519     3  0.0000     0.8761 0.000 0.000 1.000
#> GSM35527     2  0.2537     0.8651 0.000 0.920 0.080
#> GSM35532     3  0.0000     0.8761 0.000 0.000 1.000
#> GSM35439     2  0.0000     0.9301 0.000 1.000 0.000
#> GSM35443     1  0.0000     0.9849 1.000 0.000 0.000
#> GSM35445     1  0.0000     0.9849 1.000 0.000 0.000
#> GSM35448     3  0.0000     0.8761 0.000 0.000 1.000
#> GSM35451     1  0.3551     0.8446 0.868 0.132 0.000
#> GSM35454     1  0.2356     0.9110 0.928 0.000 0.072
#> GSM35457     2  0.0000     0.9301 0.000 1.000 0.000
#> GSM35465     2  0.0000     0.9301 0.000 1.000 0.000
#> GSM35468     1  0.0000     0.9849 1.000 0.000 0.000
#> GSM35471     1  0.1643     0.9494 0.956 0.044 0.000
#> GSM35473     1  0.0000     0.9849 1.000 0.000 0.000
#> GSM35477     1  0.1643     0.9492 0.956 0.044 0.000
#> GSM35480     1  0.0000     0.9849 1.000 0.000 0.000
#> GSM35482     3  0.3267     0.8261 0.116 0.000 0.884
#> GSM35485     2  0.0000     0.9301 0.000 1.000 0.000
#> GSM35489     2  0.0000     0.9301 0.000 1.000 0.000
#> GSM35492     1  0.0000     0.9849 1.000 0.000 0.000
#> GSM35495     3  0.0000     0.8761 0.000 0.000 1.000
#> GSM35499     2  0.0000     0.9301 0.000 1.000 0.000
#> GSM35502     1  0.0000     0.9849 1.000 0.000 0.000
#> GSM35505     3  0.5497     0.6288 0.292 0.000 0.708
#> GSM35507     2  0.6126     0.3250 0.400 0.600 0.000
#> GSM35510     2  0.0000     0.9301 0.000 1.000 0.000
#> GSM35514     1  0.0000     0.9849 1.000 0.000 0.000
#> GSM35517     2  0.0000     0.9301 0.000 1.000 0.000
#> GSM35520     3  0.5621     0.4980 0.000 0.308 0.692
#> GSM35523     1  0.0237     0.9828 0.996 0.004 0.000
#> GSM35529     2  0.0000     0.9301 0.000 1.000 0.000
#> GSM35531     2  0.0237     0.9273 0.004 0.996 0.000
#> GSM35534     2  0.0000     0.9301 0.000 1.000 0.000
#> GSM35536     1  0.0000     0.9849 1.000 0.000 0.000
#> GSM35538     1  0.0237     0.9828 0.996 0.004 0.000
#> GSM35539     1  0.0000     0.9849 1.000 0.000 0.000
#> GSM35540     2  0.2165     0.8813 0.000 0.936 0.064
#> GSM35541     2  0.0000     0.9301 0.000 1.000 0.000
#> GSM35442     1  0.0747     0.9722 0.984 0.000 0.016
#> GSM35447     3  0.1031     0.8692 0.024 0.000 0.976
#> GSM35450     1  0.0592     0.9773 0.988 0.012 0.000
#> GSM35453     1  0.0000     0.9849 1.000 0.000 0.000
#> GSM35456     1  0.2066     0.9331 0.940 0.060 0.000
#> GSM35464     2  0.0237     0.9272 0.004 0.996 0.000
#> GSM35467     1  0.0000     0.9849 1.000 0.000 0.000
#> GSM35470     1  0.0000     0.9849 1.000 0.000 0.000
#> GSM35479     3  0.3686     0.8104 0.140 0.000 0.860
#> GSM35484     1  0.0000     0.9849 1.000 0.000 0.000
#> GSM35488     1  0.0000     0.9849 1.000 0.000 0.000
#> GSM35491     1  0.0000     0.9849 1.000 0.000 0.000
#> GSM35494     3  0.6225     0.3420 0.432 0.000 0.568
#> GSM35498     1  0.0747     0.9742 0.984 0.016 0.000
#> GSM35501     1  0.0000     0.9849 1.000 0.000 0.000
#> GSM35509     3  0.0592     0.8733 0.012 0.000 0.988
#> GSM35513     1  0.0000     0.9849 1.000 0.000 0.000
#> GSM35516     2  0.0000     0.9301 0.000 1.000 0.000
#> GSM35522     2  0.6305     0.0564 0.484 0.516 0.000
#> GSM35525     1  0.0000     0.9849 1.000 0.000 0.000
#> GSM35528     1  0.0237     0.9828 0.996 0.004 0.000
#> GSM35533     1  0.0000     0.9849 1.000 0.000 0.000
#> GSM35537     1  0.0000     0.9849 1.000 0.000 0.000

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>          class entropy silhouette    p1    p2    p3    p4
#> GSM35441     2  0.3942     0.6531 0.000 0.764 0.000 0.236
#> GSM35446     3  0.3486     0.6925 0.000 0.000 0.812 0.188
#> GSM35449     2  0.1716     0.7113 0.000 0.936 0.000 0.064
#> GSM35455     2  0.2704     0.7059 0.000 0.876 0.000 0.124
#> GSM35458     4  0.2611     0.7073 0.096 0.000 0.008 0.896
#> GSM35460     3  0.1716     0.7541 0.000 0.000 0.936 0.064
#> GSM35461     1  0.5660     0.3163 0.576 0.000 0.396 0.028
#> GSM35463     2  0.4008     0.6398 0.000 0.756 0.000 0.244
#> GSM35472     3  0.2149     0.7501 0.000 0.000 0.912 0.088
#> GSM35475     4  0.2297     0.7298 0.024 0.004 0.044 0.928
#> GSM35483     4  0.2469     0.7237 0.000 0.108 0.000 0.892
#> GSM35496     3  0.2861     0.7397 0.096 0.000 0.888 0.016
#> GSM35497     2  0.3975     0.6480 0.000 0.760 0.000 0.240
#> GSM35504     2  0.4248     0.6411 0.000 0.768 0.012 0.220
#> GSM35508     3  0.6251     0.4500 0.000 0.140 0.664 0.196
#> GSM35511     3  0.3024     0.7130 0.000 0.000 0.852 0.148
#> GSM35512     3  0.5108     0.5204 0.020 0.000 0.672 0.308
#> GSM35515     4  0.3247     0.7047 0.060 0.000 0.060 0.880
#> GSM35519     4  0.3208     0.6645 0.004 0.000 0.148 0.848
#> GSM35527     2  0.5327     0.5960 0.000 0.720 0.060 0.220
#> GSM35532     4  0.4996    -0.0585 0.000 0.000 0.484 0.516
#> GSM35439     4  0.4632     0.4250 0.004 0.308 0.000 0.688
#> GSM35443     1  0.1557     0.8600 0.944 0.000 0.000 0.056
#> GSM35445     1  0.0376     0.8740 0.992 0.000 0.004 0.004
#> GSM35448     4  0.4453     0.5650 0.000 0.012 0.244 0.744
#> GSM35451     2  0.5682     0.3496 0.352 0.612 0.000 0.036
#> GSM35454     1  0.3808     0.7595 0.812 0.000 0.176 0.012
#> GSM35457     2  0.1716     0.7114 0.000 0.936 0.000 0.064
#> GSM35465     2  0.0657     0.6958 0.000 0.984 0.004 0.012
#> GSM35468     1  0.0469     0.8745 0.988 0.000 0.000 0.012
#> GSM35471     2  0.6579     0.2992 0.336 0.592 0.024 0.048
#> GSM35473     1  0.0921     0.8723 0.972 0.000 0.000 0.028
#> GSM35477     1  0.4425     0.7609 0.800 0.160 0.004 0.036
#> GSM35480     1  0.2463     0.8539 0.924 0.008 0.032 0.036
#> GSM35482     3  0.3266     0.6823 0.168 0.000 0.832 0.000
#> GSM35485     4  0.3649     0.6265 0.000 0.204 0.000 0.796
#> GSM35489     2  0.4907     0.3706 0.000 0.580 0.000 0.420
#> GSM35492     1  0.0921     0.8723 0.972 0.000 0.000 0.028
#> GSM35495     3  0.0921     0.7565 0.000 0.000 0.972 0.028
#> GSM35499     2  0.2149     0.7115 0.000 0.912 0.000 0.088
#> GSM35502     1  0.0469     0.8743 0.988 0.000 0.000 0.012
#> GSM35505     1  0.6988     0.0799 0.500 0.000 0.120 0.380
#> GSM35507     2  0.4371     0.6036 0.124 0.820 0.008 0.048
#> GSM35510     2  0.1716     0.7114 0.000 0.936 0.000 0.064
#> GSM35514     1  0.0817     0.8737 0.976 0.000 0.000 0.024
#> GSM35517     2  0.4746     0.4847 0.000 0.632 0.000 0.368
#> GSM35520     4  0.2048     0.7430 0.000 0.064 0.008 0.928
#> GSM35523     2  0.7643     0.1742 0.344 0.524 0.084 0.048
#> GSM35529     2  0.2814     0.7036 0.000 0.868 0.000 0.132
#> GSM35531     4  0.4775     0.6751 0.076 0.140 0.000 0.784
#> GSM35534     4  0.2760     0.7107 0.000 0.128 0.000 0.872
#> GSM35536     1  0.0469     0.8747 0.988 0.000 0.000 0.012
#> GSM35538     1  0.2825     0.8442 0.908 0.048 0.008 0.036
#> GSM35539     1  0.3583     0.8267 0.876 0.060 0.016 0.048
#> GSM35540     2  0.3032     0.7013 0.000 0.868 0.008 0.124
#> GSM35541     2  0.4888     0.3742 0.000 0.588 0.000 0.412
#> GSM35442     1  0.1302     0.8678 0.956 0.000 0.000 0.044
#> GSM35447     4  0.7382     0.1870 0.276 0.000 0.208 0.516
#> GSM35450     1  0.2124     0.8546 0.932 0.040 0.000 0.028
#> GSM35453     1  0.1059     0.8746 0.972 0.000 0.012 0.016
#> GSM35456     2  0.6821     0.0253 0.432 0.496 0.024 0.048
#> GSM35464     2  0.2040     0.6685 0.012 0.936 0.004 0.048
#> GSM35467     1  0.1302     0.8666 0.956 0.000 0.000 0.044
#> GSM35470     1  0.5232     0.7635 0.788 0.044 0.120 0.048
#> GSM35479     3  0.3400     0.7111 0.128 0.004 0.856 0.012
#> GSM35484     1  0.1867     0.8490 0.928 0.000 0.000 0.072
#> GSM35488     1  0.0817     0.8683 0.976 0.000 0.000 0.024
#> GSM35491     1  0.0707     0.8739 0.980 0.000 0.000 0.020
#> GSM35494     3  0.6354     0.1646 0.396 0.008 0.548 0.048
#> GSM35498     1  0.7401     0.1069 0.464 0.432 0.056 0.048
#> GSM35501     1  0.0469     0.8745 0.988 0.000 0.000 0.012
#> GSM35509     3  0.1229     0.7475 0.004 0.020 0.968 0.008
#> GSM35513     1  0.1389     0.8648 0.952 0.000 0.000 0.048
#> GSM35516     2  0.3801     0.6600 0.000 0.780 0.000 0.220
#> GSM35522     2  0.5178     0.5835 0.116 0.792 0.044 0.048
#> GSM35525     1  0.2335     0.8548 0.928 0.008 0.020 0.044
#> GSM35528     1  0.4983     0.7582 0.788 0.144 0.020 0.048
#> GSM35533     1  0.1389     0.8648 0.952 0.000 0.000 0.048
#> GSM35537     1  0.6266     0.7035 0.724 0.088 0.140 0.048

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>          class entropy silhouette    p1    p2    p3    p4    p5
#> GSM35441     2  0.2674     0.5825 0.000 0.868 0.000 0.012 0.120
#> GSM35446     3  0.3234     0.7101 0.000 0.000 0.852 0.084 0.064
#> GSM35449     5  0.6804    -0.0278 0.000 0.304 0.000 0.324 0.372
#> GSM35455     2  0.6210     0.2955 0.000 0.492 0.000 0.148 0.360
#> GSM35458     5  0.1741     0.4705 0.024 0.000 0.000 0.040 0.936
#> GSM35460     3  0.1942     0.7052 0.000 0.000 0.920 0.068 0.012
#> GSM35461     1  0.5201     0.6727 0.744 0.000 0.124 0.060 0.072
#> GSM35463     2  0.3055     0.5755 0.000 0.864 0.000 0.064 0.072
#> GSM35472     3  0.2136     0.7273 0.000 0.000 0.904 0.088 0.008
#> GSM35475     5  0.5691     0.2842 0.012 0.004 0.088 0.248 0.648
#> GSM35483     5  0.6878     0.2356 0.000 0.280 0.004 0.308 0.408
#> GSM35496     3  0.2946     0.6952 0.088 0.000 0.868 0.044 0.000
#> GSM35497     5  0.5572     0.3491 0.000 0.164 0.000 0.192 0.644
#> GSM35504     2  0.6009     0.2766 0.000 0.516 0.008 0.092 0.384
#> GSM35508     5  0.5633     0.3932 0.000 0.004 0.080 0.336 0.580
#> GSM35511     5  0.5659     0.2553 0.000 0.000 0.320 0.100 0.580
#> GSM35512     3  0.3995     0.6870 0.000 0.000 0.776 0.180 0.044
#> GSM35515     5  0.1372     0.4692 0.024 0.000 0.016 0.004 0.956
#> GSM35519     4  0.6901    -0.4354 0.000 0.004 0.268 0.368 0.360
#> GSM35527     5  0.5787     0.3762 0.000 0.092 0.004 0.340 0.564
#> GSM35532     5  0.6131     0.1771 0.000 0.000 0.284 0.168 0.548
#> GSM35439     5  0.6698     0.2055 0.008 0.308 0.000 0.204 0.480
#> GSM35443     1  0.3087     0.8231 0.868 0.000 0.004 0.064 0.064
#> GSM35445     1  0.1082     0.8704 0.964 0.000 0.008 0.028 0.000
#> GSM35448     3  0.6363     0.4683 0.000 0.016 0.584 0.200 0.200
#> GSM35451     2  0.4457     0.3783 0.208 0.740 0.004 0.048 0.000
#> GSM35454     3  0.4854     0.6796 0.072 0.016 0.740 0.172 0.000
#> GSM35457     2  0.3800     0.5901 0.000 0.812 0.000 0.108 0.080
#> GSM35465     2  0.3656     0.5526 0.000 0.784 0.000 0.196 0.020
#> GSM35468     1  0.0703     0.8715 0.976 0.000 0.000 0.000 0.024
#> GSM35471     2  0.6121     0.1338 0.256 0.576 0.004 0.164 0.000
#> GSM35473     1  0.0693     0.8731 0.980 0.000 0.000 0.008 0.012
#> GSM35477     1  0.4068     0.7233 0.792 0.144 0.004 0.060 0.000
#> GSM35480     1  0.1205     0.8622 0.956 0.000 0.004 0.040 0.000
#> GSM35482     3  0.5173     0.5324 0.184 0.000 0.704 0.104 0.008
#> GSM35485     2  0.6749    -0.1078 0.000 0.400 0.000 0.272 0.328
#> GSM35489     2  0.2685     0.5795 0.000 0.880 0.000 0.092 0.028
#> GSM35492     1  0.1243     0.8702 0.960 0.000 0.004 0.008 0.028
#> GSM35495     3  0.2753     0.7299 0.012 0.008 0.876 0.104 0.000
#> GSM35499     2  0.0404     0.6030 0.000 0.988 0.000 0.012 0.000
#> GSM35502     1  0.0798     0.8732 0.976 0.000 0.000 0.008 0.016
#> GSM35505     3  0.5268     0.6218 0.040 0.000 0.660 0.276 0.024
#> GSM35507     2  0.5811     0.3023 0.140 0.596 0.000 0.264 0.000
#> GSM35510     2  0.1549     0.6069 0.000 0.944 0.000 0.016 0.040
#> GSM35514     1  0.1670     0.8611 0.936 0.000 0.000 0.012 0.052
#> GSM35517     2  0.4800     0.3266 0.000 0.604 0.000 0.028 0.368
#> GSM35520     5  0.5531     0.3439 0.004 0.048 0.020 0.288 0.640
#> GSM35523     4  0.7445    -0.2187 0.332 0.272 0.032 0.364 0.000
#> GSM35529     2  0.6498     0.2558 0.000 0.452 0.000 0.196 0.352
#> GSM35531     2  0.6353     0.1370 0.004 0.516 0.048 0.384 0.048
#> GSM35534     2  0.6808    -0.1849 0.000 0.360 0.000 0.300 0.340
#> GSM35536     1  0.0703     0.8715 0.976 0.000 0.000 0.000 0.024
#> GSM35538     1  0.0963     0.8646 0.964 0.000 0.000 0.036 0.000
#> GSM35539     1  0.1798     0.8494 0.928 0.004 0.004 0.064 0.000
#> GSM35540     2  0.2889     0.5989 0.000 0.880 0.016 0.084 0.020
#> GSM35541     2  0.4822     0.4451 0.000 0.704 0.000 0.076 0.220
#> GSM35442     1  0.1934     0.8616 0.932 0.000 0.008 0.020 0.040
#> GSM35447     3  0.6529     0.3682 0.012 0.000 0.504 0.332 0.152
#> GSM35450     1  0.2300     0.8445 0.908 0.052 0.000 0.040 0.000
#> GSM35453     1  0.0162     0.8721 0.996 0.000 0.004 0.000 0.000
#> GSM35456     1  0.5704     0.5089 0.660 0.124 0.004 0.204 0.008
#> GSM35464     2  0.3812     0.5360 0.020 0.780 0.000 0.196 0.004
#> GSM35467     1  0.1430     0.8609 0.944 0.000 0.000 0.004 0.052
#> GSM35470     1  0.3969     0.7456 0.808 0.004 0.092 0.096 0.000
#> GSM35479     3  0.3427     0.6727 0.108 0.000 0.836 0.056 0.000
#> GSM35484     1  0.3737     0.7948 0.836 0.008 0.012 0.108 0.036
#> GSM35488     1  0.0404     0.8706 0.988 0.000 0.000 0.012 0.000
#> GSM35491     1  0.0912     0.8726 0.972 0.000 0.000 0.012 0.016
#> GSM35494     3  0.4830     0.4671 0.256 0.000 0.684 0.060 0.000
#> GSM35498     1  0.6980    -0.2249 0.384 0.380 0.012 0.224 0.000
#> GSM35501     1  0.0510     0.8722 0.984 0.000 0.000 0.000 0.016
#> GSM35509     3  0.2293     0.7059 0.016 0.000 0.900 0.084 0.000
#> GSM35513     1  0.1571     0.8568 0.936 0.000 0.000 0.004 0.060
#> GSM35516     2  0.1731     0.5955 0.000 0.932 0.004 0.060 0.004
#> GSM35522     2  0.5691     0.2582 0.084 0.516 0.000 0.400 0.000
#> GSM35525     1  0.1282     0.8608 0.952 0.000 0.004 0.044 0.000
#> GSM35528     1  0.1908     0.8362 0.908 0.000 0.000 0.092 0.000
#> GSM35533     1  0.3100     0.8057 0.852 0.008 0.008 0.128 0.004
#> GSM35537     1  0.4729     0.6065 0.708 0.004 0.052 0.236 0.000

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>          class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM35441     4  0.4652     0.3312 0.000 0.352 0.000 0.600 0.004 0.044
#> GSM35446     3  0.3738     0.6451 0.000 0.044 0.808 0.000 0.116 0.032
#> GSM35449     6  0.4622     0.4470 0.000 0.036 0.000 0.348 0.008 0.608
#> GSM35455     4  0.5959     0.2467 0.000 0.280 0.000 0.516 0.012 0.192
#> GSM35458     2  0.5327     0.2569 0.024 0.612 0.000 0.000 0.084 0.280
#> GSM35460     3  0.0665     0.7220 0.000 0.008 0.980 0.000 0.008 0.004
#> GSM35461     5  0.5620     0.0808 0.348 0.000 0.020 0.004 0.544 0.084
#> GSM35463     2  0.4459     0.0478 0.000 0.548 0.000 0.428 0.012 0.012
#> GSM35472     3  0.3230     0.6249 0.000 0.000 0.776 0.000 0.212 0.012
#> GSM35475     5  0.6109     0.1795 0.004 0.164 0.012 0.000 0.468 0.352
#> GSM35483     2  0.1672     0.5343 0.000 0.940 0.012 0.028 0.004 0.016
#> GSM35496     3  0.2709     0.7160 0.044 0.000 0.884 0.000 0.032 0.040
#> GSM35497     6  0.5703     0.5115 0.000 0.220 0.000 0.228 0.004 0.548
#> GSM35504     2  0.6686     0.0719 0.000 0.480 0.024 0.324 0.036 0.136
#> GSM35508     6  0.3182     0.6357 0.000 0.044 0.004 0.084 0.016 0.852
#> GSM35511     6  0.5157     0.1914 0.000 0.072 0.148 0.000 0.080 0.700
#> GSM35512     3  0.5306     0.3043 0.000 0.040 0.576 0.000 0.340 0.044
#> GSM35515     2  0.5609     0.0940 0.016 0.500 0.000 0.000 0.096 0.388
#> GSM35519     5  0.7007     0.4003 0.000 0.228 0.140 0.000 0.476 0.156
#> GSM35527     6  0.3295     0.6671 0.000 0.056 0.000 0.128 0.000 0.816
#> GSM35532     2  0.7403    -0.2086 0.000 0.376 0.228 0.000 0.136 0.260
#> GSM35439     2  0.2656     0.5229 0.004 0.884 0.000 0.060 0.008 0.044
#> GSM35443     1  0.4211     0.3258 0.532 0.000 0.000 0.008 0.456 0.004
#> GSM35445     1  0.2009     0.8057 0.904 0.000 0.004 0.008 0.084 0.000
#> GSM35448     2  0.4463    -0.0509 0.000 0.508 0.468 0.000 0.020 0.004
#> GSM35451     4  0.3960     0.5589 0.076 0.012 0.000 0.796 0.108 0.008
#> GSM35454     3  0.4814     0.4424 0.040 0.000 0.628 0.020 0.312 0.000
#> GSM35457     4  0.3703     0.5439 0.000 0.132 0.000 0.792 0.004 0.072
#> GSM35465     4  0.1908     0.5474 0.000 0.004 0.000 0.900 0.000 0.096
#> GSM35468     1  0.0777     0.8283 0.972 0.000 0.000 0.000 0.024 0.004
#> GSM35471     4  0.3492     0.5438 0.120 0.004 0.000 0.824 0.024 0.028
#> GSM35473     1  0.0520     0.8287 0.984 0.008 0.000 0.000 0.008 0.000
#> GSM35477     4  0.6104     0.0266 0.288 0.000 0.000 0.364 0.348 0.000
#> GSM35480     1  0.1949     0.8108 0.904 0.004 0.000 0.000 0.088 0.004
#> GSM35482     3  0.5838     0.4099 0.216 0.004 0.628 0.004 0.052 0.096
#> GSM35485     2  0.2699     0.5308 0.000 0.856 0.000 0.124 0.012 0.008
#> GSM35489     4  0.3927     0.4602 0.000 0.260 0.000 0.712 0.024 0.004
#> GSM35492     1  0.2668     0.7599 0.828 0.000 0.000 0.004 0.168 0.000
#> GSM35495     3  0.1124     0.7211 0.000 0.008 0.956 0.000 0.036 0.000
#> GSM35499     4  0.2985     0.5831 0.000 0.100 0.000 0.844 0.056 0.000
#> GSM35502     1  0.1802     0.8134 0.916 0.012 0.000 0.000 0.072 0.000
#> GSM35505     5  0.5293     0.0567 0.056 0.024 0.372 0.000 0.548 0.000
#> GSM35507     4  0.3573     0.5332 0.048 0.004 0.000 0.836 0.052 0.060
#> GSM35510     4  0.3894     0.5116 0.000 0.220 0.000 0.740 0.004 0.036
#> GSM35514     1  0.1010     0.8277 0.960 0.000 0.000 0.000 0.036 0.004
#> GSM35517     4  0.5715     0.2167 0.000 0.364 0.000 0.484 0.004 0.148
#> GSM35520     2  0.5193     0.2731 0.000 0.644 0.008 0.000 0.176 0.172
#> GSM35523     1  0.7659     0.1997 0.448 0.004 0.028 0.236 0.168 0.116
#> GSM35529     4  0.5929     0.1929 0.000 0.200 0.000 0.528 0.012 0.260
#> GSM35531     2  0.5241     0.1647 0.000 0.552 0.024 0.372 0.052 0.000
#> GSM35534     2  0.1398     0.5408 0.000 0.940 0.008 0.052 0.000 0.000
#> GSM35536     1  0.0937     0.8256 0.960 0.000 0.000 0.000 0.040 0.000
#> GSM35538     1  0.0914     0.8289 0.968 0.000 0.000 0.016 0.016 0.000
#> GSM35539     1  0.1956     0.8130 0.908 0.000 0.000 0.008 0.080 0.004
#> GSM35540     4  0.3682     0.5134 0.000 0.028 0.004 0.796 0.016 0.156
#> GSM35541     2  0.3215     0.4401 0.000 0.756 0.000 0.240 0.004 0.000
#> GSM35442     1  0.3005     0.7838 0.856 0.008 0.036 0.000 0.096 0.004
#> GSM35447     5  0.6782     0.1199 0.000 0.184 0.364 0.000 0.392 0.060
#> GSM35450     1  0.3932     0.6763 0.760 0.000 0.000 0.184 0.048 0.008
#> GSM35453     1  0.1124     0.8253 0.956 0.008 0.000 0.000 0.036 0.000
#> GSM35456     4  0.6207     0.0201 0.416 0.000 0.000 0.436 0.072 0.076
#> GSM35464     4  0.1080     0.5772 0.004 0.000 0.000 0.960 0.032 0.004
#> GSM35467     1  0.1074     0.8285 0.960 0.012 0.000 0.000 0.028 0.000
#> GSM35470     1  0.4256     0.6771 0.744 0.000 0.112 0.000 0.140 0.004
#> GSM35479     3  0.2941     0.6692 0.064 0.000 0.856 0.000 0.076 0.004
#> GSM35484     1  0.4764     0.2396 0.492 0.008 0.004 0.024 0.472 0.000
#> GSM35488     1  0.0508     0.8287 0.984 0.000 0.000 0.004 0.012 0.000
#> GSM35491     1  0.3073     0.7265 0.788 0.000 0.000 0.008 0.204 0.000
#> GSM35494     3  0.3632     0.6034 0.148 0.004 0.800 0.000 0.040 0.008
#> GSM35498     4  0.5558     0.4291 0.148 0.004 0.008 0.676 0.124 0.040
#> GSM35501     1  0.2039     0.8099 0.908 0.016 0.000 0.000 0.072 0.004
#> GSM35509     3  0.0725     0.7188 0.000 0.000 0.976 0.000 0.012 0.012
#> GSM35513     1  0.1155     0.8277 0.956 0.004 0.000 0.000 0.036 0.004
#> GSM35516     4  0.4095     0.5462 0.000 0.100 0.000 0.748 0.152 0.000
#> GSM35522     4  0.6831     0.1656 0.128 0.004 0.004 0.544 0.148 0.172
#> GSM35525     1  0.2333     0.7927 0.872 0.004 0.000 0.000 0.120 0.004
#> GSM35528     1  0.1405     0.8278 0.948 0.000 0.000 0.024 0.024 0.004
#> GSM35533     1  0.4649     0.5307 0.632 0.024 0.004 0.016 0.324 0.000
#> GSM35537     1  0.4710     0.6720 0.736 0.004 0.048 0.004 0.168 0.040

Heatmaps for the consensus matrix. It visualizes the probability of two samples to be in a same group.

consensus_heatmap(res, k = 2)

plot of chunk tab-ATC-NMF-consensus-heatmap-1

consensus_heatmap(res, k = 3)

plot of chunk tab-ATC-NMF-consensus-heatmap-2

consensus_heatmap(res, k = 4)

plot of chunk tab-ATC-NMF-consensus-heatmap-3

consensus_heatmap(res, k = 5)

plot of chunk tab-ATC-NMF-consensus-heatmap-4

consensus_heatmap(res, k = 6)

plot of chunk tab-ATC-NMF-consensus-heatmap-5

Heatmaps for the membership of samples in all partitions to see how consistent they are:

membership_heatmap(res, k = 2)

plot of chunk tab-ATC-NMF-membership-heatmap-1

membership_heatmap(res, k = 3)

plot of chunk tab-ATC-NMF-membership-heatmap-2

membership_heatmap(res, k = 4)

plot of chunk tab-ATC-NMF-membership-heatmap-3

membership_heatmap(res, k = 5)

plot of chunk tab-ATC-NMF-membership-heatmap-4

membership_heatmap(res, k = 6)

plot of chunk tab-ATC-NMF-membership-heatmap-5

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)

plot of chunk tab-ATC-NMF-get-signatures-1

get_signatures(res, k = 3)

plot of chunk tab-ATC-NMF-get-signatures-2

get_signatures(res, k = 4)

plot of chunk tab-ATC-NMF-get-signatures-3

get_signatures(res, k = 5)

plot of chunk tab-ATC-NMF-get-signatures-4

get_signatures(res, k = 6)

plot of chunk tab-ATC-NMF-get-signatures-5

Signature heatmaps where rows are not scaled:

get_signatures(res, k = 2, scale_rows = FALSE)

plot of chunk tab-ATC-NMF-get-signatures-no-scale-1

get_signatures(res, k = 3, scale_rows = FALSE)

plot of chunk tab-ATC-NMF-get-signatures-no-scale-2

get_signatures(res, k = 4, scale_rows = FALSE)

plot of chunk tab-ATC-NMF-get-signatures-no-scale-3

get_signatures(res, k = 5, scale_rows = FALSE)

plot of chunk tab-ATC-NMF-get-signatures-no-scale-4

get_signatures(res, k = 6, scale_rows = FALSE)

plot of chunk tab-ATC-NMF-get-signatures-no-scale-5

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk ATC-NMF-signature_compare

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:

  1. which_row: row indices corresponding to the input matrix.
  2. fdr: FDR for the differential test.
  3. mean_x: The mean value in group x.
  4. scaled_mean_x: The mean value in group x after rows are scaled.
  5. 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")

plot of chunk tab-ATC-NMF-dimension-reduction-1

dimension_reduction(res, k = 3, method = "UMAP")

plot of chunk tab-ATC-NMF-dimension-reduction-2

dimension_reduction(res, k = 4, method = "UMAP")

plot of chunk tab-ATC-NMF-dimension-reduction-3

dimension_reduction(res, k = 5, method = "UMAP")

plot of chunk tab-ATC-NMF-dimension-reduction-4

dimension_reduction(res, k = 6, method = "UMAP")

plot of chunk tab-ATC-NMF-dimension-reduction-5

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk ATC-NMF-collect-classes

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  time(p) k
#> ATC:NMF 76 9.68e-07 2
#> ATC:NMF 72 1.22e-05 3
#> ATC:NMF 64 5.08e-04 4
#> ATC:NMF 49 1.13e-02 5
#> ATC:NMF 48 1.92e-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.

Session info

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