cola Report for GDS4181

Date: 2019-12-25 21:14:01 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 51941 rows and 80 columns.
#>   Top rows are extracted by 'SD, CV, MAD, ATC' methods.
#>   Subgroups are detected by 'hclust, kmeans, skmeans, pam, mclust, NMF' method.
#>   Number of partitions are tried for k = 2, 3, 4, 5, 6.
#>   Performed in total 30000 partitions by row resampling.
#> 
#> Following methods can be applied to this 'ConsensusPartitionList' object:
#>  [1] "cola_report"           "collect_classes"       "collect_plots"         "collect_stats"        
#>  [5] "colnames"              "functional_enrichment" "get_anno_col"          "get_anno"             
#>  [9] "get_classes"           "get_matrix"            "get_membership"        "get_stats"            
#> [13] "is_best_k"             "is_stable_k"           "ncol"                  "nrow"                 
#> [17] "rownames"              "show"                  "suggest_best_k"        "test_to_known_factors"
#> [21] "top_rows_heatmap"      "top_rows_overlap"     
#> 
#> You can get result for a single method by, e.g. object["SD", "hclust"] or object["SD:hclust"]
#> or a subset of methods by object[c("SD", "CV")], c("hclust", "kmeans")]

The call of run_all_consensus_partition_methods() was:

#> run_all_consensus_partition_methods(data = mat, mc.cores = 4, anno = anno)

Dimension of the input matrix:

mat = get_matrix(res_list)
dim(mat)
#> [1] 51941    80

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
ATC:kmeans 3 1.000 0.964 0.981 **
ATC:mclust 4 0.941 0.929 0.975 *
CV:skmeans 4 0.941 0.924 0.967 *
ATC:skmeans 3 0.930 0.941 0.976 * 2
MAD:mclust 4 0.928 0.917 0.962 *
SD:pam 2 0.925 0.925 0.944 *
CV:pam 4 0.915 0.892 0.951 *
MAD:skmeans 3 0.911 0.900 0.953 *
ATC:pam 3 0.907 0.909 0.965 *
ATC:NMF 3 0.903 0.892 0.955 * 2
SD:skmeans 4 0.891 0.903 0.958
CV:NMF 2 0.873 0.935 0.970
SD:NMF 2 0.851 0.923 0.967
SD:kmeans 2 0.809 0.925 0.962
MAD:NMF 2 0.802 0.925 0.968
CV:mclust 4 0.801 0.904 0.946
CV:kmeans 2 0.760 0.910 0.960
SD:mclust 4 0.729 0.848 0.919
ATC:hclust 3 0.729 0.782 0.896
MAD:kmeans 2 0.703 0.922 0.962
MAD:pam 2 0.500 0.882 0.928
MAD:hclust 2 0.487 0.728 0.875
CV:hclust 2 0.407 0.781 0.893
SD:hclust 2 0.402 0.762 0.885

**: 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.851           0.923       0.967          0.502 0.495   0.495
#> CV:NMF      2 0.873           0.935       0.970          0.505 0.494   0.494
#> MAD:NMF     2 0.802           0.925       0.968          0.504 0.495   0.495
#> ATC:NMF     2 0.949           0.954       0.979          0.494 0.502   0.502
#> SD:skmeans  2 0.685           0.902       0.955          0.505 0.495   0.495
#> CV:skmeans  2 0.828           0.896       0.956          0.506 0.494   0.494
#> MAD:skmeans 2 0.740           0.859       0.943          0.506 0.497   0.497
#> ATC:skmeans 2 1.000           0.970       0.988          0.506 0.494   0.494
#> SD:mclust   2 0.302           0.828       0.873          0.452 0.495   0.495
#> CV:mclust   2 0.419           0.768       0.861          0.348 0.708   0.708
#> MAD:mclust  2 0.463           0.827       0.894          0.303 0.742   0.742
#> ATC:mclust  2 0.369           0.858       0.878          0.331 0.647   0.647
#> SD:kmeans   2 0.809           0.925       0.962          0.501 0.499   0.499
#> CV:kmeans   2 0.760           0.910       0.960          0.501 0.499   0.499
#> MAD:kmeans  2 0.703           0.922       0.962          0.503 0.499   0.499
#> ATC:kmeans  2 0.711           0.862       0.935          0.480 0.497   0.497
#> SD:pam      2 0.925           0.925       0.944          0.470 0.525   0.525
#> CV:pam      2 0.640           0.828       0.905          0.475 0.519   0.519
#> MAD:pam     2 0.500           0.882       0.927          0.476 0.519   0.519
#> ATC:pam     2 0.713           0.915       0.951          0.488 0.494   0.494
#> SD:hclust   2 0.402           0.762       0.885          0.485 0.502   0.502
#> CV:hclust   2 0.407           0.781       0.893          0.470 0.525   0.525
#> MAD:hclust  2 0.487           0.728       0.875          0.486 0.505   0.505
#> ATC:hclust  2 0.873           0.893       0.960          0.348 0.661   0.661
get_stats(res_list, k = 3)
#>             k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> SD:NMF      3 0.521           0.672       0.809          0.327 0.745   0.529
#> CV:NMF      3 0.521           0.498       0.739          0.309 0.722   0.497
#> MAD:NMF     3 0.547           0.627       0.830          0.323 0.757   0.547
#> ATC:NMF     3 0.903           0.892       0.955          0.326 0.766   0.564
#> SD:skmeans  3 0.879           0.374       0.744          0.327 0.580   0.328
#> CV:skmeans  3 0.629           0.827       0.848          0.322 0.710   0.481
#> MAD:skmeans 3 0.911           0.900       0.953          0.323 0.721   0.495
#> ATC:skmeans 3 0.930           0.941       0.976          0.265 0.822   0.652
#> SD:mclust   3 0.341           0.707       0.772          0.337 0.732   0.517
#> CV:mclust   3 0.352           0.543       0.669          0.573 0.676   0.584
#> MAD:mclust  3 0.403           0.695       0.820          0.509 0.723   0.655
#> ATC:mclust  3 0.768           0.901       0.926          0.924 0.690   0.530
#> SD:kmeans   3 0.599           0.684       0.752          0.304 0.761   0.557
#> CV:kmeans   3 0.540           0.339       0.630          0.297 0.706   0.477
#> MAD:kmeans  3 0.554           0.683       0.777          0.309 0.795   0.609
#> ATC:kmeans  3 1.000           0.964       0.981          0.368 0.661   0.424
#> SD:pam      3 0.448           0.621       0.806          0.340 0.798   0.621
#> CV:pam      3 0.659           0.757       0.877          0.370 0.811   0.636
#> MAD:pam     3 0.529           0.657       0.818          0.371 0.820   0.653
#> ATC:pam     3 0.907           0.909       0.965          0.351 0.694   0.463
#> SD:hclust   3 0.311           0.566       0.736          0.330 0.841   0.682
#> CV:hclust   3 0.337           0.402       0.662          0.346 0.748   0.545
#> MAD:hclust  3 0.342           0.542       0.724          0.323 0.781   0.587
#> ATC:hclust  3 0.729           0.782       0.896          0.806 0.704   0.552
get_stats(res_list, k = 4)
#>             k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> SD:NMF      4 0.873           0.892       0.953         0.1346 0.803   0.491
#> CV:NMF      4 0.850           0.869       0.946         0.1423 0.811   0.508
#> MAD:NMF     4 0.897           0.914       0.962         0.1336 0.833   0.551
#> ATC:NMF     4 0.694           0.718       0.858         0.0587 0.835   0.608
#> SD:skmeans  4 0.891           0.903       0.958         0.1299 0.740   0.378
#> CV:skmeans  4 0.941           0.924       0.967         0.1333 0.816   0.515
#> MAD:skmeans 4 0.864           0.850       0.941         0.1298 0.832   0.547
#> ATC:skmeans 4 0.856           0.843       0.932         0.1175 0.922   0.784
#> SD:mclust   4 0.729           0.848       0.919         0.2189 0.824   0.545
#> CV:mclust   4 0.801           0.904       0.946         0.3522 0.633   0.359
#> MAD:mclust  4 0.928           0.917       0.962         0.6378 0.572   0.324
#> ATC:mclust  4 0.941           0.929       0.975         0.0557 0.915   0.779
#> SD:kmeans   4 0.860           0.884       0.929         0.1542 0.828   0.544
#> CV:kmeans   4 0.831           0.872       0.925         0.1568 0.777   0.440
#> MAD:kmeans  4 0.870           0.891       0.942         0.1465 0.829   0.550
#> ATC:kmeans  4 0.750           0.704       0.827         0.1107 0.936   0.815
#> SD:pam      4 0.552           0.669       0.843         0.1477 0.787   0.477
#> CV:pam      4 0.915           0.892       0.951         0.1148 0.760   0.428
#> MAD:pam     4 0.525           0.476       0.707         0.1264 0.806   0.504
#> ATC:pam     4 0.773           0.832       0.888         0.0838 0.934   0.815
#> SD:hclust   4 0.508           0.613       0.791         0.1418 0.808   0.509
#> CV:hclust   4 0.437           0.475       0.711         0.1501 0.741   0.387
#> MAD:hclust  4 0.492           0.547       0.751         0.1418 0.819   0.526
#> ATC:hclust  4 0.721           0.726       0.829         0.1281 0.918   0.780
get_stats(res_list, k = 5)
#>             k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> SD:NMF      5 0.732           0.719       0.858         0.0542 0.915   0.682
#> CV:NMF      5 0.856           0.835       0.918         0.0576 0.912   0.670
#> MAD:NMF     5 0.729           0.697       0.840         0.0558 0.915   0.680
#> ATC:NMF     5 0.532           0.457       0.705         0.0747 0.929   0.805
#> SD:skmeans  5 0.828           0.807       0.896         0.0564 0.933   0.735
#> CV:skmeans  5 0.799           0.745       0.845         0.0543 0.950   0.799
#> MAD:skmeans 5 0.839           0.841       0.910         0.0618 0.921   0.694
#> ATC:skmeans 5 0.839           0.776       0.894         0.0338 0.979   0.928
#> SD:mclust   5 0.683           0.715       0.813         0.0432 0.960   0.853
#> CV:mclust   5 0.695           0.679       0.841         0.0384 0.964   0.859
#> MAD:mclust  5 0.847           0.864       0.927         0.0668 0.925   0.712
#> ATC:mclust  5 0.794           0.718       0.840         0.1062 0.897   0.693
#> SD:kmeans   5 0.733           0.667       0.808         0.0607 0.944   0.778
#> CV:kmeans   5 0.749           0.623       0.783         0.0615 0.905   0.646
#> MAD:kmeans  5 0.739           0.721       0.833         0.0599 0.928   0.722
#> ATC:kmeans  5 0.715           0.674       0.786         0.0520 0.972   0.903
#> SD:pam      5 0.855           0.852       0.929         0.0972 0.792   0.388
#> CV:pam      5 0.695           0.539       0.759         0.0886 0.877   0.590
#> MAD:pam     5 0.700           0.511       0.758         0.0805 0.832   0.459
#> ATC:pam     5 0.831           0.877       0.925         0.0977 0.867   0.588
#> SD:hclust   5 0.624           0.637       0.785         0.0677 0.931   0.737
#> CV:hclust   5 0.556           0.564       0.761         0.0749 0.899   0.639
#> MAD:hclust  5 0.621           0.577       0.771         0.0761 0.900   0.631
#> ATC:hclust  5 0.737           0.694       0.821         0.0539 0.934   0.779
get_stats(res_list, k = 6)
#>             k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> SD:NMF      6 0.700           0.562       0.764         0.0388 0.941   0.747
#> CV:NMF      6 0.747           0.618       0.795         0.0390 0.972   0.867
#> MAD:NMF     6 0.678           0.545       0.739         0.0392 0.881   0.517
#> ATC:NMF     6 0.551           0.381       0.618         0.0514 0.886   0.666
#> SD:skmeans  6 0.777           0.708       0.850         0.0377 0.947   0.751
#> CV:skmeans  6 0.762           0.691       0.845         0.0395 0.936   0.707
#> MAD:skmeans 6 0.791           0.650       0.817         0.0366 0.960   0.806
#> ATC:skmeans 6 0.862           0.794       0.882         0.0317 0.941   0.787
#> SD:mclust   6 0.724           0.666       0.767         0.0619 0.916   0.682
#> CV:mclust   6 0.790           0.799       0.839         0.0742 0.918   0.654
#> MAD:mclust  6 0.860           0.880       0.918         0.0345 0.941   0.726
#> ATC:mclust  6 0.704           0.553       0.790         0.0628 0.959   0.839
#> SD:kmeans   6 0.727           0.608       0.786         0.0413 0.932   0.694
#> CV:kmeans   6 0.750           0.667       0.807         0.0427 0.919   0.636
#> MAD:kmeans  6 0.718           0.577       0.760         0.0410 0.947   0.753
#> ATC:kmeans  6 0.720           0.638       0.798         0.0442 0.927   0.731
#> SD:pam      6 0.775           0.753       0.849         0.0473 0.921   0.648
#> CV:pam      6 0.756           0.547       0.779         0.0591 0.863   0.463
#> MAD:pam     6 0.697           0.492       0.731         0.0525 0.883   0.518
#> ATC:pam     6 0.866           0.852       0.897         0.0510 0.932   0.697
#> SD:hclust   6 0.654           0.609       0.725         0.0364 0.963   0.831
#> CV:hclust   6 0.710           0.590       0.783         0.0576 0.949   0.756
#> MAD:hclust  6 0.659           0.533       0.722         0.0413 0.969   0.843
#> ATC:hclust  6 0.765           0.678       0.811         0.0321 0.957   0.831

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 disease.state(p) k
#> SD:NMF      78            1.000 2
#> CV:NMF      79            1.000 2
#> MAD:NMF     78            1.000 2
#> ATC:NMF     79            1.000 2
#> SD:skmeans  79            1.000 2
#> CV:skmeans  74            1.000 2
#> MAD:skmeans 74            1.000 2
#> ATC:skmeans 78            0.692 2
#> SD:mclust   77            1.000 2
#> CV:mclust   80            0.847 2
#> MAD:mclust  79            0.911 2
#> ATC:mclust  80            0.220 2
#> SD:kmeans   80            1.000 2
#> CV:kmeans   79            1.000 2
#> MAD:kmeans  80            1.000 2
#> ATC:kmeans  79            0.718 2
#> SD:pam      79            0.391 2
#> CV:pam      79            0.485 2
#> MAD:pam     79            0.485 2
#> ATC:pam     78            0.925 2
#> SD:hclust   70            0.733 2
#> CV:hclust   74            1.000 2
#> MAD:hclust  66            0.631 2
#> ATC:hclust  75            0.486 2
test_to_known_factors(res_list, k = 3)
#>              n disease.state(p) k
#> SD:NMF      69            0.952 3
#> CV:NMF      43            1.000 3
#> MAD:NMF     63            1.000 3
#> ATC:NMF     76            0.257 3
#> SD:skmeans  40            0.945 3
#> CV:skmeans  76            0.837 3
#> MAD:skmeans 76            0.894 3
#> ATC:skmeans 77            0.520 3
#> SD:mclust   69            0.530 3
#> CV:mclust   53            1.000 3
#> MAD:mclust  73            0.164 3
#> ATC:mclust  77            0.130 3
#> SD:kmeans   70            0.925 3
#> CV:kmeans   33            0.447 3
#> MAD:kmeans  71            0.960 3
#> ATC:kmeans  78            0.281 3
#> SD:pam      69            0.443 3
#> CV:pam      70            0.475 3
#> MAD:pam     67            0.447 3
#> ATC:pam     76            0.369 3
#> SD:hclust   63            0.936 3
#> CV:hclust   29            1.000 3
#> MAD:hclust  42            0.562 3
#> ATC:hclust  69            0.213 3
test_to_known_factors(res_list, k = 4)
#>              n disease.state(p) k
#> SD:NMF      78            0.570 4
#> CV:NMF      74            0.471 4
#> MAD:NMF     79            0.441 4
#> ATC:NMF     70            0.670 4
#> SD:skmeans  77            0.284 4
#> CV:skmeans  77            0.210 4
#> MAD:skmeans 73            0.553 4
#> ATC:skmeans 75            0.654 4
#> SD:mclust   78            0.598 4
#> CV:mclust   79            0.700 4
#> MAD:mclust  78            0.478 4
#> ATC:mclust  78            0.168 4
#> SD:kmeans   77            0.343 4
#> CV:kmeans   76            0.345 4
#> MAD:kmeans  78            0.350 4
#> ATC:kmeans  62            0.734 4
#> SD:pam      66            0.487 4
#> CV:pam      76            0.537 4
#> MAD:pam     39            0.560 4
#> ATC:pam     76            0.502 4
#> SD:hclust   63            0.911 4
#> CV:hclust   48            0.922 4
#> MAD:hclust  53            0.676 4
#> ATC:hclust  72            0.301 4
test_to_known_factors(res_list, k = 5)
#>              n disease.state(p) k
#> SD:NMF      69            0.238 5
#> CV:NMF      76            0.373 5
#> MAD:NMF     63            0.737 5
#> ATC:NMF     45            0.894 5
#> SD:skmeans  73            0.480 5
#> CV:skmeans  71            0.364 5
#> MAD:skmeans 78            0.744 5
#> ATC:skmeans 66            0.876 5
#> SD:mclust   74            0.631 5
#> CV:mclust   66            0.655 5
#> MAD:mclust  78            0.882 5
#> ATC:mclust  67            0.248 5
#> SD:kmeans   64            0.540 5
#> CV:kmeans   58            0.642 5
#> MAD:kmeans  70            0.625 5
#> ATC:kmeans  70            0.230 5
#> SD:pam      75            0.899 5
#> CV:pam      50            0.471 5
#> MAD:pam     44            0.604 5
#> ATC:pam     79            0.660 5
#> SD:hclust   70            0.490 5
#> CV:hclust   57            0.892 5
#> MAD:hclust  52            0.783 5
#> ATC:hclust  64            0.556 5
test_to_known_factors(res_list, k = 6)
#>              n disease.state(p) k
#> SD:NMF      57            0.262 6
#> CV:NMF      63            0.220 6
#> MAD:NMF     53            0.221 6
#> ATC:NMF     34            0.742 6
#> SD:skmeans  67            0.216 6
#> CV:skmeans  68            0.171 6
#> MAD:skmeans 62            0.719 6
#> ATC:skmeans 66            0.847 6
#> SD:mclust   73            0.560 6
#> CV:mclust   78            0.676 6
#> MAD:mclust  79            0.840 6
#> ATC:mclust  56            0.439 6
#> SD:kmeans   60            0.234 6
#> CV:kmeans   64            0.531 6
#> MAD:kmeans  60            0.887 6
#> ATC:kmeans  66            0.388 6
#> SD:pam      73            0.398 6
#> CV:pam      59            0.391 6
#> MAD:pam     44            0.430 6
#> ATC:pam     77            0.835 6
#> SD:hclust   64            0.772 6
#> CV:hclust   60            0.523 6
#> MAD:hclust  52            0.692 6
#> ATC:hclust  63            0.586 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 51941 rows and 80 columns.
#>   Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'SD' method.
#>   Subgroups are detected by 'hclust' method.
#>   Performed in total 1250 partitions by row resampling.
#>   Best k for subgroups seems to be 2.
#> 
#> Following methods can be applied to this 'ConsensusPartition' object:
#>  [1] "cola_report"             "collect_classes"         "collect_plots"          
#>  [4] "collect_stats"           "colnames"                "compare_signatures"     
#>  [7] "consensus_heatmap"       "dimension_reduction"     "functional_enrichment"  
#> [10] "get_anno_col"            "get_anno"                "get_classes"            
#> [13] "get_consensus"           "get_matrix"              "get_membership"         
#> [16] "get_param"               "get_signatures"          "get_stats"              
#> [19] "is_best_k"               "is_stable_k"             "membership_heatmap"     
#> [22] "ncol"                    "nrow"                    "plot_ecdf"              
#> [25] "rownames"                "select_partition_number" "show"                   
#> [28] "suggest_best_k"          "test_to_known_factors"

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

collect_plots(res)

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.402           0.762       0.885         0.4848 0.502   0.502
#> 3 3 0.311           0.566       0.736         0.3300 0.841   0.682
#> 4 4 0.508           0.613       0.791         0.1418 0.808   0.509
#> 5 5 0.624           0.637       0.785         0.0677 0.931   0.737
#> 6 6 0.654           0.609       0.725         0.0364 0.963   0.831

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
#> GSM531602     2  0.0000     0.8735 0.000 1.000
#> GSM531604     2  0.7528     0.7205 0.216 0.784
#> GSM531606     2  0.6343     0.7906 0.160 0.840
#> GSM531607     2  0.0000     0.8735 0.000 1.000
#> GSM531608     1  0.7528     0.7302 0.784 0.216
#> GSM531610     2  0.0000     0.8735 0.000 1.000
#> GSM531612     2  0.0000     0.8735 0.000 1.000
#> GSM531613     2  0.0000     0.8735 0.000 1.000
#> GSM531614     2  0.0000     0.8735 0.000 1.000
#> GSM531616     1  0.0000     0.8538 1.000 0.000
#> GSM531618     2  0.7056     0.7620 0.192 0.808
#> GSM531619     1  0.1633     0.8548 0.976 0.024
#> GSM531620     1  0.2423     0.8563 0.960 0.040
#> GSM531623     1  0.0376     0.8546 0.996 0.004
#> GSM531625     1  0.0000     0.8538 1.000 0.000
#> GSM531626     1  0.0000     0.8538 1.000 0.000
#> GSM531632     1  0.0000     0.8538 1.000 0.000
#> GSM531638     1  0.0000     0.8538 1.000 0.000
#> GSM531639     1  0.3431     0.8498 0.936 0.064
#> GSM531641     2  0.0000     0.8735 0.000 1.000
#> GSM531642     2  0.9988     0.0509 0.480 0.520
#> GSM531643     1  0.4431     0.8333 0.908 0.092
#> GSM531644     2  0.9988     0.0509 0.480 0.520
#> GSM531645     2  0.0000     0.8735 0.000 1.000
#> GSM531646     1  0.0000     0.8538 1.000 0.000
#> GSM531647     1  0.0000     0.8538 1.000 0.000
#> GSM531648     2  0.5178     0.8286 0.116 0.884
#> GSM531650     1  0.3114     0.8511 0.944 0.056
#> GSM531651     1  0.0376     0.8546 0.996 0.004
#> GSM531652     2  0.8443     0.6411 0.272 0.728
#> GSM531656     1  0.3274     0.8497 0.940 0.060
#> GSM531659     2  0.8661     0.5993 0.288 0.712
#> GSM531661     1  0.7056     0.7520 0.808 0.192
#> GSM531662     1  0.8386     0.6673 0.732 0.268
#> GSM531663     2  0.5059     0.8237 0.112 0.888
#> GSM531664     1  0.3114     0.8511 0.944 0.056
#> GSM531666     1  0.9850     0.2624 0.572 0.428
#> GSM531667     1  0.8608     0.6544 0.716 0.284
#> GSM531668     2  0.2778     0.8620 0.048 0.952
#> GSM531669     1  0.2423     0.8548 0.960 0.040
#> GSM531671     1  0.8386     0.6673 0.732 0.268
#> GSM531672     2  0.0938     0.8705 0.012 0.988
#> GSM531673     1  0.8386     0.6673 0.732 0.268
#> GSM531676     1  0.9686     0.4327 0.604 0.396
#> GSM531679     2  0.6801     0.7678 0.180 0.820
#> GSM531681     2  0.0000     0.8735 0.000 1.000
#> GSM531682     2  0.6801     0.7678 0.180 0.820
#> GSM531683     2  0.0000     0.8735 0.000 1.000
#> GSM531684     2  0.6438     0.7868 0.164 0.836
#> GSM531685     1  0.5519     0.8156 0.872 0.128
#> GSM531686     2  0.0000     0.8735 0.000 1.000
#> GSM531687     1  0.9686     0.4327 0.604 0.396
#> GSM531688     1  0.5059     0.8255 0.888 0.112
#> GSM531690     2  0.0000     0.8735 0.000 1.000
#> GSM531693     1  0.5059     0.8255 0.888 0.112
#> GSM531695     1  0.9850     0.3450 0.572 0.428
#> GSM531603     2  0.0000     0.8735 0.000 1.000
#> GSM531609     2  0.0000     0.8735 0.000 1.000
#> GSM531611     2  0.0000     0.8735 0.000 1.000
#> GSM531621     1  0.0376     0.8546 0.996 0.004
#> GSM531622     1  0.1633     0.8548 0.976 0.024
#> GSM531628     1  0.3114     0.8511 0.944 0.056
#> GSM531630     1  0.1633     0.8548 0.976 0.024
#> GSM531633     1  0.0376     0.8546 0.996 0.004
#> GSM531635     1  0.0000     0.8538 1.000 0.000
#> GSM531640     1  0.1633     0.8548 0.976 0.024
#> GSM531649     1  0.0000     0.8538 1.000 0.000
#> GSM531653     1  0.0000     0.8538 1.000 0.000
#> GSM531657     2  0.6148     0.7972 0.152 0.848
#> GSM531665     2  0.9460     0.4280 0.364 0.636
#> GSM531670     1  0.3274     0.8497 0.940 0.060
#> GSM531674     1  0.2423     0.8548 0.960 0.040
#> GSM531675     2  0.0000     0.8735 0.000 1.000
#> GSM531677     2  0.3274     0.8530 0.060 0.940
#> GSM531678     2  0.6531     0.7829 0.168 0.832
#> GSM531680     1  0.9710     0.4233 0.600 0.400
#> GSM531689     1  0.9686     0.4327 0.604 0.396
#> GSM531691     1  0.9686     0.4327 0.604 0.396
#> GSM531692     1  0.7745     0.7210 0.772 0.228
#> GSM531694     2  0.0000     0.8735 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
#> GSM531602     2  0.5919    0.74267 0.276 0.712 0.012
#> GSM531604     2  0.9335    0.58167 0.324 0.492 0.184
#> GSM531606     2  0.8894    0.64416 0.300 0.548 0.152
#> GSM531607     2  0.5919    0.74267 0.276 0.712 0.012
#> GSM531608     3  0.5831    0.62477 0.076 0.128 0.796
#> GSM531610     2  0.0892    0.75334 0.020 0.980 0.000
#> GSM531612     2  0.0892    0.75334 0.020 0.980 0.000
#> GSM531613     2  0.0892    0.75334 0.020 0.980 0.000
#> GSM531614     2  0.0892    0.75334 0.020 0.980 0.000
#> GSM531616     3  0.6244   -0.13067 0.440 0.000 0.560
#> GSM531618     2  0.6332    0.66494 0.088 0.768 0.144
#> GSM531619     3  0.0424    0.72630 0.008 0.000 0.992
#> GSM531620     3  0.3722    0.67438 0.088 0.024 0.888
#> GSM531623     3  0.0592    0.72593 0.012 0.000 0.988
#> GSM531625     3  0.1411    0.71482 0.036 0.000 0.964
#> GSM531626     3  0.1643    0.70972 0.044 0.000 0.956
#> GSM531632     1  0.5706    0.58510 0.680 0.000 0.320
#> GSM531638     3  0.6244   -0.13067 0.440 0.000 0.560
#> GSM531639     3  0.7517    0.08125 0.364 0.048 0.588
#> GSM531641     2  0.0892    0.75334 0.020 0.980 0.000
#> GSM531642     2  0.8869   -0.00308 0.380 0.496 0.124
#> GSM531643     1  0.7447    0.57350 0.652 0.068 0.280
#> GSM531644     2  0.8869   -0.00308 0.380 0.496 0.124
#> GSM531645     2  0.0892    0.75334 0.020 0.980 0.000
#> GSM531646     1  0.5968    0.54503 0.636 0.000 0.364
#> GSM531647     1  0.5706    0.58510 0.680 0.000 0.320
#> GSM531648     2  0.4914    0.70827 0.068 0.844 0.088
#> GSM531650     1  0.6562    0.60354 0.700 0.036 0.264
#> GSM531651     3  0.0592    0.72593 0.012 0.000 0.988
#> GSM531652     2  0.7276    0.53687 0.192 0.704 0.104
#> GSM531656     1  0.7555    0.33039 0.520 0.040 0.440
#> GSM531659     2  0.8808    0.53014 0.164 0.572 0.264
#> GSM531661     3  0.5407    0.63965 0.076 0.104 0.820
#> GSM531662     3  0.7562    0.55552 0.148 0.160 0.692
#> GSM531663     2  0.6111    0.72953 0.112 0.784 0.104
#> GSM531664     1  0.6562    0.60354 0.700 0.036 0.264
#> GSM531666     1  0.9259    0.21574 0.440 0.404 0.156
#> GSM531667     3  0.6935    0.56057 0.088 0.188 0.724
#> GSM531668     2  0.3263    0.75117 0.048 0.912 0.040
#> GSM531669     1  0.5363    0.60861 0.724 0.000 0.276
#> GSM531671     3  0.7617    0.55285 0.152 0.160 0.688
#> GSM531672     2  0.3045    0.76082 0.064 0.916 0.020
#> GSM531673     3  0.7562    0.55552 0.148 0.160 0.692
#> GSM531676     1  0.8427    0.29910 0.612 0.148 0.240
#> GSM531679     2  0.8158    0.63326 0.364 0.556 0.080
#> GSM531681     2  0.4291    0.76372 0.180 0.820 0.000
#> GSM531682     2  0.8158    0.63326 0.364 0.556 0.080
#> GSM531683     2  0.5737    0.74694 0.256 0.732 0.012
#> GSM531684     2  0.8941    0.64036 0.300 0.544 0.156
#> GSM531685     1  0.4702    0.58732 0.788 0.000 0.212
#> GSM531686     2  0.4291    0.76372 0.180 0.820 0.000
#> GSM531687     1  0.8427    0.29910 0.612 0.148 0.240
#> GSM531688     1  0.4399    0.60564 0.812 0.000 0.188
#> GSM531690     2  0.4291    0.76372 0.180 0.820 0.000
#> GSM531693     1  0.4702    0.60071 0.788 0.000 0.212
#> GSM531695     1  0.6625    0.38425 0.736 0.196 0.068
#> GSM531603     2  0.5919    0.74267 0.276 0.712 0.012
#> GSM531609     2  0.0892    0.75334 0.020 0.980 0.000
#> GSM531611     2  0.0892    0.75334 0.020 0.980 0.000
#> GSM531621     3  0.0592    0.72593 0.012 0.000 0.988
#> GSM531622     3  0.0424    0.72630 0.008 0.000 0.992
#> GSM531628     1  0.6562    0.60354 0.700 0.036 0.264
#> GSM531630     3  0.0424    0.72630 0.008 0.000 0.992
#> GSM531633     3  0.0592    0.72593 0.012 0.000 0.988
#> GSM531635     3  0.6274   -0.17795 0.456 0.000 0.544
#> GSM531640     3  0.0424    0.72630 0.008 0.000 0.992
#> GSM531649     1  0.5785    0.57712 0.668 0.000 0.332
#> GSM531653     1  0.5785    0.57712 0.668 0.000 0.332
#> GSM531657     2  0.6181    0.70823 0.072 0.772 0.156
#> GSM531665     2  0.9120    0.37439 0.156 0.504 0.340
#> GSM531670     1  0.7555    0.33039 0.520 0.040 0.440
#> GSM531674     1  0.5363    0.60861 0.724 0.000 0.276
#> GSM531675     2  0.4346    0.76340 0.184 0.816 0.000
#> GSM531677     2  0.5977    0.74332 0.252 0.728 0.020
#> GSM531678     2  0.8964    0.63873 0.296 0.544 0.160
#> GSM531680     1  0.6572    0.43276 0.748 0.172 0.080
#> GSM531689     1  0.8427    0.29910 0.612 0.148 0.240
#> GSM531691     1  0.8427    0.29910 0.612 0.148 0.240
#> GSM531692     1  0.6215    0.04763 0.572 0.000 0.428
#> GSM531694     2  0.5919    0.74267 0.276 0.712 0.012

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM531602     2  0.2775     0.6708 0.000 0.896 0.020 0.084
#> GSM531604     2  0.3552     0.6468 0.024 0.848 0.128 0.000
#> GSM531606     2  0.2345     0.6677 0.000 0.900 0.100 0.000
#> GSM531607     2  0.2843     0.6704 0.000 0.892 0.020 0.088
#> GSM531608     3  0.5309     0.7577 0.020 0.124 0.776 0.080
#> GSM531610     4  0.0000     0.7841 0.000 0.000 0.000 1.000
#> GSM531612     4  0.0000     0.7841 0.000 0.000 0.000 1.000
#> GSM531613     4  0.0000     0.7841 0.000 0.000 0.000 1.000
#> GSM531614     4  0.0000     0.7841 0.000 0.000 0.000 1.000
#> GSM531616     1  0.4564     0.5136 0.672 0.000 0.328 0.000
#> GSM531618     4  0.6653     0.6658 0.104 0.080 0.108 0.708
#> GSM531619     3  0.0000     0.8512 0.000 0.000 1.000 0.000
#> GSM531620     3  0.3877     0.7747 0.124 0.004 0.840 0.032
#> GSM531623     3  0.0707     0.8535 0.020 0.000 0.980 0.000
#> GSM531625     3  0.2469     0.8110 0.108 0.000 0.892 0.000
#> GSM531626     3  0.2589     0.8047 0.116 0.000 0.884 0.000
#> GSM531632     1  0.0188     0.7658 0.996 0.000 0.004 0.000
#> GSM531638     1  0.4564     0.5136 0.672 0.000 0.328 0.000
#> GSM531639     1  0.6414     0.3197 0.544 0.004 0.392 0.060
#> GSM531641     4  0.0000     0.7841 0.000 0.000 0.000 1.000
#> GSM531642     4  0.6093     0.1687 0.456 0.012 0.024 0.508
#> GSM531643     1  0.3027     0.7270 0.888 0.004 0.020 0.088
#> GSM531644     4  0.6093     0.1687 0.456 0.012 0.024 0.508
#> GSM531645     4  0.0000     0.7841 0.000 0.000 0.000 1.000
#> GSM531646     1  0.1389     0.7640 0.952 0.000 0.048 0.000
#> GSM531647     1  0.0188     0.7658 0.996 0.000 0.004 0.000
#> GSM531648     4  0.5034     0.7295 0.096 0.060 0.040 0.804
#> GSM531650     1  0.1557     0.7529 0.944 0.000 0.000 0.056
#> GSM531651     3  0.0707     0.8535 0.020 0.000 0.980 0.000
#> GSM531652     4  0.5468     0.6197 0.248 0.020 0.024 0.708
#> GSM531656     1  0.5109     0.6596 0.744 0.000 0.196 0.060
#> GSM531659     2  0.8860     0.0764 0.052 0.388 0.240 0.320
#> GSM531661     3  0.4714     0.7780 0.016 0.104 0.812 0.068
#> GSM531662     3  0.7588     0.6558 0.084 0.188 0.624 0.104
#> GSM531663     4  0.6543     0.4685 0.016 0.240 0.092 0.652
#> GSM531664     1  0.1557     0.7529 0.944 0.000 0.000 0.056
#> GSM531666     1  0.5837     0.0579 0.552 0.008 0.020 0.420
#> GSM531667     3  0.6380     0.6947 0.028 0.120 0.704 0.148
#> GSM531668     4  0.3661     0.7454 0.040 0.088 0.008 0.864
#> GSM531669     1  0.1356     0.7612 0.960 0.032 0.000 0.008
#> GSM531671     3  0.7645     0.6522 0.088 0.188 0.620 0.104
#> GSM531672     4  0.5626     0.4436 0.012 0.324 0.020 0.644
#> GSM531673     3  0.7588     0.6558 0.084 0.188 0.624 0.104
#> GSM531676     2  0.8162     0.1493 0.376 0.440 0.148 0.036
#> GSM531679     2  0.3477     0.6592 0.088 0.872 0.008 0.032
#> GSM531681     2  0.4697     0.4843 0.000 0.644 0.000 0.356
#> GSM531682     2  0.3477     0.6592 0.088 0.872 0.008 0.032
#> GSM531683     2  0.3160     0.6651 0.000 0.872 0.020 0.108
#> GSM531684     2  0.2345     0.6671 0.000 0.900 0.100 0.000
#> GSM531685     1  0.4627     0.6909 0.808 0.136 0.036 0.020
#> GSM531686     2  0.4697     0.4843 0.000 0.644 0.000 0.356
#> GSM531687     2  0.8162     0.1493 0.376 0.440 0.148 0.036
#> GSM531688     1  0.3160     0.7188 0.872 0.108 0.000 0.020
#> GSM531690     2  0.4406     0.5373 0.000 0.700 0.000 0.300
#> GSM531693     1  0.3853     0.7132 0.848 0.116 0.016 0.020
#> GSM531695     1  0.6206     0.1646 0.540 0.404 0.000 0.056
#> GSM531603     2  0.2843     0.6704 0.000 0.892 0.020 0.088
#> GSM531609     4  0.0000     0.7841 0.000 0.000 0.000 1.000
#> GSM531611     4  0.1211     0.7707 0.000 0.040 0.000 0.960
#> GSM531621     3  0.0707     0.8535 0.020 0.000 0.980 0.000
#> GSM531622     3  0.0000     0.8512 0.000 0.000 1.000 0.000
#> GSM531628     1  0.1557     0.7529 0.944 0.000 0.000 0.056
#> GSM531630     3  0.0000     0.8512 0.000 0.000 1.000 0.000
#> GSM531633     3  0.0707     0.8535 0.020 0.000 0.980 0.000
#> GSM531635     1  0.4431     0.5498 0.696 0.000 0.304 0.000
#> GSM531640     3  0.0000     0.8512 0.000 0.000 1.000 0.000
#> GSM531649     1  0.0592     0.7667 0.984 0.000 0.016 0.000
#> GSM531653     1  0.0592     0.7667 0.984 0.000 0.016 0.000
#> GSM531657     4  0.7084     0.5022 0.016 0.216 0.152 0.616
#> GSM531665     2  0.8944     0.1235 0.056 0.380 0.312 0.252
#> GSM531670     1  0.5109     0.6596 0.744 0.000 0.196 0.060
#> GSM531674     1  0.1356     0.7612 0.960 0.032 0.000 0.008
#> GSM531675     2  0.4382     0.5411 0.000 0.704 0.000 0.296
#> GSM531677     2  0.4801     0.6205 0.048 0.764 0.000 0.188
#> GSM531678     2  0.2654     0.6672 0.000 0.888 0.108 0.004
#> GSM531680     1  0.6645     0.1971 0.548 0.384 0.020 0.048
#> GSM531689     2  0.8162     0.1493 0.376 0.440 0.148 0.036
#> GSM531691     2  0.8162     0.1493 0.376 0.440 0.148 0.036
#> GSM531692     1  0.7912    -0.0274 0.360 0.312 0.328 0.000
#> GSM531694     2  0.2775     0.6708 0.000 0.896 0.020 0.084

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>           class entropy silhouette    p1    p2    p3    p4    p5
#> GSM531602     2  0.0000     0.6925 0.000 1.000 0.000 0.000 0.000
#> GSM531604     2  0.4073     0.5369 0.000 0.752 0.032 0.000 0.216
#> GSM531606     2  0.3359     0.6089 0.000 0.816 0.020 0.000 0.164
#> GSM531607     2  0.0162     0.6930 0.000 0.996 0.000 0.004 0.000
#> GSM531608     3  0.5692     0.7056 0.004 0.124 0.696 0.028 0.148
#> GSM531610     4  0.0404     0.7982 0.000 0.012 0.000 0.988 0.000
#> GSM531612     4  0.0404     0.7982 0.000 0.012 0.000 0.988 0.000
#> GSM531613     4  0.0404     0.7982 0.000 0.012 0.000 0.988 0.000
#> GSM531614     4  0.0404     0.7982 0.000 0.012 0.000 0.988 0.000
#> GSM531616     1  0.4437     0.5229 0.664 0.000 0.316 0.000 0.020
#> GSM531618     4  0.7871     0.6143 0.092 0.108 0.100 0.576 0.124
#> GSM531619     3  0.0290     0.8221 0.000 0.008 0.992 0.000 0.000
#> GSM531620     3  0.3534     0.7566 0.108 0.004 0.844 0.012 0.032
#> GSM531623     3  0.0404     0.8228 0.012 0.000 0.988 0.000 0.000
#> GSM531625     3  0.2616     0.7753 0.100 0.000 0.880 0.000 0.020
#> GSM531626     3  0.2722     0.7697 0.108 0.000 0.872 0.000 0.020
#> GSM531632     1  0.0162     0.7258 0.996 0.000 0.000 0.000 0.004
#> GSM531638     1  0.4437     0.5229 0.664 0.000 0.316 0.000 0.020
#> GSM531639     1  0.6006     0.3070 0.524 0.004 0.400 0.036 0.036
#> GSM531641     4  0.0404     0.7982 0.000 0.012 0.000 0.988 0.000
#> GSM531642     1  0.6621     0.0136 0.440 0.004 0.024 0.432 0.100
#> GSM531643     1  0.3042     0.7166 0.880 0.000 0.020 0.056 0.044
#> GSM531644     1  0.6621     0.0136 0.440 0.004 0.024 0.432 0.100
#> GSM531645     4  0.0404     0.7982 0.000 0.012 0.000 0.988 0.000
#> GSM531646     1  0.1399     0.7263 0.952 0.000 0.028 0.000 0.020
#> GSM531647     1  0.0162     0.7258 0.996 0.000 0.000 0.000 0.004
#> GSM531648     4  0.6350     0.6891 0.080 0.072 0.032 0.688 0.128
#> GSM531650     1  0.1753     0.7262 0.936 0.000 0.000 0.032 0.032
#> GSM531651     3  0.0404     0.8228 0.012 0.000 0.988 0.000 0.000
#> GSM531652     4  0.6594     0.5081 0.232 0.012 0.024 0.596 0.136
#> GSM531656     1  0.4879     0.6595 0.728 0.000 0.204 0.036 0.032
#> GSM531659     2  0.8282     0.1474 0.000 0.392 0.168 0.216 0.224
#> GSM531661     3  0.4944     0.7400 0.004 0.112 0.760 0.024 0.100
#> GSM531662     3  0.7274     0.5706 0.020 0.140 0.520 0.036 0.284
#> GSM531663     4  0.6527     0.4357 0.000 0.260 0.048 0.584 0.108
#> GSM531664     1  0.1753     0.7262 0.936 0.000 0.000 0.032 0.032
#> GSM531666     1  0.6155     0.2739 0.544 0.000 0.020 0.348 0.088
#> GSM531667     3  0.6659     0.6528 0.004 0.140 0.628 0.076 0.152
#> GSM531668     4  0.5233     0.7063 0.012 0.108 0.008 0.728 0.144
#> GSM531669     1  0.2583     0.6777 0.864 0.000 0.000 0.004 0.132
#> GSM531671     3  0.7337     0.5692 0.024 0.140 0.520 0.036 0.280
#> GSM531672     4  0.5751     0.3294 0.000 0.400 0.012 0.528 0.060
#> GSM531673     3  0.7274     0.5706 0.020 0.140 0.520 0.036 0.284
#> GSM531676     5  0.4520     0.8049 0.020 0.200 0.032 0.000 0.748
#> GSM531679     2  0.4016     0.5530 0.000 0.716 0.000 0.012 0.272
#> GSM531681     2  0.4754     0.5810 0.000 0.684 0.000 0.264 0.052
#> GSM531682     2  0.4016     0.5530 0.000 0.716 0.000 0.012 0.272
#> GSM531683     2  0.1408     0.6839 0.000 0.948 0.000 0.008 0.044
#> GSM531684     2  0.3438     0.6034 0.000 0.808 0.020 0.000 0.172
#> GSM531685     1  0.4849     0.2552 0.548 0.016 0.000 0.004 0.432
#> GSM531686     2  0.4754     0.5810 0.000 0.684 0.000 0.264 0.052
#> GSM531687     5  0.4520     0.8049 0.020 0.200 0.032 0.000 0.748
#> GSM531688     1  0.3875     0.5892 0.756 0.012 0.000 0.004 0.228
#> GSM531690     2  0.4433     0.6209 0.000 0.740 0.000 0.200 0.060
#> GSM531693     1  0.4044     0.5718 0.732 0.012 0.000 0.004 0.252
#> GSM531695     5  0.6456     0.6034 0.236 0.232 0.000 0.004 0.528
#> GSM531603     2  0.0162     0.6930 0.000 0.996 0.000 0.004 0.000
#> GSM531609     4  0.0404     0.7982 0.000 0.012 0.000 0.988 0.000
#> GSM531611     4  0.1430     0.7833 0.000 0.052 0.000 0.944 0.004
#> GSM531621     3  0.0404     0.8228 0.012 0.000 0.988 0.000 0.000
#> GSM531622     3  0.0290     0.8221 0.000 0.008 0.992 0.000 0.000
#> GSM531628     1  0.1753     0.7262 0.936 0.000 0.000 0.032 0.032
#> GSM531630     3  0.0290     0.8221 0.000 0.008 0.992 0.000 0.000
#> GSM531633     3  0.0404     0.8228 0.012 0.000 0.988 0.000 0.000
#> GSM531635     1  0.4297     0.5615 0.692 0.000 0.288 0.000 0.020
#> GSM531640     3  0.0290     0.8221 0.000 0.008 0.992 0.000 0.000
#> GSM531649     1  0.0510     0.7246 0.984 0.000 0.000 0.000 0.016
#> GSM531653     1  0.0510     0.7246 0.984 0.000 0.000 0.000 0.016
#> GSM531657     4  0.7494     0.4714 0.004 0.244 0.116 0.520 0.116
#> GSM531665     2  0.8309     0.1570 0.000 0.376 0.228 0.156 0.240
#> GSM531670     1  0.4879     0.6595 0.728 0.000 0.204 0.036 0.032
#> GSM531674     1  0.2583     0.6777 0.864 0.000 0.000 0.004 0.132
#> GSM531675     2  0.4400     0.6238 0.000 0.744 0.000 0.196 0.060
#> GSM531677     2  0.4322     0.6342 0.000 0.768 0.000 0.088 0.144
#> GSM531678     2  0.3632     0.6012 0.000 0.800 0.020 0.004 0.176
#> GSM531680     5  0.6103     0.6709 0.192 0.216 0.000 0.004 0.588
#> GSM531689     5  0.4520     0.8049 0.020 0.200 0.032 0.000 0.748
#> GSM531691     5  0.4520     0.8049 0.020 0.200 0.032 0.000 0.748
#> GSM531692     5  0.4673     0.6044 0.028 0.096 0.100 0.000 0.776
#> GSM531694     2  0.0000     0.6925 0.000 1.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
#> GSM531602     2  0.0260     0.6964 0.000 0.992 0.000 0.000 0.000 0.008
#> GSM531604     2  0.3564     0.5474 0.000 0.724 0.000 0.000 0.264 0.012
#> GSM531606     2  0.2814     0.6223 0.000 0.820 0.000 0.000 0.172 0.008
#> GSM531607     2  0.0603     0.6949 0.000 0.980 0.000 0.004 0.000 0.016
#> GSM531608     3  0.5431     0.5907 0.000 0.064 0.632 0.000 0.056 0.248
#> GSM531610     4  0.0000     0.9113 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM531612     4  0.0000     0.9113 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM531613     4  0.0000     0.9113 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM531614     4  0.0000     0.9113 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM531616     1  0.4670     0.5202 0.640 0.000 0.308 0.000 0.020 0.032
#> GSM531618     6  0.6845     0.5535 0.076 0.052 0.084 0.236 0.000 0.552
#> GSM531619     3  0.0547     0.7840 0.000 0.000 0.980 0.000 0.000 0.020
#> GSM531620     3  0.3150     0.7077 0.088 0.000 0.844 0.000 0.008 0.060
#> GSM531623     3  0.0146     0.7849 0.000 0.000 0.996 0.000 0.004 0.000
#> GSM531625     3  0.2629     0.7298 0.080 0.000 0.880 0.000 0.020 0.020
#> GSM531626     3  0.2734     0.7240 0.088 0.000 0.872 0.000 0.020 0.020
#> GSM531632     1  0.0405     0.7159 0.988 0.000 0.000 0.000 0.008 0.004
#> GSM531638     1  0.4670     0.5202 0.640 0.000 0.308 0.000 0.020 0.032
#> GSM531639     1  0.5363     0.2622 0.496 0.000 0.404 0.000 0.004 0.096
#> GSM531641     4  0.0000     0.9113 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM531642     1  0.6172    -0.0236 0.428 0.000 0.016 0.180 0.000 0.376
#> GSM531643     1  0.2404     0.6892 0.872 0.000 0.016 0.000 0.000 0.112
#> GSM531644     1  0.6172    -0.0236 0.428 0.000 0.016 0.180 0.000 0.376
#> GSM531645     4  0.0000     0.9113 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM531646     1  0.1802     0.7141 0.932 0.000 0.020 0.000 0.024 0.024
#> GSM531647     1  0.0405     0.7159 0.988 0.000 0.000 0.000 0.008 0.004
#> GSM531648     6  0.5596     0.4963 0.072 0.016 0.020 0.296 0.000 0.596
#> GSM531650     1  0.1267     0.7077 0.940 0.000 0.000 0.000 0.000 0.060
#> GSM531651     3  0.0146     0.7849 0.000 0.000 0.996 0.000 0.004 0.000
#> GSM531652     6  0.5976     0.4326 0.224 0.000 0.016 0.224 0.000 0.536
#> GSM531656     1  0.4411     0.6204 0.712 0.000 0.204 0.000 0.004 0.080
#> GSM531659     6  0.8149     0.2828 0.000 0.292 0.120 0.092 0.124 0.372
#> GSM531661     3  0.4738     0.6519 0.000 0.056 0.712 0.000 0.040 0.192
#> GSM531662     3  0.6774     0.4151 0.004 0.068 0.464 0.000 0.156 0.308
#> GSM531663     4  0.6376     0.0178 0.000 0.236 0.008 0.524 0.028 0.204
#> GSM531664     1  0.1267     0.7077 0.940 0.000 0.000 0.000 0.000 0.060
#> GSM531666     1  0.5717     0.2274 0.536 0.000 0.016 0.124 0.000 0.324
#> GSM531667     3  0.6076     0.5009 0.000 0.080 0.568 0.012 0.052 0.288
#> GSM531668     6  0.4101     0.4583 0.000 0.028 0.000 0.308 0.000 0.664
#> GSM531669     1  0.2821     0.6596 0.832 0.000 0.000 0.000 0.152 0.016
#> GSM531671     3  0.6847     0.4133 0.008 0.068 0.464 0.000 0.152 0.308
#> GSM531672     2  0.6819    -0.3787 0.008 0.336 0.004 0.312 0.016 0.324
#> GSM531673     3  0.6774     0.4151 0.004 0.068 0.464 0.000 0.156 0.308
#> GSM531676     5  0.2581     0.8126 0.000 0.128 0.000 0.000 0.856 0.016
#> GSM531679     2  0.4869     0.5471 0.000 0.628 0.000 0.000 0.276 0.096
#> GSM531681     2  0.5779     0.5763 0.000 0.596 0.000 0.260 0.084 0.060
#> GSM531682     2  0.4869     0.5471 0.000 0.628 0.000 0.000 0.276 0.096
#> GSM531683     2  0.2226     0.6924 0.000 0.904 0.000 0.008 0.060 0.028
#> GSM531684     2  0.2882     0.6176 0.000 0.812 0.000 0.000 0.180 0.008
#> GSM531685     1  0.4651     0.1824 0.484 0.000 0.000 0.000 0.476 0.040
#> GSM531686     2  0.5779     0.5763 0.000 0.596 0.000 0.260 0.084 0.060
#> GSM531687     5  0.2581     0.8126 0.000 0.128 0.000 0.000 0.856 0.016
#> GSM531688     1  0.3841     0.5593 0.716 0.000 0.000 0.000 0.256 0.028
#> GSM531690     2  0.5612     0.6185 0.000 0.648 0.000 0.188 0.084 0.080
#> GSM531693     1  0.4151     0.5404 0.684 0.000 0.000 0.000 0.276 0.040
#> GSM531695     5  0.6275     0.6116 0.196 0.144 0.000 0.000 0.576 0.084
#> GSM531603     2  0.0603     0.6949 0.000 0.980 0.000 0.004 0.000 0.016
#> GSM531609     4  0.0000     0.9113 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM531611     4  0.1257     0.8695 0.000 0.020 0.000 0.952 0.000 0.028
#> GSM531621     3  0.0146     0.7849 0.000 0.000 0.996 0.000 0.004 0.000
#> GSM531622     3  0.0547     0.7840 0.000 0.000 0.980 0.000 0.000 0.020
#> GSM531628     1  0.1267     0.7077 0.940 0.000 0.000 0.000 0.000 0.060
#> GSM531630     3  0.0547     0.7840 0.000 0.000 0.980 0.000 0.000 0.020
#> GSM531633     3  0.0146     0.7849 0.000 0.000 0.996 0.000 0.004 0.000
#> GSM531635     1  0.4414     0.5591 0.672 0.000 0.284 0.000 0.016 0.028
#> GSM531640     3  0.0547     0.7840 0.000 0.000 0.980 0.000 0.000 0.020
#> GSM531649     1  0.0909     0.7146 0.968 0.000 0.000 0.000 0.020 0.012
#> GSM531653     1  0.0909     0.7146 0.968 0.000 0.000 0.000 0.020 0.012
#> GSM531657     6  0.7265     0.4945 0.000 0.172 0.092 0.248 0.020 0.468
#> GSM531665     6  0.8177     0.2747 0.000 0.272 0.172 0.056 0.144 0.356
#> GSM531670     1  0.4411     0.6204 0.712 0.000 0.204 0.000 0.004 0.080
#> GSM531674     1  0.2821     0.6596 0.832 0.000 0.000 0.000 0.152 0.016
#> GSM531675     2  0.5584     0.6213 0.000 0.652 0.000 0.184 0.084 0.080
#> GSM531677     2  0.5500     0.6115 0.000 0.668 0.000 0.076 0.156 0.100
#> GSM531678     2  0.3329     0.6198 0.000 0.792 0.000 0.004 0.184 0.020
#> GSM531680     5  0.5316     0.6877 0.136 0.144 0.000 0.000 0.676 0.044
#> GSM531689     5  0.2581     0.8126 0.000 0.128 0.000 0.000 0.856 0.016
#> GSM531691     5  0.2664     0.8076 0.000 0.136 0.000 0.000 0.848 0.016
#> GSM531692     5  0.3198     0.6038 0.004 0.008 0.012 0.000 0.816 0.160
#> GSM531694     2  0.0260     0.6964 0.000 0.992 0.000 0.000 0.000 0.008

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

consensus_heatmap(res, k = 2)

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 disease.state(p) k
#> SD:hclust 70            0.733 2
#> SD:hclust 63            0.936 3
#> SD:hclust 63            0.911 4
#> SD:hclust 70            0.490 5
#> SD:hclust 64            0.772 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 51941 rows and 80 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.809           0.925       0.962         0.5006 0.499   0.499
#> 3 3 0.599           0.684       0.752         0.3038 0.761   0.557
#> 4 4 0.860           0.884       0.929         0.1542 0.828   0.544
#> 5 5 0.733           0.667       0.808         0.0607 0.944   0.778
#> 6 6 0.727           0.608       0.786         0.0413 0.932   0.694

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
#> GSM531602     2  0.0376      0.951 0.004 0.996
#> GSM531604     2  0.6623      0.813 0.172 0.828
#> GSM531606     2  0.0376      0.951 0.004 0.996
#> GSM531607     2  0.0376      0.951 0.004 0.996
#> GSM531608     1  0.8443      0.658 0.728 0.272
#> GSM531610     2  0.0000      0.951 0.000 1.000
#> GSM531612     2  0.0000      0.951 0.000 1.000
#> GSM531613     2  0.0000      0.951 0.000 1.000
#> GSM531614     2  0.0000      0.951 0.000 1.000
#> GSM531616     1  0.0000      0.966 1.000 0.000
#> GSM531618     1  0.8016      0.703 0.756 0.244
#> GSM531619     1  0.6712      0.795 0.824 0.176
#> GSM531620     1  0.0000      0.966 1.000 0.000
#> GSM531623     1  0.0000      0.966 1.000 0.000
#> GSM531625     1  0.0000      0.966 1.000 0.000
#> GSM531626     1  0.0000      0.966 1.000 0.000
#> GSM531632     1  0.0376      0.966 0.996 0.004
#> GSM531638     1  0.0000      0.966 1.000 0.000
#> GSM531639     1  0.0000      0.966 1.000 0.000
#> GSM531641     2  0.0376      0.951 0.004 0.996
#> GSM531642     1  0.0376      0.966 0.996 0.004
#> GSM531643     1  0.0376      0.966 0.996 0.004
#> GSM531644     1  0.0376      0.966 0.996 0.004
#> GSM531645     2  0.0000      0.951 0.000 1.000
#> GSM531646     1  0.0376      0.966 0.996 0.004
#> GSM531647     1  0.0376      0.966 0.996 0.004
#> GSM531648     2  0.2423      0.921 0.040 0.960
#> GSM531650     1  0.0376      0.966 0.996 0.004
#> GSM531651     1  0.0000      0.966 1.000 0.000
#> GSM531652     1  0.0376      0.966 0.996 0.004
#> GSM531656     1  0.0000      0.966 1.000 0.000
#> GSM531659     2  0.0000      0.951 0.000 1.000
#> GSM531661     1  0.1414      0.954 0.980 0.020
#> GSM531662     1  0.0376      0.965 0.996 0.004
#> GSM531663     2  0.0376      0.951 0.004 0.996
#> GSM531664     1  0.0376      0.966 0.996 0.004
#> GSM531666     1  0.0376      0.966 0.996 0.004
#> GSM531667     1  0.7219      0.764 0.800 0.200
#> GSM531668     2  0.0376      0.951 0.004 0.996
#> GSM531669     1  0.0376      0.966 0.996 0.004
#> GSM531671     1  0.0376      0.966 0.996 0.004
#> GSM531672     2  0.0376      0.951 0.004 0.996
#> GSM531673     1  0.0376      0.965 0.996 0.004
#> GSM531676     2  0.9209      0.557 0.336 0.664
#> GSM531679     2  0.0000      0.951 0.000 1.000
#> GSM531681     2  0.0000      0.951 0.000 1.000
#> GSM531682     2  0.0000      0.951 0.000 1.000
#> GSM531683     2  0.0376      0.951 0.004 0.996
#> GSM531684     2  0.0376      0.951 0.004 0.996
#> GSM531685     1  0.2603      0.936 0.956 0.044
#> GSM531686     2  0.0000      0.951 0.000 1.000
#> GSM531687     2  0.7883      0.731 0.236 0.764
#> GSM531688     1  0.2603      0.936 0.956 0.044
#> GSM531690     2  0.0000      0.951 0.000 1.000
#> GSM531693     1  0.0376      0.966 0.996 0.004
#> GSM531695     2  0.7453      0.764 0.212 0.788
#> GSM531603     2  0.0376      0.951 0.004 0.996
#> GSM531609     2  0.0000      0.951 0.000 1.000
#> GSM531611     2  0.0000      0.951 0.000 1.000
#> GSM531621     1  0.0000      0.966 1.000 0.000
#> GSM531622     1  0.2236      0.941 0.964 0.036
#> GSM531628     1  0.0376      0.966 0.996 0.004
#> GSM531630     1  0.0000      0.966 1.000 0.000
#> GSM531633     1  0.0000      0.966 1.000 0.000
#> GSM531635     1  0.0376      0.966 0.996 0.004
#> GSM531640     1  0.7219      0.764 0.800 0.200
#> GSM531649     1  0.0376      0.966 0.996 0.004
#> GSM531653     1  0.0376      0.966 0.996 0.004
#> GSM531657     2  0.0376      0.951 0.004 0.996
#> GSM531665     1  0.0672      0.965 0.992 0.008
#> GSM531670     1  0.0000      0.966 1.000 0.000
#> GSM531674     1  0.0376      0.966 0.996 0.004
#> GSM531675     2  0.0000      0.951 0.000 1.000
#> GSM531677     2  0.0000      0.951 0.000 1.000
#> GSM531678     2  0.0376      0.951 0.004 0.996
#> GSM531680     2  0.7219      0.778 0.200 0.800
#> GSM531689     2  0.6531      0.813 0.168 0.832
#> GSM531691     2  0.7299      0.778 0.204 0.796
#> GSM531692     1  0.2603      0.934 0.956 0.044
#> GSM531694     2  0.0376      0.951 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
#> GSM531602     2  0.2066     0.7158 0.000 0.940 0.060
#> GSM531604     2  0.4974     0.5366 0.000 0.764 0.236
#> GSM531606     2  0.2261     0.7121 0.000 0.932 0.068
#> GSM531607     2  0.2066     0.7158 0.000 0.940 0.060
#> GSM531608     3  0.6473     0.8859 0.332 0.016 0.652
#> GSM531610     2  0.6154     0.7442 0.000 0.592 0.408
#> GSM531612     2  0.6950     0.7368 0.020 0.572 0.408
#> GSM531613     2  0.6062     0.7506 0.000 0.616 0.384
#> GSM531614     2  0.6950     0.7368 0.020 0.572 0.408
#> GSM531616     3  0.6274     0.7931 0.456 0.000 0.544
#> GSM531618     2  0.9171     0.3156 0.312 0.516 0.172
#> GSM531619     3  0.6470     0.9031 0.356 0.012 0.632
#> GSM531620     3  0.6008     0.8979 0.372 0.000 0.628
#> GSM531623     3  0.6470     0.9031 0.356 0.012 0.632
#> GSM531625     3  0.6267     0.7996 0.452 0.000 0.548
#> GSM531626     3  0.6260     0.8044 0.448 0.000 0.552
#> GSM531632     1  0.0000     0.7391 1.000 0.000 0.000
#> GSM531638     3  0.6267     0.7996 0.452 0.000 0.548
#> GSM531639     1  0.5905    -0.2668 0.648 0.000 0.352
#> GSM531641     2  0.6950     0.7368 0.020 0.572 0.408
#> GSM531642     1  0.4605     0.5300 0.796 0.000 0.204
#> GSM531643     1  0.0892     0.7396 0.980 0.000 0.020
#> GSM531644     1  0.1643     0.7279 0.956 0.000 0.044
#> GSM531645     2  0.6950     0.7368 0.020 0.572 0.408
#> GSM531646     1  0.0000     0.7391 1.000 0.000 0.000
#> GSM531647     1  0.0000     0.7391 1.000 0.000 0.000
#> GSM531648     2  0.6910     0.7393 0.020 0.584 0.396
#> GSM531650     1  0.0892     0.7396 0.980 0.000 0.020
#> GSM531651     3  0.5988     0.8997 0.368 0.000 0.632
#> GSM531652     1  0.2356     0.7107 0.928 0.000 0.072
#> GSM531656     1  0.3267     0.5869 0.884 0.000 0.116
#> GSM531659     2  0.6095     0.7473 0.000 0.608 0.392
#> GSM531661     3  0.6543     0.8968 0.344 0.016 0.640
#> GSM531662     3  0.6543     0.8968 0.344 0.016 0.640
#> GSM531663     2  0.6154     0.7442 0.000 0.592 0.408
#> GSM531664     1  0.0892     0.7396 0.980 0.000 0.020
#> GSM531666     1  0.1860     0.7228 0.948 0.000 0.052
#> GSM531667     3  0.6470     0.9031 0.356 0.012 0.632
#> GSM531668     2  0.6235     0.7401 0.000 0.564 0.436
#> GSM531669     1  0.0000     0.7391 1.000 0.000 0.000
#> GSM531671     1  0.6154    -0.4619 0.592 0.000 0.408
#> GSM531672     2  0.6008     0.7527 0.000 0.628 0.372
#> GSM531673     3  0.7306     0.8674 0.340 0.044 0.616
#> GSM531676     1  0.6688     0.4358 0.580 0.408 0.012
#> GSM531679     2  0.2261     0.7121 0.000 0.932 0.068
#> GSM531681     2  0.5497     0.7580 0.000 0.708 0.292
#> GSM531682     2  0.2261     0.7121 0.000 0.932 0.068
#> GSM531683     2  0.1964     0.7166 0.000 0.944 0.056
#> GSM531684     2  0.6267     0.0576 0.000 0.548 0.452
#> GSM531685     1  0.6467     0.4674 0.604 0.388 0.008
#> GSM531686     2  0.5465     0.7580 0.000 0.712 0.288
#> GSM531687     1  0.6688     0.4358 0.580 0.408 0.012
#> GSM531688     1  0.6155     0.5170 0.664 0.328 0.008
#> GSM531690     2  0.5363     0.7586 0.000 0.724 0.276
#> GSM531693     1  0.0424     0.7376 0.992 0.000 0.008
#> GSM531695     1  0.6359     0.4890 0.628 0.364 0.008
#> GSM531603     2  0.2066     0.7158 0.000 0.940 0.060
#> GSM531609     2  0.6950     0.7368 0.020 0.572 0.408
#> GSM531611     2  0.6896     0.7435 0.020 0.588 0.392
#> GSM531621     3  0.6008     0.8979 0.372 0.000 0.628
#> GSM531622     3  0.6470     0.9031 0.356 0.012 0.632
#> GSM531628     1  0.0892     0.7396 0.980 0.000 0.020
#> GSM531630     3  0.6470     0.9031 0.356 0.012 0.632
#> GSM531633     3  0.6008     0.8979 0.372 0.000 0.628
#> GSM531635     1  0.0000     0.7391 1.000 0.000 0.000
#> GSM531640     3  0.6404     0.8940 0.344 0.012 0.644
#> GSM531649     1  0.0000     0.7391 1.000 0.000 0.000
#> GSM531653     1  0.0000     0.7391 1.000 0.000 0.000
#> GSM531657     2  0.6111     0.7461 0.000 0.604 0.396
#> GSM531665     1  0.4802     0.5261 0.824 0.020 0.156
#> GSM531670     1  0.3267     0.5869 0.884 0.000 0.116
#> GSM531674     1  0.0000     0.7391 1.000 0.000 0.000
#> GSM531675     2  0.0592     0.7243 0.000 0.988 0.012
#> GSM531677     2  0.0000     0.7214 0.000 1.000 0.000
#> GSM531678     2  0.2261     0.7121 0.000 0.932 0.068
#> GSM531680     1  0.6527     0.4453 0.588 0.404 0.008
#> GSM531689     2  0.4473     0.6218 0.008 0.828 0.164
#> GSM531691     2  0.4555     0.5862 0.000 0.800 0.200
#> GSM531692     3  0.6973     0.2239 0.020 0.416 0.564
#> GSM531694     2  0.2066     0.7158 0.000 0.940 0.060

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM531602     2  0.1489      0.925 0.000 0.952 0.004 0.044
#> GSM531604     2  0.1305      0.919 0.004 0.960 0.036 0.000
#> GSM531606     2  0.1674      0.928 0.004 0.952 0.012 0.032
#> GSM531607     2  0.1489      0.925 0.000 0.952 0.004 0.044
#> GSM531608     3  0.0000      0.942 0.000 0.000 1.000 0.000
#> GSM531610     4  0.0336      0.930 0.000 0.008 0.000 0.992
#> GSM531612     4  0.0000      0.926 0.000 0.000 0.000 1.000
#> GSM531613     4  0.0336      0.930 0.000 0.008 0.000 0.992
#> GSM531614     4  0.0336      0.930 0.000 0.008 0.000 0.992
#> GSM531616     3  0.1297      0.938 0.020 0.016 0.964 0.000
#> GSM531618     4  0.5992      0.478 0.032 0.020 0.300 0.648
#> GSM531619     3  0.0000      0.942 0.000 0.000 1.000 0.000
#> GSM531620     3  0.0592      0.947 0.016 0.000 0.984 0.000
#> GSM531623     3  0.0469      0.947 0.012 0.000 0.988 0.000
#> GSM531625     3  0.0779      0.946 0.016 0.004 0.980 0.000
#> GSM531626     3  0.0779      0.946 0.016 0.004 0.980 0.000
#> GSM531632     1  0.1059      0.932 0.972 0.012 0.016 0.000
#> GSM531638     3  0.1297      0.938 0.020 0.016 0.964 0.000
#> GSM531639     3  0.5646      0.282 0.384 0.016 0.592 0.008
#> GSM531641     4  0.0336      0.930 0.000 0.008 0.000 0.992
#> GSM531642     1  0.5295      0.610 0.688 0.016 0.284 0.012
#> GSM531643     1  0.1404      0.928 0.964 0.012 0.012 0.012
#> GSM531644     1  0.1404      0.928 0.964 0.012 0.012 0.012
#> GSM531645     4  0.0000      0.926 0.000 0.000 0.000 1.000
#> GSM531646     1  0.0927      0.932 0.976 0.008 0.016 0.000
#> GSM531647     1  0.1059      0.932 0.972 0.012 0.016 0.000
#> GSM531648     4  0.1059      0.918 0.012 0.016 0.000 0.972
#> GSM531650     1  0.0937      0.931 0.976 0.000 0.012 0.012
#> GSM531651     3  0.0469      0.947 0.012 0.000 0.988 0.000
#> GSM531652     1  0.2074      0.918 0.940 0.012 0.032 0.016
#> GSM531656     1  0.4862      0.715 0.744 0.020 0.228 0.008
#> GSM531659     4  0.1489      0.919 0.004 0.044 0.000 0.952
#> GSM531661     3  0.0000      0.942 0.000 0.000 1.000 0.000
#> GSM531662     3  0.0000      0.942 0.000 0.000 1.000 0.000
#> GSM531663     4  0.0336      0.930 0.000 0.008 0.000 0.992
#> GSM531664     1  0.1271      0.931 0.968 0.008 0.012 0.012
#> GSM531666     1  0.2196      0.920 0.936 0.016 0.032 0.016
#> GSM531667     3  0.0657      0.947 0.012 0.004 0.984 0.000
#> GSM531668     4  0.3072      0.858 0.004 0.124 0.004 0.868
#> GSM531669     1  0.1182      0.931 0.968 0.016 0.016 0.000
#> GSM531671     3  0.5110      0.471 0.328 0.016 0.656 0.000
#> GSM531672     4  0.1305      0.922 0.004 0.036 0.000 0.960
#> GSM531673     3  0.1661      0.900 0.004 0.052 0.944 0.000
#> GSM531676     2  0.2976      0.858 0.120 0.872 0.008 0.000
#> GSM531679     2  0.1356      0.928 0.008 0.960 0.000 0.032
#> GSM531681     4  0.3448      0.805 0.004 0.168 0.000 0.828
#> GSM531682     2  0.1488      0.928 0.012 0.956 0.000 0.032
#> GSM531683     2  0.1675      0.924 0.004 0.948 0.004 0.044
#> GSM531684     2  0.1743      0.911 0.004 0.940 0.056 0.000
#> GSM531685     2  0.4511      0.681 0.268 0.724 0.008 0.000
#> GSM531686     4  0.3448      0.805 0.004 0.168 0.000 0.828
#> GSM531687     2  0.3272      0.844 0.128 0.860 0.004 0.008
#> GSM531688     1  0.1004      0.919 0.972 0.024 0.004 0.000
#> GSM531690     4  0.3791      0.777 0.004 0.200 0.000 0.796
#> GSM531693     1  0.1042      0.922 0.972 0.020 0.008 0.000
#> GSM531695     1  0.2342      0.880 0.912 0.080 0.000 0.008
#> GSM531603     2  0.1489      0.925 0.000 0.952 0.004 0.044
#> GSM531609     4  0.0336      0.930 0.000 0.008 0.000 0.992
#> GSM531611     4  0.0336      0.930 0.000 0.008 0.000 0.992
#> GSM531621     3  0.0592      0.947 0.016 0.000 0.984 0.000
#> GSM531622     3  0.0592      0.947 0.016 0.000 0.984 0.000
#> GSM531628     1  0.1271      0.931 0.968 0.008 0.012 0.012
#> GSM531630     3  0.0592      0.947 0.016 0.000 0.984 0.000
#> GSM531633     3  0.0592      0.947 0.016 0.000 0.984 0.000
#> GSM531635     1  0.1406      0.931 0.960 0.024 0.016 0.000
#> GSM531640     3  0.0779      0.946 0.016 0.004 0.980 0.000
#> GSM531649     1  0.1059      0.932 0.972 0.012 0.016 0.000
#> GSM531653     1  0.1059      0.932 0.972 0.012 0.016 0.000
#> GSM531657     4  0.1305      0.922 0.004 0.036 0.000 0.960
#> GSM531665     1  0.5676      0.748 0.720 0.136 0.144 0.000
#> GSM531670     1  0.4862      0.715 0.744 0.020 0.228 0.008
#> GSM531674     1  0.1182      0.931 0.968 0.016 0.016 0.000
#> GSM531675     2  0.2473      0.899 0.012 0.908 0.000 0.080
#> GSM531677     2  0.1677      0.926 0.012 0.948 0.000 0.040
#> GSM531678     2  0.1674      0.928 0.012 0.952 0.004 0.032
#> GSM531680     2  0.4422      0.685 0.256 0.736 0.000 0.008
#> GSM531689     2  0.1124      0.925 0.012 0.972 0.004 0.012
#> GSM531691     2  0.1617      0.921 0.012 0.956 0.024 0.008
#> GSM531692     2  0.1929      0.911 0.024 0.940 0.036 0.000
#> GSM531694     2  0.1489      0.925 0.000 0.952 0.004 0.044

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>           class entropy silhouette    p1    p2    p3    p4    p5
#> GSM531602     2  0.0162     0.6115 0.000 0.996 0.000 0.004 0.000
#> GSM531604     2  0.4088     0.0150 0.000 0.632 0.000 0.000 0.368
#> GSM531606     2  0.1638     0.5749 0.000 0.932 0.000 0.004 0.064
#> GSM531607     2  0.0162     0.6115 0.000 0.996 0.000 0.004 0.000
#> GSM531608     3  0.1270     0.8898 0.000 0.000 0.948 0.000 0.052
#> GSM531610     4  0.0162     0.8204 0.000 0.000 0.000 0.996 0.004
#> GSM531612     4  0.0000     0.8215 0.000 0.000 0.000 1.000 0.000
#> GSM531613     4  0.0162     0.8204 0.000 0.000 0.000 0.996 0.004
#> GSM531614     4  0.0000     0.8215 0.000 0.000 0.000 1.000 0.000
#> GSM531616     3  0.1952     0.8703 0.004 0.000 0.912 0.000 0.084
#> GSM531618     4  0.8029     0.3181 0.008 0.064 0.248 0.364 0.316
#> GSM531619     3  0.0404     0.8999 0.000 0.000 0.988 0.000 0.012
#> GSM531620     3  0.0703     0.8978 0.000 0.000 0.976 0.000 0.024
#> GSM531623     3  0.0404     0.8999 0.000 0.000 0.988 0.000 0.012
#> GSM531625     3  0.0880     0.8950 0.000 0.000 0.968 0.000 0.032
#> GSM531626     3  0.1341     0.8871 0.000 0.000 0.944 0.000 0.056
#> GSM531632     1  0.0609     0.8280 0.980 0.000 0.000 0.000 0.020
#> GSM531638     3  0.1768     0.8757 0.004 0.000 0.924 0.000 0.072
#> GSM531639     3  0.6357     0.2257 0.288 0.000 0.512 0.000 0.200
#> GSM531641     4  0.0000     0.8215 0.000 0.000 0.000 1.000 0.000
#> GSM531642     1  0.6598     0.4812 0.484 0.000 0.208 0.004 0.304
#> GSM531643     1  0.2074     0.8122 0.896 0.000 0.000 0.000 0.104
#> GSM531644     1  0.3741     0.7272 0.732 0.000 0.000 0.004 0.264
#> GSM531645     4  0.0000     0.8215 0.000 0.000 0.000 1.000 0.000
#> GSM531646     1  0.0510     0.8293 0.984 0.000 0.000 0.000 0.016
#> GSM531647     1  0.0162     0.8315 0.996 0.000 0.000 0.000 0.004
#> GSM531648     4  0.5105     0.6579 0.000 0.076 0.000 0.660 0.264
#> GSM531650     1  0.0703     0.8317 0.976 0.000 0.000 0.000 0.024
#> GSM531651     3  0.0404     0.8999 0.000 0.000 0.988 0.000 0.012
#> GSM531652     1  0.3910     0.7192 0.720 0.000 0.000 0.008 0.272
#> GSM531656     1  0.5354     0.6548 0.668 0.000 0.192 0.000 0.140
#> GSM531659     4  0.5851     0.5925 0.000 0.132 0.000 0.580 0.288
#> GSM531661     3  0.1121     0.8927 0.000 0.000 0.956 0.000 0.044
#> GSM531662     3  0.2690     0.8135 0.000 0.000 0.844 0.000 0.156
#> GSM531663     4  0.0162     0.8204 0.000 0.000 0.000 0.996 0.004
#> GSM531664     1  0.0794     0.8318 0.972 0.000 0.000 0.000 0.028
#> GSM531666     1  0.3814     0.7205 0.720 0.000 0.000 0.004 0.276
#> GSM531667     3  0.1270     0.8887 0.000 0.000 0.948 0.000 0.052
#> GSM531668     2  0.6417     0.0446 0.000 0.508 0.000 0.228 0.264
#> GSM531669     1  0.0162     0.8315 0.996 0.000 0.000 0.000 0.004
#> GSM531671     3  0.6443     0.3982 0.248 0.000 0.504 0.000 0.248
#> GSM531672     4  0.5233     0.6679 0.000 0.128 0.000 0.680 0.192
#> GSM531673     3  0.4547     0.4726 0.000 0.012 0.588 0.000 0.400
#> GSM531676     5  0.5016     0.7225 0.044 0.348 0.000 0.000 0.608
#> GSM531679     2  0.3707     0.2936 0.000 0.716 0.000 0.000 0.284
#> GSM531681     4  0.4575     0.5643 0.000 0.236 0.000 0.712 0.052
#> GSM531682     2  0.3966     0.2528 0.000 0.664 0.000 0.000 0.336
#> GSM531683     2  0.0865     0.6026 0.000 0.972 0.000 0.004 0.024
#> GSM531684     2  0.4173     0.2047 0.000 0.688 0.012 0.000 0.300
#> GSM531685     5  0.5562     0.6341 0.156 0.200 0.000 0.000 0.644
#> GSM531686     4  0.4575     0.5643 0.000 0.236 0.000 0.712 0.052
#> GSM531687     5  0.5048     0.7016 0.040 0.380 0.000 0.000 0.580
#> GSM531688     1  0.3366     0.6301 0.768 0.000 0.000 0.000 0.232
#> GSM531690     2  0.5843     0.0457 0.000 0.512 0.000 0.388 0.100
#> GSM531693     1  0.3305     0.6514 0.776 0.000 0.000 0.000 0.224
#> GSM531695     1  0.5896     0.2530 0.564 0.128 0.000 0.000 0.308
#> GSM531603     2  0.0162     0.6115 0.000 0.996 0.000 0.004 0.000
#> GSM531609     4  0.0000     0.8215 0.000 0.000 0.000 1.000 0.000
#> GSM531611     4  0.0000     0.8215 0.000 0.000 0.000 1.000 0.000
#> GSM531621     3  0.0000     0.9011 0.000 0.000 1.000 0.000 0.000
#> GSM531622     3  0.0000     0.9011 0.000 0.000 1.000 0.000 0.000
#> GSM531628     1  0.0794     0.8318 0.972 0.000 0.000 0.000 0.028
#> GSM531630     3  0.0000     0.9011 0.000 0.000 1.000 0.000 0.000
#> GSM531633     3  0.0000     0.9011 0.000 0.000 1.000 0.000 0.000
#> GSM531635     1  0.2248     0.8147 0.900 0.000 0.012 0.000 0.088
#> GSM531640     3  0.0000     0.9011 0.000 0.000 1.000 0.000 0.000
#> GSM531649     1  0.1282     0.8227 0.952 0.000 0.004 0.000 0.044
#> GSM531653     1  0.0162     0.8315 0.996 0.000 0.000 0.000 0.004
#> GSM531657     4  0.5607     0.6335 0.000 0.140 0.000 0.632 0.228
#> GSM531665     5  0.2623     0.4278 0.096 0.016 0.004 0.000 0.884
#> GSM531670     1  0.5354     0.6548 0.668 0.000 0.192 0.000 0.140
#> GSM531674     1  0.0162     0.8315 0.996 0.000 0.000 0.000 0.004
#> GSM531675     2  0.4818     0.4611 0.000 0.720 0.000 0.100 0.180
#> GSM531677     2  0.3534     0.4310 0.000 0.744 0.000 0.000 0.256
#> GSM531678     2  0.4182    -0.1463 0.000 0.600 0.000 0.000 0.400
#> GSM531680     5  0.5850     0.6596 0.120 0.316 0.000 0.000 0.564
#> GSM531689     5  0.4268     0.6152 0.000 0.444 0.000 0.000 0.556
#> GSM531691     5  0.4192     0.6615 0.000 0.404 0.000 0.000 0.596
#> GSM531692     5  0.4045     0.6848 0.000 0.356 0.000 0.000 0.644
#> GSM531694     2  0.0162     0.6115 0.000 0.996 0.000 0.004 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
#> GSM531602     2  0.1444     0.6280 0.000 0.928 0.000 0.000 0.072 0.000
#> GSM531604     5  0.5112     0.2578 0.000 0.376 0.000 0.000 0.536 0.088
#> GSM531606     2  0.2358     0.5926 0.000 0.876 0.000 0.000 0.108 0.016
#> GSM531607     2  0.1588     0.6283 0.000 0.924 0.000 0.000 0.072 0.004
#> GSM531608     3  0.3295     0.7773 0.000 0.000 0.816 0.000 0.056 0.128
#> GSM531610     4  0.0000     0.8979 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM531612     4  0.0146     0.8989 0.000 0.000 0.000 0.996 0.000 0.004
#> GSM531613     4  0.0146     0.8972 0.000 0.000 0.000 0.996 0.000 0.004
#> GSM531614     4  0.0146     0.8989 0.000 0.000 0.000 0.996 0.000 0.004
#> GSM531616     3  0.3434     0.7786 0.004 0.000 0.808 0.000 0.048 0.140
#> GSM531618     6  0.4881     0.6103 0.024 0.024 0.088 0.124 0.000 0.740
#> GSM531619     3  0.1408     0.8380 0.000 0.000 0.944 0.000 0.020 0.036
#> GSM531620     3  0.2527     0.8108 0.000 0.000 0.868 0.000 0.024 0.108
#> GSM531623     3  0.0935     0.8398 0.000 0.000 0.964 0.000 0.004 0.032
#> GSM531625     3  0.2255     0.8210 0.000 0.000 0.892 0.000 0.028 0.080
#> GSM531626     3  0.3249     0.7883 0.004 0.000 0.824 0.000 0.044 0.128
#> GSM531632     1  0.1408     0.7536 0.944 0.000 0.000 0.000 0.020 0.036
#> GSM531638     3  0.3356     0.7810 0.000 0.000 0.808 0.000 0.052 0.140
#> GSM531639     3  0.6122     0.0871 0.124 0.000 0.432 0.000 0.032 0.412
#> GSM531641     4  0.0146     0.8989 0.000 0.000 0.000 0.996 0.000 0.004
#> GSM531642     6  0.4543     0.5282 0.252 0.000 0.052 0.000 0.012 0.684
#> GSM531643     1  0.3694     0.5223 0.740 0.000 0.000 0.000 0.028 0.232
#> GSM531644     6  0.4246     0.3914 0.400 0.000 0.000 0.000 0.020 0.580
#> GSM531645     4  0.0146     0.8989 0.000 0.000 0.000 0.996 0.000 0.004
#> GSM531646     1  0.1845     0.7445 0.920 0.000 0.000 0.000 0.028 0.052
#> GSM531647     1  0.0000     0.7647 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM531648     6  0.4668     0.5589 0.008 0.044 0.000 0.292 0.004 0.652
#> GSM531650     1  0.0820     0.7602 0.972 0.000 0.000 0.000 0.012 0.016
#> GSM531651     3  0.1049     0.8388 0.000 0.000 0.960 0.000 0.008 0.032
#> GSM531652     6  0.4105     0.5112 0.332 0.000 0.004 0.000 0.016 0.648
#> GSM531656     1  0.6519     0.1590 0.476 0.000 0.180 0.000 0.048 0.296
#> GSM531659     6  0.5205     0.5658 0.000 0.096 0.000 0.188 0.040 0.676
#> GSM531661     3  0.3295     0.7753 0.000 0.000 0.816 0.000 0.056 0.128
#> GSM531662     3  0.4563     0.6645 0.000 0.000 0.700 0.000 0.136 0.164
#> GSM531663     4  0.0146     0.8972 0.000 0.000 0.000 0.996 0.000 0.004
#> GSM531664     1  0.0820     0.7602 0.972 0.000 0.000 0.000 0.012 0.016
#> GSM531666     6  0.4199     0.5022 0.336 0.000 0.004 0.000 0.020 0.640
#> GSM531667     3  0.2651     0.8095 0.000 0.000 0.860 0.000 0.028 0.112
#> GSM531668     2  0.5305    -0.0678 0.000 0.516 0.000 0.072 0.012 0.400
#> GSM531669     1  0.0405     0.7643 0.988 0.000 0.000 0.000 0.008 0.004
#> GSM531671     3  0.7515     0.2132 0.152 0.000 0.344 0.000 0.232 0.272
#> GSM531672     6  0.5541     0.4262 0.000 0.136 0.000 0.324 0.004 0.536
#> GSM531673     5  0.6315    -0.0765 0.000 0.016 0.368 0.000 0.400 0.216
#> GSM531676     5  0.2669     0.6873 0.024 0.108 0.000 0.000 0.864 0.004
#> GSM531679     2  0.4712     0.2459 0.000 0.564 0.000 0.000 0.384 0.052
#> GSM531681     4  0.5257     0.4448 0.000 0.296 0.000 0.612 0.036 0.056
#> GSM531682     2  0.5403     0.2748 0.000 0.516 0.000 0.000 0.360 0.124
#> GSM531683     2  0.0790     0.6160 0.000 0.968 0.000 0.000 0.000 0.032
#> GSM531684     2  0.6104     0.0195 0.000 0.496 0.040 0.000 0.348 0.116
#> GSM531685     5  0.3236     0.6654 0.060 0.048 0.000 0.000 0.852 0.040
#> GSM531686     4  0.5545     0.4083 0.000 0.296 0.000 0.592 0.056 0.056
#> GSM531687     5  0.3048     0.6749 0.028 0.116 0.000 0.000 0.844 0.012
#> GSM531688     1  0.3489     0.5569 0.708 0.000 0.000 0.000 0.288 0.004
#> GSM531690     2  0.6462     0.3447 0.000 0.524 0.000 0.184 0.060 0.232
#> GSM531693     1  0.3575     0.5651 0.708 0.000 0.000 0.000 0.284 0.008
#> GSM531695     1  0.5520     0.0873 0.464 0.068 0.000 0.000 0.444 0.024
#> GSM531603     2  0.1588     0.6283 0.000 0.924 0.000 0.000 0.072 0.004
#> GSM531609     4  0.0146     0.8989 0.000 0.000 0.000 0.996 0.000 0.004
#> GSM531611     4  0.0260     0.8981 0.000 0.000 0.000 0.992 0.000 0.008
#> GSM531621     3  0.0146     0.8426 0.000 0.000 0.996 0.000 0.000 0.004
#> GSM531622     3  0.0508     0.8416 0.000 0.000 0.984 0.000 0.012 0.004
#> GSM531628     1  0.0820     0.7602 0.972 0.000 0.000 0.000 0.012 0.016
#> GSM531630     3  0.0508     0.8416 0.000 0.000 0.984 0.000 0.012 0.004
#> GSM531633     3  0.0291     0.8427 0.000 0.000 0.992 0.000 0.004 0.004
#> GSM531635     1  0.4801     0.6062 0.724 0.000 0.068 0.000 0.052 0.156
#> GSM531640     3  0.1088     0.8392 0.000 0.000 0.960 0.000 0.016 0.024
#> GSM531649     1  0.2579     0.7194 0.872 0.000 0.000 0.000 0.040 0.088
#> GSM531653     1  0.0000     0.7647 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM531657     6  0.5783     0.4936 0.000 0.136 0.000 0.272 0.024 0.568
#> GSM531665     5  0.4224     0.5075 0.036 0.004 0.000 0.000 0.684 0.276
#> GSM531670     1  0.6519     0.1590 0.476 0.000 0.180 0.000 0.048 0.296
#> GSM531674     1  0.0260     0.7647 0.992 0.000 0.000 0.000 0.008 0.000
#> GSM531675     2  0.6027     0.4471 0.000 0.568 0.000 0.036 0.176 0.220
#> GSM531677     2  0.5432     0.4196 0.000 0.588 0.000 0.004 0.248 0.160
#> GSM531678     5  0.4488     0.1318 0.000 0.420 0.000 0.000 0.548 0.032
#> GSM531680     5  0.3529     0.6471 0.048 0.120 0.000 0.000 0.816 0.016
#> GSM531689     5  0.2482     0.6641 0.000 0.148 0.000 0.000 0.848 0.004
#> GSM531691     5  0.2942     0.6777 0.000 0.132 0.000 0.000 0.836 0.032
#> GSM531692     5  0.3513     0.6580 0.004 0.084 0.000 0.000 0.812 0.100
#> GSM531694     2  0.1444     0.6280 0.000 0.928 0.000 0.000 0.072 0.000

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

consensus_heatmap(res, k = 2)

plot of chunk tab-SD-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 disease.state(p) k
#> SD:kmeans 80            1.000 2
#> SD:kmeans 70            0.925 3
#> SD:kmeans 77            0.343 4
#> SD:kmeans 64            0.540 5
#> SD:kmeans 60            0.234 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 51941 rows and 80 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 4.
#> 
#> Following methods can be applied to this 'ConsensusPartition' object:
#>  [1] "cola_report"             "collect_classes"         "collect_plots"          
#>  [4] "collect_stats"           "colnames"                "compare_signatures"     
#>  [7] "consensus_heatmap"       "dimension_reduction"     "functional_enrichment"  
#> [10] "get_anno_col"            "get_anno"                "get_classes"            
#> [13] "get_consensus"           "get_matrix"              "get_membership"         
#> [16] "get_param"               "get_signatures"          "get_stats"              
#> [19] "is_best_k"               "is_stable_k"             "membership_heatmap"     
#> [22] "ncol"                    "nrow"                    "plot_ecdf"              
#> [25] "rownames"                "select_partition_number" "show"                   
#> [28] "suggest_best_k"          "test_to_known_factors"

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

collect_plots(res)

plot of chunk SD-skmeans-collect-plots

The plots are:

All the plots in panels can be made by individual functions and they are plotted later in this section.

select_partition_number() produces several plots showing different statistics for choosing “optimized” k. There are following statistics:

The detailed explanations of these statistics can be found in the cola vignette.

Generally speaking, lower PAC score, higher mean silhouette score or higher concordance corresponds to better partition. Rand index and Jaccard index measure how similar the current partition is compared to partition with k-1. If they are too similar, we won't accept k is better than k-1.

select_partition_number(res)

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

The numeric values for all these statistics can be obtained by get_stats().

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.685           0.902       0.955         0.5051 0.495   0.495
#> 3 3 0.879           0.374       0.744         0.3273 0.580   0.328
#> 4 4 0.891           0.903       0.958         0.1299 0.740   0.378
#> 5 5 0.828           0.807       0.896         0.0564 0.933   0.735
#> 6 6 0.777           0.708       0.850         0.0377 0.947   0.751

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

suggest_best_k(res)
#> [1] 4

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

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

show/hide code output

cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#>           class entropy silhouette    p1    p2
#> GSM531602     2  0.0000      0.944 0.000 1.000
#> GSM531604     2  0.0376      0.941 0.004 0.996
#> GSM531606     2  0.0000      0.944 0.000 1.000
#> GSM531607     2  0.0000      0.944 0.000 1.000
#> GSM531608     2  0.9044      0.529 0.320 0.680
#> GSM531610     2  0.0000      0.944 0.000 1.000
#> GSM531612     2  0.0000      0.944 0.000 1.000
#> GSM531613     2  0.0000      0.944 0.000 1.000
#> GSM531614     2  0.0000      0.944 0.000 1.000
#> GSM531616     1  0.0000      0.954 1.000 0.000
#> GSM531618     2  0.9552      0.394 0.376 0.624
#> GSM531619     1  0.7219      0.758 0.800 0.200
#> GSM531620     1  0.0000      0.954 1.000 0.000
#> GSM531623     1  0.0000      0.954 1.000 0.000
#> GSM531625     1  0.0000      0.954 1.000 0.000
#> GSM531626     1  0.0000      0.954 1.000 0.000
#> GSM531632     1  0.0000      0.954 1.000 0.000
#> GSM531638     1  0.0000      0.954 1.000 0.000
#> GSM531639     1  0.0000      0.954 1.000 0.000
#> GSM531641     2  0.0000      0.944 0.000 1.000
#> GSM531642     1  0.0000      0.954 1.000 0.000
#> GSM531643     1  0.0000      0.954 1.000 0.000
#> GSM531644     1  0.0000      0.954 1.000 0.000
#> GSM531645     2  0.0000      0.944 0.000 1.000
#> GSM531646     1  0.0000      0.954 1.000 0.000
#> GSM531647     1  0.0000      0.954 1.000 0.000
#> GSM531648     2  0.7056      0.744 0.192 0.808
#> GSM531650     1  0.0000      0.954 1.000 0.000
#> GSM531651     1  0.0000      0.954 1.000 0.000
#> GSM531652     1  0.0376      0.951 0.996 0.004
#> GSM531656     1  0.0000      0.954 1.000 0.000
#> GSM531659     2  0.0000      0.944 0.000 1.000
#> GSM531661     1  0.6973      0.773 0.812 0.188
#> GSM531662     1  0.0000      0.954 1.000 0.000
#> GSM531663     2  0.0000      0.944 0.000 1.000
#> GSM531664     1  0.0000      0.954 1.000 0.000
#> GSM531666     1  0.0376      0.951 0.996 0.004
#> GSM531667     1  0.7219      0.758 0.800 0.200
#> GSM531668     2  0.0000      0.944 0.000 1.000
#> GSM531669     1  0.0000      0.954 1.000 0.000
#> GSM531671     1  0.0000      0.954 1.000 0.000
#> GSM531672     2  0.0000      0.944 0.000 1.000
#> GSM531673     1  0.5178      0.850 0.884 0.116
#> GSM531676     2  0.7219      0.758 0.200 0.800
#> GSM531679     2  0.0000      0.944 0.000 1.000
#> GSM531681     2  0.0000      0.944 0.000 1.000
#> GSM531682     2  0.0000      0.944 0.000 1.000
#> GSM531683     2  0.0000      0.944 0.000 1.000
#> GSM531684     2  0.0000      0.944 0.000 1.000
#> GSM531685     1  0.7056      0.755 0.808 0.192
#> GSM531686     2  0.0000      0.944 0.000 1.000
#> GSM531687     2  0.7219      0.758 0.200 0.800
#> GSM531688     1  0.7056      0.755 0.808 0.192
#> GSM531690     2  0.0000      0.944 0.000 1.000
#> GSM531693     1  0.0000      0.954 1.000 0.000
#> GSM531695     2  0.7219      0.758 0.200 0.800
#> GSM531603     2  0.0000      0.944 0.000 1.000
#> GSM531609     2  0.0000      0.944 0.000 1.000
#> GSM531611     2  0.0000      0.944 0.000 1.000
#> GSM531621     1  0.0000      0.954 1.000 0.000
#> GSM531622     1  0.7139      0.763 0.804 0.196
#> GSM531628     1  0.0000      0.954 1.000 0.000
#> GSM531630     1  0.0000      0.954 1.000 0.000
#> GSM531633     1  0.0000      0.954 1.000 0.000
#> GSM531635     1  0.0000      0.954 1.000 0.000
#> GSM531640     1  0.7219      0.758 0.800 0.200
#> GSM531649     1  0.0000      0.954 1.000 0.000
#> GSM531653     1  0.0000      0.954 1.000 0.000
#> GSM531657     2  0.0000      0.944 0.000 1.000
#> GSM531665     1  0.0000      0.954 1.000 0.000
#> GSM531670     1  0.0000      0.954 1.000 0.000
#> GSM531674     1  0.0000      0.954 1.000 0.000
#> GSM531675     2  0.0000      0.944 0.000 1.000
#> GSM531677     2  0.0000      0.944 0.000 1.000
#> GSM531678     2  0.0000      0.944 0.000 1.000
#> GSM531680     2  0.7219      0.758 0.200 0.800
#> GSM531689     2  0.0376      0.941 0.004 0.996
#> GSM531691     2  0.7219      0.758 0.200 0.800
#> GSM531692     1  0.7056      0.755 0.808 0.192
#> GSM531694     2  0.0000      0.944 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
#> GSM531602     2  0.6309      0.588 0.496 0.504 0.000
#> GSM531604     3  0.6832      0.395 0.020 0.376 0.604
#> GSM531606     2  0.6309      0.588 0.496 0.504 0.000
#> GSM531607     2  0.6309      0.588 0.496 0.504 0.000
#> GSM531608     3  0.0237      0.945 0.004 0.000 0.996
#> GSM531610     2  0.6309      0.586 0.500 0.500 0.000
#> GSM531612     1  0.6309     -0.615 0.500 0.500 0.000
#> GSM531613     1  0.6309     -0.615 0.500 0.500 0.000
#> GSM531614     2  0.6309      0.586 0.500 0.500 0.000
#> GSM531616     3  0.2356      0.892 0.000 0.072 0.928
#> GSM531618     1  0.9014     -0.265 0.484 0.136 0.380
#> GSM531619     3  0.0000      0.948 0.000 0.000 1.000
#> GSM531620     3  0.0000      0.948 0.000 0.000 1.000
#> GSM531623     3  0.0000      0.948 0.000 0.000 1.000
#> GSM531625     3  0.0000      0.948 0.000 0.000 1.000
#> GSM531626     3  0.0000      0.948 0.000 0.000 1.000
#> GSM531632     1  0.6521      0.466 0.500 0.496 0.004
#> GSM531638     3  0.0000      0.948 0.000 0.000 1.000
#> GSM531639     3  0.5529      0.613 0.000 0.296 0.704
#> GSM531641     1  0.6309     -0.615 0.500 0.500 0.000
#> GSM531642     2  0.8190     -0.461 0.432 0.496 0.072
#> GSM531643     1  0.6521      0.466 0.500 0.496 0.004
#> GSM531644     1  0.6521      0.466 0.500 0.496 0.004
#> GSM531645     2  0.6309      0.586 0.500 0.500 0.000
#> GSM531646     1  0.6521      0.466 0.500 0.496 0.004
#> GSM531647     1  0.6521      0.466 0.500 0.496 0.004
#> GSM531648     2  0.6309      0.586 0.500 0.500 0.000
#> GSM531650     1  0.6521      0.466 0.500 0.496 0.004
#> GSM531651     3  0.0000      0.948 0.000 0.000 1.000
#> GSM531652     1  0.6521      0.466 0.500 0.496 0.004
#> GSM531656     2  0.8947     -0.423 0.372 0.496 0.132
#> GSM531659     2  0.6309      0.586 0.500 0.500 0.000
#> GSM531661     3  0.0000      0.948 0.000 0.000 1.000
#> GSM531662     3  0.0000      0.948 0.000 0.000 1.000
#> GSM531663     1  0.6309     -0.615 0.500 0.500 0.000
#> GSM531664     1  0.6521      0.466 0.500 0.496 0.004
#> GSM531666     1  0.6521      0.466 0.500 0.496 0.004
#> GSM531667     3  0.0000      0.948 0.000 0.000 1.000
#> GSM531668     1  0.6309     -0.615 0.500 0.500 0.000
#> GSM531669     1  0.6521      0.466 0.500 0.496 0.004
#> GSM531671     3  0.5875      0.751 0.136 0.072 0.792
#> GSM531672     2  0.6309      0.586 0.500 0.500 0.000
#> GSM531673     3  0.0237      0.945 0.000 0.004 0.996
#> GSM531676     1  0.6309      0.464 0.500 0.500 0.000
#> GSM531679     2  0.6309      0.588 0.496 0.504 0.000
#> GSM531681     1  0.6309     -0.615 0.500 0.500 0.000
#> GSM531682     2  0.6309      0.588 0.496 0.504 0.000
#> GSM531683     2  0.6309      0.588 0.496 0.504 0.000
#> GSM531684     3  0.2031      0.911 0.016 0.032 0.952
#> GSM531685     1  0.6309      0.464 0.500 0.500 0.000
#> GSM531686     1  0.6309     -0.615 0.500 0.500 0.000
#> GSM531687     2  0.6309     -0.502 0.500 0.500 0.000
#> GSM531688     2  0.6309     -0.502 0.500 0.500 0.000
#> GSM531690     1  0.6309     -0.615 0.500 0.500 0.000
#> GSM531693     1  0.6309      0.464 0.500 0.500 0.000
#> GSM531695     2  0.6309     -0.502 0.500 0.500 0.000
#> GSM531603     2  0.6309      0.588 0.496 0.504 0.000
#> GSM531609     1  0.6309     -0.615 0.500 0.500 0.000
#> GSM531611     1  0.6309     -0.615 0.500 0.500 0.000
#> GSM531621     3  0.0000      0.948 0.000 0.000 1.000
#> GSM531622     3  0.0000      0.948 0.000 0.000 1.000
#> GSM531628     1  0.6521      0.466 0.500 0.496 0.004
#> GSM531630     3  0.0000      0.948 0.000 0.000 1.000
#> GSM531633     3  0.0000      0.948 0.000 0.000 1.000
#> GSM531635     1  0.6521      0.466 0.500 0.496 0.004
#> GSM531640     3  0.0000      0.948 0.000 0.000 1.000
#> GSM531649     1  0.6521      0.466 0.500 0.496 0.004
#> GSM531653     1  0.6521      0.466 0.500 0.496 0.004
#> GSM531657     2  0.6309      0.586 0.500 0.500 0.000
#> GSM531665     1  0.9423      0.136 0.492 0.204 0.304
#> GSM531670     2  0.8947     -0.423 0.372 0.496 0.132
#> GSM531674     1  0.6521      0.466 0.500 0.496 0.004
#> GSM531675     2  0.6309      0.588 0.496 0.504 0.000
#> GSM531677     2  0.6309      0.588 0.496 0.504 0.000
#> GSM531678     2  0.6309      0.588 0.496 0.504 0.000
#> GSM531680     1  0.6309      0.464 0.500 0.500 0.000
#> GSM531689     1  0.6309     -0.593 0.504 0.496 0.000
#> GSM531691     1  0.9713     -0.405 0.404 0.376 0.220
#> GSM531692     3  0.1989      0.914 0.048 0.004 0.948
#> GSM531694     2  0.6309      0.588 0.496 0.504 0.000

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM531602     2  0.0000      0.937 0.000 1.000 0.000 0.000
#> GSM531604     2  0.0000      0.937 0.000 1.000 0.000 0.000
#> GSM531606     2  0.0000      0.937 0.000 1.000 0.000 0.000
#> GSM531607     2  0.0000      0.937 0.000 1.000 0.000 0.000
#> GSM531608     3  0.0000      0.966 0.000 0.000 1.000 0.000
#> GSM531610     4  0.0000      0.975 0.000 0.000 0.000 1.000
#> GSM531612     4  0.0000      0.975 0.000 0.000 0.000 1.000
#> GSM531613     4  0.0000      0.975 0.000 0.000 0.000 1.000
#> GSM531614     4  0.0000      0.975 0.000 0.000 0.000 1.000
#> GSM531616     3  0.0000      0.966 0.000 0.000 1.000 0.000
#> GSM531618     4  0.0000      0.975 0.000 0.000 0.000 1.000
#> GSM531619     3  0.0000      0.966 0.000 0.000 1.000 0.000
#> GSM531620     3  0.0000      0.966 0.000 0.000 1.000 0.000
#> GSM531623     3  0.0000      0.966 0.000 0.000 1.000 0.000
#> GSM531625     3  0.0000      0.966 0.000 0.000 1.000 0.000
#> GSM531626     3  0.0000      0.966 0.000 0.000 1.000 0.000
#> GSM531632     1  0.0000      0.939 1.000 0.000 0.000 0.000
#> GSM531638     3  0.0000      0.966 0.000 0.000 1.000 0.000
#> GSM531639     3  0.4679      0.405 0.352 0.000 0.648 0.000
#> GSM531641     4  0.0000      0.975 0.000 0.000 0.000 1.000
#> GSM531642     1  0.3801      0.716 0.780 0.000 0.220 0.000
#> GSM531643     1  0.0000      0.939 1.000 0.000 0.000 0.000
#> GSM531644     1  0.0000      0.939 1.000 0.000 0.000 0.000
#> GSM531645     4  0.0000      0.975 0.000 0.000 0.000 1.000
#> GSM531646     1  0.0000      0.939 1.000 0.000 0.000 0.000
#> GSM531647     1  0.0000      0.939 1.000 0.000 0.000 0.000
#> GSM531648     4  0.0000      0.975 0.000 0.000 0.000 1.000
#> GSM531650     1  0.0000      0.939 1.000 0.000 0.000 0.000
#> GSM531651     3  0.0000      0.966 0.000 0.000 1.000 0.000
#> GSM531652     1  0.1118      0.912 0.964 0.000 0.000 0.036
#> GSM531656     1  0.3610      0.744 0.800 0.000 0.200 0.000
#> GSM531659     4  0.0000      0.975 0.000 0.000 0.000 1.000
#> GSM531661     3  0.0000      0.966 0.000 0.000 1.000 0.000
#> GSM531662     3  0.0000      0.966 0.000 0.000 1.000 0.000
#> GSM531663     4  0.0000      0.975 0.000 0.000 0.000 1.000
#> GSM531664     1  0.0000      0.939 1.000 0.000 0.000 0.000
#> GSM531666     1  0.0188      0.936 0.996 0.000 0.000 0.004
#> GSM531667     3  0.0000      0.966 0.000 0.000 1.000 0.000
#> GSM531668     4  0.0000      0.975 0.000 0.000 0.000 1.000
#> GSM531669     1  0.0000      0.939 1.000 0.000 0.000 0.000
#> GSM531671     3  0.3801      0.688 0.220 0.000 0.780 0.000
#> GSM531672     4  0.0000      0.975 0.000 0.000 0.000 1.000
#> GSM531673     3  0.0000      0.966 0.000 0.000 1.000 0.000
#> GSM531676     2  0.1211      0.915 0.040 0.960 0.000 0.000
#> GSM531679     2  0.0000      0.937 0.000 1.000 0.000 0.000
#> GSM531681     4  0.2814      0.859 0.000 0.132 0.000 0.868
#> GSM531682     2  0.0000      0.937 0.000 1.000 0.000 0.000
#> GSM531683     2  0.0000      0.937 0.000 1.000 0.000 0.000
#> GSM531684     2  0.0000      0.937 0.000 1.000 0.000 0.000
#> GSM531685     2  0.3688      0.752 0.208 0.792 0.000 0.000
#> GSM531686     4  0.2814      0.859 0.000 0.132 0.000 0.868
#> GSM531687     2  0.1302      0.912 0.044 0.956 0.000 0.000
#> GSM531688     1  0.0000      0.939 1.000 0.000 0.000 0.000
#> GSM531690     4  0.2814      0.859 0.000 0.132 0.000 0.868
#> GSM531693     1  0.0000      0.939 1.000 0.000 0.000 0.000
#> GSM531695     2  0.5000      0.117 0.496 0.504 0.000 0.000
#> GSM531603     2  0.0000      0.937 0.000 1.000 0.000 0.000
#> GSM531609     4  0.0000      0.975 0.000 0.000 0.000 1.000
#> GSM531611     4  0.0000      0.975 0.000 0.000 0.000 1.000
#> GSM531621     3  0.0000      0.966 0.000 0.000 1.000 0.000
#> GSM531622     3  0.0000      0.966 0.000 0.000 1.000 0.000
#> GSM531628     1  0.0000      0.939 1.000 0.000 0.000 0.000
#> GSM531630     3  0.0000      0.966 0.000 0.000 1.000 0.000
#> GSM531633     3  0.0000      0.966 0.000 0.000 1.000 0.000
#> GSM531635     1  0.0000      0.939 1.000 0.000 0.000 0.000
#> GSM531640     3  0.0000      0.966 0.000 0.000 1.000 0.000
#> GSM531649     1  0.0000      0.939 1.000 0.000 0.000 0.000
#> GSM531653     1  0.0000      0.939 1.000 0.000 0.000 0.000
#> GSM531657     4  0.0000      0.975 0.000 0.000 0.000 1.000
#> GSM531665     1  0.7270      0.247 0.504 0.164 0.332 0.000
#> GSM531670     1  0.3610      0.744 0.800 0.000 0.200 0.000
#> GSM531674     1  0.0000      0.939 1.000 0.000 0.000 0.000
#> GSM531675     2  0.3873      0.688 0.000 0.772 0.000 0.228
#> GSM531677     2  0.0000      0.937 0.000 1.000 0.000 0.000
#> GSM531678     2  0.0000      0.937 0.000 1.000 0.000 0.000
#> GSM531680     2  0.3569      0.767 0.196 0.804 0.000 0.000
#> GSM531689     2  0.0000      0.937 0.000 1.000 0.000 0.000
#> GSM531691     2  0.0000      0.937 0.000 1.000 0.000 0.000
#> GSM531692     2  0.0000      0.937 0.000 1.000 0.000 0.000
#> GSM531694     2  0.0000      0.937 0.000 1.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
#> GSM531602     2  0.0000    0.90298 0.000 1.000 0.000 0.000 0.000
#> GSM531604     2  0.2929    0.77885 0.000 0.820 0.000 0.000 0.180
#> GSM531606     2  0.0162    0.90176 0.000 0.996 0.000 0.000 0.004
#> GSM531607     2  0.0000    0.90298 0.000 1.000 0.000 0.000 0.000
#> GSM531608     3  0.0000    0.94413 0.000 0.000 1.000 0.000 0.000
#> GSM531610     4  0.0000    0.87163 0.000 0.000 0.000 1.000 0.000
#> GSM531612     4  0.0000    0.87163 0.000 0.000 0.000 1.000 0.000
#> GSM531613     4  0.0000    0.87163 0.000 0.000 0.000 1.000 0.000
#> GSM531614     4  0.0000    0.87163 0.000 0.000 0.000 1.000 0.000
#> GSM531616     3  0.0162    0.94202 0.000 0.000 0.996 0.000 0.004
#> GSM531618     4  0.3551    0.77296 0.004 0.020 0.004 0.820 0.152
#> GSM531619     3  0.0000    0.94413 0.000 0.000 1.000 0.000 0.000
#> GSM531620     3  0.0000    0.94413 0.000 0.000 1.000 0.000 0.000
#> GSM531623     3  0.0000    0.94413 0.000 0.000 1.000 0.000 0.000
#> GSM531625     3  0.0000    0.94413 0.000 0.000 1.000 0.000 0.000
#> GSM531626     3  0.0000    0.94413 0.000 0.000 1.000 0.000 0.000
#> GSM531632     1  0.1121    0.88448 0.956 0.000 0.000 0.000 0.044
#> GSM531638     3  0.0162    0.94202 0.000 0.000 0.996 0.000 0.004
#> GSM531639     3  0.5014    0.29184 0.368 0.000 0.592 0.000 0.040
#> GSM531641     4  0.0000    0.87163 0.000 0.000 0.000 1.000 0.000
#> GSM531642     1  0.5307    0.66551 0.676 0.000 0.168 0.000 0.156
#> GSM531643     1  0.1608    0.87484 0.928 0.000 0.000 0.000 0.072
#> GSM531644     1  0.2690    0.82775 0.844 0.000 0.000 0.000 0.156
#> GSM531645     4  0.0000    0.87163 0.000 0.000 0.000 1.000 0.000
#> GSM531646     1  0.0510    0.89933 0.984 0.000 0.000 0.000 0.016
#> GSM531647     1  0.0510    0.89933 0.984 0.000 0.000 0.000 0.016
#> GSM531648     4  0.2763    0.78880 0.004 0.000 0.000 0.848 0.148
#> GSM531650     1  0.0000    0.89984 1.000 0.000 0.000 0.000 0.000
#> GSM531651     3  0.0000    0.94413 0.000 0.000 1.000 0.000 0.000
#> GSM531652     1  0.2690    0.82775 0.844 0.000 0.000 0.000 0.156
#> GSM531656     1  0.3844    0.73302 0.792 0.000 0.164 0.000 0.044
#> GSM531659     4  0.1043    0.85944 0.000 0.000 0.000 0.960 0.040
#> GSM531661     3  0.0000    0.94413 0.000 0.000 1.000 0.000 0.000
#> GSM531662     3  0.1809    0.89165 0.000 0.012 0.928 0.000 0.060
#> GSM531663     4  0.0000    0.87163 0.000 0.000 0.000 1.000 0.000
#> GSM531664     1  0.0000    0.89984 1.000 0.000 0.000 0.000 0.000
#> GSM531666     1  0.2690    0.82775 0.844 0.000 0.000 0.000 0.156
#> GSM531667     3  0.0162    0.94174 0.000 0.000 0.996 0.000 0.004
#> GSM531668     4  0.5498    0.20262 0.000 0.440 0.000 0.496 0.064
#> GSM531669     1  0.1121    0.88448 0.956 0.000 0.000 0.000 0.044
#> GSM531671     3  0.5361    0.54764 0.244 0.008 0.664 0.000 0.084
#> GSM531672     4  0.0963    0.86087 0.000 0.000 0.000 0.964 0.036
#> GSM531673     3  0.3039    0.79699 0.000 0.012 0.836 0.000 0.152
#> GSM531676     5  0.3304    0.77746 0.016 0.168 0.000 0.000 0.816
#> GSM531679     2  0.1270    0.89070 0.000 0.948 0.000 0.000 0.052
#> GSM531681     4  0.4306   -0.00543 0.000 0.492 0.000 0.508 0.000
#> GSM531682     2  0.1197    0.89199 0.000 0.952 0.000 0.000 0.048
#> GSM531683     2  0.0000    0.90298 0.000 1.000 0.000 0.000 0.000
#> GSM531684     2  0.2516    0.81350 0.000 0.860 0.000 0.000 0.140
#> GSM531685     5  0.3359    0.77961 0.072 0.084 0.000 0.000 0.844
#> GSM531686     4  0.4306   -0.00543 0.000 0.492 0.000 0.508 0.000
#> GSM531687     5  0.3696    0.75938 0.016 0.212 0.000 0.000 0.772
#> GSM531688     5  0.4171    0.49844 0.396 0.000 0.000 0.000 0.604
#> GSM531690     2  0.4045    0.36920 0.000 0.644 0.000 0.356 0.000
#> GSM531693     5  0.4182    0.49034 0.400 0.000 0.000 0.000 0.600
#> GSM531695     5  0.5771    0.62975 0.316 0.112 0.000 0.000 0.572
#> GSM531603     2  0.0000    0.90298 0.000 1.000 0.000 0.000 0.000
#> GSM531609     4  0.0000    0.87163 0.000 0.000 0.000 1.000 0.000
#> GSM531611     4  0.0000    0.87163 0.000 0.000 0.000 1.000 0.000
#> GSM531621     3  0.0000    0.94413 0.000 0.000 1.000 0.000 0.000
#> GSM531622     3  0.0000    0.94413 0.000 0.000 1.000 0.000 0.000
#> GSM531628     1  0.0162    0.89998 0.996 0.000 0.000 0.000 0.004
#> GSM531630     3  0.0000    0.94413 0.000 0.000 1.000 0.000 0.000
#> GSM531633     3  0.0000    0.94413 0.000 0.000 1.000 0.000 0.000
#> GSM531635     1  0.0609    0.90024 0.980 0.000 0.000 0.000 0.020
#> GSM531640     3  0.0000    0.94413 0.000 0.000 1.000 0.000 0.000
#> GSM531649     1  0.0510    0.89933 0.984 0.000 0.000 0.000 0.016
#> GSM531653     1  0.0510    0.89933 0.984 0.000 0.000 0.000 0.016
#> GSM531657     4  0.1364    0.85784 0.000 0.012 0.000 0.952 0.036
#> GSM531665     5  0.3351    0.74855 0.148 0.004 0.020 0.000 0.828
#> GSM531670     1  0.3844    0.73302 0.792 0.000 0.164 0.000 0.044
#> GSM531674     1  0.0880    0.89161 0.968 0.000 0.000 0.000 0.032
#> GSM531675     2  0.1410    0.86923 0.000 0.940 0.000 0.060 0.000
#> GSM531677     2  0.1282    0.89302 0.000 0.952 0.000 0.004 0.044
#> GSM531678     2  0.2773    0.79518 0.000 0.836 0.000 0.000 0.164
#> GSM531680     5  0.4066    0.77397 0.044 0.188 0.000 0.000 0.768
#> GSM531689     5  0.3508    0.71345 0.000 0.252 0.000 0.000 0.748
#> GSM531691     5  0.3242    0.73567 0.000 0.216 0.000 0.000 0.784
#> GSM531692     5  0.3013    0.77218 0.008 0.160 0.000 0.000 0.832
#> GSM531694     2  0.0000    0.90298 0.000 1.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
#> GSM531602     2  0.0146     0.8106 0.000 0.996 0.000 0.004 0.000 0.000
#> GSM531604     2  0.5400     0.2079 0.000 0.484 0.000 0.000 0.400 0.116
#> GSM531606     2  0.1036     0.8030 0.000 0.964 0.000 0.004 0.024 0.008
#> GSM531607     2  0.0291     0.8102 0.000 0.992 0.000 0.004 0.004 0.000
#> GSM531608     3  0.2163     0.8289 0.000 0.000 0.892 0.000 0.016 0.092
#> GSM531610     4  0.0000     0.8412 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM531612     4  0.0000     0.8412 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM531613     4  0.0000     0.8412 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM531614     4  0.0000     0.8412 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM531616     3  0.3053     0.7921 0.024 0.004 0.828 0.000 0.000 0.144
#> GSM531618     6  0.4103     0.4152 0.000 0.012 0.012 0.304 0.000 0.672
#> GSM531619     3  0.0146     0.8671 0.000 0.000 0.996 0.000 0.000 0.004
#> GSM531620     3  0.0458     0.8667 0.000 0.000 0.984 0.000 0.000 0.016
#> GSM531623     3  0.0146     0.8671 0.000 0.000 0.996 0.000 0.000 0.004
#> GSM531625     3  0.2001     0.8348 0.004 0.004 0.900 0.000 0.000 0.092
#> GSM531626     3  0.2001     0.8348 0.004 0.004 0.900 0.000 0.000 0.092
#> GSM531632     1  0.0603     0.8148 0.980 0.000 0.000 0.000 0.016 0.004
#> GSM531638     3  0.2695     0.8028 0.008 0.004 0.844 0.000 0.000 0.144
#> GSM531639     3  0.5587     0.3743 0.156 0.004 0.548 0.000 0.000 0.292
#> GSM531641     4  0.0000     0.8412 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM531642     6  0.3156     0.6480 0.180 0.000 0.020 0.000 0.000 0.800
#> GSM531643     1  0.2003     0.7372 0.884 0.000 0.000 0.000 0.000 0.116
#> GSM531644     6  0.3756     0.5263 0.400 0.000 0.000 0.000 0.000 0.600
#> GSM531645     4  0.0000     0.8412 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM531646     1  0.0632     0.8121 0.976 0.000 0.000 0.000 0.000 0.024
#> GSM531647     1  0.0291     0.8175 0.992 0.000 0.000 0.000 0.004 0.004
#> GSM531648     6  0.3620     0.3319 0.000 0.000 0.000 0.352 0.000 0.648
#> GSM531650     1  0.0547     0.8136 0.980 0.000 0.000 0.000 0.000 0.020
#> GSM531651     3  0.0146     0.8671 0.000 0.000 0.996 0.000 0.000 0.004
#> GSM531652     6  0.3446     0.6700 0.308 0.000 0.000 0.000 0.000 0.692
#> GSM531656     1  0.4697     0.5649 0.708 0.004 0.096 0.000 0.008 0.184
#> GSM531659     4  0.3636     0.5265 0.000 0.004 0.000 0.676 0.000 0.320
#> GSM531661     3  0.2398     0.8202 0.000 0.000 0.876 0.000 0.020 0.104
#> GSM531662     3  0.4154     0.7166 0.000 0.000 0.744 0.000 0.112 0.144
#> GSM531663     4  0.0000     0.8412 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM531664     1  0.0692     0.8146 0.976 0.000 0.000 0.000 0.004 0.020
#> GSM531666     6  0.3428     0.6710 0.304 0.000 0.000 0.000 0.000 0.696
#> GSM531667     3  0.1501     0.8449 0.000 0.000 0.924 0.000 0.000 0.076
#> GSM531668     2  0.4220     0.5851 0.000 0.732 0.000 0.172 0.000 0.096
#> GSM531669     1  0.0508     0.8162 0.984 0.000 0.000 0.000 0.012 0.004
#> GSM531671     3  0.7022     0.1881 0.340 0.000 0.404 0.000 0.116 0.140
#> GSM531672     4  0.4110     0.5554 0.000 0.040 0.000 0.692 0.000 0.268
#> GSM531673     3  0.5244     0.6033 0.000 0.012 0.644 0.000 0.192 0.152
#> GSM531676     5  0.1663     0.8322 0.000 0.088 0.000 0.000 0.912 0.000
#> GSM531679     2  0.2491     0.7785 0.000 0.868 0.000 0.000 0.112 0.020
#> GSM531681     4  0.4293     0.4965 0.000 0.292 0.000 0.672 0.012 0.024
#> GSM531682     2  0.2726     0.7780 0.000 0.856 0.000 0.000 0.112 0.032
#> GSM531683     2  0.0508     0.8102 0.000 0.984 0.000 0.004 0.000 0.012
#> GSM531684     2  0.6012     0.4702 0.000 0.604 0.084 0.000 0.204 0.108
#> GSM531685     5  0.0881     0.8096 0.012 0.008 0.000 0.000 0.972 0.008
#> GSM531686     4  0.4360     0.4985 0.000 0.288 0.000 0.672 0.016 0.024
#> GSM531687     5  0.1863     0.8260 0.000 0.104 0.000 0.000 0.896 0.000
#> GSM531688     1  0.3991     0.0547 0.524 0.000 0.000 0.000 0.472 0.004
#> GSM531690     2  0.4269     0.6427 0.000 0.736 0.000 0.196 0.016 0.052
#> GSM531693     1  0.3950     0.1826 0.564 0.000 0.000 0.000 0.432 0.004
#> GSM531695     5  0.5664     0.2845 0.364 0.116 0.000 0.000 0.508 0.012
#> GSM531603     2  0.0146     0.8106 0.000 0.996 0.000 0.004 0.000 0.000
#> GSM531609     4  0.0000     0.8412 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM531611     4  0.0000     0.8412 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM531621     3  0.0260     0.8675 0.000 0.000 0.992 0.000 0.000 0.008
#> GSM531622     3  0.0000     0.8671 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM531628     1  0.0692     0.8146 0.976 0.000 0.000 0.000 0.004 0.020
#> GSM531630     3  0.0146     0.8676 0.000 0.000 0.996 0.000 0.000 0.004
#> GSM531633     3  0.0363     0.8672 0.000 0.000 0.988 0.000 0.000 0.012
#> GSM531635     1  0.2714     0.7307 0.848 0.004 0.012 0.000 0.000 0.136
#> GSM531640     3  0.0713     0.8629 0.000 0.000 0.972 0.000 0.000 0.028
#> GSM531649     1  0.1908     0.7630 0.900 0.004 0.000 0.000 0.000 0.096
#> GSM531653     1  0.0146     0.8180 0.996 0.000 0.000 0.000 0.004 0.000
#> GSM531657     4  0.4453     0.4562 0.000 0.044 0.000 0.624 0.000 0.332
#> GSM531665     5  0.3532     0.7076 0.064 0.000 0.000 0.000 0.796 0.140
#> GSM531670     1  0.4741     0.5582 0.704 0.004 0.100 0.000 0.008 0.184
#> GSM531674     1  0.0363     0.8173 0.988 0.000 0.000 0.000 0.012 0.000
#> GSM531675     2  0.3366     0.7718 0.000 0.844 0.000 0.060 0.044 0.052
#> GSM531677     2  0.2911     0.7790 0.000 0.856 0.000 0.008 0.100 0.036
#> GSM531678     2  0.3965     0.3889 0.000 0.604 0.000 0.000 0.388 0.008
#> GSM531680     5  0.2135     0.8101 0.000 0.128 0.000 0.000 0.872 0.000
#> GSM531689     5  0.2146     0.8185 0.000 0.116 0.000 0.000 0.880 0.004
#> GSM531691     5  0.1913     0.8285 0.000 0.080 0.000 0.000 0.908 0.012
#> GSM531692     5  0.2446     0.7449 0.000 0.012 0.000 0.000 0.864 0.124
#> GSM531694     2  0.0146     0.8106 0.000 0.996 0.000 0.004 0.000 0.000

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

consensus_heatmap(res, k = 2)

plot of chunk tab-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)
#> Error in mat[ceiling(1:nr/h_ratio), ceiling(1:nc/w_ratio), drop = FALSE]: subscript out of bounds

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 disease.state(p) k
#> SD:skmeans 79            1.000 2
#> SD:skmeans 40            0.945 3
#> SD:skmeans 77            0.284 4
#> SD:skmeans 73            0.480 5
#> SD:skmeans 67            0.216 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 51941 rows and 80 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.925           0.925       0.944         0.4700 0.525   0.525
#> 3 3 0.448           0.621       0.806         0.3399 0.798   0.621
#> 4 4 0.552           0.669       0.843         0.1477 0.787   0.477
#> 5 5 0.855           0.852       0.929         0.0972 0.792   0.388
#> 6 6 0.775           0.753       0.849         0.0473 0.921   0.648

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
#> GSM531602     2  0.0376      0.935 0.004 0.996
#> GSM531604     2  0.0376      0.935 0.004 0.996
#> GSM531606     2  0.0376      0.935 0.004 0.996
#> GSM531607     2  0.0000      0.934 0.000 1.000
#> GSM531608     1  0.4161      0.953 0.916 0.084
#> GSM531610     1  0.4161      0.953 0.916 0.084
#> GSM531612     1  0.4161      0.953 0.916 0.084
#> GSM531613     1  0.7139      0.835 0.804 0.196
#> GSM531614     1  0.4161      0.953 0.916 0.084
#> GSM531616     1  0.0000      0.942 1.000 0.000
#> GSM531618     1  0.4161      0.953 0.916 0.084
#> GSM531619     1  0.4161      0.953 0.916 0.084
#> GSM531620     1  0.0000      0.942 1.000 0.000
#> GSM531623     1  0.4161      0.953 0.916 0.084
#> GSM531625     1  0.0000      0.942 1.000 0.000
#> GSM531626     1  0.0000      0.942 1.000 0.000
#> GSM531632     1  0.0376      0.940 0.996 0.004
#> GSM531638     1  0.0000      0.942 1.000 0.000
#> GSM531639     1  0.0000      0.942 1.000 0.000
#> GSM531641     1  0.4161      0.953 0.916 0.084
#> GSM531642     1  0.4161      0.953 0.916 0.084
#> GSM531643     1  0.0000      0.942 1.000 0.000
#> GSM531644     1  0.0000      0.942 1.000 0.000
#> GSM531645     1  0.4161      0.953 0.916 0.084
#> GSM531646     1  0.0376      0.940 0.996 0.004
#> GSM531647     1  0.0376      0.940 0.996 0.004
#> GSM531648     1  0.4161      0.953 0.916 0.084
#> GSM531650     1  0.0376      0.940 0.996 0.004
#> GSM531651     1  0.0000      0.942 1.000 0.000
#> GSM531652     1  0.4161      0.953 0.916 0.084
#> GSM531656     1  0.0000      0.942 1.000 0.000
#> GSM531659     1  0.4161      0.953 0.916 0.084
#> GSM531661     1  0.4161      0.953 0.916 0.084
#> GSM531662     1  0.4161      0.953 0.916 0.084
#> GSM531663     1  0.4161      0.953 0.916 0.084
#> GSM531664     2  0.9248      0.630 0.340 0.660
#> GSM531666     1  0.4161      0.953 0.916 0.084
#> GSM531667     1  0.4161      0.953 0.916 0.084
#> GSM531668     1  0.4161      0.953 0.916 0.084
#> GSM531669     2  0.9833      0.443 0.424 0.576
#> GSM531671     1  0.1414      0.932 0.980 0.020
#> GSM531672     1  0.4161      0.953 0.916 0.084
#> GSM531673     1  0.4161      0.953 0.916 0.084
#> GSM531676     2  0.4161      0.904 0.084 0.916
#> GSM531679     2  0.0000      0.934 0.000 1.000
#> GSM531681     2  0.0376      0.935 0.004 0.996
#> GSM531682     2  0.0376      0.935 0.004 0.996
#> GSM531683     2  0.0376      0.935 0.004 0.996
#> GSM531684     2  0.0376      0.935 0.004 0.996
#> GSM531685     2  0.4161      0.904 0.084 0.916
#> GSM531686     2  0.0000      0.934 0.000 1.000
#> GSM531687     2  0.7219      0.833 0.200 0.800
#> GSM531688     2  0.4161      0.904 0.084 0.916
#> GSM531690     2  0.0376      0.935 0.004 0.996
#> GSM531693     2  0.4298      0.903 0.088 0.912
#> GSM531695     2  0.4161      0.904 0.084 0.916
#> GSM531603     2  0.0376      0.935 0.004 0.996
#> GSM531609     1  0.4161      0.953 0.916 0.084
#> GSM531611     1  0.4161      0.953 0.916 0.084
#> GSM531621     1  0.0000      0.942 1.000 0.000
#> GSM531622     1  0.4161      0.953 0.916 0.084
#> GSM531628     1  0.0376      0.940 0.996 0.004
#> GSM531630     1  0.4161      0.953 0.916 0.084
#> GSM531633     1  0.0000      0.942 1.000 0.000
#> GSM531635     1  0.0000      0.942 1.000 0.000
#> GSM531640     1  0.4161      0.953 0.916 0.084
#> GSM531649     1  0.0000      0.942 1.000 0.000
#> GSM531653     1  0.0376      0.940 0.996 0.004
#> GSM531657     1  0.4161      0.953 0.916 0.084
#> GSM531665     2  0.5294      0.850 0.120 0.880
#> GSM531670     1  0.0000      0.942 1.000 0.000
#> GSM531674     2  0.7139      0.834 0.196 0.804
#> GSM531675     2  0.0376      0.935 0.004 0.996
#> GSM531677     2  0.0000      0.934 0.000 1.000
#> GSM531678     2  0.0376      0.935 0.004 0.996
#> GSM531680     2  0.4431      0.902 0.092 0.908
#> GSM531689     2  0.0000      0.934 0.000 1.000
#> GSM531691     2  0.2948      0.907 0.052 0.948
#> GSM531692     2  0.4161      0.904 0.084 0.916
#> GSM531694     2  0.0376      0.935 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
#> GSM531602     2  0.3826     0.8844 0.124 0.868 0.008
#> GSM531604     2  0.3644     0.8407 0.004 0.872 0.124
#> GSM531606     2  0.3826     0.8844 0.124 0.868 0.008
#> GSM531607     2  0.3412     0.8838 0.124 0.876 0.000
#> GSM531608     3  0.2796     0.5972 0.092 0.000 0.908
#> GSM531610     1  0.0000     0.6047 1.000 0.000 0.000
#> GSM531612     1  0.0000     0.6047 1.000 0.000 0.000
#> GSM531613     1  0.0237     0.6010 0.996 0.004 0.000
#> GSM531614     1  0.0000     0.6047 1.000 0.000 0.000
#> GSM531616     3  0.6286    -0.3021 0.464 0.000 0.536
#> GSM531618     1  0.5363     0.6982 0.724 0.000 0.276
#> GSM531619     3  0.0000     0.6882 0.000 0.000 1.000
#> GSM531620     3  0.0000     0.6882 0.000 0.000 1.000
#> GSM531623     3  0.0000     0.6882 0.000 0.000 1.000
#> GSM531625     3  0.0000     0.6882 0.000 0.000 1.000
#> GSM531626     3  0.6267    -0.2726 0.452 0.000 0.548
#> GSM531632     1  0.9009     0.4199 0.464 0.132 0.404
#> GSM531638     3  0.6286    -0.3021 0.464 0.000 0.536
#> GSM531639     1  0.6126     0.5725 0.600 0.000 0.400
#> GSM531641     1  0.0000     0.6047 1.000 0.000 0.000
#> GSM531642     1  0.5968     0.6265 0.636 0.000 0.364
#> GSM531643     1  0.8318     0.6368 0.600 0.116 0.284
#> GSM531644     1  0.8318     0.6364 0.600 0.116 0.284
#> GSM531645     1  0.0000     0.6047 1.000 0.000 0.000
#> GSM531646     1  0.8968     0.4174 0.464 0.128 0.408
#> GSM531647     1  0.9009     0.4199 0.464 0.132 0.404
#> GSM531648     1  0.5363     0.6982 0.724 0.000 0.276
#> GSM531650     1  0.8435     0.6335 0.600 0.132 0.268
#> GSM531651     3  0.0000     0.6882 0.000 0.000 1.000
#> GSM531652     1  0.5363     0.6982 0.724 0.000 0.276
#> GSM531656     1  0.7141     0.5995 0.600 0.032 0.368
#> GSM531659     1  0.5363     0.6982 0.724 0.000 0.276
#> GSM531661     3  0.0000     0.6882 0.000 0.000 1.000
#> GSM531662     3  0.0237     0.6856 0.004 0.000 0.996
#> GSM531663     1  0.2066     0.6298 0.940 0.000 0.060
#> GSM531664     2  0.6091     0.6467 0.092 0.784 0.124
#> GSM531666     1  0.5988     0.6227 0.632 0.000 0.368
#> GSM531667     1  0.5835     0.6381 0.660 0.000 0.340
#> GSM531668     1  0.4654     0.6844 0.792 0.000 0.208
#> GSM531669     2  0.7065     0.5116 0.228 0.700 0.072
#> GSM531671     3  0.8981    -0.3691 0.424 0.128 0.448
#> GSM531672     1  0.5363     0.6982 0.724 0.000 0.276
#> GSM531673     3  0.3686     0.5566 0.140 0.000 0.860
#> GSM531676     2  0.0000     0.8614 0.000 1.000 0.000
#> GSM531679     2  0.3267     0.8842 0.116 0.884 0.000
#> GSM531681     2  0.6126     0.6706 0.400 0.600 0.000
#> GSM531682     2  0.3826     0.8844 0.124 0.868 0.008
#> GSM531683     2  0.3826     0.8844 0.124 0.868 0.008
#> GSM531684     3  0.6359    -0.0651 0.004 0.404 0.592
#> GSM531685     2  0.0000     0.8614 0.000 1.000 0.000
#> GSM531686     2  0.5621     0.7544 0.308 0.692 0.000
#> GSM531687     2  0.4002     0.8025 0.000 0.840 0.160
#> GSM531688     2  0.0000     0.8614 0.000 1.000 0.000
#> GSM531690     2  0.3715     0.8834 0.128 0.868 0.004
#> GSM531693     2  0.0000     0.8614 0.000 1.000 0.000
#> GSM531695     2  0.0000     0.8614 0.000 1.000 0.000
#> GSM531603     2  0.3826     0.8844 0.124 0.868 0.008
#> GSM531609     1  0.0000     0.6047 1.000 0.000 0.000
#> GSM531611     1  0.0592     0.6107 0.988 0.000 0.012
#> GSM531621     3  0.0000     0.6882 0.000 0.000 1.000
#> GSM531622     3  0.0000     0.6882 0.000 0.000 1.000
#> GSM531628     1  0.8435     0.6335 0.600 0.132 0.268
#> GSM531630     3  0.3619     0.5595 0.136 0.000 0.864
#> GSM531633     3  0.0000     0.6882 0.000 0.000 1.000
#> GSM531635     3  0.7389    -0.3485 0.464 0.032 0.504
#> GSM531640     1  0.5497     0.6920 0.708 0.000 0.292
#> GSM531649     3  0.7389    -0.3485 0.464 0.032 0.504
#> GSM531653     1  0.9009     0.4199 0.464 0.132 0.404
#> GSM531657     1  0.5363     0.6982 0.724 0.000 0.276
#> GSM531665     2  0.3120     0.8288 0.012 0.908 0.080
#> GSM531670     1  0.7141     0.5995 0.600 0.032 0.368
#> GSM531674     2  0.2356     0.8229 0.000 0.928 0.072
#> GSM531675     2  0.3826     0.8844 0.124 0.868 0.008
#> GSM531677     2  0.3412     0.8838 0.124 0.876 0.000
#> GSM531678     2  0.3826     0.8844 0.124 0.868 0.008
#> GSM531680     2  0.2625     0.8552 0.000 0.916 0.084
#> GSM531689     2  0.3207     0.8587 0.012 0.904 0.084
#> GSM531691     2  0.3482     0.8389 0.000 0.872 0.128
#> GSM531692     2  0.1753     0.8649 0.000 0.952 0.048
#> GSM531694     2  0.3826     0.8844 0.124 0.868 0.008

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM531602     2  0.0188     0.8224 0.000 0.996 0.000 0.004
#> GSM531604     2  0.1792     0.8013 0.000 0.932 0.068 0.000
#> GSM531606     2  0.0188     0.8224 0.000 0.996 0.000 0.004
#> GSM531607     2  0.0188     0.8224 0.000 0.996 0.000 0.004
#> GSM531608     3  0.1302     0.7909 0.000 0.044 0.956 0.000
#> GSM531610     4  0.0000     0.9073 0.000 0.000 0.000 1.000
#> GSM531612     4  0.0000     0.9073 0.000 0.000 0.000 1.000
#> GSM531613     4  0.0000     0.9073 0.000 0.000 0.000 1.000
#> GSM531614     4  0.0000     0.9073 0.000 0.000 0.000 1.000
#> GSM531616     3  0.3726     0.6359 0.212 0.000 0.788 0.000
#> GSM531618     1  0.7202     0.3247 0.504 0.364 0.128 0.004
#> GSM531619     3  0.0000     0.8157 0.000 0.000 1.000 0.000
#> GSM531620     3  0.0000     0.8157 0.000 0.000 1.000 0.000
#> GSM531623     3  0.0000     0.8157 0.000 0.000 1.000 0.000
#> GSM531625     3  0.0000     0.8157 0.000 0.000 1.000 0.000
#> GSM531626     3  0.3649     0.6443 0.204 0.000 0.796 0.000
#> GSM531632     1  0.2868     0.6404 0.864 0.000 0.136 0.000
#> GSM531638     3  0.3726     0.6359 0.212 0.000 0.788 0.000
#> GSM531639     1  0.7216     0.2953 0.508 0.156 0.336 0.000
#> GSM531641     4  0.0000     0.9073 0.000 0.000 0.000 1.000
#> GSM531642     1  0.6324     0.5651 0.660 0.168 0.172 0.000
#> GSM531643     1  0.2760     0.6458 0.872 0.000 0.128 0.000
#> GSM531644     1  0.2760     0.6458 0.872 0.000 0.128 0.000
#> GSM531645     4  0.0000     0.9073 0.000 0.000 0.000 1.000
#> GSM531646     1  0.2868     0.6404 0.864 0.000 0.136 0.000
#> GSM531647     1  0.2868     0.6404 0.864 0.000 0.136 0.000
#> GSM531648     1  0.7335     0.5340 0.648 0.068 0.128 0.156
#> GSM531650     1  0.0000     0.6693 1.000 0.000 0.000 0.000
#> GSM531651     3  0.0000     0.8157 0.000 0.000 1.000 0.000
#> GSM531652     1  0.4664     0.6169 0.800 0.068 0.128 0.004
#> GSM531656     1  0.6826     0.5146 0.600 0.228 0.172 0.000
#> GSM531659     2  0.7136     0.1346 0.340 0.528 0.128 0.004
#> GSM531661     3  0.1389     0.7839 0.000 0.048 0.952 0.000
#> GSM531662     3  0.1389     0.7839 0.000 0.048 0.952 0.000
#> GSM531663     4  0.6913     0.5476 0.172 0.068 0.084 0.676
#> GSM531664     1  0.4277     0.4276 0.720 0.280 0.000 0.000
#> GSM531666     1  0.7050     0.4897 0.564 0.264 0.172 0.000
#> GSM531667     3  0.6376     0.4049 0.340 0.068 0.588 0.004
#> GSM531668     4  0.7711     0.1834 0.340 0.132 0.024 0.504
#> GSM531669     1  0.3649     0.5370 0.796 0.204 0.000 0.000
#> GSM531671     3  0.7110     0.0687 0.412 0.128 0.460 0.000
#> GSM531672     2  0.7136     0.1346 0.340 0.528 0.128 0.004
#> GSM531673     3  0.4307     0.7124 0.144 0.048 0.808 0.000
#> GSM531676     2  0.2530     0.7894 0.112 0.888 0.000 0.000
#> GSM531679     2  0.0000     0.8221 0.000 1.000 0.000 0.000
#> GSM531681     4  0.0188     0.9044 0.000 0.004 0.000 0.996
#> GSM531682     2  0.1576     0.8086 0.000 0.948 0.048 0.004
#> GSM531683     2  0.0188     0.8224 0.000 0.996 0.000 0.004
#> GSM531684     3  0.4164     0.5619 0.000 0.264 0.736 0.000
#> GSM531685     2  0.3024     0.7677 0.148 0.852 0.000 0.000
#> GSM531686     2  0.4624     0.4671 0.000 0.660 0.000 0.340
#> GSM531687     2  0.4095     0.7271 0.024 0.804 0.172 0.000
#> GSM531688     2  0.3610     0.7331 0.200 0.800 0.000 0.000
#> GSM531690     2  0.1724     0.8132 0.000 0.948 0.020 0.032
#> GSM531693     2  0.3649     0.7293 0.204 0.796 0.000 0.000
#> GSM531695     2  0.3528     0.7389 0.192 0.808 0.000 0.000
#> GSM531603     2  0.0188     0.8224 0.000 0.996 0.000 0.004
#> GSM531609     4  0.0000     0.9073 0.000 0.000 0.000 1.000
#> GSM531611     4  0.0707     0.8903 0.000 0.000 0.020 0.980
#> GSM531621     3  0.0000     0.8157 0.000 0.000 1.000 0.000
#> GSM531622     3  0.0000     0.8157 0.000 0.000 1.000 0.000
#> GSM531628     1  0.0000     0.6693 1.000 0.000 0.000 0.000
#> GSM531630     3  0.2868     0.7207 0.136 0.000 0.864 0.000
#> GSM531633     3  0.0000     0.8157 0.000 0.000 1.000 0.000
#> GSM531635     1  0.4454     0.5450 0.692 0.000 0.308 0.000
#> GSM531640     3  0.6180     0.4258 0.340 0.056 0.600 0.004
#> GSM531649     1  0.3400     0.6206 0.820 0.000 0.180 0.000
#> GSM531653     1  0.2868     0.6404 0.864 0.000 0.136 0.000
#> GSM531657     2  0.7136     0.1346 0.340 0.528 0.128 0.004
#> GSM531665     2  0.4410     0.7436 0.064 0.808 0.128 0.000
#> GSM531670     2  0.7408     0.0654 0.364 0.464 0.172 0.000
#> GSM531674     1  0.4624     0.2961 0.660 0.340 0.000 0.000
#> GSM531675     2  0.1576     0.8086 0.000 0.948 0.048 0.004
#> GSM531677     2  0.0188     0.8224 0.000 0.996 0.000 0.004
#> GSM531678     2  0.0000     0.8221 0.000 1.000 0.000 0.000
#> GSM531680     2  0.4274     0.7549 0.148 0.808 0.044 0.000
#> GSM531689     2  0.1888     0.8091 0.016 0.940 0.044 0.000
#> GSM531691     2  0.2730     0.7944 0.016 0.896 0.088 0.000
#> GSM531692     2  0.2131     0.8094 0.032 0.932 0.036 0.000
#> GSM531694     2  0.0188     0.8224 0.000 0.996 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
#> GSM531602     2  0.0162     0.9241 0.000 0.996 0.000 0.000 0.004
#> GSM531604     2  0.0290     0.9204 0.000 0.992 0.008 0.000 0.000
#> GSM531606     2  0.1430     0.8752 0.000 0.944 0.052 0.000 0.004
#> GSM531607     2  0.0000     0.9240 0.000 1.000 0.000 0.000 0.000
#> GSM531608     3  0.0000     0.9692 0.000 0.000 1.000 0.000 0.000
#> GSM531610     4  0.0000     0.8810 0.000 0.000 0.000 1.000 0.000
#> GSM531612     4  0.0000     0.8810 0.000 0.000 0.000 1.000 0.000
#> GSM531613     4  0.0000     0.8810 0.000 0.000 0.000 1.000 0.000
#> GSM531614     4  0.0000     0.8810 0.000 0.000 0.000 1.000 0.000
#> GSM531616     5  0.2179     0.8441 0.112 0.000 0.000 0.000 0.888
#> GSM531618     5  0.1205     0.8942 0.040 0.004 0.000 0.000 0.956
#> GSM531619     3  0.0000     0.9692 0.000 0.000 1.000 0.000 0.000
#> GSM531620     3  0.1357     0.9626 0.004 0.000 0.948 0.000 0.048
#> GSM531623     3  0.0000     0.9692 0.000 0.000 1.000 0.000 0.000
#> GSM531625     3  0.1357     0.9626 0.004 0.000 0.948 0.000 0.048
#> GSM531626     5  0.2464     0.8457 0.096 0.000 0.016 0.000 0.888
#> GSM531632     1  0.1197     0.8996 0.952 0.000 0.000 0.000 0.048
#> GSM531638     5  0.2074     0.8486 0.104 0.000 0.000 0.000 0.896
#> GSM531639     5  0.0162     0.8856 0.004 0.000 0.000 0.000 0.996
#> GSM531641     4  0.0000     0.8810 0.000 0.000 0.000 1.000 0.000
#> GSM531642     5  0.1357     0.8933 0.048 0.004 0.000 0.000 0.948
#> GSM531643     5  0.1478     0.8900 0.064 0.000 0.000 0.000 0.936
#> GSM531644     5  0.1270     0.8927 0.052 0.000 0.000 0.000 0.948
#> GSM531645     4  0.0000     0.8810 0.000 0.000 0.000 1.000 0.000
#> GSM531646     1  0.1197     0.8996 0.952 0.000 0.000 0.000 0.048
#> GSM531647     1  0.0000     0.9185 1.000 0.000 0.000 0.000 0.000
#> GSM531648     5  0.1197     0.8929 0.048 0.000 0.000 0.000 0.952
#> GSM531650     1  0.1851     0.8608 0.912 0.000 0.000 0.000 0.088
#> GSM531651     3  0.0000     0.9692 0.000 0.000 1.000 0.000 0.000
#> GSM531652     5  0.1197     0.8929 0.048 0.000 0.000 0.000 0.952
#> GSM531656     5  0.1270     0.8927 0.052 0.000 0.000 0.000 0.948
#> GSM531659     5  0.1197     0.8862 0.000 0.048 0.000 0.000 0.952
#> GSM531661     3  0.0000     0.9692 0.000 0.000 1.000 0.000 0.000
#> GSM531662     3  0.0000     0.9692 0.000 0.000 1.000 0.000 0.000
#> GSM531663     4  0.4273     0.1656 0.000 0.000 0.000 0.552 0.448
#> GSM531664     1  0.2179     0.8727 0.896 0.100 0.000 0.000 0.004
#> GSM531666     5  0.1357     0.8933 0.048 0.004 0.000 0.000 0.948
#> GSM531667     5  0.3039     0.7773 0.000 0.000 0.192 0.000 0.808
#> GSM531668     5  0.4147     0.7180 0.000 0.004 0.048 0.172 0.776
#> GSM531669     1  0.0162     0.9180 0.996 0.000 0.000 0.000 0.004
#> GSM531671     1  0.1557     0.8973 0.940 0.000 0.052 0.000 0.008
#> GSM531672     5  0.1197     0.8862 0.000 0.048 0.000 0.000 0.952
#> GSM531673     3  0.1121     0.9335 0.000 0.000 0.956 0.000 0.044
#> GSM531676     2  0.0609     0.9124 0.020 0.980 0.000 0.000 0.000
#> GSM531679     2  0.0000     0.9240 0.000 1.000 0.000 0.000 0.000
#> GSM531681     4  0.4304     0.0345 0.000 0.484 0.000 0.516 0.000
#> GSM531682     2  0.0290     0.9228 0.000 0.992 0.000 0.000 0.008
#> GSM531683     2  0.0000     0.9240 0.000 1.000 0.000 0.000 0.000
#> GSM531684     3  0.0000     0.9692 0.000 0.000 1.000 0.000 0.000
#> GSM531685     1  0.2813     0.8255 0.832 0.168 0.000 0.000 0.000
#> GSM531686     2  0.0404     0.9191 0.000 0.988 0.000 0.012 0.000
#> GSM531687     5  0.2813     0.7981 0.000 0.168 0.000 0.000 0.832
#> GSM531688     1  0.2813     0.8255 0.832 0.168 0.000 0.000 0.000
#> GSM531690     2  0.0162     0.9241 0.000 0.996 0.000 0.000 0.004
#> GSM531693     1  0.1410     0.9009 0.940 0.060 0.000 0.000 0.000
#> GSM531695     1  0.3003     0.8028 0.812 0.188 0.000 0.000 0.000
#> GSM531603     5  0.4304     0.1883 0.000 0.484 0.000 0.000 0.516
#> GSM531609     4  0.0000     0.8810 0.000 0.000 0.000 1.000 0.000
#> GSM531611     4  0.0794     0.8610 0.000 0.000 0.000 0.972 0.028
#> GSM531621     3  0.1357     0.9626 0.004 0.000 0.948 0.000 0.048
#> GSM531622     3  0.1357     0.9626 0.004 0.000 0.948 0.000 0.048
#> GSM531628     1  0.0162     0.9180 0.996 0.000 0.000 0.000 0.004
#> GSM531630     3  0.1270     0.9620 0.000 0.000 0.948 0.000 0.052
#> GSM531633     3  0.1357     0.9626 0.004 0.000 0.948 0.000 0.048
#> GSM531635     5  0.2329     0.8360 0.124 0.000 0.000 0.000 0.876
#> GSM531640     5  0.0162     0.8847 0.000 0.000 0.004 0.000 0.996
#> GSM531649     1  0.0000     0.9185 1.000 0.000 0.000 0.000 0.000
#> GSM531653     1  0.0000     0.9185 1.000 0.000 0.000 0.000 0.000
#> GSM531657     5  0.1197     0.8862 0.000 0.048 0.000 0.000 0.952
#> GSM531665     5  0.3810     0.7760 0.040 0.168 0.000 0.000 0.792
#> GSM531670     5  0.1270     0.8857 0.000 0.052 0.000 0.000 0.948
#> GSM531674     1  0.0162     0.9188 0.996 0.004 0.000 0.000 0.000
#> GSM531675     2  0.0162     0.9241 0.000 0.996 0.000 0.000 0.004
#> GSM531677     2  0.0162     0.9241 0.000 0.996 0.000 0.000 0.004
#> GSM531678     2  0.0162     0.9227 0.000 0.996 0.000 0.000 0.004
#> GSM531680     2  0.4135     0.4234 0.340 0.656 0.000 0.000 0.004
#> GSM531689     2  0.0000     0.9240 0.000 1.000 0.000 0.000 0.000
#> GSM531691     2  0.2329     0.7883 0.000 0.876 0.000 0.000 0.124
#> GSM531692     2  0.5668     0.0511 0.416 0.504 0.080 0.000 0.000
#> GSM531694     2  0.0162     0.9241 0.000 0.996 0.000 0.000 0.004

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>           class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM531602     2  0.4093      0.667 0.404 0.584 0.000 0.000 0.012 0.000
#> GSM531604     2  0.3548      0.494 0.068 0.812 0.008 0.000 0.112 0.000
#> GSM531606     2  0.5862      0.567 0.404 0.448 0.136 0.000 0.012 0.000
#> GSM531607     2  0.4093      0.667 0.404 0.584 0.000 0.000 0.012 0.000
#> GSM531608     3  0.0000      0.923 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM531610     4  0.0000      0.936 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM531612     4  0.0000      0.936 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM531613     4  0.0000      0.936 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM531614     4  0.0000      0.936 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM531616     6  0.2066      0.834 0.052 0.000 0.000 0.000 0.040 0.908
#> GSM531618     6  0.2255      0.882 0.088 0.016 0.000 0.000 0.004 0.892
#> GSM531619     3  0.0000      0.923 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM531620     3  0.2573      0.902 0.000 0.000 0.864 0.000 0.024 0.112
#> GSM531623     3  0.0000      0.923 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM531625     3  0.2573      0.902 0.000 0.000 0.864 0.000 0.024 0.112
#> GSM531626     6  0.1890      0.842 0.044 0.000 0.008 0.000 0.024 0.924
#> GSM531632     1  0.5389      0.823 0.460 0.000 0.000 0.000 0.428 0.112
#> GSM531638     6  0.1856      0.840 0.048 0.000 0.000 0.000 0.032 0.920
#> GSM531639     6  0.0000      0.864 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM531641     4  0.0000      0.936 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM531642     6  0.1957      0.879 0.112 0.000 0.000 0.000 0.000 0.888
#> GSM531643     6  0.2750      0.862 0.136 0.000 0.000 0.000 0.020 0.844
#> GSM531644     6  0.2100      0.879 0.112 0.000 0.000 0.000 0.004 0.884
#> GSM531645     4  0.0000      0.936 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM531646     1  0.5389      0.823 0.460 0.000 0.000 0.000 0.428 0.112
#> GSM531647     1  0.3765      0.931 0.596 0.000 0.000 0.000 0.404 0.000
#> GSM531648     6  0.2404      0.877 0.112 0.016 0.000 0.000 0.000 0.872
#> GSM531650     1  0.4584      0.895 0.556 0.000 0.000 0.000 0.404 0.040
#> GSM531651     3  0.0000      0.923 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM531652     6  0.2100      0.879 0.112 0.004 0.000 0.000 0.000 0.884
#> GSM531656     6  0.1957      0.879 0.112 0.000 0.000 0.000 0.000 0.888
#> GSM531659     6  0.2135      0.835 0.000 0.128 0.000 0.000 0.000 0.872
#> GSM531661     3  0.0000      0.923 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM531662     3  0.0260      0.920 0.000 0.000 0.992 0.000 0.008 0.000
#> GSM531663     4  0.4012      0.419 0.000 0.016 0.000 0.640 0.000 0.344
#> GSM531664     1  0.3975      0.887 0.544 0.000 0.000 0.000 0.452 0.004
#> GSM531666     6  0.1957      0.879 0.112 0.000 0.000 0.000 0.000 0.888
#> GSM531667     6  0.2793      0.783 0.000 0.000 0.200 0.000 0.000 0.800
#> GSM531668     6  0.5686      0.297 0.404 0.012 0.112 0.000 0.000 0.472
#> GSM531669     1  0.3765      0.931 0.596 0.000 0.000 0.000 0.404 0.000
#> GSM531671     1  0.5858      0.808 0.452 0.000 0.124 0.000 0.408 0.016
#> GSM531672     6  0.2404      0.837 0.000 0.016 0.000 0.000 0.112 0.872
#> GSM531673     3  0.1367      0.891 0.000 0.000 0.944 0.000 0.012 0.044
#> GSM531676     5  0.3996      0.682 0.008 0.352 0.000 0.000 0.636 0.004
#> GSM531679     2  0.0363      0.632 0.000 0.988 0.000 0.000 0.012 0.000
#> GSM531681     2  0.3823      0.303 0.000 0.564 0.000 0.436 0.000 0.000
#> GSM531682     2  0.0363      0.637 0.000 0.988 0.000 0.000 0.000 0.012
#> GSM531683     2  0.4093      0.667 0.404 0.584 0.000 0.000 0.012 0.000
#> GSM531684     3  0.0363      0.918 0.000 0.000 0.988 0.000 0.012 0.000
#> GSM531685     5  0.3578      0.683 0.000 0.340 0.000 0.000 0.660 0.000
#> GSM531686     2  0.3371      0.529 0.000 0.708 0.000 0.292 0.000 0.000
#> GSM531687     5  0.5221      0.652 0.000 0.328 0.000 0.000 0.560 0.112
#> GSM531688     5  0.4576     -0.696 0.400 0.040 0.000 0.000 0.560 0.000
#> GSM531690     2  0.0603      0.642 0.000 0.980 0.000 0.016 0.000 0.004
#> GSM531693     5  0.4028     -0.546 0.308 0.024 0.000 0.000 0.668 0.000
#> GSM531695     5  0.3650      0.644 0.012 0.280 0.000 0.000 0.708 0.000
#> GSM531603     5  0.4326      0.296 0.404 0.024 0.000 0.000 0.572 0.000
#> GSM531609     4  0.0000      0.936 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM531611     4  0.0632      0.914 0.000 0.000 0.000 0.976 0.000 0.024
#> GSM531621     3  0.2573      0.902 0.000 0.000 0.864 0.000 0.024 0.112
#> GSM531622     3  0.2573      0.902 0.000 0.000 0.864 0.000 0.024 0.112
#> GSM531628     1  0.3765      0.931 0.596 0.000 0.000 0.000 0.404 0.000
#> GSM531630     3  0.2219      0.898 0.000 0.000 0.864 0.000 0.000 0.136
#> GSM531633     3  0.2573      0.902 0.000 0.000 0.864 0.000 0.024 0.112
#> GSM531635     6  0.2066      0.834 0.052 0.000 0.000 0.000 0.040 0.908
#> GSM531640     6  0.0000      0.864 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM531649     1  0.3890      0.929 0.596 0.000 0.000 0.000 0.400 0.004
#> GSM531653     1  0.3765      0.931 0.596 0.000 0.000 0.000 0.404 0.000
#> GSM531657     6  0.2135      0.835 0.000 0.128 0.000 0.000 0.000 0.872
#> GSM531665     5  0.5520      0.578 0.000 0.240 0.000 0.000 0.560 0.200
#> GSM531670     6  0.1957      0.837 0.000 0.000 0.000 0.000 0.112 0.888
#> GSM531674     1  0.3765      0.931 0.596 0.000 0.000 0.000 0.404 0.000
#> GSM531675     2  0.0146      0.637 0.000 0.996 0.000 0.000 0.000 0.004
#> GSM531677     2  0.0000      0.636 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM531678     5  0.4856      0.665 0.000 0.360 0.000 0.000 0.572 0.068
#> GSM531680     5  0.4048      0.683 0.012 0.340 0.000 0.000 0.644 0.004
#> GSM531689     5  0.3937      0.636 0.000 0.424 0.000 0.000 0.572 0.004
#> GSM531691     5  0.4961      0.664 0.000 0.348 0.000 0.000 0.572 0.080
#> GSM531692     5  0.5629      0.575 0.000 0.324 0.148 0.000 0.524 0.004
#> GSM531694     2  0.3765      0.666 0.404 0.596 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-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)
#> Error in mat[ceiling(1:nr/h_ratio), ceiling(1:nc/w_ratio), drop = FALSE]: subscript out of bounds

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

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

collect_plots(res)

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.302           0.828       0.873         0.4519 0.495   0.495
#> 3 3 0.341           0.707       0.772         0.3375 0.732   0.517
#> 4 4 0.729           0.848       0.919         0.2189 0.824   0.545
#> 5 5 0.683           0.715       0.813         0.0432 0.960   0.853
#> 6 6 0.724           0.666       0.767         0.0619 0.916   0.682

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

suggest_best_k(res)
#> [1] 4

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

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

show/hide code output

cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#>           class entropy silhouette    p1    p2
#> GSM531602     2  0.1184      0.890 0.016 0.984
#> GSM531604     2  0.1184      0.890 0.016 0.984
#> GSM531606     2  0.1184      0.890 0.016 0.984
#> GSM531607     2  0.1184      0.890 0.016 0.984
#> GSM531608     1  0.6623      0.883 0.828 0.172
#> GSM531610     2  0.5178      0.864 0.116 0.884
#> GSM531612     2  0.5178      0.864 0.116 0.884
#> GSM531613     2  0.5178      0.864 0.116 0.884
#> GSM531614     2  0.5178      0.864 0.116 0.884
#> GSM531616     1  0.2948      0.844 0.948 0.052
#> GSM531618     2  0.7299      0.777 0.204 0.796
#> GSM531619     1  0.0672      0.822 0.992 0.008
#> GSM531620     1  0.0672      0.822 0.992 0.008
#> GSM531623     1  0.0672      0.822 0.992 0.008
#> GSM531625     1  0.0672      0.822 0.992 0.008
#> GSM531626     1  0.0672      0.822 0.992 0.008
#> GSM531632     1  0.6438      0.885 0.836 0.164
#> GSM531638     1  0.0672      0.822 0.992 0.008
#> GSM531639     1  0.6531      0.884 0.832 0.168
#> GSM531641     2  0.5178      0.864 0.116 0.884
#> GSM531642     1  0.6531      0.884 0.832 0.168
#> GSM531643     1  0.6531      0.884 0.832 0.168
#> GSM531644     1  0.6623      0.883 0.828 0.172
#> GSM531645     2  0.5178      0.864 0.116 0.884
#> GSM531646     1  0.6343      0.885 0.840 0.160
#> GSM531647     1  0.6343      0.885 0.840 0.160
#> GSM531648     2  0.5178      0.864 0.116 0.884
#> GSM531650     1  0.6343      0.885 0.840 0.160
#> GSM531651     1  0.0672      0.822 0.992 0.008
#> GSM531652     1  0.9460      0.577 0.636 0.364
#> GSM531656     1  0.6531      0.884 0.832 0.168
#> GSM531659     2  0.5629      0.863 0.132 0.868
#> GSM531661     1  0.6712      0.882 0.824 0.176
#> GSM531662     1  0.8207      0.816 0.744 0.256
#> GSM531663     2  0.5629      0.863 0.132 0.868
#> GSM531664     1  0.6438      0.885 0.836 0.164
#> GSM531666     1  0.6887      0.874 0.816 0.184
#> GSM531667     1  0.3733      0.853 0.928 0.072
#> GSM531668     2  0.5629      0.863 0.132 0.868
#> GSM531669     1  0.6712      0.880 0.824 0.176
#> GSM531671     1  0.7056      0.873 0.808 0.192
#> GSM531672     2  0.5629      0.863 0.132 0.868
#> GSM531673     1  0.8909      0.758 0.692 0.308
#> GSM531676     2  0.7602      0.647 0.220 0.780
#> GSM531679     2  0.1184      0.890 0.016 0.984
#> GSM531681     2  0.1184      0.890 0.016 0.984
#> GSM531682     2  0.1184      0.890 0.016 0.984
#> GSM531683     2  0.1184      0.890 0.016 0.984
#> GSM531684     2  0.1184      0.890 0.016 0.984
#> GSM531685     2  0.9427      0.271 0.360 0.640
#> GSM531686     2  0.1184      0.890 0.016 0.984
#> GSM531687     2  0.8267      0.562 0.260 0.740
#> GSM531688     1  0.9209      0.716 0.664 0.336
#> GSM531690     2  0.1184      0.890 0.016 0.984
#> GSM531693     1  0.8608      0.779 0.716 0.284
#> GSM531695     1  0.9970      0.421 0.532 0.468
#> GSM531603     2  0.1184      0.890 0.016 0.984
#> GSM531609     2  0.5178      0.864 0.116 0.884
#> GSM531611     2  0.5629      0.863 0.132 0.868
#> GSM531621     1  0.0672      0.822 0.992 0.008
#> GSM531622     1  0.0938      0.823 0.988 0.012
#> GSM531628     1  0.6343      0.885 0.840 0.160
#> GSM531630     1  0.0672      0.822 0.992 0.008
#> GSM531633     1  0.0672      0.822 0.992 0.008
#> GSM531635     1  0.6531      0.884 0.832 0.168
#> GSM531640     1  0.6623      0.883 0.828 0.172
#> GSM531649     1  0.6438      0.885 0.836 0.164
#> GSM531653     1  0.6343      0.885 0.840 0.160
#> GSM531657     2  0.5629      0.863 0.132 0.868
#> GSM531665     1  0.9580      0.597 0.620 0.380
#> GSM531670     1  0.6623      0.883 0.828 0.172
#> GSM531674     1  0.6438      0.885 0.836 0.164
#> GSM531675     2  0.1184      0.890 0.016 0.984
#> GSM531677     2  0.1184      0.890 0.016 0.984
#> GSM531678     2  0.1184      0.890 0.016 0.984
#> GSM531680     2  0.9522      0.215 0.372 0.628
#> GSM531689     2  0.1184      0.890 0.016 0.984
#> GSM531691     2  0.1184      0.890 0.016 0.984
#> GSM531692     2  0.4161      0.851 0.084 0.916
#> GSM531694     2  0.1184      0.890 0.016 0.984

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>           class entropy silhouette    p1    p2    p3
#> GSM531602     2  0.0424     0.8169 0.008 0.992 0.000
#> GSM531604     2  0.0000     0.8177 0.000 1.000 0.000
#> GSM531606     2  0.0000     0.8177 0.000 1.000 0.000
#> GSM531607     2  0.0424     0.8169 0.008 0.992 0.000
#> GSM531608     3  0.7692     0.5786 0.136 0.184 0.680
#> GSM531610     1  0.4796     0.7912 0.780 0.220 0.000
#> GSM531612     1  0.4702     0.7896 0.788 0.212 0.000
#> GSM531613     1  0.5244     0.7919 0.756 0.240 0.004
#> GSM531614     1  0.4702     0.7896 0.788 0.212 0.000
#> GSM531616     3  0.7816     0.7815 0.200 0.132 0.668
#> GSM531618     1  0.7622     0.7228 0.608 0.332 0.060
#> GSM531619     3  0.5109     0.7492 0.212 0.008 0.780
#> GSM531620     3  0.5536     0.7539 0.200 0.024 0.776
#> GSM531623     3  0.5109     0.7492 0.212 0.008 0.780
#> GSM531625     3  0.7657     0.7810 0.208 0.116 0.676
#> GSM531626     3  0.7843     0.7829 0.208 0.128 0.664
#> GSM531632     3  0.4676     0.8015 0.040 0.112 0.848
#> GSM531638     3  0.7816     0.7815 0.200 0.132 0.668
#> GSM531639     3  0.6685     0.7022 0.048 0.244 0.708
#> GSM531641     1  0.4702     0.7896 0.788 0.212 0.000
#> GSM531642     3  0.7012     0.6056 0.040 0.308 0.652
#> GSM531643     3  0.5094     0.7997 0.040 0.136 0.824
#> GSM531644     3  0.5875     0.7750 0.056 0.160 0.784
#> GSM531645     1  0.4702     0.7896 0.788 0.212 0.000
#> GSM531646     3  0.4891     0.8006 0.040 0.124 0.836
#> GSM531647     3  0.4676     0.8015 0.040 0.112 0.848
#> GSM531648     1  0.4931     0.7912 0.784 0.212 0.004
#> GSM531650     3  0.4676     0.8015 0.040 0.112 0.848
#> GSM531651     3  0.5109     0.7492 0.212 0.008 0.780
#> GSM531652     1  0.9663     0.4768 0.456 0.308 0.236
#> GSM531656     3  0.5094     0.7997 0.040 0.136 0.824
#> GSM531659     1  0.7163     0.7420 0.628 0.332 0.040
#> GSM531661     1  0.9355     0.0704 0.492 0.320 0.188
#> GSM531662     2  0.6521     0.2469 0.340 0.644 0.016
#> GSM531663     1  0.7163     0.7420 0.628 0.332 0.040
#> GSM531664     3  0.4676     0.8015 0.040 0.112 0.848
#> GSM531666     3  0.8582     0.4606 0.124 0.308 0.568
#> GSM531667     3  0.5541     0.7574 0.252 0.008 0.740
#> GSM531668     1  0.7163     0.7420 0.628 0.332 0.040
#> GSM531669     3  0.5637     0.7588 0.040 0.172 0.788
#> GSM531671     2  0.6255     0.3748 0.300 0.684 0.016
#> GSM531672     1  0.6482     0.7887 0.716 0.244 0.040
#> GSM531673     2  0.6057     0.2809 0.340 0.656 0.004
#> GSM531676     2  0.0424     0.8151 0.000 0.992 0.008
#> GSM531679     2  0.0237     0.8178 0.004 0.996 0.000
#> GSM531681     2  0.5650     0.2992 0.312 0.688 0.000
#> GSM531682     2  0.0237     0.8178 0.004 0.996 0.000
#> GSM531683     2  0.0424     0.8169 0.008 0.992 0.000
#> GSM531684     2  0.4931     0.5298 0.232 0.768 0.000
#> GSM531685     2  0.1031     0.8041 0.000 0.976 0.024
#> GSM531686     2  0.5650     0.2992 0.312 0.688 0.000
#> GSM531687     2  0.0237     0.8166 0.000 0.996 0.004
#> GSM531688     2  0.1411     0.7961 0.000 0.964 0.036
#> GSM531690     2  0.5650     0.2992 0.312 0.688 0.000
#> GSM531693     2  0.4291     0.6207 0.000 0.820 0.180
#> GSM531695     2  0.1411     0.7961 0.000 0.964 0.036
#> GSM531603     2  0.3816     0.6776 0.148 0.852 0.000
#> GSM531609     1  0.4702     0.7896 0.788 0.212 0.000
#> GSM531611     1  0.7163     0.7420 0.628 0.332 0.040
#> GSM531621     3  0.5109     0.7492 0.212 0.008 0.780
#> GSM531622     3  0.5109     0.7492 0.212 0.008 0.780
#> GSM531628     3  0.4676     0.8015 0.040 0.112 0.848
#> GSM531630     3  0.5109     0.7492 0.212 0.008 0.780
#> GSM531633     3  0.5109     0.7492 0.212 0.008 0.780
#> GSM531635     3  0.5028     0.8010 0.040 0.132 0.828
#> GSM531640     3  0.5109     0.7492 0.212 0.008 0.780
#> GSM531649     3  0.5028     0.8010 0.040 0.132 0.828
#> GSM531653     3  0.4676     0.8015 0.040 0.112 0.848
#> GSM531657     1  0.7163     0.7420 0.628 0.332 0.040
#> GSM531665     2  0.7353     0.1651 0.316 0.632 0.052
#> GSM531670     3  0.5094     0.7997 0.040 0.136 0.824
#> GSM531674     3  0.4891     0.7967 0.040 0.124 0.836
#> GSM531675     2  0.5650     0.2992 0.312 0.688 0.000
#> GSM531677     2  0.0237     0.8178 0.004 0.996 0.000
#> GSM531678     2  0.0424     0.8169 0.008 0.992 0.000
#> GSM531680     2  0.0747     0.8109 0.000 0.984 0.016
#> GSM531689     2  0.0000     0.8177 0.000 1.000 0.000
#> GSM531691     2  0.0000     0.8177 0.000 1.000 0.000
#> GSM531692     2  0.1129     0.8038 0.020 0.976 0.004
#> GSM531694     2  0.0424     0.8169 0.008 0.992 0.000

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM531602     2  0.0000      0.939 0.000 1.000 0.000 0.000
#> GSM531604     2  0.0000      0.939 0.000 1.000 0.000 0.000
#> GSM531606     2  0.0000      0.939 0.000 1.000 0.000 0.000
#> GSM531607     2  0.0000      0.939 0.000 1.000 0.000 0.000
#> GSM531608     3  0.0000      0.921 0.000 0.000 1.000 0.000
#> GSM531610     4  0.0000      0.873 0.000 0.000 0.000 1.000
#> GSM531612     4  0.0000      0.873 0.000 0.000 0.000 1.000
#> GSM531613     4  0.0000      0.873 0.000 0.000 0.000 1.000
#> GSM531614     4  0.0000      0.873 0.000 0.000 0.000 1.000
#> GSM531616     3  0.0000      0.921 0.000 0.000 1.000 0.000
#> GSM531618     4  0.3837      0.805 0.000 0.000 0.224 0.776
#> GSM531619     3  0.0000      0.921 0.000 0.000 1.000 0.000
#> GSM531620     3  0.0000      0.921 0.000 0.000 1.000 0.000
#> GSM531623     3  0.0000      0.921 0.000 0.000 1.000 0.000
#> GSM531625     3  0.0000      0.921 0.000 0.000 1.000 0.000
#> GSM531626     3  0.0000      0.921 0.000 0.000 1.000 0.000
#> GSM531632     1  0.0000      0.862 1.000 0.000 0.000 0.000
#> GSM531638     3  0.0000      0.921 0.000 0.000 1.000 0.000
#> GSM531639     3  0.4877      0.121 0.408 0.000 0.592 0.000
#> GSM531641     4  0.0000      0.873 0.000 0.000 0.000 1.000
#> GSM531642     1  0.4072      0.758 0.748 0.000 0.252 0.000
#> GSM531643     1  0.3266      0.836 0.832 0.000 0.168 0.000
#> GSM531644     1  0.3668      0.826 0.808 0.000 0.188 0.004
#> GSM531645     4  0.0000      0.873 0.000 0.000 0.000 1.000
#> GSM531646     1  0.0469      0.864 0.988 0.000 0.012 0.000
#> GSM531647     1  0.0336      0.864 0.992 0.000 0.008 0.000
#> GSM531648     4  0.1716      0.870 0.000 0.000 0.064 0.936
#> GSM531650     1  0.0000      0.862 1.000 0.000 0.000 0.000
#> GSM531651     3  0.0000      0.921 0.000 0.000 1.000 0.000
#> GSM531652     1  0.4095      0.818 0.792 0.000 0.192 0.016
#> GSM531656     1  0.3610      0.819 0.800 0.000 0.200 0.000
#> GSM531659     4  0.5653      0.767 0.000 0.096 0.192 0.712
#> GSM531661     3  0.0707      0.898 0.000 0.020 0.980 0.000
#> GSM531662     3  0.3356      0.688 0.000 0.176 0.824 0.000
#> GSM531663     4  0.3528      0.835 0.000 0.000 0.192 0.808
#> GSM531664     1  0.0000      0.862 1.000 0.000 0.000 0.000
#> GSM531666     1  0.3610      0.819 0.800 0.000 0.200 0.000
#> GSM531667     3  0.0000      0.921 0.000 0.000 1.000 0.000
#> GSM531668     4  0.5212      0.798 0.000 0.068 0.192 0.740
#> GSM531669     1  0.0000      0.862 1.000 0.000 0.000 0.000
#> GSM531671     3  0.7526      0.126 0.332 0.200 0.468 0.000
#> GSM531672     4  0.3528      0.835 0.000 0.000 0.192 0.808
#> GSM531673     2  0.4103      0.660 0.000 0.744 0.256 0.000
#> GSM531676     2  0.0000      0.939 0.000 1.000 0.000 0.000
#> GSM531679     2  0.0000      0.939 0.000 1.000 0.000 0.000
#> GSM531681     2  0.3837      0.723 0.000 0.776 0.000 0.224
#> GSM531682     2  0.0000      0.939 0.000 1.000 0.000 0.000
#> GSM531683     2  0.0000      0.939 0.000 1.000 0.000 0.000
#> GSM531684     2  0.0000      0.939 0.000 1.000 0.000 0.000
#> GSM531685     2  0.3726      0.725 0.212 0.788 0.000 0.000
#> GSM531686     2  0.1118      0.915 0.000 0.964 0.000 0.036
#> GSM531687     2  0.0000      0.939 0.000 1.000 0.000 0.000
#> GSM531688     1  0.3528      0.762 0.808 0.192 0.000 0.000
#> GSM531690     2  0.3610      0.752 0.000 0.800 0.000 0.200
#> GSM531693     1  0.3569      0.758 0.804 0.196 0.000 0.000
#> GSM531695     1  0.3610      0.754 0.800 0.200 0.000 0.000
#> GSM531603     2  0.0000      0.939 0.000 1.000 0.000 0.000
#> GSM531609     4  0.0000      0.873 0.000 0.000 0.000 1.000
#> GSM531611     4  0.3528      0.835 0.000 0.000 0.192 0.808
#> GSM531621     3  0.0000      0.921 0.000 0.000 1.000 0.000
#> GSM531622     3  0.0000      0.921 0.000 0.000 1.000 0.000
#> GSM531628     1  0.0000      0.862 1.000 0.000 0.000 0.000
#> GSM531630     3  0.0000      0.921 0.000 0.000 1.000 0.000
#> GSM531633     3  0.0000      0.921 0.000 0.000 1.000 0.000
#> GSM531635     1  0.3610      0.819 0.800 0.000 0.200 0.000
#> GSM531640     3  0.0000      0.921 0.000 0.000 1.000 0.000
#> GSM531649     1  0.2704      0.851 0.876 0.000 0.124 0.000
#> GSM531653     1  0.0336      0.864 0.992 0.000 0.008 0.000
#> GSM531657     4  0.3528      0.835 0.000 0.000 0.192 0.808
#> GSM531665     2  0.6163      0.576 0.160 0.676 0.164 0.000
#> GSM531670     1  0.3610      0.819 0.800 0.000 0.200 0.000
#> GSM531674     1  0.0000      0.862 1.000 0.000 0.000 0.000
#> GSM531675     2  0.0000      0.939 0.000 1.000 0.000 0.000
#> GSM531677     2  0.0000      0.939 0.000 1.000 0.000 0.000
#> GSM531678     2  0.0000      0.939 0.000 1.000 0.000 0.000
#> GSM531680     2  0.2647      0.840 0.120 0.880 0.000 0.000
#> GSM531689     2  0.0000      0.939 0.000 1.000 0.000 0.000
#> GSM531691     2  0.0000      0.939 0.000 1.000 0.000 0.000
#> GSM531692     2  0.0000      0.939 0.000 1.000 0.000 0.000
#> GSM531694     2  0.0000      0.939 0.000 1.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
#> GSM531602     2  0.0703     0.7990 0.000 0.976 0.000 0.000 NA
#> GSM531604     2  0.2648     0.7800 0.000 0.848 0.000 0.000 NA
#> GSM531606     2  0.0404     0.8059 0.000 0.988 0.000 0.000 NA
#> GSM531607     2  0.0000     0.8058 0.000 1.000 0.000 0.000 NA
#> GSM531608     3  0.1341     0.8617 0.000 0.056 0.944 0.000 NA
#> GSM531610     4  0.1908     0.7867 0.000 0.000 0.000 0.908 NA
#> GSM531612     4  0.1908     0.7867 0.000 0.000 0.000 0.908 NA
#> GSM531613     4  0.0963     0.7932 0.000 0.036 0.000 0.964 NA
#> GSM531614     4  0.1908     0.7867 0.000 0.000 0.000 0.908 NA
#> GSM531616     3  0.4088     0.6342 0.000 0.000 0.632 0.000 NA
#> GSM531618     4  0.7075     0.5054 0.000 0.260 0.068 0.536 NA
#> GSM531619     3  0.0000     0.9038 0.000 0.000 1.000 0.000 NA
#> GSM531620     3  0.1043     0.8893 0.000 0.000 0.960 0.000 NA
#> GSM531623     3  0.0000     0.9038 0.000 0.000 1.000 0.000 NA
#> GSM531625     3  0.0000     0.9038 0.000 0.000 1.000 0.000 NA
#> GSM531626     3  0.3707     0.7343 0.000 0.000 0.716 0.000 NA
#> GSM531632     1  0.0000     0.7434 1.000 0.000 0.000 0.000 NA
#> GSM531638     3  0.3274     0.7898 0.000 0.000 0.780 0.000 NA
#> GSM531639     1  0.6638     0.4891 0.452 0.000 0.276 0.000 NA
#> GSM531641     4  0.1908     0.7867 0.000 0.000 0.000 0.908 NA
#> GSM531642     1  0.8413     0.5843 0.448 0.060 0.156 0.068 NA
#> GSM531643     1  0.7056     0.6453 0.548 0.012 0.064 0.092 NA
#> GSM531644     1  0.7370     0.6336 0.528 0.024 0.064 0.096 NA
#> GSM531645     4  0.1908     0.7867 0.000 0.000 0.000 0.908 NA
#> GSM531646     1  0.0703     0.7423 0.976 0.000 0.000 0.000 NA
#> GSM531647     1  0.0000     0.7434 1.000 0.000 0.000 0.000 NA
#> GSM531648     4  0.1195     0.7829 0.000 0.012 0.000 0.960 NA
#> GSM531650     1  0.0000     0.7434 1.000 0.000 0.000 0.000 NA
#> GSM531651     3  0.0000     0.9038 0.000 0.000 1.000 0.000 NA
#> GSM531652     1  0.8164     0.5549 0.448 0.036 0.068 0.160 NA
#> GSM531656     1  0.6285     0.5948 0.536 0.000 0.220 0.000 NA
#> GSM531659     4  0.5340     0.5919 0.000 0.288 0.036 0.648 NA
#> GSM531661     3  0.2127     0.8014 0.000 0.108 0.892 0.000 NA
#> GSM531662     3  0.4238     0.2880 0.000 0.368 0.628 0.000 NA
#> GSM531663     4  0.4573     0.6527 0.000 0.260 0.008 0.704 NA
#> GSM531664     1  0.0000     0.7434 1.000 0.000 0.000 0.000 NA
#> GSM531666     1  0.7985     0.6006 0.488 0.060 0.068 0.096 NA
#> GSM531667     3  0.0162     0.9016 0.000 0.004 0.996 0.000 NA
#> GSM531668     4  0.4796     0.6006 0.000 0.300 0.008 0.664 NA
#> GSM531669     1  0.0000     0.7434 1.000 0.000 0.000 0.000 NA
#> GSM531671     2  0.7705     0.2007 0.060 0.392 0.312 0.000 NA
#> GSM531672     4  0.3183     0.7810 0.000 0.108 0.008 0.856 NA
#> GSM531673     2  0.5255     0.5288 0.000 0.624 0.304 0.000 NA
#> GSM531676     2  0.4060     0.6747 0.000 0.640 0.000 0.000 NA
#> GSM531679     2  0.0000     0.8058 0.000 1.000 0.000 0.000 NA
#> GSM531681     2  0.3016     0.6980 0.000 0.848 0.000 0.132 NA
#> GSM531682     2  0.0000     0.8058 0.000 1.000 0.000 0.000 NA
#> GSM531683     2  0.0000     0.8058 0.000 1.000 0.000 0.000 NA
#> GSM531684     2  0.0880     0.8040 0.000 0.968 0.000 0.000 NA
#> GSM531685     2  0.6296     0.5443 0.160 0.480 0.000 0.000 NA
#> GSM531686     2  0.1943     0.7707 0.000 0.924 0.000 0.056 NA
#> GSM531687     2  0.4151     0.6803 0.004 0.652 0.000 0.000 NA
#> GSM531688     1  0.6622     0.0837 0.440 0.232 0.000 0.000 NA
#> GSM531690     2  0.3151     0.6814 0.000 0.836 0.000 0.144 NA
#> GSM531693     1  0.5987     0.3524 0.544 0.132 0.000 0.000 NA
#> GSM531695     2  0.6767     0.3676 0.280 0.392 0.000 0.000 NA
#> GSM531603     2  0.0000     0.8058 0.000 1.000 0.000 0.000 NA
#> GSM531609     4  0.1908     0.7867 0.000 0.000 0.000 0.908 NA
#> GSM531611     4  0.3077     0.7828 0.000 0.100 0.008 0.864 NA
#> GSM531621     3  0.0000     0.9038 0.000 0.000 1.000 0.000 NA
#> GSM531622     3  0.0000     0.9038 0.000 0.000 1.000 0.000 NA
#> GSM531628     1  0.0000     0.7434 1.000 0.000 0.000 0.000 NA
#> GSM531630     3  0.0000     0.9038 0.000 0.000 1.000 0.000 NA
#> GSM531633     3  0.0000     0.9038 0.000 0.000 1.000 0.000 NA
#> GSM531635     1  0.5668     0.6637 0.624 0.000 0.144 0.000 NA
#> GSM531640     3  0.0000     0.9038 0.000 0.000 1.000 0.000 NA
#> GSM531649     1  0.2659     0.7360 0.888 0.000 0.060 0.000 NA
#> GSM531653     1  0.0000     0.7434 1.000 0.000 0.000 0.000 NA
#> GSM531657     4  0.4573     0.6527 0.000 0.260 0.008 0.704 NA
#> GSM531665     2  0.5887     0.6268 0.024 0.580 0.064 0.000 NA
#> GSM531670     1  0.6285     0.5948 0.536 0.000 0.220 0.000 NA
#> GSM531674     1  0.0000     0.7434 1.000 0.000 0.000 0.000 NA
#> GSM531675     2  0.0609     0.8028 0.000 0.980 0.000 0.000 NA
#> GSM531677     2  0.0609     0.8028 0.000 0.980 0.000 0.000 NA
#> GSM531678     2  0.0000     0.8058 0.000 1.000 0.000 0.000 NA
#> GSM531680     2  0.5644     0.6242 0.096 0.576 0.000 0.000 NA
#> GSM531689     2  0.2471     0.7836 0.000 0.864 0.000 0.000 NA
#> GSM531691     2  0.2690     0.7785 0.000 0.844 0.000 0.000 NA
#> GSM531692     2  0.4045     0.6776 0.000 0.644 0.000 0.000 NA
#> GSM531694     2  0.0703     0.7990 0.000 0.976 0.000 0.000 NA

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>           class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM531602     2  0.0692      0.729 0.000 0.976 0.000 0.000 0.020 0.004
#> GSM531604     2  0.6044     -0.709 0.000 0.376 0.000 0.000 0.252 0.372
#> GSM531606     2  0.4453     -0.100 0.000 0.592 0.000 0.000 0.036 0.372
#> GSM531607     2  0.0937      0.735 0.000 0.960 0.000 0.000 0.040 0.000
#> GSM531608     3  0.2320      0.774 0.000 0.004 0.864 0.000 0.000 0.132
#> GSM531610     4  0.0000      0.838 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM531612     4  0.0000      0.838 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM531613     4  0.0458      0.838 0.000 0.000 0.000 0.984 0.000 0.016
#> GSM531614     4  0.0000      0.838 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM531616     3  0.4120      0.654 0.008 0.000 0.692 0.000 0.024 0.276
#> GSM531618     4  0.6402      0.551 0.020 0.096 0.040 0.496 0.000 0.348
#> GSM531619     3  0.0632      0.852 0.000 0.000 0.976 0.000 0.000 0.024
#> GSM531620     3  0.1082      0.847 0.000 0.000 0.956 0.000 0.004 0.040
#> GSM531623     3  0.0000      0.860 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM531625     3  0.0146      0.859 0.000 0.000 0.996 0.000 0.000 0.004
#> GSM531626     3  0.3619      0.710 0.000 0.000 0.744 0.000 0.024 0.232
#> GSM531632     1  0.0000      0.718 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM531638     3  0.3168      0.762 0.000 0.000 0.804 0.000 0.024 0.172
#> GSM531639     1  0.6384      0.600 0.460 0.000 0.236 0.000 0.024 0.280
#> GSM531641     4  0.0000      0.838 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM531642     1  0.5779      0.669 0.512 0.004 0.180 0.000 0.000 0.304
#> GSM531643     1  0.5578      0.687 0.544 0.004 0.124 0.004 0.000 0.324
#> GSM531644     1  0.5711      0.680 0.528 0.004 0.124 0.008 0.000 0.336
#> GSM531645     4  0.0000      0.838 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM531646     1  0.0790      0.722 0.968 0.000 0.000 0.000 0.000 0.032
#> GSM531647     1  0.0000      0.718 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM531648     4  0.2400      0.832 0.000 0.004 0.008 0.872 0.000 0.116
#> GSM531650     1  0.0000      0.718 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM531651     3  0.0000      0.860 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM531652     1  0.6254      0.662 0.504 0.004 0.124 0.040 0.000 0.328
#> GSM531656     1  0.6067      0.675 0.532 0.000 0.184 0.000 0.024 0.260
#> GSM531659     4  0.6053      0.681 0.000 0.140 0.024 0.596 0.020 0.220
#> GSM531661     3  0.0405      0.855 0.000 0.008 0.988 0.000 0.004 0.000
#> GSM531662     3  0.6155      0.239 0.000 0.196 0.588 0.000 0.076 0.140
#> GSM531663     4  0.4508      0.797 0.000 0.048 0.008 0.716 0.012 0.216
#> GSM531664     1  0.0000      0.718 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM531666     1  0.5656      0.671 0.512 0.004 0.124 0.004 0.000 0.356
#> GSM531667     3  0.1714      0.812 0.000 0.000 0.908 0.000 0.000 0.092
#> GSM531668     4  0.5925      0.671 0.000 0.152 0.008 0.580 0.020 0.240
#> GSM531669     1  0.0260      0.712 0.992 0.000 0.000 0.000 0.008 0.000
#> GSM531671     3  0.7894     -0.268 0.040 0.140 0.364 0.000 0.312 0.144
#> GSM531672     4  0.4266      0.804 0.000 0.028 0.008 0.732 0.016 0.216
#> GSM531673     6  0.7344      0.658 0.000 0.272 0.128 0.000 0.216 0.384
#> GSM531676     5  0.3287      0.522 0.012 0.220 0.000 0.000 0.768 0.000
#> GSM531679     2  0.1387      0.730 0.000 0.932 0.000 0.000 0.068 0.000
#> GSM531681     2  0.3404      0.665 0.000 0.760 0.000 0.000 0.224 0.016
#> GSM531682     2  0.1863      0.710 0.000 0.896 0.000 0.000 0.104 0.000
#> GSM531683     2  0.0260      0.734 0.000 0.992 0.000 0.000 0.008 0.000
#> GSM531684     2  0.4514     -0.114 0.000 0.588 0.000 0.000 0.040 0.372
#> GSM531685     5  0.3946      0.635 0.076 0.168 0.000 0.000 0.756 0.000
#> GSM531686     2  0.3404      0.665 0.000 0.760 0.000 0.000 0.224 0.016
#> GSM531687     5  0.3023      0.519 0.004 0.212 0.000 0.000 0.784 0.000
#> GSM531688     5  0.4247      0.582 0.296 0.040 0.000 0.000 0.664 0.000
#> GSM531690     2  0.3404      0.665 0.000 0.760 0.000 0.000 0.224 0.016
#> GSM531693     5  0.4105      0.529 0.348 0.020 0.000 0.000 0.632 0.000
#> GSM531695     5  0.4506      0.667 0.176 0.120 0.000 0.000 0.704 0.000
#> GSM531603     2  0.0146      0.730 0.000 0.996 0.000 0.000 0.000 0.004
#> GSM531609     4  0.0000      0.838 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM531611     4  0.3783      0.816 0.000 0.028 0.028 0.788 0.000 0.156
#> GSM531621     3  0.0000      0.860 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM531622     3  0.0000      0.860 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM531628     1  0.0000      0.718 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM531630     3  0.0000      0.860 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM531633     3  0.0000      0.860 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM531635     1  0.5582      0.702 0.608 0.000 0.132 0.000 0.024 0.236
#> GSM531640     3  0.1863      0.804 0.000 0.000 0.896 0.000 0.000 0.104
#> GSM531649     1  0.2383      0.722 0.880 0.000 0.024 0.000 0.000 0.096
#> GSM531653     1  0.0000      0.718 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM531657     4  0.4929      0.780 0.000 0.064 0.008 0.688 0.020 0.220
#> GSM531665     6  0.7584      0.466 0.024 0.164 0.120 0.000 0.272 0.420
#> GSM531670     1  0.6050      0.676 0.536 0.000 0.184 0.000 0.024 0.256
#> GSM531674     1  0.0146      0.716 0.996 0.000 0.000 0.000 0.004 0.000
#> GSM531675     2  0.3404      0.665 0.000 0.760 0.000 0.000 0.224 0.016
#> GSM531677     2  0.1814      0.727 0.000 0.900 0.000 0.000 0.100 0.000
#> GSM531678     2  0.0000      0.731 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM531680     5  0.4261      0.669 0.112 0.156 0.000 0.000 0.732 0.000
#> GSM531689     2  0.3653      0.327 0.000 0.692 0.000 0.000 0.300 0.008
#> GSM531691     6  0.6104      0.684 0.000 0.292 0.000 0.000 0.336 0.372
#> GSM531692     6  0.6087      0.678 0.000 0.276 0.000 0.000 0.352 0.372
#> GSM531694     2  0.0692      0.729 0.000 0.976 0.000 0.000 0.020 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-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 disease.state(p) k
#> SD:mclust 77            1.000 2
#> SD:mclust 69            0.530 3
#> SD:mclust 78            0.598 4
#> SD:mclust 74            0.631 5
#> SD:mclust 73            0.560 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 51941 rows and 80 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.851           0.923       0.967         0.5018 0.495   0.495
#> 3 3 0.521           0.672       0.809         0.3265 0.745   0.529
#> 4 4 0.873           0.892       0.953         0.1346 0.803   0.491
#> 5 5 0.732           0.719       0.858         0.0542 0.915   0.682
#> 6 6 0.700           0.562       0.764         0.0388 0.941   0.747

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
#> GSM531602     2  0.0000      0.941 0.000 1.000
#> GSM531604     2  0.2236      0.915 0.036 0.964
#> GSM531606     2  0.0000      0.941 0.000 1.000
#> GSM531607     2  0.0000      0.941 0.000 1.000
#> GSM531608     2  0.9896      0.220 0.440 0.560
#> GSM531610     2  0.0000      0.941 0.000 1.000
#> GSM531612     2  0.0000      0.941 0.000 1.000
#> GSM531613     2  0.0000      0.941 0.000 1.000
#> GSM531614     2  0.0000      0.941 0.000 1.000
#> GSM531616     1  0.0000      0.984 1.000 0.000
#> GSM531618     2  0.9909      0.209 0.444 0.556
#> GSM531619     1  0.0376      0.981 0.996 0.004
#> GSM531620     1  0.0000      0.984 1.000 0.000
#> GSM531623     1  0.0000      0.984 1.000 0.000
#> GSM531625     1  0.0000      0.984 1.000 0.000
#> GSM531626     1  0.0000      0.984 1.000 0.000
#> GSM531632     1  0.0000      0.984 1.000 0.000
#> GSM531638     1  0.0000      0.984 1.000 0.000
#> GSM531639     1  0.0000      0.984 1.000 0.000
#> GSM531641     2  0.0000      0.941 0.000 1.000
#> GSM531642     1  0.0000      0.984 1.000 0.000
#> GSM531643     1  0.0000      0.984 1.000 0.000
#> GSM531644     1  0.0000      0.984 1.000 0.000
#> GSM531645     2  0.0000      0.941 0.000 1.000
#> GSM531646     1  0.0000      0.984 1.000 0.000
#> GSM531647     1  0.0000      0.984 1.000 0.000
#> GSM531648     2  0.0000      0.941 0.000 1.000
#> GSM531650     1  0.0000      0.984 1.000 0.000
#> GSM531651     1  0.0000      0.984 1.000 0.000
#> GSM531652     1  0.0000      0.984 1.000 0.000
#> GSM531656     1  0.0000      0.984 1.000 0.000
#> GSM531659     2  0.0000      0.941 0.000 1.000
#> GSM531661     1  0.0376      0.981 0.996 0.004
#> GSM531662     1  0.0000      0.984 1.000 0.000
#> GSM531663     2  0.0000      0.941 0.000 1.000
#> GSM531664     1  0.0000      0.984 1.000 0.000
#> GSM531666     1  0.2778      0.942 0.952 0.048
#> GSM531667     1  0.6247      0.808 0.844 0.156
#> GSM531668     2  0.0000      0.941 0.000 1.000
#> GSM531669     1  0.0000      0.984 1.000 0.000
#> GSM531671     1  0.0000      0.984 1.000 0.000
#> GSM531672     2  0.0000      0.941 0.000 1.000
#> GSM531673     1  0.3879      0.912 0.924 0.076
#> GSM531676     2  0.9286      0.526 0.344 0.656
#> GSM531679     2  0.0000      0.941 0.000 1.000
#> GSM531681     2  0.0000      0.941 0.000 1.000
#> GSM531682     2  0.0000      0.941 0.000 1.000
#> GSM531683     2  0.0000      0.941 0.000 1.000
#> GSM531684     2  0.0000      0.941 0.000 1.000
#> GSM531685     1  0.0000      0.984 1.000 0.000
#> GSM531686     2  0.0000      0.941 0.000 1.000
#> GSM531687     2  0.7376      0.750 0.208 0.792
#> GSM531688     1  0.1184      0.971 0.984 0.016
#> GSM531690     2  0.0000      0.941 0.000 1.000
#> GSM531693     1  0.0000      0.984 1.000 0.000
#> GSM531695     2  0.7219      0.760 0.200 0.800
#> GSM531603     2  0.0000      0.941 0.000 1.000
#> GSM531609     2  0.0000      0.941 0.000 1.000
#> GSM531611     2  0.0000      0.941 0.000 1.000
#> GSM531621     1  0.0000      0.984 1.000 0.000
#> GSM531622     1  0.0000      0.984 1.000 0.000
#> GSM531628     1  0.0000      0.984 1.000 0.000
#> GSM531630     1  0.0000      0.984 1.000 0.000
#> GSM531633     1  0.0000      0.984 1.000 0.000
#> GSM531635     1  0.0000      0.984 1.000 0.000
#> GSM531640     1  0.5059      0.867 0.888 0.112
#> GSM531649     1  0.0000      0.984 1.000 0.000
#> GSM531653     1  0.0000      0.984 1.000 0.000
#> GSM531657     2  0.0000      0.941 0.000 1.000
#> GSM531665     1  0.6343      0.801 0.840 0.160
#> GSM531670     1  0.0000      0.984 1.000 0.000
#> GSM531674     1  0.0000      0.984 1.000 0.000
#> GSM531675     2  0.0000      0.941 0.000 1.000
#> GSM531677     2  0.0000      0.941 0.000 1.000
#> GSM531678     2  0.0000      0.941 0.000 1.000
#> GSM531680     2  0.7219      0.760 0.200 0.800
#> GSM531689     2  0.0000      0.941 0.000 1.000
#> GSM531691     2  0.7219      0.760 0.200 0.800
#> GSM531692     1  0.1843      0.961 0.972 0.028
#> GSM531694     2  0.0000      0.941 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
#> GSM531602     2  0.5650     0.8006 0.000 0.688 0.312
#> GSM531604     3  0.3340     0.4333 0.000 0.120 0.880
#> GSM531606     2  0.5785     0.7864 0.000 0.668 0.332
#> GSM531607     2  0.5650     0.8006 0.000 0.688 0.312
#> GSM531608     3  0.1411     0.6427 0.036 0.000 0.964
#> GSM531610     2  0.0000     0.7644 0.000 1.000 0.000
#> GSM531612     2  0.0592     0.7549 0.012 0.988 0.000
#> GSM531613     2  0.0000     0.7644 0.000 1.000 0.000
#> GSM531614     2  0.0000     0.7644 0.000 1.000 0.000
#> GSM531616     1  0.5098     0.3542 0.752 0.000 0.248
#> GSM531618     2  0.7447     0.4028 0.160 0.700 0.140
#> GSM531619     3  0.5650     0.7701 0.312 0.000 0.688
#> GSM531620     3  0.5650     0.7701 0.312 0.000 0.688
#> GSM531623     3  0.5650     0.7701 0.312 0.000 0.688
#> GSM531625     3  0.5650     0.7701 0.312 0.000 0.688
#> GSM531626     3  0.5650     0.7701 0.312 0.000 0.688
#> GSM531632     1  0.0000     0.7509 1.000 0.000 0.000
#> GSM531638     3  0.5650     0.7701 0.312 0.000 0.688
#> GSM531639     3  0.6305     0.4938 0.484 0.000 0.516
#> GSM531641     2  0.0000     0.7644 0.000 1.000 0.000
#> GSM531642     1  0.5115     0.7215 0.796 0.188 0.016
#> GSM531643     1  0.4121     0.7312 0.832 0.168 0.000
#> GSM531644     1  0.5650     0.6440 0.688 0.312 0.000
#> GSM531645     2  0.2959     0.6601 0.100 0.900 0.000
#> GSM531646     1  0.0000     0.7509 1.000 0.000 0.000
#> GSM531647     1  0.0000     0.7509 1.000 0.000 0.000
#> GSM531648     2  0.4702     0.4790 0.212 0.788 0.000
#> GSM531650     1  0.3192     0.7454 0.888 0.112 0.000
#> GSM531651     3  0.5650     0.7701 0.312 0.000 0.688
#> GSM531652     1  0.5621     0.6474 0.692 0.308 0.000
#> GSM531656     1  0.1289     0.7248 0.968 0.000 0.032
#> GSM531659     2  0.1753     0.7806 0.000 0.952 0.048
#> GSM531661     3  0.3038     0.6800 0.104 0.000 0.896
#> GSM531662     3  0.1753     0.6509 0.048 0.000 0.952
#> GSM531663     2  0.3816     0.7995 0.000 0.852 0.148
#> GSM531664     1  0.4399     0.7228 0.812 0.188 0.000
#> GSM531666     1  0.5560     0.6536 0.700 0.300 0.000
#> GSM531667     3  0.5650     0.7701 0.312 0.000 0.688
#> GSM531668     2  0.5650     0.8006 0.000 0.688 0.312
#> GSM531669     1  0.0000     0.7509 1.000 0.000 0.000
#> GSM531671     1  0.5882     0.0238 0.652 0.000 0.348
#> GSM531672     2  0.0000     0.7644 0.000 1.000 0.000
#> GSM531673     3  0.0000     0.6170 0.000 0.000 1.000
#> GSM531676     1  0.9882    -0.0964 0.408 0.280 0.312
#> GSM531679     2  0.5650     0.8006 0.000 0.688 0.312
#> GSM531681     2  0.4931     0.8029 0.000 0.768 0.232
#> GSM531682     2  0.5650     0.8006 0.000 0.688 0.312
#> GSM531683     2  0.5650     0.8006 0.000 0.688 0.312
#> GSM531684     3  0.0592     0.6046 0.000 0.012 0.988
#> GSM531685     1  0.7138     0.5077 0.644 0.044 0.312
#> GSM531686     2  0.4002     0.8009 0.000 0.840 0.160
#> GSM531687     2  0.9989     0.2710 0.336 0.352 0.312
#> GSM531688     1  0.0747     0.7491 0.984 0.000 0.016
#> GSM531690     2  0.5497     0.8031 0.000 0.708 0.292
#> GSM531693     1  0.0000     0.7509 1.000 0.000 0.000
#> GSM531695     1  0.7595     0.6476 0.688 0.176 0.136
#> GSM531603     2  0.5835     0.7795 0.000 0.660 0.340
#> GSM531609     2  0.0000     0.7644 0.000 1.000 0.000
#> GSM531611     2  0.0000     0.7644 0.000 1.000 0.000
#> GSM531621     3  0.5650     0.7701 0.312 0.000 0.688
#> GSM531622     3  0.5650     0.7701 0.312 0.000 0.688
#> GSM531628     1  0.3686     0.7397 0.860 0.140 0.000
#> GSM531630     3  0.5650     0.7701 0.312 0.000 0.688
#> GSM531633     3  0.5650     0.7701 0.312 0.000 0.688
#> GSM531635     1  0.0000     0.7509 1.000 0.000 0.000
#> GSM531640     3  0.5650     0.7701 0.312 0.000 0.688
#> GSM531649     1  0.0000     0.7509 1.000 0.000 0.000
#> GSM531653     1  0.0000     0.7509 1.000 0.000 0.000
#> GSM531657     2  0.0592     0.7691 0.000 0.988 0.012
#> GSM531665     1  0.9106     0.2307 0.536 0.284 0.180
#> GSM531670     1  0.1964     0.6989 0.944 0.000 0.056
#> GSM531674     1  0.0000     0.7509 1.000 0.000 0.000
#> GSM531675     2  0.5650     0.8006 0.000 0.688 0.312
#> GSM531677     2  0.5650     0.8006 0.000 0.688 0.312
#> GSM531678     2  0.5650     0.8006 0.000 0.688 0.312
#> GSM531680     1  0.8683     0.5151 0.592 0.236 0.172
#> GSM531689     2  0.5650     0.8006 0.000 0.688 0.312
#> GSM531691     3  0.6308    -0.5755 0.000 0.492 0.508
#> GSM531692     3  0.4555     0.3962 0.200 0.000 0.800
#> GSM531694     2  0.5650     0.8006 0.000 0.688 0.312

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM531602     2  0.0000      0.930 0.000 1.000 0.000 0.000
#> GSM531604     2  0.0000      0.930 0.000 1.000 0.000 0.000
#> GSM531606     2  0.0000      0.930 0.000 1.000 0.000 0.000
#> GSM531607     2  0.0000      0.930 0.000 1.000 0.000 0.000
#> GSM531608     3  0.0000      0.955 0.000 0.000 1.000 0.000
#> GSM531610     4  0.0000      0.983 0.000 0.000 0.000 1.000
#> GSM531612     4  0.0000      0.983 0.000 0.000 0.000 1.000
#> GSM531613     4  0.0000      0.983 0.000 0.000 0.000 1.000
#> GSM531614     4  0.0000      0.983 0.000 0.000 0.000 1.000
#> GSM531616     3  0.3219      0.781 0.164 0.000 0.836 0.000
#> GSM531618     4  0.0188      0.980 0.000 0.000 0.004 0.996
#> GSM531619     3  0.0000      0.955 0.000 0.000 1.000 0.000
#> GSM531620     3  0.0000      0.955 0.000 0.000 1.000 0.000
#> GSM531623     3  0.0000      0.955 0.000 0.000 1.000 0.000
#> GSM531625     3  0.0000      0.955 0.000 0.000 1.000 0.000
#> GSM531626     3  0.0000      0.955 0.000 0.000 1.000 0.000
#> GSM531632     1  0.0000      0.931 1.000 0.000 0.000 0.000
#> GSM531638     3  0.0000      0.955 0.000 0.000 1.000 0.000
#> GSM531639     3  0.0000      0.955 0.000 0.000 1.000 0.000
#> GSM531641     4  0.0000      0.983 0.000 0.000 0.000 1.000
#> GSM531642     4  0.3208      0.819 0.004 0.000 0.148 0.848
#> GSM531643     1  0.0000      0.931 1.000 0.000 0.000 0.000
#> GSM531644     1  0.0469      0.924 0.988 0.000 0.000 0.012
#> GSM531645     4  0.0000      0.983 0.000 0.000 0.000 1.000
#> GSM531646     1  0.0000      0.931 1.000 0.000 0.000 0.000
#> GSM531647     1  0.0000      0.931 1.000 0.000 0.000 0.000
#> GSM531648     4  0.0000      0.983 0.000 0.000 0.000 1.000
#> GSM531650     1  0.0000      0.931 1.000 0.000 0.000 0.000
#> GSM531651     3  0.0000      0.955 0.000 0.000 1.000 0.000
#> GSM531652     4  0.1211      0.947 0.040 0.000 0.000 0.960
#> GSM531656     1  0.3219      0.770 0.836 0.000 0.164 0.000
#> GSM531659     4  0.1389      0.937 0.000 0.048 0.000 0.952
#> GSM531661     3  0.0000      0.955 0.000 0.000 1.000 0.000
#> GSM531662     3  0.0000      0.955 0.000 0.000 1.000 0.000
#> GSM531663     4  0.0000      0.983 0.000 0.000 0.000 1.000
#> GSM531664     1  0.0000      0.931 1.000 0.000 0.000 0.000
#> GSM531666     1  0.4040      0.657 0.752 0.000 0.000 0.248
#> GSM531667     3  0.0000      0.955 0.000 0.000 1.000 0.000
#> GSM531668     2  0.4072      0.665 0.000 0.748 0.000 0.252
#> GSM531669     1  0.0000      0.931 1.000 0.000 0.000 0.000
#> GSM531671     3  0.5942      0.223 0.412 0.040 0.548 0.000
#> GSM531672     4  0.0000      0.983 0.000 0.000 0.000 1.000
#> GSM531673     3  0.3400      0.754 0.000 0.180 0.820 0.000
#> GSM531676     2  0.2647      0.837 0.120 0.880 0.000 0.000
#> GSM531679     2  0.0000      0.930 0.000 1.000 0.000 0.000
#> GSM531681     2  0.4431      0.610 0.000 0.696 0.000 0.304
#> GSM531682     2  0.0000      0.930 0.000 1.000 0.000 0.000
#> GSM531683     2  0.0000      0.930 0.000 1.000 0.000 0.000
#> GSM531684     2  0.2281      0.861 0.000 0.904 0.096 0.000
#> GSM531685     1  0.4072      0.643 0.748 0.252 0.000 0.000
#> GSM531686     2  0.4134      0.678 0.000 0.740 0.000 0.260
#> GSM531687     2  0.2081      0.873 0.084 0.916 0.000 0.000
#> GSM531688     1  0.0000      0.931 1.000 0.000 0.000 0.000
#> GSM531690     2  0.1211      0.906 0.000 0.960 0.000 0.040
#> GSM531693     1  0.0000      0.931 1.000 0.000 0.000 0.000
#> GSM531695     1  0.0336      0.926 0.992 0.008 0.000 0.000
#> GSM531603     2  0.0000      0.930 0.000 1.000 0.000 0.000
#> GSM531609     4  0.0000      0.983 0.000 0.000 0.000 1.000
#> GSM531611     4  0.0000      0.983 0.000 0.000 0.000 1.000
#> GSM531621     3  0.0000      0.955 0.000 0.000 1.000 0.000
#> GSM531622     3  0.0000      0.955 0.000 0.000 1.000 0.000
#> GSM531628     1  0.0000      0.931 1.000 0.000 0.000 0.000
#> GSM531630     3  0.0000      0.955 0.000 0.000 1.000 0.000
#> GSM531633     3  0.0000      0.955 0.000 0.000 1.000 0.000
#> GSM531635     1  0.0000      0.931 1.000 0.000 0.000 0.000
#> GSM531640     3  0.0000      0.955 0.000 0.000 1.000 0.000
#> GSM531649     1  0.0000      0.931 1.000 0.000 0.000 0.000
#> GSM531653     1  0.0000      0.931 1.000 0.000 0.000 0.000
#> GSM531657     4  0.0000      0.983 0.000 0.000 0.000 1.000
#> GSM531665     2  0.4500      0.532 0.316 0.684 0.000 0.000
#> GSM531670     1  0.3400      0.749 0.820 0.000 0.180 0.000
#> GSM531674     1  0.0000      0.931 1.000 0.000 0.000 0.000
#> GSM531675     2  0.0000      0.930 0.000 1.000 0.000 0.000
#> GSM531677     2  0.0000      0.930 0.000 1.000 0.000 0.000
#> GSM531678     2  0.0000      0.930 0.000 1.000 0.000 0.000
#> GSM531680     1  0.4866      0.291 0.596 0.404 0.000 0.000
#> GSM531689     2  0.0000      0.930 0.000 1.000 0.000 0.000
#> GSM531691     2  0.0000      0.930 0.000 1.000 0.000 0.000
#> GSM531692     2  0.0469      0.924 0.012 0.988 0.000 0.000
#> GSM531694     2  0.0000      0.930 0.000 1.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
#> GSM531602     2  0.3395    0.67038 0.000 0.764 0.000 0.000 0.236
#> GSM531604     2  0.0000    0.76625 0.000 1.000 0.000 0.000 0.000
#> GSM531606     2  0.1965    0.75493 0.000 0.904 0.000 0.000 0.096
#> GSM531607     2  0.3305    0.68137 0.000 0.776 0.000 0.000 0.224
#> GSM531608     3  0.0324    0.91951 0.000 0.000 0.992 0.004 0.004
#> GSM531610     4  0.0000    0.87470 0.000 0.000 0.000 1.000 0.000
#> GSM531612     4  0.0000    0.87470 0.000 0.000 0.000 1.000 0.000
#> GSM531613     4  0.0000    0.87470 0.000 0.000 0.000 1.000 0.000
#> GSM531614     4  0.0000    0.87470 0.000 0.000 0.000 1.000 0.000
#> GSM531616     3  0.4356    0.45718 0.340 0.000 0.648 0.000 0.012
#> GSM531618     5  0.2482    0.72698 0.000 0.000 0.024 0.084 0.892
#> GSM531619     3  0.1121    0.91532 0.000 0.000 0.956 0.000 0.044
#> GSM531620     3  0.3039    0.81674 0.012 0.000 0.836 0.000 0.152
#> GSM531623     3  0.0510    0.91971 0.000 0.000 0.984 0.000 0.016
#> GSM531625     3  0.1408    0.91267 0.008 0.000 0.948 0.000 0.044
#> GSM531626     3  0.1597    0.90732 0.012 0.000 0.940 0.000 0.048
#> GSM531632     1  0.0693    0.82168 0.980 0.000 0.012 0.000 0.008
#> GSM531638     3  0.0703    0.91824 0.000 0.000 0.976 0.000 0.024
#> GSM531639     3  0.1522    0.91080 0.012 0.000 0.944 0.000 0.044
#> GSM531641     4  0.0000    0.87470 0.000 0.000 0.000 1.000 0.000
#> GSM531642     5  0.6128    0.61815 0.184 0.000 0.032 0.144 0.640
#> GSM531643     1  0.2966    0.73541 0.816 0.000 0.000 0.000 0.184
#> GSM531644     1  0.4291    0.21208 0.536 0.000 0.000 0.000 0.464
#> GSM531645     4  0.0000    0.87470 0.000 0.000 0.000 1.000 0.000
#> GSM531646     1  0.0579    0.82298 0.984 0.000 0.008 0.000 0.008
#> GSM531647     1  0.0162    0.82411 0.996 0.000 0.000 0.000 0.004
#> GSM531648     5  0.3550    0.62268 0.000 0.000 0.004 0.236 0.760
#> GSM531650     1  0.2230    0.78454 0.884 0.000 0.000 0.000 0.116
#> GSM531651     3  0.0290    0.91933 0.000 0.000 0.992 0.000 0.008
#> GSM531652     5  0.4803    0.65419 0.184 0.000 0.012 0.068 0.736
#> GSM531656     1  0.5670    0.56551 0.632 0.000 0.192 0.000 0.176
#> GSM531659     4  0.6605    0.00138 0.000 0.288 0.000 0.460 0.252
#> GSM531661     3  0.0794    0.91809 0.000 0.000 0.972 0.000 0.028
#> GSM531662     3  0.1124    0.91323 0.000 0.004 0.960 0.000 0.036
#> GSM531663     4  0.0000    0.87470 0.000 0.000 0.000 1.000 0.000
#> GSM531664     1  0.2648    0.76258 0.848 0.000 0.000 0.000 0.152
#> GSM531666     5  0.2286    0.72014 0.108 0.000 0.000 0.004 0.888
#> GSM531667     3  0.2690    0.82666 0.000 0.000 0.844 0.000 0.156
#> GSM531668     5  0.3639    0.63331 0.000 0.164 0.020 0.008 0.808
#> GSM531669     1  0.0290    0.82412 0.992 0.000 0.000 0.000 0.008
#> GSM531671     1  0.5140    0.49047 0.668 0.016 0.272 0.000 0.044
#> GSM531672     5  0.3950    0.69570 0.000 0.048 0.004 0.152 0.796
#> GSM531673     3  0.4442    0.53699 0.000 0.284 0.688 0.000 0.028
#> GSM531676     2  0.3160    0.66380 0.188 0.808 0.000 0.000 0.004
#> GSM531679     2  0.0162    0.76659 0.000 0.996 0.000 0.000 0.004
#> GSM531681     4  0.2648    0.74353 0.000 0.152 0.000 0.848 0.000
#> GSM531682     2  0.1341    0.76245 0.000 0.944 0.000 0.000 0.056
#> GSM531683     2  0.2329    0.74381 0.000 0.876 0.000 0.000 0.124
#> GSM531684     2  0.4747    0.45622 0.000 0.620 0.352 0.000 0.028
#> GSM531685     1  0.5062    0.34890 0.608 0.356 0.016 0.000 0.020
#> GSM531686     4  0.2605    0.74956 0.000 0.148 0.000 0.852 0.000
#> GSM531687     2  0.4269    0.61871 0.232 0.732 0.000 0.000 0.036
#> GSM531688     1  0.1082    0.81688 0.964 0.028 0.000 0.000 0.008
#> GSM531690     2  0.4182    0.33405 0.000 0.600 0.000 0.000 0.400
#> GSM531693     1  0.0992    0.81858 0.968 0.024 0.000 0.000 0.008
#> GSM531695     1  0.5104    0.50277 0.632 0.060 0.000 0.000 0.308
#> GSM531603     5  0.4227    0.06854 0.000 0.420 0.000 0.000 0.580
#> GSM531609     4  0.0000    0.87470 0.000 0.000 0.000 1.000 0.000
#> GSM531611     4  0.0000    0.87470 0.000 0.000 0.000 1.000 0.000
#> GSM531621     3  0.0963    0.91560 0.000 0.000 0.964 0.000 0.036
#> GSM531622     3  0.1043    0.91611 0.000 0.000 0.960 0.000 0.040
#> GSM531628     1  0.1544    0.80766 0.932 0.000 0.000 0.000 0.068
#> GSM531630     3  0.0880    0.91694 0.000 0.000 0.968 0.000 0.032
#> GSM531633     3  0.1043    0.91045 0.000 0.000 0.960 0.000 0.040
#> GSM531635     1  0.0566    0.82509 0.984 0.000 0.004 0.000 0.012
#> GSM531640     3  0.0963    0.91681 0.000 0.000 0.964 0.000 0.036
#> GSM531649     1  0.1082    0.81822 0.964 0.000 0.008 0.000 0.028
#> GSM531653     1  0.0451    0.82454 0.988 0.000 0.004 0.000 0.008
#> GSM531657     4  0.4846    0.24160 0.000 0.020 0.004 0.588 0.388
#> GSM531665     2  0.4947    0.31308 0.396 0.576 0.024 0.000 0.004
#> GSM531670     1  0.5396    0.57826 0.656 0.000 0.220 0.000 0.124
#> GSM531674     1  0.0290    0.82328 0.992 0.000 0.000 0.000 0.008
#> GSM531675     2  0.2813    0.71697 0.000 0.832 0.000 0.000 0.168
#> GSM531677     2  0.0162    0.76655 0.000 0.996 0.000 0.000 0.004
#> GSM531678     2  0.2017    0.73433 0.000 0.912 0.008 0.080 0.000
#> GSM531680     2  0.6024    0.14453 0.412 0.472 0.000 0.000 0.116
#> GSM531689     2  0.0290    0.76665 0.000 0.992 0.000 0.000 0.008
#> GSM531691     2  0.2482    0.72629 0.000 0.892 0.084 0.000 0.024
#> GSM531692     2  0.3416    0.70447 0.124 0.840 0.016 0.000 0.020
#> GSM531694     2  0.3177    0.69446 0.000 0.792 0.000 0.000 0.208

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>           class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM531602     2  0.5775     0.4799 0.000 0.496 0.000 0.000 0.296 0.208
#> GSM531604     2  0.1531     0.7100 0.000 0.928 0.004 0.000 0.068 0.000
#> GSM531606     2  0.4330     0.6560 0.000 0.696 0.000 0.000 0.236 0.068
#> GSM531607     2  0.5661     0.5156 0.000 0.528 0.000 0.000 0.268 0.204
#> GSM531608     3  0.3821     0.5276 0.000 0.000 0.772 0.148 0.080 0.000
#> GSM531610     4  0.0000     0.9858 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM531612     4  0.0000     0.9858 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM531613     4  0.0000     0.9858 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM531614     4  0.0000     0.9858 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM531616     3  0.6109    -0.5831 0.364 0.000 0.424 0.000 0.204 0.008
#> GSM531618     6  0.3985     0.6189 0.000 0.000 0.024 0.032 0.180 0.764
#> GSM531619     3  0.3515     0.5621 0.000 0.000 0.676 0.000 0.324 0.000
#> GSM531620     3  0.5190    -0.0630 0.028 0.000 0.536 0.000 0.396 0.040
#> GSM531623     3  0.0865     0.6160 0.000 0.000 0.964 0.000 0.036 0.000
#> GSM531625     3  0.3163     0.4648 0.004 0.000 0.764 0.000 0.232 0.000
#> GSM531626     3  0.4992    -0.0279 0.112 0.000 0.620 0.000 0.268 0.000
#> GSM531632     1  0.4495     0.2818 0.708 0.000 0.092 0.000 0.196 0.004
#> GSM531638     3  0.3743     0.5838 0.024 0.000 0.724 0.000 0.252 0.000
#> GSM531639     3  0.3613     0.5668 0.052 0.000 0.828 0.000 0.056 0.064
#> GSM531641     4  0.0000     0.9858 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM531642     6  0.4691     0.5728 0.160 0.000 0.016 0.072 0.016 0.736
#> GSM531643     1  0.2651     0.6831 0.860 0.000 0.000 0.000 0.028 0.112
#> GSM531644     6  0.3993     0.2091 0.400 0.000 0.000 0.000 0.008 0.592
#> GSM531645     4  0.0000     0.9858 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM531646     1  0.2946     0.5479 0.812 0.000 0.012 0.000 0.176 0.000
#> GSM531647     1  0.2048     0.6373 0.880 0.000 0.000 0.000 0.120 0.000
#> GSM531648     6  0.2848     0.6357 0.000 0.000 0.004 0.104 0.036 0.856
#> GSM531650     1  0.2066     0.6971 0.904 0.000 0.000 0.000 0.024 0.072
#> GSM531651     3  0.1327     0.6022 0.000 0.000 0.936 0.000 0.064 0.000
#> GSM531652     6  0.3234     0.6134 0.120 0.000 0.004 0.028 0.012 0.836
#> GSM531656     1  0.4977     0.5174 0.696 0.000 0.148 0.000 0.024 0.132
#> GSM531659     6  0.6388     0.4268 0.000 0.216 0.000 0.236 0.040 0.508
#> GSM531661     3  0.2178     0.6163 0.000 0.000 0.868 0.000 0.132 0.000
#> GSM531662     3  0.4230     0.3939 0.000 0.056 0.716 0.000 0.224 0.004
#> GSM531663     4  0.0000     0.9858 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM531664     1  0.2473     0.6690 0.856 0.000 0.000 0.000 0.008 0.136
#> GSM531666     6  0.3641     0.5350 0.248 0.000 0.000 0.000 0.020 0.732
#> GSM531667     3  0.4757     0.4977 0.000 0.000 0.676 0.000 0.144 0.180
#> GSM531668     6  0.5014     0.4460 0.000 0.036 0.024 0.000 0.372 0.568
#> GSM531669     1  0.2442     0.6127 0.852 0.000 0.000 0.000 0.144 0.004
#> GSM531671     5  0.7118     0.0000 0.308 0.048 0.308 0.000 0.328 0.008
#> GSM531672     6  0.2883     0.6448 0.000 0.020 0.000 0.036 0.076 0.868
#> GSM531673     3  0.6273    -0.1214 0.020 0.184 0.488 0.000 0.304 0.004
#> GSM531676     2  0.4333     0.1166 0.376 0.596 0.000 0.000 0.028 0.000
#> GSM531679     2  0.2094     0.7073 0.000 0.900 0.000 0.000 0.080 0.020
#> GSM531681     4  0.1007     0.9457 0.000 0.044 0.000 0.956 0.000 0.000
#> GSM531682     2  0.3123     0.7019 0.000 0.832 0.000 0.000 0.112 0.056
#> GSM531683     2  0.4756     0.6342 0.000 0.672 0.000 0.000 0.200 0.128
#> GSM531684     2  0.6258     0.1997 0.000 0.408 0.316 0.000 0.268 0.008
#> GSM531685     1  0.5464     0.1414 0.464 0.452 0.052 0.000 0.032 0.000
#> GSM531686     4  0.1444     0.9155 0.000 0.072 0.000 0.928 0.000 0.000
#> GSM531687     1  0.5625     0.3608 0.540 0.356 0.000 0.000 0.052 0.052
#> GSM531688     1  0.1480     0.7008 0.940 0.040 0.000 0.000 0.020 0.000
#> GSM531690     6  0.4880     0.2243 0.000 0.344 0.000 0.012 0.048 0.596
#> GSM531693     1  0.2190     0.6897 0.900 0.040 0.000 0.000 0.060 0.000
#> GSM531695     1  0.4006     0.6431 0.792 0.044 0.000 0.000 0.048 0.116
#> GSM531603     6  0.5590     0.3264 0.000 0.144 0.004 0.000 0.320 0.532
#> GSM531609     4  0.0000     0.9858 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM531611     4  0.0000     0.9858 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM531621     3  0.1765     0.5828 0.000 0.000 0.904 0.000 0.096 0.000
#> GSM531622     3  0.3151     0.5942 0.000 0.000 0.748 0.000 0.252 0.000
#> GSM531628     1  0.1700     0.6942 0.916 0.000 0.000 0.000 0.004 0.080
#> GSM531630     3  0.3464     0.5714 0.000 0.000 0.688 0.000 0.312 0.000
#> GSM531633     3  0.2595     0.5301 0.000 0.000 0.836 0.000 0.160 0.004
#> GSM531635     1  0.0713     0.6933 0.972 0.000 0.000 0.000 0.028 0.000
#> GSM531640     3  0.4195     0.5522 0.000 0.000 0.648 0.008 0.328 0.016
#> GSM531649     1  0.3960     0.4508 0.752 0.000 0.072 0.000 0.176 0.000
#> GSM531653     1  0.2595     0.6404 0.872 0.000 0.044 0.000 0.084 0.000
#> GSM531657     6  0.4993     0.5765 0.000 0.004 0.008 0.228 0.096 0.664
#> GSM531665     2  0.4191     0.6027 0.140 0.780 0.012 0.000 0.028 0.040
#> GSM531670     1  0.5500     0.4022 0.636 0.004 0.224 0.000 0.028 0.108
#> GSM531674     1  0.0291     0.7011 0.992 0.000 0.000 0.000 0.004 0.004
#> GSM531675     2  0.4378     0.4616 0.000 0.632 0.000 0.000 0.040 0.328
#> GSM531677     2  0.1719     0.6956 0.000 0.924 0.000 0.000 0.016 0.060
#> GSM531678     2  0.3374     0.6558 0.000 0.836 0.032 0.096 0.036 0.000
#> GSM531680     1  0.5693     0.4380 0.596 0.288 0.008 0.000 0.060 0.048
#> GSM531689     2  0.1151     0.6917 0.012 0.956 0.000 0.000 0.032 0.000
#> GSM531691     2  0.2781     0.6715 0.008 0.868 0.084 0.000 0.040 0.000
#> GSM531692     2  0.3514     0.6492 0.092 0.828 0.052 0.000 0.028 0.000
#> GSM531694     2  0.5336     0.5726 0.000 0.584 0.000 0.000 0.256 0.160

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

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

collect_plots(res)

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.407           0.781       0.893         0.4698 0.525   0.525
#> 3 3 0.337           0.402       0.662         0.3456 0.748   0.545
#> 4 4 0.437           0.475       0.711         0.1501 0.741   0.387
#> 5 5 0.556           0.564       0.761         0.0749 0.899   0.639
#> 6 6 0.710           0.590       0.783         0.0576 0.949   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
#> GSM531602     2  0.0000     0.8764 0.000 1.000
#> GSM531604     1  0.8763     0.6391 0.704 0.296
#> GSM531606     2  0.8081     0.6597 0.248 0.752
#> GSM531607     2  0.6887     0.7450 0.184 0.816
#> GSM531608     1  0.2603     0.8737 0.956 0.044
#> GSM531610     2  0.0000     0.8764 0.000 1.000
#> GSM531612     2  0.0000     0.8764 0.000 1.000
#> GSM531613     2  0.0000     0.8764 0.000 1.000
#> GSM531614     2  0.0000     0.8764 0.000 1.000
#> GSM531616     1  0.0000     0.8721 1.000 0.000
#> GSM531618     1  0.9833     0.2661 0.576 0.424
#> GSM531619     1  0.2236     0.8738 0.964 0.036
#> GSM531620     1  0.3584     0.8692 0.932 0.068
#> GSM531623     1  0.0376     0.8729 0.996 0.004
#> GSM531625     1  0.0000     0.8721 1.000 0.000
#> GSM531626     1  0.0000     0.8721 1.000 0.000
#> GSM531632     1  0.0000     0.8721 1.000 0.000
#> GSM531638     1  0.0000     0.8721 1.000 0.000
#> GSM531639     1  0.3733     0.8697 0.928 0.072
#> GSM531641     2  0.0000     0.8764 0.000 1.000
#> GSM531642     1  0.9933     0.2102 0.548 0.452
#> GSM531643     1  0.5629     0.8377 0.868 0.132
#> GSM531644     1  0.9933     0.2102 0.548 0.452
#> GSM531645     2  0.0000     0.8764 0.000 1.000
#> GSM531646     1  0.0000     0.8721 1.000 0.000
#> GSM531647     1  0.0000     0.8721 1.000 0.000
#> GSM531648     2  1.0000    -0.0892 0.500 0.500
#> GSM531650     1  0.2778     0.8740 0.952 0.048
#> GSM531651     1  0.0376     0.8729 0.996 0.004
#> GSM531652     1  0.9988     0.1156 0.520 0.480
#> GSM531656     1  0.4562     0.8597 0.904 0.096
#> GSM531659     2  0.7950     0.6897 0.240 0.760
#> GSM531661     1  0.2778     0.8731 0.952 0.048
#> GSM531662     1  0.7376     0.7553 0.792 0.208
#> GSM531663     2  0.5294     0.8160 0.120 0.880
#> GSM531664     1  0.4815     0.8557 0.896 0.104
#> GSM531666     1  0.9170     0.5414 0.668 0.332
#> GSM531667     1  0.2778     0.8731 0.952 0.048
#> GSM531668     2  0.9933     0.1048 0.452 0.548
#> GSM531669     1  0.3584     0.8726 0.932 0.068
#> GSM531671     1  0.6148     0.8093 0.848 0.152
#> GSM531672     2  0.2236     0.8626 0.036 0.964
#> GSM531673     1  0.7376     0.7553 0.792 0.208
#> GSM531676     1  0.6343     0.8172 0.840 0.160
#> GSM531679     2  0.0672     0.8745 0.008 0.992
#> GSM531681     2  0.0000     0.8764 0.000 1.000
#> GSM531682     2  0.1414     0.8704 0.020 0.980
#> GSM531683     2  0.0000     0.8764 0.000 1.000
#> GSM531684     2  0.8081     0.6597 0.248 0.752
#> GSM531685     1  0.6048     0.8313 0.852 0.148
#> GSM531686     2  0.0000     0.8764 0.000 1.000
#> GSM531687     1  0.6343     0.8172 0.840 0.160
#> GSM531688     1  0.3584     0.8717 0.932 0.068
#> GSM531690     2  0.0000     0.8764 0.000 1.000
#> GSM531693     1  0.3584     0.8717 0.932 0.068
#> GSM531695     1  0.6712     0.8115 0.824 0.176
#> GSM531603     2  0.6887     0.7450 0.184 0.816
#> GSM531609     2  0.0000     0.8764 0.000 1.000
#> GSM531611     2  0.0000     0.8764 0.000 1.000
#> GSM531621     1  0.0376     0.8729 0.996 0.004
#> GSM531622     1  0.2236     0.8738 0.964 0.036
#> GSM531628     1  0.2603     0.8742 0.956 0.044
#> GSM531630     1  0.2236     0.8738 0.964 0.036
#> GSM531633     1  0.0376     0.8729 0.996 0.004
#> GSM531635     1  0.0000     0.8721 1.000 0.000
#> GSM531640     1  0.2236     0.8738 0.964 0.036
#> GSM531649     1  0.0000     0.8721 1.000 0.000
#> GSM531653     1  0.0000     0.8721 1.000 0.000
#> GSM531657     2  0.7883     0.6936 0.236 0.764
#> GSM531665     2  0.8386     0.6439 0.268 0.732
#> GSM531670     1  0.4562     0.8597 0.904 0.096
#> GSM531674     1  0.3274     0.8739 0.940 0.060
#> GSM531675     2  0.0000     0.8764 0.000 1.000
#> GSM531677     2  0.0672     0.8745 0.008 0.992
#> GSM531678     2  0.8081     0.6597 0.248 0.752
#> GSM531680     1  0.6801     0.8076 0.820 0.180
#> GSM531689     1  0.6712     0.8042 0.824 0.176
#> GSM531691     1  0.6712     0.8042 0.824 0.176
#> GSM531692     1  0.5737     0.8341 0.864 0.136
#> GSM531694     2  0.0000     0.8764 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
#> GSM531602     2  0.5397     0.7731 0.000 0.720 0.280
#> GSM531604     3  0.4662     0.2933 0.124 0.032 0.844
#> GSM531606     3  0.6672    -0.4528 0.008 0.472 0.520
#> GSM531607     2  0.8886     0.6487 0.188 0.572 0.240
#> GSM531608     3  0.6244     0.3152 0.440 0.000 0.560
#> GSM531610     2  0.0000     0.8164 0.000 1.000 0.000
#> GSM531612     2  0.0000     0.8164 0.000 1.000 0.000
#> GSM531613     2  0.0000     0.8164 0.000 1.000 0.000
#> GSM531614     2  0.0000     0.8164 0.000 1.000 0.000
#> GSM531616     1  0.5926     0.0462 0.644 0.000 0.356
#> GSM531618     1  0.9129     0.2429 0.480 0.372 0.148
#> GSM531619     3  0.6252     0.3189 0.444 0.000 0.556
#> GSM531620     1  0.7705     0.1075 0.604 0.064 0.332
#> GSM531623     3  0.6302     0.2820 0.480 0.000 0.520
#> GSM531625     1  0.6305    -0.2860 0.516 0.000 0.484
#> GSM531626     1  0.6305    -0.2860 0.516 0.000 0.484
#> GSM531632     1  0.3619     0.4136 0.864 0.000 0.136
#> GSM531638     1  0.5926     0.0462 0.644 0.000 0.356
#> GSM531639     1  0.7128     0.2750 0.684 0.064 0.252
#> GSM531641     2  0.0237     0.8172 0.000 0.996 0.004
#> GSM531642     1  0.7883     0.2462 0.516 0.428 0.056
#> GSM531643     1  0.4662     0.5104 0.844 0.124 0.032
#> GSM531644     1  0.7883     0.2462 0.516 0.428 0.056
#> GSM531645     2  0.0000     0.8164 0.000 1.000 0.000
#> GSM531646     1  0.3816     0.4036 0.852 0.000 0.148
#> GSM531647     1  0.1163     0.4968 0.972 0.000 0.028
#> GSM531648     1  0.8523     0.1133 0.464 0.444 0.092
#> GSM531650     1  0.1878     0.5196 0.952 0.044 0.004
#> GSM531651     3  0.6302     0.2820 0.480 0.000 0.520
#> GSM531652     1  0.8331     0.1713 0.484 0.436 0.080
#> GSM531656     1  0.5582     0.4872 0.812 0.088 0.100
#> GSM531659     2  0.8392     0.6225 0.176 0.624 0.200
#> GSM531661     3  0.6451     0.3141 0.436 0.004 0.560
#> GSM531662     3  0.8827     0.1258 0.384 0.120 0.496
#> GSM531663     2  0.6622     0.7657 0.088 0.748 0.164
#> GSM531664     1  0.3295     0.5195 0.896 0.096 0.008
#> GSM531666     1  0.7012     0.3887 0.652 0.308 0.040
#> GSM531667     3  0.6451     0.3141 0.436 0.004 0.560
#> GSM531668     2  0.8925    -0.0135 0.412 0.464 0.124
#> GSM531669     1  0.4335     0.4767 0.864 0.036 0.100
#> GSM531671     1  0.8507    -0.0720 0.484 0.092 0.424
#> GSM531672     2  0.5047     0.8148 0.036 0.824 0.140
#> GSM531673     3  0.8827     0.1258 0.384 0.120 0.496
#> GSM531676     3  0.6445     0.2876 0.308 0.020 0.672
#> GSM531679     2  0.4931     0.8025 0.000 0.768 0.232
#> GSM531681     2  0.1289     0.8197 0.000 0.968 0.032
#> GSM531682     2  0.5335     0.8022 0.008 0.760 0.232
#> GSM531683     2  0.5178     0.7891 0.000 0.744 0.256
#> GSM531684     3  0.6672    -0.4528 0.008 0.472 0.520
#> GSM531685     3  0.7067     0.0244 0.468 0.020 0.512
#> GSM531686     2  0.1289     0.8197 0.000 0.968 0.032
#> GSM531687     3  0.6445     0.2876 0.308 0.020 0.672
#> GSM531688     1  0.4921     0.4183 0.816 0.020 0.164
#> GSM531690     2  0.4452     0.8111 0.000 0.808 0.192
#> GSM531693     1  0.4921     0.4183 0.816 0.020 0.164
#> GSM531695     1  0.7564     0.2451 0.636 0.068 0.296
#> GSM531603     2  0.8886     0.6487 0.188 0.572 0.240
#> GSM531609     2  0.0000     0.8164 0.000 1.000 0.000
#> GSM531611     2  0.0000     0.8164 0.000 1.000 0.000
#> GSM531621     3  0.6302     0.2820 0.480 0.000 0.520
#> GSM531622     3  0.6252     0.3189 0.444 0.000 0.556
#> GSM531628     1  0.1765     0.5187 0.956 0.040 0.004
#> GSM531630     3  0.6252     0.3189 0.444 0.000 0.556
#> GSM531633     3  0.6302     0.2820 0.480 0.000 0.520
#> GSM531635     1  0.5859     0.0615 0.656 0.000 0.344
#> GSM531640     3  0.6252     0.3189 0.444 0.000 0.556
#> GSM531649     1  0.1163     0.4968 0.972 0.000 0.028
#> GSM531653     1  0.1163     0.4968 0.972 0.000 0.028
#> GSM531657     2  0.8307     0.6202 0.192 0.632 0.176
#> GSM531665     2  0.8675     0.5787 0.184 0.596 0.220
#> GSM531670     1  0.5582     0.4872 0.812 0.088 0.100
#> GSM531674     1  0.3742     0.4963 0.892 0.036 0.072
#> GSM531675     2  0.4842     0.8032 0.000 0.776 0.224
#> GSM531677     2  0.4931     0.8025 0.000 0.768 0.232
#> GSM531678     3  0.6672    -0.4528 0.008 0.472 0.520
#> GSM531680     1  0.7536     0.2363 0.632 0.064 0.304
#> GSM531689     3  0.6326     0.2929 0.292 0.020 0.688
#> GSM531691     3  0.6326     0.2929 0.292 0.020 0.688
#> GSM531692     3  0.5216     0.3152 0.260 0.000 0.740
#> GSM531694     2  0.5397     0.7731 0.000 0.720 0.280

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM531602     2  0.0000   0.684668 0.000 1.000 0.000 0.000
#> GSM531604     3  0.9586   0.168804 0.144 0.276 0.372 0.208
#> GSM531606     2  0.5811   0.557105 0.028 0.740 0.160 0.072
#> GSM531607     2  0.5873   0.500038 0.188 0.712 0.008 0.092
#> GSM531608     3  0.1151   0.714074 0.024 0.008 0.968 0.000
#> GSM531610     4  0.3873   0.689164 0.000 0.228 0.000 0.772
#> GSM531612     4  0.3873   0.689164 0.000 0.228 0.000 0.772
#> GSM531613     4  0.4040   0.667784 0.000 0.248 0.000 0.752
#> GSM531614     4  0.3873   0.689164 0.000 0.228 0.000 0.772
#> GSM531616     3  0.4804   0.394994 0.384 0.000 0.616 0.000
#> GSM531618     1  0.8975   0.000932 0.384 0.064 0.224 0.328
#> GSM531619     3  0.0000   0.712648 0.000 0.000 1.000 0.000
#> GSM531620     3  0.6100   0.404683 0.304 0.000 0.624 0.072
#> GSM531623     3  0.1118   0.716516 0.036 0.000 0.964 0.000
#> GSM531625     3  0.2704   0.689437 0.124 0.000 0.876 0.000
#> GSM531626     3  0.2704   0.689437 0.124 0.000 0.876 0.000
#> GSM531632     1  0.4072   0.440644 0.748 0.000 0.252 0.000
#> GSM531638     3  0.4804   0.394994 0.384 0.000 0.616 0.000
#> GSM531639     3  0.6559   0.055958 0.452 0.004 0.480 0.064
#> GSM531641     4  0.4267   0.683658 0.008 0.216 0.004 0.772
#> GSM531642     1  0.7477  -0.000351 0.448 0.012 0.124 0.416
#> GSM531643     1  0.4801   0.571064 0.800 0.008 0.084 0.108
#> GSM531644     1  0.7477  -0.000351 0.448 0.012 0.124 0.416
#> GSM531645     4  0.4086   0.685040 0.008 0.216 0.000 0.776
#> GSM531646     1  0.4331   0.386114 0.712 0.000 0.288 0.000
#> GSM531647     1  0.2704   0.579480 0.876 0.000 0.124 0.000
#> GSM531648     4  0.7918   0.018101 0.400 0.024 0.144 0.432
#> GSM531650     1  0.2816   0.603989 0.900 0.000 0.064 0.036
#> GSM531651     3  0.1118   0.716516 0.036 0.000 0.964 0.000
#> GSM531652     4  0.7774  -0.031701 0.420 0.020 0.136 0.424
#> GSM531656     1  0.5479   0.529215 0.740 0.008 0.180 0.072
#> GSM531659     2  0.8476   0.388889 0.120 0.552 0.156 0.172
#> GSM531661     3  0.1339   0.713382 0.024 0.008 0.964 0.004
#> GSM531662     3  0.9067   0.284695 0.272 0.108 0.448 0.172
#> GSM531663     2  0.6939   0.514011 0.056 0.660 0.080 0.204
#> GSM531664     1  0.3526   0.599639 0.872 0.008 0.040 0.080
#> GSM531666     1  0.6841   0.308613 0.600 0.012 0.100 0.288
#> GSM531667     3  0.1339   0.713382 0.024 0.008 0.964 0.004
#> GSM531668     4  0.8681   0.077603 0.368 0.084 0.128 0.420
#> GSM531669     1  0.3819   0.605837 0.860 0.016 0.036 0.088
#> GSM531671     3  0.8410   0.284372 0.320 0.060 0.476 0.144
#> GSM531672     2  0.5927   0.471075 0.036 0.680 0.024 0.260
#> GSM531673     3  0.9067   0.284695 0.272 0.108 0.448 0.172
#> GSM531676     1  0.9415  -0.026933 0.348 0.112 0.332 0.208
#> GSM531679     2  0.2053   0.688248 0.004 0.924 0.000 0.072
#> GSM531681     4  0.4977   0.327882 0.000 0.460 0.000 0.540
#> GSM531682     2  0.2384   0.690316 0.004 0.916 0.008 0.072
#> GSM531683     2  0.0817   0.689357 0.000 0.976 0.000 0.024
#> GSM531684     2  0.5811   0.557105 0.028 0.740 0.160 0.072
#> GSM531685     1  0.8685   0.251809 0.508 0.088 0.208 0.196
#> GSM531686     4  0.4977   0.327882 0.000 0.460 0.000 0.540
#> GSM531687     1  0.9415  -0.026933 0.348 0.112 0.332 0.208
#> GSM531688     1  0.4739   0.578981 0.804 0.028 0.032 0.136
#> GSM531690     2  0.2469   0.650812 0.000 0.892 0.000 0.108
#> GSM531693     1  0.4739   0.578981 0.804 0.028 0.032 0.136
#> GSM531695     1  0.5842   0.498205 0.688 0.092 0.000 0.220
#> GSM531603     2  0.5873   0.500038 0.188 0.712 0.008 0.092
#> GSM531609     4  0.3873   0.689164 0.000 0.228 0.000 0.772
#> GSM531611     4  0.3873   0.689164 0.000 0.228 0.000 0.772
#> GSM531621     3  0.1118   0.716516 0.036 0.000 0.964 0.000
#> GSM531622     3  0.0000   0.712648 0.000 0.000 1.000 0.000
#> GSM531628     1  0.2722   0.603942 0.904 0.000 0.064 0.032
#> GSM531630     3  0.0000   0.712648 0.000 0.000 1.000 0.000
#> GSM531633     3  0.1118   0.716516 0.036 0.000 0.964 0.000
#> GSM531635     3  0.4898   0.341203 0.416 0.000 0.584 0.000
#> GSM531640     3  0.0000   0.712648 0.000 0.000 1.000 0.000
#> GSM531649     1  0.2704   0.579480 0.876 0.000 0.124 0.000
#> GSM531653     1  0.2704   0.579480 0.876 0.000 0.124 0.000
#> GSM531657     2  0.8907   0.169235 0.156 0.460 0.100 0.284
#> GSM531665     2  0.8730   0.359735 0.128 0.524 0.176 0.172
#> GSM531670     1  0.5479   0.529215 0.740 0.008 0.180 0.072
#> GSM531674     1  0.3221   0.609990 0.888 0.008 0.036 0.068
#> GSM531675     2  0.1716   0.684119 0.000 0.936 0.000 0.064
#> GSM531677     2  0.2053   0.688248 0.004 0.924 0.000 0.072
#> GSM531678     2  0.5903   0.553943 0.032 0.736 0.160 0.072
#> GSM531680     1  0.5923   0.494377 0.684 0.100 0.000 0.216
#> GSM531689     1  0.9535  -0.039561 0.332 0.128 0.332 0.208
#> GSM531691     1  0.9535  -0.039561 0.332 0.128 0.332 0.208
#> GSM531692     3  0.9189   0.100470 0.300 0.092 0.400 0.208
#> GSM531694     2  0.0000   0.684668 0.000 1.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
#> GSM531602     2  0.0609     0.7286 0.000 0.980 0.000 0.000 0.020
#> GSM531604     5  0.6406     0.4655 0.008 0.240 0.200 0.000 0.552
#> GSM531606     2  0.4763     0.5201 0.000 0.712 0.076 0.000 0.212
#> GSM531607     2  0.5837     0.5636 0.172 0.684 0.000 0.084 0.060
#> GSM531608     3  0.1026     0.7697 0.024 0.004 0.968 0.000 0.004
#> GSM531610     4  0.0963     0.8295 0.000 0.036 0.000 0.964 0.000
#> GSM531612     4  0.0963     0.8295 0.000 0.036 0.000 0.964 0.000
#> GSM531613     4  0.1732     0.7988 0.000 0.080 0.000 0.920 0.000
#> GSM531614     4  0.0963     0.8295 0.000 0.036 0.000 0.964 0.000
#> GSM531616     3  0.5941     0.3898 0.376 0.000 0.544 0.036 0.044
#> GSM531618     1  0.9295     0.2365 0.340 0.060 0.192 0.236 0.172
#> GSM531619     3  0.0000     0.7710 0.000 0.000 1.000 0.000 0.000
#> GSM531620     3  0.6419     0.4243 0.284 0.000 0.580 0.048 0.088
#> GSM531623     3  0.1117     0.7723 0.016 0.000 0.964 0.000 0.020
#> GSM531625     3  0.4128     0.7080 0.096 0.000 0.816 0.036 0.052
#> GSM531626     3  0.4128     0.7080 0.096 0.000 0.816 0.036 0.052
#> GSM531632     1  0.4371     0.5393 0.780 0.000 0.156 0.036 0.028
#> GSM531638     3  0.5941     0.3898 0.376 0.000 0.544 0.036 0.044
#> GSM531639     3  0.6562     0.0485 0.432 0.004 0.456 0.044 0.064
#> GSM531641     4  0.1356     0.8223 0.012 0.028 0.004 0.956 0.000
#> GSM531642     1  0.7984     0.2710 0.408 0.004 0.100 0.316 0.172
#> GSM531643     1  0.3839     0.6239 0.844 0.004 0.052 0.056 0.044
#> GSM531644     1  0.7984     0.2710 0.408 0.004 0.100 0.316 0.172
#> GSM531645     4  0.1195     0.8237 0.012 0.028 0.000 0.960 0.000
#> GSM531646     1  0.4858     0.5117 0.736 0.000 0.192 0.036 0.036
#> GSM531647     1  0.2532     0.6190 0.908 0.000 0.028 0.036 0.028
#> GSM531648     1  0.8433     0.1875 0.360 0.016 0.120 0.332 0.172
#> GSM531650     1  0.0693     0.6358 0.980 0.000 0.012 0.008 0.000
#> GSM531651     3  0.1117     0.7723 0.016 0.000 0.964 0.000 0.020
#> GSM531652     1  0.8288     0.2236 0.380 0.012 0.112 0.324 0.172
#> GSM531656     1  0.4526     0.5658 0.780 0.004 0.148 0.036 0.032
#> GSM531659     2  0.8058     0.5099 0.092 0.556 0.140 0.104 0.108
#> GSM531661     3  0.1187     0.7679 0.024 0.004 0.964 0.004 0.004
#> GSM531662     5  0.8046     0.2859 0.148 0.064 0.292 0.036 0.460
#> GSM531663     2  0.6652     0.5766 0.048 0.644 0.076 0.192 0.040
#> GSM531664     1  0.2074     0.6334 0.928 0.004 0.004 0.032 0.032
#> GSM531666     1  0.6142     0.5142 0.652 0.004 0.068 0.212 0.064
#> GSM531667     3  0.1187     0.7679 0.024 0.004 0.964 0.004 0.004
#> GSM531668     4  0.9000    -0.2274 0.320 0.060 0.108 0.332 0.180
#> GSM531669     1  0.2488     0.5574 0.872 0.000 0.000 0.004 0.124
#> GSM531671     5  0.8218     0.1229 0.240 0.032 0.320 0.044 0.364
#> GSM531672     2  0.5927     0.5529 0.044 0.660 0.024 0.240 0.032
#> GSM531673     5  0.8046     0.2859 0.148 0.064 0.292 0.036 0.460
#> GSM531676     5  0.4318     0.6655 0.040 0.032 0.136 0.000 0.792
#> GSM531679     2  0.1725     0.7356 0.000 0.936 0.000 0.044 0.020
#> GSM531681     4  0.4114     0.4082 0.000 0.376 0.000 0.624 0.000
#> GSM531682     2  0.2073     0.7363 0.008 0.928 0.004 0.044 0.016
#> GSM531683     2  0.0807     0.7340 0.000 0.976 0.000 0.012 0.012
#> GSM531684     2  0.4793     0.5160 0.000 0.708 0.076 0.000 0.216
#> GSM531685     5  0.5343     0.5585 0.212 0.008 0.100 0.000 0.680
#> GSM531686     4  0.4114     0.4082 0.000 0.376 0.000 0.624 0.000
#> GSM531687     5  0.4318     0.6655 0.040 0.032 0.136 0.000 0.792
#> GSM531688     1  0.3741     0.3883 0.732 0.004 0.000 0.000 0.264
#> GSM531690     2  0.2068     0.7108 0.000 0.904 0.000 0.092 0.004
#> GSM531693     1  0.3766     0.3824 0.728 0.004 0.000 0.000 0.268
#> GSM531695     5  0.5399     0.0823 0.476 0.032 0.000 0.012 0.480
#> GSM531603     2  0.5837     0.5636 0.172 0.684 0.000 0.084 0.060
#> GSM531609     4  0.0963     0.8295 0.000 0.036 0.000 0.964 0.000
#> GSM531611     4  0.0963     0.8295 0.000 0.036 0.000 0.964 0.000
#> GSM531621     3  0.1117     0.7723 0.016 0.000 0.964 0.000 0.020
#> GSM531622     3  0.0000     0.7710 0.000 0.000 1.000 0.000 0.000
#> GSM531628     1  0.0854     0.6359 0.976 0.000 0.012 0.008 0.004
#> GSM531630     3  0.0000     0.7710 0.000 0.000 1.000 0.000 0.000
#> GSM531633     3  0.1117     0.7723 0.016 0.000 0.964 0.000 0.020
#> GSM531635     3  0.5884     0.3098 0.416 0.000 0.512 0.036 0.036
#> GSM531640     3  0.0000     0.7710 0.000 0.000 1.000 0.000 0.000
#> GSM531649     1  0.2777     0.6175 0.896 0.000 0.028 0.036 0.040
#> GSM531653     1  0.2777     0.6175 0.896 0.000 0.028 0.036 0.040
#> GSM531657     2  0.8695     0.3495 0.128 0.468 0.088 0.208 0.108
#> GSM531665     2  0.8316     0.4846 0.096 0.528 0.152 0.104 0.120
#> GSM531670     1  0.4526     0.5658 0.780 0.004 0.148 0.036 0.032
#> GSM531674     1  0.2068     0.5884 0.904 0.000 0.000 0.004 0.092
#> GSM531675     2  0.1357     0.7331 0.000 0.948 0.000 0.048 0.004
#> GSM531677     2  0.1725     0.7356 0.000 0.936 0.000 0.044 0.020
#> GSM531678     2  0.4850     0.5060 0.000 0.700 0.076 0.000 0.224
#> GSM531680     5  0.5311     0.2463 0.396 0.032 0.000 0.012 0.560
#> GSM531689     5  0.4380     0.6634 0.028 0.048 0.136 0.000 0.788
#> GSM531691     5  0.4380     0.6634 0.028 0.048 0.136 0.000 0.788
#> GSM531692     5  0.4460     0.6259 0.032 0.016 0.204 0.000 0.748
#> GSM531694     2  0.0609     0.7286 0.000 0.980 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
#> GSM531602     2  0.0725    0.74765 0.000 0.976 0.000 0.000 0.012 0.012
#> GSM531604     5  0.4587    0.46224 0.008 0.224 0.016 0.000 0.708 0.044
#> GSM531606     2  0.3595    0.53999 0.000 0.704 0.000 0.000 0.288 0.008
#> GSM531607     2  0.4590    0.50131 0.000 0.668 0.000 0.048 0.012 0.272
#> GSM531608     3  0.1531    0.79877 0.000 0.000 0.928 0.000 0.004 0.068
#> GSM531610     4  0.0000    0.88567 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM531612     4  0.0000    0.88567 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM531613     4  0.1141    0.85700 0.000 0.052 0.000 0.948 0.000 0.000
#> GSM531614     4  0.0000    0.88567 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM531616     3  0.5075    0.14859 0.452 0.000 0.480 0.000 0.004 0.064
#> GSM531618     6  0.4480    0.70399 0.052 0.036 0.104 0.028 0.000 0.780
#> GSM531619     3  0.0790    0.80711 0.000 0.000 0.968 0.000 0.000 0.032
#> GSM531620     3  0.5848    0.31167 0.108 0.000 0.544 0.024 0.004 0.320
#> GSM531623     3  0.0146    0.80497 0.000 0.000 0.996 0.000 0.004 0.000
#> GSM531625     3  0.3840    0.69145 0.152 0.000 0.776 0.000 0.004 0.068
#> GSM531626     3  0.3840    0.69145 0.152 0.000 0.776 0.000 0.004 0.068
#> GSM531632     1  0.2794    0.64979 0.860 0.000 0.080 0.000 0.000 0.060
#> GSM531638     3  0.5075    0.14859 0.452 0.000 0.480 0.000 0.004 0.064
#> GSM531639     3  0.6210   -0.02697 0.140 0.000 0.456 0.024 0.004 0.376
#> GSM531641     4  0.0632    0.87477 0.000 0.000 0.000 0.976 0.000 0.024
#> GSM531642     6  0.3850    0.76484 0.080 0.000 0.036 0.076 0.000 0.808
#> GSM531643     1  0.4675    0.37753 0.584 0.000 0.024 0.016 0.000 0.376
#> GSM531644     6  0.3850    0.76484 0.080 0.000 0.036 0.076 0.000 0.808
#> GSM531645     4  0.0458    0.87918 0.000 0.000 0.000 0.984 0.000 0.016
#> GSM531646     1  0.3396    0.62427 0.812 0.000 0.116 0.000 0.000 0.072
#> GSM531647     1  0.0937    0.71234 0.960 0.000 0.000 0.000 0.000 0.040
#> GSM531648     6  0.3188    0.76942 0.032 0.000 0.040 0.076 0.000 0.852
#> GSM531650     1  0.2135    0.69843 0.872 0.000 0.000 0.000 0.000 0.128
#> GSM531651     3  0.0146    0.80497 0.000 0.000 0.996 0.000 0.004 0.000
#> GSM531652     6  0.3524    0.77415 0.052 0.000 0.040 0.076 0.000 0.832
#> GSM531656     1  0.5611    0.43415 0.536 0.000 0.152 0.000 0.004 0.308
#> GSM531659     2  0.5377    0.31374 0.000 0.540 0.080 0.004 0.008 0.368
#> GSM531661     3  0.1588    0.79670 0.000 0.000 0.924 0.000 0.004 0.072
#> GSM531662     5  0.6680    0.12974 0.000 0.036 0.240 0.000 0.380 0.344
#> GSM531663     2  0.5643    0.55115 0.000 0.644 0.048 0.108 0.004 0.196
#> GSM531664     1  0.3482    0.53604 0.684 0.000 0.000 0.000 0.000 0.316
#> GSM531666     6  0.5001    0.09340 0.396 0.000 0.032 0.024 0.000 0.548
#> GSM531667     3  0.1588    0.79670 0.000 0.000 0.924 0.000 0.004 0.072
#> GSM531668     6  0.2882    0.72692 0.000 0.024 0.024 0.076 0.004 0.872
#> GSM531669     1  0.3458    0.66502 0.808 0.000 0.000 0.000 0.112 0.080
#> GSM531671     5  0.8010    0.11241 0.196 0.016 0.228 0.000 0.288 0.272
#> GSM531672     2  0.4810    0.56304 0.000 0.660 0.000 0.120 0.000 0.220
#> GSM531673     5  0.6680    0.12974 0.000 0.036 0.240 0.000 0.380 0.344
#> GSM531676     5  0.0547    0.66472 0.000 0.020 0.000 0.000 0.980 0.000
#> GSM531679     2  0.1434    0.75418 0.000 0.940 0.000 0.000 0.012 0.048
#> GSM531681     4  0.3717    0.44888 0.000 0.384 0.000 0.616 0.000 0.000
#> GSM531682     2  0.1524    0.75224 0.000 0.932 0.000 0.000 0.008 0.060
#> GSM531683     2  0.0777    0.75250 0.000 0.972 0.000 0.000 0.004 0.024
#> GSM531684     2  0.3615    0.53581 0.000 0.700 0.000 0.000 0.292 0.008
#> GSM531685     5  0.2838    0.54456 0.188 0.000 0.000 0.000 0.808 0.004
#> GSM531686     4  0.3717    0.44888 0.000 0.384 0.000 0.616 0.000 0.000
#> GSM531687     5  0.0547    0.66472 0.000 0.020 0.000 0.000 0.980 0.000
#> GSM531688     1  0.3405    0.51546 0.724 0.000 0.000 0.000 0.272 0.004
#> GSM531690     2  0.2070    0.74083 0.000 0.908 0.000 0.044 0.000 0.048
#> GSM531693     1  0.3426    0.50932 0.720 0.000 0.000 0.000 0.276 0.004
#> GSM531695     5  0.5491    0.00854 0.432 0.028 0.000 0.000 0.480 0.060
#> GSM531603     2  0.4590    0.50131 0.000 0.668 0.000 0.048 0.012 0.272
#> GSM531609     4  0.0000    0.88567 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM531611     4  0.0146    0.88433 0.000 0.000 0.000 0.996 0.000 0.004
#> GSM531621     3  0.0146    0.80497 0.000 0.000 0.996 0.000 0.004 0.000
#> GSM531622     3  0.0790    0.80711 0.000 0.000 0.968 0.000 0.000 0.032
#> GSM531628     1  0.2092    0.69931 0.876 0.000 0.000 0.000 0.000 0.124
#> GSM531630     3  0.0790    0.80711 0.000 0.000 0.968 0.000 0.000 0.032
#> GSM531633     3  0.0146    0.80497 0.000 0.000 0.996 0.000 0.004 0.000
#> GSM531635     1  0.4984   -0.13467 0.492 0.000 0.440 0.000 0.000 0.068
#> GSM531640     3  0.0790    0.80711 0.000 0.000 0.968 0.000 0.000 0.032
#> GSM531649     1  0.1285    0.71149 0.944 0.000 0.004 0.000 0.000 0.052
#> GSM531653     1  0.1285    0.71149 0.944 0.000 0.004 0.000 0.000 0.052
#> GSM531657     6  0.5523   -0.22159 0.000 0.456 0.052 0.036 0.000 0.456
#> GSM531665     2  0.5832    0.26904 0.000 0.512 0.080 0.004 0.032 0.372
#> GSM531670     1  0.5611    0.43415 0.536 0.000 0.152 0.000 0.004 0.308
#> GSM531674     1  0.3175    0.68742 0.832 0.000 0.000 0.000 0.088 0.080
#> GSM531675     2  0.1152    0.75319 0.000 0.952 0.000 0.004 0.000 0.044
#> GSM531677     2  0.1434    0.75418 0.000 0.940 0.000 0.000 0.012 0.048
#> GSM531678     2  0.3547    0.52553 0.000 0.696 0.000 0.000 0.300 0.004
#> GSM531680     5  0.5292    0.23261 0.344 0.028 0.000 0.000 0.572 0.056
#> GSM531689     5  0.0865    0.66149 0.000 0.036 0.000 0.000 0.964 0.000
#> GSM531691     5  0.0865    0.66149 0.000 0.036 0.000 0.000 0.964 0.000
#> GSM531692     5  0.1793    0.65321 0.008 0.004 0.016 0.000 0.932 0.040
#> GSM531694     2  0.0725    0.74765 0.000 0.976 0.000 0.000 0.012 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-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 disease.state(p) k
#> CV:hclust 74            1.000 2
#> CV:hclust 29            1.000 3
#> CV:hclust 48            0.922 4
#> CV:hclust 57            0.892 5
#> CV:hclust 60            0.523 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 51941 rows and 80 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.760           0.910       0.960         0.5007 0.499   0.499
#> 3 3 0.540           0.339       0.630         0.2974 0.706   0.477
#> 4 4 0.831           0.872       0.925         0.1568 0.777   0.440
#> 5 5 0.749           0.623       0.783         0.0615 0.905   0.646
#> 6 6 0.750           0.667       0.807         0.0427 0.919   0.636

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
#> GSM531602     2  0.0000      0.955 0.000 1.000
#> GSM531604     2  0.0376      0.952 0.004 0.996
#> GSM531606     2  0.0000      0.955 0.000 1.000
#> GSM531607     2  0.0000      0.955 0.000 1.000
#> GSM531608     1  0.7219      0.743 0.800 0.200
#> GSM531610     2  0.0000      0.955 0.000 1.000
#> GSM531612     2  0.0000      0.955 0.000 1.000
#> GSM531613     2  0.0000      0.955 0.000 1.000
#> GSM531614     2  0.0000      0.955 0.000 1.000
#> GSM531616     1  0.0000      0.955 1.000 0.000
#> GSM531618     1  0.7219      0.743 0.800 0.200
#> GSM531619     1  0.0000      0.955 1.000 0.000
#> GSM531620     1  0.0000      0.955 1.000 0.000
#> GSM531623     1  0.0000      0.955 1.000 0.000
#> GSM531625     1  0.0000      0.955 1.000 0.000
#> GSM531626     1  0.0000      0.955 1.000 0.000
#> GSM531632     1  0.0000      0.955 1.000 0.000
#> GSM531638     1  0.0000      0.955 1.000 0.000
#> GSM531639     1  0.0000      0.955 1.000 0.000
#> GSM531641     2  0.0000      0.955 0.000 1.000
#> GSM531642     1  0.0000      0.955 1.000 0.000
#> GSM531643     1  0.0000      0.955 1.000 0.000
#> GSM531644     1  0.0000      0.955 1.000 0.000
#> GSM531645     2  0.0000      0.955 0.000 1.000
#> GSM531646     1  0.0000      0.955 1.000 0.000
#> GSM531647     1  0.0000      0.955 1.000 0.000
#> GSM531648     2  0.9944      0.128 0.456 0.544
#> GSM531650     1  0.0000      0.955 1.000 0.000
#> GSM531651     1  0.0000      0.955 1.000 0.000
#> GSM531652     1  0.0000      0.955 1.000 0.000
#> GSM531656     1  0.0000      0.955 1.000 0.000
#> GSM531659     2  0.0000      0.955 0.000 1.000
#> GSM531661     1  0.0000      0.955 1.000 0.000
#> GSM531662     1  0.0000      0.955 1.000 0.000
#> GSM531663     2  0.0000      0.955 0.000 1.000
#> GSM531664     1  0.0000      0.955 1.000 0.000
#> GSM531666     1  0.7219      0.738 0.800 0.200
#> GSM531667     1  0.0000      0.955 1.000 0.000
#> GSM531668     2  0.0000      0.955 0.000 1.000
#> GSM531669     1  0.0000      0.955 1.000 0.000
#> GSM531671     1  0.0000      0.955 1.000 0.000
#> GSM531672     2  0.0000      0.955 0.000 1.000
#> GSM531673     1  0.7883      0.700 0.764 0.236
#> GSM531676     2  0.7219      0.755 0.200 0.800
#> GSM531679     2  0.0000      0.955 0.000 1.000
#> GSM531681     2  0.0000      0.955 0.000 1.000
#> GSM531682     2  0.0000      0.955 0.000 1.000
#> GSM531683     2  0.0000      0.955 0.000 1.000
#> GSM531684     2  0.0000      0.955 0.000 1.000
#> GSM531685     1  0.7883      0.700 0.764 0.236
#> GSM531686     2  0.0000      0.955 0.000 1.000
#> GSM531687     2  0.7219      0.755 0.200 0.800
#> GSM531688     1  0.8081      0.681 0.752 0.248
#> GSM531690     2  0.0000      0.955 0.000 1.000
#> GSM531693     1  0.0000      0.955 1.000 0.000
#> GSM531695     2  0.7219      0.755 0.200 0.800
#> GSM531603     2  0.0000      0.955 0.000 1.000
#> GSM531609     2  0.0000      0.955 0.000 1.000
#> GSM531611     2  0.0000      0.955 0.000 1.000
#> GSM531621     1  0.0000      0.955 1.000 0.000
#> GSM531622     1  0.0000      0.955 1.000 0.000
#> GSM531628     1  0.0000      0.955 1.000 0.000
#> GSM531630     1  0.0000      0.955 1.000 0.000
#> GSM531633     1  0.0000      0.955 1.000 0.000
#> GSM531635     1  0.0000      0.955 1.000 0.000
#> GSM531640     1  0.0000      0.955 1.000 0.000
#> GSM531649     1  0.0000      0.955 1.000 0.000
#> GSM531653     1  0.0000      0.955 1.000 0.000
#> GSM531657     2  0.0000      0.955 0.000 1.000
#> GSM531665     1  0.7056      0.762 0.808 0.192
#> GSM531670     1  0.0000      0.955 1.000 0.000
#> GSM531674     1  0.0000      0.955 1.000 0.000
#> GSM531675     2  0.0000      0.955 0.000 1.000
#> GSM531677     2  0.0000      0.955 0.000 1.000
#> GSM531678     2  0.0000      0.955 0.000 1.000
#> GSM531680     2  0.7139      0.760 0.196 0.804
#> GSM531689     2  0.0000      0.955 0.000 1.000
#> GSM531691     2  0.6712      0.785 0.176 0.824
#> GSM531692     1  0.7745      0.712 0.772 0.228
#> GSM531694     2  0.0000      0.955 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
#> GSM531602     2  0.1129     0.6965 0.004 0.976 0.020
#> GSM531604     2  0.2680     0.6731 0.008 0.924 0.068
#> GSM531606     2  0.1129     0.6965 0.004 0.976 0.020
#> GSM531607     2  0.1129     0.6965 0.004 0.976 0.020
#> GSM531608     3  0.2492     0.6892 0.048 0.016 0.936
#> GSM531610     1  0.7583    -0.2868 0.492 0.468 0.040
#> GSM531612     1  0.7438    -0.1501 0.568 0.392 0.040
#> GSM531613     2  0.6955     0.2644 0.492 0.492 0.016
#> GSM531614     1  0.7438    -0.1501 0.568 0.392 0.040
#> GSM531616     3  0.1860     0.7239 0.052 0.000 0.948
#> GSM531618     3  0.9775     0.0038 0.288 0.272 0.440
#> GSM531619     3  0.0747     0.7406 0.000 0.016 0.984
#> GSM531620     3  0.0592     0.7413 0.000 0.012 0.988
#> GSM531623     3  0.0747     0.7406 0.000 0.016 0.984
#> GSM531625     3  0.1860     0.7239 0.052 0.000 0.948
#> GSM531626     3  0.1529     0.7280 0.040 0.000 0.960
#> GSM531632     3  0.6309     0.1550 0.496 0.000 0.504
#> GSM531638     3  0.1860     0.7239 0.052 0.000 0.948
#> GSM531639     3  0.5678     0.4596 0.316 0.000 0.684
#> GSM531641     1  0.7438    -0.1501 0.568 0.392 0.040
#> GSM531642     3  0.6516     0.2145 0.480 0.004 0.516
#> GSM531643     1  0.6308    -0.1947 0.508 0.000 0.492
#> GSM531644     1  0.6180    -0.1126 0.584 0.000 0.416
#> GSM531645     1  0.7438    -0.1501 0.568 0.392 0.040
#> GSM531646     3  0.6308     0.1650 0.492 0.000 0.508
#> GSM531647     1  0.6309    -0.2027 0.504 0.000 0.496
#> GSM531648     1  0.7551    -0.1308 0.580 0.372 0.048
#> GSM531650     1  0.6308    -0.1947 0.508 0.000 0.492
#> GSM531651     3  0.0592     0.7413 0.000 0.012 0.988
#> GSM531652     1  0.6432    -0.1306 0.568 0.004 0.428
#> GSM531656     3  0.6252     0.2705 0.444 0.000 0.556
#> GSM531659     2  0.7546     0.3526 0.396 0.560 0.044
#> GSM531661     3  0.0747     0.7406 0.000 0.016 0.984
#> GSM531662     3  0.0747     0.7406 0.000 0.016 0.984
#> GSM531663     1  0.7583    -0.2868 0.492 0.468 0.040
#> GSM531664     1  0.6421    -0.1215 0.572 0.004 0.424
#> GSM531666     1  0.6373    -0.1123 0.588 0.004 0.408
#> GSM531667     3  0.0747     0.7406 0.000 0.016 0.984
#> GSM531668     2  0.7956     0.3261 0.424 0.516 0.060
#> GSM531669     1  0.6516    -0.1819 0.516 0.004 0.480
#> GSM531671     3  0.3845     0.6887 0.116 0.012 0.872
#> GSM531672     2  0.7069     0.2790 0.472 0.508 0.020
#> GSM531673     2  0.6577     0.3090 0.008 0.572 0.420
#> GSM531676     2  0.6566     0.3767 0.348 0.636 0.016
#> GSM531679     2  0.1015     0.6953 0.008 0.980 0.012
#> GSM531681     2  0.6095     0.4159 0.392 0.608 0.000
#> GSM531682     2  0.0829     0.6959 0.004 0.984 0.012
#> GSM531683     2  0.0829     0.6954 0.004 0.984 0.012
#> GSM531684     2  0.2878     0.6573 0.000 0.904 0.096
#> GSM531685     2  0.6869     0.2672 0.424 0.560 0.016
#> GSM531686     2  0.6095     0.4159 0.392 0.608 0.000
#> GSM531687     2  0.6566     0.3767 0.348 0.636 0.016
#> GSM531688     1  0.6950    -0.1965 0.508 0.476 0.016
#> GSM531690     2  0.6140     0.3955 0.404 0.596 0.000
#> GSM531693     1  0.6822    -0.1875 0.508 0.012 0.480
#> GSM531695     2  0.6952     0.1773 0.480 0.504 0.016
#> GSM531603     2  0.1129     0.6965 0.004 0.976 0.020
#> GSM531609     1  0.7438    -0.1501 0.568 0.392 0.040
#> GSM531611     1  0.7276    -0.1700 0.564 0.404 0.032
#> GSM531621     3  0.0592     0.7413 0.000 0.012 0.988
#> GSM531622     3  0.0747     0.7406 0.000 0.016 0.984
#> GSM531628     1  0.6308    -0.1947 0.508 0.000 0.492
#> GSM531630     3  0.0747     0.7406 0.000 0.016 0.984
#> GSM531633     3  0.0592     0.7413 0.000 0.012 0.988
#> GSM531635     3  0.5810     0.4555 0.336 0.000 0.664
#> GSM531640     3  0.0747     0.7406 0.000 0.016 0.984
#> GSM531649     3  0.6215     0.3040 0.428 0.000 0.572
#> GSM531653     1  0.6309    -0.2027 0.504 0.000 0.496
#> GSM531657     2  0.7583     0.2551 0.468 0.492 0.040
#> GSM531665     3  0.9716     0.1647 0.344 0.228 0.428
#> GSM531670     3  0.6244     0.2772 0.440 0.000 0.560
#> GSM531674     1  0.6516    -0.1819 0.516 0.004 0.480
#> GSM531675     2  0.0237     0.6912 0.004 0.996 0.000
#> GSM531677     2  0.0237     0.6928 0.004 0.996 0.000
#> GSM531678     2  0.0592     0.6960 0.000 0.988 0.012
#> GSM531680     2  0.6566     0.3767 0.348 0.636 0.016
#> GSM531689     2  0.1315     0.6943 0.008 0.972 0.020
#> GSM531691     2  0.2680     0.6731 0.008 0.924 0.068
#> GSM531692     2  0.8650     0.3671 0.144 0.580 0.276
#> GSM531694     2  0.1129     0.6965 0.004 0.976 0.020

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM531602     2  0.1151      0.915 0.008 0.968 0.000 0.024
#> GSM531604     2  0.1247      0.914 0.012 0.968 0.016 0.004
#> GSM531606     2  0.1377      0.916 0.008 0.964 0.008 0.020
#> GSM531607     2  0.1151      0.915 0.008 0.968 0.000 0.024
#> GSM531608     3  0.0188      0.983 0.004 0.000 0.996 0.000
#> GSM531610     4  0.0376      0.881 0.000 0.004 0.004 0.992
#> GSM531612     4  0.0712      0.882 0.008 0.004 0.004 0.984
#> GSM531613     4  0.0188      0.880 0.000 0.004 0.000 0.996
#> GSM531614     4  0.0712      0.882 0.008 0.004 0.004 0.984
#> GSM531616     3  0.0804      0.980 0.012 0.008 0.980 0.000
#> GSM531618     4  0.6589      0.473 0.100 0.004 0.288 0.608
#> GSM531619     3  0.0188      0.983 0.004 0.000 0.996 0.000
#> GSM531620     3  0.0336      0.983 0.008 0.000 0.992 0.000
#> GSM531623     3  0.0188      0.983 0.004 0.000 0.996 0.000
#> GSM531625     3  0.0657      0.981 0.012 0.004 0.984 0.000
#> GSM531626     3  0.0657      0.981 0.012 0.004 0.984 0.000
#> GSM531632     1  0.1004      0.926 0.972 0.004 0.024 0.000
#> GSM531638     3  0.0804      0.980 0.012 0.008 0.980 0.000
#> GSM531639     1  0.5126      0.307 0.552 0.004 0.444 0.000
#> GSM531641     4  0.0712      0.882 0.008 0.004 0.004 0.984
#> GSM531642     1  0.4444      0.753 0.764 0.008 0.220 0.008
#> GSM531643     1  0.0895      0.926 0.976 0.004 0.020 0.000
#> GSM531644     1  0.1114      0.924 0.972 0.004 0.016 0.008
#> GSM531645     4  0.0712      0.882 0.008 0.004 0.004 0.984
#> GSM531646     1  0.1109      0.926 0.968 0.004 0.028 0.000
#> GSM531647     1  0.0707      0.926 0.980 0.000 0.020 0.000
#> GSM531648     4  0.2742      0.834 0.008 0.008 0.084 0.900
#> GSM531650     1  0.0707      0.926 0.980 0.000 0.020 0.000
#> GSM531651     3  0.0188      0.983 0.004 0.000 0.996 0.000
#> GSM531652     1  0.2778      0.887 0.900 0.004 0.080 0.016
#> GSM531656     1  0.4049      0.769 0.780 0.008 0.212 0.000
#> GSM531659     4  0.5467      0.425 0.008 0.400 0.008 0.584
#> GSM531661     3  0.0336      0.974 0.000 0.008 0.992 0.000
#> GSM531662     3  0.0804      0.964 0.008 0.012 0.980 0.000
#> GSM531663     4  0.0376      0.881 0.000 0.004 0.004 0.992
#> GSM531664     1  0.0657      0.922 0.984 0.004 0.012 0.000
#> GSM531666     1  0.1994      0.906 0.936 0.004 0.052 0.008
#> GSM531667     3  0.0564      0.980 0.004 0.004 0.988 0.004
#> GSM531668     4  0.4303      0.738 0.008 0.220 0.004 0.768
#> GSM531669     1  0.0937      0.921 0.976 0.012 0.012 0.000
#> GSM531671     3  0.3300      0.811 0.144 0.008 0.848 0.000
#> GSM531672     4  0.2216      0.853 0.000 0.092 0.000 0.908
#> GSM531673     2  0.4086      0.717 0.008 0.776 0.216 0.000
#> GSM531676     2  0.2125      0.888 0.076 0.920 0.004 0.000
#> GSM531679     2  0.1042      0.916 0.008 0.972 0.000 0.020
#> GSM531681     4  0.3400      0.777 0.000 0.180 0.000 0.820
#> GSM531682     2  0.1151      0.916 0.008 0.968 0.000 0.024
#> GSM531683     2  0.1151      0.915 0.008 0.968 0.000 0.024
#> GSM531684     2  0.1509      0.913 0.012 0.960 0.020 0.008
#> GSM531685     2  0.2773      0.854 0.116 0.880 0.004 0.000
#> GSM531686     4  0.3400      0.777 0.000 0.180 0.000 0.820
#> GSM531687     2  0.1824      0.896 0.060 0.936 0.004 0.000
#> GSM531688     1  0.0895      0.909 0.976 0.020 0.004 0.000
#> GSM531690     4  0.4250      0.691 0.000 0.276 0.000 0.724
#> GSM531693     1  0.0927      0.912 0.976 0.016 0.008 0.000
#> GSM531695     2  0.5000      0.120 0.496 0.504 0.000 0.000
#> GSM531603     2  0.1151      0.915 0.008 0.968 0.000 0.024
#> GSM531609     4  0.0712      0.882 0.008 0.004 0.004 0.984
#> GSM531611     4  0.0712      0.882 0.008 0.004 0.004 0.984
#> GSM531621     3  0.0336      0.983 0.008 0.000 0.992 0.000
#> GSM531622     3  0.0336      0.983 0.008 0.000 0.992 0.000
#> GSM531628     1  0.0707      0.926 0.980 0.000 0.020 0.000
#> GSM531630     3  0.0336      0.983 0.008 0.000 0.992 0.000
#> GSM531633     3  0.0336      0.983 0.008 0.000 0.992 0.000
#> GSM531635     1  0.1722      0.917 0.944 0.008 0.048 0.000
#> GSM531640     3  0.0524      0.982 0.008 0.004 0.988 0.000
#> GSM531649     1  0.1109      0.926 0.968 0.004 0.028 0.000
#> GSM531653     1  0.0707      0.926 0.980 0.000 0.020 0.000
#> GSM531657     4  0.2345      0.849 0.000 0.100 0.000 0.900
#> GSM531665     2  0.5608      0.716 0.120 0.736 0.140 0.004
#> GSM531670     1  0.4049      0.769 0.780 0.008 0.212 0.000
#> GSM531674     1  0.0937      0.921 0.976 0.012 0.012 0.000
#> GSM531675     2  0.1151      0.916 0.008 0.968 0.000 0.024
#> GSM531677     2  0.1151      0.916 0.008 0.968 0.000 0.024
#> GSM531678     2  0.1082      0.917 0.004 0.972 0.004 0.020
#> GSM531680     2  0.2149      0.881 0.088 0.912 0.000 0.000
#> GSM531689     2  0.0992      0.915 0.012 0.976 0.004 0.008
#> GSM531691     2  0.1124      0.914 0.012 0.972 0.012 0.004
#> GSM531692     2  0.2271      0.890 0.076 0.916 0.008 0.000
#> GSM531694     2  0.1151      0.915 0.008 0.968 0.000 0.024

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>           class entropy silhouette    p1    p2    p3    p4    p5
#> GSM531602     2  0.0000    0.63281 0.000 1.000 0.000 0.000 0.000
#> GSM531604     2  0.4201   -0.11590 0.000 0.592 0.000 0.000 0.408
#> GSM531606     2  0.2605    0.52022 0.000 0.852 0.000 0.000 0.148
#> GSM531607     2  0.0000    0.63281 0.000 1.000 0.000 0.000 0.000
#> GSM531608     3  0.0880    0.91384 0.000 0.000 0.968 0.000 0.032
#> GSM531610     4  0.0162    0.82279 0.000 0.004 0.000 0.996 0.000
#> GSM531612     4  0.0162    0.82279 0.000 0.004 0.000 0.996 0.000
#> GSM531613     4  0.0162    0.82279 0.000 0.004 0.000 0.996 0.000
#> GSM531614     4  0.0162    0.82279 0.000 0.004 0.000 0.996 0.000
#> GSM531616     3  0.1124    0.91577 0.000 0.000 0.960 0.004 0.036
#> GSM531618     5  0.9235   -0.21049 0.168 0.052 0.216 0.224 0.340
#> GSM531619     3  0.0000    0.92535 0.000 0.000 1.000 0.000 0.000
#> GSM531620     3  0.0671    0.92200 0.000 0.000 0.980 0.004 0.016
#> GSM531623     3  0.0000    0.92535 0.000 0.000 1.000 0.000 0.000
#> GSM531625     3  0.0865    0.91960 0.000 0.000 0.972 0.004 0.024
#> GSM531626     3  0.1124    0.91577 0.000 0.000 0.960 0.004 0.036
#> GSM531632     1  0.1043    0.81224 0.960 0.000 0.000 0.000 0.040
#> GSM531638     3  0.1124    0.91577 0.000 0.000 0.960 0.004 0.036
#> GSM531639     3  0.6330   -0.12721 0.416 0.000 0.444 0.004 0.136
#> GSM531641     4  0.0162    0.82279 0.000 0.004 0.000 0.996 0.000
#> GSM531642     1  0.6135    0.56124 0.532 0.000 0.128 0.004 0.336
#> GSM531643     1  0.2230    0.79434 0.884 0.000 0.000 0.000 0.116
#> GSM531644     1  0.3837    0.69047 0.692 0.000 0.000 0.000 0.308
#> GSM531645     4  0.0162    0.82279 0.000 0.004 0.000 0.996 0.000
#> GSM531646     1  0.0794    0.81711 0.972 0.000 0.000 0.000 0.028
#> GSM531647     1  0.0290    0.81870 0.992 0.000 0.000 0.000 0.008
#> GSM531648     4  0.7395    0.41834 0.060 0.116 0.012 0.480 0.332
#> GSM531650     1  0.0609    0.81943 0.980 0.000 0.000 0.000 0.020
#> GSM531651     3  0.0000    0.92535 0.000 0.000 1.000 0.000 0.000
#> GSM531652     1  0.4333    0.67654 0.672 0.004 0.004 0.004 0.316
#> GSM531656     1  0.5159    0.67113 0.688 0.000 0.188 0.000 0.124
#> GSM531659     5  0.6551   -0.15372 0.000 0.304 0.000 0.228 0.468
#> GSM531661     3  0.0880    0.91384 0.000 0.000 0.968 0.000 0.032
#> GSM531662     3  0.2536    0.83717 0.000 0.004 0.868 0.000 0.128
#> GSM531663     4  0.0162    0.82279 0.000 0.004 0.000 0.996 0.000
#> GSM531664     1  0.0609    0.81943 0.980 0.000 0.000 0.000 0.020
#> GSM531666     1  0.4500    0.66952 0.664 0.016 0.004 0.000 0.316
#> GSM531667     3  0.1792    0.87567 0.000 0.000 0.916 0.000 0.084
#> GSM531668     2  0.6477   -0.00151 0.000 0.464 0.000 0.196 0.340
#> GSM531669     1  0.0510    0.81747 0.984 0.000 0.000 0.000 0.016
#> GSM531671     3  0.5658    0.61854 0.120 0.004 0.652 0.004 0.220
#> GSM531672     4  0.6690    0.31200 0.000 0.300 0.000 0.432 0.268
#> GSM531673     5  0.6310    0.29956 0.000 0.328 0.152 0.004 0.516
#> GSM531676     5  0.4494    0.46223 0.012 0.380 0.000 0.000 0.608
#> GSM531679     2  0.3074    0.51371 0.000 0.804 0.000 0.000 0.196
#> GSM531681     4  0.4455    0.56640 0.000 0.260 0.000 0.704 0.036
#> GSM531682     2  0.3395    0.47745 0.000 0.764 0.000 0.000 0.236
#> GSM531683     2  0.0404    0.62962 0.000 0.988 0.000 0.000 0.012
#> GSM531684     2  0.4009    0.20675 0.000 0.684 0.004 0.000 0.312
#> GSM531685     5  0.5405    0.44911 0.072 0.304 0.000 0.004 0.620
#> GSM531686     4  0.4455    0.56640 0.000 0.260 0.000 0.704 0.036
#> GSM531687     5  0.4533    0.39200 0.008 0.448 0.000 0.000 0.544
#> GSM531688     1  0.3561    0.59528 0.740 0.000 0.000 0.000 0.260
#> GSM531690     2  0.5964    0.26981 0.000 0.588 0.000 0.232 0.180
#> GSM531693     1  0.3242    0.67404 0.784 0.000 0.000 0.000 0.216
#> GSM531695     1  0.6740   -0.15470 0.412 0.284 0.000 0.000 0.304
#> GSM531603     2  0.1121    0.60156 0.000 0.956 0.000 0.000 0.044
#> GSM531609     4  0.0162    0.82279 0.000 0.004 0.000 0.996 0.000
#> GSM531611     4  0.0162    0.82279 0.000 0.004 0.000 0.996 0.000
#> GSM531621     3  0.0000    0.92535 0.000 0.000 1.000 0.000 0.000
#> GSM531622     3  0.0000    0.92535 0.000 0.000 1.000 0.000 0.000
#> GSM531628     1  0.0609    0.81943 0.980 0.000 0.000 0.000 0.020
#> GSM531630     3  0.0000    0.92535 0.000 0.000 1.000 0.000 0.000
#> GSM531633     3  0.0000    0.92535 0.000 0.000 1.000 0.000 0.000
#> GSM531635     1  0.3425    0.76584 0.840 0.000 0.112 0.004 0.044
#> GSM531640     3  0.0000    0.92535 0.000 0.000 1.000 0.000 0.000
#> GSM531649     1  0.1205    0.81483 0.956 0.000 0.000 0.004 0.040
#> GSM531653     1  0.0510    0.81911 0.984 0.000 0.000 0.000 0.016
#> GSM531657     4  0.6742    0.29517 0.000 0.288 0.000 0.412 0.300
#> GSM531665     5  0.4711    0.36653 0.020 0.188 0.048 0.000 0.744
#> GSM531670     1  0.5159    0.67113 0.688 0.000 0.188 0.000 0.124
#> GSM531674     1  0.0162    0.81885 0.996 0.000 0.000 0.000 0.004
#> GSM531675     2  0.2424    0.58361 0.000 0.868 0.000 0.000 0.132
#> GSM531677     2  0.2516    0.57634 0.000 0.860 0.000 0.000 0.140
#> GSM531678     2  0.4074    0.12019 0.000 0.636 0.000 0.000 0.364
#> GSM531680     5  0.4658    0.31896 0.012 0.484 0.000 0.000 0.504
#> GSM531689     5  0.4273    0.39634 0.000 0.448 0.000 0.000 0.552
#> GSM531691     5  0.4227    0.42290 0.000 0.420 0.000 0.000 0.580
#> GSM531692     5  0.4517    0.46344 0.008 0.372 0.000 0.004 0.616
#> GSM531694     2  0.0000    0.63281 0.000 1.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
#> GSM531602     2  0.1007     0.7356 0.000 0.956 0.000 0.000 0.044 0.000
#> GSM531604     5  0.4473     0.5945 0.000 0.252 0.000 0.000 0.676 0.072
#> GSM531606     2  0.4044     0.3804 0.000 0.704 0.000 0.000 0.256 0.040
#> GSM531607     2  0.1152     0.7341 0.000 0.952 0.000 0.000 0.044 0.004
#> GSM531608     3  0.1625     0.8787 0.000 0.000 0.928 0.000 0.012 0.060
#> GSM531610     4  0.0146     0.8856 0.000 0.000 0.000 0.996 0.000 0.004
#> GSM531612     4  0.0000     0.8865 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM531613     4  0.0436     0.8830 0.000 0.004 0.000 0.988 0.004 0.004
#> GSM531614     4  0.0000     0.8865 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM531616     3  0.2164     0.8742 0.000 0.012 0.908 0.000 0.020 0.060
#> GSM531618     6  0.5701     0.6264 0.116 0.032 0.060 0.104 0.000 0.688
#> GSM531619     3  0.0837     0.8982 0.000 0.004 0.972 0.000 0.004 0.020
#> GSM531620     3  0.1718     0.8858 0.000 0.008 0.932 0.000 0.016 0.044
#> GSM531623     3  0.0547     0.8994 0.000 0.000 0.980 0.000 0.000 0.020
#> GSM531625     3  0.1838     0.8842 0.000 0.012 0.928 0.000 0.020 0.040
#> GSM531626     3  0.1974     0.8803 0.000 0.012 0.920 0.000 0.020 0.048
#> GSM531632     1  0.1088     0.7693 0.960 0.000 0.000 0.000 0.016 0.024
#> GSM531638     3  0.2164     0.8742 0.000 0.012 0.908 0.000 0.020 0.060
#> GSM531639     6  0.6603     0.1912 0.240 0.008 0.364 0.000 0.016 0.372
#> GSM531641     4  0.0000     0.8865 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM531642     6  0.3997     0.5366 0.288 0.000 0.004 0.020 0.000 0.688
#> GSM531643     1  0.3437     0.5536 0.752 0.004 0.000 0.000 0.008 0.236
#> GSM531644     6  0.3717     0.4325 0.384 0.000 0.000 0.000 0.000 0.616
#> GSM531645     4  0.0000     0.8865 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM531646     1  0.1230     0.7672 0.956 0.008 0.000 0.000 0.008 0.028
#> GSM531647     1  0.0000     0.7740 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM531648     6  0.4822     0.5776 0.056 0.032 0.000 0.224 0.000 0.688
#> GSM531650     1  0.1010     0.7665 0.960 0.000 0.000 0.000 0.004 0.036
#> GSM531651     3  0.0547     0.8994 0.000 0.000 0.980 0.000 0.000 0.020
#> GSM531652     6  0.4092     0.4999 0.344 0.000 0.000 0.020 0.000 0.636
#> GSM531656     1  0.6118     0.3060 0.552 0.008 0.156 0.000 0.024 0.260
#> GSM531659     6  0.4220     0.5014 0.000 0.104 0.000 0.072 0.044 0.780
#> GSM531661     3  0.2581     0.8337 0.000 0.000 0.856 0.000 0.016 0.128
#> GSM531662     3  0.4709     0.6310 0.000 0.000 0.680 0.000 0.188 0.132
#> GSM531663     4  0.0405     0.8830 0.000 0.000 0.000 0.988 0.004 0.008
#> GSM531664     1  0.1367     0.7675 0.944 0.000 0.000 0.000 0.012 0.044
#> GSM531666     6  0.3986     0.4906 0.340 0.004 0.000 0.004 0.004 0.648
#> GSM531667     3  0.2631     0.8066 0.000 0.000 0.840 0.000 0.008 0.152
#> GSM531668     6  0.5412     0.2714 0.000 0.416 0.000 0.060 0.024 0.500
#> GSM531669     1  0.1341     0.7688 0.948 0.000 0.000 0.000 0.024 0.028
#> GSM531671     3  0.7332     0.3248 0.120 0.008 0.440 0.000 0.240 0.192
#> GSM531672     6  0.5746     0.2687 0.000 0.276 0.000 0.160 0.012 0.552
#> GSM531673     5  0.4976     0.6125 0.000 0.048 0.096 0.000 0.712 0.144
#> GSM531676     5  0.2563     0.7269 0.008 0.068 0.000 0.000 0.884 0.040
#> GSM531679     2  0.4954     0.6040 0.000 0.640 0.000 0.000 0.232 0.128
#> GSM531681     4  0.5931     0.2420 0.000 0.324 0.000 0.524 0.028 0.124
#> GSM531682     2  0.5466     0.5258 0.000 0.556 0.000 0.000 0.280 0.164
#> GSM531683     2  0.2221     0.7418 0.000 0.896 0.000 0.000 0.032 0.072
#> GSM531684     5  0.5087     0.4256 0.000 0.348 0.000 0.000 0.560 0.092
#> GSM531685     5  0.2001     0.7147 0.044 0.016 0.000 0.000 0.920 0.020
#> GSM531686     4  0.5931     0.2420 0.000 0.324 0.000 0.524 0.028 0.124
#> GSM531687     5  0.3675     0.6734 0.004 0.124 0.000 0.000 0.796 0.076
#> GSM531688     1  0.4022     0.5778 0.708 0.000 0.000 0.000 0.252 0.040
#> GSM531690     2  0.4677     0.6157 0.000 0.652 0.000 0.032 0.024 0.292
#> GSM531693     1  0.3301     0.6401 0.788 0.000 0.000 0.000 0.188 0.024
#> GSM531695     1  0.7035    -0.0981 0.364 0.192 0.000 0.000 0.360 0.084
#> GSM531603     2  0.1572     0.7241 0.000 0.936 0.000 0.000 0.036 0.028
#> GSM531609     4  0.0000     0.8865 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM531611     4  0.0146     0.8858 0.000 0.000 0.000 0.996 0.004 0.000
#> GSM531621     3  0.0000     0.9012 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM531622     3  0.0146     0.9012 0.000 0.004 0.996 0.000 0.000 0.000
#> GSM531628     1  0.0692     0.7720 0.976 0.000 0.000 0.000 0.004 0.020
#> GSM531630     3  0.0146     0.9012 0.000 0.004 0.996 0.000 0.000 0.000
#> GSM531633     3  0.0000     0.9012 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM531635     1  0.4857     0.5538 0.712 0.012 0.188 0.000 0.020 0.068
#> GSM531640     3  0.0551     0.9001 0.000 0.004 0.984 0.000 0.004 0.008
#> GSM531649     1  0.2512     0.7380 0.900 0.012 0.020 0.000 0.020 0.048
#> GSM531653     1  0.0000     0.7740 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM531657     6  0.5171     0.4159 0.000 0.196 0.000 0.140 0.012 0.652
#> GSM531665     5  0.4009     0.5718 0.012 0.008 0.000 0.000 0.676 0.304
#> GSM531670     1  0.6118     0.3060 0.552 0.008 0.156 0.000 0.024 0.260
#> GSM531674     1  0.1003     0.7733 0.964 0.000 0.000 0.000 0.016 0.020
#> GSM531675     2  0.4549     0.6769 0.000 0.680 0.000 0.000 0.088 0.232
#> GSM531677     2  0.4792     0.6686 0.000 0.672 0.000 0.000 0.148 0.180
#> GSM531678     5  0.4808     0.3024 0.000 0.360 0.000 0.000 0.576 0.064
#> GSM531680     5  0.4516     0.5837 0.012 0.184 0.000 0.000 0.720 0.084
#> GSM531689     5  0.2858     0.7043 0.000 0.124 0.000 0.000 0.844 0.032
#> GSM531691     5  0.1838     0.7346 0.000 0.068 0.000 0.000 0.916 0.016
#> GSM531692     5  0.2375     0.7197 0.008 0.036 0.000 0.000 0.896 0.060
#> GSM531694     2  0.1007     0.7356 0.000 0.956 0.000 0.000 0.044 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-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)
#> Error in mat[ceiling(1:nr/h_ratio), ceiling(1:nc/w_ratio), drop = FALSE]: subscript out of bounds

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

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

collect_plots(res)

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.828           0.896       0.956         0.5059 0.494   0.494
#> 3 3 0.629           0.827       0.848         0.3217 0.710   0.481
#> 4 4 0.941           0.924       0.967         0.1333 0.816   0.515
#> 5 5 0.799           0.745       0.845         0.0543 0.950   0.799
#> 6 6 0.762           0.691       0.845         0.0395 0.936   0.707

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

suggest_best_k(res)
#> [1] 4

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

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

show/hide code output

cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#>           class entropy silhouette    p1    p2
#> GSM531602     2  0.0000      0.938 0.000 1.000
#> GSM531604     2  0.0000      0.938 0.000 1.000
#> GSM531606     2  0.0000      0.938 0.000 1.000
#> GSM531607     2  0.0000      0.938 0.000 1.000
#> GSM531608     1  0.7139      0.747 0.804 0.196
#> GSM531610     2  0.0000      0.938 0.000 1.000
#> GSM531612     2  0.0000      0.938 0.000 1.000
#> GSM531613     2  0.0000      0.938 0.000 1.000
#> GSM531614     2  0.0000      0.938 0.000 1.000
#> GSM531616     1  0.0000      0.966 1.000 0.000
#> GSM531618     1  0.9522      0.423 0.628 0.372
#> GSM531619     1  0.0672      0.960 0.992 0.008
#> GSM531620     1  0.0000      0.966 1.000 0.000
#> GSM531623     1  0.0000      0.966 1.000 0.000
#> GSM531625     1  0.0000      0.966 1.000 0.000
#> GSM531626     1  0.0000      0.966 1.000 0.000
#> GSM531632     1  0.0000      0.966 1.000 0.000
#> GSM531638     1  0.0000      0.966 1.000 0.000
#> GSM531639     1  0.0000      0.966 1.000 0.000
#> GSM531641     2  0.0000      0.938 0.000 1.000
#> GSM531642     1  0.0000      0.966 1.000 0.000
#> GSM531643     1  0.0000      0.966 1.000 0.000
#> GSM531644     1  0.0000      0.966 1.000 0.000
#> GSM531645     2  0.0000      0.938 0.000 1.000
#> GSM531646     1  0.0000      0.966 1.000 0.000
#> GSM531647     1  0.0000      0.966 1.000 0.000
#> GSM531648     1  0.9686      0.365 0.604 0.396
#> GSM531650     1  0.0000      0.966 1.000 0.000
#> GSM531651     1  0.0000      0.966 1.000 0.000
#> GSM531652     1  0.0000      0.966 1.000 0.000
#> GSM531656     1  0.0000      0.966 1.000 0.000
#> GSM531659     2  0.0000      0.938 0.000 1.000
#> GSM531661     1  0.0672      0.960 0.992 0.008
#> GSM531662     1  0.0000      0.966 1.000 0.000
#> GSM531663     2  0.0000      0.938 0.000 1.000
#> GSM531664     1  0.0000      0.966 1.000 0.000
#> GSM531666     1  0.5946      0.811 0.856 0.144
#> GSM531667     1  0.2778      0.925 0.952 0.048
#> GSM531668     2  0.0000      0.938 0.000 1.000
#> GSM531669     1  0.0000      0.966 1.000 0.000
#> GSM531671     1  0.0000      0.966 1.000 0.000
#> GSM531672     2  0.0000      0.938 0.000 1.000
#> GSM531673     2  0.9393      0.507 0.356 0.644
#> GSM531676     2  0.7139      0.750 0.196 0.804
#> GSM531679     2  0.0000      0.938 0.000 1.000
#> GSM531681     2  0.0000      0.938 0.000 1.000
#> GSM531682     2  0.0000      0.938 0.000 1.000
#> GSM531683     2  0.0000      0.938 0.000 1.000
#> GSM531684     2  0.0000      0.938 0.000 1.000
#> GSM531685     2  0.9686      0.426 0.396 0.604
#> GSM531686     2  0.0000      0.938 0.000 1.000
#> GSM531687     2  0.2778      0.904 0.048 0.952
#> GSM531688     2  0.9686      0.426 0.396 0.604
#> GSM531690     2  0.0000      0.938 0.000 1.000
#> GSM531693     1  0.0000      0.966 1.000 0.000
#> GSM531695     2  0.2778      0.904 0.048 0.952
#> GSM531603     2  0.0000      0.938 0.000 1.000
#> GSM531609     2  0.0000      0.938 0.000 1.000
#> GSM531611     2  0.0000      0.938 0.000 1.000
#> GSM531621     1  0.0000      0.966 1.000 0.000
#> GSM531622     1  0.0000      0.966 1.000 0.000
#> GSM531628     1  0.0000      0.966 1.000 0.000
#> GSM531630     1  0.0000      0.966 1.000 0.000
#> GSM531633     1  0.0000      0.966 1.000 0.000
#> GSM531635     1  0.0000      0.966 1.000 0.000
#> GSM531640     1  0.2778      0.925 0.952 0.048
#> GSM531649     1  0.0000      0.966 1.000 0.000
#> GSM531653     1  0.0000      0.966 1.000 0.000
#> GSM531657     2  0.0000      0.938 0.000 1.000
#> GSM531665     2  0.9795      0.377 0.416 0.584
#> GSM531670     1  0.0000      0.966 1.000 0.000
#> GSM531674     1  0.0000      0.966 1.000 0.000
#> GSM531675     2  0.0000      0.938 0.000 1.000
#> GSM531677     2  0.0000      0.938 0.000 1.000
#> GSM531678     2  0.0000      0.938 0.000 1.000
#> GSM531680     2  0.2778      0.904 0.048 0.952
#> GSM531689     2  0.0000      0.938 0.000 1.000
#> GSM531691     2  0.0376      0.935 0.004 0.996
#> GSM531692     2  0.9686      0.426 0.396 0.604
#> GSM531694     2  0.0000      0.938 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
#> GSM531602     2   0.000     0.8966 0.000 1.000 0.000
#> GSM531604     2   0.429     0.7204 0.000 0.820 0.180
#> GSM531606     2   0.000     0.8966 0.000 1.000 0.000
#> GSM531607     2   0.000     0.8966 0.000 1.000 0.000
#> GSM531608     3   0.394     0.9203 0.156 0.000 0.844
#> GSM531610     2   0.394     0.8850 0.000 0.844 0.156
#> GSM531612     2   0.394     0.8850 0.000 0.844 0.156
#> GSM531613     2   0.394     0.8850 0.000 0.844 0.156
#> GSM531614     2   0.394     0.8850 0.000 0.844 0.156
#> GSM531616     3   0.406     0.9134 0.164 0.000 0.836
#> GSM531618     3   0.497     0.4137 0.000 0.236 0.764
#> GSM531619     3   0.394     0.9203 0.156 0.000 0.844
#> GSM531620     3   0.394     0.9203 0.156 0.000 0.844
#> GSM531623     3   0.394     0.9203 0.156 0.000 0.844
#> GSM531625     3   0.394     0.9203 0.156 0.000 0.844
#> GSM531626     3   0.394     0.9203 0.156 0.000 0.844
#> GSM531632     1   0.000     0.8531 1.000 0.000 0.000
#> GSM531638     3   0.394     0.9203 0.156 0.000 0.844
#> GSM531639     3   0.568     0.7197 0.316 0.000 0.684
#> GSM531641     2   0.394     0.8850 0.000 0.844 0.156
#> GSM531642     1   0.629     0.4473 0.536 0.000 0.464
#> GSM531643     1   0.000     0.8531 1.000 0.000 0.000
#> GSM531644     1   0.394     0.7930 0.844 0.000 0.156
#> GSM531645     2   0.394     0.8850 0.000 0.844 0.156
#> GSM531646     1   0.000     0.8531 1.000 0.000 0.000
#> GSM531647     1   0.000     0.8531 1.000 0.000 0.000
#> GSM531648     2   0.533     0.8065 0.004 0.748 0.248
#> GSM531650     1   0.000     0.8531 1.000 0.000 0.000
#> GSM531651     3   0.394     0.9203 0.156 0.000 0.844
#> GSM531652     1   0.510     0.7489 0.752 0.000 0.248
#> GSM531656     1   0.429     0.6580 0.820 0.000 0.180
#> GSM531659     2   0.394     0.8850 0.000 0.844 0.156
#> GSM531661     3   0.394     0.9203 0.156 0.000 0.844
#> GSM531662     3   0.394     0.9203 0.156 0.000 0.844
#> GSM531663     2   0.394     0.8850 0.000 0.844 0.156
#> GSM531664     1   0.394     0.7930 0.844 0.000 0.156
#> GSM531666     1   0.394     0.7930 0.844 0.000 0.156
#> GSM531667     3   0.394     0.9203 0.156 0.000 0.844
#> GSM531668     2   0.394     0.8850 0.000 0.844 0.156
#> GSM531669     1   0.000     0.8531 1.000 0.000 0.000
#> GSM531671     3   0.590     0.6702 0.352 0.000 0.648
#> GSM531672     2   0.394     0.8850 0.000 0.844 0.156
#> GSM531673     3   0.394     0.7436 0.000 0.156 0.844
#> GSM531676     1   0.400     0.8032 0.840 0.160 0.000
#> GSM531679     2   0.000     0.8966 0.000 1.000 0.000
#> GSM531681     2   0.000     0.8966 0.000 1.000 0.000
#> GSM531682     2   0.000     0.8966 0.000 1.000 0.000
#> GSM531683     2   0.000     0.8966 0.000 1.000 0.000
#> GSM531684     2   0.631    -0.0476 0.000 0.512 0.488
#> GSM531685     1   0.394     0.8050 0.844 0.156 0.000
#> GSM531686     2   0.000     0.8966 0.000 1.000 0.000
#> GSM531687     1   0.400     0.8032 0.840 0.160 0.000
#> GSM531688     1   0.394     0.8050 0.844 0.156 0.000
#> GSM531690     2   0.129     0.8963 0.000 0.968 0.032
#> GSM531693     1   0.000     0.8531 1.000 0.000 0.000
#> GSM531695     1   0.394     0.8050 0.844 0.156 0.000
#> GSM531603     2   0.000     0.8966 0.000 1.000 0.000
#> GSM531609     2   0.394     0.8850 0.000 0.844 0.156
#> GSM531611     2   0.394     0.8850 0.000 0.844 0.156
#> GSM531621     3   0.394     0.9203 0.156 0.000 0.844
#> GSM531622     3   0.394     0.9203 0.156 0.000 0.844
#> GSM531628     1   0.000     0.8531 1.000 0.000 0.000
#> GSM531630     3   0.394     0.9203 0.156 0.000 0.844
#> GSM531633     3   0.394     0.9203 0.156 0.000 0.844
#> GSM531635     1   0.382     0.6995 0.852 0.000 0.148
#> GSM531640     3   0.394     0.9203 0.156 0.000 0.844
#> GSM531649     1   0.000     0.8531 1.000 0.000 0.000
#> GSM531653     1   0.000     0.8531 1.000 0.000 0.000
#> GSM531657     2   0.394     0.8850 0.000 0.844 0.156
#> GSM531665     1   0.797     0.6532 0.660 0.156 0.184
#> GSM531670     1   0.429     0.6580 0.820 0.000 0.180
#> GSM531674     1   0.000     0.8531 1.000 0.000 0.000
#> GSM531675     2   0.000     0.8966 0.000 1.000 0.000
#> GSM531677     2   0.000     0.8966 0.000 1.000 0.000
#> GSM531678     2   0.000     0.8966 0.000 1.000 0.000
#> GSM531680     1   0.406     0.8009 0.836 0.164 0.000
#> GSM531689     2   0.000     0.8966 0.000 1.000 0.000
#> GSM531691     2   0.254     0.8398 0.000 0.920 0.080
#> GSM531692     3   0.906     0.2274 0.324 0.156 0.520
#> GSM531694     2   0.000     0.8966 0.000 1.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
#> GSM531602     2  0.0000      0.949 0.000 1.000 0.000 0.000
#> GSM531604     2  0.0000      0.949 0.000 1.000 0.000 0.000
#> GSM531606     2  0.0000      0.949 0.000 1.000 0.000 0.000
#> GSM531607     2  0.0000      0.949 0.000 1.000 0.000 0.000
#> GSM531608     3  0.0000      0.967 0.000 0.000 1.000 0.000
#> GSM531610     4  0.0000      0.990 0.000 0.000 0.000 1.000
#> GSM531612     4  0.0000      0.990 0.000 0.000 0.000 1.000
#> GSM531613     4  0.0000      0.990 0.000 0.000 0.000 1.000
#> GSM531614     4  0.0000      0.990 0.000 0.000 0.000 1.000
#> GSM531616     3  0.0000      0.967 0.000 0.000 1.000 0.000
#> GSM531618     4  0.0000      0.990 0.000 0.000 0.000 1.000
#> GSM531619     3  0.0000      0.967 0.000 0.000 1.000 0.000
#> GSM531620     3  0.0000      0.967 0.000 0.000 1.000 0.000
#> GSM531623     3  0.0000      0.967 0.000 0.000 1.000 0.000
#> GSM531625     3  0.0000      0.967 0.000 0.000 1.000 0.000
#> GSM531626     3  0.0000      0.967 0.000 0.000 1.000 0.000
#> GSM531632     1  0.0000      0.953 1.000 0.000 0.000 0.000
#> GSM531638     3  0.0000      0.967 0.000 0.000 1.000 0.000
#> GSM531639     3  0.4624      0.448 0.340 0.000 0.660 0.000
#> GSM531641     4  0.0000      0.990 0.000 0.000 0.000 1.000
#> GSM531642     1  0.4307      0.757 0.784 0.000 0.192 0.024
#> GSM531643     1  0.0000      0.953 1.000 0.000 0.000 0.000
#> GSM531644     1  0.0000      0.953 1.000 0.000 0.000 0.000
#> GSM531645     4  0.0000      0.990 0.000 0.000 0.000 1.000
#> GSM531646     1  0.0000      0.953 1.000 0.000 0.000 0.000
#> GSM531647     1  0.0000      0.953 1.000 0.000 0.000 0.000
#> GSM531648     4  0.0000      0.990 0.000 0.000 0.000 1.000
#> GSM531650     1  0.0000      0.953 1.000 0.000 0.000 0.000
#> GSM531651     3  0.0000      0.967 0.000 0.000 1.000 0.000
#> GSM531652     1  0.0921      0.934 0.972 0.000 0.000 0.028
#> GSM531656     1  0.3569      0.765 0.804 0.000 0.196 0.000
#> GSM531659     4  0.0000      0.990 0.000 0.000 0.000 1.000
#> GSM531661     3  0.0000      0.967 0.000 0.000 1.000 0.000
#> GSM531662     3  0.0000      0.967 0.000 0.000 1.000 0.000
#> GSM531663     4  0.0000      0.990 0.000 0.000 0.000 1.000
#> GSM531664     1  0.0000      0.953 1.000 0.000 0.000 0.000
#> GSM531666     1  0.0188      0.950 0.996 0.000 0.000 0.004
#> GSM531667     3  0.0000      0.967 0.000 0.000 1.000 0.000
#> GSM531668     4  0.0000      0.990 0.000 0.000 0.000 1.000
#> GSM531669     1  0.0000      0.953 1.000 0.000 0.000 0.000
#> GSM531671     3  0.3569      0.730 0.196 0.000 0.804 0.000
#> GSM531672     4  0.0000      0.990 0.000 0.000 0.000 1.000
#> GSM531673     2  0.4713      0.441 0.000 0.640 0.360 0.000
#> GSM531676     2  0.0000      0.949 0.000 1.000 0.000 0.000
#> GSM531679     2  0.0000      0.949 0.000 1.000 0.000 0.000
#> GSM531681     4  0.1474      0.950 0.000 0.052 0.000 0.948
#> GSM531682     2  0.0000      0.949 0.000 1.000 0.000 0.000
#> GSM531683     2  0.0000      0.949 0.000 1.000 0.000 0.000
#> GSM531684     2  0.0000      0.949 0.000 1.000 0.000 0.000
#> GSM531685     2  0.0188      0.946 0.004 0.996 0.000 0.000
#> GSM531686     4  0.1557      0.946 0.000 0.056 0.000 0.944
#> GSM531687     2  0.0000      0.949 0.000 1.000 0.000 0.000
#> GSM531688     1  0.0000      0.953 1.000 0.000 0.000 0.000
#> GSM531690     4  0.1389      0.954 0.000 0.048 0.000 0.952
#> GSM531693     1  0.0000      0.953 1.000 0.000 0.000 0.000
#> GSM531695     2  0.4916      0.306 0.424 0.576 0.000 0.000
#> GSM531603     2  0.0000      0.949 0.000 1.000 0.000 0.000
#> GSM531609     4  0.0000      0.990 0.000 0.000 0.000 1.000
#> GSM531611     4  0.0000      0.990 0.000 0.000 0.000 1.000
#> GSM531621     3  0.0000      0.967 0.000 0.000 1.000 0.000
#> GSM531622     3  0.0000      0.967 0.000 0.000 1.000 0.000
#> GSM531628     1  0.0000      0.953 1.000 0.000 0.000 0.000
#> GSM531630     3  0.0000      0.967 0.000 0.000 1.000 0.000
#> GSM531633     3  0.0000      0.967 0.000 0.000 1.000 0.000
#> GSM531635     1  0.3444      0.767 0.816 0.000 0.184 0.000
#> GSM531640     3  0.0000      0.967 0.000 0.000 1.000 0.000
#> GSM531649     1  0.0000      0.953 1.000 0.000 0.000 0.000
#> GSM531653     1  0.0000      0.953 1.000 0.000 0.000 0.000
#> GSM531657     4  0.0000      0.990 0.000 0.000 0.000 1.000
#> GSM531665     2  0.5742      0.571 0.276 0.664 0.060 0.000
#> GSM531670     1  0.3610      0.760 0.800 0.000 0.200 0.000
#> GSM531674     1  0.0000      0.953 1.000 0.000 0.000 0.000
#> GSM531675     2  0.0000      0.949 0.000 1.000 0.000 0.000
#> GSM531677     2  0.0000      0.949 0.000 1.000 0.000 0.000
#> GSM531678     2  0.0000      0.949 0.000 1.000 0.000 0.000
#> GSM531680     2  0.0188      0.946 0.004 0.996 0.000 0.000
#> GSM531689     2  0.0000      0.949 0.000 1.000 0.000 0.000
#> GSM531691     2  0.0000      0.949 0.000 1.000 0.000 0.000
#> GSM531692     2  0.0000      0.949 0.000 1.000 0.000 0.000
#> GSM531694     2  0.0000      0.949 0.000 1.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
#> GSM531602     2  0.0000     0.8080 0.000 1.000 0.000 0.000 0.000
#> GSM531604     2  0.3074     0.5647 0.000 0.804 0.000 0.000 0.196
#> GSM531606     2  0.0880     0.7854 0.000 0.968 0.000 0.000 0.032
#> GSM531607     2  0.0000     0.8080 0.000 1.000 0.000 0.000 0.000
#> GSM531608     3  0.0000     0.9496 0.000 0.000 1.000 0.000 0.000
#> GSM531610     4  0.0000     0.8373 0.000 0.000 0.000 1.000 0.000
#> GSM531612     4  0.0000     0.8373 0.000 0.000 0.000 1.000 0.000
#> GSM531613     4  0.0000     0.8373 0.000 0.000 0.000 1.000 0.000
#> GSM531614     4  0.0000     0.8373 0.000 0.000 0.000 1.000 0.000
#> GSM531616     3  0.0162     0.9470 0.004 0.000 0.996 0.000 0.000
#> GSM531618     4  0.4150     0.6565 0.000 0.000 0.000 0.612 0.388
#> GSM531619     3  0.0000     0.9496 0.000 0.000 1.000 0.000 0.000
#> GSM531620     3  0.0000     0.9496 0.000 0.000 1.000 0.000 0.000
#> GSM531623     3  0.0000     0.9496 0.000 0.000 1.000 0.000 0.000
#> GSM531625     3  0.0000     0.9496 0.000 0.000 1.000 0.000 0.000
#> GSM531626     3  0.0000     0.9496 0.000 0.000 1.000 0.000 0.000
#> GSM531632     1  0.0290     0.8176 0.992 0.000 0.000 0.000 0.008
#> GSM531638     3  0.0000     0.9496 0.000 0.000 1.000 0.000 0.000
#> GSM531639     3  0.5974     0.2909 0.292 0.000 0.564 0.000 0.144
#> GSM531641     4  0.0000     0.8373 0.000 0.000 0.000 1.000 0.000
#> GSM531642     1  0.6437     0.5046 0.492 0.000 0.092 0.028 0.388
#> GSM531643     1  0.1608     0.8005 0.928 0.000 0.000 0.000 0.072
#> GSM531644     1  0.3932     0.6578 0.672 0.000 0.000 0.000 0.328
#> GSM531645     4  0.0000     0.8373 0.000 0.000 0.000 1.000 0.000
#> GSM531646     1  0.0000     0.8198 1.000 0.000 0.000 0.000 0.000
#> GSM531647     1  0.0000     0.8198 1.000 0.000 0.000 0.000 0.000
#> GSM531648     4  0.4150     0.6565 0.000 0.000 0.000 0.612 0.388
#> GSM531650     1  0.0000     0.8198 1.000 0.000 0.000 0.000 0.000
#> GSM531651     3  0.0000     0.9496 0.000 0.000 1.000 0.000 0.000
#> GSM531652     1  0.4930     0.5764 0.580 0.000 0.000 0.032 0.388
#> GSM531656     1  0.3621     0.6939 0.788 0.000 0.192 0.000 0.020
#> GSM531659     4  0.4163     0.7568 0.000 0.032 0.000 0.740 0.228
#> GSM531661     3  0.0693     0.9374 0.000 0.008 0.980 0.000 0.012
#> GSM531662     3  0.1894     0.8906 0.000 0.008 0.920 0.000 0.072
#> GSM531663     4  0.0000     0.8373 0.000 0.000 0.000 1.000 0.000
#> GSM531664     1  0.0000     0.8198 1.000 0.000 0.000 0.000 0.000
#> GSM531666     1  0.4150     0.6144 0.612 0.000 0.000 0.000 0.388
#> GSM531667     3  0.1270     0.9098 0.000 0.000 0.948 0.000 0.052
#> GSM531668     4  0.6433     0.4997 0.000 0.268 0.000 0.504 0.228
#> GSM531669     1  0.0703     0.8107 0.976 0.000 0.000 0.000 0.024
#> GSM531671     3  0.5141     0.6213 0.212 0.012 0.700 0.000 0.076
#> GSM531672     4  0.3343     0.7845 0.000 0.016 0.000 0.812 0.172
#> GSM531673     2  0.6410     0.0386 0.000 0.488 0.320 0.000 0.192
#> GSM531676     5  0.4425     0.7689 0.004 0.452 0.000 0.000 0.544
#> GSM531679     2  0.0510     0.8030 0.000 0.984 0.000 0.000 0.016
#> GSM531681     4  0.4161     0.3484 0.000 0.392 0.000 0.608 0.000
#> GSM531682     2  0.0510     0.8030 0.000 0.984 0.000 0.000 0.016
#> GSM531683     2  0.0000     0.8080 0.000 1.000 0.000 0.000 0.000
#> GSM531684     2  0.2813     0.6228 0.000 0.832 0.000 0.000 0.168
#> GSM531685     5  0.5306     0.7346 0.072 0.316 0.000 0.000 0.612
#> GSM531686     4  0.4161     0.3484 0.000 0.392 0.000 0.608 0.000
#> GSM531687     5  0.4437     0.7595 0.004 0.464 0.000 0.000 0.532
#> GSM531688     1  0.4219     0.2333 0.584 0.000 0.000 0.000 0.416
#> GSM531690     2  0.5111     0.0261 0.000 0.552 0.000 0.408 0.040
#> GSM531693     1  0.4210     0.2433 0.588 0.000 0.000 0.000 0.412
#> GSM531695     5  0.6722     0.4849 0.316 0.268 0.000 0.000 0.416
#> GSM531603     2  0.0000     0.8080 0.000 1.000 0.000 0.000 0.000
#> GSM531609     4  0.0000     0.8373 0.000 0.000 0.000 1.000 0.000
#> GSM531611     4  0.0000     0.8373 0.000 0.000 0.000 1.000 0.000
#> GSM531621     3  0.0000     0.9496 0.000 0.000 1.000 0.000 0.000
#> GSM531622     3  0.0000     0.9496 0.000 0.000 1.000 0.000 0.000
#> GSM531628     1  0.0000     0.8198 1.000 0.000 0.000 0.000 0.000
#> GSM531630     3  0.0000     0.9496 0.000 0.000 1.000 0.000 0.000
#> GSM531633     3  0.0000     0.9496 0.000 0.000 1.000 0.000 0.000
#> GSM531635     1  0.2471     0.7482 0.864 0.000 0.136 0.000 0.000
#> GSM531640     3  0.0000     0.9496 0.000 0.000 1.000 0.000 0.000
#> GSM531649     1  0.0000     0.8198 1.000 0.000 0.000 0.000 0.000
#> GSM531653     1  0.0000     0.8198 1.000 0.000 0.000 0.000 0.000
#> GSM531657     4  0.3789     0.7675 0.000 0.020 0.000 0.768 0.212
#> GSM531665     5  0.6232     0.6172 0.160 0.200 0.024 0.000 0.616
#> GSM531670     1  0.3621     0.6939 0.788 0.000 0.192 0.000 0.020
#> GSM531674     1  0.0609     0.8125 0.980 0.000 0.000 0.000 0.020
#> GSM531675     2  0.0510     0.8037 0.000 0.984 0.000 0.000 0.016
#> GSM531677     2  0.0510     0.8030 0.000 0.984 0.000 0.000 0.016
#> GSM531678     2  0.2230     0.6848 0.000 0.884 0.000 0.000 0.116
#> GSM531680     5  0.4811     0.7657 0.020 0.452 0.000 0.000 0.528
#> GSM531689     5  0.4304     0.7264 0.000 0.484 0.000 0.000 0.516
#> GSM531691     5  0.4268     0.7456 0.000 0.444 0.000 0.000 0.556
#> GSM531692     5  0.4288     0.7553 0.004 0.384 0.000 0.000 0.612
#> GSM531694     2  0.0000     0.8080 0.000 1.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
#> GSM531602     2  0.0632   7.58e-01 0.000 0.976 0.000 0.000 0.024 0.000
#> GSM531604     5  0.4978   1.33e-01 0.000 0.396 0.000 0.000 0.532 0.072
#> GSM531606     2  0.3025   6.38e-01 0.000 0.820 0.000 0.000 0.156 0.024
#> GSM531607     2  0.0632   7.58e-01 0.000 0.976 0.000 0.000 0.024 0.000
#> GSM531608     3  0.0891   8.96e-01 0.000 0.000 0.968 0.000 0.008 0.024
#> GSM531610     4  0.0000   8.64e-01 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM531612     4  0.0000   8.64e-01 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM531613     4  0.0000   8.64e-01 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM531614     4  0.0000   8.64e-01 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM531616     3  0.1155   8.91e-01 0.004 0.000 0.956 0.000 0.004 0.036
#> GSM531618     6  0.2668   6.84e-01 0.000 0.000 0.004 0.168 0.000 0.828
#> GSM531619     3  0.0291   9.04e-01 0.000 0.000 0.992 0.000 0.004 0.004
#> GSM531620     3  0.0146   9.05e-01 0.000 0.000 0.996 0.000 0.000 0.004
#> GSM531623     3  0.0291   9.04e-01 0.000 0.000 0.992 0.000 0.004 0.004
#> GSM531625     3  0.0790   8.97e-01 0.000 0.000 0.968 0.000 0.000 0.032
#> GSM531626     3  0.0790   8.97e-01 0.000 0.000 0.968 0.000 0.000 0.032
#> GSM531632     1  0.0000   8.65e-01 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM531638     3  0.1010   8.93e-01 0.000 0.000 0.960 0.000 0.004 0.036
#> GSM531639     3  0.5387   3.53e-01 0.120 0.000 0.560 0.000 0.004 0.316
#> GSM531641     4  0.0000   8.64e-01 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM531642     6  0.2613   7.24e-01 0.140 0.000 0.012 0.000 0.000 0.848
#> GSM531643     1  0.2442   7.59e-01 0.852 0.000 0.000 0.000 0.004 0.144
#> GSM531644     6  0.3288   5.89e-01 0.276 0.000 0.000 0.000 0.000 0.724
#> GSM531645     4  0.0000   8.64e-01 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM531646     1  0.0508   8.63e-01 0.984 0.000 0.000 0.000 0.004 0.012
#> GSM531647     1  0.0000   8.65e-01 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM531648     6  0.2631   6.77e-01 0.000 0.000 0.000 0.180 0.000 0.820
#> GSM531650     1  0.0363   8.62e-01 0.988 0.000 0.000 0.000 0.000 0.012
#> GSM531651     3  0.0291   9.04e-01 0.000 0.000 0.992 0.000 0.004 0.004
#> GSM531652     6  0.2527   7.24e-01 0.168 0.000 0.000 0.000 0.000 0.832
#> GSM531656     1  0.4627   6.37e-01 0.716 0.000 0.164 0.000 0.012 0.108
#> GSM531659     6  0.6092   3.13e-01 0.000 0.160 0.000 0.312 0.024 0.504
#> GSM531661     3  0.2277   8.46e-01 0.000 0.000 0.892 0.000 0.032 0.076
#> GSM531662     3  0.4794   5.93e-01 0.000 0.004 0.668 0.000 0.228 0.100
#> GSM531663     4  0.0000   8.64e-01 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM531664     1  0.0603   8.63e-01 0.980 0.000 0.000 0.000 0.004 0.016
#> GSM531666     6  0.2491   7.24e-01 0.164 0.000 0.000 0.000 0.000 0.836
#> GSM531667     3  0.1970   8.43e-01 0.000 0.000 0.900 0.000 0.008 0.092
#> GSM531668     2  0.5471   2.97e-01 0.000 0.608 0.004 0.188 0.004 0.196
#> GSM531669     1  0.0508   8.62e-01 0.984 0.000 0.000 0.000 0.012 0.004
#> GSM531671     3  0.7189   2.57e-01 0.212 0.004 0.448 0.000 0.228 0.108
#> GSM531672     4  0.5865  -1.65e-01 0.000 0.200 0.000 0.440 0.000 0.360
#> GSM531673     5  0.6819   2.60e-01 0.000 0.224 0.168 0.000 0.500 0.108
#> GSM531676     5  0.2912   6.39e-01 0.000 0.216 0.000 0.000 0.784 0.000
#> GSM531679     2  0.2950   7.02e-01 0.000 0.828 0.000 0.000 0.148 0.024
#> GSM531681     4  0.3917   5.55e-01 0.000 0.284 0.000 0.692 0.000 0.024
#> GSM531682     2  0.3065   6.94e-01 0.000 0.820 0.000 0.000 0.152 0.028
#> GSM531683     2  0.0508   7.53e-01 0.000 0.984 0.000 0.000 0.004 0.012
#> GSM531684     2  0.5102   8.33e-06 0.000 0.492 0.000 0.000 0.428 0.080
#> GSM531685     5  0.0692   6.42e-01 0.004 0.020 0.000 0.000 0.976 0.000
#> GSM531686     4  0.3876   5.67e-01 0.000 0.276 0.000 0.700 0.000 0.024
#> GSM531687     5  0.3271   6.25e-01 0.000 0.232 0.000 0.000 0.760 0.008
#> GSM531688     1  0.3819   4.74e-01 0.652 0.000 0.000 0.000 0.340 0.008
#> GSM531690     2  0.4228   5.32e-01 0.000 0.716 0.000 0.212 0.000 0.072
#> GSM531693     1  0.3215   6.46e-01 0.756 0.000 0.000 0.000 0.240 0.004
#> GSM531695     5  0.6262   2.97e-01 0.288 0.292 0.000 0.000 0.412 0.008
#> GSM531603     2  0.0632   7.58e-01 0.000 0.976 0.000 0.000 0.024 0.000
#> GSM531609     4  0.0000   8.64e-01 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM531611     4  0.0000   8.64e-01 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM531621     3  0.0146   9.05e-01 0.000 0.000 0.996 0.000 0.000 0.004
#> GSM531622     3  0.0000   9.05e-01 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM531628     1  0.0000   8.65e-01 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM531630     3  0.0000   9.05e-01 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM531633     3  0.0146   9.05e-01 0.000 0.000 0.996 0.000 0.000 0.004
#> GSM531635     1  0.3839   6.56e-01 0.748 0.000 0.212 0.000 0.004 0.036
#> GSM531640     3  0.0146   9.05e-01 0.000 0.000 0.996 0.000 0.004 0.000
#> GSM531649     1  0.1194   8.50e-01 0.956 0.000 0.008 0.000 0.004 0.032
#> GSM531653     1  0.0146   8.65e-01 0.996 0.000 0.000 0.000 0.000 0.004
#> GSM531657     6  0.5656   1.45e-01 0.000 0.152 0.000 0.408 0.000 0.440
#> GSM531665     5  0.4236   5.62e-01 0.088 0.028 0.000 0.000 0.772 0.112
#> GSM531670     1  0.4692   6.26e-01 0.708 0.000 0.172 0.000 0.012 0.108
#> GSM531674     1  0.0508   8.62e-01 0.984 0.000 0.000 0.000 0.012 0.004
#> GSM531675     2  0.2451   7.25e-01 0.000 0.884 0.000 0.000 0.056 0.060
#> GSM531677     2  0.2383   7.21e-01 0.000 0.880 0.000 0.000 0.096 0.024
#> GSM531678     2  0.4199   2.79e-01 0.000 0.600 0.000 0.000 0.380 0.020
#> GSM531680     5  0.3831   5.85e-01 0.012 0.268 0.000 0.000 0.712 0.008
#> GSM531689     5  0.3076   6.24e-01 0.000 0.240 0.000 0.000 0.760 0.000
#> GSM531691     5  0.2664   6.50e-01 0.000 0.184 0.000 0.000 0.816 0.000
#> GSM531692     5  0.2088   6.18e-01 0.000 0.028 0.000 0.000 0.904 0.068
#> GSM531694     2  0.0632   7.58e-01 0.000 0.976 0.000 0.000 0.024 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 disease.state(p) k
#> CV:skmeans 74            1.000 2
#> CV:skmeans 76            0.837 3
#> CV:skmeans 77            0.210 4
#> CV:skmeans 71            0.364 5
#> CV:skmeans 68            0.171 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 51941 rows and 80 columns.
#>   Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'CV' method.
#>   Subgroups are detected by 'pam' method.
#>   Performed in total 1250 partitions by row resampling.
#>   Best k for subgroups seems to be 4.
#> 
#> Following methods can be applied to this 'ConsensusPartition' object:
#>  [1] "cola_report"             "collect_classes"         "collect_plots"          
#>  [4] "collect_stats"           "colnames"                "compare_signatures"     
#>  [7] "consensus_heatmap"       "dimension_reduction"     "functional_enrichment"  
#> [10] "get_anno_col"            "get_anno"                "get_classes"            
#> [13] "get_consensus"           "get_matrix"              "get_membership"         
#> [16] "get_param"               "get_signatures"          "get_stats"              
#> [19] "is_best_k"               "is_stable_k"             "membership_heatmap"     
#> [22] "ncol"                    "nrow"                    "plot_ecdf"              
#> [25] "rownames"                "select_partition_number" "show"                   
#> [28] "suggest_best_k"          "test_to_known_factors"

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

collect_plots(res)

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.640           0.828       0.905         0.4751 0.519   0.519
#> 3 3 0.659           0.757       0.877         0.3697 0.811   0.636
#> 4 4 0.915           0.892       0.951         0.1148 0.760   0.428
#> 5 5 0.695           0.539       0.759         0.0886 0.877   0.590
#> 6 6 0.756           0.547       0.779         0.0591 0.863   0.463

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

suggest_best_k(res)
#> [1] 4

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

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

show/hide code output

cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#>           class entropy silhouette    p1    p2
#> GSM531602     2  0.0000      0.976 0.000 1.000
#> GSM531604     2  0.0000      0.976 0.000 1.000
#> GSM531606     2  0.0000      0.976 0.000 1.000
#> GSM531607     2  0.0000      0.976 0.000 1.000
#> GSM531608     1  0.0000      0.831 1.000 0.000
#> GSM531610     1  0.9460      0.633 0.636 0.364
#> GSM531612     1  0.9460      0.633 0.636 0.364
#> GSM531613     2  0.8955      0.383 0.312 0.688
#> GSM531614     1  0.9460      0.633 0.636 0.364
#> GSM531616     1  0.0000      0.831 1.000 0.000
#> GSM531618     1  0.1414      0.825 0.980 0.020
#> GSM531619     1  0.0000      0.831 1.000 0.000
#> GSM531620     1  0.0000      0.831 1.000 0.000
#> GSM531623     1  0.0000      0.831 1.000 0.000
#> GSM531625     1  0.0000      0.831 1.000 0.000
#> GSM531626     1  0.0000      0.831 1.000 0.000
#> GSM531632     1  0.0000      0.831 1.000 0.000
#> GSM531638     1  0.0000      0.831 1.000 0.000
#> GSM531639     1  0.0000      0.831 1.000 0.000
#> GSM531641     1  0.9460      0.633 0.636 0.364
#> GSM531642     1  0.9323      0.646 0.652 0.348
#> GSM531643     1  0.0000      0.831 1.000 0.000
#> GSM531644     1  0.9460      0.633 0.636 0.364
#> GSM531645     1  0.9460      0.633 0.636 0.364
#> GSM531646     1  0.0000      0.831 1.000 0.000
#> GSM531647     1  0.0000      0.831 1.000 0.000
#> GSM531648     1  0.9129      0.661 0.672 0.328
#> GSM531650     1  0.4562      0.795 0.904 0.096
#> GSM531651     1  0.0000      0.831 1.000 0.000
#> GSM531652     1  0.0000      0.831 1.000 0.000
#> GSM531656     1  0.9286      0.649 0.656 0.344
#> GSM531659     1  0.9460      0.633 0.636 0.364
#> GSM531661     1  0.0000      0.831 1.000 0.000
#> GSM531662     1  0.0000      0.831 1.000 0.000
#> GSM531663     1  0.9491      0.626 0.632 0.368
#> GSM531664     2  0.1633      0.952 0.024 0.976
#> GSM531666     1  0.9522      0.620 0.628 0.372
#> GSM531667     1  0.0000      0.831 1.000 0.000
#> GSM531668     1  0.9460      0.633 0.636 0.364
#> GSM531669     2  0.0672      0.970 0.008 0.992
#> GSM531671     1  0.0000      0.831 1.000 0.000
#> GSM531672     1  0.9460      0.633 0.636 0.364
#> GSM531673     1  0.9460      0.633 0.636 0.364
#> GSM531676     2  0.0000      0.976 0.000 1.000
#> GSM531679     2  0.0000      0.976 0.000 1.000
#> GSM531681     2  0.0000      0.976 0.000 1.000
#> GSM531682     2  0.0000      0.976 0.000 1.000
#> GSM531683     2  0.0000      0.976 0.000 1.000
#> GSM531684     2  0.0000      0.976 0.000 1.000
#> GSM531685     2  0.0000      0.976 0.000 1.000
#> GSM531686     2  0.0000      0.976 0.000 1.000
#> GSM531687     2  0.0672      0.970 0.008 0.992
#> GSM531688     2  0.0000      0.976 0.000 1.000
#> GSM531690     2  0.0000      0.976 0.000 1.000
#> GSM531693     2  0.0376      0.973 0.004 0.996
#> GSM531695     2  0.0000      0.976 0.000 1.000
#> GSM531603     2  0.0376      0.973 0.004 0.996
#> GSM531609     1  0.9460      0.633 0.636 0.364
#> GSM531611     1  0.9460      0.633 0.636 0.364
#> GSM531621     1  0.0000      0.831 1.000 0.000
#> GSM531622     1  0.0000      0.831 1.000 0.000
#> GSM531628     1  0.1633      0.824 0.976 0.024
#> GSM531630     1  0.0000      0.831 1.000 0.000
#> GSM531633     1  0.0000      0.831 1.000 0.000
#> GSM531635     1  0.0000      0.831 1.000 0.000
#> GSM531640     1  0.0000      0.831 1.000 0.000
#> GSM531649     1  0.0000      0.831 1.000 0.000
#> GSM531653     1  0.0000      0.831 1.000 0.000
#> GSM531657     1  0.9460      0.633 0.636 0.364
#> GSM531665     2  0.7219      0.672 0.200 0.800
#> GSM531670     1  0.9460      0.627 0.636 0.364
#> GSM531674     2  0.0672      0.970 0.008 0.992
#> GSM531675     2  0.0000      0.976 0.000 1.000
#> GSM531677     2  0.0000      0.976 0.000 1.000
#> GSM531678     2  0.0000      0.976 0.000 1.000
#> GSM531680     2  0.0000      0.976 0.000 1.000
#> GSM531689     2  0.0000      0.976 0.000 1.000
#> GSM531691     2  0.0000      0.976 0.000 1.000
#> GSM531692     2  0.0000      0.976 0.000 1.000
#> GSM531694     2  0.0000      0.976 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
#> GSM531602     2  0.1411      0.937 0.036 0.964 0.000
#> GSM531604     2  0.1525      0.927 0.004 0.964 0.032
#> GSM531606     2  0.1411      0.937 0.036 0.964 0.000
#> GSM531607     2  0.1411      0.937 0.036 0.964 0.000
#> GSM531608     3  0.0000      0.798 0.000 0.000 1.000
#> GSM531610     1  0.0000      0.767 1.000 0.000 0.000
#> GSM531612     1  0.0000      0.767 1.000 0.000 0.000
#> GSM531613     2  0.6308      0.282 0.492 0.508 0.000
#> GSM531614     1  0.0000      0.767 1.000 0.000 0.000
#> GSM531616     3  0.4235      0.680 0.176 0.000 0.824
#> GSM531618     1  0.4702      0.741 0.788 0.000 0.212
#> GSM531619     3  0.0000      0.798 0.000 0.000 1.000
#> GSM531620     3  0.0000      0.798 0.000 0.000 1.000
#> GSM531623     3  0.0000      0.798 0.000 0.000 1.000
#> GSM531625     3  0.0000      0.798 0.000 0.000 1.000
#> GSM531626     3  0.0000      0.798 0.000 0.000 1.000
#> GSM531632     3  0.7339      0.295 0.392 0.036 0.572
#> GSM531638     3  0.2796      0.750 0.092 0.000 0.908
#> GSM531639     1  0.5291      0.689 0.732 0.000 0.268
#> GSM531641     1  0.0000      0.767 1.000 0.000 0.000
#> GSM531642     1  0.5633      0.721 0.768 0.208 0.024
#> GSM531643     1  0.6253      0.710 0.732 0.036 0.232
#> GSM531644     1  0.6882      0.745 0.732 0.096 0.172
#> GSM531645     1  0.0000      0.767 1.000 0.000 0.000
#> GSM531646     3  0.7339      0.295 0.392 0.036 0.572
#> GSM531647     3  0.7339      0.295 0.392 0.036 0.572
#> GSM531648     1  0.3941      0.764 0.844 0.000 0.156
#> GSM531650     1  0.6319      0.715 0.732 0.040 0.228
#> GSM531651     3  0.0000      0.798 0.000 0.000 1.000
#> GSM531652     1  0.4702      0.741 0.788 0.000 0.212
#> GSM531656     1  0.6437      0.727 0.732 0.048 0.220
#> GSM531659     1  0.5115      0.708 0.768 0.228 0.004
#> GSM531661     3  0.0000      0.798 0.000 0.000 1.000
#> GSM531662     3  0.0424      0.794 0.008 0.000 0.992
#> GSM531663     1  0.0592      0.766 0.988 0.012 0.000
#> GSM531664     2  0.0000      0.937 0.000 1.000 0.000
#> GSM531666     1  0.5115      0.708 0.768 0.228 0.004
#> GSM531667     3  0.6180      0.228 0.416 0.000 0.584
#> GSM531668     1  0.4233      0.743 0.836 0.160 0.004
#> GSM531669     2  0.0424      0.932 0.000 0.992 0.008
#> GSM531671     3  0.5503      0.638 0.208 0.020 0.772
#> GSM531672     1  0.5115      0.708 0.768 0.228 0.004
#> GSM531673     3  0.8261      0.171 0.340 0.092 0.568
#> GSM531676     2  0.0000      0.937 0.000 1.000 0.000
#> GSM531679     2  0.1411      0.937 0.036 0.964 0.000
#> GSM531681     2  0.5098      0.745 0.248 0.752 0.000
#> GSM531682     2  0.1411      0.937 0.036 0.964 0.000
#> GSM531683     2  0.1411      0.937 0.036 0.964 0.000
#> GSM531684     2  0.6215      0.346 0.000 0.572 0.428
#> GSM531685     2  0.0000      0.937 0.000 1.000 0.000
#> GSM531686     2  0.4654      0.790 0.208 0.792 0.000
#> GSM531687     2  0.0000      0.937 0.000 1.000 0.000
#> GSM531688     2  0.0000      0.937 0.000 1.000 0.000
#> GSM531690     2  0.1411      0.937 0.036 0.964 0.000
#> GSM531693     2  0.0237      0.935 0.000 0.996 0.004
#> GSM531695     2  0.0000      0.937 0.000 1.000 0.000
#> GSM531603     2  0.1411      0.937 0.036 0.964 0.000
#> GSM531609     1  0.0000      0.767 1.000 0.000 0.000
#> GSM531611     1  0.0000      0.767 1.000 0.000 0.000
#> GSM531621     3  0.0000      0.798 0.000 0.000 1.000
#> GSM531622     3  0.0000      0.798 0.000 0.000 1.000
#> GSM531628     1  0.6319      0.715 0.732 0.040 0.228
#> GSM531630     3  0.0000      0.798 0.000 0.000 1.000
#> GSM531633     3  0.0000      0.798 0.000 0.000 1.000
#> GSM531635     3  0.7339      0.295 0.392 0.036 0.572
#> GSM531640     1  0.5291      0.689 0.732 0.000 0.268
#> GSM531649     3  0.7339      0.295 0.392 0.036 0.572
#> GSM531653     1  0.7295      0.396 0.584 0.036 0.380
#> GSM531657     1  0.5115      0.708 0.768 0.228 0.004
#> GSM531665     2  0.0237      0.935 0.000 0.996 0.004
#> GSM531670     1  0.7079      0.740 0.720 0.104 0.176
#> GSM531674     2  0.0000      0.937 0.000 1.000 0.000
#> GSM531675     2  0.1411      0.937 0.036 0.964 0.000
#> GSM531677     2  0.1411      0.937 0.036 0.964 0.000
#> GSM531678     2  0.1411      0.937 0.036 0.964 0.000
#> GSM531680     2  0.0000      0.937 0.000 1.000 0.000
#> GSM531689     2  0.0747      0.938 0.016 0.984 0.000
#> GSM531691     2  0.0475      0.937 0.004 0.992 0.004
#> GSM531692     2  0.0000      0.937 0.000 1.000 0.000
#> GSM531694     2  0.1411      0.937 0.036 0.964 0.000

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM531602     2  0.0336     0.9590 0.000 0.992 0.000 0.008
#> GSM531604     2  0.0469     0.9561 0.000 0.988 0.012 0.000
#> GSM531606     2  0.0188     0.9597 0.000 0.996 0.000 0.004
#> GSM531607     2  0.0188     0.9597 0.000 0.996 0.000 0.004
#> GSM531608     3  0.0000     0.9751 0.000 0.000 1.000 0.000
#> GSM531610     4  0.0000     0.8910 0.000 0.000 0.000 1.000
#> GSM531612     4  0.0000     0.8910 0.000 0.000 0.000 1.000
#> GSM531613     4  0.0000     0.8910 0.000 0.000 0.000 1.000
#> GSM531614     4  0.0000     0.8910 0.000 0.000 0.000 1.000
#> GSM531616     3  0.0707     0.9622 0.020 0.000 0.980 0.000
#> GSM531618     1  0.4885     0.6999 0.760 0.204 0.016 0.020
#> GSM531619     3  0.0000     0.9751 0.000 0.000 1.000 0.000
#> GSM531620     3  0.0000     0.9751 0.000 0.000 1.000 0.000
#> GSM531623     3  0.0000     0.9751 0.000 0.000 1.000 0.000
#> GSM531625     3  0.0000     0.9751 0.000 0.000 1.000 0.000
#> GSM531626     3  0.0000     0.9751 0.000 0.000 1.000 0.000
#> GSM531632     1  0.0817     0.9039 0.976 0.000 0.024 0.000
#> GSM531638     3  0.0469     0.9684 0.012 0.000 0.988 0.000
#> GSM531639     1  0.4999     0.0626 0.508 0.000 0.492 0.000
#> GSM531641     4  0.0000     0.8910 0.000 0.000 0.000 1.000
#> GSM531642     1  0.3852     0.7402 0.800 0.192 0.008 0.000
#> GSM531643     1  0.0336     0.9026 0.992 0.000 0.008 0.000
#> GSM531644     1  0.0336     0.9026 0.992 0.000 0.008 0.000
#> GSM531645     4  0.0000     0.8910 0.000 0.000 0.000 1.000
#> GSM531646     1  0.0817     0.9039 0.976 0.000 0.024 0.000
#> GSM531647     1  0.0817     0.9039 0.976 0.000 0.024 0.000
#> GSM531648     1  0.2353     0.8714 0.928 0.024 0.008 0.040
#> GSM531650     1  0.0000     0.9029 1.000 0.000 0.000 0.000
#> GSM531651     3  0.0000     0.9751 0.000 0.000 1.000 0.000
#> GSM531652     1  0.1139     0.8945 0.972 0.012 0.008 0.008
#> GSM531656     1  0.3969     0.7422 0.804 0.180 0.016 0.000
#> GSM531659     2  0.1486     0.9424 0.024 0.960 0.008 0.008
#> GSM531661     3  0.0336     0.9696 0.000 0.008 0.992 0.000
#> GSM531662     3  0.0927     0.9654 0.016 0.008 0.976 0.000
#> GSM531663     4  0.2334     0.8230 0.004 0.088 0.000 0.908
#> GSM531664     1  0.0817     0.9001 0.976 0.024 0.000 0.000
#> GSM531666     2  0.4482     0.6115 0.264 0.728 0.008 0.000
#> GSM531667     3  0.1191     0.9564 0.024 0.004 0.968 0.004
#> GSM531668     4  0.7672     0.4304 0.024 0.316 0.136 0.524
#> GSM531669     1  0.0817     0.9001 0.976 0.024 0.000 0.000
#> GSM531671     3  0.5427     0.6818 0.100 0.148 0.748 0.004
#> GSM531672     2  0.1617     0.9400 0.024 0.956 0.008 0.012
#> GSM531673     3  0.1151     0.9600 0.024 0.008 0.968 0.000
#> GSM531676     2  0.0707     0.9559 0.020 0.980 0.000 0.000
#> GSM531679     2  0.0000     0.9596 0.000 1.000 0.000 0.000
#> GSM531681     4  0.4855     0.3440 0.000 0.400 0.000 0.600
#> GSM531682     2  0.0672     0.9574 0.000 0.984 0.008 0.008
#> GSM531683     2  0.0000     0.9596 0.000 1.000 0.000 0.000
#> GSM531684     3  0.1022     0.9505 0.000 0.032 0.968 0.000
#> GSM531685     2  0.0469     0.9577 0.012 0.988 0.000 0.000
#> GSM531686     2  0.4661     0.4127 0.000 0.652 0.000 0.348
#> GSM531687     2  0.0804     0.9572 0.012 0.980 0.008 0.000
#> GSM531688     2  0.0707     0.9559 0.020 0.980 0.000 0.000
#> GSM531690     2  0.0657     0.9579 0.000 0.984 0.004 0.012
#> GSM531693     2  0.1211     0.9427 0.040 0.960 0.000 0.000
#> GSM531695     2  0.0707     0.9559 0.020 0.980 0.000 0.000
#> GSM531603     2  0.0336     0.9590 0.000 0.992 0.000 0.008
#> GSM531609     4  0.0000     0.8910 0.000 0.000 0.000 1.000
#> GSM531611     4  0.0000     0.8910 0.000 0.000 0.000 1.000
#> GSM531621     3  0.0000     0.9751 0.000 0.000 1.000 0.000
#> GSM531622     3  0.0000     0.9751 0.000 0.000 1.000 0.000
#> GSM531628     1  0.0188     0.9041 0.996 0.000 0.004 0.000
#> GSM531630     3  0.0000     0.9751 0.000 0.000 1.000 0.000
#> GSM531633     3  0.0000     0.9751 0.000 0.000 1.000 0.000
#> GSM531635     1  0.1022     0.9024 0.968 0.000 0.032 0.000
#> GSM531640     3  0.0817     0.9606 0.024 0.000 0.976 0.000
#> GSM531649     1  0.0817     0.9039 0.976 0.000 0.024 0.000
#> GSM531653     1  0.0707     0.9047 0.980 0.000 0.020 0.000
#> GSM531657     2  0.1617     0.9400 0.024 0.956 0.008 0.012
#> GSM531665     2  0.0804     0.9572 0.012 0.980 0.008 0.000
#> GSM531670     2  0.1488     0.9439 0.032 0.956 0.012 0.000
#> GSM531674     1  0.0817     0.9001 0.976 0.024 0.000 0.000
#> GSM531675     2  0.0524     0.9587 0.000 0.988 0.004 0.008
#> GSM531677     2  0.0336     0.9590 0.000 0.992 0.000 0.008
#> GSM531678     2  0.0000     0.9596 0.000 1.000 0.000 0.000
#> GSM531680     2  0.0707     0.9559 0.020 0.980 0.000 0.000
#> GSM531689     2  0.0000     0.9596 0.000 1.000 0.000 0.000
#> GSM531691     2  0.0336     0.9580 0.000 0.992 0.008 0.000
#> GSM531692     2  0.0469     0.9577 0.012 0.988 0.000 0.000
#> GSM531694     2  0.0336     0.9590 0.000 0.992 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
#> GSM531602     2  0.2389     0.7896 0.000 0.880 0.004 0.000 0.116
#> GSM531604     2  0.4182     0.3676 0.000 0.600 0.400 0.000 0.000
#> GSM531606     2  0.5454     0.3437 0.000 0.532 0.404 0.000 0.064
#> GSM531607     2  0.0963     0.8075 0.000 0.964 0.000 0.000 0.036
#> GSM531608     3  0.0000     0.7284 0.000 0.000 1.000 0.000 0.000
#> GSM531610     4  0.0000     0.9086 0.000 0.000 0.000 1.000 0.000
#> GSM531612     4  0.0000     0.9086 0.000 0.000 0.000 1.000 0.000
#> GSM531613     4  0.0000     0.9086 0.000 0.000 0.000 1.000 0.000
#> GSM531614     4  0.0000     0.9086 0.000 0.000 0.000 1.000 0.000
#> GSM531616     5  0.5435    -0.2196 0.428 0.000 0.060 0.000 0.512
#> GSM531618     5  0.4060     0.3305 0.360 0.000 0.000 0.000 0.640
#> GSM531619     3  0.0000     0.7284 0.000 0.000 1.000 0.000 0.000
#> GSM531620     3  0.4192     0.6471 0.000 0.000 0.596 0.000 0.404
#> GSM531623     3  0.0000     0.7284 0.000 0.000 1.000 0.000 0.000
#> GSM531625     3  0.4192     0.6471 0.000 0.000 0.596 0.000 0.404
#> GSM531626     3  0.4893     0.6197 0.028 0.000 0.568 0.000 0.404
#> GSM531632     1  0.4088     0.3627 0.632 0.000 0.000 0.000 0.368
#> GSM531638     5  0.6271    -0.2191 0.412 0.000 0.148 0.000 0.440
#> GSM531639     5  0.2230     0.2284 0.000 0.000 0.116 0.000 0.884
#> GSM531641     4  0.0000     0.9086 0.000 0.000 0.000 1.000 0.000
#> GSM531642     5  0.5876     0.2789 0.412 0.100 0.000 0.000 0.488
#> GSM531643     1  0.2929     0.3819 0.820 0.000 0.000 0.000 0.180
#> GSM531644     1  0.4302    -0.2606 0.520 0.000 0.000 0.000 0.480
#> GSM531645     4  0.0000     0.9086 0.000 0.000 0.000 1.000 0.000
#> GSM531646     1  0.4192     0.3332 0.596 0.000 0.000 0.000 0.404
#> GSM531647     1  0.0000     0.5907 1.000 0.000 0.000 0.000 0.000
#> GSM531648     5  0.4192     0.3111 0.404 0.000 0.000 0.000 0.596
#> GSM531650     1  0.1478     0.5377 0.936 0.000 0.000 0.000 0.064
#> GSM531651     3  0.0000     0.7284 0.000 0.000 1.000 0.000 0.000
#> GSM531652     5  0.4210     0.3055 0.412 0.000 0.000 0.000 0.588
#> GSM531656     5  0.5454     0.2411 0.452 0.060 0.000 0.000 0.488
#> GSM531659     5  0.4192     0.1079 0.000 0.404 0.000 0.000 0.596
#> GSM531661     3  0.0000     0.7284 0.000 0.000 1.000 0.000 0.000
#> GSM531662     3  0.0000     0.7284 0.000 0.000 1.000 0.000 0.000
#> GSM531663     4  0.3461     0.6510 0.000 0.000 0.004 0.772 0.224
#> GSM531664     1  0.4138     0.1561 0.616 0.384 0.000 0.000 0.000
#> GSM531666     5  0.6523     0.3399 0.232 0.288 0.000 0.000 0.480
#> GSM531667     3  0.3857     0.2902 0.000 0.000 0.688 0.000 0.312
#> GSM531668     5  0.4736     0.1938 0.000 0.020 0.404 0.000 0.576
#> GSM531669     1  0.0000     0.5907 1.000 0.000 0.000 0.000 0.000
#> GSM531671     1  0.4649     0.2765 0.580 0.000 0.404 0.000 0.016
#> GSM531672     5  0.4192     0.1079 0.000 0.404 0.000 0.000 0.596
#> GSM531673     3  0.0000     0.7284 0.000 0.000 1.000 0.000 0.000
#> GSM531676     2  0.1270     0.7975 0.052 0.948 0.000 0.000 0.000
#> GSM531679     2  0.0000     0.8053 0.000 1.000 0.000 0.000 0.000
#> GSM531681     4  0.4649     0.1759 0.000 0.404 0.000 0.580 0.016
#> GSM531682     2  0.2516     0.7857 0.000 0.860 0.000 0.000 0.140
#> GSM531683     2  0.0000     0.8053 0.000 1.000 0.000 0.000 0.000
#> GSM531684     3  0.0162     0.7254 0.000 0.004 0.996 0.000 0.000
#> GSM531685     2  0.1965     0.7807 0.096 0.904 0.000 0.000 0.000
#> GSM531686     2  0.4045     0.4522 0.000 0.644 0.000 0.356 0.000
#> GSM531687     2  0.1792     0.7741 0.000 0.916 0.000 0.000 0.084
#> GSM531688     2  0.2690     0.7430 0.156 0.844 0.000 0.000 0.000
#> GSM531690     2  0.2280     0.7900 0.000 0.880 0.000 0.000 0.120
#> GSM531693     1  0.4210     0.1353 0.588 0.412 0.000 0.000 0.000
#> GSM531695     2  0.2648     0.7465 0.152 0.848 0.000 0.000 0.000
#> GSM531603     2  0.2583     0.7855 0.000 0.864 0.004 0.000 0.132
#> GSM531609     4  0.0000     0.9086 0.000 0.000 0.000 1.000 0.000
#> GSM531611     4  0.0000     0.9086 0.000 0.000 0.000 1.000 0.000
#> GSM531621     3  0.4192     0.6471 0.000 0.000 0.596 0.000 0.404
#> GSM531622     3  0.4192     0.6471 0.000 0.000 0.596 0.000 0.404
#> GSM531628     1  0.0000     0.5907 1.000 0.000 0.000 0.000 0.000
#> GSM531630     3  0.4192     0.6471 0.000 0.000 0.596 0.000 0.404
#> GSM531633     3  0.4192     0.6471 0.000 0.000 0.596 0.000 0.404
#> GSM531635     5  0.4305    -0.2933 0.488 0.000 0.000 0.000 0.512
#> GSM531640     5  0.2230     0.2284 0.000 0.000 0.116 0.000 0.884
#> GSM531649     1  0.4182     0.3372 0.600 0.000 0.000 0.000 0.400
#> GSM531653     1  0.0000     0.5907 1.000 0.000 0.000 0.000 0.000
#> GSM531657     5  0.4331     0.1127 0.000 0.400 0.004 0.000 0.596
#> GSM531665     2  0.2074     0.7573 0.000 0.896 0.000 0.000 0.104
#> GSM531670     2  0.4304    -0.0871 0.000 0.516 0.000 0.000 0.484
#> GSM531674     1  0.0000     0.5907 1.000 0.000 0.000 0.000 0.000
#> GSM531675     2  0.2280     0.7900 0.000 0.880 0.000 0.000 0.120
#> GSM531677     2  0.2230     0.7905 0.000 0.884 0.000 0.000 0.116
#> GSM531678     2  0.0609     0.8038 0.000 0.980 0.000 0.000 0.020
#> GSM531680     2  0.1732     0.7858 0.080 0.920 0.000 0.000 0.000
#> GSM531689     2  0.0000     0.8053 0.000 1.000 0.000 0.000 0.000
#> GSM531691     2  0.0609     0.8038 0.000 0.980 0.000 0.000 0.020
#> GSM531692     2  0.4547     0.3628 0.012 0.588 0.400 0.000 0.000
#> GSM531694     2  0.2230     0.7905 0.000 0.884 0.000 0.000 0.116

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>           class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM531602     2  0.0000    0.78418 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM531604     5  0.4301    0.31801 0.000 0.016 0.400 0.000 0.580 0.004
#> GSM531606     3  0.5978   -0.22230 0.000 0.228 0.404 0.000 0.368 0.000
#> GSM531607     2  0.4252    0.29491 0.000 0.652 0.000 0.000 0.036 0.312
#> GSM531608     3  0.0000    0.67902 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM531610     4  0.0000    0.96447 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM531612     4  0.0000    0.96447 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM531613     4  0.0000    0.96447 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM531614     4  0.0000    0.96447 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM531616     1  0.2871    0.43300 0.804 0.000 0.004 0.000 0.000 0.192
#> GSM531618     6  0.4064    0.56151 0.016 0.000 0.000 0.000 0.360 0.624
#> GSM531619     3  0.0000    0.67902 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM531620     3  0.3765    0.55746 0.404 0.000 0.596 0.000 0.000 0.000
#> GSM531623     3  0.0000    0.67902 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM531625     3  0.3765    0.55746 0.404 0.000 0.596 0.000 0.000 0.000
#> GSM531626     3  0.3817    0.52462 0.432 0.000 0.568 0.000 0.000 0.000
#> GSM531632     1  0.0865    0.58541 0.964 0.000 0.000 0.000 0.036 0.000
#> GSM531638     1  0.3586    0.37816 0.796 0.000 0.124 0.000 0.000 0.080
#> GSM531639     6  0.3934    0.33384 0.376 0.000 0.008 0.000 0.000 0.616
#> GSM531641     4  0.0000    0.96447 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM531642     6  0.3717    0.56148 0.000 0.000 0.000 0.000 0.384 0.616
#> GSM531643     5  0.6102   -0.48115 0.332 0.000 0.000 0.000 0.376 0.292
#> GSM531644     6  0.3934    0.55601 0.008 0.000 0.000 0.000 0.376 0.616
#> GSM531645     4  0.0000    0.96447 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM531646     1  0.0000    0.56825 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM531647     1  0.3765    0.59671 0.596 0.000 0.000 0.000 0.404 0.000
#> GSM531648     6  0.3695    0.56113 0.000 0.000 0.000 0.000 0.376 0.624
#> GSM531650     1  0.4978    0.51680 0.532 0.000 0.000 0.000 0.396 0.072
#> GSM531651     3  0.0000    0.67902 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM531652     6  0.3695    0.56113 0.000 0.000 0.000 0.000 0.376 0.624
#> GSM531656     6  0.3945    0.55816 0.008 0.000 0.000 0.000 0.380 0.612
#> GSM531659     6  0.0865    0.45094 0.000 0.036 0.000 0.000 0.000 0.964
#> GSM531661     3  0.0000    0.67902 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM531662     3  0.0000    0.67902 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM531663     4  0.3136    0.67184 0.000 0.000 0.004 0.768 0.000 0.228
#> GSM531664     5  0.2823    0.00499 0.204 0.000 0.000 0.000 0.796 0.000
#> GSM531666     6  0.3101    0.57105 0.000 0.000 0.000 0.000 0.244 0.756
#> GSM531667     3  0.3737    0.15205 0.000 0.000 0.608 0.000 0.000 0.392
#> GSM531668     3  0.5943   -0.09691 0.000 0.216 0.404 0.000 0.000 0.380
#> GSM531669     1  0.3765    0.59671 0.596 0.000 0.000 0.000 0.404 0.000
#> GSM531671     1  0.3899    0.30605 0.592 0.000 0.404 0.000 0.000 0.004
#> GSM531672     6  0.0000    0.42950 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM531673     3  0.0000    0.67902 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM531676     5  0.3934    0.68366 0.000 0.008 0.000 0.000 0.616 0.376
#> GSM531679     2  0.2941    0.80667 0.000 0.780 0.000 0.000 0.220 0.000
#> GSM531681     2  0.2941    0.69769 0.000 0.780 0.000 0.220 0.000 0.000
#> GSM531682     2  0.3133    0.81153 0.000 0.780 0.000 0.000 0.212 0.008
#> GSM531683     2  0.0146    0.78581 0.000 0.996 0.000 0.000 0.004 0.000
#> GSM531684     3  0.0000    0.67902 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM531685     5  0.4110    0.67785 0.016 0.000 0.000 0.000 0.608 0.376
#> GSM531686     2  0.3052    0.70242 0.000 0.780 0.000 0.216 0.004 0.000
#> GSM531687     5  0.3747    0.67335 0.000 0.000 0.000 0.000 0.604 0.396
#> GSM531688     5  0.5845    0.56842 0.192 0.000 0.000 0.000 0.432 0.376
#> GSM531690     2  0.3103    0.81220 0.000 0.784 0.000 0.000 0.208 0.008
#> GSM531693     1  0.4333    0.20459 0.596 0.000 0.000 0.000 0.028 0.376
#> GSM531695     5  0.5826    0.57159 0.188 0.000 0.000 0.000 0.436 0.376
#> GSM531603     6  0.6081   -0.55986 0.000 0.220 0.004 0.000 0.376 0.400
#> GSM531609     4  0.0000    0.96447 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM531611     4  0.0000    0.96447 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM531621     3  0.3765    0.55746 0.404 0.000 0.596 0.000 0.000 0.000
#> GSM531622     3  0.3765    0.55746 0.404 0.000 0.596 0.000 0.000 0.000
#> GSM531628     1  0.3765    0.59671 0.596 0.000 0.000 0.000 0.404 0.000
#> GSM531630     3  0.3765    0.55746 0.404 0.000 0.596 0.000 0.000 0.000
#> GSM531633     3  0.3765    0.55746 0.404 0.000 0.596 0.000 0.000 0.000
#> GSM531635     1  0.2730    0.43625 0.808 0.000 0.000 0.000 0.000 0.192
#> GSM531640     6  0.3934    0.33384 0.376 0.000 0.008 0.000 0.000 0.616
#> GSM531649     1  0.0146    0.57154 0.996 0.000 0.000 0.000 0.004 0.000
#> GSM531653     1  0.3765    0.59671 0.596 0.000 0.000 0.000 0.404 0.000
#> GSM531657     6  0.3695    0.26954 0.000 0.376 0.000 0.000 0.000 0.624
#> GSM531665     6  0.3804   -0.47811 0.000 0.000 0.000 0.000 0.424 0.576
#> GSM531670     6  0.0891    0.40745 0.008 0.000 0.000 0.000 0.024 0.968
#> GSM531674     1  0.3765    0.59671 0.596 0.000 0.000 0.000 0.404 0.000
#> GSM531675     2  0.3133    0.81153 0.000 0.780 0.000 0.000 0.212 0.008
#> GSM531677     2  0.3133    0.81153 0.000 0.780 0.000 0.000 0.212 0.008
#> GSM531678     5  0.4333    0.67799 0.000 0.028 0.000 0.000 0.596 0.376
#> GSM531680     5  0.3934    0.68366 0.000 0.008 0.000 0.000 0.616 0.376
#> GSM531689     5  0.4333    0.67799 0.000 0.028 0.000 0.000 0.596 0.376
#> GSM531691     5  0.4189    0.68134 0.000 0.020 0.000 0.000 0.604 0.376
#> GSM531692     5  0.3756    0.32748 0.000 0.000 0.400 0.000 0.600 0.000
#> GSM531694     2  0.0000    0.78418 0.000 1.000 0.000 0.000 0.000 0.000

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

consensus_heatmap(res, k = 2)

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)
#> Error in mat[ceiling(1:nr/h_ratio), ceiling(1:nc/w_ratio), drop = FALSE]: subscript out of bounds

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

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

collect_plots(res)

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.419           0.768       0.861         0.3481 0.708   0.708
#> 3 3 0.352           0.543       0.669         0.5725 0.676   0.584
#> 4 4 0.801           0.904       0.946         0.3522 0.633   0.359
#> 5 5 0.695           0.679       0.841         0.0384 0.964   0.859
#> 6 6 0.790           0.799       0.839         0.0742 0.918   0.654

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

suggest_best_k(res)
#> [1] 4

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

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

show/hide code output

cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#>           class entropy silhouette    p1    p2
#> GSM531602     2  0.0000      0.821 0.000 1.000
#> GSM531604     2  0.0000      0.821 0.000 1.000
#> GSM531606     2  0.0000      0.821 0.000 1.000
#> GSM531607     2  0.0000      0.821 0.000 1.000
#> GSM531608     2  0.9635      0.573 0.388 0.612
#> GSM531610     2  0.1843      0.816 0.028 0.972
#> GSM531612     2  0.3274      0.807 0.060 0.940
#> GSM531613     2  0.0672      0.822 0.008 0.992
#> GSM531614     2  0.3274      0.807 0.060 0.940
#> GSM531616     1  0.7674      0.724 0.776 0.224
#> GSM531618     2  0.2948      0.811 0.052 0.948
#> GSM531619     1  0.0938      0.887 0.988 0.012
#> GSM531620     1  0.5629      0.861 0.868 0.132
#> GSM531623     1  0.0938      0.887 0.988 0.012
#> GSM531625     1  0.5842      0.854 0.860 0.140
#> GSM531626     1  0.6148      0.841 0.848 0.152
#> GSM531632     2  0.9170      0.646 0.332 0.668
#> GSM531638     1  0.5629      0.861 0.868 0.132
#> GSM531639     2  0.9460      0.614 0.364 0.636
#> GSM531641     2  0.3274      0.807 0.060 0.940
#> GSM531642     2  0.9129      0.658 0.328 0.672
#> GSM531643     2  0.9427      0.620 0.360 0.640
#> GSM531644     2  0.9209      0.651 0.336 0.664
#> GSM531645     2  0.3274      0.807 0.060 0.940
#> GSM531646     2  0.9460      0.614 0.364 0.636
#> GSM531647     2  0.9460      0.614 0.364 0.636
#> GSM531648     2  0.3274      0.807 0.060 0.940
#> GSM531650     2  0.9460      0.614 0.364 0.636
#> GSM531651     1  0.0938      0.887 0.988 0.012
#> GSM531652     2  0.7453      0.746 0.212 0.788
#> GSM531656     2  0.9427      0.618 0.360 0.640
#> GSM531659     2  0.0672      0.822 0.008 0.992
#> GSM531661     2  0.9129      0.650 0.328 0.672
#> GSM531662     2  0.8763      0.681 0.296 0.704
#> GSM531663     2  0.0672      0.822 0.008 0.992
#> GSM531664     2  0.9044      0.657 0.320 0.680
#> GSM531666     2  0.7602      0.739 0.220 0.780
#> GSM531667     1  0.8443      0.610 0.728 0.272
#> GSM531668     2  0.0672      0.822 0.008 0.992
#> GSM531669     2  0.9044      0.657 0.320 0.680
#> GSM531671     2  0.8763      0.681 0.296 0.704
#> GSM531672     2  0.0672      0.822 0.008 0.992
#> GSM531673     2  0.3733      0.810 0.072 0.928
#> GSM531676     2  0.2043      0.820 0.032 0.968
#> GSM531679     2  0.0000      0.821 0.000 1.000
#> GSM531681     2  0.0000      0.821 0.000 1.000
#> GSM531682     2  0.0000      0.821 0.000 1.000
#> GSM531683     2  0.0000      0.821 0.000 1.000
#> GSM531684     2  0.0000      0.821 0.000 1.000
#> GSM531685     2  0.2603      0.817 0.044 0.956
#> GSM531686     2  0.0000      0.821 0.000 1.000
#> GSM531687     2  0.2603      0.817 0.044 0.956
#> GSM531688     2  0.8386      0.701 0.268 0.732
#> GSM531690     2  0.0000      0.821 0.000 1.000
#> GSM531693     2  0.8661      0.684 0.288 0.712
#> GSM531695     2  0.7602      0.735 0.220 0.780
#> GSM531603     2  0.0000      0.821 0.000 1.000
#> GSM531609     2  0.3274      0.807 0.060 0.940
#> GSM531611     2  0.0672      0.822 0.008 0.992
#> GSM531621     1  0.0938      0.887 0.988 0.012
#> GSM531622     1  0.0938      0.887 0.988 0.012
#> GSM531628     2  0.9460      0.614 0.364 0.636
#> GSM531630     1  0.0938      0.887 0.988 0.012
#> GSM531633     1  0.0938      0.887 0.988 0.012
#> GSM531635     2  0.9460      0.614 0.364 0.636
#> GSM531640     1  0.4939      0.871 0.892 0.108
#> GSM531649     2  0.9460      0.614 0.364 0.636
#> GSM531653     2  0.9460      0.614 0.364 0.636
#> GSM531657     2  0.0672      0.822 0.008 0.992
#> GSM531665     2  0.5059      0.797 0.112 0.888
#> GSM531670     2  0.9044      0.657 0.320 0.680
#> GSM531674     2  0.9044      0.657 0.320 0.680
#> GSM531675     2  0.0000      0.821 0.000 1.000
#> GSM531677     2  0.0000      0.821 0.000 1.000
#> GSM531678     2  0.0000      0.821 0.000 1.000
#> GSM531680     2  0.4562      0.802 0.096 0.904
#> GSM531689     2  0.0000      0.821 0.000 1.000
#> GSM531691     2  0.0000      0.821 0.000 1.000
#> GSM531692     2  0.0672      0.822 0.008 0.992
#> GSM531694     2  0.0000      0.821 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
#> GSM531602     2  0.6095      0.678 NA 0.608 0.000
#> GSM531604     2  0.6154      0.675 NA 0.592 0.000
#> GSM531606     2  0.6126      0.677 NA 0.600 0.000
#> GSM531607     2  0.6095      0.678 NA 0.608 0.000
#> GSM531608     3  0.7770      0.542 NA 0.088 0.640
#> GSM531610     2  0.5431      0.404 NA 0.716 0.000
#> GSM531612     2  0.5431      0.404 NA 0.716 0.000
#> GSM531613     2  0.3192      0.540 NA 0.888 0.000
#> GSM531614     2  0.5431      0.404 NA 0.716 0.000
#> GSM531616     3  0.9885      0.504 NA 0.284 0.408
#> GSM531618     2  0.0747      0.594 NA 0.984 0.016
#> GSM531619     3  0.5621      0.551 NA 0.000 0.692
#> GSM531620     3  0.7644      0.553 NA 0.068 0.624
#> GSM531623     3  0.5621      0.551 NA 0.000 0.692
#> GSM531625     3  0.9857      0.505 NA 0.276 0.416
#> GSM531626     3  0.9857      0.505 NA 0.276 0.416
#> GSM531632     3  0.6235      0.500 NA 0.436 0.564
#> GSM531638     3  0.9857      0.505 NA 0.276 0.416
#> GSM531639     2  0.6509     -0.360 NA 0.524 0.472
#> GSM531641     2  0.5431      0.404 NA 0.716 0.000
#> GSM531642     2  0.4974      0.335 NA 0.764 0.236
#> GSM531643     3  0.6235      0.500 NA 0.436 0.564
#> GSM531644     3  0.6308      0.400 NA 0.492 0.508
#> GSM531645     2  0.5431      0.404 NA 0.716 0.000
#> GSM531646     3  0.6235      0.500 NA 0.436 0.564
#> GSM531647     3  0.6235      0.500 NA 0.436 0.564
#> GSM531648     2  0.5397      0.407 NA 0.720 0.000
#> GSM531650     3  0.6235      0.500 NA 0.436 0.564
#> GSM531651     3  0.5621      0.551 NA 0.000 0.692
#> GSM531652     2  0.2537      0.553 NA 0.920 0.080
#> GSM531656     3  0.6235      0.500 NA 0.436 0.564
#> GSM531659     2  0.0000      0.603 NA 1.000 0.000
#> GSM531661     2  0.6559      0.160 NA 0.708 0.040
#> GSM531662     2  0.2200      0.611 NA 0.940 0.004
#> GSM531663     2  0.0000      0.603 NA 1.000 0.000
#> GSM531664     3  0.6235      0.500 NA 0.436 0.564
#> GSM531666     2  0.3816      0.476 NA 0.852 0.148
#> GSM531667     3  0.8275      0.548 NA 0.108 0.596
#> GSM531668     2  0.0000      0.603 NA 1.000 0.000
#> GSM531669     3  0.7641      0.436 NA 0.436 0.520
#> GSM531671     2  0.2486      0.610 NA 0.932 0.008
#> GSM531672     2  0.0892      0.596 NA 0.980 0.000
#> GSM531673     2  0.2200      0.611 NA 0.940 0.004
#> GSM531676     2  0.6154      0.675 NA 0.592 0.000
#> GSM531679     2  0.6095      0.678 NA 0.608 0.000
#> GSM531681     2  0.5835      0.676 NA 0.660 0.000
#> GSM531682     2  0.6095      0.678 NA 0.608 0.000
#> GSM531683     2  0.6095      0.678 NA 0.608 0.000
#> GSM531684     2  0.4796      0.660 NA 0.780 0.000
#> GSM531685     2  0.6154      0.675 NA 0.592 0.000
#> GSM531686     2  0.5859      0.676 NA 0.656 0.000
#> GSM531687     2  0.6154      0.675 NA 0.592 0.000
#> GSM531688     2  0.6154      0.675 NA 0.592 0.000
#> GSM531690     2  0.5835      0.676 NA 0.660 0.000
#> GSM531693     2  0.9963      0.116 NA 0.376 0.308
#> GSM531695     2  0.6154      0.675 NA 0.592 0.000
#> GSM531603     2  0.0592      0.609 NA 0.988 0.000
#> GSM531609     2  0.5431      0.404 NA 0.716 0.000
#> GSM531611     2  0.0237      0.602 NA 0.996 0.000
#> GSM531621     3  0.5621      0.551 NA 0.000 0.692
#> GSM531622     3  0.5621      0.551 NA 0.000 0.692
#> GSM531628     3  0.6235      0.500 NA 0.436 0.564
#> GSM531630     3  0.5621      0.551 NA 0.000 0.692
#> GSM531633     3  0.5621      0.551 NA 0.000 0.692
#> GSM531635     3  0.6235      0.500 NA 0.436 0.564
#> GSM531640     3  0.5621      0.551 NA 0.000 0.692
#> GSM531649     3  0.6235      0.500 NA 0.436 0.564
#> GSM531653     3  0.6235      0.500 NA 0.436 0.564
#> GSM531657     2  0.0000      0.603 NA 1.000 0.000
#> GSM531665     2  0.2550      0.607 NA 0.932 0.012
#> GSM531670     3  0.6274      0.470 NA 0.456 0.544
#> GSM531674     3  0.7138      0.469 NA 0.436 0.540
#> GSM531675     2  0.5882      0.676 NA 0.652 0.000
#> GSM531677     2  0.6095      0.678 NA 0.608 0.000
#> GSM531678     2  0.6095      0.678 NA 0.608 0.000
#> GSM531680     2  0.6154      0.675 NA 0.592 0.000
#> GSM531689     2  0.6154      0.675 NA 0.592 0.000
#> GSM531691     2  0.6154      0.675 NA 0.592 0.000
#> GSM531692     2  0.6154      0.675 NA 0.592 0.000
#> GSM531694     2  0.6095      0.678 NA 0.608 0.000

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM531602     2  0.0000      0.957 0.000 1.000 0.000 0.000
#> GSM531604     2  0.0000      0.957 0.000 1.000 0.000 0.000
#> GSM531606     2  0.0000      0.957 0.000 1.000 0.000 0.000
#> GSM531607     2  0.0000      0.957 0.000 1.000 0.000 0.000
#> GSM531608     3  0.1209      0.942 0.000 0.004 0.964 0.032
#> GSM531610     4  0.0000      0.919 0.000 0.000 0.000 1.000
#> GSM531612     4  0.0000      0.919 0.000 0.000 0.000 1.000
#> GSM531613     4  0.2805      0.920 0.012 0.100 0.000 0.888
#> GSM531614     4  0.0000      0.919 0.000 0.000 0.000 1.000
#> GSM531616     3  0.0469      0.959 0.012 0.000 0.988 0.000
#> GSM531618     4  0.4524      0.873 0.012 0.104 0.064 0.820
#> GSM531619     3  0.0000      0.967 0.000 0.000 1.000 0.000
#> GSM531620     3  0.0000      0.967 0.000 0.000 1.000 0.000
#> GSM531623     3  0.0000      0.967 0.000 0.000 1.000 0.000
#> GSM531625     3  0.0000      0.967 0.000 0.000 1.000 0.000
#> GSM531626     3  0.0000      0.967 0.000 0.000 1.000 0.000
#> GSM531632     1  0.0000      0.911 1.000 0.000 0.000 0.000
#> GSM531638     3  0.0000      0.967 0.000 0.000 1.000 0.000
#> GSM531639     1  0.5859      0.133 0.496 0.000 0.472 0.032
#> GSM531641     4  0.0000      0.919 0.000 0.000 0.000 1.000
#> GSM531642     1  0.4380      0.784 0.800 0.004 0.164 0.032
#> GSM531643     1  0.1209      0.913 0.964 0.004 0.032 0.000
#> GSM531644     1  0.1209      0.913 0.964 0.004 0.032 0.000
#> GSM531645     4  0.0000      0.919 0.000 0.000 0.000 1.000
#> GSM531646     1  0.1022      0.914 0.968 0.000 0.032 0.000
#> GSM531647     1  0.1022      0.914 0.968 0.000 0.032 0.000
#> GSM531648     4  0.1022      0.924 0.000 0.032 0.000 0.968
#> GSM531650     1  0.0000      0.911 1.000 0.000 0.000 0.000
#> GSM531651     3  0.0000      0.967 0.000 0.000 1.000 0.000
#> GSM531652     1  0.2441      0.897 0.920 0.004 0.056 0.020
#> GSM531656     1  0.4105      0.796 0.812 0.000 0.156 0.032
#> GSM531659     2  0.3718      0.797 0.012 0.820 0.000 0.168
#> GSM531661     3  0.1821      0.933 0.012 0.008 0.948 0.032
#> GSM531662     3  0.3860      0.820 0.012 0.104 0.852 0.032
#> GSM531663     4  0.2867      0.918 0.012 0.104 0.000 0.884
#> GSM531664     1  0.0000      0.911 1.000 0.000 0.000 0.000
#> GSM531666     1  0.3489      0.845 0.880 0.068 0.020 0.032
#> GSM531667     3  0.1356      0.940 0.008 0.000 0.960 0.032
#> GSM531668     4  0.3625      0.865 0.012 0.160 0.000 0.828
#> GSM531669     1  0.0000      0.911 1.000 0.000 0.000 0.000
#> GSM531671     3  0.5694      0.739 0.100 0.108 0.760 0.032
#> GSM531672     4  0.2867      0.918 0.012 0.104 0.000 0.884
#> GSM531673     2  0.4360      0.784 0.012 0.816 0.140 0.032
#> GSM531676     2  0.0000      0.957 0.000 1.000 0.000 0.000
#> GSM531679     2  0.0000      0.957 0.000 1.000 0.000 0.000
#> GSM531681     2  0.3074      0.831 0.000 0.848 0.000 0.152
#> GSM531682     2  0.0000      0.957 0.000 1.000 0.000 0.000
#> GSM531683     2  0.0000      0.957 0.000 1.000 0.000 0.000
#> GSM531684     2  0.0000      0.957 0.000 1.000 0.000 0.000
#> GSM531685     2  0.3311      0.794 0.172 0.828 0.000 0.000
#> GSM531686     2  0.1716      0.915 0.000 0.936 0.000 0.064
#> GSM531687     2  0.0000      0.957 0.000 1.000 0.000 0.000
#> GSM531688     1  0.0921      0.900 0.972 0.028 0.000 0.000
#> GSM531690     2  0.2589      0.869 0.000 0.884 0.000 0.116
#> GSM531693     1  0.0469      0.906 0.988 0.012 0.000 0.000
#> GSM531695     1  0.3975      0.671 0.760 0.240 0.000 0.000
#> GSM531603     2  0.0000      0.957 0.000 1.000 0.000 0.000
#> GSM531609     4  0.0000      0.919 0.000 0.000 0.000 1.000
#> GSM531611     4  0.2867      0.918 0.012 0.104 0.000 0.884
#> GSM531621     3  0.0000      0.967 0.000 0.000 1.000 0.000
#> GSM531622     3  0.0000      0.967 0.000 0.000 1.000 0.000
#> GSM531628     1  0.0000      0.911 1.000 0.000 0.000 0.000
#> GSM531630     3  0.0000      0.967 0.000 0.000 1.000 0.000
#> GSM531633     3  0.0000      0.967 0.000 0.000 1.000 0.000
#> GSM531635     1  0.1211      0.912 0.960 0.000 0.040 0.000
#> GSM531640     3  0.0000      0.967 0.000 0.000 1.000 0.000
#> GSM531649     1  0.1022      0.914 0.968 0.000 0.032 0.000
#> GSM531653     1  0.1022      0.914 0.968 0.000 0.032 0.000
#> GSM531657     4  0.2867      0.918 0.012 0.104 0.000 0.884
#> GSM531665     2  0.3414      0.868 0.020 0.884 0.064 0.032
#> GSM531670     1  0.4105      0.796 0.812 0.000 0.156 0.032
#> GSM531674     1  0.0000      0.911 1.000 0.000 0.000 0.000
#> GSM531675     2  0.0000      0.957 0.000 1.000 0.000 0.000
#> GSM531677     2  0.0000      0.957 0.000 1.000 0.000 0.000
#> GSM531678     2  0.0000      0.957 0.000 1.000 0.000 0.000
#> GSM531680     2  0.0469      0.950 0.012 0.988 0.000 0.000
#> GSM531689     2  0.0000      0.957 0.000 1.000 0.000 0.000
#> GSM531691     2  0.0000      0.957 0.000 1.000 0.000 0.000
#> GSM531692     2  0.0000      0.957 0.000 1.000 0.000 0.000
#> GSM531694     2  0.0000      0.957 0.000 1.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
#> GSM531602     2  0.0404      0.744 0.000 0.988 0.000 0.000 0.012
#> GSM531604     2  0.3561      0.420 0.000 0.740 0.000 0.000 0.260
#> GSM531606     2  0.3305      0.491 0.000 0.776 0.000 0.000 0.224
#> GSM531607     2  0.0000      0.753 0.000 1.000 0.000 0.000 0.000
#> GSM531608     3  0.1243      0.879 0.008 0.028 0.960 0.000 0.004
#> GSM531610     4  0.0000      0.781 0.000 0.000 0.000 1.000 0.000
#> GSM531612     4  0.0000      0.781 0.000 0.000 0.000 1.000 0.000
#> GSM531613     4  0.4571      0.741 0.000 0.188 0.000 0.736 0.076
#> GSM531614     4  0.0000      0.781 0.000 0.000 0.000 1.000 0.000
#> GSM531616     3  0.3563      0.815 0.012 0.000 0.780 0.000 0.208
#> GSM531618     4  0.6337      0.646 0.072 0.216 0.024 0.648 0.040
#> GSM531619     3  0.0000      0.890 0.000 0.000 1.000 0.000 0.000
#> GSM531620     3  0.1430      0.882 0.000 0.004 0.944 0.000 0.052
#> GSM531623     3  0.0000      0.890 0.000 0.000 1.000 0.000 0.000
#> GSM531625     3  0.2172      0.873 0.000 0.016 0.908 0.000 0.076
#> GSM531626     3  0.3388      0.822 0.008 0.000 0.792 0.000 0.200
#> GSM531632     1  0.0404      0.834 0.988 0.000 0.000 0.000 0.012
#> GSM531638     3  0.3388      0.822 0.008 0.000 0.792 0.000 0.200
#> GSM531639     1  0.6026      0.654 0.652 0.036 0.192 0.000 0.120
#> GSM531641     4  0.0000      0.781 0.000 0.000 0.000 1.000 0.000
#> GSM531642     1  0.5613      0.711 0.716 0.088 0.120 0.000 0.076
#> GSM531643     1  0.2962      0.816 0.868 0.048 0.000 0.000 0.084
#> GSM531644     1  0.2962      0.816 0.868 0.048 0.000 0.000 0.084
#> GSM531645     4  0.0000      0.781 0.000 0.000 0.000 1.000 0.000
#> GSM531646     1  0.0162      0.836 0.996 0.000 0.000 0.000 0.004
#> GSM531647     1  0.0404      0.834 0.988 0.000 0.000 0.000 0.012
#> GSM531648     4  0.1608      0.778 0.000 0.072 0.000 0.928 0.000
#> GSM531650     1  0.0404      0.834 0.988 0.000 0.000 0.000 0.012
#> GSM531651     3  0.0000      0.890 0.000 0.000 1.000 0.000 0.000
#> GSM531652     1  0.4800      0.762 0.776 0.052 0.000 0.088 0.084
#> GSM531656     1  0.4458      0.776 0.784 0.016 0.100 0.000 0.100
#> GSM531659     2  0.5171      0.203 0.000 0.648 0.000 0.276 0.076
#> GSM531661     3  0.3476      0.773 0.000 0.088 0.836 0.000 0.076
#> GSM531662     3  0.5787      0.417 0.000 0.204 0.616 0.000 0.180
#> GSM531663     4  0.4793      0.726 0.000 0.216 0.000 0.708 0.076
#> GSM531664     1  0.1792      0.814 0.916 0.000 0.000 0.000 0.084
#> GSM531666     1  0.5097      0.718 0.728 0.108 0.016 0.000 0.148
#> GSM531667     3  0.1653      0.874 0.028 0.024 0.944 0.000 0.004
#> GSM531668     4  0.4959      0.692 0.000 0.240 0.000 0.684 0.076
#> GSM531669     1  0.1792      0.814 0.916 0.000 0.000 0.000 0.084
#> GSM531671     3  0.7363      0.141 0.048 0.216 0.468 0.000 0.268
#> GSM531672     4  0.4793      0.726 0.000 0.216 0.000 0.708 0.076
#> GSM531673     2  0.5475      0.107 0.000 0.604 0.088 0.000 0.308
#> GSM531676     5  0.4074      0.623 0.000 0.364 0.000 0.000 0.636
#> GSM531679     2  0.0000      0.753 0.000 1.000 0.000 0.000 0.000
#> GSM531681     2  0.1043      0.719 0.000 0.960 0.000 0.040 0.000
#> GSM531682     2  0.0404      0.748 0.000 0.988 0.000 0.000 0.012
#> GSM531683     2  0.0000      0.753 0.000 1.000 0.000 0.000 0.000
#> GSM531684     2  0.3491      0.479 0.000 0.768 0.004 0.000 0.228
#> GSM531685     5  0.5002      0.631 0.052 0.312 0.000 0.000 0.636
#> GSM531686     2  0.0162      0.752 0.000 0.996 0.000 0.004 0.000
#> GSM531687     2  0.4305     -0.475 0.000 0.512 0.000 0.000 0.488
#> GSM531688     1  0.6709     -0.339 0.400 0.248 0.000 0.000 0.352
#> GSM531690     2  0.0162      0.752 0.000 0.996 0.000 0.004 0.000
#> GSM531693     1  0.4066      0.573 0.672 0.004 0.000 0.000 0.324
#> GSM531695     5  0.6745      0.437 0.280 0.312 0.000 0.000 0.408
#> GSM531603     2  0.1197      0.716 0.000 0.952 0.000 0.000 0.048
#> GSM531609     4  0.0000      0.781 0.000 0.000 0.000 1.000 0.000
#> GSM531611     4  0.4763      0.729 0.000 0.212 0.000 0.712 0.076
#> GSM531621     3  0.0000      0.890 0.000 0.000 1.000 0.000 0.000
#> GSM531622     3  0.0000      0.890 0.000 0.000 1.000 0.000 0.000
#> GSM531628     1  0.0404      0.834 0.988 0.000 0.000 0.000 0.012
#> GSM531630     3  0.0000      0.890 0.000 0.000 1.000 0.000 0.000
#> GSM531633     3  0.0000      0.890 0.000 0.000 1.000 0.000 0.000
#> GSM531635     1  0.2967      0.820 0.868 0.016 0.012 0.000 0.104
#> GSM531640     3  0.0404      0.888 0.000 0.012 0.988 0.000 0.000
#> GSM531649     1  0.1717      0.835 0.936 0.008 0.004 0.000 0.052
#> GSM531653     1  0.0404      0.834 0.988 0.000 0.000 0.000 0.012
#> GSM531657     4  0.4793      0.726 0.000 0.216 0.000 0.708 0.076
#> GSM531665     5  0.5343      0.322 0.016 0.468 0.024 0.000 0.492
#> GSM531670     1  0.4834      0.773 0.752 0.016 0.100 0.000 0.132
#> GSM531674     1  0.1792      0.814 0.916 0.000 0.000 0.000 0.084
#> GSM531675     2  0.0000      0.753 0.000 1.000 0.000 0.000 0.000
#> GSM531677     2  0.0000      0.753 0.000 1.000 0.000 0.000 0.000
#> GSM531678     2  0.0000      0.753 0.000 1.000 0.000 0.000 0.000
#> GSM531680     2  0.4210     -0.317 0.000 0.588 0.000 0.000 0.412
#> GSM531689     2  0.2074      0.667 0.000 0.896 0.000 0.000 0.104
#> GSM531691     2  0.3684      0.372 0.000 0.720 0.000 0.000 0.280
#> GSM531692     5  0.4300      0.471 0.000 0.476 0.000 0.000 0.524
#> GSM531694     2  0.0404      0.744 0.000 0.988 0.000 0.000 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
#> GSM531602     2  0.0458      0.862 0.000 0.984 0.000 0.000 0.000 0.016
#> GSM531604     5  0.5630      0.658 0.000 0.232 0.000 0.000 0.540 0.228
#> GSM531606     5  0.4709      0.563 0.000 0.412 0.000 0.000 0.540 0.048
#> GSM531607     2  0.0146      0.867 0.000 0.996 0.000 0.000 0.000 0.004
#> GSM531608     3  0.0260      0.939 0.000 0.008 0.992 0.000 0.000 0.000
#> GSM531610     4  0.0000      0.885 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM531612     4  0.0000      0.885 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM531613     4  0.0972      0.883 0.000 0.008 0.000 0.964 0.028 0.000
#> GSM531614     4  0.0000      0.885 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM531616     3  0.2838      0.804 0.000 0.000 0.808 0.000 0.188 0.004
#> GSM531618     4  0.5034      0.693 0.028 0.016 0.020 0.652 0.280 0.004
#> GSM531619     3  0.0000      0.941 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM531620     3  0.1814      0.883 0.000 0.000 0.900 0.000 0.100 0.000
#> GSM531623     3  0.0000      0.941 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM531625     3  0.1075      0.923 0.000 0.000 0.952 0.000 0.048 0.000
#> GSM531626     3  0.2595      0.834 0.000 0.000 0.836 0.000 0.160 0.004
#> GSM531632     1  0.0291      0.805 0.992 0.000 0.000 0.000 0.004 0.004
#> GSM531638     3  0.2558      0.839 0.000 0.000 0.840 0.000 0.156 0.004
#> GSM531639     1  0.5437      0.672 0.568 0.000 0.136 0.000 0.292 0.004
#> GSM531641     4  0.0000      0.885 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM531642     1  0.4980      0.716 0.588 0.012 0.044 0.000 0.352 0.004
#> GSM531643     1  0.3519      0.787 0.752 0.008 0.000 0.000 0.232 0.008
#> GSM531644     1  0.3736      0.774 0.716 0.008 0.000 0.000 0.268 0.008
#> GSM531645     4  0.0000      0.885 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM531646     1  0.0547      0.810 0.980 0.000 0.000 0.000 0.020 0.000
#> GSM531647     1  0.0000      0.807 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM531648     4  0.0909      0.884 0.000 0.012 0.000 0.968 0.020 0.000
#> GSM531650     1  0.0000      0.807 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM531651     3  0.0000      0.941 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM531652     1  0.5514      0.707 0.596 0.012 0.000 0.100 0.284 0.008
#> GSM531656     1  0.4751      0.733 0.624 0.000 0.076 0.000 0.300 0.000
#> GSM531659     4  0.5567      0.619 0.000 0.176 0.000 0.584 0.232 0.008
#> GSM531661     3  0.1391      0.908 0.000 0.016 0.944 0.000 0.040 0.000
#> GSM531662     5  0.4485      0.433 0.000 0.024 0.340 0.000 0.624 0.012
#> GSM531663     4  0.3088      0.844 0.000 0.020 0.000 0.808 0.172 0.000
#> GSM531664     1  0.0692      0.799 0.976 0.000 0.000 0.000 0.004 0.020
#> GSM531666     1  0.4447      0.723 0.600 0.020 0.004 0.000 0.372 0.004
#> GSM531667     3  0.0551      0.937 0.004 0.008 0.984 0.000 0.004 0.000
#> GSM531668     4  0.3837      0.811 0.000 0.052 0.000 0.752 0.196 0.000
#> GSM531669     1  0.0692      0.799 0.976 0.000 0.000 0.000 0.004 0.020
#> GSM531671     5  0.6193      0.461 0.004 0.044 0.200 0.000 0.572 0.180
#> GSM531672     4  0.3248      0.842 0.000 0.032 0.000 0.804 0.164 0.000
#> GSM531673     5  0.5540      0.676 0.000 0.136 0.044 0.000 0.648 0.172
#> GSM531676     6  0.1588      0.772 0.000 0.072 0.000 0.000 0.004 0.924
#> GSM531679     2  0.2562      0.834 0.000 0.828 0.000 0.000 0.000 0.172
#> GSM531681     2  0.2740      0.871 0.000 0.852 0.000 0.000 0.028 0.120
#> GSM531682     2  0.2234      0.875 0.000 0.872 0.000 0.000 0.004 0.124
#> GSM531683     2  0.0000      0.866 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM531684     5  0.4941      0.611 0.000 0.376 0.000 0.000 0.552 0.072
#> GSM531685     6  0.2362      0.691 0.000 0.136 0.000 0.000 0.004 0.860
#> GSM531686     2  0.2740      0.871 0.000 0.852 0.000 0.000 0.028 0.120
#> GSM531687     6  0.1387      0.777 0.000 0.068 0.000 0.000 0.000 0.932
#> GSM531688     6  0.3512      0.717 0.196 0.032 0.000 0.000 0.000 0.772
#> GSM531690     2  0.2740      0.871 0.000 0.852 0.000 0.000 0.028 0.120
#> GSM531693     6  0.3699      0.558 0.336 0.000 0.000 0.000 0.004 0.660
#> GSM531695     6  0.2747      0.779 0.096 0.044 0.000 0.000 0.000 0.860
#> GSM531603     2  0.1524      0.825 0.000 0.932 0.000 0.000 0.060 0.008
#> GSM531609     4  0.0000      0.885 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM531611     4  0.2133      0.875 0.020 0.016 0.000 0.912 0.052 0.000
#> GSM531621     3  0.0000      0.941 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM531622     3  0.0000      0.941 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM531628     1  0.0000      0.807 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM531630     3  0.0000      0.941 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM531633     3  0.0000      0.941 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM531635     1  0.3314      0.788 0.764 0.000 0.012 0.000 0.224 0.000
#> GSM531640     3  0.0260      0.939 0.000 0.008 0.992 0.000 0.000 0.000
#> GSM531649     1  0.2653      0.798 0.844 0.000 0.012 0.000 0.144 0.000
#> GSM531653     1  0.0000      0.807 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM531657     4  0.3122      0.843 0.000 0.020 0.000 0.804 0.176 0.000
#> GSM531665     5  0.4075      0.594 0.008 0.032 0.012 0.000 0.756 0.192
#> GSM531670     1  0.4703      0.732 0.620 0.000 0.068 0.000 0.312 0.000
#> GSM531674     1  0.0692      0.799 0.976 0.000 0.000 0.000 0.004 0.020
#> GSM531675     2  0.2558      0.876 0.000 0.868 0.000 0.000 0.028 0.104
#> GSM531677     2  0.2826      0.866 0.000 0.844 0.000 0.000 0.028 0.128
#> GSM531678     2  0.0000      0.866 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM531680     6  0.1957      0.766 0.000 0.112 0.000 0.000 0.000 0.888
#> GSM531689     2  0.3490      0.545 0.000 0.724 0.000 0.000 0.008 0.268
#> GSM531691     5  0.5578      0.640 0.000 0.184 0.000 0.000 0.540 0.276
#> GSM531692     5  0.5509      0.623 0.000 0.160 0.000 0.000 0.540 0.300
#> GSM531694     2  0.0458      0.862 0.000 0.984 0.000 0.000 0.000 0.016

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)
#> Error in mat[ceiling(1:nr/h_ratio), ceiling(1:nc/w_ratio), drop = FALSE]: subscript out of bounds

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 disease.state(p) k
#> CV:mclust 80            0.847 2
#> CV:mclust 53            1.000 3
#> CV:mclust 79            0.700 4
#> CV:mclust 66            0.655 5
#> CV:mclust 78            0.676 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 51941 rows and 80 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.873           0.935       0.970         0.5046 0.494   0.494
#> 3 3 0.521           0.498       0.739         0.3091 0.722   0.497
#> 4 4 0.850           0.869       0.946         0.1423 0.811   0.508
#> 5 5 0.856           0.835       0.918         0.0576 0.912   0.670
#> 6 6 0.747           0.618       0.795         0.0390 0.972   0.867

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
#> GSM531602     2  0.0000      0.949 0.000 1.000
#> GSM531604     2  0.0000      0.949 0.000 1.000
#> GSM531606     2  0.0000      0.949 0.000 1.000
#> GSM531607     2  0.0000      0.949 0.000 1.000
#> GSM531608     1  0.8327      0.630 0.736 0.264
#> GSM531610     2  0.0000      0.949 0.000 1.000
#> GSM531612     2  0.0000      0.949 0.000 1.000
#> GSM531613     2  0.0000      0.949 0.000 1.000
#> GSM531614     2  0.0000      0.949 0.000 1.000
#> GSM531616     1  0.0000      0.989 1.000 0.000
#> GSM531618     2  0.9286      0.494 0.344 0.656
#> GSM531619     1  0.0000      0.989 1.000 0.000
#> GSM531620     1  0.0000      0.989 1.000 0.000
#> GSM531623     1  0.0000      0.989 1.000 0.000
#> GSM531625     1  0.0000      0.989 1.000 0.000
#> GSM531626     1  0.0000      0.989 1.000 0.000
#> GSM531632     1  0.0000      0.989 1.000 0.000
#> GSM531638     1  0.0000      0.989 1.000 0.000
#> GSM531639     1  0.0000      0.989 1.000 0.000
#> GSM531641     2  0.0000      0.949 0.000 1.000
#> GSM531642     1  0.0000      0.989 1.000 0.000
#> GSM531643     1  0.0000      0.989 1.000 0.000
#> GSM531644     1  0.0000      0.989 1.000 0.000
#> GSM531645     2  0.0000      0.949 0.000 1.000
#> GSM531646     1  0.0000      0.989 1.000 0.000
#> GSM531647     1  0.0000      0.989 1.000 0.000
#> GSM531648     2  0.0000      0.949 0.000 1.000
#> GSM531650     1  0.0000      0.989 1.000 0.000
#> GSM531651     1  0.0000      0.989 1.000 0.000
#> GSM531652     1  0.0000      0.989 1.000 0.000
#> GSM531656     1  0.0000      0.989 1.000 0.000
#> GSM531659     2  0.0000      0.949 0.000 1.000
#> GSM531661     1  0.0000      0.989 1.000 0.000
#> GSM531662     1  0.0000      0.989 1.000 0.000
#> GSM531663     2  0.0000      0.949 0.000 1.000
#> GSM531664     1  0.0000      0.989 1.000 0.000
#> GSM531666     2  0.9248      0.545 0.340 0.660
#> GSM531667     1  0.0376      0.985 0.996 0.004
#> GSM531668     2  0.0000      0.949 0.000 1.000
#> GSM531669     1  0.0000      0.989 1.000 0.000
#> GSM531671     1  0.0000      0.989 1.000 0.000
#> GSM531672     2  0.0000      0.949 0.000 1.000
#> GSM531673     2  0.9358      0.520 0.352 0.648
#> GSM531676     2  0.8081      0.699 0.248 0.752
#> GSM531679     2  0.0000      0.949 0.000 1.000
#> GSM531681     2  0.0000      0.949 0.000 1.000
#> GSM531682     2  0.0000      0.949 0.000 1.000
#> GSM531683     2  0.0000      0.949 0.000 1.000
#> GSM531684     2  0.0000      0.949 0.000 1.000
#> GSM531685     1  0.0376      0.985 0.996 0.004
#> GSM531686     2  0.0000      0.949 0.000 1.000
#> GSM531687     2  0.5946      0.828 0.144 0.856
#> GSM531688     1  0.5629      0.833 0.868 0.132
#> GSM531690     2  0.0000      0.949 0.000 1.000
#> GSM531693     1  0.0000      0.989 1.000 0.000
#> GSM531695     2  0.5519      0.844 0.128 0.872
#> GSM531603     2  0.0000      0.949 0.000 1.000
#> GSM531609     2  0.0000      0.949 0.000 1.000
#> GSM531611     2  0.0000      0.949 0.000 1.000
#> GSM531621     1  0.0000      0.989 1.000 0.000
#> GSM531622     1  0.0000      0.989 1.000 0.000
#> GSM531628     1  0.0000      0.989 1.000 0.000
#> GSM531630     1  0.0000      0.989 1.000 0.000
#> GSM531633     1  0.0000      0.989 1.000 0.000
#> GSM531635     1  0.0000      0.989 1.000 0.000
#> GSM531640     1  0.0000      0.989 1.000 0.000
#> GSM531649     1  0.0000      0.989 1.000 0.000
#> GSM531653     1  0.0000      0.989 1.000 0.000
#> GSM531657     2  0.0000      0.949 0.000 1.000
#> GSM531665     2  0.9000      0.590 0.316 0.684
#> GSM531670     1  0.0000      0.989 1.000 0.000
#> GSM531674     1  0.0000      0.989 1.000 0.000
#> GSM531675     2  0.0000      0.949 0.000 1.000
#> GSM531677     2  0.0000      0.949 0.000 1.000
#> GSM531678     2  0.0000      0.949 0.000 1.000
#> GSM531680     2  0.2948      0.912 0.052 0.948
#> GSM531689     2  0.0000      0.949 0.000 1.000
#> GSM531691     2  0.2043      0.927 0.032 0.968
#> GSM531692     1  0.0672      0.981 0.992 0.008
#> GSM531694     2  0.0000      0.949 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
#> GSM531602     2  0.0000     0.7839 0.000 1.000 0.000
#> GSM531604     2  0.3619     0.6772 0.000 0.864 0.136
#> GSM531606     2  0.0000     0.7839 0.000 1.000 0.000
#> GSM531607     2  0.0000     0.7839 0.000 1.000 0.000
#> GSM531608     3  0.3325     0.6383 0.076 0.020 0.904
#> GSM531610     1  0.6305     0.2722 0.516 0.484 0.000
#> GSM531612     1  0.6267     0.3242 0.548 0.452 0.000
#> GSM531613     1  0.6308     0.2541 0.508 0.492 0.000
#> GSM531614     1  0.6291     0.3035 0.532 0.468 0.000
#> GSM531616     3  0.4796     0.6415 0.220 0.000 0.780
#> GSM531618     1  0.7170     0.3829 0.612 0.352 0.036
#> GSM531619     3  0.0000     0.7074 0.000 0.000 1.000
#> GSM531620     3  0.0000     0.7074 0.000 0.000 1.000
#> GSM531623     3  0.0000     0.7074 0.000 0.000 1.000
#> GSM531625     3  0.0000     0.7074 0.000 0.000 1.000
#> GSM531626     3  0.0000     0.7074 0.000 0.000 1.000
#> GSM531632     3  0.6295     0.5010 0.472 0.000 0.528
#> GSM531638     3  0.0000     0.7074 0.000 0.000 1.000
#> GSM531639     3  0.3038     0.6782 0.104 0.000 0.896
#> GSM531641     1  0.6295     0.2969 0.528 0.472 0.000
#> GSM531642     1  0.4555     0.2494 0.800 0.000 0.200
#> GSM531643     1  0.4842     0.1464 0.776 0.000 0.224
#> GSM531644     1  0.2448     0.3688 0.924 0.000 0.076
#> GSM531645     1  0.6192     0.3525 0.580 0.420 0.000
#> GSM531646     3  0.6299     0.4973 0.476 0.000 0.524
#> GSM531647     3  0.6307     0.4835 0.488 0.000 0.512
#> GSM531648     1  0.5859     0.3992 0.656 0.344 0.000
#> GSM531650     1  0.5327     0.0249 0.728 0.000 0.272
#> GSM531651     3  0.0000     0.7074 0.000 0.000 1.000
#> GSM531652     1  0.0000     0.4208 1.000 0.000 0.000
#> GSM531656     3  0.6299     0.4856 0.476 0.000 0.524
#> GSM531659     2  0.2625     0.7224 0.084 0.916 0.000
#> GSM531661     3  0.5497     0.3769 0.000 0.292 0.708
#> GSM531662     3  0.5988     0.2059 0.000 0.368 0.632
#> GSM531663     2  0.5397     0.3941 0.280 0.720 0.000
#> GSM531664     1  0.4555     0.1959 0.800 0.000 0.200
#> GSM531666     1  0.2711     0.3571 0.912 0.000 0.088
#> GSM531667     3  0.0592     0.7003 0.012 0.000 0.988
#> GSM531668     2  0.1411     0.7612 0.036 0.964 0.000
#> GSM531669     3  0.6307     0.4835 0.488 0.000 0.512
#> GSM531671     3  0.5122     0.6463 0.200 0.012 0.788
#> GSM531672     1  0.6308     0.2541 0.508 0.492 0.000
#> GSM531673     3  0.6291    -0.0856 0.000 0.468 0.532
#> GSM531676     2  0.5178     0.5083 0.256 0.744 0.000
#> GSM531679     2  0.0000     0.7839 0.000 1.000 0.000
#> GSM531681     2  0.2261     0.7349 0.068 0.932 0.000
#> GSM531682     2  0.0000     0.7839 0.000 1.000 0.000
#> GSM531683     2  0.0000     0.7839 0.000 1.000 0.000
#> GSM531684     2  0.6252     0.2450 0.000 0.556 0.444
#> GSM531685     2  0.9409     0.0597 0.360 0.460 0.180
#> GSM531686     2  0.5363     0.3887 0.276 0.724 0.000
#> GSM531687     2  0.4002     0.6429 0.160 0.840 0.000
#> GSM531688     1  0.9441    -0.2372 0.484 0.200 0.316
#> GSM531690     2  0.2066     0.7409 0.060 0.940 0.000
#> GSM531693     3  0.6299     0.4973 0.476 0.000 0.524
#> GSM531695     1  0.5968     0.1347 0.636 0.364 0.000
#> GSM531603     2  0.0000     0.7839 0.000 1.000 0.000
#> GSM531609     1  0.6280     0.3146 0.540 0.460 0.000
#> GSM531611     1  0.6295     0.2969 0.528 0.472 0.000
#> GSM531621     3  0.0000     0.7074 0.000 0.000 1.000
#> GSM531622     3  0.0237     0.7052 0.004 0.000 0.996
#> GSM531628     1  0.5760    -0.1333 0.672 0.000 0.328
#> GSM531630     3  0.0000     0.7074 0.000 0.000 1.000
#> GSM531633     3  0.0000     0.7074 0.000 0.000 1.000
#> GSM531635     3  0.6295     0.5010 0.472 0.000 0.528
#> GSM531640     3  0.2356     0.6516 0.072 0.000 0.928
#> GSM531649     3  0.6291     0.5039 0.468 0.000 0.532
#> GSM531653     3  0.6307     0.4835 0.488 0.000 0.512
#> GSM531657     2  0.6299    -0.2290 0.476 0.524 0.000
#> GSM531665     2  0.5787     0.6037 0.136 0.796 0.068
#> GSM531670     3  0.5988     0.5561 0.368 0.000 0.632
#> GSM531674     3  0.6307     0.4835 0.488 0.000 0.512
#> GSM531675     2  0.0000     0.7839 0.000 1.000 0.000
#> GSM531677     2  0.0000     0.7839 0.000 1.000 0.000
#> GSM531678     2  0.0000     0.7839 0.000 1.000 0.000
#> GSM531680     2  0.5098     0.5436 0.248 0.752 0.000
#> GSM531689     2  0.0000     0.7839 0.000 1.000 0.000
#> GSM531691     2  0.1411     0.7643 0.000 0.964 0.036
#> GSM531692     2  0.9029     0.2031 0.144 0.504 0.352
#> GSM531694     2  0.0000     0.7839 0.000 1.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
#> GSM531602     2  0.0000      0.904 0.000 1.000 0.000 0.000
#> GSM531604     2  0.0000      0.904 0.000 1.000 0.000 0.000
#> GSM531606     2  0.0000      0.904 0.000 1.000 0.000 0.000
#> GSM531607     2  0.0000      0.904 0.000 1.000 0.000 0.000
#> GSM531608     3  0.0000      0.970 0.000 0.000 1.000 0.000
#> GSM531610     4  0.0000      0.947 0.000 0.000 0.000 1.000
#> GSM531612     4  0.0000      0.947 0.000 0.000 0.000 1.000
#> GSM531613     4  0.0000      0.947 0.000 0.000 0.000 1.000
#> GSM531614     4  0.0000      0.947 0.000 0.000 0.000 1.000
#> GSM531616     3  0.2408      0.862 0.104 0.000 0.896 0.000
#> GSM531618     4  0.0000      0.947 0.000 0.000 0.000 1.000
#> GSM531619     3  0.0000      0.970 0.000 0.000 1.000 0.000
#> GSM531620     3  0.0000      0.970 0.000 0.000 1.000 0.000
#> GSM531623     3  0.0000      0.970 0.000 0.000 1.000 0.000
#> GSM531625     3  0.0000      0.970 0.000 0.000 1.000 0.000
#> GSM531626     3  0.0000      0.970 0.000 0.000 1.000 0.000
#> GSM531632     1  0.0000      0.947 1.000 0.000 0.000 0.000
#> GSM531638     3  0.0000      0.970 0.000 0.000 1.000 0.000
#> GSM531639     3  0.0000      0.970 0.000 0.000 1.000 0.000
#> GSM531641     4  0.0000      0.947 0.000 0.000 0.000 1.000
#> GSM531642     4  0.1824      0.891 0.004 0.000 0.060 0.936
#> GSM531643     1  0.0000      0.947 1.000 0.000 0.000 0.000
#> GSM531644     1  0.0707      0.931 0.980 0.000 0.000 0.020
#> GSM531645     4  0.0000      0.947 0.000 0.000 0.000 1.000
#> GSM531646     1  0.0000      0.947 1.000 0.000 0.000 0.000
#> GSM531647     1  0.0000      0.947 1.000 0.000 0.000 0.000
#> GSM531648     4  0.0000      0.947 0.000 0.000 0.000 1.000
#> GSM531650     1  0.0000      0.947 1.000 0.000 0.000 0.000
#> GSM531651     3  0.0000      0.970 0.000 0.000 1.000 0.000
#> GSM531652     4  0.0000      0.947 0.000 0.000 0.000 1.000
#> GSM531656     1  0.2973      0.815 0.856 0.000 0.144 0.000
#> GSM531659     2  0.4522      0.560 0.000 0.680 0.000 0.320
#> GSM531661     3  0.0000      0.970 0.000 0.000 1.000 0.000
#> GSM531662     3  0.0000      0.970 0.000 0.000 1.000 0.000
#> GSM531663     4  0.0000      0.947 0.000 0.000 0.000 1.000
#> GSM531664     1  0.0000      0.947 1.000 0.000 0.000 0.000
#> GSM531666     4  0.4866      0.318 0.404 0.000 0.000 0.596
#> GSM531667     3  0.0000      0.970 0.000 0.000 1.000 0.000
#> GSM531668     2  0.4948      0.220 0.000 0.560 0.000 0.440
#> GSM531669     1  0.0000      0.947 1.000 0.000 0.000 0.000
#> GSM531671     3  0.6042      0.316 0.052 0.368 0.580 0.000
#> GSM531672     4  0.0000      0.947 0.000 0.000 0.000 1.000
#> GSM531673     2  0.4989      0.134 0.000 0.528 0.472 0.000
#> GSM531676     2  0.0592      0.896 0.016 0.984 0.000 0.000
#> GSM531679     2  0.0000      0.904 0.000 1.000 0.000 0.000
#> GSM531681     2  0.4585      0.525 0.000 0.668 0.000 0.332
#> GSM531682     2  0.0000      0.904 0.000 1.000 0.000 0.000
#> GSM531683     2  0.0000      0.904 0.000 1.000 0.000 0.000
#> GSM531684     2  0.2704      0.811 0.000 0.876 0.124 0.000
#> GSM531685     1  0.4776      0.358 0.624 0.376 0.000 0.000
#> GSM531686     4  0.4500      0.461 0.000 0.316 0.000 0.684
#> GSM531687     2  0.0188      0.902 0.004 0.996 0.000 0.000
#> GSM531688     1  0.0000      0.947 1.000 0.000 0.000 0.000
#> GSM531690     2  0.3400      0.746 0.000 0.820 0.000 0.180
#> GSM531693     1  0.0000      0.947 1.000 0.000 0.000 0.000
#> GSM531695     1  0.2469      0.852 0.892 0.108 0.000 0.000
#> GSM531603     2  0.0000      0.904 0.000 1.000 0.000 0.000
#> GSM531609     4  0.0000      0.947 0.000 0.000 0.000 1.000
#> GSM531611     4  0.0000      0.947 0.000 0.000 0.000 1.000
#> GSM531621     3  0.0000      0.970 0.000 0.000 1.000 0.000
#> GSM531622     3  0.0000      0.970 0.000 0.000 1.000 0.000
#> GSM531628     1  0.0000      0.947 1.000 0.000 0.000 0.000
#> GSM531630     3  0.0000      0.970 0.000 0.000 1.000 0.000
#> GSM531633     3  0.0000      0.970 0.000 0.000 1.000 0.000
#> GSM531635     1  0.0000      0.947 1.000 0.000 0.000 0.000
#> GSM531640     3  0.0000      0.970 0.000 0.000 1.000 0.000
#> GSM531649     1  0.0000      0.947 1.000 0.000 0.000 0.000
#> GSM531653     1  0.0000      0.947 1.000 0.000 0.000 0.000
#> GSM531657     4  0.0000      0.947 0.000 0.000 0.000 1.000
#> GSM531665     2  0.2704      0.813 0.124 0.876 0.000 0.000
#> GSM531670     1  0.3610      0.742 0.800 0.000 0.200 0.000
#> GSM531674     1  0.0000      0.947 1.000 0.000 0.000 0.000
#> GSM531675     2  0.0000      0.904 0.000 1.000 0.000 0.000
#> GSM531677     2  0.0000      0.904 0.000 1.000 0.000 0.000
#> GSM531678     2  0.0000      0.904 0.000 1.000 0.000 0.000
#> GSM531680     2  0.3123      0.775 0.156 0.844 0.000 0.000
#> GSM531689     2  0.0000      0.904 0.000 1.000 0.000 0.000
#> GSM531691     2  0.0000      0.904 0.000 1.000 0.000 0.000
#> GSM531692     2  0.0000      0.904 0.000 1.000 0.000 0.000
#> GSM531694     2  0.0000      0.904 0.000 1.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
#> GSM531602     2  0.1732     0.8767 0.000 0.920 0.000 0.000 0.080
#> GSM531604     2  0.0000     0.9013 0.000 1.000 0.000 0.000 0.000
#> GSM531606     2  0.0290     0.9022 0.000 0.992 0.000 0.000 0.008
#> GSM531607     2  0.2127     0.8537 0.000 0.892 0.000 0.000 0.108
#> GSM531608     3  0.0510     0.9070 0.000 0.000 0.984 0.000 0.016
#> GSM531610     4  0.0000     0.9924 0.000 0.000 0.000 1.000 0.000
#> GSM531612     4  0.0000     0.9924 0.000 0.000 0.000 1.000 0.000
#> GSM531613     4  0.0000     0.9924 0.000 0.000 0.000 1.000 0.000
#> GSM531614     4  0.0000     0.9924 0.000 0.000 0.000 1.000 0.000
#> GSM531616     3  0.4040     0.6036 0.276 0.000 0.712 0.000 0.012
#> GSM531618     5  0.1117     0.8288 0.000 0.000 0.016 0.020 0.964
#> GSM531619     3  0.0162     0.9080 0.000 0.000 0.996 0.000 0.004
#> GSM531620     3  0.0671     0.9062 0.004 0.000 0.980 0.000 0.016
#> GSM531623     3  0.0162     0.9080 0.000 0.000 0.996 0.000 0.004
#> GSM531625     3  0.0955     0.9008 0.004 0.000 0.968 0.000 0.028
#> GSM531626     3  0.1082     0.8991 0.008 0.000 0.964 0.000 0.028
#> GSM531632     1  0.0404     0.9139 0.988 0.000 0.000 0.000 0.012
#> GSM531638     3  0.0290     0.9079 0.000 0.000 0.992 0.000 0.008
#> GSM531639     3  0.0609     0.9030 0.000 0.000 0.980 0.000 0.020
#> GSM531641     4  0.0000     0.9924 0.000 0.000 0.000 1.000 0.000
#> GSM531642     5  0.2387     0.8190 0.040 0.000 0.004 0.048 0.908
#> GSM531643     1  0.1121     0.9020 0.956 0.000 0.000 0.000 0.044
#> GSM531644     5  0.3707     0.5548 0.284 0.000 0.000 0.000 0.716
#> GSM531645     4  0.0000     0.9924 0.000 0.000 0.000 1.000 0.000
#> GSM531646     1  0.0404     0.9139 0.988 0.000 0.000 0.000 0.012
#> GSM531647     1  0.0000     0.9155 1.000 0.000 0.000 0.000 0.000
#> GSM531648     5  0.1571     0.8206 0.000 0.000 0.004 0.060 0.936
#> GSM531650     1  0.0963     0.9056 0.964 0.000 0.000 0.000 0.036
#> GSM531651     3  0.0162     0.9080 0.000 0.000 0.996 0.000 0.004
#> GSM531652     5  0.2036     0.8196 0.056 0.000 0.000 0.024 0.920
#> GSM531656     1  0.3255     0.8208 0.848 0.000 0.100 0.000 0.052
#> GSM531659     5  0.4886     0.1168 0.000 0.448 0.000 0.024 0.528
#> GSM531661     3  0.0162     0.9080 0.000 0.000 0.996 0.000 0.004
#> GSM531662     3  0.0955     0.9007 0.000 0.004 0.968 0.000 0.028
#> GSM531663     4  0.0000     0.9924 0.000 0.000 0.000 1.000 0.000
#> GSM531664     1  0.1478     0.8881 0.936 0.000 0.000 0.000 0.064
#> GSM531666     5  0.0794     0.8296 0.028 0.000 0.000 0.000 0.972
#> GSM531667     3  0.2690     0.7662 0.000 0.000 0.844 0.000 0.156
#> GSM531668     5  0.2833     0.7993 0.000 0.120 0.004 0.012 0.864
#> GSM531669     1  0.0162     0.9155 0.996 0.000 0.000 0.000 0.004
#> GSM531671     3  0.6813     0.2799 0.212 0.300 0.476 0.000 0.012
#> GSM531672     5  0.1369     0.8303 0.000 0.008 0.008 0.028 0.956
#> GSM531673     3  0.4905    -0.0237 0.000 0.476 0.500 0.000 0.024
#> GSM531676     2  0.1341     0.8801 0.056 0.944 0.000 0.000 0.000
#> GSM531679     2  0.0000     0.9013 0.000 1.000 0.000 0.000 0.000
#> GSM531681     4  0.1121     0.9465 0.000 0.044 0.000 0.956 0.000
#> GSM531682     2  0.0703     0.9005 0.000 0.976 0.000 0.000 0.024
#> GSM531683     2  0.0404     0.9024 0.000 0.988 0.000 0.000 0.012
#> GSM531684     2  0.3837     0.5526 0.000 0.692 0.308 0.000 0.000
#> GSM531685     1  0.4169     0.6334 0.724 0.256 0.004 0.000 0.016
#> GSM531686     4  0.0510     0.9775 0.000 0.016 0.000 0.984 0.000
#> GSM531687     2  0.1211     0.8983 0.024 0.960 0.000 0.000 0.016
#> GSM531688     1  0.0162     0.9154 0.996 0.000 0.000 0.000 0.004
#> GSM531690     5  0.3266     0.7361 0.000 0.200 0.000 0.004 0.796
#> GSM531693     1  0.0162     0.9158 0.996 0.000 0.000 0.000 0.004
#> GSM531695     1  0.5048     0.3128 0.580 0.040 0.000 0.000 0.380
#> GSM531603     5  0.3274     0.7119 0.000 0.220 0.000 0.000 0.780
#> GSM531609     4  0.0000     0.9924 0.000 0.000 0.000 1.000 0.000
#> GSM531611     4  0.0000     0.9924 0.000 0.000 0.000 1.000 0.000
#> GSM531621     3  0.0609     0.9046 0.000 0.000 0.980 0.000 0.020
#> GSM531622     3  0.0162     0.9080 0.000 0.000 0.996 0.000 0.004
#> GSM531628     1  0.0609     0.9119 0.980 0.000 0.000 0.000 0.020
#> GSM531630     3  0.0162     0.9080 0.000 0.000 0.996 0.000 0.004
#> GSM531633     3  0.0404     0.9076 0.000 0.000 0.988 0.000 0.012
#> GSM531635     1  0.0609     0.9116 0.980 0.000 0.000 0.000 0.020
#> GSM531640     3  0.0162     0.9080 0.000 0.000 0.996 0.000 0.004
#> GSM531649     1  0.0865     0.9084 0.972 0.000 0.004 0.000 0.024
#> GSM531653     1  0.0404     0.9152 0.988 0.000 0.000 0.000 0.012
#> GSM531657     5  0.3430     0.6792 0.000 0.000 0.004 0.220 0.776
#> GSM531665     2  0.1877     0.8747 0.064 0.924 0.000 0.000 0.012
#> GSM531670     1  0.3877     0.6971 0.764 0.000 0.212 0.000 0.024
#> GSM531674     1  0.0162     0.9154 0.996 0.000 0.000 0.000 0.004
#> GSM531675     2  0.3336     0.7066 0.000 0.772 0.000 0.000 0.228
#> GSM531677     2  0.0794     0.8998 0.000 0.972 0.000 0.000 0.028
#> GSM531678     2  0.1410     0.8748 0.000 0.940 0.000 0.060 0.000
#> GSM531680     2  0.4668     0.5974 0.272 0.684 0.000 0.000 0.044
#> GSM531689     2  0.0000     0.9013 0.000 1.000 0.000 0.000 0.000
#> GSM531691     2  0.0798     0.8976 0.000 0.976 0.008 0.000 0.016
#> GSM531692     2  0.2568     0.8376 0.092 0.888 0.004 0.000 0.016
#> GSM531694     2  0.1544     0.8834 0.000 0.932 0.000 0.000 0.068

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>           class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM531602     2  0.5002     0.4999 0.000 0.556 0.000 0.000 0.364 0.080
#> GSM531604     2  0.0865     0.6683 0.000 0.964 0.000 0.000 0.036 0.000
#> GSM531606     2  0.3575     0.6042 0.000 0.708 0.000 0.000 0.284 0.008
#> GSM531607     2  0.4974     0.5236 0.000 0.588 0.000 0.000 0.324 0.088
#> GSM531608     3  0.2728     0.6023 0.000 0.000 0.860 0.100 0.040 0.000
#> GSM531610     4  0.0000     0.9990 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM531612     4  0.0000     0.9990 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM531613     4  0.0000     0.9990 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM531614     4  0.0000     0.9990 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM531616     3  0.5634    -0.2308 0.316 0.000 0.512 0.000 0.172 0.000
#> GSM531618     6  0.3000     0.7110 0.000 0.000 0.032 0.004 0.124 0.840
#> GSM531619     3  0.3351     0.6125 0.000 0.000 0.712 0.000 0.288 0.000
#> GSM531620     3  0.3360     0.3632 0.004 0.000 0.732 0.000 0.264 0.000
#> GSM531623     3  0.0713     0.6666 0.000 0.000 0.972 0.000 0.028 0.000
#> GSM531625     3  0.3023     0.5761 0.000 0.000 0.768 0.000 0.232 0.000
#> GSM531626     3  0.3770     0.3278 0.028 0.000 0.728 0.000 0.244 0.000
#> GSM531632     1  0.3422     0.6811 0.788 0.000 0.036 0.000 0.176 0.000
#> GSM531638     3  0.3287     0.6457 0.012 0.000 0.768 0.000 0.220 0.000
#> GSM531639     3  0.3867     0.6436 0.008 0.000 0.760 0.000 0.192 0.040
#> GSM531641     4  0.0000     0.9990 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM531642     6  0.2834     0.7002 0.128 0.000 0.016 0.008 0.000 0.848
#> GSM531643     1  0.1219     0.7818 0.948 0.000 0.000 0.000 0.004 0.048
#> GSM531644     6  0.3409     0.5204 0.300 0.000 0.000 0.000 0.000 0.700
#> GSM531645     4  0.0000     0.9990 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM531646     1  0.2778     0.7266 0.824 0.000 0.008 0.000 0.168 0.000
#> GSM531647     1  0.2092     0.7653 0.876 0.000 0.000 0.000 0.124 0.000
#> GSM531648     6  0.0622     0.7450 0.000 0.000 0.000 0.008 0.012 0.980
#> GSM531650     1  0.1934     0.7907 0.916 0.000 0.000 0.000 0.044 0.040
#> GSM531651     3  0.0458     0.6603 0.000 0.000 0.984 0.000 0.016 0.000
#> GSM531652     6  0.1411     0.7375 0.060 0.000 0.000 0.000 0.004 0.936
#> GSM531656     1  0.4116     0.6593 0.780 0.000 0.088 0.000 0.024 0.108
#> GSM531659     6  0.5200     0.4554 0.004 0.284 0.008 0.008 0.068 0.628
#> GSM531661     3  0.1714     0.6667 0.000 0.000 0.908 0.000 0.092 0.000
#> GSM531662     3  0.3053     0.4941 0.000 0.020 0.812 0.000 0.168 0.000
#> GSM531663     4  0.0000     0.9990 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM531664     1  0.1958     0.7519 0.896 0.000 0.000 0.000 0.004 0.100
#> GSM531666     6  0.2704     0.7064 0.140 0.000 0.000 0.000 0.016 0.844
#> GSM531667     3  0.3612     0.5311 0.000 0.000 0.780 0.000 0.052 0.168
#> GSM531668     6  0.5138     0.4288 0.000 0.036 0.028 0.000 0.400 0.536
#> GSM531669     1  0.2416     0.7445 0.844 0.000 0.000 0.000 0.156 0.000
#> GSM531671     5  0.6634     0.0000 0.144 0.056 0.344 0.000 0.452 0.004
#> GSM531672     6  0.1453     0.7501 0.000 0.008 0.000 0.008 0.040 0.944
#> GSM531673     3  0.6209    -0.4310 0.000 0.252 0.428 0.000 0.312 0.008
#> GSM531676     2  0.4025     0.3713 0.312 0.668 0.000 0.000 0.016 0.004
#> GSM531679     2  0.2003     0.6592 0.000 0.884 0.000 0.000 0.116 0.000
#> GSM531681     4  0.0260     0.9900 0.000 0.008 0.000 0.992 0.000 0.000
#> GSM531682     2  0.3278     0.6446 0.000 0.808 0.000 0.000 0.152 0.040
#> GSM531683     2  0.3782     0.6245 0.000 0.740 0.000 0.000 0.224 0.036
#> GSM531684     2  0.6125    -0.0120 0.000 0.356 0.320 0.000 0.324 0.000
#> GSM531685     2  0.5215    -0.1079 0.460 0.468 0.012 0.000 0.060 0.000
#> GSM531686     4  0.0000     0.9990 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM531687     2  0.5538     0.0448 0.436 0.472 0.000 0.000 0.064 0.028
#> GSM531688     1  0.1367     0.7831 0.944 0.044 0.000 0.000 0.012 0.000
#> GSM531690     6  0.3013     0.7148 0.000 0.088 0.000 0.000 0.068 0.844
#> GSM531693     1  0.2680     0.7777 0.860 0.032 0.000 0.000 0.108 0.000
#> GSM531695     1  0.4360     0.6503 0.768 0.040 0.000 0.000 0.092 0.100
#> GSM531603     6  0.5488     0.4294 0.000 0.112 0.008 0.000 0.340 0.540
#> GSM531609     4  0.0000     0.9990 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM531611     4  0.0000     0.9990 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM531621     3  0.1610     0.6630 0.000 0.000 0.916 0.000 0.084 0.000
#> GSM531622     3  0.2762     0.6585 0.000 0.000 0.804 0.000 0.196 0.000
#> GSM531628     1  0.0547     0.7886 0.980 0.000 0.000 0.000 0.000 0.020
#> GSM531630     3  0.3351     0.6141 0.000 0.000 0.712 0.000 0.288 0.000
#> GSM531633     3  0.1387     0.6366 0.000 0.000 0.932 0.000 0.068 0.000
#> GSM531635     1  0.1398     0.7902 0.940 0.000 0.008 0.000 0.052 0.000
#> GSM531640     3  0.3446     0.6018 0.000 0.000 0.692 0.000 0.308 0.000
#> GSM531649     1  0.3652     0.6734 0.768 0.000 0.044 0.000 0.188 0.000
#> GSM531653     1  0.2558     0.7626 0.868 0.000 0.028 0.000 0.104 0.000
#> GSM531657     6  0.2812     0.7205 0.000 0.008 0.000 0.028 0.104 0.860
#> GSM531665     2  0.3816     0.6301 0.068 0.820 0.008 0.000 0.072 0.032
#> GSM531670     1  0.5849     0.2228 0.576 0.012 0.304 0.000 0.056 0.052
#> GSM531674     1  0.0520     0.7912 0.984 0.000 0.000 0.000 0.008 0.008
#> GSM531675     2  0.4828     0.2923 0.000 0.568 0.000 0.000 0.064 0.368
#> GSM531677     2  0.2512     0.6548 0.000 0.880 0.000 0.000 0.060 0.060
#> GSM531678     2  0.2527     0.6340 0.000 0.876 0.000 0.084 0.040 0.000
#> GSM531680     1  0.5439     0.1869 0.524 0.380 0.000 0.000 0.080 0.016
#> GSM531689     2  0.0790     0.6633 0.000 0.968 0.000 0.000 0.032 0.000
#> GSM531691     2  0.2147     0.6474 0.000 0.896 0.020 0.000 0.084 0.000
#> GSM531692     2  0.2571     0.6333 0.064 0.876 0.000 0.000 0.060 0.000
#> GSM531694     2  0.4578     0.5573 0.000 0.624 0.000 0.000 0.320 0.056

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

consensus_heatmap(res, k = 2)

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)
#> Error in mat[ceiling(1:nr/h_ratio), ceiling(1:nc/w_ratio), drop = FALSE]: subscript out of bounds

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 disease.state(p) k
#> CV:NMF 79            1.000 2
#> CV:NMF 43            1.000 3
#> CV:NMF 74            0.471 4
#> CV:NMF 76            0.373 5
#> CV:NMF 63            0.220 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 51941 rows and 80 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.487           0.728       0.875         0.4865 0.505   0.505
#> 3 3 0.342           0.542       0.724         0.3232 0.781   0.587
#> 4 4 0.492           0.547       0.751         0.1418 0.819   0.526
#> 5 5 0.621           0.577       0.771         0.0761 0.900   0.631
#> 6 6 0.659           0.533       0.722         0.0413 0.969   0.843

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
#> GSM531602     2  0.0000     0.8952 0.000 1.000
#> GSM531604     2  0.9209     0.3983 0.336 0.664
#> GSM531606     2  0.2778     0.8739 0.048 0.952
#> GSM531607     2  0.0376     0.8948 0.004 0.996
#> GSM531608     1  0.8443     0.6430 0.728 0.272
#> GSM531610     2  0.0000     0.8952 0.000 1.000
#> GSM531612     2  0.0376     0.8953 0.004 0.996
#> GSM531613     2  0.0000     0.8952 0.000 1.000
#> GSM531614     2  0.0000     0.8952 0.000 1.000
#> GSM531616     1  0.0000     0.8177 1.000 0.000
#> GSM531618     2  0.6438     0.7677 0.164 0.836
#> GSM531619     1  0.0672     0.8180 0.992 0.008
#> GSM531620     1  0.0000     0.8177 1.000 0.000
#> GSM531623     1  0.0000     0.8177 1.000 0.000
#> GSM531625     1  0.0000     0.8177 1.000 0.000
#> GSM531626     1  0.0000     0.8177 1.000 0.000
#> GSM531632     1  0.0000     0.8177 1.000 0.000
#> GSM531638     1  0.0000     0.8177 1.000 0.000
#> GSM531639     1  0.2603     0.8125 0.956 0.044
#> GSM531641     2  0.0376     0.8953 0.004 0.996
#> GSM531642     1  0.9944     0.2656 0.544 0.456
#> GSM531643     1  0.4022     0.8031 0.920 0.080
#> GSM531644     1  0.9996     0.1608 0.512 0.488
#> GSM531645     2  0.0376     0.8953 0.004 0.996
#> GSM531646     1  0.0000     0.8177 1.000 0.000
#> GSM531647     1  0.0000     0.8177 1.000 0.000
#> GSM531648     2  0.8713     0.5582 0.292 0.708
#> GSM531650     1  0.4022     0.8016 0.920 0.080
#> GSM531651     1  0.0000     0.8177 1.000 0.000
#> GSM531652     2  0.8713     0.5582 0.292 0.708
#> GSM531656     1  0.2778     0.8122 0.952 0.048
#> GSM531659     2  0.8207     0.6046 0.256 0.744
#> GSM531661     1  0.7219     0.7147 0.800 0.200
#> GSM531662     1  0.9922     0.3426 0.552 0.448
#> GSM531663     2  0.5629     0.7894 0.132 0.868
#> GSM531664     1  0.4022     0.8016 0.920 0.080
#> GSM531666     2  0.9909     0.0964 0.444 0.556
#> GSM531667     1  0.8608     0.6307 0.716 0.284
#> GSM531668     2  0.2236     0.8823 0.036 0.964
#> GSM531669     1  0.2236     0.8140 0.964 0.036
#> GSM531671     1  0.9909     0.3528 0.556 0.444
#> GSM531672     2  0.0376     0.8953 0.004 0.996
#> GSM531673     1  0.9922     0.3426 0.552 0.448
#> GSM531676     1  0.9833     0.4244 0.576 0.424
#> GSM531679     2  0.2236     0.8818 0.036 0.964
#> GSM531681     2  0.0000     0.8952 0.000 1.000
#> GSM531682     2  0.1414     0.8911 0.020 0.980
#> GSM531683     2  0.0000     0.8952 0.000 1.000
#> GSM531684     2  0.3879     0.8501 0.076 0.924
#> GSM531685     1  0.8608     0.6478 0.716 0.284
#> GSM531686     2  0.0000     0.8952 0.000 1.000
#> GSM531687     1  0.9833     0.4244 0.576 0.424
#> GSM531688     1  0.8267     0.6743 0.740 0.260
#> GSM531690     2  0.0000     0.8952 0.000 1.000
#> GSM531693     1  0.8267     0.6743 0.740 0.260
#> GSM531695     1  0.9686     0.4777 0.604 0.396
#> GSM531603     2  0.0376     0.8948 0.004 0.996
#> GSM531609     2  0.0000     0.8952 0.000 1.000
#> GSM531611     2  0.0672     0.8946 0.008 0.992
#> GSM531621     1  0.0000     0.8177 1.000 0.000
#> GSM531622     1  0.0672     0.8180 0.992 0.008
#> GSM531628     1  0.4022     0.8016 0.920 0.080
#> GSM531630     1  0.0672     0.8180 0.992 0.008
#> GSM531633     1  0.0000     0.8177 1.000 0.000
#> GSM531635     1  0.0000     0.8177 1.000 0.000
#> GSM531640     1  0.0672     0.8180 0.992 0.008
#> GSM531649     1  0.0000     0.8177 1.000 0.000
#> GSM531653     1  0.0000     0.8177 1.000 0.000
#> GSM531657     2  0.3733     0.8607 0.072 0.928
#> GSM531665     2  0.9970    -0.0823 0.468 0.532
#> GSM531670     1  0.2778     0.8122 0.952 0.048
#> GSM531674     1  0.2236     0.8140 0.964 0.036
#> GSM531675     2  0.0000     0.8952 0.000 1.000
#> GSM531677     2  0.2236     0.8818 0.036 0.964
#> GSM531678     2  0.2948     0.8708 0.052 0.948
#> GSM531680     1  0.9710     0.4711 0.600 0.400
#> GSM531689     1  0.9833     0.4244 0.576 0.424
#> GSM531691     1  0.9866     0.4049 0.568 0.432
#> GSM531692     1  0.9087     0.5964 0.676 0.324
#> GSM531694     2  0.0000     0.8952 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
#> GSM531602     2  0.5760     0.7015 0.000 0.672 0.328
#> GSM531604     3  0.7948    -0.0637 0.080 0.320 0.600
#> GSM531606     2  0.6095     0.6420 0.000 0.608 0.392
#> GSM531607     2  0.4351     0.7806 0.004 0.828 0.168
#> GSM531608     3  0.7772     0.4832 0.196 0.132 0.672
#> GSM531610     2  0.0000     0.7888 0.000 1.000 0.000
#> GSM531612     2  0.0747     0.7859 0.016 0.984 0.000
#> GSM531613     2  0.0000     0.7888 0.000 1.000 0.000
#> GSM531614     2  0.0000     0.7888 0.000 1.000 0.000
#> GSM531616     1  0.5560     0.3564 0.700 0.000 0.300
#> GSM531618     2  0.5473     0.7028 0.140 0.808 0.052
#> GSM531619     3  0.5859     0.4833 0.344 0.000 0.656
#> GSM531620     3  0.5988     0.4662 0.368 0.000 0.632
#> GSM531623     3  0.5926     0.4763 0.356 0.000 0.644
#> GSM531625     3  0.6008     0.4607 0.372 0.000 0.628
#> GSM531626     3  0.6008     0.4607 0.372 0.000 0.628
#> GSM531632     1  0.0592     0.6663 0.988 0.000 0.012
#> GSM531638     1  0.5560     0.3564 0.700 0.000 0.300
#> GSM531639     1  0.6699     0.4670 0.700 0.044 0.256
#> GSM531641     2  0.0747     0.7859 0.016 0.984 0.000
#> GSM531642     2  0.9383    -0.1001 0.384 0.444 0.172
#> GSM531643     1  0.3120     0.6557 0.908 0.080 0.012
#> GSM531644     1  0.6299     0.0138 0.524 0.476 0.000
#> GSM531645     2  0.0747     0.7859 0.016 0.984 0.000
#> GSM531646     1  0.1411     0.6580 0.964 0.000 0.036
#> GSM531647     1  0.0592     0.6663 0.988 0.000 0.012
#> GSM531648     2  0.6082     0.5188 0.296 0.692 0.012
#> GSM531650     1  0.2261     0.6564 0.932 0.068 0.000
#> GSM531651     3  0.5926     0.4763 0.356 0.000 0.644
#> GSM531652     2  0.6082     0.5188 0.296 0.692 0.012
#> GSM531656     1  0.6646     0.4878 0.712 0.048 0.240
#> GSM531659     2  0.7580     0.4961 0.056 0.604 0.340
#> GSM531661     3  0.7413     0.4897 0.224 0.092 0.684
#> GSM531662     3  0.7082     0.4314 0.120 0.156 0.724
#> GSM531663     2  0.4915     0.7021 0.012 0.804 0.184
#> GSM531664     1  0.2261     0.6564 0.932 0.068 0.000
#> GSM531666     2  0.6641     0.1552 0.448 0.544 0.008
#> GSM531667     3  0.8042     0.4763 0.200 0.148 0.652
#> GSM531668     2  0.2903     0.7887 0.028 0.924 0.048
#> GSM531669     1  0.3769     0.6197 0.880 0.016 0.104
#> GSM531671     3  0.7273     0.4274 0.132 0.156 0.712
#> GSM531672     2  0.1636     0.7917 0.016 0.964 0.020
#> GSM531673     3  0.7082     0.4314 0.120 0.156 0.724
#> GSM531676     3  0.9048     0.1967 0.288 0.172 0.540
#> GSM531679     2  0.6226     0.7386 0.028 0.720 0.252
#> GSM531681     2  0.1964     0.7934 0.000 0.944 0.056
#> GSM531682     2  0.5681     0.7527 0.016 0.748 0.236
#> GSM531683     2  0.5733     0.7043 0.000 0.676 0.324
#> GSM531684     2  0.6192     0.6028 0.000 0.580 0.420
#> GSM531685     1  0.8691     0.2515 0.528 0.116 0.356
#> GSM531686     2  0.1964     0.7934 0.000 0.944 0.056
#> GSM531687     3  0.9048     0.1967 0.288 0.172 0.540
#> GSM531688     1  0.7872     0.4174 0.652 0.112 0.236
#> GSM531690     2  0.3482     0.7845 0.000 0.872 0.128
#> GSM531693     1  0.8311     0.3591 0.596 0.112 0.292
#> GSM531695     1  0.9267     0.2665 0.528 0.224 0.248
#> GSM531603     2  0.4351     0.7806 0.004 0.828 0.168
#> GSM531609     2  0.0000     0.7888 0.000 1.000 0.000
#> GSM531611     2  0.0829     0.7889 0.012 0.984 0.004
#> GSM531621     3  0.5948     0.4728 0.360 0.000 0.640
#> GSM531622     3  0.5859     0.4833 0.344 0.000 0.656
#> GSM531628     1  0.2261     0.6564 0.932 0.068 0.000
#> GSM531630     3  0.5859     0.4833 0.344 0.000 0.656
#> GSM531633     3  0.5948     0.4728 0.360 0.000 0.640
#> GSM531635     1  0.3941     0.5675 0.844 0.000 0.156
#> GSM531640     3  0.5859     0.4833 0.344 0.000 0.656
#> GSM531649     1  0.0592     0.6663 0.988 0.000 0.012
#> GSM531653     1  0.0592     0.6663 0.988 0.000 0.012
#> GSM531657     2  0.4370     0.7773 0.056 0.868 0.076
#> GSM531665     3  0.8350     0.2616 0.120 0.280 0.600
#> GSM531670     1  0.6646     0.4878 0.712 0.048 0.240
#> GSM531674     1  0.3769     0.6197 0.880 0.016 0.104
#> GSM531675     2  0.4452     0.7718 0.000 0.808 0.192
#> GSM531677     2  0.6226     0.7386 0.028 0.720 0.252
#> GSM531678     2  0.6111     0.6368 0.000 0.604 0.396
#> GSM531680     1  0.9295     0.2616 0.524 0.224 0.252
#> GSM531689     3  0.9048     0.1967 0.288 0.172 0.540
#> GSM531691     3  0.8933     0.2130 0.276 0.168 0.556
#> GSM531692     3  0.5325     0.3293 0.248 0.004 0.748
#> GSM531694     2  0.5760     0.7015 0.000 0.672 0.328

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM531602     2  0.2921      0.560 0.000 0.860 0.000 0.140
#> GSM531604     2  0.4850      0.522 0.052 0.776 0.168 0.004
#> GSM531606     2  0.3991      0.578 0.000 0.832 0.048 0.120
#> GSM531607     2  0.5088      0.172 0.004 0.572 0.000 0.424
#> GSM531608     3  0.6084      0.558 0.016 0.220 0.692 0.072
#> GSM531610     4  0.0707      0.718 0.000 0.020 0.000 0.980
#> GSM531612     4  0.0000      0.718 0.000 0.000 0.000 1.000
#> GSM531613     4  0.0707      0.718 0.000 0.020 0.000 0.980
#> GSM531614     4  0.0707      0.718 0.000 0.020 0.000 0.980
#> GSM531616     1  0.4866      0.349 0.596 0.000 0.404 0.000
#> GSM531618     4  0.5573      0.653 0.132 0.072 0.032 0.764
#> GSM531619     3  0.0000      0.893 0.000 0.000 1.000 0.000
#> GSM531620     3  0.1474      0.883 0.052 0.000 0.948 0.000
#> GSM531623     3  0.0469      0.894 0.012 0.000 0.988 0.000
#> GSM531625     3  0.2081      0.861 0.084 0.000 0.916 0.000
#> GSM531626     3  0.2149      0.858 0.088 0.000 0.912 0.000
#> GSM531632     1  0.0000      0.731 1.000 0.000 0.000 0.000
#> GSM531638     1  0.4866      0.349 0.596 0.000 0.404 0.000
#> GSM531639     1  0.5569      0.536 0.660 0.000 0.296 0.044
#> GSM531641     4  0.0000      0.718 0.000 0.000 0.000 1.000
#> GSM531642     4  0.7544      0.176 0.340 0.000 0.200 0.460
#> GSM531643     1  0.2593      0.703 0.904 0.000 0.016 0.080
#> GSM531644     4  0.5512      0.135 0.492 0.000 0.016 0.492
#> GSM531645     4  0.0000      0.718 0.000 0.000 0.000 1.000
#> GSM531646     1  0.1022      0.730 0.968 0.000 0.032 0.000
#> GSM531647     1  0.0000      0.731 1.000 0.000 0.000 0.000
#> GSM531648     4  0.5022      0.555 0.264 0.000 0.028 0.708
#> GSM531650     1  0.2081      0.704 0.916 0.000 0.000 0.084
#> GSM531651     3  0.0469      0.894 0.012 0.000 0.988 0.000
#> GSM531652     4  0.5022      0.555 0.264 0.000 0.028 0.708
#> GSM531656     1  0.5498      0.563 0.680 0.000 0.272 0.048
#> GSM531659     4  0.8584     -0.052 0.056 0.360 0.164 0.420
#> GSM531661     3  0.5104      0.682 0.008 0.152 0.772 0.068
#> GSM531662     2  0.8343      0.137 0.100 0.420 0.404 0.076
#> GSM531663     4  0.5998      0.505 0.004 0.192 0.108 0.696
#> GSM531664     1  0.2081      0.704 0.916 0.000 0.000 0.084
#> GSM531666     4  0.5620      0.305 0.416 0.000 0.024 0.560
#> GSM531667     3  0.6404      0.541 0.020 0.216 0.676 0.088
#> GSM531668     4  0.3824      0.668 0.036 0.104 0.008 0.852
#> GSM531669     1  0.3217      0.685 0.860 0.128 0.000 0.012
#> GSM531671     2  0.8460      0.147 0.112 0.416 0.396 0.076
#> GSM531672     4  0.2921      0.658 0.000 0.140 0.000 0.860
#> GSM531673     2  0.8343      0.137 0.100 0.420 0.404 0.076
#> GSM531676     2  0.8203      0.246 0.268 0.508 0.184 0.040
#> GSM531679     2  0.3791      0.519 0.004 0.796 0.000 0.200
#> GSM531681     4  0.4431      0.452 0.000 0.304 0.000 0.696
#> GSM531682     2  0.4234      0.496 0.004 0.764 0.004 0.228
#> GSM531683     2  0.3074      0.556 0.000 0.848 0.000 0.152
#> GSM531684     2  0.4130      0.580 0.000 0.828 0.064 0.108
#> GSM531685     1  0.7565      0.316 0.508 0.368 0.084 0.040
#> GSM531686     4  0.4477      0.439 0.000 0.312 0.000 0.688
#> GSM531687     2  0.8203      0.246 0.268 0.508 0.184 0.040
#> GSM531688     1  0.5658      0.460 0.632 0.328 0.000 0.040
#> GSM531690     2  0.4761      0.304 0.000 0.628 0.000 0.372
#> GSM531693     1  0.6858      0.413 0.576 0.340 0.044 0.040
#> GSM531695     1  0.6952      0.255 0.480 0.420 0.004 0.096
#> GSM531603     2  0.5088      0.172 0.004 0.572 0.000 0.424
#> GSM531609     4  0.0707      0.718 0.000 0.020 0.000 0.980
#> GSM531611     4  0.1824      0.705 0.000 0.060 0.004 0.936
#> GSM531621     3  0.0921      0.892 0.028 0.000 0.972 0.000
#> GSM531622     3  0.0000      0.893 0.000 0.000 1.000 0.000
#> GSM531628     1  0.2081      0.704 0.916 0.000 0.000 0.084
#> GSM531630     3  0.0000      0.893 0.000 0.000 1.000 0.000
#> GSM531633     3  0.0921      0.892 0.028 0.000 0.972 0.000
#> GSM531635     1  0.3975      0.607 0.760 0.000 0.240 0.000
#> GSM531640     3  0.0000      0.893 0.000 0.000 1.000 0.000
#> GSM531649     1  0.0000      0.731 1.000 0.000 0.000 0.000
#> GSM531653     1  0.0000      0.731 1.000 0.000 0.000 0.000
#> GSM531657     4  0.6096      0.513 0.048 0.264 0.020 0.668
#> GSM531665     2  0.8720      0.324 0.100 0.464 0.312 0.124
#> GSM531670     1  0.5498      0.563 0.680 0.000 0.272 0.048
#> GSM531674     1  0.3217      0.685 0.860 0.128 0.000 0.012
#> GSM531675     2  0.4406      0.415 0.000 0.700 0.000 0.300
#> GSM531677     2  0.3791      0.519 0.004 0.796 0.000 0.200
#> GSM531678     2  0.4072      0.578 0.000 0.828 0.052 0.120
#> GSM531680     1  0.6955      0.248 0.476 0.424 0.004 0.096
#> GSM531689     2  0.8203      0.246 0.268 0.508 0.184 0.040
#> GSM531691     2  0.8128      0.268 0.256 0.516 0.192 0.036
#> GSM531692     2  0.7647      0.190 0.220 0.444 0.336 0.000
#> GSM531694     2  0.2921      0.560 0.000 0.860 0.000 0.140

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>           class entropy silhouette    p1    p2    p3    p4    p5
#> GSM531602     2  0.0794     0.7042 0.000 0.972 0.000 0.000 0.028
#> GSM531604     2  0.5246     0.2398 0.000 0.596 0.060 0.000 0.344
#> GSM531606     2  0.2305     0.6810 0.000 0.896 0.012 0.000 0.092
#> GSM531607     2  0.4650     0.4822 0.004 0.684 0.000 0.280 0.032
#> GSM531608     3  0.6184     0.4560 0.000 0.208 0.620 0.024 0.148
#> GSM531610     4  0.2153     0.7019 0.000 0.044 0.000 0.916 0.040
#> GSM531612     4  0.0162     0.7129 0.000 0.000 0.000 0.996 0.004
#> GSM531613     4  0.2153     0.7019 0.000 0.044 0.000 0.916 0.040
#> GSM531614     4  0.2074     0.7036 0.000 0.044 0.000 0.920 0.036
#> GSM531616     1  0.4557     0.4042 0.584 0.000 0.404 0.000 0.012
#> GSM531618     4  0.6435     0.6172 0.116 0.088 0.032 0.684 0.080
#> GSM531619     3  0.0000     0.8736 0.000 0.000 1.000 0.000 0.000
#> GSM531620     3  0.1408     0.8617 0.044 0.000 0.948 0.000 0.008
#> GSM531623     3  0.0451     0.8745 0.008 0.000 0.988 0.000 0.004
#> GSM531625     3  0.1956     0.8377 0.076 0.000 0.916 0.000 0.008
#> GSM531626     3  0.2017     0.8348 0.080 0.000 0.912 0.000 0.008
#> GSM531632     1  0.0609     0.7362 0.980 0.000 0.000 0.000 0.020
#> GSM531638     1  0.4557     0.4042 0.584 0.000 0.404 0.000 0.012
#> GSM531639     1  0.5053     0.5936 0.656 0.000 0.296 0.032 0.016
#> GSM531641     4  0.0162     0.7129 0.000 0.000 0.000 0.996 0.004
#> GSM531642     4  0.7643     0.0342 0.332 0.000 0.200 0.404 0.064
#> GSM531643     1  0.2482     0.7279 0.904 0.000 0.016 0.064 0.016
#> GSM531644     1  0.5932    -0.0684 0.488 0.000 0.016 0.432 0.064
#> GSM531645     4  0.0162     0.7129 0.000 0.000 0.000 0.996 0.004
#> GSM531646     1  0.1386     0.7380 0.952 0.000 0.032 0.000 0.016
#> GSM531647     1  0.0404     0.7373 0.988 0.000 0.000 0.000 0.012
#> GSM531648     4  0.5750     0.4861 0.260 0.000 0.028 0.640 0.072
#> GSM531650     1  0.2104     0.7254 0.916 0.000 0.000 0.060 0.024
#> GSM531651     3  0.0451     0.8745 0.008 0.000 0.988 0.000 0.004
#> GSM531652     4  0.5750     0.4861 0.260 0.000 0.028 0.640 0.072
#> GSM531656     1  0.4903     0.6229 0.680 0.000 0.272 0.036 0.012
#> GSM531659     2  0.8324     0.1416 0.016 0.360 0.084 0.320 0.220
#> GSM531661     3  0.5504     0.5765 0.000 0.140 0.700 0.024 0.136
#> GSM531662     5  0.7429     0.2211 0.000 0.308 0.276 0.032 0.384
#> GSM531663     4  0.6469     0.4412 0.000 0.208 0.068 0.620 0.104
#> GSM531664     1  0.2104     0.7254 0.916 0.000 0.000 0.060 0.024
#> GSM531666     4  0.6123     0.1677 0.412 0.000 0.024 0.496 0.068
#> GSM531667     3  0.6601     0.4404 0.004 0.204 0.604 0.040 0.148
#> GSM531668     4  0.5115     0.6266 0.012 0.152 0.008 0.736 0.092
#> GSM531669     1  0.3561     0.4707 0.740 0.000 0.000 0.000 0.260
#> GSM531671     5  0.7649     0.2271 0.008 0.304 0.268 0.032 0.388
#> GSM531672     4  0.3961     0.6255 0.004 0.184 0.000 0.780 0.032
#> GSM531673     5  0.7429     0.2211 0.000 0.308 0.276 0.032 0.384
#> GSM531676     5  0.4378     0.5619 0.012 0.156 0.048 0.004 0.780
#> GSM531679     2  0.3442     0.6925 0.000 0.836 0.000 0.060 0.104
#> GSM531681     4  0.4946     0.3374 0.000 0.368 0.000 0.596 0.036
#> GSM531682     2  0.3151     0.7029 0.000 0.864 0.004 0.068 0.064
#> GSM531683     2  0.1281     0.7083 0.000 0.956 0.000 0.012 0.032
#> GSM531684     2  0.2727     0.6615 0.000 0.868 0.016 0.000 0.116
#> GSM531685     5  0.4458     0.5524 0.192 0.056 0.004 0.000 0.748
#> GSM531686     4  0.4969     0.3193 0.000 0.376 0.000 0.588 0.036
#> GSM531687     5  0.4378     0.5619 0.012 0.156 0.048 0.004 0.780
#> GSM531688     5  0.5371     0.2735 0.420 0.056 0.000 0.000 0.524
#> GSM531690     2  0.3642     0.5743 0.000 0.760 0.000 0.232 0.008
#> GSM531693     5  0.5351     0.3904 0.348 0.056 0.004 0.000 0.592
#> GSM531695     5  0.6480     0.4713 0.260 0.116 0.000 0.040 0.584
#> GSM531603     2  0.4650     0.4822 0.004 0.684 0.000 0.280 0.032
#> GSM531609     4  0.2074     0.7036 0.000 0.044 0.000 0.920 0.036
#> GSM531611     4  0.1571     0.7038 0.000 0.060 0.004 0.936 0.000
#> GSM531621     3  0.0898     0.8723 0.020 0.000 0.972 0.000 0.008
#> GSM531622     3  0.0000     0.8736 0.000 0.000 1.000 0.000 0.000
#> GSM531628     1  0.2104     0.7254 0.916 0.000 0.000 0.060 0.024
#> GSM531630     3  0.0000     0.8736 0.000 0.000 1.000 0.000 0.000
#> GSM531633     3  0.0898     0.8723 0.020 0.000 0.972 0.000 0.008
#> GSM531635     1  0.3807     0.6450 0.748 0.000 0.240 0.000 0.012
#> GSM531640     3  0.0000     0.8736 0.000 0.000 1.000 0.000 0.000
#> GSM531649     1  0.0404     0.7373 0.988 0.000 0.000 0.000 0.012
#> GSM531653     1  0.0404     0.7373 0.988 0.000 0.000 0.000 0.012
#> GSM531657     4  0.6697     0.3736 0.032 0.308 0.020 0.560 0.080
#> GSM531665     2  0.7818    -0.1172 0.008 0.392 0.204 0.056 0.340
#> GSM531670     1  0.4903     0.6229 0.680 0.000 0.272 0.036 0.012
#> GSM531674     1  0.3561     0.4707 0.740 0.000 0.000 0.000 0.260
#> GSM531675     2  0.3013     0.6654 0.000 0.832 0.000 0.160 0.008
#> GSM531677     2  0.3442     0.6925 0.000 0.836 0.000 0.060 0.104
#> GSM531678     2  0.2361     0.6788 0.000 0.892 0.012 0.000 0.096
#> GSM531680     5  0.6460     0.4757 0.256 0.116 0.000 0.040 0.588
#> GSM531689     5  0.4378     0.5619 0.012 0.156 0.048 0.004 0.780
#> GSM531691     5  0.4628     0.5516 0.012 0.168 0.056 0.004 0.760
#> GSM531692     5  0.5820     0.4699 0.012 0.172 0.168 0.000 0.648
#> GSM531694     2  0.0794     0.7042 0.000 0.972 0.000 0.000 0.028

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>           class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM531602     2  0.0363      0.754 0.000 0.988 0.000 0.000 0.012 0.000
#> GSM531604     2  0.4395      0.308 0.000 0.580 0.008 0.000 0.396 0.016
#> GSM531606     2  0.2009      0.733 0.000 0.904 0.004 0.000 0.084 0.008
#> GSM531607     2  0.4787      0.496 0.000 0.672 0.000 0.220 0.004 0.104
#> GSM531608     3  0.6648      0.375 0.000 0.108 0.532 0.000 0.200 0.160
#> GSM531610     4  0.3171      0.589 0.000 0.012 0.000 0.784 0.000 0.204
#> GSM531612     4  0.0146      0.510 0.000 0.000 0.000 0.996 0.000 0.004
#> GSM531613     4  0.3230      0.589 0.000 0.012 0.000 0.776 0.000 0.212
#> GSM531614     4  0.3141      0.589 0.000 0.012 0.000 0.788 0.000 0.200
#> GSM531616     1  0.4435      0.393 0.580 0.000 0.392 0.000 0.004 0.024
#> GSM531618     6  0.6297      0.543 0.068 0.052 0.008 0.364 0.008 0.500
#> GSM531619     3  0.0632      0.854 0.000 0.000 0.976 0.000 0.000 0.024
#> GSM531620     3  0.1152      0.846 0.044 0.000 0.952 0.000 0.004 0.000
#> GSM531623     3  0.0436      0.857 0.004 0.000 0.988 0.000 0.004 0.004
#> GSM531625     3  0.1788      0.822 0.076 0.000 0.916 0.000 0.004 0.004
#> GSM531626     3  0.1843      0.819 0.080 0.000 0.912 0.000 0.004 0.004
#> GSM531632     1  0.0405      0.684 0.988 0.000 0.000 0.000 0.008 0.004
#> GSM531638     1  0.4435      0.393 0.580 0.000 0.392 0.000 0.004 0.024
#> GSM531639     1  0.5534      0.520 0.608 0.000 0.284 0.032 0.008 0.068
#> GSM531641     4  0.0146      0.510 0.000 0.000 0.000 0.996 0.000 0.004
#> GSM531642     4  0.7762     -0.553 0.272 0.000 0.176 0.288 0.004 0.260
#> GSM531643     1  0.3029      0.624 0.840 0.000 0.000 0.036 0.004 0.120
#> GSM531644     1  0.6049     -0.473 0.416 0.000 0.000 0.292 0.000 0.292
#> GSM531645     4  0.0146      0.510 0.000 0.000 0.000 0.996 0.000 0.004
#> GSM531646     1  0.1194      0.684 0.956 0.000 0.032 0.000 0.004 0.008
#> GSM531647     1  0.0146      0.686 0.996 0.000 0.000 0.000 0.000 0.004
#> GSM531648     6  0.5736      0.694 0.188 0.000 0.000 0.320 0.000 0.492
#> GSM531650     1  0.2882      0.634 0.860 0.000 0.000 0.060 0.004 0.076
#> GSM531651     3  0.0291      0.857 0.004 0.000 0.992 0.000 0.004 0.000
#> GSM531652     6  0.5736      0.694 0.188 0.000 0.000 0.320 0.000 0.492
#> GSM531656     1  0.5443      0.539 0.628 0.000 0.256 0.032 0.004 0.080
#> GSM531659     2  0.8382      0.020 0.004 0.268 0.032 0.236 0.236 0.224
#> GSM531661     3  0.5930      0.494 0.000 0.080 0.616 0.000 0.192 0.112
#> GSM531662     5  0.7384      0.353 0.004 0.188 0.160 0.000 0.432 0.216
#> GSM531663     4  0.6987      0.415 0.000 0.156 0.012 0.524 0.124 0.184
#> GSM531664     1  0.2882      0.634 0.860 0.000 0.000 0.060 0.004 0.076
#> GSM531666     6  0.6219      0.489 0.340 0.000 0.000 0.284 0.004 0.372
#> GSM531667     3  0.7126      0.362 0.004 0.108 0.520 0.016 0.200 0.152
#> GSM531668     6  0.5437      0.120 0.000 0.092 0.000 0.416 0.008 0.484
#> GSM531669     1  0.4094      0.482 0.744 0.000 0.000 0.000 0.168 0.088
#> GSM531671     5  0.7591      0.359 0.016 0.184 0.160 0.000 0.432 0.208
#> GSM531672     4  0.4402      0.259 0.000 0.184 0.000 0.712 0.000 0.104
#> GSM531673     5  0.7384      0.353 0.004 0.188 0.160 0.000 0.432 0.216
#> GSM531676     5  0.1267      0.579 0.000 0.060 0.000 0.000 0.940 0.000
#> GSM531679     2  0.3727      0.729 0.000 0.784 0.000 0.000 0.128 0.088
#> GSM531681     4  0.5940      0.302 0.000 0.336 0.000 0.464 0.004 0.196
#> GSM531682     2  0.3528      0.740 0.000 0.816 0.000 0.008 0.084 0.092
#> GSM531683     2  0.0964      0.757 0.000 0.968 0.000 0.004 0.016 0.012
#> GSM531684     2  0.2473      0.716 0.000 0.876 0.008 0.000 0.104 0.012
#> GSM531685     5  0.4141      0.511 0.168 0.000 0.000 0.000 0.740 0.092
#> GSM531686     4  0.5953      0.284 0.000 0.344 0.000 0.456 0.004 0.196
#> GSM531687     5  0.1267      0.579 0.000 0.060 0.000 0.000 0.940 0.000
#> GSM531688     5  0.5146      0.228 0.396 0.000 0.000 0.000 0.516 0.088
#> GSM531690     2  0.4374      0.598 0.000 0.732 0.000 0.172 0.008 0.088
#> GSM531693     5  0.5016      0.344 0.324 0.000 0.000 0.000 0.584 0.092
#> GSM531695     5  0.6597      0.415 0.244 0.056 0.000 0.028 0.556 0.116
#> GSM531603     2  0.4787      0.496 0.000 0.672 0.000 0.220 0.004 0.104
#> GSM531609     4  0.3141      0.589 0.000 0.012 0.000 0.788 0.000 0.200
#> GSM531611     4  0.1524      0.513 0.000 0.060 0.000 0.932 0.000 0.008
#> GSM531621     3  0.0692      0.855 0.020 0.000 0.976 0.000 0.004 0.000
#> GSM531622     3  0.0547      0.856 0.000 0.000 0.980 0.000 0.000 0.020
#> GSM531628     1  0.2882      0.634 0.860 0.000 0.000 0.060 0.004 0.076
#> GSM531630     3  0.0547      0.856 0.000 0.000 0.980 0.000 0.000 0.020
#> GSM531633     3  0.0692      0.855 0.020 0.000 0.976 0.000 0.004 0.000
#> GSM531635     1  0.3622      0.583 0.744 0.000 0.236 0.000 0.004 0.016
#> GSM531640     3  0.0547      0.856 0.000 0.000 0.980 0.000 0.000 0.020
#> GSM531649     1  0.0146      0.686 0.996 0.000 0.000 0.000 0.000 0.004
#> GSM531653     1  0.0146      0.686 0.996 0.000 0.000 0.000 0.000 0.004
#> GSM531657     4  0.6716     -0.170 0.004 0.260 0.008 0.440 0.020 0.268
#> GSM531665     5  0.7917      0.182 0.012 0.276 0.112 0.024 0.396 0.180
#> GSM531670     1  0.5443      0.539 0.628 0.000 0.256 0.032 0.004 0.080
#> GSM531674     1  0.4094      0.482 0.744 0.000 0.000 0.000 0.168 0.088
#> GSM531675     2  0.3673      0.684 0.000 0.804 0.000 0.100 0.008 0.088
#> GSM531677     2  0.3727      0.729 0.000 0.784 0.000 0.000 0.128 0.088
#> GSM531678     2  0.2062      0.731 0.000 0.900 0.004 0.000 0.088 0.008
#> GSM531680     5  0.6578      0.420 0.240 0.056 0.000 0.028 0.560 0.116
#> GSM531689     5  0.1267      0.579 0.000 0.060 0.000 0.000 0.940 0.000
#> GSM531691     5  0.1845      0.571 0.000 0.072 0.004 0.000 0.916 0.008
#> GSM531692     5  0.4906      0.506 0.004 0.096 0.052 0.000 0.732 0.116
#> GSM531694     2  0.0363      0.754 0.000 0.988 0.000 0.000 0.012 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-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 disease.state(p) k
#> MAD:hclust 66            0.631 2
#> MAD:hclust 42            0.562 3
#> MAD:hclust 53            0.676 4
#> MAD:hclust 52            0.783 5
#> MAD:hclust 52            0.692 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 51941 rows and 80 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 0.703           0.922       0.962         0.5028 0.499   0.499
#> 3 3 0.554           0.683       0.777         0.3089 0.795   0.609
#> 4 4 0.870           0.891       0.942         0.1465 0.829   0.550
#> 5 5 0.739           0.721       0.833         0.0599 0.928   0.722
#> 6 6 0.718           0.577       0.760         0.0410 0.947   0.753

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
#> GSM531602     2  0.0000      0.965 0.000 1.000
#> GSM531604     2  0.0376      0.963 0.004 0.996
#> GSM531606     2  0.0000      0.965 0.000 1.000
#> GSM531607     2  0.0000      0.965 0.000 1.000
#> GSM531608     1  0.9460      0.507 0.636 0.364
#> GSM531610     2  0.0000      0.965 0.000 1.000
#> GSM531612     2  0.0000      0.965 0.000 1.000
#> GSM531613     2  0.0000      0.965 0.000 1.000
#> GSM531614     2  0.0000      0.965 0.000 1.000
#> GSM531616     1  0.0000      0.952 1.000 0.000
#> GSM531618     1  0.7528      0.748 0.784 0.216
#> GSM531619     1  0.6531      0.808 0.832 0.168
#> GSM531620     1  0.0000      0.952 1.000 0.000
#> GSM531623     1  0.0000      0.952 1.000 0.000
#> GSM531625     1  0.0000      0.952 1.000 0.000
#> GSM531626     1  0.0000      0.952 1.000 0.000
#> GSM531632     1  0.0000      0.952 1.000 0.000
#> GSM531638     1  0.0000      0.952 1.000 0.000
#> GSM531639     1  0.0000      0.952 1.000 0.000
#> GSM531641     2  0.0000      0.965 0.000 1.000
#> GSM531642     1  0.0000      0.952 1.000 0.000
#> GSM531643     1  0.0000      0.952 1.000 0.000
#> GSM531644     1  0.0000      0.952 1.000 0.000
#> GSM531645     2  0.0000      0.965 0.000 1.000
#> GSM531646     1  0.0000      0.952 1.000 0.000
#> GSM531647     1  0.0000      0.952 1.000 0.000
#> GSM531648     2  0.6438      0.791 0.164 0.836
#> GSM531650     1  0.0000      0.952 1.000 0.000
#> GSM531651     1  0.0000      0.952 1.000 0.000
#> GSM531652     1  0.0000      0.952 1.000 0.000
#> GSM531656     1  0.0000      0.952 1.000 0.000
#> GSM531659     2  0.0000      0.965 0.000 1.000
#> GSM531661     1  0.5842      0.838 0.860 0.140
#> GSM531662     1  0.0000      0.952 1.000 0.000
#> GSM531663     2  0.0000      0.965 0.000 1.000
#> GSM531664     1  0.0000      0.952 1.000 0.000
#> GSM531666     1  0.0000      0.952 1.000 0.000
#> GSM531667     1  0.6973      0.784 0.812 0.188
#> GSM531668     2  0.0000      0.965 0.000 1.000
#> GSM531669     1  0.0000      0.952 1.000 0.000
#> GSM531671     1  0.0000      0.952 1.000 0.000
#> GSM531672     2  0.0000      0.965 0.000 1.000
#> GSM531673     1  0.5178      0.860 0.884 0.116
#> GSM531676     2  0.7376      0.755 0.208 0.792
#> GSM531679     2  0.0000      0.965 0.000 1.000
#> GSM531681     2  0.0000      0.965 0.000 1.000
#> GSM531682     2  0.0000      0.965 0.000 1.000
#> GSM531683     2  0.0000      0.965 0.000 1.000
#> GSM531684     2  0.0000      0.965 0.000 1.000
#> GSM531685     1  0.6438      0.808 0.836 0.164
#> GSM531686     2  0.0000      0.965 0.000 1.000
#> GSM531687     2  0.7219      0.766 0.200 0.800
#> GSM531688     1  0.6343      0.813 0.840 0.160
#> GSM531690     2  0.0000      0.965 0.000 1.000
#> GSM531693     1  0.0000      0.952 1.000 0.000
#> GSM531695     2  0.7219      0.766 0.200 0.800
#> GSM531603     2  0.0000      0.965 0.000 1.000
#> GSM531609     2  0.0000      0.965 0.000 1.000
#> GSM531611     2  0.0000      0.965 0.000 1.000
#> GSM531621     1  0.0000      0.952 1.000 0.000
#> GSM531622     1  0.0000      0.952 1.000 0.000
#> GSM531628     1  0.0000      0.952 1.000 0.000
#> GSM531630     1  0.0000      0.952 1.000 0.000
#> GSM531633     1  0.0000      0.952 1.000 0.000
#> GSM531635     1  0.0000      0.952 1.000 0.000
#> GSM531640     1  0.6531      0.808 0.832 0.168
#> GSM531649     1  0.0000      0.952 1.000 0.000
#> GSM531653     1  0.0000      0.952 1.000 0.000
#> GSM531657     2  0.0000      0.965 0.000 1.000
#> GSM531665     1  0.3879      0.897 0.924 0.076
#> GSM531670     1  0.0000      0.952 1.000 0.000
#> GSM531674     1  0.0000      0.952 1.000 0.000
#> GSM531675     2  0.0000      0.965 0.000 1.000
#> GSM531677     2  0.0000      0.965 0.000 1.000
#> GSM531678     2  0.0000      0.965 0.000 1.000
#> GSM531680     2  0.7219      0.766 0.200 0.800
#> GSM531689     2  0.0376      0.963 0.004 0.996
#> GSM531691     2  0.5737      0.842 0.136 0.864
#> GSM531692     1  0.6438      0.808 0.836 0.164
#> GSM531694     2  0.0000      0.965 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
#> GSM531602     2  0.0237      0.745 0.000 0.996 0.004
#> GSM531604     2  0.2878      0.686 0.000 0.904 0.096
#> GSM531606     2  0.0892      0.738 0.000 0.980 0.020
#> GSM531607     2  0.0237      0.745 0.000 0.996 0.004
#> GSM531608     3  0.8005      0.747 0.224 0.128 0.648
#> GSM531610     2  0.6282      0.745 0.004 0.612 0.384
#> GSM531612     2  0.7099      0.735 0.028 0.588 0.384
#> GSM531613     2  0.6228      0.748 0.004 0.624 0.372
#> GSM531614     2  0.7099      0.735 0.028 0.588 0.384
#> GSM531616     3  0.6126      0.848 0.400 0.000 0.600
#> GSM531618     2  0.9419      0.496 0.192 0.480 0.328
#> GSM531619     3  0.7084      0.842 0.336 0.036 0.628
#> GSM531620     3  0.6095      0.853 0.392 0.000 0.608
#> GSM531623     3  0.6079      0.856 0.388 0.000 0.612
#> GSM531625     3  0.6126      0.848 0.400 0.000 0.600
#> GSM531626     3  0.6126      0.848 0.400 0.000 0.600
#> GSM531632     1  0.1163      0.742 0.972 0.000 0.028
#> GSM531638     3  0.6126      0.848 0.400 0.000 0.600
#> GSM531639     1  0.4399      0.451 0.812 0.000 0.188
#> GSM531641     2  0.7099      0.735 0.028 0.588 0.384
#> GSM531642     1  0.5254      0.571 0.736 0.000 0.264
#> GSM531643     1  0.1411      0.758 0.964 0.000 0.036
#> GSM531644     1  0.3752      0.690 0.856 0.000 0.144
#> GSM531645     2  0.7207      0.732 0.032 0.584 0.384
#> GSM531646     1  0.1163      0.742 0.972 0.000 0.028
#> GSM531647     1  0.0237      0.756 0.996 0.000 0.004
#> GSM531648     2  0.7311      0.730 0.036 0.580 0.384
#> GSM531650     1  0.1411      0.758 0.964 0.000 0.036
#> GSM531651     3  0.6079      0.856 0.388 0.000 0.612
#> GSM531652     1  0.4291      0.671 0.820 0.000 0.180
#> GSM531656     1  0.1529      0.729 0.960 0.000 0.040
#> GSM531659     2  0.6282      0.745 0.004 0.612 0.384
#> GSM531661     3  0.8266      0.750 0.240 0.136 0.624
#> GSM531662     3  0.8331      0.713 0.208 0.164 0.628
#> GSM531663     2  0.6282      0.745 0.004 0.612 0.384
#> GSM531664     1  0.1529      0.757 0.960 0.000 0.040
#> GSM531666     1  0.3879      0.683 0.848 0.000 0.152
#> GSM531667     3  0.7084      0.842 0.336 0.036 0.628
#> GSM531668     2  0.6282      0.745 0.004 0.612 0.384
#> GSM531669     1  0.0237      0.758 0.996 0.000 0.004
#> GSM531671     1  0.6483     -0.529 0.544 0.004 0.452
#> GSM531672     2  0.6228      0.748 0.004 0.624 0.372
#> GSM531673     3  0.8578      0.638 0.172 0.224 0.604
#> GSM531676     2  0.7063     -0.206 0.464 0.516 0.020
#> GSM531679     2  0.1031      0.737 0.000 0.976 0.024
#> GSM531681     2  0.4399      0.763 0.000 0.812 0.188
#> GSM531682     2  0.1031      0.737 0.000 0.976 0.024
#> GSM531683     2  0.0000      0.746 0.000 1.000 0.000
#> GSM531684     2  0.4504      0.568 0.000 0.804 0.196
#> GSM531685     1  0.6899      0.478 0.612 0.364 0.024
#> GSM531686     2  0.4399      0.763 0.000 0.812 0.188
#> GSM531687     2  0.7063     -0.206 0.464 0.516 0.020
#> GSM531688     1  0.6553      0.518 0.656 0.324 0.020
#> GSM531690     2  0.4399      0.763 0.000 0.812 0.188
#> GSM531693     1  0.1315      0.754 0.972 0.008 0.020
#> GSM531695     1  0.6543      0.503 0.640 0.344 0.016
#> GSM531603     2  0.0237      0.745 0.000 0.996 0.004
#> GSM531609     2  0.7099      0.735 0.028 0.588 0.384
#> GSM531611     2  0.7067      0.738 0.028 0.596 0.376
#> GSM531621     3  0.6079      0.856 0.388 0.000 0.612
#> GSM531622     3  0.6008      0.854 0.372 0.000 0.628
#> GSM531628     1  0.1411      0.758 0.964 0.000 0.036
#> GSM531630     3  0.6026      0.855 0.376 0.000 0.624
#> GSM531633     3  0.6079      0.856 0.388 0.000 0.612
#> GSM531635     1  0.1163      0.742 0.972 0.000 0.028
#> GSM531640     3  0.6057      0.832 0.340 0.004 0.656
#> GSM531649     1  0.1163      0.742 0.972 0.000 0.028
#> GSM531653     1  0.0237      0.756 0.996 0.000 0.004
#> GSM531657     2  0.6282      0.745 0.004 0.612 0.384
#> GSM531665     1  0.7394      0.447 0.652 0.284 0.064
#> GSM531670     1  0.1643      0.727 0.956 0.000 0.044
#> GSM531674     1  0.0237      0.758 0.996 0.000 0.004
#> GSM531675     2  0.3686      0.761 0.000 0.860 0.140
#> GSM531677     2  0.0237      0.745 0.000 0.996 0.004
#> GSM531678     2  0.1031      0.737 0.000 0.976 0.024
#> GSM531680     1  0.6931      0.289 0.528 0.456 0.016
#> GSM531689     2  0.2313      0.715 0.032 0.944 0.024
#> GSM531691     2  0.3742      0.678 0.036 0.892 0.072
#> GSM531692     3  0.8482      0.289 0.092 0.408 0.500
#> GSM531694     2  0.0237      0.745 0.000 0.996 0.004

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM531602     2  0.1209      0.917 0.000 0.964 0.004 0.032
#> GSM531604     2  0.0927      0.922 0.000 0.976 0.016 0.008
#> GSM531606     2  0.1059      0.923 0.000 0.972 0.016 0.012
#> GSM531607     2  0.1209      0.917 0.000 0.964 0.004 0.032
#> GSM531608     3  0.0000      0.949 0.000 0.000 1.000 0.000
#> GSM531610     4  0.0000      0.928 0.000 0.000 0.000 1.000
#> GSM531612     4  0.0000      0.928 0.000 0.000 0.000 1.000
#> GSM531613     4  0.0000      0.928 0.000 0.000 0.000 1.000
#> GSM531614     4  0.0000      0.928 0.000 0.000 0.000 1.000
#> GSM531616     3  0.0927      0.957 0.016 0.008 0.976 0.000
#> GSM531618     4  0.3997      0.732 0.012 0.008 0.164 0.816
#> GSM531619     3  0.0336      0.954 0.008 0.000 0.992 0.000
#> GSM531620     3  0.0927      0.957 0.016 0.008 0.976 0.000
#> GSM531623     3  0.0592      0.958 0.016 0.000 0.984 0.000
#> GSM531625     3  0.0927      0.957 0.016 0.008 0.976 0.000
#> GSM531626     3  0.0927      0.957 0.016 0.008 0.976 0.000
#> GSM531632     1  0.0188      0.955 0.996 0.000 0.004 0.000
#> GSM531638     3  0.0927      0.957 0.016 0.008 0.976 0.000
#> GSM531639     1  0.4158      0.736 0.768 0.008 0.224 0.000
#> GSM531641     4  0.0000      0.928 0.000 0.000 0.000 1.000
#> GSM531642     1  0.4175      0.774 0.792 0.008 0.192 0.008
#> GSM531643     1  0.0188      0.955 0.996 0.000 0.004 0.000
#> GSM531644     1  0.0188      0.953 0.996 0.000 0.000 0.004
#> GSM531645     4  0.0000      0.928 0.000 0.000 0.000 1.000
#> GSM531646     1  0.0188      0.955 0.996 0.000 0.004 0.000
#> GSM531647     1  0.0188      0.955 0.996 0.000 0.004 0.000
#> GSM531648     4  0.0000      0.928 0.000 0.000 0.000 1.000
#> GSM531650     1  0.0188      0.955 0.996 0.000 0.004 0.000
#> GSM531651     3  0.0592      0.958 0.016 0.000 0.984 0.000
#> GSM531652     1  0.1878      0.924 0.944 0.008 0.008 0.040
#> GSM531656     1  0.3545      0.815 0.828 0.008 0.164 0.000
#> GSM531659     4  0.0469      0.924 0.000 0.012 0.000 0.988
#> GSM531661     3  0.0000      0.949 0.000 0.000 1.000 0.000
#> GSM531662     3  0.3726      0.699 0.000 0.212 0.788 0.000
#> GSM531663     4  0.0000      0.928 0.000 0.000 0.000 1.000
#> GSM531664     1  0.0188      0.955 0.996 0.000 0.004 0.000
#> GSM531666     1  0.0524      0.952 0.988 0.008 0.000 0.004
#> GSM531667     3  0.0469      0.957 0.012 0.000 0.988 0.000
#> GSM531668     4  0.0524      0.924 0.000 0.008 0.004 0.988
#> GSM531669     1  0.0188      0.955 0.996 0.000 0.004 0.000
#> GSM531671     3  0.6242      0.473 0.308 0.080 0.612 0.000
#> GSM531672     4  0.0188      0.927 0.000 0.004 0.000 0.996
#> GSM531673     2  0.4040      0.658 0.000 0.752 0.248 0.000
#> GSM531676     2  0.1767      0.907 0.044 0.944 0.012 0.000
#> GSM531679     2  0.0524      0.922 0.004 0.988 0.000 0.008
#> GSM531681     4  0.4560      0.603 0.004 0.296 0.000 0.700
#> GSM531682     2  0.0859      0.923 0.004 0.980 0.008 0.008
#> GSM531683     2  0.1209      0.917 0.000 0.964 0.004 0.032
#> GSM531684     2  0.0817      0.920 0.000 0.976 0.024 0.000
#> GSM531685     2  0.3808      0.800 0.176 0.812 0.012 0.000
#> GSM531686     4  0.4608      0.592 0.004 0.304 0.000 0.692
#> GSM531687     2  0.2329      0.889 0.072 0.916 0.012 0.000
#> GSM531688     1  0.0524      0.945 0.988 0.004 0.008 0.000
#> GSM531690     4  0.4608      0.592 0.004 0.304 0.000 0.692
#> GSM531693     1  0.0524      0.945 0.988 0.004 0.008 0.000
#> GSM531695     1  0.0592      0.942 0.984 0.016 0.000 0.000
#> GSM531603     2  0.1209      0.917 0.000 0.964 0.004 0.032
#> GSM531609     4  0.0000      0.928 0.000 0.000 0.000 1.000
#> GSM531611     4  0.0000      0.928 0.000 0.000 0.000 1.000
#> GSM531621     3  0.0592      0.958 0.016 0.000 0.984 0.000
#> GSM531622     3  0.0592      0.958 0.016 0.000 0.984 0.000
#> GSM531628     1  0.0188      0.955 0.996 0.000 0.004 0.000
#> GSM531630     3  0.0592      0.958 0.016 0.000 0.984 0.000
#> GSM531633     3  0.0592      0.958 0.016 0.000 0.984 0.000
#> GSM531635     1  0.0524      0.952 0.988 0.008 0.004 0.000
#> GSM531640     3  0.0592      0.958 0.016 0.000 0.984 0.000
#> GSM531649     1  0.0524      0.952 0.988 0.008 0.004 0.000
#> GSM531653     1  0.0188      0.955 0.996 0.000 0.004 0.000
#> GSM531657     4  0.0469      0.924 0.000 0.012 0.000 0.988
#> GSM531665     2  0.3323      0.861 0.064 0.876 0.060 0.000
#> GSM531670     1  0.3498      0.820 0.832 0.008 0.160 0.000
#> GSM531674     1  0.0188      0.955 0.996 0.000 0.004 0.000
#> GSM531675     2  0.4800      0.453 0.004 0.656 0.000 0.340
#> GSM531677     2  0.1209      0.916 0.004 0.964 0.000 0.032
#> GSM531678     2  0.0804      0.923 0.000 0.980 0.012 0.008
#> GSM531680     2  0.3975      0.725 0.240 0.760 0.000 0.000
#> GSM531689     2  0.0992      0.923 0.004 0.976 0.012 0.008
#> GSM531691     2  0.0992      0.923 0.004 0.976 0.012 0.008
#> GSM531692     2  0.0657      0.920 0.004 0.984 0.012 0.000
#> GSM531694     2  0.1209      0.917 0.000 0.964 0.004 0.032

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>           class entropy silhouette    p1    p2    p3    p4    p5
#> GSM531602     2  0.0992     0.6788 0.000 0.968 0.000 0.008 0.024
#> GSM531604     2  0.4300    -0.2610 0.000 0.524 0.000 0.000 0.476
#> GSM531606     2  0.2929     0.5471 0.000 0.820 0.000 0.000 0.180
#> GSM531607     2  0.1082     0.6786 0.000 0.964 0.000 0.008 0.028
#> GSM531608     3  0.1671     0.9004 0.000 0.000 0.924 0.000 0.076
#> GSM531610     4  0.0404     0.8973 0.000 0.012 0.000 0.988 0.000
#> GSM531612     4  0.0162     0.8993 0.000 0.000 0.000 0.996 0.004
#> GSM531613     4  0.0404     0.8973 0.000 0.012 0.000 0.988 0.000
#> GSM531614     4  0.0000     0.8998 0.000 0.000 0.000 1.000 0.000
#> GSM531616     3  0.1597     0.9249 0.012 0.000 0.940 0.000 0.048
#> GSM531618     4  0.6332     0.6289 0.044 0.000 0.128 0.624 0.204
#> GSM531619     3  0.0566     0.9460 0.004 0.000 0.984 0.000 0.012
#> GSM531620     3  0.0865     0.9428 0.004 0.000 0.972 0.000 0.024
#> GSM531623     3  0.0162     0.9473 0.004 0.000 0.996 0.000 0.000
#> GSM531625     3  0.0865     0.9425 0.004 0.000 0.972 0.000 0.024
#> GSM531626     3  0.1124     0.9375 0.004 0.000 0.960 0.000 0.036
#> GSM531632     1  0.1851     0.8131 0.912 0.000 0.000 0.000 0.088
#> GSM531638     3  0.1357     0.9306 0.004 0.000 0.948 0.000 0.048
#> GSM531639     1  0.5725     0.6379 0.624 0.000 0.204 0.000 0.172
#> GSM531641     4  0.0162     0.8993 0.000 0.000 0.000 0.996 0.004
#> GSM531642     1  0.6012     0.6642 0.644 0.004 0.144 0.016 0.192
#> GSM531643     1  0.2389     0.8015 0.880 0.004 0.000 0.000 0.116
#> GSM531644     1  0.3511     0.7717 0.800 0.004 0.000 0.012 0.184
#> GSM531645     4  0.0162     0.8993 0.000 0.000 0.000 0.996 0.004
#> GSM531646     1  0.1544     0.8194 0.932 0.000 0.000 0.000 0.068
#> GSM531647     1  0.1270     0.8215 0.948 0.000 0.000 0.000 0.052
#> GSM531648     4  0.2929     0.8294 0.008 0.000 0.000 0.840 0.152
#> GSM531650     1  0.0324     0.8238 0.992 0.004 0.000 0.000 0.004
#> GSM531651     3  0.0162     0.9473 0.004 0.000 0.996 0.000 0.000
#> GSM531652     1  0.4056     0.7584 0.772 0.004 0.004 0.024 0.196
#> GSM531656     1  0.4840     0.7178 0.724 0.000 0.152 0.000 0.124
#> GSM531659     4  0.4610     0.7972 0.000 0.128 0.004 0.756 0.112
#> GSM531661     3  0.1671     0.9004 0.000 0.000 0.924 0.000 0.076
#> GSM531662     3  0.5168     0.2797 0.000 0.052 0.592 0.000 0.356
#> GSM531663     4  0.0510     0.8961 0.000 0.016 0.000 0.984 0.000
#> GSM531664     1  0.0324     0.8238 0.992 0.004 0.000 0.000 0.004
#> GSM531666     1  0.3808     0.7635 0.780 0.004 0.004 0.012 0.200
#> GSM531667     3  0.0451     0.9458 0.004 0.000 0.988 0.000 0.008
#> GSM531668     4  0.5159     0.7459 0.000 0.180 0.004 0.700 0.116
#> GSM531669     1  0.1478     0.8183 0.936 0.000 0.000 0.000 0.064
#> GSM531671     5  0.6167     0.1684 0.100 0.012 0.372 0.000 0.516
#> GSM531672     4  0.3876     0.8222 0.000 0.116 0.004 0.812 0.068
#> GSM531673     5  0.6156     0.5116 0.000 0.224 0.216 0.000 0.560
#> GSM531676     5  0.4638     0.6701 0.028 0.324 0.000 0.000 0.648
#> GSM531679     2  0.2020     0.6425 0.000 0.900 0.000 0.000 0.100
#> GSM531681     2  0.4859     0.3792 0.000 0.608 0.004 0.364 0.024
#> GSM531682     2  0.3109     0.5427 0.000 0.800 0.000 0.000 0.200
#> GSM531683     2  0.0290     0.6781 0.000 0.992 0.000 0.008 0.000
#> GSM531684     2  0.4264     0.0929 0.000 0.620 0.004 0.000 0.376
#> GSM531685     5  0.4548     0.6473 0.096 0.156 0.000 0.000 0.748
#> GSM531686     2  0.4832     0.3957 0.000 0.616 0.004 0.356 0.024
#> GSM531687     5  0.4733     0.6458 0.028 0.348 0.000 0.000 0.624
#> GSM531688     1  0.3999     0.5138 0.656 0.000 0.000 0.000 0.344
#> GSM531690     2  0.4944     0.4062 0.000 0.620 0.004 0.344 0.032
#> GSM531693     1  0.4015     0.5257 0.652 0.000 0.000 0.000 0.348
#> GSM531695     1  0.5929     0.3054 0.572 0.116 0.004 0.000 0.308
#> GSM531603     2  0.1251     0.6776 0.000 0.956 0.000 0.008 0.036
#> GSM531609     4  0.0000     0.8998 0.000 0.000 0.000 1.000 0.000
#> GSM531611     4  0.0000     0.8998 0.000 0.000 0.000 1.000 0.000
#> GSM531621     3  0.0162     0.9473 0.004 0.000 0.996 0.000 0.000
#> GSM531622     3  0.0566     0.9460 0.004 0.000 0.984 0.000 0.012
#> GSM531628     1  0.0324     0.8238 0.992 0.004 0.000 0.000 0.004
#> GSM531630     3  0.0566     0.9460 0.004 0.000 0.984 0.000 0.012
#> GSM531633     3  0.0162     0.9473 0.004 0.000 0.996 0.000 0.000
#> GSM531635     1  0.2660     0.8195 0.864 0.000 0.008 0.000 0.128
#> GSM531640     3  0.0566     0.9460 0.004 0.000 0.984 0.000 0.012
#> GSM531649     1  0.1671     0.8198 0.924 0.000 0.000 0.000 0.076
#> GSM531653     1  0.1270     0.8215 0.948 0.000 0.000 0.000 0.052
#> GSM531657     4  0.4078     0.8150 0.000 0.128 0.004 0.796 0.072
#> GSM531665     5  0.4443     0.6795 0.028 0.212 0.016 0.000 0.744
#> GSM531670     1  0.4848     0.7213 0.724 0.000 0.144 0.000 0.132
#> GSM531674     1  0.1410     0.8195 0.940 0.000 0.000 0.000 0.060
#> GSM531675     2  0.3602     0.6093 0.000 0.820 0.004 0.140 0.036
#> GSM531677     2  0.2407     0.6485 0.000 0.896 0.004 0.012 0.088
#> GSM531678     2  0.3684     0.3601 0.000 0.720 0.000 0.000 0.280
#> GSM531680     5  0.6465     0.4840 0.204 0.272 0.004 0.000 0.520
#> GSM531689     5  0.4171     0.5732 0.000 0.396 0.000 0.000 0.604
#> GSM531691     5  0.3966     0.6392 0.000 0.336 0.000 0.000 0.664
#> GSM531692     5  0.3730     0.6668 0.000 0.288 0.000 0.000 0.712
#> GSM531694     2  0.0992     0.6788 0.000 0.968 0.000 0.008 0.024

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>           class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM531602     2  0.2854     0.7013 0.000 0.860 0.000 0.004 0.048 0.088
#> GSM531604     5  0.5350     0.5336 0.000 0.212 0.000 0.000 0.592 0.196
#> GSM531606     2  0.4432     0.5442 0.000 0.708 0.000 0.000 0.188 0.104
#> GSM531607     2  0.2854     0.7013 0.000 0.860 0.000 0.004 0.048 0.088
#> GSM531608     3  0.4407     0.6294 0.000 0.000 0.692 0.000 0.076 0.232
#> GSM531610     4  0.0632     0.8257 0.000 0.024 0.000 0.976 0.000 0.000
#> GSM531612     4  0.0146     0.8293 0.000 0.000 0.000 0.996 0.000 0.004
#> GSM531613     4  0.0632     0.8257 0.000 0.024 0.000 0.976 0.000 0.000
#> GSM531614     4  0.0000     0.8294 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM531616     3  0.3722     0.7688 0.008 0.004 0.772 0.000 0.024 0.192
#> GSM531618     6  0.5465    -0.1558 0.012 0.012 0.056 0.424 0.000 0.496
#> GSM531619     3  0.1462     0.8615 0.000 0.000 0.936 0.000 0.008 0.056
#> GSM531620     3  0.3013     0.8155 0.000 0.004 0.832 0.000 0.024 0.140
#> GSM531623     3  0.0692     0.8718 0.000 0.000 0.976 0.000 0.004 0.020
#> GSM531625     3  0.2848     0.8238 0.000 0.004 0.848 0.000 0.024 0.124
#> GSM531626     3  0.3380     0.7968 0.004 0.004 0.804 0.000 0.024 0.164
#> GSM531632     1  0.2221     0.5769 0.896 0.000 0.000 0.000 0.032 0.072
#> GSM531638     3  0.3613     0.7727 0.004 0.004 0.776 0.000 0.024 0.192
#> GSM531639     6  0.6153     0.3136 0.368 0.004 0.168 0.000 0.012 0.448
#> GSM531641     4  0.0146     0.8293 0.000 0.000 0.000 0.996 0.000 0.004
#> GSM531642     6  0.5507     0.4941 0.364 0.000 0.064 0.032 0.000 0.540
#> GSM531643     1  0.3934    -0.0994 0.616 0.000 0.000 0.000 0.008 0.376
#> GSM531644     1  0.4652    -0.4434 0.508 0.000 0.000 0.016 0.016 0.460
#> GSM531645     4  0.0146     0.8293 0.000 0.000 0.000 0.996 0.000 0.004
#> GSM531646     1  0.2615     0.5571 0.876 0.000 0.008 0.000 0.028 0.088
#> GSM531647     1  0.0000     0.5971 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM531648     4  0.3954     0.4726 0.000 0.012 0.000 0.636 0.000 0.352
#> GSM531650     1  0.2060     0.5529 0.900 0.000 0.000 0.000 0.016 0.084
#> GSM531651     3  0.0777     0.8711 0.000 0.000 0.972 0.000 0.004 0.024
#> GSM531652     6  0.5295     0.4406 0.448 0.012 0.000 0.036 0.016 0.488
#> GSM531656     1  0.5784    -0.3386 0.488 0.004 0.084 0.000 0.024 0.400
#> GSM531659     4  0.6012     0.5544 0.000 0.224 0.000 0.540 0.020 0.216
#> GSM531661     3  0.4455     0.6232 0.000 0.000 0.688 0.000 0.080 0.232
#> GSM531662     5  0.6120     0.3398 0.000 0.008 0.308 0.000 0.456 0.228
#> GSM531663     4  0.0935     0.8228 0.000 0.032 0.000 0.964 0.000 0.004
#> GSM531664     1  0.2112     0.5577 0.896 0.000 0.000 0.000 0.016 0.088
#> GSM531666     6  0.5111     0.4208 0.456 0.012 0.000 0.024 0.016 0.492
#> GSM531667     3  0.2145     0.8404 0.000 0.000 0.900 0.000 0.028 0.072
#> GSM531668     4  0.6308     0.3300 0.000 0.340 0.000 0.404 0.012 0.244
#> GSM531669     1  0.1092     0.5978 0.960 0.000 0.000 0.000 0.020 0.020
#> GSM531671     5  0.6417     0.4835 0.052 0.000 0.176 0.000 0.516 0.256
#> GSM531672     4  0.4707     0.6580 0.000 0.204 0.000 0.676 0.000 0.120
#> GSM531673     5  0.5529     0.6127 0.000 0.036 0.124 0.000 0.636 0.204
#> GSM531676     5  0.2656     0.6474 0.008 0.120 0.000 0.000 0.860 0.012
#> GSM531679     2  0.3052     0.6459 0.000 0.780 0.000 0.000 0.216 0.004
#> GSM531681     2  0.4414     0.5421 0.000 0.672 0.000 0.280 0.040 0.008
#> GSM531682     2  0.3615     0.5463 0.000 0.700 0.000 0.000 0.292 0.008
#> GSM531683     2  0.0767     0.7121 0.000 0.976 0.000 0.004 0.012 0.008
#> GSM531684     5  0.6317     0.2752 0.000 0.328 0.012 0.000 0.408 0.252
#> GSM531685     5  0.2875     0.6599 0.064 0.036 0.000 0.000 0.872 0.028
#> GSM531686     2  0.4554     0.5522 0.000 0.668 0.000 0.272 0.052 0.008
#> GSM531687     5  0.3565     0.6077 0.008 0.156 0.000 0.000 0.796 0.040
#> GSM531688     1  0.4238     0.3755 0.628 0.000 0.000 0.000 0.344 0.028
#> GSM531690     2  0.4731     0.5732 0.000 0.692 0.000 0.228 0.048 0.032
#> GSM531693     1  0.4467     0.3898 0.632 0.000 0.000 0.000 0.320 0.048
#> GSM531695     1  0.6500     0.2383 0.464 0.076 0.000 0.000 0.348 0.112
#> GSM531603     2  0.2721     0.7008 0.000 0.868 0.000 0.004 0.040 0.088
#> GSM531609     4  0.0146     0.8293 0.000 0.000 0.000 0.996 0.000 0.004
#> GSM531611     4  0.0146     0.8298 0.000 0.004 0.000 0.996 0.000 0.000
#> GSM531621     3  0.0146     0.8735 0.000 0.000 0.996 0.000 0.004 0.000
#> GSM531622     3  0.0405     0.8736 0.000 0.000 0.988 0.000 0.004 0.008
#> GSM531628     1  0.2006     0.5564 0.904 0.000 0.000 0.000 0.016 0.080
#> GSM531630     3  0.0405     0.8736 0.000 0.000 0.988 0.000 0.004 0.008
#> GSM531633     3  0.0603     0.8719 0.000 0.000 0.980 0.000 0.004 0.016
#> GSM531635     1  0.5034     0.2904 0.660 0.004 0.060 0.000 0.024 0.252
#> GSM531640     3  0.1219     0.8656 0.000 0.000 0.948 0.000 0.004 0.048
#> GSM531649     1  0.3225     0.5132 0.828 0.004 0.008 0.000 0.024 0.136
#> GSM531653     1  0.0000     0.5971 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM531657     4  0.4858     0.6363 0.000 0.228 0.000 0.652 0.000 0.120
#> GSM531665     5  0.3875     0.6743 0.020 0.036 0.000 0.000 0.776 0.168
#> GSM531670     1  0.5831    -0.3360 0.488 0.004 0.076 0.000 0.032 0.400
#> GSM531674     1  0.0909     0.5990 0.968 0.000 0.000 0.000 0.012 0.020
#> GSM531675     2  0.4029     0.6722 0.000 0.784 0.000 0.132 0.052 0.032
#> GSM531677     2  0.3288     0.6625 0.000 0.800 0.000 0.008 0.176 0.016
#> GSM531678     2  0.4929     0.1790 0.000 0.508 0.000 0.000 0.428 0.064
#> GSM531680     5  0.5377     0.4929 0.080 0.136 0.000 0.000 0.684 0.100
#> GSM531689     5  0.2841     0.6148 0.000 0.164 0.000 0.000 0.824 0.012
#> GSM531691     5  0.2312     0.6555 0.000 0.112 0.000 0.000 0.876 0.012
#> GSM531692     5  0.3516     0.6740 0.000 0.048 0.000 0.000 0.788 0.164
#> GSM531694     2  0.2854     0.7013 0.000 0.860 0.000 0.004 0.048 0.088

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

consensus_heatmap(res, k = 2)

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

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

collect_plots(res)

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 0.740           0.859       0.943         0.5059 0.497   0.497
#> 3 3 0.911           0.900       0.953         0.3225 0.721   0.495
#> 4 4 0.864           0.850       0.941         0.1298 0.832   0.547
#> 5 5 0.839           0.841       0.910         0.0618 0.921   0.694
#> 6 6 0.791           0.650       0.817         0.0366 0.960   0.806

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
#> GSM531602     2  0.0000     0.9601 0.000 1.000
#> GSM531604     2  0.0000     0.9601 0.000 1.000
#> GSM531606     2  0.0000     0.9601 0.000 1.000
#> GSM531607     2  0.0000     0.9601 0.000 1.000
#> GSM531608     2  0.1184     0.9469 0.016 0.984
#> GSM531610     2  0.0000     0.9601 0.000 1.000
#> GSM531612     2  0.0000     0.9601 0.000 1.000
#> GSM531613     2  0.0000     0.9601 0.000 1.000
#> GSM531614     2  0.0000     0.9601 0.000 1.000
#> GSM531616     1  0.0000     0.9129 1.000 0.000
#> GSM531618     1  0.9970     0.1825 0.532 0.468
#> GSM531619     1  0.7219     0.7323 0.800 0.200
#> GSM531620     1  0.0000     0.9129 1.000 0.000
#> GSM531623     1  0.0000     0.9129 1.000 0.000
#> GSM531625     1  0.0000     0.9129 1.000 0.000
#> GSM531626     1  0.0000     0.9129 1.000 0.000
#> GSM531632     1  0.0000     0.9129 1.000 0.000
#> GSM531638     1  0.0000     0.9129 1.000 0.000
#> GSM531639     1  0.0000     0.9129 1.000 0.000
#> GSM531641     2  0.0000     0.9601 0.000 1.000
#> GSM531642     1  0.0000     0.9129 1.000 0.000
#> GSM531643     1  0.0000     0.9129 1.000 0.000
#> GSM531644     1  0.0000     0.9129 1.000 0.000
#> GSM531645     2  0.0000     0.9601 0.000 1.000
#> GSM531646     1  0.0000     0.9129 1.000 0.000
#> GSM531647     1  0.0000     0.9129 1.000 0.000
#> GSM531648     2  0.9661     0.2650 0.392 0.608
#> GSM531650     1  0.0000     0.9129 1.000 0.000
#> GSM531651     1  0.0000     0.9129 1.000 0.000
#> GSM531652     1  0.0000     0.9129 1.000 0.000
#> GSM531656     1  0.0000     0.9129 1.000 0.000
#> GSM531659     2  0.0000     0.9601 0.000 1.000
#> GSM531661     1  0.7219     0.7323 0.800 0.200
#> GSM531662     1  0.2778     0.8794 0.952 0.048
#> GSM531663     2  0.0000     0.9601 0.000 1.000
#> GSM531664     1  0.0000     0.9129 1.000 0.000
#> GSM531666     1  0.0672     0.9076 0.992 0.008
#> GSM531667     1  0.7219     0.7323 0.800 0.200
#> GSM531668     2  0.0000     0.9601 0.000 1.000
#> GSM531669     1  0.0000     0.9129 1.000 0.000
#> GSM531671     1  0.0000     0.9129 1.000 0.000
#> GSM531672     2  0.0000     0.9601 0.000 1.000
#> GSM531673     1  0.9866     0.2566 0.568 0.432
#> GSM531676     2  0.7219     0.7373 0.200 0.800
#> GSM531679     2  0.0000     0.9601 0.000 1.000
#> GSM531681     2  0.0000     0.9601 0.000 1.000
#> GSM531682     2  0.0000     0.9601 0.000 1.000
#> GSM531683     2  0.0000     0.9601 0.000 1.000
#> GSM531684     2  0.0000     0.9601 0.000 1.000
#> GSM531685     1  0.9661     0.3651 0.608 0.392
#> GSM531686     2  0.0000     0.9601 0.000 1.000
#> GSM531687     2  0.7219     0.7373 0.200 0.800
#> GSM531688     1  0.9580     0.3940 0.620 0.380
#> GSM531690     2  0.0000     0.9601 0.000 1.000
#> GSM531693     1  0.0000     0.9129 1.000 0.000
#> GSM531695     2  0.7219     0.7373 0.200 0.800
#> GSM531603     2  0.0000     0.9601 0.000 1.000
#> GSM531609     2  0.0000     0.9601 0.000 1.000
#> GSM531611     2  0.0000     0.9601 0.000 1.000
#> GSM531621     1  0.0000     0.9129 1.000 0.000
#> GSM531622     1  0.0000     0.9129 1.000 0.000
#> GSM531628     1  0.0000     0.9129 1.000 0.000
#> GSM531630     1  0.0000     0.9129 1.000 0.000
#> GSM531633     1  0.0000     0.9129 1.000 0.000
#> GSM531635     1  0.0000     0.9129 1.000 0.000
#> GSM531640     1  0.7219     0.7323 0.800 0.200
#> GSM531649     1  0.0000     0.9129 1.000 0.000
#> GSM531653     1  0.0000     0.9129 1.000 0.000
#> GSM531657     2  0.0000     0.9601 0.000 1.000
#> GSM531665     1  0.8861     0.5537 0.696 0.304
#> GSM531670     1  0.0000     0.9129 1.000 0.000
#> GSM531674     1  0.0000     0.9129 1.000 0.000
#> GSM531675     2  0.0000     0.9601 0.000 1.000
#> GSM531677     2  0.0000     0.9601 0.000 1.000
#> GSM531678     2  0.0000     0.9601 0.000 1.000
#> GSM531680     2  0.7219     0.7373 0.200 0.800
#> GSM531689     2  0.0000     0.9601 0.000 1.000
#> GSM531691     2  0.1843     0.9360 0.028 0.972
#> GSM531692     1  0.9998     0.0535 0.508 0.492
#> GSM531694     2  0.0000     0.9601 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
#> GSM531602     2  0.0892      0.969 0.020 0.980 0.000
#> GSM531604     3  0.7074      0.057 0.020 0.480 0.500
#> GSM531606     2  0.0892      0.969 0.020 0.980 0.000
#> GSM531607     2  0.0892      0.969 0.020 0.980 0.000
#> GSM531608     3  0.0237      0.917 0.000 0.004 0.996
#> GSM531610     2  0.0000      0.969 0.000 1.000 0.000
#> GSM531612     2  0.0000      0.969 0.000 1.000 0.000
#> GSM531613     2  0.0000      0.969 0.000 1.000 0.000
#> GSM531614     2  0.0000      0.969 0.000 1.000 0.000
#> GSM531616     3  0.0592      0.911 0.012 0.000 0.988
#> GSM531618     2  0.6881      0.305 0.020 0.592 0.388
#> GSM531619     3  0.0000      0.919 0.000 0.000 1.000
#> GSM531620     3  0.0000      0.919 0.000 0.000 1.000
#> GSM531623     3  0.0000      0.919 0.000 0.000 1.000
#> GSM531625     3  0.0000      0.919 0.000 0.000 1.000
#> GSM531626     3  0.0000      0.919 0.000 0.000 1.000
#> GSM531632     1  0.0892      0.958 0.980 0.000 0.020
#> GSM531638     3  0.0000      0.919 0.000 0.000 1.000
#> GSM531639     1  0.6204      0.321 0.576 0.000 0.424
#> GSM531641     2  0.0000      0.969 0.000 1.000 0.000
#> GSM531642     1  0.4953      0.779 0.808 0.016 0.176
#> GSM531643     1  0.0892      0.958 0.980 0.000 0.020
#> GSM531644     1  0.0983      0.952 0.980 0.016 0.004
#> GSM531645     2  0.0000      0.969 0.000 1.000 0.000
#> GSM531646     1  0.0892      0.958 0.980 0.000 0.020
#> GSM531647     1  0.0892      0.958 0.980 0.000 0.020
#> GSM531648     2  0.0892      0.954 0.020 0.980 0.000
#> GSM531650     1  0.0892      0.958 0.980 0.000 0.020
#> GSM531651     3  0.0000      0.919 0.000 0.000 1.000
#> GSM531652     1  0.4136      0.848 0.864 0.020 0.116
#> GSM531656     1  0.1411      0.949 0.964 0.000 0.036
#> GSM531659     2  0.0000      0.969 0.000 1.000 0.000
#> GSM531661     3  0.0000      0.919 0.000 0.000 1.000
#> GSM531662     3  0.0237      0.917 0.004 0.000 0.996
#> GSM531663     2  0.0000      0.969 0.000 1.000 0.000
#> GSM531664     1  0.1015      0.954 0.980 0.012 0.008
#> GSM531666     1  0.0892      0.949 0.980 0.020 0.000
#> GSM531667     3  0.0000      0.919 0.000 0.000 1.000
#> GSM531668     2  0.0000      0.969 0.000 1.000 0.000
#> GSM531669     1  0.0892      0.958 0.980 0.000 0.020
#> GSM531671     3  0.4555      0.723 0.200 0.000 0.800
#> GSM531672     2  0.0000      0.969 0.000 1.000 0.000
#> GSM531673     3  0.0892      0.905 0.020 0.000 0.980
#> GSM531676     1  0.0892      0.937 0.980 0.020 0.000
#> GSM531679     2  0.0892      0.969 0.020 0.980 0.000
#> GSM531681     2  0.0892      0.969 0.020 0.980 0.000
#> GSM531682     2  0.0892      0.969 0.020 0.980 0.000
#> GSM531683     2  0.0892      0.969 0.020 0.980 0.000
#> GSM531684     3  0.6161      0.583 0.020 0.272 0.708
#> GSM531685     1  0.0000      0.950 1.000 0.000 0.000
#> GSM531686     2  0.0892      0.969 0.020 0.980 0.000
#> GSM531687     1  0.0892      0.937 0.980 0.020 0.000
#> GSM531688     1  0.0000      0.950 1.000 0.000 0.000
#> GSM531690     2  0.0892      0.969 0.020 0.980 0.000
#> GSM531693     1  0.0892      0.958 0.980 0.000 0.020
#> GSM531695     1  0.0000      0.950 1.000 0.000 0.000
#> GSM531603     2  0.0892      0.969 0.020 0.980 0.000
#> GSM531609     2  0.0000      0.969 0.000 1.000 0.000
#> GSM531611     2  0.0000      0.969 0.000 1.000 0.000
#> GSM531621     3  0.0000      0.919 0.000 0.000 1.000
#> GSM531622     3  0.0000      0.919 0.000 0.000 1.000
#> GSM531628     1  0.0892      0.958 0.980 0.000 0.020
#> GSM531630     3  0.0000      0.919 0.000 0.000 1.000
#> GSM531633     3  0.0000      0.919 0.000 0.000 1.000
#> GSM531635     1  0.0892      0.958 0.980 0.000 0.020
#> GSM531640     3  0.0000      0.919 0.000 0.000 1.000
#> GSM531649     1  0.0892      0.958 0.980 0.000 0.020
#> GSM531653     1  0.0892      0.958 0.980 0.000 0.020
#> GSM531657     2  0.0000      0.969 0.000 1.000 0.000
#> GSM531665     3  0.6204      0.320 0.424 0.000 0.576
#> GSM531670     1  0.1289      0.952 0.968 0.000 0.032
#> GSM531674     1  0.0892      0.958 0.980 0.000 0.020
#> GSM531675     2  0.0892      0.969 0.020 0.980 0.000
#> GSM531677     2  0.0892      0.969 0.020 0.980 0.000
#> GSM531678     2  0.0892      0.969 0.020 0.980 0.000
#> GSM531680     1  0.0892      0.937 0.980 0.020 0.000
#> GSM531689     2  0.2537      0.917 0.080 0.920 0.000
#> GSM531691     2  0.4397      0.855 0.116 0.856 0.028
#> GSM531692     3  0.4452      0.753 0.192 0.000 0.808
#> GSM531694     2  0.0892      0.969 0.020 0.980 0.000

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM531602     2  0.0592     0.9035 0.000 0.984 0.000 0.016
#> GSM531604     2  0.0000     0.9047 0.000 1.000 0.000 0.000
#> GSM531606     2  0.0592     0.9035 0.000 0.984 0.000 0.016
#> GSM531607     2  0.0592     0.9035 0.000 0.984 0.000 0.016
#> GSM531608     3  0.0000     0.9566 0.000 0.000 1.000 0.000
#> GSM531610     4  0.0000     0.9282 0.000 0.000 0.000 1.000
#> GSM531612     4  0.0000     0.9282 0.000 0.000 0.000 1.000
#> GSM531613     4  0.0000     0.9282 0.000 0.000 0.000 1.000
#> GSM531614     4  0.0000     0.9282 0.000 0.000 0.000 1.000
#> GSM531616     3  0.0000     0.9566 0.000 0.000 1.000 0.000
#> GSM531618     4  0.1211     0.8906 0.000 0.000 0.040 0.960
#> GSM531619     3  0.0000     0.9566 0.000 0.000 1.000 0.000
#> GSM531620     3  0.0000     0.9566 0.000 0.000 1.000 0.000
#> GSM531623     3  0.0000     0.9566 0.000 0.000 1.000 0.000
#> GSM531625     3  0.0000     0.9566 0.000 0.000 1.000 0.000
#> GSM531626     3  0.0000     0.9566 0.000 0.000 1.000 0.000
#> GSM531632     1  0.0000     0.9389 1.000 0.000 0.000 0.000
#> GSM531638     3  0.0000     0.9566 0.000 0.000 1.000 0.000
#> GSM531639     1  0.4843     0.4204 0.604 0.000 0.396 0.000
#> GSM531641     4  0.0000     0.9282 0.000 0.000 0.000 1.000
#> GSM531642     1  0.4137     0.7478 0.780 0.000 0.208 0.012
#> GSM531643     1  0.0000     0.9389 1.000 0.000 0.000 0.000
#> GSM531644     1  0.0000     0.9389 1.000 0.000 0.000 0.000
#> GSM531645     4  0.0000     0.9282 0.000 0.000 0.000 1.000
#> GSM531646     1  0.0000     0.9389 1.000 0.000 0.000 0.000
#> GSM531647     1  0.0000     0.9389 1.000 0.000 0.000 0.000
#> GSM531648     4  0.0000     0.9282 0.000 0.000 0.000 1.000
#> GSM531650     1  0.0000     0.9389 1.000 0.000 0.000 0.000
#> GSM531651     3  0.0000     0.9566 0.000 0.000 1.000 0.000
#> GSM531652     1  0.1109     0.9174 0.968 0.000 0.004 0.028
#> GSM531656     1  0.3400     0.7879 0.820 0.000 0.180 0.000
#> GSM531659     4  0.0000     0.9282 0.000 0.000 0.000 1.000
#> GSM531661     3  0.0000     0.9566 0.000 0.000 1.000 0.000
#> GSM531662     3  0.3444     0.7699 0.000 0.184 0.816 0.000
#> GSM531663     4  0.0000     0.9282 0.000 0.000 0.000 1.000
#> GSM531664     1  0.0000     0.9389 1.000 0.000 0.000 0.000
#> GSM531666     1  0.0000     0.9389 1.000 0.000 0.000 0.000
#> GSM531667     3  0.0000     0.9566 0.000 0.000 1.000 0.000
#> GSM531668     4  0.0000     0.9282 0.000 0.000 0.000 1.000
#> GSM531669     1  0.0000     0.9389 1.000 0.000 0.000 0.000
#> GSM531671     3  0.4095     0.7338 0.192 0.016 0.792 0.000
#> GSM531672     4  0.0000     0.9282 0.000 0.000 0.000 1.000
#> GSM531673     3  0.4661     0.4953 0.000 0.348 0.652 0.000
#> GSM531676     2  0.0592     0.8977 0.016 0.984 0.000 0.000
#> GSM531679     2  0.0000     0.9047 0.000 1.000 0.000 0.000
#> GSM531681     4  0.5000    -0.0504 0.000 0.500 0.000 0.500
#> GSM531682     2  0.0188     0.9047 0.000 0.996 0.000 0.004
#> GSM531683     2  0.0592     0.9035 0.000 0.984 0.000 0.016
#> GSM531684     2  0.0000     0.9047 0.000 1.000 0.000 0.000
#> GSM531685     2  0.2921     0.7951 0.140 0.860 0.000 0.000
#> GSM531686     2  0.4999    -0.0225 0.000 0.508 0.000 0.492
#> GSM531687     2  0.0817     0.8934 0.024 0.976 0.000 0.000
#> GSM531688     1  0.0000     0.9389 1.000 0.000 0.000 0.000
#> GSM531690     4  0.4994     0.0245 0.000 0.480 0.000 0.520
#> GSM531693     1  0.0000     0.9389 1.000 0.000 0.000 0.000
#> GSM531695     1  0.3801     0.6719 0.780 0.220 0.000 0.000
#> GSM531603     2  0.0817     0.8984 0.000 0.976 0.000 0.024
#> GSM531609     4  0.0000     0.9282 0.000 0.000 0.000 1.000
#> GSM531611     4  0.0000     0.9282 0.000 0.000 0.000 1.000
#> GSM531621     3  0.0000     0.9566 0.000 0.000 1.000 0.000
#> GSM531622     3  0.0000     0.9566 0.000 0.000 1.000 0.000
#> GSM531628     1  0.0000     0.9389 1.000 0.000 0.000 0.000
#> GSM531630     3  0.0000     0.9566 0.000 0.000 1.000 0.000
#> GSM531633     3  0.0000     0.9566 0.000 0.000 1.000 0.000
#> GSM531635     1  0.0000     0.9389 1.000 0.000 0.000 0.000
#> GSM531640     3  0.0000     0.9566 0.000 0.000 1.000 0.000
#> GSM531649     1  0.0000     0.9389 1.000 0.000 0.000 0.000
#> GSM531653     1  0.0000     0.9389 1.000 0.000 0.000 0.000
#> GSM531657     4  0.0000     0.9282 0.000 0.000 0.000 1.000
#> GSM531665     2  0.5386     0.2943 0.020 0.612 0.368 0.000
#> GSM531670     1  0.3356     0.7923 0.824 0.000 0.176 0.000
#> GSM531674     1  0.0000     0.9389 1.000 0.000 0.000 0.000
#> GSM531675     2  0.4817     0.3224 0.000 0.612 0.000 0.388
#> GSM531677     2  0.0592     0.9035 0.000 0.984 0.000 0.016
#> GSM531678     2  0.0000     0.9047 0.000 1.000 0.000 0.000
#> GSM531680     2  0.3569     0.7393 0.196 0.804 0.000 0.000
#> GSM531689     2  0.0000     0.9047 0.000 1.000 0.000 0.000
#> GSM531691     2  0.0000     0.9047 0.000 1.000 0.000 0.000
#> GSM531692     2  0.0000     0.9047 0.000 1.000 0.000 0.000
#> GSM531694     2  0.0592     0.9035 0.000 0.984 0.000 0.016

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>           class entropy silhouette    p1    p2    p3    p4    p5
#> GSM531602     2  0.0000      0.918 0.000 1.000 0.000 0.000 0.000
#> GSM531604     2  0.3983      0.509 0.000 0.660 0.000 0.000 0.340
#> GSM531606     2  0.0404      0.915 0.000 0.988 0.000 0.000 0.012
#> GSM531607     2  0.0000      0.918 0.000 1.000 0.000 0.000 0.000
#> GSM531608     3  0.1668      0.891 0.000 0.028 0.940 0.000 0.032
#> GSM531610     4  0.0000      0.965 0.000 0.000 0.000 1.000 0.000
#> GSM531612     4  0.0000      0.965 0.000 0.000 0.000 1.000 0.000
#> GSM531613     4  0.0290      0.963 0.000 0.008 0.000 0.992 0.000
#> GSM531614     4  0.0000      0.965 0.000 0.000 0.000 1.000 0.000
#> GSM531616     3  0.0290      0.916 0.008 0.000 0.992 0.000 0.000
#> GSM531618     4  0.1187      0.946 0.004 0.004 0.004 0.964 0.024
#> GSM531619     3  0.0609      0.911 0.000 0.020 0.980 0.000 0.000
#> GSM531620     3  0.0000      0.921 0.000 0.000 1.000 0.000 0.000
#> GSM531623     3  0.0000      0.921 0.000 0.000 1.000 0.000 0.000
#> GSM531625     3  0.0000      0.921 0.000 0.000 1.000 0.000 0.000
#> GSM531626     3  0.0000      0.921 0.000 0.000 1.000 0.000 0.000
#> GSM531632     1  0.2852      0.776 0.828 0.000 0.000 0.000 0.172
#> GSM531638     3  0.0000      0.921 0.000 0.000 1.000 0.000 0.000
#> GSM531639     1  0.4329      0.595 0.672 0.000 0.312 0.000 0.016
#> GSM531641     4  0.0000      0.965 0.000 0.000 0.000 1.000 0.000
#> GSM531642     1  0.4230      0.729 0.764 0.000 0.196 0.016 0.024
#> GSM531643     1  0.0404      0.884 0.988 0.000 0.000 0.000 0.012
#> GSM531644     1  0.0992      0.879 0.968 0.000 0.000 0.008 0.024
#> GSM531645     4  0.0000      0.965 0.000 0.000 0.000 1.000 0.000
#> GSM531646     1  0.1197      0.881 0.952 0.000 0.000 0.000 0.048
#> GSM531647     1  0.1043      0.883 0.960 0.000 0.000 0.000 0.040
#> GSM531648     4  0.0703      0.952 0.000 0.000 0.000 0.976 0.024
#> GSM531650     1  0.0162      0.886 0.996 0.000 0.000 0.000 0.004
#> GSM531651     3  0.0000      0.921 0.000 0.000 1.000 0.000 0.000
#> GSM531652     1  0.2423      0.835 0.896 0.000 0.000 0.080 0.024
#> GSM531656     1  0.3048      0.768 0.820 0.000 0.176 0.000 0.004
#> GSM531659     4  0.1478      0.934 0.000 0.064 0.000 0.936 0.000
#> GSM531661     3  0.1750      0.889 0.000 0.028 0.936 0.000 0.036
#> GSM531662     3  0.4506      0.598 0.000 0.028 0.676 0.000 0.296
#> GSM531663     4  0.0510      0.961 0.000 0.016 0.000 0.984 0.000
#> GSM531664     1  0.0404      0.886 0.988 0.000 0.000 0.000 0.012
#> GSM531666     1  0.1310      0.875 0.956 0.000 0.000 0.020 0.024
#> GSM531667     3  0.0609      0.911 0.000 0.020 0.980 0.000 0.000
#> GSM531668     4  0.2377      0.882 0.000 0.128 0.000 0.872 0.000
#> GSM531669     1  0.2471      0.816 0.864 0.000 0.000 0.000 0.136
#> GSM531671     3  0.5579      0.292 0.072 0.000 0.508 0.000 0.420
#> GSM531672     4  0.1851      0.917 0.000 0.088 0.000 0.912 0.000
#> GSM531673     3  0.5003      0.361 0.000 0.032 0.544 0.000 0.424
#> GSM531676     5  0.2286      0.760 0.004 0.108 0.000 0.000 0.888
#> GSM531679     2  0.0703      0.914 0.000 0.976 0.000 0.000 0.024
#> GSM531681     2  0.1732      0.879 0.000 0.920 0.000 0.080 0.000
#> GSM531682     2  0.0794      0.913 0.000 0.972 0.000 0.000 0.028
#> GSM531683     2  0.0000      0.918 0.000 1.000 0.000 0.000 0.000
#> GSM531684     2  0.3424      0.666 0.000 0.760 0.000 0.000 0.240
#> GSM531685     5  0.0798      0.757 0.008 0.016 0.000 0.000 0.976
#> GSM531686     2  0.1732      0.879 0.000 0.920 0.000 0.080 0.000
#> GSM531687     5  0.3491      0.707 0.004 0.228 0.000 0.000 0.768
#> GSM531688     5  0.3876      0.541 0.316 0.000 0.000 0.000 0.684
#> GSM531690     2  0.1671      0.881 0.000 0.924 0.000 0.076 0.000
#> GSM531693     5  0.3876      0.541 0.316 0.000 0.000 0.000 0.684
#> GSM531695     5  0.6160      0.623 0.284 0.172 0.000 0.000 0.544
#> GSM531603     2  0.0000      0.918 0.000 1.000 0.000 0.000 0.000
#> GSM531609     4  0.0000      0.965 0.000 0.000 0.000 1.000 0.000
#> GSM531611     4  0.0000      0.965 0.000 0.000 0.000 1.000 0.000
#> GSM531621     3  0.0000      0.921 0.000 0.000 1.000 0.000 0.000
#> GSM531622     3  0.0000      0.921 0.000 0.000 1.000 0.000 0.000
#> GSM531628     1  0.0290      0.886 0.992 0.000 0.000 0.000 0.008
#> GSM531630     3  0.0000      0.921 0.000 0.000 1.000 0.000 0.000
#> GSM531633     3  0.0000      0.921 0.000 0.000 1.000 0.000 0.000
#> GSM531635     1  0.1753      0.883 0.936 0.000 0.032 0.000 0.032
#> GSM531640     3  0.0000      0.921 0.000 0.000 1.000 0.000 0.000
#> GSM531649     1  0.1648      0.884 0.940 0.000 0.020 0.000 0.040
#> GSM531653     1  0.1043      0.883 0.960 0.000 0.000 0.000 0.040
#> GSM531657     4  0.2020      0.907 0.000 0.100 0.000 0.900 0.000
#> GSM531665     5  0.0854      0.755 0.008 0.012 0.004 0.000 0.976
#> GSM531670     1  0.3132      0.770 0.820 0.000 0.172 0.000 0.008
#> GSM531674     1  0.1792      0.859 0.916 0.000 0.000 0.000 0.084
#> GSM531675     2  0.1270      0.898 0.000 0.948 0.000 0.052 0.000
#> GSM531677     2  0.0865      0.914 0.000 0.972 0.000 0.004 0.024
#> GSM531678     2  0.1608      0.877 0.000 0.928 0.000 0.000 0.072
#> GSM531680     5  0.5759      0.681 0.160 0.224 0.000 0.000 0.616
#> GSM531689     5  0.3636      0.655 0.000 0.272 0.000 0.000 0.728
#> GSM531691     5  0.3395      0.684 0.000 0.236 0.000 0.000 0.764
#> GSM531692     5  0.1608      0.754 0.000 0.072 0.000 0.000 0.928
#> GSM531694     2  0.0000      0.918 0.000 1.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
#> GSM531602     2  0.0865    0.89655 0.000 0.964 0.000 0.000 0.000 0.036
#> GSM531604     5  0.5999    0.15665 0.000 0.256 0.000 0.000 0.432 0.312
#> GSM531606     2  0.1995    0.86578 0.000 0.912 0.000 0.000 0.036 0.052
#> GSM531607     2  0.0865    0.89655 0.000 0.964 0.000 0.000 0.000 0.036
#> GSM531608     3  0.4408    0.41222 0.000 0.000 0.664 0.000 0.056 0.280
#> GSM531610     4  0.0260    0.87193 0.000 0.008 0.000 0.992 0.000 0.000
#> GSM531612     4  0.0000    0.87278 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM531613     4  0.0458    0.87018 0.000 0.016 0.000 0.984 0.000 0.000
#> GSM531614     4  0.0000    0.87278 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM531616     3  0.2553    0.80698 0.008 0.000 0.848 0.000 0.000 0.144
#> GSM531618     4  0.4228    0.50677 0.000 0.000 0.020 0.588 0.000 0.392
#> GSM531619     3  0.0260    0.86588 0.000 0.000 0.992 0.000 0.000 0.008
#> GSM531620     3  0.1714    0.84507 0.000 0.000 0.908 0.000 0.000 0.092
#> GSM531623     3  0.0146    0.86779 0.000 0.000 0.996 0.000 0.000 0.004
#> GSM531625     3  0.2402    0.81470 0.004 0.000 0.856 0.000 0.000 0.140
#> GSM531626     3  0.2402    0.81470 0.004 0.000 0.856 0.000 0.000 0.140
#> GSM531632     1  0.1890    0.72017 0.916 0.000 0.000 0.000 0.024 0.060
#> GSM531638     3  0.2442    0.81110 0.004 0.000 0.852 0.000 0.000 0.144
#> GSM531639     6  0.6082   -0.09635 0.360 0.000 0.272 0.000 0.000 0.368
#> GSM531641     4  0.0000    0.87278 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM531642     6  0.4800   -0.30221 0.372 0.000 0.032 0.016 0.000 0.580
#> GSM531643     1  0.2260    0.72100 0.860 0.000 0.000 0.000 0.000 0.140
#> GSM531644     1  0.4253    0.32397 0.524 0.000 0.000 0.016 0.000 0.460
#> GSM531645     4  0.0000    0.87278 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM531646     1  0.1152    0.74815 0.952 0.000 0.000 0.000 0.004 0.044
#> GSM531647     1  0.0000    0.75919 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM531648     4  0.3578    0.59777 0.000 0.000 0.000 0.660 0.000 0.340
#> GSM531650     1  0.1141    0.75908 0.948 0.000 0.000 0.000 0.000 0.052
#> GSM531651     3  0.0146    0.86779 0.000 0.000 0.996 0.000 0.000 0.004
#> GSM531652     1  0.4757    0.26562 0.484 0.000 0.000 0.048 0.000 0.468
#> GSM531656     1  0.4640    0.53063 0.676 0.000 0.080 0.000 0.004 0.240
#> GSM531659     4  0.2350    0.83105 0.000 0.100 0.000 0.880 0.000 0.020
#> GSM531661     3  0.4445    0.39486 0.000 0.000 0.656 0.000 0.056 0.288
#> GSM531662     6  0.6125   -0.00425 0.000 0.000 0.336 0.000 0.312 0.352
#> GSM531663     4  0.0713    0.86640 0.000 0.028 0.000 0.972 0.000 0.000
#> GSM531664     1  0.1141    0.75908 0.948 0.000 0.000 0.000 0.000 0.052
#> GSM531666     1  0.4401    0.30722 0.512 0.000 0.000 0.024 0.000 0.464
#> GSM531667     3  0.0547    0.85902 0.000 0.000 0.980 0.000 0.000 0.020
#> GSM531668     4  0.4583    0.39428 0.000 0.376 0.000 0.580 0.000 0.044
#> GSM531669     1  0.1082    0.74333 0.956 0.000 0.000 0.000 0.040 0.004
#> GSM531671     6  0.7452   -0.01907 0.164 0.000 0.184 0.000 0.292 0.360
#> GSM531672     4  0.2653    0.80137 0.000 0.144 0.000 0.844 0.000 0.012
#> GSM531673     5  0.6164   -0.09973 0.000 0.012 0.200 0.000 0.436 0.352
#> GSM531676     5  0.1714    0.59296 0.000 0.092 0.000 0.000 0.908 0.000
#> GSM531679     2  0.0291    0.89582 0.000 0.992 0.000 0.000 0.004 0.004
#> GSM531681     2  0.2101    0.83814 0.000 0.892 0.000 0.100 0.004 0.004
#> GSM531682     2  0.0291    0.89726 0.000 0.992 0.000 0.000 0.004 0.004
#> GSM531683     2  0.0458    0.89771 0.000 0.984 0.000 0.000 0.000 0.016
#> GSM531684     2  0.7040   -0.01768 0.000 0.388 0.072 0.000 0.244 0.296
#> GSM531685     5  0.0837    0.56399 0.020 0.004 0.000 0.000 0.972 0.004
#> GSM531686     2  0.2149    0.83452 0.000 0.888 0.000 0.104 0.004 0.004
#> GSM531687     5  0.2362    0.58673 0.000 0.136 0.000 0.000 0.860 0.004
#> GSM531688     5  0.3975    0.24510 0.452 0.000 0.000 0.000 0.544 0.004
#> GSM531690     2  0.1668    0.86274 0.000 0.928 0.000 0.060 0.004 0.008
#> GSM531693     5  0.3975    0.24494 0.452 0.000 0.000 0.000 0.544 0.004
#> GSM531695     5  0.5579    0.36960 0.352 0.100 0.000 0.000 0.532 0.016
#> GSM531603     2  0.0865    0.89655 0.000 0.964 0.000 0.000 0.000 0.036
#> GSM531609     4  0.0000    0.87278 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM531611     4  0.0000    0.87278 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM531621     3  0.0713    0.86690 0.000 0.000 0.972 0.000 0.000 0.028
#> GSM531622     3  0.0146    0.86913 0.000 0.000 0.996 0.000 0.000 0.004
#> GSM531628     1  0.1007    0.75999 0.956 0.000 0.000 0.000 0.000 0.044
#> GSM531630     3  0.0000    0.86893 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM531633     3  0.1327    0.85684 0.000 0.000 0.936 0.000 0.000 0.064
#> GSM531635     1  0.3946    0.59462 0.756 0.000 0.076 0.000 0.000 0.168
#> GSM531640     3  0.0000    0.86893 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM531649     1  0.2442    0.68023 0.852 0.000 0.004 0.000 0.000 0.144
#> GSM531653     1  0.0000    0.75919 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM531657     4  0.3133    0.74678 0.000 0.212 0.000 0.780 0.000 0.008
#> GSM531665     5  0.3584    0.36118 0.000 0.004 0.000 0.000 0.688 0.308
#> GSM531670     1  0.4698    0.53303 0.676 0.000 0.076 0.000 0.008 0.240
#> GSM531674     1  0.0937    0.74559 0.960 0.000 0.000 0.000 0.040 0.000
#> GSM531675     2  0.0665    0.89320 0.000 0.980 0.000 0.008 0.004 0.008
#> GSM531677     2  0.0291    0.89582 0.000 0.992 0.000 0.000 0.004 0.004
#> GSM531678     2  0.2909    0.76955 0.000 0.836 0.000 0.000 0.136 0.028
#> GSM531680     5  0.4695    0.53296 0.132 0.144 0.000 0.000 0.712 0.012
#> GSM531689     5  0.2877    0.57531 0.000 0.168 0.000 0.000 0.820 0.012
#> GSM531691     5  0.2163    0.58846 0.000 0.092 0.000 0.000 0.892 0.016
#> GSM531692     5  0.3758    0.34811 0.000 0.008 0.000 0.000 0.668 0.324
#> GSM531694     2  0.0865    0.89655 0.000 0.964 0.000 0.000 0.000 0.036

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 disease.state(p) k
#> MAD:skmeans 74            1.000 2
#> MAD:skmeans 76            0.894 3
#> MAD:skmeans 73            0.553 4
#> MAD:skmeans 78            0.744 5
#> MAD:skmeans 62            0.719 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 51941 rows and 80 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.500           0.882       0.927         0.4758 0.519   0.519
#> 3 3 0.529           0.657       0.818         0.3714 0.820   0.653
#> 4 4 0.525           0.476       0.707         0.1264 0.806   0.504
#> 5 5 0.700           0.511       0.758         0.0805 0.832   0.459
#> 6 6 0.697           0.492       0.731         0.0525 0.883   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
#> GSM531602     2  0.0000      0.889 0.000 1.000
#> GSM531604     2  0.1843      0.886 0.028 0.972
#> GSM531606     2  0.0000      0.889 0.000 1.000
#> GSM531607     2  0.0000      0.889 0.000 1.000
#> GSM531608     1  0.6048      0.874 0.852 0.148
#> GSM531610     1  0.6148      0.871 0.848 0.152
#> GSM531612     1  0.6048      0.874 0.852 0.148
#> GSM531613     2  0.9686      0.224 0.396 0.604
#> GSM531614     1  0.6148      0.871 0.848 0.152
#> GSM531616     1  0.0000      0.937 1.000 0.000
#> GSM531618     1  0.6048      0.874 0.852 0.148
#> GSM531619     1  0.0000      0.937 1.000 0.000
#> GSM531620     1  0.0000      0.937 1.000 0.000
#> GSM531623     1  0.0000      0.937 1.000 0.000
#> GSM531625     1  0.0000      0.937 1.000 0.000
#> GSM531626     1  0.0000      0.937 1.000 0.000
#> GSM531632     1  0.0000      0.937 1.000 0.000
#> GSM531638     1  0.0000      0.937 1.000 0.000
#> GSM531639     1  0.0000      0.937 1.000 0.000
#> GSM531641     1  0.6048      0.874 0.852 0.148
#> GSM531642     1  0.0000      0.937 1.000 0.000
#> GSM531643     1  0.0000      0.937 1.000 0.000
#> GSM531644     1  0.0376      0.936 0.996 0.004
#> GSM531645     1  0.6048      0.874 0.852 0.148
#> GSM531646     1  0.0000      0.937 1.000 0.000
#> GSM531647     1  0.0000      0.937 1.000 0.000
#> GSM531648     1  0.6048      0.874 0.852 0.148
#> GSM531650     1  0.0000      0.937 1.000 0.000
#> GSM531651     1  0.0000      0.937 1.000 0.000
#> GSM531652     1  0.2603      0.922 0.956 0.044
#> GSM531656     1  0.0000      0.937 1.000 0.000
#> GSM531659     1  0.6048      0.874 0.852 0.148
#> GSM531661     1  0.0000      0.937 1.000 0.000
#> GSM531662     1  0.0376      0.936 0.996 0.004
#> GSM531663     1  0.7139      0.828 0.804 0.196
#> GSM531664     2  0.9552      0.603 0.376 0.624
#> GSM531666     1  0.0000      0.937 1.000 0.000
#> GSM531667     1  0.6048      0.874 0.852 0.148
#> GSM531668     1  0.6048      0.874 0.852 0.148
#> GSM531669     2  0.8909      0.719 0.308 0.692
#> GSM531671     1  0.2778      0.902 0.952 0.048
#> GSM531672     1  0.6048      0.874 0.852 0.148
#> GSM531673     1  0.1184      0.932 0.984 0.016
#> GSM531676     2  0.6048      0.859 0.148 0.852
#> GSM531679     2  0.0000      0.889 0.000 1.000
#> GSM531681     2  0.0000      0.889 0.000 1.000
#> GSM531682     2  0.0000      0.889 0.000 1.000
#> GSM531683     2  0.0000      0.889 0.000 1.000
#> GSM531684     2  0.0000      0.889 0.000 1.000
#> GSM531685     2  0.6048      0.859 0.148 0.852
#> GSM531686     2  0.0000      0.889 0.000 1.000
#> GSM531687     2  0.8207      0.783 0.256 0.744
#> GSM531688     2  0.6048      0.859 0.148 0.852
#> GSM531690     2  0.0000      0.889 0.000 1.000
#> GSM531693     2  0.8144      0.787 0.252 0.748
#> GSM531695     2  0.6048      0.859 0.148 0.852
#> GSM531603     2  0.3431      0.862 0.064 0.936
#> GSM531609     1  0.6148      0.871 0.848 0.152
#> GSM531611     1  0.6148      0.871 0.848 0.152
#> GSM531621     1  0.0000      0.937 1.000 0.000
#> GSM531622     1  0.2423      0.924 0.960 0.040
#> GSM531628     1  0.0000      0.937 1.000 0.000
#> GSM531630     1  0.0000      0.937 1.000 0.000
#> GSM531633     1  0.0000      0.937 1.000 0.000
#> GSM531635     1  0.0000      0.937 1.000 0.000
#> GSM531640     1  0.0000      0.937 1.000 0.000
#> GSM531649     1  0.0000      0.937 1.000 0.000
#> GSM531653     1  0.0000      0.937 1.000 0.000
#> GSM531657     1  0.6048      0.874 0.852 0.148
#> GSM531665     2  0.5178      0.860 0.116 0.884
#> GSM531670     1  0.0000      0.937 1.000 0.000
#> GSM531674     2  0.8207      0.783 0.256 0.744
#> GSM531675     2  0.0000      0.889 0.000 1.000
#> GSM531677     2  0.0000      0.889 0.000 1.000
#> GSM531678     2  0.0000      0.889 0.000 1.000
#> GSM531680     2  0.6048      0.859 0.148 0.852
#> GSM531689     2  0.5408      0.867 0.124 0.876
#> GSM531691     2  0.6048      0.859 0.148 0.852
#> GSM531692     2  0.6048      0.859 0.148 0.852
#> GSM531694     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
#> GSM531602     2   0.141     0.8228 0.036 0.964 0.000
#> GSM531604     2   0.000     0.8312 0.000 1.000 0.000
#> GSM531606     2   0.141     0.8228 0.036 0.964 0.000
#> GSM531607     2   0.000     0.8312 0.000 1.000 0.000
#> GSM531608     3   0.711     0.5051 0.092 0.196 0.712
#> GSM531610     1   0.455     0.7539 0.800 0.200 0.000
#> GSM531612     1   0.455     0.7539 0.800 0.200 0.000
#> GSM531613     2   0.623    -0.0304 0.436 0.564 0.000
#> GSM531614     1   0.455     0.7539 0.800 0.200 0.000
#> GSM531616     3   0.593     0.4959 0.356 0.000 0.644
#> GSM531618     1   0.478     0.7542 0.796 0.200 0.004
#> GSM531619     3   0.186     0.7665 0.052 0.000 0.948
#> GSM531620     3   0.186     0.7665 0.052 0.000 0.948
#> GSM531623     3   0.186     0.7665 0.052 0.000 0.948
#> GSM531625     3   0.186     0.7665 0.052 0.000 0.948
#> GSM531626     3   0.497     0.6467 0.236 0.000 0.764
#> GSM531632     1   0.630    -0.3316 0.516 0.000 0.484
#> GSM531638     3   0.599     0.4751 0.368 0.000 0.632
#> GSM531639     1   0.502     0.6088 0.760 0.000 0.240
#> GSM531641     1   0.455     0.7539 0.800 0.200 0.000
#> GSM531642     1   0.478     0.6481 0.796 0.004 0.200
#> GSM531643     1   0.493     0.6137 0.768 0.000 0.232
#> GSM531644     1   0.584     0.6347 0.768 0.036 0.196
#> GSM531645     1   0.455     0.7539 0.800 0.200 0.000
#> GSM531646     1   0.630    -0.3316 0.516 0.000 0.484
#> GSM531647     1   0.630    -0.3316 0.516 0.000 0.484
#> GSM531648     1   0.478     0.7542 0.796 0.200 0.004
#> GSM531650     1   0.271     0.5504 0.912 0.000 0.088
#> GSM531651     3   0.186     0.7665 0.052 0.000 0.948
#> GSM531652     1   0.478     0.6481 0.796 0.004 0.200
#> GSM531656     1   0.589     0.6333 0.764 0.036 0.200
#> GSM531659     1   0.478     0.7542 0.796 0.200 0.004
#> GSM531661     3   0.210     0.7645 0.052 0.004 0.944
#> GSM531662     3   0.344     0.7309 0.088 0.016 0.896
#> GSM531663     1   0.455     0.7539 0.800 0.200 0.000
#> GSM531664     2   0.735     0.7082 0.316 0.632 0.052
#> GSM531666     1   0.600     0.6362 0.760 0.040 0.200
#> GSM531667     1   0.554     0.7414 0.776 0.200 0.024
#> GSM531668     1   0.455     0.7539 0.800 0.200 0.000
#> GSM531669     2   0.689     0.7580 0.256 0.692 0.052
#> GSM531671     3   0.629     0.3688 0.464 0.000 0.536
#> GSM531672     1   0.478     0.7542 0.796 0.200 0.004
#> GSM531673     1   0.630     0.3438 0.608 0.004 0.388
#> GSM531676     2   0.478     0.7959 0.200 0.796 0.004
#> GSM531679     2   0.000     0.8312 0.000 1.000 0.000
#> GSM531681     2   0.153     0.8208 0.040 0.960 0.000
#> GSM531682     2   0.141     0.8228 0.036 0.964 0.000
#> GSM531683     2   0.141     0.8228 0.036 0.964 0.000
#> GSM531684     2   0.699     0.4483 0.036 0.644 0.320
#> GSM531685     2   0.631     0.7813 0.200 0.748 0.052
#> GSM531686     2   0.000     0.8312 0.000 1.000 0.000
#> GSM531687     2   0.537     0.7835 0.252 0.744 0.004
#> GSM531688     2   0.631     0.7813 0.200 0.748 0.052
#> GSM531690     2   0.141     0.8228 0.036 0.964 0.000
#> GSM531693     2   0.640     0.7792 0.200 0.744 0.056
#> GSM531695     2   0.631     0.7813 0.200 0.748 0.052
#> GSM531603     2   0.196     0.8072 0.056 0.944 0.000
#> GSM531609     1   0.455     0.7539 0.800 0.200 0.000
#> GSM531611     1   0.470     0.7497 0.788 0.212 0.000
#> GSM531621     3   0.186     0.7665 0.052 0.000 0.948
#> GSM531622     3   0.186     0.7665 0.052 0.000 0.948
#> GSM531628     1   0.336     0.5453 0.908 0.036 0.056
#> GSM531630     3   0.620     0.0944 0.424 0.000 0.576
#> GSM531633     3   0.186     0.7665 0.052 0.000 0.948
#> GSM531635     3   0.601     0.4717 0.372 0.000 0.628
#> GSM531640     1   0.520     0.6148 0.760 0.004 0.236
#> GSM531649     3   0.573     0.4789 0.324 0.000 0.676
#> GSM531653     3   0.622     0.3722 0.432 0.000 0.568
#> GSM531657     1   0.478     0.7542 0.796 0.200 0.004
#> GSM531665     2   0.484     0.8101 0.168 0.816 0.016
#> GSM531670     1   0.589     0.6333 0.764 0.036 0.200
#> GSM531674     2   0.635     0.7805 0.204 0.744 0.052
#> GSM531675     2   0.141     0.8228 0.036 0.964 0.000
#> GSM531677     2   0.141     0.8228 0.036 0.964 0.000
#> GSM531678     2   0.000     0.8312 0.000 1.000 0.000
#> GSM531680     2   0.631     0.7813 0.200 0.748 0.052
#> GSM531689     2   0.490     0.8018 0.172 0.812 0.016
#> GSM531691     2   0.473     0.6922 0.004 0.800 0.196
#> GSM531692     2   0.455     0.7967 0.200 0.800 0.000
#> GSM531694     2   0.141     0.8228 0.036 0.964 0.000

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM531602     2  0.4624     0.4408 0.000 0.660 0.000 0.340
#> GSM531604     2  0.0592     0.6684 0.000 0.984 0.000 0.016
#> GSM531606     2  0.4643     0.4355 0.000 0.656 0.000 0.344
#> GSM531607     2  0.1557     0.6604 0.000 0.944 0.000 0.056
#> GSM531608     3  0.3681     0.6396 0.024 0.124 0.848 0.004
#> GSM531610     4  0.1022     0.6926 0.000 0.032 0.000 0.968
#> GSM531612     4  0.0376     0.6889 0.004 0.004 0.000 0.992
#> GSM531613     4  0.1792     0.6648 0.000 0.068 0.000 0.932
#> GSM531614     4  0.1022     0.6926 0.000 0.032 0.000 0.968
#> GSM531616     3  0.3498     0.7052 0.044 0.016 0.880 0.060
#> GSM531618     1  0.7676    -0.3565 0.444 0.136 0.016 0.404
#> GSM531619     3  0.0000     0.7801 0.000 0.000 1.000 0.000
#> GSM531620     3  0.0000     0.7801 0.000 0.000 1.000 0.000
#> GSM531623     3  0.0000     0.7801 0.000 0.000 1.000 0.000
#> GSM531625     3  0.0000     0.7801 0.000 0.000 1.000 0.000
#> GSM531626     3  0.1854     0.7449 0.012 0.000 0.940 0.048
#> GSM531632     1  0.5038     0.2752 0.652 0.012 0.336 0.000
#> GSM531638     3  0.3649     0.6973 0.044 0.016 0.872 0.068
#> GSM531639     1  0.7393     0.4072 0.632 0.100 0.200 0.068
#> GSM531641     4  0.0000     0.6891 0.000 0.000 0.000 1.000
#> GSM531642     1  0.7909    -0.0565 0.476 0.028 0.140 0.356
#> GSM531643     1  0.4586     0.4703 0.796 0.000 0.136 0.068
#> GSM531644     1  0.4636     0.4675 0.792 0.000 0.140 0.068
#> GSM531645     4  0.0188     0.6906 0.000 0.004 0.000 0.996
#> GSM531646     1  0.5038     0.2752 0.652 0.012 0.336 0.000
#> GSM531647     1  0.5038     0.2752 0.652 0.012 0.336 0.000
#> GSM531648     4  0.7431     0.4613 0.336 0.124 0.016 0.524
#> GSM531650     1  0.0779     0.4933 0.980 0.004 0.000 0.016
#> GSM531651     3  0.0000     0.7801 0.000 0.000 1.000 0.000
#> GSM531652     1  0.5375     0.4410 0.744 0.000 0.140 0.116
#> GSM531656     1  0.8467     0.3306 0.480 0.312 0.140 0.068
#> GSM531659     4  0.8214     0.3864 0.336 0.236 0.016 0.412
#> GSM531661     3  0.0188     0.7781 0.000 0.004 0.996 0.000
#> GSM531662     3  0.0672     0.7738 0.008 0.008 0.984 0.000
#> GSM531663     4  0.3695     0.6451 0.016 0.156 0.000 0.828
#> GSM531664     1  0.4193     0.2692 0.732 0.268 0.000 0.000
#> GSM531666     1  0.8188     0.3838 0.544 0.248 0.140 0.068
#> GSM531667     1  0.9578    -0.2255 0.348 0.124 0.244 0.284
#> GSM531668     4  0.6911     0.4755 0.336 0.124 0.000 0.540
#> GSM531669     1  0.4543     0.1571 0.676 0.324 0.000 0.000
#> GSM531671     3  0.8073     0.0519 0.256 0.012 0.448 0.284
#> GSM531672     4  0.7431     0.4613 0.336 0.124 0.016 0.524
#> GSM531673     4  0.8577     0.0941 0.344 0.028 0.272 0.356
#> GSM531676     2  0.3356     0.6252 0.176 0.824 0.000 0.000
#> GSM531679     2  0.0921     0.6681 0.000 0.972 0.000 0.028
#> GSM531681     4  0.4103     0.4369 0.000 0.256 0.000 0.744
#> GSM531682     2  0.4643     0.4355 0.000 0.656 0.000 0.344
#> GSM531683     2  0.4643     0.4355 0.000 0.656 0.000 0.344
#> GSM531684     3  0.5780    -0.0492 0.000 0.476 0.496 0.028
#> GSM531685     2  0.3837     0.5998 0.224 0.776 0.000 0.000
#> GSM531686     2  0.2868     0.6207 0.000 0.864 0.000 0.136
#> GSM531687     2  0.4954     0.6066 0.144 0.788 0.016 0.052
#> GSM531688     2  0.3837     0.5998 0.224 0.776 0.000 0.000
#> GSM531690     2  0.4643     0.4355 0.000 0.656 0.000 0.344
#> GSM531693     2  0.4283     0.5752 0.256 0.740 0.004 0.000
#> GSM531695     2  0.3837     0.5998 0.224 0.776 0.000 0.000
#> GSM531603     2  0.5175     0.4595 0.004 0.656 0.012 0.328
#> GSM531609     4  0.1022     0.6926 0.000 0.032 0.000 0.968
#> GSM531611     4  0.2466     0.6436 0.004 0.096 0.000 0.900
#> GSM531621     3  0.0000     0.7801 0.000 0.000 1.000 0.000
#> GSM531622     3  0.0000     0.7801 0.000 0.000 1.000 0.000
#> GSM531628     1  0.0469     0.4941 0.988 0.012 0.000 0.000
#> GSM531630     3  0.4564     0.3418 0.328 0.000 0.672 0.000
#> GSM531633     3  0.0000     0.7801 0.000 0.000 1.000 0.000
#> GSM531635     3  0.6951    -0.1328 0.440 0.016 0.476 0.068
#> GSM531640     3  0.6863     0.1943 0.348 0.020 0.564 0.068
#> GSM531649     1  0.6013     0.0975 0.508 0.016 0.460 0.016
#> GSM531653     1  0.5268     0.2147 0.592 0.012 0.396 0.000
#> GSM531657     4  0.8214     0.3864 0.336 0.236 0.016 0.412
#> GSM531665     2  0.4117     0.6332 0.116 0.832 0.004 0.048
#> GSM531670     2  0.8554    -0.1954 0.348 0.444 0.140 0.068
#> GSM531674     1  0.4643     0.1106 0.656 0.344 0.000 0.000
#> GSM531675     2  0.4643     0.4355 0.000 0.656 0.000 0.344
#> GSM531677     2  0.4643     0.4355 0.000 0.656 0.000 0.344
#> GSM531678     2  0.0921     0.6681 0.000 0.972 0.000 0.028
#> GSM531680     2  0.3356     0.6318 0.176 0.824 0.000 0.000
#> GSM531689     2  0.2799     0.6488 0.108 0.884 0.008 0.000
#> GSM531691     2  0.2888     0.5839 0.004 0.872 0.124 0.000
#> GSM531692     2  0.3636     0.6245 0.172 0.820 0.008 0.000
#> GSM531694     2  0.4624     0.4408 0.000 0.660 0.000 0.340

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>           class entropy silhouette    p1    p2    p3    p4    p5
#> GSM531602     2  0.1608     0.7514 0.000 0.928 0.000 0.000 0.072
#> GSM531604     2  0.4210     0.3308 0.000 0.588 0.000 0.000 0.412
#> GSM531606     2  0.4300     0.3130 0.000 0.524 0.000 0.000 0.476
#> GSM531607     2  0.0794     0.7438 0.000 0.972 0.000 0.000 0.028
#> GSM531608     3  0.4192     0.6981 0.000 0.000 0.596 0.000 0.404
#> GSM531610     4  0.0000     0.9846 0.000 0.000 0.000 1.000 0.000
#> GSM531612     4  0.0000     0.9846 0.000 0.000 0.000 1.000 0.000
#> GSM531613     4  0.0000     0.9846 0.000 0.000 0.000 1.000 0.000
#> GSM531614     4  0.0000     0.9846 0.000 0.000 0.000 1.000 0.000
#> GSM531616     5  0.5293     0.4099 0.048 0.000 0.460 0.000 0.492
#> GSM531618     5  0.4973     0.4494 0.408 0.024 0.004 0.000 0.564
#> GSM531619     3  0.4192     0.6981 0.000 0.000 0.596 0.000 0.404
#> GSM531620     3  0.0000     0.6513 0.000 0.000 1.000 0.000 0.000
#> GSM531623     3  0.4192     0.6981 0.000 0.000 0.596 0.000 0.404
#> GSM531625     3  0.0000     0.6513 0.000 0.000 1.000 0.000 0.000
#> GSM531626     3  0.4451    -0.1192 0.016 0.000 0.644 0.000 0.340
#> GSM531632     1  0.4192     0.3663 0.596 0.000 0.404 0.000 0.000
#> GSM531638     5  0.5232     0.4177 0.044 0.000 0.456 0.000 0.500
#> GSM531639     5  0.6216     0.4926 0.096 0.016 0.372 0.000 0.516
#> GSM531641     4  0.0000     0.9846 0.000 0.000 0.000 1.000 0.000
#> GSM531642     5  0.4489     0.4422 0.420 0.008 0.000 0.000 0.572
#> GSM531643     1  0.4307    -0.4240 0.504 0.000 0.000 0.000 0.496
#> GSM531644     1  0.4307    -0.4240 0.504 0.000 0.000 0.000 0.496
#> GSM531645     4  0.0000     0.9846 0.000 0.000 0.000 1.000 0.000
#> GSM531646     1  0.4192     0.3663 0.596 0.000 0.404 0.000 0.000
#> GSM531647     1  0.1410     0.5741 0.940 0.000 0.060 0.000 0.000
#> GSM531648     5  0.5896     0.3920 0.060 0.024 0.000 0.352 0.564
#> GSM531650     1  0.1341     0.5134 0.944 0.000 0.000 0.000 0.056
#> GSM531651     3  0.4192     0.6981 0.000 0.000 0.596 0.000 0.404
#> GSM531652     5  0.4811     0.4184 0.452 0.020 0.000 0.000 0.528
#> GSM531656     5  0.5568     0.4239 0.412 0.072 0.000 0.000 0.516
#> GSM531659     5  0.5341     0.2769 0.060 0.376 0.000 0.000 0.564
#> GSM531661     3  0.4192     0.6981 0.000 0.000 0.596 0.000 0.404
#> GSM531662     3  0.4192     0.6981 0.000 0.000 0.596 0.000 0.404
#> GSM531663     4  0.2362     0.8680 0.000 0.024 0.000 0.900 0.076
#> GSM531664     1  0.1430     0.5747 0.944 0.052 0.000 0.000 0.004
#> GSM531666     5  0.5568     0.4239 0.412 0.072 0.000 0.000 0.516
#> GSM531667     5  0.1485     0.3277 0.000 0.020 0.032 0.000 0.948
#> GSM531668     5  0.5403     0.2174 0.060 0.024 0.000 0.244 0.672
#> GSM531669     1  0.1410     0.5843 0.940 0.060 0.000 0.000 0.000
#> GSM531671     1  0.4675     0.2334 0.544 0.004 0.008 0.000 0.444
#> GSM531672     5  0.5896     0.3920 0.060 0.024 0.000 0.352 0.564
#> GSM531673     5  0.3821    -0.1167 0.000 0.020 0.216 0.000 0.764
#> GSM531676     2  0.2848     0.6481 0.104 0.868 0.000 0.000 0.028
#> GSM531679     2  0.0000     0.7351 0.000 1.000 0.000 0.000 0.000
#> GSM531681     2  0.5188     0.2225 0.000 0.540 0.000 0.416 0.044
#> GSM531682     2  0.1608     0.7514 0.000 0.928 0.000 0.000 0.072
#> GSM531683     2  0.1608     0.7514 0.000 0.928 0.000 0.000 0.072
#> GSM531684     3  0.4674     0.6751 0.000 0.016 0.568 0.000 0.416
#> GSM531685     1  0.4562     0.1231 0.500 0.492 0.000 0.000 0.008
#> GSM531686     2  0.1410     0.7505 0.000 0.940 0.000 0.000 0.060
#> GSM531687     2  0.5176    -0.0995 0.040 0.492 0.000 0.000 0.468
#> GSM531688     1  0.4561     0.1324 0.504 0.488 0.000 0.000 0.008
#> GSM531690     2  0.1608     0.7514 0.000 0.928 0.000 0.000 0.072
#> GSM531693     1  0.4670     0.1988 0.548 0.440 0.004 0.000 0.008
#> GSM531695     1  0.4562     0.1136 0.496 0.496 0.000 0.000 0.008
#> GSM531603     2  0.4256     0.1897 0.000 0.564 0.000 0.000 0.436
#> GSM531609     4  0.0000     0.9846 0.000 0.000 0.000 1.000 0.000
#> GSM531611     4  0.0000     0.9846 0.000 0.000 0.000 1.000 0.000
#> GSM531621     3  0.0000     0.6513 0.000 0.000 1.000 0.000 0.000
#> GSM531622     3  0.0000     0.6513 0.000 0.000 1.000 0.000 0.000
#> GSM531628     1  0.0000     0.5578 1.000 0.000 0.000 0.000 0.000
#> GSM531630     3  0.1410     0.6201 0.060 0.000 0.940 0.000 0.000
#> GSM531633     3  0.0000     0.6513 0.000 0.000 1.000 0.000 0.000
#> GSM531635     5  0.5826     0.4516 0.096 0.000 0.404 0.000 0.500
#> GSM531640     5  0.5443     0.4417 0.060 0.000 0.436 0.000 0.504
#> GSM531649     1  0.3688     0.5231 0.816 0.000 0.124 0.000 0.060
#> GSM531653     1  0.1410     0.5741 0.940 0.000 0.060 0.000 0.000
#> GSM531657     5  0.5479     0.2828 0.060 0.372 0.000 0.004 0.564
#> GSM531665     2  0.6131     0.2421 0.208 0.564 0.000 0.000 0.228
#> GSM531670     5  0.5467     0.2741 0.064 0.412 0.000 0.000 0.524
#> GSM531674     1  0.1410     0.5843 0.940 0.060 0.000 0.000 0.000
#> GSM531675     2  0.1608     0.7514 0.000 0.928 0.000 0.000 0.072
#> GSM531677     2  0.1608     0.7514 0.000 0.928 0.000 0.000 0.072
#> GSM531678     2  0.0290     0.7329 0.000 0.992 0.000 0.000 0.008
#> GSM531680     2  0.4380     0.1544 0.376 0.616 0.000 0.000 0.008
#> GSM531689     2  0.0955     0.7222 0.004 0.968 0.000 0.000 0.028
#> GSM531691     2  0.0955     0.7222 0.004 0.968 0.000 0.000 0.028
#> GSM531692     2  0.5531     0.2617 0.056 0.508 0.004 0.000 0.432
#> GSM531694     2  0.1608     0.7514 0.000 0.928 0.000 0.000 0.072

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>           class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM531602     2  0.2491    0.86900 0.000 0.836 0.000 0.000 0.164 0.000
#> GSM531604     2  0.3266    0.78485 0.000 0.728 0.000 0.000 0.272 0.000
#> GSM531606     5  0.3737   -0.16922 0.000 0.392 0.000 0.000 0.608 0.000
#> GSM531607     2  0.2378    0.87748 0.000 0.848 0.000 0.000 0.152 0.000
#> GSM531608     3  0.3810    0.33679 0.000 0.000 0.572 0.000 0.428 0.000
#> GSM531610     4  0.0000    0.96543 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM531612     4  0.0000    0.96543 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM531613     4  0.0000    0.96543 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM531614     4  0.0000    0.96543 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM531616     3  0.5961    0.09185 0.232 0.000 0.432 0.000 0.000 0.336
#> GSM531618     6  0.3773    0.68774 0.204 0.044 0.000 0.000 0.000 0.752
#> GSM531619     3  0.3810    0.33679 0.000 0.000 0.572 0.000 0.428 0.000
#> GSM531620     3  0.0000    0.54297 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM531623     3  0.3810    0.33679 0.000 0.000 0.572 0.000 0.428 0.000
#> GSM531625     3  0.0000    0.54297 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM531626     3  0.5374    0.08139 0.116 0.000 0.504 0.000 0.000 0.380
#> GSM531632     1  0.3737    0.34366 0.608 0.000 0.392 0.000 0.000 0.000
#> GSM531638     3  0.5877    0.04824 0.200 0.000 0.428 0.000 0.000 0.372
#> GSM531639     6  0.2854    0.58235 0.000 0.000 0.208 0.000 0.000 0.792
#> GSM531641     4  0.0000    0.96543 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM531642     6  0.2823    0.68898 0.204 0.000 0.000 0.000 0.000 0.796
#> GSM531643     6  0.3371    0.62408 0.292 0.000 0.000 0.000 0.000 0.708
#> GSM531644     6  0.2969    0.68123 0.224 0.000 0.000 0.000 0.000 0.776
#> GSM531645     4  0.0000    0.96543 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM531646     1  0.3810    0.29251 0.572 0.000 0.428 0.000 0.000 0.000
#> GSM531647     1  0.0000    0.60822 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM531648     6  0.4587    0.61087 0.000 0.108 0.000 0.204 0.000 0.688
#> GSM531650     1  0.3515    0.19168 0.676 0.000 0.000 0.000 0.000 0.324
#> GSM531651     3  0.3810    0.33679 0.000 0.000 0.572 0.000 0.428 0.000
#> GSM531652     6  0.3261    0.69042 0.204 0.016 0.000 0.000 0.000 0.780
#> GSM531656     6  0.2964    0.68849 0.204 0.000 0.000 0.000 0.004 0.792
#> GSM531659     6  0.3464    0.58308 0.000 0.312 0.000 0.000 0.000 0.688
#> GSM531661     3  0.3810    0.33679 0.000 0.000 0.572 0.000 0.428 0.000
#> GSM531662     5  0.3860   -0.30685 0.000 0.000 0.472 0.000 0.528 0.000
#> GSM531663     4  0.2915    0.79719 0.000 0.184 0.000 0.808 0.000 0.008
#> GSM531664     1  0.3314    0.44936 0.764 0.000 0.000 0.000 0.224 0.012
#> GSM531666     6  0.2964    0.68849 0.204 0.000 0.000 0.000 0.004 0.792
#> GSM531667     6  0.4913    0.25141 0.000 0.028 0.020 0.000 0.428 0.524
#> GSM531668     6  0.6785    0.40201 0.000 0.108 0.000 0.124 0.300 0.468
#> GSM531669     1  0.0363    0.60747 0.988 0.000 0.000 0.000 0.012 0.000
#> GSM531671     1  0.3823    0.22814 0.564 0.000 0.000 0.000 0.436 0.000
#> GSM531672     6  0.5310    0.59221 0.000 0.108 0.000 0.204 0.032 0.656
#> GSM531673     5  0.5633   -0.14976 0.000 0.000 0.196 0.000 0.532 0.272
#> GSM531676     5  0.6077   -0.02657 0.368 0.004 0.000 0.000 0.408 0.220
#> GSM531679     2  0.1957    0.85965 0.000 0.888 0.000 0.000 0.112 0.000
#> GSM531681     2  0.1957    0.83360 0.000 0.888 0.000 0.112 0.000 0.000
#> GSM531682     2  0.0146    0.89987 0.000 0.996 0.000 0.000 0.000 0.004
#> GSM531683     2  0.1501    0.88104 0.000 0.924 0.000 0.000 0.076 0.000
#> GSM531684     5  0.4107   -0.28555 0.000 0.004 0.452 0.000 0.540 0.004
#> GSM531685     1  0.5900   -0.04431 0.412 0.000 0.000 0.000 0.384 0.204
#> GSM531686     2  0.0405    0.89824 0.000 0.988 0.000 0.000 0.008 0.004
#> GSM531687     5  0.5986    0.11039 0.232 0.000 0.000 0.000 0.408 0.360
#> GSM531688     1  0.5543    0.22201 0.556 0.000 0.000 0.000 0.240 0.204
#> GSM531690     2  0.0146    0.89987 0.000 0.996 0.000 0.000 0.000 0.004
#> GSM531693     1  0.3171    0.48823 0.784 0.000 0.000 0.000 0.012 0.204
#> GSM531695     1  0.5883    0.00622 0.436 0.000 0.000 0.000 0.360 0.204
#> GSM531603     6  0.5391   -0.13007 0.000 0.112 0.000 0.000 0.432 0.456
#> GSM531609     4  0.0000    0.96543 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM531611     4  0.1501    0.90673 0.000 0.076 0.000 0.924 0.000 0.000
#> GSM531621     3  0.0000    0.54297 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM531622     3  0.0000    0.54297 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM531628     1  0.2597    0.46600 0.824 0.000 0.000 0.000 0.000 0.176
#> GSM531630     3  0.2969    0.41499 0.000 0.000 0.776 0.000 0.000 0.224
#> GSM531633     3  0.0000    0.54297 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM531635     3  0.5966    0.08407 0.232 0.000 0.428 0.000 0.000 0.340
#> GSM531640     6  0.2941    0.57684 0.000 0.000 0.220 0.000 0.000 0.780
#> GSM531649     1  0.3720    0.47326 0.736 0.000 0.236 0.000 0.000 0.028
#> GSM531653     1  0.0000    0.60822 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM531657     6  0.3464    0.58308 0.000 0.312 0.000 0.000 0.000 0.688
#> GSM531665     6  0.3945    0.01299 0.008 0.000 0.000 0.000 0.380 0.612
#> GSM531670     6  0.0363    0.61796 0.000 0.000 0.000 0.000 0.012 0.988
#> GSM531674     1  0.0363    0.60747 0.988 0.000 0.000 0.000 0.012 0.000
#> GSM531675     2  0.0146    0.89987 0.000 0.996 0.000 0.000 0.000 0.004
#> GSM531677     2  0.0146    0.89987 0.000 0.996 0.000 0.000 0.000 0.004
#> GSM531678     5  0.5798    0.25723 0.000 0.312 0.000 0.000 0.484 0.204
#> GSM531680     5  0.6906    0.07064 0.320 0.068 0.000 0.000 0.408 0.204
#> GSM531689     5  0.5767    0.26305 0.000 0.300 0.000 0.000 0.496 0.204
#> GSM531691     5  0.6927    0.27584 0.152 0.148 0.000 0.000 0.496 0.204
#> GSM531692     5  0.1745    0.29862 0.056 0.020 0.000 0.000 0.924 0.000
#> GSM531694     2  0.2416    0.87380 0.000 0.844 0.000 0.000 0.156 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-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)
#> Error in mat[ceiling(1:nr/h_ratio), ceiling(1:nc/w_ratio), drop = FALSE]: subscript out of bounds

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

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

collect_plots(res)

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.463           0.827       0.894         0.3035 0.742   0.742
#> 3 3 0.403           0.695       0.820         0.5087 0.723   0.655
#> 4 4 0.928           0.917       0.962         0.6378 0.572   0.324
#> 5 5 0.847           0.864       0.927         0.0668 0.925   0.712
#> 6 6 0.860           0.880       0.918         0.0345 0.941   0.726

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

suggest_best_k(res)
#> [1] 4

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

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

show/hide code output

cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#>           class entropy silhouette    p1    p2
#> GSM531602     2  0.0000      0.868 0.000 1.000
#> GSM531604     2  0.0000      0.868 0.000 1.000
#> GSM531606     2  0.0000      0.868 0.000 1.000
#> GSM531607     2  0.0000      0.868 0.000 1.000
#> GSM531608     2  0.7453      0.785 0.212 0.788
#> GSM531610     2  0.0376      0.866 0.004 0.996
#> GSM531612     2  0.2603      0.841 0.044 0.956
#> GSM531613     2  0.0000      0.868 0.000 1.000
#> GSM531614     2  0.2236      0.842 0.036 0.964
#> GSM531616     1  0.6623      0.845 0.828 0.172
#> GSM531618     2  0.0000      0.868 0.000 1.000
#> GSM531619     1  0.9170      0.474 0.668 0.332
#> GSM531620     1  0.6247      0.865 0.844 0.156
#> GSM531623     1  0.2236      0.898 0.964 0.036
#> GSM531625     1  0.5294      0.884 0.880 0.120
#> GSM531626     1  0.6247      0.865 0.844 0.156
#> GSM531632     2  0.8016      0.766 0.244 0.756
#> GSM531638     1  0.5946      0.873 0.856 0.144
#> GSM531639     2  0.8016      0.766 0.244 0.756
#> GSM531641     2  0.2603      0.841 0.044 0.956
#> GSM531642     2  0.8144      0.759 0.252 0.748
#> GSM531643     2  0.8207      0.755 0.256 0.744
#> GSM531644     2  0.8016      0.767 0.244 0.756
#> GSM531645     2  0.2236      0.842 0.036 0.964
#> GSM531646     2  0.8207      0.755 0.256 0.744
#> GSM531647     2  0.8207      0.755 0.256 0.744
#> GSM531648     2  0.2603      0.841 0.044 0.956
#> GSM531650     2  0.8207      0.755 0.256 0.744
#> GSM531651     1  0.2236      0.898 0.964 0.036
#> GSM531652     2  0.3431      0.856 0.064 0.936
#> GSM531656     2  0.8016      0.766 0.244 0.756
#> GSM531659     2  0.0000      0.868 0.000 1.000
#> GSM531661     2  0.7883      0.771 0.236 0.764
#> GSM531662     2  0.5408      0.832 0.124 0.876
#> GSM531663     2  0.0000      0.868 0.000 1.000
#> GSM531664     2  0.8016      0.766 0.244 0.756
#> GSM531666     2  0.4161      0.850 0.084 0.916
#> GSM531667     2  0.8327      0.746 0.264 0.736
#> GSM531668     2  0.0000      0.868 0.000 1.000
#> GSM531669     2  0.8016      0.766 0.244 0.756
#> GSM531671     2  0.8016      0.766 0.244 0.756
#> GSM531672     2  0.0000      0.868 0.000 1.000
#> GSM531673     2  0.1633      0.866 0.024 0.976
#> GSM531676     2  0.1843      0.865 0.028 0.972
#> GSM531679     2  0.0000      0.868 0.000 1.000
#> GSM531681     2  0.0000      0.868 0.000 1.000
#> GSM531682     2  0.0000      0.868 0.000 1.000
#> GSM531683     2  0.0000      0.868 0.000 1.000
#> GSM531684     2  0.0000      0.868 0.000 1.000
#> GSM531685     2  0.3431      0.856 0.064 0.936
#> GSM531686     2  0.0000      0.868 0.000 1.000
#> GSM531687     2  0.1843      0.865 0.028 0.972
#> GSM531688     2  0.8016      0.766 0.244 0.756
#> GSM531690     2  0.0000      0.868 0.000 1.000
#> GSM531693     2  0.8016      0.766 0.244 0.756
#> GSM531695     2  0.7376      0.788 0.208 0.792
#> GSM531603     2  0.0000      0.868 0.000 1.000
#> GSM531609     2  0.2423      0.842 0.040 0.960
#> GSM531611     2  0.0000      0.868 0.000 1.000
#> GSM531621     1  0.2236      0.898 0.964 0.036
#> GSM531622     1  0.2236      0.898 0.964 0.036
#> GSM531628     2  0.8081      0.762 0.248 0.752
#> GSM531630     1  0.2236      0.898 0.964 0.036
#> GSM531633     1  0.2236      0.898 0.964 0.036
#> GSM531635     2  0.8207      0.755 0.256 0.744
#> GSM531640     2  0.9552      0.564 0.376 0.624
#> GSM531649     2  0.8207      0.755 0.256 0.744
#> GSM531653     2  0.8207      0.755 0.256 0.744
#> GSM531657     2  0.0000      0.868 0.000 1.000
#> GSM531665     2  0.1633      0.866 0.024 0.976
#> GSM531670     2  0.8016      0.766 0.244 0.756
#> GSM531674     2  0.8016      0.766 0.244 0.756
#> GSM531675     2  0.0000      0.868 0.000 1.000
#> GSM531677     2  0.0000      0.868 0.000 1.000
#> GSM531678     2  0.0000      0.868 0.000 1.000
#> GSM531680     2  0.3733      0.853 0.072 0.928
#> GSM531689     2  0.0000      0.868 0.000 1.000
#> GSM531691     2  0.0000      0.868 0.000 1.000
#> GSM531692     2  0.0376      0.868 0.004 0.996
#> GSM531694     2  0.0000      0.868 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
#> GSM531602     2  0.0237      0.788 0.004 0.996 0.000
#> GSM531604     2  0.0000      0.789 0.000 1.000 0.000
#> GSM531606     2  0.0237      0.788 0.004 0.996 0.000
#> GSM531607     2  0.0237      0.788 0.004 0.996 0.000
#> GSM531608     3  0.6154      0.150 0.000 0.408 0.592
#> GSM531610     1  0.6291      0.696 0.532 0.468 0.000
#> GSM531612     1  0.5621      0.903 0.692 0.308 0.000
#> GSM531613     2  0.6307     -0.625 0.488 0.512 0.000
#> GSM531614     1  0.5621      0.903 0.692 0.308 0.000
#> GSM531616     2  0.6126      0.458 0.000 0.600 0.400
#> GSM531618     2  0.3644      0.699 0.124 0.872 0.004
#> GSM531619     3  0.4002      0.640 0.000 0.160 0.840
#> GSM531620     3  0.1289      0.752 0.000 0.032 0.968
#> GSM531623     3  0.0000      0.767 0.000 0.000 1.000
#> GSM531625     2  0.6192      0.416 0.000 0.580 0.420
#> GSM531626     3  0.6305     -0.174 0.000 0.484 0.516
#> GSM531632     2  0.7391      0.614 0.308 0.636 0.056
#> GSM531638     2  0.6192      0.414 0.000 0.580 0.420
#> GSM531639     2  0.5455      0.710 0.028 0.788 0.184
#> GSM531641     1  0.5621      0.903 0.692 0.308 0.000
#> GSM531642     2  0.5004      0.738 0.088 0.840 0.072
#> GSM531643     2  0.6662      0.694 0.192 0.736 0.072
#> GSM531644     2  0.4489      0.773 0.108 0.856 0.036
#> GSM531645     1  0.5621      0.903 0.692 0.308 0.000
#> GSM531646     2  0.7640      0.638 0.240 0.664 0.096
#> GSM531647     2  0.7841      0.614 0.272 0.636 0.092
#> GSM531648     1  0.5621      0.903 0.692 0.308 0.000
#> GSM531650     2  0.7424      0.618 0.300 0.640 0.060
#> GSM531651     3  0.0000      0.767 0.000 0.000 1.000
#> GSM531652     2  0.4293      0.709 0.164 0.832 0.004
#> GSM531656     2  0.5791      0.729 0.148 0.792 0.060
#> GSM531659     2  0.1964      0.772 0.056 0.944 0.000
#> GSM531661     2  0.3686      0.701 0.000 0.860 0.140
#> GSM531662     2  0.1289      0.787 0.000 0.968 0.032
#> GSM531663     2  0.3340      0.708 0.120 0.880 0.000
#> GSM531664     2  0.7301      0.615 0.308 0.640 0.052
#> GSM531666     2  0.2772      0.782 0.080 0.916 0.004
#> GSM531667     3  0.5138      0.489 0.000 0.252 0.748
#> GSM531668     2  0.2356      0.761 0.072 0.928 0.000
#> GSM531669     2  0.7301      0.615 0.308 0.640 0.052
#> GSM531671     2  0.1289      0.791 0.032 0.968 0.000
#> GSM531672     1  0.6305      0.658 0.516 0.484 0.000
#> GSM531673     2  0.0848      0.791 0.008 0.984 0.008
#> GSM531676     2  0.1289      0.791 0.032 0.968 0.000
#> GSM531679     2  0.0237      0.788 0.004 0.996 0.000
#> GSM531681     2  0.1964      0.772 0.056 0.944 0.000
#> GSM531682     2  0.0237      0.788 0.004 0.996 0.000
#> GSM531683     2  0.1289      0.782 0.032 0.968 0.000
#> GSM531684     2  0.0237      0.789 0.000 0.996 0.004
#> GSM531685     2  0.1529      0.790 0.040 0.960 0.000
#> GSM531686     2  0.1964      0.772 0.056 0.944 0.000
#> GSM531687     2  0.0892      0.791 0.020 0.980 0.000
#> GSM531688     2  0.4654      0.701 0.208 0.792 0.000
#> GSM531690     2  0.1964      0.772 0.056 0.944 0.000
#> GSM531693     2  0.5656      0.646 0.284 0.712 0.004
#> GSM531695     2  0.2959      0.769 0.100 0.900 0.000
#> GSM531603     2  0.1964      0.772 0.056 0.944 0.000
#> GSM531609     1  0.5621      0.903 0.692 0.308 0.000
#> GSM531611     2  0.2959      0.733 0.100 0.900 0.000
#> GSM531621     3  0.0000      0.767 0.000 0.000 1.000
#> GSM531622     3  0.0000      0.767 0.000 0.000 1.000
#> GSM531628     2  0.7391      0.614 0.308 0.636 0.056
#> GSM531630     3  0.0000      0.767 0.000 0.000 1.000
#> GSM531633     3  0.0000      0.767 0.000 0.000 1.000
#> GSM531635     2  0.7640      0.638 0.240 0.664 0.096
#> GSM531640     3  0.4452      0.595 0.000 0.192 0.808
#> GSM531649     2  0.7640      0.638 0.240 0.664 0.096
#> GSM531653     2  0.7677      0.632 0.252 0.656 0.092
#> GSM531657     2  0.3412      0.702 0.124 0.876 0.000
#> GSM531665     2  0.0892      0.791 0.020 0.980 0.000
#> GSM531670     2  0.5696      0.730 0.148 0.796 0.056
#> GSM531674     2  0.7301      0.615 0.308 0.640 0.052
#> GSM531675     2  0.1964      0.772 0.056 0.944 0.000
#> GSM531677     2  0.0237      0.788 0.004 0.996 0.000
#> GSM531678     2  0.0237      0.788 0.004 0.996 0.000
#> GSM531680     2  0.1753      0.787 0.048 0.952 0.000
#> GSM531689     2  0.0000      0.789 0.000 1.000 0.000
#> GSM531691     2  0.0000      0.789 0.000 1.000 0.000
#> GSM531692     2  0.0892      0.791 0.020 0.980 0.000
#> GSM531694     2  0.0237      0.788 0.004 0.996 0.000

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM531602     2  0.0000      0.963 0.000 1.000 0.000 0.000
#> GSM531604     2  0.0000      0.963 0.000 1.000 0.000 0.000
#> GSM531606     2  0.0000      0.963 0.000 1.000 0.000 0.000
#> GSM531607     2  0.0000      0.963 0.000 1.000 0.000 0.000
#> GSM531608     3  0.0469      0.957 0.000 0.012 0.988 0.000
#> GSM531610     4  0.0000      0.938 0.000 0.000 0.000 1.000
#> GSM531612     4  0.0000      0.938 0.000 0.000 0.000 1.000
#> GSM531613     4  0.0188      0.938 0.000 0.004 0.000 0.996
#> GSM531614     4  0.0000      0.938 0.000 0.000 0.000 1.000
#> GSM531616     3  0.0000      0.965 0.000 0.000 1.000 0.000
#> GSM531618     4  0.1398      0.914 0.000 0.004 0.040 0.956
#> GSM531619     3  0.0188      0.962 0.000 0.004 0.996 0.000
#> GSM531620     3  0.0000      0.965 0.000 0.000 1.000 0.000
#> GSM531623     3  0.0000      0.965 0.000 0.000 1.000 0.000
#> GSM531625     3  0.0000      0.965 0.000 0.000 1.000 0.000
#> GSM531626     3  0.0000      0.965 0.000 0.000 1.000 0.000
#> GSM531632     1  0.0000      0.958 1.000 0.000 0.000 0.000
#> GSM531638     3  0.0000      0.965 0.000 0.000 1.000 0.000
#> GSM531639     1  0.4655      0.569 0.684 0.004 0.312 0.000
#> GSM531641     4  0.0000      0.938 0.000 0.000 0.000 1.000
#> GSM531642     1  0.3791      0.763 0.796 0.000 0.200 0.004
#> GSM531643     1  0.0592      0.960 0.984 0.000 0.016 0.000
#> GSM531644     1  0.0592      0.960 0.984 0.000 0.016 0.000
#> GSM531645     4  0.0000      0.938 0.000 0.000 0.000 1.000
#> GSM531646     1  0.0592      0.960 0.984 0.000 0.016 0.000
#> GSM531647     1  0.0592      0.960 0.984 0.000 0.016 0.000
#> GSM531648     4  0.0188      0.938 0.000 0.004 0.000 0.996
#> GSM531650     1  0.0188      0.959 0.996 0.000 0.004 0.000
#> GSM531651     3  0.0000      0.965 0.000 0.000 1.000 0.000
#> GSM531652     4  0.5134      0.518 0.320 0.004 0.012 0.664
#> GSM531656     1  0.2530      0.885 0.896 0.004 0.100 0.000
#> GSM531659     4  0.3688      0.765 0.000 0.208 0.000 0.792
#> GSM531661     3  0.0592      0.953 0.000 0.016 0.984 0.000
#> GSM531662     3  0.2281      0.869 0.000 0.096 0.904 0.000
#> GSM531663     4  0.2973      0.842 0.000 0.144 0.000 0.856
#> GSM531664     1  0.0000      0.958 1.000 0.000 0.000 0.000
#> GSM531666     1  0.0992      0.956 0.976 0.004 0.012 0.008
#> GSM531667     3  0.0336      0.960 0.000 0.008 0.992 0.000
#> GSM531668     4  0.0592      0.934 0.000 0.016 0.000 0.984
#> GSM531669     1  0.0000      0.958 1.000 0.000 0.000 0.000
#> GSM531671     3  0.5352      0.335 0.388 0.016 0.596 0.000
#> GSM531672     4  0.0188      0.938 0.000 0.004 0.000 0.996
#> GSM531673     2  0.0000      0.963 0.000 1.000 0.000 0.000
#> GSM531676     2  0.1211      0.930 0.040 0.960 0.000 0.000
#> GSM531679     2  0.0000      0.963 0.000 1.000 0.000 0.000
#> GSM531681     2  0.1557      0.920 0.000 0.944 0.000 0.056
#> GSM531682     2  0.0000      0.963 0.000 1.000 0.000 0.000
#> GSM531683     2  0.0000      0.963 0.000 1.000 0.000 0.000
#> GSM531684     2  0.0000      0.963 0.000 1.000 0.000 0.000
#> GSM531685     2  0.4888      0.321 0.412 0.588 0.000 0.000
#> GSM531686     2  0.0188      0.961 0.000 0.996 0.000 0.004
#> GSM531687     2  0.0188      0.961 0.004 0.996 0.000 0.000
#> GSM531688     1  0.0000      0.958 1.000 0.000 0.000 0.000
#> GSM531690     2  0.1557      0.918 0.000 0.944 0.000 0.056
#> GSM531693     1  0.0592      0.953 0.984 0.016 0.000 0.000
#> GSM531695     1  0.0592      0.953 0.984 0.016 0.000 0.000
#> GSM531603     2  0.0000      0.963 0.000 1.000 0.000 0.000
#> GSM531609     4  0.0000      0.938 0.000 0.000 0.000 1.000
#> GSM531611     4  0.0188      0.938 0.000 0.004 0.000 0.996
#> GSM531621     3  0.0000      0.965 0.000 0.000 1.000 0.000
#> GSM531622     3  0.0000      0.965 0.000 0.000 1.000 0.000
#> GSM531628     1  0.0000      0.958 1.000 0.000 0.000 0.000
#> GSM531630     3  0.0000      0.965 0.000 0.000 1.000 0.000
#> GSM531633     3  0.0000      0.965 0.000 0.000 1.000 0.000
#> GSM531635     1  0.0592      0.960 0.984 0.000 0.016 0.000
#> GSM531640     3  0.0000      0.965 0.000 0.000 1.000 0.000
#> GSM531649     1  0.0592      0.960 0.984 0.000 0.016 0.000
#> GSM531653     1  0.0592      0.960 0.984 0.000 0.016 0.000
#> GSM531657     4  0.2647      0.864 0.000 0.120 0.000 0.880
#> GSM531665     2  0.0000      0.963 0.000 1.000 0.000 0.000
#> GSM531670     1  0.0927      0.953 0.976 0.016 0.008 0.000
#> GSM531674     1  0.0000      0.958 1.000 0.000 0.000 0.000
#> GSM531675     2  0.0592      0.952 0.000 0.984 0.000 0.016
#> GSM531677     2  0.0000      0.963 0.000 1.000 0.000 0.000
#> GSM531678     2  0.0000      0.963 0.000 1.000 0.000 0.000
#> GSM531680     2  0.3610      0.748 0.200 0.800 0.000 0.000
#> GSM531689     2  0.0000      0.963 0.000 1.000 0.000 0.000
#> GSM531691     2  0.0000      0.963 0.000 1.000 0.000 0.000
#> GSM531692     2  0.0000      0.963 0.000 1.000 0.000 0.000
#> GSM531694     2  0.0000      0.963 0.000 1.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
#> GSM531602     2  0.0162     0.9766 0.000 0.996 0.000 0.000 0.004
#> GSM531604     5  0.2605     0.7874 0.000 0.148 0.000 0.000 0.852
#> GSM531606     2  0.3143     0.7066 0.000 0.796 0.000 0.000 0.204
#> GSM531607     2  0.0162     0.9766 0.000 0.996 0.000 0.000 0.004
#> GSM531608     3  0.0404     0.9856 0.000 0.012 0.988 0.000 0.000
#> GSM531610     4  0.0000     0.8998 0.000 0.000 0.000 1.000 0.000
#> GSM531612     4  0.0000     0.8998 0.000 0.000 0.000 1.000 0.000
#> GSM531613     4  0.0290     0.8982 0.000 0.008 0.000 0.992 0.000
#> GSM531614     4  0.0000     0.8998 0.000 0.000 0.000 1.000 0.000
#> GSM531616     3  0.0404     0.9895 0.000 0.000 0.988 0.000 0.012
#> GSM531618     4  0.1942     0.8613 0.000 0.012 0.068 0.920 0.000
#> GSM531619     3  0.0162     0.9920 0.000 0.004 0.996 0.000 0.000
#> GSM531620     3  0.0290     0.9906 0.000 0.000 0.992 0.000 0.008
#> GSM531623     3  0.0162     0.9922 0.000 0.000 0.996 0.000 0.004
#> GSM531625     3  0.0290     0.9906 0.000 0.000 0.992 0.000 0.008
#> GSM531626     3  0.0404     0.9895 0.000 0.000 0.988 0.000 0.012
#> GSM531632     1  0.0000     0.8851 1.000 0.000 0.000 0.000 0.000
#> GSM531638     3  0.0404     0.9895 0.000 0.000 0.988 0.000 0.012
#> GSM531639     1  0.4268     0.5116 0.648 0.000 0.344 0.000 0.008
#> GSM531641     4  0.0000     0.8998 0.000 0.000 0.000 1.000 0.000
#> GSM531642     1  0.5263     0.6787 0.704 0.008 0.188 0.096 0.004
#> GSM531643     1  0.0324     0.8845 0.992 0.004 0.004 0.000 0.000
#> GSM531644     1  0.0324     0.8845 0.992 0.004 0.004 0.000 0.000
#> GSM531645     4  0.0000     0.8998 0.000 0.000 0.000 1.000 0.000
#> GSM531646     1  0.0162     0.8856 0.996 0.000 0.004 0.000 0.000
#> GSM531647     1  0.0162     0.8856 0.996 0.000 0.004 0.000 0.000
#> GSM531648     4  0.0000     0.8998 0.000 0.000 0.000 1.000 0.000
#> GSM531650     1  0.0162     0.8856 0.996 0.000 0.004 0.000 0.000
#> GSM531651     3  0.0162     0.9922 0.000 0.000 0.996 0.000 0.004
#> GSM531652     4  0.3802     0.6904 0.228 0.004 0.004 0.760 0.004
#> GSM531656     1  0.3282     0.7505 0.804 0.000 0.188 0.000 0.008
#> GSM531659     4  0.3074     0.8164 0.000 0.196 0.000 0.804 0.000
#> GSM531661     3  0.0451     0.9860 0.000 0.008 0.988 0.000 0.004
#> GSM531662     5  0.3934     0.6689 0.000 0.016 0.244 0.000 0.740
#> GSM531663     4  0.3508     0.7483 0.000 0.252 0.000 0.748 0.000
#> GSM531664     1  0.0000     0.8851 1.000 0.000 0.000 0.000 0.000
#> GSM531666     1  0.1492     0.8625 0.948 0.008 0.004 0.040 0.000
#> GSM531667     3  0.0290     0.9893 0.000 0.008 0.992 0.000 0.000
#> GSM531668     4  0.2852     0.8342 0.000 0.172 0.000 0.828 0.000
#> GSM531669     1  0.0000     0.8851 1.000 0.000 0.000 0.000 0.000
#> GSM531671     5  0.3807     0.7215 0.008 0.012 0.204 0.000 0.776
#> GSM531672     4  0.3039     0.8197 0.000 0.192 0.000 0.808 0.000
#> GSM531673     5  0.1399     0.8418 0.000 0.020 0.028 0.000 0.952
#> GSM531676     5  0.0510     0.8447 0.000 0.016 0.000 0.000 0.984
#> GSM531679     2  0.0162     0.9766 0.000 0.996 0.000 0.000 0.004
#> GSM531681     2  0.0162     0.9729 0.000 0.996 0.000 0.004 0.000
#> GSM531682     2  0.0794     0.9547 0.000 0.972 0.000 0.000 0.028
#> GSM531683     2  0.0162     0.9766 0.000 0.996 0.000 0.000 0.004
#> GSM531684     5  0.3274     0.7199 0.000 0.220 0.000 0.000 0.780
#> GSM531685     5  0.0566     0.8430 0.004 0.012 0.000 0.000 0.984
#> GSM531686     2  0.0162     0.9729 0.000 0.996 0.000 0.004 0.000
#> GSM531687     5  0.3752     0.6046 0.000 0.292 0.000 0.000 0.708
#> GSM531688     1  0.3039     0.7497 0.808 0.000 0.000 0.000 0.192
#> GSM531690     2  0.0162     0.9729 0.000 0.996 0.000 0.004 0.000
#> GSM531693     1  0.2852     0.7711 0.828 0.000 0.000 0.000 0.172
#> GSM531695     1  0.3455     0.7269 0.784 0.008 0.000 0.000 0.208
#> GSM531603     2  0.0162     0.9766 0.000 0.996 0.000 0.000 0.004
#> GSM531609     4  0.0000     0.8998 0.000 0.000 0.000 1.000 0.000
#> GSM531611     4  0.0703     0.8964 0.000 0.024 0.000 0.976 0.000
#> GSM531621     3  0.0162     0.9922 0.000 0.000 0.996 0.000 0.004
#> GSM531622     3  0.0162     0.9920 0.000 0.004 0.996 0.000 0.000
#> GSM531628     1  0.0000     0.8851 1.000 0.000 0.000 0.000 0.000
#> GSM531630     3  0.0162     0.9922 0.000 0.000 0.996 0.000 0.004
#> GSM531633     3  0.0162     0.9922 0.000 0.000 0.996 0.000 0.004
#> GSM531635     1  0.0451     0.8840 0.988 0.000 0.008 0.000 0.004
#> GSM531640     3  0.0162     0.9920 0.000 0.004 0.996 0.000 0.000
#> GSM531649     1  0.0324     0.8849 0.992 0.000 0.004 0.000 0.004
#> GSM531653     1  0.0162     0.8856 0.996 0.000 0.004 0.000 0.000
#> GSM531657     4  0.3074     0.8164 0.000 0.196 0.000 0.804 0.000
#> GSM531665     5  0.0510     0.8447 0.000 0.016 0.000 0.000 0.984
#> GSM531670     1  0.3039     0.7809 0.836 0.000 0.152 0.000 0.012
#> GSM531674     1  0.0000     0.8851 1.000 0.000 0.000 0.000 0.000
#> GSM531675     2  0.0162     0.9729 0.000 0.996 0.000 0.004 0.000
#> GSM531677     2  0.0162     0.9766 0.000 0.996 0.000 0.000 0.004
#> GSM531678     2  0.0162     0.9766 0.000 0.996 0.000 0.000 0.004
#> GSM531680     1  0.6783    -0.0289 0.372 0.348 0.000 0.000 0.280
#> GSM531689     5  0.4278     0.3247 0.000 0.452 0.000 0.000 0.548
#> GSM531691     5  0.1043     0.8427 0.000 0.040 0.000 0.000 0.960
#> GSM531692     5  0.0510     0.8447 0.000 0.016 0.000 0.000 0.984
#> GSM531694     2  0.0162     0.9766 0.000 0.996 0.000 0.000 0.004

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>           class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM531602     2  0.0717      0.955 0.000 0.976 0.000 0.000 0.008 0.016
#> GSM531604     5  0.0260      0.913 0.000 0.008 0.000 0.000 0.992 0.000
#> GSM531606     5  0.3290      0.648 0.000 0.208 0.000 0.000 0.776 0.016
#> GSM531607     2  0.0260      0.961 0.000 0.992 0.000 0.000 0.008 0.000
#> GSM531608     3  0.0436      0.960 0.000 0.004 0.988 0.000 0.004 0.004
#> GSM531610     4  0.0000      0.902 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM531612     4  0.0146      0.902 0.000 0.000 0.000 0.996 0.000 0.004
#> GSM531613     4  0.0603      0.902 0.000 0.016 0.000 0.980 0.004 0.000
#> GSM531614     4  0.0000      0.902 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM531616     3  0.1908      0.926 0.004 0.000 0.900 0.000 0.000 0.096
#> GSM531618     4  0.2580      0.861 0.004 0.004 0.036 0.884 0.000 0.072
#> GSM531619     3  0.0146      0.964 0.000 0.000 0.996 0.000 0.000 0.004
#> GSM531620     3  0.1556      0.938 0.000 0.000 0.920 0.000 0.000 0.080
#> GSM531623     3  0.0000      0.965 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM531625     3  0.1501      0.940 0.000 0.000 0.924 0.000 0.000 0.076
#> GSM531626     3  0.1765      0.929 0.000 0.000 0.904 0.000 0.000 0.096
#> GSM531632     1  0.0146      0.876 0.996 0.000 0.000 0.000 0.000 0.004
#> GSM531638     3  0.1765      0.929 0.000 0.000 0.904 0.000 0.000 0.096
#> GSM531639     1  0.3815      0.781 0.776 0.000 0.132 0.000 0.000 0.092
#> GSM531641     4  0.0000      0.902 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM531642     1  0.4877      0.757 0.696 0.000 0.028 0.080 0.000 0.196
#> GSM531643     1  0.1957      0.856 0.888 0.000 0.000 0.000 0.000 0.112
#> GSM531644     1  0.2003      0.855 0.884 0.000 0.000 0.000 0.000 0.116
#> GSM531645     4  0.0146      0.902 0.000 0.000 0.000 0.996 0.000 0.004
#> GSM531646     1  0.0622      0.879 0.980 0.000 0.008 0.000 0.000 0.012
#> GSM531647     1  0.0405      0.878 0.988 0.000 0.008 0.000 0.000 0.004
#> GSM531648     4  0.0146      0.902 0.000 0.000 0.000 0.996 0.000 0.004
#> GSM531650     1  0.0146      0.876 0.996 0.000 0.000 0.000 0.000 0.004
#> GSM531651     3  0.0000      0.965 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM531652     1  0.5080      0.616 0.624 0.000 0.000 0.236 0.000 0.140
#> GSM531656     1  0.3650      0.796 0.792 0.000 0.116 0.000 0.000 0.092
#> GSM531659     4  0.3011      0.842 0.000 0.192 0.000 0.800 0.004 0.004
#> GSM531661     3  0.0665      0.954 0.000 0.008 0.980 0.000 0.008 0.004
#> GSM531662     5  0.0551      0.912 0.000 0.008 0.004 0.000 0.984 0.004
#> GSM531663     4  0.3043      0.838 0.000 0.196 0.000 0.796 0.004 0.004
#> GSM531664     1  0.0146      0.876 0.996 0.000 0.000 0.000 0.000 0.004
#> GSM531666     1  0.3426      0.817 0.808 0.000 0.000 0.068 0.000 0.124
#> GSM531667     3  0.0436      0.960 0.000 0.004 0.988 0.000 0.004 0.004
#> GSM531668     4  0.2773      0.859 0.000 0.164 0.000 0.828 0.004 0.004
#> GSM531669     1  0.1501      0.824 0.924 0.000 0.000 0.000 0.000 0.076
#> GSM531671     5  0.3171      0.780 0.004 0.004 0.092 0.000 0.844 0.056
#> GSM531672     4  0.2979      0.845 0.000 0.188 0.000 0.804 0.004 0.004
#> GSM531673     5  0.0146      0.913 0.000 0.004 0.000 0.000 0.996 0.000
#> GSM531676     6  0.3163      0.770 0.000 0.004 0.000 0.000 0.232 0.764
#> GSM531679     2  0.0458      0.958 0.000 0.984 0.000 0.000 0.016 0.000
#> GSM531681     2  0.0000      0.959 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM531682     2  0.0260      0.961 0.000 0.992 0.000 0.000 0.008 0.000
#> GSM531683     2  0.0260      0.961 0.000 0.992 0.000 0.000 0.008 0.000
#> GSM531684     5  0.0951      0.905 0.000 0.008 0.004 0.000 0.968 0.020
#> GSM531685     6  0.3163      0.770 0.000 0.004 0.000 0.000 0.232 0.764
#> GSM531686     2  0.0000      0.959 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM531687     6  0.3163      0.770 0.000 0.004 0.000 0.000 0.232 0.764
#> GSM531688     6  0.3136      0.805 0.228 0.000 0.000 0.000 0.004 0.768
#> GSM531690     2  0.0000      0.959 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM531693     6  0.3248      0.809 0.224 0.004 0.000 0.000 0.004 0.768
#> GSM531695     6  0.3248      0.809 0.224 0.004 0.000 0.000 0.004 0.768
#> GSM531603     2  0.0405      0.960 0.000 0.988 0.000 0.000 0.008 0.004
#> GSM531609     4  0.0146      0.902 0.000 0.000 0.000 0.996 0.000 0.004
#> GSM531611     4  0.2196      0.882 0.004 0.108 0.000 0.884 0.004 0.000
#> GSM531621     3  0.0000      0.965 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM531622     3  0.0000      0.965 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM531628     1  0.0146      0.876 0.996 0.000 0.000 0.000 0.000 0.004
#> GSM531630     3  0.0000      0.965 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM531633     3  0.0790      0.957 0.000 0.000 0.968 0.000 0.000 0.032
#> GSM531635     1  0.1970      0.861 0.900 0.000 0.008 0.000 0.000 0.092
#> GSM531640     3  0.0000      0.965 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM531649     1  0.1970      0.861 0.900 0.000 0.008 0.000 0.000 0.092
#> GSM531653     1  0.0405      0.878 0.988 0.000 0.008 0.000 0.000 0.004
#> GSM531657     4  0.2979      0.845 0.000 0.188 0.000 0.804 0.004 0.004
#> GSM531665     5  0.1588      0.861 0.000 0.004 0.000 0.000 0.924 0.072
#> GSM531670     1  0.3844      0.798 0.792 0.004 0.108 0.000 0.004 0.092
#> GSM531674     1  0.0632      0.867 0.976 0.000 0.000 0.000 0.000 0.024
#> GSM531675     2  0.0000      0.959 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM531677     2  0.0260      0.961 0.000 0.992 0.000 0.000 0.008 0.000
#> GSM531678     2  0.0914      0.951 0.000 0.968 0.000 0.000 0.016 0.016
#> GSM531680     6  0.4138      0.817 0.108 0.012 0.000 0.000 0.112 0.768
#> GSM531689     2  0.3684      0.390 0.000 0.628 0.000 0.000 0.372 0.000
#> GSM531691     5  0.0603      0.908 0.000 0.004 0.000 0.000 0.980 0.016
#> GSM531692     5  0.0146      0.913 0.000 0.004 0.000 0.000 0.996 0.000
#> GSM531694     2  0.0717      0.955 0.000 0.976 0.000 0.000 0.008 0.016

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)
#> Error in mat[ceiling(1:nr/h_ratio), ceiling(1:nc/w_ratio), drop = FALSE]: subscript out of bounds

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)
#> Error in mat[ceiling(1:nr/h_ratio), ceiling(1:nc/w_ratio), drop = FALSE]: subscript out of bounds

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 disease.state(p) k
#> MAD:mclust 79            0.911 2
#> MAD:mclust 73            0.164 3
#> MAD:mclust 78            0.478 4
#> MAD:mclust 78            0.882 5
#> MAD:mclust 79            0.840 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 51941 rows and 80 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.802           0.925       0.968         0.5039 0.495   0.495
#> 3 3 0.547           0.627       0.830         0.3225 0.757   0.547
#> 4 4 0.897           0.914       0.962         0.1336 0.833   0.551
#> 5 5 0.729           0.697       0.840         0.0558 0.915   0.680
#> 6 6 0.678           0.545       0.739         0.0392 0.881   0.517

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
#> GSM531602     2  0.0000      0.965 0.000 1.000
#> GSM531604     2  0.0000      0.965 0.000 1.000
#> GSM531606     2  0.0000      0.965 0.000 1.000
#> GSM531607     2  0.0000      0.965 0.000 1.000
#> GSM531608     2  0.6343      0.800 0.160 0.840
#> GSM531610     2  0.0000      0.965 0.000 1.000
#> GSM531612     2  0.0000      0.965 0.000 1.000
#> GSM531613     2  0.0000      0.965 0.000 1.000
#> GSM531614     2  0.0000      0.965 0.000 1.000
#> GSM531616     1  0.0000      0.965 1.000 0.000
#> GSM531618     1  0.9608      0.392 0.616 0.384
#> GSM531619     1  0.0000      0.965 1.000 0.000
#> GSM531620     1  0.0000      0.965 1.000 0.000
#> GSM531623     1  0.0000      0.965 1.000 0.000
#> GSM531625     1  0.0000      0.965 1.000 0.000
#> GSM531626     1  0.0000      0.965 1.000 0.000
#> GSM531632     1  0.0000      0.965 1.000 0.000
#> GSM531638     1  0.0000      0.965 1.000 0.000
#> GSM531639     1  0.0000      0.965 1.000 0.000
#> GSM531641     2  0.0000      0.965 0.000 1.000
#> GSM531642     1  0.0000      0.965 1.000 0.000
#> GSM531643     1  0.0000      0.965 1.000 0.000
#> GSM531644     1  0.0000      0.965 1.000 0.000
#> GSM531645     2  0.0000      0.965 0.000 1.000
#> GSM531646     1  0.0000      0.965 1.000 0.000
#> GSM531647     1  0.0000      0.965 1.000 0.000
#> GSM531648     2  0.0000      0.965 0.000 1.000
#> GSM531650     1  0.0000      0.965 1.000 0.000
#> GSM531651     1  0.0000      0.965 1.000 0.000
#> GSM531652     1  0.0000      0.965 1.000 0.000
#> GSM531656     1  0.0000      0.965 1.000 0.000
#> GSM531659     2  0.0000      0.965 0.000 1.000
#> GSM531661     1  0.0000      0.965 1.000 0.000
#> GSM531662     1  0.0000      0.965 1.000 0.000
#> GSM531663     2  0.0000      0.965 0.000 1.000
#> GSM531664     1  0.0000      0.965 1.000 0.000
#> GSM531666     1  0.5946      0.825 0.856 0.144
#> GSM531667     1  0.5519      0.842 0.872 0.128
#> GSM531668     2  0.0000      0.965 0.000 1.000
#> GSM531669     1  0.0000      0.965 1.000 0.000
#> GSM531671     1  0.0000      0.965 1.000 0.000
#> GSM531672     2  0.0000      0.965 0.000 1.000
#> GSM531673     1  0.8955      0.549 0.688 0.312
#> GSM531676     2  0.7376      0.743 0.208 0.792
#> GSM531679     2  0.0000      0.965 0.000 1.000
#> GSM531681     2  0.0000      0.965 0.000 1.000
#> GSM531682     2  0.0000      0.965 0.000 1.000
#> GSM531683     2  0.0000      0.965 0.000 1.000
#> GSM531684     2  0.0000      0.965 0.000 1.000
#> GSM531685     1  0.1414      0.949 0.980 0.020
#> GSM531686     2  0.0000      0.965 0.000 1.000
#> GSM531687     2  0.5737      0.839 0.136 0.864
#> GSM531688     1  0.5737      0.833 0.864 0.136
#> GSM531690     2  0.0000      0.965 0.000 1.000
#> GSM531693     1  0.0000      0.965 1.000 0.000
#> GSM531695     2  0.6048      0.825 0.148 0.852
#> GSM531603     2  0.0000      0.965 0.000 1.000
#> GSM531609     2  0.0000      0.965 0.000 1.000
#> GSM531611     2  0.0000      0.965 0.000 1.000
#> GSM531621     1  0.0000      0.965 1.000 0.000
#> GSM531622     1  0.0000      0.965 1.000 0.000
#> GSM531628     1  0.0000      0.965 1.000 0.000
#> GSM531630     1  0.0000      0.965 1.000 0.000
#> GSM531633     1  0.0000      0.965 1.000 0.000
#> GSM531635     1  0.0000      0.965 1.000 0.000
#> GSM531640     1  0.0000      0.965 1.000 0.000
#> GSM531649     1  0.0000      0.965 1.000 0.000
#> GSM531653     1  0.0000      0.965 1.000 0.000
#> GSM531657     2  0.0000      0.965 0.000 1.000
#> GSM531665     2  0.9922      0.185 0.448 0.552
#> GSM531670     1  0.0000      0.965 1.000 0.000
#> GSM531674     1  0.0000      0.965 1.000 0.000
#> GSM531675     2  0.0000      0.965 0.000 1.000
#> GSM531677     2  0.0000      0.965 0.000 1.000
#> GSM531678     2  0.0000      0.965 0.000 1.000
#> GSM531680     2  0.4939      0.870 0.108 0.892
#> GSM531689     2  0.0000      0.965 0.000 1.000
#> GSM531691     2  0.0938      0.956 0.012 0.988
#> GSM531692     1  0.7950      0.686 0.760 0.240
#> GSM531694     2  0.0000      0.965 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
#> GSM531602     2  0.0000     0.8347 0.000 1.000 0.000
#> GSM531604     2  0.5650     0.4162 0.000 0.688 0.312
#> GSM531606     2  0.0000     0.8347 0.000 1.000 0.000
#> GSM531607     2  0.0000     0.8347 0.000 1.000 0.000
#> GSM531608     3  0.5926     0.4464 0.000 0.356 0.644
#> GSM531610     2  0.5497     0.6416 0.292 0.708 0.000
#> GSM531612     1  0.6260    -0.2027 0.552 0.448 0.000
#> GSM531613     2  0.5733     0.6074 0.324 0.676 0.000
#> GSM531614     2  0.6235     0.4452 0.436 0.564 0.000
#> GSM531616     3  0.5216     0.4411 0.260 0.000 0.740
#> GSM531618     1  0.8199     0.3508 0.640 0.160 0.200
#> GSM531619     3  0.0237     0.8234 0.000 0.004 0.996
#> GSM531620     3  0.0000     0.8253 0.000 0.000 1.000
#> GSM531623     3  0.0000     0.8253 0.000 0.000 1.000
#> GSM531625     3  0.0000     0.8253 0.000 0.000 1.000
#> GSM531626     3  0.0000     0.8253 0.000 0.000 1.000
#> GSM531632     1  0.6204     0.4509 0.576 0.000 0.424
#> GSM531638     3  0.0237     0.8221 0.004 0.000 0.996
#> GSM531639     3  0.6045     0.0296 0.380 0.000 0.620
#> GSM531641     2  0.6111     0.5134 0.396 0.604 0.000
#> GSM531642     1  0.1529     0.6610 0.960 0.000 0.040
#> GSM531643     1  0.0592     0.6641 0.988 0.000 0.012
#> GSM531644     1  0.0000     0.6615 1.000 0.000 0.000
#> GSM531645     1  0.6111    -0.0444 0.604 0.396 0.000
#> GSM531646     1  0.6095     0.5103 0.608 0.000 0.392
#> GSM531647     1  0.5905     0.5550 0.648 0.000 0.352
#> GSM531648     1  0.5785     0.1505 0.668 0.332 0.000
#> GSM531650     1  0.1163     0.6642 0.972 0.000 0.028
#> GSM531651     3  0.0000     0.8253 0.000 0.000 1.000
#> GSM531652     1  0.0237     0.6626 0.996 0.000 0.004
#> GSM531656     1  0.5591     0.5859 0.696 0.000 0.304
#> GSM531659     2  0.4555     0.7248 0.200 0.800 0.000
#> GSM531661     3  0.3267     0.7416 0.000 0.116 0.884
#> GSM531662     3  0.4452     0.6745 0.000 0.192 0.808
#> GSM531663     2  0.0237     0.8345 0.004 0.996 0.000
#> GSM531664     1  0.0237     0.6628 0.996 0.000 0.004
#> GSM531666     1  0.0000     0.6615 1.000 0.000 0.000
#> GSM531667     3  0.0237     0.8234 0.000 0.004 0.996
#> GSM531668     2  0.1411     0.8251 0.036 0.964 0.000
#> GSM531669     1  0.5905     0.5550 0.648 0.000 0.352
#> GSM531671     3  0.5291     0.4245 0.268 0.000 0.732
#> GSM531672     2  0.5905     0.5735 0.352 0.648 0.000
#> GSM531673     3  0.6008     0.4182 0.000 0.372 0.628
#> GSM531676     2  0.4931     0.6145 0.212 0.784 0.004
#> GSM531679     2  0.0000     0.8347 0.000 1.000 0.000
#> GSM531681     2  0.0237     0.8345 0.004 0.996 0.000
#> GSM531682     2  0.0000     0.8347 0.000 1.000 0.000
#> GSM531683     2  0.0000     0.8347 0.000 1.000 0.000
#> GSM531684     2  0.6260     0.0383 0.000 0.552 0.448
#> GSM531685     1  0.9602     0.0558 0.400 0.200 0.400
#> GSM531686     2  0.1529     0.8242 0.040 0.960 0.000
#> GSM531687     2  0.4409     0.6737 0.172 0.824 0.004
#> GSM531688     1  0.6420     0.5859 0.688 0.024 0.288
#> GSM531690     2  0.1031     0.8299 0.024 0.976 0.000
#> GSM531693     1  0.6079     0.5160 0.612 0.000 0.388
#> GSM531695     1  0.0000     0.6615 1.000 0.000 0.000
#> GSM531603     2  0.0000     0.8347 0.000 1.000 0.000
#> GSM531609     2  0.6274     0.4036 0.456 0.544 0.000
#> GSM531611     2  0.6225     0.4528 0.432 0.568 0.000
#> GSM531621     3  0.0000     0.8253 0.000 0.000 1.000
#> GSM531622     3  0.0000     0.8253 0.000 0.000 1.000
#> GSM531628     1  0.0747     0.6644 0.984 0.000 0.016
#> GSM531630     3  0.0000     0.8253 0.000 0.000 1.000
#> GSM531633     3  0.0000     0.8253 0.000 0.000 1.000
#> GSM531635     1  0.6079     0.5160 0.612 0.000 0.388
#> GSM531640     3  0.0000     0.8253 0.000 0.000 1.000
#> GSM531649     1  0.6111     0.5039 0.604 0.000 0.396
#> GSM531653     1  0.5988     0.5393 0.632 0.000 0.368
#> GSM531657     2  0.3192     0.7868 0.112 0.888 0.000
#> GSM531665     2  0.5263     0.7115 0.060 0.824 0.116
#> GSM531670     1  0.6111     0.5080 0.604 0.000 0.396
#> GSM531674     1  0.5810     0.5668 0.664 0.000 0.336
#> GSM531675     2  0.0237     0.8345 0.004 0.996 0.000
#> GSM531677     2  0.0237     0.8345 0.004 0.996 0.000
#> GSM531678     2  0.0000     0.8347 0.000 1.000 0.000
#> GSM531680     1  0.3784     0.5660 0.864 0.132 0.004
#> GSM531689     2  0.0000     0.8347 0.000 1.000 0.000
#> GSM531691     2  0.0000     0.8347 0.000 1.000 0.000
#> GSM531692     3  0.8264     0.4096 0.088 0.356 0.556
#> GSM531694     2  0.0000     0.8347 0.000 1.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
#> GSM531602     2  0.0000      0.958 0.000 1.000 0.000 0.000
#> GSM531604     2  0.0000      0.958 0.000 1.000 0.000 0.000
#> GSM531606     2  0.0000      0.958 0.000 1.000 0.000 0.000
#> GSM531607     2  0.0000      0.958 0.000 1.000 0.000 0.000
#> GSM531608     3  0.0000      0.955 0.000 0.000 1.000 0.000
#> GSM531610     4  0.0000      0.965 0.000 0.000 0.000 1.000
#> GSM531612     4  0.0000      0.965 0.000 0.000 0.000 1.000
#> GSM531613     4  0.0000      0.965 0.000 0.000 0.000 1.000
#> GSM531614     4  0.0000      0.965 0.000 0.000 0.000 1.000
#> GSM531616     3  0.4277      0.595 0.280 0.000 0.720 0.000
#> GSM531618     4  0.0000      0.965 0.000 0.000 0.000 1.000
#> GSM531619     3  0.0000      0.955 0.000 0.000 1.000 0.000
#> GSM531620     3  0.0000      0.955 0.000 0.000 1.000 0.000
#> GSM531623     3  0.0000      0.955 0.000 0.000 1.000 0.000
#> GSM531625     3  0.0000      0.955 0.000 0.000 1.000 0.000
#> GSM531626     3  0.0000      0.955 0.000 0.000 1.000 0.000
#> GSM531632     1  0.0000      0.955 1.000 0.000 0.000 0.000
#> GSM531638     3  0.0000      0.955 0.000 0.000 1.000 0.000
#> GSM531639     3  0.0592      0.943 0.016 0.000 0.984 0.000
#> GSM531641     4  0.0000      0.965 0.000 0.000 0.000 1.000
#> GSM531642     4  0.0188      0.962 0.000 0.000 0.004 0.996
#> GSM531643     1  0.0000      0.955 1.000 0.000 0.000 0.000
#> GSM531644     1  0.3764      0.712 0.784 0.000 0.000 0.216
#> GSM531645     4  0.0000      0.965 0.000 0.000 0.000 1.000
#> GSM531646     1  0.0000      0.955 1.000 0.000 0.000 0.000
#> GSM531647     1  0.0000      0.955 1.000 0.000 0.000 0.000
#> GSM531648     4  0.0000      0.965 0.000 0.000 0.000 1.000
#> GSM531650     1  0.0000      0.955 1.000 0.000 0.000 0.000
#> GSM531651     3  0.0000      0.955 0.000 0.000 1.000 0.000
#> GSM531652     4  0.0000      0.965 0.000 0.000 0.000 1.000
#> GSM531656     1  0.0592      0.943 0.984 0.000 0.016 0.000
#> GSM531659     4  0.1867      0.905 0.000 0.072 0.000 0.928
#> GSM531661     3  0.0000      0.955 0.000 0.000 1.000 0.000
#> GSM531662     3  0.0000      0.955 0.000 0.000 1.000 0.000
#> GSM531663     4  0.0469      0.957 0.000 0.012 0.000 0.988
#> GSM531664     1  0.0000      0.955 1.000 0.000 0.000 0.000
#> GSM531666     4  0.3024      0.803 0.148 0.000 0.000 0.852
#> GSM531667     3  0.0000      0.955 0.000 0.000 1.000 0.000
#> GSM531668     4  0.4564      0.532 0.000 0.328 0.000 0.672
#> GSM531669     1  0.0000      0.955 1.000 0.000 0.000 0.000
#> GSM531671     3  0.6477      0.156 0.420 0.072 0.508 0.000
#> GSM531672     4  0.0000      0.965 0.000 0.000 0.000 1.000
#> GSM531673     2  0.3649      0.759 0.000 0.796 0.204 0.000
#> GSM531676     2  0.2647      0.852 0.120 0.880 0.000 0.000
#> GSM531679     2  0.0000      0.958 0.000 1.000 0.000 0.000
#> GSM531681     2  0.0592      0.949 0.000 0.984 0.000 0.016
#> GSM531682     2  0.0000      0.958 0.000 1.000 0.000 0.000
#> GSM531683     2  0.0000      0.958 0.000 1.000 0.000 0.000
#> GSM531684     2  0.3649      0.761 0.000 0.796 0.204 0.000
#> GSM531685     1  0.4304      0.605 0.716 0.284 0.000 0.000
#> GSM531686     2  0.0707      0.947 0.000 0.980 0.000 0.020
#> GSM531687     2  0.3219      0.798 0.164 0.836 0.000 0.000
#> GSM531688     1  0.0000      0.955 1.000 0.000 0.000 0.000
#> GSM531690     2  0.2408      0.866 0.000 0.896 0.000 0.104
#> GSM531693     1  0.0000      0.955 1.000 0.000 0.000 0.000
#> GSM531695     1  0.0188      0.952 0.996 0.004 0.000 0.000
#> GSM531603     2  0.0000      0.958 0.000 1.000 0.000 0.000
#> GSM531609     4  0.0000      0.965 0.000 0.000 0.000 1.000
#> GSM531611     4  0.0000      0.965 0.000 0.000 0.000 1.000
#> GSM531621     3  0.0000      0.955 0.000 0.000 1.000 0.000
#> GSM531622     3  0.0000      0.955 0.000 0.000 1.000 0.000
#> GSM531628     1  0.0000      0.955 1.000 0.000 0.000 0.000
#> GSM531630     3  0.0000      0.955 0.000 0.000 1.000 0.000
#> GSM531633     3  0.0000      0.955 0.000 0.000 1.000 0.000
#> GSM531635     1  0.0000      0.955 1.000 0.000 0.000 0.000
#> GSM531640     3  0.0000      0.955 0.000 0.000 1.000 0.000
#> GSM531649     1  0.0000      0.955 1.000 0.000 0.000 0.000
#> GSM531653     1  0.0000      0.955 1.000 0.000 0.000 0.000
#> GSM531657     4  0.0000      0.965 0.000 0.000 0.000 1.000
#> GSM531665     2  0.1118      0.934 0.036 0.964 0.000 0.000
#> GSM531670     1  0.0707      0.939 0.980 0.000 0.020 0.000
#> GSM531674     1  0.0000      0.955 1.000 0.000 0.000 0.000
#> GSM531675     2  0.0000      0.958 0.000 1.000 0.000 0.000
#> GSM531677     2  0.0000      0.958 0.000 1.000 0.000 0.000
#> GSM531678     2  0.0000      0.958 0.000 1.000 0.000 0.000
#> GSM531680     1  0.4008      0.674 0.756 0.244 0.000 0.000
#> GSM531689     2  0.0000      0.958 0.000 1.000 0.000 0.000
#> GSM531691     2  0.0000      0.958 0.000 1.000 0.000 0.000
#> GSM531692     2  0.0000      0.958 0.000 1.000 0.000 0.000
#> GSM531694     2  0.0000      0.958 0.000 1.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
#> GSM531602     2  0.3636     0.6960 0.000 0.728 0.000 0.000 0.272
#> GSM531604     2  0.0000     0.7887 0.000 1.000 0.000 0.000 0.000
#> GSM531606     2  0.2605     0.7683 0.000 0.852 0.000 0.000 0.148
#> GSM531607     2  0.3661     0.6870 0.000 0.724 0.000 0.000 0.276
#> GSM531608     3  0.0324     0.9313 0.000 0.000 0.992 0.004 0.004
#> GSM531610     4  0.0000     0.9700 0.000 0.000 0.000 1.000 0.000
#> GSM531612     4  0.0290     0.9678 0.000 0.000 0.000 0.992 0.008
#> GSM531613     4  0.0000     0.9700 0.000 0.000 0.000 1.000 0.000
#> GSM531614     4  0.0000     0.9700 0.000 0.000 0.000 1.000 0.000
#> GSM531616     1  0.4734     0.2591 0.604 0.000 0.372 0.000 0.024
#> GSM531618     5  0.4551     0.3244 0.000 0.000 0.016 0.368 0.616
#> GSM531619     3  0.1341     0.9206 0.000 0.000 0.944 0.000 0.056
#> GSM531620     3  0.3924     0.8535 0.068 0.000 0.808 0.004 0.120
#> GSM531623     3  0.0000     0.9311 0.000 0.000 1.000 0.000 0.000
#> GSM531625     3  0.3192     0.8636 0.112 0.000 0.848 0.000 0.040
#> GSM531626     3  0.4163     0.7906 0.176 0.000 0.776 0.008 0.040
#> GSM531632     1  0.0865     0.7744 0.972 0.000 0.004 0.000 0.024
#> GSM531638     3  0.1012     0.9321 0.012 0.000 0.968 0.000 0.020
#> GSM531639     3  0.2729     0.8708 0.056 0.000 0.884 0.000 0.060
#> GSM531641     4  0.0290     0.9678 0.000 0.000 0.000 0.992 0.008
#> GSM531642     5  0.6271     0.3104 0.148 0.000 0.000 0.412 0.440
#> GSM531643     1  0.2891     0.7155 0.824 0.000 0.000 0.000 0.176
#> GSM531644     5  0.4546     0.0226 0.460 0.000 0.000 0.008 0.532
#> GSM531645     4  0.0404     0.9654 0.000 0.000 0.000 0.988 0.012
#> GSM531646     1  0.0609     0.7789 0.980 0.000 0.000 0.000 0.020
#> GSM531647     1  0.0703     0.7909 0.976 0.000 0.000 0.000 0.024
#> GSM531648     5  0.4305     0.1125 0.000 0.000 0.000 0.488 0.512
#> GSM531650     1  0.2813     0.7242 0.832 0.000 0.000 0.000 0.168
#> GSM531651     3  0.0000     0.9311 0.000 0.000 1.000 0.000 0.000
#> GSM531652     5  0.5373     0.4894 0.092 0.000 0.000 0.276 0.632
#> GSM531656     5  0.6180    -0.0149 0.404 0.000 0.136 0.000 0.460
#> GSM531659     4  0.1484     0.9143 0.000 0.048 0.000 0.944 0.008
#> GSM531661     3  0.0963     0.9272 0.000 0.000 0.964 0.000 0.036
#> GSM531662     3  0.3071     0.8652 0.012 0.080 0.872 0.000 0.036
#> GSM531663     4  0.0290     0.9639 0.000 0.008 0.000 0.992 0.000
#> GSM531664     1  0.3999     0.4506 0.656 0.000 0.000 0.000 0.344
#> GSM531666     5  0.2305     0.5471 0.092 0.000 0.000 0.012 0.896
#> GSM531667     3  0.1608     0.9103 0.000 0.000 0.928 0.000 0.072
#> GSM531668     5  0.4126     0.5266 0.000 0.104 0.004 0.096 0.796
#> GSM531669     1  0.0162     0.7855 0.996 0.000 0.000 0.000 0.004
#> GSM531671     1  0.5076     0.5560 0.744 0.132 0.092 0.000 0.032
#> GSM531672     5  0.3305     0.4903 0.000 0.000 0.000 0.224 0.776
#> GSM531673     2  0.5344     0.5130 0.032 0.636 0.304 0.000 0.028
#> GSM531676     2  0.2674     0.7198 0.120 0.868 0.000 0.000 0.012
#> GSM531679     2  0.0510     0.7912 0.000 0.984 0.000 0.000 0.016
#> GSM531681     2  0.4262     0.2461 0.000 0.560 0.000 0.440 0.000
#> GSM531682     2  0.0510     0.7909 0.000 0.984 0.000 0.000 0.016
#> GSM531683     2  0.2690     0.7613 0.000 0.844 0.000 0.000 0.156
#> GSM531684     2  0.5345     0.5664 0.000 0.632 0.280 0.000 0.088
#> GSM531685     1  0.5681     0.1018 0.504 0.436 0.040 0.000 0.020
#> GSM531686     2  0.4283     0.2066 0.000 0.544 0.000 0.456 0.000
#> GSM531687     2  0.6246     0.2975 0.272 0.536 0.000 0.000 0.192
#> GSM531688     1  0.1544     0.7833 0.932 0.000 0.000 0.000 0.068
#> GSM531690     2  0.3596     0.7251 0.000 0.776 0.000 0.012 0.212
#> GSM531693     1  0.0865     0.7902 0.972 0.004 0.000 0.000 0.024
#> GSM531695     5  0.4446     0.1576 0.400 0.008 0.000 0.000 0.592
#> GSM531603     5  0.3696     0.3468 0.000 0.212 0.016 0.000 0.772
#> GSM531609     4  0.0000     0.9700 0.000 0.000 0.000 1.000 0.000
#> GSM531611     4  0.0000     0.9700 0.000 0.000 0.000 1.000 0.000
#> GSM531621     3  0.1741     0.9175 0.024 0.000 0.936 0.000 0.040
#> GSM531622     3  0.0703     0.9299 0.000 0.000 0.976 0.000 0.024
#> GSM531628     1  0.2773     0.7276 0.836 0.000 0.000 0.000 0.164
#> GSM531630     3  0.0794     0.9292 0.000 0.000 0.972 0.000 0.028
#> GSM531633     3  0.1836     0.9162 0.032 0.000 0.932 0.000 0.036
#> GSM531635     1  0.1082     0.7915 0.964 0.000 0.008 0.000 0.028
#> GSM531640     3  0.0963     0.9277 0.000 0.000 0.964 0.000 0.036
#> GSM531649     1  0.1281     0.7663 0.956 0.000 0.012 0.000 0.032
#> GSM531653     1  0.1478     0.7868 0.936 0.000 0.000 0.000 0.064
#> GSM531657     4  0.2719     0.8027 0.000 0.004 0.000 0.852 0.144
#> GSM531665     2  0.3048     0.6694 0.176 0.820 0.004 0.000 0.000
#> GSM531670     1  0.5391     0.4522 0.616 0.000 0.084 0.000 0.300
#> GSM531674     1  0.1671     0.7803 0.924 0.000 0.000 0.000 0.076
#> GSM531675     2  0.2179     0.7777 0.000 0.888 0.000 0.000 0.112
#> GSM531677     2  0.0000     0.7887 0.000 1.000 0.000 0.000 0.000
#> GSM531678     2  0.0613     0.7904 0.000 0.984 0.004 0.004 0.008
#> GSM531680     5  0.6738     0.1985 0.280 0.308 0.000 0.000 0.412
#> GSM531689     2  0.0290     0.7899 0.000 0.992 0.000 0.000 0.008
#> GSM531691     2  0.1626     0.7813 0.000 0.940 0.044 0.000 0.016
#> GSM531692     2  0.2053     0.7708 0.024 0.924 0.048 0.000 0.004
#> GSM531694     2  0.3242     0.7338 0.000 0.784 0.000 0.000 0.216

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>           class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM531602     2  0.5468     0.5077 0.000 0.548 0.000 0.000 0.156 0.296
#> GSM531604     2  0.0935     0.7142 0.000 0.964 0.000 0.000 0.032 0.004
#> GSM531606     2  0.4626     0.6390 0.000 0.692 0.000 0.000 0.136 0.172
#> GSM531607     2  0.5480     0.5004 0.000 0.540 0.000 0.000 0.152 0.308
#> GSM531608     3  0.4340     0.7384 0.000 0.020 0.744 0.048 0.184 0.004
#> GSM531610     4  0.0000     0.8308 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM531612     4  0.0000     0.8308 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM531613     4  0.0000     0.8308 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM531614     4  0.0000     0.8308 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM531616     5  0.5393     0.4558 0.256 0.000 0.168 0.000 0.576 0.000
#> GSM531618     6  0.5615     0.5609 0.016 0.000 0.008 0.204 0.148 0.624
#> GSM531619     3  0.0363     0.7577 0.000 0.000 0.988 0.000 0.012 0.000
#> GSM531620     5  0.3231     0.4345 0.012 0.000 0.180 0.000 0.800 0.008
#> GSM531623     3  0.2697     0.7669 0.000 0.000 0.812 0.000 0.188 0.000
#> GSM531625     5  0.3923     0.1160 0.004 0.000 0.416 0.000 0.580 0.000
#> GSM531626     5  0.4258     0.4693 0.068 0.000 0.204 0.000 0.724 0.004
#> GSM531632     5  0.3864    -0.1444 0.480 0.000 0.000 0.000 0.520 0.000
#> GSM531638     3  0.1320     0.7770 0.016 0.000 0.948 0.000 0.036 0.000
#> GSM531639     3  0.6315     0.3785 0.216 0.000 0.560 0.000 0.152 0.072
#> GSM531641     4  0.0000     0.8308 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM531642     6  0.5740     0.4505 0.180 0.000 0.000 0.264 0.008 0.548
#> GSM531643     1  0.2837     0.6943 0.856 0.000 0.000 0.000 0.056 0.088
#> GSM531644     1  0.4111     0.1255 0.536 0.000 0.000 0.004 0.004 0.456
#> GSM531645     4  0.0000     0.8308 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM531646     1  0.3864     0.1184 0.520 0.000 0.000 0.000 0.480 0.000
#> GSM531647     1  0.3563     0.4446 0.664 0.000 0.000 0.000 0.336 0.000
#> GSM531648     6  0.4319     0.5041 0.012 0.000 0.000 0.256 0.036 0.696
#> GSM531650     1  0.3063     0.6909 0.840 0.000 0.000 0.000 0.068 0.092
#> GSM531651     3  0.2762     0.7631 0.000 0.000 0.804 0.000 0.196 0.000
#> GSM531652     6  0.4604     0.5707 0.092 0.000 0.000 0.172 0.016 0.720
#> GSM531656     1  0.4303     0.6007 0.752 0.000 0.108 0.000 0.012 0.128
#> GSM531659     4  0.6270     0.2524 0.004 0.232 0.000 0.544 0.036 0.184
#> GSM531661     3  0.3309     0.7520 0.000 0.004 0.788 0.000 0.192 0.016
#> GSM531662     5  0.6685    -0.0755 0.000 0.240 0.360 0.000 0.364 0.036
#> GSM531663     4  0.0260     0.8254 0.000 0.008 0.000 0.992 0.000 0.000
#> GSM531664     1  0.2442     0.6646 0.852 0.000 0.000 0.000 0.004 0.144
#> GSM531666     6  0.4379     0.1525 0.396 0.000 0.000 0.000 0.028 0.576
#> GSM531667     3  0.3667     0.7395 0.000 0.000 0.788 0.000 0.132 0.080
#> GSM531668     6  0.4102     0.4987 0.000 0.044 0.000 0.004 0.232 0.720
#> GSM531669     1  0.3765     0.3217 0.596 0.000 0.000 0.000 0.404 0.000
#> GSM531671     5  0.4030     0.4852 0.196 0.032 0.020 0.000 0.752 0.000
#> GSM531672     6  0.3522     0.6201 0.024 0.000 0.000 0.072 0.076 0.828
#> GSM531673     5  0.6206     0.1124 0.004 0.348 0.100 0.000 0.500 0.048
#> GSM531676     2  0.3905     0.2995 0.356 0.636 0.000 0.000 0.004 0.004
#> GSM531679     2  0.3159     0.7046 0.000 0.832 0.000 0.000 0.068 0.100
#> GSM531681     4  0.3758     0.5243 0.000 0.324 0.000 0.668 0.008 0.000
#> GSM531682     2  0.3419     0.7007 0.000 0.812 0.000 0.000 0.084 0.104
#> GSM531683     2  0.4675     0.6327 0.000 0.672 0.000 0.000 0.104 0.224
#> GSM531684     2  0.5630     0.1996 0.000 0.464 0.440 0.000 0.052 0.044
#> GSM531685     2  0.5077     0.0940 0.404 0.516 0.000 0.000 0.080 0.000
#> GSM531686     4  0.3742     0.4997 0.004 0.348 0.000 0.648 0.000 0.000
#> GSM531687     1  0.4890     0.4667 0.640 0.288 0.000 0.000 0.020 0.052
#> GSM531688     1  0.1838     0.6845 0.916 0.068 0.000 0.000 0.016 0.000
#> GSM531690     6  0.4640    -0.2681 0.000 0.436 0.000 0.004 0.032 0.528
#> GSM531693     1  0.3341     0.6385 0.816 0.068 0.000 0.000 0.116 0.000
#> GSM531695     1  0.3778     0.6179 0.784 0.028 0.000 0.000 0.024 0.164
#> GSM531603     6  0.4778     0.4886 0.008 0.068 0.024 0.000 0.180 0.720
#> GSM531609     4  0.0000     0.8308 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM531611     4  0.0000     0.8308 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM531621     3  0.3634     0.5680 0.000 0.000 0.644 0.000 0.356 0.000
#> GSM531622     3  0.2118     0.7858 0.000 0.000 0.888 0.000 0.104 0.008
#> GSM531628     1  0.1500     0.6994 0.936 0.000 0.000 0.000 0.012 0.052
#> GSM531630     3  0.0363     0.7709 0.000 0.000 0.988 0.000 0.012 0.000
#> GSM531633     3  0.3989     0.3340 0.000 0.000 0.528 0.000 0.468 0.004
#> GSM531635     1  0.2003     0.6718 0.884 0.000 0.000 0.000 0.116 0.000
#> GSM531640     3  0.0725     0.7551 0.000 0.000 0.976 0.012 0.012 0.000
#> GSM531649     1  0.3843     0.2265 0.548 0.000 0.000 0.000 0.452 0.000
#> GSM531653     1  0.2664     0.6317 0.816 0.000 0.000 0.000 0.184 0.000
#> GSM531657     4  0.5005     0.0593 0.000 0.008 0.000 0.520 0.052 0.420
#> GSM531665     2  0.2377     0.6953 0.024 0.892 0.000 0.000 0.076 0.008
#> GSM531670     1  0.4128     0.6011 0.772 0.004 0.140 0.000 0.012 0.072
#> GSM531674     1  0.1007     0.6934 0.956 0.000 0.000 0.000 0.044 0.000
#> GSM531675     2  0.4183     0.5902 0.000 0.668 0.000 0.000 0.036 0.296
#> GSM531677     2  0.2081     0.7092 0.012 0.916 0.000 0.000 0.036 0.036
#> GSM531678     2  0.1995     0.6938 0.024 0.924 0.000 0.036 0.012 0.004
#> GSM531680     1  0.5025     0.5275 0.676 0.208 0.000 0.000 0.024 0.092
#> GSM531689     2  0.1511     0.6934 0.044 0.940 0.000 0.000 0.012 0.004
#> GSM531691     2  0.1937     0.6913 0.048 0.924 0.012 0.000 0.012 0.004
#> GSM531692     2  0.2008     0.7070 0.032 0.920 0.004 0.000 0.040 0.004
#> GSM531694     2  0.5065     0.5813 0.000 0.616 0.000 0.000 0.124 0.260

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

consensus_heatmap(res, k = 2)

plot of chunk tab-MAD-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)
#> Error in mat[ceiling(1:nr/h_ratio), ceiling(1:nc/w_ratio), drop = FALSE]: subscript out of bounds

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 disease.state(p) k
#> MAD:NMF 78            1.000 2
#> MAD:NMF 63            1.000 3
#> MAD:NMF 79            0.441 4
#> MAD:NMF 63            0.737 5
#> MAD:NMF 53            0.221 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 51941 rows and 80 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.873           0.893       0.960         0.3480 0.661   0.661
#> 3 3 0.729           0.782       0.896         0.8056 0.704   0.552
#> 4 4 0.721           0.726       0.829         0.1281 0.918   0.780
#> 5 5 0.737           0.694       0.821         0.0539 0.934   0.779
#> 6 6 0.765           0.678       0.811         0.0321 0.957   0.831

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
#> GSM531602     2   0.000     0.9636 0.000 1.000
#> GSM531604     2   0.000     0.9636 0.000 1.000
#> GSM531606     2   0.000     0.9636 0.000 1.000
#> GSM531607     2   0.000     0.9636 0.000 1.000
#> GSM531608     1   0.000     0.9212 1.000 0.000
#> GSM531610     2   0.000     0.9636 0.000 1.000
#> GSM531612     2   0.000     0.9636 0.000 1.000
#> GSM531613     2   0.000     0.9636 0.000 1.000
#> GSM531614     2   0.000     0.9636 0.000 1.000
#> GSM531616     1   0.000     0.9212 1.000 0.000
#> GSM531618     2   0.000     0.9636 0.000 1.000
#> GSM531619     1   0.000     0.9212 1.000 0.000
#> GSM531620     1   0.850     0.6025 0.724 0.276
#> GSM531623     1   0.000     0.9212 1.000 0.000
#> GSM531625     1   0.000     0.9212 1.000 0.000
#> GSM531626     1   0.991     0.2160 0.556 0.444
#> GSM531632     2   0.714     0.7335 0.196 0.804
#> GSM531638     2   0.995     0.0896 0.460 0.540
#> GSM531639     2   0.000     0.9636 0.000 1.000
#> GSM531641     2   0.000     0.9636 0.000 1.000
#> GSM531642     2   0.000     0.9636 0.000 1.000
#> GSM531643     2   0.000     0.9636 0.000 1.000
#> GSM531644     2   0.000     0.9636 0.000 1.000
#> GSM531645     2   0.000     0.9636 0.000 1.000
#> GSM531646     2   0.996     0.0742 0.464 0.536
#> GSM531647     2   0.827     0.6251 0.260 0.740
#> GSM531648     2   0.000     0.9636 0.000 1.000
#> GSM531650     2   0.000     0.9636 0.000 1.000
#> GSM531651     1   0.000     0.9212 1.000 0.000
#> GSM531652     2   0.000     0.9636 0.000 1.000
#> GSM531656     2   0.000     0.9636 0.000 1.000
#> GSM531659     2   0.000     0.9636 0.000 1.000
#> GSM531661     1   0.000     0.9212 1.000 0.000
#> GSM531662     2   0.242     0.9262 0.040 0.960
#> GSM531663     2   0.000     0.9636 0.000 1.000
#> GSM531664     2   0.000     0.9636 0.000 1.000
#> GSM531666     2   0.000     0.9636 0.000 1.000
#> GSM531667     1   0.000     0.9212 1.000 0.000
#> GSM531668     2   0.000     0.9636 0.000 1.000
#> GSM531669     2   0.000     0.9636 0.000 1.000
#> GSM531671     2   0.278     0.9183 0.048 0.952
#> GSM531672     2   0.000     0.9636 0.000 1.000
#> GSM531673     2   0.000     0.9636 0.000 1.000
#> GSM531676     2   0.000     0.9636 0.000 1.000
#> GSM531679     2   0.000     0.9636 0.000 1.000
#> GSM531681     2   0.000     0.9636 0.000 1.000
#> GSM531682     2   0.000     0.9636 0.000 1.000
#> GSM531683     2   0.000     0.9636 0.000 1.000
#> GSM531684     2   0.000     0.9636 0.000 1.000
#> GSM531685     2   0.000     0.9636 0.000 1.000
#> GSM531686     2   0.000     0.9636 0.000 1.000
#> GSM531687     2   0.000     0.9636 0.000 1.000
#> GSM531688     2   0.000     0.9636 0.000 1.000
#> GSM531690     2   0.000     0.9636 0.000 1.000
#> GSM531693     2   0.000     0.9636 0.000 1.000
#> GSM531695     2   0.000     0.9636 0.000 1.000
#> GSM531603     2   0.000     0.9636 0.000 1.000
#> GSM531609     2   0.000     0.9636 0.000 1.000
#> GSM531611     2   0.000     0.9636 0.000 1.000
#> GSM531621     1   0.000     0.9212 1.000 0.000
#> GSM531622     1   0.000     0.9212 1.000 0.000
#> GSM531628     2   0.952     0.3742 0.372 0.628
#> GSM531630     1   0.000     0.9212 1.000 0.000
#> GSM531633     1   0.000     0.9212 1.000 0.000
#> GSM531635     1   0.000     0.9212 1.000 0.000
#> GSM531640     1   0.000     0.9212 1.000 0.000
#> GSM531649     1   0.991     0.2160 0.556 0.444
#> GSM531653     2   0.722     0.7271 0.200 0.800
#> GSM531657     2   0.000     0.9636 0.000 1.000
#> GSM531665     2   0.000     0.9636 0.000 1.000
#> GSM531670     2   0.000     0.9636 0.000 1.000
#> GSM531674     2   0.000     0.9636 0.000 1.000
#> GSM531675     2   0.000     0.9636 0.000 1.000
#> GSM531677     2   0.000     0.9636 0.000 1.000
#> GSM531678     2   0.000     0.9636 0.000 1.000
#> GSM531680     2   0.000     0.9636 0.000 1.000
#> GSM531689     2   0.000     0.9636 0.000 1.000
#> GSM531691     2   0.000     0.9636 0.000 1.000
#> GSM531692     2   0.000     0.9636 0.000 1.000
#> GSM531694     2   0.000     0.9636 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
#> GSM531602     2   0.141     0.9566 0.036 0.964 0.000
#> GSM531604     1   0.327     0.8108 0.884 0.116 0.000
#> GSM531606     1   0.327     0.8108 0.884 0.116 0.000
#> GSM531607     2   0.614     0.2607 0.404 0.596 0.000
#> GSM531608     3   0.000     0.9049 0.000 0.000 1.000
#> GSM531610     1   0.116     0.8525 0.972 0.028 0.000
#> GSM531612     2   0.141     0.9566 0.036 0.964 0.000
#> GSM531613     2   0.141     0.9566 0.036 0.964 0.000
#> GSM531614     1   0.000     0.8395 1.000 0.000 0.000
#> GSM531616     3   0.000     0.9049 0.000 0.000 1.000
#> GSM531618     1   0.116     0.8556 0.972 0.028 0.000
#> GSM531619     3   0.141     0.8964 0.000 0.036 0.964
#> GSM531620     3   0.536     0.5598 0.276 0.000 0.724
#> GSM531623     3   0.000     0.9049 0.000 0.000 1.000
#> GSM531625     3   0.141     0.8964 0.000 0.036 0.964
#> GSM531626     3   0.625     0.1346 0.444 0.000 0.556
#> GSM531632     1   0.450     0.6682 0.804 0.000 0.196
#> GSM531638     1   0.628     0.0988 0.540 0.000 0.460
#> GSM531639     1   0.116     0.8556 0.972 0.028 0.000
#> GSM531641     1   0.595     0.4700 0.640 0.360 0.000
#> GSM531642     1   0.116     0.8556 0.972 0.028 0.000
#> GSM531643     1   0.116     0.8556 0.972 0.028 0.000
#> GSM531644     1   0.116     0.8556 0.972 0.028 0.000
#> GSM531645     1   0.116     0.8556 0.972 0.028 0.000
#> GSM531646     1   0.629     0.0837 0.536 0.000 0.464
#> GSM531647     1   0.522     0.5814 0.740 0.000 0.260
#> GSM531648     1   0.116     0.8556 0.972 0.028 0.000
#> GSM531650     1   0.116     0.8556 0.972 0.028 0.000
#> GSM531651     3   0.141     0.8964 0.000 0.036 0.964
#> GSM531652     1   0.116     0.8556 0.972 0.028 0.000
#> GSM531656     1   0.116     0.8556 0.972 0.028 0.000
#> GSM531659     1   0.116     0.8556 0.972 0.028 0.000
#> GSM531661     3   0.000     0.9049 0.000 0.000 1.000
#> GSM531662     1   0.176     0.8125 0.956 0.004 0.040
#> GSM531663     1   0.116     0.8556 0.972 0.028 0.000
#> GSM531664     1   0.529     0.6368 0.732 0.268 0.000
#> GSM531666     1   0.529     0.6368 0.732 0.268 0.000
#> GSM531667     3   0.000     0.9049 0.000 0.000 1.000
#> GSM531668     1   0.116     0.8556 0.972 0.028 0.000
#> GSM531669     1   0.116     0.8556 0.972 0.028 0.000
#> GSM531671     1   0.175     0.8032 0.952 0.000 0.048
#> GSM531672     1   0.629     0.1567 0.532 0.468 0.000
#> GSM531673     1   0.116     0.8556 0.972 0.028 0.000
#> GSM531676     2   0.226     0.9272 0.068 0.932 0.000
#> GSM531679     2   0.141     0.9566 0.036 0.964 0.000
#> GSM531681     2   0.141     0.9566 0.036 0.964 0.000
#> GSM531682     2   0.141     0.9566 0.036 0.964 0.000
#> GSM531683     2   0.141     0.9566 0.036 0.964 0.000
#> GSM531684     1   0.334     0.8079 0.880 0.120 0.000
#> GSM531685     2   0.216     0.9314 0.064 0.936 0.000
#> GSM531686     2   0.141     0.9566 0.036 0.964 0.000
#> GSM531687     2   0.141     0.9566 0.036 0.964 0.000
#> GSM531688     2   0.141     0.9566 0.036 0.964 0.000
#> GSM531690     2   0.141     0.9566 0.036 0.964 0.000
#> GSM531693     1   0.627     0.2334 0.548 0.452 0.000
#> GSM531695     2   0.141     0.9566 0.036 0.964 0.000
#> GSM531603     2   0.614     0.2607 0.404 0.596 0.000
#> GSM531609     1   0.000     0.8395 1.000 0.000 0.000
#> GSM531611     2   0.141     0.9566 0.036 0.964 0.000
#> GSM531621     3   0.141     0.8964 0.000 0.036 0.964
#> GSM531622     3   0.000     0.9049 0.000 0.000 1.000
#> GSM531628     1   0.601     0.3657 0.628 0.000 0.372
#> GSM531630     3   0.000     0.9049 0.000 0.000 1.000
#> GSM531633     3   0.141     0.8964 0.000 0.036 0.964
#> GSM531635     3   0.000     0.9049 0.000 0.000 1.000
#> GSM531640     3   0.000     0.9049 0.000 0.000 1.000
#> GSM531649     3   0.625     0.1346 0.444 0.000 0.556
#> GSM531653     1   0.455     0.6713 0.800 0.000 0.200
#> GSM531657     1   0.625     0.2401 0.556 0.444 0.000
#> GSM531665     1   0.116     0.8556 0.972 0.028 0.000
#> GSM531670     1   0.116     0.8556 0.972 0.028 0.000
#> GSM531674     1   0.116     0.8556 0.972 0.028 0.000
#> GSM531675     2   0.141     0.9566 0.036 0.964 0.000
#> GSM531677     2   0.141     0.9566 0.036 0.964 0.000
#> GSM531678     2   0.153     0.9535 0.040 0.960 0.000
#> GSM531680     2   0.141     0.9566 0.036 0.964 0.000
#> GSM531689     2   0.141     0.9566 0.036 0.964 0.000
#> GSM531691     2   0.141     0.9566 0.036 0.964 0.000
#> GSM531692     1   0.319     0.8132 0.888 0.112 0.000
#> GSM531694     2   0.141     0.9566 0.036 0.964 0.000

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM531602     2  0.0000     0.9311 0.000 1.000 0.000 0.000
#> GSM531604     4  0.4360     0.6632 0.248 0.008 0.000 0.744
#> GSM531606     4  0.4360     0.6632 0.248 0.008 0.000 0.744
#> GSM531607     2  0.6635     0.1639 0.088 0.524 0.000 0.388
#> GSM531608     3  0.2814     0.7804 0.132 0.000 0.868 0.000
#> GSM531610     4  0.1661     0.7960 0.052 0.004 0.000 0.944
#> GSM531612     2  0.0000     0.9311 0.000 1.000 0.000 0.000
#> GSM531613     2  0.0000     0.9311 0.000 1.000 0.000 0.000
#> GSM531614     4  0.2011     0.7832 0.080 0.000 0.000 0.920
#> GSM531616     3  0.4304     0.8028 0.284 0.000 0.716 0.000
#> GSM531618     4  0.0817     0.8116 0.024 0.000 0.000 0.976
#> GSM531619     3  0.0000     0.7459 0.000 0.000 1.000 0.000
#> GSM531620     1  0.5906    -0.0324 0.528 0.000 0.436 0.036
#> GSM531623     3  0.4250     0.8059 0.276 0.000 0.724 0.000
#> GSM531625     3  0.0000     0.7459 0.000 0.000 1.000 0.000
#> GSM531626     1  0.5519     0.5357 0.684 0.000 0.264 0.052
#> GSM531632     1  0.4679     0.5729 0.648 0.000 0.000 0.352
#> GSM531638     1  0.5376     0.6527 0.736 0.000 0.176 0.088
#> GSM531639     4  0.0336     0.8089 0.008 0.000 0.000 0.992
#> GSM531641     4  0.4999     0.5004 0.012 0.328 0.000 0.660
#> GSM531642     4  0.0336     0.8089 0.008 0.000 0.000 0.992
#> GSM531643     4  0.0817     0.8116 0.024 0.000 0.000 0.976
#> GSM531644     4  0.0817     0.8116 0.024 0.000 0.000 0.976
#> GSM531645     4  0.0817     0.8116 0.024 0.000 0.000 0.976
#> GSM531646     1  0.5355     0.6492 0.736 0.000 0.180 0.084
#> GSM531647     1  0.4277     0.6523 0.720 0.000 0.000 0.280
#> GSM531648     4  0.0817     0.8116 0.024 0.000 0.000 0.976
#> GSM531650     4  0.0817     0.8116 0.024 0.000 0.000 0.976
#> GSM531651     3  0.0000     0.7459 0.000 0.000 1.000 0.000
#> GSM531652     4  0.0817     0.8116 0.024 0.000 0.000 0.976
#> GSM531656     4  0.0817     0.8116 0.024 0.000 0.000 0.976
#> GSM531659     4  0.0336     0.8089 0.008 0.000 0.000 0.992
#> GSM531661     3  0.4304     0.8028 0.284 0.000 0.716 0.000
#> GSM531662     4  0.4992    -0.1610 0.476 0.000 0.000 0.524
#> GSM531663     4  0.0469     0.8121 0.012 0.000 0.000 0.988
#> GSM531664     4  0.4387     0.6214 0.012 0.236 0.000 0.752
#> GSM531666     4  0.4387     0.6214 0.012 0.236 0.000 0.752
#> GSM531667     3  0.4304     0.8028 0.284 0.000 0.716 0.000
#> GSM531668     4  0.0592     0.8105 0.016 0.000 0.000 0.984
#> GSM531669     4  0.0707     0.8118 0.020 0.000 0.000 0.980
#> GSM531671     4  0.4998    -0.2009 0.488 0.000 0.000 0.512
#> GSM531672     4  0.5466     0.2346 0.016 0.436 0.000 0.548
#> GSM531673     4  0.0469     0.8121 0.012 0.000 0.000 0.988
#> GSM531676     2  0.3834     0.8263 0.076 0.848 0.000 0.076
#> GSM531679     2  0.0000     0.9311 0.000 1.000 0.000 0.000
#> GSM531681     2  0.0000     0.9311 0.000 1.000 0.000 0.000
#> GSM531682     2  0.0000     0.9311 0.000 1.000 0.000 0.000
#> GSM531683     2  0.0000     0.9311 0.000 1.000 0.000 0.000
#> GSM531684     4  0.4453     0.6640 0.244 0.012 0.000 0.744
#> GSM531685     2  0.3833     0.8279 0.080 0.848 0.000 0.072
#> GSM531686     2  0.0000     0.9311 0.000 1.000 0.000 0.000
#> GSM531687     2  0.1716     0.8991 0.064 0.936 0.000 0.000
#> GSM531688     2  0.1716     0.8991 0.064 0.936 0.000 0.000
#> GSM531690     2  0.0000     0.9311 0.000 1.000 0.000 0.000
#> GSM531693     4  0.7269     0.2557 0.156 0.356 0.000 0.488
#> GSM531695     2  0.0000     0.9311 0.000 1.000 0.000 0.000
#> GSM531603     2  0.6635     0.1639 0.088 0.524 0.000 0.388
#> GSM531609     4  0.2011     0.7832 0.080 0.000 0.000 0.920
#> GSM531611     2  0.0000     0.9311 0.000 1.000 0.000 0.000
#> GSM531621     3  0.0000     0.7459 0.000 0.000 1.000 0.000
#> GSM531622     3  0.4250     0.8059 0.276 0.000 0.724 0.000
#> GSM531628     1  0.5410     0.6755 0.728 0.000 0.080 0.192
#> GSM531630     3  0.4304     0.8028 0.284 0.000 0.716 0.000
#> GSM531633     3  0.0000     0.7459 0.000 0.000 1.000 0.000
#> GSM531635     3  0.4304     0.8028 0.284 0.000 0.716 0.000
#> GSM531640     3  0.4250     0.8059 0.276 0.000 0.724 0.000
#> GSM531649     1  0.5519     0.5357 0.684 0.000 0.264 0.052
#> GSM531653     1  0.4624     0.5795 0.660 0.000 0.000 0.340
#> GSM531657     4  0.5417     0.3016 0.016 0.412 0.000 0.572
#> GSM531665     4  0.0469     0.8121 0.012 0.000 0.000 0.988
#> GSM531670     4  0.0817     0.8116 0.024 0.000 0.000 0.976
#> GSM531674     4  0.0817     0.8116 0.024 0.000 0.000 0.976
#> GSM531675     2  0.0000     0.9311 0.000 1.000 0.000 0.000
#> GSM531677     2  0.0000     0.9311 0.000 1.000 0.000 0.000
#> GSM531678     2  0.0188     0.9285 0.000 0.996 0.000 0.004
#> GSM531680     2  0.0000     0.9311 0.000 1.000 0.000 0.000
#> GSM531689     2  0.0000     0.9311 0.000 1.000 0.000 0.000
#> GSM531691     2  0.1716     0.8991 0.064 0.936 0.000 0.000
#> GSM531692     4  0.4220     0.6650 0.248 0.004 0.000 0.748
#> GSM531694     2  0.0000     0.9311 0.000 1.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
#> GSM531602     2  0.0000     0.9243 0.000 1.000 0.000 0.000 0.000
#> GSM531604     5  0.3636     0.8516 0.000 0.000 0.000 0.272 0.728
#> GSM531606     5  0.3636     0.8516 0.000 0.000 0.000 0.272 0.728
#> GSM531607     2  0.6514    -0.0410 0.004 0.516 0.000 0.236 0.244
#> GSM531608     3  0.2732     0.7385 0.160 0.000 0.840 0.000 0.000
#> GSM531610     4  0.5364     0.4644 0.112 0.004 0.000 0.672 0.212
#> GSM531612     2  0.0000     0.9243 0.000 1.000 0.000 0.000 0.000
#> GSM531613     2  0.0000     0.9243 0.000 1.000 0.000 0.000 0.000
#> GSM531614     4  0.5460     0.4350 0.148 0.000 0.000 0.656 0.196
#> GSM531616     3  0.3876     0.7626 0.316 0.000 0.684 0.000 0.000
#> GSM531618     4  0.0771     0.7849 0.020 0.000 0.000 0.976 0.004
#> GSM531619     3  0.1608     0.6799 0.000 0.000 0.928 0.000 0.072
#> GSM531620     1  0.4817    -0.0906 0.572 0.000 0.404 0.024 0.000
#> GSM531623     3  0.3816     0.7666 0.304 0.000 0.696 0.000 0.000
#> GSM531625     3  0.1608     0.6799 0.000 0.000 0.928 0.000 0.072
#> GSM531626     1  0.4192     0.4535 0.736 0.000 0.232 0.032 0.000
#> GSM531632     1  0.3636     0.6320 0.728 0.000 0.000 0.272 0.000
#> GSM531638     1  0.3780     0.5889 0.808 0.000 0.132 0.060 0.000
#> GSM531639     4  0.1205     0.7658 0.004 0.000 0.000 0.956 0.040
#> GSM531641     4  0.5203     0.2101 0.004 0.324 0.000 0.620 0.052
#> GSM531642     4  0.1357     0.7614 0.004 0.000 0.000 0.948 0.048
#> GSM531643     4  0.0771     0.7849 0.020 0.000 0.000 0.976 0.004
#> GSM531644     4  0.0671     0.7861 0.016 0.000 0.000 0.980 0.004
#> GSM531645     4  0.0671     0.7861 0.016 0.000 0.000 0.980 0.004
#> GSM531646     1  0.3714     0.5852 0.812 0.000 0.132 0.056 0.000
#> GSM531647     1  0.3109     0.6625 0.800 0.000 0.000 0.200 0.000
#> GSM531648     4  0.0671     0.7861 0.016 0.000 0.000 0.980 0.004
#> GSM531650     4  0.0671     0.7861 0.016 0.000 0.000 0.980 0.004
#> GSM531651     3  0.1608     0.6799 0.000 0.000 0.928 0.000 0.072
#> GSM531652     4  0.0671     0.7861 0.016 0.000 0.000 0.980 0.004
#> GSM531656     4  0.0771     0.7849 0.020 0.000 0.000 0.976 0.004
#> GSM531659     4  0.1357     0.7614 0.004 0.000 0.000 0.948 0.048
#> GSM531661     3  0.3876     0.7626 0.316 0.000 0.684 0.000 0.000
#> GSM531662     1  0.4610     0.3951 0.556 0.000 0.000 0.432 0.012
#> GSM531663     4  0.0609     0.7799 0.000 0.000 0.000 0.980 0.020
#> GSM531664     4  0.4701     0.4006 0.004 0.232 0.000 0.712 0.052
#> GSM531666     4  0.4701     0.4006 0.004 0.232 0.000 0.712 0.052
#> GSM531667     3  0.3876     0.7626 0.316 0.000 0.684 0.000 0.000
#> GSM531668     4  0.0955     0.7739 0.004 0.000 0.000 0.968 0.028
#> GSM531669     4  0.0912     0.7843 0.012 0.000 0.000 0.972 0.016
#> GSM531671     1  0.4590     0.4230 0.568 0.000 0.000 0.420 0.012
#> GSM531672     4  0.5782    -0.0783 0.004 0.432 0.000 0.488 0.076
#> GSM531673     4  0.0609     0.7799 0.000 0.000 0.000 0.980 0.020
#> GSM531676     2  0.3291     0.7900 0.000 0.840 0.000 0.040 0.120
#> GSM531679     2  0.0000     0.9243 0.000 1.000 0.000 0.000 0.000
#> GSM531681     2  0.0000     0.9243 0.000 1.000 0.000 0.000 0.000
#> GSM531682     2  0.0000     0.9243 0.000 1.000 0.000 0.000 0.000
#> GSM531683     2  0.0000     0.9243 0.000 1.000 0.000 0.000 0.000
#> GSM531684     5  0.3715     0.8480 0.000 0.004 0.000 0.260 0.736
#> GSM531685     2  0.3291     0.7903 0.000 0.840 0.000 0.040 0.120
#> GSM531686     2  0.0000     0.9243 0.000 1.000 0.000 0.000 0.000
#> GSM531687     2  0.1544     0.8821 0.000 0.932 0.000 0.000 0.068
#> GSM531688     2  0.1544     0.8821 0.000 0.932 0.000 0.000 0.068
#> GSM531690     2  0.0000     0.9243 0.000 1.000 0.000 0.000 0.000
#> GSM531693     5  0.6652     0.3924 0.000 0.348 0.000 0.232 0.420
#> GSM531695     2  0.0000     0.9243 0.000 1.000 0.000 0.000 0.000
#> GSM531603     2  0.6514    -0.0410 0.004 0.516 0.000 0.236 0.244
#> GSM531609     4  0.5460     0.4350 0.148 0.000 0.000 0.656 0.196
#> GSM531611     2  0.0000     0.9243 0.000 1.000 0.000 0.000 0.000
#> GSM531621     3  0.1608     0.6799 0.000 0.000 0.928 0.000 0.072
#> GSM531622     3  0.3816     0.7666 0.304 0.000 0.696 0.000 0.000
#> GSM531628     1  0.3527     0.6351 0.828 0.000 0.056 0.116 0.000
#> GSM531630     3  0.3876     0.7626 0.316 0.000 0.684 0.000 0.000
#> GSM531633     3  0.1608     0.6799 0.000 0.000 0.928 0.000 0.072
#> GSM531635     3  0.3876     0.7626 0.316 0.000 0.684 0.000 0.000
#> GSM531640     3  0.3816     0.7666 0.304 0.000 0.696 0.000 0.000
#> GSM531649     1  0.4192     0.4535 0.736 0.000 0.232 0.032 0.000
#> GSM531653     1  0.3689     0.6361 0.740 0.000 0.000 0.256 0.004
#> GSM531657     4  0.5803    -0.0411 0.004 0.408 0.000 0.508 0.080
#> GSM531665     4  0.0609     0.7799 0.000 0.000 0.000 0.980 0.020
#> GSM531670     4  0.0771     0.7849 0.020 0.000 0.000 0.976 0.004
#> GSM531674     4  0.0771     0.7849 0.020 0.000 0.000 0.976 0.004
#> GSM531675     2  0.0000     0.9243 0.000 1.000 0.000 0.000 0.000
#> GSM531677     2  0.0000     0.9243 0.000 1.000 0.000 0.000 0.000
#> GSM531678     2  0.0162     0.9220 0.000 0.996 0.000 0.000 0.004
#> GSM531680     2  0.0000     0.9243 0.000 1.000 0.000 0.000 0.000
#> GSM531689     2  0.0000     0.9243 0.000 1.000 0.000 0.000 0.000
#> GSM531691     2  0.1544     0.8821 0.000 0.932 0.000 0.000 0.068
#> GSM531692     5  0.3636     0.8481 0.000 0.000 0.000 0.272 0.728
#> GSM531694     2  0.0000     0.9243 0.000 1.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
#> GSM531602     2  0.0000     0.9207 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM531604     5  0.3052     0.6699 0.000 0.000 0.000 0.004 0.780 0.216
#> GSM531606     5  0.3052     0.6699 0.000 0.000 0.000 0.004 0.780 0.216
#> GSM531607     2  0.6294     0.0704 0.008 0.508 0.000 0.016 0.248 0.220
#> GSM531608     3  0.3196     0.6039 0.156 0.000 0.816 0.020 0.008 0.000
#> GSM531610     4  0.3023     0.9093 0.000 0.004 0.000 0.808 0.008 0.180
#> GSM531612     2  0.0260     0.9179 0.008 0.992 0.000 0.000 0.000 0.000
#> GSM531613     2  0.0260     0.9179 0.008 0.992 0.000 0.000 0.000 0.000
#> GSM531614     4  0.2988     0.9559 0.024 0.000 0.000 0.824 0.000 0.152
#> GSM531616     3  0.0146     0.6521 0.004 0.000 0.996 0.000 0.000 0.000
#> GSM531618     6  0.0508     0.8222 0.012 0.000 0.000 0.004 0.000 0.984
#> GSM531619     3  0.6592     0.4371 0.348 0.000 0.448 0.136 0.068 0.000
#> GSM531620     3  0.3448     0.1858 0.280 0.000 0.716 0.000 0.000 0.004
#> GSM531623     3  0.0260     0.6537 0.008 0.000 0.992 0.000 0.000 0.000
#> GSM531625     3  0.6592     0.4371 0.348 0.000 0.448 0.136 0.068 0.000
#> GSM531626     3  0.3975    -0.2899 0.452 0.000 0.544 0.000 0.000 0.004
#> GSM531632     1  0.5183     0.6712 0.604 0.000 0.140 0.000 0.000 0.256
#> GSM531638     1  0.4326     0.4798 0.572 0.000 0.404 0.000 0.000 0.024
#> GSM531639     6  0.1649     0.8039 0.000 0.000 0.000 0.032 0.036 0.932
#> GSM531641     6  0.5397     0.3444 0.008 0.316 0.000 0.032 0.048 0.596
#> GSM531642     6  0.1789     0.7996 0.000 0.000 0.000 0.032 0.044 0.924
#> GSM531643     6  0.0508     0.8222 0.012 0.000 0.000 0.004 0.000 0.984
#> GSM531644     6  0.0405     0.8236 0.008 0.000 0.000 0.004 0.000 0.988
#> GSM531645     6  0.0405     0.8236 0.008 0.000 0.000 0.004 0.000 0.988
#> GSM531646     1  0.4261     0.4715 0.572 0.000 0.408 0.000 0.000 0.020
#> GSM531647     1  0.5083     0.6923 0.632 0.000 0.204 0.000 0.000 0.164
#> GSM531648     6  0.0405     0.8236 0.008 0.000 0.000 0.004 0.000 0.988
#> GSM531650     6  0.0405     0.8236 0.008 0.000 0.000 0.004 0.000 0.988
#> GSM531651     3  0.6592     0.4371 0.348 0.000 0.448 0.136 0.068 0.000
#> GSM531652     6  0.0405     0.8236 0.008 0.000 0.000 0.004 0.000 0.988
#> GSM531656     6  0.0508     0.8222 0.012 0.000 0.000 0.004 0.000 0.984
#> GSM531659     6  0.1789     0.7996 0.000 0.000 0.000 0.032 0.044 0.924
#> GSM531661     3  0.0146     0.6521 0.004 0.000 0.996 0.000 0.000 0.000
#> GSM531662     1  0.4136     0.4869 0.560 0.000 0.000 0.012 0.000 0.428
#> GSM531663     6  0.1168     0.8159 0.000 0.000 0.000 0.028 0.016 0.956
#> GSM531664     6  0.4756     0.5060 0.000 0.232 0.000 0.032 0.048 0.688
#> GSM531666     6  0.4756     0.5060 0.000 0.232 0.000 0.032 0.048 0.688
#> GSM531667     3  0.0146     0.6521 0.004 0.000 0.996 0.000 0.000 0.000
#> GSM531668     6  0.1418     0.8106 0.000 0.000 0.000 0.032 0.024 0.944
#> GSM531669     6  0.0405     0.8229 0.004 0.000 0.000 0.000 0.008 0.988
#> GSM531671     1  0.4116     0.5001 0.572 0.000 0.000 0.012 0.000 0.416
#> GSM531672     6  0.5965     0.0886 0.008 0.424 0.000 0.036 0.072 0.460
#> GSM531673     6  0.1168     0.8159 0.000 0.000 0.000 0.028 0.016 0.956
#> GSM531676     2  0.3312     0.7828 0.020 0.828 0.000 0.000 0.124 0.028
#> GSM531679     2  0.0000     0.9207 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM531681     2  0.0000     0.9207 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM531682     2  0.0000     0.9207 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM531683     2  0.0000     0.9207 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM531684     5  0.1956     0.6687 0.000 0.004 0.000 0.008 0.908 0.080
#> GSM531685     2  0.3312     0.7828 0.020 0.828 0.000 0.000 0.124 0.028
#> GSM531686     2  0.0000     0.9207 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM531687     2  0.1807     0.8739 0.020 0.920 0.000 0.000 0.060 0.000
#> GSM531688     2  0.1807     0.8739 0.020 0.920 0.000 0.000 0.060 0.000
#> GSM531690     2  0.0000     0.9207 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM531693     5  0.5647     0.3472 0.020 0.336 0.000 0.008 0.556 0.080
#> GSM531695     2  0.0000     0.9207 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM531603     2  0.6294     0.0704 0.008 0.508 0.000 0.016 0.248 0.220
#> GSM531609     4  0.2988     0.9559 0.024 0.000 0.000 0.824 0.000 0.152
#> GSM531611     2  0.0260     0.9179 0.008 0.992 0.000 0.000 0.000 0.000
#> GSM531621     3  0.6592     0.4371 0.348 0.000 0.448 0.136 0.068 0.000
#> GSM531622     3  0.0260     0.6537 0.008 0.000 0.992 0.000 0.000 0.000
#> GSM531628     1  0.4983     0.5728 0.564 0.000 0.356 0.000 0.000 0.080
#> GSM531630     3  0.0146     0.6521 0.004 0.000 0.996 0.000 0.000 0.000
#> GSM531633     3  0.6592     0.4371 0.348 0.000 0.448 0.136 0.068 0.000
#> GSM531635     3  0.0146     0.6521 0.004 0.000 0.996 0.000 0.000 0.000
#> GSM531640     3  0.0260     0.6537 0.008 0.000 0.992 0.000 0.000 0.000
#> GSM531649     3  0.3975    -0.2899 0.452 0.000 0.544 0.000 0.000 0.004
#> GSM531653     1  0.5214     0.6833 0.624 0.000 0.148 0.004 0.000 0.224
#> GSM531657     6  0.5929     0.1337 0.008 0.400 0.000 0.032 0.076 0.484
#> GSM531665     6  0.1168     0.8159 0.000 0.000 0.000 0.028 0.016 0.956
#> GSM531670     6  0.0508     0.8222 0.012 0.000 0.000 0.004 0.000 0.984
#> GSM531674     6  0.0508     0.8222 0.012 0.000 0.000 0.004 0.000 0.984
#> GSM531675     2  0.0000     0.9207 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM531677     2  0.0000     0.9207 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM531678     2  0.0146     0.9190 0.000 0.996 0.000 0.000 0.004 0.000
#> GSM531680     2  0.0000     0.9207 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM531689     2  0.0000     0.9207 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM531691     2  0.1807     0.8739 0.020 0.920 0.000 0.000 0.060 0.000
#> GSM531692     5  0.2070     0.6598 0.000 0.000 0.000 0.012 0.896 0.092
#> GSM531694     2  0.0000     0.9207 0.000 1.000 0.000 0.000 0.000 0.000

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

consensus_heatmap(res, k = 2)

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 disease.state(p) k
#> ATC:hclust 75            0.486 2
#> ATC:hclust 69            0.213 3
#> ATC:hclust 72            0.301 4
#> ATC:hclust 64            0.556 5
#> ATC:hclust 63            0.586 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 51941 rows and 80 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 0.711           0.862       0.935         0.4804 0.497   0.497
#> 3 3 1.000           0.964       0.981         0.3677 0.661   0.424
#> 4 4 0.750           0.704       0.827         0.1107 0.936   0.815
#> 5 5 0.715           0.674       0.786         0.0520 0.972   0.903
#> 6 6 0.720           0.638       0.798         0.0442 0.927   0.731

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
#> GSM531602     2   0.000      0.976 0.000 1.000
#> GSM531604     2   0.000      0.976 0.000 1.000
#> GSM531606     2   0.000      0.976 0.000 1.000
#> GSM531607     2   0.000      0.976 0.000 1.000
#> GSM531608     1   0.000      0.865 1.000 0.000
#> GSM531610     2   0.000      0.976 0.000 1.000
#> GSM531612     2   0.000      0.976 0.000 1.000
#> GSM531613     2   0.000      0.976 0.000 1.000
#> GSM531614     1   0.000      0.865 1.000 0.000
#> GSM531616     1   0.000      0.865 1.000 0.000
#> GSM531618     1   0.943      0.592 0.640 0.360
#> GSM531619     1   0.000      0.865 1.000 0.000
#> GSM531620     1   0.000      0.865 1.000 0.000
#> GSM531623     1   0.000      0.865 1.000 0.000
#> GSM531625     1   0.000      0.865 1.000 0.000
#> GSM531626     1   0.000      0.865 1.000 0.000
#> GSM531632     1   0.000      0.865 1.000 0.000
#> GSM531638     1   0.000      0.865 1.000 0.000
#> GSM531639     2   0.730      0.677 0.204 0.796
#> GSM531641     2   0.000      0.976 0.000 1.000
#> GSM531642     2   0.000      0.976 0.000 1.000
#> GSM531643     1   0.943      0.592 0.640 0.360
#> GSM531644     1   0.943      0.592 0.640 0.360
#> GSM531645     1   0.952      0.568 0.628 0.372
#> GSM531646     1   0.000      0.865 1.000 0.000
#> GSM531647     1   0.000      0.865 1.000 0.000
#> GSM531648     1   0.943      0.592 0.640 0.360
#> GSM531650     1   0.943      0.592 0.640 0.360
#> GSM531651     1   0.000      0.865 1.000 0.000
#> GSM531652     1   0.943      0.592 0.640 0.360
#> GSM531656     1   0.943      0.592 0.640 0.360
#> GSM531659     2   0.000      0.976 0.000 1.000
#> GSM531661     1   0.000      0.865 1.000 0.000
#> GSM531662     1   0.943      0.592 0.640 0.360
#> GSM531663     2   0.584      0.792 0.140 0.860
#> GSM531664     2   0.000      0.976 0.000 1.000
#> GSM531666     2   0.000      0.976 0.000 1.000
#> GSM531667     1   0.000      0.865 1.000 0.000
#> GSM531668     2   0.000      0.976 0.000 1.000
#> GSM531669     2   0.000      0.976 0.000 1.000
#> GSM531671     1   0.000      0.865 1.000 0.000
#> GSM531672     2   0.000      0.976 0.000 1.000
#> GSM531673     2   0.000      0.976 0.000 1.000
#> GSM531676     2   0.000      0.976 0.000 1.000
#> GSM531679     2   0.000      0.976 0.000 1.000
#> GSM531681     2   0.000      0.976 0.000 1.000
#> GSM531682     2   0.000      0.976 0.000 1.000
#> GSM531683     2   0.000      0.976 0.000 1.000
#> GSM531684     2   0.000      0.976 0.000 1.000
#> GSM531685     2   0.000      0.976 0.000 1.000
#> GSM531686     2   0.000      0.976 0.000 1.000
#> GSM531687     2   0.000      0.976 0.000 1.000
#> GSM531688     2   0.000      0.976 0.000 1.000
#> GSM531690     2   0.000      0.976 0.000 1.000
#> GSM531693     2   0.000      0.976 0.000 1.000
#> GSM531695     2   0.000      0.976 0.000 1.000
#> GSM531603     2   0.000      0.976 0.000 1.000
#> GSM531609     2   1.000     -0.237 0.492 0.508
#> GSM531611     2   0.000      0.976 0.000 1.000
#> GSM531621     1   0.000      0.865 1.000 0.000
#> GSM531622     1   0.000      0.865 1.000 0.000
#> GSM531628     1   0.000      0.865 1.000 0.000
#> GSM531630     1   0.000      0.865 1.000 0.000
#> GSM531633     1   0.000      0.865 1.000 0.000
#> GSM531635     1   0.000      0.865 1.000 0.000
#> GSM531640     1   0.000      0.865 1.000 0.000
#> GSM531649     1   0.000      0.865 1.000 0.000
#> GSM531653     1   0.118      0.858 0.984 0.016
#> GSM531657     2   0.000      0.976 0.000 1.000
#> GSM531665     1   0.943      0.592 0.640 0.360
#> GSM531670     1   0.943      0.592 0.640 0.360
#> GSM531674     1   0.943      0.592 0.640 0.360
#> GSM531675     2   0.000      0.976 0.000 1.000
#> GSM531677     2   0.000      0.976 0.000 1.000
#> GSM531678     2   0.000      0.976 0.000 1.000
#> GSM531680     2   0.000      0.976 0.000 1.000
#> GSM531689     2   0.000      0.976 0.000 1.000
#> GSM531691     2   0.000      0.976 0.000 1.000
#> GSM531692     2   0.000      0.976 0.000 1.000
#> GSM531694     2   0.000      0.976 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
#> GSM531602     2  0.0000      0.978 0.000 1.000 0.000
#> GSM531604     1  0.0892      0.976 0.980 0.020 0.000
#> GSM531606     2  0.6180      0.265 0.416 0.584 0.000
#> GSM531607     2  0.0000      0.978 0.000 1.000 0.000
#> GSM531608     3  0.0892      0.981 0.020 0.000 0.980
#> GSM531610     1  0.0237      0.974 0.996 0.004 0.000
#> GSM531612     2  0.0000      0.978 0.000 1.000 0.000
#> GSM531613     2  0.0000      0.978 0.000 1.000 0.000
#> GSM531614     1  0.0000      0.972 1.000 0.000 0.000
#> GSM531616     3  0.0000      0.997 0.000 0.000 1.000
#> GSM531618     1  0.0983      0.978 0.980 0.004 0.016
#> GSM531619     3  0.0000      0.997 0.000 0.000 1.000
#> GSM531620     3  0.0000      0.997 0.000 0.000 1.000
#> GSM531623     3  0.0000      0.997 0.000 0.000 1.000
#> GSM531625     3  0.0000      0.997 0.000 0.000 1.000
#> GSM531626     3  0.0000      0.997 0.000 0.000 1.000
#> GSM531632     1  0.1753      0.952 0.952 0.000 0.048
#> GSM531638     3  0.1529      0.955 0.040 0.000 0.960
#> GSM531639     1  0.0983      0.978 0.980 0.004 0.016
#> GSM531641     1  0.0892      0.976 0.980 0.020 0.000
#> GSM531642     1  0.0892      0.976 0.980 0.020 0.000
#> GSM531643     1  0.0983      0.978 0.980 0.004 0.016
#> GSM531644     1  0.0983      0.978 0.980 0.004 0.016
#> GSM531645     1  0.0983      0.978 0.980 0.004 0.016
#> GSM531646     3  0.0000      0.997 0.000 0.000 1.000
#> GSM531647     1  0.1289      0.966 0.968 0.000 0.032
#> GSM531648     1  0.0983      0.978 0.980 0.004 0.016
#> GSM531650     1  0.0983      0.978 0.980 0.004 0.016
#> GSM531651     3  0.0000      0.997 0.000 0.000 1.000
#> GSM531652     1  0.0983      0.978 0.980 0.004 0.016
#> GSM531656     1  0.0983      0.978 0.980 0.004 0.016
#> GSM531659     1  0.0892      0.976 0.980 0.020 0.000
#> GSM531661     3  0.0000      0.997 0.000 0.000 1.000
#> GSM531662     1  0.0983      0.978 0.980 0.004 0.016
#> GSM531663     1  0.0892      0.976 0.980 0.020 0.000
#> GSM531664     1  0.0892      0.976 0.980 0.020 0.000
#> GSM531666     1  0.0892      0.976 0.980 0.020 0.000
#> GSM531667     3  0.0000      0.997 0.000 0.000 1.000
#> GSM531668     1  0.0892      0.976 0.980 0.020 0.000
#> GSM531669     1  0.0892      0.976 0.980 0.020 0.000
#> GSM531671     1  0.0892      0.975 0.980 0.000 0.020
#> GSM531672     1  0.0892      0.976 0.980 0.020 0.000
#> GSM531673     1  0.0892      0.976 0.980 0.020 0.000
#> GSM531676     2  0.0000      0.978 0.000 1.000 0.000
#> GSM531679     2  0.0000      0.978 0.000 1.000 0.000
#> GSM531681     2  0.0000      0.978 0.000 1.000 0.000
#> GSM531682     2  0.0000      0.978 0.000 1.000 0.000
#> GSM531683     2  0.0000      0.978 0.000 1.000 0.000
#> GSM531684     2  0.1964      0.919 0.056 0.944 0.000
#> GSM531685     2  0.0000      0.978 0.000 1.000 0.000
#> GSM531686     2  0.0000      0.978 0.000 1.000 0.000
#> GSM531687     2  0.0000      0.978 0.000 1.000 0.000
#> GSM531688     2  0.0000      0.978 0.000 1.000 0.000
#> GSM531690     2  0.0000      0.978 0.000 1.000 0.000
#> GSM531693     1  0.5988      0.425 0.632 0.368 0.000
#> GSM531695     2  0.0000      0.978 0.000 1.000 0.000
#> GSM531603     2  0.0000      0.978 0.000 1.000 0.000
#> GSM531609     1  0.0000      0.972 1.000 0.000 0.000
#> GSM531611     2  0.0000      0.978 0.000 1.000 0.000
#> GSM531621     3  0.0000      0.997 0.000 0.000 1.000
#> GSM531622     3  0.0000      0.997 0.000 0.000 1.000
#> GSM531628     3  0.0000      0.997 0.000 0.000 1.000
#> GSM531630     3  0.0000      0.997 0.000 0.000 1.000
#> GSM531633     3  0.0000      0.997 0.000 0.000 1.000
#> GSM531635     3  0.0000      0.997 0.000 0.000 1.000
#> GSM531640     3  0.0000      0.997 0.000 0.000 1.000
#> GSM531649     3  0.0000      0.997 0.000 0.000 1.000
#> GSM531653     1  0.0892      0.975 0.980 0.000 0.020
#> GSM531657     1  0.0892      0.976 0.980 0.020 0.000
#> GSM531665     1  0.0983      0.978 0.980 0.004 0.016
#> GSM531670     1  0.0983      0.978 0.980 0.004 0.016
#> GSM531674     1  0.0983      0.978 0.980 0.004 0.016
#> GSM531675     2  0.0000      0.978 0.000 1.000 0.000
#> GSM531677     2  0.0000      0.978 0.000 1.000 0.000
#> GSM531678     2  0.0000      0.978 0.000 1.000 0.000
#> GSM531680     2  0.0000      0.978 0.000 1.000 0.000
#> GSM531689     2  0.0000      0.978 0.000 1.000 0.000
#> GSM531691     2  0.0000      0.978 0.000 1.000 0.000
#> GSM531692     1  0.0892      0.976 0.980 0.020 0.000
#> GSM531694     2  0.0000      0.978 0.000 1.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
#> GSM531602     2  0.0188      0.958 0.000 0.996 0.000 0.004
#> GSM531604     4  0.4632      0.616 0.308 0.004 0.000 0.688
#> GSM531606     4  0.6019      0.673 0.176 0.136 0.000 0.688
#> GSM531607     2  0.5383      0.121 0.012 0.536 0.000 0.452
#> GSM531608     3  0.0592      0.876 0.000 0.000 0.984 0.016
#> GSM531610     4  0.4907      0.162 0.420 0.000 0.000 0.580
#> GSM531612     2  0.0817      0.944 0.000 0.976 0.000 0.024
#> GSM531613     2  0.0707      0.946 0.000 0.980 0.000 0.020
#> GSM531614     1  0.3311      0.580 0.828 0.000 0.000 0.172
#> GSM531616     3  0.0000      0.875 0.000 0.000 1.000 0.000
#> GSM531618     1  0.0000      0.691 1.000 0.000 0.000 0.000
#> GSM531619     3  0.2216      0.858 0.000 0.000 0.908 0.092
#> GSM531620     3  0.2408      0.843 0.000 0.000 0.896 0.104
#> GSM531623     3  0.0592      0.876 0.000 0.000 0.984 0.016
#> GSM531625     3  0.2216      0.858 0.000 0.000 0.908 0.092
#> GSM531626     3  0.2408      0.843 0.000 0.000 0.896 0.104
#> GSM531632     1  0.5314      0.459 0.748 0.000 0.144 0.108
#> GSM531638     3  0.6820      0.446 0.364 0.000 0.528 0.108
#> GSM531639     1  0.1474      0.672 0.948 0.000 0.000 0.052
#> GSM531641     1  0.4790      0.329 0.620 0.000 0.000 0.380
#> GSM531642     1  0.4697      0.370 0.644 0.000 0.000 0.356
#> GSM531643     1  0.0000      0.691 1.000 0.000 0.000 0.000
#> GSM531644     1  0.0000      0.691 1.000 0.000 0.000 0.000
#> GSM531645     1  0.0000      0.691 1.000 0.000 0.000 0.000
#> GSM531646     3  0.6785      0.467 0.352 0.000 0.540 0.108
#> GSM531647     1  0.4605      0.519 0.800 0.000 0.092 0.108
#> GSM531648     1  0.0000      0.691 1.000 0.000 0.000 0.000
#> GSM531650     1  0.0000      0.691 1.000 0.000 0.000 0.000
#> GSM531651     3  0.2216      0.858 0.000 0.000 0.908 0.092
#> GSM531652     1  0.0000      0.691 1.000 0.000 0.000 0.000
#> GSM531656     1  0.0000      0.691 1.000 0.000 0.000 0.000
#> GSM531659     1  0.4877      0.274 0.592 0.000 0.000 0.408
#> GSM531661     3  0.0592      0.876 0.000 0.000 0.984 0.016
#> GSM531662     1  0.1022      0.682 0.968 0.000 0.000 0.032
#> GSM531663     1  0.4477      0.442 0.688 0.000 0.000 0.312
#> GSM531664     1  0.4697      0.368 0.644 0.000 0.000 0.356
#> GSM531666     1  0.4776      0.336 0.624 0.000 0.000 0.376
#> GSM531667     3  0.1716      0.859 0.000 0.000 0.936 0.064
#> GSM531668     1  0.4843      0.302 0.604 0.000 0.000 0.396
#> GSM531669     1  0.4679      0.375 0.648 0.000 0.000 0.352
#> GSM531671     1  0.4879      0.512 0.780 0.000 0.092 0.128
#> GSM531672     1  0.4916      0.230 0.576 0.000 0.000 0.424
#> GSM531673     1  0.4843      0.302 0.604 0.000 0.000 0.396
#> GSM531676     2  0.3074      0.819 0.000 0.848 0.000 0.152
#> GSM531679     2  0.0188      0.958 0.000 0.996 0.000 0.004
#> GSM531681     2  0.0188      0.958 0.000 0.996 0.000 0.004
#> GSM531682     2  0.0000      0.958 0.000 1.000 0.000 0.000
#> GSM531683     2  0.0188      0.958 0.000 0.996 0.000 0.004
#> GSM531684     4  0.5579      0.620 0.060 0.252 0.000 0.688
#> GSM531685     2  0.3024      0.820 0.000 0.852 0.000 0.148
#> GSM531686     2  0.0000      0.958 0.000 1.000 0.000 0.000
#> GSM531687     2  0.0000      0.958 0.000 1.000 0.000 0.000
#> GSM531688     2  0.0000      0.958 0.000 1.000 0.000 0.000
#> GSM531690     2  0.0188      0.958 0.000 0.996 0.000 0.004
#> GSM531693     4  0.5339      0.655 0.272 0.040 0.000 0.688
#> GSM531695     2  0.0000      0.958 0.000 1.000 0.000 0.000
#> GSM531603     4  0.5231      0.537 0.028 0.296 0.000 0.676
#> GSM531609     1  0.4356      0.480 0.708 0.000 0.000 0.292
#> GSM531611     2  0.0817      0.944 0.000 0.976 0.000 0.024
#> GSM531621     3  0.2216      0.858 0.000 0.000 0.908 0.092
#> GSM531622     3  0.0592      0.876 0.000 0.000 0.984 0.016
#> GSM531628     3  0.6867      0.409 0.384 0.000 0.508 0.108
#> GSM531630     3  0.0336      0.875 0.000 0.000 0.992 0.008
#> GSM531633     3  0.2216      0.858 0.000 0.000 0.908 0.092
#> GSM531635     3  0.0336      0.875 0.000 0.000 0.992 0.008
#> GSM531640     3  0.1940      0.863 0.000 0.000 0.924 0.076
#> GSM531649     3  0.2408      0.843 0.000 0.000 0.896 0.104
#> GSM531653     1  0.2469      0.612 0.892 0.000 0.000 0.108
#> GSM531657     1  0.4888      0.265 0.588 0.000 0.000 0.412
#> GSM531665     1  0.3688      0.568 0.792 0.000 0.000 0.208
#> GSM531670     1  0.0188      0.689 0.996 0.000 0.000 0.004
#> GSM531674     1  0.0000      0.691 1.000 0.000 0.000 0.000
#> GSM531675     2  0.0188      0.958 0.000 0.996 0.000 0.004
#> GSM531677     2  0.0000      0.958 0.000 1.000 0.000 0.000
#> GSM531678     2  0.0188      0.958 0.000 0.996 0.000 0.004
#> GSM531680     2  0.0000      0.958 0.000 1.000 0.000 0.000
#> GSM531689     2  0.0188      0.958 0.000 0.996 0.000 0.004
#> GSM531691     2  0.0000      0.958 0.000 1.000 0.000 0.000
#> GSM531692     4  0.4477      0.608 0.312 0.000 0.000 0.688
#> GSM531694     2  0.0188      0.958 0.000 0.996 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
#> GSM531602     2  0.0609      0.931 0.000 0.980 0.000 0.020 0.000
#> GSM531604     5  0.2389      0.785 0.116 0.000 0.000 0.004 0.880
#> GSM531606     5  0.2726      0.816 0.052 0.064 0.000 0.000 0.884
#> GSM531607     5  0.5448      0.460 0.000 0.340 0.000 0.076 0.584
#> GSM531608     3  0.3995      0.780 0.000 0.000 0.776 0.180 0.044
#> GSM531610     4  0.6802     -0.430 0.328 0.000 0.000 0.372 0.300
#> GSM531612     2  0.2971      0.862 0.000 0.836 0.000 0.156 0.008
#> GSM531613     2  0.2136      0.910 0.000 0.904 0.000 0.088 0.008
#> GSM531614     1  0.5834      0.306 0.584 0.000 0.000 0.284 0.132
#> GSM531616     3  0.3274      0.787 0.000 0.000 0.780 0.220 0.000
#> GSM531618     1  0.0000      0.645 1.000 0.000 0.000 0.000 0.000
#> GSM531619     3  0.1082      0.751 0.000 0.000 0.964 0.008 0.028
#> GSM531620     3  0.4171      0.613 0.000 0.000 0.604 0.396 0.000
#> GSM531623     3  0.2471      0.801 0.000 0.000 0.864 0.136 0.000
#> GSM531625     3  0.1082      0.751 0.000 0.000 0.964 0.008 0.028
#> GSM531626     3  0.4171      0.613 0.000 0.000 0.604 0.396 0.000
#> GSM531632     1  0.4708     -0.285 0.548 0.000 0.016 0.436 0.000
#> GSM531638     4  0.6660      0.496 0.324 0.000 0.244 0.432 0.000
#> GSM531639     1  0.3309      0.657 0.836 0.000 0.000 0.128 0.036
#> GSM531641     1  0.5618      0.604 0.628 0.000 0.000 0.236 0.136
#> GSM531642     1  0.5504      0.612 0.644 0.000 0.000 0.224 0.132
#> GSM531643     1  0.0290      0.641 0.992 0.000 0.000 0.008 0.000
#> GSM531644     1  0.0000      0.645 1.000 0.000 0.000 0.000 0.000
#> GSM531645     1  0.2648      0.657 0.848 0.000 0.000 0.152 0.000
#> GSM531646     4  0.6687      0.454 0.304 0.000 0.264 0.432 0.000
#> GSM531647     1  0.4242     -0.225 0.572 0.000 0.000 0.428 0.000
#> GSM531648     1  0.0000      0.645 1.000 0.000 0.000 0.000 0.000
#> GSM531650     1  0.0290      0.641 0.992 0.000 0.000 0.008 0.000
#> GSM531651     3  0.1082      0.751 0.000 0.000 0.964 0.008 0.028
#> GSM531652     1  0.0000      0.645 1.000 0.000 0.000 0.000 0.000
#> GSM531656     1  0.0000      0.645 1.000 0.000 0.000 0.000 0.000
#> GSM531659     1  0.6177      0.554 0.556 0.000 0.000 0.212 0.232
#> GSM531661     3  0.3039      0.796 0.000 0.000 0.808 0.192 0.000
#> GSM531662     1  0.3019      0.592 0.864 0.000 0.000 0.048 0.088
#> GSM531663     1  0.5446      0.625 0.660 0.000 0.000 0.164 0.176
#> GSM531664     1  0.5253      0.627 0.676 0.000 0.000 0.200 0.124
#> GSM531666     1  0.5618      0.604 0.628 0.000 0.000 0.236 0.136
#> GSM531667     3  0.3932      0.700 0.000 0.000 0.672 0.328 0.000
#> GSM531668     1  0.5773      0.606 0.616 0.000 0.000 0.168 0.216
#> GSM531669     1  0.4844      0.641 0.720 0.000 0.000 0.172 0.108
#> GSM531671     1  0.5071     -0.243 0.540 0.000 0.000 0.424 0.036
#> GSM531672     1  0.6255      0.537 0.540 0.000 0.000 0.252 0.208
#> GSM531673     1  0.5805      0.604 0.612 0.000 0.000 0.172 0.216
#> GSM531676     2  0.4487      0.767 0.000 0.756 0.000 0.104 0.140
#> GSM531679     2  0.0290      0.932 0.000 0.992 0.000 0.008 0.000
#> GSM531681     2  0.0404      0.932 0.000 0.988 0.000 0.012 0.000
#> GSM531682     2  0.1197      0.928 0.000 0.952 0.000 0.048 0.000
#> GSM531683     2  0.0404      0.932 0.000 0.988 0.000 0.012 0.000
#> GSM531684     5  0.2678      0.802 0.016 0.100 0.000 0.004 0.880
#> GSM531685     2  0.4493      0.766 0.000 0.756 0.000 0.108 0.136
#> GSM531686     2  0.0404      0.932 0.000 0.988 0.000 0.012 0.000
#> GSM531687     2  0.2389      0.905 0.000 0.880 0.000 0.116 0.004
#> GSM531688     2  0.2439      0.906 0.000 0.876 0.000 0.120 0.004
#> GSM531690     2  0.0404      0.932 0.000 0.988 0.000 0.012 0.000
#> GSM531693     5  0.4118      0.787 0.112 0.004 0.000 0.088 0.796
#> GSM531695     2  0.1478      0.924 0.000 0.936 0.000 0.064 0.000
#> GSM531603     5  0.4950      0.754 0.008 0.140 0.000 0.120 0.732
#> GSM531609     1  0.6445      0.386 0.456 0.000 0.000 0.360 0.184
#> GSM531611     2  0.2971      0.862 0.000 0.836 0.000 0.156 0.008
#> GSM531621     3  0.1082      0.751 0.000 0.000 0.964 0.008 0.028
#> GSM531622     3  0.2516      0.801 0.000 0.000 0.860 0.140 0.000
#> GSM531628     4  0.6626      0.501 0.340 0.000 0.228 0.432 0.000
#> GSM531630     3  0.3424      0.778 0.000 0.000 0.760 0.240 0.000
#> GSM531633     3  0.1082      0.751 0.000 0.000 0.964 0.008 0.028
#> GSM531635     3  0.3424      0.778 0.000 0.000 0.760 0.240 0.000
#> GSM531640     3  0.1197      0.781 0.000 0.000 0.952 0.048 0.000
#> GSM531649     3  0.4210      0.593 0.000 0.000 0.588 0.412 0.000
#> GSM531653     1  0.3109      0.385 0.800 0.000 0.000 0.200 0.000
#> GSM531657     1  0.6150      0.561 0.560 0.000 0.000 0.236 0.204
#> GSM531665     1  0.3667      0.633 0.812 0.000 0.000 0.048 0.140
#> GSM531670     1  0.0290      0.641 0.992 0.000 0.000 0.008 0.000
#> GSM531674     1  0.0290      0.641 0.992 0.000 0.000 0.008 0.000
#> GSM531675     2  0.0290      0.932 0.000 0.992 0.000 0.008 0.000
#> GSM531677     2  0.0290      0.932 0.000 0.992 0.000 0.008 0.000
#> GSM531678     2  0.1357      0.922 0.000 0.948 0.000 0.048 0.004
#> GSM531680     2  0.1341      0.926 0.000 0.944 0.000 0.056 0.000
#> GSM531689     2  0.1502      0.919 0.000 0.940 0.000 0.056 0.004
#> GSM531691     2  0.1704      0.922 0.000 0.928 0.000 0.068 0.004
#> GSM531692     5  0.2513      0.784 0.116 0.000 0.000 0.008 0.876
#> GSM531694     2  0.0404      0.932 0.000 0.988 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
#> GSM531602     2  0.0603      0.856 0.004 0.980 0.000 0.016 0.000 0.000
#> GSM531604     5  0.1624      0.804 0.008 0.000 0.000 0.012 0.936 0.044
#> GSM531606     5  0.1237      0.826 0.000 0.020 0.000 0.004 0.956 0.020
#> GSM531607     5  0.5572      0.588 0.016 0.228 0.000 0.116 0.628 0.012
#> GSM531608     3  0.5051      0.610 0.220 0.000 0.652 0.120 0.008 0.000
#> GSM531610     4  0.6093      0.572 0.036 0.000 0.000 0.524 0.136 0.304
#> GSM531612     2  0.3965      0.678 0.000 0.604 0.000 0.388 0.000 0.008
#> GSM531613     2  0.3266      0.775 0.000 0.728 0.000 0.272 0.000 0.000
#> GSM531614     4  0.6636      0.492 0.320 0.000 0.000 0.372 0.028 0.280
#> GSM531616     3  0.3482      0.617 0.316 0.000 0.684 0.000 0.000 0.000
#> GSM531618     6  0.2527      0.654 0.168 0.000 0.000 0.000 0.000 0.832
#> GSM531619     3  0.2331      0.687 0.000 0.000 0.888 0.080 0.032 0.000
#> GSM531620     1  0.3695      0.181 0.624 0.000 0.376 0.000 0.000 0.000
#> GSM531623     3  0.2697      0.706 0.188 0.000 0.812 0.000 0.000 0.000
#> GSM531625     3  0.2331      0.687 0.000 0.000 0.888 0.080 0.032 0.000
#> GSM531626     1  0.3684      0.189 0.628 0.000 0.372 0.000 0.000 0.000
#> GSM531632     1  0.1958      0.642 0.896 0.000 0.004 0.000 0.000 0.100
#> GSM531638     1  0.2088      0.667 0.904 0.000 0.068 0.000 0.000 0.028
#> GSM531639     6  0.1674      0.653 0.068 0.000 0.000 0.004 0.004 0.924
#> GSM531641     6  0.3094      0.538 0.000 0.000 0.000 0.140 0.036 0.824
#> GSM531642     6  0.2384      0.589 0.000 0.000 0.000 0.084 0.032 0.884
#> GSM531643     6  0.2527      0.654 0.168 0.000 0.000 0.000 0.000 0.832
#> GSM531644     6  0.2527      0.654 0.168 0.000 0.000 0.000 0.000 0.832
#> GSM531645     6  0.0547      0.647 0.020 0.000 0.000 0.000 0.000 0.980
#> GSM531646     1  0.2039      0.660 0.904 0.000 0.076 0.000 0.000 0.020
#> GSM531647     1  0.2260      0.608 0.860 0.000 0.000 0.000 0.000 0.140
#> GSM531648     6  0.2527      0.654 0.168 0.000 0.000 0.000 0.000 0.832
#> GSM531650     6  0.2527      0.654 0.168 0.000 0.000 0.000 0.000 0.832
#> GSM531651     3  0.2331      0.687 0.000 0.000 0.888 0.080 0.032 0.000
#> GSM531652     6  0.2527      0.654 0.168 0.000 0.000 0.000 0.000 0.832
#> GSM531656     6  0.2527      0.654 0.168 0.000 0.000 0.000 0.000 0.832
#> GSM531659     6  0.4635      0.431 0.008 0.000 0.000 0.148 0.132 0.712
#> GSM531661     3  0.3360      0.663 0.264 0.000 0.732 0.004 0.000 0.000
#> GSM531662     6  0.6274      0.291 0.272 0.000 0.000 0.096 0.088 0.544
#> GSM531663     6  0.4750      0.440 0.028 0.000 0.000 0.132 0.116 0.724
#> GSM531664     6  0.2462      0.589 0.000 0.000 0.000 0.096 0.028 0.876
#> GSM531666     6  0.3054      0.543 0.000 0.000 0.000 0.136 0.036 0.828
#> GSM531667     3  0.3997      0.206 0.488 0.000 0.508 0.004 0.000 0.000
#> GSM531668     6  0.4464      0.456 0.012 0.000 0.000 0.136 0.116 0.736
#> GSM531669     6  0.2015      0.630 0.016 0.000 0.000 0.056 0.012 0.916
#> GSM531671     1  0.3344      0.569 0.828 0.000 0.000 0.032 0.020 0.120
#> GSM531672     6  0.4687      0.303 0.004 0.000 0.000 0.240 0.084 0.672
#> GSM531673     6  0.4785      0.413 0.020 0.000 0.000 0.148 0.120 0.712
#> GSM531676     2  0.5671      0.604 0.024 0.604 0.000 0.212 0.160 0.000
#> GSM531679     2  0.0146      0.858 0.000 0.996 0.000 0.004 0.000 0.000
#> GSM531681     2  0.0000      0.858 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM531682     2  0.2278      0.845 0.004 0.868 0.000 0.128 0.000 0.000
#> GSM531683     2  0.0000      0.858 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM531684     5  0.1307      0.827 0.000 0.032 0.000 0.008 0.952 0.008
#> GSM531685     2  0.5811      0.600 0.024 0.576 0.000 0.244 0.156 0.000
#> GSM531686     2  0.0937      0.857 0.000 0.960 0.000 0.040 0.000 0.000
#> GSM531687     2  0.4299      0.766 0.024 0.696 0.000 0.260 0.020 0.000
#> GSM531688     2  0.4383      0.763 0.024 0.680 0.000 0.276 0.020 0.000
#> GSM531690     2  0.0146      0.858 0.000 0.996 0.000 0.004 0.000 0.000
#> GSM531693     5  0.3908      0.786 0.024 0.004 0.000 0.140 0.792 0.040
#> GSM531695     2  0.2994      0.817 0.004 0.788 0.000 0.208 0.000 0.000
#> GSM531603     5  0.4562      0.755 0.016 0.064 0.000 0.148 0.752 0.020
#> GSM531609     4  0.5556      0.542 0.060 0.000 0.000 0.468 0.032 0.440
#> GSM531611     2  0.3965      0.678 0.000 0.604 0.000 0.388 0.000 0.008
#> GSM531621     3  0.2331      0.687 0.000 0.000 0.888 0.080 0.032 0.000
#> GSM531622     3  0.2697      0.706 0.188 0.000 0.812 0.000 0.000 0.000
#> GSM531628     1  0.2129      0.672 0.904 0.000 0.056 0.000 0.000 0.040
#> GSM531630     3  0.3578      0.588 0.340 0.000 0.660 0.000 0.000 0.000
#> GSM531633     3  0.2331      0.687 0.000 0.000 0.888 0.080 0.032 0.000
#> GSM531635     3  0.3578      0.588 0.340 0.000 0.660 0.000 0.000 0.000
#> GSM531640     3  0.1444      0.713 0.072 0.000 0.928 0.000 0.000 0.000
#> GSM531649     1  0.3592      0.240 0.656 0.000 0.344 0.000 0.000 0.000
#> GSM531653     1  0.3862     -0.129 0.524 0.000 0.000 0.000 0.000 0.476
#> GSM531657     6  0.4314      0.425 0.000 0.000 0.000 0.184 0.096 0.720
#> GSM531665     6  0.5849      0.460 0.132 0.000 0.000 0.116 0.112 0.640
#> GSM531670     6  0.2668      0.653 0.168 0.000 0.000 0.004 0.000 0.828
#> GSM531674     6  0.2632      0.653 0.164 0.000 0.000 0.004 0.000 0.832
#> GSM531675     2  0.0146      0.858 0.000 0.996 0.000 0.004 0.000 0.000
#> GSM531677     2  0.0713      0.857 0.000 0.972 0.000 0.028 0.000 0.000
#> GSM531678     2  0.1398      0.846 0.000 0.940 0.000 0.052 0.008 0.000
#> GSM531680     2  0.2340      0.840 0.000 0.852 0.000 0.148 0.000 0.000
#> GSM531689     2  0.1398      0.845 0.000 0.940 0.000 0.052 0.008 0.000
#> GSM531691     2  0.2957      0.836 0.016 0.836 0.000 0.140 0.008 0.000
#> GSM531692     5  0.1806      0.804 0.008 0.000 0.000 0.020 0.928 0.044
#> GSM531694     2  0.0000      0.858 0.000 1.000 0.000 0.000 0.000 0.000

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

consensus_heatmap(res, k = 2)

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)
#> Error in mat[ceiling(1:nr/h_ratio), ceiling(1:nc/w_ratio), drop = FALSE]: subscript out of bounds

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

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

collect_plots(res)

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.970       0.988         0.5064 0.494   0.494
#> 3 3 0.930           0.941       0.976         0.2648 0.822   0.652
#> 4 4 0.856           0.843       0.932         0.1175 0.922   0.784
#> 5 5 0.839           0.776       0.894         0.0338 0.979   0.928
#> 6 6 0.862           0.794       0.882         0.0317 0.941   0.787

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
#> GSM531602     2   0.000      0.990 0.000 1.000
#> GSM531604     2   0.000      0.990 0.000 1.000
#> GSM531606     2   0.000      0.990 0.000 1.000
#> GSM531607     2   0.000      0.990 0.000 1.000
#> GSM531608     1   0.000      0.986 1.000 0.000
#> GSM531610     2   0.000      0.990 0.000 1.000
#> GSM531612     2   0.000      0.990 0.000 1.000
#> GSM531613     2   0.000      0.990 0.000 1.000
#> GSM531614     1   0.000      0.986 1.000 0.000
#> GSM531616     1   0.000      0.986 1.000 0.000
#> GSM531618     1   0.000      0.986 1.000 0.000
#> GSM531619     1   0.000      0.986 1.000 0.000
#> GSM531620     1   0.000      0.986 1.000 0.000
#> GSM531623     1   0.000      0.986 1.000 0.000
#> GSM531625     1   0.000      0.986 1.000 0.000
#> GSM531626     1   0.000      0.986 1.000 0.000
#> GSM531632     1   0.000      0.986 1.000 0.000
#> GSM531638     1   0.000      0.986 1.000 0.000
#> GSM531639     1   0.969      0.344 0.604 0.396
#> GSM531641     2   0.000      0.990 0.000 1.000
#> GSM531642     2   0.000      0.990 0.000 1.000
#> GSM531643     1   0.000      0.986 1.000 0.000
#> GSM531644     1   0.000      0.986 1.000 0.000
#> GSM531645     1   0.000      0.986 1.000 0.000
#> GSM531646     1   0.000      0.986 1.000 0.000
#> GSM531647     1   0.000      0.986 1.000 0.000
#> GSM531648     1   0.000      0.986 1.000 0.000
#> GSM531650     1   0.000      0.986 1.000 0.000
#> GSM531651     1   0.000      0.986 1.000 0.000
#> GSM531652     1   0.000      0.986 1.000 0.000
#> GSM531656     1   0.000      0.986 1.000 0.000
#> GSM531659     2   0.000      0.990 0.000 1.000
#> GSM531661     1   0.000      0.986 1.000 0.000
#> GSM531662     1   0.000      0.986 1.000 0.000
#> GSM531663     2   0.971      0.324 0.400 0.600
#> GSM531664     2   0.000      0.990 0.000 1.000
#> GSM531666     2   0.000      0.990 0.000 1.000
#> GSM531667     1   0.000      0.986 1.000 0.000
#> GSM531668     2   0.000      0.990 0.000 1.000
#> GSM531669     2   0.000      0.990 0.000 1.000
#> GSM531671     1   0.000      0.986 1.000 0.000
#> GSM531672     2   0.000      0.990 0.000 1.000
#> GSM531673     2   0.000      0.990 0.000 1.000
#> GSM531676     2   0.000      0.990 0.000 1.000
#> GSM531679     2   0.000      0.990 0.000 1.000
#> GSM531681     2   0.000      0.990 0.000 1.000
#> GSM531682     2   0.000      0.990 0.000 1.000
#> GSM531683     2   0.000      0.990 0.000 1.000
#> GSM531684     2   0.000      0.990 0.000 1.000
#> GSM531685     2   0.000      0.990 0.000 1.000
#> GSM531686     2   0.000      0.990 0.000 1.000
#> GSM531687     2   0.000      0.990 0.000 1.000
#> GSM531688     2   0.000      0.990 0.000 1.000
#> GSM531690     2   0.000      0.990 0.000 1.000
#> GSM531693     2   0.000      0.990 0.000 1.000
#> GSM531695     2   0.000      0.990 0.000 1.000
#> GSM531603     2   0.000      0.990 0.000 1.000
#> GSM531609     1   0.563      0.841 0.868 0.132
#> GSM531611     2   0.000      0.990 0.000 1.000
#> GSM531621     1   0.000      0.986 1.000 0.000
#> GSM531622     1   0.000      0.986 1.000 0.000
#> GSM531628     1   0.000      0.986 1.000 0.000
#> GSM531630     1   0.000      0.986 1.000 0.000
#> GSM531633     1   0.000      0.986 1.000 0.000
#> GSM531635     1   0.000      0.986 1.000 0.000
#> GSM531640     1   0.000      0.986 1.000 0.000
#> GSM531649     1   0.000      0.986 1.000 0.000
#> GSM531653     1   0.000      0.986 1.000 0.000
#> GSM531657     2   0.000      0.990 0.000 1.000
#> GSM531665     1   0.000      0.986 1.000 0.000
#> GSM531670     1   0.000      0.986 1.000 0.000
#> GSM531674     1   0.000      0.986 1.000 0.000
#> GSM531675     2   0.000      0.990 0.000 1.000
#> GSM531677     2   0.000      0.990 0.000 1.000
#> GSM531678     2   0.000      0.990 0.000 1.000
#> GSM531680     2   0.000      0.990 0.000 1.000
#> GSM531689     2   0.000      0.990 0.000 1.000
#> GSM531691     2   0.000      0.990 0.000 1.000
#> GSM531692     2   0.000      0.990 0.000 1.000
#> GSM531694     2   0.000      0.990 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
#> GSM531602     2  0.0000      0.980 0.000 1.000 0.000
#> GSM531604     2  0.0000      0.980 0.000 1.000 0.000
#> GSM531606     2  0.0000      0.980 0.000 1.000 0.000
#> GSM531607     2  0.0000      0.980 0.000 1.000 0.000
#> GSM531608     3  0.0000      0.993 0.000 0.000 1.000
#> GSM531610     2  0.0000      0.980 0.000 1.000 0.000
#> GSM531612     2  0.0000      0.980 0.000 1.000 0.000
#> GSM531613     2  0.0000      0.980 0.000 1.000 0.000
#> GSM531614     3  0.0000      0.993 0.000 0.000 1.000
#> GSM531616     3  0.0000      0.993 0.000 0.000 1.000
#> GSM531618     1  0.0000      0.917 1.000 0.000 0.000
#> GSM531619     3  0.0000      0.993 0.000 0.000 1.000
#> GSM531620     3  0.0000      0.993 0.000 0.000 1.000
#> GSM531623     3  0.0000      0.993 0.000 0.000 1.000
#> GSM531625     3  0.0000      0.993 0.000 0.000 1.000
#> GSM531626     3  0.0000      0.993 0.000 0.000 1.000
#> GSM531632     3  0.0000      0.993 0.000 0.000 1.000
#> GSM531638     3  0.0000      0.993 0.000 0.000 1.000
#> GSM531639     1  0.0000      0.917 1.000 0.000 0.000
#> GSM531641     1  0.6126      0.421 0.600 0.400 0.000
#> GSM531642     1  0.4555      0.758 0.800 0.200 0.000
#> GSM531643     1  0.0000      0.917 1.000 0.000 0.000
#> GSM531644     1  0.0000      0.917 1.000 0.000 0.000
#> GSM531645     1  0.0000      0.917 1.000 0.000 0.000
#> GSM531646     3  0.0000      0.993 0.000 0.000 1.000
#> GSM531647     3  0.0000      0.993 0.000 0.000 1.000
#> GSM531648     1  0.0000      0.917 1.000 0.000 0.000
#> GSM531650     1  0.0000      0.917 1.000 0.000 0.000
#> GSM531651     3  0.0000      0.993 0.000 0.000 1.000
#> GSM531652     1  0.0000      0.917 1.000 0.000 0.000
#> GSM531656     1  0.0000      0.917 1.000 0.000 0.000
#> GSM531659     2  0.0000      0.980 0.000 1.000 0.000
#> GSM531661     3  0.0000      0.993 0.000 0.000 1.000
#> GSM531662     3  0.0000      0.993 0.000 0.000 1.000
#> GSM531663     2  0.7378      0.248 0.036 0.560 0.404
#> GSM531664     1  0.4555      0.758 0.800 0.200 0.000
#> GSM531666     1  0.6126      0.421 0.600 0.400 0.000
#> GSM531667     3  0.0000      0.993 0.000 0.000 1.000
#> GSM531668     2  0.4002      0.775 0.160 0.840 0.000
#> GSM531669     1  0.0000      0.917 1.000 0.000 0.000
#> GSM531671     3  0.0000      0.993 0.000 0.000 1.000
#> GSM531672     2  0.0000      0.980 0.000 1.000 0.000
#> GSM531673     2  0.0000      0.980 0.000 1.000 0.000
#> GSM531676     2  0.0000      0.980 0.000 1.000 0.000
#> GSM531679     2  0.0000      0.980 0.000 1.000 0.000
#> GSM531681     2  0.0000      0.980 0.000 1.000 0.000
#> GSM531682     2  0.0000      0.980 0.000 1.000 0.000
#> GSM531683     2  0.0000      0.980 0.000 1.000 0.000
#> GSM531684     2  0.0000      0.980 0.000 1.000 0.000
#> GSM531685     2  0.0000      0.980 0.000 1.000 0.000
#> GSM531686     2  0.0000      0.980 0.000 1.000 0.000
#> GSM531687     2  0.0000      0.980 0.000 1.000 0.000
#> GSM531688     2  0.0000      0.980 0.000 1.000 0.000
#> GSM531690     2  0.0000      0.980 0.000 1.000 0.000
#> GSM531693     2  0.0000      0.980 0.000 1.000 0.000
#> GSM531695     2  0.0000      0.980 0.000 1.000 0.000
#> GSM531603     2  0.0000      0.980 0.000 1.000 0.000
#> GSM531609     3  0.3851      0.807 0.004 0.136 0.860
#> GSM531611     2  0.0000      0.980 0.000 1.000 0.000
#> GSM531621     3  0.0000      0.993 0.000 0.000 1.000
#> GSM531622     3  0.0000      0.993 0.000 0.000 1.000
#> GSM531628     3  0.0000      0.993 0.000 0.000 1.000
#> GSM531630     3  0.0000      0.993 0.000 0.000 1.000
#> GSM531633     3  0.0000      0.993 0.000 0.000 1.000
#> GSM531635     3  0.0000      0.993 0.000 0.000 1.000
#> GSM531640     3  0.0000      0.993 0.000 0.000 1.000
#> GSM531649     3  0.0000      0.993 0.000 0.000 1.000
#> GSM531653     1  0.0000      0.917 1.000 0.000 0.000
#> GSM531657     2  0.0000      0.980 0.000 1.000 0.000
#> GSM531665     3  0.0000      0.993 0.000 0.000 1.000
#> GSM531670     1  0.0237      0.914 0.996 0.000 0.004
#> GSM531674     1  0.0000      0.917 1.000 0.000 0.000
#> GSM531675     2  0.0000      0.980 0.000 1.000 0.000
#> GSM531677     2  0.0000      0.980 0.000 1.000 0.000
#> GSM531678     2  0.0000      0.980 0.000 1.000 0.000
#> GSM531680     2  0.0000      0.980 0.000 1.000 0.000
#> GSM531689     2  0.0000      0.980 0.000 1.000 0.000
#> GSM531691     2  0.0000      0.980 0.000 1.000 0.000
#> GSM531692     2  0.0000      0.980 0.000 1.000 0.000
#> GSM531694     2  0.0000      0.980 0.000 1.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
#> GSM531602     2  0.0000     0.9112 0.000 1.000 0.000 0.000
#> GSM531604     2  0.3975     0.6511 0.000 0.760 0.000 0.240
#> GSM531606     2  0.1022     0.8855 0.000 0.968 0.000 0.032
#> GSM531607     2  0.0000     0.9112 0.000 1.000 0.000 0.000
#> GSM531608     3  0.0000     0.9814 0.000 0.000 1.000 0.000
#> GSM531610     2  0.4967     0.1327 0.000 0.548 0.000 0.452
#> GSM531612     2  0.4331     0.5589 0.000 0.712 0.000 0.288
#> GSM531613     2  0.4134     0.6078 0.000 0.740 0.000 0.260
#> GSM531614     3  0.0336     0.9744 0.000 0.000 0.992 0.008
#> GSM531616     3  0.0000     0.9814 0.000 0.000 1.000 0.000
#> GSM531618     1  0.0000     0.9391 1.000 0.000 0.000 0.000
#> GSM531619     3  0.0000     0.9814 0.000 0.000 1.000 0.000
#> GSM531620     3  0.0000     0.9814 0.000 0.000 1.000 0.000
#> GSM531623     3  0.0000     0.9814 0.000 0.000 1.000 0.000
#> GSM531625     3  0.0000     0.9814 0.000 0.000 1.000 0.000
#> GSM531626     3  0.0000     0.9814 0.000 0.000 1.000 0.000
#> GSM531632     3  0.0000     0.9814 0.000 0.000 1.000 0.000
#> GSM531638     3  0.0000     0.9814 0.000 0.000 1.000 0.000
#> GSM531639     1  0.0000     0.9391 1.000 0.000 0.000 0.000
#> GSM531641     4  0.5531     0.6863 0.140 0.128 0.000 0.732
#> GSM531642     1  0.6394     0.4128 0.636 0.120 0.000 0.244
#> GSM531643     1  0.0000     0.9391 1.000 0.000 0.000 0.000
#> GSM531644     1  0.0000     0.9391 1.000 0.000 0.000 0.000
#> GSM531645     1  0.0000     0.9391 1.000 0.000 0.000 0.000
#> GSM531646     3  0.0000     0.9814 0.000 0.000 1.000 0.000
#> GSM531647     3  0.0000     0.9814 0.000 0.000 1.000 0.000
#> GSM531648     1  0.0000     0.9391 1.000 0.000 0.000 0.000
#> GSM531650     1  0.0000     0.9391 1.000 0.000 0.000 0.000
#> GSM531651     3  0.0000     0.9814 0.000 0.000 1.000 0.000
#> GSM531652     1  0.0000     0.9391 1.000 0.000 0.000 0.000
#> GSM531656     1  0.0000     0.9391 1.000 0.000 0.000 0.000
#> GSM531659     2  0.4972     0.0839 0.000 0.544 0.000 0.456
#> GSM531661     3  0.0000     0.9814 0.000 0.000 1.000 0.000
#> GSM531662     3  0.3801     0.7386 0.000 0.000 0.780 0.220
#> GSM531663     4  0.0376     0.6917 0.004 0.000 0.004 0.992
#> GSM531664     4  0.6176     0.1680 0.424 0.052 0.000 0.524
#> GSM531666     4  0.5657     0.6737 0.160 0.120 0.000 0.720
#> GSM531667     3  0.0000     0.9814 0.000 0.000 1.000 0.000
#> GSM531668     4  0.1109     0.7051 0.004 0.028 0.000 0.968
#> GSM531669     1  0.4406     0.5450 0.700 0.000 0.000 0.300
#> GSM531671     3  0.0000     0.9814 0.000 0.000 1.000 0.000
#> GSM531672     4  0.4103     0.6429 0.000 0.256 0.000 0.744
#> GSM531673     4  0.0188     0.6946 0.000 0.004 0.000 0.996
#> GSM531676     2  0.0000     0.9112 0.000 1.000 0.000 0.000
#> GSM531679     2  0.0000     0.9112 0.000 1.000 0.000 0.000
#> GSM531681     2  0.0000     0.9112 0.000 1.000 0.000 0.000
#> GSM531682     2  0.0000     0.9112 0.000 1.000 0.000 0.000
#> GSM531683     2  0.0000     0.9112 0.000 1.000 0.000 0.000
#> GSM531684     2  0.0336     0.9052 0.000 0.992 0.000 0.008
#> GSM531685     2  0.0000     0.9112 0.000 1.000 0.000 0.000
#> GSM531686     2  0.0000     0.9112 0.000 1.000 0.000 0.000
#> GSM531687     2  0.0000     0.9112 0.000 1.000 0.000 0.000
#> GSM531688     2  0.0000     0.9112 0.000 1.000 0.000 0.000
#> GSM531690     2  0.0000     0.9112 0.000 1.000 0.000 0.000
#> GSM531693     2  0.0000     0.9112 0.000 1.000 0.000 0.000
#> GSM531695     2  0.0000     0.9112 0.000 1.000 0.000 0.000
#> GSM531603     2  0.0000     0.9112 0.000 1.000 0.000 0.000
#> GSM531609     4  0.6928     0.1920 0.040 0.036 0.436 0.488
#> GSM531611     2  0.4222     0.5876 0.000 0.728 0.000 0.272
#> GSM531621     3  0.0000     0.9814 0.000 0.000 1.000 0.000
#> GSM531622     3  0.0000     0.9814 0.000 0.000 1.000 0.000
#> GSM531628     3  0.0000     0.9814 0.000 0.000 1.000 0.000
#> GSM531630     3  0.0000     0.9814 0.000 0.000 1.000 0.000
#> GSM531633     3  0.0000     0.9814 0.000 0.000 1.000 0.000
#> GSM531635     3  0.0000     0.9814 0.000 0.000 1.000 0.000
#> GSM531640     3  0.0000     0.9814 0.000 0.000 1.000 0.000
#> GSM531649     3  0.0000     0.9814 0.000 0.000 1.000 0.000
#> GSM531653     1  0.0336     0.9317 0.992 0.000 0.008 0.000
#> GSM531657     4  0.4103     0.6429 0.000 0.256 0.000 0.744
#> GSM531665     3  0.3801     0.7386 0.000 0.000 0.780 0.220
#> GSM531670     1  0.0469     0.9274 0.988 0.000 0.012 0.000
#> GSM531674     1  0.0188     0.9366 0.996 0.000 0.000 0.004
#> GSM531675     2  0.0000     0.9112 0.000 1.000 0.000 0.000
#> GSM531677     2  0.0000     0.9112 0.000 1.000 0.000 0.000
#> GSM531678     2  0.0000     0.9112 0.000 1.000 0.000 0.000
#> GSM531680     2  0.0000     0.9112 0.000 1.000 0.000 0.000
#> GSM531689     2  0.0000     0.9112 0.000 1.000 0.000 0.000
#> GSM531691     2  0.0000     0.9112 0.000 1.000 0.000 0.000
#> GSM531692     2  0.3942     0.6560 0.000 0.764 0.000 0.236
#> GSM531694     2  0.0000     0.9112 0.000 1.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
#> GSM531602     2  0.0000      0.900 0.000 1.000 0.000 0.000 0.000
#> GSM531604     2  0.5957      0.417 0.000 0.588 0.000 0.176 0.236
#> GSM531606     2  0.3772      0.717 0.000 0.792 0.000 0.036 0.172
#> GSM531607     2  0.0000      0.900 0.000 1.000 0.000 0.000 0.000
#> GSM531608     3  0.0404      0.940 0.000 0.000 0.988 0.000 0.012
#> GSM531610     5  0.4417      0.220 0.000 0.148 0.000 0.092 0.760
#> GSM531612     2  0.5240      0.465 0.000 0.672 0.000 0.112 0.216
#> GSM531613     2  0.4152      0.648 0.000 0.772 0.000 0.060 0.168
#> GSM531614     5  0.4497      0.286 0.000 0.000 0.424 0.008 0.568
#> GSM531616     3  0.0000      0.952 0.000 0.000 1.000 0.000 0.000
#> GSM531618     1  0.0000      0.913 1.000 0.000 0.000 0.000 0.000
#> GSM531619     3  0.0000      0.952 0.000 0.000 1.000 0.000 0.000
#> GSM531620     3  0.0000      0.952 0.000 0.000 1.000 0.000 0.000
#> GSM531623     3  0.0000      0.952 0.000 0.000 1.000 0.000 0.000
#> GSM531625     3  0.0000      0.952 0.000 0.000 1.000 0.000 0.000
#> GSM531626     3  0.0000      0.952 0.000 0.000 1.000 0.000 0.000
#> GSM531632     3  0.0000      0.952 0.000 0.000 1.000 0.000 0.000
#> GSM531638     3  0.0000      0.952 0.000 0.000 1.000 0.000 0.000
#> GSM531639     1  0.0404      0.906 0.988 0.000 0.000 0.000 0.012
#> GSM531641     4  0.7512      0.581 0.096 0.168 0.000 0.504 0.232
#> GSM531642     1  0.7162      0.084 0.528 0.084 0.000 0.268 0.120
#> GSM531643     1  0.0000      0.913 1.000 0.000 0.000 0.000 0.000
#> GSM531644     1  0.0000      0.913 1.000 0.000 0.000 0.000 0.000
#> GSM531645     1  0.0000      0.913 1.000 0.000 0.000 0.000 0.000
#> GSM531646     3  0.0000      0.952 0.000 0.000 1.000 0.000 0.000
#> GSM531647     3  0.0162      0.948 0.004 0.000 0.996 0.000 0.000
#> GSM531648     1  0.0000      0.913 1.000 0.000 0.000 0.000 0.000
#> GSM531650     1  0.0000      0.913 1.000 0.000 0.000 0.000 0.000
#> GSM531651     3  0.0000      0.952 0.000 0.000 1.000 0.000 0.000
#> GSM531652     1  0.0000      0.913 1.000 0.000 0.000 0.000 0.000
#> GSM531656     1  0.0000      0.913 1.000 0.000 0.000 0.000 0.000
#> GSM531659     2  0.6290     -0.130 0.000 0.500 0.000 0.332 0.168
#> GSM531661     3  0.0000      0.952 0.000 0.000 1.000 0.000 0.000
#> GSM531662     3  0.4909      0.218 0.000 0.000 0.560 0.412 0.028
#> GSM531663     4  0.1197      0.430 0.000 0.000 0.000 0.952 0.048
#> GSM531664     4  0.7193      0.411 0.324 0.060 0.000 0.480 0.136
#> GSM531666     4  0.7605      0.576 0.128 0.140 0.000 0.500 0.232
#> GSM531667     3  0.0000      0.952 0.000 0.000 1.000 0.000 0.000
#> GSM531668     4  0.3474      0.462 0.008 0.020 0.000 0.824 0.148
#> GSM531669     1  0.5807      0.210 0.560 0.016 0.000 0.360 0.064
#> GSM531671     3  0.0451      0.941 0.000 0.000 0.988 0.004 0.008
#> GSM531672     4  0.6224      0.540 0.000 0.232 0.000 0.548 0.220
#> GSM531673     4  0.1043      0.436 0.000 0.000 0.000 0.960 0.040
#> GSM531676     2  0.0000      0.900 0.000 1.000 0.000 0.000 0.000
#> GSM531679     2  0.0000      0.900 0.000 1.000 0.000 0.000 0.000
#> GSM531681     2  0.0000      0.900 0.000 1.000 0.000 0.000 0.000
#> GSM531682     2  0.0000      0.900 0.000 1.000 0.000 0.000 0.000
#> GSM531683     2  0.0000      0.900 0.000 1.000 0.000 0.000 0.000
#> GSM531684     2  0.3053      0.756 0.000 0.828 0.000 0.008 0.164
#> GSM531685     2  0.0000      0.900 0.000 1.000 0.000 0.000 0.000
#> GSM531686     2  0.0000      0.900 0.000 1.000 0.000 0.000 0.000
#> GSM531687     2  0.0000      0.900 0.000 1.000 0.000 0.000 0.000
#> GSM531688     2  0.0000      0.900 0.000 1.000 0.000 0.000 0.000
#> GSM531690     2  0.0000      0.900 0.000 1.000 0.000 0.000 0.000
#> GSM531693     2  0.0162      0.898 0.000 0.996 0.000 0.000 0.004
#> GSM531695     2  0.0000      0.900 0.000 1.000 0.000 0.000 0.000
#> GSM531603     2  0.0000      0.900 0.000 1.000 0.000 0.000 0.000
#> GSM531609     5  0.4939      0.430 0.012 0.012 0.116 0.100 0.760
#> GSM531611     2  0.4893      0.531 0.000 0.704 0.000 0.088 0.208
#> GSM531621     3  0.0000      0.952 0.000 0.000 1.000 0.000 0.000
#> GSM531622     3  0.0000      0.952 0.000 0.000 1.000 0.000 0.000
#> GSM531628     3  0.0000      0.952 0.000 0.000 1.000 0.000 0.000
#> GSM531630     3  0.0000      0.952 0.000 0.000 1.000 0.000 0.000
#> GSM531633     3  0.0000      0.952 0.000 0.000 1.000 0.000 0.000
#> GSM531635     3  0.0000      0.952 0.000 0.000 1.000 0.000 0.000
#> GSM531640     3  0.0000      0.952 0.000 0.000 1.000 0.000 0.000
#> GSM531649     3  0.0000      0.952 0.000 0.000 1.000 0.000 0.000
#> GSM531653     1  0.0162      0.910 0.996 0.000 0.004 0.000 0.000
#> GSM531657     4  0.6246      0.540 0.000 0.232 0.000 0.544 0.224
#> GSM531665     3  0.4924      0.199 0.000 0.000 0.552 0.420 0.028
#> GSM531670     1  0.1124      0.873 0.960 0.000 0.036 0.000 0.004
#> GSM531674     1  0.0771      0.899 0.976 0.000 0.000 0.020 0.004
#> GSM531675     2  0.0000      0.900 0.000 1.000 0.000 0.000 0.000
#> GSM531677     2  0.0000      0.900 0.000 1.000 0.000 0.000 0.000
#> GSM531678     2  0.0000      0.900 0.000 1.000 0.000 0.000 0.000
#> GSM531680     2  0.0000      0.900 0.000 1.000 0.000 0.000 0.000
#> GSM531689     2  0.0000      0.900 0.000 1.000 0.000 0.000 0.000
#> GSM531691     2  0.0000      0.900 0.000 1.000 0.000 0.000 0.000
#> GSM531692     2  0.5575      0.511 0.000 0.644 0.000 0.168 0.188
#> GSM531694     2  0.0000      0.900 0.000 1.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
#> GSM531602     2  0.0000      0.905 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM531604     4  0.5166      0.378 0.000 0.364 0.000 0.540 0.096 0.000
#> GSM531606     4  0.3989      0.207 0.000 0.468 0.000 0.528 0.004 0.000
#> GSM531607     2  0.0000      0.905 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM531608     3  0.0665      0.976 0.000 0.000 0.980 0.008 0.008 0.004
#> GSM531610     4  0.6753      0.221 0.000 0.068 0.000 0.460 0.288 0.184
#> GSM531612     2  0.3804      0.224 0.000 0.576 0.000 0.000 0.000 0.424
#> GSM531613     2  0.2219      0.751 0.000 0.864 0.000 0.000 0.000 0.136
#> GSM531614     4  0.6975      0.106 0.000 0.000 0.140 0.460 0.272 0.128
#> GSM531616     3  0.0000      0.996 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM531618     1  0.0767      0.966 0.976 0.000 0.000 0.004 0.012 0.008
#> GSM531619     3  0.0000      0.996 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM531620     3  0.0000      0.996 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM531623     3  0.0000      0.996 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM531625     3  0.0000      0.996 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM531626     3  0.0000      0.996 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM531632     3  0.0000      0.996 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM531638     3  0.0000      0.996 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM531639     1  0.0858      0.952 0.968 0.000 0.000 0.000 0.004 0.028
#> GSM531641     6  0.2908      0.703 0.048 0.104 0.000 0.000 0.000 0.848
#> GSM531642     6  0.4720      0.572 0.308 0.060 0.000 0.000 0.004 0.628
#> GSM531643     1  0.0291      0.967 0.992 0.000 0.000 0.004 0.004 0.000
#> GSM531644     1  0.0405      0.968 0.988 0.000 0.000 0.004 0.000 0.008
#> GSM531645     1  0.0964      0.962 0.968 0.000 0.000 0.004 0.012 0.016
#> GSM531646     3  0.0000      0.996 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM531647     3  0.0405      0.984 0.008 0.000 0.988 0.004 0.000 0.000
#> GSM531648     1  0.0870      0.964 0.972 0.000 0.000 0.004 0.012 0.012
#> GSM531650     1  0.0260      0.967 0.992 0.000 0.000 0.008 0.000 0.000
#> GSM531651     3  0.0000      0.996 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM531652     1  0.0405      0.968 0.988 0.000 0.000 0.004 0.000 0.008
#> GSM531656     1  0.0291      0.968 0.992 0.000 0.000 0.004 0.004 0.000
#> GSM531659     2  0.4116      0.209 0.000 0.572 0.000 0.000 0.012 0.416
#> GSM531661     3  0.0000      0.996 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM531662     5  0.3607      0.561 0.000 0.000 0.348 0.000 0.652 0.000
#> GSM531663     5  0.3288      0.406 0.000 0.000 0.000 0.000 0.724 0.276
#> GSM531664     6  0.3196      0.661 0.156 0.020 0.000 0.008 0.000 0.816
#> GSM531666     6  0.2994      0.705 0.064 0.080 0.000 0.004 0.000 0.852
#> GSM531667     3  0.0000      0.996 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM531668     6  0.6175      0.111 0.016 0.004 0.000 0.176 0.312 0.492
#> GSM531669     6  0.5286      0.436 0.348 0.000 0.000 0.012 0.080 0.560
#> GSM531671     3  0.0790      0.961 0.000 0.000 0.968 0.000 0.032 0.000
#> GSM531672     6  0.2821      0.658 0.000 0.152 0.000 0.000 0.016 0.832
#> GSM531673     5  0.3482      0.375 0.000 0.000 0.000 0.000 0.684 0.316
#> GSM531676     2  0.0000      0.905 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM531679     2  0.0000      0.905 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM531681     2  0.0000      0.905 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM531682     2  0.0000      0.905 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM531683     2  0.0000      0.905 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM531684     2  0.3847     -0.139 0.000 0.544 0.000 0.456 0.000 0.000
#> GSM531685     2  0.0000      0.905 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM531686     2  0.0000      0.905 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM531687     2  0.0000      0.905 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM531688     2  0.0000      0.905 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM531690     2  0.0000      0.905 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM531693     2  0.0865      0.868 0.000 0.964 0.000 0.036 0.000 0.000
#> GSM531695     2  0.0000      0.905 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM531603     2  0.0146      0.902 0.000 0.996 0.000 0.004 0.000 0.000
#> GSM531609     4  0.6731      0.175 0.012 0.000 0.036 0.468 0.288 0.196
#> GSM531611     2  0.3464      0.483 0.000 0.688 0.000 0.000 0.000 0.312
#> GSM531621     3  0.0000      0.996 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM531622     3  0.0000      0.996 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM531628     3  0.0000      0.996 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM531630     3  0.0000      0.996 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM531633     3  0.0000      0.996 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM531635     3  0.0000      0.996 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM531640     3  0.0000      0.996 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM531649     3  0.0000      0.996 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM531653     1  0.0798      0.957 0.976 0.000 0.012 0.004 0.004 0.004
#> GSM531657     6  0.2790      0.666 0.000 0.140 0.000 0.000 0.020 0.840
#> GSM531665     5  0.3707      0.589 0.000 0.000 0.312 0.000 0.680 0.008
#> GSM531670     1  0.2121      0.905 0.916 0.000 0.040 0.008 0.032 0.004
#> GSM531674     1  0.1888      0.913 0.916 0.000 0.000 0.012 0.068 0.004
#> GSM531675     2  0.0000      0.905 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM531677     2  0.0000      0.905 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM531678     2  0.0000      0.905 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM531680     2  0.0000      0.905 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM531689     2  0.0000      0.905 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM531691     2  0.0000      0.905 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM531692     4  0.4735      0.288 0.000 0.432 0.000 0.520 0.048 0.000
#> GSM531694     2  0.0000      0.905 0.000 1.000 0.000 0.000 0.000 0.000

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

consensus_heatmap(res, k = 2)

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 disease.state(p) k
#> ATC:skmeans 78            0.692 2
#> ATC:skmeans 77            0.520 3
#> ATC:skmeans 75            0.654 4
#> ATC:skmeans 66            0.876 5
#> ATC:skmeans 66            0.847 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 51941 rows and 80 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.713           0.915       0.951         0.4882 0.494   0.494
#> 3 3 0.907           0.909       0.965         0.3506 0.694   0.463
#> 4 4 0.773           0.832       0.888         0.0838 0.934   0.815
#> 5 5 0.831           0.877       0.925         0.0977 0.867   0.588
#> 6 6 0.866           0.852       0.897         0.0510 0.932   0.697

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
#> GSM531602     2   0.000     0.9022 0.000 1.000
#> GSM531604     2   0.788     0.7935 0.236 0.764
#> GSM531606     2   0.706     0.8423 0.192 0.808
#> GSM531607     2   0.295     0.8897 0.052 0.948
#> GSM531608     1   0.000     0.9878 1.000 0.000
#> GSM531610     2   0.706     0.8423 0.192 0.808
#> GSM531612     2   0.000     0.9022 0.000 1.000
#> GSM531613     2   0.000     0.9022 0.000 1.000
#> GSM531614     1   0.000     0.9878 1.000 0.000
#> GSM531616     1   0.000     0.9878 1.000 0.000
#> GSM531618     1   0.000     0.9878 1.000 0.000
#> GSM531619     1   0.000     0.9878 1.000 0.000
#> GSM531620     1   0.000     0.9878 1.000 0.000
#> GSM531623     1   0.000     0.9878 1.000 0.000
#> GSM531625     1   0.000     0.9878 1.000 0.000
#> GSM531626     1   0.000     0.9878 1.000 0.000
#> GSM531632     1   0.000     0.9878 1.000 0.000
#> GSM531638     1   0.000     0.9878 1.000 0.000
#> GSM531639     1   0.000     0.9878 1.000 0.000
#> GSM531641     2   0.706     0.8423 0.192 0.808
#> GSM531642     2   0.706     0.8423 0.192 0.808
#> GSM531643     1   0.000     0.9878 1.000 0.000
#> GSM531644     1   0.000     0.9878 1.000 0.000
#> GSM531645     1   0.000     0.9878 1.000 0.000
#> GSM531646     1   0.000     0.9878 1.000 0.000
#> GSM531647     1   0.000     0.9878 1.000 0.000
#> GSM531648     1   0.000     0.9878 1.000 0.000
#> GSM531650     1   0.000     0.9878 1.000 0.000
#> GSM531651     1   0.000     0.9878 1.000 0.000
#> GSM531652     1   0.000     0.9878 1.000 0.000
#> GSM531656     1   0.000     0.9878 1.000 0.000
#> GSM531659     2   0.706     0.8423 0.192 0.808
#> GSM531661     1   0.000     0.9878 1.000 0.000
#> GSM531662     1   0.000     0.9878 1.000 0.000
#> GSM531663     1   0.000     0.9878 1.000 0.000
#> GSM531664     2   0.706     0.8423 0.192 0.808
#> GSM531666     2   0.706     0.8423 0.192 0.808
#> GSM531667     1   0.000     0.9878 1.000 0.000
#> GSM531668     2   0.990     0.3923 0.440 0.560
#> GSM531669     2   0.753     0.8174 0.216 0.784
#> GSM531671     1   0.000     0.9878 1.000 0.000
#> GSM531672     2   0.706     0.8423 0.192 0.808
#> GSM531673     1   0.981     0.0798 0.580 0.420
#> GSM531676     2   0.000     0.9022 0.000 1.000
#> GSM531679     2   0.000     0.9022 0.000 1.000
#> GSM531681     2   0.000     0.9022 0.000 1.000
#> GSM531682     2   0.000     0.9022 0.000 1.000
#> GSM531683     2   0.000     0.9022 0.000 1.000
#> GSM531684     2   0.697     0.8440 0.188 0.812
#> GSM531685     2   0.000     0.9022 0.000 1.000
#> GSM531686     2   0.000     0.9022 0.000 1.000
#> GSM531687     2   0.000     0.9022 0.000 1.000
#> GSM531688     2   0.000     0.9022 0.000 1.000
#> GSM531690     2   0.000     0.9022 0.000 1.000
#> GSM531693     2   0.706     0.8423 0.192 0.808
#> GSM531695     2   0.000     0.9022 0.000 1.000
#> GSM531603     2   0.706     0.8423 0.192 0.808
#> GSM531609     1   0.000     0.9878 1.000 0.000
#> GSM531611     2   0.000     0.9022 0.000 1.000
#> GSM531621     1   0.000     0.9878 1.000 0.000
#> GSM531622     1   0.000     0.9878 1.000 0.000
#> GSM531628     1   0.000     0.9878 1.000 0.000
#> GSM531630     1   0.000     0.9878 1.000 0.000
#> GSM531633     1   0.000     0.9878 1.000 0.000
#> GSM531635     1   0.000     0.9878 1.000 0.000
#> GSM531640     1   0.000     0.9878 1.000 0.000
#> GSM531649     1   0.000     0.9878 1.000 0.000
#> GSM531653     1   0.000     0.9878 1.000 0.000
#> GSM531657     2   0.706     0.8423 0.192 0.808
#> GSM531665     1   0.000     0.9878 1.000 0.000
#> GSM531670     1   0.000     0.9878 1.000 0.000
#> GSM531674     1   0.000     0.9878 1.000 0.000
#> GSM531675     2   0.000     0.9022 0.000 1.000
#> GSM531677     2   0.000     0.9022 0.000 1.000
#> GSM531678     2   0.000     0.9022 0.000 1.000
#> GSM531680     2   0.000     0.9022 0.000 1.000
#> GSM531689     2   0.000     0.9022 0.000 1.000
#> GSM531691     2   0.000     0.9022 0.000 1.000
#> GSM531692     2   0.802     0.7831 0.244 0.756
#> GSM531694     2   0.000     0.9022 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
#> GSM531602     2  0.0000     0.9518 0.000 1.000 0.000
#> GSM531604     1  0.6274     0.0669 0.544 0.456 0.000
#> GSM531606     2  0.4555     0.7684 0.200 0.800 0.000
#> GSM531607     2  0.1860     0.9139 0.052 0.948 0.000
#> GSM531608     3  0.0000     0.9847 0.000 0.000 1.000
#> GSM531610     1  0.0892     0.9346 0.980 0.020 0.000
#> GSM531612     2  0.0000     0.9518 0.000 1.000 0.000
#> GSM531613     2  0.0000     0.9518 0.000 1.000 0.000
#> GSM531614     1  0.0000     0.9536 1.000 0.000 0.000
#> GSM531616     3  0.0000     0.9847 0.000 0.000 1.000
#> GSM531618     1  0.0000     0.9536 1.000 0.000 0.000
#> GSM531619     3  0.0000     0.9847 0.000 0.000 1.000
#> GSM531620     3  0.0000     0.9847 0.000 0.000 1.000
#> GSM531623     3  0.0000     0.9847 0.000 0.000 1.000
#> GSM531625     3  0.0000     0.9847 0.000 0.000 1.000
#> GSM531626     3  0.0000     0.9847 0.000 0.000 1.000
#> GSM531632     1  0.6204     0.2609 0.576 0.000 0.424
#> GSM531638     3  0.5138     0.6361 0.252 0.000 0.748
#> GSM531639     1  0.0000     0.9536 1.000 0.000 0.000
#> GSM531641     1  0.0000     0.9536 1.000 0.000 0.000
#> GSM531642     1  0.0000     0.9536 1.000 0.000 0.000
#> GSM531643     1  0.0000     0.9536 1.000 0.000 0.000
#> GSM531644     1  0.0000     0.9536 1.000 0.000 0.000
#> GSM531645     1  0.0000     0.9536 1.000 0.000 0.000
#> GSM531646     3  0.0000     0.9847 0.000 0.000 1.000
#> GSM531647     1  0.0000     0.9536 1.000 0.000 0.000
#> GSM531648     1  0.0000     0.9536 1.000 0.000 0.000
#> GSM531650     1  0.0000     0.9536 1.000 0.000 0.000
#> GSM531651     3  0.0000     0.9847 0.000 0.000 1.000
#> GSM531652     1  0.0000     0.9536 1.000 0.000 0.000
#> GSM531656     1  0.0000     0.9536 1.000 0.000 0.000
#> GSM531659     1  0.0000     0.9536 1.000 0.000 0.000
#> GSM531661     3  0.0000     0.9847 0.000 0.000 1.000
#> GSM531662     1  0.0000     0.9536 1.000 0.000 0.000
#> GSM531663     1  0.0000     0.9536 1.000 0.000 0.000
#> GSM531664     1  0.0000     0.9536 1.000 0.000 0.000
#> GSM531666     1  0.0000     0.9536 1.000 0.000 0.000
#> GSM531667     3  0.0000     0.9847 0.000 0.000 1.000
#> GSM531668     1  0.0000     0.9536 1.000 0.000 0.000
#> GSM531669     1  0.0000     0.9536 1.000 0.000 0.000
#> GSM531671     1  0.0000     0.9536 1.000 0.000 0.000
#> GSM531672     1  0.0000     0.9536 1.000 0.000 0.000
#> GSM531673     1  0.0000     0.9536 1.000 0.000 0.000
#> GSM531676     2  0.0000     0.9518 0.000 1.000 0.000
#> GSM531679     2  0.0000     0.9518 0.000 1.000 0.000
#> GSM531681     2  0.0000     0.9518 0.000 1.000 0.000
#> GSM531682     2  0.0000     0.9518 0.000 1.000 0.000
#> GSM531683     2  0.0000     0.9518 0.000 1.000 0.000
#> GSM531684     2  0.4002     0.8187 0.160 0.840 0.000
#> GSM531685     2  0.0000     0.9518 0.000 1.000 0.000
#> GSM531686     2  0.0000     0.9518 0.000 1.000 0.000
#> GSM531687     2  0.0000     0.9518 0.000 1.000 0.000
#> GSM531688     2  0.0000     0.9518 0.000 1.000 0.000
#> GSM531690     2  0.0000     0.9518 0.000 1.000 0.000
#> GSM531693     2  0.4178     0.8046 0.172 0.828 0.000
#> GSM531695     2  0.0000     0.9518 0.000 1.000 0.000
#> GSM531603     2  0.3941     0.8231 0.156 0.844 0.000
#> GSM531609     1  0.0000     0.9536 1.000 0.000 0.000
#> GSM531611     2  0.0000     0.9518 0.000 1.000 0.000
#> GSM531621     3  0.0000     0.9847 0.000 0.000 1.000
#> GSM531622     3  0.0000     0.9847 0.000 0.000 1.000
#> GSM531628     1  0.6308     0.0105 0.508 0.000 0.492
#> GSM531630     3  0.0000     0.9847 0.000 0.000 1.000
#> GSM531633     3  0.0000     0.9847 0.000 0.000 1.000
#> GSM531635     3  0.0000     0.9847 0.000 0.000 1.000
#> GSM531640     3  0.0000     0.9847 0.000 0.000 1.000
#> GSM531649     3  0.0000     0.9847 0.000 0.000 1.000
#> GSM531653     1  0.0000     0.9536 1.000 0.000 0.000
#> GSM531657     1  0.0000     0.9536 1.000 0.000 0.000
#> GSM531665     1  0.0000     0.9536 1.000 0.000 0.000
#> GSM531670     1  0.0000     0.9536 1.000 0.000 0.000
#> GSM531674     1  0.0000     0.9536 1.000 0.000 0.000
#> GSM531675     2  0.0000     0.9518 0.000 1.000 0.000
#> GSM531677     2  0.0000     0.9518 0.000 1.000 0.000
#> GSM531678     2  0.0000     0.9518 0.000 1.000 0.000
#> GSM531680     2  0.0000     0.9518 0.000 1.000 0.000
#> GSM531689     2  0.0000     0.9518 0.000 1.000 0.000
#> GSM531691     2  0.0000     0.9518 0.000 1.000 0.000
#> GSM531692     2  0.6140     0.3640 0.404 0.596 0.000
#> GSM531694     2  0.0000     0.9518 0.000 1.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
#> GSM531602     2  0.0188      0.915 0.000 0.996 0.000 0.004
#> GSM531604     1  0.7879      0.190 0.380 0.332 0.288 0.000
#> GSM531606     2  0.6122      0.642 0.160 0.680 0.160 0.000
#> GSM531607     2  0.4499      0.761 0.048 0.792 0.160 0.000
#> GSM531608     3  0.4661      0.811 0.000 0.000 0.652 0.348
#> GSM531610     1  0.3636      0.832 0.820 0.008 0.172 0.000
#> GSM531612     2  0.0817      0.905 0.000 0.976 0.024 0.000
#> GSM531613     2  0.0188      0.915 0.000 0.996 0.000 0.004
#> GSM531614     1  0.0000      0.870 1.000 0.000 0.000 0.000
#> GSM531616     3  0.4356      0.872 0.000 0.000 0.708 0.292
#> GSM531618     1  0.0000      0.870 1.000 0.000 0.000 0.000
#> GSM531619     4  0.0188      0.993 0.000 0.000 0.004 0.996
#> GSM531620     3  0.4356      0.872 0.000 0.000 0.708 0.292
#> GSM531623     3  0.4522      0.846 0.000 0.000 0.680 0.320
#> GSM531625     4  0.0188      0.993 0.000 0.000 0.004 0.996
#> GSM531626     3  0.4356      0.872 0.000 0.000 0.708 0.292
#> GSM531632     3  0.5772      0.696 0.176 0.000 0.708 0.116
#> GSM531638     3  0.5386      0.832 0.056 0.000 0.708 0.236
#> GSM531639     1  0.0000      0.870 1.000 0.000 0.000 0.000
#> GSM531641     1  0.3123      0.839 0.844 0.000 0.156 0.000
#> GSM531642     1  0.2921      0.845 0.860 0.000 0.140 0.000
#> GSM531643     1  0.0000      0.870 1.000 0.000 0.000 0.000
#> GSM531644     1  0.0000      0.870 1.000 0.000 0.000 0.000
#> GSM531645     1  0.0000      0.870 1.000 0.000 0.000 0.000
#> GSM531646     3  0.4882      0.862 0.020 0.000 0.708 0.272
#> GSM531647     1  0.4679      0.310 0.648 0.000 0.352 0.000
#> GSM531648     1  0.0000      0.870 1.000 0.000 0.000 0.000
#> GSM531650     1  0.0000      0.870 1.000 0.000 0.000 0.000
#> GSM531651     4  0.0188      0.993 0.000 0.000 0.004 0.996
#> GSM531652     1  0.0000      0.870 1.000 0.000 0.000 0.000
#> GSM531656     1  0.0000      0.870 1.000 0.000 0.000 0.000
#> GSM531659     1  0.4331      0.785 0.712 0.000 0.288 0.000
#> GSM531661     3  0.4356      0.872 0.000 0.000 0.708 0.292
#> GSM531662     1  0.3400      0.796 0.820 0.000 0.180 0.000
#> GSM531663     1  0.4331      0.785 0.712 0.000 0.288 0.000
#> GSM531664     1  0.1792      0.863 0.932 0.000 0.068 0.000
#> GSM531666     1  0.3123      0.839 0.844 0.000 0.156 0.000
#> GSM531667     3  0.3172      0.745 0.000 0.000 0.840 0.160
#> GSM531668     1  0.3907      0.814 0.768 0.000 0.232 0.000
#> GSM531669     1  0.2760      0.833 0.872 0.000 0.128 0.000
#> GSM531671     3  0.3528      0.554 0.192 0.000 0.808 0.000
#> GSM531672     1  0.3545      0.834 0.828 0.008 0.164 0.000
#> GSM531673     1  0.4331      0.785 0.712 0.000 0.288 0.000
#> GSM531676     2  0.0188      0.914 0.000 0.996 0.004 0.000
#> GSM531679     2  0.0188      0.915 0.000 0.996 0.000 0.004
#> GSM531681     2  0.0188      0.915 0.000 0.996 0.000 0.004
#> GSM531682     2  0.0188      0.915 0.000 0.996 0.000 0.004
#> GSM531683     2  0.0188      0.915 0.000 0.996 0.000 0.004
#> GSM531684     2  0.5807      0.678 0.132 0.708 0.160 0.000
#> GSM531685     2  0.0469      0.911 0.000 0.988 0.012 0.000
#> GSM531686     2  0.0188      0.915 0.000 0.996 0.000 0.004
#> GSM531687     2  0.0188      0.914 0.000 0.996 0.004 0.000
#> GSM531688     2  0.0188      0.914 0.000 0.996 0.004 0.000
#> GSM531690     2  0.0188      0.915 0.000 0.996 0.000 0.004
#> GSM531693     2  0.5855      0.673 0.136 0.704 0.160 0.000
#> GSM531695     2  0.0188      0.914 0.000 0.996 0.004 0.000
#> GSM531603     2  0.5758      0.682 0.128 0.712 0.160 0.000
#> GSM531609     1  0.0707      0.869 0.980 0.000 0.020 0.000
#> GSM531611     2  0.0817      0.905 0.000 0.976 0.024 0.000
#> GSM531621     4  0.0188      0.993 0.000 0.000 0.004 0.996
#> GSM531622     3  0.4356      0.872 0.000 0.000 0.708 0.292
#> GSM531628     3  0.5291      0.494 0.324 0.000 0.652 0.024
#> GSM531630     3  0.4356      0.872 0.000 0.000 0.708 0.292
#> GSM531633     4  0.0188      0.993 0.000 0.000 0.004 0.996
#> GSM531635     3  0.4356      0.872 0.000 0.000 0.708 0.292
#> GSM531640     4  0.0921      0.965 0.000 0.000 0.028 0.972
#> GSM531649     3  0.4356      0.872 0.000 0.000 0.708 0.292
#> GSM531653     1  0.0000      0.870 1.000 0.000 0.000 0.000
#> GSM531657     1  0.4331      0.785 0.712 0.000 0.288 0.000
#> GSM531665     1  0.4164      0.796 0.736 0.000 0.264 0.000
#> GSM531670     1  0.0000      0.870 1.000 0.000 0.000 0.000
#> GSM531674     1  0.0000      0.870 1.000 0.000 0.000 0.000
#> GSM531675     2  0.0188      0.915 0.000 0.996 0.000 0.004
#> GSM531677     2  0.0188      0.915 0.000 0.996 0.000 0.004
#> GSM531678     2  0.0000      0.915 0.000 1.000 0.000 0.000
#> GSM531680     2  0.0188      0.915 0.000 0.996 0.000 0.004
#> GSM531689     2  0.0188      0.914 0.000 0.996 0.004 0.000
#> GSM531691     2  0.0188      0.914 0.000 0.996 0.004 0.000
#> GSM531692     2  0.7685      0.210 0.256 0.456 0.288 0.000
#> GSM531694     2  0.0188      0.915 0.000 0.996 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
#> GSM531602     2  0.0000      0.903 0.000 1.000 0.000 0.000 0.000
#> GSM531604     4  0.1121      0.842 0.044 0.000 0.000 0.956 0.000
#> GSM531606     4  0.0000      0.814 0.000 0.000 0.000 1.000 0.000
#> GSM531607     4  0.0000      0.814 0.000 0.000 0.000 1.000 0.000
#> GSM531608     3  0.2813      0.787 0.000 0.000 0.832 0.000 0.168
#> GSM531610     4  0.2891      0.878 0.176 0.000 0.000 0.824 0.000
#> GSM531612     2  0.3508      0.815 0.000 0.748 0.000 0.252 0.000
#> GSM531613     2  0.0000      0.903 0.000 1.000 0.000 0.000 0.000
#> GSM531614     1  0.0000      0.917 1.000 0.000 0.000 0.000 0.000
#> GSM531616     3  0.0000      0.962 0.000 0.000 1.000 0.000 0.000
#> GSM531618     1  0.0000      0.917 1.000 0.000 0.000 0.000 0.000
#> GSM531619     5  0.0000      0.988 0.000 0.000 0.000 0.000 1.000
#> GSM531620     3  0.0000      0.962 0.000 0.000 1.000 0.000 0.000
#> GSM531623     3  0.1908      0.880 0.000 0.000 0.908 0.000 0.092
#> GSM531625     5  0.0000      0.988 0.000 0.000 0.000 0.000 1.000
#> GSM531626     3  0.0000      0.962 0.000 0.000 1.000 0.000 0.000
#> GSM531632     3  0.0000      0.962 0.000 0.000 1.000 0.000 0.000
#> GSM531638     3  0.0000      0.962 0.000 0.000 1.000 0.000 0.000
#> GSM531639     1  0.0000      0.917 1.000 0.000 0.000 0.000 0.000
#> GSM531641     4  0.2891      0.878 0.176 0.000 0.000 0.824 0.000
#> GSM531642     4  0.3612      0.776 0.268 0.000 0.000 0.732 0.000
#> GSM531643     1  0.0000      0.917 1.000 0.000 0.000 0.000 0.000
#> GSM531644     1  0.0000      0.917 1.000 0.000 0.000 0.000 0.000
#> GSM531645     1  0.0000      0.917 1.000 0.000 0.000 0.000 0.000
#> GSM531646     3  0.0000      0.962 0.000 0.000 1.000 0.000 0.000
#> GSM531647     1  0.3684      0.580 0.720 0.000 0.280 0.000 0.000
#> GSM531648     1  0.0000      0.917 1.000 0.000 0.000 0.000 0.000
#> GSM531650     1  0.0000      0.917 1.000 0.000 0.000 0.000 0.000
#> GSM531651     5  0.0000      0.988 0.000 0.000 0.000 0.000 1.000
#> GSM531652     1  0.0000      0.917 1.000 0.000 0.000 0.000 0.000
#> GSM531656     1  0.0000      0.917 1.000 0.000 0.000 0.000 0.000
#> GSM531659     4  0.2891      0.878 0.176 0.000 0.000 0.824 0.000
#> GSM531661     3  0.0000      0.962 0.000 0.000 1.000 0.000 0.000
#> GSM531662     1  0.2690      0.756 0.844 0.000 0.156 0.000 0.000
#> GSM531663     4  0.2891      0.878 0.176 0.000 0.000 0.824 0.000
#> GSM531664     1  0.4182      0.156 0.600 0.000 0.000 0.400 0.000
#> GSM531666     4  0.3039      0.865 0.192 0.000 0.000 0.808 0.000
#> GSM531667     3  0.0000      0.962 0.000 0.000 1.000 0.000 0.000
#> GSM531668     4  0.2891      0.878 0.176 0.000 0.000 0.824 0.000
#> GSM531669     1  0.3210      0.651 0.788 0.000 0.000 0.212 0.000
#> GSM531671     3  0.0000      0.962 0.000 0.000 1.000 0.000 0.000
#> GSM531672     4  0.2891      0.878 0.176 0.000 0.000 0.824 0.000
#> GSM531673     4  0.2891      0.878 0.176 0.000 0.000 0.824 0.000
#> GSM531676     2  0.2891      0.883 0.000 0.824 0.000 0.176 0.000
#> GSM531679     2  0.0000      0.903 0.000 1.000 0.000 0.000 0.000
#> GSM531681     2  0.0000      0.903 0.000 1.000 0.000 0.000 0.000
#> GSM531682     2  0.0963      0.902 0.000 0.964 0.000 0.036 0.000
#> GSM531683     2  0.0000      0.903 0.000 1.000 0.000 0.000 0.000
#> GSM531684     4  0.0000      0.814 0.000 0.000 0.000 1.000 0.000
#> GSM531685     2  0.3003      0.876 0.000 0.812 0.000 0.188 0.000
#> GSM531686     2  0.0000      0.903 0.000 1.000 0.000 0.000 0.000
#> GSM531687     2  0.2891      0.883 0.000 0.824 0.000 0.176 0.000
#> GSM531688     2  0.2891      0.883 0.000 0.824 0.000 0.176 0.000
#> GSM531690     2  0.0000      0.903 0.000 1.000 0.000 0.000 0.000
#> GSM531693     4  0.0000      0.814 0.000 0.000 0.000 1.000 0.000
#> GSM531695     2  0.2891      0.883 0.000 0.824 0.000 0.176 0.000
#> GSM531603     4  0.0000      0.814 0.000 0.000 0.000 1.000 0.000
#> GSM531609     1  0.1851      0.834 0.912 0.000 0.000 0.088 0.000
#> GSM531611     2  0.3612      0.800 0.000 0.732 0.000 0.268 0.000
#> GSM531621     5  0.0000      0.988 0.000 0.000 0.000 0.000 1.000
#> GSM531622     3  0.0000      0.962 0.000 0.000 1.000 0.000 0.000
#> GSM531628     3  0.3305      0.675 0.224 0.000 0.776 0.000 0.000
#> GSM531630     3  0.0000      0.962 0.000 0.000 1.000 0.000 0.000
#> GSM531633     5  0.0000      0.988 0.000 0.000 0.000 0.000 1.000
#> GSM531635     3  0.0000      0.962 0.000 0.000 1.000 0.000 0.000
#> GSM531640     5  0.1341      0.939 0.000 0.000 0.056 0.000 0.944
#> GSM531649     3  0.0000      0.962 0.000 0.000 1.000 0.000 0.000
#> GSM531653     1  0.0000      0.917 1.000 0.000 0.000 0.000 0.000
#> GSM531657     4  0.2891      0.878 0.176 0.000 0.000 0.824 0.000
#> GSM531665     4  0.4114      0.593 0.376 0.000 0.000 0.624 0.000
#> GSM531670     1  0.0000      0.917 1.000 0.000 0.000 0.000 0.000
#> GSM531674     1  0.0000      0.917 1.000 0.000 0.000 0.000 0.000
#> GSM531675     2  0.0000      0.903 0.000 1.000 0.000 0.000 0.000
#> GSM531677     2  0.0000      0.903 0.000 1.000 0.000 0.000 0.000
#> GSM531678     2  0.2891      0.883 0.000 0.824 0.000 0.176 0.000
#> GSM531680     2  0.0000      0.903 0.000 1.000 0.000 0.000 0.000
#> GSM531689     2  0.2891      0.883 0.000 0.824 0.000 0.176 0.000
#> GSM531691     2  0.2891      0.883 0.000 0.824 0.000 0.176 0.000
#> GSM531692     4  0.1121      0.842 0.044 0.000 0.000 0.956 0.000
#> GSM531694     2  0.0000      0.903 0.000 1.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
#> GSM531602     2  0.0146      0.988 0.000 0.996 0.000 0.000 0.004 0.000
#> GSM531604     4  0.0000      0.946 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM531606     4  0.2562      0.757 0.000 0.000 0.000 0.828 0.172 0.000
#> GSM531607     5  0.3620      0.504 0.000 0.000 0.000 0.352 0.648 0.000
#> GSM531608     3  0.1531      0.787 0.000 0.000 0.928 0.000 0.004 0.068
#> GSM531610     4  0.0146      0.946 0.004 0.000 0.000 0.996 0.000 0.000
#> GSM531612     5  0.3266      0.782 0.000 0.272 0.000 0.000 0.728 0.000
#> GSM531613     2  0.0000      0.992 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM531614     1  0.0146      0.922 0.996 0.000 0.000 0.000 0.004 0.000
#> GSM531616     3  0.0000      0.844 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM531618     1  0.0000      0.924 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM531619     6  0.0000      0.945 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM531620     3  0.2631      0.847 0.000 0.000 0.820 0.000 0.180 0.000
#> GSM531623     3  0.0790      0.823 0.000 0.000 0.968 0.000 0.000 0.032
#> GSM531625     6  0.0000      0.945 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM531626     3  0.2969      0.844 0.000 0.000 0.776 0.000 0.224 0.000
#> GSM531632     3  0.2996      0.843 0.000 0.000 0.772 0.000 0.228 0.000
#> GSM531638     3  0.2996      0.843 0.000 0.000 0.772 0.000 0.228 0.000
#> GSM531639     1  0.0000      0.924 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM531641     4  0.0146      0.946 0.004 0.000 0.000 0.996 0.000 0.000
#> GSM531642     4  0.1814      0.865 0.100 0.000 0.000 0.900 0.000 0.000
#> GSM531643     1  0.0000      0.924 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM531644     1  0.0000      0.924 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM531645     1  0.0000      0.924 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM531646     3  0.2996      0.843 0.000 0.000 0.772 0.000 0.228 0.000
#> GSM531647     1  0.4382      0.613 0.696 0.000 0.076 0.000 0.228 0.000
#> GSM531648     1  0.0000      0.924 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM531650     1  0.0000      0.924 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM531651     6  0.0000      0.945 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM531652     1  0.0000      0.924 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM531656     1  0.0000      0.924 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM531659     4  0.0000      0.946 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM531661     3  0.0000      0.844 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM531662     1  0.1411      0.869 0.936 0.000 0.060 0.004 0.000 0.000
#> GSM531663     4  0.0000      0.946 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM531664     1  0.3756      0.333 0.600 0.000 0.000 0.400 0.000 0.000
#> GSM531666     4  0.0713      0.932 0.028 0.000 0.000 0.972 0.000 0.000
#> GSM531667     3  0.1075      0.849 0.000 0.000 0.952 0.000 0.048 0.000
#> GSM531668     4  0.0146      0.946 0.004 0.000 0.000 0.996 0.000 0.000
#> GSM531669     1  0.3371      0.577 0.708 0.000 0.000 0.292 0.000 0.000
#> GSM531671     3  0.3136      0.842 0.000 0.000 0.768 0.004 0.228 0.000
#> GSM531672     4  0.0146      0.946 0.004 0.000 0.000 0.996 0.000 0.000
#> GSM531673     4  0.0000      0.946 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM531676     5  0.3023      0.814 0.000 0.232 0.000 0.000 0.768 0.000
#> GSM531679     2  0.0000      0.992 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM531681     2  0.0000      0.992 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM531682     2  0.1327      0.906 0.000 0.936 0.000 0.000 0.064 0.000
#> GSM531683     2  0.0000      0.992 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM531684     5  0.3607      0.510 0.000 0.000 0.000 0.348 0.652 0.000
#> GSM531685     5  0.3023      0.814 0.000 0.232 0.000 0.000 0.768 0.000
#> GSM531686     2  0.0000      0.992 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM531687     5  0.3023      0.814 0.000 0.232 0.000 0.000 0.768 0.000
#> GSM531688     5  0.3023      0.814 0.000 0.232 0.000 0.000 0.768 0.000
#> GSM531690     2  0.0000      0.992 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM531693     5  0.3023      0.641 0.000 0.000 0.000 0.232 0.768 0.000
#> GSM531695     5  0.3023      0.814 0.000 0.232 0.000 0.000 0.768 0.000
#> GSM531603     5  0.3634      0.496 0.000 0.000 0.000 0.356 0.644 0.000
#> GSM531609     1  0.1010      0.895 0.960 0.000 0.000 0.036 0.004 0.000
#> GSM531611     5  0.3023      0.814 0.000 0.232 0.000 0.000 0.768 0.000
#> GSM531621     6  0.0000      0.945 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM531622     3  0.0000      0.844 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM531628     3  0.5940      0.364 0.332 0.000 0.440 0.000 0.228 0.000
#> GSM531630     3  0.0000      0.844 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM531633     6  0.0000      0.945 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM531635     3  0.0547      0.849 0.000 0.000 0.980 0.000 0.020 0.000
#> GSM531640     6  0.3409      0.652 0.000 0.000 0.300 0.000 0.000 0.700
#> GSM531649     3  0.2996      0.843 0.000 0.000 0.772 0.000 0.228 0.000
#> GSM531653     1  0.0000      0.924 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM531657     4  0.0000      0.946 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM531665     4  0.2793      0.703 0.200 0.000 0.000 0.800 0.000 0.000
#> GSM531670     1  0.0000      0.924 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM531674     1  0.0000      0.924 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM531675     2  0.0000      0.992 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM531677     2  0.0000      0.992 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM531678     5  0.3684      0.671 0.000 0.372 0.000 0.000 0.628 0.000
#> GSM531680     2  0.0000      0.992 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM531689     5  0.3607      0.708 0.000 0.348 0.000 0.000 0.652 0.000
#> GSM531691     5  0.3126      0.805 0.000 0.248 0.000 0.000 0.752 0.000
#> GSM531692     4  0.1075      0.912 0.000 0.000 0.000 0.952 0.048 0.000
#> GSM531694     2  0.0000      0.992 0.000 1.000 0.000 0.000 0.000 0.000

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

consensus_heatmap(res, k = 2)

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)
#> Error in mat[ceiling(1:nr/h_ratio), ceiling(1:nc/w_ratio), drop = FALSE]: subscript out of bounds

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 disease.state(p) k
#> ATC:pam 78            0.925 2
#> ATC:pam 76            0.369 3
#> ATC:pam 76            0.502 4
#> ATC:pam 79            0.660 5
#> ATC:pam 77            0.835 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 51941 rows and 80 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 4.
#> 
#> Following methods can be applied to this 'ConsensusPartition' object:
#>  [1] "cola_report"             "collect_classes"         "collect_plots"          
#>  [4] "collect_stats"           "colnames"                "compare_signatures"     
#>  [7] "consensus_heatmap"       "dimension_reduction"     "functional_enrichment"  
#> [10] "get_anno_col"            "get_anno"                "get_classes"            
#> [13] "get_consensus"           "get_matrix"              "get_membership"         
#> [16] "get_param"               "get_signatures"          "get_stats"              
#> [19] "is_best_k"               "is_stable_k"             "membership_heatmap"     
#> [22] "ncol"                    "nrow"                    "plot_ecdf"              
#> [25] "rownames"                "select_partition_number" "show"                   
#> [28] "suggest_best_k"          "test_to_known_factors"

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

collect_plots(res)

plot of chunk 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.369           0.858       0.878         0.3311 0.647   0.647
#> 3 3 0.768           0.901       0.926         0.9242 0.690   0.530
#> 4 4 0.941           0.929       0.975         0.0557 0.915   0.779
#> 5 5 0.794           0.718       0.840         0.1062 0.897   0.693
#> 6 6 0.704           0.553       0.790         0.0628 0.959   0.839

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

suggest_best_k(res)
#> [1] 4

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

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

show/hide code output

cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#>           class entropy silhouette    p1    p2
#> GSM531602     2   0.714      0.834 0.196 0.804
#> GSM531604     2   0.714      0.834 0.196 0.804
#> GSM531606     2   0.714      0.834 0.196 0.804
#> GSM531607     2   0.714      0.834 0.196 0.804
#> GSM531608     1   0.714      0.818 0.804 0.196
#> GSM531610     1   0.714      0.818 0.804 0.196
#> GSM531612     2   0.000      0.868 0.000 1.000
#> GSM531613     2   0.163      0.864 0.024 0.976
#> GSM531614     1   0.714      0.818 0.804 0.196
#> GSM531616     1   0.939      0.930 0.644 0.356
#> GSM531618     2   0.000      0.868 0.000 1.000
#> GSM531619     1   0.939      0.930 0.644 0.356
#> GSM531620     1   0.939      0.930 0.644 0.356
#> GSM531623     1   0.939      0.930 0.644 0.356
#> GSM531625     1   0.939      0.930 0.644 0.356
#> GSM531626     1   1.000      0.661 0.500 0.500
#> GSM531632     2   0.000      0.868 0.000 1.000
#> GSM531638     2   0.000      0.868 0.000 1.000
#> GSM531639     2   0.000      0.868 0.000 1.000
#> GSM531641     2   0.000      0.868 0.000 1.000
#> GSM531642     2   0.000      0.868 0.000 1.000
#> GSM531643     2   0.000      0.868 0.000 1.000
#> GSM531644     2   0.000      0.868 0.000 1.000
#> GSM531645     2   0.000      0.868 0.000 1.000
#> GSM531646     2   0.000      0.868 0.000 1.000
#> GSM531647     2   0.000      0.868 0.000 1.000
#> GSM531648     2   0.000      0.868 0.000 1.000
#> GSM531650     2   0.000      0.868 0.000 1.000
#> GSM531651     1   0.939      0.930 0.644 0.356
#> GSM531652     2   0.000      0.868 0.000 1.000
#> GSM531656     2   0.000      0.868 0.000 1.000
#> GSM531659     2   0.000      0.868 0.000 1.000
#> GSM531661     2   0.000      0.868 0.000 1.000
#> GSM531662     2   0.000      0.868 0.000 1.000
#> GSM531663     2   0.000      0.868 0.000 1.000
#> GSM531664     2   0.000      0.868 0.000 1.000
#> GSM531666     2   0.000      0.868 0.000 1.000
#> GSM531667     2   0.000      0.868 0.000 1.000
#> GSM531668     2   0.000      0.868 0.000 1.000
#> GSM531669     2   0.000      0.868 0.000 1.000
#> GSM531671     2   0.000      0.868 0.000 1.000
#> GSM531672     2   0.000      0.868 0.000 1.000
#> GSM531673     2   0.000      0.868 0.000 1.000
#> GSM531676     2   0.714      0.834 0.196 0.804
#> GSM531679     2   0.714      0.834 0.196 0.804
#> GSM531681     2   0.714      0.834 0.196 0.804
#> GSM531682     2   0.714      0.834 0.196 0.804
#> GSM531683     2   0.714      0.834 0.196 0.804
#> GSM531684     2   0.714      0.834 0.196 0.804
#> GSM531685     2   0.714      0.834 0.196 0.804
#> GSM531686     2   0.714      0.834 0.196 0.804
#> GSM531687     2   0.714      0.834 0.196 0.804
#> GSM531688     2   0.714      0.834 0.196 0.804
#> GSM531690     2   0.714      0.834 0.196 0.804
#> GSM531693     2   0.714      0.834 0.196 0.804
#> GSM531695     2   0.714      0.834 0.196 0.804
#> GSM531603     2   0.714      0.834 0.196 0.804
#> GSM531609     1   0.714      0.818 0.804 0.196
#> GSM531611     2   0.000      0.868 0.000 1.000
#> GSM531621     1   0.939      0.930 0.644 0.356
#> GSM531622     1   0.939      0.930 0.644 0.356
#> GSM531628     1   0.939      0.930 0.644 0.356
#> GSM531630     1   0.939      0.930 0.644 0.356
#> GSM531633     1   0.939      0.930 0.644 0.356
#> GSM531635     1   0.939      0.930 0.644 0.356
#> GSM531640     1   0.939      0.930 0.644 0.356
#> GSM531649     2   0.671      0.545 0.176 0.824
#> GSM531653     2   0.000      0.868 0.000 1.000
#> GSM531657     2   0.000      0.868 0.000 1.000
#> GSM531665     2   0.000      0.868 0.000 1.000
#> GSM531670     2   0.000      0.868 0.000 1.000
#> GSM531674     2   0.000      0.868 0.000 1.000
#> GSM531675     2   0.714      0.834 0.196 0.804
#> GSM531677     2   0.714      0.834 0.196 0.804
#> GSM531678     2   0.714      0.834 0.196 0.804
#> GSM531680     2   0.714      0.834 0.196 0.804
#> GSM531689     2   0.714      0.834 0.196 0.804
#> GSM531691     2   0.714      0.834 0.196 0.804
#> GSM531692     2   0.714      0.834 0.196 0.804
#> GSM531694     2   0.714      0.834 0.196 0.804

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>           class entropy silhouette    p1    p2    p3
#> GSM531602     2  0.0892     0.9955 0.020 0.980 0.000
#> GSM531604     2  0.0892     0.9955 0.020 0.980 0.000
#> GSM531606     2  0.0892     0.9955 0.020 0.980 0.000
#> GSM531607     2  0.2625     0.9178 0.084 0.916 0.000
#> GSM531608     3  0.3987     0.8547 0.108 0.020 0.872
#> GSM531610     3  0.5858     0.7587 0.240 0.020 0.740
#> GSM531612     1  0.3742     0.8835 0.892 0.036 0.072
#> GSM531613     1  0.6309     0.0822 0.504 0.496 0.000
#> GSM531614     3  0.3987     0.8547 0.108 0.020 0.872
#> GSM531616     3  0.1411     0.9537 0.036 0.000 0.964
#> GSM531618     1  0.3349     0.9026 0.888 0.004 0.108
#> GSM531619     3  0.1411     0.9537 0.036 0.000 0.964
#> GSM531620     3  0.1411     0.9537 0.036 0.000 0.964
#> GSM531623     3  0.1411     0.9537 0.036 0.000 0.964
#> GSM531625     3  0.1411     0.9537 0.036 0.000 0.964
#> GSM531626     1  0.3686     0.8823 0.860 0.000 0.140
#> GSM531632     1  0.3482     0.8895 0.872 0.000 0.128
#> GSM531638     1  0.3482     0.8895 0.872 0.000 0.128
#> GSM531639     1  0.3116     0.9024 0.892 0.000 0.108
#> GSM531641     1  0.4121     0.8961 0.868 0.024 0.108
#> GSM531642     1  0.3116     0.9024 0.892 0.000 0.108
#> GSM531643     1  0.3116     0.9024 0.892 0.000 0.108
#> GSM531644     1  0.3116     0.9024 0.892 0.000 0.108
#> GSM531645     1  0.3116     0.9024 0.892 0.000 0.108
#> GSM531646     1  0.3482     0.8895 0.872 0.000 0.128
#> GSM531647     1  0.3267     0.8979 0.884 0.000 0.116
#> GSM531648     1  0.3116     0.9024 0.892 0.000 0.108
#> GSM531650     1  0.3116     0.9024 0.892 0.000 0.108
#> GSM531651     3  0.1411     0.9537 0.036 0.000 0.964
#> GSM531652     1  0.3116     0.9024 0.892 0.000 0.108
#> GSM531656     1  0.3116     0.9024 0.892 0.000 0.108
#> GSM531659     1  0.1031     0.8593 0.976 0.024 0.000
#> GSM531661     1  0.5785     0.4561 0.696 0.004 0.300
#> GSM531662     1  0.0592     0.8642 0.988 0.012 0.000
#> GSM531663     1  0.1031     0.8593 0.976 0.024 0.000
#> GSM531664     1  0.3349     0.9026 0.888 0.004 0.108
#> GSM531666     1  0.4121     0.8961 0.868 0.024 0.108
#> GSM531667     1  0.3573     0.7747 0.876 0.004 0.120
#> GSM531668     1  0.1163     0.8569 0.972 0.028 0.000
#> GSM531669     1  0.3349     0.9026 0.888 0.004 0.108
#> GSM531671     1  0.1015     0.8627 0.980 0.012 0.008
#> GSM531672     1  0.1411     0.8515 0.964 0.036 0.000
#> GSM531673     1  0.1031     0.8593 0.976 0.024 0.000
#> GSM531676     2  0.0892     0.9955 0.020 0.980 0.000
#> GSM531679     2  0.0892     0.9955 0.020 0.980 0.000
#> GSM531681     2  0.0892     0.9955 0.020 0.980 0.000
#> GSM531682     2  0.0892     0.9955 0.020 0.980 0.000
#> GSM531683     2  0.0892     0.9955 0.020 0.980 0.000
#> GSM531684     2  0.0892     0.9955 0.020 0.980 0.000
#> GSM531685     2  0.0892     0.9955 0.020 0.980 0.000
#> GSM531686     2  0.0892     0.9955 0.020 0.980 0.000
#> GSM531687     2  0.0892     0.9955 0.020 0.980 0.000
#> GSM531688     2  0.0892     0.9955 0.020 0.980 0.000
#> GSM531690     2  0.0892     0.9955 0.020 0.980 0.000
#> GSM531693     2  0.1753     0.9690 0.048 0.952 0.000
#> GSM531695     2  0.0892     0.9955 0.020 0.980 0.000
#> GSM531603     1  0.6305     0.1256 0.516 0.484 0.000
#> GSM531609     3  0.3987     0.8547 0.108 0.020 0.872
#> GSM531611     1  0.1411     0.8515 0.964 0.036 0.000
#> GSM531621     3  0.1411     0.9537 0.036 0.000 0.964
#> GSM531622     3  0.1411     0.9537 0.036 0.000 0.964
#> GSM531628     3  0.1529     0.9498 0.040 0.000 0.960
#> GSM531630     3  0.1411     0.9537 0.036 0.000 0.964
#> GSM531633     3  0.1411     0.9537 0.036 0.000 0.964
#> GSM531635     3  0.1411     0.9537 0.036 0.000 0.964
#> GSM531640     3  0.1411     0.9537 0.036 0.000 0.964
#> GSM531649     1  0.3482     0.8895 0.872 0.000 0.128
#> GSM531653     1  0.3116     0.9024 0.892 0.000 0.108
#> GSM531657     1  0.1411     0.8515 0.964 0.036 0.000
#> GSM531665     1  0.1031     0.8593 0.976 0.024 0.000
#> GSM531670     1  0.3349     0.9026 0.888 0.004 0.108
#> GSM531674     1  0.3349     0.9026 0.888 0.004 0.108
#> GSM531675     2  0.0892     0.9955 0.020 0.980 0.000
#> GSM531677     2  0.0892     0.9955 0.020 0.980 0.000
#> GSM531678     2  0.0892     0.9955 0.020 0.980 0.000
#> GSM531680     2  0.0892     0.9955 0.020 0.980 0.000
#> GSM531689     2  0.0892     0.9955 0.020 0.980 0.000
#> GSM531691     2  0.0892     0.9955 0.020 0.980 0.000
#> GSM531692     2  0.0892     0.9955 0.020 0.980 0.000
#> GSM531694     2  0.0892     0.9955 0.020 0.980 0.000

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM531602     2  0.0000     0.9897 0.000 1.000 0.000 0.000
#> GSM531604     2  0.0000     0.9897 0.000 1.000 0.000 0.000
#> GSM531606     2  0.0000     0.9897 0.000 1.000 0.000 0.000
#> GSM531607     2  0.0336     0.9817 0.008 0.992 0.000 0.000
#> GSM531608     4  0.0000     1.0000 0.000 0.000 0.000 1.000
#> GSM531610     4  0.0000     1.0000 0.000 0.000 0.000 1.000
#> GSM531612     1  0.3356     0.7615 0.824 0.176 0.000 0.000
#> GSM531613     2  0.0336     0.9817 0.008 0.992 0.000 0.000
#> GSM531614     4  0.0000     1.0000 0.000 0.000 0.000 1.000
#> GSM531616     3  0.0000     0.8887 0.000 0.000 1.000 0.000
#> GSM531618     1  0.0000     0.9693 1.000 0.000 0.000 0.000
#> GSM531619     3  0.0000     0.8887 0.000 0.000 1.000 0.000
#> GSM531620     3  0.0921     0.8626 0.028 0.000 0.972 0.000
#> GSM531623     3  0.0000     0.8887 0.000 0.000 1.000 0.000
#> GSM531625     3  0.0000     0.8887 0.000 0.000 1.000 0.000
#> GSM531626     3  0.4999     0.0384 0.492 0.000 0.508 0.000
#> GSM531632     1  0.0000     0.9693 1.000 0.000 0.000 0.000
#> GSM531638     1  0.0336     0.9633 0.992 0.000 0.008 0.000
#> GSM531639     1  0.0000     0.9693 1.000 0.000 0.000 0.000
#> GSM531641     1  0.0000     0.9693 1.000 0.000 0.000 0.000
#> GSM531642     1  0.0000     0.9693 1.000 0.000 0.000 0.000
#> GSM531643     1  0.0000     0.9693 1.000 0.000 0.000 0.000
#> GSM531644     1  0.0000     0.9693 1.000 0.000 0.000 0.000
#> GSM531645     1  0.0000     0.9693 1.000 0.000 0.000 0.000
#> GSM531646     1  0.0188     0.9665 0.996 0.000 0.004 0.000
#> GSM531647     1  0.0000     0.9693 1.000 0.000 0.000 0.000
#> GSM531648     1  0.0000     0.9693 1.000 0.000 0.000 0.000
#> GSM531650     1  0.0000     0.9693 1.000 0.000 0.000 0.000
#> GSM531651     3  0.0000     0.8887 0.000 0.000 1.000 0.000
#> GSM531652     1  0.0000     0.9693 1.000 0.000 0.000 0.000
#> GSM531656     1  0.0000     0.9693 1.000 0.000 0.000 0.000
#> GSM531659     1  0.0000     0.9693 1.000 0.000 0.000 0.000
#> GSM531661     3  0.4843     0.3457 0.396 0.000 0.604 0.000
#> GSM531662     1  0.0188     0.9665 0.996 0.000 0.004 0.000
#> GSM531663     1  0.0000     0.9693 1.000 0.000 0.000 0.000
#> GSM531664     1  0.0000     0.9693 1.000 0.000 0.000 0.000
#> GSM531666     1  0.0000     0.9693 1.000 0.000 0.000 0.000
#> GSM531667     1  0.4072     0.6447 0.748 0.000 0.252 0.000
#> GSM531668     1  0.0000     0.9693 1.000 0.000 0.000 0.000
#> GSM531669     1  0.0000     0.9693 1.000 0.000 0.000 0.000
#> GSM531671     1  0.0336     0.9633 0.992 0.000 0.008 0.000
#> GSM531672     1  0.3539     0.7579 0.820 0.176 0.000 0.004
#> GSM531673     1  0.0000     0.9693 1.000 0.000 0.000 0.000
#> GSM531676     2  0.0000     0.9897 0.000 1.000 0.000 0.000
#> GSM531679     2  0.0000     0.9897 0.000 1.000 0.000 0.000
#> GSM531681     2  0.0000     0.9897 0.000 1.000 0.000 0.000
#> GSM531682     2  0.0000     0.9897 0.000 1.000 0.000 0.000
#> GSM531683     2  0.0000     0.9897 0.000 1.000 0.000 0.000
#> GSM531684     2  0.0000     0.9897 0.000 1.000 0.000 0.000
#> GSM531685     2  0.0000     0.9897 0.000 1.000 0.000 0.000
#> GSM531686     2  0.0000     0.9897 0.000 1.000 0.000 0.000
#> GSM531687     2  0.0000     0.9897 0.000 1.000 0.000 0.000
#> GSM531688     2  0.0000     0.9897 0.000 1.000 0.000 0.000
#> GSM531690     2  0.0000     0.9897 0.000 1.000 0.000 0.000
#> GSM531693     2  0.3266     0.7345 0.168 0.832 0.000 0.000
#> GSM531695     2  0.0000     0.9897 0.000 1.000 0.000 0.000
#> GSM531603     2  0.0336     0.9817 0.008 0.992 0.000 0.000
#> GSM531609     4  0.0000     1.0000 0.000 0.000 0.000 1.000
#> GSM531611     1  0.3569     0.7326 0.804 0.196 0.000 0.000
#> GSM531621     3  0.0000     0.8887 0.000 0.000 1.000 0.000
#> GSM531622     3  0.0000     0.8887 0.000 0.000 1.000 0.000
#> GSM531628     3  0.0921     0.8626 0.028 0.000 0.972 0.000
#> GSM531630     3  0.0000     0.8887 0.000 0.000 1.000 0.000
#> GSM531633     3  0.0000     0.8887 0.000 0.000 1.000 0.000
#> GSM531635     3  0.0000     0.8887 0.000 0.000 1.000 0.000
#> GSM531640     3  0.0000     0.8887 0.000 0.000 1.000 0.000
#> GSM531649     1  0.0336     0.9633 0.992 0.000 0.008 0.000
#> GSM531653     1  0.0000     0.9693 1.000 0.000 0.000 0.000
#> GSM531657     1  0.0000     0.9693 1.000 0.000 0.000 0.000
#> GSM531665     1  0.0000     0.9693 1.000 0.000 0.000 0.000
#> GSM531670     1  0.0000     0.9693 1.000 0.000 0.000 0.000
#> GSM531674     1  0.0000     0.9693 1.000 0.000 0.000 0.000
#> GSM531675     2  0.0000     0.9897 0.000 1.000 0.000 0.000
#> GSM531677     2  0.0000     0.9897 0.000 1.000 0.000 0.000
#> GSM531678     2  0.0000     0.9897 0.000 1.000 0.000 0.000
#> GSM531680     2  0.0000     0.9897 0.000 1.000 0.000 0.000
#> GSM531689     2  0.0000     0.9897 0.000 1.000 0.000 0.000
#> GSM531691     2  0.0000     0.9897 0.000 1.000 0.000 0.000
#> GSM531692     2  0.0000     0.9897 0.000 1.000 0.000 0.000
#> GSM531694     2  0.0000     0.9897 0.000 1.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
#> GSM531602     2  0.0000   0.927936 0.000 1.000 0.000 0.000  0
#> GSM531604     2  0.1121   0.913901 0.000 0.956 0.000 0.044  0
#> GSM531606     2  0.1121   0.913901 0.000 0.956 0.000 0.044  0
#> GSM531607     2  0.0162   0.927206 0.000 0.996 0.000 0.004  0
#> GSM531608     5  0.0000   1.000000 0.000 0.000 0.000 0.000  1
#> GSM531610     5  0.0000   1.000000 0.000 0.000 0.000 0.000  1
#> GSM531612     4  0.2927   0.532657 0.040 0.092 0.000 0.868  0
#> GSM531613     2  0.4201   0.431082 0.000 0.592 0.000 0.408  0
#> GSM531614     5  0.0000   1.000000 0.000 0.000 0.000 0.000  1
#> GSM531616     3  0.0703   0.975731 0.000 0.000 0.976 0.024  0
#> GSM531618     1  0.3305   0.462474 0.776 0.000 0.000 0.224  0
#> GSM531619     3  0.0290   0.977702 0.000 0.000 0.992 0.008  0
#> GSM531620     3  0.0771   0.974857 0.004 0.000 0.976 0.020  0
#> GSM531623     3  0.0963   0.949382 0.036 0.000 0.964 0.000  0
#> GSM531625     3  0.0290   0.977702 0.000 0.000 0.992 0.008  0
#> GSM531626     1  0.2280   0.583305 0.880 0.000 0.120 0.000  0
#> GSM531632     1  0.0000   0.724425 1.000 0.000 0.000 0.000  0
#> GSM531638     1  0.0290   0.718523 0.992 0.000 0.008 0.000  0
#> GSM531639     1  0.2891   0.545218 0.824 0.000 0.000 0.176  0
#> GSM531641     4  0.4150   0.650737 0.388 0.000 0.000 0.612  0
#> GSM531642     1  0.4138   0.000301 0.616 0.000 0.000 0.384  0
#> GSM531643     1  0.0000   0.724425 1.000 0.000 0.000 0.000  0
#> GSM531644     1  0.0000   0.724425 1.000 0.000 0.000 0.000  0
#> GSM531645     1  0.0000   0.724425 1.000 0.000 0.000 0.000  0
#> GSM531646     1  0.0290   0.718523 0.992 0.000 0.008 0.000  0
#> GSM531647     1  0.0000   0.724425 1.000 0.000 0.000 0.000  0
#> GSM531648     1  0.0000   0.724425 1.000 0.000 0.000 0.000  0
#> GSM531650     1  0.0000   0.724425 1.000 0.000 0.000 0.000  0
#> GSM531651     3  0.0290   0.977702 0.000 0.000 0.992 0.008  0
#> GSM531652     1  0.0000   0.724425 1.000 0.000 0.000 0.000  0
#> GSM531656     1  0.0000   0.724425 1.000 0.000 0.000 0.000  0
#> GSM531659     4  0.4138   0.657096 0.384 0.000 0.000 0.616  0
#> GSM531661     4  0.6506   0.439907 0.344 0.000 0.200 0.456  0
#> GSM531662     1  0.4278  -0.240785 0.548 0.000 0.000 0.452  0
#> GSM531663     4  0.4074   0.666242 0.364 0.000 0.000 0.636  0
#> GSM531664     1  0.4278  -0.240785 0.548 0.000 0.000 0.452  0
#> GSM531666     4  0.4307   0.347749 0.500 0.000 0.000 0.500  0
#> GSM531667     4  0.6299   0.433761 0.380 0.000 0.156 0.464  0
#> GSM531668     4  0.4101   0.665136 0.372 0.000 0.000 0.628  0
#> GSM531669     1  0.4278  -0.240785 0.548 0.000 0.000 0.452  0
#> GSM531671     1  0.4278  -0.240785 0.548 0.000 0.000 0.452  0
#> GSM531672     4  0.2946   0.537925 0.044 0.088 0.000 0.868  0
#> GSM531673     4  0.4126   0.660695 0.380 0.000 0.000 0.620  0
#> GSM531676     2  0.1410   0.909194 0.000 0.940 0.000 0.060  0
#> GSM531679     2  0.0000   0.927936 0.000 1.000 0.000 0.000  0
#> GSM531681     2  0.0000   0.927936 0.000 1.000 0.000 0.000  0
#> GSM531682     2  0.0162   0.927206 0.000 0.996 0.000 0.004  0
#> GSM531683     2  0.0000   0.927936 0.000 1.000 0.000 0.000  0
#> GSM531684     2  0.1270   0.912079 0.000 0.948 0.000 0.052  0
#> GSM531685     2  0.2280   0.878331 0.000 0.880 0.000 0.120  0
#> GSM531686     2  0.0000   0.927936 0.000 1.000 0.000 0.000  0
#> GSM531687     2  0.2280   0.876720 0.000 0.880 0.000 0.120  0
#> GSM531688     2  0.2280   0.876720 0.000 0.880 0.000 0.120  0
#> GSM531690     2  0.0000   0.927936 0.000 1.000 0.000 0.000  0
#> GSM531693     2  0.3309   0.839306 0.036 0.836 0.000 0.128  0
#> GSM531695     2  0.1732   0.893253 0.000 0.920 0.000 0.080  0
#> GSM531603     2  0.4307   0.248174 0.000 0.500 0.000 0.500  0
#> GSM531609     5  0.0000   1.000000 0.000 0.000 0.000 0.000  1
#> GSM531611     4  0.2927   0.532657 0.040 0.092 0.000 0.868  0
#> GSM531621     3  0.0290   0.977702 0.000 0.000 0.992 0.008  0
#> GSM531622     3  0.0703   0.975731 0.000 0.000 0.976 0.024  0
#> GSM531628     3  0.1270   0.922809 0.052 0.000 0.948 0.000  0
#> GSM531630     3  0.0703   0.975731 0.000 0.000 0.976 0.024  0
#> GSM531633     3  0.0290   0.977702 0.000 0.000 0.992 0.008  0
#> GSM531635     3  0.0703   0.975731 0.000 0.000 0.976 0.024  0
#> GSM531640     3  0.0290   0.977702 0.000 0.000 0.992 0.008  0
#> GSM531649     1  0.0880   0.693393 0.968 0.000 0.032 0.000  0
#> GSM531653     1  0.0000   0.724425 1.000 0.000 0.000 0.000  0
#> GSM531657     4  0.3508   0.635691 0.252 0.000 0.000 0.748  0
#> GSM531665     4  0.4138   0.657096 0.384 0.000 0.000 0.616  0
#> GSM531670     1  0.4273  -0.227785 0.552 0.000 0.000 0.448  0
#> GSM531674     1  0.3913   0.188662 0.676 0.000 0.000 0.324  0
#> GSM531675     2  0.0000   0.927936 0.000 1.000 0.000 0.000  0
#> GSM531677     2  0.0000   0.927936 0.000 1.000 0.000 0.000  0
#> GSM531678     2  0.0000   0.927936 0.000 1.000 0.000 0.000  0
#> GSM531680     2  0.0290   0.926961 0.000 0.992 0.000 0.008  0
#> GSM531689     2  0.0290   0.927149 0.000 0.992 0.000 0.008  0
#> GSM531691     2  0.1341   0.910422 0.000 0.944 0.000 0.056  0
#> GSM531692     2  0.2020   0.890191 0.000 0.900 0.000 0.100  0
#> GSM531694     2  0.0000   0.927936 0.000 1.000 0.000 0.000  0

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>           class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM531602     2  0.0000     0.6702 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM531604     2  0.2969     0.4315 0.000 0.776 0.000 0.000 0.224 0.000
#> GSM531606     2  0.2597     0.4973 0.000 0.824 0.000 0.000 0.176 0.000
#> GSM531607     2  0.0000     0.6702 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM531608     6  0.3266     1.0000 0.000 0.000 0.000 0.000 0.272 0.728
#> GSM531610     6  0.3266     1.0000 0.000 0.000 0.000 0.000 0.272 0.728
#> GSM531612     4  0.2915     0.3822 0.008 0.184 0.000 0.808 0.000 0.000
#> GSM531613     2  0.4039     0.1531 0.008 0.568 0.000 0.424 0.000 0.000
#> GSM531614     6  0.3266     1.0000 0.000 0.000 0.000 0.000 0.272 0.728
#> GSM531616     3  0.0713     0.8329 0.000 0.000 0.972 0.000 0.028 0.000
#> GSM531618     1  0.3927     0.4466 0.712 0.000 0.000 0.260 0.004 0.024
#> GSM531619     3  0.2860     0.8265 0.000 0.000 0.852 0.100 0.048 0.000
#> GSM531620     3  0.0146     0.8357 0.000 0.000 0.996 0.000 0.004 0.000
#> GSM531623     3  0.0777     0.8309 0.024 0.000 0.972 0.004 0.000 0.000
#> GSM531625     3  0.2860     0.8265 0.000 0.000 0.852 0.100 0.048 0.000
#> GSM531626     1  0.3795     0.3531 0.632 0.000 0.364 0.004 0.000 0.000
#> GSM531632     1  0.2969     0.6779 0.860 0.000 0.088 0.020 0.000 0.032
#> GSM531638     1  0.2006     0.6603 0.892 0.000 0.104 0.004 0.000 0.000
#> GSM531639     1  0.3555     0.6164 0.780 0.000 0.000 0.044 0.000 0.176
#> GSM531641     4  0.5289     0.5828 0.280 0.000 0.000 0.580 0.000 0.140
#> GSM531642     1  0.3618     0.6133 0.776 0.000 0.000 0.048 0.000 0.176
#> GSM531643     1  0.0547     0.6940 0.980 0.000 0.000 0.020 0.000 0.000
#> GSM531644     1  0.1007     0.6839 0.956 0.000 0.000 0.044 0.000 0.000
#> GSM531645     1  0.3699     0.2394 0.660 0.000 0.000 0.336 0.004 0.000
#> GSM531646     1  0.1765     0.6676 0.904 0.000 0.096 0.000 0.000 0.000
#> GSM531647     1  0.1714     0.6697 0.908 0.000 0.092 0.000 0.000 0.000
#> GSM531648     1  0.3468     0.3687 0.712 0.000 0.000 0.284 0.004 0.000
#> GSM531650     1  0.0000     0.6922 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM531651     3  0.2860     0.8265 0.000 0.000 0.852 0.100 0.048 0.000
#> GSM531652     1  0.0632     0.6899 0.976 0.000 0.000 0.024 0.000 0.000
#> GSM531656     1  0.1141     0.6801 0.948 0.000 0.000 0.052 0.000 0.000
#> GSM531659     4  0.6070     0.6201 0.240 0.000 0.000 0.480 0.008 0.272
#> GSM531661     3  0.6269     0.2863 0.104 0.000 0.556 0.060 0.008 0.272
#> GSM531662     1  0.4610     0.5134 0.664 0.000 0.000 0.056 0.008 0.272
#> GSM531663     4  0.5654     0.6664 0.188 0.000 0.000 0.552 0.004 0.256
#> GSM531664     1  0.4405     0.5396 0.688 0.000 0.000 0.072 0.000 0.240
#> GSM531666     1  0.5841    -0.0221 0.488 0.000 0.000 0.328 0.004 0.180
#> GSM531667     3  0.6361     0.2541 0.120 0.000 0.544 0.056 0.008 0.272
#> GSM531668     4  0.5861     0.6486 0.224 0.000 0.000 0.512 0.004 0.260
#> GSM531669     1  0.4312     0.5223 0.676 0.000 0.000 0.052 0.000 0.272
#> GSM531671     1  0.6007     0.4999 0.580 0.000 0.088 0.052 0.008 0.272
#> GSM531672     4  0.3664     0.4610 0.080 0.108 0.000 0.804 0.000 0.008
#> GSM531673     4  0.5908     0.6411 0.228 0.000 0.000 0.500 0.004 0.268
#> GSM531676     2  0.3833    -0.2819 0.000 0.556 0.000 0.000 0.444 0.000
#> GSM531679     2  0.0000     0.6702 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM531681     2  0.0000     0.6702 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM531682     2  0.2697     0.4572 0.000 0.812 0.000 0.000 0.188 0.000
#> GSM531683     2  0.0000     0.6702 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM531684     2  0.2793     0.4747 0.000 0.800 0.000 0.000 0.200 0.000
#> GSM531685     2  0.4072    -0.3124 0.000 0.544 0.000 0.008 0.448 0.000
#> GSM531686     2  0.0260     0.6660 0.000 0.992 0.000 0.000 0.008 0.000
#> GSM531687     2  0.4072    -0.3124 0.000 0.544 0.000 0.008 0.448 0.000
#> GSM531688     2  0.4072    -0.3124 0.000 0.544 0.000 0.008 0.448 0.000
#> GSM531690     2  0.0000     0.6702 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM531693     5  0.7196     0.5443 0.160 0.332 0.000 0.044 0.424 0.040
#> GSM531695     2  0.4032    -0.2388 0.000 0.572 0.000 0.008 0.420 0.000
#> GSM531603     2  0.3934     0.1973 0.008 0.616 0.000 0.376 0.000 0.000
#> GSM531609     6  0.3266     1.0000 0.000 0.000 0.000 0.000 0.272 0.728
#> GSM531611     4  0.2915     0.3822 0.008 0.184 0.000 0.808 0.000 0.000
#> GSM531621     3  0.2812     0.8266 0.000 0.000 0.856 0.096 0.048 0.000
#> GSM531622     3  0.0291     0.8358 0.000 0.000 0.992 0.004 0.004 0.000
#> GSM531628     3  0.1984     0.7746 0.056 0.000 0.912 0.032 0.000 0.000
#> GSM531630     3  0.0713     0.8329 0.000 0.000 0.972 0.000 0.028 0.000
#> GSM531633     3  0.2812     0.8266 0.000 0.000 0.856 0.096 0.048 0.000
#> GSM531635     3  0.0713     0.8329 0.000 0.000 0.972 0.000 0.028 0.000
#> GSM531640     3  0.2812     0.8266 0.000 0.000 0.856 0.096 0.048 0.000
#> GSM531649     1  0.2597     0.6016 0.824 0.000 0.176 0.000 0.000 0.000
#> GSM531653     1  0.0146     0.6923 0.996 0.000 0.000 0.004 0.000 0.000
#> GSM531657     4  0.5055     0.6566 0.184 0.000 0.000 0.652 0.004 0.160
#> GSM531665     4  0.6125     0.6293 0.232 0.000 0.000 0.484 0.012 0.272
#> GSM531670     1  0.4270     0.5325 0.684 0.000 0.000 0.052 0.000 0.264
#> GSM531674     1  0.3964     0.5742 0.724 0.000 0.000 0.044 0.000 0.232
#> GSM531675     2  0.0000     0.6702 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM531677     2  0.0000     0.6702 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM531678     2  0.0000     0.6702 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM531680     2  0.1765     0.5911 0.000 0.904 0.000 0.000 0.096 0.000
#> GSM531689     2  0.1610     0.6055 0.000 0.916 0.000 0.000 0.084 0.000
#> GSM531691     2  0.3810    -0.2401 0.000 0.572 0.000 0.000 0.428 0.000
#> GSM531692     5  0.3695     0.4604 0.000 0.376 0.000 0.000 0.624 0.000
#> GSM531694     2  0.0000     0.6702 0.000 1.000 0.000 0.000 0.000 0.000

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

consensus_heatmap(res, k = 2)

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 disease.state(p) k
#> ATC:mclust 80            0.220 2
#> ATC:mclust 77            0.130 3
#> ATC:mclust 78            0.168 4
#> ATC:mclust 67            0.248 5
#> ATC:mclust 56            0.439 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 51941 rows and 80 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 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-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.949           0.954       0.979         0.4937 0.502   0.502
#> 3 3 0.903           0.892       0.955         0.3257 0.766   0.564
#> 4 4 0.694           0.718       0.858         0.0587 0.835   0.608
#> 5 5 0.532           0.457       0.705         0.0747 0.929   0.805
#> 6 6 0.551           0.381       0.618         0.0514 0.886   0.666

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
#> GSM531602     2  0.0000      0.961 0.000 1.000
#> GSM531604     2  0.8499      0.645 0.276 0.724
#> GSM531606     2  0.3114      0.920 0.056 0.944
#> GSM531607     2  0.0000      0.961 0.000 1.000
#> GSM531608     1  0.0000      0.992 1.000 0.000
#> GSM531610     2  0.0376      0.958 0.004 0.996
#> GSM531612     2  0.0000      0.961 0.000 1.000
#> GSM531613     2  0.0000      0.961 0.000 1.000
#> GSM531614     1  0.0000      0.992 1.000 0.000
#> GSM531616     1  0.0000      0.992 1.000 0.000
#> GSM531618     1  0.0000      0.992 1.000 0.000
#> GSM531619     1  0.0000      0.992 1.000 0.000
#> GSM531620     1  0.0000      0.992 1.000 0.000
#> GSM531623     1  0.0000      0.992 1.000 0.000
#> GSM531625     1  0.0000      0.992 1.000 0.000
#> GSM531626     1  0.0000      0.992 1.000 0.000
#> GSM531632     1  0.0000      0.992 1.000 0.000
#> GSM531638     1  0.0000      0.992 1.000 0.000
#> GSM531639     1  0.0000      0.992 1.000 0.000
#> GSM531641     2  0.2043      0.939 0.032 0.968
#> GSM531642     1  0.3114      0.940 0.944 0.056
#> GSM531643     1  0.0000      0.992 1.000 0.000
#> GSM531644     1  0.0000      0.992 1.000 0.000
#> GSM531645     1  0.0000      0.992 1.000 0.000
#> GSM531646     1  0.0000      0.992 1.000 0.000
#> GSM531647     1  0.0000      0.992 1.000 0.000
#> GSM531648     1  0.0000      0.992 1.000 0.000
#> GSM531650     1  0.0000      0.992 1.000 0.000
#> GSM531651     1  0.0000      0.992 1.000 0.000
#> GSM531652     1  0.0000      0.992 1.000 0.000
#> GSM531656     1  0.0000      0.992 1.000 0.000
#> GSM531659     2  0.8267      0.672 0.260 0.740
#> GSM531661     1  0.0000      0.992 1.000 0.000
#> GSM531662     1  0.0000      0.992 1.000 0.000
#> GSM531663     1  0.4022      0.915 0.920 0.080
#> GSM531664     2  0.9933      0.220 0.452 0.548
#> GSM531666     2  0.0672      0.956 0.008 0.992
#> GSM531667     1  0.0000      0.992 1.000 0.000
#> GSM531668     1  0.1633      0.971 0.976 0.024
#> GSM531669     1  0.0672      0.985 0.992 0.008
#> GSM531671     1  0.0000      0.992 1.000 0.000
#> GSM531672     2  0.0000      0.961 0.000 1.000
#> GSM531673     1  0.4022      0.915 0.920 0.080
#> GSM531676     2  0.0000      0.961 0.000 1.000
#> GSM531679     2  0.0000      0.961 0.000 1.000
#> GSM531681     2  0.0000      0.961 0.000 1.000
#> GSM531682     2  0.0000      0.961 0.000 1.000
#> GSM531683     2  0.0000      0.961 0.000 1.000
#> GSM531684     2  0.0000      0.961 0.000 1.000
#> GSM531685     2  0.0000      0.961 0.000 1.000
#> GSM531686     2  0.0000      0.961 0.000 1.000
#> GSM531687     2  0.0000      0.961 0.000 1.000
#> GSM531688     2  0.0000      0.961 0.000 1.000
#> GSM531690     2  0.0000      0.961 0.000 1.000
#> GSM531693     2  0.4815      0.876 0.104 0.896
#> GSM531695     2  0.0000      0.961 0.000 1.000
#> GSM531603     2  0.0000      0.961 0.000 1.000
#> GSM531609     1  0.0000      0.992 1.000 0.000
#> GSM531611     2  0.0000      0.961 0.000 1.000
#> GSM531621     1  0.0000      0.992 1.000 0.000
#> GSM531622     1  0.0000      0.992 1.000 0.000
#> GSM531628     1  0.0000      0.992 1.000 0.000
#> GSM531630     1  0.0000      0.992 1.000 0.000
#> GSM531633     1  0.0000      0.992 1.000 0.000
#> GSM531635     1  0.0000      0.992 1.000 0.000
#> GSM531640     1  0.0000      0.992 1.000 0.000
#> GSM531649     1  0.0000      0.992 1.000 0.000
#> GSM531653     1  0.0000      0.992 1.000 0.000
#> GSM531657     2  0.5408      0.855 0.124 0.876
#> GSM531665     1  0.0000      0.992 1.000 0.000
#> GSM531670     1  0.0000      0.992 1.000 0.000
#> GSM531674     1  0.0000      0.992 1.000 0.000
#> GSM531675     2  0.0000      0.961 0.000 1.000
#> GSM531677     2  0.0000      0.961 0.000 1.000
#> GSM531678     2  0.0000      0.961 0.000 1.000
#> GSM531680     2  0.0000      0.961 0.000 1.000
#> GSM531689     2  0.0000      0.961 0.000 1.000
#> GSM531691     2  0.0000      0.961 0.000 1.000
#> GSM531692     1  0.4690      0.890 0.900 0.100
#> GSM531694     2  0.0000      0.961 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
#> GSM531602     2  0.0000     0.9496 0.000 1.000 0.000
#> GSM531604     2  0.5465     0.6034 0.000 0.712 0.288
#> GSM531606     2  0.2878     0.8607 0.000 0.904 0.096
#> GSM531607     2  0.0000     0.9496 0.000 1.000 0.000
#> GSM531608     3  0.0000     0.9712 0.000 0.000 1.000
#> GSM531610     1  0.0475     0.9072 0.992 0.004 0.004
#> GSM531612     1  0.0237     0.9057 0.996 0.004 0.000
#> GSM531613     1  0.2796     0.8365 0.908 0.092 0.000
#> GSM531614     3  0.0000     0.9712 0.000 0.000 1.000
#> GSM531616     3  0.0000     0.9712 0.000 0.000 1.000
#> GSM531618     1  0.6299     0.1770 0.524 0.000 0.476
#> GSM531619     3  0.0000     0.9712 0.000 0.000 1.000
#> GSM531620     3  0.0000     0.9712 0.000 0.000 1.000
#> GSM531623     3  0.0000     0.9712 0.000 0.000 1.000
#> GSM531625     3  0.0000     0.9712 0.000 0.000 1.000
#> GSM531626     3  0.0000     0.9712 0.000 0.000 1.000
#> GSM531632     3  0.0000     0.9712 0.000 0.000 1.000
#> GSM531638     3  0.0000     0.9712 0.000 0.000 1.000
#> GSM531639     1  0.1163     0.9067 0.972 0.000 0.028
#> GSM531641     1  0.0000     0.9071 1.000 0.000 0.000
#> GSM531642     1  0.0000     0.9071 1.000 0.000 0.000
#> GSM531643     1  0.2448     0.8785 0.924 0.000 0.076
#> GSM531644     1  0.1031     0.9078 0.976 0.000 0.024
#> GSM531645     1  0.0237     0.9079 0.996 0.000 0.004
#> GSM531646     3  0.0000     0.9712 0.000 0.000 1.000
#> GSM531647     3  0.1163     0.9504 0.028 0.000 0.972
#> GSM531648     1  0.1031     0.9079 0.976 0.000 0.024
#> GSM531650     1  0.1411     0.9030 0.964 0.000 0.036
#> GSM531651     3  0.0000     0.9712 0.000 0.000 1.000
#> GSM531652     1  0.1031     0.9076 0.976 0.000 0.024
#> GSM531656     1  0.5706     0.5704 0.680 0.000 0.320
#> GSM531659     2  0.8939     0.0184 0.124 0.440 0.436
#> GSM531661     3  0.0000     0.9712 0.000 0.000 1.000
#> GSM531662     3  0.0000     0.9712 0.000 0.000 1.000
#> GSM531663     3  0.1491     0.9507 0.016 0.016 0.968
#> GSM531664     1  0.0000     0.9071 1.000 0.000 0.000
#> GSM531666     1  0.0000     0.9071 1.000 0.000 0.000
#> GSM531667     3  0.0000     0.9712 0.000 0.000 1.000
#> GSM531668     3  0.0424     0.9660 0.008 0.000 0.992
#> GSM531669     1  0.6154     0.3750 0.592 0.000 0.408
#> GSM531671     3  0.0000     0.9712 0.000 0.000 1.000
#> GSM531672     1  0.0000     0.9071 1.000 0.000 0.000
#> GSM531673     3  0.1620     0.9465 0.012 0.024 0.964
#> GSM531676     2  0.0000     0.9496 0.000 1.000 0.000
#> GSM531679     2  0.0000     0.9496 0.000 1.000 0.000
#> GSM531681     2  0.0000     0.9496 0.000 1.000 0.000
#> GSM531682     2  0.0000     0.9496 0.000 1.000 0.000
#> GSM531683     2  0.0000     0.9496 0.000 1.000 0.000
#> GSM531684     2  0.0237     0.9467 0.000 0.996 0.004
#> GSM531685     2  0.0000     0.9496 0.000 1.000 0.000
#> GSM531686     2  0.0000     0.9496 0.000 1.000 0.000
#> GSM531687     2  0.0000     0.9496 0.000 1.000 0.000
#> GSM531688     2  0.0000     0.9496 0.000 1.000 0.000
#> GSM531690     2  0.0000     0.9496 0.000 1.000 0.000
#> GSM531693     2  0.3816     0.8036 0.000 0.852 0.148
#> GSM531695     2  0.0592     0.9414 0.012 0.988 0.000
#> GSM531603     2  0.0000     0.9496 0.000 1.000 0.000
#> GSM531609     1  0.3816     0.8104 0.852 0.000 0.148
#> GSM531611     1  0.0000     0.9071 1.000 0.000 0.000
#> GSM531621     3  0.0000     0.9712 0.000 0.000 1.000
#> GSM531622     3  0.0000     0.9712 0.000 0.000 1.000
#> GSM531628     3  0.0747     0.9603 0.016 0.000 0.984
#> GSM531630     3  0.0000     0.9712 0.000 0.000 1.000
#> GSM531633     3  0.0000     0.9712 0.000 0.000 1.000
#> GSM531635     3  0.0000     0.9712 0.000 0.000 1.000
#> GSM531640     3  0.0000     0.9712 0.000 0.000 1.000
#> GSM531649     3  0.0000     0.9712 0.000 0.000 1.000
#> GSM531653     3  0.5291     0.5965 0.268 0.000 0.732
#> GSM531657     1  0.0892     0.9074 0.980 0.000 0.020
#> GSM531665     3  0.0000     0.9712 0.000 0.000 1.000
#> GSM531670     3  0.0747     0.9603 0.016 0.000 0.984
#> GSM531674     3  0.2261     0.9091 0.068 0.000 0.932
#> GSM531675     2  0.0000     0.9496 0.000 1.000 0.000
#> GSM531677     2  0.0000     0.9496 0.000 1.000 0.000
#> GSM531678     2  0.0000     0.9496 0.000 1.000 0.000
#> GSM531680     2  0.0747     0.9386 0.016 0.984 0.000
#> GSM531689     2  0.0000     0.9496 0.000 1.000 0.000
#> GSM531691     2  0.0000     0.9496 0.000 1.000 0.000
#> GSM531692     3  0.5882     0.4305 0.000 0.348 0.652
#> GSM531694     2  0.0000     0.9496 0.000 1.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
#> GSM531602     2  0.0188     0.9425 0.000 0.996 0.000 0.004
#> GSM531604     2  0.3215     0.8554 0.092 0.876 0.032 0.000
#> GSM531606     2  0.1059     0.9315 0.012 0.972 0.016 0.000
#> GSM531607     2  0.1936     0.9259 0.028 0.940 0.000 0.032
#> GSM531608     1  0.1867     0.6748 0.928 0.000 0.072 0.000
#> GSM531610     4  0.5345     0.2995 0.428 0.012 0.000 0.560
#> GSM531612     4  0.2282     0.7530 0.052 0.024 0.000 0.924
#> GSM531613     4  0.3312     0.7065 0.052 0.072 0.000 0.876
#> GSM531614     1  0.1970     0.6710 0.932 0.000 0.060 0.008
#> GSM531616     3  0.3172     0.7330 0.160 0.000 0.840 0.000
#> GSM531618     3  0.3074     0.6940 0.000 0.000 0.848 0.152
#> GSM531619     3  0.4994     0.1090 0.480 0.000 0.520 0.000
#> GSM531620     3  0.3528     0.7246 0.192 0.000 0.808 0.000
#> GSM531623     3  0.4222     0.6260 0.272 0.000 0.728 0.000
#> GSM531625     3  0.4522     0.5679 0.320 0.000 0.680 0.000
#> GSM531626     3  0.2921     0.7356 0.140 0.000 0.860 0.000
#> GSM531632     3  0.0921     0.7527 0.028 0.000 0.972 0.000
#> GSM531638     3  0.2704     0.7447 0.124 0.000 0.876 0.000
#> GSM531639     3  0.3583     0.6611 0.004 0.000 0.816 0.180
#> GSM531641     4  0.0657     0.7783 0.012 0.000 0.004 0.984
#> GSM531642     4  0.2773     0.7589 0.004 0.000 0.116 0.880
#> GSM531643     3  0.3105     0.6951 0.004 0.000 0.856 0.140
#> GSM531644     3  0.5158     0.0174 0.004 0.000 0.524 0.472
#> GSM531645     4  0.2271     0.7788 0.008 0.000 0.076 0.916
#> GSM531646     3  0.0336     0.7508 0.008 0.000 0.992 0.000
#> GSM531647     3  0.2197     0.7253 0.004 0.000 0.916 0.080
#> GSM531648     4  0.2469     0.7688 0.000 0.000 0.108 0.892
#> GSM531650     3  0.4905     0.3590 0.004 0.000 0.632 0.364
#> GSM531651     1  0.4989    -0.1950 0.528 0.000 0.472 0.000
#> GSM531652     4  0.4889     0.4524 0.004 0.000 0.360 0.636
#> GSM531656     3  0.3726     0.6340 0.000 0.000 0.788 0.212
#> GSM531659     3  0.5241     0.5985 0.008 0.136 0.768 0.088
#> GSM531661     3  0.3486     0.7069 0.188 0.000 0.812 0.000
#> GSM531662     3  0.3464     0.7377 0.076 0.056 0.868 0.000
#> GSM531663     3  0.2718     0.7336 0.012 0.020 0.912 0.056
#> GSM531664     4  0.5138     0.4009 0.008 0.000 0.392 0.600
#> GSM531666     4  0.2530     0.7683 0.004 0.000 0.100 0.896
#> GSM531667     3  0.4040     0.6491 0.248 0.000 0.752 0.000
#> GSM531668     3  0.3289     0.7445 0.140 0.004 0.852 0.004
#> GSM531669     3  0.2918     0.7103 0.008 0.000 0.876 0.116
#> GSM531671     3  0.2530     0.7497 0.100 0.004 0.896 0.000
#> GSM531672     4  0.2142     0.7572 0.056 0.016 0.000 0.928
#> GSM531673     3  0.2719     0.7343 0.024 0.020 0.916 0.040
#> GSM531676     2  0.0336     0.9414 0.008 0.992 0.000 0.000
#> GSM531679     2  0.0672     0.9414 0.008 0.984 0.000 0.008
#> GSM531681     2  0.0000     0.9425 0.000 1.000 0.000 0.000
#> GSM531682     2  0.0804     0.9408 0.012 0.980 0.000 0.008
#> GSM531683     2  0.0804     0.9410 0.008 0.980 0.000 0.012
#> GSM531684     2  0.0927     0.9333 0.008 0.976 0.016 0.000
#> GSM531685     2  0.0336     0.9414 0.008 0.992 0.000 0.000
#> GSM531686     2  0.2586     0.9107 0.040 0.912 0.000 0.048
#> GSM531687     2  0.0336     0.9414 0.008 0.992 0.000 0.000
#> GSM531688     2  0.0524     0.9416 0.008 0.988 0.000 0.004
#> GSM531690     2  0.2131     0.9223 0.036 0.932 0.000 0.032
#> GSM531693     2  0.2198     0.8828 0.008 0.920 0.072 0.000
#> GSM531695     2  0.2313     0.9188 0.032 0.924 0.000 0.044
#> GSM531603     2  0.3128     0.8878 0.040 0.884 0.000 0.076
#> GSM531609     1  0.5035     0.4375 0.748 0.000 0.056 0.196
#> GSM531611     4  0.2483     0.7468 0.052 0.032 0.000 0.916
#> GSM531621     3  0.4713     0.5039 0.360 0.000 0.640 0.000
#> GSM531622     3  0.3172     0.7276 0.160 0.000 0.840 0.000
#> GSM531628     3  0.3356     0.7328 0.176 0.000 0.824 0.000
#> GSM531630     3  0.3486     0.7165 0.188 0.000 0.812 0.000
#> GSM531633     3  0.4697     0.5105 0.356 0.000 0.644 0.000
#> GSM531635     3  0.3074     0.7358 0.152 0.000 0.848 0.000
#> GSM531640     3  0.4925     0.3362 0.428 0.000 0.572 0.000
#> GSM531649     3  0.2216     0.7496 0.092 0.000 0.908 0.000
#> GSM531653     3  0.2773     0.7114 0.004 0.000 0.880 0.116
#> GSM531657     4  0.1488     0.7833 0.012 0.000 0.032 0.956
#> GSM531665     3  0.3674     0.6961 0.036 0.116 0.848 0.000
#> GSM531670     3  0.2342     0.7238 0.008 0.000 0.912 0.080
#> GSM531674     3  0.2611     0.7185 0.008 0.000 0.896 0.096
#> GSM531675     2  0.0804     0.9408 0.012 0.980 0.000 0.008
#> GSM531677     2  0.2131     0.9223 0.036 0.932 0.000 0.032
#> GSM531678     2  0.0000     0.9425 0.000 1.000 0.000 0.000
#> GSM531680     2  0.2751     0.9051 0.040 0.904 0.000 0.056
#> GSM531689     2  0.0336     0.9414 0.008 0.992 0.000 0.000
#> GSM531691     2  0.0336     0.9414 0.008 0.992 0.000 0.000
#> GSM531692     2  0.7133     0.1643 0.332 0.520 0.148 0.000
#> GSM531694     2  0.0188     0.9421 0.004 0.996 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
#> GSM531602     2  0.3928     0.5600 0.004 0.700 0.000 0.000 0.296
#> GSM531604     2  0.5342     0.4010 0.000 0.676 0.024 0.056 0.244
#> GSM531606     2  0.4352     0.4363 0.000 0.732 0.020 0.012 0.236
#> GSM531607     2  0.5421     0.3364 0.044 0.584 0.000 0.012 0.360
#> GSM531608     4  0.2859     0.8101 0.000 0.000 0.056 0.876 0.068
#> GSM531610     4  0.2795     0.8216 0.100 0.000 0.000 0.872 0.028
#> GSM531612     1  0.6003     0.1467 0.644 0.024 0.000 0.144 0.188
#> GSM531613     1  0.8293    -0.3018 0.364 0.168 0.000 0.180 0.288
#> GSM531614     4  0.0771     0.8855 0.004 0.000 0.020 0.976 0.000
#> GSM531616     3  0.2490     0.6743 0.004 0.000 0.896 0.080 0.020
#> GSM531618     3  0.4558     0.5031 0.252 0.000 0.708 0.004 0.036
#> GSM531619     3  0.5937     0.4406 0.000 0.000 0.564 0.136 0.300
#> GSM531620     3  0.3059     0.6712 0.004 0.000 0.860 0.108 0.028
#> GSM531623     3  0.5233     0.5341 0.000 0.000 0.636 0.076 0.288
#> GSM531625     3  0.5116     0.5972 0.000 0.000 0.692 0.120 0.188
#> GSM531626     3  0.2037     0.6748 0.004 0.000 0.920 0.012 0.064
#> GSM531632     3  0.2438     0.6419 0.060 0.000 0.900 0.000 0.040
#> GSM531638     3  0.1569     0.6713 0.012 0.000 0.948 0.008 0.032
#> GSM531639     1  0.5541     0.1231 0.496 0.000 0.444 0.004 0.056
#> GSM531641     1  0.4407     0.2022 0.764 0.000 0.016 0.040 0.180
#> GSM531642     1  0.3241     0.4206 0.832 0.000 0.144 0.000 0.024
#> GSM531643     3  0.5683    -0.0418 0.428 0.000 0.500 0.004 0.068
#> GSM531644     1  0.4874     0.1368 0.528 0.000 0.452 0.004 0.016
#> GSM531645     1  0.4222     0.3886 0.792 0.000 0.144 0.020 0.044
#> GSM531646     3  0.1943     0.6497 0.056 0.000 0.924 0.000 0.020
#> GSM531647     3  0.4802     0.4727 0.212 0.000 0.716 0.004 0.068
#> GSM531648     1  0.4871     0.3828 0.648 0.000 0.316 0.008 0.028
#> GSM531650     1  0.5335     0.2058 0.536 0.000 0.416 0.004 0.044
#> GSM531651     3  0.6101     0.4301 0.000 0.000 0.552 0.164 0.284
#> GSM531652     1  0.3992     0.4341 0.712 0.000 0.280 0.004 0.004
#> GSM531656     3  0.4724     0.3896 0.320 0.000 0.652 0.008 0.020
#> GSM531659     3  0.7839     0.1016 0.244 0.156 0.464 0.000 0.136
#> GSM531661     3  0.3790     0.6064 0.000 0.000 0.724 0.004 0.272
#> GSM531662     3  0.4197     0.6171 0.020 0.036 0.788 0.000 0.156
#> GSM531663     3  0.6061     0.5447 0.076 0.016 0.668 0.036 0.204
#> GSM531664     1  0.5834     0.0699 0.472 0.000 0.444 0.004 0.080
#> GSM531666     1  0.3769     0.2365 0.796 0.000 0.028 0.004 0.172
#> GSM531667     3  0.4623     0.5530 0.000 0.000 0.664 0.032 0.304
#> GSM531668     3  0.5798     0.5426 0.080 0.008 0.636 0.012 0.264
#> GSM531669     3  0.6046     0.0680 0.376 0.000 0.512 0.004 0.108
#> GSM531671     3  0.3822     0.6406 0.020 0.020 0.808 0.000 0.152
#> GSM531672     1  0.7452    -0.4250 0.412 0.132 0.028 0.028 0.400
#> GSM531673     3  0.5997     0.5081 0.096 0.036 0.660 0.004 0.204
#> GSM531676     2  0.1851     0.6241 0.000 0.912 0.000 0.000 0.088
#> GSM531679     2  0.3039     0.6373 0.000 0.808 0.000 0.000 0.192
#> GSM531681     2  0.3305     0.6225 0.000 0.776 0.000 0.000 0.224
#> GSM531682     2  0.2074     0.6582 0.000 0.896 0.000 0.000 0.104
#> GSM531683     2  0.3177     0.6285 0.000 0.792 0.000 0.000 0.208
#> GSM531684     2  0.4645     0.4024 0.000 0.672 0.016 0.012 0.300
#> GSM531685     2  0.1908     0.6217 0.000 0.908 0.000 0.000 0.092
#> GSM531686     2  0.3766     0.5614 0.004 0.728 0.000 0.000 0.268
#> GSM531687     2  0.1043     0.6482 0.000 0.960 0.000 0.000 0.040
#> GSM531688     2  0.1908     0.6236 0.000 0.908 0.000 0.000 0.092
#> GSM531690     2  0.5100     0.4488 0.056 0.652 0.000 0.004 0.288
#> GSM531693     2  0.5094     0.4056 0.004 0.688 0.064 0.004 0.240
#> GSM531695     2  0.5599     0.3582 0.120 0.620 0.000 0.000 0.260
#> GSM531603     5  0.6711    -0.2166 0.132 0.388 0.004 0.016 0.460
#> GSM531609     4  0.1124     0.8838 0.036 0.000 0.004 0.960 0.000
#> GSM531611     1  0.6526     0.0829 0.576 0.024 0.000 0.188 0.212
#> GSM531621     3  0.5444     0.5731 0.000 0.000 0.660 0.180 0.160
#> GSM531622     3  0.2505     0.6714 0.000 0.000 0.888 0.020 0.092
#> GSM531628     3  0.4380     0.6444 0.048 0.000 0.788 0.136 0.028
#> GSM531630     3  0.2580     0.6727 0.000 0.000 0.892 0.044 0.064
#> GSM531633     3  0.5210     0.5943 0.000 0.000 0.684 0.184 0.132
#> GSM531635     3  0.2166     0.6752 0.004 0.000 0.912 0.072 0.012
#> GSM531640     3  0.6147     0.4482 0.000 0.000 0.556 0.256 0.188
#> GSM531649     3  0.0807     0.6670 0.012 0.000 0.976 0.000 0.012
#> GSM531653     3  0.5715     0.2187 0.332 0.000 0.576 0.004 0.088
#> GSM531657     5  0.8616    -0.1811 0.284 0.048 0.208 0.072 0.388
#> GSM531665     3  0.4524     0.6162 0.016 0.044 0.768 0.004 0.168
#> GSM531670     3  0.3496     0.6026 0.124 0.000 0.832 0.004 0.040
#> GSM531674     3  0.5786     0.2843 0.284 0.000 0.600 0.004 0.112
#> GSM531675     2  0.3242     0.6233 0.000 0.784 0.000 0.000 0.216
#> GSM531677     2  0.3274     0.6196 0.000 0.780 0.000 0.000 0.220
#> GSM531678     2  0.2329     0.6555 0.000 0.876 0.000 0.000 0.124
#> GSM531680     2  0.5336     0.4070 0.084 0.628 0.000 0.000 0.288
#> GSM531689     2  0.1043     0.6421 0.000 0.960 0.000 0.000 0.040
#> GSM531691     2  0.1732     0.6278 0.000 0.920 0.000 0.000 0.080
#> GSM531692     2  0.6625     0.1141 0.000 0.476 0.112 0.028 0.384
#> GSM531694     2  0.2891     0.6441 0.000 0.824 0.000 0.000 0.176

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>           class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM531602     2  0.4037     0.5977 0.008 0.724 0.000 0.032 0.236 0.000
#> GSM531604     2  0.6079     0.2806 0.060 0.472 0.024 0.004 0.416 0.024
#> GSM531606     2  0.6678     0.2008 0.100 0.456 0.040 0.024 0.376 0.004
#> GSM531607     2  0.5244     0.6014 0.020 0.680 0.000 0.160 0.132 0.008
#> GSM531608     6  0.2095     0.8395 0.028 0.000 0.040 0.000 0.016 0.916
#> GSM531610     6  0.3247     0.7462 0.000 0.000 0.000 0.156 0.036 0.808
#> GSM531612     4  0.4808     0.4461 0.028 0.076 0.000 0.760 0.044 0.092
#> GSM531613     4  0.6488     0.3169 0.000 0.232 0.000 0.540 0.092 0.136
#> GSM531614     6  0.0260     0.8865 0.000 0.000 0.008 0.000 0.000 0.992
#> GSM531616     3  0.2585     0.4082 0.048 0.000 0.880 0.000 0.004 0.068
#> GSM531618     3  0.6034    -0.3354 0.184 0.000 0.508 0.292 0.016 0.000
#> GSM531619     3  0.6024     0.2530 0.268 0.000 0.556 0.000 0.136 0.040
#> GSM531620     3  0.3698     0.3851 0.044 0.000 0.796 0.004 0.008 0.148
#> GSM531623     3  0.5577     0.2851 0.272 0.000 0.592 0.000 0.112 0.024
#> GSM531625     3  0.4982     0.4233 0.164 0.000 0.708 0.000 0.060 0.068
#> GSM531626     3  0.1049     0.4568 0.008 0.000 0.960 0.000 0.032 0.000
#> GSM531632     3  0.3921    -0.1329 0.308 0.000 0.676 0.004 0.012 0.000
#> GSM531638     3  0.2278     0.4328 0.052 0.000 0.908 0.008 0.024 0.008
#> GSM531639     1  0.5894     0.7604 0.444 0.000 0.392 0.156 0.008 0.000
#> GSM531641     4  0.2119     0.5185 0.060 0.016 0.008 0.912 0.004 0.000
#> GSM531642     4  0.5278     0.3233 0.284 0.000 0.092 0.608 0.016 0.000
#> GSM531643     1  0.4978     0.7872 0.532 0.000 0.396 0.072 0.000 0.000
#> GSM531644     3  0.5868    -0.7459 0.420 0.000 0.432 0.136 0.012 0.000
#> GSM531645     4  0.5702     0.3066 0.172 0.000 0.172 0.620 0.036 0.000
#> GSM531646     3  0.3357     0.1018 0.224 0.000 0.764 0.004 0.008 0.000
#> GSM531647     3  0.4366    -0.5343 0.440 0.000 0.540 0.004 0.016 0.000
#> GSM531648     4  0.6468    -0.2603 0.228 0.000 0.300 0.444 0.028 0.000
#> GSM531650     1  0.5783     0.7838 0.496 0.000 0.368 0.120 0.016 0.000
#> GSM531651     3  0.6258     0.2551 0.252 0.000 0.552 0.000 0.128 0.068
#> GSM531652     1  0.6317     0.5375 0.376 0.000 0.304 0.312 0.008 0.000
#> GSM531656     3  0.5990    -0.6641 0.368 0.000 0.488 0.112 0.032 0.000
#> GSM531659     3  0.8063    -0.4864 0.280 0.084 0.364 0.056 0.212 0.004
#> GSM531661     3  0.5156     0.3097 0.216 0.000 0.620 0.000 0.164 0.000
#> GSM531662     3  0.5059     0.1182 0.052 0.000 0.540 0.012 0.396 0.000
#> GSM531663     5  0.7601     0.0385 0.064 0.032 0.336 0.196 0.368 0.004
#> GSM531664     1  0.6678     0.7356 0.428 0.000 0.356 0.148 0.068 0.000
#> GSM531666     4  0.4990     0.5057 0.184 0.004 0.044 0.704 0.064 0.000
#> GSM531667     3  0.5509     0.2105 0.292 0.000 0.544 0.000 0.164 0.000
#> GSM531668     3  0.7677    -0.1393 0.104 0.040 0.384 0.120 0.348 0.004
#> GSM531669     1  0.5622     0.7746 0.528 0.000 0.364 0.080 0.028 0.000
#> GSM531671     3  0.4935     0.3043 0.096 0.000 0.660 0.004 0.236 0.004
#> GSM531672     4  0.7288     0.3143 0.076 0.164 0.036 0.484 0.240 0.000
#> GSM531673     5  0.7475    -0.0635 0.108 0.032 0.348 0.120 0.392 0.000
#> GSM531676     2  0.4063     0.6032 0.020 0.692 0.000 0.008 0.280 0.000
#> GSM531679     2  0.0935     0.7357 0.000 0.964 0.000 0.004 0.032 0.000
#> GSM531681     2  0.2750     0.6961 0.000 0.844 0.000 0.020 0.136 0.000
#> GSM531682     2  0.1610     0.7271 0.000 0.916 0.000 0.000 0.084 0.000
#> GSM531683     2  0.1584     0.7309 0.000 0.928 0.000 0.008 0.064 0.000
#> GSM531684     5  0.7164     0.1177 0.252 0.264 0.052 0.000 0.416 0.016
#> GSM531685     2  0.5240     0.5064 0.060 0.588 0.000 0.008 0.332 0.012
#> GSM531686     2  0.1643     0.7273 0.000 0.924 0.000 0.068 0.008 0.000
#> GSM531687     2  0.2442     0.7126 0.000 0.852 0.000 0.004 0.144 0.000
#> GSM531688     2  0.5192     0.5822 0.116 0.648 0.000 0.016 0.220 0.000
#> GSM531690     2  0.4267     0.6378 0.000 0.732 0.000 0.152 0.116 0.000
#> GSM531693     2  0.7242     0.0917 0.268 0.340 0.036 0.012 0.336 0.008
#> GSM531695     2  0.4940     0.6421 0.028 0.704 0.000 0.144 0.124 0.000
#> GSM531603     2  0.7240     0.3046 0.100 0.456 0.004 0.288 0.140 0.012
#> GSM531609     6  0.0632     0.8846 0.000 0.000 0.000 0.024 0.000 0.976
#> GSM531611     4  0.6066     0.3740 0.016 0.112 0.000 0.632 0.068 0.172
#> GSM531621     3  0.4823     0.4532 0.136 0.000 0.724 0.000 0.040 0.100
#> GSM531622     3  0.2513     0.4786 0.060 0.000 0.888 0.000 0.044 0.008
#> GSM531628     3  0.5791     0.0549 0.160 0.000 0.540 0.012 0.000 0.288
#> GSM531630     3  0.1265     0.4537 0.008 0.000 0.948 0.000 0.000 0.044
#> GSM531633     3  0.4418     0.4842 0.084 0.000 0.764 0.000 0.044 0.108
#> GSM531635     3  0.2854     0.4023 0.048 0.000 0.860 0.000 0.004 0.088
#> GSM531640     3  0.5426     0.3916 0.108 0.000 0.644 0.000 0.036 0.212
#> GSM531649     3  0.2214     0.3591 0.092 0.000 0.892 0.004 0.012 0.000
#> GSM531653     1  0.4831     0.7070 0.572 0.000 0.380 0.028 0.020 0.000
#> GSM531657     4  0.8246     0.1661 0.068 0.096 0.176 0.368 0.284 0.008
#> GSM531665     3  0.5580    -0.0211 0.052 0.004 0.488 0.032 0.424 0.000
#> GSM531670     3  0.5257    -0.3179 0.280 0.000 0.624 0.052 0.044 0.000
#> GSM531674     1  0.5184     0.7370 0.496 0.000 0.440 0.036 0.028 0.000
#> GSM531675     2  0.1003     0.7376 0.000 0.964 0.000 0.016 0.020 0.000
#> GSM531677     2  0.0806     0.7354 0.000 0.972 0.000 0.020 0.008 0.000
#> GSM531678     2  0.0937     0.7346 0.000 0.960 0.000 0.000 0.040 0.000
#> GSM531680     2  0.3652     0.6641 0.000 0.768 0.000 0.188 0.044 0.000
#> GSM531689     2  0.1814     0.7227 0.000 0.900 0.000 0.000 0.100 0.000
#> GSM531691     2  0.4099     0.6083 0.024 0.696 0.000 0.008 0.272 0.000
#> GSM531692     5  0.7334     0.2070 0.212 0.188 0.108 0.008 0.476 0.008
#> GSM531694     2  0.1152     0.7358 0.000 0.952 0.000 0.004 0.044 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)
#> Error in mat[ceiling(1:nr/h_ratio), ceiling(1:nc/w_ratio), drop = FALSE]: subscript out of bounds

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 disease.state(p) k
#> ATC:NMF 79            1.000 2
#> ATC:NMF 76            0.257 3
#> ATC:NMF 70            0.670 4
#> ATC:NMF 45            0.894 5
#> ATC:NMF 34            0.742 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