cola Report for GDS3325

Date: 2019-12-25 20:43:12 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 18172 rows and 71 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] 18172    71

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
MAD:kmeans 2 1.000 0.965 0.986 **
MAD:skmeans 2 1.000 0.989 0.995 **
ATC:kmeans 3 1.000 0.974 0.988 ** 2
CV:skmeans 2 0.970 0.927 0.970 **
ATC:pam 3 0.952 0.937 0.975 **
MAD:NMF 2 0.940 0.944 0.975 *
SD:skmeans 2 0.938 0.907 0.965 *
ATC:skmeans 5 0.912 0.862 0.919 * 2
ATC:NMF 2 0.910 0.911 0.964 *
ATC:mclust 2 0.910 0.895 0.960 *
MAD:pam 2 0.865 0.892 0.955
CV:kmeans 2 0.858 0.915 0.954
SD:pam 2 0.853 0.888 0.953
SD:NMF 2 0.779 0.889 0.953
SD:kmeans 2 0.777 0.857 0.936
CV:pam 6 0.754 0.634 0.833
CV:NMF 2 0.681 0.822 0.918
MAD:mclust 3 0.629 0.647 0.855
CV:mclust 5 0.618 0.690 0.782
ATC:hclust 3 0.524 0.774 0.878
SD:mclust 3 0.502 0.794 0.855
SD:hclust 5 0.476 0.611 0.723
MAD:hclust 2 0.403 0.854 0.886
CV:hclust 3 0.370 0.593 0.745

**: 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.779           0.889       0.953          0.501 0.501   0.501
#> CV:NMF      2 0.681           0.822       0.918          0.460 0.505   0.505
#> MAD:NMF     2 0.940           0.944       0.975          0.506 0.493   0.493
#> ATC:NMF     2 0.910           0.911       0.964          0.502 0.494   0.494
#> SD:skmeans  2 0.938           0.907       0.965          0.507 0.494   0.494
#> CV:skmeans  2 0.970           0.927       0.970          0.504 0.501   0.501
#> MAD:skmeans 2 1.000           0.989       0.995          0.507 0.493   0.493
#> ATC:skmeans 2 1.000           0.965       0.986          0.507 0.493   0.493
#> SD:mclust   2 0.427           0.792       0.888          0.404 0.590   0.590
#> CV:mclust   2 0.664           0.866       0.931          0.397 0.577   0.577
#> MAD:mclust  2 0.368           0.846       0.896          0.388 0.566   0.566
#> ATC:mclust  2 0.910           0.895       0.960          0.422 0.577   0.577
#> SD:kmeans   2 0.777           0.857       0.936          0.494 0.515   0.515
#> CV:kmeans   2 0.858           0.915       0.954          0.476 0.501   0.501
#> MAD:kmeans  2 1.000           0.965       0.986          0.506 0.494   0.494
#> ATC:kmeans  2 1.000           0.958       0.982          0.502 0.498   0.498
#> SD:pam      2 0.853           0.888       0.953          0.497 0.505   0.505
#> CV:pam      2 0.472           0.758       0.815          0.428 0.529   0.529
#> MAD:pam     2 0.865           0.892       0.955          0.498 0.498   0.498
#> ATC:pam     2 0.670           0.806       0.917          0.485 0.493   0.493
#> SD:hclust   2 0.303           0.676       0.783          0.386 0.556   0.556
#> CV:hclust   2 0.591           0.732       0.884          0.405 0.631   0.631
#> MAD:hclust  2 0.403           0.854       0.886          0.457 0.494   0.494
#> ATC:hclust  2 0.358           0.718       0.834          0.429 0.505   0.505
get_stats(res_list, k = 3)
#>             k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> SD:NMF      3 0.756           0.863       0.934          0.319 0.752   0.544
#> CV:NMF      3 0.326           0.408       0.709          0.369 0.803   0.634
#> MAD:NMF     3 0.602           0.730       0.873          0.313 0.697   0.465
#> ATC:NMF     3 0.599           0.790       0.851          0.308 0.726   0.497
#> SD:skmeans  3 0.722           0.818       0.918          0.309 0.804   0.622
#> CV:skmeans  3 0.660           0.731       0.808          0.287 0.788   0.597
#> MAD:skmeans 3 0.860           0.846       0.938          0.309 0.758   0.546
#> ATC:skmeans 3 0.723           0.628       0.858          0.235 0.931   0.861
#> SD:mclust   3 0.502           0.794       0.855          0.570 0.642   0.438
#> CV:mclust   3 0.364           0.557       0.802          0.533 0.651   0.451
#> MAD:mclust  3 0.629           0.647       0.855          0.642 0.705   0.505
#> ATC:mclust  3 0.498           0.755       0.836          0.435 0.771   0.614
#> SD:kmeans   3 0.790           0.852       0.919          0.312 0.657   0.434
#> CV:kmeans   3 0.528           0.626       0.838          0.317 0.631   0.402
#> MAD:kmeans  3 0.755           0.862       0.923          0.304 0.703   0.472
#> ATC:kmeans  3 1.000           0.974       0.988          0.250 0.687   0.470
#> SD:pam      3 0.590           0.752       0.874          0.260 0.668   0.455
#> CV:pam      3 0.394           0.564       0.762          0.382 0.594   0.399
#> MAD:pam     3 0.556           0.636       0.808          0.288 0.709   0.490
#> ATC:pam     3 0.952           0.937       0.975          0.224 0.602   0.387
#> SD:hclust   3 0.303           0.490       0.683          0.493 0.650   0.449
#> CV:hclust   3 0.370           0.593       0.745          0.529 0.657   0.483
#> MAD:hclust  3 0.498           0.759       0.863          0.333 0.874   0.751
#> ATC:hclust  3 0.524           0.774       0.878          0.375 0.784   0.610
get_stats(res_list, k = 4)
#>             k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> SD:NMF      4 0.728           0.769       0.886         0.1240 0.779   0.457
#> CV:NMF      4 0.532           0.675       0.824         0.1377 0.703   0.370
#> MAD:NMF     4 0.812           0.831       0.916         0.1149 0.776   0.456
#> ATC:NMF     4 0.596           0.711       0.839         0.0864 0.917   0.762
#> SD:skmeans  4 0.685           0.732       0.868         0.1143 0.905   0.734
#> CV:skmeans  4 0.762           0.724       0.880         0.1239 0.822   0.554
#> MAD:skmeans 4 0.711           0.731       0.860         0.1181 0.874   0.655
#> ATC:skmeans 4 0.829           0.751       0.851         0.1335 0.801   0.564
#> SD:mclust   4 0.557           0.505       0.776         0.1086 0.885   0.699
#> CV:mclust   4 0.457           0.484       0.681         0.1309 0.843   0.593
#> MAD:mclust  4 0.536           0.594       0.782         0.0956 0.882   0.677
#> ATC:mclust  4 0.509           0.592       0.745         0.1105 0.720   0.412
#> SD:kmeans   4 0.610           0.614       0.817         0.1298 0.872   0.657
#> CV:kmeans   4 0.597           0.697       0.800         0.1675 0.839   0.587
#> MAD:kmeans  4 0.606           0.590       0.733         0.1178 0.850   0.598
#> ATC:kmeans  4 0.672           0.727       0.836         0.1544 0.769   0.470
#> SD:pam      4 0.533           0.470       0.703         0.1241 0.847   0.659
#> CV:pam      4 0.609           0.628       0.821         0.1921 0.760   0.489
#> MAD:pam     4 0.440           0.420       0.686         0.1343 0.736   0.407
#> ATC:pam     4 0.839           0.810       0.928         0.2043 0.751   0.470
#> SD:hclust   4 0.392           0.428       0.712         0.1868 0.849   0.635
#> CV:hclust   4 0.428           0.441       0.693         0.1420 0.813   0.524
#> MAD:hclust  4 0.519           0.628       0.747         0.1330 0.891   0.720
#> ATC:hclust  4 0.558           0.611       0.789         0.1648 0.885   0.730
get_stats(res_list, k = 5)
#>             k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> SD:NMF      5 0.731           0.688       0.848         0.0434 0.922   0.723
#> CV:NMF      5 0.506           0.511       0.696         0.0658 0.891   0.657
#> MAD:NMF     5 0.717           0.762       0.857         0.0432 0.918   0.721
#> ATC:NMF     5 0.562           0.512       0.786         0.0404 0.981   0.935
#> SD:skmeans  5 0.630           0.599       0.777         0.0635 0.910   0.691
#> CV:skmeans  5 0.682           0.598       0.784         0.0635 0.906   0.697
#> MAD:skmeans 5 0.660           0.647       0.792         0.0579 0.950   0.822
#> ATC:skmeans 5 0.912           0.862       0.919         0.0634 0.944   0.808
#> SD:mclust   5 0.539           0.580       0.760         0.0691 0.855   0.583
#> CV:mclust   5 0.618           0.690       0.782         0.1078 0.885   0.630
#> MAD:mclust  5 0.611           0.538       0.670         0.0666 0.878   0.619
#> ATC:mclust  5 0.643           0.763       0.873         0.0885 0.938   0.799
#> SD:kmeans   5 0.615           0.500       0.736         0.0690 0.829   0.472
#> CV:kmeans   5 0.685           0.626       0.759         0.0683 0.908   0.663
#> MAD:kmeans  5 0.631           0.604       0.774         0.0654 0.888   0.617
#> ATC:kmeans  5 0.791           0.834       0.901         0.0771 0.932   0.755
#> SD:pam      5 0.556           0.407       0.667         0.0886 0.744   0.380
#> CV:pam      5 0.698           0.623       0.822         0.0997 0.896   0.657
#> MAD:pam     5 0.522           0.417       0.655         0.0671 0.893   0.648
#> ATC:pam     5 0.835           0.791       0.914         0.1171 0.864   0.557
#> SD:hclust   5 0.476           0.611       0.723         0.0826 0.868   0.621
#> CV:hclust   5 0.480           0.479       0.693         0.0571 0.838   0.514
#> MAD:hclust  5 0.573           0.596       0.732         0.0933 0.930   0.774
#> ATC:hclust  5 0.611           0.499       0.739         0.0959 0.856   0.606
get_stats(res_list, k = 6)
#>             k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> SD:NMF      6 0.673           0.521       0.743         0.0477 0.923   0.715
#> CV:NMF      6 0.484           0.434       0.680         0.0435 0.893   0.626
#> MAD:NMF     6 0.653           0.564       0.752         0.0547 0.939   0.756
#> ATC:NMF     6 0.630           0.635       0.791         0.0445 0.902   0.658
#> SD:skmeans  6 0.646           0.499       0.718         0.0405 0.962   0.832
#> CV:skmeans  6 0.674           0.576       0.749         0.0404 0.950   0.798
#> MAD:skmeans 6 0.658           0.536       0.753         0.0376 0.961   0.842
#> ATC:skmeans 6 0.808           0.707       0.853         0.0392 0.994   0.977
#> SD:mclust   6 0.609           0.632       0.777         0.0556 0.861   0.501
#> CV:mclust   6 0.716           0.619       0.774         0.0623 0.895   0.608
#> MAD:mclust  6 0.660           0.587       0.750         0.0717 0.800   0.363
#> ATC:mclust  6 0.668           0.516       0.722         0.0773 0.877   0.579
#> SD:kmeans   6 0.660           0.472       0.636         0.0477 0.880   0.518
#> CV:kmeans   6 0.768           0.762       0.804         0.0458 0.895   0.556
#> MAD:kmeans  6 0.689           0.568       0.665         0.0433 0.901   0.584
#> ATC:kmeans  6 0.769           0.711       0.825         0.0508 0.905   0.606
#> SD:pam      6 0.581           0.290       0.634         0.0582 0.808   0.356
#> CV:pam      6 0.754           0.634       0.833         0.0395 0.900   0.607
#> MAD:pam     6 0.587           0.318       0.651         0.0487 0.832   0.405
#> ATC:pam     6 0.850           0.735       0.880         0.0335 0.941   0.723
#> SD:hclust   6 0.558           0.520       0.733         0.0496 0.969   0.883
#> CV:hclust   6 0.567           0.478       0.671         0.0402 0.918   0.698
#> MAD:hclust  6 0.601           0.549       0.701         0.0473 0.936   0.775
#> ATC:hclust  6 0.725           0.631       0.801         0.0710 0.906   0.630

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 = 1000, method = "euler")

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

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

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

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

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

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

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

top_rows_overlap(res_list, top_n = 5000, 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 = 1000, method = "correspondance")

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

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

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

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

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

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

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

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

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

Heatmaps of the top rows:

top_rows_heatmap(res_list, top_n = 1000)

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

top_rows_heatmap(res_list, top_n = 2000)

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

top_rows_heatmap(res_list, top_n = 3000)

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

top_rows_heatmap(res_list, top_n = 4000)

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

top_rows_heatmap(res_list, top_n = 5000)

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 stress(p) development.stage(p) k
#> SD:NMF      66     0.620             1.18e-03 2
#> CV:NMF      64     0.897             2.53e-01 2
#> MAD:NMF     70     1.000             1.86e-05 2
#> ATC:NMF     68     0.466             2.64e-02 2
#> SD:skmeans  66     0.805             2.98e-04 2
#> CV:skmeans  67     0.522             1.05e-01 2
#> MAD:skmeans 71     0.907             1.36e-05 2
#> ATC:skmeans 70     0.342             5.29e-02 2
#> SD:mclust   69     0.732             3.22e-04 2
#> CV:mclust   69     0.941             5.47e-04 2
#> MAD:mclust  70     0.602             2.32e-04 2
#> ATC:mclust  66     0.876             4.79e-04 2
#> SD:kmeans   65     0.887             2.21e-04 2
#> CV:kmeans   71     0.394             1.32e-01 2
#> MAD:kmeans  70     0.632             3.64e-05 2
#> ATC:kmeans  70     0.347             2.21e-02 2
#> SD:pam      66     0.301             5.99e-03 2
#> CV:pam      68     0.577             3.81e-01 2
#> MAD:pam     67     0.892             4.35e-04 2
#> ATC:pam     62     0.435             2.01e-02 2
#> SD:hclust   64     0.677             2.35e-02 2
#> CV:hclust   59     0.600             1.00e+00 2
#> MAD:hclust  70     0.821             3.64e-05 2
#> ATC:hclust  63     0.382             3.19e-03 2
test_to_known_factors(res_list, k = 3)
#>              n stress(p) development.stage(p) k
#> SD:NMF      69     0.172             6.31e-07 3
#> CV:NMF      34     0.463             4.51e-02 3
#> MAD:NMF     61     0.234             6.34e-10 3
#> ATC:NMF     67     0.900             1.41e-06 3
#> SD:skmeans  66     0.857             4.98e-06 3
#> CV:skmeans  60     0.341             8.90e-03 3
#> MAD:skmeans 64     0.722             7.11e-08 3
#> ATC:skmeans 53     0.454             1.16e-02 3
#> SD:mclust   69     0.478             6.94e-14 3
#> CV:mclust   52     0.904             1.80e-05 3
#> MAD:mclust  51     0.388             1.12e-07 3
#> ATC:mclust  67     0.825             5.46e-06 3
#> SD:kmeans   65     0.912             5.11e-07 3
#> CV:kmeans   52     0.679             5.78e-03 3
#> MAD:kmeans  68     0.991             1.77e-08 3
#> ATC:kmeans  71     0.935             3.74e-03 3
#> SD:pam      64     0.582             8.09e-05 3
#> CV:pam      36     0.895             1.70e-03 3
#> MAD:pam     51     0.889             3.97e-06 3
#> ATC:pam     69     0.994             3.63e-03 3
#> SD:hclust   43     0.467             7.66e-04 3
#> CV:hclust   54     0.612             6.12e-02 3
#> MAD:hclust  64     0.932             1.53e-05 3
#> ATC:hclust  64     0.835             3.75e-03 3
test_to_known_factors(res_list, k = 4)
#>              n stress(p) development.stage(p) k
#> SD:NMF      66    0.3596             1.16e-08 4
#> CV:NMF      62    0.6242             2.01e-07 4
#> MAD:NMF     67    0.5996             4.45e-09 4
#> ATC:NMF     63    0.9580             6.40e-09 4
#> SD:skmeans  62    0.7669             1.17e-05 4
#> CV:skmeans  60    0.6752             6.71e-04 4
#> MAD:skmeans 62    0.7577             7.90e-11 4
#> ATC:skmeans 62    0.3546             1.75e-04 4
#> SD:mclust   48    0.8344             3.14e-10 4
#> CV:mclust   44    0.9833             1.62e-05 4
#> MAD:mclust  49    0.0924             6.36e-09 4
#> ATC:mclust  49    0.7541             1.38e-05 4
#> SD:kmeans   51    0.7076             1.52e-06 4
#> CV:kmeans   60    0.8069             1.07e-03 4
#> MAD:kmeans  50    0.4731             1.79e-08 4
#> ATC:kmeans  57    0.4114             8.45e-05 4
#> SD:pam      29    1.0000             1.00e+00 4
#> CV:pam      43    0.6739             3.94e-02 4
#> MAD:pam     32    0.2091             3.24e-06 4
#> ATC:pam     62    0.5657             1.41e-03 4
#> SD:hclust   45    0.9257             8.00e-07 4
#> CV:hclust   35    0.7532             2.59e-02 4
#> MAD:hclust  57    0.6872             5.23e-07 4
#> ATC:hclust  58    0.6964             9.97e-04 4
test_to_known_factors(res_list, k = 5)
#>              n stress(p) development.stage(p) k
#> SD:NMF      57    0.4161             6.46e-09 5
#> CV:NMF      48    0.8772             3.20e-08 5
#> MAD:NMF     66    0.7657             9.43e-10 5
#> ATC:NMF     40    0.9511             4.54e-05 5
#> SD:skmeans  49    0.8661             3.40e-06 5
#> CV:skmeans  55    0.9074             1.01e-04 5
#> MAD:skmeans 59    0.9135             3.80e-11 5
#> ATC:skmeans 68    0.8483             5.67e-04 5
#> SD:mclust   48    0.0798             1.07e-08 5
#> CV:mclust   62    0.3796             5.56e-09 5
#> MAD:mclust  50    0.1177             1.17e-08 5
#> ATC:mclust  68    0.9854             3.64e-06 5
#> SD:kmeans   46    0.5715             3.47e-07 5
#> CV:kmeans   52    0.6881             8.65e-04 5
#> MAD:kmeans  57    0.9297             1.24e-11 5
#> ATC:kmeans  69    0.7650             1.29e-05 5
#> SD:pam      26    0.1699             9.54e-06 5
#> CV:pam      55    0.8930             2.04e-02 5
#> MAD:pam     30    0.2290             1.81e-06 5
#> ATC:pam     58    0.7538             1.72e-03 5
#> SD:hclust   60    0.7481             3.48e-07 5
#> CV:hclust   42    0.6251             2.44e-03 5
#> MAD:hclust  56    0.2360             8.32e-06 5
#> ATC:hclust  36    0.6414             7.28e-04 5
test_to_known_factors(res_list, k = 6)
#>              n stress(p) development.stage(p) k
#> SD:NMF      47   0.64646             5.32e-07 6
#> CV:NMF      44   0.85038             1.06e-06 6
#> MAD:NMF     45   0.89132             1.04e-06 6
#> ATC:NMF     59   0.95761             4.20e-07 6
#> SD:skmeans  45   0.94292             1.59e-07 6
#> CV:skmeans  47   0.99642             6.38e-04 6
#> MAD:skmeans 45   0.77696             9.25e-10 6
#> ATC:skmeans 59   0.78915             2.50e-03 6
#> SD:mclust   53   0.25523             4.92e-08 6
#> CV:mclust   51   0.48777             1.16e-06 6
#> MAD:mclust  45   0.06525             2.15e-06 6
#> ATC:mclust  40   0.98977             4.70e-04 6
#> SD:kmeans   43   0.57403             2.14e-07 6
#> CV:kmeans   63   0.91810             1.20e-05 6
#> MAD:kmeans  49   0.38642             2.22e-09 6
#> ATC:kmeans  61   0.85998             9.81e-06 6
#> SD:pam      15   0.29958             5.53e-04 6
#> CV:pam      52   0.77357             1.03e-02 6
#> MAD:pam     14   0.00702             9.12e-04 6
#> ATC:pam     54   0.70942             1.24e-03 6
#> SD:hclust   40   0.48343             5.18e-06 6
#> CV:hclust   42   0.29842             5.03e-03 6
#> MAD:hclust  51   0.10987             3.68e-08 6
#> ATC:hclust  53   0.44747             3.18e-04 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 18172 rows and 71 columns.
#>   Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'SD' method.
#>   Subgroups are detected by 'hclust' method.
#>   Performed in total 1250 partitions by row resampling.
#>   Best k for subgroups seems to be 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-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.303           0.676       0.783         0.3859 0.556   0.556
#> 3 3 0.303           0.490       0.683         0.4929 0.650   0.449
#> 4 4 0.392           0.428       0.712         0.1868 0.849   0.635
#> 5 5 0.476           0.611       0.723         0.0826 0.868   0.621
#> 6 6 0.558           0.520       0.733         0.0496 0.969   0.883

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
#> GSM182755     1  0.6247      0.732 0.844 0.156
#> GSM182756     1  0.8608      0.602 0.716 0.284
#> GSM182757     2  0.9710      0.521 0.400 0.600
#> GSM182758     1  0.8608      0.599 0.716 0.284
#> GSM182759     2  0.9323      0.592 0.348 0.652
#> GSM182760     1  0.8713      0.586 0.708 0.292
#> GSM182761     2  0.9795      0.487 0.416 0.584
#> GSM182762     1  0.8386      0.601 0.732 0.268
#> GSM182763     2  0.9881      0.434 0.436 0.564
#> GSM182764     2  0.9635      0.542 0.388 0.612
#> GSM182765     2  0.9552      0.561 0.376 0.624
#> GSM182766     2  0.6623      0.674 0.172 0.828
#> GSM182767     1  0.8661      0.593 0.712 0.288
#> GSM182768     1  0.6801      0.734 0.820 0.180
#> GSM182769     1  0.3114      0.819 0.944 0.056
#> GSM182770     2  0.0000      0.663 0.000 1.000
#> GSM182771     2  0.8955      0.621 0.312 0.688
#> GSM182772     2  0.0000      0.663 0.000 1.000
#> GSM182773     1  0.3114      0.819 0.944 0.056
#> GSM182774     1  0.4161      0.816 0.916 0.084
#> GSM182775     1  0.2948      0.819 0.948 0.052
#> GSM182776     1  0.3114      0.819 0.944 0.056
#> GSM182777     1  0.3114      0.820 0.944 0.056
#> GSM182802     2  0.2948      0.670 0.052 0.948
#> GSM182803     1  0.0938      0.813 0.988 0.012
#> GSM182804     1  0.8813      0.536 0.700 0.300
#> GSM182805     2  0.2948      0.670 0.052 0.948
#> GSM182806     1  0.0000      0.810 1.000 0.000
#> GSM182807     1  0.0000      0.810 1.000 0.000
#> GSM182808     1  0.0000      0.810 1.000 0.000
#> GSM182809     1  0.4161      0.816 0.916 0.084
#> GSM182810     1  0.3879      0.818 0.924 0.076
#> GSM182811     1  0.3879      0.818 0.924 0.076
#> GSM182812     1  0.0000      0.810 1.000 0.000
#> GSM182813     1  0.0000      0.810 1.000 0.000
#> GSM182778     2  0.0000      0.663 0.000 1.000
#> GSM182779     2  0.9795      0.487 0.416 0.584
#> GSM182780     2  0.9933      0.365 0.452 0.548
#> GSM182781     1  0.8608      0.601 0.716 0.284
#> GSM182782     2  0.0000      0.663 0.000 1.000
#> GSM182783     2  0.9954      0.336 0.460 0.540
#> GSM182784     1  0.8763      0.576 0.704 0.296
#> GSM182785     1  0.8861      0.559 0.696 0.304
#> GSM182786     2  0.0000      0.663 0.000 1.000
#> GSM182787     2  0.9795      0.482 0.416 0.584
#> GSM182788     2  0.0000      0.663 0.000 1.000
#> GSM182789     1  0.9988     -0.142 0.520 0.480
#> GSM182790     1  0.8608      0.599 0.716 0.284
#> GSM182791     1  0.4939      0.807 0.892 0.108
#> GSM182792     1  0.4431      0.813 0.908 0.092
#> GSM182793     2  0.6712      0.639 0.176 0.824
#> GSM182794     1  0.8661      0.593 0.712 0.288
#> GSM182795     1  0.8909      0.549 0.692 0.308
#> GSM182796     2  0.7883      0.660 0.236 0.764
#> GSM182797     1  0.0000      0.810 1.000 0.000
#> GSM182798     2  0.9044      0.618 0.320 0.680
#> GSM182799     1  0.7602      0.683 0.780 0.220
#> GSM182800     1  0.1633      0.814 0.976 0.024
#> GSM182801     1  0.2948      0.819 0.948 0.052
#> GSM182814     1  0.0000      0.810 1.000 0.000
#> GSM182815     1  0.8713      0.560 0.708 0.292
#> GSM182816     1  0.0000      0.810 1.000 0.000
#> GSM182817     1  0.6148      0.772 0.848 0.152
#> GSM182818     1  0.4939      0.805 0.892 0.108
#> GSM182819     1  0.0000      0.810 1.000 0.000
#> GSM182820     1  0.0000      0.810 1.000 0.000
#> GSM182821     1  0.7056      0.738 0.808 0.192
#> GSM182822     1  0.3879      0.818 0.924 0.076
#> GSM182823     1  0.0000      0.810 1.000 0.000
#> GSM182824     1  0.0000      0.810 1.000 0.000
#> GSM182825     1  0.0000      0.810 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
#> GSM182755     1  0.6111     0.1306 0.604 0.000 0.396
#> GSM182756     3  0.6282     0.5443 0.324 0.012 0.664
#> GSM182757     3  0.6730     0.4111 0.036 0.284 0.680
#> GSM182758     3  0.6129     0.5433 0.324 0.008 0.668
#> GSM182759     3  0.6773     0.2778 0.024 0.340 0.636
#> GSM182760     3  0.6255     0.5436 0.320 0.012 0.668
#> GSM182761     3  0.6066     0.4568 0.024 0.248 0.728
#> GSM182762     3  0.6994     0.4856 0.360 0.028 0.612
#> GSM182763     3  0.6685     0.4813 0.048 0.244 0.708
#> GSM182764     3  0.6570     0.3853 0.028 0.292 0.680
#> GSM182765     3  0.7491     0.3199 0.056 0.324 0.620
#> GSM182766     2  0.7169     0.2609 0.024 0.520 0.456
#> GSM182767     3  0.6102     0.5494 0.320 0.008 0.672
#> GSM182768     3  0.7601    -0.1653 0.416 0.044 0.540
#> GSM182769     1  0.6062     0.5331 0.616 0.000 0.384
#> GSM182770     2  0.3482     0.7818 0.000 0.872 0.128
#> GSM182771     3  0.7396    -0.2273 0.032 0.480 0.488
#> GSM182772     2  0.3482     0.7818 0.000 0.872 0.128
#> GSM182773     1  0.6045     0.5341 0.620 0.000 0.380
#> GSM182774     1  0.6225     0.4448 0.568 0.000 0.432
#> GSM182775     1  0.5968     0.5498 0.636 0.000 0.364
#> GSM182776     1  0.6045     0.5378 0.620 0.000 0.380
#> GSM182777     1  0.5968     0.5464 0.636 0.000 0.364
#> GSM182802     2  0.4504     0.7621 0.000 0.804 0.196
#> GSM182803     1  0.1411     0.6756 0.964 0.000 0.036
#> GSM182804     3  0.8007     0.1102 0.244 0.116 0.640
#> GSM182805     2  0.4504     0.7621 0.000 0.804 0.196
#> GSM182806     1  0.0000     0.6854 1.000 0.000 0.000
#> GSM182807     1  0.0000     0.6854 1.000 0.000 0.000
#> GSM182808     1  0.0000     0.6854 1.000 0.000 0.000
#> GSM182809     1  0.6252     0.4133 0.556 0.000 0.444
#> GSM182810     1  0.6180     0.4585 0.584 0.000 0.416
#> GSM182811     1  0.6180     0.4585 0.584 0.000 0.416
#> GSM182812     1  0.3272     0.6698 0.892 0.004 0.104
#> GSM182813     1  0.0000     0.6854 1.000 0.000 0.000
#> GSM182778     2  0.2356     0.7755 0.000 0.928 0.072
#> GSM182779     3  0.6066     0.4568 0.024 0.248 0.728
#> GSM182780     3  0.7001     0.5199 0.084 0.200 0.716
#> GSM182781     3  0.5733     0.5459 0.324 0.000 0.676
#> GSM182782     2  0.2356     0.7755 0.000 0.928 0.072
#> GSM182783     3  0.7107     0.5286 0.092 0.196 0.712
#> GSM182784     3  0.6200     0.5573 0.312 0.012 0.676
#> GSM182785     3  0.6387     0.5661 0.300 0.020 0.680
#> GSM182786     2  0.2356     0.7755 0.000 0.928 0.072
#> GSM182787     3  0.6624     0.4650 0.044 0.248 0.708
#> GSM182788     2  0.2356     0.7755 0.000 0.928 0.072
#> GSM182789     3  0.7451     0.5851 0.144 0.156 0.700
#> GSM182790     3  0.6102     0.5479 0.320 0.008 0.672
#> GSM182791     1  0.7575     0.3807 0.504 0.040 0.456
#> GSM182792     1  0.6260     0.4263 0.552 0.000 0.448
#> GSM182793     2  0.6627     0.5773 0.020 0.644 0.336
#> GSM182794     3  0.6102     0.5494 0.320 0.008 0.672
#> GSM182795     3  0.6630     0.5685 0.300 0.028 0.672
#> GSM182796     2  0.6252     0.3585 0.000 0.556 0.444
#> GSM182797     1  0.0237     0.6856 0.996 0.000 0.004
#> GSM182798     2  0.7004     0.3480 0.020 0.552 0.428
#> GSM182799     3  0.8390    -0.0624 0.340 0.100 0.560
#> GSM182800     1  0.5956     0.6168 0.768 0.044 0.188
#> GSM182801     1  0.5988     0.5485 0.632 0.000 0.368
#> GSM182814     1  0.0237     0.6844 0.996 0.004 0.000
#> GSM182815     3  0.7507     0.0986 0.288 0.068 0.644
#> GSM182816     1  0.0237     0.6844 0.996 0.004 0.000
#> GSM182817     1  0.6683     0.1976 0.500 0.008 0.492
#> GSM182818     3  0.6299    -0.3228 0.476 0.000 0.524
#> GSM182819     1  0.0237     0.6844 0.996 0.004 0.000
#> GSM182820     1  0.0000     0.6854 1.000 0.000 0.000
#> GSM182821     3  0.6912    -0.0603 0.444 0.016 0.540
#> GSM182822     1  0.6180     0.4585 0.584 0.000 0.416
#> GSM182823     1  0.0237     0.6844 0.996 0.004 0.000
#> GSM182824     1  0.0237     0.6844 0.996 0.004 0.000
#> GSM182825     1  0.4035     0.6483 0.880 0.040 0.080

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM182755     3  0.5150     0.2590 0.396 0.000 0.596 0.008
#> GSM182756     3  0.3172     0.6658 0.112 0.004 0.872 0.012
#> GSM182757     3  0.4122     0.5968 0.000 0.236 0.760 0.004
#> GSM182758     3  0.2799     0.6680 0.108 0.000 0.884 0.008
#> GSM182759     3  0.4560     0.5305 0.000 0.296 0.700 0.004
#> GSM182760     3  0.2805     0.6698 0.100 0.000 0.888 0.012
#> GSM182761     3  0.3831     0.6254 0.000 0.204 0.792 0.004
#> GSM182762     3  0.3351     0.6224 0.148 0.000 0.844 0.008
#> GSM182763     3  0.4114     0.6369 0.008 0.200 0.788 0.004
#> GSM182764     3  0.4431     0.5831 0.004 0.252 0.740 0.004
#> GSM182765     3  0.5198     0.5453 0.016 0.288 0.688 0.008
#> GSM182766     3  0.5691     0.1256 0.000 0.468 0.508 0.024
#> GSM182767     3  0.2928     0.6702 0.108 0.000 0.880 0.012
#> GSM182768     4  0.7054     0.4267 0.236 0.004 0.172 0.588
#> GSM182769     1  0.7640     0.0383 0.432 0.000 0.212 0.356
#> GSM182770     2  0.3439     0.8373 0.000 0.868 0.048 0.084
#> GSM182771     3  0.5807     0.0311 0.016 0.484 0.492 0.008
#> GSM182772     2  0.3439     0.8373 0.000 0.868 0.048 0.084
#> GSM182773     1  0.7668     0.0411 0.432 0.000 0.220 0.348
#> GSM182774     1  0.7923    -0.1499 0.344 0.000 0.332 0.324
#> GSM182775     1  0.7584     0.0590 0.448 0.000 0.204 0.348
#> GSM182776     1  0.7634     0.0447 0.436 0.000 0.212 0.352
#> GSM182777     1  0.7617     0.0603 0.452 0.000 0.216 0.332
#> GSM182802     2  0.4465     0.8019 0.000 0.800 0.056 0.144
#> GSM182803     1  0.2032     0.5512 0.936 0.000 0.036 0.028
#> GSM182804     4  0.4439     0.5032 0.112 0.008 0.060 0.820
#> GSM182805     2  0.4614     0.7999 0.000 0.792 0.064 0.144
#> GSM182806     1  0.0188     0.5664 0.996 0.000 0.004 0.000
#> GSM182807     1  0.0188     0.5664 0.996 0.000 0.004 0.000
#> GSM182808     1  0.0000     0.5646 1.000 0.000 0.000 0.000
#> GSM182809     4  0.7910     0.0941 0.316 0.000 0.320 0.364
#> GSM182810     1  0.7916    -0.1611 0.356 0.000 0.316 0.328
#> GSM182811     1  0.7921    -0.1713 0.348 0.000 0.320 0.332
#> GSM182812     1  0.3486     0.4728 0.812 0.000 0.000 0.188
#> GSM182813     1  0.0000     0.5646 1.000 0.000 0.000 0.000
#> GSM182778     2  0.0469     0.8467 0.000 0.988 0.012 0.000
#> GSM182779     3  0.3831     0.6254 0.000 0.204 0.792 0.004
#> GSM182780     3  0.6086     0.6138 0.008 0.148 0.704 0.140
#> GSM182781     3  0.2714     0.6695 0.112 0.000 0.884 0.004
#> GSM182782     2  0.0469     0.8467 0.000 0.988 0.012 0.000
#> GSM182783     3  0.6164     0.6191 0.012 0.144 0.704 0.140
#> GSM182784     3  0.2715     0.6756 0.100 0.004 0.892 0.004
#> GSM182785     3  0.2401     0.6780 0.092 0.004 0.904 0.000
#> GSM182786     2  0.0469     0.8467 0.000 0.988 0.012 0.000
#> GSM182787     3  0.5356     0.6095 0.000 0.200 0.728 0.072
#> GSM182788     2  0.0469     0.8467 0.000 0.988 0.012 0.000
#> GSM182789     3  0.4843     0.6676 0.016 0.108 0.804 0.072
#> GSM182790     3  0.2654     0.6702 0.108 0.000 0.888 0.004
#> GSM182791     4  0.7676     0.2163 0.308 0.000 0.240 0.452
#> GSM182792     1  0.7916    -0.1491 0.352 0.000 0.312 0.336
#> GSM182793     4  0.6376    -0.4035 0.000 0.432 0.064 0.504
#> GSM182794     3  0.2928     0.6702 0.108 0.000 0.880 0.012
#> GSM182795     3  0.3383     0.6777 0.100 0.016 0.872 0.012
#> GSM182796     2  0.5126     0.0675 0.000 0.552 0.444 0.004
#> GSM182797     1  0.0336     0.5663 0.992 0.000 0.008 0.000
#> GSM182798     3  0.7591    -0.0056 0.000 0.368 0.432 0.200
#> GSM182799     4  0.5438     0.5185 0.176 0.008 0.072 0.744
#> GSM182800     1  0.4936     0.3361 0.672 0.000 0.012 0.316
#> GSM182801     1  0.7515     0.0438 0.448 0.000 0.188 0.364
#> GSM182814     1  0.1118     0.5653 0.964 0.000 0.000 0.036
#> GSM182815     4  0.5734     0.5349 0.148 0.008 0.112 0.732
#> GSM182816     1  0.0707     0.5669 0.980 0.000 0.000 0.020
#> GSM182817     3  0.7777    -0.3221 0.268 0.000 0.428 0.304
#> GSM182818     4  0.5697     0.3949 0.292 0.000 0.052 0.656
#> GSM182819     1  0.0707     0.5669 0.980 0.000 0.000 0.020
#> GSM182820     1  0.0188     0.5664 0.996 0.000 0.004 0.000
#> GSM182821     3  0.7606    -0.2538 0.228 0.000 0.468 0.304
#> GSM182822     1  0.7916    -0.1611 0.356 0.000 0.316 0.328
#> GSM182823     1  0.1118     0.5653 0.964 0.000 0.000 0.036
#> GSM182824     1  0.1118     0.5653 0.964 0.000 0.000 0.036
#> GSM182825     1  0.3688     0.4595 0.792 0.000 0.000 0.208

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>           class entropy silhouette    p1    p2    p3    p4    p5
#> GSM182755     5   0.771     0.0907 0.212 0.000 0.212 0.100 0.476
#> GSM182756     5   0.392     0.6274 0.032 0.000 0.156 0.012 0.800
#> GSM182757     5   0.406     0.6589 0.000 0.172 0.000 0.052 0.776
#> GSM182758     5   0.338     0.6825 0.032 0.000 0.108 0.012 0.848
#> GSM182759     5   0.465     0.6041 0.000 0.220 0.000 0.064 0.716
#> GSM182760     5   0.311     0.6840 0.028 0.000 0.112 0.004 0.856
#> GSM182761     5   0.382     0.6827 0.000 0.148 0.000 0.052 0.800
#> GSM182762     5   0.524     0.5354 0.044 0.000 0.172 0.060 0.724
#> GSM182763     5   0.383     0.6893 0.000 0.128 0.004 0.056 0.812
#> GSM182764     5   0.439     0.6489 0.000 0.180 0.000 0.068 0.752
#> GSM182765     5   0.506     0.6100 0.000 0.188 0.008 0.092 0.712
#> GSM182766     5   0.584     0.2621 0.000 0.384 0.000 0.100 0.516
#> GSM182767     5   0.332     0.6850 0.032 0.000 0.104 0.012 0.852
#> GSM182768     3   0.690     0.5023 0.140 0.000 0.592 0.176 0.092
#> GSM182769     3   0.567     0.6474 0.296 0.000 0.604 0.004 0.096
#> GSM182770     2   0.317     0.6992 0.000 0.816 0.000 0.176 0.008
#> GSM182771     5   0.601     0.2023 0.000 0.384 0.008 0.092 0.516
#> GSM182772     2   0.317     0.6992 0.000 0.816 0.000 0.176 0.008
#> GSM182773     3   0.581     0.6502 0.292 0.000 0.600 0.008 0.100
#> GSM182774     3   0.630     0.6867 0.216 0.000 0.572 0.008 0.204
#> GSM182775     3   0.574     0.6377 0.308 0.000 0.596 0.008 0.088
#> GSM182776     3   0.568     0.6465 0.300 0.000 0.600 0.004 0.096
#> GSM182777     3   0.589     0.6351 0.312 0.000 0.580 0.008 0.100
#> GSM182802     2   0.416     0.6491 0.000 0.748 0.020 0.224 0.008
#> GSM182803     1   0.246     0.8367 0.888 0.000 0.096 0.000 0.016
#> GSM182804     4   0.465     0.3015 0.020 0.000 0.372 0.608 0.000
#> GSM182805     2   0.436     0.6467 0.000 0.740 0.020 0.224 0.016
#> GSM182806     1   0.131     0.8833 0.956 0.000 0.020 0.024 0.000
#> GSM182807     1   0.131     0.8833 0.956 0.000 0.020 0.024 0.000
#> GSM182808     1   0.121     0.8833 0.960 0.000 0.016 0.024 0.000
#> GSM182809     3   0.635     0.6645 0.168 0.000 0.600 0.024 0.208
#> GSM182810     3   0.627     0.6565 0.188 0.000 0.588 0.012 0.212
#> GSM182811     3   0.615     0.6505 0.172 0.000 0.604 0.012 0.212
#> GSM182812     1   0.407     0.7561 0.792 0.000 0.112 0.096 0.000
#> GSM182813     1   0.121     0.8833 0.960 0.000 0.016 0.024 0.000
#> GSM182778     2   0.000     0.7329 0.000 1.000 0.000 0.000 0.000
#> GSM182779     5   0.382     0.6827 0.000 0.148 0.000 0.052 0.800
#> GSM182780     5   0.570     0.6567 0.000 0.096 0.072 0.124 0.708
#> GSM182781     5   0.319     0.6925 0.024 0.000 0.092 0.020 0.864
#> GSM182782     2   0.000     0.7329 0.000 1.000 0.000 0.000 0.000
#> GSM182783     5   0.566     0.6623 0.000 0.088 0.076 0.124 0.712
#> GSM182784     5   0.298     0.6917 0.032 0.000 0.096 0.004 0.868
#> GSM182785     5   0.300     0.6959 0.028 0.004 0.092 0.004 0.872
#> GSM182786     2   0.000     0.7329 0.000 1.000 0.000 0.000 0.000
#> GSM182787     5   0.525     0.6683 0.000 0.144 0.040 0.084 0.732
#> GSM182788     2   0.000     0.7329 0.000 1.000 0.000 0.000 0.000
#> GSM182789     5   0.459     0.7066 0.000 0.064 0.068 0.076 0.792
#> GSM182790     5   0.332     0.6845 0.032 0.000 0.104 0.012 0.852
#> GSM182791     3   0.672     0.5535 0.124 0.000 0.612 0.092 0.172
#> GSM182792     3   0.621     0.6865 0.220 0.000 0.584 0.008 0.188
#> GSM182793     4   0.480    -0.0119 0.000 0.372 0.020 0.604 0.004
#> GSM182794     5   0.332     0.6850 0.032 0.000 0.104 0.012 0.852
#> GSM182795     5   0.366     0.6941 0.032 0.012 0.100 0.012 0.844
#> GSM182796     2   0.560    -0.1539 0.000 0.468 0.000 0.072 0.460
#> GSM182797     1   0.149     0.8800 0.948 0.000 0.024 0.028 0.000
#> GSM182798     5   0.664     0.1965 0.000 0.256 0.000 0.296 0.448
#> GSM182799     3   0.575     0.0491 0.036 0.000 0.616 0.300 0.048
#> GSM182800     1   0.614     0.3428 0.520 0.000 0.352 0.124 0.004
#> GSM182801     3   0.554     0.6282 0.312 0.000 0.604 0.004 0.080
#> GSM182814     1   0.158     0.8720 0.944 0.000 0.032 0.024 0.000
#> GSM182815     3   0.549    -0.2773 0.052 0.000 0.484 0.460 0.004
#> GSM182816     1   0.088     0.8822 0.968 0.000 0.032 0.000 0.000
#> GSM182817     3   0.643     0.5923 0.156 0.000 0.516 0.008 0.320
#> GSM182818     3   0.565     0.2292 0.156 0.000 0.648 0.192 0.004
#> GSM182819     1   0.088     0.8822 0.968 0.000 0.032 0.000 0.000
#> GSM182820     1   0.131     0.8833 0.956 0.000 0.020 0.024 0.000
#> GSM182821     3   0.634     0.5169 0.120 0.000 0.504 0.012 0.364
#> GSM182822     3   0.627     0.6565 0.188 0.000 0.588 0.012 0.212
#> GSM182823     1   0.158     0.8720 0.944 0.000 0.032 0.024 0.000
#> GSM182824     1   0.166     0.8708 0.940 0.000 0.036 0.024 0.000
#> GSM182825     1   0.507     0.6262 0.676 0.000 0.240 0.084 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
#> GSM182755     5  0.6949     0.0000 0.080 0.000 0.200 0.000 0.432 0.288
#> GSM182756     3  0.5492     0.2020 0.000 0.000 0.552 0.000 0.168 0.280
#> GSM182757     3  0.1599     0.5719 0.000 0.024 0.940 0.008 0.028 0.000
#> GSM182758     3  0.5134     0.3979 0.000 0.000 0.620 0.000 0.152 0.228
#> GSM182759     3  0.2777     0.5391 0.000 0.032 0.880 0.044 0.044 0.000
#> GSM182760     3  0.4954     0.4046 0.000 0.000 0.640 0.000 0.128 0.232
#> GSM182761     3  0.0777     0.5780 0.000 0.024 0.972 0.000 0.000 0.004
#> GSM182762     3  0.5870    -0.2352 0.000 0.000 0.480 0.000 0.276 0.244
#> GSM182763     3  0.1785     0.5798 0.000 0.008 0.936 0.012 0.016 0.028
#> GSM182764     3  0.1930     0.5640 0.000 0.028 0.924 0.012 0.036 0.000
#> GSM182765     3  0.4018     0.5260 0.000 0.036 0.816 0.064 0.060 0.024
#> GSM182766     3  0.5074     0.3628 0.000 0.188 0.684 0.096 0.032 0.000
#> GSM182767     3  0.5134     0.3973 0.000 0.000 0.620 0.000 0.152 0.228
#> GSM182768     6  0.5961     0.4540 0.124 0.000 0.020 0.168 0.048 0.640
#> GSM182769     6  0.4236     0.5782 0.240 0.000 0.008 0.008 0.028 0.716
#> GSM182770     2  0.4102     0.7272 0.000 0.720 0.044 0.232 0.004 0.000
#> GSM182771     3  0.6019     0.3130 0.000 0.232 0.616 0.068 0.060 0.024
#> GSM182772     2  0.4102     0.7272 0.000 0.720 0.044 0.232 0.004 0.000
#> GSM182773     6  0.4378     0.5754 0.236 0.000 0.012 0.008 0.032 0.712
#> GSM182774     6  0.5348     0.5217 0.164 0.000 0.084 0.048 0.012 0.692
#> GSM182775     6  0.4400     0.5684 0.256 0.000 0.008 0.008 0.032 0.696
#> GSM182776     6  0.4296     0.5786 0.240 0.000 0.012 0.004 0.032 0.712
#> GSM182777     6  0.4709     0.5613 0.252 0.000 0.020 0.008 0.036 0.684
#> GSM182802     2  0.4581     0.6823 0.000 0.652 0.044 0.296 0.004 0.004
#> GSM182803     1  0.2709     0.7922 0.848 0.000 0.000 0.000 0.020 0.132
#> GSM182804     4  0.5250     0.5311 0.004 0.008 0.000 0.624 0.260 0.104
#> GSM182805     2  0.4697     0.6749 0.000 0.644 0.052 0.296 0.004 0.004
#> GSM182806     1  0.2294     0.8540 0.892 0.000 0.000 0.000 0.072 0.036
#> GSM182807     1  0.2294     0.8540 0.892 0.000 0.000 0.000 0.072 0.036
#> GSM182808     1  0.2088     0.8549 0.904 0.000 0.000 0.000 0.068 0.028
#> GSM182809     6  0.5845     0.4886 0.104 0.000 0.068 0.064 0.076 0.688
#> GSM182810     6  0.5736     0.4529 0.100 0.000 0.072 0.052 0.080 0.696
#> GSM182811     6  0.5456     0.4346 0.076 0.000 0.072 0.052 0.080 0.720
#> GSM182812     1  0.4120     0.7523 0.784 0.000 0.000 0.116 0.060 0.040
#> GSM182813     1  0.2088     0.8549 0.904 0.000 0.000 0.000 0.068 0.028
#> GSM182778     2  0.0790     0.7613 0.000 0.968 0.032 0.000 0.000 0.000
#> GSM182779     3  0.0922     0.5778 0.000 0.024 0.968 0.000 0.004 0.004
#> GSM182780     3  0.3908     0.4977 0.000 0.008 0.784 0.104 0.000 0.104
#> GSM182781     3  0.5008     0.4189 0.000 0.000 0.644 0.000 0.168 0.188
#> GSM182782     2  0.0790     0.7613 0.000 0.968 0.032 0.000 0.000 0.000
#> GSM182783     3  0.4473     0.4875 0.000 0.008 0.756 0.104 0.016 0.116
#> GSM182784     3  0.4845     0.4334 0.000 0.000 0.660 0.000 0.132 0.208
#> GSM182785     3  0.4729     0.4444 0.000 0.000 0.676 0.000 0.128 0.196
#> GSM182786     2  0.0790     0.7613 0.000 0.968 0.032 0.000 0.000 0.000
#> GSM182787     3  0.2818     0.5517 0.000 0.024 0.876 0.048 0.000 0.052
#> GSM182788     2  0.0790     0.7613 0.000 0.968 0.032 0.000 0.000 0.000
#> GSM182789     3  0.3693     0.5325 0.000 0.000 0.800 0.048 0.016 0.136
#> GSM182790     3  0.5134     0.3953 0.000 0.000 0.620 0.000 0.152 0.228
#> GSM182791     6  0.6113     0.4132 0.064 0.000 0.076 0.044 0.172 0.644
#> GSM182792     6  0.4592     0.5445 0.164 0.000 0.076 0.016 0.008 0.736
#> GSM182793     4  0.4576    -0.1500 0.000 0.344 0.004 0.616 0.032 0.004
#> GSM182794     3  0.5134     0.3973 0.000 0.000 0.620 0.000 0.152 0.228
#> GSM182795     3  0.4906     0.4339 0.000 0.000 0.652 0.000 0.136 0.212
#> GSM182796     3  0.5447     0.2713 0.000 0.276 0.612 0.068 0.044 0.000
#> GSM182797     1  0.2433     0.8489 0.884 0.000 0.000 0.000 0.072 0.044
#> GSM182798     3  0.5734     0.2606 0.000 0.080 0.584 0.284 0.052 0.000
#> GSM182799     6  0.6446    -0.0033 0.016 0.004 0.012 0.228 0.224 0.516
#> GSM182800     1  0.6287     0.3226 0.500 0.000 0.000 0.028 0.256 0.216
#> GSM182801     6  0.4056     0.5667 0.264 0.000 0.000 0.008 0.024 0.704
#> GSM182814     1  0.1297     0.8472 0.948 0.000 0.000 0.000 0.040 0.012
#> GSM182815     4  0.5455     0.4137 0.000 0.008 0.000 0.552 0.112 0.328
#> GSM182816     1  0.0632     0.8579 0.976 0.000 0.000 0.000 0.000 0.024
#> GSM182817     6  0.5938     0.2939 0.060 0.000 0.152 0.040 0.084 0.664
#> GSM182818     6  0.6812    -0.1333 0.052 0.004 0.000 0.224 0.264 0.456
#> GSM182819     1  0.0713     0.8580 0.972 0.000 0.000 0.000 0.000 0.028
#> GSM182820     1  0.2294     0.8540 0.892 0.000 0.000 0.000 0.072 0.036
#> GSM182821     6  0.5385     0.1984 0.020 0.000 0.180 0.032 0.084 0.684
#> GSM182822     6  0.5736     0.4529 0.100 0.000 0.072 0.052 0.080 0.696
#> GSM182823     1  0.1297     0.8472 0.948 0.000 0.000 0.000 0.040 0.012
#> GSM182824     1  0.1367     0.8461 0.944 0.000 0.000 0.000 0.044 0.012
#> GSM182825     1  0.4704     0.5947 0.664 0.000 0.000 0.000 0.236 0.100

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 stress(p) development.stage(p) k
#> SD:hclust 64     0.677             2.35e-02 2
#> SD:hclust 43     0.467             7.66e-04 3
#> SD:hclust 45     0.926             8.00e-07 4
#> SD:hclust 60     0.748             3.48e-07 5
#> SD:hclust 40     0.483             5.18e-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.


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

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

collect_plots(res)

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.777           0.857       0.936         0.4939 0.515   0.515
#> 3 3 0.790           0.852       0.919         0.3122 0.657   0.434
#> 4 4 0.610           0.614       0.817         0.1298 0.872   0.657
#> 5 5 0.615           0.500       0.736         0.0690 0.829   0.472
#> 6 6 0.660           0.472       0.636         0.0477 0.880   0.518

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
#> GSM182755     1  0.0672      0.889 0.992 0.008
#> GSM182756     1  0.9970      0.288 0.532 0.468
#> GSM182757     2  0.0000      0.988 0.000 1.000
#> GSM182758     2  0.0000      0.988 0.000 1.000
#> GSM182759     2  0.0000      0.988 0.000 1.000
#> GSM182760     1  0.9000      0.595 0.684 0.316
#> GSM182761     2  0.0000      0.988 0.000 1.000
#> GSM182762     1  0.9970      0.288 0.532 0.468
#> GSM182763     2  0.0000      0.988 0.000 1.000
#> GSM182764     2  0.0000      0.988 0.000 1.000
#> GSM182765     2  0.0000      0.988 0.000 1.000
#> GSM182766     2  0.0000      0.988 0.000 1.000
#> GSM182767     1  0.9795      0.415 0.584 0.416
#> GSM182768     1  0.0672      0.889 0.992 0.008
#> GSM182769     1  0.0000      0.892 1.000 0.000
#> GSM182770     2  0.0000      0.988 0.000 1.000
#> GSM182771     2  0.0000      0.988 0.000 1.000
#> GSM182772     2  0.0000      0.988 0.000 1.000
#> GSM182773     1  0.0000      0.892 1.000 0.000
#> GSM182774     1  0.0000      0.892 1.000 0.000
#> GSM182775     1  0.0000      0.892 1.000 0.000
#> GSM182776     1  0.0000      0.892 1.000 0.000
#> GSM182777     1  0.0000      0.892 1.000 0.000
#> GSM182802     2  0.0000      0.988 0.000 1.000
#> GSM182803     1  0.0000      0.892 1.000 0.000
#> GSM182804     1  0.1843      0.879 0.972 0.028
#> GSM182805     2  0.0000      0.988 0.000 1.000
#> GSM182806     1  0.0000      0.892 1.000 0.000
#> GSM182807     1  0.0000      0.892 1.000 0.000
#> GSM182808     1  0.0000      0.892 1.000 0.000
#> GSM182809     1  0.2423      0.872 0.960 0.040
#> GSM182810     1  0.0000      0.892 1.000 0.000
#> GSM182811     1  0.0000      0.892 1.000 0.000
#> GSM182812     1  0.0000      0.892 1.000 0.000
#> GSM182813     1  0.0000      0.892 1.000 0.000
#> GSM182778     2  0.0000      0.988 0.000 1.000
#> GSM182779     2  0.0000      0.988 0.000 1.000
#> GSM182780     2  0.0000      0.988 0.000 1.000
#> GSM182781     1  0.9087      0.568 0.676 0.324
#> GSM182782     2  0.0000      0.988 0.000 1.000
#> GSM182783     2  0.0000      0.988 0.000 1.000
#> GSM182784     2  0.6343      0.776 0.160 0.840
#> GSM182785     2  0.0000      0.988 0.000 1.000
#> GSM182786     2  0.0000      0.988 0.000 1.000
#> GSM182787     2  0.0000      0.988 0.000 1.000
#> GSM182788     2  0.0000      0.988 0.000 1.000
#> GSM182789     2  0.0000      0.988 0.000 1.000
#> GSM182790     1  0.9209      0.552 0.664 0.336
#> GSM182791     1  0.4298      0.838 0.912 0.088
#> GSM182792     1  0.0672      0.889 0.992 0.008
#> GSM182793     2  0.0000      0.988 0.000 1.000
#> GSM182794     1  0.9775      0.423 0.588 0.412
#> GSM182795     2  0.5294      0.839 0.120 0.880
#> GSM182796     2  0.0000      0.988 0.000 1.000
#> GSM182797     1  0.0000      0.892 1.000 0.000
#> GSM182798     2  0.0000      0.988 0.000 1.000
#> GSM182799     1  0.4298      0.838 0.912 0.088
#> GSM182800     1  0.0000      0.892 1.000 0.000
#> GSM182801     1  0.0000      0.892 1.000 0.000
#> GSM182814     1  0.0000      0.892 1.000 0.000
#> GSM182815     1  0.8713      0.606 0.708 0.292
#> GSM182816     1  0.0000      0.892 1.000 0.000
#> GSM182817     1  0.9983      0.264 0.524 0.476
#> GSM182818     1  0.0000      0.892 1.000 0.000
#> GSM182819     1  0.0000      0.892 1.000 0.000
#> GSM182820     1  0.0000      0.892 1.000 0.000
#> GSM182821     1  0.9993      0.241 0.516 0.484
#> GSM182822     1  0.0000      0.892 1.000 0.000
#> GSM182823     1  0.0000      0.892 1.000 0.000
#> GSM182824     1  0.0000      0.892 1.000 0.000
#> GSM182825     1  0.0000      0.892 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
#> GSM182755     3  0.6045      0.371 0.380 0.000 0.620
#> GSM182756     3  0.0424      0.888 0.008 0.000 0.992
#> GSM182757     3  0.1753      0.875 0.000 0.048 0.952
#> GSM182758     3  0.0983      0.887 0.004 0.016 0.980
#> GSM182759     2  0.2959      0.936 0.000 0.900 0.100
#> GSM182760     3  0.0747      0.886 0.016 0.000 0.984
#> GSM182761     3  0.2537      0.854 0.000 0.080 0.920
#> GSM182762     3  0.0424      0.888 0.008 0.000 0.992
#> GSM182763     3  0.1964      0.869 0.000 0.056 0.944
#> GSM182764     3  0.3192      0.830 0.000 0.112 0.888
#> GSM182765     3  0.1031      0.885 0.000 0.024 0.976
#> GSM182766     2  0.1964      0.971 0.000 0.944 0.056
#> GSM182767     3  0.0424      0.888 0.008 0.000 0.992
#> GSM182768     3  0.6416      0.564 0.304 0.020 0.676
#> GSM182769     1  0.1964      0.913 0.944 0.000 0.056
#> GSM182770     2  0.1643      0.969 0.000 0.956 0.044
#> GSM182771     3  0.6180      0.308 0.000 0.416 0.584
#> GSM182772     2  0.1643      0.969 0.000 0.956 0.044
#> GSM182773     3  0.2486      0.859 0.060 0.008 0.932
#> GSM182774     1  0.2486      0.899 0.932 0.008 0.060
#> GSM182775     1  0.6154      0.303 0.592 0.000 0.408
#> GSM182776     1  0.1860      0.915 0.948 0.000 0.052
#> GSM182777     3  0.2261      0.858 0.068 0.000 0.932
#> GSM182802     2  0.1411      0.965 0.000 0.964 0.036
#> GSM182803     1  0.0747      0.928 0.984 0.000 0.016
#> GSM182804     1  0.2947      0.892 0.920 0.060 0.020
#> GSM182805     2  0.1529      0.967 0.000 0.960 0.040
#> GSM182806     1  0.0747      0.928 0.984 0.000 0.016
#> GSM182807     1  0.0747      0.928 0.984 0.000 0.016
#> GSM182808     1  0.0747      0.928 0.984 0.000 0.016
#> GSM182809     1  0.7181      0.230 0.564 0.028 0.408
#> GSM182810     1  0.0424      0.923 0.992 0.008 0.000
#> GSM182811     1  0.1031      0.918 0.976 0.024 0.000
#> GSM182812     1  0.0592      0.922 0.988 0.012 0.000
#> GSM182813     1  0.0747      0.928 0.984 0.000 0.016
#> GSM182778     2  0.1964      0.971 0.000 0.944 0.056
#> GSM182779     3  0.3340      0.822 0.000 0.120 0.880
#> GSM182780     3  0.1643      0.876 0.000 0.044 0.956
#> GSM182781     3  0.0592      0.888 0.012 0.000 0.988
#> GSM182782     2  0.1964      0.971 0.000 0.944 0.056
#> GSM182783     3  0.1878      0.877 0.004 0.044 0.952
#> GSM182784     3  0.1015      0.888 0.008 0.012 0.980
#> GSM182785     3  0.0983      0.887 0.004 0.016 0.980
#> GSM182786     2  0.1964      0.971 0.000 0.944 0.056
#> GSM182787     2  0.4178      0.850 0.000 0.828 0.172
#> GSM182788     2  0.1964      0.971 0.000 0.944 0.056
#> GSM182789     3  0.0983      0.887 0.004 0.016 0.980
#> GSM182790     3  0.0592      0.888 0.012 0.000 0.988
#> GSM182791     3  0.5343      0.783 0.132 0.052 0.816
#> GSM182792     3  0.4861      0.768 0.180 0.012 0.808
#> GSM182793     2  0.0592      0.940 0.000 0.988 0.012
#> GSM182794     3  0.0592      0.888 0.012 0.000 0.988
#> GSM182795     3  0.0983      0.887 0.004 0.016 0.980
#> GSM182796     2  0.1860      0.971 0.000 0.948 0.052
#> GSM182797     1  0.1753      0.917 0.952 0.000 0.048
#> GSM182798     2  0.2711      0.926 0.000 0.912 0.088
#> GSM182799     3  0.7640      0.340 0.372 0.052 0.576
#> GSM182800     1  0.3472      0.890 0.904 0.040 0.056
#> GSM182801     1  0.1860      0.915 0.948 0.000 0.052
#> GSM182814     1  0.0747      0.928 0.984 0.000 0.016
#> GSM182815     1  0.5882      0.494 0.652 0.348 0.000
#> GSM182816     1  0.0747      0.928 0.984 0.000 0.016
#> GSM182817     3  0.5507      0.785 0.136 0.056 0.808
#> GSM182818     1  0.1163      0.916 0.972 0.028 0.000
#> GSM182819     1  0.0747      0.928 0.984 0.000 0.016
#> GSM182820     1  0.0747      0.928 0.984 0.000 0.016
#> GSM182821     3  0.1482      0.884 0.020 0.012 0.968
#> GSM182822     1  0.0424      0.923 0.992 0.008 0.000
#> GSM182823     1  0.0747      0.928 0.984 0.000 0.016
#> GSM182824     1  0.0747      0.928 0.984 0.000 0.016
#> GSM182825     1  0.1647      0.910 0.960 0.036 0.004

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM182755     1  0.6698    0.15956 0.556 0.000 0.340 0.104
#> GSM182756     3  0.2216    0.83675 0.000 0.000 0.908 0.092
#> GSM182757     3  0.1109    0.82072 0.000 0.028 0.968 0.004
#> GSM182758     3  0.2149    0.83777 0.000 0.000 0.912 0.088
#> GSM182759     2  0.4792    0.60566 0.000 0.680 0.312 0.008
#> GSM182760     3  0.3172    0.79874 0.000 0.000 0.840 0.160
#> GSM182761     3  0.2401    0.77966 0.000 0.092 0.904 0.004
#> GSM182762     3  0.0592    0.83411 0.000 0.000 0.984 0.016
#> GSM182763     3  0.1042    0.82249 0.000 0.020 0.972 0.008
#> GSM182764     3  0.2944    0.74795 0.000 0.128 0.868 0.004
#> GSM182765     3  0.0188    0.83132 0.000 0.000 0.996 0.004
#> GSM182766     2  0.0672    0.85488 0.000 0.984 0.008 0.008
#> GSM182767     3  0.3172    0.79874 0.000 0.000 0.840 0.160
#> GSM182768     4  0.6004    0.50408 0.076 0.000 0.276 0.648
#> GSM182769     1  0.5560    0.26122 0.584 0.000 0.024 0.392
#> GSM182770     2  0.1661    0.84918 0.000 0.944 0.004 0.052
#> GSM182771     3  0.6316    0.22156 0.000 0.324 0.596 0.080
#> GSM182772     2  0.1661    0.84918 0.000 0.944 0.004 0.052
#> GSM182773     3  0.5657    0.50260 0.044 0.000 0.644 0.312
#> GSM182774     4  0.6023    0.37270 0.328 0.000 0.060 0.612
#> GSM182775     1  0.7231   -0.05274 0.464 0.000 0.144 0.392
#> GSM182776     1  0.5233    0.37897 0.648 0.000 0.020 0.332
#> GSM182777     3  0.6664    0.47721 0.152 0.000 0.616 0.232
#> GSM182802     2  0.3539    0.79678 0.000 0.820 0.004 0.176
#> GSM182803     1  0.0188    0.70956 0.996 0.004 0.000 0.000
#> GSM182804     4  0.3335    0.52500 0.128 0.000 0.016 0.856
#> GSM182805     2  0.3681    0.79660 0.000 0.816 0.008 0.176
#> GSM182806     1  0.0469    0.71156 0.988 0.000 0.000 0.012
#> GSM182807     1  0.0469    0.71156 0.988 0.000 0.000 0.012
#> GSM182808     1  0.0469    0.71156 0.988 0.000 0.000 0.012
#> GSM182809     4  0.4388    0.58182 0.136 0.004 0.048 0.812
#> GSM182810     1  0.4907    0.09072 0.580 0.000 0.000 0.420
#> GSM182811     4  0.5132    0.18369 0.448 0.004 0.000 0.548
#> GSM182812     1  0.4817    0.20367 0.612 0.000 0.000 0.388
#> GSM182813     1  0.0469    0.71156 0.988 0.000 0.000 0.012
#> GSM182778     2  0.0188    0.85446 0.000 0.996 0.004 0.000
#> GSM182779     3  0.2944    0.74795 0.000 0.128 0.868 0.004
#> GSM182780     3  0.1488    0.83709 0.000 0.012 0.956 0.032
#> GSM182781     3  0.2530    0.82841 0.000 0.000 0.888 0.112
#> GSM182782     2  0.0188    0.85446 0.000 0.996 0.004 0.000
#> GSM182783     3  0.2255    0.84048 0.000 0.012 0.920 0.068
#> GSM182784     3  0.2149    0.83777 0.000 0.000 0.912 0.088
#> GSM182785     3  0.0336    0.83271 0.000 0.000 0.992 0.008
#> GSM182786     2  0.0188    0.85446 0.000 0.996 0.004 0.000
#> GSM182787     2  0.5236    0.31019 0.000 0.560 0.432 0.008
#> GSM182788     2  0.0188    0.85446 0.000 0.996 0.004 0.000
#> GSM182789     3  0.1302    0.84059 0.000 0.000 0.956 0.044
#> GSM182790     3  0.3172    0.79874 0.000 0.000 0.840 0.160
#> GSM182791     4  0.5306    0.31456 0.020 0.000 0.348 0.632
#> GSM182792     4  0.6521    0.19040 0.076 0.000 0.412 0.512
#> GSM182793     2  0.4509    0.70782 0.000 0.708 0.004 0.288
#> GSM182794     3  0.3172    0.79874 0.000 0.000 0.840 0.160
#> GSM182795     3  0.2081    0.83815 0.000 0.000 0.916 0.084
#> GSM182796     2  0.2714    0.81427 0.000 0.884 0.112 0.004
#> GSM182797     1  0.2408    0.64699 0.896 0.000 0.000 0.104
#> GSM182798     2  0.5496    0.74913 0.000 0.724 0.188 0.088
#> GSM182799     4  0.2399    0.58730 0.032 0.000 0.048 0.920
#> GSM182800     4  0.4609    0.49146 0.224 0.000 0.024 0.752
#> GSM182801     1  0.5355    0.33014 0.620 0.000 0.020 0.360
#> GSM182814     1  0.0592    0.70633 0.984 0.000 0.000 0.016
#> GSM182815     4  0.5911    0.48153 0.180 0.084 0.016 0.720
#> GSM182816     1  0.0592    0.70633 0.984 0.000 0.000 0.016
#> GSM182817     3  0.6499    0.26145 0.060 0.012 0.588 0.340
#> GSM182818     4  0.4920    0.33618 0.368 0.004 0.000 0.628
#> GSM182819     1  0.0000    0.71009 1.000 0.000 0.000 0.000
#> GSM182820     1  0.0469    0.71156 0.988 0.000 0.000 0.012
#> GSM182821     3  0.3765    0.77887 0.004 0.004 0.812 0.180
#> GSM182822     1  0.5165   -0.08251 0.512 0.004 0.000 0.484
#> GSM182823     1  0.0592    0.70633 0.984 0.000 0.000 0.016
#> GSM182824     1  0.0592    0.70633 0.984 0.000 0.000 0.016
#> GSM182825     1  0.4998    0.00849 0.512 0.000 0.000 0.488

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>           class entropy silhouette    p1    p2    p3    p4    p5
#> GSM182755     1  0.6569    0.12779 0.496 0.000 0.288 0.004 0.212
#> GSM182756     5  0.4171    0.35438 0.000 0.000 0.396 0.000 0.604
#> GSM182757     5  0.0912    0.67805 0.000 0.012 0.016 0.000 0.972
#> GSM182758     5  0.4161    0.36374 0.000 0.000 0.392 0.000 0.608
#> GSM182759     5  0.3870    0.39054 0.000 0.260 0.004 0.004 0.732
#> GSM182760     3  0.4219    0.16470 0.000 0.000 0.584 0.000 0.416
#> GSM182761     5  0.1484    0.67106 0.000 0.048 0.008 0.000 0.944
#> GSM182762     5  0.1341    0.67052 0.000 0.000 0.056 0.000 0.944
#> GSM182763     5  0.0451    0.67765 0.000 0.000 0.008 0.004 0.988
#> GSM182764     5  0.1430    0.66701 0.000 0.052 0.004 0.000 0.944
#> GSM182765     5  0.0609    0.67729 0.000 0.000 0.020 0.000 0.980
#> GSM182766     2  0.4393    0.72252 0.000 0.752 0.004 0.052 0.192
#> GSM182767     3  0.4227    0.15328 0.000 0.000 0.580 0.000 0.420
#> GSM182768     3  0.4386    0.56442 0.024 0.000 0.788 0.132 0.056
#> GSM182769     3  0.4121    0.51749 0.168 0.000 0.784 0.036 0.012
#> GSM182770     2  0.2286    0.78378 0.000 0.888 0.000 0.108 0.004
#> GSM182771     5  0.5847    0.32483 0.000 0.160 0.024 0.152 0.664
#> GSM182772     2  0.2286    0.78378 0.000 0.888 0.000 0.108 0.004
#> GSM182773     3  0.3197    0.57096 0.012 0.000 0.832 0.004 0.152
#> GSM182774     3  0.6653   -0.15733 0.136 0.000 0.476 0.368 0.020
#> GSM182775     3  0.3675    0.56672 0.124 0.000 0.828 0.016 0.032
#> GSM182776     3  0.4798    0.38036 0.268 0.000 0.684 0.044 0.004
#> GSM182777     3  0.3146    0.60289 0.052 0.000 0.856 0.000 0.092
#> GSM182802     2  0.5071    0.66856 0.000 0.616 0.004 0.340 0.040
#> GSM182803     1  0.1469    0.76567 0.948 0.000 0.016 0.036 0.000
#> GSM182804     4  0.2352    0.55861 0.004 0.008 0.092 0.896 0.000
#> GSM182805     2  0.5071    0.66856 0.000 0.616 0.004 0.340 0.040
#> GSM182806     1  0.1571    0.78474 0.936 0.000 0.060 0.004 0.000
#> GSM182807     1  0.1571    0.78474 0.936 0.000 0.060 0.004 0.000
#> GSM182808     1  0.1410    0.78458 0.940 0.000 0.060 0.000 0.000
#> GSM182809     4  0.5175    0.58346 0.072 0.000 0.240 0.680 0.008
#> GSM182810     1  0.5737   -0.47918 0.464 0.000 0.084 0.452 0.000
#> GSM182811     4  0.5701    0.60307 0.332 0.000 0.100 0.568 0.000
#> GSM182812     1  0.5283   -0.34224 0.508 0.000 0.048 0.444 0.000
#> GSM182813     1  0.1410    0.78458 0.940 0.000 0.060 0.000 0.000
#> GSM182778     2  0.1195    0.78666 0.000 0.960 0.028 0.000 0.012
#> GSM182779     5  0.1270    0.66718 0.000 0.052 0.000 0.000 0.948
#> GSM182780     5  0.1357    0.67665 0.000 0.000 0.048 0.004 0.948
#> GSM182781     5  0.4287    0.19890 0.000 0.000 0.460 0.000 0.540
#> GSM182782     2  0.1195    0.78666 0.000 0.960 0.028 0.000 0.012
#> GSM182783     5  0.3774    0.50430 0.000 0.000 0.296 0.000 0.704
#> GSM182784     5  0.4101    0.39325 0.000 0.000 0.372 0.000 0.628
#> GSM182785     5  0.1792    0.65998 0.000 0.000 0.084 0.000 0.916
#> GSM182786     2  0.1195    0.78666 0.000 0.960 0.028 0.000 0.012
#> GSM182787     5  0.2629    0.59282 0.000 0.136 0.000 0.004 0.860
#> GSM182788     2  0.1195    0.78666 0.000 0.960 0.028 0.000 0.012
#> GSM182789     5  0.3210    0.58250 0.000 0.000 0.212 0.000 0.788
#> GSM182790     3  0.4210    0.16707 0.000 0.000 0.588 0.000 0.412
#> GSM182791     3  0.4129    0.49586 0.000 0.000 0.756 0.204 0.040
#> GSM182792     3  0.4065    0.59312 0.020 0.000 0.816 0.080 0.084
#> GSM182793     2  0.6341    0.52115 0.000 0.488 0.064 0.408 0.040
#> GSM182794     3  0.4210    0.16707 0.000 0.000 0.588 0.000 0.412
#> GSM182795     5  0.4150    0.36925 0.000 0.000 0.388 0.000 0.612
#> GSM182796     2  0.4789    0.43611 0.000 0.608 0.004 0.020 0.368
#> GSM182797     1  0.2732    0.68430 0.840 0.000 0.160 0.000 0.000
#> GSM182798     5  0.7015   -0.30297 0.000 0.372 0.032 0.156 0.440
#> GSM182799     3  0.4434    0.00288 0.004 0.000 0.536 0.460 0.000
#> GSM182800     3  0.5671    0.14057 0.096 0.000 0.568 0.336 0.000
#> GSM182801     3  0.4823    0.30766 0.316 0.000 0.644 0.040 0.000
#> GSM182814     1  0.0880    0.77327 0.968 0.000 0.000 0.032 0.000
#> GSM182815     4  0.3073    0.63972 0.068 0.008 0.052 0.872 0.000
#> GSM182816     1  0.1168    0.77183 0.960 0.000 0.008 0.032 0.000
#> GSM182817     5  0.6187   -0.02717 0.032 0.000 0.060 0.444 0.464
#> GSM182818     4  0.5218    0.69520 0.180 0.000 0.136 0.684 0.000
#> GSM182819     1  0.0566    0.78033 0.984 0.000 0.004 0.012 0.000
#> GSM182820     1  0.1571    0.78474 0.936 0.000 0.060 0.004 0.000
#> GSM182821     5  0.5944    0.17665 0.000 0.000 0.404 0.108 0.488
#> GSM182822     4  0.6047    0.52543 0.376 0.000 0.124 0.500 0.000
#> GSM182823     1  0.1168    0.77154 0.960 0.000 0.008 0.032 0.000
#> GSM182824     1  0.1168    0.77154 0.960 0.000 0.008 0.032 0.000
#> GSM182825     4  0.5828    0.41762 0.380 0.000 0.100 0.520 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
#> GSM182755     6  0.7251     0.0106 0.324 0.000 0.216 0.000 0.104 0.356
#> GSM182756     3  0.1492     0.5813 0.000 0.000 0.940 0.000 0.024 0.036
#> GSM182757     5  0.4184     0.4447 0.000 0.012 0.484 0.000 0.504 0.000
#> GSM182758     3  0.0891     0.5829 0.000 0.000 0.968 0.000 0.008 0.024
#> GSM182759     5  0.4946     0.5648 0.000 0.100 0.284 0.000 0.616 0.000
#> GSM182760     3  0.3390     0.3174 0.000 0.000 0.704 0.000 0.000 0.296
#> GSM182761     3  0.4593    -0.4895 0.000 0.036 0.492 0.000 0.472 0.000
#> GSM182762     3  0.4338    -0.4276 0.000 0.000 0.492 0.000 0.488 0.020
#> GSM182763     5  0.3975     0.4932 0.000 0.000 0.452 0.000 0.544 0.004
#> GSM182764     5  0.4509     0.5146 0.000 0.032 0.436 0.000 0.532 0.000
#> GSM182765     5  0.4039     0.5023 0.000 0.000 0.424 0.000 0.568 0.008
#> GSM182766     2  0.5624     0.3181 0.000 0.484 0.044 0.020 0.432 0.020
#> GSM182767     3  0.3050     0.4178 0.000 0.000 0.764 0.000 0.000 0.236
#> GSM182768     6  0.4024     0.7306 0.000 0.000 0.180 0.064 0.004 0.752
#> GSM182769     6  0.3159     0.7361 0.020 0.000 0.152 0.008 0.000 0.820
#> GSM182770     2  0.4796     0.7054 0.000 0.708 0.000 0.092 0.176 0.024
#> GSM182771     5  0.4577     0.5324 0.000 0.048 0.156 0.040 0.748 0.008
#> GSM182772     2  0.4826     0.7047 0.000 0.704 0.000 0.092 0.180 0.024
#> GSM182773     6  0.3619     0.6301 0.000 0.000 0.316 0.004 0.000 0.680
#> GSM182774     6  0.5284     0.5204 0.028 0.000 0.056 0.216 0.024 0.676
#> GSM182775     6  0.2882     0.7351 0.008 0.000 0.180 0.000 0.000 0.812
#> GSM182776     6  0.3610     0.7132 0.048 0.000 0.104 0.012 0.012 0.824
#> GSM182777     6  0.3309     0.6590 0.000 0.000 0.280 0.000 0.000 0.720
#> GSM182802     2  0.6635     0.5032 0.000 0.400 0.000 0.312 0.256 0.032
#> GSM182803     1  0.2340     0.7433 0.900 0.000 0.000 0.060 0.016 0.024
#> GSM182804     4  0.3892     0.4669 0.012 0.000 0.000 0.788 0.120 0.080
#> GSM182805     2  0.6625     0.4994 0.000 0.400 0.000 0.320 0.248 0.032
#> GSM182806     1  0.2798     0.7800 0.852 0.000 0.000 0.000 0.036 0.112
#> GSM182807     1  0.2798     0.7800 0.852 0.000 0.000 0.000 0.036 0.112
#> GSM182808     1  0.2706     0.7817 0.860 0.000 0.000 0.000 0.036 0.104
#> GSM182809     4  0.3759     0.4671 0.008 0.000 0.024 0.752 0.000 0.216
#> GSM182810     4  0.5715     0.2999 0.432 0.000 0.000 0.456 0.024 0.088
#> GSM182811     4  0.5324     0.5288 0.284 0.000 0.000 0.612 0.028 0.076
#> GSM182812     1  0.5183    -0.1465 0.540 0.000 0.000 0.392 0.028 0.040
#> GSM182813     1  0.2843     0.7796 0.848 0.000 0.000 0.000 0.036 0.116
#> GSM182778     2  0.0000     0.7267 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM182779     5  0.4504     0.5164 0.000 0.032 0.432 0.000 0.536 0.000
#> GSM182780     3  0.3684    -0.0369 0.000 0.000 0.664 0.000 0.332 0.004
#> GSM182781     3  0.3333     0.5060 0.000 0.000 0.784 0.000 0.024 0.192
#> GSM182782     2  0.0000     0.7267 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM182783     3  0.1918     0.5205 0.000 0.000 0.904 0.000 0.088 0.008
#> GSM182784     3  0.0508     0.5806 0.000 0.000 0.984 0.000 0.004 0.012
#> GSM182785     3  0.3221     0.1721 0.000 0.000 0.736 0.000 0.264 0.000
#> GSM182786     2  0.0000     0.7267 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM182787     3  0.5116    -0.4682 0.000 0.068 0.484 0.000 0.444 0.004
#> GSM182788     2  0.0000     0.7267 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM182789     3  0.2178     0.4396 0.000 0.000 0.868 0.000 0.132 0.000
#> GSM182790     3  0.3710     0.3209 0.000 0.000 0.696 0.000 0.012 0.292
#> GSM182791     6  0.6423     0.5646 0.000 0.000 0.204 0.164 0.080 0.552
#> GSM182792     6  0.3912     0.7265 0.000 0.000 0.204 0.044 0.004 0.748
#> GSM182793     4  0.7111    -0.3996 0.000 0.272 0.000 0.344 0.312 0.072
#> GSM182794     3  0.3371     0.3269 0.000 0.000 0.708 0.000 0.000 0.292
#> GSM182795     3  0.1418     0.5788 0.000 0.000 0.944 0.000 0.024 0.032
#> GSM182796     5  0.4876     0.1398 0.000 0.368 0.068 0.000 0.564 0.000
#> GSM182797     1  0.4534     0.4357 0.580 0.000 0.000 0.000 0.040 0.380
#> GSM182798     5  0.5305     0.3205 0.000 0.136 0.080 0.048 0.712 0.024
#> GSM182799     6  0.6318     0.2892 0.004 0.000 0.064 0.364 0.088 0.480
#> GSM182800     6  0.6402     0.5163 0.032 0.000 0.072 0.216 0.084 0.596
#> GSM182801     6  0.3561     0.7005 0.072 0.000 0.088 0.012 0.004 0.824
#> GSM182814     1  0.2112     0.7586 0.916 0.000 0.000 0.036 0.028 0.020
#> GSM182815     4  0.3177     0.5478 0.052 0.000 0.000 0.856 0.052 0.040
#> GSM182816     1  0.2262     0.7553 0.908 0.000 0.000 0.036 0.036 0.020
#> GSM182817     5  0.5868     0.0561 0.012 0.000 0.068 0.400 0.492 0.028
#> GSM182818     4  0.4348     0.5958 0.120 0.000 0.000 0.748 0.012 0.120
#> GSM182819     1  0.1232     0.7771 0.956 0.000 0.000 0.004 0.016 0.024
#> GSM182820     1  0.2798     0.7800 0.852 0.000 0.000 0.000 0.036 0.112
#> GSM182821     3  0.4934     0.3981 0.004 0.000 0.696 0.208 0.048 0.044
#> GSM182822     4  0.5630     0.4576 0.344 0.000 0.000 0.540 0.024 0.092
#> GSM182823     1  0.1932     0.7631 0.924 0.000 0.000 0.040 0.020 0.016
#> GSM182824     1  0.1932     0.7631 0.924 0.000 0.000 0.040 0.020 0.016
#> GSM182825     4  0.6120     0.2396 0.412 0.000 0.000 0.444 0.048 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 stress(p) development.stage(p) k
#> SD:kmeans 65     0.887             2.21e-04 2
#> SD:kmeans 65     0.912             5.11e-07 3
#> SD:kmeans 51     0.708             1.52e-06 4
#> SD:kmeans 46     0.572             3.47e-07 5
#> SD:kmeans 43     0.574             2.14e-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 18172 rows and 71 columns.
#>   Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'SD' method.
#>   Subgroups are detected by 'skmeans' method.
#>   Performed in total 1250 partitions by row resampling.
#>   Best k for subgroups seems to be 2.
#> 
#> Following methods can be applied to this 'ConsensusPartition' object:
#>  [1] "cola_report"             "collect_classes"         "collect_plots"          
#>  [4] "collect_stats"           "colnames"                "compare_signatures"     
#>  [7] "consensus_heatmap"       "dimension_reduction"     "functional_enrichment"  
#> [10] "get_anno_col"            "get_anno"                "get_classes"            
#> [13] "get_consensus"           "get_matrix"              "get_membership"         
#> [16] "get_param"               "get_signatures"          "get_stats"              
#> [19] "is_best_k"               "is_stable_k"             "membership_heatmap"     
#> [22] "ncol"                    "nrow"                    "plot_ecdf"              
#> [25] "rownames"                "select_partition_number" "show"                   
#> [28] "suggest_best_k"          "test_to_known_factors"

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

collect_plots(res)

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 0.938           0.907       0.965         0.5067 0.494   0.494
#> 3 3 0.722           0.818       0.918         0.3091 0.804   0.622
#> 4 4 0.685           0.732       0.868         0.1143 0.905   0.734
#> 5 5 0.630           0.599       0.777         0.0635 0.910   0.691
#> 6 6 0.646           0.499       0.718         0.0405 0.962   0.832

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
#> GSM182755     1   0.000     0.9462 1.000 0.000
#> GSM182756     2   0.204     0.9503 0.032 0.968
#> GSM182757     2   0.000     0.9781 0.000 1.000
#> GSM182758     2   0.000     0.9781 0.000 1.000
#> GSM182759     2   0.000     0.9781 0.000 1.000
#> GSM182760     1   0.961     0.3744 0.616 0.384
#> GSM182761     2   0.000     0.9781 0.000 1.000
#> GSM182762     2   0.224     0.9465 0.036 0.964
#> GSM182763     2   0.000     0.9781 0.000 1.000
#> GSM182764     2   0.000     0.9781 0.000 1.000
#> GSM182765     2   0.000     0.9781 0.000 1.000
#> GSM182766     2   0.000     0.9781 0.000 1.000
#> GSM182767     2   0.689     0.7631 0.184 0.816
#> GSM182768     1   0.000     0.9462 1.000 0.000
#> GSM182769     1   0.000     0.9462 1.000 0.000
#> GSM182770     2   0.000     0.9781 0.000 1.000
#> GSM182771     2   0.000     0.9781 0.000 1.000
#> GSM182772     2   0.000     0.9781 0.000 1.000
#> GSM182773     1   0.000     0.9462 1.000 0.000
#> GSM182774     1   0.000     0.9462 1.000 0.000
#> GSM182775     1   0.000     0.9462 1.000 0.000
#> GSM182776     1   0.000     0.9462 1.000 0.000
#> GSM182777     1   0.000     0.9462 1.000 0.000
#> GSM182802     2   0.000     0.9781 0.000 1.000
#> GSM182803     1   0.000     0.9462 1.000 0.000
#> GSM182804     1   0.224     0.9181 0.964 0.036
#> GSM182805     2   0.000     0.9781 0.000 1.000
#> GSM182806     1   0.000     0.9462 1.000 0.000
#> GSM182807     1   0.000     0.9462 1.000 0.000
#> GSM182808     1   0.000     0.9462 1.000 0.000
#> GSM182809     1   0.224     0.9181 0.964 0.036
#> GSM182810     1   0.000     0.9462 1.000 0.000
#> GSM182811     1   0.000     0.9462 1.000 0.000
#> GSM182812     1   0.000     0.9462 1.000 0.000
#> GSM182813     1   0.000     0.9462 1.000 0.000
#> GSM182778     2   0.000     0.9781 0.000 1.000
#> GSM182779     2   0.000     0.9781 0.000 1.000
#> GSM182780     2   0.000     0.9781 0.000 1.000
#> GSM182781     1   1.000     0.0249 0.504 0.496
#> GSM182782     2   0.000     0.9781 0.000 1.000
#> GSM182783     2   0.000     0.9781 0.000 1.000
#> GSM182784     2   0.000     0.9781 0.000 1.000
#> GSM182785     2   0.000     0.9781 0.000 1.000
#> GSM182786     2   0.000     0.9781 0.000 1.000
#> GSM182787     2   0.000     0.9781 0.000 1.000
#> GSM182788     2   0.000     0.9781 0.000 1.000
#> GSM182789     2   0.000     0.9781 0.000 1.000
#> GSM182790     1   1.000     0.0249 0.504 0.496
#> GSM182791     1   0.000     0.9462 1.000 0.000
#> GSM182792     1   0.000     0.9462 1.000 0.000
#> GSM182793     2   0.000     0.9781 0.000 1.000
#> GSM182794     2   0.932     0.4401 0.348 0.652
#> GSM182795     2   0.000     0.9781 0.000 1.000
#> GSM182796     2   0.000     0.9781 0.000 1.000
#> GSM182797     1   0.000     0.9462 1.000 0.000
#> GSM182798     2   0.000     0.9781 0.000 1.000
#> GSM182799     1   0.224     0.9181 0.964 0.036
#> GSM182800     1   0.000     0.9462 1.000 0.000
#> GSM182801     1   0.000     0.9462 1.000 0.000
#> GSM182814     1   0.000     0.9462 1.000 0.000
#> GSM182815     1   0.932     0.4702 0.652 0.348
#> GSM182816     1   0.000     0.9462 1.000 0.000
#> GSM182817     2   0.358     0.9108 0.068 0.932
#> GSM182818     1   0.000     0.9462 1.000 0.000
#> GSM182819     1   0.000     0.9462 1.000 0.000
#> GSM182820     1   0.000     0.9462 1.000 0.000
#> GSM182821     2   0.000     0.9781 0.000 1.000
#> GSM182822     1   0.000     0.9462 1.000 0.000
#> GSM182823     1   0.000     0.9462 1.000 0.000
#> GSM182824     1   0.000     0.9462 1.000 0.000
#> GSM182825     1   0.000     0.9462 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
#> GSM182755     3  0.5905      0.445 0.352 0.000 0.648
#> GSM182756     3  0.0000      0.903 0.000 0.000 1.000
#> GSM182757     3  0.6045      0.336 0.000 0.380 0.620
#> GSM182758     3  0.0000      0.903 0.000 0.000 1.000
#> GSM182759     2  0.0000      0.924 0.000 1.000 0.000
#> GSM182760     3  0.0000      0.903 0.000 0.000 1.000
#> GSM182761     2  0.4974      0.705 0.000 0.764 0.236
#> GSM182762     3  0.2400      0.867 0.004 0.064 0.932
#> GSM182763     2  0.1031      0.910 0.000 0.976 0.024
#> GSM182764     2  0.4555      0.745 0.000 0.800 0.200
#> GSM182765     2  0.5706      0.539 0.000 0.680 0.320
#> GSM182766     2  0.0000      0.924 0.000 1.000 0.000
#> GSM182767     3  0.0000      0.903 0.000 0.000 1.000
#> GSM182768     1  0.5733      0.578 0.676 0.000 0.324
#> GSM182769     1  0.3619      0.804 0.864 0.000 0.136
#> GSM182770     2  0.0000      0.924 0.000 1.000 0.000
#> GSM182771     2  0.0000      0.924 0.000 1.000 0.000
#> GSM182772     2  0.0000      0.924 0.000 1.000 0.000
#> GSM182773     3  0.2261      0.859 0.068 0.000 0.932
#> GSM182774     1  0.0000      0.894 1.000 0.000 0.000
#> GSM182775     1  0.5810      0.558 0.664 0.000 0.336
#> GSM182776     1  0.0000      0.894 1.000 0.000 0.000
#> GSM182777     3  0.2625      0.843 0.084 0.000 0.916
#> GSM182802     2  0.0000      0.924 0.000 1.000 0.000
#> GSM182803     1  0.0000      0.894 1.000 0.000 0.000
#> GSM182804     1  0.3686      0.786 0.860 0.140 0.000
#> GSM182805     2  0.0000      0.924 0.000 1.000 0.000
#> GSM182806     1  0.0000      0.894 1.000 0.000 0.000
#> GSM182807     1  0.0000      0.894 1.000 0.000 0.000
#> GSM182808     1  0.0000      0.894 1.000 0.000 0.000
#> GSM182809     1  0.3340      0.804 0.880 0.120 0.000
#> GSM182810     1  0.0000      0.894 1.000 0.000 0.000
#> GSM182811     1  0.0000      0.894 1.000 0.000 0.000
#> GSM182812     1  0.0000      0.894 1.000 0.000 0.000
#> GSM182813     1  0.0000      0.894 1.000 0.000 0.000
#> GSM182778     2  0.0000      0.924 0.000 1.000 0.000
#> GSM182779     2  0.2711      0.862 0.000 0.912 0.088
#> GSM182780     2  0.0424      0.920 0.000 0.992 0.008
#> GSM182781     3  0.0000      0.903 0.000 0.000 1.000
#> GSM182782     2  0.0000      0.924 0.000 1.000 0.000
#> GSM182783     2  0.5216      0.651 0.000 0.740 0.260
#> GSM182784     3  0.0000      0.903 0.000 0.000 1.000
#> GSM182785     3  0.3116      0.824 0.000 0.108 0.892
#> GSM182786     2  0.0000      0.924 0.000 1.000 0.000
#> GSM182787     2  0.0000      0.924 0.000 1.000 0.000
#> GSM182788     2  0.0000      0.924 0.000 1.000 0.000
#> GSM182789     3  0.4504      0.715 0.000 0.196 0.804
#> GSM182790     3  0.0000      0.903 0.000 0.000 1.000
#> GSM182791     1  0.7223      0.353 0.548 0.028 0.424
#> GSM182792     1  0.6244      0.343 0.560 0.000 0.440
#> GSM182793     2  0.0000      0.924 0.000 1.000 0.000
#> GSM182794     3  0.0000      0.903 0.000 0.000 1.000
#> GSM182795     3  0.0747      0.896 0.000 0.016 0.984
#> GSM182796     2  0.0000      0.924 0.000 1.000 0.000
#> GSM182797     1  0.2165      0.858 0.936 0.000 0.064
#> GSM182798     2  0.0000      0.924 0.000 1.000 0.000
#> GSM182799     1  0.8626      0.501 0.580 0.140 0.280
#> GSM182800     1  0.0592      0.888 0.988 0.000 0.012
#> GSM182801     1  0.2959      0.833 0.900 0.000 0.100
#> GSM182814     1  0.0000      0.894 1.000 0.000 0.000
#> GSM182815     1  0.6291      0.165 0.532 0.468 0.000
#> GSM182816     1  0.0000      0.894 1.000 0.000 0.000
#> GSM182817     2  0.4974      0.666 0.236 0.764 0.000
#> GSM182818     1  0.0000      0.894 1.000 0.000 0.000
#> GSM182819     1  0.0000      0.894 1.000 0.000 0.000
#> GSM182820     1  0.0000      0.894 1.000 0.000 0.000
#> GSM182821     2  0.4968      0.745 0.012 0.800 0.188
#> GSM182822     1  0.0000      0.894 1.000 0.000 0.000
#> GSM182823     1  0.0000      0.894 1.000 0.000 0.000
#> GSM182824     1  0.0000      0.894 1.000 0.000 0.000
#> GSM182825     1  0.0000      0.894 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
#> GSM182755     1  0.4086      0.631 0.776 0.000 0.216 0.008
#> GSM182756     3  0.0188      0.852 0.000 0.000 0.996 0.004
#> GSM182757     3  0.4713      0.364 0.000 0.360 0.640 0.000
#> GSM182758     3  0.0672      0.853 0.000 0.008 0.984 0.008
#> GSM182759     2  0.0000      0.847 0.000 1.000 0.000 0.000
#> GSM182760     3  0.0817      0.849 0.000 0.000 0.976 0.024
#> GSM182761     2  0.4193      0.629 0.000 0.732 0.268 0.000
#> GSM182762     3  0.2654      0.787 0.004 0.108 0.888 0.000
#> GSM182763     2  0.0817      0.841 0.000 0.976 0.024 0.000
#> GSM182764     2  0.3942      0.669 0.000 0.764 0.236 0.000
#> GSM182765     2  0.4356      0.589 0.000 0.708 0.292 0.000
#> GSM182766     2  0.0188      0.847 0.000 0.996 0.000 0.004
#> GSM182767     3  0.0707      0.850 0.000 0.000 0.980 0.020
#> GSM182768     4  0.5650      0.692 0.180 0.000 0.104 0.716
#> GSM182769     1  0.4540      0.659 0.772 0.000 0.032 0.196
#> GSM182770     2  0.1118      0.838 0.000 0.964 0.000 0.036
#> GSM182771     2  0.0188      0.847 0.000 0.996 0.000 0.004
#> GSM182772     2  0.1022      0.840 0.000 0.968 0.000 0.032
#> GSM182773     3  0.5889      0.529 0.116 0.000 0.696 0.188
#> GSM182774     1  0.3219      0.775 0.836 0.000 0.000 0.164
#> GSM182775     1  0.6823      0.351 0.604 0.000 0.196 0.200
#> GSM182776     1  0.1557      0.835 0.944 0.000 0.000 0.056
#> GSM182777     3  0.7149      0.189 0.316 0.000 0.528 0.156
#> GSM182802     2  0.2589      0.792 0.000 0.884 0.000 0.116
#> GSM182803     1  0.0921      0.864 0.972 0.000 0.000 0.028
#> GSM182804     4  0.3674      0.734 0.104 0.044 0.000 0.852
#> GSM182805     2  0.2530      0.795 0.000 0.888 0.000 0.112
#> GSM182806     1  0.0000      0.863 1.000 0.000 0.000 0.000
#> GSM182807     1  0.0000      0.863 1.000 0.000 0.000 0.000
#> GSM182808     1  0.0000      0.863 1.000 0.000 0.000 0.000
#> GSM182809     4  0.4464      0.711 0.208 0.024 0.000 0.768
#> GSM182810     1  0.1792      0.846 0.932 0.000 0.000 0.068
#> GSM182811     1  0.3649      0.702 0.796 0.000 0.000 0.204
#> GSM182812     1  0.2647      0.804 0.880 0.000 0.000 0.120
#> GSM182813     1  0.0000      0.863 1.000 0.000 0.000 0.000
#> GSM182778     2  0.0188      0.847 0.000 0.996 0.000 0.004
#> GSM182779     2  0.2149      0.810 0.000 0.912 0.088 0.000
#> GSM182780     2  0.4727      0.734 0.000 0.792 0.100 0.108
#> GSM182781     3  0.0188      0.852 0.004 0.000 0.996 0.000
#> GSM182782     2  0.0188      0.847 0.000 0.996 0.000 0.004
#> GSM182783     2  0.6007      0.269 0.000 0.548 0.408 0.044
#> GSM182784     3  0.0188      0.852 0.000 0.004 0.996 0.000
#> GSM182785     3  0.1637      0.826 0.000 0.060 0.940 0.000
#> GSM182786     2  0.0188      0.847 0.000 0.996 0.000 0.004
#> GSM182787     2  0.0188      0.847 0.000 0.996 0.000 0.004
#> GSM182788     2  0.0188      0.847 0.000 0.996 0.000 0.004
#> GSM182789     3  0.3539      0.716 0.000 0.176 0.820 0.004
#> GSM182790     3  0.0592      0.851 0.000 0.000 0.984 0.016
#> GSM182791     4  0.3190      0.705 0.016 0.008 0.096 0.880
#> GSM182792     4  0.6469      0.608 0.164 0.000 0.192 0.644
#> GSM182793     2  0.4888      0.374 0.000 0.588 0.000 0.412
#> GSM182794     3  0.1118      0.842 0.000 0.000 0.964 0.036
#> GSM182795     3  0.1677      0.842 0.000 0.040 0.948 0.012
#> GSM182796     2  0.0000      0.847 0.000 1.000 0.000 0.000
#> GSM182797     1  0.2412      0.806 0.908 0.000 0.008 0.084
#> GSM182798     2  0.0817      0.842 0.000 0.976 0.000 0.024
#> GSM182799     4  0.0524      0.734 0.004 0.000 0.008 0.988
#> GSM182800     4  0.3945      0.656 0.216 0.000 0.004 0.780
#> GSM182801     1  0.4194      0.647 0.764 0.000 0.008 0.228
#> GSM182814     1  0.0921      0.864 0.972 0.000 0.000 0.028
#> GSM182815     4  0.4856      0.718 0.136 0.084 0.000 0.780
#> GSM182816     1  0.0921      0.864 0.972 0.000 0.000 0.028
#> GSM182817     2  0.6910      0.258 0.324 0.548 0.000 0.128
#> GSM182818     4  0.4941      0.321 0.436 0.000 0.000 0.564
#> GSM182819     1  0.0921      0.864 0.972 0.000 0.000 0.028
#> GSM182820     1  0.0000      0.863 1.000 0.000 0.000 0.000
#> GSM182821     2  0.8053      0.286 0.020 0.488 0.224 0.268
#> GSM182822     1  0.1867      0.842 0.928 0.000 0.000 0.072
#> GSM182823     1  0.0921      0.864 0.972 0.000 0.000 0.028
#> GSM182824     1  0.0921      0.864 0.972 0.000 0.000 0.028
#> GSM182825     1  0.4643      0.427 0.656 0.000 0.000 0.344

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>           class entropy silhouette    p1    p2    p3    p4    p5
#> GSM182755     1  0.5914     0.4292 0.644 0.000 0.176 0.016 0.164
#> GSM182756     5  0.1628     0.7447 0.000 0.000 0.056 0.008 0.936
#> GSM182757     5  0.6169     0.3062 0.000 0.312 0.108 0.016 0.564
#> GSM182758     5  0.2052     0.7429 0.000 0.004 0.080 0.004 0.912
#> GSM182759     2  0.1569     0.7792 0.000 0.944 0.044 0.008 0.004
#> GSM182760     5  0.3132     0.6837 0.000 0.000 0.172 0.008 0.820
#> GSM182761     2  0.5776     0.4021 0.000 0.592 0.064 0.020 0.324
#> GSM182762     5  0.5887     0.5828 0.000 0.136 0.164 0.032 0.668
#> GSM182763     2  0.3674     0.7400 0.000 0.840 0.068 0.016 0.076
#> GSM182764     2  0.6554     0.3931 0.000 0.540 0.136 0.024 0.300
#> GSM182765     2  0.6479     0.4311 0.000 0.568 0.132 0.028 0.272
#> GSM182766     2  0.0000     0.7828 0.000 1.000 0.000 0.000 0.000
#> GSM182767     5  0.2798     0.7091 0.000 0.000 0.140 0.008 0.852
#> GSM182768     3  0.5930     0.4621 0.060 0.000 0.664 0.204 0.072
#> GSM182769     3  0.5211     0.2708 0.432 0.000 0.524 0.000 0.044
#> GSM182770     2  0.2020     0.7466 0.000 0.900 0.000 0.100 0.000
#> GSM182771     2  0.3796     0.7431 0.000 0.820 0.076 0.100 0.004
#> GSM182772     2  0.1965     0.7485 0.000 0.904 0.000 0.096 0.000
#> GSM182773     3  0.4482     0.2389 0.012 0.000 0.612 0.000 0.376
#> GSM182774     1  0.4404     0.6965 0.760 0.000 0.152 0.088 0.000
#> GSM182775     3  0.6001     0.4990 0.280 0.000 0.580 0.004 0.136
#> GSM182776     1  0.3366     0.6221 0.768 0.000 0.232 0.000 0.000
#> GSM182777     3  0.6507     0.3117 0.156 0.000 0.484 0.008 0.352
#> GSM182802     2  0.3895     0.5030 0.000 0.680 0.000 0.320 0.000
#> GSM182803     1  0.1408     0.8174 0.948 0.000 0.008 0.044 0.000
#> GSM182804     4  0.3858     0.4113 0.016 0.024 0.156 0.804 0.000
#> GSM182805     2  0.4029     0.5003 0.000 0.680 0.004 0.316 0.000
#> GSM182806     1  0.0880     0.8355 0.968 0.000 0.032 0.000 0.000
#> GSM182807     1  0.0880     0.8355 0.968 0.000 0.032 0.000 0.000
#> GSM182808     1  0.0794     0.8349 0.972 0.000 0.028 0.000 0.000
#> GSM182809     4  0.4893     0.5184 0.164 0.016 0.080 0.740 0.000
#> GSM182810     1  0.2377     0.7675 0.872 0.000 0.000 0.128 0.000
#> GSM182811     1  0.4504     0.1614 0.564 0.000 0.008 0.428 0.000
#> GSM182812     1  0.2773     0.7351 0.836 0.000 0.000 0.164 0.000
#> GSM182813     1  0.0880     0.8334 0.968 0.000 0.032 0.000 0.000
#> GSM182778     2  0.0000     0.7828 0.000 1.000 0.000 0.000 0.000
#> GSM182779     2  0.4975     0.6663 0.000 0.736 0.068 0.024 0.172
#> GSM182780     2  0.6267     0.5620 0.000 0.656 0.076 0.116 0.152
#> GSM182781     5  0.2130     0.7412 0.000 0.000 0.080 0.012 0.908
#> GSM182782     2  0.0000     0.7828 0.000 1.000 0.000 0.000 0.000
#> GSM182783     5  0.6430     0.0454 0.000 0.432 0.052 0.056 0.460
#> GSM182784     5  0.1329     0.7456 0.000 0.004 0.032 0.008 0.956
#> GSM182785     5  0.3850     0.6900 0.000 0.044 0.128 0.012 0.816
#> GSM182786     2  0.0000     0.7828 0.000 1.000 0.000 0.000 0.000
#> GSM182787     2  0.1469     0.7751 0.000 0.948 0.016 0.000 0.036
#> GSM182788     2  0.0000     0.7828 0.000 1.000 0.000 0.000 0.000
#> GSM182789     5  0.4255     0.6780 0.000 0.140 0.060 0.012 0.788
#> GSM182790     5  0.3203     0.6855 0.000 0.000 0.168 0.012 0.820
#> GSM182791     3  0.5355     0.2210 0.008 0.000 0.552 0.400 0.040
#> GSM182792     3  0.5203     0.5108 0.068 0.000 0.748 0.080 0.104
#> GSM182793     2  0.6024     0.1950 0.000 0.512 0.124 0.364 0.000
#> GSM182794     5  0.3487     0.6477 0.000 0.000 0.212 0.008 0.780
#> GSM182795     5  0.3525     0.7157 0.000 0.032 0.120 0.012 0.836
#> GSM182796     2  0.1885     0.7769 0.000 0.932 0.044 0.020 0.004
#> GSM182797     1  0.3489     0.6467 0.784 0.000 0.208 0.004 0.004
#> GSM182798     2  0.3700     0.7526 0.000 0.832 0.084 0.076 0.008
#> GSM182799     3  0.4446     0.1171 0.000 0.000 0.520 0.476 0.004
#> GSM182800     3  0.6313     0.2921 0.188 0.000 0.516 0.296 0.000
#> GSM182801     3  0.4890     0.2161 0.452 0.000 0.524 0.024 0.000
#> GSM182814     1  0.0404     0.8373 0.988 0.000 0.000 0.012 0.000
#> GSM182815     4  0.3429     0.5669 0.100 0.040 0.012 0.848 0.000
#> GSM182816     1  0.0000     0.8386 1.000 0.000 0.000 0.000 0.000
#> GSM182817     4  0.7800     0.4273 0.256 0.204 0.080 0.456 0.004
#> GSM182818     4  0.4416     0.4071 0.356 0.000 0.012 0.632 0.000
#> GSM182819     1  0.0162     0.8383 0.996 0.000 0.004 0.000 0.000
#> GSM182820     1  0.0880     0.8355 0.968 0.000 0.032 0.000 0.000
#> GSM182821     4  0.8370     0.2766 0.032 0.308 0.100 0.416 0.144
#> GSM182822     1  0.3013     0.7242 0.832 0.000 0.008 0.160 0.000
#> GSM182823     1  0.0000     0.8386 1.000 0.000 0.000 0.000 0.000
#> GSM182824     1  0.0162     0.8384 0.996 0.000 0.000 0.004 0.000
#> GSM182825     1  0.5589     0.4501 0.628 0.000 0.128 0.244 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
#> GSM182755     1  0.7040   0.091254 0.464 0.000 0.116 0.000 0.204 0.216
#> GSM182756     3  0.3624   0.656525 0.000 0.000 0.784 0.000 0.156 0.060
#> GSM182757     5  0.6195   0.326096 0.000 0.272 0.336 0.000 0.388 0.004
#> GSM182758     3  0.2077   0.681438 0.000 0.004 0.916 0.004 0.032 0.044
#> GSM182759     2  0.2389   0.636728 0.000 0.864 0.008 0.000 0.128 0.000
#> GSM182760     3  0.4771   0.607554 0.000 0.000 0.652 0.000 0.100 0.248
#> GSM182761     2  0.5711  -0.039346 0.000 0.540 0.192 0.004 0.264 0.000
#> GSM182762     5  0.5813   0.163154 0.000 0.116 0.288 0.000 0.564 0.032
#> GSM182763     2  0.4330   0.387081 0.000 0.680 0.044 0.000 0.272 0.004
#> GSM182764     5  0.5541   0.312160 0.000 0.392 0.136 0.000 0.472 0.000
#> GSM182765     5  0.6054   0.370608 0.000 0.348 0.144 0.004 0.488 0.016
#> GSM182766     2  0.0458   0.704275 0.000 0.984 0.000 0.000 0.016 0.000
#> GSM182767     3  0.3284   0.670347 0.000 0.000 0.800 0.000 0.032 0.168
#> GSM182768     6  0.4125   0.490686 0.016 0.000 0.036 0.192 0.004 0.752
#> GSM182769     6  0.4526   0.531650 0.280 0.000 0.032 0.008 0.008 0.672
#> GSM182770     2  0.2887   0.663569 0.000 0.844 0.000 0.036 0.120 0.000
#> GSM182771     2  0.4284   0.558859 0.000 0.676 0.008 0.016 0.292 0.008
#> GSM182772     2  0.2956   0.661920 0.000 0.840 0.000 0.040 0.120 0.000
#> GSM182773     6  0.3716   0.455559 0.012 0.000 0.248 0.000 0.008 0.732
#> GSM182774     1  0.5586   0.537127 0.648 0.000 0.004 0.140 0.036 0.172
#> GSM182775     6  0.4431   0.603326 0.152 0.000 0.080 0.004 0.016 0.748
#> GSM182776     1  0.4365   0.392397 0.640 0.000 0.008 0.008 0.012 0.332
#> GSM182777     6  0.5374   0.514482 0.128 0.000 0.176 0.000 0.036 0.660
#> GSM182802     2  0.4965   0.504177 0.000 0.660 0.000 0.136 0.200 0.004
#> GSM182803     1  0.1065   0.774719 0.964 0.000 0.000 0.020 0.008 0.008
#> GSM182804     4  0.2421   0.517004 0.000 0.004 0.004 0.896 0.044 0.052
#> GSM182805     2  0.4955   0.495007 0.000 0.660 0.000 0.132 0.204 0.004
#> GSM182806     1  0.1049   0.775845 0.960 0.000 0.000 0.000 0.008 0.032
#> GSM182807     1  0.1225   0.774535 0.952 0.000 0.000 0.000 0.012 0.036
#> GSM182808     1  0.1124   0.775231 0.956 0.000 0.000 0.000 0.008 0.036
#> GSM182809     4  0.4951   0.598771 0.148 0.012 0.000 0.728 0.068 0.044
#> GSM182810     1  0.3309   0.641385 0.788 0.000 0.000 0.192 0.016 0.004
#> GSM182811     1  0.5664   0.042406 0.492 0.000 0.000 0.384 0.112 0.012
#> GSM182812     1  0.3383   0.564282 0.728 0.000 0.000 0.268 0.000 0.004
#> GSM182813     1  0.1124   0.775231 0.956 0.000 0.000 0.000 0.008 0.036
#> GSM182778     2  0.0000   0.704101 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM182779     2  0.4874   0.202287 0.000 0.608 0.084 0.000 0.308 0.000
#> GSM182780     2  0.6417   0.313759 0.000 0.592 0.160 0.108 0.132 0.008
#> GSM182781     3  0.4573   0.584676 0.000 0.000 0.676 0.000 0.236 0.088
#> GSM182782     2  0.0000   0.704101 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM182783     3  0.5902   0.052471 0.000 0.368 0.512 0.028 0.084 0.008
#> GSM182784     3  0.3316   0.642860 0.000 0.004 0.804 0.000 0.164 0.028
#> GSM182785     3  0.4700   0.353368 0.000 0.036 0.592 0.004 0.364 0.004
#> GSM182786     2  0.0000   0.704101 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM182787     2  0.2128   0.662017 0.000 0.908 0.032 0.004 0.056 0.000
#> GSM182788     2  0.0000   0.704101 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM182789     3  0.4954   0.468728 0.000 0.116 0.692 0.008 0.176 0.008
#> GSM182790     3  0.3861   0.651336 0.000 0.000 0.756 0.000 0.060 0.184
#> GSM182791     6  0.5775  -0.075354 0.000 0.000 0.060 0.444 0.048 0.448
#> GSM182792     6  0.3502   0.560787 0.008 0.000 0.088 0.060 0.012 0.832
#> GSM182793     2  0.5952   0.287621 0.000 0.520 0.004 0.352 0.084 0.040
#> GSM182794     3  0.3780   0.609728 0.000 0.000 0.728 0.004 0.020 0.248
#> GSM182795     3  0.4102   0.622780 0.000 0.048 0.808 0.016 0.072 0.056
#> GSM182796     2  0.1957   0.687877 0.000 0.888 0.000 0.000 0.112 0.000
#> GSM182797     1  0.4515   0.314547 0.608 0.000 0.008 0.000 0.028 0.356
#> GSM182798     2  0.4341   0.607319 0.000 0.712 0.000 0.048 0.228 0.012
#> GSM182799     4  0.4810  -0.044804 0.000 0.000 0.008 0.552 0.040 0.400
#> GSM182800     6  0.6062   0.000714 0.108 0.000 0.000 0.416 0.036 0.440
#> GSM182801     6  0.4099   0.514324 0.276 0.000 0.004 0.016 0.008 0.696
#> GSM182814     1  0.0935   0.769166 0.964 0.000 0.000 0.032 0.000 0.004
#> GSM182815     4  0.4463   0.577763 0.076 0.020 0.000 0.748 0.152 0.004
#> GSM182816     1  0.0458   0.775834 0.984 0.000 0.000 0.016 0.000 0.000
#> GSM182817     5  0.7911  -0.252006 0.192 0.132 0.000 0.276 0.368 0.032
#> GSM182818     4  0.4998   0.399928 0.316 0.000 0.000 0.608 0.064 0.012
#> GSM182819     1  0.0405   0.776958 0.988 0.000 0.000 0.004 0.000 0.008
#> GSM182820     1  0.1225   0.774535 0.952 0.000 0.000 0.000 0.012 0.036
#> GSM182821     5  0.8652   0.079579 0.008 0.244 0.200 0.208 0.284 0.056
#> GSM182822     1  0.4071   0.588337 0.736 0.000 0.000 0.216 0.036 0.012
#> GSM182823     1  0.0547   0.774830 0.980 0.000 0.000 0.020 0.000 0.000
#> GSM182824     1  0.0458   0.775834 0.984 0.000 0.000 0.016 0.000 0.000
#> GSM182825     1  0.4435   0.351711 0.580 0.000 0.000 0.392 0.004 0.024

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

consensus_heatmap(res, k = 2)

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 stress(p) development.stage(p) k
#> SD:skmeans 66     0.805             2.98e-04 2
#> SD:skmeans 66     0.857             4.98e-06 3
#> SD:skmeans 62     0.767             1.17e-05 4
#> SD:skmeans 49     0.866             3.40e-06 5
#> SD:skmeans 45     0.943             1.59e-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: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 18172 rows and 71 columns.
#>   Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'SD' method.
#>   Subgroups are detected by 'pam' method.
#>   Performed in total 1250 partitions by row resampling.
#>   Best k for subgroups seems to be 2.
#> 
#> Following methods can be applied to this 'ConsensusPartition' object:
#>  [1] "cola_report"             "collect_classes"         "collect_plots"          
#>  [4] "collect_stats"           "colnames"                "compare_signatures"     
#>  [7] "consensus_heatmap"       "dimension_reduction"     "functional_enrichment"  
#> [10] "get_anno_col"            "get_anno"                "get_classes"            
#> [13] "get_consensus"           "get_matrix"              "get_membership"         
#> [16] "get_param"               "get_signatures"          "get_stats"              
#> [19] "is_best_k"               "is_stable_k"             "membership_heatmap"     
#> [22] "ncol"                    "nrow"                    "plot_ecdf"              
#> [25] "rownames"                "select_partition_number" "show"                   
#> [28] "suggest_best_k"          "test_to_known_factors"

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

collect_plots(res)

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.853           0.888       0.953         0.4970 0.505   0.505
#> 3 3 0.590           0.752       0.874         0.2601 0.668   0.455
#> 4 4 0.533           0.470       0.703         0.1241 0.847   0.659
#> 5 5 0.556           0.407       0.667         0.0886 0.744   0.380
#> 6 6 0.581           0.290       0.634         0.0582 0.808   0.356

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
#> GSM182755     1  0.0376      0.941 0.996 0.004
#> GSM182756     1  0.9686      0.388 0.604 0.396
#> GSM182757     2  0.0000      0.959 0.000 1.000
#> GSM182758     2  0.0000      0.959 0.000 1.000
#> GSM182759     2  0.0000      0.959 0.000 1.000
#> GSM182760     1  0.4562      0.873 0.904 0.096
#> GSM182761     2  0.0000      0.959 0.000 1.000
#> GSM182762     1  0.6623      0.792 0.828 0.172
#> GSM182763     2  0.0000      0.959 0.000 1.000
#> GSM182764     2  0.0000      0.959 0.000 1.000
#> GSM182765     1  0.9909      0.247 0.556 0.444
#> GSM182766     2  0.0000      0.959 0.000 1.000
#> GSM182767     1  0.8555      0.642 0.720 0.280
#> GSM182768     1  0.0376      0.941 0.996 0.004
#> GSM182769     1  0.0000      0.942 1.000 0.000
#> GSM182770     2  0.0000      0.959 0.000 1.000
#> GSM182771     2  0.9248      0.446 0.340 0.660
#> GSM182772     2  0.0000      0.959 0.000 1.000
#> GSM182773     1  0.0376      0.941 0.996 0.004
#> GSM182774     1  0.0000      0.942 1.000 0.000
#> GSM182775     1  0.0376      0.941 0.996 0.004
#> GSM182776     1  0.0376      0.941 0.996 0.004
#> GSM182777     1  0.0376      0.941 0.996 0.004
#> GSM182802     2  0.0000      0.959 0.000 1.000
#> GSM182803     1  0.0000      0.942 1.000 0.000
#> GSM182804     1  0.0000      0.942 1.000 0.000
#> GSM182805     2  0.0000      0.959 0.000 1.000
#> GSM182806     1  0.0000      0.942 1.000 0.000
#> GSM182807     1  0.0000      0.942 1.000 0.000
#> GSM182808     1  0.0000      0.942 1.000 0.000
#> GSM182809     1  0.0672      0.937 0.992 0.008
#> GSM182810     1  0.0000      0.942 1.000 0.000
#> GSM182811     1  0.0000      0.942 1.000 0.000
#> GSM182812     1  0.0000      0.942 1.000 0.000
#> GSM182813     1  0.0000      0.942 1.000 0.000
#> GSM182778     2  0.0000      0.959 0.000 1.000
#> GSM182779     2  0.0000      0.959 0.000 1.000
#> GSM182780     2  0.0000      0.959 0.000 1.000
#> GSM182781     1  0.4562      0.873 0.904 0.096
#> GSM182782     2  0.0000      0.959 0.000 1.000
#> GSM182783     2  0.0000      0.959 0.000 1.000
#> GSM182784     2  0.0000      0.959 0.000 1.000
#> GSM182785     2  0.0000      0.959 0.000 1.000
#> GSM182786     2  0.0000      0.959 0.000 1.000
#> GSM182787     2  0.0000      0.959 0.000 1.000
#> GSM182788     2  0.0000      0.959 0.000 1.000
#> GSM182789     2  0.0000      0.959 0.000 1.000
#> GSM182790     1  0.4562      0.873 0.904 0.096
#> GSM182791     1  0.2603      0.914 0.956 0.044
#> GSM182792     1  0.0376      0.941 0.996 0.004
#> GSM182793     2  0.0672      0.952 0.008 0.992
#> GSM182794     1  0.7376      0.746 0.792 0.208
#> GSM182795     2  0.0376      0.956 0.004 0.996
#> GSM182796     2  0.0000      0.959 0.000 1.000
#> GSM182797     1  0.0000      0.942 1.000 0.000
#> GSM182798     2  0.0000      0.959 0.000 1.000
#> GSM182799     1  0.9209      0.487 0.664 0.336
#> GSM182800     1  0.0000      0.942 1.000 0.000
#> GSM182801     1  0.0000      0.942 1.000 0.000
#> GSM182814     1  0.0000      0.942 1.000 0.000
#> GSM182815     2  0.9881      0.216 0.436 0.564
#> GSM182816     1  0.0000      0.942 1.000 0.000
#> GSM182817     2  0.8955      0.520 0.312 0.688
#> GSM182818     1  0.0000      0.942 1.000 0.000
#> GSM182819     1  0.0000      0.942 1.000 0.000
#> GSM182820     1  0.0000      0.942 1.000 0.000
#> GSM182821     2  0.0000      0.959 0.000 1.000
#> GSM182822     1  0.0000      0.942 1.000 0.000
#> GSM182823     1  0.0000      0.942 1.000 0.000
#> GSM182824     1  0.0000      0.942 1.000 0.000
#> GSM182825     1  0.0000      0.942 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
#> GSM182755     1  0.4842     0.7920 0.776 0.000 0.224
#> GSM182756     3  0.2810     0.7995 0.036 0.036 0.928
#> GSM182757     3  0.3412     0.8023 0.000 0.124 0.876
#> GSM182758     3  0.1529     0.8035 0.000 0.040 0.960
#> GSM182759     3  0.6252     0.3199 0.000 0.444 0.556
#> GSM182760     3  0.1860     0.7564 0.052 0.000 0.948
#> GSM182761     3  0.3941     0.7882 0.000 0.156 0.844
#> GSM182762     1  0.5244     0.7702 0.756 0.004 0.240
#> GSM182763     3  0.3412     0.8037 0.000 0.124 0.876
#> GSM182764     3  0.5431     0.6495 0.000 0.284 0.716
#> GSM182765     3  0.1031     0.7986 0.000 0.024 0.976
#> GSM182766     2  0.5327     0.5715 0.000 0.728 0.272
#> GSM182767     3  0.1289     0.8016 0.000 0.032 0.968
#> GSM182768     1  0.5098     0.7907 0.752 0.000 0.248
#> GSM182769     1  0.3192     0.8808 0.888 0.000 0.112
#> GSM182770     2  0.0000     0.8354 0.000 1.000 0.000
#> GSM182771     3  0.4861     0.7001 0.008 0.192 0.800
#> GSM182772     2  0.0000     0.8354 0.000 1.000 0.000
#> GSM182773     3  0.1411     0.7815 0.036 0.000 0.964
#> GSM182774     1  0.3879     0.8516 0.848 0.000 0.152
#> GSM182775     1  0.3267     0.8788 0.884 0.000 0.116
#> GSM182776     1  0.2878     0.8872 0.904 0.000 0.096
#> GSM182777     1  0.4796     0.7959 0.780 0.000 0.220
#> GSM182802     2  0.6140     0.2180 0.000 0.596 0.404
#> GSM182803     1  0.0892     0.9004 0.980 0.000 0.020
#> GSM182804     3  0.6215     0.2400 0.428 0.000 0.572
#> GSM182805     2  0.6045     0.2945 0.000 0.620 0.380
#> GSM182806     1  0.0000     0.9002 1.000 0.000 0.000
#> GSM182807     1  0.0237     0.9007 0.996 0.000 0.004
#> GSM182808     1  0.0000     0.9002 1.000 0.000 0.000
#> GSM182809     3  0.4605     0.6316 0.204 0.000 0.796
#> GSM182810     1  0.0892     0.9004 0.980 0.000 0.020
#> GSM182811     1  0.1289     0.8982 0.968 0.000 0.032
#> GSM182812     1  0.0000     0.9002 1.000 0.000 0.000
#> GSM182813     1  0.0424     0.9008 0.992 0.000 0.008
#> GSM182778     2  0.0000     0.8354 0.000 1.000 0.000
#> GSM182779     3  0.5465     0.6444 0.000 0.288 0.712
#> GSM182780     3  0.3879     0.7906 0.000 0.152 0.848
#> GSM182781     3  0.6305    -0.1831 0.484 0.000 0.516
#> GSM182782     2  0.0000     0.8354 0.000 1.000 0.000
#> GSM182783     3  0.3412     0.8029 0.000 0.124 0.876
#> GSM182784     3  0.3267     0.8034 0.000 0.116 0.884
#> GSM182785     3  0.3551     0.7997 0.000 0.132 0.868
#> GSM182786     2  0.0000     0.8354 0.000 1.000 0.000
#> GSM182787     3  0.3941     0.7882 0.000 0.156 0.844
#> GSM182788     2  0.0000     0.8354 0.000 1.000 0.000
#> GSM182789     3  0.3941     0.7882 0.000 0.156 0.844
#> GSM182790     3  0.2261     0.7699 0.068 0.000 0.932
#> GSM182791     3  0.0000     0.7890 0.000 0.000 1.000
#> GSM182792     1  0.6168     0.5164 0.588 0.000 0.412
#> GSM182793     3  0.5760     0.3814 0.000 0.328 0.672
#> GSM182794     3  0.0237     0.7914 0.000 0.004 0.996
#> GSM182795     3  0.2261     0.8052 0.000 0.068 0.932
#> GSM182796     2  0.2796     0.7690 0.000 0.908 0.092
#> GSM182797     1  0.2711     0.8817 0.912 0.000 0.088
#> GSM182798     3  0.4887     0.6786 0.000 0.228 0.772
#> GSM182799     3  0.0592     0.7897 0.012 0.000 0.988
#> GSM182800     1  0.3267     0.8705 0.884 0.000 0.116
#> GSM182801     1  0.3192     0.8751 0.888 0.000 0.112
#> GSM182814     1  0.0000     0.9002 1.000 0.000 0.000
#> GSM182815     1  0.9820    -0.0151 0.428 0.276 0.296
#> GSM182816     1  0.0000     0.9002 1.000 0.000 0.000
#> GSM182817     3  0.5267     0.7369 0.140 0.044 0.816
#> GSM182818     1  0.0424     0.9006 0.992 0.000 0.008
#> GSM182819     1  0.0000     0.9002 1.000 0.000 0.000
#> GSM182820     1  0.1031     0.8992 0.976 0.000 0.024
#> GSM182821     3  0.4345     0.7952 0.016 0.136 0.848
#> GSM182822     1  0.1411     0.8982 0.964 0.000 0.036
#> GSM182823     1  0.0000     0.9002 1.000 0.000 0.000
#> GSM182824     1  0.0000     0.9002 1.000 0.000 0.000
#> GSM182825     1  0.2261     0.8853 0.932 0.000 0.068

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM182755     1  0.0927     0.4859 0.976 0.000 0.008 0.016
#> GSM182756     3  0.4245     0.6088 0.196 0.000 0.784 0.020
#> GSM182757     3  0.3400     0.7013 0.044 0.004 0.876 0.076
#> GSM182758     3  0.4215     0.6533 0.104 0.000 0.824 0.072
#> GSM182759     3  0.7093     0.4631 0.000 0.220 0.568 0.212
#> GSM182760     3  0.6458     0.3343 0.408 0.000 0.520 0.072
#> GSM182761     3  0.3249     0.6825 0.000 0.008 0.852 0.140
#> GSM182762     1  0.4860     0.2777 0.768 0.004 0.044 0.184
#> GSM182763     3  0.4538     0.6964 0.048 0.004 0.800 0.148
#> GSM182764     3  0.5857     0.6131 0.000 0.108 0.696 0.196
#> GSM182765     3  0.6343     0.6378 0.096 0.004 0.644 0.256
#> GSM182766     3  0.7613     0.0814 0.000 0.204 0.428 0.368
#> GSM182767     3  0.6396     0.3761 0.380 0.000 0.548 0.072
#> GSM182768     1  0.2742     0.4177 0.900 0.000 0.024 0.076
#> GSM182769     1  0.0592     0.4904 0.984 0.000 0.000 0.016
#> GSM182770     2  0.4123     0.8194 0.000 0.772 0.008 0.220
#> GSM182771     3  0.6204     0.6147 0.004 0.124 0.680 0.192
#> GSM182772     2  0.4123     0.8194 0.000 0.772 0.008 0.220
#> GSM182773     1  0.6080    -0.3319 0.488 0.000 0.468 0.044
#> GSM182774     1  0.5346     0.4029 0.692 0.004 0.032 0.272
#> GSM182775     1  0.1059     0.4812 0.972 0.000 0.016 0.012
#> GSM182776     1  0.0921     0.4923 0.972 0.000 0.000 0.028
#> GSM182777     1  0.1022     0.4745 0.968 0.000 0.032 0.000
#> GSM182802     3  0.7608     0.1178 0.000 0.200 0.408 0.392
#> GSM182803     1  0.4933     0.3787 0.568 0.000 0.000 0.432
#> GSM182804     4  0.6980     0.4337 0.128 0.004 0.300 0.568
#> GSM182805     3  0.7706     0.0932 0.000 0.224 0.412 0.364
#> GSM182806     1  0.4313     0.4659 0.736 0.004 0.000 0.260
#> GSM182807     1  0.4877     0.3920 0.592 0.000 0.000 0.408
#> GSM182808     1  0.4283     0.4676 0.740 0.004 0.000 0.256
#> GSM182809     4  0.6419     0.3214 0.068 0.000 0.420 0.512
#> GSM182810     1  0.5126     0.3614 0.552 0.004 0.000 0.444
#> GSM182811     1  0.4948     0.3560 0.560 0.000 0.000 0.440
#> GSM182812     1  0.5112     0.3663 0.560 0.004 0.000 0.436
#> GSM182813     1  0.4103     0.4655 0.744 0.000 0.000 0.256
#> GSM182778     2  0.0336     0.8961 0.000 0.992 0.008 0.000
#> GSM182779     3  0.5369     0.6447 0.000 0.112 0.744 0.144
#> GSM182780     3  0.2384     0.6978 0.008 0.004 0.916 0.072
#> GSM182781     1  0.4122     0.2184 0.760 0.000 0.236 0.004
#> GSM182782     2  0.0336     0.8961 0.000 0.992 0.008 0.000
#> GSM182783     3  0.1575     0.6998 0.028 0.004 0.956 0.012
#> GSM182784     3  0.2081     0.6875 0.084 0.000 0.916 0.000
#> GSM182785     3  0.4468     0.6935 0.052 0.004 0.808 0.136
#> GSM182786     2  0.0336     0.8961 0.000 0.992 0.008 0.000
#> GSM182787     3  0.2329     0.6947 0.000 0.012 0.916 0.072
#> GSM182788     2  0.0336     0.8961 0.000 0.992 0.008 0.000
#> GSM182789     3  0.2010     0.6985 0.004 0.004 0.932 0.060
#> GSM182790     1  0.4994    -0.2943 0.520 0.000 0.480 0.000
#> GSM182791     3  0.5223     0.6268 0.136 0.004 0.764 0.096
#> GSM182792     1  0.7012    -0.1450 0.496 0.004 0.396 0.104
#> GSM182793     3  0.6794     0.3919 0.012 0.064 0.480 0.444
#> GSM182794     3  0.5119     0.6242 0.148 0.004 0.768 0.080
#> GSM182795     3  0.3198     0.6790 0.040 0.000 0.880 0.080
#> GSM182796     2  0.5288     0.7219 0.000 0.732 0.068 0.200
#> GSM182797     1  0.0592     0.4901 0.984 0.000 0.000 0.016
#> GSM182798     3  0.7084     0.5562 0.000 0.176 0.560 0.264
#> GSM182799     3  0.5530     0.6125 0.152 0.004 0.740 0.104
#> GSM182800     1  0.5047     0.3364 0.636 0.004 0.004 0.356
#> GSM182801     1  0.1706     0.4759 0.948 0.000 0.016 0.036
#> GSM182814     1  0.5119     0.3651 0.556 0.004 0.000 0.440
#> GSM182815     4  0.3337     0.2741 0.032 0.060 0.020 0.888
#> GSM182816     1  0.5070     0.3837 0.580 0.004 0.000 0.416
#> GSM182817     3  0.5346     0.5596 0.076 0.000 0.732 0.192
#> GSM182818     1  0.4955     0.3634 0.556 0.000 0.000 0.444
#> GSM182819     1  0.4955     0.3647 0.556 0.000 0.000 0.444
#> GSM182820     1  0.2011     0.4909 0.920 0.000 0.000 0.080
#> GSM182821     3  0.1191     0.6978 0.004 0.004 0.968 0.024
#> GSM182822     1  0.5236     0.3546 0.560 0.000 0.008 0.432
#> GSM182823     1  0.5119     0.3651 0.556 0.004 0.000 0.440
#> GSM182824     1  0.5119     0.3651 0.556 0.004 0.000 0.440
#> GSM182825     4  0.5168    -0.4347 0.496 0.004 0.000 0.500

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>           class entropy silhouette    p1    p2    p3    p4    p5
#> GSM182755     3  0.1364    0.53139 0.036 0.000 0.952 0.012 0.000
#> GSM182756     4  0.4276    0.32256 0.000 0.000 0.380 0.616 0.004
#> GSM182757     5  0.5052    0.36950 0.000 0.000 0.048 0.340 0.612
#> GSM182758     4  0.4240    0.42805 0.000 0.000 0.228 0.736 0.036
#> GSM182759     5  0.3002    0.51275 0.000 0.028 0.000 0.116 0.856
#> GSM182760     3  0.4804   -0.08696 0.008 0.000 0.524 0.460 0.008
#> GSM182761     5  0.3835    0.44406 0.000 0.008 0.000 0.260 0.732
#> GSM182762     5  0.5347    0.16178 0.004 0.000 0.424 0.044 0.528
#> GSM182763     5  0.5071    0.41635 0.004 0.000 0.048 0.308 0.640
#> GSM182764     5  0.3318    0.49865 0.000 0.012 0.000 0.180 0.808
#> GSM182765     5  0.5422    0.34933 0.004 0.000 0.076 0.296 0.624
#> GSM182766     5  0.5511    0.41403 0.256 0.052 0.000 0.032 0.660
#> GSM182767     3  0.4452   -0.13808 0.000 0.000 0.500 0.496 0.004
#> GSM182768     3  0.1412    0.54778 0.008 0.000 0.952 0.036 0.004
#> GSM182769     3  0.1877    0.50666 0.064 0.000 0.924 0.012 0.000
#> GSM182770     2  0.4640    0.73187 0.256 0.696 0.000 0.000 0.048
#> GSM182771     4  0.5798    0.08704 0.004 0.056 0.008 0.484 0.448
#> GSM182772     2  0.4706    0.72924 0.256 0.692 0.000 0.000 0.052
#> GSM182773     3  0.4390    0.01368 0.000 0.000 0.568 0.428 0.004
#> GSM182774     3  0.6594   -0.47252 0.324 0.000 0.500 0.164 0.012
#> GSM182775     3  0.1267    0.54108 0.024 0.000 0.960 0.012 0.004
#> GSM182776     3  0.2580    0.49013 0.064 0.000 0.892 0.044 0.000
#> GSM182777     3  0.0566    0.54808 0.000 0.000 0.984 0.012 0.004
#> GSM182802     5  0.5954    0.37593 0.264 0.060 0.000 0.048 0.628
#> GSM182803     1  0.5166    0.76963 0.528 0.000 0.436 0.032 0.004
#> GSM182804     4  0.6435    0.11148 0.308 0.000 0.092 0.560 0.040
#> GSM182805     5  0.6496    0.37238 0.260 0.068 0.000 0.080 0.592
#> GSM182806     3  0.4375   -0.11293 0.420 0.000 0.576 0.000 0.004
#> GSM182807     1  0.4331    0.74625 0.596 0.000 0.400 0.000 0.004
#> GSM182808     3  0.4321   -0.05138 0.396 0.000 0.600 0.000 0.004
#> GSM182809     4  0.4743    0.12394 0.472 0.000 0.016 0.512 0.000
#> GSM182810     1  0.4192    0.82165 0.596 0.000 0.404 0.000 0.000
#> GSM182811     1  0.4966    0.80799 0.564 0.000 0.404 0.032 0.000
#> GSM182812     1  0.4045    0.82411 0.644 0.000 0.356 0.000 0.000
#> GSM182813     3  0.4437   -0.32532 0.464 0.000 0.532 0.000 0.004
#> GSM182778     2  0.0000    0.87663 0.000 1.000 0.000 0.000 0.000
#> GSM182779     5  0.4806    0.12763 0.000 0.016 0.012 0.336 0.636
#> GSM182780     4  0.4310    0.29099 0.000 0.000 0.004 0.604 0.392
#> GSM182781     3  0.3909    0.45642 0.000 0.000 0.760 0.216 0.024
#> GSM182782     2  0.0000    0.87663 0.000 1.000 0.000 0.000 0.000
#> GSM182783     4  0.3928    0.38760 0.000 0.000 0.004 0.700 0.296
#> GSM182784     4  0.4930    0.40507 0.000 0.000 0.084 0.696 0.220
#> GSM182785     5  0.4780    0.42976 0.000 0.000 0.048 0.280 0.672
#> GSM182786     2  0.0000    0.87663 0.000 1.000 0.000 0.000 0.000
#> GSM182787     4  0.4403    0.20949 0.004 0.000 0.000 0.560 0.436
#> GSM182788     2  0.0000    0.87663 0.000 1.000 0.000 0.000 0.000
#> GSM182789     4  0.4211    0.32939 0.000 0.000 0.004 0.636 0.360
#> GSM182790     3  0.4397   -0.00166 0.000 0.000 0.564 0.432 0.004
#> GSM182791     4  0.0693    0.45276 0.008 0.000 0.012 0.980 0.000
#> GSM182792     4  0.4726   -0.01623 0.020 0.000 0.400 0.580 0.000
#> GSM182793     4  0.6778   -0.13903 0.264 0.000 0.004 0.448 0.284
#> GSM182794     4  0.3768    0.43104 0.008 0.000 0.228 0.760 0.004
#> GSM182795     4  0.1908    0.45504 0.000 0.000 0.000 0.908 0.092
#> GSM182796     5  0.4415   -0.10042 0.004 0.444 0.000 0.000 0.552
#> GSM182797     3  0.2471    0.49676 0.136 0.000 0.864 0.000 0.000
#> GSM182798     5  0.6065    0.29098 0.012 0.092 0.000 0.364 0.532
#> GSM182799     4  0.1095    0.44763 0.008 0.000 0.012 0.968 0.012
#> GSM182800     3  0.6741   -0.19561 0.176 0.000 0.492 0.316 0.016
#> GSM182801     3  0.0833    0.54937 0.004 0.000 0.976 0.016 0.004
#> GSM182814     1  0.3983    0.82221 0.660 0.000 0.340 0.000 0.000
#> GSM182815     1  0.4449    0.25576 0.776 0.000 0.008 0.104 0.112
#> GSM182816     1  0.4425    0.78435 0.544 0.000 0.452 0.000 0.004
#> GSM182817     4  0.6677    0.21121 0.152 0.000 0.016 0.472 0.360
#> GSM182818     1  0.4299    0.82049 0.608 0.000 0.388 0.004 0.000
#> GSM182819     1  0.4973    0.81897 0.592 0.000 0.376 0.028 0.004
#> GSM182820     3  0.2719    0.48658 0.144 0.000 0.852 0.000 0.004
#> GSM182821     4  0.3816    0.38007 0.000 0.000 0.000 0.696 0.304
#> GSM182822     1  0.4510    0.80284 0.560 0.000 0.432 0.008 0.000
#> GSM182823     1  0.3790    0.78063 0.724 0.000 0.272 0.000 0.004
#> GSM182824     1  0.3636    0.78215 0.728 0.000 0.272 0.000 0.000
#> GSM182825     1  0.5921    0.74639 0.560 0.000 0.344 0.084 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
#> GSM182755     3  0.4435     0.3265 0.392 0.000 0.580 0.000 0.004 0.024
#> GSM182756     3  0.3763     0.3236 0.000 0.000 0.812 0.100 0.044 0.044
#> GSM182757     5  0.3738     0.3618 0.000 0.000 0.208 0.040 0.752 0.000
#> GSM182758     3  0.5374     0.1620 0.000 0.000 0.672 0.132 0.148 0.048
#> GSM182759     5  0.1349     0.3350 0.000 0.000 0.004 0.056 0.940 0.000
#> GSM182760     3  0.1872     0.4138 0.004 0.000 0.920 0.008 0.064 0.004
#> GSM182761     5  0.0748     0.3741 0.000 0.000 0.016 0.004 0.976 0.004
#> GSM182762     5  0.6158     0.0716 0.024 0.000 0.356 0.156 0.464 0.000
#> GSM182763     5  0.3488     0.3661 0.000 0.000 0.184 0.036 0.780 0.000
#> GSM182764     5  0.0777     0.3588 0.000 0.000 0.004 0.024 0.972 0.000
#> GSM182765     5  0.5561    -0.0428 0.000 0.000 0.136 0.428 0.436 0.000
#> GSM182766     5  0.4619    -0.0497 0.000 0.024 0.012 0.388 0.576 0.000
#> GSM182767     3  0.1226     0.4136 0.000 0.000 0.952 0.004 0.040 0.004
#> GSM182768     3  0.4266     0.3628 0.348 0.000 0.628 0.008 0.000 0.016
#> GSM182769     3  0.4184     0.3119 0.408 0.000 0.576 0.000 0.000 0.016
#> GSM182770     2  0.3810     0.5615 0.000 0.572 0.000 0.428 0.000 0.000
#> GSM182771     4  0.6594     0.1504 0.008 0.028 0.308 0.456 0.200 0.000
#> GSM182772     2  0.3833     0.5454 0.000 0.556 0.000 0.444 0.000 0.000
#> GSM182773     3  0.0405     0.4306 0.008 0.000 0.988 0.000 0.004 0.000
#> GSM182774     1  0.5431     0.3413 0.672 0.000 0.164 0.116 0.004 0.044
#> GSM182775     3  0.4141     0.3357 0.388 0.000 0.596 0.000 0.000 0.016
#> GSM182776     3  0.4199     0.3066 0.416 0.000 0.568 0.000 0.000 0.016
#> GSM182777     3  0.4052     0.3618 0.356 0.000 0.628 0.000 0.000 0.016
#> GSM182802     4  0.4485     0.2295 0.020 0.032 0.000 0.680 0.268 0.000
#> GSM182803     1  0.3810    -0.1811 0.572 0.000 0.000 0.000 0.000 0.428
#> GSM182804     1  0.7486    -0.1260 0.324 0.000 0.232 0.304 0.000 0.140
#> GSM182805     4  0.4964     0.0401 0.012 0.040 0.000 0.484 0.464 0.000
#> GSM182806     6  0.3053     0.7000 0.168 0.000 0.020 0.000 0.000 0.812
#> GSM182807     6  0.4018     0.6711 0.324 0.000 0.020 0.000 0.000 0.656
#> GSM182808     6  0.3688     0.7169 0.256 0.000 0.020 0.000 0.000 0.724
#> GSM182809     1  0.5587     0.0666 0.508 0.000 0.356 0.132 0.004 0.000
#> GSM182810     1  0.0260     0.5070 0.992 0.000 0.000 0.000 0.000 0.008
#> GSM182811     1  0.0000     0.5075 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM182812     1  0.2219     0.4751 0.864 0.000 0.000 0.000 0.000 0.136
#> GSM182813     6  0.3657     0.6950 0.100 0.000 0.108 0.000 0.000 0.792
#> GSM182778     2  0.0000     0.8199 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM182779     5  0.5058     0.2458 0.000 0.000 0.292 0.108 0.600 0.000
#> GSM182780     5  0.5633     0.2673 0.000 0.000 0.340 0.060 0.552 0.048
#> GSM182781     3  0.4756     0.4402 0.204 0.000 0.712 0.016 0.052 0.016
#> GSM182782     2  0.0000     0.8199 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM182783     5  0.6210     0.2168 0.000 0.000 0.396 0.108 0.448 0.048
#> GSM182784     3  0.5958    -0.1364 0.000 0.000 0.548 0.100 0.304 0.048
#> GSM182785     5  0.2848     0.3780 0.000 0.000 0.176 0.000 0.816 0.008
#> GSM182786     2  0.0000     0.8199 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM182787     5  0.4493     0.2946 0.000 0.000 0.312 0.036 0.644 0.008
#> GSM182788     2  0.0000     0.8199 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM182789     5  0.5819     0.2639 0.000 0.000 0.340 0.076 0.536 0.048
#> GSM182790     3  0.0405     0.4295 0.008 0.000 0.988 0.000 0.004 0.000
#> GSM182791     3  0.7119    -0.0734 0.012 0.000 0.416 0.340 0.084 0.148
#> GSM182792     4  0.7824    -0.1892 0.228 0.000 0.320 0.320 0.028 0.104
#> GSM182793     4  0.4387     0.2741 0.000 0.000 0.008 0.736 0.104 0.152
#> GSM182794     3  0.5795     0.1153 0.000 0.000 0.588 0.268 0.052 0.092
#> GSM182795     3  0.6861    -0.0733 0.000 0.000 0.424 0.320 0.184 0.072
#> GSM182796     5  0.5799    -0.1461 0.000 0.392 0.000 0.180 0.428 0.000
#> GSM182797     3  0.5558    -0.2023 0.136 0.000 0.448 0.000 0.000 0.416
#> GSM182798     4  0.4649     0.1126 0.000 0.028 0.004 0.604 0.356 0.008
#> GSM182799     3  0.7054    -0.0999 0.012 0.000 0.428 0.324 0.068 0.168
#> GSM182800     1  0.7289     0.1976 0.432 0.000 0.136 0.260 0.004 0.168
#> GSM182801     3  0.4131     0.3577 0.356 0.000 0.624 0.000 0.000 0.020
#> GSM182814     1  0.2597     0.4471 0.824 0.000 0.000 0.000 0.000 0.176
#> GSM182815     1  0.3907     0.2147 0.588 0.000 0.000 0.408 0.004 0.000
#> GSM182816     1  0.3565     0.1687 0.692 0.000 0.004 0.000 0.000 0.304
#> GSM182817     4  0.7394     0.1676 0.168 0.000 0.320 0.384 0.120 0.008
#> GSM182818     1  0.2213     0.5038 0.904 0.000 0.020 0.004 0.004 0.068
#> GSM182819     1  0.3854    -0.2438 0.536 0.000 0.000 0.000 0.000 0.464
#> GSM182820     6  0.4877     0.5392 0.148 0.000 0.192 0.000 0.000 0.660
#> GSM182821     5  0.6263     0.2178 0.000 0.000 0.368 0.112 0.468 0.052
#> GSM182822     1  0.0909     0.5074 0.968 0.000 0.020 0.012 0.000 0.000
#> GSM182823     6  0.3737     0.3849 0.392 0.000 0.000 0.000 0.000 0.608
#> GSM182824     1  0.3847    -0.1667 0.544 0.000 0.000 0.000 0.000 0.456
#> GSM182825     1  0.3924     0.4636 0.740 0.000 0.000 0.052 0.000 0.208

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 stress(p) development.stage(p) k
#> SD:pam 66     0.301             5.99e-03 2
#> SD:pam 64     0.582             8.09e-05 3
#> SD:pam 29     1.000             1.00e+00 4
#> SD:pam 26     0.170             9.54e-06 5
#> SD:pam 15     0.300             5.53e-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 18172 rows and 71 columns.
#>   Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'SD' method.
#>   Subgroups are detected by 'mclust' method.
#>   Performed in total 1250 partitions by row resampling.
#>   Best k for subgroups seems to be 3.
#> 
#> Following methods can be applied to this 'ConsensusPartition' object:
#>  [1] "cola_report"             "collect_classes"         "collect_plots"          
#>  [4] "collect_stats"           "colnames"                "compare_signatures"     
#>  [7] "consensus_heatmap"       "dimension_reduction"     "functional_enrichment"  
#> [10] "get_anno_col"            "get_anno"                "get_classes"            
#> [13] "get_consensus"           "get_matrix"              "get_membership"         
#> [16] "get_param"               "get_signatures"          "get_stats"              
#> [19] "is_best_k"               "is_stable_k"             "membership_heatmap"     
#> [22] "ncol"                    "nrow"                    "plot_ecdf"              
#> [25] "rownames"                "select_partition_number" "show"                   
#> [28] "suggest_best_k"          "test_to_known_factors"

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

collect_plots(res)

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.427           0.792       0.888         0.4044 0.590   0.590
#> 3 3 0.502           0.794       0.855         0.5704 0.642   0.438
#> 4 4 0.557           0.505       0.776         0.1086 0.885   0.699
#> 5 5 0.539           0.580       0.760         0.0691 0.855   0.583
#> 6 6 0.609           0.632       0.777         0.0556 0.861   0.501

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
#> GSM182755     2  0.7299    0.76989 0.204 0.796
#> GSM182756     1  0.8909    0.50116 0.692 0.308
#> GSM182757     2  0.8144    0.73629 0.252 0.748
#> GSM182758     1  0.0376    0.82400 0.996 0.004
#> GSM182759     2  0.7528    0.77178 0.216 0.784
#> GSM182760     1  0.0376    0.82400 0.996 0.004
#> GSM182761     2  0.8016    0.74664 0.244 0.756
#> GSM182762     2  0.7950    0.75162 0.240 0.760
#> GSM182763     2  0.7528    0.77178 0.216 0.784
#> GSM182764     2  0.7883    0.75646 0.236 0.764
#> GSM182765     2  0.7528    0.77178 0.216 0.784
#> GSM182766     2  0.2236    0.86874 0.036 0.964
#> GSM182767     1  0.0376    0.82400 0.996 0.004
#> GSM182768     1  0.7139    0.79117 0.804 0.196
#> GSM182769     1  0.6712    0.80942 0.824 0.176
#> GSM182770     2  0.2043    0.86967 0.032 0.968
#> GSM182771     2  0.0000    0.87085 0.000 1.000
#> GSM182772     2  0.2043    0.86967 0.032 0.968
#> GSM182773     1  0.3114    0.83172 0.944 0.056
#> GSM182774     2  0.2423    0.86995 0.040 0.960
#> GSM182775     1  0.6438    0.81633 0.836 0.164
#> GSM182776     2  0.7674    0.76494 0.224 0.776
#> GSM182777     1  0.0938    0.82609 0.988 0.012
#> GSM182802     2  0.0000    0.87085 0.000 1.000
#> GSM182803     2  0.0000    0.87085 0.000 1.000
#> GSM182804     2  0.0376    0.87034 0.004 0.996
#> GSM182805     2  0.0000    0.87085 0.000 1.000
#> GSM182806     2  0.1843    0.86917 0.028 0.972
#> GSM182807     2  0.6887    0.78379 0.184 0.816
#> GSM182808     2  0.4431    0.84213 0.092 0.908
#> GSM182809     2  0.2236    0.86874 0.036 0.964
#> GSM182810     2  0.0000    0.87085 0.000 1.000
#> GSM182811     2  0.0000    0.87085 0.000 1.000
#> GSM182812     2  0.0000    0.87085 0.000 1.000
#> GSM182813     2  0.6887    0.78379 0.184 0.816
#> GSM182778     2  0.2236    0.86957 0.036 0.964
#> GSM182779     2  0.7528    0.77178 0.216 0.784
#> GSM182780     1  0.9732    0.52937 0.596 0.404
#> GSM182781     1  0.8813    0.50997 0.700 0.300
#> GSM182782     2  0.2236    0.86957 0.036 0.964
#> GSM182783     1  0.6887    0.80313 0.816 0.184
#> GSM182784     1  0.0376    0.82400 0.996 0.004
#> GSM182785     2  0.9170    0.61389 0.332 0.668
#> GSM182786     2  0.2236    0.86957 0.036 0.964
#> GSM182787     2  0.7528    0.77178 0.216 0.784
#> GSM182788     2  0.2236    0.86957 0.036 0.964
#> GSM182789     1  0.4022    0.83200 0.920 0.080
#> GSM182790     1  0.0376    0.82400 0.996 0.004
#> GSM182791     1  0.9732    0.52937 0.596 0.404
#> GSM182792     1  0.6623    0.81241 0.828 0.172
#> GSM182793     2  0.2236    0.86874 0.036 0.964
#> GSM182794     1  0.0376    0.82400 0.996 0.004
#> GSM182795     1  0.6438    0.81633 0.836 0.164
#> GSM182796     2  0.1843    0.87063 0.028 0.972
#> GSM182797     2  0.7528    0.76697 0.216 0.784
#> GSM182798     2  0.1414    0.87136 0.020 0.980
#> GSM182799     2  0.8813    0.42696 0.300 0.700
#> GSM182800     2  0.9795   -0.00308 0.416 0.584
#> GSM182801     1  0.7528    0.76772 0.784 0.216
#> GSM182814     2  0.0000    0.87085 0.000 1.000
#> GSM182815     2  0.0376    0.87034 0.004 0.996
#> GSM182816     2  0.0000    0.87085 0.000 1.000
#> GSM182817     2  0.0000    0.87085 0.000 1.000
#> GSM182818     2  0.0376    0.87034 0.004 0.996
#> GSM182819     2  0.0000    0.87085 0.000 1.000
#> GSM182820     2  0.6887    0.78379 0.184 0.816
#> GSM182821     2  0.7528    0.77178 0.216 0.784
#> GSM182822     2  0.0000    0.87085 0.000 1.000
#> GSM182823     2  0.0000    0.87085 0.000 1.000
#> GSM182824     2  0.0000    0.87085 0.000 1.000
#> GSM182825     2  0.0376    0.87034 0.004 0.996

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>           class entropy silhouette    p1    p2    p3
#> GSM182755     1  0.8122      0.471 0.648 0.184 0.168
#> GSM182756     3  0.1170      0.905 0.016 0.008 0.976
#> GSM182757     2  0.7640      0.619 0.056 0.592 0.352
#> GSM182758     3  0.0000      0.902 0.000 0.000 1.000
#> GSM182759     2  0.5932      0.806 0.056 0.780 0.164
#> GSM182760     3  0.0000      0.902 0.000 0.000 1.000
#> GSM182761     2  0.6098      0.803 0.056 0.768 0.176
#> GSM182762     2  0.8608      0.698 0.192 0.604 0.204
#> GSM182763     2  0.7308      0.707 0.056 0.648 0.296
#> GSM182764     2  0.5988      0.805 0.056 0.776 0.168
#> GSM182765     2  0.7537      0.653 0.056 0.612 0.332
#> GSM182766     2  0.6586      0.774 0.056 0.728 0.216
#> GSM182767     3  0.0000      0.902 0.000 0.000 1.000
#> GSM182768     3  0.2356      0.906 0.072 0.000 0.928
#> GSM182769     3  0.2537      0.903 0.080 0.000 0.920
#> GSM182770     2  0.4654      0.762 0.208 0.792 0.000
#> GSM182771     2  0.6669      0.297 0.468 0.524 0.008
#> GSM182772     2  0.4654      0.762 0.208 0.792 0.000
#> GSM182773     3  0.1753      0.912 0.048 0.000 0.952
#> GSM182774     1  0.6262      0.619 0.696 0.020 0.284
#> GSM182775     3  0.2537      0.903 0.080 0.000 0.920
#> GSM182776     3  0.3695      0.873 0.108 0.012 0.880
#> GSM182777     3  0.2261      0.908 0.068 0.000 0.932
#> GSM182802     1  0.4842      0.642 0.776 0.224 0.000
#> GSM182803     1  0.0000      0.852 1.000 0.000 0.000
#> GSM182804     1  0.7785      0.669 0.672 0.192 0.136
#> GSM182805     1  0.4842      0.642 0.776 0.224 0.000
#> GSM182806     1  0.0747      0.850 0.984 0.000 0.016
#> GSM182807     1  0.2537      0.817 0.920 0.000 0.080
#> GSM182808     1  0.1031      0.848 0.976 0.000 0.024
#> GSM182809     1  0.7163      0.533 0.628 0.040 0.332
#> GSM182810     1  0.0000      0.852 1.000 0.000 0.000
#> GSM182811     1  0.0424      0.851 0.992 0.008 0.000
#> GSM182812     1  0.0424      0.851 0.992 0.008 0.000
#> GSM182813     1  0.3412      0.775 0.876 0.000 0.124
#> GSM182778     2  0.3879      0.753 0.152 0.848 0.000
#> GSM182779     2  0.6148      0.807 0.076 0.776 0.148
#> GSM182780     3  0.1877      0.911 0.032 0.012 0.956
#> GSM182781     3  0.1267      0.903 0.024 0.004 0.972
#> GSM182782     2  0.4345      0.766 0.136 0.848 0.016
#> GSM182783     3  0.1289      0.911 0.032 0.000 0.968
#> GSM182784     3  0.0000      0.902 0.000 0.000 1.000
#> GSM182785     3  0.2773      0.887 0.048 0.024 0.928
#> GSM182786     2  0.4047      0.757 0.148 0.848 0.004
#> GSM182787     2  0.5988      0.805 0.056 0.776 0.168
#> GSM182788     2  0.4261      0.764 0.140 0.848 0.012
#> GSM182789     3  0.1031      0.911 0.024 0.000 0.976
#> GSM182790     3  0.0000      0.902 0.000 0.000 1.000
#> GSM182791     3  0.6239      0.792 0.072 0.160 0.768
#> GSM182792     3  0.2356      0.906 0.072 0.000 0.928
#> GSM182793     3  0.6836      0.729 0.056 0.240 0.704
#> GSM182794     3  0.0000      0.902 0.000 0.000 1.000
#> GSM182795     3  0.1289      0.911 0.032 0.000 0.968
#> GSM182796     2  0.4654      0.762 0.208 0.792 0.000
#> GSM182797     3  0.6018      0.620 0.308 0.008 0.684
#> GSM182798     2  0.4452      0.634 0.192 0.808 0.000
#> GSM182799     3  0.6935      0.771 0.096 0.176 0.728
#> GSM182800     3  0.6567      0.785 0.088 0.160 0.752
#> GSM182801     3  0.2537      0.903 0.080 0.000 0.920
#> GSM182814     1  0.0000      0.852 1.000 0.000 0.000
#> GSM182815     1  0.5094      0.761 0.824 0.040 0.136
#> GSM182816     1  0.0000      0.852 1.000 0.000 0.000
#> GSM182817     1  0.2280      0.827 0.940 0.052 0.008
#> GSM182818     1  0.4810      0.767 0.832 0.028 0.140
#> GSM182819     1  0.0000      0.852 1.000 0.000 0.000
#> GSM182820     1  0.2537      0.817 0.920 0.000 0.080
#> GSM182821     2  0.7980      0.763 0.168 0.660 0.172
#> GSM182822     1  0.0000      0.852 1.000 0.000 0.000
#> GSM182823     1  0.0000      0.852 1.000 0.000 0.000
#> GSM182824     1  0.0237      0.851 0.996 0.004 0.000
#> GSM182825     1  0.7595      0.679 0.688 0.176 0.136

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM182755     1  0.6729     0.5235 0.680 0.164 0.036 0.120
#> GSM182756     3  0.0524     0.6912 0.000 0.004 0.988 0.008
#> GSM182757     2  0.6965     0.1002 0.000 0.460 0.428 0.112
#> GSM182758     3  0.0592     0.6924 0.000 0.016 0.984 0.000
#> GSM182759     2  0.4953     0.5750 0.000 0.776 0.120 0.104
#> GSM182760     3  0.0000     0.6912 0.000 0.000 1.000 0.000
#> GSM182761     2  0.6499     0.4017 0.000 0.612 0.276 0.112
#> GSM182762     2  0.9190     0.2241 0.308 0.416 0.132 0.144
#> GSM182763     3  0.6881    -0.1415 0.000 0.428 0.468 0.104
#> GSM182764     2  0.5628     0.5687 0.000 0.724 0.132 0.144
#> GSM182765     3  0.7149    -0.1672 0.000 0.416 0.452 0.132
#> GSM182766     2  0.6118     0.4034 0.000 0.672 0.208 0.120
#> GSM182767     3  0.0000     0.6912 0.000 0.000 1.000 0.000
#> GSM182768     3  0.2847     0.6644 0.016 0.004 0.896 0.084
#> GSM182769     3  0.4477     0.5567 0.108 0.000 0.808 0.084
#> GSM182770     2  0.0817     0.6132 0.000 0.976 0.000 0.024
#> GSM182771     2  0.4755     0.5506 0.000 0.760 0.040 0.200
#> GSM182772     2  0.1716     0.6073 0.000 0.936 0.000 0.064
#> GSM182773     3  0.2053     0.6773 0.000 0.004 0.924 0.072
#> GSM182774     1  0.7980     0.0107 0.480 0.108 0.364 0.048
#> GSM182775     3  0.4288     0.5917 0.084 0.004 0.828 0.084
#> GSM182776     3  0.6420     0.3871 0.140 0.104 0.712 0.044
#> GSM182777     3  0.0895     0.6917 0.000 0.020 0.976 0.004
#> GSM182802     2  0.5432     0.3913 0.032 0.652 0.000 0.316
#> GSM182803     1  0.0188     0.8107 0.996 0.000 0.000 0.004
#> GSM182804     1  0.8090     0.0666 0.408 0.168 0.024 0.400
#> GSM182805     2  0.5432     0.3913 0.032 0.652 0.000 0.316
#> GSM182806     1  0.0188     0.8107 0.996 0.000 0.000 0.004
#> GSM182807     1  0.0188     0.8107 0.996 0.000 0.000 0.004
#> GSM182808     1  0.0376     0.8086 0.992 0.000 0.004 0.004
#> GSM182809     3  0.8830    -0.2391 0.376 0.176 0.380 0.068
#> GSM182810     1  0.0188     0.8095 0.996 0.000 0.000 0.004
#> GSM182811     1  0.2334     0.7602 0.908 0.088 0.000 0.004
#> GSM182812     1  0.1867     0.7703 0.928 0.072 0.000 0.000
#> GSM182813     1  0.0000     0.8103 1.000 0.000 0.000 0.000
#> GSM182778     2  0.2589     0.6122 0.000 0.884 0.000 0.116
#> GSM182779     2  0.5527     0.5448 0.000 0.728 0.168 0.104
#> GSM182780     3  0.2081     0.6462 0.000 0.084 0.916 0.000
#> GSM182781     3  0.0804     0.6920 0.000 0.012 0.980 0.008
#> GSM182782     2  0.2589     0.6122 0.000 0.884 0.000 0.116
#> GSM182783     3  0.2081     0.6462 0.000 0.084 0.916 0.000
#> GSM182784     3  0.0000     0.6912 0.000 0.000 1.000 0.000
#> GSM182785     3  0.4662     0.4807 0.000 0.092 0.796 0.112
#> GSM182786     2  0.2589     0.6122 0.000 0.884 0.000 0.116
#> GSM182787     2  0.5119     0.5717 0.000 0.764 0.124 0.112
#> GSM182788     2  0.2589     0.6122 0.000 0.884 0.000 0.116
#> GSM182789     3  0.1716     0.6670 0.000 0.064 0.936 0.000
#> GSM182790     3  0.0000     0.6912 0.000 0.000 1.000 0.000
#> GSM182791     3  0.5574     0.1329 0.000 0.048 0.668 0.284
#> GSM182792     3  0.2452     0.6705 0.004 0.004 0.908 0.084
#> GSM182793     4  0.7598     0.0000 0.000 0.216 0.324 0.460
#> GSM182794     3  0.0000     0.6912 0.000 0.000 1.000 0.000
#> GSM182795     3  0.1637     0.6697 0.000 0.060 0.940 0.000
#> GSM182796     2  0.3610     0.5359 0.000 0.800 0.000 0.200
#> GSM182797     1  0.6556     0.1604 0.592 0.052 0.336 0.020
#> GSM182798     2  0.5594     0.2088 0.000 0.520 0.020 0.460
#> GSM182799     3  0.7332    -0.6284 0.000 0.164 0.480 0.356
#> GSM182800     3  0.7024    -0.3449 0.104 0.004 0.488 0.404
#> GSM182801     3  0.4801     0.5566 0.108 0.008 0.800 0.084
#> GSM182814     1  0.0188     0.8107 0.996 0.000 0.000 0.004
#> GSM182815     1  0.7279     0.4952 0.612 0.168 0.024 0.196
#> GSM182816     1  0.0000     0.8103 1.000 0.000 0.000 0.000
#> GSM182817     1  0.8675     0.0609 0.392 0.292 0.036 0.280
#> GSM182818     1  0.5500     0.6714 0.768 0.112 0.024 0.096
#> GSM182819     1  0.0188     0.8107 0.996 0.000 0.000 0.004
#> GSM182820     1  0.0188     0.8107 0.996 0.000 0.000 0.004
#> GSM182821     2  0.9411     0.1869 0.204 0.420 0.236 0.140
#> GSM182822     1  0.1733     0.7929 0.948 0.024 0.000 0.028
#> GSM182823     1  0.0188     0.8107 0.996 0.000 0.000 0.004
#> GSM182824     1  0.0188     0.8095 0.996 0.000 0.000 0.004
#> GSM182825     1  0.6429     0.4202 0.588 0.088 0.000 0.324

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>           class entropy silhouette    p1    p2    p3    p4    p5
#> GSM182755     1  0.5078     0.6285 0.744 0.000 0.040 0.072 0.144
#> GSM182756     3  0.4847     0.6573 0.000 0.080 0.720 0.004 0.196
#> GSM182757     5  0.3196     0.5940 0.004 0.000 0.192 0.000 0.804
#> GSM182758     3  0.4433     0.7153 0.000 0.080 0.784 0.016 0.120
#> GSM182759     5  0.1822     0.6002 0.004 0.000 0.024 0.036 0.936
#> GSM182760     3  0.3520     0.7170 0.000 0.080 0.840 0.004 0.076
#> GSM182761     5  0.1041     0.6063 0.004 0.000 0.032 0.000 0.964
#> GSM182762     5  0.5070     0.5568 0.036 0.000 0.052 0.184 0.728
#> GSM182763     5  0.5293     0.5639 0.004 0.000 0.236 0.092 0.668
#> GSM182764     5  0.2520     0.5802 0.004 0.000 0.012 0.096 0.888
#> GSM182765     5  0.5482     0.5547 0.004 0.000 0.268 0.092 0.636
#> GSM182766     5  0.7734     0.4409 0.004 0.108 0.204 0.184 0.500
#> GSM182767     3  0.3520     0.7170 0.000 0.080 0.840 0.004 0.076
#> GSM182768     3  0.4256     0.6991 0.076 0.012 0.812 0.088 0.012
#> GSM182769     3  0.4210     0.6866 0.132 0.012 0.804 0.040 0.012
#> GSM182770     2  0.5589     0.3201 0.000 0.548 0.000 0.372 0.080
#> GSM182771     5  0.6542     0.1980 0.004 0.200 0.000 0.300 0.496
#> GSM182772     2  0.5726     0.3196 0.004 0.548 0.000 0.368 0.080
#> GSM182773     3  0.2626     0.7264 0.040 0.012 0.908 0.028 0.012
#> GSM182774     1  0.6501    -0.1765 0.444 0.000 0.440 0.076 0.040
#> GSM182775     3  0.4210     0.6866 0.132 0.012 0.804 0.040 0.012
#> GSM182776     3  0.6980     0.4153 0.280 0.000 0.536 0.068 0.116
#> GSM182777     3  0.5611     0.7313 0.080 0.080 0.744 0.024 0.072
#> GSM182802     4  0.6217     0.1211 0.008 0.296 0.000 0.556 0.140
#> GSM182803     1  0.0290     0.8845 0.992 0.000 0.000 0.000 0.008
#> GSM182804     4  0.1668     0.4533 0.028 0.000 0.000 0.940 0.032
#> GSM182805     4  0.6712     0.1911 0.008 0.216 0.000 0.484 0.292
#> GSM182806     1  0.0000     0.8864 1.000 0.000 0.000 0.000 0.000
#> GSM182807     1  0.0000     0.8864 1.000 0.000 0.000 0.000 0.000
#> GSM182808     1  0.0000     0.8864 1.000 0.000 0.000 0.000 0.000
#> GSM182809     3  0.6643     0.1186 0.084 0.000 0.444 0.428 0.044
#> GSM182810     1  0.0290     0.8845 0.992 0.000 0.000 0.000 0.008
#> GSM182811     1  0.2723     0.7585 0.864 0.000 0.000 0.124 0.012
#> GSM182812     1  0.2074     0.8179 0.896 0.000 0.000 0.104 0.000
#> GSM182813     1  0.0162     0.8861 0.996 0.000 0.000 0.000 0.004
#> GSM182778     2  0.2488     0.7742 0.000 0.872 0.000 0.004 0.124
#> GSM182779     5  0.1041     0.6063 0.004 0.000 0.032 0.000 0.964
#> GSM182780     3  0.5740     0.4437 0.000 0.000 0.612 0.144 0.244
#> GSM182781     3  0.3367     0.6973 0.004 0.008 0.828 0.008 0.152
#> GSM182782     2  0.2488     0.7742 0.000 0.872 0.000 0.004 0.124
#> GSM182783     3  0.4764     0.6657 0.000 0.000 0.732 0.140 0.128
#> GSM182784     3  0.4847     0.6472 0.000 0.080 0.720 0.004 0.196
#> GSM182785     5  0.4299     0.4563 0.004 0.000 0.316 0.008 0.672
#> GSM182786     2  0.2488     0.7742 0.000 0.872 0.000 0.004 0.124
#> GSM182787     5  0.3433     0.5984 0.004 0.000 0.032 0.132 0.832
#> GSM182788     2  0.2488     0.7742 0.000 0.872 0.000 0.004 0.124
#> GSM182789     3  0.4270     0.4808 0.000 0.000 0.668 0.012 0.320
#> GSM182790     3  0.3520     0.7170 0.000 0.080 0.840 0.004 0.076
#> GSM182791     3  0.5468     0.4483 0.028 0.012 0.600 0.348 0.012
#> GSM182792     3  0.3778     0.7135 0.068 0.012 0.844 0.064 0.012
#> GSM182793     4  0.1808     0.4393 0.000 0.020 0.004 0.936 0.040
#> GSM182794     3  0.3520     0.7170 0.000 0.080 0.840 0.004 0.076
#> GSM182795     3  0.2964     0.7208 0.000 0.000 0.856 0.024 0.120
#> GSM182796     5  0.6530     0.1948 0.004 0.200 0.000 0.296 0.500
#> GSM182797     1  0.4366     0.7140 0.804 0.000 0.044 0.064 0.088
#> GSM182798     4  0.5051    -0.2398 0.004 0.024 0.000 0.492 0.480
#> GSM182799     4  0.5224     0.1540 0.004 0.016 0.300 0.648 0.032
#> GSM182800     3  0.6572     0.4554 0.124 0.020 0.580 0.264 0.012
#> GSM182801     3  0.4429     0.6608 0.168 0.012 0.776 0.032 0.012
#> GSM182814     1  0.0290     0.8861 0.992 0.000 0.000 0.008 0.000
#> GSM182815     4  0.4537     0.4142 0.204 0.016 0.000 0.744 0.036
#> GSM182816     1  0.0290     0.8861 0.992 0.000 0.000 0.008 0.000
#> GSM182817     5  0.7397    -0.0263 0.316 0.028 0.000 0.288 0.368
#> GSM182818     4  0.4961    -0.0218 0.448 0.000 0.000 0.524 0.028
#> GSM182819     1  0.0000     0.8864 1.000 0.000 0.000 0.000 0.000
#> GSM182820     1  0.0162     0.8861 0.996 0.000 0.000 0.000 0.004
#> GSM182821     5  0.7226     0.4107 0.100 0.000 0.148 0.200 0.552
#> GSM182822     1  0.1117     0.8698 0.964 0.000 0.000 0.016 0.020
#> GSM182823     1  0.0290     0.8861 0.992 0.000 0.000 0.008 0.000
#> GSM182824     1  0.0510     0.8838 0.984 0.000 0.000 0.016 0.000
#> GSM182825     1  0.4235     0.5069 0.656 0.000 0.000 0.336 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
#> GSM182755     1  0.7315    0.28900 0.496 0.000 0.076 0.220 0.164 0.044
#> GSM182756     3  0.4520    0.80343 0.000 0.000 0.704 0.000 0.128 0.168
#> GSM182757     5  0.1918    0.62799 0.000 0.000 0.008 0.000 0.904 0.088
#> GSM182758     3  0.5948    0.17860 0.000 0.000 0.428 0.000 0.348 0.224
#> GSM182759     5  0.0508    0.62772 0.000 0.004 0.000 0.012 0.984 0.000
#> GSM182760     3  0.3671    0.85313 0.000 0.000 0.756 0.000 0.036 0.208
#> GSM182761     5  0.0146    0.62704 0.000 0.004 0.000 0.000 0.996 0.000
#> GSM182762     5  0.5921    0.54168 0.040 0.000 0.072 0.200 0.644 0.044
#> GSM182763     5  0.3981    0.59660 0.000 0.000 0.076 0.008 0.772 0.144
#> GSM182764     5  0.2946    0.53332 0.004 0.004 0.000 0.184 0.808 0.000
#> GSM182765     5  0.5781    0.58033 0.000 0.000 0.076 0.140 0.640 0.144
#> GSM182766     5  0.6414    0.38445 0.004 0.068 0.008 0.252 0.564 0.104
#> GSM182767     3  0.3612    0.85523 0.000 0.000 0.764 0.000 0.036 0.200
#> GSM182768     6  0.2582    0.75679 0.028 0.000 0.060 0.008 0.012 0.892
#> GSM182769     6  0.1858    0.77898 0.092 0.000 0.000 0.000 0.004 0.904
#> GSM182770     4  0.2662    0.61574 0.004 0.152 0.000 0.840 0.004 0.000
#> GSM182771     4  0.4634    0.39164 0.004 0.056 0.000 0.640 0.300 0.000
#> GSM182772     4  0.2662    0.61574 0.004 0.152 0.000 0.840 0.004 0.000
#> GSM182773     6  0.2326    0.71406 0.008 0.000 0.092 0.000 0.012 0.888
#> GSM182774     1  0.5613    0.42915 0.596 0.000 0.004 0.124 0.016 0.260
#> GSM182775     6  0.1806    0.77996 0.088 0.000 0.000 0.000 0.004 0.908
#> GSM182776     6  0.5728    0.34230 0.336 0.000 0.008 0.104 0.012 0.540
#> GSM182777     6  0.3363    0.70355 0.036 0.000 0.108 0.000 0.024 0.832
#> GSM182802     4  0.2243    0.62775 0.004 0.112 0.000 0.880 0.004 0.000
#> GSM182803     1  0.0692    0.84242 0.976 0.000 0.000 0.000 0.004 0.020
#> GSM182804     4  0.5977    0.44309 0.220 0.000 0.076 0.600 0.000 0.104
#> GSM182805     4  0.2641    0.63762 0.004 0.072 0.000 0.876 0.048 0.000
#> GSM182806     1  0.1866    0.83732 0.908 0.000 0.084 0.000 0.008 0.000
#> GSM182807     1  0.1970    0.83503 0.900 0.000 0.092 0.000 0.008 0.000
#> GSM182808     1  0.1866    0.83726 0.908 0.000 0.084 0.000 0.008 0.000
#> GSM182809     4  0.5777    0.27586 0.320 0.000 0.004 0.520 0.004 0.152
#> GSM182810     1  0.0458    0.84276 0.984 0.000 0.000 0.000 0.000 0.016
#> GSM182811     1  0.2950    0.73887 0.828 0.000 0.000 0.148 0.000 0.024
#> GSM182812     1  0.1994    0.82327 0.920 0.004 0.008 0.052 0.000 0.016
#> GSM182813     1  0.1918    0.83616 0.904 0.000 0.088 0.000 0.008 0.000
#> GSM182778     2  0.0260    1.00000 0.000 0.992 0.000 0.000 0.008 0.000
#> GSM182779     5  0.0146    0.62704 0.000 0.004 0.000 0.000 0.996 0.000
#> GSM182780     5  0.7000    0.09353 0.000 0.004 0.252 0.052 0.380 0.312
#> GSM182781     3  0.4889    0.71853 0.000 0.000 0.604 0.000 0.084 0.312
#> GSM182782     2  0.0260    1.00000 0.000 0.992 0.000 0.000 0.008 0.000
#> GSM182783     5  0.6925    0.00434 0.000 0.004 0.252 0.044 0.368 0.332
#> GSM182784     3  0.4218    0.81239 0.000 0.000 0.736 0.000 0.108 0.156
#> GSM182785     5  0.3958    0.57678 0.000 0.000 0.128 0.000 0.764 0.108
#> GSM182786     2  0.0260    1.00000 0.000 0.992 0.000 0.000 0.008 0.000
#> GSM182787     5  0.0935    0.62754 0.000 0.004 0.000 0.032 0.964 0.000
#> GSM182788     2  0.0260    1.00000 0.000 0.992 0.000 0.000 0.008 0.000
#> GSM182789     5  0.5826    0.18516 0.000 0.000 0.272 0.000 0.492 0.236
#> GSM182790     3  0.3612    0.85523 0.000 0.000 0.764 0.000 0.036 0.200
#> GSM182791     6  0.3317    0.65497 0.004 0.000 0.088 0.080 0.000 0.828
#> GSM182792     6  0.2689    0.76197 0.040 0.000 0.060 0.004 0.012 0.884
#> GSM182793     4  0.4086    0.58118 0.000 0.004 0.136 0.768 0.004 0.088
#> GSM182794     3  0.3612    0.85523 0.000 0.000 0.764 0.000 0.036 0.200
#> GSM182795     5  0.6071   -0.02123 0.000 0.000 0.272 0.000 0.392 0.336
#> GSM182796     4  0.5137    0.40130 0.004 0.104 0.000 0.604 0.288 0.000
#> GSM182797     1  0.6036    0.60490 0.644 0.000 0.088 0.104 0.016 0.148
#> GSM182798     4  0.5503    0.44009 0.004 0.028 0.076 0.624 0.264 0.004
#> GSM182799     4  0.5554    0.15932 0.000 0.000 0.136 0.456 0.000 0.408
#> GSM182800     6  0.3903    0.61493 0.016 0.000 0.084 0.108 0.000 0.792
#> GSM182801     6  0.1958    0.77416 0.100 0.000 0.000 0.000 0.004 0.896
#> GSM182814     1  0.0405    0.84315 0.988 0.004 0.008 0.000 0.000 0.000
#> GSM182815     4  0.3855    0.46702 0.272 0.000 0.000 0.704 0.000 0.024
#> GSM182816     1  0.0405    0.84315 0.988 0.004 0.008 0.000 0.000 0.000
#> GSM182817     4  0.4733    0.62730 0.124 0.008 0.008 0.752 0.084 0.024
#> GSM182818     1  0.4474    0.24678 0.560 0.000 0.004 0.412 0.000 0.024
#> GSM182819     1  0.0260    0.84535 0.992 0.000 0.008 0.000 0.000 0.000
#> GSM182820     1  0.1970    0.83503 0.900 0.000 0.092 0.000 0.008 0.000
#> GSM182821     5  0.6629    0.48312 0.040 0.000 0.092 0.228 0.572 0.068
#> GSM182822     1  0.1844    0.84096 0.932 0.000 0.028 0.012 0.004 0.024
#> GSM182823     1  0.0405    0.84315 0.988 0.004 0.008 0.000 0.000 0.000
#> GSM182824     1  0.0508    0.84357 0.984 0.004 0.012 0.000 0.000 0.000
#> GSM182825     1  0.5371    0.60795 0.684 0.000 0.076 0.136 0.000 0.104

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

consensus_heatmap(res, k = 2)

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 stress(p) development.stage(p) k
#> SD:mclust 69    0.7321             3.22e-04 2
#> SD:mclust 69    0.4780             6.94e-14 3
#> SD:mclust 48    0.8344             3.14e-10 4
#> SD:mclust 48    0.0798             1.07e-08 5
#> SD:mclust 53    0.2552             4.92e-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.


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

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

collect_plots(res)

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.779           0.889       0.953         0.5014 0.501   0.501
#> 3 3 0.756           0.863       0.934         0.3191 0.752   0.544
#> 4 4 0.728           0.769       0.886         0.1240 0.779   0.457
#> 5 5 0.731           0.688       0.848         0.0434 0.922   0.723
#> 6 6 0.673           0.521       0.743         0.0477 0.923   0.715

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
#> GSM182755     1  0.4690      0.856 0.900 0.100
#> GSM182756     2  0.9129      0.449 0.328 0.672
#> GSM182757     2  0.0000      0.971 0.000 1.000
#> GSM182758     2  0.0000      0.971 0.000 1.000
#> GSM182759     2  0.0000      0.971 0.000 1.000
#> GSM182760     1  0.6712      0.782 0.824 0.176
#> GSM182761     2  0.0000      0.971 0.000 1.000
#> GSM182762     1  0.8861      0.605 0.696 0.304
#> GSM182763     2  0.0000      0.971 0.000 1.000
#> GSM182764     2  0.0000      0.971 0.000 1.000
#> GSM182765     2  0.0672      0.964 0.008 0.992
#> GSM182766     2  0.0000      0.971 0.000 1.000
#> GSM182767     1  0.9988      0.169 0.520 0.480
#> GSM182768     1  0.0000      0.930 1.000 0.000
#> GSM182769     1  0.0000      0.930 1.000 0.000
#> GSM182770     2  0.0000      0.971 0.000 1.000
#> GSM182771     2  0.0000      0.971 0.000 1.000
#> GSM182772     2  0.0000      0.971 0.000 1.000
#> GSM182773     1  0.0000      0.930 1.000 0.000
#> GSM182774     1  0.0000      0.930 1.000 0.000
#> GSM182775     1  0.0000      0.930 1.000 0.000
#> GSM182776     1  0.0000      0.930 1.000 0.000
#> GSM182777     1  0.0000      0.930 1.000 0.000
#> GSM182802     2  0.0000      0.971 0.000 1.000
#> GSM182803     1  0.0000      0.930 1.000 0.000
#> GSM182804     1  0.0672      0.925 0.992 0.008
#> GSM182805     2  0.0000      0.971 0.000 1.000
#> GSM182806     1  0.0000      0.930 1.000 0.000
#> GSM182807     1  0.0000      0.930 1.000 0.000
#> GSM182808     1  0.0000      0.930 1.000 0.000
#> GSM182809     1  0.2423      0.903 0.960 0.040
#> GSM182810     1  0.0000      0.930 1.000 0.000
#> GSM182811     1  0.0000      0.930 1.000 0.000
#> GSM182812     1  0.0000      0.930 1.000 0.000
#> GSM182813     1  0.0000      0.930 1.000 0.000
#> GSM182778     2  0.0000      0.971 0.000 1.000
#> GSM182779     2  0.0000      0.971 0.000 1.000
#> GSM182780     2  0.0000      0.971 0.000 1.000
#> GSM182781     1  0.7299      0.751 0.796 0.204
#> GSM182782     2  0.0000      0.971 0.000 1.000
#> GSM182783     2  0.0000      0.971 0.000 1.000
#> GSM182784     2  0.0938      0.961 0.012 0.988
#> GSM182785     2  0.0000      0.971 0.000 1.000
#> GSM182786     2  0.0000      0.971 0.000 1.000
#> GSM182787     2  0.0000      0.971 0.000 1.000
#> GSM182788     2  0.0000      0.971 0.000 1.000
#> GSM182789     2  0.0000      0.971 0.000 1.000
#> GSM182790     1  0.7453      0.741 0.788 0.212
#> GSM182791     1  0.0938      0.923 0.988 0.012
#> GSM182792     1  0.0000      0.930 1.000 0.000
#> GSM182793     2  0.0000      0.971 0.000 1.000
#> GSM182794     1  0.8327      0.671 0.736 0.264
#> GSM182795     2  0.0000      0.971 0.000 1.000
#> GSM182796     2  0.0000      0.971 0.000 1.000
#> GSM182797     1  0.0000      0.930 1.000 0.000
#> GSM182798     2  0.0000      0.971 0.000 1.000
#> GSM182799     1  0.9795      0.284 0.584 0.416
#> GSM182800     1  0.0000      0.930 1.000 0.000
#> GSM182801     1  0.0000      0.930 1.000 0.000
#> GSM182814     1  0.0000      0.930 1.000 0.000
#> GSM182815     2  0.9170      0.482 0.332 0.668
#> GSM182816     1  0.0000      0.930 1.000 0.000
#> GSM182817     1  0.9427      0.499 0.640 0.360
#> GSM182818     1  0.0000      0.930 1.000 0.000
#> GSM182819     1  0.0000      0.930 1.000 0.000
#> GSM182820     1  0.0000      0.930 1.000 0.000
#> GSM182821     2  0.4815      0.859 0.104 0.896
#> GSM182822     1  0.0000      0.930 1.000 0.000
#> GSM182823     1  0.0000      0.930 1.000 0.000
#> GSM182824     1  0.0000      0.930 1.000 0.000
#> GSM182825     1  0.0000      0.930 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
#> GSM182755     3  0.0000      0.905 0.000 0.000 1.000
#> GSM182756     3  0.0892      0.894 0.000 0.020 0.980
#> GSM182757     2  0.2165      0.911 0.000 0.936 0.064
#> GSM182758     2  0.4452      0.803 0.000 0.808 0.192
#> GSM182759     2  0.0000      0.947 0.000 1.000 0.000
#> GSM182760     3  0.0000      0.905 0.000 0.000 1.000
#> GSM182761     2  0.0424      0.944 0.000 0.992 0.008
#> GSM182762     3  0.1031      0.892 0.000 0.024 0.976
#> GSM182763     2  0.0000      0.947 0.000 1.000 0.000
#> GSM182764     2  0.0000      0.947 0.000 1.000 0.000
#> GSM182765     2  0.0424      0.943 0.000 0.992 0.008
#> GSM182766     2  0.0000      0.947 0.000 1.000 0.000
#> GSM182767     3  0.0000      0.905 0.000 0.000 1.000
#> GSM182768     3  0.2066      0.878 0.060 0.000 0.940
#> GSM182769     3  0.0000      0.905 0.000 0.000 1.000
#> GSM182770     2  0.0000      0.947 0.000 1.000 0.000
#> GSM182771     2  0.0000      0.947 0.000 1.000 0.000
#> GSM182772     2  0.0000      0.947 0.000 1.000 0.000
#> GSM182773     3  0.0000      0.905 0.000 0.000 1.000
#> GSM182774     3  0.4887      0.742 0.228 0.000 0.772
#> GSM182775     3  0.0000      0.905 0.000 0.000 1.000
#> GSM182776     3  0.0000      0.905 0.000 0.000 1.000
#> GSM182777     3  0.0000      0.905 0.000 0.000 1.000
#> GSM182802     1  0.4974      0.654 0.764 0.236 0.000
#> GSM182803     3  0.6154      0.387 0.408 0.000 0.592
#> GSM182804     1  0.0000      0.910 1.000 0.000 0.000
#> GSM182805     2  0.0747      0.937 0.016 0.984 0.000
#> GSM182806     3  0.4452      0.783 0.192 0.000 0.808
#> GSM182807     3  0.3816      0.825 0.148 0.000 0.852
#> GSM182808     3  0.4121      0.807 0.168 0.000 0.832
#> GSM182809     1  0.0000      0.910 1.000 0.000 0.000
#> GSM182810     1  0.0000      0.910 1.000 0.000 0.000
#> GSM182811     1  0.0000      0.910 1.000 0.000 0.000
#> GSM182812     1  0.0000      0.910 1.000 0.000 0.000
#> GSM182813     3  0.3752      0.828 0.144 0.000 0.856
#> GSM182778     2  0.0000      0.947 0.000 1.000 0.000
#> GSM182779     2  0.0000      0.947 0.000 1.000 0.000
#> GSM182780     2  0.0000      0.947 0.000 1.000 0.000
#> GSM182781     3  0.0000      0.905 0.000 0.000 1.000
#> GSM182782     2  0.0000      0.947 0.000 1.000 0.000
#> GSM182783     2  0.3482      0.864 0.000 0.872 0.128
#> GSM182784     3  0.4842      0.652 0.000 0.224 0.776
#> GSM182785     2  0.4842      0.765 0.000 0.776 0.224
#> GSM182786     2  0.0000      0.947 0.000 1.000 0.000
#> GSM182787     2  0.0000      0.947 0.000 1.000 0.000
#> GSM182788     2  0.0000      0.947 0.000 1.000 0.000
#> GSM182789     2  0.3752      0.850 0.000 0.856 0.144
#> GSM182790     3  0.0000      0.905 0.000 0.000 1.000
#> GSM182791     1  0.9891      0.112 0.404 0.280 0.316
#> GSM182792     3  0.0000      0.905 0.000 0.000 1.000
#> GSM182793     2  0.5431      0.583 0.284 0.716 0.000
#> GSM182794     3  0.0424      0.901 0.000 0.008 0.992
#> GSM182795     2  0.3619      0.858 0.000 0.864 0.136
#> GSM182796     2  0.0000      0.947 0.000 1.000 0.000
#> GSM182797     3  0.0000      0.905 0.000 0.000 1.000
#> GSM182798     2  0.0000      0.947 0.000 1.000 0.000
#> GSM182799     1  0.0000      0.910 1.000 0.000 0.000
#> GSM182800     1  0.2625      0.853 0.916 0.000 0.084
#> GSM182801     3  0.1411      0.893 0.036 0.000 0.964
#> GSM182814     1  0.0000      0.910 1.000 0.000 0.000
#> GSM182815     1  0.0000      0.910 1.000 0.000 0.000
#> GSM182816     1  0.4887      0.662 0.772 0.000 0.228
#> GSM182817     2  0.3921      0.859 0.036 0.884 0.080
#> GSM182818     1  0.0000      0.910 1.000 0.000 0.000
#> GSM182819     3  0.4974      0.731 0.236 0.000 0.764
#> GSM182820     3  0.3686      0.831 0.140 0.000 0.860
#> GSM182821     2  0.0000      0.947 0.000 1.000 0.000
#> GSM182822     1  0.3752      0.787 0.856 0.000 0.144
#> GSM182823     1  0.1031      0.900 0.976 0.000 0.024
#> GSM182824     1  0.1031      0.900 0.976 0.000 0.024
#> GSM182825     1  0.0000      0.910 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
#> GSM182755     1  0.0469      0.824 0.988 0.000 0.012 0.000
#> GSM182756     3  0.4431      0.640 0.304 0.000 0.696 0.000
#> GSM182757     2  0.4040      0.683 0.000 0.752 0.248 0.000
#> GSM182758     3  0.0592      0.877 0.000 0.016 0.984 0.000
#> GSM182759     2  0.0188      0.950 0.000 0.996 0.004 0.000
#> GSM182760     3  0.0469      0.879 0.012 0.000 0.988 0.000
#> GSM182761     2  0.2704      0.847 0.000 0.876 0.124 0.000
#> GSM182762     1  0.4655      0.598 0.760 0.208 0.032 0.000
#> GSM182763     2  0.0817      0.941 0.000 0.976 0.024 0.000
#> GSM182764     2  0.0000      0.950 0.000 1.000 0.000 0.000
#> GSM182765     2  0.3899      0.825 0.052 0.840 0.108 0.000
#> GSM182766     2  0.0707      0.943 0.000 0.980 0.020 0.000
#> GSM182767     3  0.0592      0.878 0.016 0.000 0.984 0.000
#> GSM182768     3  0.0707      0.872 0.000 0.000 0.980 0.020
#> GSM182769     3  0.2999      0.814 0.132 0.000 0.864 0.004
#> GSM182770     2  0.0188      0.949 0.000 0.996 0.004 0.000
#> GSM182771     2  0.0188      0.949 0.000 0.996 0.000 0.004
#> GSM182772     2  0.0000      0.950 0.000 1.000 0.000 0.000
#> GSM182773     3  0.0188      0.878 0.004 0.000 0.996 0.000
#> GSM182774     1  0.4741      0.624 0.744 0.000 0.028 0.228
#> GSM182775     3  0.2408      0.834 0.104 0.000 0.896 0.000
#> GSM182776     1  0.4543      0.362 0.676 0.000 0.324 0.000
#> GSM182777     3  0.4624      0.587 0.340 0.000 0.660 0.000
#> GSM182802     2  0.1716      0.903 0.000 0.936 0.000 0.064
#> GSM182803     1  0.2011      0.762 0.920 0.000 0.000 0.080
#> GSM182804     4  0.0000      0.694 0.000 0.000 0.000 1.000
#> GSM182805     2  0.0524      0.944 0.004 0.988 0.000 0.008
#> GSM182806     1  0.0336      0.827 0.992 0.000 0.000 0.008
#> GSM182807     1  0.0188      0.829 0.996 0.000 0.000 0.004
#> GSM182808     1  0.0188      0.829 0.996 0.000 0.000 0.004
#> GSM182809     4  0.1940      0.718 0.076 0.000 0.000 0.924
#> GSM182810     4  0.4250      0.692 0.276 0.000 0.000 0.724
#> GSM182811     4  0.4706      0.700 0.248 0.020 0.000 0.732
#> GSM182812     4  0.3074      0.727 0.152 0.000 0.000 0.848
#> GSM182813     1  0.0000      0.828 1.000 0.000 0.000 0.000
#> GSM182778     2  0.0188      0.950 0.000 0.996 0.004 0.000
#> GSM182779     2  0.0188      0.950 0.000 0.996 0.004 0.000
#> GSM182780     3  0.0895      0.874 0.000 0.020 0.976 0.004
#> GSM182781     3  0.4679      0.559 0.352 0.000 0.648 0.000
#> GSM182782     2  0.0000      0.950 0.000 1.000 0.000 0.000
#> GSM182783     3  0.0707      0.874 0.000 0.020 0.980 0.000
#> GSM182784     3  0.1151      0.877 0.024 0.008 0.968 0.000
#> GSM182785     3  0.5375      0.710 0.116 0.140 0.744 0.000
#> GSM182786     2  0.0188      0.950 0.000 0.996 0.004 0.000
#> GSM182787     2  0.0336      0.949 0.000 0.992 0.008 0.000
#> GSM182788     2  0.0188      0.950 0.000 0.996 0.004 0.000
#> GSM182789     3  0.0592      0.877 0.000 0.016 0.984 0.000
#> GSM182790     3  0.0921      0.877 0.028 0.000 0.972 0.000
#> GSM182791     3  0.2589      0.807 0.000 0.000 0.884 0.116
#> GSM182792     3  0.0188      0.877 0.000 0.000 0.996 0.004
#> GSM182793     4  0.7469      0.180 0.000 0.312 0.200 0.488
#> GSM182794     3  0.0469      0.879 0.012 0.000 0.988 0.000
#> GSM182795     3  0.0592      0.877 0.000 0.016 0.984 0.000
#> GSM182796     2  0.0000      0.950 0.000 1.000 0.000 0.000
#> GSM182797     1  0.0592      0.821 0.984 0.000 0.016 0.000
#> GSM182798     2  0.0000      0.950 0.000 1.000 0.000 0.000
#> GSM182799     3  0.4624      0.509 0.000 0.000 0.660 0.340
#> GSM182800     4  0.4713      0.223 0.000 0.000 0.360 0.640
#> GSM182801     3  0.4744      0.651 0.284 0.000 0.704 0.012
#> GSM182814     4  0.4454      0.662 0.308 0.000 0.000 0.692
#> GSM182815     4  0.0188      0.694 0.000 0.004 0.000 0.996
#> GSM182816     4  0.4331      0.683 0.288 0.000 0.000 0.712
#> GSM182817     2  0.4399      0.677 0.224 0.760 0.000 0.016
#> GSM182818     4  0.3528      0.721 0.192 0.000 0.000 0.808
#> GSM182819     1  0.1022      0.811 0.968 0.000 0.000 0.032
#> GSM182820     1  0.0188      0.829 0.996 0.000 0.000 0.004
#> GSM182821     2  0.1114      0.941 0.016 0.972 0.008 0.004
#> GSM182822     4  0.4994      0.334 0.480 0.000 0.000 0.520
#> GSM182823     1  0.4998     -0.336 0.512 0.000 0.000 0.488
#> GSM182824     4  0.4277      0.689 0.280 0.000 0.000 0.720
#> GSM182825     4  0.0000      0.694 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
#> GSM182755     2  0.0566     0.4845 0.012 0.984 0.000 0.000 0.004
#> GSM182756     3  0.4039     0.6866 0.000 0.268 0.720 0.004 0.008
#> GSM182757     5  0.4644     0.7539 0.000 0.092 0.116 0.020 0.772
#> GSM182758     3  0.0854     0.8388 0.000 0.012 0.976 0.008 0.004
#> GSM182759     5  0.0671     0.8875 0.000 0.004 0.000 0.016 0.980
#> GSM182760     3  0.2068     0.8259 0.000 0.092 0.904 0.004 0.000
#> GSM182761     5  0.4237     0.7061 0.000 0.008 0.212 0.028 0.752
#> GSM182762     2  0.2337     0.4499 0.004 0.904 0.008 0.004 0.080
#> GSM182763     5  0.1612     0.8856 0.000 0.024 0.016 0.012 0.948
#> GSM182764     5  0.1251     0.8869 0.000 0.036 0.000 0.008 0.956
#> GSM182765     5  0.4880     0.6642 0.000 0.256 0.012 0.040 0.692
#> GSM182766     5  0.1800     0.8769 0.000 0.000 0.048 0.020 0.932
#> GSM182767     3  0.0968     0.8351 0.000 0.012 0.972 0.012 0.004
#> GSM182768     3  0.0510     0.8370 0.000 0.000 0.984 0.016 0.000
#> GSM182769     3  0.3651     0.7624 0.028 0.160 0.808 0.004 0.000
#> GSM182770     5  0.0324     0.8891 0.000 0.000 0.004 0.004 0.992
#> GSM182771     5  0.2376     0.8647 0.000 0.052 0.000 0.044 0.904
#> GSM182772     5  0.0510     0.8877 0.000 0.000 0.000 0.016 0.984
#> GSM182773     3  0.0162     0.8370 0.000 0.000 0.996 0.004 0.000
#> GSM182774     2  0.5940     0.0606 0.036 0.564 0.048 0.352 0.000
#> GSM182775     3  0.4029     0.6257 0.000 0.316 0.680 0.004 0.000
#> GSM182776     2  0.5771    -0.1441 0.088 0.480 0.432 0.000 0.000
#> GSM182777     3  0.3730     0.6714 0.000 0.288 0.712 0.000 0.000
#> GSM182802     5  0.0798     0.8877 0.008 0.000 0.000 0.016 0.976
#> GSM182803     1  0.1851     0.8032 0.912 0.088 0.000 0.000 0.000
#> GSM182804     4  0.1892     0.8827 0.080 0.000 0.004 0.916 0.000
#> GSM182805     5  0.3601     0.7741 0.136 0.008 0.000 0.032 0.824
#> GSM182806     2  0.4397     0.0286 0.432 0.564 0.004 0.000 0.000
#> GSM182807     2  0.4452    -0.1609 0.496 0.500 0.004 0.000 0.000
#> GSM182808     1  0.3317     0.7112 0.804 0.188 0.004 0.004 0.000
#> GSM182809     1  0.1419     0.8128 0.956 0.016 0.012 0.016 0.000
#> GSM182810     1  0.0404     0.8255 0.988 0.000 0.000 0.012 0.000
#> GSM182811     1  0.0162     0.8259 0.996 0.000 0.000 0.004 0.000
#> GSM182812     1  0.4088     0.3514 0.632 0.000 0.000 0.368 0.000
#> GSM182813     2  0.4101     0.2680 0.332 0.664 0.004 0.000 0.000
#> GSM182778     5  0.0833     0.8876 0.000 0.004 0.004 0.016 0.976
#> GSM182779     5  0.1059     0.8897 0.000 0.020 0.004 0.008 0.968
#> GSM182780     3  0.1704     0.8191 0.000 0.004 0.928 0.068 0.000
#> GSM182781     2  0.4659    -0.3278 0.000 0.500 0.488 0.012 0.000
#> GSM182782     5  0.0867     0.8885 0.000 0.008 0.008 0.008 0.976
#> GSM182783     3  0.0613     0.8368 0.000 0.004 0.984 0.008 0.004
#> GSM182784     3  0.1560     0.8364 0.000 0.028 0.948 0.020 0.004
#> GSM182785     3  0.4272     0.7596 0.000 0.156 0.784 0.020 0.040
#> GSM182786     5  0.0727     0.8881 0.000 0.004 0.004 0.012 0.980
#> GSM182787     5  0.3502     0.8164 0.004 0.012 0.112 0.028 0.844
#> GSM182788     5  0.0727     0.8883 0.000 0.004 0.004 0.012 0.980
#> GSM182789     3  0.1710     0.8226 0.000 0.012 0.944 0.024 0.020
#> GSM182790     3  0.1965     0.8231 0.000 0.096 0.904 0.000 0.000
#> GSM182791     3  0.4171     0.3765 0.000 0.000 0.604 0.396 0.000
#> GSM182792     3  0.2149     0.8322 0.000 0.048 0.916 0.036 0.000
#> GSM182793     4  0.1547     0.8626 0.004 0.000 0.016 0.948 0.032
#> GSM182794     3  0.1444     0.8403 0.000 0.040 0.948 0.012 0.000
#> GSM182795     3  0.0867     0.8347 0.000 0.008 0.976 0.008 0.008
#> GSM182796     5  0.0566     0.8880 0.000 0.004 0.000 0.012 0.984
#> GSM182797     2  0.1357     0.4966 0.048 0.948 0.004 0.000 0.000
#> GSM182798     5  0.4761     0.4497 0.000 0.028 0.000 0.356 0.616
#> GSM182799     3  0.3968     0.6197 0.004 0.004 0.716 0.276 0.000
#> GSM182800     4  0.1808     0.8718 0.020 0.004 0.040 0.936 0.000
#> GSM182801     3  0.5877     0.3387 0.072 0.384 0.532 0.012 0.000
#> GSM182814     1  0.0451     0.8263 0.988 0.004 0.000 0.008 0.000
#> GSM182815     1  0.3838     0.5228 0.716 0.000 0.004 0.280 0.000
#> GSM182816     1  0.1153     0.8269 0.964 0.024 0.004 0.008 0.000
#> GSM182817     5  0.4202     0.6611 0.228 0.012 0.000 0.016 0.744
#> GSM182818     1  0.1314     0.8174 0.960 0.012 0.012 0.016 0.000
#> GSM182819     1  0.3160     0.7241 0.808 0.188 0.004 0.000 0.000
#> GSM182820     1  0.4199     0.5406 0.692 0.296 0.004 0.008 0.000
#> GSM182821     1  0.6585     0.3676 0.600 0.024 0.080 0.032 0.264
#> GSM182822     1  0.1631     0.8204 0.948 0.020 0.004 0.024 0.004
#> GSM182823     1  0.2233     0.7981 0.892 0.104 0.000 0.004 0.000
#> GSM182824     1  0.1059     0.8273 0.968 0.020 0.004 0.008 0.000
#> GSM182825     4  0.3003     0.7929 0.188 0.000 0.000 0.812 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
#> GSM182755     5  0.0810     0.4413 0.004 0.008 0.008 0.000 0.976 0.004
#> GSM182756     3  0.5067     0.4997 0.004 0.008 0.672 0.000 0.136 0.180
#> GSM182757     3  0.7243    -0.2993 0.000 0.276 0.320 0.000 0.088 0.316
#> GSM182758     3  0.2300     0.6237 0.000 0.000 0.856 0.000 0.000 0.144
#> GSM182759     2  0.0653     0.8145 0.000 0.980 0.000 0.004 0.012 0.004
#> GSM182760     3  0.3017     0.6274 0.000 0.000 0.840 0.000 0.052 0.108
#> GSM182761     2  0.6418    -0.3255 0.000 0.336 0.336 0.000 0.012 0.316
#> GSM182762     5  0.5215    -0.1076 0.000 0.124 0.060 0.000 0.696 0.120
#> GSM182763     2  0.3475     0.7871 0.000 0.836 0.016 0.012 0.040 0.096
#> GSM182764     2  0.2344     0.8055 0.000 0.896 0.004 0.000 0.048 0.052
#> GSM182765     2  0.5754     0.3108 0.000 0.544 0.028 0.020 0.356 0.052
#> GSM182766     2  0.4046     0.6491 0.000 0.752 0.068 0.004 0.000 0.176
#> GSM182767     3  0.2805     0.5964 0.000 0.000 0.812 0.004 0.000 0.184
#> GSM182768     3  0.2253     0.6254 0.004 0.000 0.896 0.012 0.004 0.084
#> GSM182769     3  0.3286     0.6091 0.016 0.000 0.832 0.000 0.116 0.036
#> GSM182770     2  0.0790     0.8182 0.000 0.968 0.000 0.000 0.000 0.032
#> GSM182771     2  0.2925     0.7749 0.000 0.864 0.000 0.012 0.064 0.060
#> GSM182772     2  0.1010     0.8160 0.000 0.960 0.000 0.004 0.000 0.036
#> GSM182773     3  0.1888     0.6353 0.000 0.000 0.916 0.004 0.012 0.068
#> GSM182774     6  0.8042     0.0000 0.060 0.016 0.184 0.060 0.288 0.392
#> GSM182775     3  0.3784     0.5428 0.000 0.000 0.736 0.004 0.236 0.024
#> GSM182776     3  0.6685    -0.1851 0.064 0.000 0.460 0.000 0.304 0.172
#> GSM182777     3  0.3669     0.5887 0.008 0.000 0.784 0.004 0.176 0.028
#> GSM182802     2  0.2251     0.7981 0.036 0.904 0.000 0.008 0.000 0.052
#> GSM182803     1  0.2726     0.6584 0.856 0.000 0.000 0.000 0.112 0.032
#> GSM182804     4  0.1088     0.6307 0.016 0.000 0.000 0.960 0.000 0.024
#> GSM182805     2  0.4218     0.6888 0.112 0.748 0.000 0.000 0.004 0.136
#> GSM182806     5  0.4283     0.2955 0.384 0.000 0.000 0.000 0.592 0.024
#> GSM182807     1  0.3975     0.0407 0.544 0.000 0.000 0.000 0.452 0.004
#> GSM182808     1  0.3807     0.5261 0.740 0.000 0.004 0.000 0.228 0.028
#> GSM182809     1  0.3146     0.6786 0.844 0.000 0.012 0.028 0.004 0.112
#> GSM182810     1  0.3367     0.6644 0.804 0.000 0.000 0.012 0.020 0.164
#> GSM182811     1  0.2482     0.6784 0.848 0.000 0.000 0.000 0.004 0.148
#> GSM182812     1  0.5962     0.3248 0.488 0.000 0.000 0.260 0.004 0.248
#> GSM182813     5  0.3833     0.3902 0.344 0.000 0.000 0.000 0.648 0.008
#> GSM182778     2  0.0713     0.8172 0.000 0.972 0.000 0.000 0.000 0.028
#> GSM182779     2  0.2976     0.7747 0.000 0.860 0.028 0.000 0.024 0.088
#> GSM182780     3  0.4910     0.4188 0.000 0.008 0.620 0.068 0.000 0.304
#> GSM182781     3  0.5773     0.1898 0.000 0.012 0.532 0.000 0.148 0.308
#> GSM182782     2  0.1970     0.8080 0.000 0.900 0.008 0.000 0.000 0.092
#> GSM182783     3  0.3707     0.4525 0.000 0.008 0.680 0.000 0.000 0.312
#> GSM182784     3  0.2941     0.6099 0.000 0.000 0.780 0.000 0.000 0.220
#> GSM182785     3  0.5123     0.3819 0.000 0.004 0.588 0.000 0.092 0.316
#> GSM182786     2  0.1007     0.8141 0.000 0.956 0.000 0.000 0.000 0.044
#> GSM182787     2  0.4620     0.5810 0.000 0.640 0.068 0.000 0.000 0.292
#> GSM182788     2  0.1204     0.8141 0.000 0.944 0.000 0.000 0.000 0.056
#> GSM182789     3  0.3774     0.5362 0.000 0.008 0.664 0.000 0.000 0.328
#> GSM182790     3  0.3295     0.6048 0.000 0.000 0.816 0.000 0.056 0.128
#> GSM182791     4  0.4887     0.4555 0.000 0.000 0.280 0.624 0.000 0.096
#> GSM182792     3  0.3337     0.6173 0.000 0.000 0.840 0.044 0.028 0.088
#> GSM182793     4  0.1148     0.6408 0.000 0.016 0.004 0.960 0.000 0.020
#> GSM182794     3  0.4656     0.5029 0.004 0.004 0.680 0.016 0.032 0.264
#> GSM182795     3  0.2762     0.6088 0.000 0.000 0.804 0.000 0.000 0.196
#> GSM182796     2  0.0291     0.8145 0.000 0.992 0.000 0.004 0.000 0.004
#> GSM182797     5  0.2119     0.4784 0.044 0.000 0.036 0.000 0.912 0.008
#> GSM182798     4  0.4631     0.1188 0.000 0.440 0.000 0.528 0.012 0.020
#> GSM182799     4  0.5555     0.2913 0.000 0.000 0.380 0.480 0.000 0.140
#> GSM182800     4  0.0692     0.6445 0.000 0.000 0.020 0.976 0.000 0.004
#> GSM182801     3  0.6734     0.3153 0.092 0.000 0.572 0.052 0.216 0.068
#> GSM182814     1  0.3166     0.6618 0.800 0.000 0.000 0.008 0.008 0.184
#> GSM182815     1  0.5731     0.4328 0.552 0.000 0.000 0.184 0.008 0.256
#> GSM182816     1  0.2259     0.6884 0.904 0.000 0.000 0.008 0.044 0.044
#> GSM182817     2  0.4837     0.5606 0.232 0.680 0.000 0.000 0.024 0.064
#> GSM182818     1  0.3061     0.6745 0.816 0.000 0.004 0.004 0.008 0.168
#> GSM182819     1  0.3424     0.6012 0.772 0.000 0.000 0.000 0.204 0.024
#> GSM182820     1  0.4967     0.3877 0.644 0.000 0.004 0.000 0.244 0.108
#> GSM182821     1  0.7089     0.1203 0.444 0.128 0.112 0.000 0.008 0.308
#> GSM182822     1  0.1010     0.6895 0.960 0.000 0.000 0.000 0.004 0.036
#> GSM182823     1  0.3691     0.6175 0.768 0.000 0.000 0.004 0.192 0.036
#> GSM182824     1  0.1477     0.6836 0.940 0.000 0.000 0.008 0.048 0.004
#> GSM182825     4  0.2218     0.5891 0.104 0.000 0.000 0.884 0.000 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 stress(p) development.stage(p) k
#> SD:NMF 66     0.620             1.18e-03 2
#> SD:NMF 69     0.172             6.31e-07 3
#> SD:NMF 66     0.360             1.16e-08 4
#> SD:NMF 57     0.416             6.46e-09 5
#> SD:NMF 47     0.646             5.32e-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.


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 18172 rows and 71 columns.
#>   Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'CV' method.
#>   Subgroups are detected by 'hclust' method.
#>   Performed in total 1250 partitions by row resampling.
#>   Best k for subgroups seems to be 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-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.591           0.732       0.884         0.4047 0.631   0.631
#> 3 3 0.370           0.593       0.745         0.5289 0.657   0.483
#> 4 4 0.428           0.441       0.693         0.1420 0.813   0.524
#> 5 5 0.480           0.479       0.693         0.0571 0.838   0.514
#> 6 6 0.567           0.478       0.671         0.0402 0.918   0.698

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
#> GSM182755     1  0.0000     0.8532 1.000 0.000
#> GSM182756     1  0.4562     0.8191 0.904 0.096
#> GSM182757     1  0.4161     0.8275 0.916 0.084
#> GSM182758     1  0.5178     0.8043 0.884 0.116
#> GSM182759     1  0.8207     0.6705 0.744 0.256
#> GSM182760     1  0.8713     0.6134 0.708 0.292
#> GSM182761     1  0.9993     0.2193 0.516 0.484
#> GSM182762     1  0.0000     0.8532 1.000 0.000
#> GSM182763     1  0.9248     0.5511 0.660 0.340
#> GSM182764     1  0.1633     0.8543 0.976 0.024
#> GSM182765     1  0.2236     0.8520 0.964 0.036
#> GSM182766     2  0.0000     0.8803 0.000 1.000
#> GSM182767     1  0.9491     0.4989 0.632 0.368
#> GSM182768     1  0.9954     0.2858 0.540 0.460
#> GSM182769     1  0.4022     0.8272 0.920 0.080
#> GSM182770     2  0.0000     0.8803 0.000 1.000
#> GSM182771     1  0.2043     0.8517 0.968 0.032
#> GSM182772     2  0.0000     0.8803 0.000 1.000
#> GSM182773     1  0.2423     0.8476 0.960 0.040
#> GSM182774     1  0.0938     0.8543 0.988 0.012
#> GSM182775     1  0.1414     0.8534 0.980 0.020
#> GSM182776     1  0.0938     0.8543 0.988 0.012
#> GSM182777     1  0.1414     0.8534 0.980 0.020
#> GSM182802     2  0.0000     0.8803 0.000 1.000
#> GSM182803     1  0.0000     0.8532 1.000 0.000
#> GSM182804     2  0.0000     0.8803 0.000 1.000
#> GSM182805     2  0.0000     0.8803 0.000 1.000
#> GSM182806     1  0.0000     0.8532 1.000 0.000
#> GSM182807     1  0.0000     0.8532 1.000 0.000
#> GSM182808     1  0.0000     0.8532 1.000 0.000
#> GSM182809     1  0.9983     0.2445 0.524 0.476
#> GSM182810     1  0.1184     0.8549 0.984 0.016
#> GSM182811     1  0.1414     0.8546 0.980 0.020
#> GSM182812     1  0.2423     0.8493 0.960 0.040
#> GSM182813     1  0.0000     0.8532 1.000 0.000
#> GSM182778     2  0.0000     0.8803 0.000 1.000
#> GSM182779     1  0.3114     0.8427 0.944 0.056
#> GSM182780     2  0.9922    -0.0126 0.448 0.552
#> GSM182781     1  0.0000     0.8532 1.000 0.000
#> GSM182782     2  0.0000     0.8803 0.000 1.000
#> GSM182783     2  0.9661     0.2417 0.392 0.608
#> GSM182784     1  0.9460     0.5061 0.636 0.364
#> GSM182785     1  0.9881     0.3596 0.564 0.436
#> GSM182786     2  0.0000     0.8803 0.000 1.000
#> GSM182787     2  0.9922    -0.0126 0.448 0.552
#> GSM182788     2  0.0000     0.8803 0.000 1.000
#> GSM182789     1  0.9977     0.2578 0.528 0.472
#> GSM182790     1  0.0938     0.8540 0.988 0.012
#> GSM182791     1  0.9833     0.3860 0.576 0.424
#> GSM182792     1  0.9661     0.4565 0.608 0.392
#> GSM182793     2  0.0000     0.8803 0.000 1.000
#> GSM182794     1  0.1414     0.8534 0.980 0.020
#> GSM182795     1  0.9323     0.5413 0.652 0.348
#> GSM182796     1  0.2043     0.8517 0.968 0.032
#> GSM182797     1  0.0000     0.8532 1.000 0.000
#> GSM182798     1  0.2043     0.8517 0.968 0.032
#> GSM182799     2  0.7528     0.6370 0.216 0.784
#> GSM182800     1  0.0376     0.8538 0.996 0.004
#> GSM182801     1  0.0000     0.8532 1.000 0.000
#> GSM182814     1  0.0000     0.8532 1.000 0.000
#> GSM182815     2  0.0000     0.8803 0.000 1.000
#> GSM182816     1  0.0000     0.8532 1.000 0.000
#> GSM182817     1  0.2603     0.8486 0.956 0.044
#> GSM182818     2  0.0000     0.8803 0.000 1.000
#> GSM182819     1  0.0000     0.8532 1.000 0.000
#> GSM182820     1  0.0000     0.8532 1.000 0.000
#> GSM182821     1  0.9933     0.3163 0.548 0.452
#> GSM182822     1  0.8608     0.6248 0.716 0.284
#> GSM182823     1  0.0000     0.8532 1.000 0.000
#> GSM182824     1  0.0000     0.8532 1.000 0.000
#> GSM182825     1  0.0938     0.8543 0.988 0.012

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>           class entropy silhouette    p1    p2    p3
#> GSM182755     1  0.0237     0.6188 0.996 0.000 0.004
#> GSM182756     3  0.2625     0.5266 0.084 0.000 0.916
#> GSM182757     3  0.5728     0.3945 0.196 0.032 0.772
#> GSM182758     3  0.1753     0.5485 0.048 0.000 0.952
#> GSM182759     3  0.5067     0.6154 0.052 0.116 0.832
#> GSM182760     3  0.7960     0.6357 0.120 0.232 0.648
#> GSM182761     3  0.5785     0.6037 0.000 0.332 0.668
#> GSM182762     1  0.5465     0.6453 0.712 0.000 0.288
#> GSM182763     3  0.5901     0.6451 0.040 0.192 0.768
#> GSM182764     1  0.6180     0.5801 0.584 0.000 0.416
#> GSM182765     1  0.6168     0.5983 0.588 0.000 0.412
#> GSM182766     2  0.0747     0.9571 0.000 0.984 0.016
#> GSM182767     3  0.6224     0.6710 0.032 0.240 0.728
#> GSM182768     3  0.6369     0.6327 0.016 0.316 0.668
#> GSM182769     3  0.3918     0.4911 0.140 0.004 0.856
#> GSM182770     2  0.0237     0.9628 0.000 0.996 0.004
#> GSM182771     1  0.6111     0.6098 0.604 0.000 0.396
#> GSM182772     2  0.0237     0.9628 0.000 0.996 0.004
#> GSM182773     3  0.4682     0.4334 0.192 0.004 0.804
#> GSM182774     1  0.6308     0.5298 0.508 0.000 0.492
#> GSM182775     3  0.4974     0.3629 0.236 0.000 0.764
#> GSM182776     1  0.6308     0.5298 0.508 0.000 0.492
#> GSM182777     3  0.4887     0.3782 0.228 0.000 0.772
#> GSM182802     2  0.0424     0.9618 0.000 0.992 0.008
#> GSM182803     1  0.5948     0.6315 0.640 0.000 0.360
#> GSM182804     2  0.1031     0.9530 0.000 0.976 0.024
#> GSM182805     2  0.1031     0.9530 0.000 0.976 0.024
#> GSM182806     1  0.0237     0.6188 0.996 0.000 0.004
#> GSM182807     1  0.0237     0.6188 0.996 0.000 0.004
#> GSM182808     1  0.2959     0.6189 0.900 0.000 0.100
#> GSM182809     3  0.5733     0.6133 0.000 0.324 0.676
#> GSM182810     1  0.6267     0.5768 0.548 0.000 0.452
#> GSM182811     1  0.6274     0.5725 0.544 0.000 0.456
#> GSM182812     1  0.6267     0.5812 0.548 0.000 0.452
#> GSM182813     1  0.0237     0.6188 0.996 0.000 0.004
#> GSM182778     2  0.0000     0.9622 0.000 1.000 0.000
#> GSM182779     3  0.5988    -0.1356 0.368 0.000 0.632
#> GSM182780     3  0.6111     0.4863 0.000 0.396 0.604
#> GSM182781     1  0.6309     0.2585 0.504 0.000 0.496
#> GSM182782     2  0.0000     0.9622 0.000 1.000 0.000
#> GSM182783     3  0.6521     0.1511 0.004 0.492 0.504
#> GSM182784     3  0.6335     0.6702 0.036 0.240 0.724
#> GSM182785     3  0.5864     0.6558 0.008 0.288 0.704
#> GSM182786     2  0.0000     0.9622 0.000 1.000 0.000
#> GSM182787     3  0.6140     0.4793 0.000 0.404 0.596
#> GSM182788     2  0.0000     0.9622 0.000 1.000 0.000
#> GSM182789     3  0.5956     0.6192 0.004 0.324 0.672
#> GSM182790     3  0.4842     0.3820 0.224 0.000 0.776
#> GSM182791     3  0.6096     0.6643 0.016 0.280 0.704
#> GSM182792     3  0.5977     0.6736 0.020 0.252 0.728
#> GSM182793     2  0.0237     0.9628 0.000 0.996 0.004
#> GSM182794     3  0.4887     0.3782 0.228 0.000 0.772
#> GSM182795     3  0.5803     0.6701 0.028 0.212 0.760
#> GSM182796     1  0.6062     0.6145 0.616 0.000 0.384
#> GSM182797     1  0.0237     0.6188 0.996 0.000 0.004
#> GSM182798     1  0.6045     0.6163 0.620 0.000 0.380
#> GSM182799     2  0.5929     0.4033 0.004 0.676 0.320
#> GSM182800     1  0.6204     0.5701 0.576 0.000 0.424
#> GSM182801     3  0.6079     0.1516 0.388 0.000 0.612
#> GSM182814     1  0.6111     0.6169 0.604 0.000 0.396
#> GSM182815     2  0.0424     0.9618 0.000 0.992 0.008
#> GSM182816     1  0.6308    -0.0201 0.508 0.000 0.492
#> GSM182817     3  0.5810    -0.1324 0.336 0.000 0.664
#> GSM182818     2  0.0000     0.9622 0.000 1.000 0.000
#> GSM182819     1  0.6308    -0.0201 0.508 0.000 0.492
#> GSM182820     1  0.0237     0.6188 0.996 0.000 0.004
#> GSM182821     3  0.5785     0.6424 0.004 0.300 0.696
#> GSM182822     3  0.7835     0.6265 0.112 0.232 0.656
#> GSM182823     1  0.0237     0.6188 0.996 0.000 0.004
#> GSM182824     1  0.2959     0.6189 0.900 0.000 0.100
#> GSM182825     1  0.6235     0.5914 0.564 0.000 0.436

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM182755     1  0.0000    0.54414 1.000 0.000 0.000 0.000
#> GSM182756     3  0.5856    0.05497 0.032 0.000 0.504 0.464
#> GSM182757     4  0.6741    0.20361 0.092 0.000 0.424 0.484
#> GSM182758     3  0.5244    0.21274 0.008 0.000 0.556 0.436
#> GSM182759     3  0.5560    0.40449 0.036 0.004 0.668 0.292
#> GSM182760     3  0.5427    0.58256 0.052 0.008 0.728 0.212
#> GSM182761     3  0.1118    0.73064 0.000 0.036 0.964 0.000
#> GSM182762     1  0.6054    0.12335 0.592 0.000 0.056 0.352
#> GSM182763     3  0.4640    0.64862 0.032 0.024 0.808 0.136
#> GSM182764     1  0.7006   -0.11584 0.456 0.000 0.116 0.428
#> GSM182765     1  0.6800   -0.07086 0.460 0.000 0.096 0.444
#> GSM182766     2  0.3052    0.89428 0.000 0.860 0.136 0.004
#> GSM182767     3  0.3484    0.69589 0.004 0.008 0.844 0.144
#> GSM182768     3  0.4094    0.71762 0.000 0.056 0.828 0.116
#> GSM182769     4  0.6705    0.06390 0.088 0.000 0.440 0.472
#> GSM182770     2  0.2089    0.89241 0.000 0.932 0.048 0.020
#> GSM182771     1  0.6915   -0.01190 0.476 0.000 0.108 0.416
#> GSM182772     2  0.2469    0.90093 0.000 0.892 0.108 0.000
#> GSM182773     4  0.7020    0.22186 0.124 0.000 0.376 0.500
#> GSM182774     4  0.6648    0.15679 0.372 0.000 0.092 0.536
#> GSM182775     4  0.7307    0.35756 0.168 0.004 0.288 0.540
#> GSM182776     4  0.6648    0.15679 0.372 0.000 0.092 0.536
#> GSM182777     4  0.7128    0.32742 0.152 0.000 0.320 0.528
#> GSM182802     2  0.2773    0.89893 0.000 0.880 0.116 0.004
#> GSM182803     1  0.6371   -0.00345 0.508 0.000 0.064 0.428
#> GSM182804     2  0.5902    0.80735 0.000 0.696 0.184 0.120
#> GSM182805     2  0.3208    0.88739 0.000 0.848 0.148 0.004
#> GSM182806     1  0.0000    0.54414 1.000 0.000 0.000 0.000
#> GSM182807     1  0.0000    0.54414 1.000 0.000 0.000 0.000
#> GSM182808     1  0.2408    0.49641 0.896 0.000 0.000 0.104
#> GSM182809     3  0.1452    0.73295 0.000 0.036 0.956 0.008
#> GSM182810     4  0.6906    0.09284 0.408 0.000 0.108 0.484
#> GSM182811     4  0.6944    0.09627 0.404 0.000 0.112 0.484
#> GSM182812     4  0.6965    0.01279 0.428 0.000 0.112 0.460
#> GSM182813     1  0.0000    0.54414 1.000 0.000 0.000 0.000
#> GSM182778     2  0.2385    0.88249 0.000 0.920 0.028 0.052
#> GSM182779     4  0.7612    0.25975 0.264 0.000 0.260 0.476
#> GSM182780     3  0.2546    0.70477 0.000 0.092 0.900 0.008
#> GSM182781     4  0.6949    0.12595 0.408 0.000 0.112 0.480
#> GSM182782     2  0.2385    0.88249 0.000 0.920 0.028 0.052
#> GSM182783     3  0.7198    0.31493 0.000 0.280 0.540 0.180
#> GSM182784     3  0.3534    0.69252 0.004 0.008 0.840 0.148
#> GSM182785     3  0.1635    0.73700 0.000 0.008 0.948 0.044
#> GSM182786     2  0.2385    0.88249 0.000 0.920 0.028 0.052
#> GSM182787     3  0.2737    0.70095 0.000 0.104 0.888 0.008
#> GSM182788     2  0.2385    0.88249 0.000 0.920 0.028 0.052
#> GSM182789     3  0.1356    0.73555 0.000 0.032 0.960 0.008
#> GSM182790     4  0.7142    0.31560 0.152 0.000 0.324 0.524
#> GSM182791     3  0.1824    0.73741 0.000 0.004 0.936 0.060
#> GSM182792     3  0.2831    0.72106 0.000 0.004 0.876 0.120
#> GSM182793     2  0.2469    0.90093 0.000 0.892 0.108 0.000
#> GSM182794     4  0.7128    0.32742 0.152 0.000 0.320 0.528
#> GSM182795     3  0.4941    0.66603 0.004 0.048 0.764 0.184
#> GSM182796     1  0.6901    0.00179 0.488 0.000 0.108 0.404
#> GSM182797     1  0.0000    0.54414 1.000 0.000 0.000 0.000
#> GSM182798     1  0.6822   -0.00110 0.488 0.000 0.100 0.412
#> GSM182799     3  0.7181    0.05800 0.000 0.336 0.512 0.152
#> GSM182800     1  0.6277   -0.12400 0.476 0.000 0.056 0.468
#> GSM182801     4  0.8427    0.22378 0.332 0.024 0.248 0.396
#> GSM182814     4  0.6395   -0.01184 0.464 0.000 0.064 0.472
#> GSM182815     2  0.5568    0.82968 0.000 0.728 0.152 0.120
#> GSM182816     1  0.7878   -0.00578 0.508 0.016 0.220 0.256
#> GSM182817     4  0.7297    0.33208 0.220 0.000 0.244 0.536
#> GSM182818     2  0.5664    0.83146 0.000 0.720 0.124 0.156
#> GSM182819     1  0.7878   -0.00578 0.508 0.016 0.220 0.256
#> GSM182820     1  0.0000    0.54414 1.000 0.000 0.000 0.000
#> GSM182821     3  0.0937    0.73779 0.000 0.012 0.976 0.012
#> GSM182822     3  0.5205    0.41671 0.008 0.012 0.672 0.308
#> GSM182823     1  0.0000    0.54414 1.000 0.000 0.000 0.000
#> GSM182824     1  0.2408    0.49641 0.896 0.000 0.000 0.104
#> GSM182825     4  0.6693    0.05681 0.424 0.000 0.088 0.488

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>           class entropy silhouette    p1    p2    p3    p4    p5
#> GSM182755     1   0.405     0.6495 0.644 0.000 0.000 0.000 0.356
#> GSM182756     3   0.763     0.5002 0.124 0.000 0.504 0.204 0.168
#> GSM182757     5   0.706    -0.1540 0.080 0.000 0.384 0.084 0.452
#> GSM182758     3   0.720     0.5438 0.100 0.000 0.556 0.196 0.148
#> GSM182759     3   0.655     0.5277 0.064 0.004 0.604 0.084 0.244
#> GSM182760     3   0.509     0.6485 0.056 0.000 0.748 0.060 0.136
#> GSM182761     3   0.178     0.6432 0.000 0.024 0.940 0.008 0.028
#> GSM182762     5   0.427     0.5731 0.180 0.000 0.024 0.024 0.772
#> GSM182763     3   0.518     0.6371 0.040 0.020 0.764 0.064 0.112
#> GSM182764     5   0.457     0.6524 0.092 0.000 0.084 0.036 0.788
#> GSM182765     5   0.447     0.6660 0.076 0.000 0.064 0.060 0.800
#> GSM182766     2   0.305     0.4143 0.000 0.852 0.120 0.028 0.000
#> GSM182767     3   0.312     0.6818 0.004 0.000 0.864 0.048 0.084
#> GSM182768     3   0.425     0.6518 0.012 0.036 0.824 0.068 0.060
#> GSM182769     3   0.810     0.4296 0.172 0.000 0.436 0.200 0.192
#> GSM182770     2   0.314     0.3826 0.000 0.832 0.016 0.152 0.000
#> GSM182771     5   0.376     0.6629 0.080 0.000 0.044 0.036 0.840
#> GSM182772     2   0.207     0.4288 0.000 0.896 0.104 0.000 0.000
#> GSM182773     3   0.839     0.3538 0.204 0.000 0.372 0.204 0.220
#> GSM182774     5   0.315     0.6758 0.072 0.000 0.020 0.036 0.872
#> GSM182775     1   0.844    -0.1293 0.372 0.004 0.180 0.180 0.264
#> GSM182776     5   0.315     0.6758 0.072 0.000 0.020 0.036 0.872
#> GSM182777     3   0.852     0.2685 0.228 0.000 0.316 0.200 0.256
#> GSM182802     2   0.311     0.3916 0.000 0.852 0.112 0.036 0.000
#> GSM182803     5   0.269     0.6154 0.128 0.000 0.004 0.004 0.864
#> GSM182804     2   0.567    -0.1197 0.000 0.632 0.176 0.192 0.000
#> GSM182805     2   0.355     0.3646 0.000 0.820 0.136 0.044 0.000
#> GSM182806     1   0.405     0.6495 0.644 0.000 0.000 0.000 0.356
#> GSM182807     1   0.405     0.6495 0.644 0.000 0.000 0.000 0.356
#> GSM182808     1   0.441     0.5642 0.556 0.000 0.000 0.004 0.440
#> GSM182809     3   0.208     0.6462 0.000 0.024 0.928 0.016 0.032
#> GSM182810     5   0.212     0.6946 0.032 0.000 0.036 0.008 0.924
#> GSM182811     5   0.220     0.6955 0.032 0.000 0.040 0.008 0.920
#> GSM182812     5   0.315     0.6720 0.052 0.000 0.044 0.028 0.876
#> GSM182813     1   0.405     0.6495 0.644 0.000 0.000 0.000 0.356
#> GSM182778     2   0.388     0.3529 0.000 0.708 0.004 0.288 0.000
#> GSM182779     5   0.783     0.3225 0.212 0.000 0.172 0.140 0.476
#> GSM182780     3   0.252     0.6162 0.000 0.060 0.900 0.036 0.004
#> GSM182781     5   0.708     0.0974 0.404 0.000 0.048 0.128 0.420
#> GSM182782     2   0.388     0.3529 0.000 0.708 0.004 0.288 0.000
#> GSM182783     3   0.823    -0.0139 0.176 0.260 0.444 0.100 0.020
#> GSM182784     3   0.318     0.6814 0.004 0.000 0.860 0.048 0.088
#> GSM182785     3   0.207     0.6755 0.000 0.000 0.912 0.012 0.076
#> GSM182786     2   0.388     0.3529 0.000 0.708 0.004 0.288 0.000
#> GSM182787     3   0.269     0.6095 0.000 0.076 0.888 0.032 0.004
#> GSM182788     2   0.388     0.3529 0.000 0.708 0.004 0.288 0.000
#> GSM182789     3   0.165     0.6504 0.000 0.020 0.944 0.004 0.032
#> GSM182790     3   0.851     0.2833 0.236 0.000 0.324 0.200 0.240
#> GSM182791     3   0.217     0.6754 0.012 0.000 0.912 0.004 0.072
#> GSM182792     3   0.305     0.6837 0.012 0.000 0.872 0.032 0.084
#> GSM182793     2   0.236     0.4244 0.000 0.888 0.104 0.008 0.000
#> GSM182794     3   0.852     0.2685 0.228 0.000 0.316 0.200 0.256
#> GSM182795     3   0.580     0.6650 0.084 0.040 0.732 0.044 0.100
#> GSM182796     5   0.356     0.6610 0.072 0.000 0.044 0.032 0.852
#> GSM182797     1   0.405     0.6495 0.644 0.000 0.000 0.000 0.356
#> GSM182798     5   0.356     0.6640 0.072 0.000 0.044 0.032 0.852
#> GSM182799     3   0.723    -0.1046 0.024 0.292 0.476 0.200 0.008
#> GSM182800     5   0.605     0.4342 0.172 0.000 0.064 0.096 0.668
#> GSM182801     1   0.731     0.2095 0.568 0.004 0.144 0.132 0.152
#> GSM182814     5   0.223     0.6603 0.092 0.000 0.004 0.004 0.900
#> GSM182815     2   0.540    -0.0979 0.000 0.664 0.152 0.184 0.000
#> GSM182816     1   0.463     0.4038 0.788 0.000 0.092 0.056 0.064
#> GSM182817     5   0.531     0.5499 0.060 0.000 0.172 0.048 0.720
#> GSM182818     4   0.553     0.0000 0.004 0.472 0.044 0.476 0.004
#> GSM182819     1   0.463     0.4038 0.788 0.000 0.092 0.056 0.064
#> GSM182820     1   0.405     0.6495 0.644 0.000 0.000 0.000 0.356
#> GSM182821     3   0.168     0.6619 0.000 0.004 0.940 0.012 0.044
#> GSM182822     3   0.454     0.4536 0.000 0.004 0.608 0.008 0.380
#> GSM182823     1   0.405     0.6495 0.644 0.000 0.000 0.000 0.356
#> GSM182824     1   0.441     0.5642 0.556 0.000 0.000 0.004 0.440
#> GSM182825     5   0.193     0.6842 0.052 0.000 0.016 0.004 0.928

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>           class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM182755     1  0.3647    0.72638 0.640 0.000 0.000 0.000 0.360 0.000
#> GSM182756     3  0.5644   -0.29509 0.016 0.000 0.464 0.000 0.096 0.424
#> GSM182757     3  0.6376   -0.21499 0.012 0.000 0.368 0.000 0.348 0.272
#> GSM182758     3  0.5112   -0.12224 0.000 0.000 0.516 0.000 0.084 0.400
#> GSM182759     3  0.5617    0.31856 0.008 0.004 0.612 0.004 0.164 0.208
#> GSM182760     3  0.4749    0.47108 0.040 0.000 0.720 0.000 0.068 0.172
#> GSM182761     3  0.1059    0.65815 0.000 0.016 0.964 0.004 0.016 0.000
#> GSM182762     5  0.5121    0.57284 0.172 0.000 0.016 0.000 0.668 0.144
#> GSM182763     3  0.4295    0.54565 0.008 0.016 0.776 0.004 0.068 0.128
#> GSM182764     5  0.5186    0.62925 0.080 0.000 0.064 0.000 0.692 0.164
#> GSM182765     5  0.5174    0.64913 0.076 0.000 0.044 0.000 0.672 0.208
#> GSM182766     2  0.3150    0.44609 0.000 0.828 0.120 0.052 0.000 0.000
#> GSM182767     3  0.3062    0.60418 0.000 0.000 0.836 0.000 0.052 0.112
#> GSM182768     3  0.4709    0.60591 0.032 0.036 0.784 0.024 0.036 0.088
#> GSM182769     6  0.6250    0.40712 0.044 0.000 0.396 0.000 0.120 0.440
#> GSM182770     2  0.3629    0.39240 0.000 0.712 0.012 0.276 0.000 0.000
#> GSM182771     5  0.4801    0.67039 0.084 0.000 0.048 0.000 0.728 0.140
#> GSM182772     2  0.2118    0.45814 0.000 0.888 0.104 0.008 0.000 0.000
#> GSM182773     6  0.6593    0.55187 0.076 0.000 0.332 0.000 0.128 0.464
#> GSM182774     5  0.2239    0.70278 0.020 0.000 0.008 0.000 0.900 0.072
#> GSM182775     6  0.7079    0.51296 0.312 0.000 0.092 0.004 0.168 0.424
#> GSM182776     5  0.2239    0.70278 0.020 0.000 0.008 0.000 0.900 0.072
#> GSM182777     6  0.6734    0.61628 0.084 0.000 0.280 0.000 0.156 0.480
#> GSM182802     2  0.3220    0.41220 0.000 0.832 0.108 0.056 0.000 0.004
#> GSM182803     5  0.2212    0.63668 0.112 0.000 0.000 0.000 0.880 0.008
#> GSM182804     2  0.5409    0.08866 0.000 0.612 0.176 0.204 0.000 0.008
#> GSM182805     2  0.3576    0.39715 0.000 0.800 0.136 0.060 0.000 0.004
#> GSM182806     1  0.3647    0.72638 0.640 0.000 0.000 0.000 0.360 0.000
#> GSM182807     1  0.3647    0.72638 0.640 0.000 0.000 0.000 0.360 0.000
#> GSM182808     1  0.4072    0.62953 0.544 0.000 0.000 0.000 0.448 0.008
#> GSM182809     3  0.1406    0.65908 0.000 0.016 0.952 0.004 0.020 0.008
#> GSM182810     5  0.1528    0.72460 0.016 0.000 0.028 0.000 0.944 0.012
#> GSM182811     5  0.1605    0.72548 0.016 0.000 0.032 0.000 0.940 0.012
#> GSM182812     5  0.3046    0.67648 0.032 0.000 0.032 0.000 0.860 0.076
#> GSM182813     1  0.3647    0.72638 0.640 0.000 0.000 0.000 0.360 0.000
#> GSM182778     2  0.3854    0.36050 0.000 0.536 0.000 0.464 0.000 0.000
#> GSM182779     6  0.6503    0.04922 0.064 0.000 0.144 0.000 0.300 0.492
#> GSM182780     3  0.1969    0.64369 0.000 0.052 0.920 0.020 0.004 0.004
#> GSM182781     6  0.6193    0.05281 0.232 0.000 0.012 0.000 0.296 0.460
#> GSM182782     2  0.3854    0.36050 0.000 0.536 0.000 0.464 0.000 0.000
#> GSM182783     3  0.7066    0.00627 0.020 0.260 0.424 0.028 0.004 0.264
#> GSM182784     3  0.3078    0.60370 0.000 0.000 0.836 0.000 0.056 0.108
#> GSM182785     3  0.1909    0.65985 0.000 0.000 0.920 0.004 0.052 0.024
#> GSM182786     2  0.3854    0.36050 0.000 0.536 0.000 0.464 0.000 0.000
#> GSM182787     3  0.2213    0.64094 0.000 0.068 0.904 0.020 0.004 0.004
#> GSM182788     2  0.3854    0.36050 0.000 0.536 0.000 0.464 0.000 0.000
#> GSM182789     3  0.0909    0.66160 0.000 0.012 0.968 0.000 0.020 0.000
#> GSM182790     6  0.6733    0.61167 0.088 0.000 0.284 0.000 0.148 0.480
#> GSM182791     3  0.2411    0.65854 0.024 0.000 0.900 0.000 0.044 0.032
#> GSM182792     3  0.3387    0.63308 0.024 0.000 0.836 0.000 0.052 0.088
#> GSM182793     2  0.1863    0.45534 0.000 0.896 0.104 0.000 0.000 0.000
#> GSM182794     6  0.6734    0.61628 0.084 0.000 0.280 0.000 0.156 0.480
#> GSM182795     3  0.4393    0.55718 0.000 0.036 0.748 0.000 0.052 0.164
#> GSM182796     5  0.4647    0.67275 0.084 0.000 0.048 0.000 0.744 0.124
#> GSM182797     1  0.3647    0.72638 0.640 0.000 0.000 0.000 0.360 0.000
#> GSM182798     5  0.4585    0.67570 0.084 0.000 0.044 0.000 0.748 0.124
#> GSM182799     3  0.7235   -0.04591 0.048 0.288 0.456 0.164 0.000 0.044
#> GSM182800     5  0.5457    0.32745 0.084 0.000 0.036 0.000 0.616 0.264
#> GSM182801     1  0.6316   -0.15633 0.540 0.000 0.060 0.016 0.080 0.304
#> GSM182814     5  0.1643    0.69180 0.068 0.000 0.000 0.000 0.924 0.008
#> GSM182815     2  0.5172    0.11258 0.000 0.644 0.148 0.200 0.000 0.008
#> GSM182816     1  0.3337    0.32131 0.824 0.000 0.004 0.000 0.064 0.108
#> GSM182817     5  0.5164    0.46325 0.008 0.000 0.172 0.000 0.648 0.172
#> GSM182818     4  0.5957    0.00000 0.008 0.264 0.016 0.560 0.000 0.152
#> GSM182819     1  0.3337    0.32131 0.824 0.000 0.004 0.000 0.064 0.108
#> GSM182820     1  0.3647    0.72638 0.640 0.000 0.000 0.000 0.360 0.000
#> GSM182821     3  0.0972    0.66300 0.000 0.000 0.964 0.000 0.028 0.008
#> GSM182822     3  0.3965    0.30351 0.000 0.000 0.604 0.000 0.388 0.008
#> GSM182823     1  0.3647    0.72638 0.640 0.000 0.000 0.000 0.360 0.000
#> GSM182824     1  0.4072    0.62953 0.544 0.000 0.000 0.000 0.448 0.008
#> GSM182825     5  0.1230    0.71539 0.028 0.000 0.008 0.000 0.956 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-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 stress(p) development.stage(p) k
#> CV:hclust 59     0.600              1.00000 2
#> CV:hclust 54     0.612              0.06124 3
#> CV:hclust 35     0.753              0.02587 4
#> CV:hclust 42     0.625              0.00244 5
#> CV:hclust 42     0.298              0.00503 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 18172 rows and 71 columns.
#>   Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'CV' method.
#>   Subgroups are detected by 'kmeans' method.
#>   Performed in total 1250 partitions by row resampling.
#>   Best k for subgroups seems to be 2.
#> 
#> Following methods can be applied to this 'ConsensusPartition' object:
#>  [1] "cola_report"             "collect_classes"         "collect_plots"          
#>  [4] "collect_stats"           "colnames"                "compare_signatures"     
#>  [7] "consensus_heatmap"       "dimension_reduction"     "functional_enrichment"  
#> [10] "get_anno_col"            "get_anno"                "get_classes"            
#> [13] "get_consensus"           "get_matrix"              "get_membership"         
#> [16] "get_param"               "get_signatures"          "get_stats"              
#> [19] "is_best_k"               "is_stable_k"             "membership_heatmap"     
#> [22] "ncol"                    "nrow"                    "plot_ecdf"              
#> [25] "rownames"                "select_partition_number" "show"                   
#> [28] "suggest_best_k"          "test_to_known_factors"

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

collect_plots(res)

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.858           0.915       0.954         0.4764 0.501   0.501
#> 3 3 0.528           0.626       0.838         0.3173 0.631   0.402
#> 4 4 0.597           0.697       0.800         0.1675 0.839   0.587
#> 5 5 0.685           0.626       0.759         0.0683 0.908   0.663
#> 6 6 0.768           0.762       0.804         0.0458 0.895   0.556

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
#> GSM182755     1   0.000      0.999 1.000 0.000
#> GSM182756     1   0.118      0.982 0.984 0.016
#> GSM182757     1   0.000      0.999 1.000 0.000
#> GSM182758     2   0.886      0.673 0.304 0.696
#> GSM182759     2   0.278      0.869 0.048 0.952
#> GSM182760     1   0.118      0.982 0.984 0.016
#> GSM182761     2   0.000      0.889 0.000 1.000
#> GSM182762     1   0.000      0.999 1.000 0.000
#> GSM182763     2   0.430      0.848 0.088 0.912
#> GSM182764     1   0.000      0.999 1.000 0.000
#> GSM182765     1   0.000      0.999 1.000 0.000
#> GSM182766     2   0.000      0.889 0.000 1.000
#> GSM182767     2   0.971      0.507 0.400 0.600
#> GSM182768     2   0.886      0.673 0.304 0.696
#> GSM182769     1   0.000      0.999 1.000 0.000
#> GSM182770     2   0.000      0.889 0.000 1.000
#> GSM182771     1   0.000      0.999 1.000 0.000
#> GSM182772     2   0.000      0.889 0.000 1.000
#> GSM182773     1   0.118      0.982 0.984 0.016
#> GSM182774     1   0.000      0.999 1.000 0.000
#> GSM182775     1   0.000      0.999 1.000 0.000
#> GSM182776     1   0.000      0.999 1.000 0.000
#> GSM182777     1   0.000      0.999 1.000 0.000
#> GSM182802     2   0.000      0.889 0.000 1.000
#> GSM182803     1   0.000      0.999 1.000 0.000
#> GSM182804     2   0.000      0.889 0.000 1.000
#> GSM182805     2   0.000      0.889 0.000 1.000
#> GSM182806     1   0.000      0.999 1.000 0.000
#> GSM182807     1   0.000      0.999 1.000 0.000
#> GSM182808     1   0.000      0.999 1.000 0.000
#> GSM182809     2   0.000      0.889 0.000 1.000
#> GSM182810     1   0.000      0.999 1.000 0.000
#> GSM182811     1   0.000      0.999 1.000 0.000
#> GSM182812     1   0.000      0.999 1.000 0.000
#> GSM182813     1   0.000      0.999 1.000 0.000
#> GSM182778     2   0.000      0.889 0.000 1.000
#> GSM182779     1   0.000      0.999 1.000 0.000
#> GSM182780     2   0.000      0.889 0.000 1.000
#> GSM182781     1   0.000      0.999 1.000 0.000
#> GSM182782     2   0.000      0.889 0.000 1.000
#> GSM182783     2   0.000      0.889 0.000 1.000
#> GSM182784     2   0.971      0.507 0.400 0.600
#> GSM182785     2   0.909      0.644 0.324 0.676
#> GSM182786     2   0.000      0.889 0.000 1.000
#> GSM182787     2   0.000      0.889 0.000 1.000
#> GSM182788     2   0.000      0.889 0.000 1.000
#> GSM182789     2   0.204      0.877 0.032 0.968
#> GSM182790     1   0.000      0.999 1.000 0.000
#> GSM182791     2   0.886      0.673 0.304 0.696
#> GSM182792     2   0.961      0.540 0.384 0.616
#> GSM182793     2   0.000      0.889 0.000 1.000
#> GSM182794     1   0.000      0.999 1.000 0.000
#> GSM182795     2   0.886      0.673 0.304 0.696
#> GSM182796     1   0.000      0.999 1.000 0.000
#> GSM182797     1   0.000      0.999 1.000 0.000
#> GSM182798     1   0.000      0.999 1.000 0.000
#> GSM182799     2   0.000      0.889 0.000 1.000
#> GSM182800     1   0.000      0.999 1.000 0.000
#> GSM182801     1   0.000      0.999 1.000 0.000
#> GSM182814     1   0.000      0.999 1.000 0.000
#> GSM182815     2   0.000      0.889 0.000 1.000
#> GSM182816     1   0.000      0.999 1.000 0.000
#> GSM182817     1   0.000      0.999 1.000 0.000
#> GSM182818     2   0.000      0.889 0.000 1.000
#> GSM182819     1   0.000      0.999 1.000 0.000
#> GSM182820     1   0.000      0.999 1.000 0.000
#> GSM182821     2   0.886      0.673 0.304 0.696
#> GSM182822     1   0.000      0.999 1.000 0.000
#> GSM182823     1   0.000      0.999 1.000 0.000
#> GSM182824     1   0.000      0.999 1.000 0.000
#> GSM182825     1   0.000      0.999 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
#> GSM182755     1  0.0237     0.7863 0.996 0.000 0.004
#> GSM182756     3  0.1711     0.7052 0.032 0.008 0.960
#> GSM182757     3  0.2356     0.6768 0.072 0.000 0.928
#> GSM182758     3  0.2537     0.7317 0.000 0.080 0.920
#> GSM182759     3  0.2625     0.7313 0.000 0.084 0.916
#> GSM182760     3  0.1711     0.7052 0.032 0.008 0.960
#> GSM182761     3  0.3482     0.7087 0.000 0.128 0.872
#> GSM182762     1  0.2448     0.7695 0.924 0.000 0.076
#> GSM182763     3  0.2711     0.7300 0.000 0.088 0.912
#> GSM182764     3  0.6026     0.2093 0.376 0.000 0.624
#> GSM182765     3  0.6305    -0.1389 0.484 0.000 0.516
#> GSM182766     2  0.1411     0.9963 0.000 0.964 0.036
#> GSM182767     3  0.2625     0.7317 0.000 0.084 0.916
#> GSM182768     3  0.2625     0.7317 0.000 0.084 0.916
#> GSM182769     3  0.1860     0.6925 0.052 0.000 0.948
#> GSM182770     2  0.1411     0.9963 0.000 0.964 0.036
#> GSM182771     1  0.6299     0.2045 0.524 0.000 0.476
#> GSM182772     2  0.1411     0.9963 0.000 0.964 0.036
#> GSM182773     3  0.1711     0.7052 0.032 0.008 0.960
#> GSM182774     3  0.6295    -0.1238 0.472 0.000 0.528
#> GSM182775     3  0.5988     0.2734 0.368 0.000 0.632
#> GSM182776     3  0.6274    -0.0729 0.456 0.000 0.544
#> GSM182777     1  0.5621     0.5639 0.692 0.000 0.308
#> GSM182802     2  0.1289     0.9947 0.000 0.968 0.032
#> GSM182803     1  0.1529     0.7842 0.960 0.000 0.040
#> GSM182804     2  0.1289     0.9947 0.000 0.968 0.032
#> GSM182805     2  0.1289     0.9947 0.000 0.968 0.032
#> GSM182806     1  0.0237     0.7863 0.996 0.000 0.004
#> GSM182807     1  0.0237     0.7863 0.996 0.000 0.004
#> GSM182808     1  0.1163     0.7848 0.972 0.000 0.028
#> GSM182809     3  0.4974     0.5917 0.000 0.236 0.764
#> GSM182810     3  0.6483    -0.0368 0.452 0.004 0.544
#> GSM182811     1  0.6520     0.1749 0.508 0.004 0.488
#> GSM182812     1  0.6235     0.2878 0.564 0.000 0.436
#> GSM182813     1  0.0237     0.7863 0.996 0.000 0.004
#> GSM182778     2  0.1411     0.9963 0.000 0.964 0.036
#> GSM182779     3  0.6274    -0.0449 0.456 0.000 0.544
#> GSM182780     3  0.5733     0.4258 0.000 0.324 0.676
#> GSM182781     1  0.2261     0.7718 0.932 0.000 0.068
#> GSM182782     2  0.1411     0.9963 0.000 0.964 0.036
#> GSM182783     3  0.5497     0.4867 0.000 0.292 0.708
#> GSM182784     3  0.2625     0.7317 0.000 0.084 0.916
#> GSM182785     3  0.2625     0.7317 0.000 0.084 0.916
#> GSM182786     2  0.1411     0.9963 0.000 0.964 0.036
#> GSM182787     2  0.1411     0.9963 0.000 0.964 0.036
#> GSM182788     2  0.1411     0.9963 0.000 0.964 0.036
#> GSM182789     3  0.2878     0.7264 0.000 0.096 0.904
#> GSM182790     3  0.5291     0.4689 0.268 0.000 0.732
#> GSM182791     3  0.2625     0.7317 0.000 0.084 0.916
#> GSM182792     3  0.1753     0.7261 0.000 0.048 0.952
#> GSM182793     2  0.1411     0.9963 0.000 0.964 0.036
#> GSM182794     3  0.4702     0.5481 0.212 0.000 0.788
#> GSM182795     3  0.2448     0.7314 0.000 0.076 0.924
#> GSM182796     1  0.6299     0.2045 0.524 0.000 0.476
#> GSM182797     1  0.0237     0.7863 0.996 0.000 0.004
#> GSM182798     1  0.6274     0.2503 0.544 0.000 0.456
#> GSM182799     3  0.6079     0.2710 0.000 0.388 0.612
#> GSM182800     3  0.6299    -0.1350 0.476 0.000 0.524
#> GSM182801     1  0.4842     0.6581 0.776 0.000 0.224
#> GSM182814     1  0.1411     0.7845 0.964 0.000 0.036
#> GSM182815     2  0.1289     0.9947 0.000 0.968 0.032
#> GSM182816     1  0.4099     0.7134 0.852 0.008 0.140
#> GSM182817     3  0.6483    -0.0945 0.452 0.004 0.544
#> GSM182818     2  0.0661     0.9707 0.004 0.988 0.008
#> GSM182819     1  0.2384     0.7784 0.936 0.008 0.056
#> GSM182820     1  0.0237     0.7863 0.996 0.000 0.004
#> GSM182821     3  0.2711     0.7316 0.000 0.088 0.912
#> GSM182822     3  0.1765     0.6999 0.040 0.004 0.956
#> GSM182823     1  0.0237     0.7863 0.996 0.000 0.004
#> GSM182824     1  0.1289     0.7840 0.968 0.000 0.032
#> GSM182825     1  0.6267     0.2429 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
#> GSM182755     1  0.0188     0.7643 0.996 0.000 0.000 0.004
#> GSM182756     3  0.2334     0.7609 0.004 0.000 0.908 0.088
#> GSM182757     4  0.4687     0.5168 0.004 0.004 0.288 0.704
#> GSM182758     3  0.0524     0.7988 0.000 0.008 0.988 0.004
#> GSM182759     3  0.3810     0.7201 0.000 0.008 0.804 0.188
#> GSM182760     3  0.2944     0.7322 0.004 0.000 0.868 0.128
#> GSM182761     3  0.3279     0.7844 0.000 0.032 0.872 0.096
#> GSM182762     1  0.5212     0.1850 0.588 0.004 0.004 0.404
#> GSM182763     3  0.2611     0.7900 0.000 0.008 0.896 0.096
#> GSM182764     4  0.6103     0.7048 0.192 0.004 0.116 0.688
#> GSM182765     4  0.5961     0.7069 0.220 0.004 0.088 0.688
#> GSM182766     2  0.1059     0.9681 0.000 0.972 0.012 0.016
#> GSM182767     3  0.0927     0.7950 0.000 0.008 0.976 0.016
#> GSM182768     3  0.0804     0.7989 0.000 0.008 0.980 0.012
#> GSM182769     3  0.4720     0.4813 0.004 0.000 0.672 0.324
#> GSM182770     2  0.1059     0.9693 0.000 0.972 0.012 0.016
#> GSM182771     4  0.5604     0.6989 0.232 0.004 0.060 0.704
#> GSM182772     2  0.0937     0.9695 0.000 0.976 0.012 0.012
#> GSM182773     3  0.3306     0.7147 0.004 0.000 0.840 0.156
#> GSM182774     4  0.4893     0.7170 0.168 0.000 0.064 0.768
#> GSM182775     3  0.7078    -0.0816 0.124 0.000 0.456 0.420
#> GSM182776     4  0.6703     0.5635 0.156 0.000 0.232 0.612
#> GSM182777     4  0.7563     0.3642 0.236 0.000 0.280 0.484
#> GSM182802     2  0.1488     0.9668 0.000 0.956 0.012 0.032
#> GSM182803     1  0.4955     0.3596 0.648 0.000 0.008 0.344
#> GSM182804     2  0.1677     0.9646 0.000 0.948 0.012 0.040
#> GSM182805     2  0.1388     0.9675 0.000 0.960 0.012 0.028
#> GSM182806     1  0.0188     0.7643 0.996 0.000 0.000 0.004
#> GSM182807     1  0.0000     0.7656 1.000 0.000 0.000 0.000
#> GSM182808     1  0.1867     0.7391 0.928 0.000 0.000 0.072
#> GSM182809     3  0.4727     0.7414 0.000 0.100 0.792 0.108
#> GSM182810     4  0.6278     0.6474 0.228 0.000 0.120 0.652
#> GSM182811     4  0.5590     0.6734 0.244 0.000 0.064 0.692
#> GSM182812     4  0.6200     0.5539 0.356 0.000 0.064 0.580
#> GSM182813     1  0.0000     0.7656 1.000 0.000 0.000 0.000
#> GSM182778     2  0.1767     0.9636 0.000 0.944 0.012 0.044
#> GSM182779     4  0.6529     0.6885 0.208 0.004 0.140 0.648
#> GSM182780     3  0.3787     0.7504 0.000 0.124 0.840 0.036
#> GSM182781     1  0.4950     0.2663 0.620 0.000 0.004 0.376
#> GSM182782     2  0.1767     0.9636 0.000 0.944 0.012 0.044
#> GSM182783     3  0.3271     0.7523 0.000 0.132 0.856 0.012
#> GSM182784     3  0.0804     0.7964 0.000 0.008 0.980 0.012
#> GSM182785     3  0.2546     0.7921 0.000 0.008 0.900 0.092
#> GSM182786     2  0.1767     0.9636 0.000 0.944 0.012 0.044
#> GSM182787     2  0.2635     0.9182 0.000 0.904 0.076 0.020
#> GSM182788     2  0.1767     0.9636 0.000 0.944 0.012 0.044
#> GSM182789     3  0.2480     0.7938 0.000 0.008 0.904 0.088
#> GSM182790     3  0.6575     0.0877 0.080 0.000 0.508 0.412
#> GSM182791     3  0.2198     0.7966 0.000 0.008 0.920 0.072
#> GSM182792     3  0.1635     0.8033 0.000 0.008 0.948 0.044
#> GSM182793     2  0.1584     0.9675 0.000 0.952 0.012 0.036
#> GSM182794     3  0.6309     0.3342 0.076 0.000 0.588 0.336
#> GSM182795     3  0.1151     0.8029 0.000 0.008 0.968 0.024
#> GSM182796     4  0.5642     0.7011 0.228 0.004 0.064 0.704
#> GSM182797     1  0.0188     0.7643 0.996 0.000 0.000 0.004
#> GSM182798     4  0.5626     0.6898 0.244 0.004 0.056 0.696
#> GSM182799     3  0.4197     0.7165 0.000 0.156 0.808 0.036
#> GSM182800     4  0.6423     0.6115 0.196 0.000 0.156 0.648
#> GSM182801     1  0.7313     0.1593 0.508 0.000 0.176 0.316
#> GSM182814     1  0.5040     0.2951 0.628 0.000 0.008 0.364
#> GSM182815     2  0.1584     0.9659 0.000 0.952 0.012 0.036
#> GSM182816     1  0.5109     0.6264 0.736 0.000 0.052 0.212
#> GSM182817     4  0.4513     0.7242 0.120 0.000 0.076 0.804
#> GSM182818     2  0.1824     0.9518 0.000 0.936 0.004 0.060
#> GSM182819     1  0.4599     0.6495 0.760 0.000 0.028 0.212
#> GSM182820     1  0.0000     0.7656 1.000 0.000 0.000 0.000
#> GSM182821     3  0.2198     0.7981 0.000 0.008 0.920 0.072
#> GSM182822     3  0.4977     0.2536 0.000 0.000 0.540 0.460
#> GSM182823     1  0.0188     0.7644 0.996 0.000 0.000 0.004
#> GSM182824     1  0.2412     0.7322 0.908 0.000 0.008 0.084
#> GSM182825     4  0.5917     0.5746 0.320 0.000 0.056 0.624

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>           class entropy silhouette    p1    p2    p3    p4    p5
#> GSM182755     1  0.0290     0.7457 0.992 0.000 0.000 0.000 0.008
#> GSM182756     3  0.4157     0.4569 0.000 0.000 0.716 0.264 0.020
#> GSM182757     5  0.3612     0.5021 0.004 0.000 0.100 0.064 0.832
#> GSM182758     3  0.0000     0.8507 0.000 0.000 1.000 0.000 0.000
#> GSM182759     3  0.3160     0.7216 0.000 0.000 0.808 0.004 0.188
#> GSM182760     3  0.4527     0.4079 0.000 0.000 0.692 0.272 0.036
#> GSM182761     3  0.2629     0.8242 0.000 0.032 0.896 0.008 0.064
#> GSM182762     5  0.5754     0.2352 0.380 0.000 0.004 0.080 0.536
#> GSM182763     3  0.1638     0.8395 0.000 0.000 0.932 0.004 0.064
#> GSM182764     5  0.3704     0.5739 0.076 0.000 0.044 0.036 0.844
#> GSM182765     5  0.3765     0.5751 0.080 0.000 0.040 0.040 0.840
#> GSM182766     2  0.1124     0.8863 0.000 0.960 0.000 0.036 0.004
#> GSM182767     3  0.0963     0.8340 0.000 0.000 0.964 0.036 0.000
#> GSM182768     3  0.0703     0.8468 0.000 0.000 0.976 0.024 0.000
#> GSM182769     4  0.5099     0.6038 0.000 0.000 0.336 0.612 0.052
#> GSM182770     2  0.0566     0.8844 0.000 0.984 0.000 0.004 0.012
#> GSM182771     5  0.2575     0.5885 0.100 0.000 0.012 0.004 0.884
#> GSM182772     2  0.0404     0.8849 0.000 0.988 0.000 0.000 0.012
#> GSM182773     3  0.4958    -0.0114 0.000 0.000 0.568 0.400 0.032
#> GSM182774     5  0.5353     0.3164 0.036 0.000 0.012 0.384 0.568
#> GSM182775     4  0.5910     0.6446 0.032 0.000 0.192 0.660 0.116
#> GSM182776     4  0.5940     0.5480 0.032 0.000 0.108 0.652 0.208
#> GSM182777     4  0.6616     0.6027 0.052 0.000 0.148 0.600 0.200
#> GSM182802     2  0.3242     0.8750 0.000 0.844 0.000 0.116 0.040
#> GSM182803     1  0.6788    -0.0524 0.372 0.000 0.000 0.344 0.284
#> GSM182804     2  0.3880     0.8618 0.000 0.800 0.004 0.152 0.044
#> GSM182805     2  0.3339     0.8732 0.000 0.836 0.000 0.124 0.040
#> GSM182806     1  0.0290     0.7457 0.992 0.000 0.000 0.000 0.008
#> GSM182807     1  0.0162     0.7464 0.996 0.000 0.000 0.000 0.004
#> GSM182808     1  0.1872     0.7222 0.928 0.000 0.000 0.052 0.020
#> GSM182809     3  0.4271     0.7474 0.000 0.064 0.808 0.092 0.036
#> GSM182810     5  0.6675     0.1912 0.084 0.000 0.048 0.392 0.476
#> GSM182811     5  0.6130     0.3407 0.080 0.000 0.024 0.344 0.552
#> GSM182812     5  0.6450     0.3536 0.172 0.000 0.008 0.292 0.528
#> GSM182813     1  0.0162     0.7464 0.996 0.000 0.000 0.000 0.004
#> GSM182778     2  0.2351     0.8676 0.000 0.896 0.000 0.088 0.016
#> GSM182779     5  0.5874     0.4271 0.076 0.000 0.092 0.140 0.692
#> GSM182780     3  0.2409     0.8262 0.000 0.056 0.908 0.028 0.008
#> GSM182781     5  0.6431     0.1244 0.396 0.000 0.004 0.152 0.448
#> GSM182782     2  0.2351     0.8676 0.000 0.896 0.000 0.088 0.016
#> GSM182783     3  0.2576     0.8242 0.000 0.056 0.900 0.036 0.008
#> GSM182784     3  0.0510     0.8456 0.000 0.000 0.984 0.016 0.000
#> GSM182785     3  0.1478     0.8406 0.000 0.000 0.936 0.000 0.064
#> GSM182786     2  0.2351     0.8676 0.000 0.896 0.000 0.088 0.016
#> GSM182787     2  0.4479     0.6445 0.000 0.720 0.240 0.036 0.004
#> GSM182788     2  0.2351     0.8676 0.000 0.896 0.000 0.088 0.016
#> GSM182789     3  0.1331     0.8498 0.000 0.000 0.952 0.008 0.040
#> GSM182790     4  0.6932     0.5471 0.020 0.000 0.344 0.452 0.184
#> GSM182791     3  0.1041     0.8517 0.000 0.000 0.964 0.004 0.032
#> GSM182792     3  0.0510     0.8463 0.000 0.000 0.984 0.016 0.000
#> GSM182793     2  0.3012     0.8770 0.000 0.860 0.000 0.104 0.036
#> GSM182794     4  0.6988     0.4715 0.024 0.000 0.392 0.412 0.172
#> GSM182795     3  0.0000     0.8507 0.000 0.000 1.000 0.000 0.000
#> GSM182796     5  0.2735     0.5848 0.084 0.000 0.036 0.000 0.880
#> GSM182797     1  0.0290     0.7457 0.992 0.000 0.000 0.000 0.008
#> GSM182798     5  0.2411     0.5873 0.108 0.000 0.008 0.000 0.884
#> GSM182799     3  0.3410     0.7971 0.000 0.064 0.860 0.052 0.024
#> GSM182800     4  0.6338     0.4320 0.044 0.000 0.088 0.588 0.280
#> GSM182801     4  0.6342     0.5226 0.188 0.000 0.096 0.640 0.076
#> GSM182814     1  0.6825    -0.1620 0.340 0.000 0.000 0.328 0.332
#> GSM182815     2  0.3608     0.8663 0.000 0.812 0.000 0.148 0.040
#> GSM182816     1  0.5511     0.3667 0.544 0.000 0.024 0.404 0.028
#> GSM182817     5  0.5190     0.3763 0.020 0.000 0.024 0.344 0.612
#> GSM182818     2  0.4393     0.8423 0.000 0.756 0.000 0.168 0.076
#> GSM182819     1  0.5155     0.4006 0.560 0.000 0.008 0.404 0.028
#> GSM182820     1  0.0290     0.7457 0.992 0.000 0.000 0.000 0.008
#> GSM182821     3  0.0955     0.8521 0.000 0.000 0.968 0.004 0.028
#> GSM182822     4  0.6775     0.1961 0.000 0.000 0.284 0.388 0.328
#> GSM182823     1  0.0162     0.7464 0.996 0.000 0.000 0.000 0.004
#> GSM182824     1  0.4485     0.5466 0.680 0.000 0.000 0.292 0.028
#> GSM182825     5  0.6561     0.2186 0.104 0.000 0.028 0.392 0.476

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>           class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM182755     1  0.0000      0.981 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM182756     6  0.4410      0.215 0.000 0.000 0.472 0.008 0.012 0.508
#> GSM182757     5  0.1649      0.826 0.000 0.000 0.032 0.000 0.932 0.036
#> GSM182758     3  0.1219      0.891 0.000 0.000 0.948 0.000 0.004 0.048
#> GSM182759     3  0.2871      0.737 0.000 0.000 0.804 0.004 0.192 0.000
#> GSM182760     6  0.4524      0.252 0.000 0.000 0.452 0.004 0.024 0.520
#> GSM182761     3  0.1167      0.895 0.000 0.012 0.960 0.008 0.020 0.000
#> GSM182762     5  0.3909      0.691 0.244 0.000 0.000 0.000 0.720 0.036
#> GSM182763     3  0.0692      0.901 0.000 0.000 0.976 0.004 0.020 0.000
#> GSM182764     5  0.1726      0.858 0.044 0.000 0.012 0.000 0.932 0.012
#> GSM182765     5  0.1718      0.858 0.044 0.000 0.008 0.000 0.932 0.016
#> GSM182766     2  0.1837      0.896 0.000 0.932 0.020 0.032 0.004 0.012
#> GSM182767     3  0.1753      0.861 0.000 0.000 0.912 0.000 0.004 0.084
#> GSM182768     3  0.1749      0.895 0.000 0.000 0.932 0.024 0.008 0.036
#> GSM182769     6  0.4483      0.627 0.000 0.000 0.104 0.152 0.012 0.732
#> GSM182770     2  0.0862      0.894 0.000 0.972 0.000 0.008 0.004 0.016
#> GSM182771     5  0.1789      0.849 0.044 0.000 0.000 0.032 0.924 0.000
#> GSM182772     2  0.0862      0.894 0.000 0.972 0.000 0.008 0.004 0.016
#> GSM182773     6  0.3714      0.606 0.000 0.000 0.264 0.008 0.008 0.720
#> GSM182774     4  0.5133      0.755 0.000 0.000 0.000 0.592 0.292 0.116
#> GSM182775     6  0.4377      0.599 0.008 0.000 0.036 0.180 0.028 0.748
#> GSM182776     6  0.5048      0.422 0.000 0.000 0.024 0.308 0.052 0.616
#> GSM182777     6  0.4646      0.600 0.008 0.000 0.036 0.172 0.048 0.736
#> GSM182802     2  0.2806      0.885 0.000 0.884 0.012 0.048 0.016 0.040
#> GSM182803     4  0.5551      0.683 0.140 0.000 0.000 0.668 0.100 0.092
#> GSM182804     2  0.4159      0.853 0.000 0.804 0.028 0.084 0.028 0.056
#> GSM182805     2  0.2874      0.884 0.000 0.880 0.012 0.048 0.016 0.044
#> GSM182806     1  0.0000      0.981 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM182807     1  0.0000      0.981 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM182808     1  0.2586      0.861 0.868 0.000 0.000 0.100 0.000 0.032
#> GSM182809     3  0.3897      0.799 0.000 0.032 0.824 0.068 0.028 0.048
#> GSM182810     4  0.4755      0.811 0.016 0.000 0.000 0.680 0.236 0.068
#> GSM182811     4  0.3903      0.783 0.012 0.000 0.000 0.680 0.304 0.004
#> GSM182812     4  0.4271      0.790 0.028 0.000 0.000 0.672 0.292 0.008
#> GSM182813     1  0.0000      0.981 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM182778     2  0.3256      0.865 0.000 0.844 0.008 0.104 0.016 0.028
#> GSM182779     5  0.3212      0.820 0.044 0.000 0.028 0.004 0.856 0.068
#> GSM182780     3  0.1570      0.892 0.000 0.016 0.944 0.028 0.008 0.004
#> GSM182781     5  0.6123      0.502 0.256 0.000 0.000 0.044 0.552 0.148
#> GSM182782     2  0.3165      0.865 0.000 0.848 0.008 0.104 0.012 0.028
#> GSM182783     3  0.2232      0.891 0.000 0.016 0.916 0.028 0.012 0.028
#> GSM182784     3  0.1732      0.871 0.000 0.000 0.920 0.004 0.004 0.072
#> GSM182785     3  0.0632      0.902 0.000 0.000 0.976 0.000 0.024 0.000
#> GSM182786     2  0.3165      0.865 0.000 0.848 0.008 0.104 0.012 0.028
#> GSM182787     3  0.4903      0.228 0.000 0.396 0.556 0.032 0.012 0.004
#> GSM182788     2  0.3165      0.865 0.000 0.848 0.008 0.104 0.012 0.028
#> GSM182789     3  0.0653      0.903 0.000 0.000 0.980 0.004 0.012 0.004
#> GSM182790     6  0.4776      0.636 0.008 0.000 0.172 0.044 0.048 0.728
#> GSM182791     3  0.0717      0.903 0.000 0.000 0.976 0.000 0.008 0.016
#> GSM182792     3  0.0858      0.900 0.000 0.000 0.968 0.000 0.004 0.028
#> GSM182793     2  0.1983      0.893 0.000 0.924 0.008 0.012 0.012 0.044
#> GSM182794     6  0.4846      0.633 0.008 0.000 0.184 0.032 0.060 0.716
#> GSM182795     3  0.0713      0.901 0.000 0.000 0.972 0.000 0.000 0.028
#> GSM182796     5  0.1857      0.850 0.044 0.000 0.004 0.028 0.924 0.000
#> GSM182797     1  0.0000      0.981 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM182798     5  0.1789      0.849 0.044 0.000 0.000 0.032 0.924 0.000
#> GSM182799     3  0.2478      0.879 0.000 0.012 0.904 0.032 0.024 0.028
#> GSM182800     6  0.5860      0.227 0.004 0.000 0.016 0.328 0.124 0.528
#> GSM182801     6  0.4712      0.584 0.036 0.000 0.028 0.200 0.016 0.720
#> GSM182814     4  0.5361      0.763 0.120 0.000 0.000 0.672 0.160 0.048
#> GSM182815     2  0.3713      0.864 0.000 0.828 0.012 0.080 0.028 0.052
#> GSM182816     6  0.6406      0.125 0.336 0.000 0.004 0.236 0.012 0.412
#> GSM182817     4  0.3636      0.769 0.000 0.000 0.000 0.676 0.320 0.004
#> GSM182818     2  0.4809      0.823 0.000 0.740 0.012 0.108 0.028 0.112
#> GSM182819     6  0.6386      0.096 0.356 0.000 0.004 0.224 0.012 0.404
#> GSM182820     1  0.0000      0.981 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM182821     3  0.0881      0.904 0.000 0.000 0.972 0.008 0.008 0.012
#> GSM182822     4  0.5646      0.710 0.000 0.000 0.084 0.652 0.168 0.096
#> GSM182823     1  0.0000      0.981 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM182824     4  0.5037      0.282 0.380 0.000 0.000 0.540 0.000 0.080
#> GSM182825     4  0.4912      0.813 0.024 0.000 0.000 0.672 0.236 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-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 stress(p) development.stage(p) k
#> CV:kmeans 71     0.394             0.131845 2
#> CV:kmeans 52     0.679             0.005783 3
#> CV:kmeans 60     0.807             0.001074 4
#> CV:kmeans 52     0.688             0.000865 5
#> CV:kmeans 63     0.918             0.000012 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 18172 rows and 71 columns.
#>   Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'CV' method.
#>   Subgroups are detected by 'skmeans' method.
#>   Performed in total 1250 partitions by row resampling.
#>   Best k for subgroups seems to be 2.
#> 
#> Following methods can be applied to this 'ConsensusPartition' object:
#>  [1] "cola_report"             "collect_classes"         "collect_plots"          
#>  [4] "collect_stats"           "colnames"                "compare_signatures"     
#>  [7] "consensus_heatmap"       "dimension_reduction"     "functional_enrichment"  
#> [10] "get_anno_col"            "get_anno"                "get_classes"            
#> [13] "get_consensus"           "get_matrix"              "get_membership"         
#> [16] "get_param"               "get_signatures"          "get_stats"              
#> [19] "is_best_k"               "is_stable_k"             "membership_heatmap"     
#> [22] "ncol"                    "nrow"                    "plot_ecdf"              
#> [25] "rownames"                "select_partition_number" "show"                   
#> [28] "suggest_best_k"          "test_to_known_factors"

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

collect_plots(res)

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 0.970           0.927       0.970         0.5039 0.501   0.501
#> 3 3 0.660           0.731       0.808         0.2873 0.788   0.597
#> 4 4 0.762           0.724       0.880         0.1239 0.822   0.554
#> 5 5 0.682           0.598       0.784         0.0635 0.906   0.697
#> 6 6 0.674           0.576       0.749         0.0404 0.950   0.798

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
#> GSM182755     1  0.0000      0.947 1.000 0.000
#> GSM182756     1  0.9795      0.332 0.584 0.416
#> GSM182757     1  0.0000      0.947 1.000 0.000
#> GSM182758     2  0.0000      0.995 0.000 1.000
#> GSM182759     2  0.0000      0.995 0.000 1.000
#> GSM182760     1  0.9710      0.373 0.600 0.400
#> GSM182761     2  0.0000      0.995 0.000 1.000
#> GSM182762     1  0.0000      0.947 1.000 0.000
#> GSM182763     2  0.0000      0.995 0.000 1.000
#> GSM182764     1  0.0000      0.947 1.000 0.000
#> GSM182765     1  0.0000      0.947 1.000 0.000
#> GSM182766     2  0.0000      0.995 0.000 1.000
#> GSM182767     2  0.3733      0.919 0.072 0.928
#> GSM182768     2  0.0000      0.995 0.000 1.000
#> GSM182769     1  0.0000      0.947 1.000 0.000
#> GSM182770     2  0.0000      0.995 0.000 1.000
#> GSM182771     1  0.0376      0.944 0.996 0.004
#> GSM182772     2  0.0000      0.995 0.000 1.000
#> GSM182773     1  0.9866      0.287 0.568 0.432
#> GSM182774     1  0.0000      0.947 1.000 0.000
#> GSM182775     1  0.0000      0.947 1.000 0.000
#> GSM182776     1  0.0000      0.947 1.000 0.000
#> GSM182777     1  0.0000      0.947 1.000 0.000
#> GSM182802     2  0.0000      0.995 0.000 1.000
#> GSM182803     1  0.0000      0.947 1.000 0.000
#> GSM182804     2  0.0000      0.995 0.000 1.000
#> GSM182805     2  0.0000      0.995 0.000 1.000
#> GSM182806     1  0.0000      0.947 1.000 0.000
#> GSM182807     1  0.0000      0.947 1.000 0.000
#> GSM182808     1  0.0000      0.947 1.000 0.000
#> GSM182809     2  0.0000      0.995 0.000 1.000
#> GSM182810     1  0.0000      0.947 1.000 0.000
#> GSM182811     1  0.4161      0.879 0.916 0.084
#> GSM182812     1  0.3879      0.886 0.924 0.076
#> GSM182813     1  0.0000      0.947 1.000 0.000
#> GSM182778     2  0.0000      0.995 0.000 1.000
#> GSM182779     1  0.1843      0.927 0.972 0.028
#> GSM182780     2  0.0000      0.995 0.000 1.000
#> GSM182781     1  0.0000      0.947 1.000 0.000
#> GSM182782     2  0.0000      0.995 0.000 1.000
#> GSM182783     2  0.0000      0.995 0.000 1.000
#> GSM182784     2  0.3879      0.914 0.076 0.924
#> GSM182785     2  0.0000      0.995 0.000 1.000
#> GSM182786     2  0.0000      0.995 0.000 1.000
#> GSM182787     2  0.0000      0.995 0.000 1.000
#> GSM182788     2  0.0000      0.995 0.000 1.000
#> GSM182789     2  0.0000      0.995 0.000 1.000
#> GSM182790     1  0.0000      0.947 1.000 0.000
#> GSM182791     2  0.0000      0.995 0.000 1.000
#> GSM182792     2  0.0000      0.995 0.000 1.000
#> GSM182793     2  0.0000      0.995 0.000 1.000
#> GSM182794     1  0.0000      0.947 1.000 0.000
#> GSM182795     2  0.0000      0.995 0.000 1.000
#> GSM182796     1  0.6343      0.797 0.840 0.160
#> GSM182797     1  0.0000      0.947 1.000 0.000
#> GSM182798     1  0.0000      0.947 1.000 0.000
#> GSM182799     2  0.0000      0.995 0.000 1.000
#> GSM182800     1  0.0000      0.947 1.000 0.000
#> GSM182801     1  0.0000      0.947 1.000 0.000
#> GSM182814     1  0.0000      0.947 1.000 0.000
#> GSM182815     2  0.0000      0.995 0.000 1.000
#> GSM182816     1  0.0000      0.947 1.000 0.000
#> GSM182817     1  0.0000      0.947 1.000 0.000
#> GSM182818     2  0.0000      0.995 0.000 1.000
#> GSM182819     1  0.0000      0.947 1.000 0.000
#> GSM182820     1  0.0000      0.947 1.000 0.000
#> GSM182821     2  0.0000      0.995 0.000 1.000
#> GSM182822     1  0.9775      0.339 0.588 0.412
#> GSM182823     1  0.0000      0.947 1.000 0.000
#> GSM182824     1  0.0000      0.947 1.000 0.000
#> GSM182825     1  0.0000      0.947 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
#> GSM182755     1  0.5465      0.782 0.712 0.000 0.288
#> GSM182756     3  0.0237      0.689 0.000 0.004 0.996
#> GSM182757     1  0.6026      0.249 0.624 0.000 0.376
#> GSM182758     3  0.5859      0.358 0.000 0.344 0.656
#> GSM182759     2  0.3030      0.868 0.092 0.904 0.004
#> GSM182760     3  0.0237      0.689 0.000 0.004 0.996
#> GSM182761     2  0.0000      0.956 0.000 1.000 0.000
#> GSM182762     1  0.5785      0.764 0.668 0.000 0.332
#> GSM182763     2  0.0000      0.956 0.000 1.000 0.000
#> GSM182764     1  0.2796      0.698 0.908 0.000 0.092
#> GSM182765     1  0.2796      0.698 0.908 0.000 0.092
#> GSM182766     2  0.0000      0.956 0.000 1.000 0.000
#> GSM182767     3  0.3816      0.662 0.000 0.148 0.852
#> GSM182768     3  0.5882      0.351 0.000 0.348 0.652
#> GSM182769     3  0.2165      0.679 0.064 0.000 0.936
#> GSM182770     2  0.0000      0.956 0.000 1.000 0.000
#> GSM182771     1  0.2066      0.683 0.940 0.000 0.060
#> GSM182772     2  0.0000      0.956 0.000 1.000 0.000
#> GSM182773     3  0.2280      0.685 0.052 0.008 0.940
#> GSM182774     1  0.3340      0.757 0.880 0.000 0.120
#> GSM182775     3  0.2959      0.654 0.100 0.000 0.900
#> GSM182776     3  0.6299     -0.300 0.476 0.000 0.524
#> GSM182777     3  0.5706      0.255 0.320 0.000 0.680
#> GSM182802     2  0.0000      0.956 0.000 1.000 0.000
#> GSM182803     1  0.5431      0.783 0.716 0.000 0.284
#> GSM182804     2  0.0000      0.956 0.000 1.000 0.000
#> GSM182805     2  0.0000      0.956 0.000 1.000 0.000
#> GSM182806     1  0.5431      0.783 0.716 0.000 0.284
#> GSM182807     1  0.5431      0.783 0.716 0.000 0.284
#> GSM182808     1  0.5431      0.783 0.716 0.000 0.284
#> GSM182809     2  0.0000      0.956 0.000 1.000 0.000
#> GSM182810     1  0.4702      0.778 0.788 0.000 0.212
#> GSM182811     1  0.0892      0.696 0.980 0.020 0.000
#> GSM182812     1  0.0000      0.708 1.000 0.000 0.000
#> GSM182813     1  0.5431      0.783 0.716 0.000 0.284
#> GSM182778     2  0.0000      0.956 0.000 1.000 0.000
#> GSM182779     1  0.3116      0.692 0.892 0.000 0.108
#> GSM182780     2  0.1031      0.944 0.000 0.976 0.024
#> GSM182781     1  0.5835      0.764 0.660 0.000 0.340
#> GSM182782     2  0.0000      0.956 0.000 1.000 0.000
#> GSM182783     2  0.2796      0.893 0.000 0.908 0.092
#> GSM182784     3  0.3686      0.666 0.000 0.140 0.860
#> GSM182785     2  0.3715      0.855 0.004 0.868 0.128
#> GSM182786     2  0.0000      0.956 0.000 1.000 0.000
#> GSM182787     2  0.0000      0.956 0.000 1.000 0.000
#> GSM182788     2  0.0000      0.956 0.000 1.000 0.000
#> GSM182789     2  0.1643      0.932 0.000 0.956 0.044
#> GSM182790     3  0.1163      0.680 0.028 0.000 0.972
#> GSM182791     2  0.2711      0.899 0.000 0.912 0.088
#> GSM182792     3  0.5905      0.343 0.000 0.352 0.648
#> GSM182793     2  0.0000      0.956 0.000 1.000 0.000
#> GSM182794     3  0.0424      0.686 0.008 0.000 0.992
#> GSM182795     2  0.6215      0.277 0.000 0.572 0.428
#> GSM182796     1  0.2486      0.677 0.932 0.008 0.060
#> GSM182797     1  0.5431      0.783 0.716 0.000 0.284
#> GSM182798     1  0.2066      0.683 0.940 0.000 0.060
#> GSM182799     2  0.2959      0.888 0.000 0.900 0.100
#> GSM182800     1  0.5465      0.780 0.712 0.000 0.288
#> GSM182801     3  0.5621      0.323 0.308 0.000 0.692
#> GSM182814     1  0.5098      0.781 0.752 0.000 0.248
#> GSM182815     2  0.0000      0.956 0.000 1.000 0.000
#> GSM182816     3  0.5650      0.318 0.312 0.000 0.688
#> GSM182817     1  0.0237      0.707 0.996 0.000 0.004
#> GSM182818     2  0.0000      0.956 0.000 1.000 0.000
#> GSM182819     1  0.6309      0.337 0.504 0.000 0.496
#> GSM182820     1  0.5431      0.783 0.716 0.000 0.284
#> GSM182821     2  0.0592      0.951 0.000 0.988 0.012
#> GSM182822     3  0.9122      0.352 0.280 0.184 0.536
#> GSM182823     1  0.5431      0.783 0.716 0.000 0.284
#> GSM182824     1  0.5431      0.783 0.716 0.000 0.284
#> GSM182825     1  0.4796      0.778 0.780 0.000 0.220

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM182755     1  0.1637     0.8252 0.940 0.000 0.000 0.060
#> GSM182756     3  0.0804     0.8258 0.008 0.000 0.980 0.012
#> GSM182757     4  0.2456     0.8334 0.068 0.008 0.008 0.916
#> GSM182758     3  0.0469     0.8277 0.000 0.012 0.988 0.000
#> GSM182759     2  0.1940     0.8324 0.000 0.924 0.000 0.076
#> GSM182760     3  0.1398     0.8186 0.040 0.000 0.956 0.004
#> GSM182761     2  0.0336     0.8859 0.000 0.992 0.008 0.000
#> GSM182762     4  0.4866     0.3889 0.404 0.000 0.000 0.596
#> GSM182763     2  0.0469     0.8841 0.000 0.988 0.012 0.000
#> GSM182764     4  0.1940     0.8391 0.076 0.000 0.000 0.924
#> GSM182765     4  0.2198     0.8394 0.072 0.000 0.008 0.920
#> GSM182766     2  0.0000     0.8887 0.000 1.000 0.000 0.000
#> GSM182767     3  0.0524     0.8290 0.008 0.004 0.988 0.000
#> GSM182768     3  0.1004     0.8264 0.000 0.024 0.972 0.004
#> GSM182769     3  0.4212     0.6435 0.216 0.000 0.772 0.012
#> GSM182770     2  0.0000     0.8887 0.000 1.000 0.000 0.000
#> GSM182771     4  0.0707     0.8233 0.020 0.000 0.000 0.980
#> GSM182772     2  0.0000     0.8887 0.000 1.000 0.000 0.000
#> GSM182773     3  0.2255     0.7965 0.068 0.000 0.920 0.012
#> GSM182774     1  0.2737     0.8049 0.888 0.000 0.008 0.104
#> GSM182775     1  0.5108     0.5345 0.672 0.000 0.308 0.020
#> GSM182776     1  0.0937     0.8401 0.976 0.000 0.012 0.012
#> GSM182777     1  0.5141     0.6646 0.756 0.000 0.160 0.084
#> GSM182802     2  0.0336     0.8881 0.000 0.992 0.000 0.008
#> GSM182803     1  0.0188     0.8430 0.996 0.000 0.004 0.000
#> GSM182804     2  0.0336     0.8881 0.000 0.992 0.000 0.008
#> GSM182805     2  0.0336     0.8881 0.000 0.992 0.000 0.008
#> GSM182806     1  0.1211     0.8360 0.960 0.000 0.000 0.040
#> GSM182807     1  0.0469     0.8440 0.988 0.000 0.000 0.012
#> GSM182808     1  0.0000     0.8433 1.000 0.000 0.000 0.000
#> GSM182809     2  0.0336     0.8881 0.000 0.992 0.000 0.008
#> GSM182810     1  0.2048     0.8122 0.928 0.000 0.008 0.064
#> GSM182811     1  0.5193     0.2864 0.580 0.000 0.008 0.412
#> GSM182812     1  0.5125     0.3434 0.604 0.000 0.008 0.388
#> GSM182813     1  0.0469     0.8440 0.988 0.000 0.000 0.012
#> GSM182778     2  0.0000     0.8887 0.000 1.000 0.000 0.000
#> GSM182779     4  0.2376     0.8382 0.068 0.000 0.016 0.916
#> GSM182780     2  0.3486     0.7291 0.000 0.812 0.188 0.000
#> GSM182781     4  0.4992     0.1927 0.476 0.000 0.000 0.524
#> GSM182782     2  0.0000     0.8887 0.000 1.000 0.000 0.000
#> GSM182783     2  0.4843     0.3853 0.000 0.604 0.396 0.000
#> GSM182784     3  0.0524     0.8290 0.008 0.004 0.988 0.000
#> GSM182785     3  0.5143    -0.0416 0.000 0.456 0.540 0.004
#> GSM182786     2  0.0000     0.8887 0.000 1.000 0.000 0.000
#> GSM182787     2  0.0000     0.8887 0.000 1.000 0.000 0.000
#> GSM182788     2  0.0000     0.8887 0.000 1.000 0.000 0.000
#> GSM182789     2  0.4624     0.5118 0.000 0.660 0.340 0.000
#> GSM182790     1  0.7838    -0.0940 0.404 0.000 0.280 0.316
#> GSM182791     2  0.5288     0.1874 0.000 0.520 0.472 0.008
#> GSM182792     3  0.1302     0.8191 0.000 0.044 0.956 0.000
#> GSM182793     2  0.0336     0.8881 0.000 0.992 0.000 0.008
#> GSM182794     3  0.7396     0.2235 0.268 0.000 0.516 0.216
#> GSM182795     3  0.3024     0.7262 0.000 0.148 0.852 0.000
#> GSM182796     4  0.0707     0.8233 0.020 0.000 0.000 0.980
#> GSM182797     1  0.1474     0.8300 0.948 0.000 0.000 0.052
#> GSM182798     4  0.0707     0.8233 0.020 0.000 0.000 0.980
#> GSM182799     2  0.5288     0.1725 0.000 0.520 0.472 0.008
#> GSM182800     1  0.1042     0.8439 0.972 0.000 0.008 0.020
#> GSM182801     1  0.3333     0.7900 0.872 0.000 0.088 0.040
#> GSM182814     1  0.0524     0.8418 0.988 0.000 0.004 0.008
#> GSM182815     2  0.0336     0.8881 0.000 0.992 0.000 0.008
#> GSM182816     1  0.1174     0.8380 0.968 0.000 0.020 0.012
#> GSM182817     1  0.5296     0.0376 0.500 0.000 0.008 0.492
#> GSM182818     2  0.0336     0.8881 0.000 0.992 0.000 0.008
#> GSM182819     1  0.0804     0.8403 0.980 0.000 0.008 0.012
#> GSM182820     1  0.1022     0.8390 0.968 0.000 0.000 0.032
#> GSM182821     2  0.4539     0.6285 0.000 0.720 0.272 0.008
#> GSM182822     1  0.4401     0.7602 0.832 0.016 0.068 0.084
#> GSM182823     1  0.0469     0.8440 0.988 0.000 0.000 0.012
#> GSM182824     1  0.0000     0.8433 1.000 0.000 0.000 0.000
#> GSM182825     1  0.1970     0.8142 0.932 0.000 0.008 0.060

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>           class entropy silhouette    p1    p2    p3    p4    p5
#> GSM182755     1  0.1041     0.6453 0.964 0.000 0.000 0.004 0.032
#> GSM182756     3  0.4520     0.6251 0.032 0.000 0.748 0.200 0.020
#> GSM182757     5  0.2072     0.8577 0.036 0.000 0.020 0.016 0.928
#> GSM182758     3  0.1717     0.6973 0.000 0.004 0.936 0.052 0.008
#> GSM182759     2  0.3674     0.7091 0.000 0.812 0.016 0.016 0.156
#> GSM182760     3  0.5770     0.5925 0.108 0.000 0.684 0.168 0.040
#> GSM182761     2  0.3321     0.7456 0.000 0.832 0.136 0.032 0.000
#> GSM182762     5  0.4390     0.1720 0.428 0.000 0.000 0.004 0.568
#> GSM182763     2  0.3477     0.7623 0.000 0.840 0.116 0.032 0.012
#> GSM182764     5  0.1121     0.8725 0.044 0.000 0.000 0.000 0.956
#> GSM182765     5  0.0955     0.8760 0.028 0.000 0.000 0.004 0.968
#> GSM182766     2  0.0404     0.8297 0.000 0.988 0.000 0.012 0.000
#> GSM182767     3  0.0932     0.6994 0.000 0.004 0.972 0.020 0.004
#> GSM182768     3  0.3416     0.6925 0.000 0.072 0.840 0.088 0.000
#> GSM182769     3  0.6816     0.2820 0.236 0.000 0.460 0.296 0.008
#> GSM182770     2  0.0703     0.8299 0.000 0.976 0.000 0.024 0.000
#> GSM182771     5  0.1168     0.8642 0.008 0.000 0.000 0.032 0.960
#> GSM182772     2  0.0794     0.8294 0.000 0.972 0.000 0.028 0.000
#> GSM182773     3  0.5671     0.5286 0.100 0.000 0.628 0.264 0.008
#> GSM182774     1  0.5398    -0.0823 0.648 0.000 0.000 0.240 0.112
#> GSM182775     1  0.6582     0.3489 0.500 0.000 0.184 0.308 0.008
#> GSM182776     1  0.3578     0.5908 0.784 0.000 0.004 0.204 0.008
#> GSM182777     1  0.5692     0.4826 0.640 0.000 0.072 0.264 0.024
#> GSM182802     2  0.1608     0.8234 0.000 0.928 0.000 0.072 0.000
#> GSM182803     1  0.1764     0.5928 0.928 0.000 0.000 0.064 0.008
#> GSM182804     2  0.2561     0.7981 0.000 0.856 0.000 0.144 0.000
#> GSM182805     2  0.1671     0.8223 0.000 0.924 0.000 0.076 0.000
#> GSM182806     1  0.0609     0.6469 0.980 0.000 0.000 0.000 0.020
#> GSM182807     1  0.0451     0.6443 0.988 0.000 0.000 0.004 0.008
#> GSM182808     1  0.0579     0.6431 0.984 0.000 0.000 0.008 0.008
#> GSM182809     2  0.2690     0.7913 0.000 0.844 0.000 0.156 0.000
#> GSM182810     4  0.4829     0.6849 0.484 0.000 0.000 0.496 0.020
#> GSM182811     4  0.6105     0.7863 0.392 0.008 0.000 0.500 0.100
#> GSM182812     4  0.6069     0.7668 0.432 0.000 0.000 0.448 0.120
#> GSM182813     1  0.0290     0.6449 0.992 0.000 0.000 0.000 0.008
#> GSM182778     2  0.0693     0.8264 0.000 0.980 0.008 0.012 0.000
#> GSM182779     5  0.1442     0.8725 0.032 0.000 0.004 0.012 0.952
#> GSM182780     2  0.4637     0.5179 0.000 0.672 0.292 0.036 0.000
#> GSM182781     1  0.4798     0.1162 0.540 0.000 0.000 0.020 0.440
#> GSM182782     2  0.0693     0.8264 0.000 0.980 0.008 0.012 0.000
#> GSM182783     2  0.5216     0.1257 0.000 0.520 0.436 0.044 0.000
#> GSM182784     3  0.1243     0.6989 0.000 0.004 0.960 0.028 0.008
#> GSM182785     3  0.5804     0.3613 0.000 0.312 0.604 0.044 0.040
#> GSM182786     2  0.0693     0.8264 0.000 0.980 0.008 0.012 0.000
#> GSM182787     2  0.1914     0.8077 0.000 0.924 0.060 0.016 0.000
#> GSM182788     2  0.0693     0.8264 0.000 0.980 0.008 0.012 0.000
#> GSM182789     2  0.5143     0.2024 0.000 0.532 0.428 0.040 0.000
#> GSM182790     1  0.7798     0.3070 0.448 0.000 0.176 0.272 0.104
#> GSM182791     3  0.5836     0.1434 0.000 0.384 0.516 0.100 0.000
#> GSM182792     3  0.2830     0.6963 0.000 0.044 0.876 0.080 0.000
#> GSM182793     2  0.1410     0.8271 0.000 0.940 0.000 0.060 0.000
#> GSM182794     1  0.8025     0.1953 0.404 0.000 0.244 0.248 0.104
#> GSM182795     3  0.3477     0.6824 0.000 0.112 0.832 0.056 0.000
#> GSM182796     5  0.0992     0.8667 0.008 0.000 0.000 0.024 0.968
#> GSM182797     1  0.0771     0.6477 0.976 0.000 0.000 0.004 0.020
#> GSM182798     5  0.1082     0.8652 0.008 0.000 0.000 0.028 0.964
#> GSM182799     3  0.6007     0.0549 0.000 0.396 0.488 0.116 0.000
#> GSM182800     1  0.2233     0.6368 0.904 0.000 0.000 0.080 0.016
#> GSM182801     1  0.4699     0.5428 0.716 0.000 0.032 0.236 0.016
#> GSM182814     1  0.3098     0.4039 0.836 0.000 0.000 0.148 0.016
#> GSM182815     2  0.2561     0.7981 0.000 0.856 0.000 0.144 0.000
#> GSM182816     1  0.3996     0.5741 0.752 0.000 0.012 0.228 0.008
#> GSM182817     4  0.6569     0.7073 0.336 0.000 0.000 0.448 0.216
#> GSM182818     2  0.2561     0.7977 0.000 0.856 0.000 0.144 0.000
#> GSM182819     1  0.3170     0.6084 0.828 0.000 0.008 0.160 0.004
#> GSM182820     1  0.0510     0.6468 0.984 0.000 0.000 0.000 0.016
#> GSM182821     2  0.6377     0.1582 0.000 0.452 0.380 0.168 0.000
#> GSM182822     4  0.5303     0.6354 0.256 0.016 0.032 0.680 0.016
#> GSM182823     1  0.0579     0.6414 0.984 0.000 0.000 0.008 0.008
#> GSM182824     1  0.1410     0.6062 0.940 0.000 0.000 0.060 0.000
#> GSM182825     1  0.4821    -0.6994 0.516 0.000 0.000 0.464 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
#> GSM182755     1  0.0790    0.71889 0.968 0.000 0.000 0.000 0.032 0.000
#> GSM182756     3  0.4592   -0.03895 0.024 0.000 0.564 0.004 0.004 0.404
#> GSM182757     5  0.2299    0.85851 0.012 0.000 0.008 0.012 0.904 0.064
#> GSM182758     3  0.3420    0.36691 0.000 0.000 0.748 0.012 0.000 0.240
#> GSM182759     2  0.3972    0.70303 0.000 0.800 0.012 0.016 0.112 0.060
#> GSM182760     3  0.5385   -0.04932 0.076 0.000 0.556 0.004 0.012 0.352
#> GSM182761     2  0.4760    0.59915 0.000 0.696 0.208 0.020 0.000 0.076
#> GSM182762     5  0.4578    0.21430 0.396 0.000 0.000 0.004 0.568 0.032
#> GSM182763     2  0.4866    0.65548 0.000 0.732 0.152 0.024 0.020 0.072
#> GSM182764     5  0.1493    0.87215 0.004 0.000 0.000 0.004 0.936 0.056
#> GSM182765     5  0.0865    0.87947 0.000 0.000 0.000 0.000 0.964 0.036
#> GSM182766     2  0.0508    0.80141 0.000 0.984 0.000 0.004 0.000 0.012
#> GSM182767     3  0.2473    0.47869 0.000 0.000 0.856 0.008 0.000 0.136
#> GSM182768     3  0.4488    0.49430 0.000 0.036 0.724 0.040 0.000 0.200
#> GSM182769     6  0.6193    0.56516 0.184 0.000 0.276 0.028 0.000 0.512
#> GSM182770     2  0.0603    0.80183 0.000 0.980 0.000 0.004 0.000 0.016
#> GSM182771     5  0.0858    0.87815 0.000 0.000 0.000 0.028 0.968 0.004
#> GSM182772     2  0.0603    0.80140 0.000 0.980 0.000 0.004 0.000 0.016
#> GSM182773     6  0.5487    0.26094 0.080 0.000 0.416 0.016 0.000 0.488
#> GSM182774     1  0.5891    0.00108 0.524 0.000 0.000 0.336 0.108 0.032
#> GSM182775     1  0.5535   -0.41373 0.460 0.000 0.076 0.020 0.000 0.444
#> GSM182776     1  0.4319    0.58337 0.724 0.000 0.000 0.108 0.000 0.168
#> GSM182777     1  0.4532    0.14617 0.628 0.000 0.020 0.004 0.012 0.336
#> GSM182802     2  0.2129    0.78959 0.000 0.904 0.000 0.040 0.000 0.056
#> GSM182803     1  0.3198    0.58376 0.796 0.000 0.000 0.188 0.008 0.008
#> GSM182804     2  0.3466    0.75051 0.000 0.816 0.004 0.084 0.000 0.096
#> GSM182805     2  0.2070    0.79002 0.000 0.908 0.000 0.044 0.000 0.048
#> GSM182806     1  0.0653    0.72571 0.980 0.000 0.000 0.004 0.012 0.004
#> GSM182807     1  0.0767    0.72563 0.976 0.000 0.000 0.008 0.012 0.004
#> GSM182808     1  0.0692    0.72386 0.976 0.000 0.000 0.020 0.000 0.004
#> GSM182809     2  0.4001    0.73127 0.000 0.784 0.016 0.092 0.000 0.108
#> GSM182810     4  0.3357    0.82595 0.224 0.000 0.000 0.764 0.004 0.008
#> GSM182811     4  0.4074    0.82957 0.184 0.000 0.000 0.756 0.040 0.020
#> GSM182812     4  0.4731    0.81139 0.232 0.000 0.000 0.672 0.092 0.004
#> GSM182813     1  0.0622    0.72555 0.980 0.000 0.000 0.008 0.012 0.000
#> GSM182778     2  0.1078    0.79817 0.000 0.964 0.012 0.008 0.000 0.016
#> GSM182779     5  0.1194    0.87859 0.000 0.000 0.004 0.008 0.956 0.032
#> GSM182780     2  0.5137    0.43832 0.000 0.588 0.328 0.012 0.000 0.072
#> GSM182781     1  0.4943    0.24147 0.576 0.000 0.000 0.008 0.360 0.056
#> GSM182782     2  0.1251    0.79643 0.000 0.956 0.012 0.008 0.000 0.024
#> GSM182783     2  0.6057   -0.01690 0.000 0.456 0.368 0.016 0.000 0.160
#> GSM182784     3  0.1866    0.49289 0.000 0.000 0.908 0.008 0.000 0.084
#> GSM182785     3  0.6409    0.46004 0.000 0.196 0.588 0.028 0.044 0.144
#> GSM182786     2  0.1409    0.79469 0.000 0.948 0.012 0.008 0.000 0.032
#> GSM182787     2  0.3281    0.73280 0.000 0.828 0.124 0.012 0.000 0.036
#> GSM182788     2  0.1409    0.79469 0.000 0.948 0.012 0.008 0.000 0.032
#> GSM182789     2  0.5541    0.05185 0.000 0.452 0.448 0.016 0.000 0.084
#> GSM182790     6  0.6564    0.42277 0.408 0.000 0.092 0.016 0.056 0.428
#> GSM182791     3  0.6636    0.32586 0.000 0.288 0.456 0.048 0.000 0.208
#> GSM182792     3  0.4105    0.49587 0.000 0.020 0.752 0.040 0.000 0.188
#> GSM182793     2  0.1760    0.79627 0.000 0.928 0.004 0.020 0.000 0.048
#> GSM182794     6  0.6872    0.56687 0.352 0.000 0.160 0.012 0.052 0.424
#> GSM182795     3  0.5173    0.49061 0.000 0.104 0.668 0.028 0.000 0.200
#> GSM182796     5  0.0692    0.88082 0.000 0.000 0.000 0.020 0.976 0.004
#> GSM182797     1  0.0458    0.72437 0.984 0.000 0.000 0.000 0.016 0.000
#> GSM182798     5  0.0692    0.88082 0.000 0.000 0.000 0.020 0.976 0.004
#> GSM182799     3  0.6895    0.22953 0.000 0.332 0.408 0.072 0.000 0.188
#> GSM182800     1  0.4395    0.62588 0.740 0.000 0.000 0.164 0.016 0.080
#> GSM182801     1  0.4190    0.47244 0.724 0.000 0.012 0.040 0.000 0.224
#> GSM182814     1  0.3940    0.22252 0.640 0.000 0.000 0.348 0.000 0.012
#> GSM182815     2  0.3516    0.74857 0.000 0.812 0.004 0.088 0.000 0.096
#> GSM182816     1  0.4513    0.54339 0.704 0.000 0.000 0.124 0.000 0.172
#> GSM182817     4  0.5240    0.76663 0.256 0.000 0.000 0.636 0.080 0.028
#> GSM182818     2  0.3227    0.75731 0.000 0.828 0.000 0.088 0.000 0.084
#> GSM182819     1  0.3914    0.60975 0.768 0.000 0.000 0.104 0.000 0.128
#> GSM182820     1  0.0508    0.72541 0.984 0.000 0.000 0.004 0.012 0.000
#> GSM182821     3  0.7149    0.15332 0.000 0.316 0.372 0.088 0.000 0.224
#> GSM182822     4  0.4565    0.66900 0.100 0.004 0.020 0.744 0.000 0.132
#> GSM182823     1  0.1500    0.71716 0.936 0.000 0.000 0.052 0.012 0.000
#> GSM182824     1  0.2473    0.67010 0.856 0.000 0.000 0.136 0.000 0.008
#> GSM182825     4  0.3371    0.77822 0.292 0.000 0.000 0.708 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-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 stress(p) development.stage(p) k
#> CV:skmeans 67     0.522             0.104950 2
#> CV:skmeans 60     0.341             0.008898 3
#> CV:skmeans 60     0.675             0.000671 4
#> CV:skmeans 55     0.907             0.000101 5
#> CV:skmeans 47     0.996             0.000638 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 18172 rows and 71 columns.
#>   Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'CV' method.
#>   Subgroups are detected by 'pam' method.
#>   Performed in total 1250 partitions by row resampling.
#>   Best k for subgroups seems to be 6.
#> 
#> Following methods can be applied to this 'ConsensusPartition' object:
#>  [1] "cola_report"             "collect_classes"         "collect_plots"          
#>  [4] "collect_stats"           "colnames"                "compare_signatures"     
#>  [7] "consensus_heatmap"       "dimension_reduction"     "functional_enrichment"  
#> [10] "get_anno_col"            "get_anno"                "get_classes"            
#> [13] "get_consensus"           "get_matrix"              "get_membership"         
#> [16] "get_param"               "get_signatures"          "get_stats"              
#> [19] "is_best_k"               "is_stable_k"             "membership_heatmap"     
#> [22] "ncol"                    "nrow"                    "plot_ecdf"              
#> [25] "rownames"                "select_partition_number" "show"                   
#> [28] "suggest_best_k"          "test_to_known_factors"

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

collect_plots(res)

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.472           0.758       0.815         0.4284 0.529   0.529
#> 3 3 0.394           0.564       0.762         0.3823 0.594   0.399
#> 4 4 0.609           0.628       0.821         0.1921 0.760   0.489
#> 5 5 0.698           0.623       0.822         0.0997 0.896   0.657
#> 6 6 0.754           0.634       0.833         0.0395 0.900   0.607

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
#> GSM182755     1  0.9866      0.638 0.568 0.432
#> GSM182756     1  0.0000      0.689 1.000 0.000
#> GSM182757     1  0.0000      0.689 1.000 0.000
#> GSM182758     1  0.7299      0.139 0.796 0.204
#> GSM182759     2  0.9866      0.999 0.432 0.568
#> GSM182760     1  0.0000      0.689 1.000 0.000
#> GSM182761     2  0.9866      0.999 0.432 0.568
#> GSM182762     1  0.9833      0.639 0.576 0.424
#> GSM182763     2  0.9866      0.999 0.432 0.568
#> GSM182764     1  0.0938      0.692 0.988 0.012
#> GSM182765     1  0.0000      0.689 1.000 0.000
#> GSM182766     2  0.9866      0.999 0.432 0.568
#> GSM182767     2  0.9866      0.999 0.432 0.568
#> GSM182768     1  0.8763     -0.297 0.704 0.296
#> GSM182769     1  0.0000      0.689 1.000 0.000
#> GSM182770     2  0.9866      0.999 0.432 0.568
#> GSM182771     1  0.2043      0.696 0.968 0.032
#> GSM182772     2  0.9866      0.999 0.432 0.568
#> GSM182773     1  0.0000      0.689 1.000 0.000
#> GSM182774     1  0.0000      0.689 1.000 0.000
#> GSM182775     1  0.4161      0.689 0.916 0.084
#> GSM182776     1  0.0000      0.689 1.000 0.000
#> GSM182777     1  0.2236      0.696 0.964 0.036
#> GSM182802     2  0.9866      0.999 0.432 0.568
#> GSM182803     1  0.9866      0.638 0.568 0.432
#> GSM182804     2  0.9909      0.980 0.444 0.556
#> GSM182805     2  0.9866      0.999 0.432 0.568
#> GSM182806     1  0.9866      0.638 0.568 0.432
#> GSM182807     1  0.9866      0.638 0.568 0.432
#> GSM182808     1  0.9866      0.638 0.568 0.432
#> GSM182809     2  0.9866      0.999 0.432 0.568
#> GSM182810     1  0.0000      0.689 1.000 0.000
#> GSM182811     1  0.0000      0.689 1.000 0.000
#> GSM182812     1  0.0000      0.689 1.000 0.000
#> GSM182813     1  0.9866      0.638 0.568 0.432
#> GSM182778     2  0.9866      0.999 0.432 0.568
#> GSM182779     1  0.2043      0.696 0.968 0.032
#> GSM182780     2  0.9866      0.999 0.432 0.568
#> GSM182781     1  0.9866      0.638 0.568 0.432
#> GSM182782     2  0.9866      0.999 0.432 0.568
#> GSM182783     2  0.9866      0.999 0.432 0.568
#> GSM182784     2  0.9866      0.999 0.432 0.568
#> GSM182785     2  0.9866      0.999 0.432 0.568
#> GSM182786     2  0.9866      0.999 0.432 0.568
#> GSM182787     2  0.9866      0.999 0.432 0.568
#> GSM182788     2  0.9866      0.999 0.432 0.568
#> GSM182789     2  0.9866      0.999 0.432 0.568
#> GSM182790     1  0.8443      0.665 0.728 0.272
#> GSM182791     1  0.8386     -0.175 0.732 0.268
#> GSM182792     1  0.0000      0.689 1.000 0.000
#> GSM182793     2  0.9866      0.999 0.432 0.568
#> GSM182794     1  0.0376      0.690 0.996 0.004
#> GSM182795     1  0.0000      0.689 1.000 0.000
#> GSM182796     1  0.1633      0.695 0.976 0.024
#> GSM182797     1  0.9866      0.638 0.568 0.432
#> GSM182798     1  0.2043      0.696 0.968 0.032
#> GSM182799     2  0.9866      0.999 0.432 0.568
#> GSM182800     1  0.0000      0.689 1.000 0.000
#> GSM182801     1  0.8443      0.668 0.728 0.272
#> GSM182814     1  0.8207      0.669 0.744 0.256
#> GSM182815     2  0.9866      0.999 0.432 0.568
#> GSM182816     1  0.9866      0.638 0.568 0.432
#> GSM182817     1  0.0000      0.689 1.000 0.000
#> GSM182818     2  0.9866      0.999 0.432 0.568
#> GSM182819     1  0.9866      0.638 0.568 0.432
#> GSM182820     1  0.9866      0.638 0.568 0.432
#> GSM182821     2  0.9866      0.999 0.432 0.568
#> GSM182822     1  0.0000      0.689 1.000 0.000
#> GSM182823     1  0.9866      0.638 0.568 0.432
#> GSM182824     1  0.9866      0.638 0.568 0.432
#> GSM182825     1  0.0000      0.689 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
#> GSM182755     1  0.0000      0.771 1.000 0.000 0.000
#> GSM182756     3  0.5785      0.473 0.332 0.000 0.668
#> GSM182757     3  0.3686      0.492 0.140 0.000 0.860
#> GSM182758     3  0.6807      0.558 0.172 0.092 0.736
#> GSM182759     3  0.5058      0.396 0.000 0.244 0.756
#> GSM182760     3  0.5016      0.531 0.240 0.000 0.760
#> GSM182761     3  0.6252      0.251 0.000 0.444 0.556
#> GSM182762     1  0.6225      0.571 0.568 0.000 0.432
#> GSM182763     3  0.5138      0.385 0.000 0.252 0.748
#> GSM182764     3  0.2537      0.520 0.080 0.000 0.920
#> GSM182765     3  0.0424      0.541 0.008 0.000 0.992
#> GSM182766     2  0.0000      0.940 0.000 1.000 0.000
#> GSM182767     3  0.6215      0.282 0.000 0.428 0.572
#> GSM182768     3  0.8016      0.545 0.188 0.156 0.656
#> GSM182769     3  0.5785      0.473 0.332 0.000 0.668
#> GSM182770     2  0.0000      0.940 0.000 1.000 0.000
#> GSM182771     3  0.4178      0.453 0.172 0.000 0.828
#> GSM182772     2  0.0000      0.940 0.000 1.000 0.000
#> GSM182773     3  0.5785      0.473 0.332 0.000 0.668
#> GSM182774     3  0.5785      0.473 0.332 0.000 0.668
#> GSM182775     3  0.6180      0.266 0.416 0.000 0.584
#> GSM182776     3  0.5785      0.473 0.332 0.000 0.668
#> GSM182777     3  0.5988      0.405 0.368 0.000 0.632
#> GSM182802     2  0.0000      0.940 0.000 1.000 0.000
#> GSM182803     1  0.5016      0.715 0.760 0.000 0.240
#> GSM182804     2  0.6584      0.275 0.012 0.608 0.380
#> GSM182805     2  0.0000      0.940 0.000 1.000 0.000
#> GSM182806     1  0.2448      0.709 0.924 0.000 0.076
#> GSM182807     1  0.0000      0.771 1.000 0.000 0.000
#> GSM182808     1  0.0237      0.771 0.996 0.000 0.004
#> GSM182809     3  0.6244      0.259 0.000 0.440 0.560
#> GSM182810     3  0.5785      0.473 0.332 0.000 0.668
#> GSM182811     3  0.5785      0.473 0.332 0.000 0.668
#> GSM182812     3  0.5785      0.473 0.332 0.000 0.668
#> GSM182813     1  0.0000      0.771 1.000 0.000 0.000
#> GSM182778     2  0.0000      0.940 0.000 1.000 0.000
#> GSM182779     3  0.4178      0.453 0.172 0.000 0.828
#> GSM182780     3  0.6252      0.251 0.000 0.444 0.556
#> GSM182781     1  0.5016      0.715 0.760 0.000 0.240
#> GSM182782     2  0.0000      0.940 0.000 1.000 0.000
#> GSM182783     3  0.6252      0.251 0.000 0.444 0.556
#> GSM182784     3  0.6215      0.282 0.000 0.428 0.572
#> GSM182785     3  0.6225      0.276 0.000 0.432 0.568
#> GSM182786     2  0.0000      0.940 0.000 1.000 0.000
#> GSM182787     3  0.6252      0.251 0.000 0.444 0.556
#> GSM182788     2  0.0000      0.940 0.000 1.000 0.000
#> GSM182789     3  0.6252      0.251 0.000 0.444 0.556
#> GSM182790     1  0.6111      0.432 0.604 0.000 0.396
#> GSM182791     3  0.7298      0.560 0.100 0.200 0.700
#> GSM182792     3  0.4452      0.547 0.192 0.000 0.808
#> GSM182793     2  0.0000      0.940 0.000 1.000 0.000
#> GSM182794     3  0.0237      0.539 0.004 0.000 0.996
#> GSM182795     3  0.4682      0.548 0.192 0.004 0.804
#> GSM182796     3  0.4062      0.465 0.164 0.000 0.836
#> GSM182797     1  0.0000      0.771 1.000 0.000 0.000
#> GSM182798     3  0.4605      0.434 0.204 0.000 0.796
#> GSM182799     3  0.6225      0.276 0.000 0.432 0.568
#> GSM182800     3  0.5529      0.500 0.296 0.000 0.704
#> GSM182801     1  0.6126      0.403 0.600 0.000 0.400
#> GSM182814     1  0.6180      0.353 0.584 0.000 0.416
#> GSM182815     2  0.0000      0.940 0.000 1.000 0.000
#> GSM182816     1  0.4974      0.719 0.764 0.000 0.236
#> GSM182817     3  0.5785      0.473 0.332 0.000 0.668
#> GSM182818     2  0.4062      0.704 0.000 0.836 0.164
#> GSM182819     1  0.4974      0.719 0.764 0.000 0.236
#> GSM182820     1  0.0000      0.771 1.000 0.000 0.000
#> GSM182821     3  0.6225      0.276 0.000 0.432 0.568
#> GSM182822     3  0.5706      0.484 0.320 0.000 0.680
#> GSM182823     1  0.0000      0.771 1.000 0.000 0.000
#> GSM182824     1  0.4291      0.743 0.820 0.000 0.180
#> GSM182825     3  0.5785      0.473 0.332 0.000 0.668

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM182755     4  0.0000    1.00000 0.000 0.000 0.000 1.000
#> GSM182756     1  0.4855    0.31124 0.600 0.000 0.400 0.000
#> GSM182757     3  0.3569    0.37293 0.196 0.000 0.804 0.000
#> GSM182758     3  0.6494    0.33981 0.340 0.088 0.572 0.000
#> GSM182759     3  0.0188    0.55905 0.000 0.004 0.996 0.000
#> GSM182760     1  0.4999    0.04571 0.508 0.000 0.492 0.000
#> GSM182761     3  0.4955    0.44148 0.000 0.444 0.556 0.000
#> GSM182762     1  0.6310    0.25423 0.512 0.000 0.428 0.060
#> GSM182763     3  0.0817    0.55819 0.000 0.024 0.976 0.000
#> GSM182764     3  0.2329    0.50751 0.072 0.000 0.916 0.012
#> GSM182765     3  0.0336    0.55475 0.008 0.000 0.992 0.000
#> GSM182766     2  0.0000    0.93147 0.000 1.000 0.000 0.000
#> GSM182767     3  0.4925    0.46103 0.000 0.428 0.572 0.000
#> GSM182768     3  0.6950    0.45743 0.272 0.156 0.572 0.000
#> GSM182769     1  0.0000    0.79562 1.000 0.000 0.000 0.000
#> GSM182770     2  0.0000    0.93147 0.000 1.000 0.000 0.000
#> GSM182771     3  0.4790    0.00791 0.380 0.000 0.620 0.000
#> GSM182772     2  0.0000    0.93147 0.000 1.000 0.000 0.000
#> GSM182773     1  0.0188    0.79442 0.996 0.000 0.004 0.000
#> GSM182774     1  0.0000    0.79562 1.000 0.000 0.000 0.000
#> GSM182775     1  0.0000    0.79562 1.000 0.000 0.000 0.000
#> GSM182776     1  0.0000    0.79562 1.000 0.000 0.000 0.000
#> GSM182777     1  0.0000    0.79562 1.000 0.000 0.000 0.000
#> GSM182802     2  0.0000    0.93147 0.000 1.000 0.000 0.000
#> GSM182803     1  0.0188    0.79482 0.996 0.000 0.000 0.004
#> GSM182804     2  0.5217    0.05506 0.012 0.608 0.380 0.000
#> GSM182805     2  0.0000    0.93147 0.000 1.000 0.000 0.000
#> GSM182806     4  0.0000    1.00000 0.000 0.000 0.000 1.000
#> GSM182807     4  0.0000    1.00000 0.000 0.000 0.000 1.000
#> GSM182808     4  0.0000    1.00000 0.000 0.000 0.000 1.000
#> GSM182809     3  0.4948    0.44723 0.000 0.440 0.560 0.000
#> GSM182810     1  0.1940    0.75823 0.924 0.000 0.076 0.000
#> GSM182811     1  0.4866    0.30261 0.596 0.000 0.404 0.000
#> GSM182812     1  0.4843    0.32032 0.604 0.000 0.396 0.000
#> GSM182813     4  0.0000    1.00000 0.000 0.000 0.000 1.000
#> GSM182778     2  0.0000    0.93147 0.000 1.000 0.000 0.000
#> GSM182779     3  0.4382    0.20256 0.296 0.000 0.704 0.000
#> GSM182780     3  0.4955    0.44148 0.000 0.444 0.556 0.000
#> GSM182781     1  0.0188    0.79451 0.996 0.000 0.000 0.004
#> GSM182782     2  0.0000    0.93147 0.000 1.000 0.000 0.000
#> GSM182783     3  0.4955    0.44148 0.000 0.444 0.556 0.000
#> GSM182784     3  0.4925    0.46103 0.000 0.428 0.572 0.000
#> GSM182785     3  0.4933    0.45674 0.000 0.432 0.568 0.000
#> GSM182786     2  0.0000    0.93147 0.000 1.000 0.000 0.000
#> GSM182787     3  0.4955    0.44148 0.000 0.444 0.556 0.000
#> GSM182788     2  0.0000    0.93147 0.000 1.000 0.000 0.000
#> GSM182789     3  0.4955    0.44148 0.000 0.444 0.556 0.000
#> GSM182790     1  0.0000    0.79562 1.000 0.000 0.000 0.000
#> GSM182791     3  0.7054    0.50872 0.232 0.196 0.572 0.000
#> GSM182792     3  0.4925    0.12783 0.428 0.000 0.572 0.000
#> GSM182793     2  0.0000    0.93147 0.000 1.000 0.000 0.000
#> GSM182794     3  0.1211    0.53956 0.040 0.000 0.960 0.000
#> GSM182795     3  0.4925    0.12783 0.428 0.000 0.572 0.000
#> GSM182796     3  0.3400    0.39596 0.180 0.000 0.820 0.000
#> GSM182797     4  0.0000    1.00000 0.000 0.000 0.000 1.000
#> GSM182798     3  0.3853    0.40842 0.160 0.000 0.820 0.020
#> GSM182799     3  0.4925    0.46103 0.000 0.428 0.572 0.000
#> GSM182800     1  0.2216    0.74505 0.908 0.000 0.092 0.000
#> GSM182801     1  0.0000    0.79562 1.000 0.000 0.000 0.000
#> GSM182814     1  0.0000    0.79562 1.000 0.000 0.000 0.000
#> GSM182815     2  0.0000    0.93147 0.000 1.000 0.000 0.000
#> GSM182816     1  0.4382    0.56746 0.704 0.000 0.000 0.296
#> GSM182817     1  0.4134    0.56430 0.740 0.000 0.260 0.000
#> GSM182818     2  0.3219    0.66140 0.000 0.836 0.164 0.000
#> GSM182819     1  0.4855    0.40392 0.600 0.000 0.000 0.400
#> GSM182820     4  0.0000    1.00000 0.000 0.000 0.000 1.000
#> GSM182821     3  0.4925    0.46103 0.000 0.428 0.572 0.000
#> GSM182822     1  0.4500    0.48450 0.684 0.000 0.316 0.000
#> GSM182823     4  0.0000    1.00000 0.000 0.000 0.000 1.000
#> GSM182824     1  0.2973    0.69217 0.856 0.000 0.000 0.144
#> GSM182825     1  0.0000    0.79562 1.000 0.000 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
#> GSM182755     4  0.0000     1.0000 0.000 0.000 0.000 1.000 0.000
#> GSM182756     1  0.5819     0.4282 0.600 0.000 0.148 0.000 0.252
#> GSM182757     5  0.3197     0.7169 0.024 0.000 0.140 0.000 0.836
#> GSM182758     3  0.3508     0.6449 0.000 0.000 0.748 0.000 0.252
#> GSM182759     5  0.3983     0.4262 0.000 0.000 0.340 0.000 0.660
#> GSM182760     1  0.6553     0.1623 0.472 0.000 0.292 0.000 0.236
#> GSM182761     3  0.4242    -0.1511 0.000 0.428 0.572 0.000 0.000
#> GSM182762     5  0.4990     0.3678 0.360 0.000 0.000 0.040 0.600
#> GSM182763     3  0.1792     0.6102 0.000 0.000 0.916 0.000 0.084
#> GSM182764     5  0.2605     0.6931 0.000 0.000 0.148 0.000 0.852
#> GSM182765     5  0.0510     0.7974 0.000 0.000 0.016 0.000 0.984
#> GSM182766     2  0.4152     0.6931 0.000 0.692 0.296 0.000 0.012
#> GSM182767     3  0.5191     0.6060 0.000 0.088 0.660 0.000 0.252
#> GSM182768     3  0.3508     0.6449 0.000 0.000 0.748 0.000 0.252
#> GSM182769     1  0.0000     0.7928 1.000 0.000 0.000 0.000 0.000
#> GSM182770     2  0.0000     0.7520 0.000 1.000 0.000 0.000 0.000
#> GSM182771     5  0.2130     0.7661 0.080 0.000 0.012 0.000 0.908
#> GSM182772     2  0.0162     0.7518 0.000 0.996 0.000 0.000 0.004
#> GSM182773     1  0.0162     0.7917 0.996 0.000 0.004 0.000 0.000
#> GSM182774     1  0.0000     0.7928 1.000 0.000 0.000 0.000 0.000
#> GSM182775     1  0.0000     0.7928 1.000 0.000 0.000 0.000 0.000
#> GSM182776     1  0.0000     0.7928 1.000 0.000 0.000 0.000 0.000
#> GSM182777     1  0.0000     0.7928 1.000 0.000 0.000 0.000 0.000
#> GSM182802     2  0.0290     0.7518 0.000 0.992 0.000 0.000 0.008
#> GSM182803     1  0.0162     0.7919 0.996 0.000 0.000 0.004 0.000
#> GSM182804     3  0.3051     0.4187 0.000 0.120 0.852 0.000 0.028
#> GSM182805     2  0.3890     0.7110 0.000 0.736 0.252 0.000 0.012
#> GSM182806     4  0.0000     1.0000 0.000 0.000 0.000 1.000 0.000
#> GSM182807     4  0.0000     1.0000 0.000 0.000 0.000 1.000 0.000
#> GSM182808     4  0.0000     1.0000 0.000 0.000 0.000 1.000 0.000
#> GSM182809     3  0.3039     0.6486 0.000 0.000 0.808 0.000 0.192
#> GSM182810     1  0.1997     0.7592 0.924 0.000 0.040 0.000 0.036
#> GSM182811     1  0.5866     0.4230 0.596 0.000 0.156 0.000 0.248
#> GSM182812     1  0.4588     0.4458 0.604 0.000 0.016 0.000 0.380
#> GSM182813     4  0.0000     1.0000 0.000 0.000 0.000 1.000 0.000
#> GSM182778     2  0.0162     0.7518 0.000 0.996 0.000 0.000 0.004
#> GSM182779     5  0.1522     0.7907 0.044 0.000 0.012 0.000 0.944
#> GSM182780     3  0.4242    -0.1511 0.000 0.428 0.572 0.000 0.000
#> GSM182781     1  0.0162     0.7916 0.996 0.000 0.000 0.004 0.000
#> GSM182782     2  0.3353     0.7357 0.000 0.796 0.196 0.000 0.008
#> GSM182783     3  0.1851     0.4936 0.000 0.088 0.912 0.000 0.000
#> GSM182784     2  0.6718    -0.3068 0.000 0.400 0.348 0.000 0.252
#> GSM182785     2  0.6588    -0.2677 0.000 0.400 0.392 0.000 0.208
#> GSM182786     2  0.2011     0.7540 0.000 0.908 0.088 0.000 0.004
#> GSM182787     3  0.4390    -0.1597 0.000 0.428 0.568 0.000 0.004
#> GSM182788     2  0.3550     0.7222 0.000 0.760 0.236 0.000 0.004
#> GSM182789     3  0.5810    -0.0198 0.000 0.428 0.480 0.000 0.092
#> GSM182790     1  0.0000     0.7928 1.000 0.000 0.000 0.000 0.000
#> GSM182791     3  0.3508     0.6449 0.000 0.000 0.748 0.000 0.252
#> GSM182792     3  0.3508     0.6449 0.000 0.000 0.748 0.000 0.252
#> GSM182793     2  0.3388     0.5496 0.000 0.792 0.200 0.000 0.008
#> GSM182794     3  0.4342     0.6125 0.040 0.000 0.728 0.000 0.232
#> GSM182795     3  0.3508     0.6449 0.000 0.000 0.748 0.000 0.252
#> GSM182796     5  0.0693     0.8012 0.008 0.000 0.012 0.000 0.980
#> GSM182797     4  0.0000     1.0000 0.000 0.000 0.000 1.000 0.000
#> GSM182798     5  0.0693     0.8012 0.008 0.000 0.012 0.000 0.980
#> GSM182799     3  0.3003     0.6413 0.000 0.000 0.812 0.000 0.188
#> GSM182800     1  0.4747     0.0827 0.500 0.000 0.484 0.000 0.016
#> GSM182801     1  0.0000     0.7928 1.000 0.000 0.000 0.000 0.000
#> GSM182814     1  0.0000     0.7928 1.000 0.000 0.000 0.000 0.000
#> GSM182815     2  0.0798     0.7465 0.000 0.976 0.016 0.000 0.008
#> GSM182816     1  0.3774     0.5630 0.704 0.000 0.000 0.296 0.000
#> GSM182817     1  0.4558     0.6077 0.740 0.000 0.080 0.000 0.180
#> GSM182818     2  0.4016     0.7064 0.000 0.716 0.272 0.000 0.012
#> GSM182819     1  0.4182     0.3929 0.600 0.000 0.000 0.400 0.000
#> GSM182820     4  0.0000     1.0000 0.000 0.000 0.000 1.000 0.000
#> GSM182821     3  0.3508     0.6449 0.000 0.000 0.748 0.000 0.252
#> GSM182822     1  0.5305     0.5445 0.676 0.000 0.172 0.000 0.152
#> GSM182823     4  0.0000     1.0000 0.000 0.000 0.000 1.000 0.000
#> GSM182824     1  0.2561     0.6991 0.856 0.000 0.000 0.144 0.000
#> GSM182825     1  0.0000     0.7928 1.000 0.000 0.000 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
#> GSM182755     1  0.0000    1.00000 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM182756     6  0.3975    0.41101 0.000 0.000 0.392 0.000 0.008 0.600
#> GSM182757     5  0.4092    0.56917 0.000 0.000 0.344 0.000 0.636 0.020
#> GSM182758     3  0.0000    0.74210 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM182759     5  0.5031    0.25369 0.000 0.000 0.448 0.072 0.480 0.000
#> GSM182760     3  0.4083   -0.05744 0.000 0.000 0.532 0.000 0.008 0.460
#> GSM182761     4  0.3288    0.44055 0.000 0.000 0.276 0.724 0.000 0.000
#> GSM182762     5  0.4396    0.42312 0.036 0.000 0.000 0.000 0.612 0.352
#> GSM182763     3  0.2527    0.60601 0.000 0.000 0.832 0.168 0.000 0.000
#> GSM182764     5  0.3578    0.57807 0.000 0.000 0.340 0.000 0.660 0.000
#> GSM182765     5  0.1714    0.73569 0.000 0.000 0.092 0.000 0.908 0.000
#> GSM182766     4  0.1265    0.54927 0.000 0.008 0.044 0.948 0.000 0.000
#> GSM182767     3  0.1663    0.68876 0.000 0.000 0.912 0.088 0.000 0.000
#> GSM182768     3  0.0000    0.74210 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM182769     6  0.0000    0.83464 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM182770     4  0.4517    0.20293 0.000 0.444 0.000 0.524 0.032 0.000
#> GSM182771     5  0.1082    0.72560 0.000 0.000 0.040 0.000 0.956 0.004
#> GSM182772     2  0.1789    0.73228 0.000 0.924 0.000 0.044 0.032 0.000
#> GSM182773     6  0.0000    0.83464 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM182774     6  0.0000    0.83464 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM182775     6  0.0000    0.83464 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM182776     6  0.0000    0.83464 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM182777     6  0.0260    0.83320 0.000 0.000 0.000 0.000 0.008 0.992
#> GSM182802     4  0.4170    0.38179 0.000 0.308 0.000 0.660 0.032 0.000
#> GSM182803     6  0.0146    0.83421 0.004 0.000 0.000 0.000 0.000 0.996
#> GSM182804     4  0.3810    0.14119 0.000 0.000 0.428 0.572 0.000 0.000
#> GSM182805     4  0.0000    0.54543 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM182806     1  0.0000    1.00000 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM182807     1  0.0000    1.00000 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM182808     1  0.0000    1.00000 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM182809     3  0.1327    0.71304 0.000 0.000 0.936 0.064 0.000 0.000
#> GSM182810     6  0.2433    0.79516 0.000 0.044 0.072 0.000 0.000 0.884
#> GSM182811     6  0.5256    0.40925 0.000 0.044 0.368 0.000 0.032 0.556
#> GSM182812     6  0.6062    0.47620 0.000 0.044 0.140 0.000 0.256 0.560
#> GSM182813     1  0.0000    1.00000 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM182778     2  0.1007    0.74972 0.000 0.956 0.000 0.044 0.000 0.000
#> GSM182779     5  0.1556    0.73678 0.000 0.000 0.080 0.000 0.920 0.000
#> GSM182780     4  0.3288    0.44055 0.000 0.000 0.276 0.724 0.000 0.000
#> GSM182781     6  0.0146    0.83408 0.000 0.000 0.000 0.000 0.004 0.996
#> GSM182782     2  0.3409    0.71444 0.000 0.700 0.000 0.300 0.000 0.000
#> GSM182783     3  0.3717    0.23964 0.000 0.000 0.616 0.384 0.000 0.000
#> GSM182784     3  0.3993    0.17563 0.000 0.000 0.592 0.400 0.008 0.000
#> GSM182785     3  0.4067    0.08364 0.000 0.000 0.548 0.444 0.008 0.000
#> GSM182786     2  0.2491    0.78058 0.000 0.836 0.000 0.164 0.000 0.000
#> GSM182787     4  0.1168    0.54183 0.000 0.028 0.016 0.956 0.000 0.000
#> GSM182788     2  0.3499    0.68571 0.000 0.680 0.000 0.320 0.000 0.000
#> GSM182789     4  0.3817    0.12815 0.000 0.000 0.432 0.568 0.000 0.000
#> GSM182790     6  0.0000    0.83464 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM182791     3  0.0000    0.74210 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM182792     3  0.0146    0.74129 0.000 0.000 0.996 0.000 0.000 0.004
#> GSM182793     4  0.6429    0.27148 0.000 0.308 0.200 0.460 0.032 0.000
#> GSM182794     3  0.1257    0.72627 0.000 0.000 0.952 0.000 0.020 0.028
#> GSM182795     3  0.0000    0.74210 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM182796     5  0.0937    0.72605 0.000 0.000 0.040 0.000 0.960 0.000
#> GSM182797     1  0.0000    1.00000 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM182798     5  0.0937    0.72605 0.000 0.000 0.040 0.000 0.960 0.000
#> GSM182799     3  0.2092    0.64604 0.000 0.000 0.876 0.124 0.000 0.000
#> GSM182800     3  0.4097    0.00113 0.000 0.000 0.504 0.000 0.008 0.488
#> GSM182801     6  0.0260    0.83320 0.000 0.000 0.000 0.000 0.008 0.992
#> GSM182814     6  0.1007    0.82071 0.000 0.044 0.000 0.000 0.000 0.956
#> GSM182815     4  0.4590    0.38245 0.000 0.308 0.016 0.644 0.032 0.000
#> GSM182816     6  0.3371    0.60155 0.292 0.000 0.000 0.000 0.000 0.708
#> GSM182817     6  0.3175    0.64358 0.000 0.000 0.256 0.000 0.000 0.744
#> GSM182818     4  0.0547    0.55078 0.000 0.000 0.020 0.980 0.000 0.000
#> GSM182819     6  0.3756    0.41890 0.400 0.000 0.000 0.000 0.000 0.600
#> GSM182820     1  0.0000    1.00000 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM182821     3  0.0000    0.74210 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM182822     6  0.4408    0.52129 0.000 0.044 0.320 0.000 0.000 0.636
#> GSM182823     1  0.0000    1.00000 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM182824     6  0.3066    0.73889 0.124 0.044 0.000 0.000 0.000 0.832
#> GSM182825     6  0.1007    0.82071 0.000 0.044 0.000 0.000 0.000 0.956

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 stress(p) development.stage(p) k
#> CV:pam 68     0.577               0.3813 2
#> CV:pam 36     0.895               0.0017 3
#> CV:pam 43     0.674               0.0394 4
#> CV:pam 55     0.893               0.0204 5
#> CV:pam 52     0.774               0.0103 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 18172 rows and 71 columns.
#>   Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'CV' method.
#>   Subgroups are detected by 'mclust' method.
#>   Performed in total 1250 partitions by row resampling.
#>   Best k for subgroups seems to be 5.
#> 
#> Following methods can be applied to this 'ConsensusPartition' object:
#>  [1] "cola_report"             "collect_classes"         "collect_plots"          
#>  [4] "collect_stats"           "colnames"                "compare_signatures"     
#>  [7] "consensus_heatmap"       "dimension_reduction"     "functional_enrichment"  
#> [10] "get_anno_col"            "get_anno"                "get_classes"            
#> [13] "get_consensus"           "get_matrix"              "get_membership"         
#> [16] "get_param"               "get_signatures"          "get_stats"              
#> [19] "is_best_k"               "is_stable_k"             "membership_heatmap"     
#> [22] "ncol"                    "nrow"                    "plot_ecdf"              
#> [25] "rownames"                "select_partition_number" "show"                   
#> [28] "suggest_best_k"          "test_to_known_factors"

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

collect_plots(res)

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.664           0.866       0.931         0.3967 0.577   0.577
#> 3 3 0.364           0.557       0.802         0.5330 0.651   0.451
#> 4 4 0.457           0.484       0.681         0.1309 0.843   0.593
#> 5 5 0.618           0.690       0.782         0.1078 0.885   0.630
#> 6 6 0.716           0.619       0.774         0.0623 0.895   0.608

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
#> GSM182755     1  0.1633      0.950 0.976 0.024
#> GSM182756     2  0.0000      0.838 0.000 1.000
#> GSM182757     1  0.2423      0.940 0.960 0.040
#> GSM182758     2  0.0000      0.838 0.000 1.000
#> GSM182759     1  0.1633      0.950 0.976 0.024
#> GSM182760     2  0.7139      0.769 0.196 0.804
#> GSM182761     1  0.8081      0.647 0.752 0.248
#> GSM182762     1  0.1633      0.950 0.976 0.024
#> GSM182763     1  0.2043      0.946 0.968 0.032
#> GSM182764     1  0.1633      0.950 0.976 0.024
#> GSM182765     1  0.1633      0.950 0.976 0.024
#> GSM182766     1  0.1633      0.950 0.976 0.024
#> GSM182767     2  0.0000      0.838 0.000 1.000
#> GSM182768     2  0.0000      0.838 0.000 1.000
#> GSM182769     2  0.0672      0.837 0.008 0.992
#> GSM182770     1  0.0376      0.954 0.996 0.004
#> GSM182771     1  0.1414      0.951 0.980 0.020
#> GSM182772     1  0.0376      0.954 0.996 0.004
#> GSM182773     2  0.0000      0.838 0.000 1.000
#> GSM182774     1  0.0376      0.954 0.996 0.004
#> GSM182775     2  0.0000      0.838 0.000 1.000
#> GSM182776     1  0.7299      0.728 0.796 0.204
#> GSM182777     2  0.9460      0.556 0.364 0.636
#> GSM182802     1  0.0376      0.954 0.996 0.004
#> GSM182803     1  0.0376      0.954 0.996 0.004
#> GSM182804     1  0.0376      0.954 0.996 0.004
#> GSM182805     1  0.0376      0.954 0.996 0.004
#> GSM182806     1  0.0000      0.952 1.000 0.000
#> GSM182807     1  0.0376      0.954 0.996 0.004
#> GSM182808     1  0.0672      0.954 0.992 0.008
#> GSM182809     1  0.0376      0.954 0.996 0.004
#> GSM182810     1  0.0376      0.954 0.996 0.004
#> GSM182811     1  0.0376      0.954 0.996 0.004
#> GSM182812     1  0.0376      0.954 0.996 0.004
#> GSM182813     1  0.0376      0.954 0.996 0.004
#> GSM182778     1  0.1843      0.950 0.972 0.028
#> GSM182779     1  0.2603      0.937 0.956 0.044
#> GSM182780     2  0.7139      0.770 0.196 0.804
#> GSM182781     1  0.5059      0.863 0.888 0.112
#> GSM182782     1  0.1414      0.951 0.980 0.020
#> GSM182783     2  0.1414      0.835 0.020 0.980
#> GSM182784     2  0.0000      0.838 0.000 1.000
#> GSM182785     2  0.9635      0.507 0.388 0.612
#> GSM182786     1  0.1633      0.950 0.976 0.024
#> GSM182787     1  0.7602      0.710 0.780 0.220
#> GSM182788     1  0.1633      0.950 0.976 0.024
#> GSM182789     2  0.7745      0.744 0.228 0.772
#> GSM182790     2  0.0000      0.838 0.000 1.000
#> GSM182791     2  0.9754      0.450 0.408 0.592
#> GSM182792     2  0.7745      0.745 0.228 0.772
#> GSM182793     1  0.0376      0.954 0.996 0.004
#> GSM182794     2  0.8327      0.711 0.264 0.736
#> GSM182795     2  0.0000      0.838 0.000 1.000
#> GSM182796     1  0.1414      0.951 0.980 0.020
#> GSM182797     1  0.1633      0.950 0.976 0.024
#> GSM182798     1  0.1414      0.951 0.980 0.020
#> GSM182799     2  0.9922      0.216 0.448 0.552
#> GSM182800     1  0.0938      0.953 0.988 0.012
#> GSM182801     2  0.6438      0.753 0.164 0.836
#> GSM182814     1  0.0376      0.954 0.996 0.004
#> GSM182815     1  0.0376      0.954 0.996 0.004
#> GSM182816     1  0.7056      0.748 0.808 0.192
#> GSM182817     1  0.0376      0.954 0.996 0.004
#> GSM182818     1  0.0376      0.954 0.996 0.004
#> GSM182819     1  0.7056      0.748 0.808 0.192
#> GSM182820     1  0.1843      0.950 0.972 0.028
#> GSM182821     1  0.7950      0.662 0.760 0.240
#> GSM182822     1  0.0376      0.954 0.996 0.004
#> GSM182823     1  0.0376      0.954 0.996 0.004
#> GSM182824     1  0.0376      0.954 0.996 0.004
#> GSM182825     1  0.0376      0.954 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
#> GSM182755     1  0.6990     0.5231 0.728 0.108 0.164
#> GSM182756     3  0.0000     0.6867 0.000 0.000 1.000
#> GSM182757     3  0.8737    -0.0430 0.428 0.108 0.464
#> GSM182758     3  0.0000     0.6867 0.000 0.000 1.000
#> GSM182759     3  0.8633    -0.0552 0.436 0.100 0.464
#> GSM182760     3  0.2959     0.6641 0.000 0.100 0.900
#> GSM182761     3  0.5397     0.5483 0.000 0.280 0.720
#> GSM182762     1  0.7610     0.4918 0.676 0.108 0.216
#> GSM182763     3  0.4335     0.6416 0.036 0.100 0.864
#> GSM182764     3  0.8737    -0.0430 0.428 0.108 0.464
#> GSM182765     1  0.8569     0.2510 0.508 0.100 0.392
#> GSM182766     2  0.1289     0.8646 0.032 0.968 0.000
#> GSM182767     3  0.0000     0.6867 0.000 0.000 1.000
#> GSM182768     3  0.0000     0.6867 0.000 0.000 1.000
#> GSM182769     3  0.6225     0.0514 0.432 0.000 0.568
#> GSM182770     2  0.3551     0.8843 0.132 0.868 0.000
#> GSM182771     1  0.8238     0.4709 0.596 0.104 0.300
#> GSM182772     2  0.3551     0.8843 0.132 0.868 0.000
#> GSM182773     3  0.0000     0.6867 0.000 0.000 1.000
#> GSM182774     1  0.5560     0.5399 0.700 0.000 0.300
#> GSM182775     3  0.6126     0.1313 0.400 0.000 0.600
#> GSM182776     1  0.6309     0.0931 0.504 0.000 0.496
#> GSM182777     3  0.8587     0.0385 0.400 0.100 0.500
#> GSM182802     2  0.3116     0.8871 0.108 0.892 0.000
#> GSM182803     1  0.0237     0.6541 0.996 0.004 0.000
#> GSM182804     2  0.3116     0.8871 0.108 0.892 0.000
#> GSM182805     2  0.3116     0.8871 0.108 0.892 0.000
#> GSM182806     1  0.0237     0.6541 0.996 0.004 0.000
#> GSM182807     1  0.0237     0.6541 0.996 0.004 0.000
#> GSM182808     1  0.0000     0.6536 1.000 0.000 0.000
#> GSM182809     2  0.8301     0.4032 0.108 0.592 0.300
#> GSM182810     1  0.6630     0.5372 0.672 0.028 0.300
#> GSM182811     1  0.6630     0.5372 0.672 0.028 0.300
#> GSM182812     1  0.6630     0.5372 0.672 0.028 0.300
#> GSM182813     1  0.0237     0.6541 0.996 0.004 0.000
#> GSM182778     2  0.1289     0.8646 0.032 0.968 0.000
#> GSM182779     3  0.8737    -0.0430 0.428 0.108 0.464
#> GSM182780     3  0.1411     0.6846 0.000 0.036 0.964
#> GSM182781     1  0.6990     0.5231 0.728 0.108 0.164
#> GSM182782     2  0.1289     0.8646 0.032 0.968 0.000
#> GSM182783     3  0.0237     0.6846 0.000 0.004 0.996
#> GSM182784     3  0.0000     0.6867 0.000 0.000 1.000
#> GSM182785     3  0.2959     0.6641 0.000 0.100 0.900
#> GSM182786     2  0.1289     0.8646 0.032 0.968 0.000
#> GSM182787     2  0.4605     0.6368 0.000 0.796 0.204
#> GSM182788     2  0.1289     0.8646 0.032 0.968 0.000
#> GSM182789     3  0.1289     0.6853 0.000 0.032 0.968
#> GSM182790     3  0.6126     0.1313 0.400 0.000 0.600
#> GSM182791     3  0.2959     0.6641 0.000 0.100 0.900
#> GSM182792     3  0.0000     0.6867 0.000 0.000 1.000
#> GSM182793     2  0.3116     0.8871 0.108 0.892 0.000
#> GSM182794     3  0.8587     0.0385 0.400 0.100 0.500
#> GSM182795     3  0.0000     0.6867 0.000 0.000 1.000
#> GSM182796     1  0.8238     0.4709 0.596 0.104 0.300
#> GSM182797     1  0.3116     0.6229 0.892 0.108 0.000
#> GSM182798     1  0.8238     0.4709 0.596 0.104 0.300
#> GSM182799     3  0.4346     0.5809 0.000 0.184 0.816
#> GSM182800     1  0.8040     0.4824 0.608 0.092 0.300
#> GSM182801     3  0.6140     0.1226 0.404 0.000 0.596
#> GSM182814     1  0.1163     0.6470 0.972 0.028 0.000
#> GSM182815     2  0.3116     0.8871 0.108 0.892 0.000
#> GSM182816     1  0.4555     0.5500 0.800 0.000 0.200
#> GSM182817     1  0.5785     0.5401 0.696 0.004 0.300
#> GSM182818     2  0.3116     0.8871 0.108 0.892 0.000
#> GSM182819     1  0.4555     0.5500 0.800 0.000 0.200
#> GSM182820     1  0.2959     0.6255 0.900 0.100 0.000
#> GSM182821     3  0.2796     0.6462 0.092 0.000 0.908
#> GSM182822     1  0.6476     0.2333 0.548 0.004 0.448
#> GSM182823     1  0.1163     0.6470 0.972 0.028 0.000
#> GSM182824     1  0.1163     0.6470 0.972 0.028 0.000
#> GSM182825     1  0.6630     0.5372 0.672 0.028 0.300

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM182755     4  0.4800     0.3649 0.044 0.000 0.196 0.760
#> GSM182756     3  0.0336     0.7809 0.000 0.000 0.992 0.008
#> GSM182757     4  0.5668     0.0310 0.024 0.000 0.444 0.532
#> GSM182758     3  0.0000     0.7801 0.000 0.000 1.000 0.000
#> GSM182759     3  0.5887     0.2528 0.028 0.004 0.548 0.420
#> GSM182760     3  0.2281     0.7505 0.000 0.000 0.904 0.096
#> GSM182761     3  0.4364     0.6357 0.016 0.000 0.764 0.220
#> GSM182762     4  0.4149     0.3938 0.028 0.000 0.168 0.804
#> GSM182763     3  0.3791     0.6626 0.004 0.000 0.796 0.200
#> GSM182764     4  0.6422     0.3768 0.120 0.000 0.248 0.632
#> GSM182765     4  0.5929     0.3709 0.108 0.000 0.204 0.688
#> GSM182766     2  0.6835     0.6789 0.088 0.580 0.012 0.320
#> GSM182767     3  0.0524     0.7808 0.004 0.000 0.988 0.008
#> GSM182768     3  0.0592     0.7736 0.016 0.000 0.984 0.000
#> GSM182769     3  0.4053     0.5524 0.004 0.000 0.768 0.228
#> GSM182770     2  0.4352     0.7649 0.080 0.816 0.000 0.104
#> GSM182771     4  0.5573     0.1393 0.368 0.000 0.028 0.604
#> GSM182772     2  0.3198     0.7741 0.080 0.880 0.000 0.040
#> GSM182773     3  0.0657     0.7808 0.004 0.000 0.984 0.012
#> GSM182774     1  0.5343     0.6860 0.656 0.000 0.028 0.316
#> GSM182775     3  0.4088     0.5475 0.004 0.000 0.764 0.232
#> GSM182776     3  0.7761    -0.3371 0.376 0.000 0.388 0.236
#> GSM182777     3  0.5526     0.2248 0.020 0.000 0.564 0.416
#> GSM182802     2  0.0000     0.7786 0.000 1.000 0.000 0.000
#> GSM182803     1  0.4877     0.6368 0.592 0.000 0.000 0.408
#> GSM182804     2  0.0188     0.7775 0.004 0.996 0.000 0.000
#> GSM182805     2  0.0000     0.7786 0.000 1.000 0.000 0.000
#> GSM182806     4  0.4985    -0.4412 0.468 0.000 0.000 0.532
#> GSM182807     4  0.5000    -0.5367 0.496 0.000 0.000 0.504
#> GSM182808     4  0.5695    -0.5240 0.476 0.000 0.024 0.500
#> GSM182809     2  0.7577     0.2369 0.160 0.484 0.348 0.008
#> GSM182810     1  0.5716     0.7050 0.680 0.000 0.068 0.252
#> GSM182811     1  0.5413     0.7161 0.712 0.004 0.048 0.236
#> GSM182812     1  0.4954     0.7271 0.736 0.004 0.028 0.232
#> GSM182813     4  0.4999    -0.5319 0.492 0.000 0.000 0.508
#> GSM182778     2  0.8217     0.6412 0.212 0.456 0.024 0.308
#> GSM182779     4  0.5138     0.1903 0.008 0.000 0.392 0.600
#> GSM182780     3  0.1629     0.7719 0.024 0.000 0.952 0.024
#> GSM182781     4  0.5343     0.3761 0.028 0.000 0.316 0.656
#> GSM182782     2  0.7617     0.6421 0.216 0.452 0.000 0.332
#> GSM182783     3  0.0817     0.7689 0.024 0.000 0.976 0.000
#> GSM182784     3  0.0524     0.7808 0.004 0.000 0.988 0.008
#> GSM182785     3  0.3266     0.6979 0.000 0.000 0.832 0.168
#> GSM182786     2  0.7617     0.6421 0.216 0.452 0.000 0.332
#> GSM182787     3  0.7708     0.4363 0.096 0.216 0.604 0.084
#> GSM182788     2  0.7617     0.6421 0.216 0.452 0.000 0.332
#> GSM182789     3  0.0927     0.7795 0.008 0.000 0.976 0.016
#> GSM182790     3  0.3942     0.5429 0.000 0.000 0.764 0.236
#> GSM182791     3  0.2125     0.7602 0.004 0.000 0.920 0.076
#> GSM182792     3  0.0336     0.7809 0.000 0.000 0.992 0.008
#> GSM182793     2  0.0469     0.7795 0.000 0.988 0.000 0.012
#> GSM182794     3  0.4679     0.4082 0.000 0.000 0.648 0.352
#> GSM182795     3  0.0000     0.7801 0.000 0.000 1.000 0.000
#> GSM182796     4  0.5543     0.1576 0.360 0.000 0.028 0.612
#> GSM182797     4  0.4499     0.2122 0.160 0.000 0.048 0.792
#> GSM182798     4  0.5543     0.1576 0.360 0.000 0.028 0.612
#> GSM182799     3  0.1151     0.7684 0.024 0.008 0.968 0.000
#> GSM182800     4  0.7862     0.0759 0.308 0.000 0.296 0.396
#> GSM182801     3  0.4898     0.4708 0.024 0.000 0.716 0.260
#> GSM182814     1  0.5024     0.6873 0.632 0.000 0.008 0.360
#> GSM182815     2  0.0000     0.7786 0.000 1.000 0.000 0.000
#> GSM182816     4  0.7803     0.1374 0.252 0.000 0.352 0.396
#> GSM182817     1  0.5506     0.7205 0.700 0.004 0.048 0.248
#> GSM182818     2  0.0817     0.7683 0.024 0.976 0.000 0.000
#> GSM182819     4  0.7828     0.1207 0.264 0.000 0.340 0.396
#> GSM182820     4  0.5254    -0.0751 0.300 0.000 0.028 0.672
#> GSM182821     3  0.0804     0.7794 0.012 0.000 0.980 0.008
#> GSM182822     1  0.7807     0.1121 0.420 0.000 0.288 0.292
#> GSM182823     1  0.4866     0.6292 0.596 0.000 0.000 0.404
#> GSM182824     1  0.4888     0.6306 0.588 0.000 0.000 0.412
#> GSM182825     1  0.4987     0.7293 0.732 0.004 0.028 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
#> GSM182755     5  0.4419     0.5974 0.052 0.008 0.008 0.152 0.780
#> GSM182756     3  0.2583     0.8177 0.000 0.000 0.864 0.132 0.004
#> GSM182757     5  0.7439     0.6014 0.076 0.112 0.208 0.032 0.572
#> GSM182758     3  0.1043     0.8327 0.000 0.000 0.960 0.040 0.000
#> GSM182759     5  0.6704     0.4015 0.024 0.132 0.372 0.000 0.472
#> GSM182760     3  0.3106     0.8168 0.000 0.000 0.844 0.132 0.024
#> GSM182761     3  0.4953     0.5628 0.000 0.216 0.696 0.000 0.088
#> GSM182762     5  0.3612     0.6859 0.036 0.100 0.004 0.016 0.844
#> GSM182763     3  0.4803     0.5615 0.000 0.096 0.720 0.000 0.184
#> GSM182764     5  0.5379     0.6903 0.104 0.112 0.044 0.004 0.736
#> GSM182765     5  0.5529     0.6903 0.092 0.116 0.040 0.016 0.736
#> GSM182766     2  0.1806     0.9467 0.000 0.940 0.016 0.028 0.016
#> GSM182767     3  0.2233     0.8254 0.000 0.000 0.892 0.104 0.004
#> GSM182768     3  0.0162     0.8332 0.000 0.000 0.996 0.004 0.000
#> GSM182769     3  0.5078     0.7542 0.064 0.000 0.740 0.156 0.040
#> GSM182770     4  0.4310     0.7895 0.004 0.392 0.000 0.604 0.000
#> GSM182771     5  0.5396     0.6539 0.280 0.080 0.004 0.000 0.636
#> GSM182772     4  0.4151     0.8566 0.004 0.344 0.000 0.652 0.000
#> GSM182773     3  0.2787     0.8171 0.004 0.000 0.856 0.136 0.004
#> GSM182774     1  0.2450     0.6675 0.896 0.000 0.028 0.000 0.076
#> GSM182775     3  0.5707     0.7048 0.112 0.000 0.692 0.156 0.040
#> GSM182776     1  0.7277    -0.0569 0.412 0.000 0.396 0.128 0.064
#> GSM182777     3  0.7789     0.4780 0.136 0.008 0.512 0.144 0.200
#> GSM182802     4  0.3928     0.8994 0.004 0.296 0.000 0.700 0.000
#> GSM182803     1  0.1725     0.6889 0.936 0.000 0.000 0.020 0.044
#> GSM182804     4  0.3928     0.8994 0.004 0.296 0.000 0.700 0.000
#> GSM182805     4  0.3928     0.8994 0.004 0.296 0.000 0.700 0.000
#> GSM182806     1  0.5251     0.5656 0.680 0.000 0.000 0.136 0.184
#> GSM182807     1  0.5500     0.5658 0.648 0.000 0.000 0.140 0.212
#> GSM182808     1  0.4986     0.6408 0.736 0.004 0.024 0.052 0.184
#> GSM182809     4  0.5291     0.4367 0.040 0.020 0.268 0.668 0.004
#> GSM182810     1  0.0771     0.6813 0.976 0.004 0.000 0.000 0.020
#> GSM182811     1  0.1074     0.6811 0.968 0.004 0.000 0.012 0.016
#> GSM182812     1  0.1074     0.6811 0.968 0.004 0.000 0.012 0.016
#> GSM182813     1  0.5680     0.5402 0.620 0.000 0.000 0.140 0.240
#> GSM182778     2  0.0671     0.9785 0.000 0.980 0.004 0.000 0.016
#> GSM182779     5  0.6350     0.6640 0.044 0.088 0.120 0.056 0.692
#> GSM182780     3  0.0510     0.8310 0.000 0.000 0.984 0.000 0.016
#> GSM182781     5  0.5887     0.6247 0.048 0.012 0.100 0.136 0.704
#> GSM182782     2  0.0404     0.9837 0.000 0.988 0.000 0.000 0.012
#> GSM182783     3  0.0290     0.8323 0.000 0.000 0.992 0.000 0.008
#> GSM182784     3  0.2124     0.8270 0.000 0.000 0.900 0.096 0.004
#> GSM182785     3  0.4255     0.6570 0.000 0.096 0.776 0.000 0.128
#> GSM182786     2  0.0404     0.9837 0.000 0.988 0.000 0.000 0.012
#> GSM182787     3  0.3993     0.6657 0.000 0.216 0.756 0.000 0.028
#> GSM182788     2  0.0404     0.9837 0.000 0.988 0.000 0.000 0.012
#> GSM182789     3  0.0609     0.8305 0.000 0.000 0.980 0.000 0.020
#> GSM182790     3  0.5154     0.7335 0.108 0.000 0.732 0.136 0.024
#> GSM182791     3  0.0865     0.8294 0.000 0.000 0.972 0.004 0.024
#> GSM182792     3  0.0912     0.8340 0.000 0.000 0.972 0.012 0.016
#> GSM182793     4  0.3928     0.8994 0.004 0.296 0.000 0.700 0.000
#> GSM182794     3  0.6720     0.5993 0.060 0.004 0.608 0.136 0.192
#> GSM182795     3  0.0290     0.8323 0.000 0.000 0.992 0.000 0.008
#> GSM182796     5  0.5447     0.6648 0.248 0.112 0.000 0.000 0.640
#> GSM182797     5  0.4419     0.5974 0.052 0.008 0.008 0.152 0.780
#> GSM182798     5  0.5405     0.6638 0.256 0.104 0.000 0.000 0.640
#> GSM182799     3  0.0854     0.8316 0.000 0.012 0.976 0.004 0.008
#> GSM182800     1  0.7074     0.3301 0.512 0.000 0.308 0.084 0.096
#> GSM182801     3  0.5780     0.6974 0.112 0.000 0.684 0.164 0.040
#> GSM182814     1  0.1202     0.6897 0.960 0.004 0.000 0.004 0.032
#> GSM182815     4  0.3928     0.8994 0.004 0.296 0.000 0.700 0.000
#> GSM182816     1  0.7887     0.0687 0.376 0.004 0.376 0.108 0.136
#> GSM182817     1  0.1202     0.6808 0.960 0.004 0.000 0.004 0.032
#> GSM182818     4  0.3928     0.8994 0.004 0.296 0.000 0.700 0.000
#> GSM182819     1  0.7674     0.3413 0.460 0.000 0.288 0.108 0.144
#> GSM182820     5  0.6080     0.1159 0.332 0.000 0.000 0.140 0.528
#> GSM182821     3  0.0566     0.8314 0.000 0.000 0.984 0.004 0.012
#> GSM182822     1  0.5908     0.3938 0.564 0.000 0.340 0.012 0.084
#> GSM182823     1  0.4444     0.6156 0.760 0.000 0.000 0.136 0.104
#> GSM182824     1  0.3339     0.6740 0.840 0.000 0.000 0.048 0.112
#> GSM182825     1  0.0771     0.6813 0.976 0.004 0.000 0.000 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
#> GSM182755     6  0.6296    0.09686 0.000 0.000 0.008 0.284 0.320 0.388
#> GSM182756     3  0.2805    0.73427 0.000 0.000 0.812 0.000 0.004 0.184
#> GSM182757     5  0.0935    0.85380 0.004 0.000 0.032 0.000 0.964 0.000
#> GSM182758     3  0.0000    0.80308 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM182759     3  0.4221    0.38519 0.000 0.008 0.588 0.000 0.396 0.008
#> GSM182760     3  0.3104    0.73399 0.000 0.000 0.800 0.000 0.016 0.184
#> GSM182761     3  0.3496    0.70437 0.000 0.052 0.804 0.000 0.140 0.004
#> GSM182762     5  0.1219    0.84065 0.000 0.000 0.000 0.048 0.948 0.004
#> GSM182763     3  0.2632    0.71724 0.000 0.000 0.832 0.000 0.164 0.004
#> GSM182764     5  0.0260    0.86434 0.008 0.000 0.000 0.000 0.992 0.000
#> GSM182765     5  0.0260    0.86434 0.008 0.000 0.000 0.000 0.992 0.000
#> GSM182766     2  0.2293    0.85542 0.000 0.896 0.016 0.080 0.004 0.004
#> GSM182767     3  0.2146    0.77344 0.000 0.000 0.880 0.000 0.004 0.116
#> GSM182768     3  0.1610    0.77147 0.000 0.000 0.916 0.000 0.000 0.084
#> GSM182769     6  0.5607    0.00890 0.148 0.000 0.316 0.000 0.004 0.532
#> GSM182770     4  0.3765    0.69438 0.000 0.404 0.000 0.596 0.000 0.000
#> GSM182771     5  0.2420    0.84594 0.032 0.068 0.000 0.000 0.892 0.008
#> GSM182772     4  0.3828    0.63355 0.000 0.440 0.000 0.560 0.000 0.000
#> GSM182773     3  0.3426    0.67463 0.000 0.000 0.720 0.000 0.004 0.276
#> GSM182774     1  0.0000    0.81218 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM182775     6  0.6035    0.09155 0.236 0.000 0.300 0.000 0.004 0.460
#> GSM182776     6  0.5382   -0.03317 0.352 0.000 0.108 0.000 0.004 0.536
#> GSM182777     3  0.7487    0.00605 0.236 0.000 0.332 0.000 0.140 0.292
#> GSM182802     4  0.3351    0.82520 0.000 0.288 0.000 0.712 0.000 0.000
#> GSM182803     1  0.1588    0.75584 0.924 0.000 0.000 0.072 0.000 0.004
#> GSM182804     4  0.3351    0.82520 0.000 0.288 0.000 0.712 0.000 0.000
#> GSM182805     4  0.3351    0.82520 0.000 0.288 0.000 0.712 0.000 0.000
#> GSM182806     6  0.6641    0.35441 0.236 0.000 0.000 0.288 0.040 0.436
#> GSM182807     6  0.6121    0.32350 0.272 0.000 0.000 0.288 0.004 0.436
#> GSM182808     1  0.5714    0.24962 0.540 0.000 0.012 0.140 0.000 0.308
#> GSM182809     4  0.4086    0.08603 0.008 0.000 0.464 0.528 0.000 0.000
#> GSM182810     1  0.0000    0.81218 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM182811     1  0.0260    0.81015 0.992 0.000 0.000 0.008 0.000 0.000
#> GSM182812     1  0.0260    0.81015 0.992 0.000 0.000 0.008 0.000 0.000
#> GSM182813     6  0.6074    0.33591 0.256 0.000 0.000 0.288 0.004 0.452
#> GSM182778     2  0.0146    0.96735 0.000 0.996 0.000 0.000 0.004 0.000
#> GSM182779     5  0.1946    0.81728 0.004 0.000 0.072 0.000 0.912 0.012
#> GSM182780     3  0.0405    0.80336 0.000 0.000 0.988 0.000 0.008 0.004
#> GSM182781     5  0.6054    0.10457 0.000 0.000 0.008 0.272 0.484 0.236
#> GSM182782     2  0.0146    0.96735 0.000 0.996 0.000 0.000 0.004 0.000
#> GSM182783     3  0.0405    0.80336 0.000 0.000 0.988 0.000 0.008 0.004
#> GSM182784     3  0.2100    0.77516 0.000 0.000 0.884 0.000 0.004 0.112
#> GSM182785     3  0.2100    0.75804 0.000 0.000 0.884 0.000 0.112 0.004
#> GSM182786     2  0.0146    0.96735 0.000 0.996 0.000 0.000 0.004 0.000
#> GSM182787     3  0.3693    0.55623 0.000 0.280 0.708 0.000 0.008 0.004
#> GSM182788     2  0.0146    0.96735 0.000 0.996 0.000 0.000 0.004 0.000
#> GSM182789     3  0.0405    0.80336 0.000 0.000 0.988 0.000 0.008 0.004
#> GSM182790     3  0.4756    0.53331 0.068 0.000 0.636 0.000 0.004 0.292
#> GSM182791     3  0.0260    0.80385 0.000 0.000 0.992 0.000 0.008 0.000
#> GSM182792     3  0.0405    0.80376 0.000 0.000 0.988 0.000 0.008 0.004
#> GSM182793     4  0.3351    0.82520 0.000 0.288 0.000 0.712 0.000 0.000
#> GSM182794     3  0.6023    0.49626 0.036 0.000 0.540 0.000 0.132 0.292
#> GSM182795     3  0.0146    0.80369 0.000 0.000 0.996 0.000 0.004 0.000
#> GSM182796     5  0.1957    0.85210 0.008 0.072 0.000 0.000 0.912 0.008
#> GSM182797     6  0.6296    0.09686 0.000 0.000 0.008 0.284 0.320 0.388
#> GSM182798     5  0.1957    0.85210 0.008 0.072 0.000 0.000 0.912 0.008
#> GSM182799     3  0.2883    0.66608 0.000 0.000 0.788 0.000 0.000 0.212
#> GSM182800     1  0.5956    0.15837 0.524 0.000 0.208 0.000 0.012 0.256
#> GSM182801     6  0.5899    0.12093 0.236 0.000 0.256 0.000 0.004 0.504
#> GSM182814     1  0.0000    0.81218 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM182815     4  0.3351    0.82520 0.000 0.288 0.000 0.712 0.000 0.000
#> GSM182816     6  0.6272    0.08607 0.300 0.004 0.016 0.176 0.004 0.500
#> GSM182817     1  0.0146    0.81156 0.996 0.000 0.000 0.004 0.000 0.000
#> GSM182818     4  0.3351    0.82520 0.000 0.288 0.000 0.712 0.000 0.000
#> GSM182819     6  0.5920    0.15107 0.260 0.000 0.012 0.176 0.004 0.548
#> GSM182820     6  0.7331    0.36716 0.180 0.000 0.000 0.288 0.144 0.388
#> GSM182821     3  0.0260    0.80385 0.000 0.000 0.992 0.000 0.008 0.000
#> GSM182822     1  0.3027    0.61399 0.824 0.000 0.148 0.000 0.000 0.028
#> GSM182823     6  0.6205    0.28222 0.316 0.000 0.000 0.288 0.004 0.392
#> GSM182824     1  0.4593    0.52639 0.704 0.004 0.000 0.112 0.000 0.180
#> GSM182825     1  0.0000    0.81218 1.000 0.000 0.000 0.000 0.000 0.000

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

consensus_heatmap(res, k = 2)

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 stress(p) development.stage(p) k
#> CV:mclust 69     0.941             5.47e-04 2
#> CV:mclust 52     0.904             1.80e-05 3
#> CV:mclust 44     0.983             1.62e-05 4
#> CV:mclust 62     0.380             5.56e-09 5
#> CV:mclust 51     0.488             1.16e-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.


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

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

collect_plots(res)

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 0.681           0.822       0.918         0.4604 0.505   0.505
#> 3 3 0.326           0.408       0.709         0.3692 0.803   0.634
#> 4 4 0.532           0.675       0.824         0.1377 0.703   0.370
#> 5 5 0.506           0.511       0.696         0.0658 0.891   0.657
#> 6 6 0.484           0.434       0.680         0.0435 0.893   0.626

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
#> GSM182755     1  0.0000      0.961 1.000 0.000
#> GSM182756     1  0.7299      0.683 0.796 0.204
#> GSM182757     1  0.5178      0.832 0.884 0.116
#> GSM182758     2  0.9710      0.512 0.400 0.600
#> GSM182759     2  0.7602      0.704 0.220 0.780
#> GSM182760     1  0.4431      0.865 0.908 0.092
#> GSM182761     2  0.5408      0.768 0.124 0.876
#> GSM182762     1  0.0000      0.961 1.000 0.000
#> GSM182763     2  0.9209      0.592 0.336 0.664
#> GSM182764     1  0.0000      0.961 1.000 0.000
#> GSM182765     1  0.0000      0.961 1.000 0.000
#> GSM182766     2  0.0000      0.824 0.000 1.000
#> GSM182767     2  0.9896      0.435 0.440 0.560
#> GSM182768     2  0.9710      0.512 0.400 0.600
#> GSM182769     1  0.0000      0.961 1.000 0.000
#> GSM182770     2  0.0000      0.824 0.000 1.000
#> GSM182771     1  0.0000      0.961 1.000 0.000
#> GSM182772     2  0.0000      0.824 0.000 1.000
#> GSM182773     1  0.6531      0.750 0.832 0.168
#> GSM182774     1  0.0000      0.961 1.000 0.000
#> GSM182775     1  0.0000      0.961 1.000 0.000
#> GSM182776     1  0.0000      0.961 1.000 0.000
#> GSM182777     1  0.0000      0.961 1.000 0.000
#> GSM182802     2  0.0000      0.824 0.000 1.000
#> GSM182803     1  0.0000      0.961 1.000 0.000
#> GSM182804     2  0.0000      0.824 0.000 1.000
#> GSM182805     2  0.0000      0.824 0.000 1.000
#> GSM182806     1  0.0000      0.961 1.000 0.000
#> GSM182807     1  0.0000      0.961 1.000 0.000
#> GSM182808     1  0.0000      0.961 1.000 0.000
#> GSM182809     2  0.2236      0.811 0.036 0.964
#> GSM182810     1  0.0000      0.961 1.000 0.000
#> GSM182811     1  0.0000      0.961 1.000 0.000
#> GSM182812     1  0.0672      0.954 0.992 0.008
#> GSM182813     1  0.0000      0.961 1.000 0.000
#> GSM182778     2  0.0000      0.824 0.000 1.000
#> GSM182779     1  0.2043      0.931 0.968 0.032
#> GSM182780     2  0.0000      0.824 0.000 1.000
#> GSM182781     1  0.0000      0.961 1.000 0.000
#> GSM182782     2  0.0000      0.824 0.000 1.000
#> GSM182783     2  0.0000      0.824 0.000 1.000
#> GSM182784     2  0.9954      0.384 0.460 0.540
#> GSM182785     2  0.9983      0.338 0.476 0.524
#> GSM182786     2  0.0000      0.824 0.000 1.000
#> GSM182787     2  0.0000      0.824 0.000 1.000
#> GSM182788     2  0.0000      0.824 0.000 1.000
#> GSM182789     2  0.9686      0.517 0.396 0.604
#> GSM182790     1  0.0000      0.961 1.000 0.000
#> GSM182791     2  0.9775      0.491 0.412 0.588
#> GSM182792     1  0.9944     -0.142 0.544 0.456
#> GSM182793     2  0.0000      0.824 0.000 1.000
#> GSM182794     1  0.0000      0.961 1.000 0.000
#> GSM182795     2  0.9896      0.435 0.440 0.560
#> GSM182796     1  0.3431      0.894 0.936 0.064
#> GSM182797     1  0.0000      0.961 1.000 0.000
#> GSM182798     1  0.0000      0.961 1.000 0.000
#> GSM182799     2  0.0000      0.824 0.000 1.000
#> GSM182800     1  0.0000      0.961 1.000 0.000
#> GSM182801     1  0.0000      0.961 1.000 0.000
#> GSM182814     1  0.0000      0.961 1.000 0.000
#> GSM182815     2  0.0000      0.824 0.000 1.000
#> GSM182816     1  0.0000      0.961 1.000 0.000
#> GSM182817     1  0.0000      0.961 1.000 0.000
#> GSM182818     2  0.0000      0.824 0.000 1.000
#> GSM182819     1  0.0000      0.961 1.000 0.000
#> GSM182820     1  0.0000      0.961 1.000 0.000
#> GSM182821     2  0.9866      0.452 0.432 0.568
#> GSM182822     1  0.4022      0.880 0.920 0.080
#> GSM182823     1  0.0000      0.961 1.000 0.000
#> GSM182824     1  0.0000      0.961 1.000 0.000
#> GSM182825     1  0.0000      0.961 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
#> GSM182755     3  0.3412    0.67476 0.124 0.000 0.876
#> GSM182756     3  0.5891    0.45482 0.036 0.200 0.764
#> GSM182757     3  0.9050    0.30083 0.164 0.304 0.532
#> GSM182758     2  0.8737    0.28837 0.108 0.464 0.428
#> GSM182759     2  0.6282    0.37234 0.324 0.664 0.012
#> GSM182760     3  0.3832    0.59996 0.036 0.076 0.888
#> GSM182761     2  0.2414    0.59467 0.040 0.940 0.020
#> GSM182762     3  0.4702    0.64408 0.212 0.000 0.788
#> GSM182763     2  0.6518    0.49893 0.080 0.752 0.168
#> GSM182764     3  0.9752    0.23116 0.352 0.232 0.416
#> GSM182765     3  0.5812    0.61114 0.264 0.012 0.724
#> GSM182766     2  0.0237    0.59488 0.004 0.996 0.000
#> GSM182767     2  0.8892    0.27155 0.120 0.444 0.436
#> GSM182768     1  0.8834    0.20776 0.464 0.116 0.420
#> GSM182769     3  0.5968    0.17057 0.364 0.000 0.636
#> GSM182770     2  0.2711    0.56165 0.088 0.912 0.000
#> GSM182771     3  0.6204    0.43692 0.424 0.000 0.576
#> GSM182772     2  0.0592    0.59403 0.012 0.988 0.000
#> GSM182773     3  0.6986    0.29711 0.256 0.056 0.688
#> GSM182774     3  0.5363    0.57493 0.276 0.000 0.724
#> GSM182775     3  0.1411    0.64983 0.036 0.000 0.964
#> GSM182776     3  0.1860    0.67229 0.052 0.000 0.948
#> GSM182777     3  0.1411    0.64983 0.036 0.000 0.964
#> GSM182802     2  0.6302   -0.17163 0.480 0.520 0.000
#> GSM182803     3  0.4605    0.63317 0.204 0.000 0.796
#> GSM182804     1  0.5905    0.30242 0.648 0.352 0.000
#> GSM182805     1  0.5859    0.26863 0.656 0.344 0.000
#> GSM182806     3  0.5650    0.54831 0.312 0.000 0.688
#> GSM182807     3  0.3267    0.67414 0.116 0.000 0.884
#> GSM182808     3  0.1753    0.66605 0.048 0.000 0.952
#> GSM182809     1  0.6295    0.16281 0.528 0.472 0.000
#> GSM182810     1  0.6079    0.10798 0.612 0.000 0.388
#> GSM182811     1  0.5835    0.08070 0.660 0.000 0.340
#> GSM182812     1  0.4931    0.29009 0.768 0.000 0.232
#> GSM182813     3  0.3482    0.67143 0.128 0.000 0.872
#> GSM182778     2  0.0000    0.59429 0.000 1.000 0.000
#> GSM182779     3  0.7160    0.47169 0.148 0.132 0.720
#> GSM182780     2  0.5212    0.55607 0.108 0.828 0.064
#> GSM182781     3  0.0747    0.66856 0.016 0.000 0.984
#> GSM182782     2  0.2711    0.57046 0.088 0.912 0.000
#> GSM182783     2  0.6500    0.52539 0.140 0.760 0.100
#> GSM182784     2  0.8892    0.27155 0.120 0.444 0.436
#> GSM182785     2  0.8454    0.11041 0.088 0.480 0.432
#> GSM182786     2  0.2711    0.57046 0.088 0.912 0.000
#> GSM182787     2  0.1411    0.58548 0.036 0.964 0.000
#> GSM182788     2  0.3038    0.56132 0.104 0.896 0.000
#> GSM182789     2  0.8569    0.32479 0.100 0.508 0.392
#> GSM182790     3  0.1411    0.64983 0.036 0.000 0.964
#> GSM182791     1  0.9977    0.05116 0.352 0.300 0.348
#> GSM182792     3  0.9686   -0.15351 0.308 0.240 0.452
#> GSM182793     2  0.5098    0.35601 0.248 0.752 0.000
#> GSM182794     3  0.1647    0.64829 0.036 0.004 0.960
#> GSM182795     2  0.8792    0.27976 0.112 0.456 0.432
#> GSM182796     1  0.9587   -0.18827 0.440 0.204 0.356
#> GSM182797     3  0.3340    0.67491 0.120 0.000 0.880
#> GSM182798     3  0.6633    0.40590 0.444 0.008 0.548
#> GSM182799     1  0.8898    0.14175 0.500 0.372 0.128
#> GSM182800     3  0.2796    0.67733 0.092 0.000 0.908
#> GSM182801     3  0.1411    0.64983 0.036 0.000 0.964
#> GSM182814     3  0.6308    0.24786 0.492 0.000 0.508
#> GSM182815     1  0.6299    0.15673 0.524 0.476 0.000
#> GSM182816     3  0.6168    0.10879 0.412 0.000 0.588
#> GSM182817     3  0.5948    0.48359 0.360 0.000 0.640
#> GSM182818     1  0.5650    0.33122 0.688 0.312 0.000
#> GSM182819     3  0.3686    0.67101 0.140 0.000 0.860
#> GSM182820     3  0.3879    0.66402 0.152 0.000 0.848
#> GSM182821     3  0.9810   -0.25964 0.372 0.240 0.388
#> GSM182822     1  0.7159    0.00722 0.528 0.024 0.448
#> GSM182823     3  0.5497    0.56392 0.292 0.000 0.708
#> GSM182824     3  0.4750    0.54648 0.216 0.000 0.784
#> GSM182825     1  0.5397    0.28435 0.720 0.000 0.280

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM182755     1  0.3172     0.7540 0.840 0.000 0.160 0.000
#> GSM182756     3  0.1389     0.8566 0.048 0.000 0.952 0.000
#> GSM182757     2  0.7379    -0.1410 0.384 0.452 0.164 0.000
#> GSM182758     3  0.0188     0.8519 0.000 0.000 0.996 0.004
#> GSM182759     2  0.3257     0.6891 0.152 0.844 0.004 0.000
#> GSM182760     3  0.1474     0.8558 0.052 0.000 0.948 0.000
#> GSM182761     2  0.3484     0.7825 0.008 0.844 0.144 0.004
#> GSM182762     1  0.2799     0.7631 0.884 0.008 0.108 0.000
#> GSM182763     2  0.2899     0.7984 0.004 0.880 0.112 0.004
#> GSM182764     1  0.6024     0.2822 0.540 0.416 0.044 0.000
#> GSM182765     1  0.5727     0.6901 0.704 0.200 0.096 0.000
#> GSM182766     2  0.2983     0.8123 0.012 0.896 0.076 0.016
#> GSM182767     3  0.0000     0.8527 0.000 0.000 1.000 0.000
#> GSM182768     3  0.1109     0.8406 0.000 0.004 0.968 0.028
#> GSM182769     3  0.1940     0.8481 0.076 0.000 0.924 0.000
#> GSM182770     2  0.6356     0.5276 0.000 0.604 0.088 0.308
#> GSM182771     1  0.3074     0.6305 0.848 0.152 0.000 0.000
#> GSM182772     2  0.3931     0.7626 0.000 0.832 0.040 0.128
#> GSM182773     3  0.1389     0.8566 0.048 0.000 0.952 0.000
#> GSM182774     1  0.1792     0.7538 0.932 0.000 0.068 0.000
#> GSM182775     3  0.2760     0.8214 0.128 0.000 0.872 0.000
#> GSM182776     3  0.4454     0.5831 0.308 0.000 0.692 0.000
#> GSM182777     3  0.2973     0.8088 0.144 0.000 0.856 0.000
#> GSM182802     4  0.1356     0.7395 0.008 0.032 0.000 0.960
#> GSM182803     1  0.2796     0.7559 0.892 0.000 0.092 0.016
#> GSM182804     4  0.1211     0.7544 0.040 0.000 0.000 0.960
#> GSM182805     4  0.4605     0.6636 0.072 0.132 0.000 0.796
#> GSM182806     1  0.1474     0.7471 0.948 0.000 0.052 0.000
#> GSM182807     1  0.2973     0.7583 0.856 0.000 0.144 0.000
#> GSM182808     1  0.4830     0.4339 0.608 0.000 0.392 0.000
#> GSM182809     4  0.0524     0.7492 0.008 0.004 0.000 0.988
#> GSM182810     4  0.4535     0.6597 0.240 0.000 0.016 0.744
#> GSM182811     1  0.4817     0.0748 0.612 0.000 0.000 0.388
#> GSM182812     4  0.4679     0.5198 0.352 0.000 0.000 0.648
#> GSM182813     1  0.2760     0.7614 0.872 0.000 0.128 0.000
#> GSM182778     2  0.3547     0.7987 0.000 0.864 0.072 0.064
#> GSM182779     1  0.6944     0.3347 0.484 0.404 0.112 0.000
#> GSM182780     3  0.4589     0.6426 0.000 0.168 0.784 0.048
#> GSM182781     1  0.4998     0.1260 0.512 0.000 0.488 0.000
#> GSM182782     2  0.1917     0.8084 0.012 0.944 0.036 0.008
#> GSM182783     3  0.3899     0.7306 0.000 0.052 0.840 0.108
#> GSM182784     3  0.0000     0.8527 0.000 0.000 1.000 0.000
#> GSM182785     3  0.5007     0.6503 0.172 0.068 0.760 0.000
#> GSM182786     2  0.0992     0.7983 0.008 0.976 0.012 0.004
#> GSM182787     2  0.3958     0.7695 0.000 0.824 0.144 0.032
#> GSM182788     2  0.0524     0.7906 0.008 0.988 0.000 0.004
#> GSM182789     3  0.0895     0.8484 0.000 0.020 0.976 0.004
#> GSM182790     3  0.2647     0.8271 0.120 0.000 0.880 0.000
#> GSM182791     3  0.4219     0.7429 0.136 0.004 0.820 0.040
#> GSM182792     3  0.1305     0.8574 0.036 0.000 0.960 0.004
#> GSM182793     4  0.6793     0.1520 0.000 0.288 0.132 0.580
#> GSM182794     3  0.2589     0.8299 0.116 0.000 0.884 0.000
#> GSM182795     3  0.0707     0.8472 0.000 0.000 0.980 0.020
#> GSM182796     1  0.4843     0.3223 0.604 0.396 0.000 0.000
#> GSM182797     1  0.3172     0.7540 0.840 0.000 0.160 0.000
#> GSM182798     1  0.3172     0.6259 0.840 0.160 0.000 0.000
#> GSM182799     3  0.5464     0.5839 0.000 0.064 0.708 0.228
#> GSM182800     1  0.4103     0.6734 0.744 0.000 0.256 0.000
#> GSM182801     3  0.2973     0.8088 0.144 0.000 0.856 0.000
#> GSM182814     1  0.5170     0.5199 0.724 0.000 0.048 0.228
#> GSM182815     4  0.0000     0.7462 0.000 0.000 0.000 1.000
#> GSM182816     3  0.4375     0.7632 0.180 0.000 0.788 0.032
#> GSM182817     1  0.1936     0.6853 0.940 0.032 0.000 0.028
#> GSM182818     4  0.1211     0.7544 0.040 0.000 0.000 0.960
#> GSM182819     1  0.2814     0.7615 0.868 0.000 0.132 0.000
#> GSM182820     1  0.2868     0.7609 0.864 0.000 0.136 0.000
#> GSM182821     3  0.5539     0.6720 0.064 0.016 0.744 0.176
#> GSM182822     4  0.7081     0.1285 0.352 0.000 0.136 0.512
#> GSM182823     1  0.1637     0.7504 0.940 0.000 0.060 0.000
#> GSM182824     1  0.6113     0.6249 0.636 0.000 0.284 0.080
#> GSM182825     4  0.4103     0.6633 0.256 0.000 0.000 0.744

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>           class entropy silhouette    p1    p2    p3    p4    p5
#> GSM182755     1  0.2448     0.6010 0.892 0.000 0.088 0.000 0.020
#> GSM182756     3  0.5739     0.6808 0.196 0.024 0.668 0.000 0.112
#> GSM182757     1  0.7572    -0.1087 0.452 0.172 0.076 0.000 0.300
#> GSM182758     3  0.4606     0.7247 0.108 0.012 0.768 0.000 0.112
#> GSM182759     2  0.4129     0.6158 0.040 0.756 0.000 0.000 0.204
#> GSM182760     3  0.2482     0.7493 0.084 0.000 0.892 0.000 0.024
#> GSM182761     2  0.1915     0.7519 0.000 0.928 0.032 0.000 0.040
#> GSM182762     1  0.4046     0.4491 0.780 0.008 0.032 0.000 0.180
#> GSM182763     2  0.3736     0.6939 0.004 0.824 0.100 0.000 0.072
#> GSM182764     1  0.6341    -0.2849 0.524 0.220 0.000 0.000 0.256
#> GSM182765     1  0.6547    -0.5070 0.452 0.108 0.024 0.000 0.416
#> GSM182766     2  0.2116     0.7603 0.000 0.912 0.004 0.008 0.076
#> GSM182767     3  0.3613     0.7317 0.048 0.076 0.848 0.000 0.028
#> GSM182768     3  0.1616     0.7273 0.004 0.008 0.948 0.008 0.032
#> GSM182769     3  0.4679     0.7173 0.124 0.000 0.740 0.000 0.136
#> GSM182770     2  0.5122     0.3773 0.000 0.584 0.012 0.380 0.024
#> GSM182771     1  0.4961    -0.4423 0.520 0.020 0.000 0.004 0.456
#> GSM182772     2  0.3622     0.7298 0.000 0.820 0.000 0.124 0.056
#> GSM182773     3  0.1300     0.7427 0.028 0.000 0.956 0.000 0.016
#> GSM182774     1  0.3773     0.4736 0.800 0.000 0.032 0.004 0.164
#> GSM182775     3  0.1872     0.7425 0.052 0.000 0.928 0.000 0.020
#> GSM182776     3  0.5223     0.3124 0.444 0.000 0.512 0.000 0.044
#> GSM182777     3  0.2624     0.7363 0.116 0.000 0.872 0.000 0.012
#> GSM182802     4  0.1041     0.7185 0.000 0.032 0.000 0.964 0.004
#> GSM182803     1  0.2006     0.6079 0.932 0.000 0.024 0.020 0.024
#> GSM182804     4  0.0162     0.7272 0.000 0.000 0.000 0.996 0.004
#> GSM182805     2  0.7840    -0.0564 0.044 0.368 0.008 0.296 0.284
#> GSM182806     1  0.2248     0.5657 0.900 0.000 0.012 0.000 0.088
#> GSM182807     1  0.1270     0.6123 0.948 0.000 0.052 0.000 0.000
#> GSM182808     1  0.4441     0.4309 0.720 0.000 0.236 0.000 0.044
#> GSM182809     4  0.3432     0.7205 0.016 0.012 0.024 0.860 0.088
#> GSM182810     4  0.5368     0.2357 0.416 0.000 0.016 0.540 0.028
#> GSM182811     1  0.5691     0.0947 0.536 0.000 0.000 0.376 0.088
#> GSM182812     4  0.4453     0.5749 0.228 0.000 0.000 0.724 0.048
#> GSM182813     1  0.1043     0.6124 0.960 0.000 0.040 0.000 0.000
#> GSM182778     2  0.1924     0.7506 0.000 0.924 0.008 0.064 0.004
#> GSM182779     5  0.8287     0.4236 0.208 0.268 0.152 0.000 0.372
#> GSM182780     3  0.4257     0.6695 0.000 0.164 0.780 0.016 0.040
#> GSM182781     3  0.6669     0.1903 0.368 0.000 0.400 0.000 0.232
#> GSM182782     2  0.1608     0.7552 0.000 0.928 0.000 0.000 0.072
#> GSM182783     3  0.7154     0.5179 0.020 0.048 0.580 0.180 0.172
#> GSM182784     3  0.3288     0.7485 0.060 0.028 0.868 0.000 0.044
#> GSM182785     3  0.7577     0.4295 0.212 0.248 0.468 0.000 0.072
#> GSM182786     2  0.2280     0.7272 0.000 0.880 0.000 0.000 0.120
#> GSM182787     2  0.1560     0.7531 0.000 0.948 0.028 0.004 0.020
#> GSM182788     2  0.3305     0.6264 0.000 0.776 0.000 0.000 0.224
#> GSM182789     3  0.7364     0.3700 0.116 0.352 0.448 0.000 0.084
#> GSM182790     3  0.5283     0.6774 0.204 0.000 0.672 0.000 0.124
#> GSM182791     3  0.5969     0.6786 0.140 0.072 0.704 0.016 0.068
#> GSM182792     3  0.1808     0.7455 0.040 0.004 0.936 0.000 0.020
#> GSM182793     4  0.5573     0.3325 0.000 0.264 0.016 0.644 0.076
#> GSM182794     3  0.2727     0.7415 0.116 0.000 0.868 0.000 0.016
#> GSM182795     3  0.4726     0.7179 0.080 0.008 0.756 0.004 0.152
#> GSM182796     5  0.6525     0.5705 0.308 0.220 0.000 0.000 0.472
#> GSM182797     1  0.2740     0.5961 0.876 0.000 0.096 0.000 0.028
#> GSM182798     5  0.5293     0.3698 0.460 0.048 0.000 0.000 0.492
#> GSM182799     3  0.4229     0.6550 0.000 0.024 0.800 0.124 0.052
#> GSM182800     3  0.7398     0.0694 0.328 0.000 0.448 0.060 0.164
#> GSM182801     3  0.2054     0.7387 0.052 0.000 0.920 0.000 0.028
#> GSM182814     1  0.5069     0.3295 0.648 0.000 0.012 0.304 0.036
#> GSM182815     4  0.0771     0.7214 0.000 0.004 0.000 0.976 0.020
#> GSM182816     1  0.6186    -0.1111 0.496 0.000 0.412 0.040 0.052
#> GSM182817     1  0.2605     0.5539 0.896 0.004 0.000 0.044 0.056
#> GSM182818     4  0.4608     0.6445 0.008 0.016 0.004 0.688 0.284
#> GSM182819     1  0.1484     0.6123 0.944 0.000 0.048 0.000 0.008
#> GSM182820     1  0.1893     0.6052 0.928 0.000 0.048 0.000 0.024
#> GSM182821     3  0.8309     0.2322 0.180 0.280 0.388 0.004 0.148
#> GSM182822     1  0.6667     0.3887 0.640 0.024 0.044 0.160 0.132
#> GSM182823     1  0.2666     0.5747 0.892 0.000 0.020 0.012 0.076
#> GSM182824     1  0.5212     0.5080 0.740 0.000 0.136 0.064 0.060
#> GSM182825     4  0.4946     0.5319 0.260 0.000 0.004 0.680 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
#> GSM182755     1  0.3652     0.5955 0.816 0.000 0.084 0.000 0.080 0.020
#> GSM182756     3  0.7766     0.0279 0.228 0.012 0.356 0.000 0.152 0.252
#> GSM182757     1  0.8546    -0.0657 0.340 0.112 0.132 0.000 0.224 0.192
#> GSM182758     3  0.7592     0.0968 0.156 0.016 0.404 0.000 0.148 0.276
#> GSM182759     2  0.3804     0.4491 0.008 0.656 0.000 0.000 0.336 0.000
#> GSM182760     3  0.2526     0.6146 0.096 0.000 0.876 0.000 0.004 0.024
#> GSM182761     2  0.3437     0.6149 0.000 0.832 0.092 0.000 0.052 0.024
#> GSM182762     1  0.5544     0.0554 0.588 0.016 0.056 0.000 0.316 0.024
#> GSM182763     2  0.6245     0.3243 0.016 0.520 0.232 0.000 0.224 0.008
#> GSM182764     5  0.6531     0.4291 0.356 0.180 0.020 0.000 0.432 0.012
#> GSM182765     5  0.5640     0.6291 0.296 0.048 0.036 0.000 0.600 0.020
#> GSM182766     2  0.3210     0.6413 0.000 0.836 0.004 0.016 0.124 0.020
#> GSM182767     3  0.4088     0.6015 0.076 0.064 0.808 0.000 0.020 0.032
#> GSM182768     3  0.3254     0.5838 0.028 0.004 0.868 0.024 0.040 0.036
#> GSM182769     3  0.7204     0.0506 0.140 0.000 0.400 0.000 0.152 0.308
#> GSM182770     2  0.4759     0.1911 0.000 0.540 0.000 0.420 0.016 0.024
#> GSM182771     5  0.4001     0.6849 0.268 0.020 0.000 0.000 0.704 0.008
#> GSM182772     2  0.3874     0.6009 0.000 0.760 0.000 0.172 0.068 0.000
#> GSM182773     3  0.3031     0.6017 0.048 0.000 0.860 0.000 0.020 0.072
#> GSM182774     1  0.4982     0.3538 0.684 0.000 0.020 0.020 0.232 0.044
#> GSM182775     3  0.3514     0.6061 0.096 0.000 0.828 0.000 0.040 0.036
#> GSM182776     1  0.5333     0.0489 0.516 0.000 0.408 0.000 0.036 0.040
#> GSM182777     3  0.3729     0.5993 0.136 0.000 0.800 0.000 0.040 0.024
#> GSM182802     4  0.1757     0.6962 0.000 0.076 0.000 0.916 0.008 0.000
#> GSM182803     1  0.2494     0.6487 0.900 0.000 0.004 0.036 0.032 0.028
#> GSM182804     4  0.0837     0.7103 0.004 0.004 0.020 0.972 0.000 0.000
#> GSM182805     6  0.6370    -0.1218 0.028 0.336 0.000 0.116 0.020 0.500
#> GSM182806     1  0.2488     0.5866 0.864 0.000 0.004 0.000 0.124 0.008
#> GSM182807     1  0.1138     0.6553 0.960 0.000 0.024 0.000 0.012 0.004
#> GSM182808     1  0.4206     0.5984 0.780 0.000 0.128 0.004 0.048 0.040
#> GSM182809     4  0.4451     0.6350 0.036 0.028 0.036 0.784 0.004 0.112
#> GSM182810     1  0.5649     0.3068 0.556 0.000 0.004 0.332 0.024 0.084
#> GSM182811     1  0.6457     0.3317 0.556 0.000 0.000 0.208 0.124 0.112
#> GSM182812     4  0.3867     0.6153 0.128 0.000 0.000 0.780 0.088 0.004
#> GSM182813     1  0.0806     0.6558 0.972 0.000 0.020 0.000 0.008 0.000
#> GSM182778     2  0.1562     0.6470 0.000 0.940 0.004 0.032 0.024 0.000
#> GSM182779     5  0.8376     0.2228 0.104 0.172 0.176 0.000 0.392 0.156
#> GSM182780     3  0.4292     0.4909 0.000 0.204 0.740 0.016 0.016 0.024
#> GSM182781     6  0.7654    -0.1284 0.228 0.000 0.264 0.000 0.196 0.312
#> GSM182782     2  0.1918     0.6487 0.000 0.904 0.000 0.000 0.088 0.008
#> GSM182783     6  0.8576    -0.0351 0.024 0.052 0.288 0.140 0.160 0.336
#> GSM182784     3  0.4221     0.5881 0.080 0.060 0.800 0.000 0.020 0.040
#> GSM182785     3  0.7590     0.3025 0.156 0.228 0.472 0.000 0.076 0.068
#> GSM182786     2  0.2100     0.6395 0.000 0.884 0.004 0.000 0.112 0.000
#> GSM182787     2  0.2288     0.6267 0.000 0.900 0.068 0.000 0.016 0.016
#> GSM182788     2  0.3626     0.5008 0.000 0.704 0.004 0.000 0.288 0.004
#> GSM182789     2  0.7290     0.0331 0.104 0.444 0.328 0.000 0.060 0.064
#> GSM182790     3  0.7454     0.0524 0.240 0.000 0.352 0.000 0.136 0.272
#> GSM182791     3  0.6534     0.5141 0.164 0.052 0.640 0.052 0.036 0.056
#> GSM182792     3  0.3762     0.6072 0.076 0.008 0.836 0.024 0.028 0.028
#> GSM182793     4  0.4854     0.5008 0.000 0.240 0.028 0.684 0.008 0.040
#> GSM182794     3  0.4330     0.5969 0.156 0.000 0.756 0.000 0.048 0.040
#> GSM182795     3  0.7444     0.0354 0.116 0.016 0.396 0.000 0.152 0.320
#> GSM182796     5  0.4425     0.6153 0.152 0.132 0.000 0.000 0.716 0.000
#> GSM182797     1  0.3490     0.5982 0.828 0.000 0.068 0.000 0.084 0.020
#> GSM182798     5  0.3831     0.6802 0.268 0.012 0.000 0.000 0.712 0.008
#> GSM182799     3  0.4927     0.5086 0.004 0.032 0.760 0.092 0.060 0.052
#> GSM182800     3  0.8036     0.0854 0.252 0.000 0.392 0.140 0.164 0.052
#> GSM182801     3  0.3823     0.5875 0.100 0.000 0.808 0.000 0.040 0.052
#> GSM182814     1  0.4745     0.5400 0.716 0.000 0.000 0.184 0.048 0.052
#> GSM182815     4  0.1096     0.7071 0.000 0.004 0.020 0.964 0.004 0.008
#> GSM182816     1  0.5699     0.4482 0.640 0.000 0.228 0.044 0.068 0.020
#> GSM182817     1  0.4413     0.5803 0.780 0.004 0.004 0.044 0.092 0.076
#> GSM182818     6  0.5180    -0.2408 0.016 0.048 0.004 0.328 0.004 0.600
#> GSM182819     1  0.1218     0.6590 0.956 0.000 0.028 0.000 0.012 0.004
#> GSM182820     1  0.2925     0.6298 0.864 0.000 0.060 0.000 0.064 0.012
#> GSM182821     2  0.7777    -0.1152 0.292 0.292 0.132 0.000 0.012 0.272
#> GSM182822     1  0.6254     0.5151 0.644 0.028 0.032 0.084 0.032 0.180
#> GSM182823     1  0.3353     0.6101 0.844 0.000 0.004 0.020 0.076 0.056
#> GSM182824     1  0.4411     0.6271 0.792 0.000 0.064 0.052 0.064 0.028
#> GSM182825     4  0.5297     0.2534 0.352 0.000 0.000 0.556 0.012 0.080

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 stress(p) development.stage(p) k
#> CV:NMF 64     0.897             2.53e-01 2
#> CV:NMF 34     0.463             4.51e-02 3
#> CV:NMF 62     0.624             2.01e-07 4
#> CV:NMF 48     0.877             3.20e-08 5
#> CV:NMF 44     0.850             1.06e-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: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 18172 rows and 71 columns.
#>   Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'MAD' method.
#>   Subgroups are detected by 'hclust' method.
#>   Performed in total 1250 partitions by row resampling.
#>   Best k for subgroups seems to be 2.
#> 
#> Following methods can be applied to this 'ConsensusPartition' object:
#>  [1] "cola_report"             "collect_classes"         "collect_plots"          
#>  [4] "collect_stats"           "colnames"                "compare_signatures"     
#>  [7] "consensus_heatmap"       "dimension_reduction"     "functional_enrichment"  
#> [10] "get_anno_col"            "get_anno"                "get_classes"            
#> [13] "get_consensus"           "get_matrix"              "get_membership"         
#> [16] "get_param"               "get_signatures"          "get_stats"              
#> [19] "is_best_k"               "is_stable_k"             "membership_heatmap"     
#> [22] "ncol"                    "nrow"                    "plot_ecdf"              
#> [25] "rownames"                "select_partition_number" "show"                   
#> [28] "suggest_best_k"          "test_to_known_factors"

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

collect_plots(res)

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.403           0.854       0.886         0.4568 0.494   0.494
#> 3 3 0.498           0.759       0.863         0.3325 0.874   0.751
#> 4 4 0.519           0.628       0.747         0.1330 0.891   0.720
#> 5 5 0.573           0.596       0.732         0.0933 0.930   0.774
#> 6 6 0.601           0.549       0.701         0.0473 0.936   0.775

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
#> GSM182755     1  0.9866    -0.0547 0.568 0.432
#> GSM182756     2  0.7299     0.8856 0.204 0.796
#> GSM182757     2  0.6531     0.9006 0.168 0.832
#> GSM182758     2  0.7299     0.8856 0.204 0.796
#> GSM182759     2  0.6148     0.8990 0.152 0.848
#> GSM182760     2  0.7299     0.8866 0.204 0.796
#> GSM182761     2  0.6623     0.9004 0.172 0.828
#> GSM182762     2  0.8144     0.8426 0.252 0.748
#> GSM182763     2  0.6712     0.8997 0.176 0.824
#> GSM182764     2  0.6247     0.8996 0.156 0.844
#> GSM182765     2  0.6148     0.8990 0.152 0.848
#> GSM182766     2  0.2603     0.8480 0.044 0.956
#> GSM182767     2  0.7299     0.8856 0.204 0.796
#> GSM182768     1  0.2423     0.9128 0.960 0.040
#> GSM182769     1  0.5178     0.8563 0.884 0.116
#> GSM182770     2  0.0000     0.8220 0.000 1.000
#> GSM182771     2  0.5946     0.8969 0.144 0.856
#> GSM182772     2  0.0000     0.8220 0.000 1.000
#> GSM182773     1  0.5294     0.8525 0.880 0.120
#> GSM182774     1  0.3114     0.9056 0.944 0.056
#> GSM182775     1  0.4690     0.8705 0.900 0.100
#> GSM182776     1  0.3733     0.8950 0.928 0.072
#> GSM182777     1  0.7139     0.7522 0.804 0.196
#> GSM182802     2  0.1184     0.8315 0.016 0.984
#> GSM182803     1  0.2236     0.9112 0.964 0.036
#> GSM182804     1  0.8386     0.6592 0.732 0.268
#> GSM182805     2  0.1184     0.8315 0.016 0.984
#> GSM182806     1  0.0000     0.9193 1.000 0.000
#> GSM182807     1  0.0000     0.9193 1.000 0.000
#> GSM182808     1  0.0000     0.9193 1.000 0.000
#> GSM182809     1  0.1843     0.9178 0.972 0.028
#> GSM182810     1  0.1843     0.9178 0.972 0.028
#> GSM182811     1  0.2603     0.9113 0.956 0.044
#> GSM182812     1  0.0000     0.9193 1.000 0.000
#> GSM182813     1  0.0000     0.9193 1.000 0.000
#> GSM182778     2  0.0000     0.8220 0.000 1.000
#> GSM182779     2  0.6623     0.9004 0.172 0.828
#> GSM182780     2  0.6531     0.9008 0.168 0.832
#> GSM182781     2  0.7299     0.8856 0.204 0.796
#> GSM182782     2  0.0000     0.8220 0.000 1.000
#> GSM182783     2  0.6712     0.8998 0.176 0.824
#> GSM182784     2  0.6887     0.8966 0.184 0.816
#> GSM182785     2  0.6801     0.8983 0.180 0.820
#> GSM182786     2  0.0000     0.8220 0.000 1.000
#> GSM182787     2  0.6712     0.8996 0.176 0.824
#> GSM182788     2  0.0000     0.8220 0.000 1.000
#> GSM182789     2  0.6801     0.8983 0.180 0.820
#> GSM182790     2  0.7299     0.8856 0.204 0.796
#> GSM182791     1  0.7950     0.6695 0.760 0.240
#> GSM182792     1  0.5408     0.8491 0.876 0.124
#> GSM182793     2  0.0938     0.8243 0.012 0.988
#> GSM182794     2  0.7376     0.8822 0.208 0.792
#> GSM182795     2  0.7602     0.8709 0.220 0.780
#> GSM182796     2  0.5629     0.8928 0.132 0.868
#> GSM182797     1  0.0000     0.9193 1.000 0.000
#> GSM182798     2  0.5629     0.8928 0.132 0.868
#> GSM182799     1  0.1843     0.9180 0.972 0.028
#> GSM182800     1  0.0672     0.9197 0.992 0.008
#> GSM182801     1  0.1633     0.9181 0.976 0.024
#> GSM182814     1  0.0000     0.9193 1.000 0.000
#> GSM182815     1  0.8386     0.6592 0.732 0.268
#> GSM182816     1  0.0000     0.9193 1.000 0.000
#> GSM182817     2  0.9815     0.5105 0.420 0.580
#> GSM182818     1  0.0672     0.9197 0.992 0.008
#> GSM182819     1  0.0000     0.9193 1.000 0.000
#> GSM182820     1  0.0000     0.9193 1.000 0.000
#> GSM182821     2  0.9710     0.5598 0.400 0.600
#> GSM182822     1  0.1843     0.9178 0.972 0.028
#> GSM182823     1  0.0000     0.9193 1.000 0.000
#> GSM182824     1  0.0000     0.9193 1.000 0.000
#> GSM182825     1  0.0000     0.9193 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
#> GSM182755     3  0.7069      0.216 0.408 0.024 0.568
#> GSM182756     3  0.1163      0.793 0.028 0.000 0.972
#> GSM182757     3  0.3941      0.720 0.000 0.156 0.844
#> GSM182758     3  0.1163      0.793 0.028 0.000 0.972
#> GSM182759     3  0.4605      0.671 0.000 0.204 0.796
#> GSM182760     3  0.1525      0.794 0.032 0.004 0.964
#> GSM182761     3  0.2796      0.768 0.000 0.092 0.908
#> GSM182762     3  0.2998      0.765 0.068 0.016 0.916
#> GSM182763     3  0.2165      0.781 0.000 0.064 0.936
#> GSM182764     3  0.4555      0.676 0.000 0.200 0.800
#> GSM182765     3  0.5497      0.530 0.000 0.292 0.708
#> GSM182766     3  0.6079      0.257 0.000 0.388 0.612
#> GSM182767     3  0.1163      0.793 0.028 0.000 0.972
#> GSM182768     1  0.4413      0.868 0.852 0.024 0.124
#> GSM182769     1  0.5156      0.792 0.776 0.008 0.216
#> GSM182770     2  0.5327      0.801 0.000 0.728 0.272
#> GSM182771     3  0.6062      0.307 0.000 0.384 0.616
#> GSM182772     2  0.5327      0.801 0.000 0.728 0.272
#> GSM182773     1  0.5202      0.788 0.772 0.008 0.220
#> GSM182774     1  0.3918      0.873 0.868 0.012 0.120
#> GSM182775     1  0.4963      0.806 0.792 0.008 0.200
#> GSM182776     1  0.4164      0.860 0.848 0.008 0.144
#> GSM182777     1  0.5988      0.671 0.688 0.008 0.304
#> GSM182802     2  0.5465      0.786 0.000 0.712 0.288
#> GSM182803     1  0.2703      0.877 0.928 0.016 0.056
#> GSM182804     1  0.7599      0.622 0.656 0.084 0.260
#> GSM182805     2  0.5497      0.783 0.000 0.708 0.292
#> GSM182806     1  0.0747      0.882 0.984 0.016 0.000
#> GSM182807     1  0.0747      0.882 0.984 0.016 0.000
#> GSM182808     1  0.0747      0.882 0.984 0.016 0.000
#> GSM182809     1  0.4056      0.876 0.876 0.032 0.092
#> GSM182810     1  0.4056      0.876 0.876 0.032 0.092
#> GSM182811     1  0.4371      0.870 0.860 0.032 0.108
#> GSM182812     1  0.0237      0.883 0.996 0.004 0.000
#> GSM182813     1  0.0747      0.882 0.984 0.016 0.000
#> GSM182778     2  0.2165      0.806 0.000 0.936 0.064
#> GSM182779     3  0.3038      0.761 0.000 0.104 0.896
#> GSM182780     3  0.1163      0.789 0.000 0.028 0.972
#> GSM182781     3  0.1031      0.793 0.024 0.000 0.976
#> GSM182782     2  0.2165      0.806 0.000 0.936 0.064
#> GSM182783     3  0.1015      0.793 0.008 0.012 0.980
#> GSM182784     3  0.0829      0.793 0.004 0.012 0.984
#> GSM182785     3  0.0592      0.792 0.000 0.012 0.988
#> GSM182786     2  0.2165      0.806 0.000 0.936 0.064
#> GSM182787     3  0.2625      0.773 0.000 0.084 0.916
#> GSM182788     2  0.2165      0.806 0.000 0.936 0.064
#> GSM182789     3  0.0747      0.792 0.000 0.016 0.984
#> GSM182790     3  0.1163      0.793 0.028 0.000 0.972
#> GSM182791     1  0.6129      0.639 0.668 0.008 0.324
#> GSM182792     1  0.5012      0.808 0.788 0.008 0.204
#> GSM182793     2  0.5363      0.794 0.000 0.724 0.276
#> GSM182794     3  0.1289      0.792 0.032 0.000 0.968
#> GSM182795     3  0.1643      0.785 0.044 0.000 0.956
#> GSM182796     3  0.6168      0.236 0.000 0.412 0.588
#> GSM182797     1  0.1170      0.884 0.976 0.016 0.008
#> GSM182798     3  0.6126      0.258 0.000 0.400 0.600
#> GSM182799     1  0.4094      0.877 0.872 0.028 0.100
#> GSM182800     1  0.2414      0.887 0.940 0.020 0.040
#> GSM182801     1  0.3832      0.878 0.880 0.020 0.100
#> GSM182814     1  0.0237      0.883 0.996 0.004 0.000
#> GSM182815     1  0.7665      0.611 0.648 0.084 0.268
#> GSM182816     1  0.0237      0.883 0.996 0.004 0.000
#> GSM182817     3  0.6762      0.459 0.288 0.036 0.676
#> GSM182818     1  0.3213      0.884 0.912 0.028 0.060
#> GSM182819     1  0.0237      0.883 0.996 0.004 0.000
#> GSM182820     1  0.0747      0.882 0.984 0.016 0.000
#> GSM182821     3  0.6562      0.491 0.264 0.036 0.700
#> GSM182822     1  0.4056      0.876 0.876 0.032 0.092
#> GSM182823     1  0.0237      0.883 0.996 0.004 0.000
#> GSM182824     1  0.0237      0.883 0.996 0.004 0.000
#> GSM182825     1  0.0424      0.883 0.992 0.008 0.000

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM182755     3  0.5805     0.3124 0.388 0.000 0.576 0.036
#> GSM182756     3  0.0895     0.8129 0.004 0.000 0.976 0.020
#> GSM182757     3  0.4037     0.7559 0.000 0.112 0.832 0.056
#> GSM182758     3  0.0779     0.8131 0.004 0.000 0.980 0.016
#> GSM182759     3  0.4656     0.7159 0.000 0.160 0.784 0.056
#> GSM182760     3  0.1749     0.8140 0.012 0.012 0.952 0.024
#> GSM182761     3  0.2840     0.7970 0.000 0.044 0.900 0.056
#> GSM182762     3  0.2275     0.7900 0.048 0.004 0.928 0.020
#> GSM182763     3  0.1867     0.8052 0.000 0.072 0.928 0.000
#> GSM182764     3  0.4609     0.7198 0.000 0.156 0.788 0.056
#> GSM182765     3  0.4868     0.5809 0.000 0.304 0.684 0.012
#> GSM182766     3  0.5300     0.3561 0.000 0.408 0.580 0.012
#> GSM182767     3  0.0779     0.8131 0.004 0.000 0.980 0.016
#> GSM182768     4  0.6668     0.6528 0.380 0.000 0.092 0.528
#> GSM182769     4  0.7647     0.5373 0.388 0.000 0.208 0.404
#> GSM182770     2  0.2593     0.8205 0.000 0.892 0.104 0.004
#> GSM182771     3  0.4925     0.3671 0.000 0.428 0.572 0.000
#> GSM182772     2  0.2593     0.8205 0.000 0.892 0.104 0.004
#> GSM182773     4  0.7665     0.5355 0.384 0.000 0.212 0.404
#> GSM182774     4  0.6627     0.6300 0.412 0.000 0.084 0.504
#> GSM182775     1  0.7589    -0.5761 0.408 0.000 0.196 0.396
#> GSM182776     4  0.6944     0.6298 0.404 0.000 0.112 0.484
#> GSM182777     1  0.7877    -0.4554 0.388 0.000 0.300 0.312
#> GSM182802     2  0.3099     0.8175 0.000 0.876 0.104 0.020
#> GSM182803     1  0.5640     0.3849 0.656 0.024 0.012 0.308
#> GSM182804     4  0.8243     0.4681 0.168 0.160 0.100 0.572
#> GSM182805     2  0.3160     0.8162 0.000 0.872 0.108 0.020
#> GSM182806     1  0.0336     0.6962 0.992 0.000 0.000 0.008
#> GSM182807     1  0.0188     0.6973 0.996 0.000 0.000 0.004
#> GSM182808     1  0.0000     0.6967 1.000 0.000 0.000 0.000
#> GSM182809     4  0.5423     0.6324 0.332 0.000 0.028 0.640
#> GSM182810     4  0.5460     0.6267 0.340 0.000 0.028 0.632
#> GSM182811     4  0.5857     0.6041 0.340 0.008 0.032 0.620
#> GSM182812     1  0.2149     0.7009 0.912 0.000 0.000 0.088
#> GSM182813     1  0.0188     0.6973 0.996 0.000 0.000 0.004
#> GSM182778     2  0.5010     0.7995 0.000 0.700 0.024 0.276
#> GSM182779     3  0.3090     0.7916 0.000 0.056 0.888 0.056
#> GSM182780     3  0.1118     0.8144 0.000 0.036 0.964 0.000
#> GSM182781     3  0.0592     0.8131 0.000 0.000 0.984 0.016
#> GSM182782     2  0.5010     0.7995 0.000 0.700 0.024 0.276
#> GSM182783     3  0.1284     0.8169 0.000 0.024 0.964 0.012
#> GSM182784     3  0.0592     0.8156 0.000 0.016 0.984 0.000
#> GSM182785     3  0.0707     0.8152 0.000 0.020 0.980 0.000
#> GSM182786     2  0.5010     0.7995 0.000 0.700 0.024 0.276
#> GSM182787     3  0.2675     0.8005 0.000 0.044 0.908 0.048
#> GSM182788     2  0.5010     0.7995 0.000 0.700 0.024 0.276
#> GSM182789     3  0.0817     0.8152 0.000 0.024 0.976 0.000
#> GSM182790     3  0.0779     0.8131 0.004 0.000 0.980 0.016
#> GSM182791     4  0.7863     0.4664 0.300 0.000 0.304 0.396
#> GSM182792     4  0.7489     0.6018 0.364 0.000 0.184 0.452
#> GSM182793     2  0.3037     0.8172 0.000 0.880 0.100 0.020
#> GSM182794     3  0.0895     0.8127 0.004 0.000 0.976 0.020
#> GSM182795     3  0.1543     0.8080 0.008 0.004 0.956 0.032
#> GSM182796     3  0.6819     0.3703 0.000 0.312 0.564 0.124
#> GSM182797     1  0.0937     0.6885 0.976 0.000 0.012 0.012
#> GSM182798     3  0.4955     0.3298 0.000 0.444 0.556 0.000
#> GSM182799     4  0.6497     0.6534 0.376 0.004 0.068 0.552
#> GSM182800     1  0.5284     0.0682 0.616 0.000 0.016 0.368
#> GSM182801     4  0.6392     0.6333 0.404 0.000 0.068 0.528
#> GSM182814     1  0.2149     0.7009 0.912 0.000 0.000 0.088
#> GSM182815     4  0.8133     0.4625 0.156 0.160 0.100 0.584
#> GSM182816     1  0.3942     0.5422 0.764 0.000 0.000 0.236
#> GSM182817     3  0.6724     0.3873 0.052 0.028 0.588 0.332
#> GSM182818     4  0.4790     0.5885 0.380 0.000 0.000 0.620
#> GSM182819     1  0.3942     0.5422 0.764 0.000 0.000 0.236
#> GSM182820     1  0.0336     0.6962 0.992 0.000 0.000 0.008
#> GSM182821     3  0.6273     0.4529 0.048 0.016 0.624 0.312
#> GSM182822     4  0.5460     0.6267 0.340 0.000 0.028 0.632
#> GSM182823     1  0.2149     0.7009 0.912 0.000 0.000 0.088
#> GSM182824     1  0.2149     0.7009 0.912 0.000 0.000 0.088
#> GSM182825     1  0.3801     0.5707 0.780 0.000 0.000 0.220

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>           class entropy silhouette    p1    p2    p3    p4    p5
#> GSM182755     1  0.7842    -0.0727 0.352 0.000 0.068 0.248 0.332
#> GSM182756     5  0.2984     0.7588 0.000 0.000 0.032 0.108 0.860
#> GSM182757     5  0.3578     0.7262 0.000 0.048 0.000 0.132 0.820
#> GSM182758     5  0.2769     0.7598 0.000 0.000 0.032 0.092 0.876
#> GSM182759     5  0.4779     0.6756 0.000 0.096 0.004 0.164 0.736
#> GSM182760     5  0.2155     0.7786 0.008 0.008 0.028 0.028 0.928
#> GSM182761     5  0.2130     0.7624 0.000 0.012 0.000 0.080 0.908
#> GSM182762     5  0.5028     0.6561 0.040 0.000 0.036 0.204 0.720
#> GSM182763     5  0.1981     0.7704 0.000 0.048 0.000 0.028 0.924
#> GSM182764     5  0.4728     0.6789 0.000 0.092 0.004 0.164 0.740
#> GSM182765     5  0.6133     0.5027 0.004 0.276 0.008 0.124 0.588
#> GSM182766     5  0.5256     0.3483 0.000 0.420 0.000 0.048 0.532
#> GSM182767     5  0.2824     0.7587 0.000 0.000 0.032 0.096 0.872
#> GSM182768     3  0.4841     0.6504 0.200 0.000 0.732 0.028 0.040
#> GSM182769     3  0.6751     0.6055 0.212 0.000 0.596 0.104 0.088
#> GSM182770     2  0.0000     0.7695 0.000 1.000 0.000 0.000 0.000
#> GSM182771     5  0.6374     0.2911 0.004 0.400 0.008 0.112 0.476
#> GSM182772     2  0.0000     0.7695 0.000 1.000 0.000 0.000 0.000
#> GSM182773     3  0.6772     0.6043 0.208 0.000 0.596 0.104 0.092
#> GSM182774     3  0.4898     0.6402 0.200 0.000 0.728 0.048 0.024
#> GSM182775     3  0.6784     0.5987 0.232 0.000 0.584 0.096 0.088
#> GSM182776     3  0.5607     0.6421 0.220 0.000 0.676 0.064 0.040
#> GSM182777     3  0.7636     0.5085 0.220 0.000 0.492 0.104 0.184
#> GSM182802     2  0.0771     0.7656 0.000 0.976 0.020 0.004 0.000
#> GSM182803     3  0.5893    -0.2379 0.460 0.016 0.464 0.060 0.000
#> GSM182804     3  0.6480     0.4040 0.040 0.260 0.584 0.116 0.000
#> GSM182805     2  0.0932     0.7620 0.000 0.972 0.020 0.004 0.004
#> GSM182806     1  0.1041     0.7093 0.964 0.000 0.032 0.004 0.000
#> GSM182807     1  0.0955     0.7101 0.968 0.000 0.028 0.004 0.000
#> GSM182808     1  0.0703     0.7107 0.976 0.000 0.024 0.000 0.000
#> GSM182809     3  0.3635     0.5972 0.088 0.000 0.836 0.068 0.008
#> GSM182810     3  0.3798     0.5907 0.100 0.000 0.824 0.068 0.008
#> GSM182811     3  0.4168     0.5634 0.112 0.004 0.804 0.072 0.008
#> GSM182812     1  0.4031     0.6803 0.772 0.000 0.184 0.044 0.000
#> GSM182813     1  0.0955     0.7101 0.968 0.000 0.028 0.004 0.000
#> GSM182778     4  0.4748     1.0000 0.000 0.492 0.000 0.492 0.016
#> GSM182779     5  0.2408     0.7579 0.000 0.016 0.000 0.092 0.892
#> GSM182780     5  0.0794     0.7761 0.000 0.028 0.000 0.000 0.972
#> GSM182781     5  0.2351     0.7685 0.000 0.000 0.016 0.088 0.896
#> GSM182782     4  0.4748     1.0000 0.000 0.492 0.000 0.492 0.016
#> GSM182783     5  0.2547     0.7727 0.000 0.016 0.016 0.068 0.900
#> GSM182784     5  0.0290     0.7764 0.000 0.008 0.000 0.000 0.992
#> GSM182785     5  0.0404     0.7760 0.000 0.012 0.000 0.000 0.988
#> GSM182786     4  0.4748     1.0000 0.000 0.492 0.000 0.492 0.016
#> GSM182787     5  0.2046     0.7654 0.000 0.016 0.000 0.068 0.916
#> GSM182788     2  0.4748    -1.0000 0.000 0.492 0.000 0.492 0.016
#> GSM182789     5  0.0510     0.7761 0.000 0.016 0.000 0.000 0.984
#> GSM182790     5  0.2824     0.7591 0.000 0.000 0.032 0.096 0.872
#> GSM182791     3  0.6809     0.5503 0.124 0.000 0.588 0.076 0.212
#> GSM182792     3  0.6311     0.6345 0.184 0.000 0.644 0.076 0.096
#> GSM182793     2  0.0609     0.7570 0.000 0.980 0.000 0.020 0.000
#> GSM182794     5  0.3058     0.7546 0.000 0.000 0.044 0.096 0.860
#> GSM182795     5  0.3090     0.7534 0.000 0.000 0.052 0.088 0.860
#> GSM182796     5  0.6947     0.2542 0.004 0.236 0.008 0.292 0.460
#> GSM182797     1  0.1872     0.6876 0.928 0.000 0.052 0.020 0.000
#> GSM182798     5  0.6356     0.2420 0.004 0.424 0.008 0.108 0.456
#> GSM182799     3  0.4556     0.6562 0.160 0.004 0.772 0.024 0.040
#> GSM182800     3  0.5143     0.1523 0.420 0.000 0.544 0.032 0.004
#> GSM182801     3  0.4821     0.6457 0.208 0.000 0.728 0.024 0.040
#> GSM182814     1  0.4031     0.6803 0.772 0.000 0.184 0.044 0.000
#> GSM182815     3  0.6226     0.3907 0.028 0.260 0.600 0.112 0.000
#> GSM182816     1  0.5240     0.3998 0.584 0.000 0.360 0.056 0.000
#> GSM182817     5  0.7101     0.2313 0.008 0.028 0.360 0.144 0.460
#> GSM182818     3  0.4855     0.5822 0.168 0.000 0.720 0.112 0.000
#> GSM182819     1  0.5240     0.3998 0.584 0.000 0.360 0.056 0.000
#> GSM182820     1  0.1041     0.7093 0.964 0.000 0.032 0.004 0.000
#> GSM182821     5  0.6783     0.3026 0.004 0.020 0.344 0.140 0.492
#> GSM182822     3  0.3798     0.5907 0.100 0.000 0.824 0.068 0.008
#> GSM182823     1  0.4031     0.6803 0.772 0.000 0.184 0.044 0.000
#> GSM182824     1  0.4031     0.6803 0.772 0.000 0.184 0.044 0.000
#> GSM182825     1  0.5036     0.4918 0.628 0.000 0.320 0.052 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
#> GSM182755     5  0.8081    0.18034 0.296 0.004 0.156 0.144 0.360 0.040
#> GSM182756     3  0.4133    0.64994 0.000 0.000 0.772 0.024 0.064 0.140
#> GSM182757     3  0.3295    0.66666 0.000 0.012 0.800 0.176 0.012 0.000
#> GSM182758     3  0.3222    0.67919 0.000 0.000 0.824 0.024 0.012 0.140
#> GSM182759     3  0.4756    0.59787 0.000 0.060 0.696 0.216 0.028 0.000
#> GSM182760     3  0.1932    0.72288 0.004 0.004 0.912 0.004 0.000 0.076
#> GSM182761     3  0.1700    0.71729 0.000 0.004 0.916 0.080 0.000 0.000
#> GSM182762     3  0.6040    0.20750 0.004 0.004 0.528 0.136 0.312 0.016
#> GSM182763     3  0.1864    0.72203 0.000 0.040 0.924 0.032 0.004 0.000
#> GSM182764     3  0.4701    0.60136 0.000 0.056 0.700 0.216 0.028 0.000
#> GSM182765     3  0.6425    0.34250 0.000 0.260 0.524 0.152 0.064 0.000
#> GSM182766     3  0.5265    0.28704 0.000 0.388 0.520 0.088 0.004 0.000
#> GSM182767     3  0.3300    0.67374 0.000 0.000 0.816 0.024 0.012 0.148
#> GSM182768     6  0.3738    0.57823 0.100 0.000 0.008 0.016 0.060 0.816
#> GSM182769     6  0.3650    0.54959 0.116 0.000 0.032 0.020 0.012 0.820
#> GSM182770     2  0.0291    0.72561 0.000 0.992 0.004 0.004 0.000 0.000
#> GSM182771     3  0.6608    0.00289 0.000 0.384 0.412 0.140 0.064 0.000
#> GSM182772     2  0.0291    0.72561 0.000 0.992 0.004 0.004 0.000 0.000
#> GSM182773     6  0.3721    0.54733 0.116 0.000 0.036 0.020 0.012 0.816
#> GSM182774     6  0.4933    0.52798 0.128 0.000 0.008 0.004 0.172 0.688
#> GSM182775     6  0.4150    0.55133 0.132 0.000 0.032 0.020 0.028 0.788
#> GSM182776     6  0.4580    0.56239 0.124 0.000 0.008 0.008 0.124 0.736
#> GSM182777     6  0.5260    0.44363 0.136 0.000 0.128 0.024 0.016 0.696
#> GSM182802     2  0.1080    0.71598 0.000 0.960 0.004 0.000 0.032 0.004
#> GSM182803     1  0.6678    0.36120 0.428 0.000 0.000 0.044 0.308 0.220
#> GSM182804     6  0.7817    0.08407 0.072 0.260 0.000 0.044 0.280 0.344
#> GSM182805     2  0.1155    0.71278 0.000 0.956 0.004 0.000 0.036 0.004
#> GSM182806     1  0.1788    0.69557 0.916 0.000 0.000 0.004 0.004 0.076
#> GSM182807     1  0.1732    0.69605 0.920 0.000 0.000 0.004 0.004 0.072
#> GSM182808     1  0.1444    0.69812 0.928 0.000 0.000 0.000 0.000 0.072
#> GSM182809     6  0.5224    0.22577 0.092 0.000 0.000 0.000 0.440 0.468
#> GSM182810     6  0.5262    0.21545 0.096 0.000 0.000 0.000 0.448 0.456
#> GSM182811     5  0.5508   -0.37638 0.112 0.000 0.000 0.004 0.472 0.412
#> GSM182812     1  0.4417    0.71401 0.748 0.000 0.000 0.056 0.160 0.036
#> GSM182813     1  0.1732    0.69605 0.920 0.000 0.000 0.004 0.004 0.072
#> GSM182778     4  0.3835    1.00000 0.000 0.320 0.012 0.668 0.000 0.000
#> GSM182779     3  0.2113    0.71146 0.000 0.008 0.896 0.092 0.004 0.000
#> GSM182780     3  0.0547    0.73023 0.000 0.020 0.980 0.000 0.000 0.000
#> GSM182781     3  0.2829    0.70292 0.000 0.000 0.864 0.024 0.016 0.096
#> GSM182782     4  0.3835    1.00000 0.000 0.320 0.012 0.668 0.000 0.000
#> GSM182783     3  0.2804    0.71086 0.000 0.012 0.876 0.020 0.012 0.080
#> GSM182784     3  0.0291    0.72955 0.000 0.004 0.992 0.000 0.000 0.004
#> GSM182785     3  0.0146    0.72927 0.000 0.004 0.996 0.000 0.000 0.000
#> GSM182786     4  0.3835    1.00000 0.000 0.320 0.012 0.668 0.000 0.000
#> GSM182787     3  0.1643    0.72035 0.000 0.008 0.924 0.068 0.000 0.000
#> GSM182788     4  0.3835    1.00000 0.000 0.320 0.012 0.668 0.000 0.000
#> GSM182789     3  0.0260    0.72978 0.000 0.008 0.992 0.000 0.000 0.000
#> GSM182790     3  0.3261    0.67685 0.000 0.000 0.820 0.024 0.012 0.144
#> GSM182791     6  0.4244    0.41480 0.080 0.000 0.168 0.000 0.008 0.744
#> GSM182792     6  0.3533    0.56025 0.100 0.000 0.052 0.000 0.024 0.824
#> GSM182793     2  0.0912    0.71723 0.000 0.972 0.004 0.012 0.004 0.008
#> GSM182794     3  0.3411    0.66457 0.000 0.000 0.804 0.024 0.012 0.160
#> GSM182795     3  0.3375    0.66866 0.000 0.000 0.808 0.024 0.012 0.156
#> GSM182796     3  0.6790    0.15826 0.000 0.204 0.412 0.328 0.056 0.000
#> GSM182797     1  0.3015    0.64106 0.844 0.000 0.000 0.024 0.012 0.120
#> GSM182798     2  0.6546   -0.15675 0.000 0.404 0.400 0.136 0.060 0.000
#> GSM182799     6  0.4043    0.56507 0.084 0.004 0.008 0.020 0.080 0.804
#> GSM182800     6  0.6211    0.08827 0.356 0.000 0.000 0.040 0.128 0.476
#> GSM182801     6  0.4094    0.57632 0.112 0.000 0.008 0.016 0.076 0.788
#> GSM182814     1  0.4417    0.71401 0.748 0.000 0.000 0.056 0.160 0.036
#> GSM182815     6  0.7688    0.07799 0.056 0.260 0.000 0.044 0.304 0.336
#> GSM182816     1  0.6162    0.53619 0.560 0.000 0.000 0.048 0.228 0.164
#> GSM182817     5  0.6555    0.43727 0.004 0.012 0.304 0.016 0.472 0.192
#> GSM182818     6  0.6175    0.28992 0.072 0.000 0.000 0.076 0.376 0.476
#> GSM182819     1  0.6162    0.53619 0.560 0.000 0.000 0.048 0.228 0.164
#> GSM182820     1  0.1788    0.69557 0.916 0.000 0.000 0.004 0.004 0.076
#> GSM182821     5  0.6491    0.41447 0.000 0.012 0.336 0.016 0.444 0.192
#> GSM182822     6  0.5262    0.21545 0.096 0.000 0.000 0.000 0.448 0.456
#> GSM182823     1  0.4417    0.71401 0.748 0.000 0.000 0.056 0.160 0.036
#> GSM182824     1  0.4417    0.71401 0.748 0.000 0.000 0.056 0.160 0.036
#> GSM182825     1  0.5880    0.59153 0.604 0.000 0.000 0.056 0.220 0.120

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 stress(p) development.stage(p) k
#> MAD:hclust 70     0.821             3.64e-05 2
#> MAD:hclust 64     0.932             1.53e-05 3
#> MAD:hclust 57     0.687             5.23e-07 4
#> MAD:hclust 56     0.236             8.32e-06 5
#> MAD:hclust 51     0.110             3.68e-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.


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

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

collect_plots(res)

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.965       0.986         0.5059 0.494   0.494
#> 3 3 0.755           0.862       0.923         0.3037 0.703   0.472
#> 4 4 0.606           0.590       0.733         0.1178 0.850   0.598
#> 5 5 0.631           0.604       0.774         0.0654 0.888   0.617
#> 6 6 0.689           0.568       0.665         0.0433 0.901   0.584

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
#> GSM182755     1  0.6247     0.8039 0.844 0.156
#> GSM182756     2  0.0000     0.9909 0.000 1.000
#> GSM182757     2  0.0000     0.9909 0.000 1.000
#> GSM182758     2  0.0000     0.9909 0.000 1.000
#> GSM182759     2  0.0000     0.9909 0.000 1.000
#> GSM182760     2  0.0672     0.9854 0.008 0.992
#> GSM182761     2  0.0000     0.9909 0.000 1.000
#> GSM182762     2  0.0000     0.9909 0.000 1.000
#> GSM182763     2  0.0000     0.9909 0.000 1.000
#> GSM182764     2  0.0000     0.9909 0.000 1.000
#> GSM182765     2  0.0000     0.9909 0.000 1.000
#> GSM182766     2  0.0000     0.9909 0.000 1.000
#> GSM182767     2  0.0672     0.9854 0.008 0.992
#> GSM182768     1  0.0000     0.9801 1.000 0.000
#> GSM182769     1  0.0000     0.9801 1.000 0.000
#> GSM182770     2  0.0000     0.9909 0.000 1.000
#> GSM182771     2  0.0000     0.9909 0.000 1.000
#> GSM182772     2  0.0000     0.9909 0.000 1.000
#> GSM182773     1  0.0000     0.9801 1.000 0.000
#> GSM182774     1  0.0000     0.9801 1.000 0.000
#> GSM182775     1  0.0000     0.9801 1.000 0.000
#> GSM182776     1  0.0000     0.9801 1.000 0.000
#> GSM182777     1  0.0000     0.9801 1.000 0.000
#> GSM182802     2  0.0000     0.9909 0.000 1.000
#> GSM182803     1  0.0000     0.9801 1.000 0.000
#> GSM182804     1  0.0000     0.9801 1.000 0.000
#> GSM182805     2  0.0000     0.9909 0.000 1.000
#> GSM182806     1  0.0000     0.9801 1.000 0.000
#> GSM182807     1  0.0000     0.9801 1.000 0.000
#> GSM182808     1  0.0000     0.9801 1.000 0.000
#> GSM182809     1  0.0000     0.9801 1.000 0.000
#> GSM182810     1  0.0000     0.9801 1.000 0.000
#> GSM182811     1  0.0000     0.9801 1.000 0.000
#> GSM182812     1  0.0000     0.9801 1.000 0.000
#> GSM182813     1  0.0000     0.9801 1.000 0.000
#> GSM182778     2  0.0000     0.9909 0.000 1.000
#> GSM182779     2  0.0000     0.9909 0.000 1.000
#> GSM182780     2  0.0000     0.9909 0.000 1.000
#> GSM182781     2  0.1184     0.9784 0.016 0.984
#> GSM182782     2  0.0000     0.9909 0.000 1.000
#> GSM182783     2  0.0000     0.9909 0.000 1.000
#> GSM182784     2  0.0000     0.9909 0.000 1.000
#> GSM182785     2  0.0000     0.9909 0.000 1.000
#> GSM182786     2  0.0000     0.9909 0.000 1.000
#> GSM182787     2  0.0000     0.9909 0.000 1.000
#> GSM182788     2  0.0000     0.9909 0.000 1.000
#> GSM182789     2  0.0000     0.9909 0.000 1.000
#> GSM182790     2  0.1184     0.9784 0.016 0.984
#> GSM182791     1  0.9993     0.0428 0.516 0.484
#> GSM182792     1  0.0000     0.9801 1.000 0.000
#> GSM182793     2  0.0000     0.9909 0.000 1.000
#> GSM182794     2  0.0672     0.9854 0.008 0.992
#> GSM182795     2  0.0000     0.9909 0.000 1.000
#> GSM182796     2  0.0000     0.9909 0.000 1.000
#> GSM182797     1  0.0000     0.9801 1.000 0.000
#> GSM182798     2  0.0000     0.9909 0.000 1.000
#> GSM182799     1  0.0000     0.9801 1.000 0.000
#> GSM182800     1  0.0000     0.9801 1.000 0.000
#> GSM182801     1  0.0000     0.9801 1.000 0.000
#> GSM182814     1  0.0000     0.9801 1.000 0.000
#> GSM182815     1  0.0000     0.9801 1.000 0.000
#> GSM182816     1  0.0000     0.9801 1.000 0.000
#> GSM182817     2  0.8207     0.6495 0.256 0.744
#> GSM182818     1  0.0000     0.9801 1.000 0.000
#> GSM182819     1  0.0000     0.9801 1.000 0.000
#> GSM182820     1  0.0000     0.9801 1.000 0.000
#> GSM182821     2  0.0672     0.9854 0.008 0.992
#> GSM182822     1  0.0000     0.9801 1.000 0.000
#> GSM182823     1  0.0000     0.9801 1.000 0.000
#> GSM182824     1  0.0000     0.9801 1.000 0.000
#> GSM182825     1  0.0000     0.9801 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
#> GSM182755     3  0.4235      0.777 0.176 0.000 0.824
#> GSM182756     3  0.0000      0.892 0.000 0.000 1.000
#> GSM182757     3  0.5905      0.288 0.000 0.352 0.648
#> GSM182758     3  0.0000      0.892 0.000 0.000 1.000
#> GSM182759     2  0.2356      0.897 0.000 0.928 0.072
#> GSM182760     3  0.0000      0.892 0.000 0.000 1.000
#> GSM182761     2  0.5733      0.647 0.000 0.676 0.324
#> GSM182762     3  0.0237      0.891 0.000 0.004 0.996
#> GSM182763     3  0.4974      0.588 0.000 0.236 0.764
#> GSM182764     2  0.6215      0.441 0.000 0.572 0.428
#> GSM182765     3  0.3038      0.801 0.000 0.104 0.896
#> GSM182766     2  0.2356      0.897 0.000 0.928 0.072
#> GSM182767     3  0.0000      0.892 0.000 0.000 1.000
#> GSM182768     3  0.5514      0.764 0.156 0.044 0.800
#> GSM182769     1  0.2796      0.913 0.908 0.000 0.092
#> GSM182770     2  0.1529      0.891 0.000 0.960 0.040
#> GSM182771     2  0.4235      0.799 0.000 0.824 0.176
#> GSM182772     2  0.1529      0.891 0.000 0.960 0.040
#> GSM182773     3  0.3276      0.854 0.068 0.024 0.908
#> GSM182774     1  0.3445      0.910 0.896 0.016 0.088
#> GSM182775     3  0.5859      0.501 0.344 0.000 0.656
#> GSM182776     1  0.2537      0.921 0.920 0.000 0.080
#> GSM182777     3  0.2711      0.851 0.088 0.000 0.912
#> GSM182802     2  0.0000      0.867 0.000 1.000 0.000
#> GSM182803     1  0.0237      0.958 0.996 0.004 0.000
#> GSM182804     1  0.3742      0.917 0.892 0.072 0.036
#> GSM182805     2  0.0237      0.870 0.000 0.996 0.004
#> GSM182806     1  0.0000      0.959 1.000 0.000 0.000
#> GSM182807     1  0.0000      0.959 1.000 0.000 0.000
#> GSM182808     1  0.0000      0.959 1.000 0.000 0.000
#> GSM182809     1  0.4370      0.901 0.868 0.056 0.076
#> GSM182810     1  0.0000      0.959 1.000 0.000 0.000
#> GSM182811     1  0.1529      0.944 0.960 0.040 0.000
#> GSM182812     1  0.0000      0.959 1.000 0.000 0.000
#> GSM182813     1  0.0000      0.959 1.000 0.000 0.000
#> GSM182778     2  0.2356      0.897 0.000 0.928 0.072
#> GSM182779     2  0.6215      0.443 0.000 0.572 0.428
#> GSM182780     3  0.1289      0.869 0.000 0.032 0.968
#> GSM182781     3  0.0000      0.892 0.000 0.000 1.000
#> GSM182782     2  0.2356      0.897 0.000 0.928 0.072
#> GSM182783     3  0.0237      0.891 0.000 0.004 0.996
#> GSM182784     3  0.0000      0.892 0.000 0.000 1.000
#> GSM182785     3  0.0000      0.892 0.000 0.000 1.000
#> GSM182786     2  0.2356      0.897 0.000 0.928 0.072
#> GSM182787     2  0.4555      0.804 0.000 0.800 0.200
#> GSM182788     2  0.2356      0.897 0.000 0.928 0.072
#> GSM182789     3  0.0237      0.891 0.000 0.004 0.996
#> GSM182790     3  0.0000      0.892 0.000 0.000 1.000
#> GSM182791     3  0.3148      0.860 0.036 0.048 0.916
#> GSM182792     3  0.4636      0.815 0.104 0.044 0.852
#> GSM182793     2  0.0424      0.870 0.000 0.992 0.008
#> GSM182794     3  0.0000      0.892 0.000 0.000 1.000
#> GSM182795     3  0.0000      0.892 0.000 0.000 1.000
#> GSM182796     2  0.2066      0.895 0.000 0.940 0.060
#> GSM182797     1  0.0747      0.954 0.984 0.000 0.016
#> GSM182798     2  0.1643      0.892 0.000 0.956 0.044
#> GSM182799     3  0.6107      0.728 0.184 0.052 0.764
#> GSM182800     1  0.3445      0.910 0.896 0.016 0.088
#> GSM182801     1  0.2711      0.916 0.912 0.000 0.088
#> GSM182814     1  0.0000      0.959 1.000 0.000 0.000
#> GSM182815     1  0.3742      0.917 0.892 0.072 0.036
#> GSM182816     1  0.0000      0.959 1.000 0.000 0.000
#> GSM182817     1  0.6452      0.777 0.760 0.088 0.152
#> GSM182818     1  0.1163      0.949 0.972 0.028 0.000
#> GSM182819     1  0.0000      0.959 1.000 0.000 0.000
#> GSM182820     1  0.0000      0.959 1.000 0.000 0.000
#> GSM182821     3  0.1753      0.873 0.000 0.048 0.952
#> GSM182822     1  0.0237      0.958 0.996 0.004 0.000
#> GSM182823     1  0.0000      0.959 1.000 0.000 0.000
#> GSM182824     1  0.0000      0.959 1.000 0.000 0.000
#> GSM182825     1  0.0000      0.959 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
#> GSM182755     3  0.6892     0.3098 0.240 0.004 0.604 0.152
#> GSM182756     3  0.0336     0.7365 0.000 0.000 0.992 0.008
#> GSM182757     3  0.6078     0.4042 0.000 0.312 0.620 0.068
#> GSM182758     3  0.0000     0.7357 0.000 0.000 1.000 0.000
#> GSM182759     2  0.4203     0.7252 0.000 0.824 0.108 0.068
#> GSM182760     3  0.1118     0.7217 0.000 0.000 0.964 0.036
#> GSM182761     3  0.6371     0.1416 0.000 0.428 0.508 0.064
#> GSM182762     3  0.2965     0.7145 0.000 0.036 0.892 0.072
#> GSM182763     3  0.4534     0.6500 0.000 0.132 0.800 0.068
#> GSM182764     3  0.6337     0.2576 0.000 0.380 0.552 0.068
#> GSM182765     3  0.3056     0.7130 0.000 0.040 0.888 0.072
#> GSM182766     2  0.1733     0.7979 0.000 0.948 0.024 0.028
#> GSM182767     3  0.1389     0.7152 0.000 0.000 0.952 0.048
#> GSM182768     4  0.5781     0.1317 0.028 0.000 0.480 0.492
#> GSM182769     4  0.7748     0.5026 0.336 0.004 0.208 0.452
#> GSM182770     2  0.3751     0.7702 0.000 0.800 0.004 0.196
#> GSM182771     2  0.7121     0.6402 0.000 0.544 0.164 0.292
#> GSM182772     2  0.3791     0.7707 0.000 0.796 0.004 0.200
#> GSM182773     3  0.5039     0.1029 0.000 0.004 0.592 0.404
#> GSM182774     4  0.6770     0.5005 0.292 0.000 0.128 0.580
#> GSM182775     4  0.7558     0.4017 0.168 0.004 0.372 0.456
#> GSM182776     4  0.6932     0.3921 0.404 0.004 0.096 0.496
#> GSM182777     3  0.5706     0.0201 0.020 0.004 0.556 0.420
#> GSM182802     2  0.4776     0.6597 0.000 0.624 0.000 0.376
#> GSM182803     1  0.1302     0.8459 0.956 0.000 0.000 0.044
#> GSM182804     4  0.5378     0.1121 0.348 0.016 0.004 0.632
#> GSM182805     2  0.4713     0.6767 0.000 0.640 0.000 0.360
#> GSM182806     1  0.1489     0.8334 0.952 0.004 0.000 0.044
#> GSM182807     1  0.1489     0.8334 0.952 0.004 0.000 0.044
#> GSM182808     1  0.1489     0.8334 0.952 0.004 0.000 0.044
#> GSM182809     4  0.4746     0.4751 0.168 0.000 0.056 0.776
#> GSM182810     1  0.2647     0.8064 0.880 0.000 0.000 0.120
#> GSM182811     1  0.4624     0.5129 0.660 0.000 0.000 0.340
#> GSM182812     1  0.2281     0.8233 0.904 0.000 0.000 0.096
#> GSM182813     1  0.1489     0.8334 0.952 0.004 0.000 0.044
#> GSM182778     2  0.1151     0.7979 0.000 0.968 0.024 0.008
#> GSM182779     3  0.6326     0.2654 0.000 0.376 0.556 0.068
#> GSM182780     3  0.2282     0.7244 0.000 0.052 0.924 0.024
#> GSM182781     3  0.0592     0.7368 0.000 0.000 0.984 0.016
#> GSM182782     2  0.1151     0.7979 0.000 0.968 0.024 0.008
#> GSM182783     3  0.0188     0.7364 0.000 0.004 0.996 0.000
#> GSM182784     3  0.0000     0.7357 0.000 0.000 1.000 0.000
#> GSM182785     3  0.2739     0.7185 0.000 0.036 0.904 0.060
#> GSM182786     2  0.1151     0.7979 0.000 0.968 0.024 0.008
#> GSM182787     2  0.5535     0.1159 0.000 0.560 0.420 0.020
#> GSM182788     2  0.1151     0.7979 0.000 0.968 0.024 0.008
#> GSM182789     3  0.1109     0.7340 0.000 0.028 0.968 0.004
#> GSM182790     3  0.1557     0.7129 0.000 0.000 0.944 0.056
#> GSM182791     3  0.4933     0.0482 0.000 0.000 0.568 0.432
#> GSM182792     3  0.5285    -0.1034 0.008 0.000 0.524 0.468
#> GSM182793     2  0.4655     0.7260 0.000 0.684 0.004 0.312
#> GSM182794     3  0.1474     0.7124 0.000 0.000 0.948 0.052
#> GSM182795     3  0.0707     0.7284 0.000 0.000 0.980 0.020
#> GSM182796     2  0.1820     0.7929 0.000 0.944 0.020 0.036
#> GSM182797     1  0.4522     0.4052 0.728 0.004 0.004 0.264
#> GSM182798     2  0.5446     0.7471 0.000 0.680 0.044 0.276
#> GSM182799     4  0.5881     0.2588 0.036 0.000 0.420 0.544
#> GSM182800     4  0.6843     0.4691 0.356 0.000 0.112 0.532
#> GSM182801     4  0.7375     0.4445 0.404 0.004 0.140 0.452
#> GSM182814     1  0.1022     0.8479 0.968 0.000 0.000 0.032
#> GSM182815     4  0.5464     0.1180 0.344 0.020 0.004 0.632
#> GSM182816     1  0.1118     0.8479 0.964 0.000 0.000 0.036
#> GSM182817     4  0.7841     0.1484 0.244 0.028 0.184 0.544
#> GSM182818     1  0.4679     0.5004 0.648 0.000 0.000 0.352
#> GSM182819     1  0.1118     0.8479 0.964 0.000 0.000 0.036
#> GSM182820     1  0.1489     0.8334 0.952 0.004 0.000 0.044
#> GSM182821     3  0.3356     0.6333 0.000 0.000 0.824 0.176
#> GSM182822     1  0.4193     0.6307 0.732 0.000 0.000 0.268
#> GSM182823     1  0.0000     0.8455 1.000 0.000 0.000 0.000
#> GSM182824     1  0.0000     0.8455 1.000 0.000 0.000 0.000
#> GSM182825     1  0.2345     0.8209 0.900 0.000 0.000 0.100

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>           class entropy silhouette    p1    p2    p3    p4    p5
#> GSM182755     5  0.8037   -0.00345 0.316 0.000 0.256 0.088 0.340
#> GSM182756     5  0.3053    0.75975 0.000 0.000 0.164 0.008 0.828
#> GSM182757     5  0.3932    0.62456 0.000 0.140 0.000 0.064 0.796
#> GSM182758     5  0.2773    0.75868 0.000 0.000 0.164 0.000 0.836
#> GSM182759     2  0.5908    0.39405 0.000 0.512 0.000 0.108 0.380
#> GSM182760     5  0.3366    0.70767 0.000 0.000 0.232 0.000 0.768
#> GSM182761     5  0.3958    0.59829 0.000 0.184 0.000 0.040 0.776
#> GSM182762     5  0.2124    0.71739 0.000 0.000 0.004 0.096 0.900
#> GSM182763     5  0.2550    0.70759 0.000 0.020 0.004 0.084 0.892
#> GSM182764     5  0.4624    0.56728 0.000 0.164 0.000 0.096 0.740
#> GSM182765     5  0.2720    0.70885 0.000 0.004 0.020 0.096 0.880
#> GSM182766     2  0.4195    0.68840 0.000 0.796 0.008 0.092 0.104
#> GSM182767     5  0.3366    0.70767 0.000 0.000 0.232 0.000 0.768
#> GSM182768     3  0.2959    0.83775 0.008 0.000 0.864 0.016 0.112
#> GSM182769     3  0.2144    0.82614 0.068 0.000 0.912 0.000 0.020
#> GSM182770     2  0.4040    0.60308 0.000 0.724 0.016 0.260 0.000
#> GSM182771     4  0.7401   -0.41967 0.000 0.332 0.032 0.384 0.252
#> GSM182772     2  0.4194    0.60350 0.000 0.720 0.016 0.260 0.004
#> GSM182773     3  0.2732    0.81158 0.000 0.000 0.840 0.000 0.160
#> GSM182774     3  0.4821    0.67947 0.096 0.000 0.764 0.112 0.028
#> GSM182775     3  0.2388    0.84428 0.028 0.000 0.900 0.000 0.072
#> GSM182776     3  0.4021    0.71472 0.148 0.000 0.800 0.036 0.016
#> GSM182777     3  0.2563    0.83309 0.008 0.000 0.872 0.000 0.120
#> GSM182802     4  0.4585   -0.13272 0.000 0.396 0.008 0.592 0.004
#> GSM182803     1  0.3454    0.75472 0.816 0.000 0.028 0.156 0.000
#> GSM182804     4  0.4320    0.51467 0.096 0.004 0.120 0.780 0.000
#> GSM182805     4  0.4449   -0.11727 0.000 0.388 0.004 0.604 0.004
#> GSM182806     1  0.2171    0.77312 0.912 0.000 0.064 0.024 0.000
#> GSM182807     1  0.2171    0.77312 0.912 0.000 0.064 0.024 0.000
#> GSM182808     1  0.2079    0.77259 0.916 0.000 0.064 0.020 0.000
#> GSM182809     4  0.4928    0.05036 0.020 0.000 0.428 0.548 0.004
#> GSM182810     1  0.4615    0.63042 0.700 0.000 0.048 0.252 0.000
#> GSM182811     4  0.5736   -0.05697 0.400 0.000 0.088 0.512 0.000
#> GSM182812     1  0.3772    0.72743 0.792 0.000 0.036 0.172 0.000
#> GSM182813     1  0.2079    0.77259 0.916 0.000 0.064 0.020 0.000
#> GSM182778     2  0.0771    0.70905 0.000 0.976 0.004 0.000 0.020
#> GSM182779     5  0.4355    0.58426 0.000 0.164 0.000 0.076 0.760
#> GSM182780     5  0.2367    0.76531 0.000 0.004 0.072 0.020 0.904
#> GSM182781     5  0.3280    0.75650 0.000 0.000 0.176 0.012 0.812
#> GSM182782     2  0.0771    0.70905 0.000 0.976 0.004 0.000 0.020
#> GSM182783     5  0.2732    0.76021 0.000 0.000 0.160 0.000 0.840
#> GSM182784     5  0.2773    0.75868 0.000 0.000 0.164 0.000 0.836
#> GSM182785     5  0.0671    0.74811 0.000 0.000 0.004 0.016 0.980
#> GSM182786     2  0.0771    0.70905 0.000 0.976 0.004 0.000 0.020
#> GSM182787     5  0.4339    0.50652 0.000 0.296 0.000 0.020 0.684
#> GSM182788     2  0.0771    0.70905 0.000 0.976 0.004 0.000 0.020
#> GSM182789     5  0.2074    0.76768 0.000 0.000 0.104 0.000 0.896
#> GSM182790     5  0.3689    0.68371 0.000 0.000 0.256 0.004 0.740
#> GSM182791     3  0.3183    0.80951 0.000 0.000 0.828 0.016 0.156
#> GSM182792     3  0.2536    0.83075 0.000 0.000 0.868 0.004 0.128
#> GSM182793     2  0.5300    0.39236 0.000 0.528 0.028 0.432 0.012
#> GSM182794     5  0.3534    0.68317 0.000 0.000 0.256 0.000 0.744
#> GSM182795     5  0.2813    0.75682 0.000 0.000 0.168 0.000 0.832
#> GSM182796     2  0.4535    0.63306 0.000 0.748 0.000 0.092 0.160
#> GSM182797     1  0.4702    0.12937 0.552 0.000 0.432 0.016 0.000
#> GSM182798     2  0.7103    0.43162 0.000 0.432 0.024 0.340 0.204
#> GSM182799     3  0.3392    0.82529 0.008 0.000 0.852 0.060 0.080
#> GSM182800     3  0.3748    0.75915 0.100 0.000 0.832 0.052 0.016
#> GSM182801     3  0.3124    0.77508 0.136 0.000 0.844 0.004 0.016
#> GSM182814     1  0.2653    0.78322 0.880 0.000 0.024 0.096 0.000
#> GSM182815     4  0.4320    0.51467 0.096 0.004 0.120 0.780 0.000
#> GSM182816     1  0.2707    0.78206 0.876 0.000 0.024 0.100 0.000
#> GSM182817     4  0.3640    0.41628 0.040 0.000 0.028 0.844 0.088
#> GSM182818     4  0.6270   -0.09998 0.404 0.008 0.116 0.472 0.000
#> GSM182819     1  0.2653    0.78374 0.880 0.000 0.024 0.096 0.000
#> GSM182820     1  0.2171    0.77312 0.912 0.000 0.064 0.024 0.000
#> GSM182821     5  0.6234    0.44972 0.000 0.000 0.176 0.296 0.528
#> GSM182822     1  0.5708    0.25793 0.504 0.000 0.084 0.412 0.000
#> GSM182823     1  0.0404    0.78565 0.988 0.000 0.000 0.012 0.000
#> GSM182824     1  0.1216    0.78929 0.960 0.000 0.020 0.020 0.000
#> GSM182825     1  0.3885    0.72057 0.784 0.000 0.040 0.176 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
#> GSM182755     1  0.7933     0.0247 0.372 0.000 0.136 0.032 0.200 0.260
#> GSM182756     3  0.5011     0.7994 0.000 0.000 0.508 0.000 0.420 0.072
#> GSM182757     5  0.1812     0.6727 0.000 0.008 0.080 0.000 0.912 0.000
#> GSM182758     3  0.5176     0.8069 0.000 0.000 0.508 0.004 0.412 0.076
#> GSM182759     5  0.3465     0.4530 0.000 0.132 0.048 0.008 0.812 0.000
#> GSM182760     3  0.5418     0.7963 0.000 0.000 0.508 0.000 0.368 0.124
#> GSM182761     5  0.2833     0.5928 0.000 0.012 0.148 0.000 0.836 0.004
#> GSM182762     5  0.2500     0.6330 0.000 0.000 0.116 0.012 0.868 0.004
#> GSM182763     5  0.2234     0.6371 0.000 0.000 0.124 0.004 0.872 0.000
#> GSM182764     5  0.1149     0.6483 0.000 0.008 0.024 0.008 0.960 0.000
#> GSM182765     5  0.2596     0.6375 0.000 0.004 0.104 0.016 0.872 0.004
#> GSM182766     2  0.4216     0.5746 0.000 0.676 0.032 0.004 0.288 0.000
#> GSM182767     3  0.5557     0.7888 0.000 0.000 0.512 0.004 0.356 0.128
#> GSM182768     6  0.2182     0.8618 0.000 0.000 0.068 0.020 0.008 0.904
#> GSM182769     6  0.0622     0.8653 0.012 0.000 0.008 0.000 0.000 0.980
#> GSM182770     2  0.0146     0.5868 0.000 0.996 0.000 0.000 0.004 0.000
#> GSM182771     2  0.5159     0.3859 0.000 0.532 0.008 0.068 0.392 0.000
#> GSM182772     2  0.0363     0.5873 0.000 0.988 0.000 0.000 0.012 0.000
#> GSM182773     6  0.2837     0.8203 0.004 0.000 0.144 0.004 0.008 0.840
#> GSM182774     6  0.3840     0.7365 0.020 0.000 0.028 0.152 0.008 0.792
#> GSM182775     6  0.0909     0.8662 0.012 0.000 0.020 0.000 0.000 0.968
#> GSM182776     6  0.2303     0.8088 0.024 0.000 0.020 0.052 0.000 0.904
#> GSM182777     6  0.2009     0.8463 0.008 0.000 0.084 0.004 0.000 0.904
#> GSM182802     2  0.3935     0.3434 0.000 0.692 0.012 0.288 0.008 0.000
#> GSM182803     1  0.5341     0.4347 0.580 0.000 0.108 0.304 0.000 0.008
#> GSM182804     4  0.5474     0.5948 0.052 0.140 0.040 0.704 0.000 0.064
#> GSM182805     2  0.3991     0.3278 0.000 0.680 0.012 0.300 0.008 0.000
#> GSM182806     1  0.1913     0.5568 0.908 0.000 0.000 0.012 0.000 0.080
#> GSM182807     1  0.1913     0.5568 0.908 0.000 0.000 0.012 0.000 0.080
#> GSM182808     1  0.1501     0.5614 0.924 0.000 0.000 0.000 0.000 0.076
#> GSM182809     4  0.4761     0.3919 0.016 0.016 0.016 0.632 0.000 0.320
#> GSM182810     1  0.6040     0.1094 0.420 0.000 0.140 0.420 0.000 0.020
#> GSM182811     4  0.4576     0.4496 0.264 0.000 0.044 0.676 0.000 0.016
#> GSM182812     1  0.5673     0.4777 0.572 0.000 0.164 0.252 0.000 0.012
#> GSM182813     1  0.1501     0.5614 0.924 0.000 0.000 0.000 0.000 0.076
#> GSM182778     2  0.6762     0.5607 0.000 0.516 0.240 0.140 0.100 0.004
#> GSM182779     5  0.0806     0.6680 0.000 0.008 0.020 0.000 0.972 0.000
#> GSM182780     5  0.4282    -0.4519 0.000 0.000 0.420 0.000 0.560 0.020
#> GSM182781     3  0.5224     0.7700 0.000 0.000 0.468 0.000 0.440 0.092
#> GSM182782     2  0.6762     0.5607 0.000 0.516 0.240 0.140 0.100 0.004
#> GSM182783     3  0.5061     0.7988 0.000 0.000 0.496 0.000 0.428 0.076
#> GSM182784     3  0.5015     0.8009 0.000 0.000 0.504 0.000 0.424 0.072
#> GSM182785     5  0.3830    -0.1633 0.000 0.000 0.376 0.000 0.620 0.004
#> GSM182786     2  0.6762     0.5607 0.000 0.516 0.240 0.140 0.100 0.004
#> GSM182787     5  0.4403     0.4485 0.000 0.100 0.172 0.000 0.724 0.004
#> GSM182788     2  0.6762     0.5607 0.000 0.516 0.240 0.140 0.100 0.004
#> GSM182789     3  0.4834     0.7050 0.000 0.000 0.484 0.004 0.468 0.044
#> GSM182790     3  0.5828     0.7344 0.000 0.000 0.480 0.004 0.344 0.172
#> GSM182791     6  0.3800     0.7901 0.000 0.000 0.168 0.048 0.008 0.776
#> GSM182792     6  0.2262     0.8590 0.000 0.000 0.080 0.016 0.008 0.896
#> GSM182793     2  0.4102     0.4978 0.000 0.776 0.036 0.152 0.032 0.004
#> GSM182794     3  0.5797     0.7415 0.000 0.000 0.488 0.004 0.340 0.168
#> GSM182795     3  0.5188     0.8018 0.000 0.000 0.496 0.004 0.424 0.076
#> GSM182796     2  0.6311     0.4715 0.000 0.448 0.076 0.084 0.392 0.000
#> GSM182797     1  0.4184     0.0379 0.556 0.000 0.008 0.004 0.000 0.432
#> GSM182798     2  0.4669     0.4467 0.000 0.592 0.008 0.036 0.364 0.000
#> GSM182799     6  0.3314     0.8323 0.000 0.000 0.092 0.076 0.004 0.828
#> GSM182800     6  0.3167     0.8152 0.028 0.000 0.040 0.080 0.000 0.852
#> GSM182801     6  0.0891     0.8537 0.024 0.000 0.000 0.008 0.000 0.968
#> GSM182814     1  0.5104     0.5606 0.656 0.000 0.164 0.172 0.000 0.008
#> GSM182815     4  0.5075     0.6057 0.056 0.144 0.016 0.724 0.000 0.060
#> GSM182816     1  0.5253     0.5549 0.644 0.000 0.160 0.184 0.000 0.012
#> GSM182817     4  0.5856     0.3677 0.028 0.160 0.008 0.612 0.192 0.000
#> GSM182818     4  0.5464     0.4652 0.312 0.004 0.044 0.592 0.000 0.048
#> GSM182819     1  0.5102     0.5583 0.656 0.000 0.160 0.176 0.000 0.008
#> GSM182820     1  0.1913     0.5568 0.908 0.000 0.000 0.012 0.000 0.080
#> GSM182821     3  0.6905     0.2319 0.000 0.000 0.376 0.372 0.176 0.076
#> GSM182822     4  0.5092     0.3031 0.356 0.000 0.044 0.576 0.000 0.024
#> GSM182823     1  0.3821     0.5836 0.772 0.000 0.148 0.080 0.000 0.000
#> GSM182824     1  0.4615     0.5802 0.712 0.000 0.164 0.116 0.000 0.008
#> GSM182825     1  0.5673     0.4768 0.572 0.000 0.164 0.252 0.000 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-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 stress(p) development.stage(p) k
#> MAD:kmeans 70     0.632             3.64e-05 2
#> MAD:kmeans 68     0.991             1.77e-08 3
#> MAD:kmeans 50     0.473             1.79e-08 4
#> MAD:kmeans 57     0.930             1.24e-11 5
#> MAD:kmeans 49     0.386             2.22e-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.


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

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

collect_plots(res)

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.989       0.995         0.5072 0.493   0.493
#> 3 3 0.860           0.846       0.938         0.3091 0.758   0.546
#> 4 4 0.711           0.731       0.860         0.1181 0.874   0.655
#> 5 5 0.660           0.647       0.792         0.0579 0.950   0.822
#> 6 6 0.658           0.536       0.753         0.0376 0.961   0.842

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

suggest_best_k(res)
#> [1] 2

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

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

show/hide code output

cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#>           class entropy silhouette    p1    p2
#> GSM182755     1  0.0672      0.982 0.992 0.008
#> GSM182756     2  0.0000      1.000 0.000 1.000
#> GSM182757     2  0.0000      1.000 0.000 1.000
#> GSM182758     2  0.0000      1.000 0.000 1.000
#> GSM182759     2  0.0000      1.000 0.000 1.000
#> GSM182760     2  0.0000      1.000 0.000 1.000
#> GSM182761     2  0.0000      1.000 0.000 1.000
#> GSM182762     2  0.0000      1.000 0.000 1.000
#> GSM182763     2  0.0000      1.000 0.000 1.000
#> GSM182764     2  0.0000      1.000 0.000 1.000
#> GSM182765     2  0.0000      1.000 0.000 1.000
#> GSM182766     2  0.0000      1.000 0.000 1.000
#> GSM182767     2  0.0000      1.000 0.000 1.000
#> GSM182768     1  0.0000      0.989 1.000 0.000
#> GSM182769     1  0.0000      0.989 1.000 0.000
#> GSM182770     2  0.0000      1.000 0.000 1.000
#> GSM182771     2  0.0000      1.000 0.000 1.000
#> GSM182772     2  0.0000      1.000 0.000 1.000
#> GSM182773     1  0.0000      0.989 1.000 0.000
#> GSM182774     1  0.0000      0.989 1.000 0.000
#> GSM182775     1  0.0000      0.989 1.000 0.000
#> GSM182776     1  0.0000      0.989 1.000 0.000
#> GSM182777     1  0.0000      0.989 1.000 0.000
#> GSM182802     2  0.0000      1.000 0.000 1.000
#> GSM182803     1  0.0000      0.989 1.000 0.000
#> GSM182804     1  0.0000      0.989 1.000 0.000
#> GSM182805     2  0.0000      1.000 0.000 1.000
#> GSM182806     1  0.0000      0.989 1.000 0.000
#> GSM182807     1  0.0000      0.989 1.000 0.000
#> GSM182808     1  0.0000      0.989 1.000 0.000
#> GSM182809     1  0.0000      0.989 1.000 0.000
#> GSM182810     1  0.0000      0.989 1.000 0.000
#> GSM182811     1  0.0000      0.989 1.000 0.000
#> GSM182812     1  0.0000      0.989 1.000 0.000
#> GSM182813     1  0.0000      0.989 1.000 0.000
#> GSM182778     2  0.0000      1.000 0.000 1.000
#> GSM182779     2  0.0000      1.000 0.000 1.000
#> GSM182780     2  0.0000      1.000 0.000 1.000
#> GSM182781     2  0.0000      1.000 0.000 1.000
#> GSM182782     2  0.0000      1.000 0.000 1.000
#> GSM182783     2  0.0000      1.000 0.000 1.000
#> GSM182784     2  0.0000      1.000 0.000 1.000
#> GSM182785     2  0.0000      1.000 0.000 1.000
#> GSM182786     2  0.0000      1.000 0.000 1.000
#> GSM182787     2  0.0000      1.000 0.000 1.000
#> GSM182788     2  0.0000      1.000 0.000 1.000
#> GSM182789     2  0.0000      1.000 0.000 1.000
#> GSM182790     2  0.0000      1.000 0.000 1.000
#> GSM182791     1  0.4431      0.896 0.908 0.092
#> GSM182792     1  0.0000      0.989 1.000 0.000
#> GSM182793     2  0.0000      1.000 0.000 1.000
#> GSM182794     2  0.0000      1.000 0.000 1.000
#> GSM182795     2  0.0000      1.000 0.000 1.000
#> GSM182796     2  0.0000      1.000 0.000 1.000
#> GSM182797     1  0.0000      0.989 1.000 0.000
#> GSM182798     2  0.0000      1.000 0.000 1.000
#> GSM182799     1  0.0000      0.989 1.000 0.000
#> GSM182800     1  0.0000      0.989 1.000 0.000
#> GSM182801     1  0.0000      0.989 1.000 0.000
#> GSM182814     1  0.0000      0.989 1.000 0.000
#> GSM182815     1  0.0000      0.989 1.000 0.000
#> GSM182816     1  0.0000      0.989 1.000 0.000
#> GSM182817     1  0.8207      0.659 0.744 0.256
#> GSM182818     1  0.0000      0.989 1.000 0.000
#> GSM182819     1  0.0000      0.989 1.000 0.000
#> GSM182820     1  0.0000      0.989 1.000 0.000
#> GSM182821     2  0.0000      1.000 0.000 1.000
#> GSM182822     1  0.0000      0.989 1.000 0.000
#> GSM182823     1  0.0000      0.989 1.000 0.000
#> GSM182824     1  0.0000      0.989 1.000 0.000
#> GSM182825     1  0.0000      0.989 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
#> GSM182755     1  0.5591      0.524 0.696 0.000 0.304
#> GSM182756     3  0.0000      0.850 0.000 0.000 1.000
#> GSM182757     2  0.1643      0.931 0.000 0.956 0.044
#> GSM182758     3  0.0000      0.850 0.000 0.000 1.000
#> GSM182759     2  0.0237      0.960 0.000 0.996 0.004
#> GSM182760     3  0.0000      0.850 0.000 0.000 1.000
#> GSM182761     2  0.1411      0.937 0.000 0.964 0.036
#> GSM182762     2  0.2165      0.912 0.000 0.936 0.064
#> GSM182763     2  0.0237      0.960 0.000 0.996 0.004
#> GSM182764     2  0.0237      0.960 0.000 0.996 0.004
#> GSM182765     2  0.0592      0.955 0.000 0.988 0.012
#> GSM182766     2  0.0237      0.960 0.000 0.996 0.004
#> GSM182767     3  0.0000      0.850 0.000 0.000 1.000
#> GSM182768     3  0.6111      0.335 0.396 0.000 0.604
#> GSM182769     1  0.5529      0.546 0.704 0.000 0.296
#> GSM182770     2  0.0000      0.959 0.000 1.000 0.000
#> GSM182771     2  0.0000      0.959 0.000 1.000 0.000
#> GSM182772     2  0.0000      0.959 0.000 1.000 0.000
#> GSM182773     3  0.0424      0.848 0.008 0.000 0.992
#> GSM182774     1  0.0000      0.952 1.000 0.000 0.000
#> GSM182775     1  0.6252      0.152 0.556 0.000 0.444
#> GSM182776     1  0.0000      0.952 1.000 0.000 0.000
#> GSM182777     3  0.1411      0.835 0.036 0.000 0.964
#> GSM182802     2  0.0000      0.959 0.000 1.000 0.000
#> GSM182803     1  0.0000      0.952 1.000 0.000 0.000
#> GSM182804     1  0.0237      0.950 0.996 0.004 0.000
#> GSM182805     2  0.0000      0.959 0.000 1.000 0.000
#> GSM182806     1  0.0000      0.952 1.000 0.000 0.000
#> GSM182807     1  0.0000      0.952 1.000 0.000 0.000
#> GSM182808     1  0.0000      0.952 1.000 0.000 0.000
#> GSM182809     1  0.0000      0.952 1.000 0.000 0.000
#> GSM182810     1  0.0000      0.952 1.000 0.000 0.000
#> GSM182811     1  0.0237      0.950 0.996 0.004 0.000
#> GSM182812     1  0.0000      0.952 1.000 0.000 0.000
#> GSM182813     1  0.0000      0.952 1.000 0.000 0.000
#> GSM182778     2  0.0237      0.960 0.000 0.996 0.004
#> GSM182779     2  0.0424      0.958 0.000 0.992 0.008
#> GSM182780     2  0.3816      0.805 0.000 0.852 0.148
#> GSM182781     3  0.0000      0.850 0.000 0.000 1.000
#> GSM182782     2  0.0237      0.960 0.000 0.996 0.004
#> GSM182783     3  0.3267      0.772 0.000 0.116 0.884
#> GSM182784     3  0.0000      0.850 0.000 0.000 1.000
#> GSM182785     3  0.6204      0.255 0.000 0.424 0.576
#> GSM182786     2  0.0237      0.960 0.000 0.996 0.004
#> GSM182787     2  0.0237      0.960 0.000 0.996 0.004
#> GSM182788     2  0.0237      0.960 0.000 0.996 0.004
#> GSM182789     3  0.5835      0.461 0.000 0.340 0.660
#> GSM182790     3  0.0000      0.850 0.000 0.000 1.000
#> GSM182791     3  0.2066      0.819 0.060 0.000 0.940
#> GSM182792     3  0.5363      0.574 0.276 0.000 0.724
#> GSM182793     2  0.0000      0.959 0.000 1.000 0.000
#> GSM182794     3  0.0000      0.850 0.000 0.000 1.000
#> GSM182795     3  0.0000      0.850 0.000 0.000 1.000
#> GSM182796     2  0.0000      0.959 0.000 1.000 0.000
#> GSM182797     1  0.0237      0.949 0.996 0.000 0.004
#> GSM182798     2  0.0000      0.959 0.000 1.000 0.000
#> GSM182799     3  0.6045      0.374 0.380 0.000 0.620
#> GSM182800     1  0.0424      0.946 0.992 0.000 0.008
#> GSM182801     1  0.2448      0.880 0.924 0.000 0.076
#> GSM182814     1  0.0000      0.952 1.000 0.000 0.000
#> GSM182815     1  0.0424      0.946 0.992 0.008 0.000
#> GSM182816     1  0.0000      0.952 1.000 0.000 0.000
#> GSM182817     2  0.6274      0.154 0.456 0.544 0.000
#> GSM182818     1  0.0000      0.952 1.000 0.000 0.000
#> GSM182819     1  0.0000      0.952 1.000 0.000 0.000
#> GSM182820     1  0.0000      0.952 1.000 0.000 0.000
#> GSM182821     3  0.6235      0.275 0.000 0.436 0.564
#> GSM182822     1  0.0000      0.952 1.000 0.000 0.000
#> GSM182823     1  0.0000      0.952 1.000 0.000 0.000
#> GSM182824     1  0.0000      0.952 1.000 0.000 0.000
#> GSM182825     1  0.0000      0.952 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
#> GSM182755     1  0.7337     0.1519 0.524 0.000 0.272 0.204
#> GSM182756     3  0.0524     0.8802 0.000 0.004 0.988 0.008
#> GSM182757     2  0.4994     0.1865 0.000 0.520 0.480 0.000
#> GSM182758     3  0.0336     0.8802 0.000 0.000 0.992 0.008
#> GSM182759     2  0.1211     0.8591 0.000 0.960 0.040 0.000
#> GSM182760     3  0.2216     0.8312 0.000 0.000 0.908 0.092
#> GSM182761     2  0.4948     0.2998 0.000 0.560 0.440 0.000
#> GSM182762     3  0.4964     0.2420 0.004 0.380 0.616 0.000
#> GSM182763     2  0.2149     0.8442 0.000 0.912 0.088 0.000
#> GSM182764     2  0.2868     0.8153 0.000 0.864 0.136 0.000
#> GSM182765     2  0.2408     0.8375 0.000 0.896 0.104 0.000
#> GSM182766     2  0.1109     0.8607 0.000 0.968 0.028 0.004
#> GSM182767     3  0.1557     0.8572 0.000 0.000 0.944 0.056
#> GSM182768     4  0.3486     0.8129 0.044 0.000 0.092 0.864
#> GSM182769     4  0.4635     0.7668 0.216 0.000 0.028 0.756
#> GSM182770     2  0.1118     0.8465 0.000 0.964 0.000 0.036
#> GSM182771     2  0.1059     0.8537 0.000 0.972 0.012 0.016
#> GSM182772     2  0.1022     0.8478 0.000 0.968 0.000 0.032
#> GSM182773     4  0.4543     0.6267 0.000 0.000 0.324 0.676
#> GSM182774     1  0.2921     0.7366 0.860 0.000 0.000 0.140
#> GSM182775     4  0.4920     0.7894 0.192 0.000 0.052 0.756
#> GSM182776     1  0.4866     0.1950 0.596 0.000 0.000 0.404
#> GSM182777     4  0.6110     0.7265 0.100 0.000 0.240 0.660
#> GSM182802     2  0.2704     0.7973 0.000 0.876 0.000 0.124
#> GSM182803     1  0.0469     0.8359 0.988 0.000 0.000 0.012
#> GSM182804     1  0.5492     0.5487 0.640 0.032 0.000 0.328
#> GSM182805     2  0.2704     0.7973 0.000 0.876 0.000 0.124
#> GSM182806     1  0.1022     0.8296 0.968 0.000 0.000 0.032
#> GSM182807     1  0.1118     0.8281 0.964 0.000 0.000 0.036
#> GSM182808     1  0.1211     0.8262 0.960 0.000 0.000 0.040
#> GSM182809     1  0.5587     0.4826 0.600 0.028 0.000 0.372
#> GSM182810     1  0.0469     0.8342 0.988 0.000 0.000 0.012
#> GSM182811     1  0.1792     0.8083 0.932 0.000 0.000 0.068
#> GSM182812     1  0.0188     0.8358 0.996 0.000 0.000 0.004
#> GSM182813     1  0.1302     0.8241 0.956 0.000 0.000 0.044
#> GSM182778     2  0.1004     0.8605 0.000 0.972 0.024 0.004
#> GSM182779     2  0.2921     0.8085 0.000 0.860 0.140 0.000
#> GSM182780     2  0.5360     0.2656 0.000 0.552 0.436 0.012
#> GSM182781     3  0.0188     0.8797 0.000 0.000 0.996 0.004
#> GSM182782     2  0.0921     0.8608 0.000 0.972 0.028 0.000
#> GSM182783     3  0.2334     0.8389 0.000 0.088 0.908 0.004
#> GSM182784     3  0.0336     0.8802 0.000 0.000 0.992 0.008
#> GSM182785     3  0.2589     0.8039 0.000 0.116 0.884 0.000
#> GSM182786     2  0.0921     0.8608 0.000 0.972 0.028 0.000
#> GSM182787     2  0.1661     0.8571 0.000 0.944 0.052 0.004
#> GSM182788     2  0.0921     0.8608 0.000 0.972 0.028 0.000
#> GSM182789     3  0.2408     0.8251 0.000 0.104 0.896 0.000
#> GSM182790     3  0.2011     0.8409 0.000 0.000 0.920 0.080
#> GSM182791     4  0.3764     0.7313 0.000 0.000 0.216 0.784
#> GSM182792     4  0.3760     0.8039 0.028 0.000 0.136 0.836
#> GSM182793     2  0.2345     0.8159 0.000 0.900 0.000 0.100
#> GSM182794     3  0.2704     0.7914 0.000 0.000 0.876 0.124
#> GSM182795     3  0.0937     0.8793 0.000 0.012 0.976 0.012
#> GSM182796     2  0.1022     0.8602 0.000 0.968 0.032 0.000
#> GSM182797     1  0.5000    -0.1566 0.504 0.000 0.000 0.496
#> GSM182798     2  0.1059     0.8537 0.000 0.972 0.012 0.016
#> GSM182799     4  0.2660     0.7916 0.036 0.000 0.056 0.908
#> GSM182800     4  0.3873     0.7378 0.228 0.000 0.000 0.772
#> GSM182801     4  0.3870     0.7678 0.208 0.000 0.004 0.788
#> GSM182814     1  0.0000     0.8361 1.000 0.000 0.000 0.000
#> GSM182815     1  0.6106     0.5044 0.604 0.064 0.000 0.332
#> GSM182816     1  0.0188     0.8362 0.996 0.000 0.000 0.004
#> GSM182817     1  0.6011     0.6019 0.700 0.172 0.004 0.124
#> GSM182818     1  0.2760     0.7703 0.872 0.000 0.000 0.128
#> GSM182819     1  0.0188     0.8362 0.996 0.000 0.000 0.004
#> GSM182820     1  0.1118     0.8281 0.964 0.000 0.000 0.036
#> GSM182821     2  0.8337     0.0587 0.036 0.408 0.384 0.172
#> GSM182822     1  0.0592     0.8329 0.984 0.000 0.000 0.016
#> GSM182823     1  0.0188     0.8362 0.996 0.000 0.000 0.004
#> GSM182824     1  0.0188     0.8362 0.996 0.000 0.000 0.004
#> GSM182825     1  0.0336     0.8359 0.992 0.000 0.000 0.008

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>           class entropy silhouette    p1    p2    p3    p4    p5
#> GSM182755     1  0.7783     0.2441 0.516 0.020 0.096 0.236 0.132
#> GSM182756     3  0.2313     0.8555 0.000 0.012 0.916 0.032 0.040
#> GSM182757     2  0.6039     0.4894 0.000 0.580 0.288 0.124 0.008
#> GSM182758     3  0.2072     0.8580 0.000 0.036 0.928 0.020 0.016
#> GSM182759     2  0.1768     0.7446 0.000 0.924 0.004 0.072 0.000
#> GSM182760     3  0.3284     0.8082 0.000 0.000 0.828 0.024 0.148
#> GSM182761     2  0.5045     0.4780 0.000 0.636 0.308 0.056 0.000
#> GSM182762     2  0.7033     0.3529 0.000 0.440 0.304 0.240 0.016
#> GSM182763     2  0.2676     0.7423 0.000 0.884 0.036 0.080 0.000
#> GSM182764     2  0.4548     0.6844 0.000 0.752 0.076 0.168 0.004
#> GSM182765     2  0.5358     0.6528 0.000 0.680 0.088 0.220 0.012
#> GSM182766     2  0.1043     0.7448 0.000 0.960 0.000 0.040 0.000
#> GSM182767     3  0.2880     0.8311 0.000 0.004 0.868 0.020 0.108
#> GSM182768     5  0.1661     0.7860 0.000 0.000 0.036 0.024 0.940
#> GSM182769     5  0.3694     0.7616 0.140 0.000 0.020 0.020 0.820
#> GSM182770     2  0.3480     0.6450 0.000 0.752 0.000 0.248 0.000
#> GSM182771     2  0.4834     0.6519 0.000 0.656 0.028 0.308 0.008
#> GSM182772     2  0.3452     0.6476 0.000 0.756 0.000 0.244 0.000
#> GSM182773     5  0.3496     0.7112 0.000 0.000 0.200 0.012 0.788
#> GSM182774     1  0.4657     0.5814 0.752 0.000 0.004 0.128 0.116
#> GSM182775     5  0.4154     0.7821 0.092 0.000 0.048 0.044 0.816
#> GSM182776     1  0.5627     0.2699 0.548 0.000 0.000 0.084 0.368
#> GSM182777     5  0.5490     0.7360 0.064 0.000 0.140 0.076 0.720
#> GSM182802     2  0.4430     0.3707 0.000 0.540 0.000 0.456 0.004
#> GSM182803     1  0.0609     0.7638 0.980 0.000 0.000 0.020 0.000
#> GSM182804     4  0.6531     0.5017 0.360 0.012 0.000 0.484 0.144
#> GSM182805     2  0.4219     0.4280 0.000 0.584 0.000 0.416 0.000
#> GSM182806     1  0.2248     0.7436 0.900 0.000 0.000 0.088 0.012
#> GSM182807     1  0.2189     0.7446 0.904 0.000 0.000 0.084 0.012
#> GSM182808     1  0.2293     0.7431 0.900 0.000 0.000 0.084 0.016
#> GSM182809     1  0.6686    -0.4965 0.420 0.004 0.000 0.376 0.200
#> GSM182810     1  0.1430     0.7429 0.944 0.000 0.000 0.052 0.004
#> GSM182811     1  0.3602     0.5549 0.796 0.000 0.000 0.180 0.024
#> GSM182812     1  0.1282     0.7466 0.952 0.000 0.000 0.044 0.004
#> GSM182813     1  0.2540     0.7360 0.888 0.000 0.000 0.088 0.024
#> GSM182778     2  0.0324     0.7455 0.000 0.992 0.004 0.004 0.000
#> GSM182779     2  0.3439     0.7238 0.000 0.844 0.092 0.060 0.004
#> GSM182780     2  0.5033     0.2518 0.000 0.568 0.400 0.028 0.004
#> GSM182781     3  0.3336     0.8141 0.004 0.004 0.856 0.088 0.048
#> GSM182782     2  0.0162     0.7461 0.000 0.996 0.004 0.000 0.000
#> GSM182783     3  0.3706     0.7480 0.000 0.180 0.796 0.012 0.012
#> GSM182784     3  0.1808     0.8521 0.000 0.040 0.936 0.020 0.004
#> GSM182785     3  0.4094     0.7592 0.000 0.128 0.788 0.084 0.000
#> GSM182786     2  0.0162     0.7461 0.000 0.996 0.004 0.000 0.000
#> GSM182787     2  0.2136     0.7260 0.000 0.904 0.088 0.008 0.000
#> GSM182788     2  0.0162     0.7461 0.000 0.996 0.004 0.000 0.000
#> GSM182789     3  0.3565     0.7902 0.000 0.144 0.816 0.040 0.000
#> GSM182790     3  0.3752     0.7988 0.000 0.004 0.812 0.044 0.140
#> GSM182791     5  0.5043     0.6529 0.000 0.000 0.160 0.136 0.704
#> GSM182792     5  0.2722     0.7863 0.008 0.000 0.060 0.040 0.892
#> GSM182793     2  0.4794     0.5367 0.000 0.624 0.000 0.344 0.032
#> GSM182794     3  0.3847     0.7571 0.000 0.000 0.784 0.036 0.180
#> GSM182795     3  0.2899     0.8486 0.000 0.056 0.888 0.032 0.024
#> GSM182796     2  0.2844     0.7388 0.000 0.876 0.028 0.092 0.004
#> GSM182797     1  0.5834     0.2775 0.544 0.000 0.000 0.108 0.348
#> GSM182798     2  0.4522     0.6901 0.000 0.720 0.032 0.240 0.008
#> GSM182799     5  0.3080     0.7218 0.004 0.000 0.020 0.124 0.852
#> GSM182800     5  0.4974     0.6140 0.212 0.000 0.000 0.092 0.696
#> GSM182801     5  0.3099     0.7668 0.132 0.000 0.008 0.012 0.848
#> GSM182814     1  0.0404     0.7616 0.988 0.000 0.000 0.012 0.000
#> GSM182815     4  0.6591     0.5220 0.364 0.024 0.000 0.492 0.120
#> GSM182816     1  0.0162     0.7633 0.996 0.000 0.000 0.004 0.000
#> GSM182817     4  0.6156     0.3784 0.412 0.072 0.016 0.496 0.004
#> GSM182818     1  0.4252     0.5128 0.764 0.000 0.000 0.172 0.064
#> GSM182819     1  0.0510     0.7632 0.984 0.000 0.000 0.016 0.000
#> GSM182820     1  0.2293     0.7431 0.900 0.000 0.000 0.084 0.016
#> GSM182821     4  0.8638     0.0261 0.040 0.304 0.264 0.324 0.068
#> GSM182822     1  0.2172     0.7195 0.908 0.000 0.000 0.076 0.016
#> GSM182823     1  0.0404     0.7646 0.988 0.000 0.000 0.012 0.000
#> GSM182824     1  0.0290     0.7626 0.992 0.000 0.000 0.008 0.000
#> GSM182825     1  0.1809     0.7344 0.928 0.000 0.000 0.060 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
#> GSM182755     1  0.7057     0.2351 0.420 0.368 0.040 0.024 0.008 0.140
#> GSM182756     3  0.3309     0.7255 0.000 0.172 0.800 0.004 0.000 0.024
#> GSM182757     5  0.5591    -0.2518 0.000 0.232 0.196 0.004 0.568 0.000
#> GSM182758     3  0.1067     0.7618 0.000 0.024 0.964 0.004 0.004 0.004
#> GSM182759     5  0.1728     0.5989 0.000 0.064 0.004 0.008 0.924 0.000
#> GSM182760     3  0.4632     0.6959 0.000 0.152 0.712 0.008 0.000 0.128
#> GSM182761     5  0.5209     0.0901 0.000 0.172 0.160 0.008 0.656 0.004
#> GSM182762     2  0.6101     0.0000 0.000 0.520 0.152 0.016 0.304 0.008
#> GSM182763     5  0.3637     0.4907 0.000 0.140 0.052 0.004 0.800 0.004
#> GSM182764     5  0.4544     0.1495 0.000 0.292 0.052 0.004 0.652 0.000
#> GSM182765     5  0.5210    -0.1057 0.000 0.380 0.044 0.020 0.552 0.004
#> GSM182766     5  0.0717     0.6224 0.000 0.016 0.000 0.008 0.976 0.000
#> GSM182767     3  0.2697     0.7543 0.000 0.068 0.876 0.008 0.000 0.048
#> GSM182768     6  0.1555     0.7642 0.000 0.008 0.012 0.040 0.000 0.940
#> GSM182769     6  0.3621     0.7147 0.140 0.044 0.008 0.004 0.000 0.804
#> GSM182770     5  0.3865     0.4776 0.000 0.032 0.000 0.248 0.720 0.000
#> GSM182771     5  0.5590     0.3200 0.000 0.232 0.000 0.220 0.548 0.000
#> GSM182772     5  0.3668     0.4946 0.000 0.028 0.000 0.228 0.744 0.000
#> GSM182773     6  0.3752     0.6875 0.000 0.052 0.168 0.004 0.000 0.776
#> GSM182774     1  0.5993     0.4940 0.624 0.116 0.000 0.120 0.000 0.140
#> GSM182775     6  0.3471     0.7553 0.040 0.076 0.040 0.004 0.000 0.840
#> GSM182776     1  0.5683     0.1636 0.496 0.096 0.000 0.020 0.000 0.388
#> GSM182777     6  0.5407     0.6604 0.040 0.164 0.120 0.004 0.000 0.672
#> GSM182802     4  0.4475     0.0959 0.000 0.032 0.000 0.556 0.412 0.000
#> GSM182803     1  0.1794     0.7804 0.924 0.036 0.000 0.040 0.000 0.000
#> GSM182804     4  0.5855     0.4474 0.208 0.100 0.000 0.628 0.008 0.056
#> GSM182805     4  0.4529    -0.0125 0.000 0.032 0.000 0.508 0.460 0.000
#> GSM182806     1  0.2468     0.7639 0.880 0.096 0.000 0.016 0.000 0.008
#> GSM182807     1  0.2418     0.7655 0.884 0.092 0.000 0.016 0.000 0.008
#> GSM182808     1  0.2367     0.7665 0.888 0.088 0.000 0.016 0.000 0.008
#> GSM182809     4  0.6023     0.3623 0.288 0.040 0.000 0.564 0.008 0.100
#> GSM182810     1  0.2501     0.7357 0.872 0.016 0.000 0.108 0.000 0.004
#> GSM182811     1  0.4047     0.5016 0.676 0.028 0.000 0.296 0.000 0.000
#> GSM182812     1  0.2113     0.7525 0.896 0.008 0.000 0.092 0.000 0.004
#> GSM182813     1  0.2878     0.7539 0.860 0.100 0.000 0.016 0.000 0.024
#> GSM182778     5  0.0000     0.6229 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM182779     5  0.4117     0.4074 0.000 0.144 0.096 0.004 0.756 0.000
#> GSM182780     5  0.5945    -0.0271 0.000 0.132 0.280 0.020 0.560 0.008
#> GSM182781     3  0.3680     0.6644 0.000 0.232 0.744 0.004 0.000 0.020
#> GSM182782     5  0.0000     0.6229 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM182783     3  0.4411     0.6488 0.000 0.088 0.760 0.016 0.128 0.008
#> GSM182784     3  0.2716     0.7343 0.000 0.132 0.852 0.004 0.008 0.004
#> GSM182785     3  0.5558     0.3859 0.000 0.264 0.588 0.008 0.136 0.004
#> GSM182786     5  0.0000     0.6229 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM182787     5  0.3669     0.4866 0.000 0.084 0.092 0.008 0.812 0.004
#> GSM182788     5  0.0000     0.6229 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM182789     3  0.4723     0.5917 0.000 0.132 0.720 0.012 0.132 0.004
#> GSM182790     3  0.3686     0.7192 0.000 0.124 0.788 0.000 0.000 0.088
#> GSM182791     6  0.6294     0.5665 0.000 0.148 0.148 0.116 0.000 0.588
#> GSM182792     6  0.2655     0.7614 0.000 0.060 0.020 0.036 0.000 0.884
#> GSM182793     5  0.5467     0.2536 0.000 0.116 0.000 0.320 0.556 0.008
#> GSM182794     3  0.4162     0.6779 0.000 0.100 0.752 0.004 0.000 0.144
#> GSM182795     3  0.3026     0.7491 0.000 0.068 0.868 0.008 0.020 0.036
#> GSM182796     5  0.2282     0.5927 0.000 0.088 0.000 0.024 0.888 0.000
#> GSM182797     1  0.5880     0.2892 0.512 0.144 0.000 0.016 0.000 0.328
#> GSM182798     5  0.5008     0.4191 0.000 0.212 0.000 0.148 0.640 0.000
#> GSM182799     6  0.4228     0.6800 0.000 0.088 0.012 0.144 0.000 0.756
#> GSM182800     6  0.6062     0.5878 0.164 0.124 0.000 0.100 0.000 0.612
#> GSM182801     6  0.2711     0.7578 0.080 0.024 0.000 0.020 0.000 0.876
#> GSM182814     1  0.0935     0.7777 0.964 0.004 0.000 0.032 0.000 0.000
#> GSM182815     4  0.4078     0.4949 0.224 0.008 0.000 0.736 0.012 0.020
#> GSM182816     1  0.0858     0.7781 0.968 0.004 0.000 0.028 0.000 0.000
#> GSM182817     4  0.5961     0.4174 0.232 0.128 0.000 0.588 0.052 0.000
#> GSM182818     1  0.4522     0.5180 0.684 0.028 0.000 0.260 0.000 0.028
#> GSM182819     1  0.0820     0.7825 0.972 0.016 0.000 0.012 0.000 0.000
#> GSM182820     1  0.2568     0.7622 0.876 0.096 0.000 0.016 0.000 0.012
#> GSM182821     4  0.8214     0.0351 0.016 0.152 0.240 0.372 0.196 0.024
#> GSM182822     1  0.3041     0.7248 0.832 0.040 0.000 0.128 0.000 0.000
#> GSM182823     1  0.1003     0.7827 0.964 0.020 0.000 0.016 0.000 0.000
#> GSM182824     1  0.0260     0.7825 0.992 0.000 0.000 0.008 0.000 0.000
#> GSM182825     1  0.2002     0.7604 0.908 0.012 0.000 0.076 0.000 0.004

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

consensus_heatmap(res, k = 2)

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 stress(p) development.stage(p) k
#> MAD:skmeans 71     0.907             1.36e-05 2
#> MAD:skmeans 64     0.722             7.11e-08 3
#> MAD:skmeans 62     0.758             7.90e-11 4
#> MAD:skmeans 59     0.913             3.80e-11 5
#> MAD:skmeans 45     0.777             9.25e-10 6

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


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

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

collect_plots(res)

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.865           0.892       0.955         0.4982 0.498   0.498
#> 3 3 0.556           0.636       0.808         0.2885 0.709   0.490
#> 4 4 0.440           0.420       0.686         0.1343 0.736   0.407
#> 5 5 0.522           0.417       0.655         0.0671 0.893   0.648
#> 6 6 0.587           0.318       0.651         0.0487 0.832   0.405

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
#> GSM182755     1  0.3879     0.9053 0.924 0.076
#> GSM182756     2  0.1843     0.9318 0.028 0.972
#> GSM182757     2  0.0000     0.9576 0.000 1.000
#> GSM182758     2  0.0000     0.9576 0.000 1.000
#> GSM182759     2  0.0000     0.9576 0.000 1.000
#> GSM182760     1  0.6438     0.8205 0.836 0.164
#> GSM182761     2  0.0000     0.9576 0.000 1.000
#> GSM182762     2  0.9983     0.0128 0.476 0.524
#> GSM182763     2  0.0000     0.9576 0.000 1.000
#> GSM182764     2  0.0000     0.9576 0.000 1.000
#> GSM182765     2  0.8661     0.5574 0.288 0.712
#> GSM182766     2  0.0000     0.9576 0.000 1.000
#> GSM182767     2  0.0672     0.9506 0.008 0.992
#> GSM182768     1  0.2778     0.9222 0.952 0.048
#> GSM182769     1  0.0376     0.9435 0.996 0.004
#> GSM182770     2  0.0000     0.9576 0.000 1.000
#> GSM182771     1  0.9996     0.0853 0.512 0.488
#> GSM182772     2  0.0000     0.9576 0.000 1.000
#> GSM182773     1  0.4022     0.9027 0.920 0.080
#> GSM182774     1  0.0376     0.9435 0.996 0.004
#> GSM182775     1  0.0938     0.9405 0.988 0.012
#> GSM182776     1  0.1184     0.9388 0.984 0.016
#> GSM182777     1  0.4022     0.9025 0.920 0.080
#> GSM182802     2  0.0000     0.9576 0.000 1.000
#> GSM182803     1  0.0000     0.9444 1.000 0.000
#> GSM182804     1  0.0000     0.9444 1.000 0.000
#> GSM182805     2  0.0000     0.9576 0.000 1.000
#> GSM182806     1  0.0000     0.9444 1.000 0.000
#> GSM182807     1  0.0000     0.9444 1.000 0.000
#> GSM182808     1  0.0000     0.9444 1.000 0.000
#> GSM182809     1  0.0376     0.9434 0.996 0.004
#> GSM182810     1  0.0000     0.9444 1.000 0.000
#> GSM182811     1  0.0000     0.9444 1.000 0.000
#> GSM182812     1  0.0000     0.9444 1.000 0.000
#> GSM182813     1  0.0000     0.9444 1.000 0.000
#> GSM182778     2  0.0000     0.9576 0.000 1.000
#> GSM182779     2  0.0000     0.9576 0.000 1.000
#> GSM182780     2  0.0000     0.9576 0.000 1.000
#> GSM182781     1  0.6438     0.8205 0.836 0.164
#> GSM182782     2  0.0000     0.9576 0.000 1.000
#> GSM182783     2  0.0000     0.9576 0.000 1.000
#> GSM182784     2  0.0000     0.9576 0.000 1.000
#> GSM182785     2  0.0000     0.9576 0.000 1.000
#> GSM182786     2  0.0000     0.9576 0.000 1.000
#> GSM182787     2  0.0000     0.9576 0.000 1.000
#> GSM182788     2  0.0000     0.9576 0.000 1.000
#> GSM182789     2  0.0000     0.9576 0.000 1.000
#> GSM182790     1  0.6438     0.8205 0.836 0.164
#> GSM182791     1  0.6148     0.8340 0.848 0.152
#> GSM182792     1  0.3879     0.9053 0.924 0.076
#> GSM182793     2  0.0000     0.9576 0.000 1.000
#> GSM182794     2  0.9635     0.3141 0.388 0.612
#> GSM182795     2  0.0000     0.9576 0.000 1.000
#> GSM182796     2  0.0000     0.9576 0.000 1.000
#> GSM182797     1  0.0000     0.9444 1.000 0.000
#> GSM182798     2  0.0000     0.9576 0.000 1.000
#> GSM182799     1  0.4022     0.9027 0.920 0.080
#> GSM182800     1  0.0000     0.9444 1.000 0.000
#> GSM182801     1  0.0376     0.9435 0.996 0.004
#> GSM182814     1  0.0000     0.9444 1.000 0.000
#> GSM182815     1  0.0000     0.9444 1.000 0.000
#> GSM182816     1  0.0000     0.9444 1.000 0.000
#> GSM182817     1  0.9552     0.3866 0.624 0.376
#> GSM182818     1  0.0000     0.9444 1.000 0.000
#> GSM182819     1  0.0000     0.9444 1.000 0.000
#> GSM182820     1  0.0000     0.9444 1.000 0.000
#> GSM182821     2  0.0000     0.9576 0.000 1.000
#> GSM182822     1  0.0000     0.9444 1.000 0.000
#> GSM182823     1  0.0000     0.9444 1.000 0.000
#> GSM182824     1  0.0000     0.9444 1.000 0.000
#> GSM182825     1  0.0000     0.9444 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
#> GSM182755     1  0.5678     0.5837 0.684 0.000 0.316
#> GSM182756     3  0.2356     0.6568 0.000 0.072 0.928
#> GSM182757     3  0.5882     0.3697 0.000 0.348 0.652
#> GSM182758     3  0.0000     0.6708 0.000 0.000 1.000
#> GSM182759     2  0.3752     0.6736 0.000 0.856 0.144
#> GSM182760     3  0.0000     0.6708 0.000 0.000 1.000
#> GSM182761     2  0.4887     0.5646 0.000 0.772 0.228
#> GSM182762     3  0.7533     0.2473 0.392 0.044 0.564
#> GSM182763     3  0.4605     0.5737 0.000 0.204 0.796
#> GSM182764     2  0.6111     0.3405 0.000 0.604 0.396
#> GSM182765     3  0.1964     0.6613 0.000 0.056 0.944
#> GSM182766     2  0.5948     0.3921 0.000 0.640 0.360
#> GSM182767     3  0.0000     0.6708 0.000 0.000 1.000
#> GSM182768     1  0.6260     0.4314 0.552 0.000 0.448
#> GSM182769     1  0.3116     0.8578 0.892 0.000 0.108
#> GSM182770     2  0.0000     0.7393 0.000 1.000 0.000
#> GSM182771     3  0.5553     0.4305 0.004 0.272 0.724
#> GSM182772     2  0.0000     0.7393 0.000 1.000 0.000
#> GSM182773     3  0.0000     0.6708 0.000 0.000 1.000
#> GSM182774     1  0.0892     0.8888 0.980 0.000 0.020
#> GSM182775     1  0.3619     0.8384 0.864 0.000 0.136
#> GSM182776     1  0.3551     0.8414 0.868 0.000 0.132
#> GSM182777     1  0.5810     0.5490 0.664 0.000 0.336
#> GSM182802     2  0.6168     0.2921 0.000 0.588 0.412
#> GSM182803     1  0.0000     0.8917 1.000 0.000 0.000
#> GSM182804     1  0.5254     0.6525 0.736 0.000 0.264
#> GSM182805     2  0.6154     0.3025 0.000 0.592 0.408
#> GSM182806     1  0.2165     0.8783 0.936 0.000 0.064
#> GSM182807     1  0.0000     0.8917 1.000 0.000 0.000
#> GSM182808     1  0.2066     0.8796 0.940 0.000 0.060
#> GSM182809     3  0.5810     0.4014 0.336 0.000 0.664
#> GSM182810     1  0.0000     0.8917 1.000 0.000 0.000
#> GSM182811     1  0.0000     0.8917 1.000 0.000 0.000
#> GSM182812     1  0.0000     0.8917 1.000 0.000 0.000
#> GSM182813     1  0.1163     0.8880 0.972 0.000 0.028
#> GSM182778     2  0.0000     0.7393 0.000 1.000 0.000
#> GSM182779     2  0.6274     0.1676 0.000 0.544 0.456
#> GSM182780     3  0.6095     0.2808 0.000 0.392 0.608
#> GSM182781     3  0.5397     0.4875 0.280 0.000 0.720
#> GSM182782     2  0.0000     0.7393 0.000 1.000 0.000
#> GSM182783     3  0.2796     0.6515 0.000 0.092 0.908
#> GSM182784     3  0.5785     0.3954 0.000 0.332 0.668
#> GSM182785     3  0.6026     0.3129 0.000 0.376 0.624
#> GSM182786     2  0.0000     0.7393 0.000 1.000 0.000
#> GSM182787     3  0.6126     0.2605 0.000 0.400 0.600
#> GSM182788     2  0.0000     0.7393 0.000 1.000 0.000
#> GSM182789     3  0.6126     0.2605 0.000 0.400 0.600
#> GSM182790     3  0.4974     0.5268 0.236 0.000 0.764
#> GSM182791     3  0.0000     0.6708 0.000 0.000 1.000
#> GSM182792     3  0.6026     0.0558 0.376 0.000 0.624
#> GSM182793     3  0.3038     0.6395 0.000 0.104 0.896
#> GSM182794     3  0.0000     0.6708 0.000 0.000 1.000
#> GSM182795     3  0.2625     0.6494 0.000 0.084 0.916
#> GSM182796     2  0.0000     0.7393 0.000 1.000 0.000
#> GSM182797     1  0.2959     0.8621 0.900 0.000 0.100
#> GSM182798     3  0.6140     0.1588 0.000 0.404 0.596
#> GSM182799     3  0.0000     0.6708 0.000 0.000 1.000
#> GSM182800     1  0.5733     0.6253 0.676 0.000 0.324
#> GSM182801     1  0.4452     0.8073 0.808 0.000 0.192
#> GSM182814     1  0.0000     0.8917 1.000 0.000 0.000
#> GSM182815     1  0.5365     0.6653 0.744 0.004 0.252
#> GSM182816     1  0.0000     0.8917 1.000 0.000 0.000
#> GSM182817     3  0.6798     0.3959 0.400 0.016 0.584
#> GSM182818     1  0.0000     0.8917 1.000 0.000 0.000
#> GSM182819     1  0.0000     0.8917 1.000 0.000 0.000
#> GSM182820     1  0.2261     0.8769 0.932 0.000 0.068
#> GSM182821     3  0.5785     0.3995 0.000 0.332 0.668
#> GSM182822     1  0.0000     0.8917 1.000 0.000 0.000
#> GSM182823     1  0.0000     0.8917 1.000 0.000 0.000
#> GSM182824     1  0.0000     0.8917 1.000 0.000 0.000
#> GSM182825     1  0.0237     0.8906 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
#> GSM182755     4  0.5599     0.5766 0.288 0.000 0.048 0.664
#> GSM182756     3  0.6158     0.2755 0.000 0.080 0.628 0.292
#> GSM182757     3  0.1118     0.4810 0.000 0.000 0.964 0.036
#> GSM182758     3  0.6698     0.4167 0.000 0.256 0.604 0.140
#> GSM182759     3  0.5947    -0.3648 0.000 0.384 0.572 0.044
#> GSM182760     4  0.6702     0.2965 0.000 0.100 0.356 0.544
#> GSM182761     3  0.4898     0.0115 0.000 0.260 0.716 0.024
#> GSM182762     4  0.8771     0.4448 0.140 0.116 0.244 0.500
#> GSM182763     3  0.4462     0.5197 0.000 0.164 0.792 0.044
#> GSM182764     3  0.4867     0.1060 0.000 0.232 0.736 0.032
#> GSM182765     3  0.6726     0.4367 0.000 0.364 0.536 0.100
#> GSM182766     3  0.5968    -0.0449 0.000 0.252 0.664 0.084
#> GSM182767     4  0.6843     0.0958 0.000 0.100 0.440 0.460
#> GSM182768     4  0.7044     0.6068 0.108 0.092 0.120 0.680
#> GSM182769     4  0.5047     0.5403 0.316 0.000 0.016 0.668
#> GSM182770     2  0.5941     0.6479 0.000 0.652 0.276 0.072
#> GSM182771     2  0.7149    -0.2101 0.000 0.552 0.264 0.184
#> GSM182772     2  0.6022     0.6436 0.000 0.656 0.260 0.084
#> GSM182773     4  0.6627     0.3000 0.000 0.096 0.348 0.556
#> GSM182774     1  0.6773     0.5369 0.660 0.160 0.020 0.160
#> GSM182775     4  0.5430     0.5653 0.300 0.000 0.036 0.664
#> GSM182776     4  0.5228     0.5495 0.312 0.000 0.024 0.664
#> GSM182777     4  0.6181     0.6162 0.204 0.000 0.128 0.668
#> GSM182802     3  0.7232    -0.1377 0.000 0.320 0.516 0.164
#> GSM182803     1  0.3486     0.6408 0.812 0.000 0.000 0.188
#> GSM182804     1  0.7646     0.4018 0.500 0.256 0.004 0.240
#> GSM182805     3  0.6514    -0.0166 0.000 0.212 0.636 0.152
#> GSM182806     1  0.4855     0.2399 0.600 0.000 0.000 0.400
#> GSM182807     1  0.3907     0.6740 0.768 0.000 0.000 0.232
#> GSM182808     1  0.4522     0.4517 0.680 0.000 0.000 0.320
#> GSM182809     1  0.9036     0.2397 0.472 0.212 0.204 0.112
#> GSM182810     1  0.2868     0.6750 0.864 0.000 0.000 0.136
#> GSM182811     1  0.3895     0.6694 0.832 0.036 0.000 0.132
#> GSM182812     1  0.0000     0.6915 1.000 0.000 0.000 0.000
#> GSM182813     1  0.3907     0.5699 0.768 0.000 0.000 0.232
#> GSM182778     2  0.4730     0.6681 0.000 0.636 0.364 0.000
#> GSM182779     3  0.3636     0.2682 0.000 0.172 0.820 0.008
#> GSM182780     3  0.3013     0.4693 0.000 0.032 0.888 0.080
#> GSM182781     3  0.6750     0.0569 0.128 0.000 0.584 0.288
#> GSM182782     2  0.4730     0.6681 0.000 0.636 0.364 0.000
#> GSM182783     3  0.6209     0.4979 0.000 0.232 0.656 0.112
#> GSM182784     3  0.0188     0.4912 0.000 0.000 0.996 0.004
#> GSM182785     3  0.1624     0.4690 0.000 0.020 0.952 0.028
#> GSM182786     2  0.4730     0.6681 0.000 0.636 0.364 0.000
#> GSM182787     3  0.2760     0.3854 0.000 0.128 0.872 0.000
#> GSM182788     2  0.4730     0.6681 0.000 0.636 0.364 0.000
#> GSM182789     3  0.0817     0.4734 0.000 0.024 0.976 0.000
#> GSM182790     3  0.6884     0.0634 0.108 0.008 0.584 0.300
#> GSM182791     3  0.7362     0.4225 0.000 0.256 0.524 0.220
#> GSM182792     4  0.9299    -0.0118 0.088 0.256 0.288 0.368
#> GSM182793     3  0.7569     0.3657 0.000 0.368 0.436 0.196
#> GSM182794     3  0.7362     0.4225 0.000 0.256 0.524 0.220
#> GSM182795     3  0.6474     0.4882 0.000 0.256 0.624 0.120
#> GSM182796     2  0.4546     0.6593 0.000 0.732 0.256 0.012
#> GSM182797     4  0.4327     0.5211 0.216 0.000 0.016 0.768
#> GSM182798     2  0.6656    -0.0502 0.000 0.620 0.160 0.220
#> GSM182799     3  0.7499     0.3997 0.000 0.256 0.500 0.244
#> GSM182800     1  0.8295     0.1884 0.380 0.256 0.016 0.348
#> GSM182801     4  0.6816     0.6211 0.180 0.040 0.108 0.672
#> GSM182814     1  0.0000     0.6915 1.000 0.000 0.000 0.000
#> GSM182815     1  0.6828     0.5142 0.588 0.148 0.000 0.264
#> GSM182816     1  0.2921     0.6744 0.860 0.000 0.000 0.140
#> GSM182817     1  0.9074    -0.0467 0.384 0.200 0.336 0.080
#> GSM182818     1  0.0921     0.6955 0.972 0.000 0.000 0.028
#> GSM182819     1  0.1867     0.6935 0.928 0.000 0.000 0.072
#> GSM182820     4  0.4008     0.4741 0.244 0.000 0.000 0.756
#> GSM182821     3  0.2706     0.4855 0.000 0.020 0.900 0.080
#> GSM182822     1  0.3444     0.6418 0.816 0.000 0.000 0.184
#> GSM182823     1  0.2408     0.6592 0.896 0.000 0.000 0.104
#> GSM182824     1  0.2408     0.6592 0.896 0.000 0.000 0.104
#> GSM182825     1  0.0188     0.6919 0.996 0.000 0.000 0.004

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>           class entropy silhouette    p1    p2    p3    p4    p5
#> GSM182755     4  0.4724     0.6605 0.168 0.000 0.080 0.744 0.008
#> GSM182756     3  0.4806     0.3598 0.000 0.000 0.688 0.252 0.060
#> GSM182757     3  0.3196     0.4200 0.000 0.004 0.804 0.000 0.192
#> GSM182758     3  0.5110     0.3539 0.000 0.000 0.680 0.096 0.224
#> GSM182759     3  0.6158     0.1517 0.000 0.184 0.552 0.000 0.264
#> GSM182760     4  0.5587     0.1922 0.000 0.000 0.428 0.500 0.072
#> GSM182761     3  0.6050     0.1398 0.000 0.312 0.544 0.000 0.144
#> GSM182762     5  0.7838     0.0138 0.072 0.012 0.232 0.208 0.476
#> GSM182763     3  0.4339     0.3752 0.000 0.020 0.684 0.000 0.296
#> GSM182764     3  0.5770     0.2300 0.000 0.140 0.604 0.000 0.256
#> GSM182765     5  0.4040     0.1743 0.000 0.012 0.276 0.000 0.712
#> GSM182766     5  0.7115    -0.1234 0.000 0.288 0.328 0.012 0.372
#> GSM182767     3  0.5524    -0.0350 0.000 0.000 0.516 0.416 0.068
#> GSM182768     4  0.5665     0.6247 0.056 0.000 0.208 0.680 0.056
#> GSM182769     4  0.4657     0.6135 0.172 0.000 0.024 0.756 0.048
#> GSM182770     2  0.5910     0.5531 0.000 0.596 0.100 0.012 0.292
#> GSM182771     5  0.4315     0.3723 0.000 0.068 0.156 0.004 0.772
#> GSM182772     2  0.5791     0.5449 0.000 0.588 0.080 0.012 0.320
#> GSM182773     4  0.5524     0.2182 0.000 0.000 0.416 0.516 0.068
#> GSM182774     1  0.6991     0.4227 0.492 0.000 0.024 0.244 0.240
#> GSM182775     4  0.4548     0.6727 0.156 0.000 0.096 0.748 0.000
#> GSM182776     4  0.4298     0.6434 0.184 0.000 0.060 0.756 0.000
#> GSM182777     4  0.5060     0.6600 0.104 0.000 0.204 0.692 0.000
#> GSM182802     5  0.5991     0.1183 0.000 0.068 0.452 0.016 0.464
#> GSM182803     1  0.3612     0.6218 0.732 0.000 0.000 0.268 0.000
#> GSM182804     1  0.6460     0.2614 0.440 0.000 0.004 0.156 0.400
#> GSM182805     3  0.5957    -0.0810 0.000 0.068 0.508 0.016 0.408
#> GSM182806     4  0.4446    -0.1808 0.476 0.000 0.000 0.520 0.004
#> GSM182807     1  0.4397     0.6023 0.564 0.000 0.000 0.432 0.004
#> GSM182808     1  0.4446     0.2778 0.520 0.000 0.000 0.476 0.004
#> GSM182809     1  0.6780     0.1051 0.496 0.000 0.192 0.016 0.296
#> GSM182810     1  0.3305     0.6526 0.776 0.000 0.000 0.224 0.000
#> GSM182811     1  0.4134     0.6450 0.744 0.000 0.000 0.224 0.032
#> GSM182812     1  0.0404     0.6731 0.988 0.000 0.000 0.012 0.000
#> GSM182813     1  0.4251     0.4277 0.624 0.000 0.000 0.372 0.004
#> GSM182778     2  0.0404     0.8420 0.000 0.988 0.012 0.000 0.000
#> GSM182779     3  0.2735     0.4570 0.000 0.036 0.880 0.000 0.084
#> GSM182780     3  0.3326     0.3999 0.000 0.024 0.824 0.000 0.152
#> GSM182781     3  0.6644     0.2546 0.064 0.000 0.596 0.224 0.116
#> GSM182782     2  0.1012     0.8299 0.000 0.968 0.012 0.000 0.020
#> GSM182783     3  0.4218     0.3139 0.000 0.000 0.660 0.008 0.332
#> GSM182784     3  0.0290     0.4819 0.000 0.000 0.992 0.000 0.008
#> GSM182785     3  0.2722     0.4498 0.000 0.020 0.872 0.000 0.108
#> GSM182786     2  0.0404     0.8420 0.000 0.988 0.012 0.000 0.000
#> GSM182787     3  0.3612     0.3231 0.000 0.228 0.764 0.000 0.008
#> GSM182788     2  0.0404     0.8420 0.000 0.988 0.012 0.000 0.000
#> GSM182789     3  0.0865     0.4797 0.000 0.024 0.972 0.000 0.004
#> GSM182790     3  0.5175     0.2737 0.052 0.000 0.664 0.272 0.012
#> GSM182791     3  0.5308     0.2245 0.000 0.000 0.532 0.052 0.416
#> GSM182792     5  0.7630     0.0491 0.052 0.000 0.296 0.252 0.400
#> GSM182793     5  0.3462     0.3173 0.000 0.000 0.196 0.012 0.792
#> GSM182794     3  0.5499     0.2319 0.000 0.000 0.532 0.068 0.400
#> GSM182795     3  0.4595     0.2523 0.000 0.004 0.588 0.008 0.400
#> GSM182796     2  0.1478     0.8132 0.000 0.936 0.000 0.000 0.064
#> GSM182797     4  0.0671     0.5667 0.016 0.000 0.000 0.980 0.004
#> GSM182798     5  0.1704     0.3944 0.000 0.068 0.004 0.000 0.928
#> GSM182799     3  0.5861     0.1999 0.000 0.000 0.500 0.100 0.400
#> GSM182800     5  0.7019    -0.1211 0.300 0.000 0.020 0.220 0.460
#> GSM182801     4  0.5266     0.6555 0.096 0.000 0.208 0.688 0.008
#> GSM182814     1  0.0510     0.6722 0.984 0.000 0.000 0.016 0.000
#> GSM182815     1  0.5920     0.5111 0.580 0.000 0.000 0.148 0.272
#> GSM182816     1  0.3336     0.6517 0.772 0.000 0.000 0.228 0.000
#> GSM182817     5  0.8095     0.2608 0.296 0.012 0.248 0.064 0.380
#> GSM182818     1  0.1043     0.6821 0.960 0.000 0.000 0.040 0.000
#> GSM182819     1  0.2561     0.6780 0.856 0.000 0.000 0.144 0.000
#> GSM182820     4  0.1124     0.5604 0.036 0.000 0.000 0.960 0.004
#> GSM182821     3  0.3477     0.3888 0.012 0.004 0.816 0.004 0.164
#> GSM182822     1  0.3561     0.6272 0.740 0.000 0.000 0.260 0.000
#> GSM182823     1  0.3491     0.5813 0.768 0.000 0.000 0.228 0.004
#> GSM182824     1  0.3461     0.5837 0.772 0.000 0.000 0.224 0.004
#> GSM182825     1  0.0404     0.6731 0.988 0.000 0.000 0.012 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
#> GSM182755     6  0.2092    0.48838 0.000 0.000 0.124 0.000 0.000 0.876
#> GSM182756     3  0.2668    0.37083 0.000 0.000 0.828 0.004 0.000 0.168
#> GSM182757     3  0.4905   -0.35159 0.000 0.000 0.528 0.064 0.408 0.000
#> GSM182758     3  0.2308    0.37303 0.000 0.000 0.892 0.040 0.000 0.068
#> GSM182759     5  0.5107    0.58986 0.000 0.048 0.204 0.068 0.680 0.000
#> GSM182760     3  0.4176    0.25034 0.000 0.000 0.580 0.000 0.016 0.404
#> GSM182761     5  0.4655    0.58249 0.000 0.112 0.208 0.000 0.680 0.000
#> GSM182762     4  0.6099   -0.12542 0.000 0.000 0.372 0.420 0.200 0.008
#> GSM182763     5  0.5100    0.44185 0.000 0.000 0.392 0.084 0.524 0.000
#> GSM182764     5  0.5181    0.57666 0.000 0.016 0.212 0.120 0.652 0.000
#> GSM182765     4  0.5286    0.06643 0.000 0.000 0.296 0.572 0.132 0.000
#> GSM182766     5  0.4497    0.27774 0.000 0.064 0.008 0.232 0.696 0.000
#> GSM182767     3  0.3499    0.31354 0.000 0.000 0.680 0.000 0.000 0.320
#> GSM182768     6  0.3695    0.21028 0.000 0.000 0.376 0.000 0.000 0.624
#> GSM182769     6  0.1995    0.47166 0.000 0.000 0.052 0.036 0.000 0.912
#> GSM182770     4  0.5878    0.23759 0.000 0.204 0.000 0.440 0.356 0.000
#> GSM182771     4  0.3047    0.42391 0.000 0.008 0.060 0.852 0.080 0.000
#> GSM182772     4  0.5724    0.25715 0.000 0.184 0.000 0.492 0.324 0.000
#> GSM182773     3  0.4348    0.24748 0.000 0.000 0.560 0.024 0.000 0.416
#> GSM182774     6  0.7276    0.02114 0.200 0.000 0.168 0.104 0.028 0.500
#> GSM182775     6  0.2219    0.48821 0.000 0.000 0.136 0.000 0.000 0.864
#> GSM182776     6  0.1556    0.48286 0.000 0.000 0.080 0.000 0.000 0.920
#> GSM182777     6  0.3659    0.23045 0.000 0.000 0.364 0.000 0.000 0.636
#> GSM182802     4  0.4325    0.25452 0.000 0.008 0.008 0.504 0.480 0.000
#> GSM182803     6  0.4234   -0.07601 0.408 0.000 0.000 0.004 0.012 0.576
#> GSM182804     4  0.8250   -0.01591 0.240 0.000 0.172 0.380 0.080 0.128
#> GSM182805     5  0.3023    0.21794 0.000 0.004 0.008 0.180 0.808 0.000
#> GSM182806     1  0.3276    0.36351 0.764 0.000 0.000 0.004 0.004 0.228
#> GSM182807     1  0.3804    0.24265 0.656 0.000 0.000 0.000 0.008 0.336
#> GSM182808     1  0.3314    0.36851 0.740 0.000 0.000 0.000 0.004 0.256
#> GSM182809     1  0.7063    0.05327 0.392 0.000 0.200 0.348 0.024 0.036
#> GSM182810     6  0.4630   -0.09315 0.404 0.000 0.000 0.008 0.028 0.560
#> GSM182811     6  0.4849   -0.08673 0.396 0.000 0.008 0.008 0.028 0.560
#> GSM182812     1  0.3651    0.56592 0.752 0.000 0.000 0.008 0.016 0.224
#> GSM182813     1  0.2320    0.49031 0.864 0.000 0.000 0.000 0.004 0.132
#> GSM182778     2  0.0000    0.97491 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM182779     5  0.4076    0.43619 0.000 0.000 0.452 0.008 0.540 0.000
#> GSM182780     5  0.5829    0.03462 0.000 0.000 0.380 0.188 0.432 0.000
#> GSM182781     3  0.4259    0.31634 0.000 0.000 0.740 0.096 0.004 0.160
#> GSM182782     2  0.0146    0.97197 0.000 0.996 0.000 0.000 0.004 0.000
#> GSM182783     3  0.5117    0.33601 0.000 0.000 0.596 0.288 0.116 0.000
#> GSM182784     3  0.3050    0.07856 0.000 0.000 0.764 0.000 0.236 0.000
#> GSM182785     5  0.3860    0.41274 0.000 0.000 0.472 0.000 0.528 0.000
#> GSM182786     2  0.0000    0.97491 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM182787     5  0.5602    0.36135 0.000 0.188 0.276 0.000 0.536 0.000
#> GSM182788     2  0.0000    0.97491 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM182789     3  0.3789   -0.26364 0.000 0.000 0.584 0.000 0.416 0.000
#> GSM182790     3  0.2664    0.36789 0.000 0.000 0.816 0.000 0.000 0.184
#> GSM182791     3  0.3659    0.29891 0.000 0.000 0.636 0.364 0.000 0.000
#> GSM182792     3  0.5887    0.04757 0.000 0.000 0.432 0.364 0.000 0.204
#> GSM182793     4  0.4746    0.34828 0.000 0.000 0.236 0.660 0.104 0.000
#> GSM182794     3  0.3899    0.30518 0.000 0.000 0.628 0.364 0.000 0.008
#> GSM182795     3  0.4493    0.31538 0.000 0.000 0.596 0.364 0.040 0.000
#> GSM182796     2  0.1926    0.89991 0.000 0.912 0.000 0.068 0.020 0.000
#> GSM182797     6  0.3905    0.38159 0.212 0.000 0.040 0.000 0.004 0.744
#> GSM182798     4  0.2020    0.39881 0.000 0.008 0.000 0.896 0.096 0.000
#> GSM182799     3  0.4367    0.29095 0.000 0.000 0.604 0.364 0.000 0.032
#> GSM182800     4  0.7668   -0.00174 0.196 0.000 0.176 0.380 0.008 0.240
#> GSM182801     6  0.3620    0.24660 0.000 0.000 0.352 0.000 0.000 0.648
#> GSM182814     1  0.3651    0.56592 0.752 0.000 0.000 0.008 0.016 0.224
#> GSM182815     1  0.7646    0.22611 0.372 0.000 0.016 0.192 0.296 0.124
#> GSM182816     6  0.3823   -0.11025 0.436 0.000 0.000 0.000 0.000 0.564
#> GSM182817     4  0.7218    0.31543 0.044 0.000 0.176 0.504 0.064 0.212
#> GSM182818     1  0.4350    0.51916 0.676 0.000 0.000 0.008 0.036 0.280
#> GSM182819     1  0.4475    0.27966 0.528 0.000 0.000 0.008 0.016 0.448
#> GSM182820     6  0.3536    0.34071 0.252 0.000 0.008 0.000 0.004 0.736
#> GSM182821     3  0.5894    0.07263 0.000 0.000 0.452 0.216 0.332 0.000
#> GSM182822     6  0.4708   -0.07720 0.396 0.000 0.008 0.008 0.020 0.568
#> GSM182823     1  0.0146    0.57321 0.996 0.000 0.000 0.000 0.004 0.000
#> GSM182824     1  0.0146    0.57321 0.996 0.000 0.000 0.000 0.004 0.000
#> GSM182825     1  0.3651    0.56592 0.752 0.000 0.000 0.008 0.016 0.224

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 stress(p) development.stage(p) k
#> MAD:pam 67   0.89207             4.35e-04 2
#> MAD:pam 51   0.88938             3.97e-06 3
#> MAD:pam 32   0.20913             3.24e-06 4
#> MAD:pam 30   0.22905             1.81e-06 5
#> MAD:pam 14   0.00702             9.12e-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: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 18172 rows and 71 columns.
#>   Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'MAD' method.
#>   Subgroups are detected by 'mclust' method.
#>   Performed in total 1250 partitions by row resampling.
#>   Best k for subgroups seems to be 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-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.368           0.846       0.896         0.3883 0.566   0.566
#> 3 3 0.629           0.647       0.855         0.6424 0.705   0.505
#> 4 4 0.536           0.594       0.782         0.0956 0.882   0.677
#> 5 5 0.611           0.538       0.670         0.0666 0.878   0.619
#> 6 6 0.660           0.587       0.750         0.0717 0.800   0.363

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
#> GSM182755     2  0.0376      0.890 0.004 0.996
#> GSM182756     1  0.5946      0.793 0.856 0.144
#> GSM182757     2  0.6973      0.838 0.188 0.812
#> GSM182758     1  0.0376      0.802 0.996 0.004
#> GSM182759     2  0.6048      0.880 0.148 0.852
#> GSM182760     1  0.0000      0.800 1.000 0.000
#> GSM182761     2  0.6048      0.880 0.148 0.852
#> GSM182762     2  0.6048      0.880 0.148 0.852
#> GSM182763     2  0.6048      0.880 0.148 0.852
#> GSM182764     2  0.6048      0.880 0.148 0.852
#> GSM182765     2  0.6048      0.880 0.148 0.852
#> GSM182766     2  0.6048      0.880 0.148 0.852
#> GSM182767     1  0.0000      0.800 1.000 0.000
#> GSM182768     1  0.8016      0.795 0.756 0.244
#> GSM182769     1  0.7674      0.811 0.776 0.224
#> GSM182770     2  0.5946      0.881 0.144 0.856
#> GSM182771     2  0.5629      0.884 0.132 0.868
#> GSM182772     2  0.5946      0.881 0.144 0.856
#> GSM182773     1  0.7056      0.824 0.808 0.192
#> GSM182774     2  0.5737      0.884 0.136 0.864
#> GSM182775     1  0.7376      0.821 0.792 0.208
#> GSM182776     2  0.6343      0.869 0.160 0.840
#> GSM182777     1  0.4298      0.826 0.912 0.088
#> GSM182802     2  0.0000      0.889 0.000 1.000
#> GSM182803     2  0.0000      0.889 0.000 1.000
#> GSM182804     2  0.5629      0.884 0.132 0.868
#> GSM182805     2  0.0000      0.889 0.000 1.000
#> GSM182806     2  0.0376      0.890 0.004 0.996
#> GSM182807     2  0.0376      0.890 0.004 0.996
#> GSM182808     2  0.0376      0.890 0.004 0.996
#> GSM182809     2  0.5946      0.882 0.144 0.856
#> GSM182810     2  0.0000      0.889 0.000 1.000
#> GSM182811     2  0.0000      0.889 0.000 1.000
#> GSM182812     2  0.0000      0.889 0.000 1.000
#> GSM182813     2  0.0376      0.890 0.004 0.996
#> GSM182778     2  0.5946      0.881 0.144 0.856
#> GSM182779     2  0.6048      0.880 0.148 0.852
#> GSM182780     1  0.8443      0.763 0.728 0.272
#> GSM182781     1  0.6801      0.745 0.820 0.180
#> GSM182782     2  0.6048      0.880 0.148 0.852
#> GSM182783     1  0.7376      0.821 0.792 0.208
#> GSM182784     1  0.0938      0.803 0.988 0.012
#> GSM182785     1  0.7745      0.718 0.772 0.228
#> GSM182786     2  0.5946      0.881 0.144 0.856
#> GSM182787     2  0.6048      0.880 0.148 0.852
#> GSM182788     2  0.6048      0.880 0.148 0.852
#> GSM182789     1  0.3431      0.822 0.936 0.064
#> GSM182790     1  0.0000      0.800 1.000 0.000
#> GSM182791     1  0.8386      0.769 0.732 0.268
#> GSM182792     1  0.8081      0.791 0.752 0.248
#> GSM182793     2  0.5946      0.881 0.144 0.856
#> GSM182794     1  0.0000      0.800 1.000 0.000
#> GSM182795     1  0.7376      0.821 0.792 0.208
#> GSM182796     2  0.5946      0.881 0.144 0.856
#> GSM182797     2  0.0938      0.886 0.012 0.988
#> GSM182798     2  0.5629      0.884 0.132 0.868
#> GSM182799     1  0.9881      0.391 0.564 0.436
#> GSM182800     2  0.8955      0.580 0.312 0.688
#> GSM182801     1  0.8327      0.773 0.736 0.264
#> GSM182814     2  0.0000      0.889 0.000 1.000
#> GSM182815     2  0.0000      0.889 0.000 1.000
#> GSM182816     2  0.0000      0.889 0.000 1.000
#> GSM182817     2  0.0000      0.889 0.000 1.000
#> GSM182818     2  0.0376      0.890 0.004 0.996
#> GSM182819     2  0.0000      0.889 0.000 1.000
#> GSM182820     2  0.0376      0.890 0.004 0.996
#> GSM182821     2  0.1184      0.889 0.016 0.984
#> GSM182822     2  0.0376      0.890 0.004 0.996
#> GSM182823     2  0.0000      0.889 0.000 1.000
#> GSM182824     2  0.0000      0.889 0.000 1.000
#> GSM182825     2  0.0000      0.889 0.000 1.000

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>           class entropy silhouette    p1    p2    p3
#> GSM182755     1  0.1964     0.7459 0.944 0.000 0.056
#> GSM182756     3  0.0000     0.7122 0.000 0.000 1.000
#> GSM182757     2  0.3755     0.8757 0.008 0.872 0.120
#> GSM182758     3  0.0000     0.7122 0.000 0.000 1.000
#> GSM182759     2  0.0892     0.9202 0.020 0.980 0.000
#> GSM182760     3  0.0000     0.7122 0.000 0.000 1.000
#> GSM182761     2  0.3120     0.9052 0.012 0.908 0.080
#> GSM182762     2  0.3583     0.9105 0.044 0.900 0.056
#> GSM182763     2  0.3502     0.9011 0.020 0.896 0.084
#> GSM182764     2  0.3009     0.9158 0.028 0.920 0.052
#> GSM182765     2  0.3910     0.8854 0.020 0.876 0.104
#> GSM182766     2  0.2636     0.9134 0.020 0.932 0.048
#> GSM182767     3  0.0000     0.7122 0.000 0.000 1.000
#> GSM182768     3  0.6260     0.2413 0.448 0.000 0.552
#> GSM182769     1  0.6309    -0.1085 0.504 0.000 0.496
#> GSM182770     2  0.0892     0.9202 0.020 0.980 0.000
#> GSM182771     2  0.2902     0.9120 0.064 0.920 0.016
#> GSM182772     2  0.1031     0.9204 0.024 0.976 0.000
#> GSM182773     3  0.6215     0.2782 0.428 0.000 0.572
#> GSM182774     1  0.1753     0.7597 0.952 0.000 0.048
#> GSM182775     3  0.6267     0.2251 0.452 0.000 0.548
#> GSM182776     1  0.6421     0.1379 0.572 0.004 0.424
#> GSM182777     3  0.6235     0.2655 0.436 0.000 0.564
#> GSM182802     2  0.3192     0.8801 0.112 0.888 0.000
#> GSM182803     1  0.0000     0.7945 1.000 0.000 0.000
#> GSM182804     1  0.8248     0.2128 0.560 0.088 0.352
#> GSM182805     2  0.3192     0.8801 0.112 0.888 0.000
#> GSM182806     1  0.0000     0.7945 1.000 0.000 0.000
#> GSM182807     1  0.0000     0.7945 1.000 0.000 0.000
#> GSM182808     1  0.0000     0.7945 1.000 0.000 0.000
#> GSM182809     1  0.8346     0.1849 0.548 0.092 0.360
#> GSM182810     1  0.0000     0.7945 1.000 0.000 0.000
#> GSM182811     1  0.0000     0.7945 1.000 0.000 0.000
#> GSM182812     1  0.0000     0.7945 1.000 0.000 0.000
#> GSM182813     1  0.0000     0.7945 1.000 0.000 0.000
#> GSM182778     2  0.0000     0.9139 0.000 1.000 0.000
#> GSM182779     2  0.2846     0.9133 0.020 0.924 0.056
#> GSM182780     3  0.6994     0.1739 0.020 0.424 0.556
#> GSM182781     3  0.0000     0.7122 0.000 0.000 1.000
#> GSM182782     2  0.0000     0.9139 0.000 1.000 0.000
#> GSM182783     3  0.5722     0.4519 0.004 0.292 0.704
#> GSM182784     3  0.0000     0.7122 0.000 0.000 1.000
#> GSM182785     3  0.0237     0.7115 0.000 0.004 0.996
#> GSM182786     2  0.0000     0.9139 0.000 1.000 0.000
#> GSM182787     2  0.3415     0.8774 0.020 0.900 0.080
#> GSM182788     2  0.0000     0.9139 0.000 1.000 0.000
#> GSM182789     3  0.0424     0.7105 0.000 0.008 0.992
#> GSM182790     3  0.0000     0.7122 0.000 0.000 1.000
#> GSM182791     3  0.6260     0.2413 0.448 0.000 0.552
#> GSM182792     3  0.6260     0.2413 0.448 0.000 0.552
#> GSM182793     2  0.6849     0.2638 0.020 0.600 0.380
#> GSM182794     3  0.0000     0.7122 0.000 0.000 1.000
#> GSM182795     3  0.0592     0.7091 0.000 0.012 0.988
#> GSM182796     2  0.1753     0.9164 0.048 0.952 0.000
#> GSM182797     1  0.1525     0.7715 0.964 0.004 0.032
#> GSM182798     2  0.1753     0.9164 0.048 0.952 0.000
#> GSM182799     3  0.6260     0.2413 0.448 0.000 0.552
#> GSM182800     1  0.6505    -0.0123 0.528 0.004 0.468
#> GSM182801     1  0.6309    -0.1085 0.504 0.000 0.496
#> GSM182814     1  0.0000     0.7945 1.000 0.000 0.000
#> GSM182815     1  0.8068     0.2965 0.596 0.088 0.316
#> GSM182816     1  0.0000     0.7945 1.000 0.000 0.000
#> GSM182817     1  0.6204     0.2674 0.576 0.424 0.000
#> GSM182818     1  0.5678     0.4039 0.684 0.000 0.316
#> GSM182819     1  0.0000     0.7945 1.000 0.000 0.000
#> GSM182820     1  0.0000     0.7945 1.000 0.000 0.000
#> GSM182821     3  0.9969     0.1936 0.308 0.320 0.372
#> GSM182822     1  0.0000     0.7945 1.000 0.000 0.000
#> GSM182823     1  0.0000     0.7945 1.000 0.000 0.000
#> GSM182824     1  0.0000     0.7945 1.000 0.000 0.000
#> GSM182825     1  0.0000     0.7945 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
#> GSM182755     1  0.5955      0.621 0.732 0.060 0.168 0.040
#> GSM182756     3  0.0188      0.790 0.000 0.000 0.996 0.004
#> GSM182757     2  0.4624      0.520 0.000 0.660 0.340 0.000
#> GSM182758     3  0.0376      0.790 0.000 0.004 0.992 0.004
#> GSM182759     2  0.4621      0.515 0.000 0.708 0.284 0.008
#> GSM182760     3  0.0188      0.790 0.000 0.000 0.996 0.004
#> GSM182761     2  0.4543      0.530 0.000 0.676 0.324 0.000
#> GSM182762     2  0.5487      0.513 0.024 0.644 0.328 0.004
#> GSM182763     2  0.4564      0.528 0.000 0.672 0.328 0.000
#> GSM182764     2  0.5343      0.522 0.000 0.656 0.316 0.028
#> GSM182765     2  0.4624      0.520 0.000 0.660 0.340 0.000
#> GSM182766     2  0.4188      0.389 0.000 0.812 0.148 0.040
#> GSM182767     3  0.0188      0.790 0.000 0.000 0.996 0.004
#> GSM182768     3  0.5080      0.729 0.092 0.000 0.764 0.144
#> GSM182769     3  0.6855      0.539 0.276 0.000 0.580 0.144
#> GSM182770     2  0.5119     -0.162 0.000 0.556 0.004 0.440
#> GSM182771     4  0.7566      0.309 0.000 0.392 0.192 0.416
#> GSM182772     2  0.5132     -0.182 0.000 0.548 0.004 0.448
#> GSM182773     3  0.3991      0.759 0.048 0.000 0.832 0.120
#> GSM182774     1  0.4094      0.777 0.828 0.000 0.056 0.116
#> GSM182775     3  0.6034      0.664 0.164 0.000 0.688 0.148
#> GSM182776     3  0.6863      0.439 0.348 0.000 0.536 0.116
#> GSM182777     3  0.3780      0.733 0.148 0.004 0.832 0.016
#> GSM182802     4  0.4240      0.442 0.012 0.200 0.004 0.784
#> GSM182803     1  0.0000      0.878 1.000 0.000 0.000 0.000
#> GSM182804     1  0.6090      0.355 0.512 0.036 0.004 0.448
#> GSM182805     4  0.5134      0.452 0.012 0.320 0.004 0.664
#> GSM182806     1  0.1118      0.874 0.964 0.000 0.000 0.036
#> GSM182807     1  0.1305      0.874 0.960 0.000 0.004 0.036
#> GSM182808     1  0.1584      0.872 0.952 0.000 0.012 0.036
#> GSM182809     1  0.6858      0.190 0.532 0.004 0.368 0.096
#> GSM182810     1  0.0000      0.878 1.000 0.000 0.000 0.000
#> GSM182811     1  0.1109      0.870 0.968 0.000 0.004 0.028
#> GSM182812     1  0.0592      0.876 0.984 0.000 0.000 0.016
#> GSM182813     1  0.1706      0.870 0.948 0.000 0.016 0.036
#> GSM182778     2  0.2216      0.254 0.000 0.908 0.000 0.092
#> GSM182779     2  0.4543      0.530 0.000 0.676 0.324 0.000
#> GSM182780     3  0.2760      0.678 0.000 0.128 0.872 0.000
#> GSM182781     3  0.0000      0.790 0.000 0.000 1.000 0.000
#> GSM182782     2  0.2216      0.254 0.000 0.908 0.000 0.092
#> GSM182783     3  0.0817      0.780 0.000 0.024 0.976 0.000
#> GSM182784     3  0.0188      0.790 0.000 0.000 0.996 0.004
#> GSM182785     3  0.0817      0.779 0.000 0.024 0.976 0.000
#> GSM182786     2  0.2216      0.254 0.000 0.908 0.000 0.092
#> GSM182787     2  0.4898      0.396 0.000 0.584 0.416 0.000
#> GSM182788     2  0.2216      0.254 0.000 0.908 0.000 0.092
#> GSM182789     3  0.0336      0.788 0.000 0.008 0.992 0.000
#> GSM182790     3  0.0188      0.790 0.000 0.000 0.996 0.004
#> GSM182791     3  0.4153      0.755 0.048 0.000 0.820 0.132
#> GSM182792     3  0.5080      0.729 0.092 0.000 0.764 0.144
#> GSM182793     4  0.7922      0.293 0.012 0.304 0.212 0.472
#> GSM182794     3  0.0188      0.790 0.000 0.000 0.996 0.004
#> GSM182795     3  0.0376      0.790 0.000 0.004 0.992 0.004
#> GSM182796     2  0.5386     -0.328 0.000 0.612 0.020 0.368
#> GSM182797     1  0.3570      0.804 0.860 0.000 0.092 0.048
#> GSM182798     4  0.7451      0.319 0.000 0.412 0.172 0.416
#> GSM182799     3  0.5272      0.727 0.096 0.004 0.760 0.140
#> GSM182800     3  0.6337      0.448 0.360 0.000 0.568 0.072
#> GSM182801     3  0.6584      0.477 0.336 0.000 0.568 0.096
#> GSM182814     1  0.0592      0.876 0.984 0.000 0.000 0.016
#> GSM182815     1  0.6086      0.349 0.516 0.036 0.004 0.444
#> GSM182816     1  0.0592      0.876 0.984 0.000 0.000 0.016
#> GSM182817     4  0.9656      0.296 0.168 0.264 0.196 0.372
#> GSM182818     1  0.4284      0.728 0.780 0.000 0.020 0.200
#> GSM182819     1  0.0000      0.878 1.000 0.000 0.000 0.000
#> GSM182820     1  0.1305      0.874 0.960 0.000 0.004 0.036
#> GSM182821     3  0.6576     -0.191 0.068 0.412 0.516 0.004
#> GSM182822     1  0.0376      0.877 0.992 0.000 0.004 0.004
#> GSM182823     1  0.0592      0.876 0.984 0.000 0.000 0.016
#> GSM182824     1  0.0336      0.878 0.992 0.000 0.000 0.008
#> GSM182825     1  0.0707      0.876 0.980 0.000 0.000 0.020

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>           class entropy silhouette    p1    p2    p3    p4    p5
#> GSM182755     1  0.8283     0.4179 0.464 0.040 0.184 0.076 0.236
#> GSM182756     3  0.0404     0.6204 0.000 0.000 0.988 0.000 0.012
#> GSM182757     5  0.6796     0.5945 0.000 0.312 0.308 0.000 0.380
#> GSM182758     3  0.0404     0.6233 0.000 0.012 0.988 0.000 0.000
#> GSM182759     5  0.6790     0.5695 0.000 0.328 0.292 0.000 0.380
#> GSM182760     3  0.0324     0.6274 0.000 0.000 0.992 0.004 0.004
#> GSM182761     5  0.6796     0.5945 0.000 0.312 0.308 0.000 0.380
#> GSM182762     5  0.7035     0.4830 0.004 0.204 0.312 0.016 0.464
#> GSM182763     5  0.7135     0.5869 0.000 0.312 0.316 0.012 0.360
#> GSM182764     5  0.6928     0.5865 0.000 0.316 0.300 0.004 0.380
#> GSM182765     5  0.7143     0.5740 0.000 0.316 0.324 0.012 0.348
#> GSM182766     2  0.7528    -0.0471 0.000 0.468 0.184 0.072 0.276
#> GSM182767     3  0.0162     0.6271 0.000 0.000 0.996 0.004 0.000
#> GSM182768     3  0.5365     0.5734 0.032 0.000 0.572 0.016 0.380
#> GSM182769     3  0.5445     0.5681 0.036 0.000 0.564 0.016 0.384
#> GSM182770     4  0.3949     0.7040 0.000 0.332 0.000 0.668 0.000
#> GSM182771     2  0.7135     0.2927 0.000 0.400 0.028 0.384 0.188
#> GSM182772     4  0.3949     0.7040 0.000 0.332 0.000 0.668 0.000
#> GSM182773     3  0.5365     0.5734 0.032 0.000 0.572 0.016 0.380
#> GSM182774     1  0.6309     0.4835 0.600 0.020 0.084 0.016 0.280
#> GSM182775     3  0.5375     0.5708 0.032 0.000 0.568 0.016 0.384
#> GSM182776     1  0.7145    -0.1815 0.340 0.012 0.316 0.000 0.332
#> GSM182777     3  0.5318     0.5844 0.052 0.000 0.636 0.012 0.300
#> GSM182802     4  0.3586     0.6998 0.000 0.264 0.000 0.736 0.000
#> GSM182803     1  0.0324     0.8137 0.992 0.000 0.000 0.004 0.004
#> GSM182804     4  0.5368     0.5148 0.108 0.076 0.000 0.736 0.080
#> GSM182805     4  0.3707     0.6790 0.000 0.284 0.000 0.716 0.000
#> GSM182806     1  0.4930     0.7156 0.696 0.000 0.000 0.084 0.220
#> GSM182807     1  0.5110     0.7081 0.680 0.000 0.000 0.096 0.224
#> GSM182808     1  0.3866     0.7658 0.808 0.000 0.000 0.096 0.096
#> GSM182809     5  0.8314    -0.2539 0.248 0.024 0.268 0.068 0.392
#> GSM182810     1  0.0324     0.8139 0.992 0.000 0.004 0.000 0.004
#> GSM182811     1  0.1717     0.7855 0.936 0.008 0.000 0.052 0.004
#> GSM182812     1  0.0693     0.8107 0.980 0.000 0.000 0.012 0.008
#> GSM182813     1  0.5110     0.7081 0.680 0.000 0.000 0.096 0.224
#> GSM182778     2  0.0000     0.5000 0.000 1.000 0.000 0.000 0.000
#> GSM182779     5  0.6796     0.5945 0.000 0.312 0.308 0.000 0.380
#> GSM182780     3  0.3706     0.4487 0.000 0.180 0.796 0.012 0.012
#> GSM182781     3  0.0000     0.6264 0.000 0.000 1.000 0.000 0.000
#> GSM182782     2  0.0000     0.5000 0.000 1.000 0.000 0.000 0.000
#> GSM182783     3  0.3203     0.4845 0.000 0.168 0.820 0.012 0.000
#> GSM182784     3  0.0404     0.6204 0.000 0.000 0.988 0.000 0.012
#> GSM182785     3  0.4725     0.1831 0.000 0.080 0.720 0.000 0.200
#> GSM182786     2  0.0000     0.5000 0.000 1.000 0.000 0.000 0.000
#> GSM182787     3  0.6672    -0.6304 0.000 0.232 0.392 0.000 0.376
#> GSM182788     2  0.0000     0.5000 0.000 1.000 0.000 0.000 0.000
#> GSM182789     3  0.2423     0.5583 0.000 0.080 0.896 0.000 0.024
#> GSM182790     3  0.0324     0.6274 0.000 0.000 0.992 0.004 0.004
#> GSM182791     3  0.5365     0.5734 0.032 0.000 0.572 0.016 0.380
#> GSM182792     3  0.5365     0.5734 0.032 0.000 0.572 0.016 0.380
#> GSM182793     4  0.4147     0.6988 0.000 0.316 0.000 0.676 0.008
#> GSM182794     3  0.0324     0.6274 0.000 0.000 0.992 0.004 0.004
#> GSM182795     3  0.2563     0.5438 0.000 0.120 0.872 0.008 0.000
#> GSM182796     2  0.6560     0.4127 0.000 0.548 0.016 0.248 0.188
#> GSM182797     1  0.5903     0.6620 0.608 0.000 0.016 0.096 0.280
#> GSM182798     2  0.7135     0.2927 0.000 0.400 0.028 0.384 0.188
#> GSM182799     3  0.6307     0.5601 0.032 0.024 0.552 0.036 0.356
#> GSM182800     5  0.7643    -0.3100 0.288 0.004 0.304 0.036 0.368
#> GSM182801     3  0.6046     0.5059 0.108 0.000 0.512 0.004 0.376
#> GSM182814     1  0.0693     0.8107 0.980 0.000 0.000 0.012 0.008
#> GSM182815     4  0.5016     0.4970 0.184 0.076 0.000 0.724 0.016
#> GSM182816     1  0.0693     0.8107 0.980 0.000 0.000 0.012 0.008
#> GSM182817     2  0.9160     0.2321 0.212 0.308 0.036 0.256 0.188
#> GSM182818     1  0.1461     0.8031 0.952 0.000 0.004 0.016 0.028
#> GSM182819     1  0.0324     0.8137 0.992 0.000 0.000 0.004 0.004
#> GSM182820     1  0.5110     0.7081 0.680 0.000 0.000 0.096 0.224
#> GSM182821     3  0.6728     0.1160 0.032 0.172 0.616 0.020 0.160
#> GSM182822     1  0.0613     0.8132 0.984 0.000 0.004 0.004 0.008
#> GSM182823     1  0.0693     0.8107 0.980 0.000 0.000 0.012 0.008
#> GSM182824     1  0.0451     0.8128 0.988 0.000 0.000 0.008 0.004
#> GSM182825     1  0.0703     0.8118 0.976 0.000 0.000 0.024 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
#> GSM182755     4  0.6457     0.5283 0.080 0.000 0.200 0.604 0.068 0.048
#> GSM182756     3  0.6442     0.4347 0.000 0.036 0.504 0.188 0.004 0.268
#> GSM182757     3  0.1307     0.5624 0.000 0.008 0.952 0.008 0.032 0.000
#> GSM182758     3  0.6376     0.4224 0.000 0.036 0.488 0.188 0.000 0.288
#> GSM182759     3  0.4775     0.3236 0.000 0.188 0.720 0.008 0.040 0.044
#> GSM182760     3  0.6603     0.4167 0.000 0.040 0.472 0.196 0.004 0.288
#> GSM182761     3  0.1483     0.5574 0.000 0.012 0.944 0.008 0.036 0.000
#> GSM182762     3  0.2240     0.5653 0.000 0.000 0.904 0.008 0.056 0.032
#> GSM182763     3  0.2593     0.5447 0.000 0.012 0.884 0.000 0.036 0.068
#> GSM182764     3  0.1882     0.5508 0.000 0.012 0.920 0.008 0.060 0.000
#> GSM182765     3  0.3025     0.5562 0.000 0.004 0.856 0.004 0.060 0.076
#> GSM182766     3  0.6247    -0.0990 0.000 0.240 0.520 0.000 0.208 0.032
#> GSM182767     3  0.6547     0.4182 0.000 0.036 0.476 0.196 0.004 0.288
#> GSM182768     6  0.0405     0.6929 0.008 0.004 0.000 0.000 0.000 0.988
#> GSM182769     6  0.1196     0.6917 0.008 0.000 0.040 0.000 0.000 0.952
#> GSM182770     5  0.2146     0.6065 0.000 0.044 0.044 0.000 0.908 0.004
#> GSM182771     5  0.5965     0.3288 0.004 0.240 0.236 0.000 0.516 0.004
#> GSM182772     5  0.1511     0.6084 0.000 0.044 0.012 0.000 0.940 0.004
#> GSM182773     6  0.1265     0.6902 0.008 0.000 0.044 0.000 0.000 0.948
#> GSM182774     6  0.4292     0.1327 0.416 0.000 0.008 0.004 0.004 0.568
#> GSM182775     6  0.1265     0.6902 0.008 0.000 0.044 0.000 0.000 0.948
#> GSM182776     6  0.3648     0.6320 0.128 0.000 0.040 0.024 0.000 0.808
#> GSM182777     6  0.4879     0.3530 0.008 0.028 0.280 0.016 0.008 0.660
#> GSM182802     5  0.1440     0.6097 0.000 0.032 0.012 0.004 0.948 0.004
#> GSM182803     1  0.2484     0.8952 0.896 0.004 0.000 0.056 0.012 0.032
#> GSM182804     5  0.5772     0.4046 0.216 0.036 0.004 0.052 0.652 0.040
#> GSM182805     5  0.1829     0.6021 0.000 0.064 0.012 0.000 0.920 0.004
#> GSM182806     4  0.3834     0.8530 0.268 0.000 0.000 0.708 0.000 0.024
#> GSM182807     4  0.3766     0.8642 0.256 0.000 0.000 0.720 0.000 0.024
#> GSM182808     4  0.3789     0.8563 0.260 0.000 0.000 0.716 0.000 0.024
#> GSM182809     6  0.5427     0.1741 0.396 0.004 0.008 0.004 0.068 0.520
#> GSM182810     1  0.1989     0.9017 0.916 0.004 0.000 0.052 0.000 0.028
#> GSM182811     1  0.3565     0.7917 0.828 0.004 0.004 0.020 0.108 0.036
#> GSM182812     1  0.0000     0.9057 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM182813     4  0.3619     0.8676 0.232 0.000 0.000 0.744 0.000 0.024
#> GSM182778     2  0.1757     0.9938 0.000 0.916 0.008 0.000 0.076 0.000
#> GSM182779     3  0.2476     0.5415 0.000 0.012 0.900 0.008 0.036 0.044
#> GSM182780     6  0.6103     0.0809 0.000 0.004 0.308 0.100 0.048 0.540
#> GSM182781     3  0.6193     0.3670 0.000 0.036 0.500 0.120 0.004 0.340
#> GSM182782     2  0.1701     0.9979 0.000 0.920 0.008 0.000 0.072 0.000
#> GSM182783     6  0.5955     0.1751 0.000 0.004 0.268 0.100 0.048 0.580
#> GSM182784     3  0.6456     0.4378 0.000 0.036 0.504 0.196 0.004 0.260
#> GSM182785     3  0.3243     0.5667 0.000 0.016 0.844 0.076 0.000 0.064
#> GSM182786     2  0.1701     0.9979 0.000 0.920 0.008 0.000 0.072 0.000
#> GSM182787     3  0.4938     0.3625 0.000 0.180 0.712 0.008 0.036 0.064
#> GSM182788     2  0.1701     0.9979 0.000 0.920 0.008 0.000 0.072 0.000
#> GSM182789     3  0.5378     0.4255 0.000 0.008 0.576 0.112 0.000 0.304
#> GSM182790     3  0.6603     0.4167 0.000 0.040 0.472 0.196 0.004 0.288
#> GSM182791     6  0.0551     0.6925 0.008 0.004 0.004 0.000 0.000 0.984
#> GSM182792     6  0.0405     0.6929 0.008 0.004 0.000 0.000 0.000 0.988
#> GSM182793     5  0.2179     0.5930 0.000 0.004 0.064 0.016 0.908 0.008
#> GSM182794     3  0.6603     0.4167 0.000 0.040 0.472 0.196 0.004 0.288
#> GSM182795     6  0.5423     0.1360 0.000 0.004 0.308 0.112 0.004 0.572
#> GSM182796     5  0.6114     0.1602 0.000 0.348 0.236 0.000 0.412 0.004
#> GSM182797     4  0.4446     0.7891 0.152 0.000 0.004 0.724 0.000 0.120
#> GSM182798     5  0.5884     0.3161 0.000 0.252 0.236 0.000 0.508 0.004
#> GSM182799     6  0.1652     0.6815 0.004 0.004 0.004 0.004 0.048 0.936
#> GSM182800     6  0.5101     0.4657 0.208 0.008 0.000 0.048 0.048 0.688
#> GSM182801     6  0.1196     0.6917 0.008 0.000 0.040 0.000 0.000 0.952
#> GSM182814     1  0.0000     0.9057 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM182815     5  0.5644     0.4072 0.236 0.032 0.004 0.044 0.648 0.036
#> GSM182816     1  0.0000     0.9057 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM182817     5  0.7387     0.3477 0.244 0.004 0.232 0.044 0.440 0.036
#> GSM182818     1  0.2393     0.8938 0.892 0.000 0.000 0.064 0.004 0.040
#> GSM182819     1  0.2145     0.8920 0.900 0.000 0.000 0.072 0.000 0.028
#> GSM182820     4  0.3670     0.8698 0.240 0.000 0.000 0.736 0.000 0.024
#> GSM182821     6  0.6086    -0.0236 0.016 0.000 0.416 0.028 0.080 0.460
#> GSM182822     1  0.2972     0.8274 0.836 0.000 0.000 0.128 0.000 0.036
#> GSM182823     1  0.0146     0.9048 0.996 0.000 0.000 0.004 0.000 0.000
#> GSM182824     1  0.0260     0.9084 0.992 0.000 0.000 0.000 0.000 0.008
#> GSM182825     1  0.2544     0.8785 0.896 0.004 0.000 0.024 0.048 0.028

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

consensus_heatmap(res, k = 2)

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 stress(p) development.stage(p) k
#> MAD:mclust 70    0.6019             2.32e-04 2
#> MAD:mclust 51    0.3884             1.12e-07 3
#> MAD:mclust 49    0.0924             6.36e-09 4
#> MAD:mclust 50    0.1177             1.17e-08 5
#> MAD:mclust 45    0.0652             2.15e-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: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 18172 rows and 71 columns.
#>   Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'MAD' method.
#>   Subgroups are detected by 'NMF' method.
#>   Performed in total 1250 partitions by row resampling.
#>   Best k for subgroups seems to be 2.
#> 
#> Following methods can be applied to this 'ConsensusPartition' object:
#>  [1] "cola_report"             "collect_classes"         "collect_plots"          
#>  [4] "collect_stats"           "colnames"                "compare_signatures"     
#>  [7] "consensus_heatmap"       "dimension_reduction"     "functional_enrichment"  
#> [10] "get_anno_col"            "get_anno"                "get_classes"            
#> [13] "get_consensus"           "get_matrix"              "get_membership"         
#> [16] "get_param"               "get_signatures"          "get_stats"              
#> [19] "is_best_k"               "is_stable_k"             "membership_heatmap"     
#> [22] "ncol"                    "nrow"                    "plot_ecdf"              
#> [25] "rownames"                "select_partition_number" "show"                   
#> [28] "suggest_best_k"          "test_to_known_factors"

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

collect_plots(res)

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.940           0.944       0.975         0.5058 0.493   0.493
#> 3 3 0.602           0.730       0.873         0.3130 0.697   0.465
#> 4 4 0.812           0.831       0.916         0.1149 0.776   0.456
#> 5 5 0.717           0.762       0.857         0.0432 0.918   0.721
#> 6 6 0.653           0.564       0.752         0.0547 0.939   0.756

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
#> GSM182755     1  0.7219      0.744 0.800 0.200
#> GSM182756     2  0.0000      0.968 0.000 1.000
#> GSM182757     2  0.0000      0.968 0.000 1.000
#> GSM182758     2  0.0000      0.968 0.000 1.000
#> GSM182759     2  0.0000      0.968 0.000 1.000
#> GSM182760     2  0.6973      0.770 0.188 0.812
#> GSM182761     2  0.0000      0.968 0.000 1.000
#> GSM182762     2  0.5059      0.864 0.112 0.888
#> GSM182763     2  0.0000      0.968 0.000 1.000
#> GSM182764     2  0.0000      0.968 0.000 1.000
#> GSM182765     2  0.0000      0.968 0.000 1.000
#> GSM182766     2  0.0000      0.968 0.000 1.000
#> GSM182767     2  0.0376      0.965 0.004 0.996
#> GSM182768     1  0.0000      0.980 1.000 0.000
#> GSM182769     1  0.0000      0.980 1.000 0.000
#> GSM182770     2  0.0000      0.968 0.000 1.000
#> GSM182771     2  0.0000      0.968 0.000 1.000
#> GSM182772     2  0.0000      0.968 0.000 1.000
#> GSM182773     1  0.0376      0.977 0.996 0.004
#> GSM182774     1  0.0000      0.980 1.000 0.000
#> GSM182775     1  0.0000      0.980 1.000 0.000
#> GSM182776     1  0.0000      0.980 1.000 0.000
#> GSM182777     1  0.0000      0.980 1.000 0.000
#> GSM182802     2  0.0000      0.968 0.000 1.000
#> GSM182803     1  0.0000      0.980 1.000 0.000
#> GSM182804     1  0.0000      0.980 1.000 0.000
#> GSM182805     2  0.0000      0.968 0.000 1.000
#> GSM182806     1  0.0000      0.980 1.000 0.000
#> GSM182807     1  0.0000      0.980 1.000 0.000
#> GSM182808     1  0.0000      0.980 1.000 0.000
#> GSM182809     1  0.0000      0.980 1.000 0.000
#> GSM182810     1  0.0000      0.980 1.000 0.000
#> GSM182811     1  0.0000      0.980 1.000 0.000
#> GSM182812     1  0.0000      0.980 1.000 0.000
#> GSM182813     1  0.0000      0.980 1.000 0.000
#> GSM182778     2  0.0000      0.968 0.000 1.000
#> GSM182779     2  0.0000      0.968 0.000 1.000
#> GSM182780     2  0.0000      0.968 0.000 1.000
#> GSM182781     2  0.9686      0.368 0.396 0.604
#> GSM182782     2  0.0000      0.968 0.000 1.000
#> GSM182783     2  0.0000      0.968 0.000 1.000
#> GSM182784     2  0.0000      0.968 0.000 1.000
#> GSM182785     2  0.0000      0.968 0.000 1.000
#> GSM182786     2  0.0000      0.968 0.000 1.000
#> GSM182787     2  0.0000      0.968 0.000 1.000
#> GSM182788     2  0.0000      0.968 0.000 1.000
#> GSM182789     2  0.0000      0.968 0.000 1.000
#> GSM182790     2  0.9000      0.555 0.316 0.684
#> GSM182791     1  0.4161      0.902 0.916 0.084
#> GSM182792     1  0.0000      0.980 1.000 0.000
#> GSM182793     2  0.0000      0.968 0.000 1.000
#> GSM182794     2  0.3879      0.901 0.076 0.924
#> GSM182795     2  0.0000      0.968 0.000 1.000
#> GSM182796     2  0.0000      0.968 0.000 1.000
#> GSM182797     1  0.0000      0.980 1.000 0.000
#> GSM182798     2  0.0000      0.968 0.000 1.000
#> GSM182799     1  0.3733      0.914 0.928 0.072
#> GSM182800     1  0.0000      0.980 1.000 0.000
#> GSM182801     1  0.0000      0.980 1.000 0.000
#> GSM182814     1  0.0000      0.980 1.000 0.000
#> GSM182815     1  0.1633      0.961 0.976 0.024
#> GSM182816     1  0.0000      0.980 1.000 0.000
#> GSM182817     1  0.8207      0.651 0.744 0.256
#> GSM182818     1  0.0000      0.980 1.000 0.000
#> GSM182819     1  0.0000      0.980 1.000 0.000
#> GSM182820     1  0.0000      0.980 1.000 0.000
#> GSM182821     2  0.0672      0.962 0.008 0.992
#> GSM182822     1  0.0000      0.980 1.000 0.000
#> GSM182823     1  0.0000      0.980 1.000 0.000
#> GSM182824     1  0.0000      0.980 1.000 0.000
#> GSM182825     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
#> GSM182755     3  0.4324      0.736 0.028 0.112 0.860
#> GSM182756     3  0.4796      0.518 0.000 0.220 0.780
#> GSM182757     2  0.4842      0.748 0.000 0.776 0.224
#> GSM182758     2  0.6008      0.603 0.000 0.628 0.372
#> GSM182759     2  0.0237      0.862 0.000 0.996 0.004
#> GSM182760     3  0.0237      0.785 0.000 0.004 0.996
#> GSM182761     2  0.4346      0.776 0.000 0.816 0.184
#> GSM182762     3  0.5327      0.572 0.000 0.272 0.728
#> GSM182763     2  0.0237      0.862 0.000 0.996 0.004
#> GSM182764     2  0.0592      0.860 0.000 0.988 0.012
#> GSM182765     2  0.0424      0.861 0.000 0.992 0.008
#> GSM182766     2  0.0237      0.862 0.000 0.996 0.004
#> GSM182767     3  0.1643      0.766 0.000 0.044 0.956
#> GSM182768     3  0.5506      0.591 0.220 0.016 0.764
#> GSM182769     3  0.0237      0.786 0.004 0.000 0.996
#> GSM182770     2  0.0000      0.862 0.000 1.000 0.000
#> GSM182771     2  0.0000      0.862 0.000 1.000 0.000
#> GSM182772     2  0.0000      0.862 0.000 1.000 0.000
#> GSM182773     3  0.0000      0.786 0.000 0.000 1.000
#> GSM182774     1  0.6295     -0.126 0.528 0.000 0.472
#> GSM182775     3  0.0237      0.786 0.004 0.000 0.996
#> GSM182776     3  0.2959      0.761 0.100 0.000 0.900
#> GSM182777     3  0.0000      0.786 0.000 0.000 1.000
#> GSM182802     1  0.6045      0.368 0.620 0.380 0.000
#> GSM182803     1  0.3412      0.783 0.876 0.000 0.124
#> GSM182804     1  0.0000      0.882 1.000 0.000 0.000
#> GSM182805     2  0.1411      0.842 0.036 0.964 0.000
#> GSM182806     3  0.6079      0.444 0.388 0.000 0.612
#> GSM182807     3  0.6026      0.469 0.376 0.000 0.624
#> GSM182808     3  0.6026      0.469 0.376 0.000 0.624
#> GSM182809     1  0.0000      0.882 1.000 0.000 0.000
#> GSM182810     1  0.0000      0.882 1.000 0.000 0.000
#> GSM182811     1  0.0000      0.882 1.000 0.000 0.000
#> GSM182812     1  0.0000      0.882 1.000 0.000 0.000
#> GSM182813     3  0.5968      0.487 0.364 0.000 0.636
#> GSM182778     2  0.0000      0.862 0.000 1.000 0.000
#> GSM182779     2  0.0000      0.862 0.000 1.000 0.000
#> GSM182780     2  0.4750      0.753 0.000 0.784 0.216
#> GSM182781     3  0.0000      0.786 0.000 0.000 1.000
#> GSM182782     2  0.0000      0.862 0.000 1.000 0.000
#> GSM182783     2  0.5785      0.651 0.000 0.668 0.332
#> GSM182784     2  0.6225      0.502 0.000 0.568 0.432
#> GSM182785     2  0.5988      0.608 0.000 0.632 0.368
#> GSM182786     2  0.0000      0.862 0.000 1.000 0.000
#> GSM182787     2  0.0424      0.861 0.000 0.992 0.008
#> GSM182788     2  0.0000      0.862 0.000 1.000 0.000
#> GSM182789     2  0.5905      0.628 0.000 0.648 0.352
#> GSM182790     3  0.0000      0.786 0.000 0.000 1.000
#> GSM182791     2  0.6244      0.482 0.000 0.560 0.440
#> GSM182792     3  0.0000      0.786 0.000 0.000 1.000
#> GSM182793     2  0.2261      0.819 0.068 0.932 0.000
#> GSM182794     3  0.1643      0.767 0.000 0.044 0.956
#> GSM182795     2  0.5835      0.643 0.000 0.660 0.340
#> GSM182796     2  0.0000      0.862 0.000 1.000 0.000
#> GSM182797     3  0.3340      0.749 0.120 0.000 0.880
#> GSM182798     2  0.0000      0.862 0.000 1.000 0.000
#> GSM182799     1  0.4842      0.597 0.776 0.000 0.224
#> GSM182800     1  0.3941      0.739 0.844 0.000 0.156
#> GSM182801     3  0.4399      0.699 0.188 0.000 0.812
#> GSM182814     1  0.0000      0.882 1.000 0.000 0.000
#> GSM182815     1  0.0000      0.882 1.000 0.000 0.000
#> GSM182816     1  0.1163      0.869 0.972 0.000 0.028
#> GSM182817     2  0.6473      0.445 0.332 0.652 0.016
#> GSM182818     1  0.0237      0.881 0.996 0.000 0.004
#> GSM182819     3  0.6305      0.192 0.484 0.000 0.516
#> GSM182820     3  0.5968      0.487 0.364 0.000 0.636
#> GSM182821     2  0.0000      0.862 0.000 1.000 0.000
#> GSM182822     1  0.0592      0.878 0.988 0.000 0.012
#> GSM182823     1  0.3192      0.796 0.888 0.000 0.112
#> GSM182824     1  0.0592      0.878 0.988 0.000 0.012
#> GSM182825     1  0.0000      0.882 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
#> GSM182755     1  0.0000     0.8369 1.000 0.000 0.000 0.000
#> GSM182756     3  0.1297     0.9196 0.016 0.020 0.964 0.000
#> GSM182757     2  0.2281     0.8690 0.000 0.904 0.096 0.000
#> GSM182758     3  0.0188     0.9332 0.000 0.004 0.996 0.000
#> GSM182759     2  0.0336     0.9363 0.000 0.992 0.008 0.000
#> GSM182760     3  0.0376     0.9329 0.004 0.004 0.992 0.000
#> GSM182761     2  0.3400     0.7769 0.000 0.820 0.180 0.000
#> GSM182762     1  0.5511     0.0159 0.500 0.484 0.016 0.000
#> GSM182763     2  0.0921     0.9289 0.000 0.972 0.028 0.000
#> GSM182764     2  0.0000     0.9374 0.000 1.000 0.000 0.000
#> GSM182765     2  0.0921     0.9261 0.000 0.972 0.028 0.000
#> GSM182766     2  0.0000     0.9374 0.000 1.000 0.000 0.000
#> GSM182767     3  0.0188     0.9332 0.000 0.004 0.996 0.000
#> GSM182768     3  0.0469     0.9298 0.000 0.000 0.988 0.012
#> GSM182769     3  0.0657     0.9290 0.012 0.000 0.984 0.004
#> GSM182770     2  0.0188     0.9377 0.000 0.996 0.004 0.000
#> GSM182771     2  0.0188     0.9357 0.000 0.996 0.000 0.004
#> GSM182772     2  0.0000     0.9374 0.000 1.000 0.000 0.000
#> GSM182773     3  0.0000     0.9325 0.000 0.000 1.000 0.000
#> GSM182774     1  0.5137     0.2703 0.544 0.004 0.000 0.452
#> GSM182775     3  0.0469     0.9297 0.012 0.000 0.988 0.000
#> GSM182776     3  0.5161     0.1894 0.476 0.000 0.520 0.004
#> GSM182777     3  0.3486     0.7815 0.188 0.000 0.812 0.000
#> GSM182802     2  0.3569     0.7528 0.000 0.804 0.000 0.196
#> GSM182803     1  0.4072     0.5581 0.748 0.000 0.000 0.252
#> GSM182804     4  0.0000     0.8301 0.000 0.000 0.000 1.000
#> GSM182805     2  0.0188     0.9377 0.000 0.996 0.004 0.000
#> GSM182806     1  0.0188     0.8387 0.996 0.000 0.000 0.004
#> GSM182807     1  0.0188     0.8387 0.996 0.000 0.000 0.004
#> GSM182808     1  0.0524     0.8356 0.988 0.000 0.008 0.004
#> GSM182809     4  0.1109     0.8432 0.028 0.000 0.004 0.968
#> GSM182810     4  0.3528     0.8264 0.192 0.000 0.000 0.808
#> GSM182811     4  0.2610     0.8471 0.088 0.012 0.000 0.900
#> GSM182812     4  0.1474     0.8479 0.052 0.000 0.000 0.948
#> GSM182813     1  0.0188     0.8387 0.996 0.000 0.000 0.004
#> GSM182778     2  0.0188     0.9377 0.000 0.996 0.004 0.000
#> GSM182779     2  0.0188     0.9377 0.000 0.996 0.004 0.000
#> GSM182780     3  0.0657     0.9309 0.004 0.012 0.984 0.000
#> GSM182781     3  0.3726     0.7436 0.212 0.000 0.788 0.000
#> GSM182782     2  0.0188     0.9377 0.000 0.996 0.004 0.000
#> GSM182783     3  0.0336     0.9319 0.000 0.008 0.992 0.000
#> GSM182784     3  0.0188     0.9332 0.000 0.004 0.996 0.000
#> GSM182785     3  0.1661     0.8990 0.004 0.052 0.944 0.000
#> GSM182786     2  0.0188     0.9377 0.000 0.996 0.004 0.000
#> GSM182787     2  0.1118     0.9237 0.000 0.964 0.036 0.000
#> GSM182788     2  0.0188     0.9377 0.000 0.996 0.004 0.000
#> GSM182789     3  0.0188     0.9332 0.000 0.004 0.996 0.000
#> GSM182790     3  0.0376     0.9329 0.004 0.004 0.992 0.000
#> GSM182791     3  0.0469     0.9298 0.000 0.000 0.988 0.012
#> GSM182792     3  0.0188     0.9320 0.004 0.000 0.996 0.000
#> GSM182793     2  0.5636     0.3402 0.000 0.552 0.024 0.424
#> GSM182794     3  0.0188     0.9332 0.000 0.004 0.996 0.000
#> GSM182795     3  0.0188     0.9332 0.000 0.004 0.996 0.000
#> GSM182796     2  0.0000     0.9374 0.000 1.000 0.000 0.000
#> GSM182797     1  0.0000     0.8369 1.000 0.000 0.000 0.000
#> GSM182798     2  0.0000     0.9374 0.000 1.000 0.000 0.000
#> GSM182799     3  0.3649     0.7613 0.000 0.000 0.796 0.204
#> GSM182800     4  0.2281     0.7507 0.000 0.000 0.096 0.904
#> GSM182801     3  0.4458     0.7762 0.116 0.000 0.808 0.076
#> GSM182814     4  0.3688     0.8175 0.208 0.000 0.000 0.792
#> GSM182815     4  0.0188     0.8325 0.004 0.000 0.000 0.996
#> GSM182816     4  0.3791     0.8203 0.200 0.000 0.004 0.796
#> GSM182817     2  0.2918     0.8373 0.116 0.876 0.000 0.008
#> GSM182818     4  0.3908     0.8105 0.212 0.000 0.004 0.784
#> GSM182819     1  0.1557     0.8091 0.944 0.000 0.000 0.056
#> GSM182820     1  0.0188     0.8387 0.996 0.000 0.000 0.004
#> GSM182821     2  0.3013     0.8658 0.080 0.888 0.032 0.000
#> GSM182822     4  0.4837     0.6162 0.348 0.000 0.004 0.648
#> GSM182823     1  0.3024     0.7197 0.852 0.000 0.000 0.148
#> GSM182824     4  0.4155     0.7867 0.240 0.000 0.004 0.756
#> GSM182825     4  0.0000     0.8301 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
#> GSM182755     2  0.1202     0.6730 0.032 0.960 0.004 0.000 0.004
#> GSM182756     3  0.3902     0.8271 0.000 0.152 0.804 0.028 0.016
#> GSM182757     5  0.4044     0.7878 0.000 0.148 0.024 0.028 0.800
#> GSM182758     3  0.0807     0.8936 0.000 0.012 0.976 0.012 0.000
#> GSM182759     5  0.1568     0.8647 0.000 0.036 0.000 0.020 0.944
#> GSM182760     3  0.1952     0.8819 0.000 0.084 0.912 0.004 0.000
#> GSM182761     5  0.4998     0.7238 0.000 0.044 0.160 0.052 0.744
#> GSM182762     2  0.3827     0.5256 0.000 0.812 0.020 0.024 0.144
#> GSM182763     5  0.2420     0.8633 0.000 0.036 0.036 0.016 0.912
#> GSM182764     5  0.1798     0.8627 0.000 0.064 0.004 0.004 0.928
#> GSM182765     5  0.5287     0.6120 0.000 0.260 0.004 0.080 0.656
#> GSM182766     5  0.1518     0.8663 0.000 0.004 0.004 0.048 0.944
#> GSM182767     3  0.1074     0.8884 0.000 0.012 0.968 0.016 0.004
#> GSM182768     3  0.0963     0.8912 0.000 0.000 0.964 0.036 0.000
#> GSM182769     3  0.2313     0.8907 0.012 0.032 0.916 0.040 0.000
#> GSM182770     5  0.0854     0.8706 0.000 0.008 0.004 0.012 0.976
#> GSM182771     5  0.4351     0.7605 0.000 0.100 0.000 0.132 0.768
#> GSM182772     5  0.0794     0.8685 0.000 0.000 0.000 0.028 0.972
#> GSM182773     3  0.0404     0.8924 0.000 0.000 0.988 0.012 0.000
#> GSM182774     4  0.5222     0.4453 0.020 0.244 0.012 0.692 0.032
#> GSM182775     3  0.3059     0.8679 0.004 0.108 0.860 0.028 0.000
#> GSM182776     3  0.4524     0.6131 0.020 0.336 0.644 0.000 0.000
#> GSM182777     3  0.3477     0.8426 0.024 0.140 0.828 0.008 0.000
#> GSM182802     5  0.3019     0.8211 0.088 0.000 0.000 0.048 0.864
#> GSM182803     1  0.1124     0.8209 0.960 0.036 0.000 0.004 0.000
#> GSM182804     4  0.3074     0.7260 0.196 0.000 0.000 0.804 0.000
#> GSM182805     5  0.4063     0.7775 0.112 0.020 0.000 0.056 0.812
#> GSM182806     1  0.4262     0.2608 0.560 0.440 0.000 0.000 0.000
#> GSM182807     1  0.3752     0.6052 0.708 0.292 0.000 0.000 0.000
#> GSM182808     1  0.3006     0.7589 0.836 0.156 0.004 0.004 0.000
#> GSM182809     1  0.2574     0.7360 0.876 0.012 0.000 0.112 0.000
#> GSM182810     1  0.1357     0.8126 0.948 0.004 0.000 0.048 0.000
#> GSM182811     1  0.0963     0.8158 0.964 0.000 0.000 0.036 0.000
#> GSM182812     4  0.3707     0.7087 0.284 0.000 0.000 0.716 0.000
#> GSM182813     2  0.4182     0.0917 0.400 0.600 0.000 0.000 0.000
#> GSM182778     5  0.1883     0.8602 0.000 0.012 0.008 0.048 0.932
#> GSM182779     5  0.1630     0.8711 0.000 0.036 0.004 0.016 0.944
#> GSM182780     3  0.1731     0.8912 0.000 0.012 0.940 0.040 0.008
#> GSM182781     3  0.5184     0.3479 0.000 0.456 0.508 0.032 0.004
#> GSM182782     5  0.1285     0.8664 0.000 0.004 0.004 0.036 0.956
#> GSM182783     3  0.1300     0.8936 0.000 0.016 0.956 0.028 0.000
#> GSM182784     3  0.1393     0.8830 0.000 0.012 0.956 0.024 0.008
#> GSM182785     3  0.3592     0.8401 0.000 0.124 0.832 0.016 0.028
#> GSM182786     5  0.1770     0.8615 0.000 0.008 0.008 0.048 0.936
#> GSM182787     5  0.4565     0.7757 0.012 0.020 0.116 0.060 0.792
#> GSM182788     5  0.1644     0.8628 0.000 0.004 0.008 0.048 0.940
#> GSM182789     3  0.2228     0.8621 0.000 0.016 0.920 0.044 0.020
#> GSM182790     3  0.2006     0.8846 0.000 0.072 0.916 0.012 0.000
#> GSM182791     3  0.1608     0.8858 0.000 0.000 0.928 0.072 0.000
#> GSM182792     3  0.2535     0.8838 0.000 0.032 0.892 0.076 0.000
#> GSM182793     4  0.2112     0.6289 0.004 0.000 0.004 0.908 0.084
#> GSM182794     3  0.0798     0.8944 0.000 0.016 0.976 0.008 0.000
#> GSM182795     3  0.1130     0.8881 0.004 0.012 0.968 0.012 0.004
#> GSM182796     5  0.0671     0.8687 0.000 0.004 0.000 0.016 0.980
#> GSM182797     2  0.1892     0.6752 0.080 0.916 0.004 0.000 0.000
#> GSM182798     5  0.3420     0.8187 0.000 0.084 0.000 0.076 0.840
#> GSM182799     3  0.2069     0.8794 0.000 0.012 0.912 0.076 0.000
#> GSM182800     4  0.3278     0.6589 0.056 0.024 0.052 0.868 0.000
#> GSM182801     3  0.5582     0.6852 0.152 0.052 0.708 0.088 0.000
#> GSM182814     1  0.1894     0.7956 0.920 0.008 0.000 0.072 0.000
#> GSM182815     4  0.4114     0.6129 0.376 0.000 0.000 0.624 0.000
#> GSM182816     1  0.1282     0.8145 0.952 0.004 0.000 0.044 0.000
#> GSM182817     5  0.4996     0.5506 0.280 0.004 0.000 0.052 0.664
#> GSM182818     1  0.1211     0.8142 0.960 0.016 0.000 0.024 0.000
#> GSM182819     1  0.1965     0.8050 0.904 0.096 0.000 0.000 0.000
#> GSM182820     1  0.3243     0.7271 0.812 0.180 0.004 0.004 0.000
#> GSM182821     1  0.6382     0.4789 0.668 0.024 0.072 0.064 0.172
#> GSM182822     1  0.1197     0.8120 0.952 0.000 0.000 0.048 0.000
#> GSM182823     1  0.3934     0.6719 0.740 0.244 0.000 0.016 0.000
#> GSM182824     1  0.0703     0.8189 0.976 0.000 0.000 0.024 0.000
#> GSM182825     4  0.4138     0.5908 0.384 0.000 0.000 0.616 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
#> GSM182755     5  0.1471     0.6471 0.000 0.000 0.004 0.000 0.932 0.064
#> GSM182756     6  0.5014     0.4113 0.000 0.008 0.368 0.000 0.060 0.564
#> GSM182757     6  0.5989     0.3601 0.000 0.288 0.088 0.000 0.064 0.560
#> GSM182758     3  0.3634     0.3971 0.000 0.000 0.696 0.000 0.008 0.296
#> GSM182759     2  0.0993     0.8153 0.000 0.964 0.000 0.000 0.024 0.012
#> GSM182760     3  0.3979     0.4360 0.000 0.000 0.708 0.000 0.036 0.256
#> GSM182761     6  0.5618     0.2991 0.000 0.312 0.100 0.008 0.012 0.568
#> GSM182762     5  0.4173     0.5243 0.000 0.056 0.016 0.000 0.752 0.176
#> GSM182763     2  0.4459     0.7439 0.000 0.772 0.068 0.008 0.044 0.108
#> GSM182764     2  0.2750     0.8045 0.000 0.868 0.000 0.004 0.080 0.048
#> GSM182765     2  0.6551     0.4711 0.000 0.544 0.020 0.048 0.252 0.136
#> GSM182766     2  0.4041     0.6697 0.000 0.736 0.040 0.008 0.000 0.216
#> GSM182767     3  0.2191     0.6056 0.004 0.000 0.876 0.000 0.000 0.120
#> GSM182768     3  0.1633     0.6266 0.000 0.000 0.932 0.024 0.000 0.044
#> GSM182769     3  0.3819     0.5747 0.032 0.000 0.788 0.000 0.028 0.152
#> GSM182770     2  0.1333     0.8171 0.000 0.944 0.000 0.008 0.000 0.048
#> GSM182771     2  0.3441     0.7783 0.000 0.832 0.000 0.076 0.072 0.020
#> GSM182772     2  0.1218     0.8197 0.000 0.956 0.000 0.012 0.004 0.028
#> GSM182773     3  0.1663     0.6185 0.000 0.000 0.912 0.000 0.000 0.088
#> GSM182774     4  0.6591     0.2392 0.008 0.004 0.028 0.460 0.164 0.336
#> GSM182775     3  0.3324     0.6018 0.000 0.000 0.824 0.004 0.060 0.112
#> GSM182776     6  0.7366     0.2387 0.068 0.000 0.280 0.012 0.296 0.344
#> GSM182777     3  0.4449     0.5527 0.040 0.000 0.760 0.000 0.108 0.092
#> GSM182802     2  0.2885     0.7834 0.044 0.868 0.000 0.076 0.004 0.008
#> GSM182803     1  0.1500     0.7802 0.936 0.000 0.000 0.000 0.052 0.012
#> GSM182804     4  0.1663     0.6564 0.088 0.000 0.000 0.912 0.000 0.000
#> GSM182805     2  0.4142     0.6964 0.168 0.752 0.000 0.008 0.000 0.072
#> GSM182806     1  0.4602     0.0471 0.492 0.000 0.000 0.004 0.476 0.028
#> GSM182807     1  0.3349     0.6616 0.748 0.000 0.000 0.000 0.244 0.008
#> GSM182808     1  0.2944     0.7342 0.832 0.000 0.008 0.000 0.148 0.012
#> GSM182809     1  0.2311     0.7490 0.880 0.000 0.000 0.104 0.000 0.016
#> GSM182810     1  0.3229     0.7169 0.828 0.000 0.000 0.120 0.004 0.048
#> GSM182811     1  0.2451     0.7634 0.888 0.000 0.000 0.068 0.004 0.040
#> GSM182812     4  0.3876     0.6334 0.156 0.000 0.000 0.772 0.004 0.068
#> GSM182813     5  0.3993     0.0364 0.400 0.000 0.000 0.000 0.592 0.008
#> GSM182778     2  0.2257     0.7951 0.000 0.876 0.000 0.008 0.000 0.116
#> GSM182779     2  0.3820     0.7100 0.000 0.756 0.008 0.000 0.032 0.204
#> GSM182780     6  0.4456     0.2959 0.000 0.004 0.456 0.020 0.000 0.520
#> GSM182781     6  0.5434     0.4658 0.000 0.000 0.268 0.004 0.148 0.580
#> GSM182782     2  0.1049     0.8182 0.000 0.960 0.000 0.008 0.000 0.032
#> GSM182783     6  0.3997     0.2145 0.000 0.000 0.488 0.004 0.000 0.508
#> GSM182784     3  0.3945     0.2082 0.000 0.000 0.612 0.008 0.000 0.380
#> GSM182785     6  0.5314     0.4388 0.000 0.024 0.348 0.004 0.052 0.572
#> GSM182786     2  0.1196     0.8162 0.000 0.952 0.000 0.008 0.000 0.040
#> GSM182787     2  0.5014     0.4181 0.000 0.564 0.060 0.008 0.000 0.368
#> GSM182788     2  0.0858     0.8171 0.000 0.968 0.000 0.004 0.000 0.028
#> GSM182789     3  0.4325    -0.1386 0.000 0.008 0.504 0.008 0.000 0.480
#> GSM182790     3  0.4246     0.1316 0.000 0.000 0.580 0.000 0.020 0.400
#> GSM182791     3  0.5034     0.4696 0.000 0.000 0.672 0.172 0.012 0.144
#> GSM182792     3  0.3566     0.6061 0.000 0.000 0.812 0.076 0.008 0.104
#> GSM182793     4  0.3337     0.5927 0.000 0.060 0.020 0.852 0.012 0.056
#> GSM182794     3  0.3073     0.5907 0.000 0.000 0.816 0.004 0.016 0.164
#> GSM182795     3  0.3791     0.3951 0.004 0.008 0.688 0.000 0.000 0.300
#> GSM182796     2  0.0520     0.8152 0.000 0.984 0.000 0.000 0.008 0.008
#> GSM182797     5  0.1973     0.6480 0.064 0.000 0.012 0.004 0.916 0.004
#> GSM182798     2  0.4901     0.6563 0.000 0.712 0.000 0.168 0.068 0.052
#> GSM182799     3  0.4026     0.5257 0.000 0.000 0.752 0.160 0.000 0.088
#> GSM182800     4  0.3310     0.5909 0.000 0.000 0.048 0.848 0.052 0.052
#> GSM182801     3  0.5784     0.4917 0.080 0.000 0.688 0.120 0.052 0.060
#> GSM182814     1  0.3142     0.7329 0.840 0.000 0.000 0.108 0.008 0.044
#> GSM182815     4  0.4750     0.4647 0.340 0.000 0.000 0.596 0.000 0.064
#> GSM182816     1  0.2170     0.7820 0.908 0.000 0.000 0.060 0.016 0.016
#> GSM182817     2  0.5656     0.3892 0.324 0.556 0.000 0.008 0.012 0.100
#> GSM182818     1  0.1901     0.7785 0.924 0.000 0.008 0.028 0.000 0.040
#> GSM182819     1  0.2540     0.7670 0.872 0.000 0.000 0.004 0.104 0.020
#> GSM182820     1  0.3293     0.7220 0.824 0.000 0.008 0.000 0.128 0.040
#> GSM182821     1  0.6628     0.3788 0.592 0.164 0.100 0.012 0.008 0.124
#> GSM182822     1  0.0837     0.7863 0.972 0.000 0.000 0.004 0.004 0.020
#> GSM182823     1  0.4192     0.3498 0.572 0.000 0.000 0.016 0.412 0.000
#> GSM182824     1  0.1633     0.7881 0.932 0.000 0.000 0.044 0.024 0.000
#> GSM182825     4  0.4022     0.3914 0.360 0.000 0.000 0.628 0.004 0.008

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

consensus_heatmap(res, k = 2)

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 stress(p) development.stage(p) k
#> MAD:NMF 70     1.000             1.86e-05 2
#> MAD:NMF 61     0.234             6.34e-10 3
#> MAD:NMF 67     0.600             4.45e-09 4
#> MAD:NMF 66     0.766             9.43e-10 5
#> MAD:NMF 45     0.891             1.04e-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: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 18172 rows and 71 columns.
#>   Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'ATC' method.
#>   Subgroups are detected by 'hclust' method.
#>   Performed in total 1250 partitions by row resampling.
#>   Best k for subgroups seems to be 3.
#> 
#> Following methods can be applied to this 'ConsensusPartition' object:
#>  [1] "cola_report"             "collect_classes"         "collect_plots"          
#>  [4] "collect_stats"           "colnames"                "compare_signatures"     
#>  [7] "consensus_heatmap"       "dimension_reduction"     "functional_enrichment"  
#> [10] "get_anno_col"            "get_anno"                "get_classes"            
#> [13] "get_consensus"           "get_matrix"              "get_membership"         
#> [16] "get_param"               "get_signatures"          "get_stats"              
#> [19] "is_best_k"               "is_stable_k"             "membership_heatmap"     
#> [22] "ncol"                    "nrow"                    "plot_ecdf"              
#> [25] "rownames"                "select_partition_number" "show"                   
#> [28] "suggest_best_k"          "test_to_known_factors"

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

collect_plots(res)

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.358           0.718       0.834         0.4293 0.505   0.505
#> 3 3 0.524           0.774       0.878         0.3753 0.784   0.610
#> 4 4 0.558           0.611       0.789         0.1648 0.885   0.730
#> 5 5 0.611           0.499       0.739         0.0959 0.856   0.606
#> 6 6 0.725           0.631       0.801         0.0710 0.906   0.630

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
#> GSM182755     1  0.0000     0.8737 1.000 0.000
#> GSM182756     2  0.9998     0.3998 0.492 0.508
#> GSM182757     2  0.7883     0.8024 0.236 0.764
#> GSM182758     2  0.8763     0.7601 0.296 0.704
#> GSM182759     2  0.7139     0.8024 0.196 0.804
#> GSM182760     2  0.9988     0.4368 0.480 0.520
#> GSM182761     2  0.6887     0.7994 0.184 0.816
#> GSM182762     1  0.9970    -0.2950 0.532 0.468
#> GSM182763     2  0.7056     0.8017 0.192 0.808
#> GSM182764     2  0.7883     0.8024 0.236 0.764
#> GSM182765     2  0.8016     0.7999 0.244 0.756
#> GSM182766     2  0.0000     0.7109 0.000 1.000
#> GSM182767     2  0.9993     0.4253 0.484 0.516
#> GSM182768     2  0.9754     0.6051 0.408 0.592
#> GSM182769     1  0.0672     0.8716 0.992 0.008
#> GSM182770     2  0.0000     0.7109 0.000 1.000
#> GSM182771     2  0.7883     0.8024 0.236 0.764
#> GSM182772     2  0.0000     0.7109 0.000 1.000
#> GSM182773     1  0.1184     0.8682 0.984 0.016
#> GSM182774     1  0.3431     0.8336 0.936 0.064
#> GSM182775     1  0.0672     0.8716 0.992 0.008
#> GSM182776     1  0.3114     0.8409 0.944 0.056
#> GSM182777     1  0.6438     0.6992 0.836 0.164
#> GSM182802     2  0.0000     0.7109 0.000 1.000
#> GSM182803     1  0.0000     0.8737 1.000 0.000
#> GSM182804     2  0.8144     0.7964 0.252 0.748
#> GSM182805     2  0.0000     0.7109 0.000 1.000
#> GSM182806     1  0.0000     0.8737 1.000 0.000
#> GSM182807     1  0.0000     0.8737 1.000 0.000
#> GSM182808     1  0.0000     0.8737 1.000 0.000
#> GSM182809     2  0.8443     0.7829 0.272 0.728
#> GSM182810     1  0.2603     0.8500 0.956 0.044
#> GSM182811     1  0.7674     0.6027 0.776 0.224
#> GSM182812     1  0.0938     0.8688 0.988 0.012
#> GSM182813     1  0.0000     0.8737 1.000 0.000
#> GSM182778     2  0.0000     0.7109 0.000 1.000
#> GSM182779     2  0.7139     0.8024 0.196 0.804
#> GSM182780     2  0.7056     0.8017 0.192 0.808
#> GSM182781     1  0.9661     0.0498 0.608 0.392
#> GSM182782     2  0.0000     0.7109 0.000 1.000
#> GSM182783     2  0.2948     0.7368 0.052 0.948
#> GSM182784     2  0.9988     0.4368 0.480 0.520
#> GSM182785     2  0.8016     0.8005 0.244 0.756
#> GSM182786     2  0.0000     0.7109 0.000 1.000
#> GSM182787     2  0.6887     0.7994 0.184 0.816
#> GSM182788     2  0.0000     0.7109 0.000 1.000
#> GSM182789     2  0.8016     0.8005 0.244 0.756
#> GSM182790     1  0.9686     0.0336 0.604 0.396
#> GSM182791     2  0.9754     0.6051 0.408 0.592
#> GSM182792     2  0.9754     0.6051 0.408 0.592
#> GSM182793     2  0.0000     0.7109 0.000 1.000
#> GSM182794     1  0.9686     0.0336 0.604 0.396
#> GSM182795     2  0.8813     0.7559 0.300 0.700
#> GSM182796     2  0.7219     0.8028 0.200 0.800
#> GSM182797     1  0.0000     0.8737 1.000 0.000
#> GSM182798     2  0.7883     0.8024 0.236 0.764
#> GSM182799     2  0.8144     0.7964 0.252 0.748
#> GSM182800     1  0.3114     0.8409 0.944 0.056
#> GSM182801     1  0.0000     0.8737 1.000 0.000
#> GSM182814     1  0.0000     0.8737 1.000 0.000
#> GSM182815     2  0.8144     0.7964 0.252 0.748
#> GSM182816     1  0.0000     0.8737 1.000 0.000
#> GSM182817     2  0.9732     0.6117 0.404 0.596
#> GSM182818     2  0.8327     0.7885 0.264 0.736
#> GSM182819     1  0.0000     0.8737 1.000 0.000
#> GSM182820     1  0.0000     0.8737 1.000 0.000
#> GSM182821     2  0.9754     0.6051 0.408 0.592
#> GSM182822     1  0.7674     0.6027 0.776 0.224
#> GSM182823     1  0.0000     0.8737 1.000 0.000
#> GSM182824     1  0.0000     0.8737 1.000 0.000
#> GSM182825     1  0.0000     0.8737 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
#> GSM182755     1  0.0000      0.821 1.000 0.000 0.000
#> GSM182756     3  0.4750      0.702 0.216 0.000 0.784
#> GSM182757     3  0.1529      0.846 0.000 0.040 0.960
#> GSM182758     3  0.1585      0.846 0.028 0.008 0.964
#> GSM182759     3  0.2537      0.827 0.000 0.080 0.920
#> GSM182760     3  0.4605      0.718 0.204 0.000 0.796
#> GSM182761     3  0.2796      0.818 0.000 0.092 0.908
#> GSM182762     3  0.5254      0.624 0.264 0.000 0.736
#> GSM182763     3  0.2625      0.824 0.000 0.084 0.916
#> GSM182764     3  0.1529      0.846 0.000 0.040 0.960
#> GSM182765     3  0.1289      0.848 0.000 0.032 0.968
#> GSM182766     2  0.4235      0.847 0.000 0.824 0.176
#> GSM182767     3  0.4654      0.713 0.208 0.000 0.792
#> GSM182768     3  0.3551      0.789 0.132 0.000 0.868
#> GSM182769     1  0.4654      0.769 0.792 0.000 0.208
#> GSM182770     2  0.0000      0.927 0.000 1.000 0.000
#> GSM182771     3  0.1529      0.846 0.000 0.040 0.960
#> GSM182772     2  0.0000      0.927 0.000 1.000 0.000
#> GSM182773     1  0.5178      0.733 0.744 0.000 0.256
#> GSM182774     1  0.5529      0.677 0.704 0.000 0.296
#> GSM182775     1  0.4452      0.778 0.808 0.000 0.192
#> GSM182776     1  0.5178      0.727 0.744 0.000 0.256
#> GSM182777     1  0.6079      0.479 0.612 0.000 0.388
#> GSM182802     2  0.4399      0.836 0.000 0.812 0.188
#> GSM182803     1  0.0000      0.821 1.000 0.000 0.000
#> GSM182804     3  0.1031      0.850 0.000 0.024 0.976
#> GSM182805     2  0.4399      0.836 0.000 0.812 0.188
#> GSM182806     1  0.0000      0.821 1.000 0.000 0.000
#> GSM182807     1  0.0000      0.821 1.000 0.000 0.000
#> GSM182808     1  0.0000      0.821 1.000 0.000 0.000
#> GSM182809     3  0.1337      0.851 0.012 0.016 0.972
#> GSM182810     1  0.5098      0.737 0.752 0.000 0.248
#> GSM182811     1  0.6286      0.297 0.536 0.000 0.464
#> GSM182812     1  0.4974      0.753 0.764 0.000 0.236
#> GSM182813     1  0.0000      0.821 1.000 0.000 0.000
#> GSM182778     2  0.0000      0.927 0.000 1.000 0.000
#> GSM182779     3  0.2537      0.827 0.000 0.080 0.920
#> GSM182780     3  0.2625      0.824 0.000 0.084 0.916
#> GSM182781     3  0.5926      0.417 0.356 0.000 0.644
#> GSM182782     2  0.0000      0.927 0.000 1.000 0.000
#> GSM182783     3  0.5810      0.430 0.000 0.336 0.664
#> GSM182784     3  0.4605      0.718 0.204 0.000 0.796
#> GSM182785     3  0.1289      0.849 0.000 0.032 0.968
#> GSM182786     2  0.0000      0.927 0.000 1.000 0.000
#> GSM182787     3  0.2796      0.818 0.000 0.092 0.908
#> GSM182788     2  0.0000      0.927 0.000 1.000 0.000
#> GSM182789     3  0.1289      0.849 0.000 0.032 0.968
#> GSM182790     3  0.5905      0.427 0.352 0.000 0.648
#> GSM182791     3  0.3551      0.789 0.132 0.000 0.868
#> GSM182792     3  0.3551      0.789 0.132 0.000 0.868
#> GSM182793     2  0.2261      0.904 0.000 0.932 0.068
#> GSM182794     3  0.5905      0.427 0.352 0.000 0.648
#> GSM182795     3  0.1399      0.845 0.028 0.004 0.968
#> GSM182796     3  0.2448      0.829 0.000 0.076 0.924
#> GSM182797     1  0.0000      0.821 1.000 0.000 0.000
#> GSM182798     3  0.1529      0.846 0.000 0.040 0.960
#> GSM182799     3  0.1031      0.850 0.000 0.024 0.976
#> GSM182800     1  0.5178      0.727 0.744 0.000 0.256
#> GSM182801     1  0.1643      0.818 0.956 0.000 0.044
#> GSM182814     1  0.0000      0.821 1.000 0.000 0.000
#> GSM182815     3  0.1031      0.850 0.000 0.024 0.976
#> GSM182816     1  0.0000      0.821 1.000 0.000 0.000
#> GSM182817     3  0.3482      0.791 0.128 0.000 0.872
#> GSM182818     3  0.0592      0.850 0.000 0.012 0.988
#> GSM182819     1  0.0000      0.821 1.000 0.000 0.000
#> GSM182820     1  0.0000      0.821 1.000 0.000 0.000
#> GSM182821     3  0.3551      0.789 0.132 0.000 0.868
#> GSM182822     1  0.6286      0.297 0.536 0.000 0.464
#> GSM182823     1  0.0000      0.821 1.000 0.000 0.000
#> GSM182824     1  0.0000      0.821 1.000 0.000 0.000
#> GSM182825     1  0.4796      0.763 0.780 0.000 0.220

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM182755     1  0.0000      0.781 1.000 0.000 0.000 0.000
#> GSM182756     3  0.1297      0.581 0.016 0.000 0.964 0.020
#> GSM182757     3  0.5131      0.554 0.000 0.028 0.692 0.280
#> GSM182758     3  0.4360      0.589 0.000 0.008 0.744 0.248
#> GSM182759     3  0.6277      0.452 0.000 0.068 0.572 0.360
#> GSM182760     3  0.0895      0.586 0.004 0.000 0.976 0.020
#> GSM182761     3  0.6549      0.341 0.000 0.076 0.488 0.436
#> GSM182762     3  0.1716      0.545 0.064 0.000 0.936 0.000
#> GSM182763     3  0.6425      0.377 0.000 0.068 0.508 0.424
#> GSM182764     3  0.5131      0.554 0.000 0.028 0.692 0.280
#> GSM182765     3  0.4936      0.557 0.000 0.020 0.700 0.280
#> GSM182766     2  0.3768      0.778 0.000 0.808 0.008 0.184
#> GSM182767     3  0.1042      0.585 0.008 0.000 0.972 0.020
#> GSM182768     3  0.3208      0.602 0.004 0.000 0.848 0.148
#> GSM182769     1  0.5268      0.610 0.592 0.000 0.396 0.012
#> GSM182770     2  0.0000      0.905 0.000 1.000 0.000 0.000
#> GSM182771     3  0.5131      0.554 0.000 0.028 0.692 0.280
#> GSM182772     2  0.0000      0.905 0.000 1.000 0.000 0.000
#> GSM182773     1  0.4972      0.530 0.544 0.000 0.456 0.000
#> GSM182774     1  0.6319      0.523 0.504 0.000 0.436 0.060
#> GSM182775     1  0.4830      0.617 0.608 0.000 0.392 0.000
#> GSM182776     1  0.6079      0.576 0.544 0.000 0.408 0.048
#> GSM182777     3  0.4888     -0.229 0.412 0.000 0.588 0.000
#> GSM182802     2  0.4121      0.762 0.000 0.796 0.020 0.184
#> GSM182803     1  0.0336      0.780 0.992 0.000 0.008 0.000
#> GSM182804     4  0.2124      0.957 0.000 0.008 0.068 0.924
#> GSM182805     2  0.4121      0.762 0.000 0.796 0.020 0.184
#> GSM182806     1  0.0000      0.781 1.000 0.000 0.000 0.000
#> GSM182807     1  0.0000      0.781 1.000 0.000 0.000 0.000
#> GSM182808     1  0.0000      0.781 1.000 0.000 0.000 0.000
#> GSM182809     3  0.5321      0.369 0.004 0.004 0.528 0.464
#> GSM182810     1  0.6477      0.607 0.552 0.000 0.368 0.080
#> GSM182811     3  0.7143     -0.217 0.380 0.000 0.484 0.136
#> GSM182812     1  0.6992      0.631 0.564 0.000 0.280 0.156
#> GSM182813     1  0.0000      0.781 1.000 0.000 0.000 0.000
#> GSM182778     2  0.0000      0.905 0.000 1.000 0.000 0.000
#> GSM182779     3  0.5901      0.523 0.000 0.068 0.652 0.280
#> GSM182780     3  0.6425      0.377 0.000 0.068 0.508 0.424
#> GSM182781     3  0.3123      0.466 0.156 0.000 0.844 0.000
#> GSM182782     2  0.0000      0.905 0.000 1.000 0.000 0.000
#> GSM182783     3  0.7900     -0.110 0.000 0.320 0.372 0.308
#> GSM182784     3  0.1004      0.586 0.004 0.000 0.972 0.024
#> GSM182785     3  0.5543      0.509 0.000 0.028 0.612 0.360
#> GSM182786     2  0.0000      0.905 0.000 1.000 0.000 0.000
#> GSM182787     3  0.6549      0.341 0.000 0.076 0.488 0.436
#> GSM182788     2  0.0000      0.905 0.000 1.000 0.000 0.000
#> GSM182789     3  0.5543      0.509 0.000 0.028 0.612 0.360
#> GSM182790     3  0.3074      0.470 0.152 0.000 0.848 0.000
#> GSM182791     3  0.3052      0.604 0.004 0.000 0.860 0.136
#> GSM182792     3  0.3052      0.604 0.004 0.000 0.860 0.136
#> GSM182793     2  0.1978      0.877 0.000 0.928 0.004 0.068
#> GSM182794     3  0.3074      0.470 0.152 0.000 0.848 0.000
#> GSM182795     3  0.4053      0.595 0.000 0.004 0.768 0.228
#> GSM182796     3  0.5835      0.527 0.000 0.064 0.656 0.280
#> GSM182797     1  0.0000      0.781 1.000 0.000 0.000 0.000
#> GSM182798     3  0.5131      0.554 0.000 0.028 0.692 0.280
#> GSM182799     4  0.2124      0.957 0.000 0.008 0.068 0.924
#> GSM182800     1  0.6253      0.584 0.544 0.000 0.396 0.060
#> GSM182801     1  0.3764      0.726 0.784 0.000 0.216 0.000
#> GSM182814     1  0.0000      0.781 1.000 0.000 0.000 0.000
#> GSM182815     4  0.2124      0.957 0.000 0.008 0.068 0.924
#> GSM182816     1  0.0000      0.781 1.000 0.000 0.000 0.000
#> GSM182817     3  0.1867      0.607 0.000 0.000 0.928 0.072
#> GSM182818     4  0.0188      0.877 0.000 0.000 0.004 0.996
#> GSM182819     1  0.0000      0.781 1.000 0.000 0.000 0.000
#> GSM182820     1  0.0000      0.781 1.000 0.000 0.000 0.000
#> GSM182821     3  0.3052      0.604 0.004 0.000 0.860 0.136
#> GSM182822     3  0.7143     -0.217 0.380 0.000 0.484 0.136
#> GSM182823     1  0.0000      0.781 1.000 0.000 0.000 0.000
#> GSM182824     1  0.0000      0.781 1.000 0.000 0.000 0.000
#> GSM182825     1  0.6693      0.646 0.580 0.000 0.304 0.116

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>           class entropy silhouette    p1    p2    p3    p4    p5
#> GSM182755     1  0.0000    0.76530 1.000 0.000 0.000 0.000 0.000
#> GSM182756     3  0.1732    0.44013 0.000 0.000 0.920 0.000 0.080
#> GSM182757     5  0.2732    0.68614 0.000 0.000 0.160 0.000 0.840
#> GSM182758     3  0.3816   -0.00244 0.000 0.000 0.696 0.000 0.304
#> GSM182759     5  0.3452    0.63856 0.000 0.032 0.148 0.000 0.820
#> GSM182760     3  0.1851    0.43704 0.000 0.000 0.912 0.000 0.088
#> GSM182761     5  0.5026    0.43320 0.000 0.040 0.372 0.000 0.588
#> GSM182762     3  0.4444    0.23954 0.012 0.000 0.624 0.000 0.364
#> GSM182763     5  0.4920    0.43724 0.000 0.032 0.384 0.000 0.584
#> GSM182764     5  0.2732    0.68614 0.000 0.000 0.160 0.000 0.840
#> GSM182765     5  0.2813    0.67824 0.000 0.000 0.168 0.000 0.832
#> GSM182766     2  0.3527    0.78529 0.000 0.792 0.000 0.016 0.192
#> GSM182767     3  0.1792    0.43859 0.000 0.000 0.916 0.000 0.084
#> GSM182768     3  0.3362    0.39492 0.000 0.000 0.844 0.080 0.076
#> GSM182769     1  0.5521    0.34634 0.496 0.000 0.452 0.012 0.040
#> GSM182770     2  0.0000    0.90048 0.000 1.000 0.000 0.000 0.000
#> GSM182771     5  0.2732    0.68614 0.000 0.000 0.160 0.000 0.840
#> GSM182772     2  0.0000    0.90048 0.000 1.000 0.000 0.000 0.000
#> GSM182773     3  0.4449   -0.31717 0.484 0.000 0.512 0.000 0.004
#> GSM182774     3  0.6371   -0.29360 0.436 0.000 0.460 0.060 0.044
#> GSM182775     1  0.5165    0.36170 0.512 0.000 0.448 0.000 0.040
#> GSM182776     1  0.6571    0.29061 0.448 0.000 0.432 0.048 0.072
#> GSM182777     3  0.6254   -0.03117 0.340 0.000 0.500 0.000 0.160
#> GSM182802     2  0.3630    0.77201 0.000 0.780 0.000 0.016 0.204
#> GSM182803     1  0.0290    0.76258 0.992 0.000 0.008 0.000 0.000
#> GSM182804     4  0.4317    0.91400 0.000 0.000 0.076 0.764 0.160
#> GSM182805     2  0.3630    0.77201 0.000 0.780 0.000 0.016 0.204
#> GSM182806     1  0.0000    0.76530 1.000 0.000 0.000 0.000 0.000
#> GSM182807     1  0.0000    0.76530 1.000 0.000 0.000 0.000 0.000
#> GSM182808     1  0.0000    0.76530 1.000 0.000 0.000 0.000 0.000
#> GSM182809     3  0.5584   -0.08366 0.000 0.000 0.532 0.392 0.076
#> GSM182810     1  0.6887    0.33852 0.464 0.000 0.388 0.080 0.068
#> GSM182811     3  0.6922    0.09280 0.320 0.000 0.512 0.112 0.056
#> GSM182812     1  0.7055    0.41650 0.488 0.000 0.312 0.160 0.040
#> GSM182813     1  0.0000    0.76530 1.000 0.000 0.000 0.000 0.000
#> GSM182778     2  0.0000    0.90048 0.000 1.000 0.000 0.000 0.000
#> GSM182779     5  0.3276    0.68180 0.000 0.032 0.132 0.000 0.836
#> GSM182780     5  0.4920    0.43724 0.000 0.032 0.384 0.000 0.584
#> GSM182781     3  0.5467    0.33334 0.100 0.000 0.624 0.000 0.276
#> GSM182782     2  0.0000    0.90048 0.000 1.000 0.000 0.000 0.000
#> GSM182783     3  0.7935   -0.22257 0.000 0.296 0.332 0.072 0.300
#> GSM182784     3  0.1908    0.43738 0.000 0.000 0.908 0.000 0.092
#> GSM182785     3  0.4306   -0.37082 0.000 0.000 0.508 0.000 0.492
#> GSM182786     2  0.0000    0.90048 0.000 1.000 0.000 0.000 0.000
#> GSM182787     5  0.5026    0.43320 0.000 0.040 0.372 0.000 0.588
#> GSM182788     2  0.0000    0.90048 0.000 1.000 0.000 0.000 0.000
#> GSM182789     3  0.4306   -0.37082 0.000 0.000 0.508 0.000 0.492
#> GSM182790     3  0.5421    0.33413 0.096 0.000 0.628 0.000 0.276
#> GSM182791     3  0.3090    0.40131 0.000 0.000 0.860 0.052 0.088
#> GSM182792     3  0.3090    0.40131 0.000 0.000 0.860 0.052 0.088
#> GSM182793     2  0.1845    0.87096 0.000 0.928 0.000 0.016 0.056
#> GSM182794     3  0.5421    0.33413 0.096 0.000 0.628 0.000 0.276
#> GSM182795     3  0.3586    0.10646 0.000 0.000 0.736 0.000 0.264
#> GSM182796     5  0.3182    0.68021 0.000 0.032 0.124 0.000 0.844
#> GSM182797     1  0.0000    0.76530 1.000 0.000 0.000 0.000 0.000
#> GSM182798     5  0.2732    0.68614 0.000 0.000 0.160 0.000 0.840
#> GSM182799     4  0.4317    0.91400 0.000 0.000 0.076 0.764 0.160
#> GSM182800     1  0.6725    0.29950 0.448 0.000 0.420 0.060 0.072
#> GSM182801     1  0.4477    0.58897 0.708 0.000 0.252 0.000 0.040
#> GSM182814     1  0.0000    0.76530 1.000 0.000 0.000 0.000 0.000
#> GSM182815     4  0.4317    0.91400 0.000 0.000 0.076 0.764 0.160
#> GSM182816     1  0.0000    0.76530 1.000 0.000 0.000 0.000 0.000
#> GSM182817     5  0.4300   -0.04195 0.000 0.000 0.476 0.000 0.524
#> GSM182818     4  0.0404    0.74708 0.000 0.000 0.000 0.988 0.012
#> GSM182819     1  0.0000    0.76530 1.000 0.000 0.000 0.000 0.000
#> GSM182820     1  0.0000    0.76530 1.000 0.000 0.000 0.000 0.000
#> GSM182821     3  0.3090    0.40131 0.000 0.000 0.860 0.052 0.088
#> GSM182822     3  0.6922    0.09280 0.320 0.000 0.512 0.112 0.056
#> GSM182823     1  0.0000    0.76530 1.000 0.000 0.000 0.000 0.000
#> GSM182824     1  0.0000    0.76530 1.000 0.000 0.000 0.000 0.000
#> GSM182825     1  0.6796    0.41055 0.496 0.000 0.348 0.116 0.040

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>           class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM182755     1  0.0000     0.9973 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM182756     3  0.2948     0.5543 0.000 0.000 0.804 0.000 0.188 0.008
#> GSM182757     5  0.0865     0.6373 0.000 0.000 0.036 0.000 0.964 0.000
#> GSM182758     3  0.3774     0.2554 0.000 0.000 0.592 0.000 0.408 0.000
#> GSM182759     5  0.2402     0.5729 0.000 0.000 0.140 0.000 0.856 0.004
#> GSM182760     3  0.2902     0.5578 0.000 0.000 0.800 0.000 0.196 0.004
#> GSM182761     5  0.4763     0.2672 0.000 0.008 0.468 0.024 0.496 0.004
#> GSM182762     3  0.4704     0.2058 0.000 0.000 0.488 0.000 0.468 0.044
#> GSM182763     5  0.4527     0.2725 0.000 0.000 0.456 0.024 0.516 0.004
#> GSM182764     5  0.0865     0.6373 0.000 0.000 0.036 0.000 0.964 0.000
#> GSM182765     5  0.1007     0.6285 0.000 0.000 0.044 0.000 0.956 0.000
#> GSM182766     2  0.4882     0.7396 0.000 0.728 0.060 0.020 0.164 0.028
#> GSM182767     3  0.2871     0.5576 0.000 0.000 0.804 0.000 0.192 0.004
#> GSM182768     3  0.4233     0.5442 0.000 0.000 0.736 0.080 0.180 0.004
#> GSM182769     6  0.2473     0.7396 0.008 0.000 0.136 0.000 0.000 0.856
#> GSM182770     2  0.0000     0.8799 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM182771     5  0.0865     0.6373 0.000 0.000 0.036 0.000 0.964 0.000
#> GSM182772     2  0.0000     0.8799 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM182773     6  0.3841     0.5909 0.004 0.000 0.380 0.000 0.000 0.616
#> GSM182774     6  0.4391     0.6923 0.012 0.000 0.236 0.000 0.048 0.704
#> GSM182775     6  0.3236     0.7248 0.024 0.000 0.180 0.000 0.000 0.796
#> GSM182776     6  0.3053     0.7512 0.016 0.000 0.080 0.000 0.048 0.856
#> GSM182777     6  0.5724     0.5184 0.008 0.000 0.312 0.000 0.152 0.528
#> GSM182802     2  0.5105     0.7324 0.000 0.716 0.060 0.032 0.164 0.028
#> GSM182803     1  0.0363     0.9862 0.988 0.000 0.000 0.000 0.000 0.012
#> GSM182804     4  0.2946     0.9223 0.000 0.000 0.176 0.812 0.012 0.000
#> GSM182805     2  0.5105     0.7324 0.000 0.716 0.060 0.032 0.164 0.028
#> GSM182806     1  0.0000     0.9973 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM182807     1  0.0000     0.9973 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM182808     1  0.0000     0.9973 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM182809     3  0.5889     0.1428 0.000 0.000 0.424 0.400 0.172 0.004
#> GSM182810     6  0.2849     0.7395 0.020 0.000 0.056 0.008 0.036 0.880
#> GSM182811     6  0.6556     0.4652 0.012 0.000 0.264 0.052 0.144 0.528
#> GSM182812     6  0.2146     0.6586 0.024 0.000 0.008 0.060 0.000 0.908
#> GSM182813     1  0.0000     0.9973 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM182778     2  0.0000     0.8799 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM182779     5  0.0603     0.6321 0.000 0.000 0.016 0.000 0.980 0.004
#> GSM182780     5  0.4527     0.2725 0.000 0.000 0.456 0.024 0.516 0.004
#> GSM182781     3  0.5555     0.2511 0.000 0.000 0.480 0.000 0.380 0.140
#> GSM182782     2  0.0000     0.8799 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM182783     3  0.7628    -0.0713 0.000 0.232 0.444 0.120 0.172 0.032
#> GSM182784     3  0.2871     0.5583 0.000 0.000 0.804 0.000 0.192 0.004
#> GSM182785     3  0.4532    -0.1614 0.000 0.000 0.508 0.024 0.464 0.004
#> GSM182786     2  0.0000     0.8799 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM182787     5  0.4763     0.2672 0.000 0.008 0.468 0.024 0.496 0.004
#> GSM182788     2  0.0000     0.8799 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM182789     3  0.4532    -0.1614 0.000 0.000 0.508 0.024 0.464 0.004
#> GSM182790     3  0.5492     0.2629 0.000 0.000 0.492 0.000 0.376 0.132
#> GSM182791     3  0.3946     0.5511 0.000 0.000 0.752 0.052 0.192 0.004
#> GSM182792     3  0.3946     0.5511 0.000 0.000 0.752 0.052 0.192 0.004
#> GSM182793     2  0.2562     0.8390 0.000 0.892 0.060 0.016 0.004 0.028
#> GSM182794     3  0.5492     0.2629 0.000 0.000 0.492 0.000 0.376 0.132
#> GSM182795     3  0.3672     0.3381 0.000 0.000 0.632 0.000 0.368 0.000
#> GSM182796     5  0.0000     0.6317 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM182797     1  0.0000     0.9973 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM182798     5  0.0865     0.6373 0.000 0.000 0.036 0.000 0.964 0.000
#> GSM182799     4  0.2946     0.9223 0.000 0.000 0.176 0.812 0.012 0.000
#> GSM182800     6  0.2889     0.7480 0.016 0.000 0.068 0.000 0.048 0.868
#> GSM182801     6  0.3390     0.4793 0.296 0.000 0.000 0.000 0.000 0.704
#> GSM182814     1  0.0363     0.9873 0.988 0.000 0.000 0.000 0.000 0.012
#> GSM182815     4  0.2946     0.9223 0.000 0.000 0.176 0.812 0.012 0.000
#> GSM182816     1  0.0000     0.9973 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM182817     5  0.3647    -0.0966 0.000 0.000 0.360 0.000 0.640 0.000
#> GSM182818     4  0.1572     0.7582 0.000 0.000 0.028 0.936 0.000 0.036
#> GSM182819     1  0.0000     0.9973 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM182820     1  0.0000     0.9973 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM182821     3  0.3946     0.5511 0.000 0.000 0.752 0.052 0.192 0.004
#> GSM182822     6  0.6556     0.4652 0.012 0.000 0.264 0.052 0.144 0.528
#> GSM182823     1  0.0146     0.9939 0.996 0.000 0.000 0.000 0.000 0.004
#> GSM182824     1  0.0000     0.9973 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM182825     6  0.2198     0.6982 0.032 0.000 0.032 0.024 0.000 0.912

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 stress(p) development.stage(p) k
#> ATC:hclust 63     0.382             0.003193 2
#> ATC:hclust 64     0.835             0.003748 3
#> ATC:hclust 58     0.696             0.000997 4
#> ATC:hclust 36     0.641             0.000728 5
#> ATC:hclust 53     0.447             0.000318 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 18172 rows and 71 columns.
#>   Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'ATC' method.
#>   Subgroups are detected by 'kmeans' method.
#>   Performed in total 1250 partitions by row resampling.
#>   Best k for subgroups seems to be 3.
#> 
#> Following methods can be applied to this 'ConsensusPartition' object:
#>  [1] "cola_report"             "collect_classes"         "collect_plots"          
#>  [4] "collect_stats"           "colnames"                "compare_signatures"     
#>  [7] "consensus_heatmap"       "dimension_reduction"     "functional_enrichment"  
#> [10] "get_anno_col"            "get_anno"                "get_classes"            
#> [13] "get_consensus"           "get_matrix"              "get_membership"         
#> [16] "get_param"               "get_signatures"          "get_stats"              
#> [19] "is_best_k"               "is_stable_k"             "membership_heatmap"     
#> [22] "ncol"                    "nrow"                    "plot_ecdf"              
#> [25] "rownames"                "select_partition_number" "show"                   
#> [28] "suggest_best_k"          "test_to_known_factors"

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

collect_plots(res)

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.958       0.982         0.5024 0.498   0.498
#> 3 3 1.000           0.974       0.988         0.2501 0.687   0.470
#> 4 4 0.672           0.727       0.836         0.1544 0.769   0.470
#> 5 5 0.791           0.834       0.901         0.0771 0.932   0.755
#> 6 6 0.769           0.711       0.825         0.0508 0.905   0.606

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
#> GSM182755     1  0.0000      0.986 1.000 0.000
#> GSM182756     1  0.7376      0.734 0.792 0.208
#> GSM182757     2  0.0376      0.977 0.004 0.996
#> GSM182758     2  0.0376      0.977 0.004 0.996
#> GSM182759     2  0.0000      0.977 0.000 1.000
#> GSM182760     1  0.7376      0.734 0.792 0.208
#> GSM182761     2  0.0000      0.977 0.000 1.000
#> GSM182762     1  0.0000      0.986 1.000 0.000
#> GSM182763     2  0.0000      0.977 0.000 1.000
#> GSM182764     2  0.0376      0.977 0.004 0.996
#> GSM182765     2  0.0376      0.977 0.004 0.996
#> GSM182766     2  0.0000      0.977 0.000 1.000
#> GSM182767     2  0.9833      0.265 0.424 0.576
#> GSM182768     2  0.2603      0.939 0.044 0.956
#> GSM182769     1  0.0000      0.986 1.000 0.000
#> GSM182770     2  0.0000      0.977 0.000 1.000
#> GSM182771     2  0.0376      0.977 0.004 0.996
#> GSM182772     2  0.0000      0.977 0.000 1.000
#> GSM182773     1  0.0000      0.986 1.000 0.000
#> GSM182774     1  0.0000      0.986 1.000 0.000
#> GSM182775     1  0.0000      0.986 1.000 0.000
#> GSM182776     1  0.0000      0.986 1.000 0.000
#> GSM182777     1  0.0000      0.986 1.000 0.000
#> GSM182802     2  0.0000      0.977 0.000 1.000
#> GSM182803     1  0.0000      0.986 1.000 0.000
#> GSM182804     2  0.0376      0.977 0.004 0.996
#> GSM182805     2  0.0000      0.977 0.000 1.000
#> GSM182806     1  0.0000      0.986 1.000 0.000
#> GSM182807     1  0.0000      0.986 1.000 0.000
#> GSM182808     1  0.0000      0.986 1.000 0.000
#> GSM182809     2  0.0376      0.977 0.004 0.996
#> GSM182810     1  0.0000      0.986 1.000 0.000
#> GSM182811     1  0.0000      0.986 1.000 0.000
#> GSM182812     1  0.0000      0.986 1.000 0.000
#> GSM182813     1  0.0000      0.986 1.000 0.000
#> GSM182778     2  0.0000      0.977 0.000 1.000
#> GSM182779     2  0.0000      0.977 0.000 1.000
#> GSM182780     2  0.0000      0.977 0.000 1.000
#> GSM182781     1  0.0000      0.986 1.000 0.000
#> GSM182782     2  0.0000      0.977 0.000 1.000
#> GSM182783     2  0.0000      0.977 0.000 1.000
#> GSM182784     2  0.0376      0.977 0.004 0.996
#> GSM182785     2  0.0376      0.977 0.004 0.996
#> GSM182786     2  0.0000      0.977 0.000 1.000
#> GSM182787     2  0.0000      0.977 0.000 1.000
#> GSM182788     2  0.0000      0.977 0.000 1.000
#> GSM182789     2  0.0000      0.977 0.000 1.000
#> GSM182790     1  0.0000      0.986 1.000 0.000
#> GSM182791     2  0.0376      0.977 0.004 0.996
#> GSM182792     2  0.8909      0.554 0.308 0.692
#> GSM182793     2  0.0000      0.977 0.000 1.000
#> GSM182794     1  0.0000      0.986 1.000 0.000
#> GSM182795     2  0.0376      0.977 0.004 0.996
#> GSM182796     2  0.0000      0.977 0.000 1.000
#> GSM182797     1  0.0000      0.986 1.000 0.000
#> GSM182798     2  0.0376      0.977 0.004 0.996
#> GSM182799     2  0.0376      0.977 0.004 0.996
#> GSM182800     1  0.0000      0.986 1.000 0.000
#> GSM182801     1  0.0000      0.986 1.000 0.000
#> GSM182814     1  0.0000      0.986 1.000 0.000
#> GSM182815     2  0.0000      0.977 0.000 1.000
#> GSM182816     1  0.0000      0.986 1.000 0.000
#> GSM182817     2  0.0376      0.977 0.004 0.996
#> GSM182818     2  0.0376      0.977 0.004 0.996
#> GSM182819     1  0.0000      0.986 1.000 0.000
#> GSM182820     1  0.0000      0.986 1.000 0.000
#> GSM182821     2  0.0376      0.977 0.004 0.996
#> GSM182822     1  0.0000      0.986 1.000 0.000
#> GSM182823     1  0.0000      0.986 1.000 0.000
#> GSM182824     1  0.0000      0.986 1.000 0.000
#> GSM182825     1  0.0000      0.986 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
#> GSM182755     1  0.0000      0.984 1.00 0.000 0.000
#> GSM182756     3  0.0000      0.987 0.00 0.000 1.000
#> GSM182757     3  0.0000      0.987 0.00 0.000 1.000
#> GSM182758     3  0.0000      0.987 0.00 0.000 1.000
#> GSM182759     3  0.3038      0.889 0.00 0.104 0.896
#> GSM182760     3  0.0000      0.987 0.00 0.000 1.000
#> GSM182761     2  0.3340      0.858 0.00 0.880 0.120
#> GSM182762     3  0.0000      0.987 0.00 0.000 1.000
#> GSM182763     3  0.0000      0.987 0.00 0.000 1.000
#> GSM182764     3  0.0000      0.987 0.00 0.000 1.000
#> GSM182765     3  0.0000      0.987 0.00 0.000 1.000
#> GSM182766     2  0.0000      0.985 0.00 1.000 0.000
#> GSM182767     3  0.0000      0.987 0.00 0.000 1.000
#> GSM182768     3  0.0000      0.987 0.00 0.000 1.000
#> GSM182769     1  0.0892      0.974 0.98 0.000 0.020
#> GSM182770     2  0.0000      0.985 0.00 1.000 0.000
#> GSM182771     3  0.0000      0.987 0.00 0.000 1.000
#> GSM182772     2  0.0000      0.985 0.00 1.000 0.000
#> GSM182773     3  0.0000      0.987 0.00 0.000 1.000
#> GSM182774     3  0.0000      0.987 0.00 0.000 1.000
#> GSM182775     1  0.0000      0.984 1.00 0.000 0.000
#> GSM182776     1  0.0892      0.974 0.98 0.000 0.020
#> GSM182777     1  0.0892      0.974 0.98 0.000 0.020
#> GSM182802     2  0.0000      0.985 0.00 1.000 0.000
#> GSM182803     1  0.0000      0.984 1.00 0.000 0.000
#> GSM182804     3  0.0000      0.987 0.00 0.000 1.000
#> GSM182805     2  0.0000      0.985 0.00 1.000 0.000
#> GSM182806     1  0.0000      0.984 1.00 0.000 0.000
#> GSM182807     1  0.0000      0.984 1.00 0.000 0.000
#> GSM182808     1  0.0000      0.984 1.00 0.000 0.000
#> GSM182809     3  0.0000      0.987 0.00 0.000 1.000
#> GSM182810     1  0.0892      0.974 0.98 0.000 0.020
#> GSM182811     3  0.0000      0.987 0.00 0.000 1.000
#> GSM182812     1  0.0892      0.974 0.98 0.000 0.020
#> GSM182813     1  0.0000      0.984 1.00 0.000 0.000
#> GSM182778     2  0.0000      0.985 0.00 1.000 0.000
#> GSM182779     3  0.0000      0.987 0.00 0.000 1.000
#> GSM182780     3  0.1964      0.937 0.00 0.056 0.944
#> GSM182781     1  0.4002      0.791 0.84 0.000 0.160
#> GSM182782     2  0.0000      0.985 0.00 1.000 0.000
#> GSM182783     3  0.4235      0.797 0.00 0.176 0.824
#> GSM182784     3  0.0000      0.987 0.00 0.000 1.000
#> GSM182785     3  0.0000      0.987 0.00 0.000 1.000
#> GSM182786     2  0.0000      0.985 0.00 1.000 0.000
#> GSM182787     2  0.0000      0.985 0.00 1.000 0.000
#> GSM182788     2  0.0000      0.985 0.00 1.000 0.000
#> GSM182789     3  0.0000      0.987 0.00 0.000 1.000
#> GSM182790     3  0.0000      0.987 0.00 0.000 1.000
#> GSM182791     3  0.0000      0.987 0.00 0.000 1.000
#> GSM182792     3  0.0000      0.987 0.00 0.000 1.000
#> GSM182793     2  0.0000      0.985 0.00 1.000 0.000
#> GSM182794     3  0.0000      0.987 0.00 0.000 1.000
#> GSM182795     3  0.0000      0.987 0.00 0.000 1.000
#> GSM182796     3  0.2878      0.897 0.00 0.096 0.904
#> GSM182797     1  0.0000      0.984 1.00 0.000 0.000
#> GSM182798     3  0.0000      0.987 0.00 0.000 1.000
#> GSM182799     3  0.0000      0.987 0.00 0.000 1.000
#> GSM182800     1  0.0892      0.974 0.98 0.000 0.020
#> GSM182801     1  0.0000      0.984 1.00 0.000 0.000
#> GSM182814     1  0.0000      0.984 1.00 0.000 0.000
#> GSM182815     2  0.1289      0.956 0.00 0.968 0.032
#> GSM182816     1  0.0000      0.984 1.00 0.000 0.000
#> GSM182817     3  0.0000      0.987 0.00 0.000 1.000
#> GSM182818     3  0.0000      0.987 0.00 0.000 1.000
#> GSM182819     1  0.0000      0.984 1.00 0.000 0.000
#> GSM182820     1  0.0000      0.984 1.00 0.000 0.000
#> GSM182821     3  0.0000      0.987 0.00 0.000 1.000
#> GSM182822     3  0.0000      0.987 0.00 0.000 1.000
#> GSM182823     1  0.0000      0.984 1.00 0.000 0.000
#> GSM182824     1  0.0000      0.984 1.00 0.000 0.000
#> GSM182825     1  0.0000      0.984 1.00 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
#> GSM182755     1  0.0000     0.9919 1.000 0.000 0.000 0.000
#> GSM182756     4  0.4916     0.3580 0.000 0.000 0.424 0.576
#> GSM182757     3  0.1867     0.7977 0.000 0.000 0.928 0.072
#> GSM182758     3  0.2216     0.7953 0.000 0.000 0.908 0.092
#> GSM182759     3  0.1174     0.7920 0.000 0.020 0.968 0.012
#> GSM182760     4  0.4933     0.3381 0.000 0.000 0.432 0.568
#> GSM182761     3  0.2737     0.7358 0.000 0.104 0.888 0.008
#> GSM182762     4  0.4877     0.4263 0.000 0.000 0.408 0.592
#> GSM182763     3  0.0336     0.7992 0.000 0.000 0.992 0.008
#> GSM182764     3  0.1867     0.7977 0.000 0.000 0.928 0.072
#> GSM182765     3  0.1867     0.7977 0.000 0.000 0.928 0.072
#> GSM182766     2  0.0336     0.9720 0.000 0.992 0.008 0.000
#> GSM182767     3  0.4948     0.0464 0.000 0.000 0.560 0.440
#> GSM182768     4  0.4761     0.2526 0.000 0.000 0.372 0.628
#> GSM182769     4  0.4973     0.5494 0.348 0.000 0.008 0.644
#> GSM182770     2  0.0000     0.9748 0.000 1.000 0.000 0.000
#> GSM182771     3  0.1637     0.8012 0.000 0.000 0.940 0.060
#> GSM182772     2  0.0000     0.9748 0.000 1.000 0.000 0.000
#> GSM182773     4  0.3688     0.6279 0.000 0.000 0.208 0.792
#> GSM182774     4  0.3688     0.6285 0.000 0.000 0.208 0.792
#> GSM182775     4  0.4990     0.5459 0.352 0.000 0.008 0.640
#> GSM182776     4  0.4973     0.5494 0.348 0.000 0.008 0.644
#> GSM182777     4  0.4957     0.5812 0.320 0.000 0.012 0.668
#> GSM182802     2  0.0469     0.9701 0.000 0.988 0.012 0.000
#> GSM182803     1  0.1792     0.9048 0.932 0.000 0.000 0.068
#> GSM182804     3  0.4948     0.4682 0.000 0.000 0.560 0.440
#> GSM182805     2  0.3300     0.8398 0.000 0.848 0.144 0.008
#> GSM182806     1  0.0000     0.9919 1.000 0.000 0.000 0.000
#> GSM182807     1  0.0000     0.9919 1.000 0.000 0.000 0.000
#> GSM182808     1  0.0000     0.9919 1.000 0.000 0.000 0.000
#> GSM182809     3  0.4948     0.4682 0.000 0.000 0.560 0.440
#> GSM182810     4  0.4222     0.5887 0.272 0.000 0.000 0.728
#> GSM182811     4  0.2011     0.6338 0.000 0.000 0.080 0.920
#> GSM182812     4  0.3400     0.5935 0.180 0.000 0.000 0.820
#> GSM182813     1  0.0000     0.9919 1.000 0.000 0.000 0.000
#> GSM182778     2  0.0000     0.9748 0.000 1.000 0.000 0.000
#> GSM182779     3  0.0592     0.8017 0.000 0.000 0.984 0.016
#> GSM182780     3  0.2142     0.7794 0.000 0.016 0.928 0.056
#> GSM182781     4  0.5719     0.6778 0.152 0.000 0.132 0.716
#> GSM182782     2  0.0000     0.9748 0.000 1.000 0.000 0.000
#> GSM182783     3  0.3280     0.7424 0.000 0.016 0.860 0.124
#> GSM182784     3  0.2216     0.7953 0.000 0.000 0.908 0.092
#> GSM182785     3  0.1716     0.7996 0.000 0.000 0.936 0.064
#> GSM182786     2  0.0000     0.9748 0.000 1.000 0.000 0.000
#> GSM182787     2  0.2198     0.9217 0.000 0.920 0.072 0.008
#> GSM182788     2  0.0000     0.9748 0.000 1.000 0.000 0.000
#> GSM182789     3  0.0592     0.7998 0.000 0.000 0.984 0.016
#> GSM182790     4  0.4134     0.6005 0.000 0.000 0.260 0.740
#> GSM182791     3  0.4040     0.6593 0.000 0.000 0.752 0.248
#> GSM182792     4  0.4955     0.1953 0.000 0.000 0.444 0.556
#> GSM182793     2  0.0000     0.9748 0.000 1.000 0.000 0.000
#> GSM182794     4  0.4679     0.4937 0.000 0.000 0.352 0.648
#> GSM182795     3  0.2081     0.7989 0.000 0.000 0.916 0.084
#> GSM182796     3  0.1042     0.7954 0.000 0.020 0.972 0.008
#> GSM182797     1  0.0000     0.9919 1.000 0.000 0.000 0.000
#> GSM182798     3  0.1389     0.8029 0.000 0.000 0.952 0.048
#> GSM182799     3  0.4948     0.4682 0.000 0.000 0.560 0.440
#> GSM182800     4  0.4722     0.5857 0.300 0.000 0.008 0.692
#> GSM182801     4  0.4955     0.3635 0.444 0.000 0.000 0.556
#> GSM182814     1  0.0000     0.9919 1.000 0.000 0.000 0.000
#> GSM182815     3  0.7792     0.0928 0.000 0.332 0.412 0.256
#> GSM182816     1  0.0188     0.9890 0.996 0.000 0.000 0.004
#> GSM182817     3  0.2647     0.7793 0.000 0.000 0.880 0.120
#> GSM182818     3  0.4994     0.3947 0.000 0.000 0.520 0.480
#> GSM182819     1  0.0188     0.9890 0.996 0.000 0.000 0.004
#> GSM182820     1  0.0000     0.9919 1.000 0.000 0.000 0.000
#> GSM182821     3  0.2647     0.7815 0.000 0.000 0.880 0.120
#> GSM182822     4  0.3024     0.6387 0.000 0.000 0.148 0.852
#> GSM182823     1  0.0000     0.9919 1.000 0.000 0.000 0.000
#> GSM182824     1  0.0000     0.9919 1.000 0.000 0.000 0.000
#> GSM182825     4  0.4790     0.4992 0.380 0.000 0.000 0.620

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>           class entropy silhouette    p1    p2    p3    p4    p5
#> GSM182755     1  0.0703      0.977 0.976 0.000 0.000 0.024 0.000
#> GSM182756     3  0.4850      0.634 0.000 0.000 0.696 0.072 0.232
#> GSM182757     5  0.0671      0.880 0.000 0.000 0.016 0.004 0.980
#> GSM182758     5  0.2850      0.861 0.000 0.000 0.036 0.092 0.872
#> GSM182759     5  0.1732      0.861 0.000 0.000 0.000 0.080 0.920
#> GSM182760     3  0.5167      0.601 0.000 0.000 0.664 0.088 0.248
#> GSM182761     5  0.2513      0.868 0.000 0.000 0.008 0.116 0.876
#> GSM182762     3  0.4084      0.609 0.000 0.000 0.668 0.004 0.328
#> GSM182763     5  0.2358      0.873 0.000 0.000 0.008 0.104 0.888
#> GSM182764     5  0.0671      0.880 0.000 0.000 0.016 0.004 0.980
#> GSM182765     5  0.0865      0.877 0.000 0.000 0.024 0.004 0.972
#> GSM182766     2  0.1251      0.939 0.000 0.956 0.000 0.036 0.008
#> GSM182767     3  0.5584      0.479 0.000 0.000 0.584 0.092 0.324
#> GSM182768     3  0.5413      0.583 0.000 0.000 0.664 0.172 0.164
#> GSM182769     3  0.1300      0.787 0.028 0.000 0.956 0.016 0.000
#> GSM182770     2  0.0000      0.956 0.000 1.000 0.000 0.000 0.000
#> GSM182771     5  0.1018      0.882 0.000 0.000 0.016 0.016 0.968
#> GSM182772     2  0.0000      0.956 0.000 1.000 0.000 0.000 0.000
#> GSM182773     3  0.0404      0.793 0.000 0.000 0.988 0.000 0.012
#> GSM182774     3  0.0613      0.793 0.004 0.000 0.984 0.004 0.008
#> GSM182775     3  0.1364      0.787 0.036 0.000 0.952 0.012 0.000
#> GSM182776     3  0.1300      0.787 0.028 0.000 0.956 0.016 0.000
#> GSM182777     3  0.0798      0.794 0.016 0.000 0.976 0.000 0.008
#> GSM182802     2  0.1408      0.935 0.000 0.948 0.000 0.044 0.008
#> GSM182803     1  0.2300      0.901 0.904 0.000 0.072 0.024 0.000
#> GSM182804     4  0.2260      0.879 0.000 0.000 0.028 0.908 0.064
#> GSM182805     2  0.3362      0.837 0.000 0.844 0.000 0.076 0.080
#> GSM182806     1  0.0162      0.983 0.996 0.000 0.000 0.004 0.000
#> GSM182807     1  0.0000      0.984 1.000 0.000 0.000 0.000 0.000
#> GSM182808     1  0.0000      0.984 1.000 0.000 0.000 0.000 0.000
#> GSM182809     4  0.2260      0.879 0.000 0.000 0.028 0.908 0.064
#> GSM182810     3  0.1310      0.787 0.024 0.000 0.956 0.020 0.000
#> GSM182811     3  0.2068      0.745 0.004 0.000 0.904 0.092 0.000
#> GSM182812     4  0.4510      0.260 0.008 0.000 0.432 0.560 0.000
#> GSM182813     1  0.0000      0.984 1.000 0.000 0.000 0.000 0.000
#> GSM182778     2  0.0000      0.956 0.000 1.000 0.000 0.000 0.000
#> GSM182779     5  0.1704      0.866 0.000 0.000 0.004 0.068 0.928
#> GSM182780     5  0.3093      0.850 0.000 0.000 0.008 0.168 0.824
#> GSM182781     3  0.1173      0.793 0.012 0.000 0.964 0.004 0.020
#> GSM182782     2  0.0000      0.956 0.000 1.000 0.000 0.000 0.000
#> GSM182783     5  0.4341      0.566 0.000 0.000 0.008 0.364 0.628
#> GSM182784     5  0.3003      0.857 0.000 0.000 0.044 0.092 0.864
#> GSM182785     5  0.1469      0.885 0.000 0.000 0.016 0.036 0.948
#> GSM182786     2  0.0000      0.956 0.000 1.000 0.000 0.000 0.000
#> GSM182787     2  0.3242      0.850 0.000 0.852 0.000 0.076 0.072
#> GSM182788     2  0.0000      0.956 0.000 1.000 0.000 0.000 0.000
#> GSM182789     5  0.3013      0.854 0.000 0.000 0.008 0.160 0.832
#> GSM182790     3  0.1478      0.779 0.000 0.000 0.936 0.000 0.064
#> GSM182791     5  0.4123      0.800 0.000 0.000 0.108 0.104 0.788
#> GSM182792     3  0.5141      0.599 0.000 0.000 0.672 0.092 0.236
#> GSM182793     2  0.0162      0.955 0.000 0.996 0.000 0.004 0.000
#> GSM182794     3  0.3274      0.694 0.000 0.000 0.780 0.000 0.220
#> GSM182795     5  0.2761      0.866 0.000 0.000 0.024 0.104 0.872
#> GSM182796     5  0.1831      0.862 0.000 0.000 0.004 0.076 0.920
#> GSM182797     1  0.0000      0.984 1.000 0.000 0.000 0.000 0.000
#> GSM182798     5  0.1018      0.882 0.000 0.000 0.016 0.016 0.968
#> GSM182799     4  0.2260      0.879 0.000 0.000 0.028 0.908 0.064
#> GSM182800     3  0.1211      0.789 0.024 0.000 0.960 0.016 0.000
#> GSM182801     3  0.4054      0.604 0.204 0.000 0.760 0.036 0.000
#> GSM182814     1  0.0000      0.984 1.000 0.000 0.000 0.000 0.000
#> GSM182815     4  0.1522      0.845 0.000 0.012 0.000 0.944 0.044
#> GSM182816     1  0.0963      0.973 0.964 0.000 0.000 0.036 0.000
#> GSM182817     5  0.2416      0.827 0.000 0.000 0.100 0.012 0.888
#> GSM182818     4  0.1997      0.867 0.000 0.000 0.036 0.924 0.040
#> GSM182819     1  0.0963      0.973 0.964 0.000 0.000 0.036 0.000
#> GSM182820     1  0.0703      0.977 0.976 0.000 0.000 0.024 0.000
#> GSM182821     5  0.3918      0.808 0.000 0.000 0.100 0.096 0.804
#> GSM182822     3  0.0955      0.787 0.004 0.000 0.968 0.028 0.000
#> GSM182823     1  0.0000      0.984 1.000 0.000 0.000 0.000 0.000
#> GSM182824     1  0.0000      0.984 1.000 0.000 0.000 0.000 0.000
#> GSM182825     3  0.3906      0.569 0.240 0.000 0.744 0.016 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
#> GSM182755     1  0.1787     0.9223 0.920 0.000 0.068 0.008 0.000 0.004
#> GSM182756     3  0.3766     0.6149 0.000 0.000 0.720 0.000 0.024 0.256
#> GSM182757     5  0.2219     0.7137 0.000 0.000 0.136 0.000 0.864 0.000
#> GSM182758     3  0.3830     0.2193 0.000 0.000 0.620 0.000 0.376 0.004
#> GSM182759     5  0.0603     0.7184 0.000 0.000 0.016 0.004 0.980 0.000
#> GSM182760     3  0.3720     0.6338 0.000 0.000 0.736 0.000 0.028 0.236
#> GSM182761     5  0.2624     0.6993 0.000 0.004 0.148 0.004 0.844 0.000
#> GSM182762     3  0.5446     0.5014 0.000 0.000 0.568 0.000 0.176 0.256
#> GSM182763     5  0.2178     0.7069 0.000 0.000 0.132 0.000 0.868 0.000
#> GSM182764     5  0.2178     0.7158 0.000 0.000 0.132 0.000 0.868 0.000
#> GSM182765     5  0.3244     0.5381 0.000 0.000 0.268 0.000 0.732 0.000
#> GSM182766     2  0.3038     0.8379 0.000 0.856 0.072 0.012 0.060 0.000
#> GSM182767     3  0.3679     0.6517 0.000 0.000 0.760 0.000 0.040 0.200
#> GSM182768     3  0.4028     0.6302 0.000 0.000 0.756 0.048 0.012 0.184
#> GSM182769     6  0.1152     0.8260 0.004 0.000 0.044 0.000 0.000 0.952
#> GSM182770     2  0.0000     0.8792 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM182771     5  0.2300     0.7090 0.000 0.000 0.144 0.000 0.856 0.000
#> GSM182772     2  0.0000     0.8792 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM182773     6  0.3607     0.4846 0.000 0.000 0.348 0.000 0.000 0.652
#> GSM182774     6  0.2994     0.7190 0.000 0.000 0.208 0.000 0.004 0.788
#> GSM182775     6  0.1082     0.8262 0.004 0.000 0.040 0.000 0.000 0.956
#> GSM182776     6  0.1152     0.8260 0.004 0.000 0.044 0.000 0.000 0.952
#> GSM182777     6  0.2902     0.7361 0.004 0.000 0.196 0.000 0.000 0.800
#> GSM182802     2  0.2756     0.8491 0.000 0.876 0.072 0.020 0.032 0.000
#> GSM182803     1  0.4366     0.6948 0.720 0.000 0.068 0.008 0.000 0.204
#> GSM182804     4  0.1686     0.9611 0.000 0.000 0.064 0.924 0.012 0.000
#> GSM182805     2  0.4976     0.6629 0.000 0.656 0.072 0.020 0.252 0.000
#> GSM182806     1  0.0000     0.9483 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM182807     1  0.0000     0.9483 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM182808     1  0.0000     0.9483 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM182809     4  0.1802     0.9603 0.000 0.000 0.072 0.916 0.012 0.000
#> GSM182810     6  0.1674     0.8045 0.004 0.000 0.004 0.068 0.000 0.924
#> GSM182811     6  0.2679     0.7940 0.000 0.000 0.032 0.096 0.004 0.868
#> GSM182812     6  0.4048     0.4711 0.012 0.000 0.012 0.292 0.000 0.684
#> GSM182813     1  0.0000     0.9483 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM182778     2  0.1237     0.8763 0.000 0.956 0.020 0.020 0.000 0.004
#> GSM182779     5  0.0000     0.7216 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM182780     5  0.3559     0.6273 0.000 0.004 0.240 0.012 0.744 0.000
#> GSM182781     6  0.3636     0.5472 0.000 0.000 0.320 0.000 0.004 0.676
#> GSM182782     2  0.1237     0.8763 0.000 0.956 0.020 0.020 0.000 0.004
#> GSM182783     5  0.6289     0.0765 0.000 0.008 0.280 0.320 0.392 0.000
#> GSM182784     3  0.3684     0.3234 0.000 0.000 0.664 0.000 0.332 0.004
#> GSM182785     5  0.3515     0.5813 0.000 0.000 0.324 0.000 0.676 0.000
#> GSM182786     2  0.1237     0.8763 0.000 0.956 0.020 0.020 0.000 0.004
#> GSM182787     2  0.5115     0.6239 0.000 0.624 0.088 0.012 0.276 0.000
#> GSM182788     2  0.1237     0.8763 0.000 0.956 0.020 0.020 0.000 0.004
#> GSM182789     5  0.2969     0.6383 0.000 0.000 0.224 0.000 0.776 0.000
#> GSM182790     3  0.3986     0.0840 0.000 0.000 0.532 0.000 0.004 0.464
#> GSM182791     3  0.4436     0.3047 0.000 0.000 0.636 0.036 0.324 0.004
#> GSM182792     3  0.3678     0.6398 0.000 0.000 0.752 0.004 0.024 0.220
#> GSM182793     2  0.1462     0.8668 0.000 0.936 0.056 0.008 0.000 0.000
#> GSM182794     3  0.4065     0.5490 0.000 0.000 0.672 0.000 0.028 0.300
#> GSM182795     3  0.3804     0.0473 0.000 0.000 0.576 0.000 0.424 0.000
#> GSM182796     5  0.0405     0.7186 0.000 0.000 0.008 0.004 0.988 0.000
#> GSM182797     1  0.0000     0.9483 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM182798     5  0.2219     0.7143 0.000 0.000 0.136 0.000 0.864 0.000
#> GSM182799     4  0.2019     0.9504 0.000 0.000 0.088 0.900 0.012 0.000
#> GSM182800     6  0.0436     0.8236 0.004 0.000 0.004 0.004 0.000 0.988
#> GSM182801     6  0.2277     0.7865 0.032 0.000 0.076 0.000 0.000 0.892
#> GSM182814     1  0.0000     0.9483 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM182815     4  0.2402     0.9171 0.000 0.020 0.084 0.888 0.008 0.000
#> GSM182816     1  0.2622     0.8979 0.868 0.000 0.104 0.024 0.000 0.004
#> GSM182817     5  0.3774     0.1755 0.000 0.000 0.408 0.000 0.592 0.000
#> GSM182818     4  0.1668     0.9411 0.000 0.000 0.060 0.928 0.008 0.004
#> GSM182819     1  0.2622     0.8979 0.868 0.000 0.104 0.024 0.000 0.004
#> GSM182820     1  0.1493     0.9282 0.936 0.000 0.056 0.004 0.000 0.004
#> GSM182821     3  0.3807     0.2427 0.000 0.000 0.628 0.000 0.368 0.004
#> GSM182822     6  0.2011     0.8203 0.000 0.000 0.064 0.020 0.004 0.912
#> GSM182823     1  0.0000     0.9483 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM182824     1  0.0000     0.9483 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM182825     6  0.2442     0.7742 0.048 0.000 0.000 0.068 0.000 0.884

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 stress(p) development.stage(p) k
#> ATC:kmeans 70     0.347             2.21e-02 2
#> ATC:kmeans 71     0.935             3.74e-03 3
#> ATC:kmeans 57     0.411             8.45e-05 4
#> ATC:kmeans 69     0.765             1.29e-05 5
#> ATC:kmeans 61     0.860             9.81e-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: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 18172 rows and 71 columns.
#>   Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'ATC' method.
#>   Subgroups are detected by 'skmeans' method.
#>   Performed in total 1250 partitions by row resampling.
#>   Best k for subgroups seems to be 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 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.965       0.986         0.5071 0.493   0.493
#> 3 3 0.723           0.628       0.858         0.2349 0.931   0.861
#> 4 4 0.829           0.751       0.851         0.1335 0.801   0.564
#> 5 5 0.912           0.862       0.919         0.0634 0.944   0.808
#> 6 6 0.808           0.707       0.853         0.0392 0.994   0.977

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

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

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

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

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

show/hide code output

cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#>           class entropy silhouette    p1    p2
#> GSM182755     1   0.000      0.978 1.000 0.000
#> GSM182756     1   0.000      0.978 1.000 0.000
#> GSM182757     2   0.000      0.993 0.000 1.000
#> GSM182758     2   0.000      0.993 0.000 1.000
#> GSM182759     2   0.000      0.993 0.000 1.000
#> GSM182760     1   0.000      0.978 1.000 0.000
#> GSM182761     2   0.000      0.993 0.000 1.000
#> GSM182762     1   0.000      0.978 1.000 0.000
#> GSM182763     2   0.000      0.993 0.000 1.000
#> GSM182764     2   0.000      0.993 0.000 1.000
#> GSM182765     2   0.000      0.993 0.000 1.000
#> GSM182766     2   0.000      0.993 0.000 1.000
#> GSM182767     1   0.909      0.527 0.676 0.324
#> GSM182768     1   0.978      0.316 0.588 0.412
#> GSM182769     1   0.000      0.978 1.000 0.000
#> GSM182770     2   0.000      0.993 0.000 1.000
#> GSM182771     2   0.000      0.993 0.000 1.000
#> GSM182772     2   0.000      0.993 0.000 1.000
#> GSM182773     1   0.000      0.978 1.000 0.000
#> GSM182774     1   0.000      0.978 1.000 0.000
#> GSM182775     1   0.000      0.978 1.000 0.000
#> GSM182776     1   0.000      0.978 1.000 0.000
#> GSM182777     1   0.000      0.978 1.000 0.000
#> GSM182802     2   0.000      0.993 0.000 1.000
#> GSM182803     1   0.000      0.978 1.000 0.000
#> GSM182804     2   0.000      0.993 0.000 1.000
#> GSM182805     2   0.000      0.993 0.000 1.000
#> GSM182806     1   0.000      0.978 1.000 0.000
#> GSM182807     1   0.000      0.978 1.000 0.000
#> GSM182808     1   0.000      0.978 1.000 0.000
#> GSM182809     2   0.000      0.993 0.000 1.000
#> GSM182810     1   0.000      0.978 1.000 0.000
#> GSM182811     1   0.000      0.978 1.000 0.000
#> GSM182812     1   0.000      0.978 1.000 0.000
#> GSM182813     1   0.000      0.978 1.000 0.000
#> GSM182778     2   0.000      0.993 0.000 1.000
#> GSM182779     2   0.000      0.993 0.000 1.000
#> GSM182780     2   0.000      0.993 0.000 1.000
#> GSM182781     1   0.000      0.978 1.000 0.000
#> GSM182782     2   0.000      0.993 0.000 1.000
#> GSM182783     2   0.000      0.993 0.000 1.000
#> GSM182784     2   0.000      0.993 0.000 1.000
#> GSM182785     2   0.000      0.993 0.000 1.000
#> GSM182786     2   0.000      0.993 0.000 1.000
#> GSM182787     2   0.000      0.993 0.000 1.000
#> GSM182788     2   0.000      0.993 0.000 1.000
#> GSM182789     2   0.000      0.993 0.000 1.000
#> GSM182790     1   0.000      0.978 1.000 0.000
#> GSM182791     2   0.000      0.993 0.000 1.000
#> GSM182792     1   0.000      0.978 1.000 0.000
#> GSM182793     2   0.000      0.993 0.000 1.000
#> GSM182794     1   0.000      0.978 1.000 0.000
#> GSM182795     2   0.000      0.993 0.000 1.000
#> GSM182796     2   0.000      0.993 0.000 1.000
#> GSM182797     1   0.000      0.978 1.000 0.000
#> GSM182798     2   0.000      0.993 0.000 1.000
#> GSM182799     2   0.000      0.993 0.000 1.000
#> GSM182800     1   0.000      0.978 1.000 0.000
#> GSM182801     1   0.000      0.978 1.000 0.000
#> GSM182814     1   0.000      0.978 1.000 0.000
#> GSM182815     2   0.000      0.993 0.000 1.000
#> GSM182816     1   0.000      0.978 1.000 0.000
#> GSM182817     2   0.814      0.653 0.252 0.748
#> GSM182818     2   0.000      0.993 0.000 1.000
#> GSM182819     1   0.000      0.978 1.000 0.000
#> GSM182820     1   0.000      0.978 1.000 0.000
#> GSM182821     2   0.000      0.993 0.000 1.000
#> GSM182822     1   0.000      0.978 1.000 0.000
#> GSM182823     1   0.000      0.978 1.000 0.000
#> GSM182824     1   0.000      0.978 1.000 0.000
#> GSM182825     1   0.000      0.978 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
#> GSM182755     1  0.0000     0.8962 1.000 0.000 0.000
#> GSM182756     1  0.5948     0.5235 0.640 0.000 0.360
#> GSM182757     3  0.6308     0.3849 0.000 0.492 0.508
#> GSM182758     2  0.5988    -0.1746 0.000 0.632 0.368
#> GSM182759     2  0.0747     0.7195 0.000 0.984 0.016
#> GSM182760     1  0.5948     0.5235 0.640 0.000 0.360
#> GSM182761     2  0.0424     0.7241 0.000 0.992 0.008
#> GSM182762     1  0.6309     0.2644 0.500 0.000 0.500
#> GSM182763     2  0.0424     0.7241 0.000 0.992 0.008
#> GSM182764     3  0.6308     0.3849 0.000 0.492 0.508
#> GSM182765     3  0.6308     0.3849 0.000 0.492 0.508
#> GSM182766     2  0.0000     0.7281 0.000 1.000 0.000
#> GSM182767     1  0.9191     0.0122 0.432 0.148 0.420
#> GSM182768     3  0.5581     0.3058 0.036 0.176 0.788
#> GSM182769     1  0.0000     0.8962 1.000 0.000 0.000
#> GSM182770     2  0.0000     0.7281 0.000 1.000 0.000
#> GSM182771     2  0.4062     0.5597 0.000 0.836 0.164
#> GSM182772     2  0.0000     0.7281 0.000 1.000 0.000
#> GSM182773     1  0.0424     0.8908 0.992 0.000 0.008
#> GSM182774     1  0.0000     0.8962 1.000 0.000 0.000
#> GSM182775     1  0.0000     0.8962 1.000 0.000 0.000
#> GSM182776     1  0.0000     0.8962 1.000 0.000 0.000
#> GSM182777     1  0.0000     0.8962 1.000 0.000 0.000
#> GSM182802     2  0.0000     0.7281 0.000 1.000 0.000
#> GSM182803     1  0.0000     0.8962 1.000 0.000 0.000
#> GSM182804     2  0.6305     0.1757 0.000 0.516 0.484
#> GSM182805     2  0.0000     0.7281 0.000 1.000 0.000
#> GSM182806     1  0.0000     0.8962 1.000 0.000 0.000
#> GSM182807     1  0.0000     0.8962 1.000 0.000 0.000
#> GSM182808     1  0.0000     0.8962 1.000 0.000 0.000
#> GSM182809     2  0.6305     0.1757 0.000 0.516 0.484
#> GSM182810     1  0.0000     0.8962 1.000 0.000 0.000
#> GSM182811     1  0.4452     0.7105 0.808 0.000 0.192
#> GSM182812     1  0.6225     0.3350 0.568 0.000 0.432
#> GSM182813     1  0.0000     0.8962 1.000 0.000 0.000
#> GSM182778     2  0.0000     0.7281 0.000 1.000 0.000
#> GSM182779     2  0.4062     0.5597 0.000 0.836 0.164
#> GSM182780     2  0.0000     0.7281 0.000 1.000 0.000
#> GSM182781     1  0.0000     0.8962 1.000 0.000 0.000
#> GSM182782     2  0.0000     0.7281 0.000 1.000 0.000
#> GSM182783     2  0.0000     0.7281 0.000 1.000 0.000
#> GSM182784     2  0.5988    -0.1746 0.000 0.632 0.368
#> GSM182785     2  0.5948    -0.1585 0.000 0.640 0.360
#> GSM182786     2  0.0000     0.7281 0.000 1.000 0.000
#> GSM182787     2  0.0000     0.7281 0.000 1.000 0.000
#> GSM182788     2  0.0000     0.7281 0.000 1.000 0.000
#> GSM182789     2  0.0424     0.7241 0.000 0.992 0.008
#> GSM182790     1  0.5621     0.5943 0.692 0.000 0.308
#> GSM182791     2  0.6308     0.1637 0.000 0.508 0.492
#> GSM182792     3  0.5637     0.3187 0.172 0.040 0.788
#> GSM182793     2  0.0000     0.7281 0.000 1.000 0.000
#> GSM182794     1  0.5948     0.5235 0.640 0.000 0.360
#> GSM182795     2  0.0592     0.7221 0.000 0.988 0.012
#> GSM182796     2  0.4062     0.5597 0.000 0.836 0.164
#> GSM182797     1  0.0000     0.8962 1.000 0.000 0.000
#> GSM182798     2  0.4062     0.5597 0.000 0.836 0.164
#> GSM182799     2  0.6308     0.1637 0.000 0.508 0.492
#> GSM182800     1  0.0000     0.8962 1.000 0.000 0.000
#> GSM182801     1  0.0000     0.8962 1.000 0.000 0.000
#> GSM182814     1  0.0000     0.8962 1.000 0.000 0.000
#> GSM182815     2  0.6305     0.1757 0.000 0.516 0.484
#> GSM182816     1  0.0000     0.8962 1.000 0.000 0.000
#> GSM182817     2  0.6527     0.4015 0.068 0.744 0.188
#> GSM182818     2  0.6305     0.1757 0.000 0.516 0.484
#> GSM182819     1  0.0000     0.8962 1.000 0.000 0.000
#> GSM182820     1  0.0000     0.8962 1.000 0.000 0.000
#> GSM182821     2  0.2261     0.6854 0.000 0.932 0.068
#> GSM182822     1  0.0000     0.8962 1.000 0.000 0.000
#> GSM182823     1  0.0000     0.8962 1.000 0.000 0.000
#> GSM182824     1  0.0000     0.8962 1.000 0.000 0.000
#> GSM182825     1  0.0000     0.8962 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
#> GSM182755     1  0.0000     0.9803 1.000 0.000 0.000 0.000
#> GSM182756     3  0.6929     0.5510 0.108 0.000 0.452 0.440
#> GSM182757     3  0.1940     0.5719 0.000 0.076 0.924 0.000
#> GSM182758     3  0.5731     0.6516 0.000 0.028 0.544 0.428
#> GSM182759     2  0.1389     0.8182 0.000 0.952 0.048 0.000
#> GSM182760     3  0.5576     0.6427 0.020 0.000 0.536 0.444
#> GSM182761     2  0.0592     0.8442 0.000 0.984 0.016 0.000
#> GSM182762     3  0.3166     0.6264 0.016 0.000 0.868 0.116
#> GSM182763     2  0.0707     0.8417 0.000 0.980 0.020 0.000
#> GSM182764     3  0.1940     0.5719 0.000 0.076 0.924 0.000
#> GSM182765     3  0.1716     0.5780 0.000 0.064 0.936 0.000
#> GSM182766     2  0.0000     0.8508 0.000 1.000 0.000 0.000
#> GSM182767     3  0.5297     0.6496 0.004 0.004 0.548 0.444
#> GSM182768     4  0.0188     0.1593 0.000 0.000 0.004 0.996
#> GSM182769     1  0.0000     0.9803 1.000 0.000 0.000 0.000
#> GSM182770     2  0.0000     0.8508 0.000 1.000 0.000 0.000
#> GSM182771     2  0.4967     0.3544 0.000 0.548 0.452 0.000
#> GSM182772     2  0.0000     0.8508 0.000 1.000 0.000 0.000
#> GSM182773     1  0.5108     0.5210 0.672 0.000 0.020 0.308
#> GSM182774     1  0.0000     0.9803 1.000 0.000 0.000 0.000
#> GSM182775     1  0.0000     0.9803 1.000 0.000 0.000 0.000
#> GSM182776     1  0.0000     0.9803 1.000 0.000 0.000 0.000
#> GSM182777     1  0.0000     0.9803 1.000 0.000 0.000 0.000
#> GSM182802     2  0.0000     0.8508 0.000 1.000 0.000 0.000
#> GSM182803     1  0.0000     0.9803 1.000 0.000 0.000 0.000
#> GSM182804     4  0.4948     0.6282 0.000 0.440 0.000 0.560
#> GSM182805     2  0.0000     0.8508 0.000 1.000 0.000 0.000
#> GSM182806     1  0.0000     0.9803 1.000 0.000 0.000 0.000
#> GSM182807     1  0.0000     0.9803 1.000 0.000 0.000 0.000
#> GSM182808     1  0.0000     0.9803 1.000 0.000 0.000 0.000
#> GSM182809     4  0.4948     0.6282 0.000 0.440 0.000 0.560
#> GSM182810     1  0.0000     0.9803 1.000 0.000 0.000 0.000
#> GSM182811     1  0.0000     0.9803 1.000 0.000 0.000 0.000
#> GSM182812     1  0.3024     0.8179 0.852 0.000 0.000 0.148
#> GSM182813     1  0.0000     0.9803 1.000 0.000 0.000 0.000
#> GSM182778     2  0.0000     0.8508 0.000 1.000 0.000 0.000
#> GSM182779     2  0.4967     0.3544 0.000 0.548 0.452 0.000
#> GSM182780     2  0.0000     0.8508 0.000 1.000 0.000 0.000
#> GSM182781     1  0.0469     0.9699 0.988 0.000 0.012 0.000
#> GSM182782     2  0.0000     0.8508 0.000 1.000 0.000 0.000
#> GSM182783     2  0.0000     0.8508 0.000 1.000 0.000 0.000
#> GSM182784     3  0.5366     0.6495 0.000 0.012 0.548 0.440
#> GSM182785     3  0.6140     0.6266 0.000 0.096 0.652 0.252
#> GSM182786     2  0.0000     0.8508 0.000 1.000 0.000 0.000
#> GSM182787     2  0.0000     0.8508 0.000 1.000 0.000 0.000
#> GSM182788     2  0.0000     0.8508 0.000 1.000 0.000 0.000
#> GSM182789     2  0.0657     0.8446 0.000 0.984 0.012 0.004
#> GSM182790     4  0.7700    -0.4853 0.228 0.000 0.344 0.428
#> GSM182791     4  0.4933     0.6278 0.000 0.432 0.000 0.568
#> GSM182792     4  0.0921     0.1281 0.000 0.000 0.028 0.972
#> GSM182793     2  0.0000     0.8508 0.000 1.000 0.000 0.000
#> GSM182794     3  0.5250     0.6512 0.008 0.000 0.552 0.440
#> GSM182795     2  0.0672     0.8439 0.000 0.984 0.008 0.008
#> GSM182796     2  0.4967     0.3544 0.000 0.548 0.452 0.000
#> GSM182797     1  0.0000     0.9803 1.000 0.000 0.000 0.000
#> GSM182798     2  0.4967     0.3544 0.000 0.548 0.452 0.000
#> GSM182799     4  0.4948     0.6282 0.000 0.440 0.000 0.560
#> GSM182800     1  0.0000     0.9803 1.000 0.000 0.000 0.000
#> GSM182801     1  0.0000     0.9803 1.000 0.000 0.000 0.000
#> GSM182814     1  0.0000     0.9803 1.000 0.000 0.000 0.000
#> GSM182815     4  0.4948     0.6282 0.000 0.440 0.000 0.560
#> GSM182816     1  0.0000     0.9803 1.000 0.000 0.000 0.000
#> GSM182817     3  0.5428     0.0198 0.016 0.360 0.620 0.004
#> GSM182818     4  0.4948     0.6282 0.000 0.440 0.000 0.560
#> GSM182819     1  0.0000     0.9803 1.000 0.000 0.000 0.000
#> GSM182820     1  0.0000     0.9803 1.000 0.000 0.000 0.000
#> GSM182821     2  0.4728     0.4877 0.000 0.752 0.216 0.032
#> GSM182822     1  0.0000     0.9803 1.000 0.000 0.000 0.000
#> GSM182823     1  0.0000     0.9803 1.000 0.000 0.000 0.000
#> GSM182824     1  0.0000     0.9803 1.000 0.000 0.000 0.000
#> GSM182825     1  0.0000     0.9803 1.000 0.000 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
#> GSM182755     1  0.0794      0.942 0.972 0.000 0.028 0.000 0.000
#> GSM182756     3  0.0609      0.773 0.020 0.000 0.980 0.000 0.000
#> GSM182757     5  0.1124      0.739 0.000 0.004 0.036 0.000 0.960
#> GSM182758     3  0.5727      0.621 0.000 0.044 0.640 0.048 0.268
#> GSM182759     2  0.1082      0.943 0.000 0.964 0.000 0.008 0.028
#> GSM182760     3  0.0992      0.781 0.008 0.000 0.968 0.024 0.000
#> GSM182761     2  0.0290      0.951 0.000 0.992 0.000 0.008 0.000
#> GSM182762     3  0.3861      0.535 0.008 0.000 0.728 0.000 0.264
#> GSM182763     2  0.0162      0.954 0.000 0.996 0.000 0.004 0.000
#> GSM182764     5  0.1124      0.739 0.000 0.004 0.036 0.000 0.960
#> GSM182765     5  0.1124      0.739 0.000 0.004 0.036 0.000 0.960
#> GSM182766     2  0.0609      0.961 0.000 0.980 0.000 0.020 0.000
#> GSM182767     3  0.2654      0.770 0.000 0.000 0.888 0.048 0.064
#> GSM182768     4  0.1732      0.846 0.000 0.000 0.080 0.920 0.000
#> GSM182769     1  0.0609      0.946 0.980 0.000 0.020 0.000 0.000
#> GSM182770     2  0.0609      0.961 0.000 0.980 0.000 0.020 0.000
#> GSM182771     5  0.3305      0.790 0.000 0.224 0.000 0.000 0.776
#> GSM182772     2  0.0609      0.961 0.000 0.980 0.000 0.020 0.000
#> GSM182773     1  0.4310      0.411 0.604 0.000 0.392 0.004 0.000
#> GSM182774     1  0.0290      0.950 0.992 0.000 0.008 0.000 0.000
#> GSM182775     1  0.0794      0.942 0.972 0.000 0.028 0.000 0.000
#> GSM182776     1  0.0000      0.950 1.000 0.000 0.000 0.000 0.000
#> GSM182777     1  0.1851      0.898 0.912 0.000 0.088 0.000 0.000
#> GSM182802     2  0.0609      0.961 0.000 0.980 0.000 0.020 0.000
#> GSM182803     1  0.0162      0.950 0.996 0.000 0.004 0.000 0.000
#> GSM182804     4  0.1544      0.925 0.000 0.068 0.000 0.932 0.000
#> GSM182805     2  0.0609      0.961 0.000 0.980 0.000 0.020 0.000
#> GSM182806     1  0.0162      0.950 0.996 0.000 0.004 0.000 0.000
#> GSM182807     1  0.0162      0.950 0.996 0.000 0.004 0.000 0.000
#> GSM182808     1  0.0162      0.950 0.996 0.000 0.004 0.000 0.000
#> GSM182809     4  0.1544      0.925 0.000 0.068 0.000 0.932 0.000
#> GSM182810     1  0.1710      0.924 0.940 0.000 0.004 0.016 0.040
#> GSM182811     1  0.1808      0.921 0.936 0.000 0.004 0.020 0.040
#> GSM182812     1  0.2728      0.882 0.888 0.000 0.004 0.068 0.040
#> GSM182813     1  0.0162      0.950 0.996 0.000 0.004 0.000 0.000
#> GSM182778     2  0.0609      0.961 0.000 0.980 0.000 0.020 0.000
#> GSM182779     5  0.3876      0.686 0.000 0.316 0.000 0.000 0.684
#> GSM182780     2  0.0162      0.954 0.000 0.996 0.000 0.004 0.000
#> GSM182781     1  0.3857      0.596 0.688 0.000 0.312 0.000 0.000
#> GSM182782     2  0.0609      0.961 0.000 0.980 0.000 0.020 0.000
#> GSM182783     2  0.0451      0.957 0.000 0.988 0.004 0.008 0.000
#> GSM182784     3  0.4641      0.712 0.000 0.020 0.752 0.048 0.180
#> GSM182785     3  0.7615      0.231 0.000 0.308 0.364 0.044 0.284
#> GSM182786     2  0.0609      0.961 0.000 0.980 0.000 0.020 0.000
#> GSM182787     2  0.0000      0.955 0.000 1.000 0.000 0.000 0.000
#> GSM182788     2  0.0609      0.961 0.000 0.980 0.000 0.020 0.000
#> GSM182789     2  0.1471      0.920 0.000 0.952 0.004 0.020 0.024
#> GSM182790     3  0.1638      0.741 0.064 0.000 0.932 0.004 0.000
#> GSM182791     4  0.1502      0.914 0.000 0.056 0.004 0.940 0.000
#> GSM182792     4  0.3519      0.681 0.008 0.000 0.216 0.776 0.000
#> GSM182793     2  0.0609      0.961 0.000 0.980 0.000 0.020 0.000
#> GSM182794     3  0.0324      0.778 0.000 0.000 0.992 0.004 0.004
#> GSM182795     2  0.1799      0.910 0.000 0.940 0.012 0.028 0.020
#> GSM182796     5  0.3336      0.789 0.000 0.228 0.000 0.000 0.772
#> GSM182797     1  0.0162      0.950 0.996 0.000 0.004 0.000 0.000
#> GSM182798     5  0.3336      0.789 0.000 0.228 0.000 0.000 0.772
#> GSM182799     4  0.1410      0.926 0.000 0.060 0.000 0.940 0.000
#> GSM182800     1  0.0451      0.947 0.988 0.000 0.004 0.000 0.008
#> GSM182801     1  0.0000      0.950 1.000 0.000 0.000 0.000 0.000
#> GSM182814     1  0.0162      0.949 0.996 0.000 0.004 0.000 0.000
#> GSM182815     4  0.1608      0.923 0.000 0.072 0.000 0.928 0.000
#> GSM182816     1  0.0703      0.944 0.976 0.000 0.024 0.000 0.000
#> GSM182817     5  0.2304      0.772 0.000 0.068 0.020 0.004 0.908
#> GSM182818     4  0.1270      0.920 0.000 0.052 0.000 0.948 0.000
#> GSM182819     1  0.0794      0.942 0.972 0.000 0.028 0.000 0.000
#> GSM182820     1  0.0162      0.950 0.996 0.000 0.004 0.000 0.000
#> GSM182821     2  0.5790      0.483 0.000 0.652 0.032 0.080 0.236
#> GSM182822     1  0.1728      0.924 0.940 0.000 0.004 0.020 0.036
#> GSM182823     1  0.0162      0.949 0.996 0.000 0.004 0.000 0.000
#> GSM182824     1  0.0000      0.950 1.000 0.000 0.000 0.000 0.000
#> GSM182825     1  0.1710      0.924 0.940 0.000 0.004 0.016 0.040

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>           class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM182755     1  0.0937     0.8381 0.960 0.000 0.000 0.000 0.000 0.040
#> GSM182756     3  0.4200    -0.3120 0.012 0.000 0.592 0.000 0.004 0.392
#> GSM182757     5  0.2039     0.7476 0.000 0.000 0.076 0.000 0.904 0.020
#> GSM182758     3  0.3800     0.3935 0.000 0.036 0.764 0.000 0.192 0.008
#> GSM182759     2  0.0146     0.9430 0.000 0.996 0.000 0.000 0.004 0.000
#> GSM182760     3  0.3606     0.0570 0.004 0.000 0.724 0.008 0.000 0.264
#> GSM182761     2  0.0603     0.9369 0.000 0.980 0.016 0.000 0.004 0.000
#> GSM182762     6  0.7081     0.5020 0.096 0.000 0.348 0.000 0.180 0.376
#> GSM182763     2  0.0405     0.9405 0.000 0.988 0.008 0.000 0.004 0.000
#> GSM182764     5  0.1320     0.7736 0.000 0.000 0.036 0.000 0.948 0.016
#> GSM182765     5  0.1257     0.7753 0.000 0.000 0.028 0.000 0.952 0.020
#> GSM182766     2  0.0000     0.9440 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM182767     3  0.2699     0.3014 0.000 0.000 0.856 0.012 0.008 0.124
#> GSM182768     4  0.4023     0.7294 0.000 0.000 0.144 0.756 0.000 0.100
#> GSM182769     1  0.2260     0.8148 0.860 0.000 0.000 0.000 0.000 0.140
#> GSM182770     2  0.0146     0.9434 0.000 0.996 0.000 0.000 0.000 0.004
#> GSM182771     5  0.2362     0.8018 0.000 0.136 0.000 0.000 0.860 0.004
#> GSM182772     2  0.0146     0.9434 0.000 0.996 0.000 0.000 0.000 0.004
#> GSM182773     1  0.5630    -0.0343 0.508 0.000 0.140 0.004 0.000 0.348
#> GSM182774     1  0.0790     0.8465 0.968 0.000 0.000 0.000 0.000 0.032
#> GSM182775     1  0.1204     0.8304 0.944 0.000 0.000 0.000 0.000 0.056
#> GSM182776     1  0.0146     0.8520 0.996 0.000 0.000 0.000 0.000 0.004
#> GSM182777     1  0.2527     0.7221 0.832 0.000 0.000 0.000 0.000 0.168
#> GSM182802     2  0.0291     0.9418 0.000 0.992 0.000 0.004 0.000 0.004
#> GSM182803     1  0.0000     0.8522 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM182804     4  0.0603     0.8719 0.000 0.016 0.000 0.980 0.000 0.004
#> GSM182805     2  0.0291     0.9418 0.000 0.992 0.000 0.004 0.000 0.004
#> GSM182806     1  0.0000     0.8522 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM182807     1  0.0000     0.8522 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM182808     1  0.0000     0.8522 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM182809     4  0.0458     0.8727 0.000 0.016 0.000 0.984 0.000 0.000
#> GSM182810     1  0.3601     0.6718 0.684 0.000 0.000 0.004 0.000 0.312
#> GSM182811     1  0.4118     0.6484 0.660 0.000 0.000 0.028 0.000 0.312
#> GSM182812     1  0.4703     0.5989 0.620 0.000 0.000 0.068 0.000 0.312
#> GSM182813     1  0.0000     0.8522 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM182778     2  0.0000     0.9440 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM182779     5  0.3774     0.5714 0.000 0.328 0.008 0.000 0.664 0.000
#> GSM182780     2  0.0458     0.9385 0.000 0.984 0.016 0.000 0.000 0.000
#> GSM182781     1  0.5296    -0.2800 0.456 0.000 0.100 0.000 0.000 0.444
#> GSM182782     2  0.0000     0.9440 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM182783     2  0.0713     0.9316 0.000 0.972 0.028 0.000 0.000 0.000
#> GSM182784     3  0.2320     0.4051 0.000 0.000 0.864 0.000 0.132 0.004
#> GSM182785     3  0.5885     0.2781 0.000 0.208 0.564 0.000 0.208 0.020
#> GSM182786     2  0.0000     0.9440 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM182787     2  0.0000     0.9440 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM182788     2  0.0000     0.9440 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM182789     2  0.2572     0.8249 0.000 0.852 0.136 0.000 0.012 0.000
#> GSM182790     6  0.5368     0.4840 0.112 0.000 0.400 0.000 0.000 0.488
#> GSM182791     4  0.2271     0.8511 0.000 0.024 0.036 0.908 0.000 0.032
#> GSM182792     4  0.6084     0.2239 0.000 0.000 0.344 0.424 0.004 0.228
#> GSM182793     2  0.0146     0.9434 0.000 0.996 0.000 0.000 0.000 0.004
#> GSM182794     3  0.4822    -0.5601 0.036 0.000 0.480 0.008 0.000 0.476
#> GSM182795     2  0.3804     0.7003 0.000 0.748 0.220 0.000 0.020 0.012
#> GSM182796     5  0.2219     0.8023 0.000 0.136 0.000 0.000 0.864 0.000
#> GSM182797     1  0.0000     0.8522 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM182798     5  0.2320     0.8038 0.000 0.132 0.000 0.000 0.864 0.004
#> GSM182799     4  0.1036     0.8664 0.000 0.004 0.008 0.964 0.000 0.024
#> GSM182800     1  0.2260     0.8040 0.860 0.000 0.000 0.000 0.000 0.140
#> GSM182801     1  0.0146     0.8520 0.996 0.000 0.000 0.000 0.000 0.004
#> GSM182814     1  0.1663     0.8302 0.912 0.000 0.000 0.000 0.000 0.088
#> GSM182815     4  0.0777     0.8690 0.000 0.024 0.000 0.972 0.000 0.004
#> GSM182816     1  0.0937     0.8381 0.960 0.000 0.000 0.000 0.000 0.040
#> GSM182817     5  0.3242     0.7316 0.000 0.012 0.016 0.012 0.836 0.124
#> GSM182818     4  0.0520     0.8710 0.000 0.008 0.000 0.984 0.000 0.008
#> GSM182819     1  0.0937     0.8381 0.960 0.000 0.000 0.000 0.000 0.040
#> GSM182820     1  0.0000     0.8522 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM182821     2  0.7217     0.2401 0.000 0.516 0.216 0.044 0.140 0.084
#> GSM182822     1  0.3575     0.6936 0.708 0.000 0.000 0.008 0.000 0.284
#> GSM182823     1  0.1387     0.8363 0.932 0.000 0.000 0.000 0.000 0.068
#> GSM182824     1  0.1267     0.8390 0.940 0.000 0.000 0.000 0.000 0.060
#> GSM182825     1  0.3584     0.6758 0.688 0.000 0.000 0.004 0.000 0.308

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 stress(p) development.stage(p) k
#> ATC:skmeans 70     0.342             0.052856 2
#> ATC:skmeans 53     0.454             0.011634 3
#> ATC:skmeans 62     0.355             0.000175 4
#> ATC:skmeans 68     0.848             0.000567 5
#> ATC:skmeans 59     0.789             0.002499 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 18172 rows and 71 columns.
#>   Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'ATC' method.
#>   Subgroups are detected by 'pam' method.
#>   Performed in total 1250 partitions by row resampling.
#>   Best k for subgroups seems to be 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 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.670           0.806       0.917         0.4847 0.493   0.493
#> 3 3 0.952           0.937       0.975         0.2237 0.602   0.387
#> 4 4 0.839           0.810       0.928         0.2043 0.751   0.470
#> 5 5 0.835           0.791       0.914         0.1171 0.864   0.557
#> 6 6 0.850           0.735       0.880         0.0335 0.941   0.723

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
#> GSM182755     1  0.0000      0.901 1.000 0.000
#> GSM182756     1  0.4690      0.880 0.900 0.100
#> GSM182757     2  0.0000      0.898 0.000 1.000
#> GSM182758     2  0.0000      0.898 0.000 1.000
#> GSM182759     2  0.0000      0.898 0.000 1.000
#> GSM182760     1  0.9170      0.538 0.668 0.332
#> GSM182761     2  0.0000      0.898 0.000 1.000
#> GSM182762     1  0.3584      0.906 0.932 0.068
#> GSM182763     2  0.0000      0.898 0.000 1.000
#> GSM182764     2  0.0000      0.898 0.000 1.000
#> GSM182765     2  0.9881      0.211 0.436 0.564
#> GSM182766     2  0.0000      0.898 0.000 1.000
#> GSM182767     1  0.9580      0.423 0.620 0.380
#> GSM182768     1  0.9922      0.210 0.552 0.448
#> GSM182769     1  0.3584      0.906 0.932 0.068
#> GSM182770     2  0.0000      0.898 0.000 1.000
#> GSM182771     2  0.9881      0.211 0.436 0.564
#> GSM182772     2  0.0000      0.898 0.000 1.000
#> GSM182773     1  0.3584      0.906 0.932 0.068
#> GSM182774     1  0.3584      0.906 0.932 0.068
#> GSM182775     1  0.3431      0.906 0.936 0.064
#> GSM182776     1  0.3584      0.906 0.932 0.068
#> GSM182777     1  0.3584      0.906 0.932 0.068
#> GSM182802     2  0.0000      0.898 0.000 1.000
#> GSM182803     1  0.0000      0.901 1.000 0.000
#> GSM182804     2  0.5946      0.764 0.144 0.856
#> GSM182805     2  0.0000      0.898 0.000 1.000
#> GSM182806     1  0.0000      0.901 1.000 0.000
#> GSM182807     1  0.0000      0.901 1.000 0.000
#> GSM182808     1  0.0000      0.901 1.000 0.000
#> GSM182809     2  0.9866      0.223 0.432 0.568
#> GSM182810     1  0.3584      0.906 0.932 0.068
#> GSM182811     1  0.3584      0.906 0.932 0.068
#> GSM182812     1  0.3584      0.906 0.932 0.068
#> GSM182813     1  0.0000      0.901 1.000 0.000
#> GSM182778     2  0.0000      0.898 0.000 1.000
#> GSM182779     2  0.0000      0.898 0.000 1.000
#> GSM182780     2  0.0000      0.898 0.000 1.000
#> GSM182781     1  0.3584      0.906 0.932 0.068
#> GSM182782     2  0.0000      0.898 0.000 1.000
#> GSM182783     2  0.0000      0.898 0.000 1.000
#> GSM182784     2  0.2603      0.865 0.044 0.956
#> GSM182785     2  0.0000      0.898 0.000 1.000
#> GSM182786     2  0.0000      0.898 0.000 1.000
#> GSM182787     2  0.0000      0.898 0.000 1.000
#> GSM182788     2  0.0000      0.898 0.000 1.000
#> GSM182789     2  0.0000      0.898 0.000 1.000
#> GSM182790     1  0.3584      0.906 0.932 0.068
#> GSM182791     2  0.9881      0.211 0.436 0.564
#> GSM182792     1  0.9209      0.530 0.664 0.336
#> GSM182793     2  0.0000      0.898 0.000 1.000
#> GSM182794     1  0.4298      0.891 0.912 0.088
#> GSM182795     2  0.0000      0.898 0.000 1.000
#> GSM182796     2  0.0000      0.898 0.000 1.000
#> GSM182797     1  0.0000      0.901 1.000 0.000
#> GSM182798     2  0.9815      0.256 0.420 0.580
#> GSM182799     2  0.0376      0.895 0.004 0.996
#> GSM182800     1  0.3584      0.906 0.932 0.068
#> GSM182801     1  0.0000      0.901 1.000 0.000
#> GSM182814     1  0.0000      0.901 1.000 0.000
#> GSM182815     2  0.0000      0.898 0.000 1.000
#> GSM182816     1  0.0000      0.901 1.000 0.000
#> GSM182817     1  0.9393      0.484 0.644 0.356
#> GSM182818     2  0.9881      0.211 0.436 0.564
#> GSM182819     1  0.0000      0.901 1.000 0.000
#> GSM182820     1  0.0000      0.901 1.000 0.000
#> GSM182821     2  0.5408      0.789 0.124 0.876
#> GSM182822     1  0.3584      0.906 0.932 0.068
#> GSM182823     1  0.0000      0.901 1.000 0.000
#> GSM182824     1  0.0000      0.901 1.000 0.000
#> GSM182825     1  0.0000      0.901 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
#> GSM182755     1  0.0000      0.945 1.000 0.000 0.000
#> GSM182756     3  0.0000      0.973 0.000 0.000 1.000
#> GSM182757     3  0.0000      0.973 0.000 0.000 1.000
#> GSM182758     3  0.0000      0.973 0.000 0.000 1.000
#> GSM182759     3  0.0000      0.973 0.000 0.000 1.000
#> GSM182760     3  0.0000      0.973 0.000 0.000 1.000
#> GSM182761     2  0.0747      0.979 0.000 0.984 0.016
#> GSM182762     3  0.0000      0.973 0.000 0.000 1.000
#> GSM182763     3  0.0000      0.973 0.000 0.000 1.000
#> GSM182764     3  0.0000      0.973 0.000 0.000 1.000
#> GSM182765     3  0.0000      0.973 0.000 0.000 1.000
#> GSM182766     2  0.0000      0.998 0.000 1.000 0.000
#> GSM182767     3  0.0000      0.973 0.000 0.000 1.000
#> GSM182768     3  0.0000      0.973 0.000 0.000 1.000
#> GSM182769     1  0.6180      0.301 0.584 0.000 0.416
#> GSM182770     2  0.0000      0.998 0.000 1.000 0.000
#> GSM182771     3  0.0000      0.973 0.000 0.000 1.000
#> GSM182772     2  0.0000      0.998 0.000 1.000 0.000
#> GSM182773     3  0.0000      0.973 0.000 0.000 1.000
#> GSM182774     3  0.0000      0.973 0.000 0.000 1.000
#> GSM182775     1  0.2165      0.888 0.936 0.000 0.064
#> GSM182776     1  0.4235      0.753 0.824 0.000 0.176
#> GSM182777     1  0.2261      0.884 0.932 0.000 0.068
#> GSM182802     2  0.0000      0.998 0.000 1.000 0.000
#> GSM182803     1  0.0000      0.945 1.000 0.000 0.000
#> GSM182804     3  0.0000      0.973 0.000 0.000 1.000
#> GSM182805     2  0.0000      0.998 0.000 1.000 0.000
#> GSM182806     1  0.0000      0.945 1.000 0.000 0.000
#> GSM182807     1  0.0000      0.945 1.000 0.000 0.000
#> GSM182808     1  0.0000      0.945 1.000 0.000 0.000
#> GSM182809     3  0.0000      0.973 0.000 0.000 1.000
#> GSM182810     3  0.5138      0.652 0.252 0.000 0.748
#> GSM182811     3  0.0000      0.973 0.000 0.000 1.000
#> GSM182812     3  0.4062      0.794 0.164 0.000 0.836
#> GSM182813     1  0.0000      0.945 1.000 0.000 0.000
#> GSM182778     2  0.0000      0.998 0.000 1.000 0.000
#> GSM182779     3  0.0000      0.973 0.000 0.000 1.000
#> GSM182780     3  0.0000      0.973 0.000 0.000 1.000
#> GSM182781     3  0.5882      0.437 0.348 0.000 0.652
#> GSM182782     2  0.0000      0.998 0.000 1.000 0.000
#> GSM182783     3  0.0000      0.973 0.000 0.000 1.000
#> GSM182784     3  0.0000      0.973 0.000 0.000 1.000
#> GSM182785     3  0.0000      0.973 0.000 0.000 1.000
#> GSM182786     2  0.0000      0.998 0.000 1.000 0.000
#> GSM182787     2  0.0000      0.998 0.000 1.000 0.000
#> GSM182788     2  0.0000      0.998 0.000 1.000 0.000
#> GSM182789     3  0.0000      0.973 0.000 0.000 1.000
#> GSM182790     3  0.0000      0.973 0.000 0.000 1.000
#> GSM182791     3  0.0000      0.973 0.000 0.000 1.000
#> GSM182792     3  0.0000      0.973 0.000 0.000 1.000
#> GSM182793     2  0.0000      0.998 0.000 1.000 0.000
#> GSM182794     3  0.0000      0.973 0.000 0.000 1.000
#> GSM182795     3  0.0000      0.973 0.000 0.000 1.000
#> GSM182796     3  0.0424      0.966 0.000 0.008 0.992
#> GSM182797     1  0.0000      0.945 1.000 0.000 0.000
#> GSM182798     3  0.0000      0.973 0.000 0.000 1.000
#> GSM182799     3  0.0000      0.973 0.000 0.000 1.000
#> GSM182800     3  0.0592      0.962 0.012 0.000 0.988
#> GSM182801     1  0.0000      0.945 1.000 0.000 0.000
#> GSM182814     1  0.0000      0.945 1.000 0.000 0.000
#> GSM182815     3  0.4842      0.708 0.000 0.224 0.776
#> GSM182816     1  0.0000      0.945 1.000 0.000 0.000
#> GSM182817     3  0.0000      0.973 0.000 0.000 1.000
#> GSM182818     3  0.0000      0.973 0.000 0.000 1.000
#> GSM182819     1  0.0000      0.945 1.000 0.000 0.000
#> GSM182820     1  0.0000      0.945 1.000 0.000 0.000
#> GSM182821     3  0.0000      0.973 0.000 0.000 1.000
#> GSM182822     3  0.0000      0.973 0.000 0.000 1.000
#> GSM182823     1  0.0000      0.945 1.000 0.000 0.000
#> GSM182824     1  0.0000      0.945 1.000 0.000 0.000
#> GSM182825     1  0.0000      0.945 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
#> GSM182755     1  0.0000      0.958 1.000 0.000 0.000 0.000
#> GSM182756     4  0.4866      0.388 0.000 0.000 0.404 0.596
#> GSM182757     3  0.0000      0.923 0.000 0.000 1.000 0.000
#> GSM182758     3  0.0336      0.922 0.000 0.000 0.992 0.008
#> GSM182759     3  0.0000      0.923 0.000 0.000 1.000 0.000
#> GSM182760     4  0.4996      0.199 0.000 0.000 0.484 0.516
#> GSM182761     3  0.4996     -0.100 0.000 0.484 0.516 0.000
#> GSM182762     4  0.0000      0.853 0.000 0.000 0.000 1.000
#> GSM182763     3  0.0000      0.923 0.000 0.000 1.000 0.000
#> GSM182764     3  0.0000      0.923 0.000 0.000 1.000 0.000
#> GSM182765     3  0.0188      0.923 0.000 0.000 0.996 0.004
#> GSM182766     2  0.1557      0.873 0.000 0.944 0.056 0.000
#> GSM182767     3  0.2281      0.853 0.000 0.000 0.904 0.096
#> GSM182768     3  0.2589      0.827 0.000 0.000 0.884 0.116
#> GSM182769     4  0.0469      0.852 0.012 0.000 0.000 0.988
#> GSM182770     2  0.0000      0.908 0.000 1.000 0.000 0.000
#> GSM182771     3  0.0188      0.923 0.000 0.000 0.996 0.004
#> GSM182772     2  0.0000      0.908 0.000 1.000 0.000 0.000
#> GSM182773     4  0.0000      0.853 0.000 0.000 0.000 1.000
#> GSM182774     4  0.0000      0.853 0.000 0.000 0.000 1.000
#> GSM182775     4  0.0469      0.852 0.012 0.000 0.000 0.988
#> GSM182776     4  0.0469      0.852 0.012 0.000 0.000 0.988
#> GSM182777     4  0.0469      0.852 0.012 0.000 0.000 0.988
#> GSM182802     2  0.3444      0.760 0.000 0.816 0.184 0.000
#> GSM182803     4  0.0469      0.852 0.012 0.000 0.000 0.988
#> GSM182804     3  0.0817      0.915 0.000 0.000 0.976 0.024
#> GSM182805     2  0.4866      0.350 0.000 0.596 0.404 0.000
#> GSM182806     1  0.0000      0.958 1.000 0.000 0.000 0.000
#> GSM182807     1  0.0000      0.958 1.000 0.000 0.000 0.000
#> GSM182808     1  0.0000      0.958 1.000 0.000 0.000 0.000
#> GSM182809     3  0.0469      0.921 0.000 0.000 0.988 0.012
#> GSM182810     4  0.0336      0.853 0.008 0.000 0.000 0.992
#> GSM182811     4  0.4277      0.601 0.000 0.000 0.280 0.720
#> GSM182812     4  0.0000      0.853 0.000 0.000 0.000 1.000
#> GSM182813     1  0.0000      0.958 1.000 0.000 0.000 0.000
#> GSM182778     2  0.0000      0.908 0.000 1.000 0.000 0.000
#> GSM182779     3  0.0000      0.923 0.000 0.000 1.000 0.000
#> GSM182780     3  0.0000      0.923 0.000 0.000 1.000 0.000
#> GSM182781     4  0.0469      0.852 0.012 0.000 0.000 0.988
#> GSM182782     2  0.0000      0.908 0.000 1.000 0.000 0.000
#> GSM182783     3  0.0000      0.923 0.000 0.000 1.000 0.000
#> GSM182784     3  0.0336      0.922 0.000 0.000 0.992 0.008
#> GSM182785     3  0.0000      0.923 0.000 0.000 1.000 0.000
#> GSM182786     2  0.0000      0.908 0.000 1.000 0.000 0.000
#> GSM182787     3  0.4996     -0.100 0.000 0.484 0.516 0.000
#> GSM182788     2  0.0000      0.908 0.000 1.000 0.000 0.000
#> GSM182789     3  0.0000      0.923 0.000 0.000 1.000 0.000
#> GSM182790     4  0.0000      0.853 0.000 0.000 0.000 1.000
#> GSM182791     3  0.1792      0.881 0.000 0.000 0.932 0.068
#> GSM182792     4  0.4996      0.199 0.000 0.000 0.484 0.516
#> GSM182793     2  0.0000      0.908 0.000 1.000 0.000 0.000
#> GSM182794     4  0.4996      0.199 0.000 0.000 0.484 0.516
#> GSM182795     3  0.0469      0.921 0.000 0.000 0.988 0.012
#> GSM182796     3  0.0000      0.923 0.000 0.000 1.000 0.000
#> GSM182797     1  0.0000      0.958 1.000 0.000 0.000 0.000
#> GSM182798     3  0.0188      0.923 0.000 0.000 0.996 0.004
#> GSM182799     3  0.0469      0.921 0.000 0.000 0.988 0.012
#> GSM182800     4  0.0000      0.853 0.000 0.000 0.000 1.000
#> GSM182801     4  0.0469      0.852 0.012 0.000 0.000 0.988
#> GSM182814     1  0.0000      0.958 1.000 0.000 0.000 0.000
#> GSM182815     3  0.4978      0.459 0.000 0.324 0.664 0.012
#> GSM182816     1  0.4855      0.384 0.600 0.000 0.000 0.400
#> GSM182817     3  0.1792      0.881 0.000 0.000 0.932 0.068
#> GSM182818     3  0.1389      0.898 0.000 0.000 0.952 0.048
#> GSM182819     1  0.0000      0.958 1.000 0.000 0.000 0.000
#> GSM182820     1  0.0000      0.958 1.000 0.000 0.000 0.000
#> GSM182821     3  0.0469      0.921 0.000 0.000 0.988 0.012
#> GSM182822     4  0.0000      0.853 0.000 0.000 0.000 1.000
#> GSM182823     1  0.0000      0.958 1.000 0.000 0.000 0.000
#> GSM182824     1  0.0000      0.958 1.000 0.000 0.000 0.000
#> GSM182825     4  0.0469      0.852 0.012 0.000 0.000 0.988

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>           class entropy silhouette  p1    p2    p3    p4    p5
#> GSM182755     1   0.000      0.958 1.0 0.000 0.000 0.000 0.000
#> GSM182756     3   0.424      0.201 0.0 0.000 0.572 0.428 0.000
#> GSM182757     5   0.000      0.717 0.0 0.000 0.000 0.000 1.000
#> GSM182758     4   0.403      0.325 0.0 0.000 0.000 0.648 0.352
#> GSM182759     5   0.000      0.717 0.0 0.000 0.000 0.000 1.000
#> GSM182760     4   0.000      0.881 0.0 0.000 0.000 1.000 0.000
#> GSM182761     5   0.000      0.717 0.0 0.000 0.000 0.000 1.000
#> GSM182762     3   0.406      0.480 0.0 0.000 0.640 0.000 0.360
#> GSM182763     5   0.351      0.613 0.0 0.000 0.000 0.252 0.748
#> GSM182764     5   0.000      0.717 0.0 0.000 0.000 0.000 1.000
#> GSM182765     5   0.403      0.418 0.0 0.000 0.000 0.352 0.648
#> GSM182766     2   0.141      0.910 0.0 0.940 0.000 0.000 0.060
#> GSM182767     4   0.000      0.881 0.0 0.000 0.000 1.000 0.000
#> GSM182768     4   0.000      0.881 0.0 0.000 0.000 1.000 0.000
#> GSM182769     3   0.000      0.945 0.0 0.000 1.000 0.000 0.000
#> GSM182770     2   0.000      0.961 0.0 1.000 0.000 0.000 0.000
#> GSM182771     5   0.405      0.411 0.0 0.000 0.000 0.356 0.644
#> GSM182772     2   0.000      0.961 0.0 1.000 0.000 0.000 0.000
#> GSM182773     3   0.000      0.945 0.0 0.000 1.000 0.000 0.000
#> GSM182774     3   0.000      0.945 0.0 0.000 1.000 0.000 0.000
#> GSM182775     3   0.000      0.945 0.0 0.000 1.000 0.000 0.000
#> GSM182776     3   0.000      0.945 0.0 0.000 1.000 0.000 0.000
#> GSM182777     3   0.000      0.945 0.0 0.000 1.000 0.000 0.000
#> GSM182802     2   0.307      0.716 0.0 0.804 0.000 0.000 0.196
#> GSM182803     3   0.000      0.945 0.0 0.000 1.000 0.000 0.000
#> GSM182804     4   0.000      0.881 0.0 0.000 0.000 1.000 0.000
#> GSM182805     5   0.415      0.318 0.0 0.388 0.000 0.000 0.612
#> GSM182806     1   0.000      0.958 1.0 0.000 0.000 0.000 0.000
#> GSM182807     1   0.000      0.958 1.0 0.000 0.000 0.000 0.000
#> GSM182808     1   0.000      0.958 1.0 0.000 0.000 0.000 0.000
#> GSM182809     4   0.000      0.881 0.0 0.000 0.000 1.000 0.000
#> GSM182810     3   0.000      0.945 0.0 0.000 1.000 0.000 0.000
#> GSM182811     4   0.318      0.641 0.0 0.000 0.208 0.792 0.000
#> GSM182812     3   0.000      0.945 0.0 0.000 1.000 0.000 0.000
#> GSM182813     1   0.000      0.958 1.0 0.000 0.000 0.000 0.000
#> GSM182778     2   0.000      0.961 0.0 1.000 0.000 0.000 0.000
#> GSM182779     5   0.000      0.717 0.0 0.000 0.000 0.000 1.000
#> GSM182780     5   0.406      0.477 0.0 0.000 0.000 0.360 0.640
#> GSM182781     3   0.000      0.945 0.0 0.000 1.000 0.000 0.000
#> GSM182782     2   0.000      0.961 0.0 1.000 0.000 0.000 0.000
#> GSM182783     5   0.410      0.455 0.0 0.000 0.000 0.372 0.628
#> GSM182784     4   0.407      0.295 0.0 0.000 0.000 0.636 0.364
#> GSM182785     5   0.293      0.670 0.0 0.000 0.000 0.180 0.820
#> GSM182786     2   0.000      0.961 0.0 1.000 0.000 0.000 0.000
#> GSM182787     5   0.406      0.372 0.0 0.360 0.000 0.000 0.640
#> GSM182788     2   0.000      0.961 0.0 1.000 0.000 0.000 0.000
#> GSM182789     5   0.406      0.477 0.0 0.000 0.000 0.360 0.640
#> GSM182790     3   0.000      0.945 0.0 0.000 1.000 0.000 0.000
#> GSM182791     4   0.000      0.881 0.0 0.000 0.000 1.000 0.000
#> GSM182792     4   0.000      0.881 0.0 0.000 0.000 1.000 0.000
#> GSM182793     2   0.000      0.961 0.0 1.000 0.000 0.000 0.000
#> GSM182794     4   0.228      0.767 0.0 0.000 0.120 0.880 0.000
#> GSM182795     4   0.191      0.795 0.0 0.000 0.000 0.908 0.092
#> GSM182796     5   0.000      0.717 0.0 0.000 0.000 0.000 1.000
#> GSM182797     1   0.000      0.958 1.0 0.000 0.000 0.000 0.000
#> GSM182798     5   0.403      0.418 0.0 0.000 0.000 0.352 0.648
#> GSM182799     4   0.000      0.881 0.0 0.000 0.000 1.000 0.000
#> GSM182800     3   0.000      0.945 0.0 0.000 1.000 0.000 0.000
#> GSM182801     3   0.000      0.945 0.0 0.000 1.000 0.000 0.000
#> GSM182814     1   0.000      0.958 1.0 0.000 0.000 0.000 0.000
#> GSM182815     4   0.318      0.645 0.0 0.208 0.000 0.792 0.000
#> GSM182816     1   0.418      0.348 0.6 0.000 0.400 0.000 0.000
#> GSM182817     4   0.000      0.881 0.0 0.000 0.000 1.000 0.000
#> GSM182818     4   0.000      0.881 0.0 0.000 0.000 1.000 0.000
#> GSM182819     1   0.000      0.958 1.0 0.000 0.000 0.000 0.000
#> GSM182820     1   0.000      0.958 1.0 0.000 0.000 0.000 0.000
#> GSM182821     4   0.000      0.881 0.0 0.000 0.000 1.000 0.000
#> GSM182822     3   0.000      0.945 0.0 0.000 1.000 0.000 0.000
#> GSM182823     1   0.000      0.958 1.0 0.000 0.000 0.000 0.000
#> GSM182824     1   0.000      0.958 1.0 0.000 0.000 0.000 0.000
#> GSM182825     3   0.000      0.945 0.0 0.000 1.000 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
#> GSM182755     1   0.000     0.9548 1.0 0.000 0.000 0.000 0.000 0.000
#> GSM182756     6   0.412     0.2378 0.0 0.000 0.416 0.012 0.000 0.572
#> GSM182757     5   0.000     0.6714 0.0 0.000 0.000 0.000 1.000 0.000
#> GSM182758     3   0.549     0.3413 0.0 0.000 0.568 0.212 0.220 0.000
#> GSM182759     5   0.161     0.6000 0.0 0.000 0.000 0.084 0.916 0.000
#> GSM182760     3   0.000     0.8952 0.0 0.000 1.000 0.000 0.000 0.000
#> GSM182761     4   0.387     0.1715 0.0 0.000 0.000 0.516 0.484 0.000
#> GSM182762     5   0.387    -0.0407 0.0 0.000 0.000 0.000 0.516 0.484
#> GSM182763     5   0.487     0.2677 0.0 0.000 0.108 0.252 0.640 0.000
#> GSM182764     5   0.000     0.6714 0.0 0.000 0.000 0.000 1.000 0.000
#> GSM182765     5   0.294     0.5859 0.0 0.000 0.220 0.000 0.780 0.000
#> GSM182766     4   0.315     0.3086 0.0 0.252 0.000 0.748 0.000 0.000
#> GSM182767     3   0.000     0.8952 0.0 0.000 1.000 0.000 0.000 0.000
#> GSM182768     3   0.000     0.8952 0.0 0.000 1.000 0.000 0.000 0.000
#> GSM182769     6   0.000     0.9664 0.0 0.000 0.000 0.000 0.000 1.000
#> GSM182770     2   0.000     1.0000 0.0 1.000 0.000 0.000 0.000 0.000
#> GSM182771     5   0.294     0.5859 0.0 0.000 0.220 0.000 0.780 0.000
#> GSM182772     2   0.000     1.0000 0.0 1.000 0.000 0.000 0.000 0.000
#> GSM182773     6   0.000     0.9664 0.0 0.000 0.000 0.000 0.000 1.000
#> GSM182774     6   0.000     0.9664 0.0 0.000 0.000 0.000 0.000 1.000
#> GSM182775     6   0.000     0.9664 0.0 0.000 0.000 0.000 0.000 1.000
#> GSM182776     6   0.000     0.9664 0.0 0.000 0.000 0.000 0.000 1.000
#> GSM182777     6   0.000     0.9664 0.0 0.000 0.000 0.000 0.000 1.000
#> GSM182802     4   0.315     0.3086 0.0 0.252 0.000 0.748 0.000 0.000
#> GSM182803     6   0.000     0.9664 0.0 0.000 0.000 0.000 0.000 1.000
#> GSM182804     3   0.000     0.8952 0.0 0.000 1.000 0.000 0.000 0.000
#> GSM182805     4   0.315     0.3086 0.0 0.252 0.000 0.748 0.000 0.000
#> GSM182806     1   0.000     0.9548 1.0 0.000 0.000 0.000 0.000 0.000
#> GSM182807     1   0.000     0.9548 1.0 0.000 0.000 0.000 0.000 0.000
#> GSM182808     1   0.000     0.9548 1.0 0.000 0.000 0.000 0.000 0.000
#> GSM182809     3   0.000     0.8952 0.0 0.000 1.000 0.000 0.000 0.000
#> GSM182810     6   0.000     0.9664 0.0 0.000 0.000 0.000 0.000 1.000
#> GSM182811     3   0.285     0.6757 0.0 0.000 0.792 0.000 0.000 0.208
#> GSM182812     6   0.000     0.9664 0.0 0.000 0.000 0.000 0.000 1.000
#> GSM182813     1   0.000     0.9548 1.0 0.000 0.000 0.000 0.000 0.000
#> GSM182778     2   0.000     1.0000 0.0 1.000 0.000 0.000 0.000 0.000
#> GSM182779     5   0.026     0.6677 0.0 0.000 0.000 0.008 0.992 0.000
#> GSM182780     4   0.387     0.1715 0.0 0.000 0.000 0.516 0.484 0.000
#> GSM182781     6   0.000     0.9664 0.0 0.000 0.000 0.000 0.000 1.000
#> GSM182782     2   0.000     1.0000 0.0 1.000 0.000 0.000 0.000 0.000
#> GSM182783     4   0.368     0.2963 0.0 0.000 0.004 0.664 0.332 0.000
#> GSM182784     3   0.570     0.2567 0.0 0.000 0.524 0.252 0.224 0.000
#> GSM182785     5   0.408     0.3473 0.0 0.000 0.044 0.252 0.704 0.000
#> GSM182786     2   0.000     1.0000 0.0 1.000 0.000 0.000 0.000 0.000
#> GSM182787     4   0.387     0.1715 0.0 0.000 0.000 0.516 0.484 0.000
#> GSM182788     2   0.000     1.0000 0.0 1.000 0.000 0.000 0.000 0.000
#> GSM182789     4   0.387     0.1715 0.0 0.000 0.000 0.516 0.484 0.000
#> GSM182790     6   0.000     0.9664 0.0 0.000 0.000 0.000 0.000 1.000
#> GSM182791     3   0.000     0.8952 0.0 0.000 1.000 0.000 0.000 0.000
#> GSM182792     3   0.000     0.8952 0.0 0.000 1.000 0.000 0.000 0.000
#> GSM182793     4   0.322     0.2908 0.0 0.264 0.000 0.736 0.000 0.000
#> GSM182794     3   0.270     0.7680 0.0 0.000 0.856 0.000 0.028 0.116
#> GSM182795     3   0.172     0.8358 0.0 0.000 0.924 0.016 0.060 0.000
#> GSM182796     5   0.000     0.6714 0.0 0.000 0.000 0.000 1.000 0.000
#> GSM182797     1   0.000     0.9548 1.0 0.000 0.000 0.000 0.000 0.000
#> GSM182798     5   0.294     0.5859 0.0 0.000 0.220 0.000 0.780 0.000
#> GSM182799     3   0.000     0.8952 0.0 0.000 1.000 0.000 0.000 0.000
#> GSM182800     6   0.000     0.9664 0.0 0.000 0.000 0.000 0.000 1.000
#> GSM182801     6   0.000     0.9664 0.0 0.000 0.000 0.000 0.000 1.000
#> GSM182814     1   0.000     0.9548 1.0 0.000 0.000 0.000 0.000 0.000
#> GSM182815     4   0.567     0.0851 0.0 0.164 0.352 0.484 0.000 0.000
#> GSM182816     1   0.376     0.3465 0.6 0.000 0.000 0.000 0.000 0.400
#> GSM182817     3   0.000     0.8952 0.0 0.000 1.000 0.000 0.000 0.000
#> GSM182818     3   0.000     0.8952 0.0 0.000 1.000 0.000 0.000 0.000
#> GSM182819     1   0.000     0.9548 1.0 0.000 0.000 0.000 0.000 0.000
#> GSM182820     1   0.000     0.9548 1.0 0.000 0.000 0.000 0.000 0.000
#> GSM182821     3   0.000     0.8952 0.0 0.000 1.000 0.000 0.000 0.000
#> GSM182822     6   0.000     0.9664 0.0 0.000 0.000 0.000 0.000 1.000
#> GSM182823     1   0.000     0.9548 1.0 0.000 0.000 0.000 0.000 0.000
#> GSM182824     1   0.000     0.9548 1.0 0.000 0.000 0.000 0.000 0.000
#> GSM182825     6   0.000     0.9664 0.0 0.000 0.000 0.000 0.000 1.000

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

consensus_heatmap(res, k = 2)

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 stress(p) development.stage(p) k
#> ATC:pam 62     0.435              0.02009 2
#> ATC:pam 69     0.994              0.00363 3
#> ATC:pam 62     0.566              0.00141 4
#> ATC:pam 58     0.754              0.00172 5
#> ATC:pam 54     0.709              0.00124 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 18172 rows and 71 columns.
#>   Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'ATC' method.
#>   Subgroups are detected by 'mclust' method.
#>   Performed in total 1250 partitions by row resampling.
#>   Best k for subgroups seems to be 2.
#> 
#> Following methods can be applied to this 'ConsensusPartition' object:
#>  [1] "cola_report"             "collect_classes"         "collect_plots"          
#>  [4] "collect_stats"           "colnames"                "compare_signatures"     
#>  [7] "consensus_heatmap"       "dimension_reduction"     "functional_enrichment"  
#> [10] "get_anno_col"            "get_anno"                "get_classes"            
#> [13] "get_consensus"           "get_matrix"              "get_membership"         
#> [16] "get_param"               "get_signatures"          "get_stats"              
#> [19] "is_best_k"               "is_stable_k"             "membership_heatmap"     
#> [22] "ncol"                    "nrow"                    "plot_ecdf"              
#> [25] "rownames"                "select_partition_number" "show"                   
#> [28] "suggest_best_k"          "test_to_known_factors"

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

collect_plots(res)

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 0.910           0.895       0.960         0.4221 0.577   0.577
#> 3 3 0.498           0.755       0.836         0.4352 0.771   0.614
#> 4 4 0.509           0.592       0.745         0.1105 0.720   0.412
#> 5 5 0.643           0.763       0.873         0.0885 0.938   0.799
#> 6 6 0.668           0.516       0.722         0.0773 0.877   0.579

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
#> GSM182755     1  0.0000     0.9669 1.000 0.000
#> GSM182756     2  0.2948     0.9087 0.052 0.948
#> GSM182757     1  0.0938     0.9572 0.988 0.012
#> GSM182758     2  0.0000     0.9271 0.000 1.000
#> GSM182759     1  0.0000     0.9669 1.000 0.000
#> GSM182760     2  0.0000     0.9271 0.000 1.000
#> GSM182761     1  0.2043     0.9390 0.968 0.032
#> GSM182762     1  0.0000     0.9669 1.000 0.000
#> GSM182763     1  0.0938     0.9572 0.988 0.012
#> GSM182764     1  0.0000     0.9669 1.000 0.000
#> GSM182765     1  0.0000     0.9669 1.000 0.000
#> GSM182766     1  0.0000     0.9669 1.000 0.000
#> GSM182767     2  0.0000     0.9271 0.000 1.000
#> GSM182768     2  0.0000     0.9271 0.000 1.000
#> GSM182769     2  0.0376     0.9263 0.004 0.996
#> GSM182770     1  0.0000     0.9669 1.000 0.000
#> GSM182771     1  0.0000     0.9669 1.000 0.000
#> GSM182772     1  0.0000     0.9669 1.000 0.000
#> GSM182773     2  0.0000     0.9271 0.000 1.000
#> GSM182774     1  0.0000     0.9669 1.000 0.000
#> GSM182775     2  0.0000     0.9271 0.000 1.000
#> GSM182776     1  0.9954     0.0708 0.540 0.460
#> GSM182777     2  0.2778     0.9111 0.048 0.952
#> GSM182802     1  0.0000     0.9669 1.000 0.000
#> GSM182803     1  0.0000     0.9669 1.000 0.000
#> GSM182804     1  0.0000     0.9669 1.000 0.000
#> GSM182805     1  0.0000     0.9669 1.000 0.000
#> GSM182806     1  0.0000     0.9669 1.000 0.000
#> GSM182807     1  0.0000     0.9669 1.000 0.000
#> GSM182808     1  0.0000     0.9669 1.000 0.000
#> GSM182809     1  0.0000     0.9669 1.000 0.000
#> GSM182810     1  0.0000     0.9669 1.000 0.000
#> GSM182811     1  0.0000     0.9669 1.000 0.000
#> GSM182812     1  0.0000     0.9669 1.000 0.000
#> GSM182813     1  0.0000     0.9669 1.000 0.000
#> GSM182778     1  0.0000     0.9669 1.000 0.000
#> GSM182779     1  0.1633     0.9468 0.976 0.024
#> GSM182780     2  0.0000     0.9271 0.000 1.000
#> GSM182781     2  0.9996     0.0594 0.488 0.512
#> GSM182782     1  0.0000     0.9669 1.000 0.000
#> GSM182783     2  0.5737     0.8336 0.136 0.864
#> GSM182784     2  0.0000     0.9271 0.000 1.000
#> GSM182785     2  0.4022     0.8896 0.080 0.920
#> GSM182786     1  0.0000     0.9669 1.000 0.000
#> GSM182787     1  0.9710     0.2799 0.600 0.400
#> GSM182788     1  0.0000     0.9669 1.000 0.000
#> GSM182789     2  0.2603     0.9131 0.044 0.956
#> GSM182790     2  0.0000     0.9271 0.000 1.000
#> GSM182791     2  0.9795     0.3214 0.416 0.584
#> GSM182792     2  0.1633     0.9209 0.024 0.976
#> GSM182793     1  0.0000     0.9669 1.000 0.000
#> GSM182794     2  0.0000     0.9271 0.000 1.000
#> GSM182795     2  0.0000     0.9271 0.000 1.000
#> GSM182796     1  0.0000     0.9669 1.000 0.000
#> GSM182797     1  0.0000     0.9669 1.000 0.000
#> GSM182798     1  0.0000     0.9669 1.000 0.000
#> GSM182799     1  0.4298     0.8774 0.912 0.088
#> GSM182800     1  0.0000     0.9669 1.000 0.000
#> GSM182801     2  0.4690     0.8682 0.100 0.900
#> GSM182814     1  0.0000     0.9669 1.000 0.000
#> GSM182815     1  0.0000     0.9669 1.000 0.000
#> GSM182816     1  0.9850     0.1808 0.572 0.428
#> GSM182817     1  0.0000     0.9669 1.000 0.000
#> GSM182818     1  0.0000     0.9669 1.000 0.000
#> GSM182819     1  0.0000     0.9669 1.000 0.000
#> GSM182820     1  0.0000     0.9669 1.000 0.000
#> GSM182821     1  0.1633     0.9458 0.976 0.024
#> GSM182822     1  0.0000     0.9669 1.000 0.000
#> GSM182823     1  0.0000     0.9669 1.000 0.000
#> GSM182824     1  0.0000     0.9669 1.000 0.000
#> GSM182825     1  0.0000     0.9669 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
#> GSM182755     1  0.4654      0.842 0.792 0.208 0.000
#> GSM182756     3  0.1163      0.897 0.000 0.028 0.972
#> GSM182757     2  0.5285      0.735 0.244 0.752 0.004
#> GSM182758     3  0.0000      0.901 0.000 0.000 1.000
#> GSM182759     2  0.4654      0.749 0.208 0.792 0.000
#> GSM182760     3  0.0000      0.901 0.000 0.000 1.000
#> GSM182761     2  0.6693      0.714 0.148 0.748 0.104
#> GSM182762     2  0.5098      0.733 0.248 0.752 0.000
#> GSM182763     2  0.5681      0.734 0.236 0.748 0.016
#> GSM182764     2  0.5058      0.734 0.244 0.756 0.000
#> GSM182765     2  0.5058      0.734 0.244 0.756 0.000
#> GSM182766     2  0.5178      0.735 0.256 0.744 0.000
#> GSM182767     3  0.0000      0.901 0.000 0.000 1.000
#> GSM182768     3  0.0000      0.901 0.000 0.000 1.000
#> GSM182769     3  0.1031      0.896 0.000 0.024 0.976
#> GSM182770     2  0.2356      0.715 0.072 0.928 0.000
#> GSM182771     2  0.4605      0.750 0.204 0.796 0.000
#> GSM182772     2  0.2959      0.727 0.100 0.900 0.000
#> GSM182773     3  0.0000      0.901 0.000 0.000 1.000
#> GSM182774     2  0.5098      0.729 0.248 0.752 0.000
#> GSM182775     3  0.0000      0.901 0.000 0.000 1.000
#> GSM182776     3  0.5635      0.707 0.036 0.180 0.784
#> GSM182777     3  0.1031      0.898 0.000 0.024 0.976
#> GSM182802     2  0.0592      0.744 0.012 0.988 0.000
#> GSM182803     1  0.5016      0.817 0.760 0.240 0.000
#> GSM182804     2  0.0237      0.740 0.000 0.996 0.004
#> GSM182805     2  0.2537      0.763 0.080 0.920 0.000
#> GSM182806     1  0.4842      0.844 0.776 0.224 0.000
#> GSM182807     1  0.5058      0.852 0.756 0.244 0.000
#> GSM182808     1  0.6154      0.770 0.592 0.408 0.000
#> GSM182809     2  0.0424      0.740 0.000 0.992 0.008
#> GSM182810     2  0.2878      0.672 0.096 0.904 0.000
#> GSM182811     2  0.2448      0.761 0.076 0.924 0.000
#> GSM182812     2  0.0237      0.739 0.004 0.996 0.000
#> GSM182813     1  0.5706      0.828 0.680 0.320 0.000
#> GSM182778     2  0.4178      0.728 0.172 0.828 0.000
#> GSM182779     2  0.5899      0.728 0.244 0.736 0.020
#> GSM182780     3  0.2165      0.871 0.000 0.064 0.936
#> GSM182781     3  0.6208      0.667 0.088 0.136 0.776
#> GSM182782     2  0.6126      0.604 0.400 0.600 0.000
#> GSM182783     3  0.6330      0.283 0.004 0.396 0.600
#> GSM182784     3  0.0000      0.901 0.000 0.000 1.000
#> GSM182785     3  0.2537      0.864 0.000 0.080 0.920
#> GSM182786     2  0.6126      0.604 0.400 0.600 0.000
#> GSM182787     2  0.6033      0.482 0.004 0.660 0.336
#> GSM182788     2  0.6126      0.604 0.400 0.600 0.000
#> GSM182789     3  0.1163      0.897 0.000 0.028 0.972
#> GSM182790     3  0.0000      0.901 0.000 0.000 1.000
#> GSM182791     3  0.4821      0.799 0.040 0.120 0.840
#> GSM182792     3  0.0892      0.899 0.000 0.020 0.980
#> GSM182793     2  0.0661      0.739 0.008 0.988 0.004
#> GSM182794     3  0.0000      0.901 0.000 0.000 1.000
#> GSM182795     3  0.0000      0.901 0.000 0.000 1.000
#> GSM182796     2  0.4605      0.750 0.204 0.796 0.000
#> GSM182797     1  0.4750      0.850 0.784 0.216 0.000
#> GSM182798     2  0.4605      0.750 0.204 0.796 0.000
#> GSM182799     2  0.4326      0.620 0.012 0.844 0.144
#> GSM182800     2  0.5178      0.527 0.164 0.808 0.028
#> GSM182801     3  0.3038      0.836 0.000 0.104 0.896
#> GSM182814     1  0.6244      0.751 0.560 0.440 0.000
#> GSM182815     2  0.0661      0.739 0.008 0.988 0.004
#> GSM182816     3  0.9150      0.292 0.232 0.224 0.544
#> GSM182817     2  0.4605      0.750 0.204 0.796 0.000
#> GSM182818     2  0.0661      0.739 0.008 0.988 0.004
#> GSM182819     1  0.4750      0.850 0.784 0.216 0.000
#> GSM182820     1  0.4750      0.850 0.784 0.216 0.000
#> GSM182821     2  0.8333      0.411 0.100 0.572 0.328
#> GSM182822     2  0.3042      0.711 0.040 0.920 0.040
#> GSM182823     1  0.6244      0.751 0.560 0.440 0.000
#> GSM182824     1  0.6168      0.766 0.588 0.412 0.000
#> GSM182825     2  0.3340      0.599 0.120 0.880 0.000

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM182755     1  0.6746     0.6281 0.568 0.000 0.116 0.316
#> GSM182756     3  0.0188     0.8360 0.000 0.000 0.996 0.004
#> GSM182757     3  0.5441     0.2790 0.004 0.012 0.588 0.396
#> GSM182758     3  0.0000     0.8358 0.000 0.000 1.000 0.000
#> GSM182759     4  0.4679     0.4917 0.000 0.352 0.000 0.648
#> GSM182760     3  0.0000     0.8358 0.000 0.000 1.000 0.000
#> GSM182761     3  0.4980     0.5529 0.008 0.012 0.708 0.272
#> GSM182762     4  0.7715     0.2727 0.160 0.044 0.208 0.588
#> GSM182763     3  0.5391     0.3208 0.004 0.012 0.604 0.380
#> GSM182764     4  0.6756     0.5062 0.000 0.188 0.200 0.612
#> GSM182765     4  0.6483     0.4089 0.000 0.092 0.324 0.584
#> GSM182766     2  0.4897     0.2115 0.004 0.668 0.004 0.324
#> GSM182767     3  0.0000     0.8358 0.000 0.000 1.000 0.000
#> GSM182768     3  0.0000     0.8358 0.000 0.000 1.000 0.000
#> GSM182769     3  0.0188     0.8355 0.000 0.004 0.996 0.000
#> GSM182770     2  0.2197     0.6298 0.004 0.916 0.000 0.080
#> GSM182771     4  0.4624     0.5024 0.000 0.340 0.000 0.660
#> GSM182772     2  0.2530     0.6208 0.004 0.896 0.000 0.100
#> GSM182773     3  0.0000     0.8358 0.000 0.000 1.000 0.000
#> GSM182774     1  0.7808     0.4935 0.480 0.044 0.096 0.380
#> GSM182775     3  0.0000     0.8358 0.000 0.000 1.000 0.000
#> GSM182776     3  0.1892     0.8215 0.004 0.016 0.944 0.036
#> GSM182777     3  0.0188     0.8360 0.000 0.000 0.996 0.004
#> GSM182802     2  0.3355     0.5897 0.004 0.836 0.000 0.160
#> GSM182803     1  0.4500     0.7904 0.684 0.000 0.000 0.316
#> GSM182804     2  0.7050     0.4104 0.004 0.460 0.104 0.432
#> GSM182805     2  0.4088     0.4817 0.004 0.764 0.000 0.232
#> GSM182806     1  0.4500     0.7904 0.684 0.000 0.000 0.316
#> GSM182807     1  0.4655     0.7919 0.684 0.004 0.000 0.312
#> GSM182808     1  0.5471     0.7834 0.684 0.048 0.000 0.268
#> GSM182809     3  0.9483    -0.0751 0.144 0.304 0.376 0.176
#> GSM182810     1  0.7254     0.4685 0.524 0.176 0.000 0.300
#> GSM182811     4  0.6798    -0.4550 0.396 0.100 0.000 0.504
#> GSM182812     4  0.7301    -0.0427 0.232 0.232 0.000 0.536
#> GSM182813     1  0.4957     0.7932 0.684 0.016 0.000 0.300
#> GSM182778     2  0.0927     0.6182 0.016 0.976 0.000 0.008
#> GSM182779     4  0.6935     0.4099 0.004 0.112 0.332 0.552
#> GSM182780     3  0.1743     0.8176 0.000 0.004 0.940 0.056
#> GSM182781     3  0.3764     0.6125 0.000 0.000 0.784 0.216
#> GSM182782     2  0.4673     0.5019 0.292 0.700 0.000 0.008
#> GSM182783     3  0.3409     0.7889 0.008 0.024 0.872 0.096
#> GSM182784     3  0.0000     0.8358 0.000 0.000 1.000 0.000
#> GSM182785     3  0.2053     0.8135 0.004 0.000 0.924 0.072
#> GSM182786     2  0.4673     0.5019 0.292 0.700 0.000 0.008
#> GSM182787     3  0.2927     0.7953 0.008 0.024 0.900 0.068
#> GSM182788     2  0.4673     0.5019 0.292 0.700 0.000 0.008
#> GSM182789     3  0.1792     0.8157 0.000 0.000 0.932 0.068
#> GSM182790     3  0.0000     0.8358 0.000 0.000 1.000 0.000
#> GSM182791     3  0.1822     0.8235 0.004 0.008 0.944 0.044
#> GSM182792     3  0.0000     0.8358 0.000 0.000 1.000 0.000
#> GSM182793     2  0.4718     0.5900 0.008 0.716 0.004 0.272
#> GSM182794     3  0.0188     0.8360 0.000 0.000 0.996 0.004
#> GSM182795     3  0.0000     0.8358 0.000 0.000 1.000 0.000
#> GSM182796     4  0.4936     0.4960 0.008 0.340 0.000 0.652
#> GSM182797     1  0.4500     0.7904 0.684 0.000 0.000 0.316
#> GSM182798     4  0.4936     0.4960 0.008 0.340 0.000 0.652
#> GSM182799     3  0.6850     0.4487 0.012 0.300 0.592 0.096
#> GSM182800     1  0.9357     0.1965 0.368 0.108 0.204 0.320
#> GSM182801     3  0.0657     0.8339 0.000 0.012 0.984 0.004
#> GSM182814     1  0.5519     0.7803 0.684 0.052 0.000 0.264
#> GSM182815     2  0.5509     0.5064 0.012 0.560 0.004 0.424
#> GSM182816     3  0.6163     0.2852 0.364 0.000 0.576 0.060
#> GSM182817     4  0.4917     0.5033 0.008 0.336 0.000 0.656
#> GSM182818     2  0.7365     0.4036 0.012 0.452 0.112 0.424
#> GSM182819     1  0.6878     0.6026 0.556 0.000 0.128 0.316
#> GSM182820     1  0.4500     0.7904 0.684 0.000 0.000 0.316
#> GSM182821     3  0.4406     0.7036 0.004 0.044 0.808 0.144
#> GSM182822     3  0.9195    -0.1515 0.148 0.128 0.412 0.312
#> GSM182823     1  0.5308     0.7893 0.684 0.036 0.000 0.280
#> GSM182824     1  0.5790     0.7521 0.684 0.080 0.000 0.236
#> GSM182825     1  0.7346     0.4268 0.520 0.200 0.000 0.280

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>           class entropy silhouette    p1    p2    p3    p4    p5
#> GSM182755     1  0.0000      0.854 1.000 0.000 0.000 0.000 0.000
#> GSM182756     3  0.0162      0.866 0.000 0.000 0.996 0.000 0.004
#> GSM182757     5  0.5882      0.354 0.008 0.000 0.280 0.112 0.600
#> GSM182758     3  0.0290      0.866 0.000 0.000 0.992 0.000 0.008
#> GSM182759     5  0.2935      0.790 0.016 0.004 0.000 0.120 0.860
#> GSM182760     3  0.0162      0.866 0.000 0.000 0.996 0.000 0.004
#> GSM182761     3  0.5665      0.598 0.004 0.000 0.624 0.112 0.260
#> GSM182762     5  0.2784      0.790 0.016 0.000 0.004 0.108 0.872
#> GSM182763     3  0.5779      0.602 0.008 0.000 0.624 0.116 0.252
#> GSM182764     5  0.2625      0.791 0.016 0.000 0.000 0.108 0.876
#> GSM182765     5  0.2784      0.791 0.016 0.000 0.004 0.108 0.872
#> GSM182766     2  0.6005      0.583 0.016 0.620 0.000 0.128 0.236
#> GSM182767     3  0.0162      0.866 0.000 0.000 0.996 0.000 0.004
#> GSM182768     3  0.0404      0.866 0.000 0.000 0.988 0.000 0.012
#> GSM182769     3  0.0324      0.865 0.000 0.000 0.992 0.004 0.004
#> GSM182770     2  0.4333      0.769 0.012 0.788 0.000 0.120 0.080
#> GSM182771     5  0.4889      0.750 0.016 0.108 0.000 0.128 0.748
#> GSM182772     2  0.4386      0.769 0.016 0.788 0.000 0.116 0.080
#> GSM182773     3  0.0162      0.865 0.000 0.000 0.996 0.000 0.004
#> GSM182774     1  0.5183      0.623 0.748 0.000 0.064 0.112 0.076
#> GSM182775     3  0.0324      0.865 0.000 0.000 0.992 0.004 0.004
#> GSM182776     3  0.1808      0.853 0.008 0.000 0.936 0.044 0.012
#> GSM182777     3  0.0000      0.865 0.000 0.000 1.000 0.000 0.000
#> GSM182802     2  0.4635      0.757 0.016 0.768 0.000 0.128 0.088
#> GSM182803     1  0.0162      0.851 0.996 0.000 0.004 0.000 0.000
#> GSM182804     4  0.1251      0.966 0.008 0.000 0.000 0.956 0.036
#> GSM182805     2  0.4635      0.757 0.016 0.768 0.000 0.128 0.088
#> GSM182806     1  0.0000      0.854 1.000 0.000 0.000 0.000 0.000
#> GSM182807     1  0.0000      0.854 1.000 0.000 0.000 0.000 0.000
#> GSM182808     1  0.0000      0.854 1.000 0.000 0.000 0.000 0.000
#> GSM182809     3  0.6503      0.621 0.116 0.000 0.628 0.180 0.076
#> GSM182810     1  0.3722      0.686 0.796 0.000 0.004 0.176 0.024
#> GSM182811     1  0.5778      0.272 0.556 0.000 0.004 0.352 0.088
#> GSM182812     4  0.1560      0.955 0.028 0.000 0.004 0.948 0.020
#> GSM182813     1  0.0000      0.854 1.000 0.000 0.000 0.000 0.000
#> GSM182778     2  0.0162      0.744 0.004 0.996 0.000 0.000 0.000
#> GSM182779     5  0.2746      0.770 0.008 0.000 0.008 0.112 0.872
#> GSM182780     3  0.3280      0.795 0.000 0.000 0.812 0.176 0.012
#> GSM182781     3  0.0000      0.865 0.000 0.000 1.000 0.000 0.000
#> GSM182782     2  0.0000      0.743 0.000 1.000 0.000 0.000 0.000
#> GSM182783     3  0.3527      0.786 0.000 0.000 0.792 0.192 0.016
#> GSM182784     3  0.0162      0.866 0.000 0.000 0.996 0.000 0.004
#> GSM182785     3  0.3682      0.806 0.000 0.000 0.820 0.108 0.072
#> GSM182786     2  0.0000      0.743 0.000 1.000 0.000 0.000 0.000
#> GSM182787     3  0.5850      0.596 0.004 0.004 0.624 0.124 0.244
#> GSM182788     2  0.0000      0.743 0.000 1.000 0.000 0.000 0.000
#> GSM182789     3  0.3141      0.821 0.000 0.000 0.852 0.108 0.040
#> GSM182790     3  0.0000      0.865 0.000 0.000 1.000 0.000 0.000
#> GSM182791     3  0.3059      0.825 0.004 0.000 0.860 0.108 0.028
#> GSM182792     3  0.0404      0.866 0.000 0.000 0.988 0.000 0.012
#> GSM182793     2  0.4837      0.538 0.008 0.624 0.000 0.348 0.020
#> GSM182794     3  0.0000      0.865 0.000 0.000 1.000 0.000 0.000
#> GSM182795     3  0.0290      0.866 0.000 0.000 0.992 0.000 0.008
#> GSM182796     5  0.3860      0.654 0.016 0.148 0.000 0.028 0.808
#> GSM182797     1  0.0000      0.854 1.000 0.000 0.000 0.000 0.000
#> GSM182798     5  0.3860      0.654 0.016 0.148 0.000 0.028 0.808
#> GSM182799     3  0.3462      0.785 0.000 0.000 0.792 0.196 0.012
#> GSM182800     1  0.4532      0.655 0.764 0.000 0.048 0.168 0.020
#> GSM182801     3  0.1205      0.860 0.000 0.000 0.956 0.040 0.004
#> GSM182814     1  0.0000      0.854 1.000 0.000 0.000 0.000 0.000
#> GSM182815     4  0.1251      0.968 0.008 0.000 0.000 0.956 0.036
#> GSM182816     1  0.5124     -0.121 0.488 0.000 0.480 0.028 0.004
#> GSM182817     5  0.5199      0.725 0.016 0.140 0.000 0.124 0.720
#> GSM182818     4  0.0579      0.958 0.008 0.000 0.000 0.984 0.008
#> GSM182819     1  0.0000      0.854 1.000 0.000 0.000 0.000 0.000
#> GSM182820     1  0.0000      0.854 1.000 0.000 0.000 0.000 0.000
#> GSM182821     3  0.5891      0.587 0.016 0.000 0.624 0.108 0.252
#> GSM182822     3  0.6404      0.595 0.180 0.000 0.632 0.128 0.060
#> GSM182823     1  0.0000      0.854 1.000 0.000 0.000 0.000 0.000
#> GSM182824     1  0.0000      0.854 1.000 0.000 0.000 0.000 0.000
#> GSM182825     1  0.4037      0.646 0.752 0.000 0.004 0.224 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
#> GSM182755     1  0.0291     0.8992 0.992 0.000 0.004 0.000 0.000 0.004
#> GSM182756     3  0.3952     0.1760 0.000 0.000 0.672 0.020 0.000 0.308
#> GSM182757     5  0.4738     0.5567 0.000 0.000 0.064 0.000 0.600 0.336
#> GSM182758     3  0.4325    -0.2024 0.000 0.000 0.524 0.020 0.000 0.456
#> GSM182759     5  0.2624     0.7898 0.000 0.004 0.000 0.004 0.844 0.148
#> GSM182760     3  0.4018     0.1507 0.000 0.000 0.656 0.020 0.000 0.324
#> GSM182761     6  0.5335     0.6730 0.000 0.000 0.276 0.000 0.148 0.576
#> GSM182762     5  0.2980     0.7930 0.000 0.000 0.000 0.012 0.808 0.180
#> GSM182763     6  0.5177     0.5390 0.000 0.000 0.152 0.000 0.236 0.612
#> GSM182764     5  0.2772     0.7956 0.000 0.000 0.000 0.004 0.816 0.180
#> GSM182765     5  0.3386     0.7837 0.000 0.000 0.016 0.008 0.788 0.188
#> GSM182766     2  0.4441     0.7398 0.000 0.720 0.000 0.016 0.204 0.060
#> GSM182767     3  0.4310    -0.1411 0.000 0.000 0.540 0.020 0.000 0.440
#> GSM182768     3  0.3737    -0.1485 0.000 0.000 0.608 0.000 0.000 0.392
#> GSM182769     3  0.1341     0.4607 0.000 0.000 0.948 0.024 0.000 0.028
#> GSM182770     2  0.2867     0.8583 0.000 0.848 0.000 0.040 0.112 0.000
#> GSM182771     5  0.0972     0.7503 0.000 0.028 0.000 0.008 0.964 0.000
#> GSM182772     2  0.2709     0.8578 0.000 0.848 0.000 0.020 0.132 0.000
#> GSM182773     3  0.0000     0.4699 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM182774     3  0.6813     0.0433 0.316 0.000 0.476 0.020 0.136 0.052
#> GSM182775     3  0.0777     0.4671 0.000 0.000 0.972 0.024 0.000 0.004
#> GSM182776     3  0.1629     0.4444 0.004 0.000 0.940 0.004 0.024 0.028
#> GSM182777     3  0.0520     0.4703 0.000 0.000 0.984 0.008 0.000 0.008
#> GSM182802     2  0.3014     0.8509 0.000 0.832 0.000 0.036 0.132 0.000
#> GSM182803     1  0.0777     0.8988 0.972 0.000 0.004 0.000 0.000 0.024
#> GSM182804     4  0.1958     0.7281 0.000 0.000 0.004 0.896 0.100 0.000
#> GSM182805     2  0.2814     0.8392 0.000 0.820 0.000 0.008 0.172 0.000
#> GSM182806     1  0.0777     0.8988 0.972 0.000 0.004 0.000 0.000 0.024
#> GSM182807     1  0.0000     0.8996 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM182808     1  0.0146     0.8994 0.996 0.000 0.000 0.000 0.000 0.004
#> GSM182809     4  0.7518    -0.2170 0.020 0.000 0.320 0.380 0.096 0.184
#> GSM182810     1  0.7767     0.0400 0.384 0.000 0.340 0.104 0.088 0.084
#> GSM182811     4  0.6598     0.4718 0.256 0.000 0.004 0.512 0.168 0.060
#> GSM182812     4  0.3679     0.7114 0.036 0.000 0.000 0.820 0.084 0.060
#> GSM182813     1  0.0146     0.8994 0.996 0.000 0.000 0.000 0.000 0.004
#> GSM182778     2  0.0000     0.8425 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM182779     5  0.3670     0.7527 0.000 0.000 0.024 0.000 0.736 0.240
#> GSM182780     3  0.5238    -0.4342 0.000 0.000 0.492 0.016 0.056 0.436
#> GSM182781     3  0.2407     0.4612 0.016 0.000 0.904 0.024 0.008 0.048
#> GSM182782     2  0.0000     0.8425 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM182783     6  0.5531     0.4327 0.000 0.000 0.424 0.064 0.028 0.484
#> GSM182784     3  0.4314    -0.1597 0.000 0.000 0.536 0.020 0.000 0.444
#> GSM182785     6  0.5105     0.4875 0.000 0.000 0.432 0.000 0.080 0.488
#> GSM182786     2  0.0000     0.8425 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM182787     6  0.5395     0.6714 0.000 0.000 0.300 0.000 0.144 0.556
#> GSM182788     2  0.0000     0.8425 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM182789     3  0.4807    -0.4373 0.000 0.000 0.484 0.000 0.052 0.464
#> GSM182790     3  0.1950     0.4578 0.000 0.000 0.912 0.024 0.000 0.064
#> GSM182791     3  0.4751    -0.4096 0.000 0.000 0.512 0.008 0.032 0.448
#> GSM182792     3  0.3409     0.1108 0.000 0.000 0.700 0.000 0.000 0.300
#> GSM182793     2  0.4681     0.7651 0.000 0.732 0.000 0.140 0.096 0.032
#> GSM182794     3  0.2176     0.4539 0.000 0.000 0.896 0.024 0.000 0.080
#> GSM182795     3  0.4366    -0.2811 0.000 0.000 0.548 0.000 0.024 0.428
#> GSM182796     5  0.3601     0.6488 0.000 0.040 0.000 0.008 0.792 0.160
#> GSM182797     1  0.0000     0.8996 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM182798     5  0.3601     0.6488 0.000 0.040 0.000 0.008 0.792 0.160
#> GSM182799     6  0.5561     0.4359 0.000 0.000 0.408 0.068 0.028 0.496
#> GSM182800     3  0.6036     0.1031 0.328 0.000 0.548 0.028 0.064 0.032
#> GSM182801     3  0.1341     0.4608 0.000 0.000 0.948 0.028 0.000 0.024
#> GSM182814     1  0.1493     0.8774 0.936 0.000 0.000 0.004 0.004 0.056
#> GSM182815     4  0.1843     0.7311 0.000 0.000 0.004 0.912 0.080 0.004
#> GSM182816     3  0.4158     0.1123 0.416 0.000 0.572 0.004 0.000 0.008
#> GSM182817     5  0.1536     0.7359 0.000 0.040 0.000 0.004 0.940 0.016
#> GSM182818     4  0.1686     0.7263 0.000 0.000 0.000 0.924 0.064 0.012
#> GSM182819     1  0.0291     0.8992 0.992 0.000 0.004 0.000 0.000 0.004
#> GSM182820     1  0.0692     0.8987 0.976 0.000 0.004 0.000 0.000 0.020
#> GSM182821     6  0.5886     0.6456 0.000 0.000 0.252 0.016 0.184 0.548
#> GSM182822     3  0.5422     0.2502 0.108 0.000 0.700 0.024 0.128 0.040
#> GSM182823     1  0.0922     0.8966 0.968 0.000 0.000 0.004 0.004 0.024
#> GSM182824     1  0.0692     0.8983 0.976 0.000 0.000 0.000 0.004 0.020
#> GSM182825     1  0.5773     0.3919 0.604 0.000 0.000 0.248 0.064 0.084

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 stress(p) development.stage(p) k
#> ATC:mclust 66     0.876             4.79e-04 2
#> ATC:mclust 67     0.825             5.46e-06 3
#> ATC:mclust 49     0.754             1.38e-05 4
#> ATC:mclust 68     0.985             3.64e-06 5
#> ATC:mclust 40     0.990             4.70e-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.


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

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

collect_plots(res)

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.910           0.911       0.964         0.5021 0.494   0.494
#> 3 3 0.599           0.790       0.851         0.3076 0.726   0.497
#> 4 4 0.596           0.711       0.839         0.0864 0.917   0.762
#> 5 5 0.562           0.512       0.786         0.0404 0.981   0.935
#> 6 6 0.630           0.635       0.791         0.0445 0.902   0.658

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
#> GSM182755     1  0.0000     0.9798 1.000 0.000
#> GSM182756     1  0.0000     0.9798 1.000 0.000
#> GSM182757     2  0.0000     0.9417 0.000 1.000
#> GSM182758     2  0.4161     0.8787 0.084 0.916
#> GSM182759     2  0.0000     0.9417 0.000 1.000
#> GSM182760     1  0.0000     0.9798 1.000 0.000
#> GSM182761     2  0.0000     0.9417 0.000 1.000
#> GSM182762     1  0.0000     0.9798 1.000 0.000
#> GSM182763     2  0.0000     0.9417 0.000 1.000
#> GSM182764     2  0.0000     0.9417 0.000 1.000
#> GSM182765     2  0.9998     0.0953 0.492 0.508
#> GSM182766     2  0.0000     0.9417 0.000 1.000
#> GSM182767     1  0.5294     0.8438 0.880 0.120
#> GSM182768     1  0.2236     0.9455 0.964 0.036
#> GSM182769     1  0.0000     0.9798 1.000 0.000
#> GSM182770     2  0.0000     0.9417 0.000 1.000
#> GSM182771     2  0.4298     0.8762 0.088 0.912
#> GSM182772     2  0.0000     0.9417 0.000 1.000
#> GSM182773     1  0.0000     0.9798 1.000 0.000
#> GSM182774     1  0.0000     0.9798 1.000 0.000
#> GSM182775     1  0.0000     0.9798 1.000 0.000
#> GSM182776     1  0.0000     0.9798 1.000 0.000
#> GSM182777     1  0.0000     0.9798 1.000 0.000
#> GSM182802     2  0.0000     0.9417 0.000 1.000
#> GSM182803     1  0.0000     0.9798 1.000 0.000
#> GSM182804     2  0.0000     0.9417 0.000 1.000
#> GSM182805     2  0.0000     0.9417 0.000 1.000
#> GSM182806     1  0.0000     0.9798 1.000 0.000
#> GSM182807     1  0.0000     0.9798 1.000 0.000
#> GSM182808     1  0.0000     0.9798 1.000 0.000
#> GSM182809     2  0.2236     0.9185 0.036 0.964
#> GSM182810     1  0.0000     0.9798 1.000 0.000
#> GSM182811     1  0.0000     0.9798 1.000 0.000
#> GSM182812     1  0.0000     0.9798 1.000 0.000
#> GSM182813     1  0.0000     0.9798 1.000 0.000
#> GSM182778     2  0.0000     0.9417 0.000 1.000
#> GSM182779     2  0.0000     0.9417 0.000 1.000
#> GSM182780     2  0.0000     0.9417 0.000 1.000
#> GSM182781     1  0.0000     0.9798 1.000 0.000
#> GSM182782     2  0.0000     0.9417 0.000 1.000
#> GSM182783     2  0.0000     0.9417 0.000 1.000
#> GSM182784     2  0.9323     0.5011 0.348 0.652
#> GSM182785     2  0.0000     0.9417 0.000 1.000
#> GSM182786     2  0.0000     0.9417 0.000 1.000
#> GSM182787     2  0.0000     0.9417 0.000 1.000
#> GSM182788     2  0.0000     0.9417 0.000 1.000
#> GSM182789     2  0.0000     0.9417 0.000 1.000
#> GSM182790     1  0.0000     0.9798 1.000 0.000
#> GSM182791     1  0.9983    -0.0154 0.524 0.476
#> GSM182792     1  0.0000     0.9798 1.000 0.000
#> GSM182793     2  0.0000     0.9417 0.000 1.000
#> GSM182794     1  0.0000     0.9798 1.000 0.000
#> GSM182795     2  0.0938     0.9346 0.012 0.988
#> GSM182796     2  0.0000     0.9417 0.000 1.000
#> GSM182797     1  0.0000     0.9798 1.000 0.000
#> GSM182798     2  0.5294     0.8446 0.120 0.880
#> GSM182799     2  0.0000     0.9417 0.000 1.000
#> GSM182800     1  0.0000     0.9798 1.000 0.000
#> GSM182801     1  0.0000     0.9798 1.000 0.000
#> GSM182814     1  0.0000     0.9798 1.000 0.000
#> GSM182815     2  0.0000     0.9417 0.000 1.000
#> GSM182816     1  0.0000     0.9798 1.000 0.000
#> GSM182817     1  0.2236     0.9458 0.964 0.036
#> GSM182818     2  0.8909     0.5865 0.308 0.692
#> GSM182819     1  0.0000     0.9798 1.000 0.000
#> GSM182820     1  0.0000     0.9798 1.000 0.000
#> GSM182821     2  0.9522     0.4498 0.372 0.628
#> GSM182822     1  0.0000     0.9798 1.000 0.000
#> GSM182823     1  0.0000     0.9798 1.000 0.000
#> GSM182824     1  0.0000     0.9798 1.000 0.000
#> GSM182825     1  0.0000     0.9798 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
#> GSM182755     1  0.0000      0.913 1.000 0.000 0.000
#> GSM182756     3  0.5216      0.797 0.260 0.000 0.740
#> GSM182757     3  0.5619      0.757 0.012 0.244 0.744
#> GSM182758     3  0.5061      0.775 0.008 0.208 0.784
#> GSM182759     2  0.0747      0.865 0.000 0.984 0.016
#> GSM182760     3  0.5098      0.805 0.248 0.000 0.752
#> GSM182761     3  0.6079      0.493 0.000 0.388 0.612
#> GSM182762     1  0.1643      0.874 0.956 0.000 0.044
#> GSM182763     2  0.3267      0.795 0.000 0.884 0.116
#> GSM182764     2  0.2486      0.843 0.008 0.932 0.060
#> GSM182765     2  0.9410      0.184 0.220 0.504 0.276
#> GSM182766     2  0.1031      0.864 0.000 0.976 0.024
#> GSM182767     3  0.5921      0.816 0.212 0.032 0.756
#> GSM182768     3  0.6107      0.821 0.184 0.052 0.764
#> GSM182769     3  0.5138      0.803 0.252 0.000 0.748
#> GSM182770     2  0.1411      0.863 0.000 0.964 0.036
#> GSM182771     2  0.2339      0.847 0.048 0.940 0.012
#> GSM182772     2  0.0747      0.866 0.000 0.984 0.016
#> GSM182773     3  0.5098      0.805 0.248 0.000 0.752
#> GSM182774     1  0.0000      0.913 1.000 0.000 0.000
#> GSM182775     3  0.5465      0.764 0.288 0.000 0.712
#> GSM182776     1  0.4504      0.658 0.804 0.000 0.196
#> GSM182777     3  0.5327      0.784 0.272 0.000 0.728
#> GSM182802     2  0.1163      0.863 0.000 0.972 0.028
#> GSM182803     1  0.0000      0.913 1.000 0.000 0.000
#> GSM182804     2  0.5503      0.751 0.020 0.772 0.208
#> GSM182805     2  0.1031      0.864 0.000 0.976 0.024
#> GSM182806     1  0.0000      0.913 1.000 0.000 0.000
#> GSM182807     1  0.0000      0.913 1.000 0.000 0.000
#> GSM182808     1  0.0000      0.913 1.000 0.000 0.000
#> GSM182809     2  0.5331      0.774 0.024 0.792 0.184
#> GSM182810     1  0.2959      0.859 0.900 0.000 0.100
#> GSM182811     1  0.5061      0.777 0.784 0.008 0.208
#> GSM182812     1  0.4931      0.777 0.784 0.004 0.212
#> GSM182813     1  0.0000      0.913 1.000 0.000 0.000
#> GSM182778     2  0.1031      0.864 0.000 0.976 0.024
#> GSM182779     2  0.6302     -0.110 0.000 0.520 0.480
#> GSM182780     3  0.4796      0.767 0.000 0.220 0.780
#> GSM182781     3  0.5178      0.800 0.256 0.000 0.744
#> GSM182782     2  0.0892      0.865 0.000 0.980 0.020
#> GSM182783     3  0.4702      0.770 0.000 0.212 0.788
#> GSM182784     3  0.5932      0.800 0.056 0.164 0.780
#> GSM182785     3  0.5115      0.764 0.004 0.228 0.768
#> GSM182786     2  0.0592      0.866 0.000 0.988 0.012
#> GSM182787     2  0.1289      0.863 0.000 0.968 0.032
#> GSM182788     2  0.0592      0.865 0.000 0.988 0.012
#> GSM182789     3  0.4842      0.764 0.000 0.224 0.776
#> GSM182790     3  0.5138      0.803 0.252 0.000 0.748
#> GSM182791     3  0.6424      0.800 0.068 0.180 0.752
#> GSM182792     3  0.5244      0.808 0.240 0.004 0.756
#> GSM182793     2  0.1289      0.864 0.000 0.968 0.032
#> GSM182794     3  0.5138      0.803 0.252 0.000 0.748
#> GSM182795     3  0.4702      0.770 0.000 0.212 0.788
#> GSM182796     2  0.0592      0.863 0.000 0.988 0.012
#> GSM182797     1  0.0000      0.913 1.000 0.000 0.000
#> GSM182798     2  0.4540      0.787 0.124 0.848 0.028
#> GSM182799     3  0.4504      0.772 0.000 0.196 0.804
#> GSM182800     1  0.0000      0.913 1.000 0.000 0.000
#> GSM182801     1  0.6026      0.170 0.624 0.000 0.376
#> GSM182814     1  0.4555      0.790 0.800 0.000 0.200
#> GSM182815     2  0.4931      0.755 0.000 0.768 0.232
#> GSM182816     1  0.0000      0.913 1.000 0.000 0.000
#> GSM182817     1  0.4915      0.783 0.832 0.132 0.036
#> GSM182818     2  0.8876      0.519 0.220 0.576 0.204
#> GSM182819     1  0.0000      0.913 1.000 0.000 0.000
#> GSM182820     1  0.0000      0.913 1.000 0.000 0.000
#> GSM182821     2  0.5541      0.655 0.252 0.740 0.008
#> GSM182822     1  0.0424      0.910 0.992 0.000 0.008
#> GSM182823     1  0.0000      0.913 1.000 0.000 0.000
#> GSM182824     1  0.0000      0.913 1.000 0.000 0.000
#> GSM182825     1  0.4291      0.805 0.820 0.000 0.180

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM182755     1  0.2821     0.7964 0.900 0.004 0.020 0.076
#> GSM182756     3  0.3392     0.8274 0.124 0.000 0.856 0.020
#> GSM182757     2  0.6953     0.3212 0.012 0.480 0.432 0.076
#> GSM182758     3  0.0712     0.8395 0.004 0.008 0.984 0.004
#> GSM182759     2  0.2413     0.7307 0.000 0.916 0.020 0.064
#> GSM182760     3  0.2778     0.8418 0.080 0.004 0.900 0.016
#> GSM182761     2  0.4814     0.5304 0.000 0.676 0.316 0.008
#> GSM182762     1  0.6370     0.4965 0.668 0.004 0.180 0.148
#> GSM182763     2  0.4671     0.6447 0.000 0.752 0.220 0.028
#> GSM182764     2  0.4711     0.6577 0.000 0.784 0.064 0.152
#> GSM182765     2  0.9290     0.1834 0.220 0.448 0.180 0.152
#> GSM182766     2  0.2048     0.7487 0.000 0.928 0.064 0.008
#> GSM182767     3  0.1488     0.8482 0.032 0.000 0.956 0.012
#> GSM182768     3  0.2670     0.8355 0.024 0.000 0.904 0.072
#> GSM182769     3  0.5410     0.7314 0.192 0.000 0.728 0.080
#> GSM182770     2  0.2125     0.7441 0.000 0.920 0.076 0.004
#> GSM182771     2  0.4901     0.6320 0.048 0.784 0.012 0.156
#> GSM182772     2  0.1557     0.7512 0.000 0.944 0.056 0.000
#> GSM182773     3  0.3439     0.8437 0.084 0.000 0.868 0.048
#> GSM182774     1  0.1796     0.8315 0.948 0.004 0.016 0.032
#> GSM182775     3  0.3278     0.8356 0.116 0.000 0.864 0.020
#> GSM182776     1  0.5040     0.3287 0.628 0.000 0.364 0.008
#> GSM182777     3  0.3718     0.7986 0.168 0.000 0.820 0.012
#> GSM182802     2  0.0927     0.7422 0.000 0.976 0.016 0.008
#> GSM182803     1  0.0000     0.8482 1.000 0.000 0.000 0.000
#> GSM182804     4  0.7319     0.7147 0.156 0.384 0.000 0.460
#> GSM182805     2  0.0779     0.7434 0.000 0.980 0.016 0.004
#> GSM182806     1  0.0188     0.8487 0.996 0.000 0.000 0.004
#> GSM182807     1  0.0188     0.8487 0.996 0.000 0.000 0.004
#> GSM182808     1  0.0336     0.8478 0.992 0.000 0.000 0.008
#> GSM182809     4  0.6987     0.7881 0.136 0.260 0.008 0.596
#> GSM182810     1  0.2704     0.7742 0.876 0.000 0.000 0.124
#> GSM182811     1  0.2611     0.7826 0.896 0.008 0.000 0.096
#> GSM182812     1  0.4994     0.0271 0.520 0.000 0.000 0.480
#> GSM182813     1  0.0336     0.8478 0.992 0.000 0.000 0.008
#> GSM182778     2  0.1716     0.7496 0.000 0.936 0.064 0.000
#> GSM182779     2  0.6472     0.5243 0.000 0.640 0.212 0.148
#> GSM182780     3  0.1489     0.8249 0.000 0.044 0.952 0.004
#> GSM182781     3  0.6174     0.1998 0.460 0.004 0.496 0.040
#> GSM182782     2  0.1557     0.7512 0.000 0.944 0.056 0.000
#> GSM182783     3  0.3718     0.7546 0.000 0.012 0.820 0.168
#> GSM182784     3  0.0992     0.8418 0.008 0.004 0.976 0.012
#> GSM182785     3  0.4107     0.7268 0.012 0.128 0.832 0.028
#> GSM182786     2  0.1118     0.7493 0.000 0.964 0.036 0.000
#> GSM182787     2  0.2124     0.7481 0.000 0.924 0.068 0.008
#> GSM182788     2  0.0707     0.7449 0.000 0.980 0.020 0.000
#> GSM182789     3  0.1211     0.8285 0.000 0.040 0.960 0.000
#> GSM182790     3  0.2861     0.8411 0.096 0.000 0.888 0.016
#> GSM182791     3  0.3095     0.8209 0.012 0.020 0.892 0.076
#> GSM182792     3  0.2722     0.8488 0.064 0.000 0.904 0.032
#> GSM182793     2  0.2342     0.7407 0.000 0.912 0.080 0.008
#> GSM182794     3  0.2988     0.8357 0.112 0.000 0.876 0.012
#> GSM182795     3  0.0804     0.8362 0.000 0.008 0.980 0.012
#> GSM182796     2  0.3196     0.6847 0.000 0.856 0.008 0.136
#> GSM182797     1  0.1059     0.8408 0.972 0.000 0.012 0.016
#> GSM182798     2  0.5384     0.5791 0.088 0.748 0.004 0.160
#> GSM182799     3  0.4767     0.6590 0.000 0.020 0.724 0.256
#> GSM182800     1  0.0672     0.8451 0.984 0.000 0.008 0.008
#> GSM182801     3  0.5839     0.4890 0.352 0.000 0.604 0.044
#> GSM182814     1  0.2408     0.7824 0.896 0.000 0.000 0.104
#> GSM182815     4  0.4857     0.6754 0.000 0.324 0.008 0.668
#> GSM182816     1  0.4464     0.6045 0.768 0.000 0.208 0.024
#> GSM182817     1  0.4355     0.5938 0.772 0.212 0.004 0.012
#> GSM182818     4  0.7704     0.6958 0.236 0.196 0.020 0.548
#> GSM182819     1  0.0000     0.8482 1.000 0.000 0.000 0.000
#> GSM182820     1  0.0188     0.8487 0.996 0.000 0.000 0.004
#> GSM182821     2  0.6660     0.2264 0.252 0.628 0.112 0.008
#> GSM182822     1  0.2742     0.8036 0.900 0.000 0.024 0.076
#> GSM182823     1  0.0188     0.8477 0.996 0.000 0.000 0.004
#> GSM182824     1  0.0336     0.8467 0.992 0.000 0.000 0.008
#> GSM182825     1  0.4134     0.6033 0.740 0.000 0.000 0.260

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>           class entropy silhouette    p1    p2    p3    p4    p5
#> GSM182755     1  0.1200     0.8591 0.964 0.000 0.012 0.008 0.016
#> GSM182756     3  0.6268    -0.2534 0.140 0.000 0.508 0.004 0.348
#> GSM182757     2  0.7142    -0.1580 0.016 0.396 0.376 0.004 0.208
#> GSM182758     3  0.4961    -0.3150 0.024 0.008 0.608 0.000 0.360
#> GSM182759     2  0.1701     0.7224 0.000 0.936 0.000 0.016 0.048
#> GSM182760     3  0.2390     0.4939 0.084 0.000 0.896 0.000 0.020
#> GSM182761     2  0.4777     0.3988 0.000 0.620 0.356 0.008 0.016
#> GSM182762     1  0.6396     0.3346 0.568 0.000 0.220 0.012 0.200
#> GSM182763     2  0.4723     0.5377 0.000 0.688 0.272 0.008 0.032
#> GSM182764     2  0.5579     0.5799 0.004 0.660 0.064 0.020 0.252
#> GSM182765     2  0.8638     0.1815 0.180 0.376 0.144 0.020 0.280
#> GSM182766     2  0.0771     0.7379 0.000 0.976 0.020 0.000 0.004
#> GSM182767     3  0.2823     0.4874 0.064 0.004 0.888 0.004 0.040
#> GSM182768     3  0.2665     0.4315 0.020 0.000 0.900 0.032 0.048
#> GSM182769     3  0.7030    -0.2804 0.248 0.000 0.404 0.012 0.336
#> GSM182770     2  0.0671     0.7386 0.000 0.980 0.016 0.000 0.004
#> GSM182771     2  0.6113     0.4990 0.084 0.608 0.008 0.020 0.280
#> GSM182772     2  0.0290     0.7404 0.000 0.992 0.008 0.000 0.000
#> GSM182773     3  0.5040    -0.0315 0.040 0.000 0.664 0.012 0.284
#> GSM182774     1  0.3774     0.7229 0.804 0.000 0.028 0.008 0.160
#> GSM182775     3  0.3022     0.4829 0.136 0.000 0.848 0.004 0.012
#> GSM182776     1  0.4178     0.4751 0.696 0.000 0.292 0.004 0.008
#> GSM182777     3  0.3934     0.4068 0.244 0.000 0.740 0.000 0.016
#> GSM182802     2  0.0162     0.7398 0.000 0.996 0.000 0.000 0.004
#> GSM182803     1  0.0162     0.8713 0.996 0.000 0.000 0.004 0.000
#> GSM182804     4  0.5661     0.6151 0.120 0.272 0.000 0.608 0.000
#> GSM182805     2  0.0000     0.7400 0.000 1.000 0.000 0.000 0.000
#> GSM182806     1  0.0162     0.8713 0.996 0.000 0.000 0.004 0.000
#> GSM182807     1  0.0000     0.8714 1.000 0.000 0.000 0.000 0.000
#> GSM182808     1  0.0000     0.8714 1.000 0.000 0.000 0.000 0.000
#> GSM182809     4  0.5977     0.6492 0.104 0.228 0.012 0.644 0.012
#> GSM182810     1  0.1851     0.8242 0.912 0.000 0.000 0.088 0.000
#> GSM182811     1  0.2852     0.7299 0.828 0.000 0.000 0.172 0.000
#> GSM182812     4  0.4885     0.3077 0.400 0.000 0.000 0.572 0.028
#> GSM182813     1  0.0162     0.8707 0.996 0.000 0.000 0.004 0.000
#> GSM182778     2  0.0771     0.7378 0.000 0.976 0.020 0.000 0.004
#> GSM182779     2  0.6920     0.3921 0.000 0.476 0.196 0.020 0.308
#> GSM182780     3  0.3477     0.3715 0.000 0.112 0.832 0.000 0.056
#> GSM182781     3  0.6741    -0.2749 0.212 0.000 0.400 0.004 0.384
#> GSM182782     2  0.0162     0.7403 0.000 0.996 0.000 0.000 0.004
#> GSM182783     5  0.6524     0.0000 0.000 0.036 0.432 0.084 0.448
#> GSM182784     3  0.2355     0.4567 0.024 0.024 0.916 0.000 0.036
#> GSM182785     3  0.4117     0.3478 0.004 0.160 0.788 0.004 0.044
#> GSM182786     2  0.0162     0.7405 0.000 0.996 0.004 0.000 0.000
#> GSM182787     2  0.1469     0.7284 0.000 0.948 0.036 0.000 0.016
#> GSM182788     2  0.0290     0.7385 0.000 0.992 0.000 0.000 0.008
#> GSM182789     3  0.5268     0.1713 0.000 0.148 0.680 0.000 0.172
#> GSM182790     3  0.5927     0.0288 0.132 0.000 0.592 0.004 0.272
#> GSM182791     3  0.5138     0.3963 0.036 0.060 0.780 0.064 0.060
#> GSM182792     3  0.2976     0.4802 0.064 0.000 0.880 0.012 0.044
#> GSM182793     2  0.1471     0.7314 0.000 0.952 0.024 0.004 0.020
#> GSM182794     3  0.4489     0.4232 0.156 0.000 0.760 0.004 0.080
#> GSM182795     3  0.4748    -0.4734 0.000 0.016 0.596 0.004 0.384
#> GSM182796     2  0.3821     0.6327 0.000 0.764 0.000 0.020 0.216
#> GSM182797     1  0.0162     0.8707 0.996 0.000 0.000 0.004 0.000
#> GSM182798     2  0.5501     0.5256 0.052 0.628 0.000 0.020 0.300
#> GSM182799     3  0.4941     0.1596 0.000 0.024 0.744 0.156 0.076
#> GSM182800     1  0.3768     0.7280 0.812 0.000 0.144 0.008 0.036
#> GSM182801     3  0.4560     0.3561 0.268 0.000 0.700 0.012 0.020
#> GSM182814     1  0.2179     0.8107 0.896 0.000 0.000 0.100 0.004
#> GSM182815     4  0.3308     0.6053 0.000 0.144 0.004 0.832 0.020
#> GSM182816     1  0.1741     0.8402 0.936 0.000 0.040 0.024 0.000
#> GSM182817     1  0.3772     0.6401 0.792 0.172 0.000 0.000 0.036
#> GSM182818     4  0.6975     0.5984 0.124 0.056 0.012 0.584 0.224
#> GSM182819     1  0.0000     0.8714 1.000 0.000 0.000 0.000 0.000
#> GSM182820     1  0.0000     0.8714 1.000 0.000 0.000 0.000 0.000
#> GSM182821     2  0.6380     0.0820 0.324 0.548 0.108 0.008 0.012
#> GSM182822     1  0.1618     0.8505 0.944 0.000 0.008 0.040 0.008
#> GSM182823     1  0.0162     0.8711 0.996 0.000 0.000 0.004 0.000
#> GSM182824     1  0.0290     0.8703 0.992 0.000 0.000 0.008 0.000
#> GSM182825     1  0.3039     0.7092 0.808 0.000 0.000 0.192 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
#> GSM182755     1  0.0964   0.863249 0.968 0.000 0.016 0.000 0.012 0.004
#> GSM182756     6  0.3988   0.729926 0.072 0.000 0.140 0.000 0.012 0.776
#> GSM182757     6  0.6340   0.399331 0.008 0.240 0.164 0.000 0.040 0.548
#> GSM182758     6  0.3649   0.710332 0.008 0.016 0.204 0.000 0.004 0.768
#> GSM182759     2  0.2558   0.552590 0.000 0.840 0.004 0.000 0.156 0.000
#> GSM182760     3  0.2999   0.695394 0.068 0.000 0.856 0.000 0.008 0.068
#> GSM182761     2  0.4214  -0.022730 0.000 0.528 0.460 0.000 0.008 0.004
#> GSM182762     1  0.6612  -0.000196 0.408 0.000 0.156 0.000 0.380 0.056
#> GSM182763     3  0.4758   0.058883 0.000 0.460 0.500 0.000 0.032 0.008
#> GSM182764     5  0.4935   0.609309 0.004 0.460 0.052 0.000 0.484 0.000
#> GSM182765     5  0.7299   0.606268 0.088 0.220 0.076 0.000 0.520 0.096
#> GSM182766     2  0.0665   0.784773 0.000 0.980 0.008 0.004 0.008 0.000
#> GSM182767     3  0.2014   0.710626 0.032 0.004 0.924 0.000 0.016 0.024
#> GSM182768     3  0.1337   0.698432 0.016 0.008 0.956 0.012 0.000 0.008
#> GSM182769     6  0.4969   0.523060 0.260 0.000 0.100 0.000 0.004 0.636
#> GSM182770     2  0.0912   0.780397 0.000 0.972 0.004 0.012 0.008 0.004
#> GSM182771     5  0.5247   0.710321 0.012 0.384 0.004 0.004 0.548 0.048
#> GSM182772     2  0.0405   0.786075 0.000 0.988 0.004 0.000 0.008 0.000
#> GSM182773     6  0.5666   0.176668 0.084 0.000 0.432 0.016 0.004 0.464
#> GSM182774     1  0.5106   0.349400 0.556 0.000 0.048 0.004 0.380 0.012
#> GSM182775     3  0.2196   0.687809 0.108 0.000 0.884 0.004 0.000 0.004
#> GSM182776     1  0.3622   0.620746 0.760 0.000 0.212 0.000 0.004 0.024
#> GSM182777     3  0.4883   0.512236 0.240 0.000 0.660 0.000 0.008 0.092
#> GSM182802     2  0.0665   0.783853 0.000 0.980 0.000 0.008 0.008 0.004
#> GSM182803     1  0.0405   0.870080 0.988 0.000 0.004 0.000 0.008 0.000
#> GSM182804     4  0.4197   0.575702 0.064 0.176 0.000 0.748 0.012 0.000
#> GSM182805     2  0.0551   0.783288 0.000 0.984 0.000 0.004 0.008 0.004
#> GSM182806     1  0.0436   0.869302 0.988 0.000 0.004 0.000 0.004 0.004
#> GSM182807     1  0.0291   0.869206 0.992 0.000 0.004 0.000 0.000 0.004
#> GSM182808     1  0.0551   0.869415 0.984 0.000 0.004 0.000 0.008 0.004
#> GSM182809     4  0.6144   0.406792 0.104 0.344 0.016 0.512 0.024 0.000
#> GSM182810     1  0.1285   0.847104 0.944 0.000 0.000 0.052 0.004 0.000
#> GSM182811     1  0.2706   0.757519 0.832 0.000 0.000 0.160 0.008 0.000
#> GSM182812     4  0.4901   0.504175 0.260 0.000 0.000 0.648 0.084 0.008
#> GSM182813     1  0.0146   0.869408 0.996 0.000 0.004 0.000 0.000 0.000
#> GSM182778     2  0.0603   0.784029 0.000 0.980 0.016 0.000 0.004 0.000
#> GSM182779     5  0.7048   0.598469 0.000 0.264 0.096 0.000 0.436 0.204
#> GSM182780     3  0.3961   0.635497 0.000 0.112 0.764 0.000 0.000 0.124
#> GSM182781     6  0.3504   0.728380 0.052 0.000 0.112 0.000 0.016 0.820
#> GSM182782     2  0.0291   0.784823 0.000 0.992 0.000 0.000 0.004 0.004
#> GSM182783     6  0.3239   0.675099 0.000 0.016 0.100 0.044 0.000 0.840
#> GSM182784     3  0.3395   0.692500 0.032 0.032 0.840 0.000 0.004 0.092
#> GSM182785     3  0.4614   0.638096 0.004 0.124 0.756 0.004 0.032 0.080
#> GSM182786     2  0.0405   0.784602 0.000 0.988 0.004 0.000 0.008 0.000
#> GSM182787     2  0.1088   0.776117 0.000 0.960 0.024 0.000 0.016 0.000
#> GSM182788     2  0.0405   0.784602 0.000 0.988 0.004 0.000 0.008 0.000
#> GSM182789     3  0.6231   0.205145 0.000 0.192 0.488 0.004 0.016 0.300
#> GSM182790     6  0.5389   0.569152 0.140 0.000 0.272 0.000 0.004 0.584
#> GSM182791     3  0.5628   0.654894 0.036 0.076 0.724 0.084 0.024 0.056
#> GSM182792     3  0.2663   0.708306 0.060 0.004 0.892 0.020 0.012 0.012
#> GSM182793     2  0.1635   0.760553 0.000 0.944 0.012 0.016 0.016 0.012
#> GSM182794     3  0.5560   0.388285 0.172 0.000 0.584 0.000 0.008 0.236
#> GSM182795     6  0.3103   0.708761 0.000 0.008 0.208 0.000 0.000 0.784
#> GSM182796     2  0.4086  -0.554347 0.000 0.528 0.000 0.000 0.464 0.008
#> GSM182797     1  0.0436   0.868725 0.988 0.000 0.004 0.000 0.004 0.004
#> GSM182798     5  0.4338   0.674523 0.016 0.420 0.000 0.000 0.560 0.004
#> GSM182799     3  0.2754   0.631793 0.004 0.008 0.860 0.116 0.000 0.012
#> GSM182800     1  0.3288   0.763711 0.836 0.000 0.056 0.000 0.096 0.012
#> GSM182801     3  0.2700   0.638018 0.156 0.000 0.836 0.004 0.000 0.004
#> GSM182814     1  0.2726   0.787423 0.856 0.000 0.000 0.112 0.032 0.000
#> GSM182815     4  0.1398   0.601357 0.000 0.052 0.000 0.940 0.000 0.008
#> GSM182816     1  0.0982   0.864134 0.968 0.000 0.004 0.020 0.004 0.004
#> GSM182817     1  0.3727   0.634014 0.768 0.188 0.000 0.000 0.040 0.004
#> GSM182818     4  0.6904   0.489252 0.024 0.032 0.016 0.420 0.400 0.108
#> GSM182819     1  0.0291   0.868729 0.992 0.000 0.000 0.004 0.004 0.000
#> GSM182820     1  0.0436   0.868725 0.988 0.000 0.004 0.000 0.004 0.004
#> GSM182821     2  0.4875   0.145763 0.344 0.604 0.032 0.012 0.008 0.000
#> GSM182822     1  0.0820   0.865763 0.972 0.000 0.000 0.016 0.012 0.000
#> GSM182823     1  0.0508   0.867730 0.984 0.000 0.000 0.012 0.004 0.000
#> GSM182824     1  0.0622   0.866797 0.980 0.000 0.000 0.012 0.008 0.000
#> GSM182825     1  0.2092   0.795880 0.876 0.000 0.000 0.124 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-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 stress(p) development.stage(p) k
#> ATC:NMF 68     0.466             2.64e-02 2
#> ATC:NMF 67     0.900             1.41e-06 3
#> ATC:NMF 63     0.958             6.40e-09 4
#> ATC:NMF 40     0.951             4.54e-05 5
#> ATC:NMF 59     0.958             4.20e-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.

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