cola Report for GDS4471

Date: 2019-12-25 21:37:39 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 76 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    76

Density distribution

The density distribution for each sample is visualized as in one column in the following heatmap. The clustering is based on the distance which is the Kolmogorov-Smirnov statistic between two distributions.

library(ComplexHeatmap)
densityHeatmap(mat, top_annotation = HeatmapAnnotation(df = get_anno(res_list), 
    col = get_anno_col(res_list)), ylab = "value", cluster_columns = TRUE, show_column_names = FALSE,
    mc.cores = 4)

plot of chunk density-heatmap

Suggest the best k

Folowing table shows the best k (number of partitions) for each combination of top-value methods and partition methods. Clicking on the method name in the table goes to the section for a single combination of methods.

The cola vignette explains the definition of the metrics used for determining the best number of partitions.

suggest_best_k(res_list)
The best k 1-PAC Mean silhouette Concordance Optional k
SD:hclust 2 1.000 0.973 0.984 **
SD:skmeans 3 1.000 0.966 0.986 ** 2
CV:hclust 3 1.000 0.943 0.976 ** 2
CV:skmeans 3 1.000 0.976 0.991 ** 2
ATC:kmeans 2 1.000 0.995 0.997 **
SD:NMF 4 0.953 0.913 0.967 ** 3
CV:NMF 4 0.949 0.910 0.968 * 2,3
MAD:skmeans 3 0.945 0.957 0.981 * 2
SD:mclust 6 0.941 0.935 0.960 * 2
CV:pam 4 0.940 0.909 0.965 *
MAD:pam 6 0.936 0.886 0.950 *
CV:mclust 6 0.927 0.906 0.948 * 2
MAD:NMF 4 0.921 0.915 0.961 * 2,3
ATC:NMF 2 0.921 0.952 0.978 *
ATC:pam 5 0.917 0.914 0.951 * 2
MAD:mclust 5 0.912 0.903 0.960 *
ATC:skmeans 4 0.903 0.939 0.968 * 2,3
ATC:mclust 5 0.903 0.892 0.941 *
SD:pam 4 0.877 0.857 0.948
ATC:hclust 2 0.805 0.947 0.969
MAD:hclust 3 0.775 0.926 0.920
CV:kmeans 4 0.721 0.791 0.830
MAD:kmeans 2 0.679 0.870 0.858
SD:kmeans 3 0.520 0.786 0.845

**: 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.816           0.890       0.955          0.481 0.511   0.511
#> CV:NMF      2 0.919           0.954       0.978          0.463 0.536   0.536
#> MAD:NMF     2 1.000           0.981       0.992          0.505 0.496   0.496
#> ATC:NMF     2 0.921           0.952       0.978          0.417 0.583   0.583
#> SD:skmeans  2 1.000           0.985       0.995          0.506 0.495   0.495
#> CV:skmeans  2 1.000           0.980       0.993          0.506 0.494   0.494
#> MAD:skmeans 2 1.000           0.977       0.991          0.506 0.495   0.495
#> ATC:skmeans 2 0.972           0.955       0.981          0.499 0.499   0.499
#> SD:mclust   2 1.000           0.986       0.992          0.397 0.595   0.595
#> CV:mclust   2 1.000           0.981       0.985          0.389 0.595   0.595
#> MAD:mclust  2 0.763           0.971       0.973          0.373 0.595   0.595
#> ATC:mclust  2 0.226           0.665       0.782          0.424 0.595   0.595
#> SD:kmeans   2 0.675           0.391       0.749          0.441 0.788   0.788
#> CV:kmeans   2 0.447           0.755       0.786          0.429 0.595   0.595
#> MAD:kmeans  2 0.679           0.870       0.858          0.471 0.495   0.495
#> ATC:kmeans  2 1.000           0.995       0.997          0.404 0.595   0.595
#> SD:pam      2 0.592           0.895       0.931          0.401 0.620   0.620
#> CV:pam      2 0.572           0.790       0.885          0.414 0.607   0.607
#> MAD:pam     2 0.491           0.807       0.886          0.433 0.583   0.583
#> ATC:pam     2 1.000           0.981       0.992          0.416 0.583   0.583
#> SD:hclust   2 1.000           0.973       0.984          0.393 0.607   0.607
#> CV:hclust   2 1.000           0.957       0.978          0.387 0.607   0.607
#> MAD:hclust  2 0.597           0.761       0.880          0.451 0.495   0.495
#> ATC:hclust  2 0.805           0.947       0.969          0.388 0.595   0.595
get_stats(res_list, k = 3)
#>             k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> SD:NMF      3 0.942           0.894       0.962          0.384 0.735   0.523
#> CV:NMF      3 0.960           0.922       0.968          0.441 0.705   0.492
#> MAD:NMF     3 0.960           0.900       0.963          0.318 0.752   0.541
#> ATC:NMF     3 0.769           0.883       0.945          0.479 0.730   0.560
#> SD:skmeans  3 1.000           0.966       0.986          0.322 0.720   0.493
#> CV:skmeans  3 1.000           0.976       0.991          0.324 0.724   0.498
#> MAD:skmeans 3 0.945           0.957       0.981          0.318 0.732   0.510
#> ATC:skmeans 3 1.000           0.974       0.990          0.320 0.772   0.575
#> SD:mclust   3 0.963           0.896       0.849          0.165 1.000   1.000
#> CV:mclust   3 0.711           0.923       0.918          0.247 0.961   0.935
#> MAD:mclust  3 0.728           0.783       0.908          0.455 0.765   0.629
#> ATC:mclust  3 0.702           0.895       0.893          0.539 0.508   0.312
#> SD:kmeans   3 0.520           0.786       0.845          0.383 0.491   0.383
#> CV:kmeans   3 0.490           0.723       0.823          0.411 0.746   0.578
#> MAD:kmeans  3 0.520           0.778       0.851          0.334 0.782   0.588
#> ATC:kmeans  3 0.846           0.937       0.957          0.612 0.708   0.527
#> SD:pam      3 0.634           0.889       0.926          0.125 0.969   0.950
#> CV:pam      3 0.627           0.787       0.864          0.189 0.943   0.909
#> MAD:pam     3 0.609           0.824       0.901          0.445 0.701   0.519
#> ATC:pam     3 0.715           0.804       0.919          0.568 0.680   0.485
#> SD:hclust   3 0.602           0.566       0.664          0.381 0.728   0.552
#> CV:hclust   3 1.000           0.943       0.976          0.128 0.966   0.945
#> MAD:hclust  3 0.775           0.926       0.920          0.377 0.871   0.741
#> ATC:hclust  3 0.687           0.867       0.918          0.248 0.962   0.936
get_stats(res_list, k = 4)
#>             k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> SD:NMF      4 0.953           0.913       0.967         0.0613 0.924   0.785
#> CV:NMF      4 0.949           0.910       0.968         0.0590 0.924   0.783
#> MAD:NMF     4 0.921           0.915       0.961         0.0651 0.942   0.833
#> ATC:NMF     4 0.567           0.662       0.808         0.1900 0.759   0.448
#> SD:skmeans  4 0.774           0.871       0.853         0.0738 0.961   0.883
#> CV:skmeans  4 0.875           0.905       0.923         0.0689 0.961   0.883
#> MAD:skmeans 4 0.754           0.816       0.857         0.1158 0.890   0.683
#> ATC:skmeans 4 0.903           0.939       0.968         0.1496 0.851   0.597
#> SD:mclust   4 0.797           0.879       0.934         0.4679 0.659   0.457
#> CV:mclust   4 0.791           0.916       0.955         0.4001 0.696   0.485
#> MAD:mclust  4 0.814           0.781       0.912         0.2505 0.711   0.443
#> ATC:mclust  4 0.738           0.833       0.890         0.1272 0.833   0.571
#> SD:kmeans   4 0.707           0.639       0.782         0.1674 0.862   0.643
#> CV:kmeans   4 0.721           0.791       0.830         0.1746 0.833   0.595
#> MAD:kmeans  4 0.698           0.631       0.754         0.1568 0.926   0.790
#> ATC:kmeans  4 0.694           0.695       0.763         0.1269 0.883   0.674
#> SD:pam      4 0.877           0.857       0.948         0.4535 0.735   0.557
#> CV:pam      4 0.940           0.909       0.965         0.3662 0.728   0.543
#> MAD:pam     4 0.848           0.889       0.951         0.0840 0.953   0.872
#> ATC:pam     4 0.805           0.919       0.939         0.1422 0.811   0.517
#> SD:hclust   4 0.725           0.841       0.914         0.2087 0.751   0.465
#> CV:hclust   4 0.771           0.901       0.945         0.5181 0.767   0.594
#> MAD:hclust  4 0.784           0.816       0.904         0.0484 0.987   0.965
#> ATC:hclust  4 0.611           0.700       0.830         0.4235 0.745   0.543
get_stats(res_list, k = 5)
#>             k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> SD:NMF      5 0.846           0.824       0.907         0.0640 0.938   0.801
#> CV:NMF      5 0.831           0.809       0.896         0.0706 0.936   0.795
#> MAD:NMF     5 0.835           0.807       0.901         0.0703 0.904   0.703
#> ATC:NMF     5 0.561           0.570       0.748         0.0697 0.880   0.587
#> SD:skmeans  5 0.858           0.848       0.900         0.1022 0.895   0.656
#> CV:skmeans  5 0.835           0.823       0.884         0.1062 0.888   0.637
#> MAD:skmeans 5 0.804           0.835       0.880         0.0626 0.948   0.799
#> ATC:skmeans 5 0.801           0.797       0.875         0.0542 0.958   0.828
#> SD:mclust   5 0.877           0.855       0.938         0.1542 0.843   0.543
#> CV:mclust   5 0.875           0.855       0.934         0.1504 0.859   0.585
#> MAD:mclust  5 0.912           0.903       0.960         0.1544 0.862   0.584
#> ATC:mclust  5 0.903           0.892       0.941         0.0467 0.928   0.748
#> SD:kmeans   5 0.701           0.796       0.834         0.0885 0.898   0.660
#> CV:kmeans   5 0.689           0.790       0.820         0.0908 0.888   0.647
#> MAD:kmeans  5 0.705           0.735       0.736         0.0781 0.871   0.589
#> ATC:kmeans  5 0.722           0.630       0.754         0.0634 0.948   0.802
#> SD:pam      5 0.869           0.839       0.937         0.2016 0.855   0.585
#> CV:pam      5 0.873           0.821       0.935         0.1768 0.876   0.626
#> MAD:pam     5 0.890           0.866       0.948         0.1607 0.888   0.653
#> ATC:pam     5 0.917           0.914       0.951         0.0756 0.856   0.519
#> SD:hclust   5 0.728           0.839       0.920         0.0150 0.993   0.980
#> CV:hclust   5 0.756           0.886       0.948         0.0147 0.993   0.979
#> MAD:hclust  5 0.745           0.836       0.885         0.0737 0.965   0.904
#> ATC:hclust  5 0.644           0.694       0.775         0.0971 0.904   0.686
get_stats(res_list, k = 6)
#>             k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> SD:NMF      6 0.764           0.508       0.786         0.0618 0.908   0.680
#> CV:NMF      6 0.775           0.516       0.769         0.0668 0.951   0.822
#> MAD:NMF     6 0.739           0.664       0.808         0.0639 0.889   0.604
#> ATC:NMF     6 0.626           0.608       0.748         0.0391 0.920   0.656
#> SD:skmeans  6 0.842           0.716       0.854         0.0530 0.949   0.764
#> CV:skmeans  6 0.825           0.747       0.838         0.0520 0.931   0.687
#> MAD:skmeans 6 0.829           0.709       0.833         0.0521 0.938   0.718
#> ATC:skmeans 6 0.786           0.656       0.798         0.0286 0.984   0.922
#> SD:mclust   6 0.941           0.935       0.960         0.0218 0.975   0.885
#> CV:mclust   6 0.927           0.906       0.948         0.0232 0.928   0.710
#> MAD:mclust  6 0.890           0.835       0.889         0.0390 0.991   0.959
#> ATC:mclust  6 0.739           0.667       0.794         0.0371 0.902   0.638
#> SD:kmeans   6 0.734           0.664       0.757         0.0529 0.949   0.772
#> CV:kmeans   6 0.725           0.666       0.754         0.0514 0.956   0.799
#> MAD:kmeans  6 0.750           0.758       0.790         0.0481 0.933   0.696
#> ATC:kmeans  6 0.760           0.593       0.744         0.0472 0.924   0.671
#> SD:pam      6 0.851           0.826       0.899         0.0427 0.942   0.741
#> CV:pam      6 0.854           0.840       0.914         0.0361 0.916   0.645
#> MAD:pam     6 0.936           0.886       0.950         0.0390 0.968   0.851
#> ATC:pam     6 0.817           0.841       0.912         0.0246 0.984   0.920
#> SD:hclust   6 0.744           0.801       0.870         0.1462 0.839   0.545
#> CV:hclust   6 0.737           0.833       0.894         0.0618 0.994   0.981
#> MAD:hclust  6 0.703           0.732       0.835         0.1196 0.867   0.603
#> ATC:hclust  6 0.735           0.678       0.824         0.0437 0.962   0.834

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) gender(p) other(p) k
#> SD:NMF      70         1.29e-11   0.03373 1.42e-03 2
#> CV:NMF      76         1.45e-11   0.01330 7.91e-04 2
#> MAD:NMF     75         1.71e-12   0.25623 8.49e-03 2
#> ATC:NMF     75         1.76e-03   1.00000 2.64e-01 2
#> SD:skmeans  75         3.63e-13   0.32471 1.26e-02 2
#> CV:skmeans  75         3.63e-13   0.32471 1.26e-02 2
#> MAD:skmeans 75         3.63e-13   0.32471 9.47e-03 2
#> ATC:skmeans 75         1.60e-08   0.11873 1.54e-01 2
#> SD:mclust   76         5.75e-15   0.00217 2.46e-05 2
#> CV:mclust   76         5.75e-15   0.00217 2.46e-05 2
#> MAD:mclust  76         5.75e-15   0.00217 2.46e-05 2
#> ATC:mclust  71         6.53e-04   1.00000 1.97e-01 2
#> SD:kmeans   49         1.30e-10   0.02800 4.25e-02 2
#> CV:kmeans   62         4.69e-12   0.01286 4.35e-04 2
#> MAD:kmeans  76         1.08e-12   0.29229 1.07e-02 2
#> ATC:kmeans  76         2.23e-03   1.00000 2.80e-01 2
#> SD:pam      74         1.22e-14   0.00830 3.93e-04 2
#> CV:pam      75         7.22e-15   0.00407 5.80e-04 2
#> MAD:pam     74         1.11e-13   0.00911 1.53e-03 2
#> ATC:pam     75         2.70e-03   1.00000 2.64e-01 2
#> SD:hclust   75         9.30e-15   0.00438 6.98e-05 2
#> CV:hclust   74         3.24e-15   0.00257 5.71e-05 2
#> MAD:hclust  60         1.22e-11   0.01852 6.49e-04 2
#> ATC:hclust  76         2.23e-03   1.00000 2.80e-01 2
test_to_known_factors(res_list, k = 3)
#>              n disease.state(p) gender(p) other(p) k
#> SD:NMF      71         1.04e-19   0.00195 2.19e-04 3
#> CV:NMF      71         1.04e-19   0.00195 2.19e-04 3
#> MAD:NMF     71         1.04e-19   0.00195 2.19e-04 3
#> ATC:NMF     74         6.43e-10   0.00381 1.25e-04 3
#> SD:skmeans  74         5.75e-19   0.00253 1.36e-04 3
#> CV:skmeans  75         8.46e-19   0.00431 1.40e-04 3
#> MAD:skmeans 74         5.75e-19   0.00253 1.36e-04 3
#> ATC:skmeans 75         1.19e-09   0.39366 1.47e-01 3
#> SD:mclust   76         5.75e-15   0.00217 2.46e-05 3
#> CV:mclust   76         1.44e-27   0.00170 5.39e-10 3
#> MAD:mclust  69         2.40e-21   0.09627 1.44e-05 3
#> ATC:mclust  76         5.67e-20   0.03015 3.05e-04 3
#> SD:kmeans   67         1.55e-20   0.00288 2.18e-04 3
#> CV:kmeans   65         7.55e-22   0.00134 5.91e-04 3
#> MAD:kmeans  68         5.32e-21   0.00234 2.71e-04 3
#> ATC:kmeans  76         5.18e-10   0.27334 1.80e-01 3
#> SD:pam      75         3.73e-27   0.00160 2.19e-05 3
#> CV:pam      75         1.39e-27   0.00252 1.42e-06 3
#> MAD:pam     72         5.72e-21   0.07423 8.21e-06 3
#> ATC:pam     68         3.39e-08   0.06773 9.83e-02 3
#> SD:hclust   59         2.45e-19   0.00218 6.15e-04 3
#> CV:hclust   74         5.12e-28   0.00154 3.01e-08 3
#> MAD:hclust  76         6.17e-25   0.00168 2.56e-05 3
#> ATC:hclust  73         7.85e-03   0.97513 2.46e-01 3
test_to_known_factors(res_list, k = 4)
#>              n disease.state(p) gender(p) other(p) k
#> SD:NMF      72         3.59e-31  0.003893 9.05e-07 4
#> CV:NMF      71         2.09e-32  0.001753 5.83e-08 4
#> MAD:NMF     74         1.07e-31  0.011120 3.15e-07 4
#> ATC:NMF     61         7.66e-16  0.026000 4.45e-05 4
#> SD:skmeans  74         3.99e-31  0.006025 4.43e-07 4
#> CV:skmeans  73         2.25e-32  0.002757 2.61e-08 4
#> MAD:skmeans 73         3.86e-21  0.004571 5.66e-04 4
#> ATC:skmeans 76         4.89e-13  0.010451 2.33e-02 4
#> SD:mclust   75         8.43e-30  0.004601 2.84e-05 4
#> CV:mclust   76         5.65e-30  0.003995 2.83e-05 4
#> MAD:mclust  62         3.21e-30  0.002863 2.00e-05 4
#> ATC:mclust  73         6.20e-19  0.084889 1.50e-03 4
#> SD:kmeans   55         2.51e-20  0.040245 1.42e-06 4
#> CV:kmeans   66         1.51e-32  0.001852 1.66e-07 4
#> MAD:kmeans  64         7.98e-19  0.005164 1.55e-03 4
#> ATC:kmeans  67         1.07e-16  0.000271 1.66e-02 4
#> SD:pam      69         4.21e-35  0.000272 3.65e-06 4
#> CV:pam      72         9.41e-36  0.001816 8.61e-08 4
#> MAD:pam     73         7.29e-37  0.002214 5.18e-07 4
#> ATC:pam     76         6.96e-17  0.000594 2.47e-02 4
#> SD:hclust   73         1.61e-35  0.004363 4.47e-08 4
#> CV:hclust   74         3.50e-38  0.002269 1.47e-08 4
#> MAD:hclust  71         1.26e-25  0.001103 4.26e-05 4
#> ATC:hclust  59         2.44e-06  0.134884 1.40e-01 4
test_to_known_factors(res_list, k = 5)
#>              n disease.state(p) gender(p) other(p) k
#> SD:NMF      71         5.59e-28  0.001646 2.16e-07 5
#> CV:NMF      71         5.59e-28  0.001646 2.16e-07 5
#> MAD:NMF     71         6.99e-28  0.001099 1.46e-07 5
#> ATC:NMF     52         1.43e-13  0.164315 4.00e-05 5
#> SD:skmeans  75         3.61e-34  0.010082 1.26e-06 5
#> CV:skmeans  73         2.19e-36  0.005257 1.22e-07 5
#> MAD:skmeans 72         1.31e-34  0.003726 1.93e-07 5
#> ATC:skmeans 74         2.01e-12  0.017262 3.06e-03 5
#> SD:mclust   71         2.34e-35  0.005079 2.76e-06 5
#> CV:mclust   69         2.28e-35  0.007499 3.22e-06 5
#> MAD:mclust  73         5.50e-32  0.016333 3.49e-05 5
#> ATC:mclust  75         7.27e-21  0.129842 2.23e-03 5
#> SD:kmeans   70         2.24e-31  0.006848 4.63e-06 5
#> CV:kmeans   73         3.40e-33  0.008027 6.19e-07 5
#> MAD:kmeans  69         7.51e-33  0.005482 4.55e-06 5
#> ATC:kmeans  57         1.60e-15  0.007483 4.33e-02 5
#> SD:pam      67         1.32e-28  0.001657 1.33e-05 5
#> CV:pam      68         5.87e-29  0.000721 3.99e-06 5
#> MAD:pam     71         2.76e-33  0.004275 8.65e-06 5
#> ATC:pam     76         4.99e-17  0.030566 4.67e-02 5
#> SD:hclust   73         1.93e-47  0.004374 1.13e-12 5
#> CV:hclust   73         1.30e-39  0.001717 7.96e-08 5
#> MAD:hclust  74         3.50e-38  0.004252 5.95e-08 5
#> ATC:hclust  70         5.61e-14  0.022922 1.96e-02 5
test_to_known_factors(res_list, k = 6)
#>              n disease.state(p) gender(p) other(p) k
#> SD:NMF      46         3.05e-17  0.042130 2.62e-05 6
#> CV:NMF      44         4.32e-16  0.055642 1.77e-05 6
#> MAD:NMF     63         4.98e-24  0.000347 2.92e-06 6
#> ATC:NMF     61         7.42e-26  0.020404 2.64e-05 6
#> SD:skmeans  60         1.73e-25  0.007060 2.23e-05 6
#> CV:skmeans  68         3.85e-30  0.004957 7.28e-06 6
#> MAD:skmeans 62         1.18e-26  0.007618 9.20e-06 6
#> ATC:skmeans 53         6.25e-22  0.146663 9.84e-09 6
#> SD:mclust   75         2.27e-45  0.008565 6.83e-13 6
#> CV:mclust   74         1.30e-44  0.008704 1.14e-12 6
#> MAD:mclust  73         5.50e-32  0.016333 3.49e-05 6
#> ATC:mclust  58         2.66e-15  0.032790 3.74e-03 6
#> SD:kmeans   54         4.16e-26  0.002294 6.80e-05 6
#> CV:kmeans   56         3.41e-25  0.013752 2.96e-04 6
#> MAD:kmeans  70         4.91e-34  0.004453 8.52e-06 6
#> ATC:kmeans  56         3.69e-11  0.042212 8.24e-02 6
#> SD:pam      69         4.81e-31  0.003206 5.02e-05 6
#> CV:pam      71         9.41e-30  0.005057 1.22e-05 6
#> MAD:pam     72         7.99e-33  0.006619 2.35e-05 6
#> ATC:pam     75         4.84e-20  0.066738 1.43e-03 6
#> SD:hclust   66         2.51e-38  0.009604 4.32e-10 6
#> CV:hclust   73         7.04e-50  0.006299 7.96e-20 6
#> MAD:hclust  68         3.15e-32  0.004120 9.21e-07 6
#> ATC:hclust  68         6.60e-18  0.022897 8.65e-04 6

Results for each method


SD:hclust**

The object with results only for a single top-value method and a single partition method can be extracted as:

res = res_list["SD", "hclust"]
# you can also extract it by
# res = res_list["SD:hclust"]

A summary of res and all the functions that can be applied to it:

res
#> A 'ConsensusPartition' object with k = 2, 3, 4, 5, 6.
#>   On a matrix with 51941 rows and 76 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 1.000           0.973       0.984          0.393 0.607   0.607
#> 3 3 0.602           0.566       0.664          0.381 0.728   0.552
#> 4 4 0.725           0.841       0.914          0.209 0.751   0.465
#> 5 5 0.728           0.839       0.920          0.015 0.993   0.980
#> 6 6 0.744           0.801       0.870          0.146 0.839   0.545

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
#> GSM918603     1  0.2948      0.966 0.948 0.052
#> GSM918641     1  0.2423      0.971 0.960 0.040
#> GSM918580     1  0.0000      0.974 1.000 0.000
#> GSM918593     1  0.2948      0.966 0.948 0.052
#> GSM918625     1  0.2948      0.966 0.948 0.052
#> GSM918638     1  0.2948      0.966 0.948 0.052
#> GSM918642     1  0.2948      0.966 0.948 0.052
#> GSM918643     1  0.2948      0.966 0.948 0.052
#> GSM918619     1  0.0672      0.979 0.992 0.008
#> GSM918621     1  0.0672      0.979 0.992 0.008
#> GSM918582     1  0.0672      0.979 0.992 0.008
#> GSM918649     1  0.0672      0.979 0.992 0.008
#> GSM918651     1  0.0672      0.979 0.992 0.008
#> GSM918607     1  0.0672      0.979 0.992 0.008
#> GSM918609     1  0.0672      0.979 0.992 0.008
#> GSM918608     1  0.0672      0.979 0.992 0.008
#> GSM918606     1  0.0672      0.979 0.992 0.008
#> GSM918620     1  0.0672      0.979 0.992 0.008
#> GSM918628     1  0.0376      0.977 0.996 0.004
#> GSM918586     2  0.1184      0.980 0.016 0.984
#> GSM918594     2  0.1184      0.980 0.016 0.984
#> GSM918600     2  0.1184      0.980 0.016 0.984
#> GSM918601     2  0.1184      0.980 0.016 0.984
#> GSM918612     2  0.1184      0.980 0.016 0.984
#> GSM918614     2  0.1184      0.980 0.016 0.984
#> GSM918629     2  0.1184      0.980 0.016 0.984
#> GSM918587     2  0.3431      0.928 0.064 0.936
#> GSM918588     2  0.1184      0.980 0.016 0.984
#> GSM918589     2  0.1184      0.980 0.016 0.984
#> GSM918611     2  0.1414      0.977 0.020 0.980
#> GSM918624     2  0.1184      0.980 0.016 0.984
#> GSM918637     2  0.1184      0.980 0.016 0.984
#> GSM918639     2  0.1184      0.980 0.016 0.984
#> GSM918640     2  0.1184      0.980 0.016 0.984
#> GSM918636     2  0.1184      0.980 0.016 0.984
#> GSM918590     2  0.0000      0.986 0.000 1.000
#> GSM918610     2  0.0000      0.986 0.000 1.000
#> GSM918615     2  0.0000      0.986 0.000 1.000
#> GSM918616     2  0.0000      0.986 0.000 1.000
#> GSM918632     2  0.0376      0.985 0.004 0.996
#> GSM918647     2  0.0376      0.985 0.004 0.996
#> GSM918578     2  0.0000      0.986 0.000 1.000
#> GSM918579     2  0.0376      0.985 0.004 0.996
#> GSM918581     2  0.0376      0.985 0.004 0.996
#> GSM918584     2  0.0000      0.986 0.000 1.000
#> GSM918591     2  0.0000      0.986 0.000 1.000
#> GSM918592     2  0.0000      0.986 0.000 1.000
#> GSM918597     2  0.0000      0.986 0.000 1.000
#> GSM918598     2  0.0000      0.986 0.000 1.000
#> GSM918599     2  0.0000      0.986 0.000 1.000
#> GSM918604     2  0.1184      0.980 0.016 0.984
#> GSM918605     2  0.0000      0.986 0.000 1.000
#> GSM918613     2  0.0000      0.986 0.000 1.000
#> GSM918623     2  0.0376      0.985 0.004 0.996
#> GSM918626     2  0.0000      0.986 0.000 1.000
#> GSM918627     2  0.0000      0.986 0.000 1.000
#> GSM918633     2  0.0000      0.986 0.000 1.000
#> GSM918634     2  0.0000      0.986 0.000 1.000
#> GSM918635     2  0.0376      0.985 0.004 0.996
#> GSM918645     2  0.0000      0.986 0.000 1.000
#> GSM918646     2  0.0376      0.985 0.004 0.996
#> GSM918648     2  0.0376      0.985 0.004 0.996
#> GSM918650     2  0.0000      0.986 0.000 1.000
#> GSM918652     2  0.0000      0.986 0.000 1.000
#> GSM918653     2  0.0376      0.985 0.004 0.996
#> GSM918622     2  0.0000      0.986 0.000 1.000
#> GSM918583     2  0.0000      0.986 0.000 1.000
#> GSM918585     2  0.0376      0.985 0.004 0.996
#> GSM918595     2  0.0000      0.986 0.000 1.000
#> GSM918596     2  0.0000      0.986 0.000 1.000
#> GSM918602     2  0.0000      0.986 0.000 1.000
#> GSM918617     2  0.0000      0.986 0.000 1.000
#> GSM918630     2  0.0000      0.986 0.000 1.000
#> GSM918631     2  0.0376      0.985 0.004 0.996
#> GSM918618     1  0.3584      0.947 0.932 0.068
#> GSM918644     2  0.9393      0.434 0.356 0.644

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>           class entropy silhouette    p1    p2    p3
#> GSM918603     1  0.1753      0.795 0.952 0.000 0.048
#> GSM918641     1  0.1411      0.798 0.964 0.000 0.036
#> GSM918580     1  0.0747      0.802 0.984 0.016 0.000
#> GSM918593     1  0.1753      0.795 0.952 0.000 0.048
#> GSM918625     1  0.1753      0.795 0.952 0.000 0.048
#> GSM918638     1  0.1753      0.795 0.952 0.000 0.048
#> GSM918642     1  0.1753      0.795 0.952 0.000 0.048
#> GSM918643     1  0.1753      0.795 0.952 0.000 0.048
#> GSM918619     1  0.6168      0.868 0.588 0.412 0.000
#> GSM918621     1  0.6168      0.868 0.588 0.412 0.000
#> GSM918582     1  0.6168      0.868 0.588 0.412 0.000
#> GSM918649     1  0.6168      0.868 0.588 0.412 0.000
#> GSM918651     1  0.6168      0.868 0.588 0.412 0.000
#> GSM918607     1  0.6168      0.868 0.588 0.412 0.000
#> GSM918609     1  0.6168      0.868 0.588 0.412 0.000
#> GSM918608     1  0.6168      0.868 0.588 0.412 0.000
#> GSM918606     1  0.6168      0.868 0.588 0.412 0.000
#> GSM918620     1  0.6168      0.868 0.588 0.412 0.000
#> GSM918628     1  0.6215      0.863 0.572 0.428 0.000
#> GSM918586     3  0.0000      0.557 0.000 0.000 1.000
#> GSM918594     3  0.0000      0.557 0.000 0.000 1.000
#> GSM918600     3  0.0000      0.557 0.000 0.000 1.000
#> GSM918601     3  0.0000      0.557 0.000 0.000 1.000
#> GSM918612     3  0.0000      0.557 0.000 0.000 1.000
#> GSM918614     3  0.0000      0.557 0.000 0.000 1.000
#> GSM918629     3  0.2537      0.503 0.000 0.080 0.920
#> GSM918587     3  0.7091     -0.221 0.024 0.416 0.560
#> GSM918588     3  0.0000      0.557 0.000 0.000 1.000
#> GSM918589     3  0.4121      0.405 0.000 0.168 0.832
#> GSM918611     3  0.4682      0.368 0.004 0.192 0.804
#> GSM918624     3  0.0000      0.557 0.000 0.000 1.000
#> GSM918637     3  0.0000      0.557 0.000 0.000 1.000
#> GSM918639     3  0.0000      0.557 0.000 0.000 1.000
#> GSM918640     3  0.0000      0.557 0.000 0.000 1.000
#> GSM918636     3  0.0237      0.555 0.000 0.004 0.996
#> GSM918590     2  0.6291      0.852 0.000 0.532 0.468
#> GSM918610     2  0.6204      0.974 0.000 0.576 0.424
#> GSM918615     2  0.6204      0.974 0.000 0.576 0.424
#> GSM918616     3  0.6111     -0.324 0.000 0.396 0.604
#> GSM918632     2  0.6192      0.972 0.000 0.580 0.420
#> GSM918647     2  0.6192      0.972 0.000 0.580 0.420
#> GSM918578     2  0.6204      0.974 0.000 0.576 0.424
#> GSM918579     2  0.6192      0.972 0.000 0.580 0.420
#> GSM918581     2  0.6192      0.972 0.000 0.580 0.420
#> GSM918584     2  0.6204      0.974 0.000 0.576 0.424
#> GSM918591     2  0.6204      0.974 0.000 0.576 0.424
#> GSM918592     2  0.6204      0.974 0.000 0.576 0.424
#> GSM918597     3  0.6244     -0.466 0.000 0.440 0.560
#> GSM918598     2  0.6204      0.974 0.000 0.576 0.424
#> GSM918599     3  0.6244     -0.468 0.000 0.440 0.560
#> GSM918604     3  0.0237      0.555 0.000 0.004 0.996
#> GSM918605     3  0.6260     -0.497 0.000 0.448 0.552
#> GSM918613     2  0.6204      0.974 0.000 0.576 0.424
#> GSM918623     2  0.6192      0.972 0.000 0.580 0.420
#> GSM918626     3  0.6225     -0.439 0.000 0.432 0.568
#> GSM918627     3  0.6244     -0.466 0.000 0.440 0.560
#> GSM918633     2  0.6204      0.974 0.000 0.576 0.424
#> GSM918634     2  0.6291      0.852 0.000 0.532 0.468
#> GSM918635     2  0.6192      0.972 0.000 0.580 0.420
#> GSM918645     3  0.6274     -0.538 0.000 0.456 0.544
#> GSM918646     2  0.6309      0.735 0.000 0.504 0.496
#> GSM918648     2  0.6192      0.972 0.000 0.580 0.420
#> GSM918650     2  0.6204      0.974 0.000 0.576 0.424
#> GSM918652     3  0.6260     -0.497 0.000 0.448 0.552
#> GSM918653     2  0.6192      0.972 0.000 0.580 0.420
#> GSM918622     3  0.6244     -0.466 0.000 0.440 0.560
#> GSM918583     2  0.6204      0.974 0.000 0.576 0.424
#> GSM918585     2  0.6192      0.972 0.000 0.580 0.420
#> GSM918595     2  0.6204      0.974 0.000 0.576 0.424
#> GSM918596     3  0.6260     -0.497 0.000 0.448 0.552
#> GSM918602     3  0.6111     -0.324 0.000 0.396 0.604
#> GSM918617     3  0.6260     -0.497 0.000 0.448 0.552
#> GSM918630     3  0.6274     -0.537 0.000 0.456 0.544
#> GSM918631     2  0.6192      0.972 0.000 0.580 0.420
#> GSM918618     1  0.7839      0.841 0.560 0.380 0.060
#> GSM918644     3  0.9176      0.143 0.344 0.160 0.496

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM918603     4  0.2002     0.9890 0.020 0.000 0.044 0.936
#> GSM918641     4  0.1724     0.9810 0.020 0.000 0.032 0.948
#> GSM918580     4  0.0376     0.9369 0.004 0.004 0.000 0.992
#> GSM918593     4  0.2002     0.9890 0.020 0.000 0.044 0.936
#> GSM918625     4  0.2002     0.9890 0.020 0.000 0.044 0.936
#> GSM918638     4  0.2002     0.9890 0.020 0.000 0.044 0.936
#> GSM918642     4  0.2002     0.9890 0.020 0.000 0.044 0.936
#> GSM918643     4  0.2002     0.9890 0.020 0.000 0.044 0.936
#> GSM918619     1  0.0000     0.9813 1.000 0.000 0.000 0.000
#> GSM918621     1  0.0000     0.9813 1.000 0.000 0.000 0.000
#> GSM918582     1  0.0000     0.9813 1.000 0.000 0.000 0.000
#> GSM918649     1  0.0000     0.9813 1.000 0.000 0.000 0.000
#> GSM918651     1  0.0000     0.9813 1.000 0.000 0.000 0.000
#> GSM918607     1  0.0000     0.9813 1.000 0.000 0.000 0.000
#> GSM918609     1  0.0000     0.9813 1.000 0.000 0.000 0.000
#> GSM918608     1  0.0000     0.9813 1.000 0.000 0.000 0.000
#> GSM918606     1  0.0000     0.9813 1.000 0.000 0.000 0.000
#> GSM918620     1  0.0000     0.9813 1.000 0.000 0.000 0.000
#> GSM918628     1  0.1902     0.9363 0.932 0.004 0.000 0.064
#> GSM918586     3  0.0000     0.8951 0.000 0.000 1.000 0.000
#> GSM918594     3  0.0000     0.8951 0.000 0.000 1.000 0.000
#> GSM918600     3  0.0000     0.8951 0.000 0.000 1.000 0.000
#> GSM918601     3  0.0000     0.8951 0.000 0.000 1.000 0.000
#> GSM918612     3  0.0000     0.8951 0.000 0.000 1.000 0.000
#> GSM918614     3  0.0000     0.8951 0.000 0.000 1.000 0.000
#> GSM918629     3  0.3074     0.7323 0.000 0.152 0.848 0.000
#> GSM918587     2  0.6223     0.6501 0.048 0.648 0.284 0.020
#> GSM918588     3  0.0000     0.8951 0.000 0.000 1.000 0.000
#> GSM918589     3  0.4817     0.1934 0.000 0.388 0.612 0.000
#> GSM918611     3  0.5143    -0.0915 0.004 0.456 0.540 0.000
#> GSM918624     3  0.0000     0.8951 0.000 0.000 1.000 0.000
#> GSM918637     3  0.0000     0.8951 0.000 0.000 1.000 0.000
#> GSM918639     3  0.0000     0.8951 0.000 0.000 1.000 0.000
#> GSM918640     3  0.0000     0.8951 0.000 0.000 1.000 0.000
#> GSM918636     3  0.0188     0.8921 0.000 0.004 0.996 0.000
#> GSM918590     2  0.2868     0.8276 0.000 0.864 0.136 0.000
#> GSM918610     2  0.0336     0.8627 0.000 0.992 0.008 0.000
#> GSM918615     2  0.0336     0.8627 0.000 0.992 0.008 0.000
#> GSM918616     2  0.4679     0.6214 0.000 0.648 0.352 0.000
#> GSM918632     2  0.0000     0.8603 0.000 1.000 0.000 0.000
#> GSM918647     2  0.0000     0.8603 0.000 1.000 0.000 0.000
#> GSM918578     2  0.0469     0.8628 0.000 0.988 0.012 0.000
#> GSM918579     2  0.0000     0.8603 0.000 1.000 0.000 0.000
#> GSM918581     2  0.0000     0.8603 0.000 1.000 0.000 0.000
#> GSM918584     2  0.0336     0.8627 0.000 0.992 0.008 0.000
#> GSM918591     2  0.0469     0.8628 0.000 0.988 0.012 0.000
#> GSM918592     2  0.0469     0.8628 0.000 0.988 0.012 0.000
#> GSM918597     2  0.4008     0.7689 0.000 0.756 0.244 0.000
#> GSM918598     2  0.0469     0.8628 0.000 0.988 0.012 0.000
#> GSM918599     2  0.4008     0.7688 0.000 0.756 0.244 0.000
#> GSM918604     3  0.0188     0.8920 0.000 0.004 0.996 0.000
#> GSM918605     2  0.3942     0.7756 0.000 0.764 0.236 0.000
#> GSM918613     2  0.0336     0.8627 0.000 0.992 0.008 0.000
#> GSM918623     2  0.0000     0.8603 0.000 1.000 0.000 0.000
#> GSM918626     2  0.4072     0.7605 0.000 0.748 0.252 0.000
#> GSM918627     2  0.4008     0.7689 0.000 0.756 0.244 0.000
#> GSM918633     2  0.0336     0.8627 0.000 0.992 0.008 0.000
#> GSM918634     2  0.2868     0.8276 0.000 0.864 0.136 0.000
#> GSM918635     2  0.0000     0.8603 0.000 1.000 0.000 0.000
#> GSM918645     2  0.3873     0.7814 0.000 0.772 0.228 0.000
#> GSM918646     2  0.3266     0.8114 0.000 0.832 0.168 0.000
#> GSM918648     2  0.0000     0.8603 0.000 1.000 0.000 0.000
#> GSM918650     2  0.0336     0.8627 0.000 0.992 0.008 0.000
#> GSM918652     2  0.3942     0.7756 0.000 0.764 0.236 0.000
#> GSM918653     2  0.0000     0.8603 0.000 1.000 0.000 0.000
#> GSM918622     2  0.4008     0.7689 0.000 0.756 0.244 0.000
#> GSM918583     2  0.0336     0.8627 0.000 0.992 0.008 0.000
#> GSM918585     2  0.0000     0.8603 0.000 1.000 0.000 0.000
#> GSM918595     2  0.0469     0.8628 0.000 0.988 0.012 0.000
#> GSM918596     2  0.3942     0.7756 0.000 0.764 0.236 0.000
#> GSM918602     2  0.4679     0.6214 0.000 0.648 0.352 0.000
#> GSM918617     2  0.3942     0.7756 0.000 0.764 0.236 0.000
#> GSM918630     2  0.3837     0.7834 0.000 0.776 0.224 0.000
#> GSM918631     2  0.0000     0.8603 0.000 1.000 0.000 0.000
#> GSM918618     1  0.3996     0.8361 0.836 0.000 0.060 0.104
#> GSM918644     2  0.8942     0.1955 0.292 0.412 0.232 0.064

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>           class entropy silhouette    p1    p2    p3    p4    p5
#> GSM918603     4  0.0000      0.988 0.000 0.000 0.000 1.000 0.000
#> GSM918641     4  0.0404      0.980 0.000 0.000 0.000 0.988 0.012
#> GSM918580     4  0.1608      0.926 0.000 0.000 0.000 0.928 0.072
#> GSM918593     4  0.0000      0.988 0.000 0.000 0.000 1.000 0.000
#> GSM918625     4  0.0000      0.988 0.000 0.000 0.000 1.000 0.000
#> GSM918638     4  0.0000      0.988 0.000 0.000 0.000 1.000 0.000
#> GSM918642     4  0.0000      0.988 0.000 0.000 0.000 1.000 0.000
#> GSM918643     4  0.0000      0.988 0.000 0.000 0.000 1.000 0.000
#> GSM918619     1  0.0000      1.000 1.000 0.000 0.000 0.000 0.000
#> GSM918621     1  0.0000      1.000 1.000 0.000 0.000 0.000 0.000
#> GSM918582     1  0.0000      1.000 1.000 0.000 0.000 0.000 0.000
#> GSM918649     1  0.0000      1.000 1.000 0.000 0.000 0.000 0.000
#> GSM918651     1  0.0000      1.000 1.000 0.000 0.000 0.000 0.000
#> GSM918607     1  0.0000      1.000 1.000 0.000 0.000 0.000 0.000
#> GSM918609     1  0.0000      1.000 1.000 0.000 0.000 0.000 0.000
#> GSM918608     1  0.0000      1.000 1.000 0.000 0.000 0.000 0.000
#> GSM918606     1  0.0000      1.000 1.000 0.000 0.000 0.000 0.000
#> GSM918620     1  0.0000      1.000 1.000 0.000 0.000 0.000 0.000
#> GSM918628     5  0.0162      0.878 0.004 0.000 0.000 0.000 0.996
#> GSM918586     3  0.0000      0.878 0.000 0.000 1.000 0.000 0.000
#> GSM918594     3  0.0000      0.878 0.000 0.000 1.000 0.000 0.000
#> GSM918600     3  0.0000      0.878 0.000 0.000 1.000 0.000 0.000
#> GSM918601     3  0.0000      0.878 0.000 0.000 1.000 0.000 0.000
#> GSM918612     3  0.0000      0.878 0.000 0.000 1.000 0.000 0.000
#> GSM918614     3  0.0000      0.878 0.000 0.000 1.000 0.000 0.000
#> GSM918629     3  0.2806      0.681 0.000 0.152 0.844 0.000 0.004
#> GSM918587     2  0.5295      0.654 0.000 0.648 0.280 0.008 0.064
#> GSM918588     3  0.0000      0.878 0.000 0.000 1.000 0.000 0.000
#> GSM918589     3  0.4449      0.182 0.000 0.388 0.604 0.004 0.004
#> GSM918611     3  0.4688     -0.104 0.000 0.456 0.532 0.008 0.004
#> GSM918624     3  0.0000      0.878 0.000 0.000 1.000 0.000 0.000
#> GSM918637     3  0.0000      0.878 0.000 0.000 1.000 0.000 0.000
#> GSM918639     3  0.0000      0.878 0.000 0.000 1.000 0.000 0.000
#> GSM918640     3  0.0000      0.878 0.000 0.000 1.000 0.000 0.000
#> GSM918636     3  0.0162      0.875 0.000 0.004 0.996 0.000 0.000
#> GSM918590     2  0.2471      0.829 0.000 0.864 0.136 0.000 0.000
#> GSM918610     2  0.0290      0.862 0.000 0.992 0.008 0.000 0.000
#> GSM918615     2  0.0290      0.862 0.000 0.992 0.008 0.000 0.000
#> GSM918616     2  0.4166      0.625 0.000 0.648 0.348 0.000 0.004
#> GSM918632     2  0.0000      0.859 0.000 1.000 0.000 0.000 0.000
#> GSM918647     2  0.0000      0.859 0.000 1.000 0.000 0.000 0.000
#> GSM918578     2  0.0404      0.862 0.000 0.988 0.012 0.000 0.000
#> GSM918579     2  0.0000      0.859 0.000 1.000 0.000 0.000 0.000
#> GSM918581     2  0.0000      0.859 0.000 1.000 0.000 0.000 0.000
#> GSM918584     2  0.0290      0.862 0.000 0.992 0.008 0.000 0.000
#> GSM918591     2  0.0404      0.862 0.000 0.988 0.012 0.000 0.000
#> GSM918592     2  0.0404      0.862 0.000 0.988 0.012 0.000 0.000
#> GSM918597     2  0.3579      0.771 0.000 0.756 0.240 0.000 0.004
#> GSM918598     2  0.0404      0.862 0.000 0.988 0.012 0.000 0.000
#> GSM918599     2  0.3579      0.771 0.000 0.756 0.240 0.000 0.004
#> GSM918604     3  0.0162      0.875 0.000 0.004 0.996 0.000 0.000
#> GSM918605     2  0.3521      0.778 0.000 0.764 0.232 0.000 0.004
#> GSM918613     2  0.0290      0.862 0.000 0.992 0.008 0.000 0.000
#> GSM918623     2  0.0000      0.859 0.000 1.000 0.000 0.000 0.000
#> GSM918626     2  0.3635      0.763 0.000 0.748 0.248 0.000 0.004
#> GSM918627     2  0.3579      0.771 0.000 0.756 0.240 0.000 0.004
#> GSM918633     2  0.0290      0.862 0.000 0.992 0.008 0.000 0.000
#> GSM918634     2  0.2471      0.829 0.000 0.864 0.136 0.000 0.000
#> GSM918635     2  0.0000      0.859 0.000 1.000 0.000 0.000 0.000
#> GSM918645     2  0.3461      0.784 0.000 0.772 0.224 0.000 0.004
#> GSM918646     2  0.2813      0.813 0.000 0.832 0.168 0.000 0.000
#> GSM918648     2  0.0000      0.859 0.000 1.000 0.000 0.000 0.000
#> GSM918650     2  0.0290      0.862 0.000 0.992 0.008 0.000 0.000
#> GSM918652     2  0.3521      0.778 0.000 0.764 0.232 0.000 0.004
#> GSM918653     2  0.0000      0.859 0.000 1.000 0.000 0.000 0.000
#> GSM918622     2  0.3579      0.771 0.000 0.756 0.240 0.000 0.004
#> GSM918583     2  0.0290      0.862 0.000 0.992 0.008 0.000 0.000
#> GSM918585     2  0.0000      0.859 0.000 1.000 0.000 0.000 0.000
#> GSM918595     2  0.0404      0.862 0.000 0.988 0.012 0.000 0.000
#> GSM918596     2  0.3521      0.778 0.000 0.764 0.232 0.000 0.004
#> GSM918602     2  0.4166      0.625 0.000 0.648 0.348 0.000 0.004
#> GSM918617     2  0.3521      0.778 0.000 0.764 0.232 0.000 0.004
#> GSM918630     2  0.3430      0.786 0.000 0.776 0.220 0.000 0.004
#> GSM918631     2  0.0000      0.859 0.000 1.000 0.000 0.000 0.000
#> GSM918618     5  0.3133      0.870 0.004 0.000 0.052 0.080 0.864
#> GSM918644     2  0.7900      0.201 0.004 0.412 0.228 0.072 0.284

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>           class entropy silhouette p1    p2    p3    p4    p5    p6
#> GSM918603     4  0.0000      0.988  0 0.000 0.000 1.000 0.000 0.000
#> GSM918641     4  0.0363      0.981  0 0.000 0.000 0.988 0.000 0.012
#> GSM918580     4  0.1444      0.927  0 0.000 0.000 0.928 0.000 0.072
#> GSM918593     4  0.0000      0.988  0 0.000 0.000 1.000 0.000 0.000
#> GSM918625     4  0.0000      0.988  0 0.000 0.000 1.000 0.000 0.000
#> GSM918638     4  0.0000      0.988  0 0.000 0.000 1.000 0.000 0.000
#> GSM918642     4  0.0000      0.988  0 0.000 0.000 1.000 0.000 0.000
#> GSM918643     4  0.0000      0.988  0 0.000 0.000 1.000 0.000 0.000
#> GSM918619     1  0.0000      1.000  1 0.000 0.000 0.000 0.000 0.000
#> GSM918621     1  0.0000      1.000  1 0.000 0.000 0.000 0.000 0.000
#> GSM918582     1  0.0000      1.000  1 0.000 0.000 0.000 0.000 0.000
#> GSM918649     1  0.0000      1.000  1 0.000 0.000 0.000 0.000 0.000
#> GSM918651     1  0.0000      1.000  1 0.000 0.000 0.000 0.000 0.000
#> GSM918607     1  0.0000      1.000  1 0.000 0.000 0.000 0.000 0.000
#> GSM918609     1  0.0000      1.000  1 0.000 0.000 0.000 0.000 0.000
#> GSM918608     1  0.0000      1.000  1 0.000 0.000 0.000 0.000 0.000
#> GSM918606     1  0.0000      1.000  1 0.000 0.000 0.000 0.000 0.000
#> GSM918620     1  0.0000      1.000  1 0.000 0.000 0.000 0.000 0.000
#> GSM918628     6  0.0000      0.855  0 0.000 0.000 0.000 0.000 1.000
#> GSM918586     3  0.0260      0.963  0 0.000 0.992 0.000 0.008 0.000
#> GSM918594     3  0.0146      0.964  0 0.000 0.996 0.000 0.004 0.000
#> GSM918600     3  0.0000      0.965  0 0.000 1.000 0.000 0.000 0.000
#> GSM918601     3  0.0000      0.965  0 0.000 1.000 0.000 0.000 0.000
#> GSM918612     3  0.0632      0.949  0 0.000 0.976 0.000 0.024 0.000
#> GSM918614     3  0.0260      0.963  0 0.000 0.992 0.000 0.008 0.000
#> GSM918629     3  0.3588      0.639  0 0.044 0.776 0.000 0.180 0.000
#> GSM918587     5  0.5385      0.743  0 0.192 0.060 0.008 0.676 0.064
#> GSM918588     3  0.0000      0.965  0 0.000 1.000 0.000 0.000 0.000
#> GSM918589     5  0.3742      0.386  0 0.004 0.348 0.000 0.648 0.000
#> GSM918611     5  0.3405      0.503  0 0.004 0.272 0.000 0.724 0.000
#> GSM918624     3  0.0000      0.965  0 0.000 1.000 0.000 0.000 0.000
#> GSM918637     3  0.0000      0.965  0 0.000 1.000 0.000 0.000 0.000
#> GSM918639     3  0.0000      0.965  0 0.000 1.000 0.000 0.000 0.000
#> GSM918640     3  0.0000      0.965  0 0.000 1.000 0.000 0.000 0.000
#> GSM918636     3  0.0547      0.955  0 0.000 0.980 0.000 0.020 0.000
#> GSM918590     5  0.4179      0.223  0 0.472 0.012 0.000 0.516 0.000
#> GSM918610     2  0.1957      0.806  0 0.888 0.000 0.000 0.112 0.000
#> GSM918615     2  0.1957      0.806  0 0.888 0.000 0.000 0.112 0.000
#> GSM918616     5  0.4626      0.730  0 0.172 0.136 0.000 0.692 0.000
#> GSM918632     2  0.0260      0.795  0 0.992 0.000 0.000 0.008 0.000
#> GSM918647     2  0.1007      0.807  0 0.956 0.000 0.000 0.044 0.000
#> GSM918578     2  0.3789      0.312  0 0.584 0.000 0.000 0.416 0.000
#> GSM918579     2  0.0000      0.792  0 1.000 0.000 0.000 0.000 0.000
#> GSM918581     2  0.1610      0.799  0 0.916 0.000 0.000 0.084 0.000
#> GSM918584     2  0.1957      0.806  0 0.888 0.000 0.000 0.112 0.000
#> GSM918591     2  0.3789      0.312  0 0.584 0.000 0.000 0.416 0.000
#> GSM918592     2  0.3789      0.312  0 0.584 0.000 0.000 0.416 0.000
#> GSM918597     5  0.3374      0.804  0 0.208 0.020 0.000 0.772 0.000
#> GSM918598     2  0.3789      0.312  0 0.584 0.000 0.000 0.416 0.000
#> GSM918599     5  0.3141      0.803  0 0.200 0.012 0.000 0.788 0.000
#> GSM918604     3  0.0777      0.945  0 0.004 0.972 0.000 0.024 0.000
#> GSM918605     5  0.3201      0.802  0 0.208 0.012 0.000 0.780 0.000
#> GSM918613     2  0.1957      0.806  0 0.888 0.000 0.000 0.112 0.000
#> GSM918623     2  0.1610      0.799  0 0.916 0.000 0.000 0.084 0.000
#> GSM918626     5  0.3315      0.802  0 0.200 0.020 0.000 0.780 0.000
#> GSM918627     5  0.3374      0.804  0 0.208 0.020 0.000 0.772 0.000
#> GSM918633     2  0.1957      0.806  0 0.888 0.000 0.000 0.112 0.000
#> GSM918634     5  0.4179      0.223  0 0.472 0.012 0.000 0.516 0.000
#> GSM918635     2  0.1610      0.799  0 0.916 0.000 0.000 0.084 0.000
#> GSM918645     5  0.3259      0.797  0 0.216 0.012 0.000 0.772 0.000
#> GSM918646     5  0.4181      0.389  0 0.476 0.012 0.000 0.512 0.000
#> GSM918648     2  0.0146      0.793  0 0.996 0.000 0.000 0.004 0.000
#> GSM918650     2  0.1957      0.806  0 0.888 0.000 0.000 0.112 0.000
#> GSM918652     5  0.3201      0.802  0 0.208 0.012 0.000 0.780 0.000
#> GSM918653     2  0.0000      0.792  0 1.000 0.000 0.000 0.000 0.000
#> GSM918622     5  0.3374      0.804  0 0.208 0.020 0.000 0.772 0.000
#> GSM918583     2  0.2048      0.801  0 0.880 0.000 0.000 0.120 0.000
#> GSM918585     2  0.0000      0.792  0 1.000 0.000 0.000 0.000 0.000
#> GSM918595     2  0.3797      0.299  0 0.580 0.000 0.000 0.420 0.000
#> GSM918596     5  0.3201      0.802  0 0.208 0.012 0.000 0.780 0.000
#> GSM918602     5  0.4626      0.730  0 0.172 0.136 0.000 0.692 0.000
#> GSM918617     5  0.3230      0.802  0 0.212 0.012 0.000 0.776 0.000
#> GSM918630     5  0.3564      0.771  0 0.264 0.012 0.000 0.724 0.000
#> GSM918631     2  0.0260      0.791  0 0.992 0.000 0.000 0.008 0.000
#> GSM918618     6  0.3986      0.852  0 0.000 0.016 0.036 0.192 0.756
#> GSM918644     5  0.3880      0.333  0 0.000 0.024 0.028 0.772 0.176

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) gender(p) other(p) k
#> SD:hclust 75         9.30e-15   0.00438 6.98e-05 2
#> SD:hclust 59         2.45e-19   0.00218 6.15e-04 3
#> SD:hclust 73         1.61e-35   0.00436 4.47e-08 4
#> SD:hclust 73         1.93e-47   0.00437 1.13e-12 5
#> SD:hclust 66         2.51e-38   0.00960 4.32e-10 6

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


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 76 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 3.
#> 
#> Following methods can be applied to this 'ConsensusPartition' object:
#>  [1] "cola_report"             "collect_classes"         "collect_plots"          
#>  [4] "collect_stats"           "colnames"                "compare_signatures"     
#>  [7] "consensus_heatmap"       "dimension_reduction"     "functional_enrichment"  
#> [10] "get_anno_col"            "get_anno"                "get_classes"            
#> [13] "get_consensus"           "get_matrix"              "get_membership"         
#> [16] "get_param"               "get_signatures"          "get_stats"              
#> [19] "is_best_k"               "is_stable_k"             "membership_heatmap"     
#> [22] "ncol"                    "nrow"                    "plot_ecdf"              
#> [25] "rownames"                "select_partition_number" "show"                   
#> [28] "suggest_best_k"          "test_to_known_factors"

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

collect_plots(res)

plot of chunk SD-kmeans-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.675           0.391       0.749         0.4415 0.788   0.788
#> 3 3 0.520           0.786       0.845         0.3825 0.491   0.383
#> 4 4 0.707           0.639       0.782         0.1674 0.862   0.643
#> 5 5 0.701           0.796       0.834         0.0885 0.898   0.660
#> 6 6 0.734           0.664       0.757         0.0529 0.949   0.772

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
#> GSM918603     1   0.997      0.993 0.532 0.468
#> GSM918641     1   0.997      0.993 0.532 0.468
#> GSM918580     1   0.997      0.993 0.532 0.468
#> GSM918593     1   0.997      0.993 0.532 0.468
#> GSM918625     1   0.997      0.993 0.532 0.468
#> GSM918638     1   0.997      0.993 0.532 0.468
#> GSM918642     1   0.997      0.993 0.532 0.468
#> GSM918643     1   0.997      0.993 0.532 0.468
#> GSM918619     2   1.000     -0.912 0.496 0.504
#> GSM918621     2   1.000     -0.912 0.496 0.504
#> GSM918582     2   1.000     -0.912 0.496 0.504
#> GSM918649     2   1.000     -0.912 0.496 0.504
#> GSM918651     2   1.000     -0.912 0.496 0.504
#> GSM918607     2   1.000     -0.912 0.496 0.504
#> GSM918609     2   1.000     -0.912 0.496 0.504
#> GSM918608     2   1.000     -0.912 0.496 0.504
#> GSM918606     2   1.000     -0.912 0.496 0.504
#> GSM918620     2   1.000     -0.912 0.496 0.504
#> GSM918628     1   1.000      0.938 0.500 0.500
#> GSM918586     2   0.000      0.272 0.000 1.000
#> GSM918594     2   0.000      0.272 0.000 1.000
#> GSM918600     2   0.000      0.272 0.000 1.000
#> GSM918601     2   0.000      0.272 0.000 1.000
#> GSM918612     2   0.000      0.272 0.000 1.000
#> GSM918614     2   0.000      0.272 0.000 1.000
#> GSM918629     2   0.992      0.686 0.448 0.552
#> GSM918587     2   0.990      0.685 0.440 0.560
#> GSM918588     2   0.000      0.272 0.000 1.000
#> GSM918589     2   0.000      0.272 0.000 1.000
#> GSM918611     2   0.000      0.272 0.000 1.000
#> GSM918624     2   0.000      0.272 0.000 1.000
#> GSM918637     2   0.358      0.367 0.068 0.932
#> GSM918639     2   0.000      0.272 0.000 1.000
#> GSM918640     2   0.000      0.272 0.000 1.000
#> GSM918636     2   0.000      0.272 0.000 1.000
#> GSM918590     2   1.000      0.692 0.488 0.512
#> GSM918610     2   1.000      0.692 0.488 0.512
#> GSM918615     2   1.000      0.692 0.488 0.512
#> GSM918616     2   0.992      0.686 0.448 0.552
#> GSM918632     2   1.000      0.692 0.488 0.512
#> GSM918647     2   1.000      0.692 0.488 0.512
#> GSM918578     2   1.000      0.692 0.488 0.512
#> GSM918579     2   1.000      0.692 0.488 0.512
#> GSM918581     2   1.000      0.692 0.488 0.512
#> GSM918584     2   1.000      0.692 0.488 0.512
#> GSM918591     2   1.000      0.692 0.488 0.512
#> GSM918592     2   1.000      0.692 0.488 0.512
#> GSM918597     2   0.992      0.686 0.448 0.552
#> GSM918598     2   1.000      0.692 0.488 0.512
#> GSM918599     2   0.992      0.686 0.448 0.552
#> GSM918604     2   0.118      0.296 0.016 0.984
#> GSM918605     2   0.995      0.688 0.460 0.540
#> GSM918613     2   1.000      0.692 0.488 0.512
#> GSM918623     2   1.000      0.692 0.488 0.512
#> GSM918626     2   0.992      0.686 0.448 0.552
#> GSM918627     2   0.992      0.686 0.448 0.552
#> GSM918633     2   1.000      0.692 0.488 0.512
#> GSM918634     2   0.992      0.686 0.448 0.552
#> GSM918635     2   1.000      0.692 0.488 0.512
#> GSM918645     2   1.000      0.692 0.488 0.512
#> GSM918646     2   0.998      0.691 0.476 0.524
#> GSM918648     2   1.000      0.692 0.488 0.512
#> GSM918650     2   1.000      0.692 0.488 0.512
#> GSM918652     2   0.995      0.688 0.460 0.540
#> GSM918653     2   1.000      0.692 0.488 0.512
#> GSM918622     2   0.992      0.686 0.448 0.552
#> GSM918583     2   1.000      0.692 0.488 0.512
#> GSM918585     2   1.000      0.692 0.488 0.512
#> GSM918595     2   1.000      0.692 0.488 0.512
#> GSM918596     2   0.992      0.686 0.448 0.552
#> GSM918602     2   0.992      0.686 0.448 0.552
#> GSM918617     2   0.992      0.686 0.448 0.552
#> GSM918630     2   1.000      0.692 0.488 0.512
#> GSM918631     2   1.000      0.692 0.488 0.512
#> GSM918618     2   0.999     -0.938 0.480 0.520
#> GSM918644     2   0.995     -0.908 0.460 0.540

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>           class entropy silhouette    p1    p2    p3
#> GSM918603     1  0.3043      0.802 0.908 0.008 0.084
#> GSM918641     1  0.3043      0.802 0.908 0.008 0.084
#> GSM918580     1  0.3043      0.802 0.908 0.008 0.084
#> GSM918593     1  0.3043      0.802 0.908 0.008 0.084
#> GSM918625     1  0.3043      0.802 0.908 0.008 0.084
#> GSM918638     1  0.3043      0.802 0.908 0.008 0.084
#> GSM918642     1  0.3043      0.802 0.908 0.008 0.084
#> GSM918643     1  0.3043      0.802 0.908 0.008 0.084
#> GSM918619     1  0.6546      0.834 0.716 0.044 0.240
#> GSM918621     1  0.6546      0.834 0.716 0.044 0.240
#> GSM918582     1  0.6546      0.834 0.716 0.044 0.240
#> GSM918649     1  0.6546      0.834 0.716 0.044 0.240
#> GSM918651     1  0.6546      0.834 0.716 0.044 0.240
#> GSM918607     1  0.6546      0.834 0.716 0.044 0.240
#> GSM918609     1  0.6546      0.834 0.716 0.044 0.240
#> GSM918608     1  0.6546      0.834 0.716 0.044 0.240
#> GSM918606     1  0.6546      0.834 0.716 0.044 0.240
#> GSM918620     1  0.6546      0.834 0.716 0.044 0.240
#> GSM918628     1  0.6402      0.816 0.724 0.040 0.236
#> GSM918586     3  0.4874      0.930 0.028 0.144 0.828
#> GSM918594     3  0.4874      0.930 0.028 0.144 0.828
#> GSM918600     3  0.4874      0.930 0.028 0.144 0.828
#> GSM918601     3  0.4874      0.930 0.028 0.144 0.828
#> GSM918612     3  0.4874      0.930 0.028 0.144 0.828
#> GSM918614     3  0.4874      0.930 0.028 0.144 0.828
#> GSM918629     3  0.4750      0.832 0.000 0.216 0.784
#> GSM918587     3  0.6079      0.489 0.000 0.388 0.612
#> GSM918588     3  0.4874      0.930 0.028 0.144 0.828
#> GSM918589     3  0.4874      0.930 0.028 0.144 0.828
#> GSM918611     3  0.4615      0.927 0.020 0.144 0.836
#> GSM918624     3  0.4874      0.930 0.028 0.144 0.828
#> GSM918637     3  0.3752      0.913 0.000 0.144 0.856
#> GSM918639     3  0.4874      0.930 0.028 0.144 0.828
#> GSM918640     3  0.4874      0.930 0.028 0.144 0.828
#> GSM918636     3  0.4874      0.930 0.028 0.144 0.828
#> GSM918590     2  0.1163      0.872 0.000 0.972 0.028
#> GSM918610     2  0.1163      0.872 0.000 0.972 0.028
#> GSM918615     2  0.1163      0.872 0.000 0.972 0.028
#> GSM918616     3  0.5810      0.619 0.000 0.336 0.664
#> GSM918632     2  0.0000      0.869 0.000 1.000 0.000
#> GSM918647     2  0.0000      0.869 0.000 1.000 0.000
#> GSM918578     2  0.1163      0.872 0.000 0.972 0.028
#> GSM918579     2  0.0000      0.869 0.000 1.000 0.000
#> GSM918581     2  0.0000      0.869 0.000 1.000 0.000
#> GSM918584     2  0.1163      0.872 0.000 0.972 0.028
#> GSM918591     2  0.1163      0.872 0.000 0.972 0.028
#> GSM918592     2  0.1163      0.872 0.000 0.972 0.028
#> GSM918597     2  0.6192      0.221 0.000 0.580 0.420
#> GSM918598     2  0.1163      0.872 0.000 0.972 0.028
#> GSM918599     2  0.5291      0.534 0.000 0.732 0.268
#> GSM918604     3  0.3752      0.913 0.000 0.144 0.856
#> GSM918605     2  0.2261      0.841 0.000 0.932 0.068
#> GSM918613     2  0.1163      0.872 0.000 0.972 0.028
#> GSM918623     2  0.0000      0.869 0.000 1.000 0.000
#> GSM918626     2  0.6140      0.273 0.000 0.596 0.404
#> GSM918627     2  0.6154      0.261 0.000 0.592 0.408
#> GSM918633     2  0.1163      0.872 0.000 0.972 0.028
#> GSM918634     2  0.6180      0.235 0.000 0.584 0.416
#> GSM918635     2  0.0000      0.869 0.000 1.000 0.000
#> GSM918645     2  0.1163      0.872 0.000 0.972 0.028
#> GSM918646     2  0.0237      0.868 0.000 0.996 0.004
#> GSM918648     2  0.0000      0.869 0.000 1.000 0.000
#> GSM918650     2  0.1163      0.872 0.000 0.972 0.028
#> GSM918652     2  0.1529      0.865 0.000 0.960 0.040
#> GSM918653     2  0.0000      0.869 0.000 1.000 0.000
#> GSM918622     2  0.6154      0.261 0.000 0.592 0.408
#> GSM918583     2  0.0000      0.869 0.000 1.000 0.000
#> GSM918585     2  0.0000      0.869 0.000 1.000 0.000
#> GSM918595     2  0.1163      0.872 0.000 0.972 0.028
#> GSM918596     3  0.5591      0.688 0.000 0.304 0.696
#> GSM918602     2  0.6260      0.109 0.000 0.552 0.448
#> GSM918617     2  0.5968      0.380 0.000 0.636 0.364
#> GSM918630     2  0.0000      0.869 0.000 1.000 0.000
#> GSM918631     2  0.0000      0.869 0.000 1.000 0.000
#> GSM918618     1  0.6337      0.706 0.708 0.028 0.264
#> GSM918644     1  0.8261      0.321 0.524 0.080 0.396

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM918603     4  0.5586     0.0460 0.452 0.000 0.020 0.528
#> GSM918641     4  0.5586     0.0460 0.452 0.000 0.020 0.528
#> GSM918580     4  0.5586     0.0460 0.452 0.000 0.020 0.528
#> GSM918593     4  0.5581     0.0471 0.448 0.000 0.020 0.532
#> GSM918625     4  0.5581     0.0471 0.448 0.000 0.020 0.532
#> GSM918638     4  0.5581     0.0471 0.448 0.000 0.020 0.532
#> GSM918642     4  0.5581     0.0471 0.448 0.000 0.020 0.532
#> GSM918643     4  0.5581     0.0471 0.448 0.000 0.020 0.532
#> GSM918619     1  0.1118     0.9855 0.964 0.000 0.036 0.000
#> GSM918621     1  0.1118     0.9855 0.964 0.000 0.036 0.000
#> GSM918582     1  0.1022     0.9862 0.968 0.000 0.032 0.000
#> GSM918649     1  0.1022     0.9862 0.968 0.000 0.032 0.000
#> GSM918651     1  0.1022     0.9862 0.968 0.000 0.032 0.000
#> GSM918607     1  0.1022     0.9862 0.968 0.000 0.032 0.000
#> GSM918609     1  0.1118     0.9855 0.964 0.000 0.036 0.000
#> GSM918608     1  0.1022     0.9862 0.968 0.000 0.032 0.000
#> GSM918606     1  0.1118     0.9855 0.964 0.000 0.036 0.000
#> GSM918620     1  0.1022     0.9862 0.968 0.000 0.032 0.000
#> GSM918628     1  0.3486     0.8664 0.864 0.000 0.044 0.092
#> GSM918586     3  0.0188     0.8552 0.000 0.004 0.996 0.000
#> GSM918594     3  0.1109     0.8514 0.000 0.004 0.968 0.028
#> GSM918600     3  0.0188     0.8552 0.000 0.004 0.996 0.000
#> GSM918601     3  0.1305     0.8496 0.000 0.004 0.960 0.036
#> GSM918612     3  0.0188     0.8552 0.000 0.004 0.996 0.000
#> GSM918614     3  0.0188     0.8552 0.000 0.004 0.996 0.000
#> GSM918629     3  0.1151     0.8438 0.000 0.008 0.968 0.024
#> GSM918587     3  0.5784     0.3547 0.000 0.032 0.556 0.412
#> GSM918588     3  0.0188     0.8552 0.000 0.004 0.996 0.000
#> GSM918589     3  0.0188     0.8552 0.000 0.004 0.996 0.000
#> GSM918611     3  0.0779     0.8513 0.000 0.004 0.980 0.016
#> GSM918624     3  0.1305     0.8496 0.000 0.004 0.960 0.036
#> GSM918637     3  0.1576     0.8464 0.000 0.004 0.948 0.048
#> GSM918639     3  0.1305     0.8496 0.000 0.004 0.960 0.036
#> GSM918640     3  0.1305     0.8496 0.000 0.004 0.960 0.036
#> GSM918636     3  0.0188     0.8552 0.000 0.004 0.996 0.000
#> GSM918590     2  0.4925     0.6529 0.000 0.572 0.000 0.428
#> GSM918610     2  0.3172     0.8126 0.000 0.840 0.000 0.160
#> GSM918615     2  0.3975     0.8012 0.000 0.760 0.000 0.240
#> GSM918616     3  0.5378     0.3832 0.000 0.012 0.540 0.448
#> GSM918632     2  0.0000     0.7955 0.000 1.000 0.000 0.000
#> GSM918647     2  0.0000     0.7955 0.000 1.000 0.000 0.000
#> GSM918578     2  0.3172     0.8126 0.000 0.840 0.000 0.160
#> GSM918579     2  0.1474     0.8050 0.000 0.948 0.000 0.052
#> GSM918581     2  0.1474     0.8081 0.000 0.948 0.000 0.052
#> GSM918584     2  0.3764     0.8100 0.000 0.784 0.000 0.216
#> GSM918591     2  0.3172     0.8126 0.000 0.840 0.000 0.160
#> GSM918592     2  0.3172     0.8126 0.000 0.840 0.000 0.160
#> GSM918597     4  0.7806    -0.0169 0.000 0.264 0.324 0.412
#> GSM918598     2  0.3172     0.8126 0.000 0.840 0.000 0.160
#> GSM918599     2  0.7318     0.3164 0.000 0.524 0.196 0.280
#> GSM918604     3  0.1109     0.8453 0.000 0.004 0.968 0.028
#> GSM918605     2  0.4933     0.6490 0.000 0.568 0.000 0.432
#> GSM918613     2  0.4382     0.7704 0.000 0.704 0.000 0.296
#> GSM918623     2  0.0000     0.7955 0.000 1.000 0.000 0.000
#> GSM918626     4  0.7825    -0.0495 0.000 0.284 0.304 0.412
#> GSM918627     4  0.7828    -0.0660 0.000 0.292 0.296 0.412
#> GSM918633     2  0.3726     0.8108 0.000 0.788 0.000 0.212
#> GSM918634     4  0.7805    -0.0515 0.000 0.280 0.300 0.420
#> GSM918635     2  0.0000     0.7955 0.000 1.000 0.000 0.000
#> GSM918645     2  0.4543     0.7526 0.000 0.676 0.000 0.324
#> GSM918646     2  0.3649     0.7467 0.000 0.796 0.000 0.204
#> GSM918648     2  0.0000     0.7955 0.000 1.000 0.000 0.000
#> GSM918650     2  0.3569     0.8132 0.000 0.804 0.000 0.196
#> GSM918652     2  0.4898     0.6536 0.000 0.584 0.000 0.416
#> GSM918653     2  0.1474     0.8050 0.000 0.948 0.000 0.052
#> GSM918622     4  0.7828    -0.0660 0.000 0.292 0.296 0.412
#> GSM918583     2  0.1792     0.8081 0.000 0.932 0.000 0.068
#> GSM918585     2  0.0000     0.7955 0.000 1.000 0.000 0.000
#> GSM918595     2  0.3942     0.7842 0.000 0.764 0.000 0.236
#> GSM918596     3  0.5320     0.3929 0.000 0.012 0.572 0.416
#> GSM918602     4  0.7688     0.0179 0.000 0.220 0.364 0.416
#> GSM918617     2  0.7733     0.1576 0.000 0.440 0.256 0.304
#> GSM918630     2  0.3172     0.7677 0.000 0.840 0.000 0.160
#> GSM918631     2  0.1557     0.8049 0.000 0.944 0.000 0.056
#> GSM918618     3  0.6640     0.2018 0.352 0.000 0.552 0.096
#> GSM918644     3  0.5268     0.3817 0.348 0.004 0.636 0.012

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>           class entropy silhouette    p1    p2    p3    p4    p5
#> GSM918603     4  0.3689     1.0000 0.256 0.000 0.004 0.740 0.000
#> GSM918641     4  0.3689     1.0000 0.256 0.000 0.004 0.740 0.000
#> GSM918580     4  0.3689     1.0000 0.256 0.000 0.004 0.740 0.000
#> GSM918593     4  0.3689     1.0000 0.256 0.000 0.004 0.740 0.000
#> GSM918625     4  0.3689     1.0000 0.256 0.000 0.004 0.740 0.000
#> GSM918638     4  0.3689     1.0000 0.256 0.000 0.004 0.740 0.000
#> GSM918642     4  0.3689     1.0000 0.256 0.000 0.004 0.740 0.000
#> GSM918643     4  0.3689     1.0000 0.256 0.000 0.004 0.740 0.000
#> GSM918619     1  0.0000     0.9718 1.000 0.000 0.000 0.000 0.000
#> GSM918621     1  0.0000     0.9718 1.000 0.000 0.000 0.000 0.000
#> GSM918582     1  0.0000     0.9718 1.000 0.000 0.000 0.000 0.000
#> GSM918649     1  0.0000     0.9718 1.000 0.000 0.000 0.000 0.000
#> GSM918651     1  0.0000     0.9718 1.000 0.000 0.000 0.000 0.000
#> GSM918607     1  0.0000     0.9718 1.000 0.000 0.000 0.000 0.000
#> GSM918609     1  0.0000     0.9718 1.000 0.000 0.000 0.000 0.000
#> GSM918608     1  0.0000     0.9718 1.000 0.000 0.000 0.000 0.000
#> GSM918606     1  0.0000     0.9718 1.000 0.000 0.000 0.000 0.000
#> GSM918620     1  0.0000     0.9718 1.000 0.000 0.000 0.000 0.000
#> GSM918628     1  0.4704     0.6423 0.764 0.000 0.016 0.104 0.116
#> GSM918586     3  0.0162     0.9027 0.000 0.000 0.996 0.004 0.000
#> GSM918594     3  0.2694     0.8837 0.000 0.000 0.884 0.076 0.040
#> GSM918600     3  0.0000     0.9032 0.000 0.000 1.000 0.000 0.000
#> GSM918601     3  0.2903     0.8802 0.000 0.000 0.872 0.080 0.048
#> GSM918612     3  0.0000     0.9032 0.000 0.000 1.000 0.000 0.000
#> GSM918614     3  0.0000     0.9032 0.000 0.000 1.000 0.000 0.000
#> GSM918629     3  0.1041     0.8936 0.000 0.000 0.964 0.004 0.032
#> GSM918587     5  0.2864     0.7500 0.000 0.000 0.136 0.012 0.852
#> GSM918588     3  0.0162     0.9031 0.000 0.000 0.996 0.000 0.004
#> GSM918589     3  0.0324     0.9022 0.000 0.000 0.992 0.004 0.004
#> GSM918611     3  0.1956     0.8641 0.000 0.000 0.916 0.008 0.076
#> GSM918624     3  0.2903     0.8802 0.000 0.000 0.872 0.080 0.048
#> GSM918637     3  0.2974     0.8792 0.000 0.000 0.868 0.080 0.052
#> GSM918639     3  0.2903     0.8802 0.000 0.000 0.872 0.080 0.048
#> GSM918640     3  0.2903     0.8802 0.000 0.000 0.872 0.080 0.048
#> GSM918636     3  0.0324     0.9022 0.000 0.000 0.992 0.004 0.004
#> GSM918590     5  0.3409     0.8014 0.000 0.160 0.000 0.024 0.816
#> GSM918610     2  0.4916     0.7095 0.000 0.716 0.000 0.124 0.160
#> GSM918615     2  0.6021     0.6076 0.000 0.552 0.000 0.144 0.304
#> GSM918616     5  0.2976     0.7840 0.000 0.004 0.132 0.012 0.852
#> GSM918632     2  0.0404     0.7172 0.000 0.988 0.000 0.012 0.000
#> GSM918647     2  0.0000     0.7180 0.000 1.000 0.000 0.000 0.000
#> GSM918578     2  0.4916     0.7095 0.000 0.716 0.000 0.124 0.160
#> GSM918579     2  0.2540     0.7029 0.000 0.888 0.000 0.024 0.088
#> GSM918581     2  0.3485     0.7299 0.000 0.828 0.000 0.124 0.048
#> GSM918584     2  0.5748     0.6714 0.000 0.608 0.000 0.140 0.252
#> GSM918591     2  0.4916     0.7095 0.000 0.716 0.000 0.124 0.160
#> GSM918592     2  0.4916     0.7095 0.000 0.716 0.000 0.124 0.160
#> GSM918597     5  0.4034     0.8571 0.000 0.096 0.080 0.012 0.812
#> GSM918598     2  0.4916     0.7095 0.000 0.716 0.000 0.124 0.160
#> GSM918599     5  0.4919     0.6613 0.000 0.304 0.028 0.012 0.656
#> GSM918604     3  0.2069     0.8600 0.000 0.000 0.912 0.012 0.076
#> GSM918605     5  0.3224     0.8018 0.000 0.160 0.000 0.016 0.824
#> GSM918613     2  0.6012     0.4539 0.000 0.484 0.000 0.116 0.400
#> GSM918623     2  0.0404     0.7172 0.000 0.988 0.000 0.012 0.000
#> GSM918626     5  0.3136     0.8385 0.000 0.072 0.052 0.008 0.868
#> GSM918627     5  0.3888     0.8578 0.000 0.112 0.064 0.008 0.816
#> GSM918633     2  0.5618     0.6818 0.000 0.628 0.000 0.136 0.236
#> GSM918634     5  0.3985     0.8540 0.000 0.104 0.052 0.024 0.820
#> GSM918635     2  0.0404     0.7172 0.000 0.988 0.000 0.012 0.000
#> GSM918645     2  0.6127     0.3869 0.000 0.456 0.000 0.128 0.416
#> GSM918646     2  0.4425    -0.0379 0.000 0.544 0.000 0.004 0.452
#> GSM918648     2  0.0404     0.7172 0.000 0.988 0.000 0.012 0.000
#> GSM918650     2  0.5489     0.6937 0.000 0.648 0.000 0.136 0.216
#> GSM918652     5  0.3438     0.7907 0.000 0.172 0.000 0.020 0.808
#> GSM918653     2  0.2540     0.7029 0.000 0.888 0.000 0.024 0.088
#> GSM918622     5  0.3888     0.8578 0.000 0.112 0.064 0.008 0.816
#> GSM918583     2  0.3865     0.7192 0.000 0.808 0.000 0.100 0.092
#> GSM918585     2  0.1310     0.7160 0.000 0.956 0.000 0.024 0.020
#> GSM918595     2  0.6166     0.4114 0.000 0.512 0.000 0.148 0.340
#> GSM918596     5  0.3399     0.7785 0.000 0.004 0.172 0.012 0.812
#> GSM918602     5  0.3981     0.8564 0.000 0.096 0.084 0.008 0.812
#> GSM918617     5  0.4429     0.7365 0.000 0.256 0.028 0.004 0.712
#> GSM918630     2  0.4315     0.4480 0.000 0.700 0.000 0.024 0.276
#> GSM918631     2  0.2597     0.7008 0.000 0.884 0.000 0.024 0.092
#> GSM918618     3  0.6888     0.4317 0.160 0.000 0.600 0.120 0.120
#> GSM918644     3  0.6414     0.5477 0.140 0.000 0.636 0.064 0.160

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>           class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM918603     4  0.2669     0.9953 0.156 0.000 0.000 0.836 0.008 0.000
#> GSM918641     4  0.2669     0.9953 0.156 0.000 0.000 0.836 0.008 0.000
#> GSM918580     4  0.2669     0.9953 0.156 0.000 0.000 0.836 0.008 0.000
#> GSM918593     4  0.2416     0.9972 0.156 0.000 0.000 0.844 0.000 0.000
#> GSM918625     4  0.2416     0.9972 0.156 0.000 0.000 0.844 0.000 0.000
#> GSM918638     4  0.2416     0.9972 0.156 0.000 0.000 0.844 0.000 0.000
#> GSM918642     4  0.2416     0.9972 0.156 0.000 0.000 0.844 0.000 0.000
#> GSM918643     4  0.2416     0.9972 0.156 0.000 0.000 0.844 0.000 0.000
#> GSM918619     1  0.0692     0.9401 0.976 0.000 0.000 0.000 0.004 0.020
#> GSM918621     1  0.0692     0.9401 0.976 0.000 0.000 0.000 0.004 0.020
#> GSM918582     1  0.0000     0.9438 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM918649     1  0.0000     0.9438 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM918651     1  0.0291     0.9431 0.992 0.000 0.000 0.000 0.004 0.004
#> GSM918607     1  0.0146     0.9438 0.996 0.000 0.000 0.000 0.004 0.000
#> GSM918609     1  0.0806     0.9402 0.972 0.000 0.000 0.000 0.008 0.020
#> GSM918608     1  0.0146     0.9438 0.996 0.000 0.000 0.000 0.004 0.000
#> GSM918606     1  0.0603     0.9416 0.980 0.000 0.000 0.000 0.004 0.016
#> GSM918620     1  0.0146     0.9438 0.996 0.000 0.000 0.000 0.004 0.000
#> GSM918628     1  0.6465     0.3577 0.540 0.000 0.048 0.112 0.020 0.280
#> GSM918586     3  0.1149     0.8371 0.000 0.000 0.960 0.008 0.008 0.024
#> GSM918594     3  0.3337     0.8115 0.000 0.000 0.824 0.064 0.004 0.108
#> GSM918600     3  0.0000     0.8419 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM918601     3  0.3777     0.8065 0.000 0.000 0.804 0.068 0.020 0.108
#> GSM918612     3  0.0000     0.8419 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM918614     3  0.0000     0.8419 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM918629     3  0.2213     0.8009 0.000 0.000 0.888 0.008 0.100 0.004
#> GSM918587     5  0.4520     0.7217 0.000 0.004 0.136 0.016 0.744 0.100
#> GSM918588     3  0.0000     0.8419 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM918589     3  0.1838     0.8301 0.000 0.000 0.928 0.012 0.020 0.040
#> GSM918611     3  0.3819     0.7279 0.000 0.000 0.784 0.016 0.156 0.044
#> GSM918624     3  0.3777     0.8065 0.000 0.000 0.804 0.068 0.020 0.108
#> GSM918637     3  0.3822     0.8051 0.000 0.000 0.800 0.068 0.020 0.112
#> GSM918639     3  0.3777     0.8065 0.000 0.000 0.804 0.068 0.020 0.108
#> GSM918640     3  0.3777     0.8065 0.000 0.000 0.804 0.068 0.020 0.108
#> GSM918636     3  0.1649     0.8325 0.000 0.000 0.936 0.008 0.016 0.040
#> GSM918590     5  0.2875     0.8145 0.000 0.044 0.000 0.024 0.872 0.060
#> GSM918610     2  0.5465    -0.0720 0.000 0.564 0.000 0.016 0.096 0.324
#> GSM918615     6  0.5719     0.7782 0.000 0.272 0.000 0.004 0.188 0.536
#> GSM918616     5  0.2063     0.8452 0.000 0.000 0.060 0.020 0.912 0.008
#> GSM918632     2  0.0000     0.4566 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM918647     2  0.0547     0.4507 0.000 0.980 0.000 0.000 0.000 0.020
#> GSM918578     2  0.5453    -0.0619 0.000 0.568 0.000 0.016 0.096 0.320
#> GSM918579     2  0.4013     0.3004 0.000 0.740 0.000 0.008 0.040 0.212
#> GSM918581     2  0.4883     0.0140 0.000 0.616 0.000 0.016 0.048 0.320
#> GSM918584     6  0.5578     0.7676 0.000 0.316 0.000 0.004 0.144 0.536
#> GSM918591     2  0.5453    -0.0619 0.000 0.568 0.000 0.016 0.096 0.320
#> GSM918592     2  0.5453    -0.0619 0.000 0.568 0.000 0.016 0.096 0.320
#> GSM918597     5  0.2728     0.8509 0.000 0.016 0.056 0.016 0.888 0.024
#> GSM918598     2  0.5453    -0.0619 0.000 0.568 0.000 0.016 0.096 0.320
#> GSM918599     5  0.4033     0.7874 0.000 0.144 0.024 0.028 0.788 0.016
#> GSM918604     3  0.3926     0.7081 0.000 0.000 0.768 0.016 0.176 0.040
#> GSM918605     5  0.2622     0.8179 0.000 0.044 0.000 0.024 0.888 0.044
#> GSM918613     6  0.5814     0.7224 0.000 0.224 0.000 0.004 0.248 0.524
#> GSM918623     2  0.0000     0.4566 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM918626     5  0.3708     0.8308 0.000 0.024 0.036 0.028 0.832 0.080
#> GSM918627     5  0.2474     0.8562 0.000 0.028 0.036 0.016 0.904 0.016
#> GSM918633     6  0.5431     0.7555 0.000 0.332 0.000 0.000 0.136 0.532
#> GSM918634     5  0.2964     0.8465 0.000 0.028 0.028 0.024 0.880 0.040
#> GSM918635     2  0.0000     0.4566 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM918645     6  0.5855     0.6295 0.000 0.176 0.000 0.008 0.304 0.512
#> GSM918646     5  0.5400     0.2491 0.000 0.412 0.000 0.016 0.500 0.072
#> GSM918648     2  0.0000     0.4566 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM918650     6  0.5276     0.7034 0.000 0.348 0.000 0.000 0.112 0.540
#> GSM918652     5  0.3791     0.7554 0.000 0.056 0.000 0.032 0.808 0.104
#> GSM918653     2  0.4013     0.3004 0.000 0.740 0.000 0.008 0.040 0.212
#> GSM918622     5  0.2474     0.8562 0.000 0.028 0.036 0.016 0.904 0.016
#> GSM918583     2  0.5112    -0.1926 0.000 0.524 0.000 0.016 0.048 0.412
#> GSM918585     2  0.3568     0.3207 0.000 0.764 0.000 0.008 0.016 0.212
#> GSM918595     2  0.6308    -0.2157 0.000 0.448 0.000 0.024 0.188 0.340
#> GSM918596     5  0.2202     0.8484 0.000 0.008 0.072 0.004 0.904 0.012
#> GSM918602     5  0.2348     0.8577 0.000 0.024 0.044 0.012 0.908 0.012
#> GSM918617     5  0.3264     0.8253 0.000 0.104 0.028 0.012 0.844 0.012
#> GSM918630     2  0.5793     0.1074 0.000 0.568 0.000 0.016 0.184 0.232
#> GSM918631     2  0.4013     0.3004 0.000 0.740 0.000 0.008 0.040 0.212
#> GSM918618     3  0.7393     0.3456 0.088 0.000 0.468 0.120 0.048 0.276
#> GSM918644     3  0.7267     0.4429 0.056 0.000 0.472 0.056 0.132 0.284

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) gender(p) other(p) k
#> SD:kmeans 49         1.30e-10   0.02800 4.25e-02 2
#> SD:kmeans 67         1.55e-20   0.00288 2.18e-04 3
#> SD:kmeans 55         2.51e-20   0.04025 1.42e-06 4
#> SD:kmeans 70         2.24e-31   0.00685 4.63e-06 5
#> SD:kmeans 54         4.16e-26   0.00229 6.80e-05 6

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


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

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

collect_plots(res)

plot of chunk SD-skmeans-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 1.000           0.985       0.995         0.5062 0.495   0.495
#> 3 3 1.000           0.966       0.986         0.3216 0.720   0.493
#> 4 4 0.774           0.871       0.853         0.0738 0.961   0.883
#> 5 5 0.858           0.848       0.900         0.1022 0.895   0.656
#> 6 6 0.842           0.716       0.854         0.0530 0.949   0.764

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
#> GSM918603     1   0.000      1.000 1.000 0.000
#> GSM918641     1   0.000      1.000 1.000 0.000
#> GSM918580     1   0.000      1.000 1.000 0.000
#> GSM918593     1   0.000      1.000 1.000 0.000
#> GSM918625     1   0.000      1.000 1.000 0.000
#> GSM918638     1   0.000      1.000 1.000 0.000
#> GSM918642     1   0.000      1.000 1.000 0.000
#> GSM918643     1   0.000      1.000 1.000 0.000
#> GSM918619     1   0.000      1.000 1.000 0.000
#> GSM918621     1   0.000      1.000 1.000 0.000
#> GSM918582     1   0.000      1.000 1.000 0.000
#> GSM918649     1   0.000      1.000 1.000 0.000
#> GSM918651     1   0.000      1.000 1.000 0.000
#> GSM918607     1   0.000      1.000 1.000 0.000
#> GSM918609     1   0.000      1.000 1.000 0.000
#> GSM918608     1   0.000      1.000 1.000 0.000
#> GSM918606     1   0.000      1.000 1.000 0.000
#> GSM918620     1   0.000      1.000 1.000 0.000
#> GSM918628     1   0.000      1.000 1.000 0.000
#> GSM918586     1   0.000      1.000 1.000 0.000
#> GSM918594     1   0.000      1.000 1.000 0.000
#> GSM918600     1   0.000      1.000 1.000 0.000
#> GSM918601     1   0.000      1.000 1.000 0.000
#> GSM918612     1   0.000      1.000 1.000 0.000
#> GSM918614     1   0.000      1.000 1.000 0.000
#> GSM918629     2   0.000      0.989 0.000 1.000
#> GSM918587     2   0.978      0.299 0.412 0.588
#> GSM918588     1   0.000      1.000 1.000 0.000
#> GSM918589     1   0.000      1.000 1.000 0.000
#> GSM918611     1   0.000      1.000 1.000 0.000
#> GSM918624     1   0.000      1.000 1.000 0.000
#> GSM918637     1   0.000      1.000 1.000 0.000
#> GSM918639     1   0.000      1.000 1.000 0.000
#> GSM918640     1   0.000      1.000 1.000 0.000
#> GSM918636     1   0.000      1.000 1.000 0.000
#> GSM918590     2   0.000      0.989 0.000 1.000
#> GSM918610     2   0.000      0.989 0.000 1.000
#> GSM918615     2   0.000      0.989 0.000 1.000
#> GSM918616     2   0.000      0.989 0.000 1.000
#> GSM918632     2   0.000      0.989 0.000 1.000
#> GSM918647     2   0.000      0.989 0.000 1.000
#> GSM918578     2   0.000      0.989 0.000 1.000
#> GSM918579     2   0.000      0.989 0.000 1.000
#> GSM918581     2   0.000      0.989 0.000 1.000
#> GSM918584     2   0.000      0.989 0.000 1.000
#> GSM918591     2   0.000      0.989 0.000 1.000
#> GSM918592     2   0.000      0.989 0.000 1.000
#> GSM918597     2   0.000      0.989 0.000 1.000
#> GSM918598     2   0.000      0.989 0.000 1.000
#> GSM918599     2   0.000      0.989 0.000 1.000
#> GSM918604     1   0.000      1.000 1.000 0.000
#> GSM918605     2   0.000      0.989 0.000 1.000
#> GSM918613     2   0.000      0.989 0.000 1.000
#> GSM918623     2   0.000      0.989 0.000 1.000
#> GSM918626     2   0.000      0.989 0.000 1.000
#> GSM918627     2   0.000      0.989 0.000 1.000
#> GSM918633     2   0.000      0.989 0.000 1.000
#> GSM918634     2   0.000      0.989 0.000 1.000
#> GSM918635     2   0.000      0.989 0.000 1.000
#> GSM918645     2   0.000      0.989 0.000 1.000
#> GSM918646     2   0.000      0.989 0.000 1.000
#> GSM918648     2   0.000      0.989 0.000 1.000
#> GSM918650     2   0.000      0.989 0.000 1.000
#> GSM918652     2   0.000      0.989 0.000 1.000
#> GSM918653     2   0.000      0.989 0.000 1.000
#> GSM918622     2   0.000      0.989 0.000 1.000
#> GSM918583     2   0.000      0.989 0.000 1.000
#> GSM918585     2   0.000      0.989 0.000 1.000
#> GSM918595     2   0.000      0.989 0.000 1.000
#> GSM918596     2   0.000      0.989 0.000 1.000
#> GSM918602     2   0.000      0.989 0.000 1.000
#> GSM918617     2   0.000      0.989 0.000 1.000
#> GSM918630     2   0.000      0.989 0.000 1.000
#> GSM918631     2   0.000      0.989 0.000 1.000
#> GSM918618     1   0.000      1.000 1.000 0.000
#> GSM918644     1   0.000      1.000 1.000 0.000

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>           class entropy silhouette p1    p2    p3
#> GSM918603     1  0.0000      1.000  1 0.000 0.000
#> GSM918641     1  0.0000      1.000  1 0.000 0.000
#> GSM918580     1  0.0000      1.000  1 0.000 0.000
#> GSM918593     1  0.0000      1.000  1 0.000 0.000
#> GSM918625     1  0.0000      1.000  1 0.000 0.000
#> GSM918638     1  0.0000      1.000  1 0.000 0.000
#> GSM918642     1  0.0000      1.000  1 0.000 0.000
#> GSM918643     1  0.0000      1.000  1 0.000 0.000
#> GSM918619     1  0.0000      1.000  1 0.000 0.000
#> GSM918621     1  0.0000      1.000  1 0.000 0.000
#> GSM918582     1  0.0000      1.000  1 0.000 0.000
#> GSM918649     1  0.0000      1.000  1 0.000 0.000
#> GSM918651     1  0.0000      1.000  1 0.000 0.000
#> GSM918607     1  0.0000      1.000  1 0.000 0.000
#> GSM918609     1  0.0000      1.000  1 0.000 0.000
#> GSM918608     1  0.0000      1.000  1 0.000 0.000
#> GSM918606     1  0.0000      1.000  1 0.000 0.000
#> GSM918620     1  0.0000      1.000  1 0.000 0.000
#> GSM918628     1  0.0000      1.000  1 0.000 0.000
#> GSM918586     3  0.0000      0.970  0 0.000 1.000
#> GSM918594     3  0.0000      0.970  0 0.000 1.000
#> GSM918600     3  0.0000      0.970  0 0.000 1.000
#> GSM918601     3  0.0000      0.970  0 0.000 1.000
#> GSM918612     3  0.0000      0.970  0 0.000 1.000
#> GSM918614     3  0.0000      0.970  0 0.000 1.000
#> GSM918629     3  0.0000      0.970  0 0.000 1.000
#> GSM918587     3  0.0000      0.970  0 0.000 1.000
#> GSM918588     3  0.0000      0.970  0 0.000 1.000
#> GSM918589     3  0.0000      0.970  0 0.000 1.000
#> GSM918611     3  0.0000      0.970  0 0.000 1.000
#> GSM918624     3  0.0000      0.970  0 0.000 1.000
#> GSM918637     3  0.0000      0.970  0 0.000 1.000
#> GSM918639     3  0.0000      0.970  0 0.000 1.000
#> GSM918640     3  0.0000      0.970  0 0.000 1.000
#> GSM918636     3  0.0000      0.970  0 0.000 1.000
#> GSM918590     2  0.0000      0.987  0 1.000 0.000
#> GSM918610     2  0.0000      0.987  0 1.000 0.000
#> GSM918615     2  0.0000      0.987  0 1.000 0.000
#> GSM918616     3  0.0000      0.970  0 0.000 1.000
#> GSM918632     2  0.0000      0.987  0 1.000 0.000
#> GSM918647     2  0.0000      0.987  0 1.000 0.000
#> GSM918578     2  0.0000      0.987  0 1.000 0.000
#> GSM918579     2  0.0000      0.987  0 1.000 0.000
#> GSM918581     2  0.0000      0.987  0 1.000 0.000
#> GSM918584     2  0.0000      0.987  0 1.000 0.000
#> GSM918591     2  0.0000      0.987  0 1.000 0.000
#> GSM918592     2  0.0000      0.987  0 1.000 0.000
#> GSM918597     3  0.1411      0.948  0 0.036 0.964
#> GSM918598     2  0.0000      0.987  0 1.000 0.000
#> GSM918599     2  0.5810      0.464  0 0.664 0.336
#> GSM918604     3  0.0000      0.970  0 0.000 1.000
#> GSM918605     2  0.0000      0.987  0 1.000 0.000
#> GSM918613     2  0.0000      0.987  0 1.000 0.000
#> GSM918623     2  0.0000      0.987  0 1.000 0.000
#> GSM918626     3  0.1643      0.942  0 0.044 0.956
#> GSM918627     3  0.1964      0.932  0 0.056 0.944
#> GSM918633     2  0.0000      0.987  0 1.000 0.000
#> GSM918634     3  0.1289      0.951  0 0.032 0.968
#> GSM918635     2  0.0000      0.987  0 1.000 0.000
#> GSM918645     2  0.0000      0.987  0 1.000 0.000
#> GSM918646     2  0.0000      0.987  0 1.000 0.000
#> GSM918648     2  0.0000      0.987  0 1.000 0.000
#> GSM918650     2  0.0000      0.987  0 1.000 0.000
#> GSM918652     2  0.0000      0.987  0 1.000 0.000
#> GSM918653     2  0.0000      0.987  0 1.000 0.000
#> GSM918622     3  0.1964      0.932  0 0.056 0.944
#> GSM918583     2  0.0000      0.987  0 1.000 0.000
#> GSM918585     2  0.0000      0.987  0 1.000 0.000
#> GSM918595     2  0.0000      0.987  0 1.000 0.000
#> GSM918596     3  0.0000      0.970  0 0.000 1.000
#> GSM918602     3  0.0592      0.964  0 0.012 0.988
#> GSM918617     3  0.6274      0.165  0 0.456 0.544
#> GSM918630     2  0.0000      0.987  0 1.000 0.000
#> GSM918631     2  0.0000      0.987  0 1.000 0.000
#> GSM918618     1  0.0000      1.000  1 0.000 0.000
#> GSM918644     1  0.0000      1.000  1 0.000 0.000

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM918603     4  0.4103     0.9726 0.256 0.000 0.000 0.744
#> GSM918641     4  0.4103     0.9726 0.256 0.000 0.000 0.744
#> GSM918580     4  0.4103     0.9726 0.256 0.000 0.000 0.744
#> GSM918593     4  0.4103     0.9726 0.256 0.000 0.000 0.744
#> GSM918625     4  0.4103     0.9726 0.256 0.000 0.000 0.744
#> GSM918638     4  0.4103     0.9726 0.256 0.000 0.000 0.744
#> GSM918642     4  0.4103     0.9726 0.256 0.000 0.000 0.744
#> GSM918643     4  0.4103     0.9726 0.256 0.000 0.000 0.744
#> GSM918619     1  0.0000     1.0000 1.000 0.000 0.000 0.000
#> GSM918621     1  0.0000     1.0000 1.000 0.000 0.000 0.000
#> GSM918582     1  0.0000     1.0000 1.000 0.000 0.000 0.000
#> GSM918649     1  0.0000     1.0000 1.000 0.000 0.000 0.000
#> GSM918651     1  0.0000     1.0000 1.000 0.000 0.000 0.000
#> GSM918607     1  0.0000     1.0000 1.000 0.000 0.000 0.000
#> GSM918609     1  0.0000     1.0000 1.000 0.000 0.000 0.000
#> GSM918608     1  0.0000     1.0000 1.000 0.000 0.000 0.000
#> GSM918606     1  0.0000     1.0000 1.000 0.000 0.000 0.000
#> GSM918620     1  0.0000     1.0000 1.000 0.000 0.000 0.000
#> GSM918628     4  0.4972     0.6327 0.456 0.000 0.000 0.544
#> GSM918586     3  0.0000     0.8672 0.000 0.000 1.000 0.000
#> GSM918594     3  0.0000     0.8672 0.000 0.000 1.000 0.000
#> GSM918600     3  0.0000     0.8672 0.000 0.000 1.000 0.000
#> GSM918601     3  0.0000     0.8672 0.000 0.000 1.000 0.000
#> GSM918612     3  0.0000     0.8672 0.000 0.000 1.000 0.000
#> GSM918614     3  0.0000     0.8672 0.000 0.000 1.000 0.000
#> GSM918629     3  0.0000     0.8672 0.000 0.000 1.000 0.000
#> GSM918587     3  0.5491     0.6988 0.000 0.052 0.688 0.260
#> GSM918588     3  0.0000     0.8672 0.000 0.000 1.000 0.000
#> GSM918589     3  0.0000     0.8672 0.000 0.000 1.000 0.000
#> GSM918611     3  0.0000     0.8672 0.000 0.000 1.000 0.000
#> GSM918624     3  0.0000     0.8672 0.000 0.000 1.000 0.000
#> GSM918637     3  0.0000     0.8672 0.000 0.000 1.000 0.000
#> GSM918639     3  0.0000     0.8672 0.000 0.000 1.000 0.000
#> GSM918640     3  0.0000     0.8672 0.000 0.000 1.000 0.000
#> GSM918636     3  0.0000     0.8672 0.000 0.000 1.000 0.000
#> GSM918590     2  0.2760     0.8345 0.000 0.872 0.000 0.128
#> GSM918610     2  0.0000     0.9131 0.000 1.000 0.000 0.000
#> GSM918615     2  0.0000     0.9131 0.000 1.000 0.000 0.000
#> GSM918616     3  0.3335     0.8146 0.000 0.016 0.856 0.128
#> GSM918632     2  0.2760     0.9060 0.000 0.872 0.000 0.128
#> GSM918647     2  0.2760     0.9060 0.000 0.872 0.000 0.128
#> GSM918578     2  0.0000     0.9131 0.000 1.000 0.000 0.000
#> GSM918579     2  0.2760     0.9060 0.000 0.872 0.000 0.128
#> GSM918581     2  0.0592     0.9137 0.000 0.984 0.000 0.016
#> GSM918584     2  0.0000     0.9131 0.000 1.000 0.000 0.000
#> GSM918591     2  0.0000     0.9131 0.000 1.000 0.000 0.000
#> GSM918592     2  0.0000     0.9131 0.000 1.000 0.000 0.000
#> GSM918597     3  0.6215     0.7063 0.000 0.208 0.664 0.128
#> GSM918598     2  0.0000     0.9131 0.000 1.000 0.000 0.000
#> GSM918599     2  0.7387     0.4519 0.000 0.520 0.224 0.256
#> GSM918604     3  0.0000     0.8672 0.000 0.000 1.000 0.000
#> GSM918605     2  0.2760     0.8345 0.000 0.872 0.000 0.128
#> GSM918613     2  0.0000     0.9131 0.000 1.000 0.000 0.000
#> GSM918623     2  0.2760     0.9060 0.000 0.872 0.000 0.128
#> GSM918626     3  0.7005     0.5687 0.000 0.172 0.572 0.256
#> GSM918627     3  0.6790     0.5888 0.000 0.296 0.576 0.128
#> GSM918633     2  0.0000     0.9131 0.000 1.000 0.000 0.000
#> GSM918634     3  0.6181     0.7095 0.000 0.204 0.668 0.128
#> GSM918635     2  0.2760     0.9060 0.000 0.872 0.000 0.128
#> GSM918645     2  0.0188     0.9119 0.000 0.996 0.000 0.004
#> GSM918646     2  0.3649     0.8717 0.000 0.796 0.000 0.204
#> GSM918648     2  0.2760     0.9060 0.000 0.872 0.000 0.128
#> GSM918650     2  0.0000     0.9131 0.000 1.000 0.000 0.000
#> GSM918652     2  0.4072     0.8366 0.000 0.748 0.000 0.252
#> GSM918653     2  0.2760     0.9060 0.000 0.872 0.000 0.128
#> GSM918622     3  0.6729     0.6087 0.000 0.284 0.588 0.128
#> GSM918583     2  0.2760     0.9060 0.000 0.872 0.000 0.128
#> GSM918585     2  0.2760     0.9060 0.000 0.872 0.000 0.128
#> GSM918595     2  0.0707     0.9055 0.000 0.980 0.000 0.020
#> GSM918596     3  0.2760     0.8191 0.000 0.000 0.872 0.128
#> GSM918602     3  0.5800     0.7382 0.000 0.164 0.708 0.128
#> GSM918617     3  0.7815     0.0754 0.000 0.352 0.392 0.256
#> GSM918630     2  0.2760     0.9060 0.000 0.872 0.000 0.128
#> GSM918631     2  0.2760     0.9060 0.000 0.872 0.000 0.128
#> GSM918618     4  0.4103     0.9726 0.256 0.000 0.000 0.744
#> GSM918644     4  0.4103     0.9726 0.256 0.000 0.000 0.744

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>           class entropy silhouette    p1    p2    p3    p4    p5
#> GSM918603     4  0.0703     0.9691 0.024 0.000 0.000 0.976 0.000
#> GSM918641     4  0.0703     0.9691 0.024 0.000 0.000 0.976 0.000
#> GSM918580     4  0.0703     0.9691 0.024 0.000 0.000 0.976 0.000
#> GSM918593     4  0.0703     0.9691 0.024 0.000 0.000 0.976 0.000
#> GSM918625     4  0.0703     0.9691 0.024 0.000 0.000 0.976 0.000
#> GSM918638     4  0.0703     0.9691 0.024 0.000 0.000 0.976 0.000
#> GSM918642     4  0.0703     0.9691 0.024 0.000 0.000 0.976 0.000
#> GSM918643     4  0.0703     0.9691 0.024 0.000 0.000 0.976 0.000
#> GSM918619     1  0.0000     1.0000 1.000 0.000 0.000 0.000 0.000
#> GSM918621     1  0.0000     1.0000 1.000 0.000 0.000 0.000 0.000
#> GSM918582     1  0.0000     1.0000 1.000 0.000 0.000 0.000 0.000
#> GSM918649     1  0.0000     1.0000 1.000 0.000 0.000 0.000 0.000
#> GSM918651     1  0.0000     1.0000 1.000 0.000 0.000 0.000 0.000
#> GSM918607     1  0.0000     1.0000 1.000 0.000 0.000 0.000 0.000
#> GSM918609     1  0.0000     1.0000 1.000 0.000 0.000 0.000 0.000
#> GSM918608     1  0.0000     1.0000 1.000 0.000 0.000 0.000 0.000
#> GSM918606     1  0.0000     1.0000 1.000 0.000 0.000 0.000 0.000
#> GSM918620     1  0.0000     1.0000 1.000 0.000 0.000 0.000 0.000
#> GSM918628     4  0.3895     0.5658 0.320 0.000 0.000 0.680 0.000
#> GSM918586     3  0.0000     0.9976 0.000 0.000 1.000 0.000 0.000
#> GSM918594     3  0.0162     0.9969 0.000 0.000 0.996 0.000 0.004
#> GSM918600     3  0.0000     0.9976 0.000 0.000 1.000 0.000 0.000
#> GSM918601     3  0.0162     0.9969 0.000 0.000 0.996 0.000 0.004
#> GSM918612     3  0.0000     0.9976 0.000 0.000 1.000 0.000 0.000
#> GSM918614     3  0.0000     0.9976 0.000 0.000 1.000 0.000 0.000
#> GSM918629     3  0.0000     0.9976 0.000 0.000 1.000 0.000 0.000
#> GSM918587     5  0.5880     0.5153 0.000 0.000 0.172 0.228 0.600
#> GSM918588     3  0.0000     0.9976 0.000 0.000 1.000 0.000 0.000
#> GSM918589     3  0.0000     0.9976 0.000 0.000 1.000 0.000 0.000
#> GSM918611     3  0.0162     0.9955 0.000 0.000 0.996 0.000 0.004
#> GSM918624     3  0.0162     0.9969 0.000 0.000 0.996 0.000 0.004
#> GSM918637     3  0.0162     0.9969 0.000 0.000 0.996 0.000 0.004
#> GSM918639     3  0.0162     0.9969 0.000 0.000 0.996 0.000 0.004
#> GSM918640     3  0.0162     0.9969 0.000 0.000 0.996 0.000 0.004
#> GSM918636     3  0.0000     0.9976 0.000 0.000 1.000 0.000 0.000
#> GSM918590     5  0.0324     0.7850 0.000 0.004 0.000 0.004 0.992
#> GSM918610     2  0.4132     0.7807 0.000 0.720 0.000 0.020 0.260
#> GSM918615     2  0.4445     0.7674 0.000 0.676 0.000 0.024 0.300
#> GSM918616     5  0.3684     0.6232 0.000 0.000 0.280 0.000 0.720
#> GSM918632     2  0.0000     0.7690 0.000 1.000 0.000 0.000 0.000
#> GSM918647     2  0.0000     0.7690 0.000 1.000 0.000 0.000 0.000
#> GSM918578     2  0.4132     0.7807 0.000 0.720 0.000 0.020 0.260
#> GSM918579     2  0.0566     0.7669 0.000 0.984 0.000 0.004 0.012
#> GSM918581     2  0.3970     0.7854 0.000 0.744 0.000 0.020 0.236
#> GSM918584     2  0.4445     0.7684 0.000 0.676 0.000 0.024 0.300
#> GSM918591     2  0.4132     0.7807 0.000 0.720 0.000 0.020 0.260
#> GSM918592     2  0.4132     0.7807 0.000 0.720 0.000 0.020 0.260
#> GSM918597     5  0.0794     0.7913 0.000 0.000 0.028 0.000 0.972
#> GSM918598     2  0.4132     0.7807 0.000 0.720 0.000 0.020 0.260
#> GSM918599     5  0.3707     0.6892 0.000 0.284 0.000 0.000 0.716
#> GSM918604     3  0.0162     0.9955 0.000 0.000 0.996 0.000 0.004
#> GSM918605     5  0.0000     0.7894 0.000 0.000 0.000 0.000 1.000
#> GSM918613     2  0.4465     0.7656 0.000 0.672 0.000 0.024 0.304
#> GSM918623     2  0.0000     0.7690 0.000 1.000 0.000 0.000 0.000
#> GSM918626     5  0.3561     0.7051 0.000 0.260 0.000 0.000 0.740
#> GSM918627     5  0.0000     0.7894 0.000 0.000 0.000 0.000 1.000
#> GSM918633     2  0.4243     0.7803 0.000 0.712 0.000 0.024 0.264
#> GSM918634     5  0.0290     0.7899 0.000 0.000 0.008 0.000 0.992
#> GSM918635     2  0.0000     0.7690 0.000 1.000 0.000 0.000 0.000
#> GSM918645     2  0.4798     0.6722 0.000 0.580 0.000 0.024 0.396
#> GSM918646     2  0.4201    -0.0415 0.000 0.592 0.000 0.000 0.408
#> GSM918648     2  0.0000     0.7690 0.000 1.000 0.000 0.000 0.000
#> GSM918650     2  0.4315     0.7780 0.000 0.700 0.000 0.024 0.276
#> GSM918652     5  0.3534     0.7083 0.000 0.256 0.000 0.000 0.744
#> GSM918653     2  0.0566     0.7669 0.000 0.984 0.000 0.004 0.012
#> GSM918622     5  0.0000     0.7894 0.000 0.000 0.000 0.000 1.000
#> GSM918583     2  0.1914     0.7669 0.000 0.924 0.000 0.016 0.060
#> GSM918585     2  0.0162     0.7687 0.000 0.996 0.000 0.004 0.000
#> GSM918595     2  0.4717     0.6338 0.000 0.584 0.000 0.020 0.396
#> GSM918596     5  0.3612     0.6348 0.000 0.000 0.268 0.000 0.732
#> GSM918602     5  0.1369     0.7770 0.000 0.008 0.028 0.008 0.956
#> GSM918617     5  0.3707     0.6893 0.000 0.284 0.000 0.000 0.716
#> GSM918630     2  0.2011     0.7175 0.000 0.908 0.000 0.004 0.088
#> GSM918631     2  0.1205     0.7548 0.000 0.956 0.000 0.004 0.040
#> GSM918618     4  0.0703     0.9691 0.024 0.000 0.000 0.976 0.000
#> GSM918644     4  0.0703     0.9691 0.024 0.000 0.000 0.976 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
#> GSM918603     4  0.0146     0.9535 0.004 0.000 0.000 0.996 0.000 0.000
#> GSM918641     4  0.0146     0.9535 0.004 0.000 0.000 0.996 0.000 0.000
#> GSM918580     4  0.0146     0.9535 0.004 0.000 0.000 0.996 0.000 0.000
#> GSM918593     4  0.0146     0.9535 0.004 0.000 0.000 0.996 0.000 0.000
#> GSM918625     4  0.0146     0.9535 0.004 0.000 0.000 0.996 0.000 0.000
#> GSM918638     4  0.0146     0.9535 0.004 0.000 0.000 0.996 0.000 0.000
#> GSM918642     4  0.0146     0.9535 0.004 0.000 0.000 0.996 0.000 0.000
#> GSM918643     4  0.0146     0.9535 0.004 0.000 0.000 0.996 0.000 0.000
#> GSM918619     1  0.0146     1.0000 0.996 0.000 0.000 0.004 0.000 0.000
#> GSM918621     1  0.0146     1.0000 0.996 0.000 0.000 0.004 0.000 0.000
#> GSM918582     1  0.0146     1.0000 0.996 0.000 0.000 0.004 0.000 0.000
#> GSM918649     1  0.0146     1.0000 0.996 0.000 0.000 0.004 0.000 0.000
#> GSM918651     1  0.0146     1.0000 0.996 0.000 0.000 0.004 0.000 0.000
#> GSM918607     1  0.0146     1.0000 0.996 0.000 0.000 0.004 0.000 0.000
#> GSM918609     1  0.0146     1.0000 0.996 0.000 0.000 0.004 0.000 0.000
#> GSM918608     1  0.0146     1.0000 0.996 0.000 0.000 0.004 0.000 0.000
#> GSM918606     1  0.0146     1.0000 0.996 0.000 0.000 0.004 0.000 0.000
#> GSM918620     1  0.0146     1.0000 0.996 0.000 0.000 0.004 0.000 0.000
#> GSM918628     4  0.4405     0.3986 0.368 0.000 0.000 0.604 0.020 0.008
#> GSM918586     3  0.0508     0.9647 0.000 0.000 0.984 0.000 0.004 0.012
#> GSM918594     3  0.1194     0.9604 0.004 0.000 0.956 0.000 0.008 0.032
#> GSM918600     3  0.0291     0.9661 0.000 0.000 0.992 0.000 0.004 0.004
#> GSM918601     3  0.1644     0.9536 0.004 0.000 0.932 0.000 0.012 0.052
#> GSM918612     3  0.0291     0.9669 0.000 0.000 0.992 0.000 0.004 0.004
#> GSM918614     3  0.0146     0.9664 0.000 0.000 0.996 0.000 0.000 0.004
#> GSM918629     3  0.0622     0.9664 0.000 0.000 0.980 0.000 0.008 0.012
#> GSM918587     5  0.5125     0.6516 0.000 0.012 0.136 0.076 0.720 0.056
#> GSM918588     3  0.0291     0.9661 0.000 0.000 0.992 0.000 0.004 0.004
#> GSM918589     3  0.0551     0.9641 0.000 0.000 0.984 0.004 0.004 0.008
#> GSM918611     3  0.1644     0.9354 0.000 0.000 0.932 0.004 0.052 0.012
#> GSM918624     3  0.1644     0.9536 0.004 0.000 0.932 0.000 0.012 0.052
#> GSM918637     3  0.1989     0.9435 0.004 0.000 0.916 0.000 0.028 0.052
#> GSM918639     3  0.1644     0.9536 0.004 0.000 0.932 0.000 0.012 0.052
#> GSM918640     3  0.1644     0.9536 0.004 0.000 0.932 0.000 0.012 0.052
#> GSM918636     3  0.0653     0.9632 0.000 0.000 0.980 0.004 0.004 0.012
#> GSM918590     5  0.4429     0.7047 0.000 0.140 0.000 0.000 0.716 0.144
#> GSM918610     2  0.0260     0.6056 0.000 0.992 0.000 0.000 0.000 0.008
#> GSM918615     2  0.4078     0.3936 0.000 0.656 0.000 0.000 0.024 0.320
#> GSM918616     5  0.4610     0.6875 0.004 0.016 0.156 0.000 0.732 0.092
#> GSM918632     2  0.3860    -0.0438 0.000 0.528 0.000 0.000 0.000 0.472
#> GSM918647     2  0.3860    -0.0421 0.000 0.528 0.000 0.000 0.000 0.472
#> GSM918578     2  0.0146     0.6057 0.000 0.996 0.000 0.000 0.000 0.004
#> GSM918579     6  0.2793     0.6704 0.000 0.200 0.000 0.000 0.000 0.800
#> GSM918581     2  0.0146     0.6056 0.000 0.996 0.000 0.000 0.000 0.004
#> GSM918584     2  0.3940     0.3636 0.000 0.640 0.000 0.000 0.012 0.348
#> GSM918591     2  0.0000     0.6064 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM918592     2  0.0000     0.6064 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM918597     5  0.1666     0.7962 0.000 0.020 0.008 0.000 0.936 0.036
#> GSM918598     2  0.0146     0.6057 0.000 0.996 0.000 0.000 0.000 0.004
#> GSM918599     6  0.3998    -0.2798 0.000 0.004 0.000 0.000 0.492 0.504
#> GSM918604     3  0.0909     0.9589 0.000 0.000 0.968 0.000 0.020 0.012
#> GSM918605     5  0.3193     0.7708 0.000 0.052 0.000 0.000 0.824 0.124
#> GSM918613     2  0.4170     0.4045 0.000 0.660 0.000 0.000 0.032 0.308
#> GSM918623     2  0.3854    -0.0254 0.000 0.536 0.000 0.000 0.000 0.464
#> GSM918626     5  0.1556     0.7777 0.000 0.000 0.000 0.000 0.920 0.080
#> GSM918627     5  0.1418     0.7968 0.000 0.032 0.000 0.000 0.944 0.024
#> GSM918633     2  0.2762     0.5215 0.000 0.804 0.000 0.000 0.000 0.196
#> GSM918634     5  0.2843     0.7871 0.000 0.036 0.000 0.000 0.848 0.116
#> GSM918635     2  0.3823     0.0295 0.000 0.564 0.000 0.000 0.000 0.436
#> GSM918645     2  0.5093     0.2378 0.000 0.528 0.000 0.000 0.084 0.388
#> GSM918646     6  0.4517     0.4320 0.000 0.060 0.000 0.000 0.292 0.648
#> GSM918648     2  0.3860    -0.0452 0.000 0.528 0.000 0.000 0.000 0.472
#> GSM918650     2  0.3101     0.4871 0.000 0.756 0.000 0.000 0.000 0.244
#> GSM918652     5  0.4319     0.4322 0.000 0.024 0.000 0.000 0.576 0.400
#> GSM918653     6  0.2823     0.6672 0.000 0.204 0.000 0.000 0.000 0.796
#> GSM918622     5  0.1334     0.7967 0.000 0.032 0.000 0.000 0.948 0.020
#> GSM918583     6  0.3804     0.3992 0.000 0.336 0.000 0.000 0.008 0.656
#> GSM918585     6  0.3151     0.6101 0.000 0.252 0.000 0.000 0.000 0.748
#> GSM918595     2  0.2680     0.5245 0.000 0.868 0.000 0.000 0.076 0.056
#> GSM918596     5  0.2009     0.7936 0.000 0.000 0.024 0.000 0.908 0.068
#> GSM918602     5  0.4561     0.6911 0.004 0.176 0.020 0.000 0.732 0.068
#> GSM918617     5  0.3986     0.2023 0.000 0.004 0.000 0.000 0.532 0.464
#> GSM918630     6  0.2930     0.6541 0.000 0.124 0.000 0.000 0.036 0.840
#> GSM918631     6  0.2762     0.6713 0.000 0.196 0.000 0.000 0.000 0.804
#> GSM918618     4  0.0909     0.9361 0.000 0.000 0.000 0.968 0.020 0.012
#> GSM918644     4  0.0909     0.9361 0.000 0.000 0.000 0.968 0.020 0.012

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

consensus_heatmap(res, k = 2)

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

consensus_heatmap(res, k = 3)

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

consensus_heatmap(res, k = 4)

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

consensus_heatmap(res, k = 5)

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

consensus_heatmap(res, k = 6)

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

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

membership_heatmap(res, k = 2)

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

membership_heatmap(res, k = 3)

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

membership_heatmap(res, k = 4)

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

membership_heatmap(res, k = 5)

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

membership_heatmap(res, k = 6)

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

As soon as we have had the classes for columns, we can look for signatures which are significantly different between classes which can be candidate marks for certain classes. Following are the heatmaps for signatures.

Signature heatmaps where rows are scaled:

get_signatures(res, k = 2)

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

get_signatures(res, k = 3)

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

get_signatures(res, k = 4)

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

get_signatures(res, k = 5)

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

get_signatures(res, k = 6)

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

Signature heatmaps where rows are not scaled:

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

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

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

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

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

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

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

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

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

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

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk SD-skmeans-signature_compare

get_signature() returns a data frame invisibly. TO get the list of signatures, the function call should be assigned to a variable explicitly. In following code, if plot argument is set to FALSE, no heatmap is plotted while only the differential analysis is performed.

# code only for demonstration
tb = get_signature(res, k = ..., plot = FALSE)

An example of the output of tb is:

#>   which_row         fdr    mean_1    mean_2 scaled_mean_1 scaled_mean_2 km
#> 1        38 0.042760348  8.373488  9.131774    -0.5533452     0.5164555  1
#> 2        40 0.018707592  7.106213  8.469186    -0.6173731     0.5762149  1
#> 3        55 0.019134737 10.221463 11.207825    -0.6159697     0.5749050  1
#> 4        59 0.006059896  5.921854  7.869574    -0.6899429     0.6439467  1
#> 5        60 0.018055526  8.928898 10.211722    -0.6204761     0.5791110  1
#> 6        98 0.009384629 15.714769 14.887706     0.6635654    -0.6193277  2
...

The columns in tb are:

  1. which_row: row indices corresponding to the input matrix.
  2. fdr: FDR for the differential test.
  3. mean_x: The mean value in group x.
  4. scaled_mean_x: The mean value in group x after rows are scaled.
  5. km: Row groups if k-means clustering is applied to rows.

UMAP plot which shows how samples are separated.

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

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

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

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

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

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

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

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

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

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

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk SD-skmeans-collect-classes

Test correlation between subgroups and known annotations. If the known annotation is numeric, one-way ANOVA test is applied, and if the known annotation is discrete, chi-squared contingency table test is applied.

test_to_known_factors(res)
#>             n disease.state(p) gender(p) other(p) k
#> SD:skmeans 75         3.63e-13   0.32471 1.26e-02 2
#> SD:skmeans 74         5.75e-19   0.00253 1.36e-04 3
#> SD:skmeans 74         3.99e-31   0.00603 4.43e-07 4
#> SD:skmeans 75         3.61e-34   0.01008 1.26e-06 5
#> SD:skmeans 60         1.73e-25   0.00706 2.23e-05 6

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


SD: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 76 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 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-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.592           0.895       0.931         0.4011 0.620   0.620
#> 3 3 0.634           0.889       0.926         0.1254 0.969   0.950
#> 4 4 0.877           0.857       0.948         0.4535 0.735   0.557
#> 5 5 0.869           0.839       0.937         0.2016 0.855   0.585
#> 6 6 0.851           0.826       0.899         0.0427 0.942   0.741

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

suggest_best_k(res)
#> [1] 4

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

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

show/hide code output

cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#>           class entropy silhouette    p1    p2
#> GSM918603     1   0.000      0.978 1.000 0.000
#> GSM918641     1   0.000      0.978 1.000 0.000
#> GSM918580     1   0.876      0.479 0.704 0.296
#> GSM918593     1   0.000      0.978 1.000 0.000
#> GSM918625     1   0.224      0.940 0.964 0.036
#> GSM918638     1   0.000      0.978 1.000 0.000
#> GSM918642     1   0.000      0.978 1.000 0.000
#> GSM918643     1   0.000      0.978 1.000 0.000
#> GSM918619     1   0.000      0.978 1.000 0.000
#> GSM918621     1   0.000      0.978 1.000 0.000
#> GSM918582     1   0.000      0.978 1.000 0.000
#> GSM918649     1   0.000      0.978 1.000 0.000
#> GSM918651     1   0.000      0.978 1.000 0.000
#> GSM918607     1   0.000      0.978 1.000 0.000
#> GSM918609     1   0.000      0.978 1.000 0.000
#> GSM918608     1   0.000      0.978 1.000 0.000
#> GSM918606     1   0.000      0.978 1.000 0.000
#> GSM918620     1   0.000      0.978 1.000 0.000
#> GSM918628     2   0.998      0.306 0.476 0.524
#> GSM918586     2   0.697      0.860 0.188 0.812
#> GSM918594     2   0.697      0.860 0.188 0.812
#> GSM918600     2   0.697      0.860 0.188 0.812
#> GSM918601     2   0.697      0.860 0.188 0.812
#> GSM918612     2   0.706      0.856 0.192 0.808
#> GSM918614     2   0.697      0.860 0.188 0.812
#> GSM918629     2   0.697      0.860 0.188 0.812
#> GSM918587     2   0.697      0.860 0.188 0.812
#> GSM918588     2   0.697      0.860 0.188 0.812
#> GSM918589     2   0.697      0.860 0.188 0.812
#> GSM918611     2   0.697      0.860 0.188 0.812
#> GSM918624     2   0.697      0.860 0.188 0.812
#> GSM918637     2   0.697      0.860 0.188 0.812
#> GSM918639     2   0.697      0.860 0.188 0.812
#> GSM918640     2   0.697      0.860 0.188 0.812
#> GSM918636     2   0.697      0.860 0.188 0.812
#> GSM918590     2   0.163      0.905 0.024 0.976
#> GSM918610     2   0.000      0.905 0.000 1.000
#> GSM918615     2   0.000      0.905 0.000 1.000
#> GSM918616     2   0.224      0.905 0.036 0.964
#> GSM918632     2   0.000      0.905 0.000 1.000
#> GSM918647     2   0.000      0.905 0.000 1.000
#> GSM918578     2   0.000      0.905 0.000 1.000
#> GSM918579     2   0.000      0.905 0.000 1.000
#> GSM918581     2   0.000      0.905 0.000 1.000
#> GSM918584     2   0.000      0.905 0.000 1.000
#> GSM918591     2   0.000      0.905 0.000 1.000
#> GSM918592     2   0.000      0.905 0.000 1.000
#> GSM918597     2   0.697      0.860 0.188 0.812
#> GSM918598     2   0.000      0.905 0.000 1.000
#> GSM918599     2   0.000      0.905 0.000 1.000
#> GSM918604     2   0.697      0.860 0.188 0.812
#> GSM918605     2   0.000      0.905 0.000 1.000
#> GSM918613     2   0.224      0.905 0.036 0.964
#> GSM918623     2   0.000      0.905 0.000 1.000
#> GSM918626     2   0.697      0.860 0.188 0.812
#> GSM918627     2   0.224      0.905 0.036 0.964
#> GSM918633     2   0.456      0.889 0.096 0.904
#> GSM918634     2   0.204      0.905 0.032 0.968
#> GSM918635     2   0.000      0.905 0.000 1.000
#> GSM918645     2   0.000      0.905 0.000 1.000
#> GSM918646     2   0.000      0.905 0.000 1.000
#> GSM918648     2   0.000      0.905 0.000 1.000
#> GSM918650     2   0.000      0.905 0.000 1.000
#> GSM918652     2   0.000      0.905 0.000 1.000
#> GSM918653     2   0.000      0.905 0.000 1.000
#> GSM918622     2   0.224      0.905 0.036 0.964
#> GSM918583     2   0.000      0.905 0.000 1.000
#> GSM918585     2   0.000      0.905 0.000 1.000
#> GSM918595     2   0.204      0.904 0.032 0.968
#> GSM918596     2   0.552      0.882 0.128 0.872
#> GSM918602     2   0.653      0.868 0.168 0.832
#> GSM918617     2   0.204      0.905 0.032 0.968
#> GSM918630     2   0.000      0.905 0.000 1.000
#> GSM918631     2   0.000      0.905 0.000 1.000
#> GSM918618     1   0.000      0.978 1.000 0.000
#> GSM918644     2   0.697      0.860 0.188 0.812

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>           class entropy silhouette    p1    p2    p3
#> GSM918603     3   0.000      1.000 0.000 0.000 1.000
#> GSM918641     3   0.000      1.000 0.000 0.000 1.000
#> GSM918580     3   0.000      1.000 0.000 0.000 1.000
#> GSM918593     3   0.000      1.000 0.000 0.000 1.000
#> GSM918625     3   0.000      1.000 0.000 0.000 1.000
#> GSM918638     3   0.000      1.000 0.000 0.000 1.000
#> GSM918642     3   0.000      1.000 0.000 0.000 1.000
#> GSM918643     3   0.000      1.000 0.000 0.000 1.000
#> GSM918619     1   0.000      0.952 1.000 0.000 0.000
#> GSM918621     1   0.000      0.952 1.000 0.000 0.000
#> GSM918582     1   0.000      0.952 1.000 0.000 0.000
#> GSM918649     1   0.000      0.952 1.000 0.000 0.000
#> GSM918651     1   0.000      0.952 1.000 0.000 0.000
#> GSM918607     1   0.000      0.952 1.000 0.000 0.000
#> GSM918609     1   0.000      0.952 1.000 0.000 0.000
#> GSM918608     1   0.000      0.952 1.000 0.000 0.000
#> GSM918606     1   0.000      0.952 1.000 0.000 0.000
#> GSM918620     1   0.000      0.952 1.000 0.000 0.000
#> GSM918628     2   0.597      0.628 0.364 0.636 0.000
#> GSM918586     2   0.460      0.852 0.204 0.796 0.000
#> GSM918594     2   0.460      0.852 0.204 0.796 0.000
#> GSM918600     2   0.460      0.852 0.204 0.796 0.000
#> GSM918601     2   0.460      0.852 0.204 0.796 0.000
#> GSM918612     2   0.460      0.852 0.204 0.796 0.000
#> GSM918614     2   0.460      0.852 0.204 0.796 0.000
#> GSM918629     2   0.460      0.852 0.204 0.796 0.000
#> GSM918587     2   0.460      0.852 0.204 0.796 0.000
#> GSM918588     2   0.460      0.852 0.204 0.796 0.000
#> GSM918589     2   0.460      0.852 0.204 0.796 0.000
#> GSM918611     2   0.460      0.852 0.204 0.796 0.000
#> GSM918624     2   0.460      0.852 0.204 0.796 0.000
#> GSM918637     2   0.460      0.852 0.204 0.796 0.000
#> GSM918639     2   0.460      0.852 0.204 0.796 0.000
#> GSM918640     2   0.460      0.852 0.204 0.796 0.000
#> GSM918636     2   0.460      0.852 0.204 0.796 0.000
#> GSM918590     2   0.103      0.899 0.024 0.976 0.000
#> GSM918610     2   0.000      0.899 0.000 1.000 0.000
#> GSM918615     2   0.000      0.899 0.000 1.000 0.000
#> GSM918616     2   0.141      0.898 0.036 0.964 0.000
#> GSM918632     2   0.000      0.899 0.000 1.000 0.000
#> GSM918647     2   0.000      0.899 0.000 1.000 0.000
#> GSM918578     2   0.000      0.899 0.000 1.000 0.000
#> GSM918579     2   0.000      0.899 0.000 1.000 0.000
#> GSM918581     2   0.000      0.899 0.000 1.000 0.000
#> GSM918584     2   0.000      0.899 0.000 1.000 0.000
#> GSM918591     2   0.000      0.899 0.000 1.000 0.000
#> GSM918592     2   0.000      0.899 0.000 1.000 0.000
#> GSM918597     2   0.460      0.852 0.204 0.796 0.000
#> GSM918598     2   0.000      0.899 0.000 1.000 0.000
#> GSM918599     2   0.000      0.899 0.000 1.000 0.000
#> GSM918604     2   0.460      0.852 0.204 0.796 0.000
#> GSM918605     2   0.000      0.899 0.000 1.000 0.000
#> GSM918613     2   0.141      0.898 0.036 0.964 0.000
#> GSM918623     2   0.000      0.899 0.000 1.000 0.000
#> GSM918626     2   0.460      0.852 0.204 0.796 0.000
#> GSM918627     2   0.141      0.898 0.036 0.964 0.000
#> GSM918633     2   0.319      0.879 0.112 0.888 0.000
#> GSM918634     2   0.129      0.898 0.032 0.968 0.000
#> GSM918635     2   0.000      0.899 0.000 1.000 0.000
#> GSM918645     2   0.000      0.899 0.000 1.000 0.000
#> GSM918646     2   0.000      0.899 0.000 1.000 0.000
#> GSM918648     2   0.000      0.899 0.000 1.000 0.000
#> GSM918650     2   0.000      0.899 0.000 1.000 0.000
#> GSM918652     2   0.000      0.899 0.000 1.000 0.000
#> GSM918653     2   0.000      0.899 0.000 1.000 0.000
#> GSM918622     2   0.141      0.898 0.036 0.964 0.000
#> GSM918583     2   0.000      0.899 0.000 1.000 0.000
#> GSM918585     2   0.000      0.899 0.000 1.000 0.000
#> GSM918595     2   0.141      0.897 0.036 0.964 0.000
#> GSM918596     2   0.382      0.871 0.148 0.852 0.000
#> GSM918602     2   0.460      0.852 0.204 0.796 0.000
#> GSM918617     2   0.129      0.898 0.032 0.968 0.000
#> GSM918630     2   0.000      0.899 0.000 1.000 0.000
#> GSM918631     2   0.000      0.899 0.000 1.000 0.000
#> GSM918618     1   0.630      0.146 0.516 0.000 0.484
#> GSM918644     2   0.460      0.852 0.204 0.796 0.000

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM918603     4  0.0000      1.000 0.000 0.000 0.000 1.000
#> GSM918641     4  0.0000      1.000 0.000 0.000 0.000 1.000
#> GSM918580     4  0.0000      1.000 0.000 0.000 0.000 1.000
#> GSM918593     4  0.0000      1.000 0.000 0.000 0.000 1.000
#> GSM918625     4  0.0000      1.000 0.000 0.000 0.000 1.000
#> GSM918638     4  0.0000      1.000 0.000 0.000 0.000 1.000
#> GSM918642     4  0.0000      1.000 0.000 0.000 0.000 1.000
#> GSM918643     4  0.0000      1.000 0.000 0.000 0.000 1.000
#> GSM918619     1  0.0000      0.925 1.000 0.000 0.000 0.000
#> GSM918621     1  0.0000      0.925 1.000 0.000 0.000 0.000
#> GSM918582     1  0.0000      0.925 1.000 0.000 0.000 0.000
#> GSM918649     1  0.0000      0.925 1.000 0.000 0.000 0.000
#> GSM918651     1  0.0000      0.925 1.000 0.000 0.000 0.000
#> GSM918607     1  0.0000      0.925 1.000 0.000 0.000 0.000
#> GSM918609     1  0.0000      0.925 1.000 0.000 0.000 0.000
#> GSM918608     1  0.0000      0.925 1.000 0.000 0.000 0.000
#> GSM918606     1  0.0000      0.925 1.000 0.000 0.000 0.000
#> GSM918620     1  0.0000      0.925 1.000 0.000 0.000 0.000
#> GSM918628     1  0.6906      0.153 0.484 0.408 0.108 0.000
#> GSM918586     3  0.0000      0.871 0.000 0.000 1.000 0.000
#> GSM918594     3  0.0000      0.871 0.000 0.000 1.000 0.000
#> GSM918600     3  0.0000      0.871 0.000 0.000 1.000 0.000
#> GSM918601     3  0.0000      0.871 0.000 0.000 1.000 0.000
#> GSM918612     3  0.0000      0.871 0.000 0.000 1.000 0.000
#> GSM918614     3  0.0000      0.871 0.000 0.000 1.000 0.000
#> GSM918629     3  0.4994      0.131 0.000 0.480 0.520 0.000
#> GSM918587     2  0.3219      0.771 0.000 0.836 0.164 0.000
#> GSM918588     3  0.0000      0.871 0.000 0.000 1.000 0.000
#> GSM918589     3  0.0000      0.871 0.000 0.000 1.000 0.000
#> GSM918611     3  0.0000      0.871 0.000 0.000 1.000 0.000
#> GSM918624     3  0.0000      0.871 0.000 0.000 1.000 0.000
#> GSM918637     3  0.0000      0.871 0.000 0.000 1.000 0.000
#> GSM918639     3  0.0000      0.871 0.000 0.000 1.000 0.000
#> GSM918640     3  0.0000      0.871 0.000 0.000 1.000 0.000
#> GSM918636     3  0.4804      0.398 0.000 0.384 0.616 0.000
#> GSM918590     2  0.0336      0.942 0.000 0.992 0.008 0.000
#> GSM918610     2  0.0000      0.945 0.000 1.000 0.000 0.000
#> GSM918615     2  0.0336      0.942 0.000 0.992 0.008 0.000
#> GSM918616     2  0.2814      0.816 0.000 0.868 0.132 0.000
#> GSM918632     2  0.0000      0.945 0.000 1.000 0.000 0.000
#> GSM918647     2  0.0000      0.945 0.000 1.000 0.000 0.000
#> GSM918578     2  0.0000      0.945 0.000 1.000 0.000 0.000
#> GSM918579     2  0.0000      0.945 0.000 1.000 0.000 0.000
#> GSM918581     2  0.0000      0.945 0.000 1.000 0.000 0.000
#> GSM918584     2  0.0000      0.945 0.000 1.000 0.000 0.000
#> GSM918591     2  0.0000      0.945 0.000 1.000 0.000 0.000
#> GSM918592     2  0.0000      0.945 0.000 1.000 0.000 0.000
#> GSM918597     3  0.2081      0.795 0.000 0.084 0.916 0.000
#> GSM918598     2  0.0000      0.945 0.000 1.000 0.000 0.000
#> GSM918599     2  0.0000      0.945 0.000 1.000 0.000 0.000
#> GSM918604     3  0.4898      0.323 0.000 0.416 0.584 0.000
#> GSM918605     2  0.0336      0.942 0.000 0.992 0.008 0.000
#> GSM918613     2  0.0336      0.942 0.000 0.992 0.008 0.000
#> GSM918623     2  0.0000      0.945 0.000 1.000 0.000 0.000
#> GSM918626     2  0.2704      0.822 0.000 0.876 0.124 0.000
#> GSM918627     2  0.0469      0.940 0.000 0.988 0.012 0.000
#> GSM918633     2  0.0000      0.945 0.000 1.000 0.000 0.000
#> GSM918634     2  0.1118      0.922 0.000 0.964 0.036 0.000
#> GSM918635     2  0.0000      0.945 0.000 1.000 0.000 0.000
#> GSM918645     2  0.0336      0.942 0.000 0.992 0.008 0.000
#> GSM918646     2  0.0000      0.945 0.000 1.000 0.000 0.000
#> GSM918648     2  0.0000      0.945 0.000 1.000 0.000 0.000
#> GSM918650     2  0.0000      0.945 0.000 1.000 0.000 0.000
#> GSM918652     2  0.0336      0.942 0.000 0.992 0.008 0.000
#> GSM918653     2  0.0000      0.945 0.000 1.000 0.000 0.000
#> GSM918622     2  0.0469      0.940 0.000 0.988 0.012 0.000
#> GSM918583     2  0.0000      0.945 0.000 1.000 0.000 0.000
#> GSM918585     2  0.0000      0.945 0.000 1.000 0.000 0.000
#> GSM918595     2  0.4916      0.246 0.000 0.576 0.424 0.000
#> GSM918596     2  0.4697      0.424 0.000 0.644 0.356 0.000
#> GSM918602     2  0.0592      0.937 0.000 0.984 0.016 0.000
#> GSM918617     2  0.0469      0.940 0.000 0.988 0.012 0.000
#> GSM918630     2  0.0000      0.945 0.000 1.000 0.000 0.000
#> GSM918631     2  0.0000      0.945 0.000 1.000 0.000 0.000
#> GSM918618     3  0.3542      0.764 0.060 0.000 0.864 0.076
#> GSM918644     2  0.7523     -0.197 0.000 0.416 0.400 0.184

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>           class entropy silhouette    p1    p2    p3    p4    p5
#> GSM918603     4   0.000      1.000 0.000 0.000 0.000 1.000 0.000
#> GSM918641     4   0.000      1.000 0.000 0.000 0.000 1.000 0.000
#> GSM918580     4   0.000      1.000 0.000 0.000 0.000 1.000 0.000
#> GSM918593     4   0.000      1.000 0.000 0.000 0.000 1.000 0.000
#> GSM918625     4   0.000      1.000 0.000 0.000 0.000 1.000 0.000
#> GSM918638     4   0.000      1.000 0.000 0.000 0.000 1.000 0.000
#> GSM918642     4   0.000      1.000 0.000 0.000 0.000 1.000 0.000
#> GSM918643     4   0.000      1.000 0.000 0.000 0.000 1.000 0.000
#> GSM918619     1   0.000      0.964 1.000 0.000 0.000 0.000 0.000
#> GSM918621     1   0.000      0.964 1.000 0.000 0.000 0.000 0.000
#> GSM918582     1   0.000      0.964 1.000 0.000 0.000 0.000 0.000
#> GSM918649     1   0.000      0.964 1.000 0.000 0.000 0.000 0.000
#> GSM918651     1   0.000      0.964 1.000 0.000 0.000 0.000 0.000
#> GSM918607     1   0.000      0.964 1.000 0.000 0.000 0.000 0.000
#> GSM918609     1   0.000      0.964 1.000 0.000 0.000 0.000 0.000
#> GSM918608     1   0.000      0.964 1.000 0.000 0.000 0.000 0.000
#> GSM918606     1   0.000      0.964 1.000 0.000 0.000 0.000 0.000
#> GSM918620     1   0.000      0.964 1.000 0.000 0.000 0.000 0.000
#> GSM918628     1   0.366      0.582 0.724 0.000 0.276 0.000 0.000
#> GSM918586     3   0.000      0.948 0.000 0.000 1.000 0.000 0.000
#> GSM918594     3   0.000      0.948 0.000 0.000 1.000 0.000 0.000
#> GSM918600     3   0.000      0.948 0.000 0.000 1.000 0.000 0.000
#> GSM918601     3   0.000      0.948 0.000 0.000 1.000 0.000 0.000
#> GSM918612     3   0.000      0.948 0.000 0.000 1.000 0.000 0.000
#> GSM918614     3   0.000      0.948 0.000 0.000 1.000 0.000 0.000
#> GSM918629     3   0.382      0.542 0.000 0.000 0.696 0.000 0.304
#> GSM918587     5   0.382      0.513 0.000 0.000 0.304 0.000 0.696
#> GSM918588     3   0.000      0.948 0.000 0.000 1.000 0.000 0.000
#> GSM918589     3   0.000      0.948 0.000 0.000 1.000 0.000 0.000
#> GSM918611     3   0.000      0.948 0.000 0.000 1.000 0.000 0.000
#> GSM918624     3   0.000      0.948 0.000 0.000 1.000 0.000 0.000
#> GSM918637     3   0.000      0.948 0.000 0.000 1.000 0.000 0.000
#> GSM918639     3   0.000      0.948 0.000 0.000 1.000 0.000 0.000
#> GSM918640     3   0.000      0.948 0.000 0.000 1.000 0.000 0.000
#> GSM918636     3   0.000      0.948 0.000 0.000 1.000 0.000 0.000
#> GSM918590     5   0.000      0.908 0.000 0.000 0.000 0.000 1.000
#> GSM918610     5   0.413      0.321 0.000 0.380 0.000 0.000 0.620
#> GSM918615     5   0.000      0.908 0.000 0.000 0.000 0.000 1.000
#> GSM918616     5   0.000      0.908 0.000 0.000 0.000 0.000 1.000
#> GSM918632     2   0.000      0.840 0.000 1.000 0.000 0.000 0.000
#> GSM918647     2   0.000      0.840 0.000 1.000 0.000 0.000 0.000
#> GSM918578     2   0.000      0.840 0.000 1.000 0.000 0.000 0.000
#> GSM918579     2   0.281      0.727 0.000 0.832 0.000 0.000 0.168
#> GSM918581     2   0.000      0.840 0.000 1.000 0.000 0.000 0.000
#> GSM918584     5   0.000      0.908 0.000 0.000 0.000 0.000 1.000
#> GSM918591     5   0.417      0.280 0.000 0.396 0.000 0.000 0.604
#> GSM918592     2   0.000      0.840 0.000 1.000 0.000 0.000 0.000
#> GSM918597     3   0.000      0.948 0.000 0.000 1.000 0.000 0.000
#> GSM918598     2   0.000      0.840 0.000 1.000 0.000 0.000 0.000
#> GSM918599     5   0.415      0.230 0.000 0.388 0.000 0.000 0.612
#> GSM918604     3   0.000      0.948 0.000 0.000 1.000 0.000 0.000
#> GSM918605     5   0.000      0.908 0.000 0.000 0.000 0.000 1.000
#> GSM918613     5   0.000      0.908 0.000 0.000 0.000 0.000 1.000
#> GSM918623     2   0.000      0.840 0.000 1.000 0.000 0.000 0.000
#> GSM918626     2   0.599      0.451 0.000 0.568 0.280 0.000 0.152
#> GSM918627     5   0.000      0.908 0.000 0.000 0.000 0.000 1.000
#> GSM918633     2   0.411      0.367 0.000 0.624 0.000 0.000 0.376
#> GSM918634     5   0.000      0.908 0.000 0.000 0.000 0.000 1.000
#> GSM918635     2   0.000      0.840 0.000 1.000 0.000 0.000 0.000
#> GSM918645     5   0.000      0.908 0.000 0.000 0.000 0.000 1.000
#> GSM918646     2   0.403      0.473 0.000 0.648 0.000 0.000 0.352
#> GSM918648     2   0.000      0.840 0.000 1.000 0.000 0.000 0.000
#> GSM918650     5   0.000      0.908 0.000 0.000 0.000 0.000 1.000
#> GSM918652     5   0.000      0.908 0.000 0.000 0.000 0.000 1.000
#> GSM918653     2   0.000      0.840 0.000 1.000 0.000 0.000 0.000
#> GSM918622     5   0.000      0.908 0.000 0.000 0.000 0.000 1.000
#> GSM918583     5   0.000      0.908 0.000 0.000 0.000 0.000 1.000
#> GSM918585     2   0.000      0.840 0.000 1.000 0.000 0.000 0.000
#> GSM918595     2   0.423      0.249 0.000 0.580 0.000 0.000 0.420
#> GSM918596     5   0.088      0.879 0.000 0.000 0.032 0.000 0.968
#> GSM918602     5   0.000      0.908 0.000 0.000 0.000 0.000 1.000
#> GSM918617     5   0.000      0.908 0.000 0.000 0.000 0.000 1.000
#> GSM918630     5   0.000      0.908 0.000 0.000 0.000 0.000 1.000
#> GSM918631     2   0.406      0.451 0.000 0.640 0.000 0.000 0.360
#> GSM918618     3   0.304      0.826 0.100 0.000 0.860 0.040 0.000
#> GSM918644     3   0.426      0.271 0.000 0.000 0.564 0.436 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
#> GSM918603     4  0.0000      1.000 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM918641     4  0.0000      1.000 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM918580     4  0.0000      1.000 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM918593     4  0.0000      1.000 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM918625     4  0.0000      1.000 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM918638     4  0.0000      1.000 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM918642     4  0.0000      1.000 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM918643     4  0.0000      1.000 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM918619     1  0.0000      1.000 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM918621     1  0.0000      1.000 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM918582     1  0.0000      1.000 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM918649     1  0.0000      1.000 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM918651     1  0.0000      1.000 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM918607     1  0.0000      1.000 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM918609     1  0.0000      1.000 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM918608     1  0.0000      1.000 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM918606     1  0.0000      1.000 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM918620     1  0.0000      1.000 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM918628     3  0.3774      0.349 0.408 0.000 0.592 0.000 0.000 0.000
#> GSM918586     3  0.3351      0.826 0.000 0.000 0.712 0.000 0.000 0.288
#> GSM918594     6  0.0000      1.000 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM918600     3  0.3351      0.826 0.000 0.000 0.712 0.000 0.000 0.288
#> GSM918601     6  0.0000      1.000 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM918612     3  0.3351      0.826 0.000 0.000 0.712 0.000 0.000 0.288
#> GSM918614     3  0.3351      0.826 0.000 0.000 0.712 0.000 0.000 0.288
#> GSM918629     3  0.3088      0.798 0.000 0.000 0.808 0.000 0.020 0.172
#> GSM918587     3  0.1908      0.636 0.000 0.000 0.900 0.000 0.096 0.004
#> GSM918588     3  0.3351      0.826 0.000 0.000 0.712 0.000 0.000 0.288
#> GSM918589     3  0.3351      0.826 0.000 0.000 0.712 0.000 0.000 0.288
#> GSM918611     3  0.2730      0.813 0.000 0.000 0.808 0.000 0.000 0.192
#> GSM918624     6  0.0000      1.000 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM918637     6  0.0000      1.000 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM918639     6  0.0000      1.000 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM918640     6  0.0000      1.000 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM918636     3  0.3351      0.826 0.000 0.000 0.712 0.000 0.000 0.288
#> GSM918590     5  0.0000      0.860 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM918610     5  0.3706      0.393 0.000 0.380 0.000 0.000 0.620 0.000
#> GSM918615     5  0.0000      0.860 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM918616     5  0.2300      0.826 0.000 0.000 0.144 0.000 0.856 0.000
#> GSM918632     2  0.0000      0.860 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM918647     2  0.0000      0.860 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM918578     2  0.0000      0.860 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM918579     2  0.2527      0.739 0.000 0.832 0.000 0.000 0.168 0.000
#> GSM918581     2  0.0000      0.860 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM918584     5  0.0000      0.860 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM918591     5  0.3747      0.373 0.000 0.396 0.000 0.000 0.604 0.000
#> GSM918592     2  0.0000      0.860 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM918597     3  0.0363      0.710 0.000 0.000 0.988 0.000 0.000 0.012
#> GSM918598     2  0.0000      0.860 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM918599     5  0.5353      0.117 0.000 0.388 0.112 0.000 0.500 0.000
#> GSM918604     3  0.2823      0.817 0.000 0.000 0.796 0.000 0.000 0.204
#> GSM918605     5  0.0000      0.860 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM918613     5  0.1501      0.844 0.000 0.000 0.076 0.000 0.924 0.000
#> GSM918623     2  0.0000      0.860 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM918626     3  0.0000      0.700 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM918627     5  0.3351      0.748 0.000 0.000 0.288 0.000 0.712 0.000
#> GSM918633     2  0.5257      0.139 0.000 0.524 0.104 0.000 0.372 0.000
#> GSM918634     5  0.0865      0.855 0.000 0.000 0.036 0.000 0.964 0.000
#> GSM918635     2  0.0000      0.860 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM918645     5  0.0000      0.860 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM918646     2  0.5124      0.526 0.000 0.620 0.232 0.000 0.148 0.000
#> GSM918648     2  0.0000      0.860 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM918650     5  0.0000      0.860 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM918652     5  0.0000      0.860 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM918653     2  0.0000      0.860 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM918622     5  0.3221      0.762 0.000 0.000 0.264 0.000 0.736 0.000
#> GSM918583     5  0.0000      0.860 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM918585     2  0.0000      0.860 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM918595     2  0.4018      0.167 0.000 0.580 0.008 0.000 0.412 0.000
#> GSM918596     5  0.2446      0.828 0.000 0.000 0.124 0.000 0.864 0.012
#> GSM918602     5  0.3330      0.751 0.000 0.000 0.284 0.000 0.716 0.000
#> GSM918617     5  0.2300      0.827 0.000 0.000 0.144 0.000 0.856 0.000
#> GSM918630     5  0.0000      0.860 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM918631     2  0.3940      0.479 0.000 0.640 0.012 0.000 0.348 0.000
#> GSM918618     3  0.3555      0.824 0.000 0.000 0.712 0.008 0.000 0.280
#> GSM918644     3  0.2214      0.772 0.000 0.000 0.888 0.016 0.000 0.096

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

consensus_heatmap(res, k = 2)

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

consensus_heatmap(res, k = 3)

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

consensus_heatmap(res, k = 4)

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

consensus_heatmap(res, k = 5)

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

consensus_heatmap(res, k = 6)

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

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

membership_heatmap(res, k = 2)

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

membership_heatmap(res, k = 3)

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

membership_heatmap(res, k = 4)

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

membership_heatmap(res, k = 5)

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

membership_heatmap(res, k = 6)

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

As soon as we have had the classes for columns, we can look for signatures which are significantly different between classes which can be candidate marks for certain classes. Following are the heatmaps for signatures.

Signature heatmaps where rows are scaled:

get_signatures(res, k = 2)

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

get_signatures(res, k = 3)

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

get_signatures(res, k = 4)

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

get_signatures(res, k = 5)

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

get_signatures(res, k = 6)

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

Signature heatmaps where rows are not scaled:

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

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

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

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

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

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

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

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

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

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

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk SD-pam-signature_compare

get_signature() returns a data frame invisibly. TO get the list of signatures, the function call should be assigned to a variable explicitly. In following code, if plot argument is set to FALSE, no heatmap is plotted while only the differential analysis is performed.

# code only for demonstration
tb = get_signature(res, k = ..., plot = FALSE)

An example of the output of tb is:

#>   which_row         fdr    mean_1    mean_2 scaled_mean_1 scaled_mean_2 km
#> 1        38 0.042760348  8.373488  9.131774    -0.5533452     0.5164555  1
#> 2        40 0.018707592  7.106213  8.469186    -0.6173731     0.5762149  1
#> 3        55 0.019134737 10.221463 11.207825    -0.6159697     0.5749050  1
#> 4        59 0.006059896  5.921854  7.869574    -0.6899429     0.6439467  1
#> 5        60 0.018055526  8.928898 10.211722    -0.6204761     0.5791110  1
#> 6        98 0.009384629 15.714769 14.887706     0.6635654    -0.6193277  2
...

The columns in tb are:

  1. which_row: row indices corresponding to the input matrix.
  2. fdr: FDR for the differential test.
  3. mean_x: The mean value in group x.
  4. scaled_mean_x: The mean value in group x after rows are scaled.
  5. km: Row groups if k-means clustering is applied to rows.

UMAP plot which shows how samples are separated.

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

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

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

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

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

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

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

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

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

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

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk SD-pam-collect-classes

Test correlation between subgroups and known annotations. If the known annotation is numeric, one-way ANOVA test is applied, and if the known annotation is discrete, chi-squared contingency table test is applied.

test_to_known_factors(res)
#>         n disease.state(p) gender(p) other(p) k
#> SD:pam 74         1.22e-14  0.008303 3.93e-04 2
#> SD:pam 75         3.73e-27  0.001598 2.19e-05 3
#> SD:pam 69         4.21e-35  0.000272 3.65e-06 4
#> SD:pam 67         1.32e-28  0.001657 1.33e-05 5
#> SD:pam 69         4.81e-31  0.003206 5.02e-05 6

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


SD: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 76 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 6.
#> 
#> Following methods can be applied to this 'ConsensusPartition' object:
#>  [1] "cola_report"             "collect_classes"         "collect_plots"          
#>  [4] "collect_stats"           "colnames"                "compare_signatures"     
#>  [7] "consensus_heatmap"       "dimension_reduction"     "functional_enrichment"  
#> [10] "get_anno_col"            "get_anno"                "get_classes"            
#> [13] "get_consensus"           "get_matrix"              "get_membership"         
#> [16] "get_param"               "get_signatures"          "get_stats"              
#> [19] "is_best_k"               "is_stable_k"             "membership_heatmap"     
#> [22] "ncol"                    "nrow"                    "plot_ecdf"              
#> [25] "rownames"                "select_partition_number" "show"                   
#> [28] "suggest_best_k"          "test_to_known_factors"

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

collect_plots(res)

plot of chunk 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 1.000           0.986       0.992         0.3969 0.595   0.595
#> 3 3 0.963           0.896       0.849         0.1651 1.000   1.000
#> 4 4 0.797           0.879       0.934         0.4679 0.659   0.457
#> 5 5 0.877           0.855       0.938         0.1542 0.843   0.543
#> 6 6 0.941           0.935       0.960         0.0218 0.975   0.885

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

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

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
#> GSM918603     1   0.204      0.968 0.968 0.032
#> GSM918641     1   0.204      0.968 0.968 0.032
#> GSM918580     1   0.204      0.968 0.968 0.032
#> GSM918593     1   0.204      0.968 0.968 0.032
#> GSM918625     1   0.204      0.968 0.968 0.032
#> GSM918638     1   0.204      0.968 0.968 0.032
#> GSM918642     1   0.204      0.968 0.968 0.032
#> GSM918643     1   0.204      0.968 0.968 0.032
#> GSM918619     1   0.000      0.968 1.000 0.000
#> GSM918621     1   0.000      0.968 1.000 0.000
#> GSM918582     1   0.000      0.968 1.000 0.000
#> GSM918649     1   0.000      0.968 1.000 0.000
#> GSM918651     1   0.000      0.968 1.000 0.000
#> GSM918607     1   0.000      0.968 1.000 0.000
#> GSM918609     1   0.000      0.968 1.000 0.000
#> GSM918608     1   0.000      0.968 1.000 0.000
#> GSM918606     1   0.000      0.968 1.000 0.000
#> GSM918620     1   0.000      0.968 1.000 0.000
#> GSM918628     1   0.204      0.968 0.968 0.032
#> GSM918586     2   0.000      1.000 0.000 1.000
#> GSM918594     2   0.000      1.000 0.000 1.000
#> GSM918600     2   0.000      1.000 0.000 1.000
#> GSM918601     2   0.000      1.000 0.000 1.000
#> GSM918612     2   0.000      1.000 0.000 1.000
#> GSM918614     2   0.000      1.000 0.000 1.000
#> GSM918629     2   0.000      1.000 0.000 1.000
#> GSM918587     2   0.000      1.000 0.000 1.000
#> GSM918588     2   0.000      1.000 0.000 1.000
#> GSM918589     2   0.000      1.000 0.000 1.000
#> GSM918611     2   0.000      1.000 0.000 1.000
#> GSM918624     2   0.000      1.000 0.000 1.000
#> GSM918637     2   0.000      1.000 0.000 1.000
#> GSM918639     2   0.000      1.000 0.000 1.000
#> GSM918640     2   0.000      1.000 0.000 1.000
#> GSM918636     2   0.000      1.000 0.000 1.000
#> GSM918590     2   0.000      1.000 0.000 1.000
#> GSM918610     2   0.000      1.000 0.000 1.000
#> GSM918615     2   0.000      1.000 0.000 1.000
#> GSM918616     2   0.000      1.000 0.000 1.000
#> GSM918632     2   0.000      1.000 0.000 1.000
#> GSM918647     2   0.000      1.000 0.000 1.000
#> GSM918578     2   0.000      1.000 0.000 1.000
#> GSM918579     2   0.000      1.000 0.000 1.000
#> GSM918581     2   0.000      1.000 0.000 1.000
#> GSM918584     2   0.000      1.000 0.000 1.000
#> GSM918591     2   0.000      1.000 0.000 1.000
#> GSM918592     2   0.000      1.000 0.000 1.000
#> GSM918597     2   0.000      1.000 0.000 1.000
#> GSM918598     2   0.000      1.000 0.000 1.000
#> GSM918599     2   0.000      1.000 0.000 1.000
#> GSM918604     2   0.000      1.000 0.000 1.000
#> GSM918605     2   0.000      1.000 0.000 1.000
#> GSM918613     2   0.000      1.000 0.000 1.000
#> GSM918623     2   0.000      1.000 0.000 1.000
#> GSM918626     2   0.000      1.000 0.000 1.000
#> GSM918627     2   0.000      1.000 0.000 1.000
#> GSM918633     2   0.000      1.000 0.000 1.000
#> GSM918634     2   0.000      1.000 0.000 1.000
#> GSM918635     2   0.000      1.000 0.000 1.000
#> GSM918645     2   0.000      1.000 0.000 1.000
#> GSM918646     2   0.000      1.000 0.000 1.000
#> GSM918648     2   0.000      1.000 0.000 1.000
#> GSM918650     2   0.000      1.000 0.000 1.000
#> GSM918652     2   0.000      1.000 0.000 1.000
#> GSM918653     2   0.000      1.000 0.000 1.000
#> GSM918622     2   0.000      1.000 0.000 1.000
#> GSM918583     2   0.000      1.000 0.000 1.000
#> GSM918585     2   0.000      1.000 0.000 1.000
#> GSM918595     2   0.000      1.000 0.000 1.000
#> GSM918596     2   0.000      1.000 0.000 1.000
#> GSM918602     2   0.000      1.000 0.000 1.000
#> GSM918617     2   0.000      1.000 0.000 1.000
#> GSM918630     2   0.000      1.000 0.000 1.000
#> GSM918631     2   0.000      1.000 0.000 1.000
#> GSM918618     1   0.204      0.968 0.968 0.032
#> GSM918644     1   0.904      0.559 0.680 0.320

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>           class entropy silhouette    p1    p2    p3
#> GSM918603     1  0.6274      0.720 0.544 0.000 0.456
#> GSM918641     1  0.6274      0.720 0.544 0.000 0.456
#> GSM918580     1  0.6274      0.720 0.544 0.000 0.456
#> GSM918593     1  0.6274      0.720 0.544 0.000 0.456
#> GSM918625     1  0.6274      0.720 0.544 0.000 0.456
#> GSM918638     1  0.6274      0.720 0.544 0.000 0.456
#> GSM918642     1  0.6274      0.720 0.544 0.000 0.456
#> GSM918643     1  0.6274      0.720 0.544 0.000 0.456
#> GSM918619     1  0.6286      0.722 0.536 0.000 0.464
#> GSM918621     1  0.6286      0.722 0.536 0.000 0.464
#> GSM918582     1  0.6286      0.722 0.536 0.000 0.464
#> GSM918649     1  0.6286      0.722 0.536 0.000 0.464
#> GSM918651     1  0.6286      0.722 0.536 0.000 0.464
#> GSM918607     1  0.6286      0.722 0.536 0.000 0.464
#> GSM918609     1  0.6286      0.722 0.536 0.000 0.464
#> GSM918608     1  0.6286      0.722 0.536 0.000 0.464
#> GSM918606     1  0.6286      0.722 0.536 0.000 0.464
#> GSM918620     1  0.6286      0.722 0.536 0.000 0.464
#> GSM918628     1  0.0237      0.719 0.996 0.004 0.000
#> GSM918586     2  0.1585      0.962 0.008 0.964 0.028
#> GSM918594     2  0.1031      0.967 0.000 0.976 0.024
#> GSM918600     2  0.1877      0.957 0.012 0.956 0.032
#> GSM918601     2  0.1031      0.967 0.000 0.976 0.024
#> GSM918612     2  0.2031      0.954 0.016 0.952 0.032
#> GSM918614     2  0.1031      0.967 0.000 0.976 0.024
#> GSM918629     2  0.0000      0.972 0.000 1.000 0.000
#> GSM918587     2  0.4342      0.853 0.120 0.856 0.024
#> GSM918588     2  0.1585      0.962 0.008 0.964 0.028
#> GSM918589     2  0.1267      0.966 0.004 0.972 0.024
#> GSM918611     2  0.1031      0.967 0.000 0.976 0.024
#> GSM918624     2  0.1031      0.967 0.000 0.976 0.024
#> GSM918637     2  0.1031      0.967 0.000 0.976 0.024
#> GSM918639     2  0.1031      0.967 0.000 0.976 0.024
#> GSM918640     2  0.1031      0.967 0.000 0.976 0.024
#> GSM918636     2  0.1163      0.966 0.000 0.972 0.028
#> GSM918590     2  0.0000      0.972 0.000 1.000 0.000
#> GSM918610     2  0.1964      0.960 0.000 0.944 0.056
#> GSM918615     2  0.1289      0.967 0.000 0.968 0.032
#> GSM918616     2  0.0000      0.972 0.000 1.000 0.000
#> GSM918632     2  0.1289      0.967 0.000 0.968 0.032
#> GSM918647     2  0.1964      0.960 0.000 0.944 0.056
#> GSM918578     2  0.1964      0.960 0.000 0.944 0.056
#> GSM918579     2  0.1964      0.960 0.000 0.944 0.056
#> GSM918581     2  0.1964      0.960 0.000 0.944 0.056
#> GSM918584     2  0.1964      0.960 0.000 0.944 0.056
#> GSM918591     2  0.1964      0.960 0.000 0.944 0.056
#> GSM918592     2  0.1964      0.960 0.000 0.944 0.056
#> GSM918597     2  0.0000      0.972 0.000 1.000 0.000
#> GSM918598     2  0.1964      0.960 0.000 0.944 0.056
#> GSM918599     2  0.0000      0.972 0.000 1.000 0.000
#> GSM918604     2  0.1585      0.962 0.008 0.964 0.028
#> GSM918605     2  0.0000      0.972 0.000 1.000 0.000
#> GSM918613     2  0.0000      0.972 0.000 1.000 0.000
#> GSM918623     2  0.1964      0.960 0.000 0.944 0.056
#> GSM918626     2  0.0000      0.972 0.000 1.000 0.000
#> GSM918627     2  0.0000      0.972 0.000 1.000 0.000
#> GSM918633     2  0.0000      0.972 0.000 1.000 0.000
#> GSM918634     2  0.0000      0.972 0.000 1.000 0.000
#> GSM918635     2  0.1964      0.960 0.000 0.944 0.056
#> GSM918645     2  0.0000      0.972 0.000 1.000 0.000
#> GSM918646     2  0.0000      0.972 0.000 1.000 0.000
#> GSM918648     2  0.1964      0.960 0.000 0.944 0.056
#> GSM918650     2  0.1964      0.960 0.000 0.944 0.056
#> GSM918652     2  0.0000      0.972 0.000 1.000 0.000
#> GSM918653     2  0.1964      0.960 0.000 0.944 0.056
#> GSM918622     2  0.0000      0.972 0.000 1.000 0.000
#> GSM918583     2  0.1964      0.960 0.000 0.944 0.056
#> GSM918585     2  0.1964      0.960 0.000 0.944 0.056
#> GSM918595     2  0.0000      0.972 0.000 1.000 0.000
#> GSM918596     2  0.1031      0.967 0.000 0.976 0.024
#> GSM918602     2  0.0000      0.972 0.000 1.000 0.000
#> GSM918617     2  0.0000      0.972 0.000 1.000 0.000
#> GSM918630     2  0.1031      0.969 0.000 0.976 0.024
#> GSM918631     2  0.1289      0.967 0.000 0.968 0.032
#> GSM918618     1  0.6513      0.708 0.520 0.004 0.476
#> GSM918644     1  0.6513      0.708 0.520 0.004 0.476

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette p1    p2    p3   p4
#> GSM918603     4  0.0000      1.000  0 0.000 0.000 1.00
#> GSM918641     4  0.0000      1.000  0 0.000 0.000 1.00
#> GSM918580     4  0.0000      1.000  0 0.000 0.000 1.00
#> GSM918593     4  0.0000      1.000  0 0.000 0.000 1.00
#> GSM918625     4  0.0000      1.000  0 0.000 0.000 1.00
#> GSM918638     4  0.0000      1.000  0 0.000 0.000 1.00
#> GSM918642     4  0.0000      1.000  0 0.000 0.000 1.00
#> GSM918643     4  0.0000      1.000  0 0.000 0.000 1.00
#> GSM918619     1  0.0000      1.000  1 0.000 0.000 0.00
#> GSM918621     1  0.0000      1.000  1 0.000 0.000 0.00
#> GSM918582     1  0.0000      1.000  1 0.000 0.000 0.00
#> GSM918649     1  0.0000      1.000  1 0.000 0.000 0.00
#> GSM918651     1  0.0000      1.000  1 0.000 0.000 0.00
#> GSM918607     1  0.0000      1.000  1 0.000 0.000 0.00
#> GSM918609     1  0.0000      1.000  1 0.000 0.000 0.00
#> GSM918608     1  0.0000      1.000  1 0.000 0.000 0.00
#> GSM918606     1  0.0000      1.000  1 0.000 0.000 0.00
#> GSM918620     1  0.0000      1.000  1 0.000 0.000 0.00
#> GSM918628     3  0.3801      0.700  0 0.000 0.780 0.22
#> GSM918586     3  0.0000      0.847  0 0.000 1.000 0.00
#> GSM918594     3  0.0000      0.847  0 0.000 1.000 0.00
#> GSM918600     3  0.0000      0.847  0 0.000 1.000 0.00
#> GSM918601     3  0.0000      0.847  0 0.000 1.000 0.00
#> GSM918612     3  0.0000      0.847  0 0.000 1.000 0.00
#> GSM918614     3  0.0000      0.847  0 0.000 1.000 0.00
#> GSM918629     3  0.1474      0.838  0 0.052 0.948 0.00
#> GSM918587     3  0.0000      0.847  0 0.000 1.000 0.00
#> GSM918588     3  0.0000      0.847  0 0.000 1.000 0.00
#> GSM918589     3  0.0000      0.847  0 0.000 1.000 0.00
#> GSM918611     3  0.0000      0.847  0 0.000 1.000 0.00
#> GSM918624     3  0.0000      0.847  0 0.000 1.000 0.00
#> GSM918637     3  0.0000      0.847  0 0.000 1.000 0.00
#> GSM918639     3  0.0000      0.847  0 0.000 1.000 0.00
#> GSM918640     3  0.0000      0.847  0 0.000 1.000 0.00
#> GSM918636     3  0.0000      0.847  0 0.000 1.000 0.00
#> GSM918590     3  0.4134      0.738  0 0.260 0.740 0.00
#> GSM918610     2  0.0000      0.959  0 1.000 0.000 0.00
#> GSM918615     2  0.0469      0.955  0 0.988 0.012 0.00
#> GSM918616     3  0.4040      0.749  0 0.248 0.752 0.00
#> GSM918632     2  0.0000      0.959  0 1.000 0.000 0.00
#> GSM918647     2  0.0707      0.952  0 0.980 0.020 0.00
#> GSM918578     2  0.1474      0.933  0 0.948 0.052 0.00
#> GSM918579     2  0.0000      0.959  0 1.000 0.000 0.00
#> GSM918581     2  0.0000      0.959  0 1.000 0.000 0.00
#> GSM918584     2  0.0000      0.959  0 1.000 0.000 0.00
#> GSM918591     2  0.0000      0.959  0 1.000 0.000 0.00
#> GSM918592     2  0.0000      0.959  0 1.000 0.000 0.00
#> GSM918597     3  0.3726      0.774  0 0.212 0.788 0.00
#> GSM918598     2  0.2216      0.899  0 0.908 0.092 0.00
#> GSM918599     3  0.4746      0.573  0 0.368 0.632 0.00
#> GSM918604     3  0.0000      0.847  0 0.000 1.000 0.00
#> GSM918605     3  0.4804      0.541  0 0.384 0.616 0.00
#> GSM918613     2  0.2149      0.903  0 0.912 0.088 0.00
#> GSM918623     2  0.0000      0.959  0 1.000 0.000 0.00
#> GSM918626     3  0.3266      0.800  0 0.168 0.832 0.00
#> GSM918627     3  0.4103      0.741  0 0.256 0.744 0.00
#> GSM918633     2  0.1940      0.914  0 0.924 0.076 0.00
#> GSM918634     3  0.4072      0.745  0 0.252 0.748 0.00
#> GSM918635     2  0.0000      0.959  0 1.000 0.000 0.00
#> GSM918645     2  0.1867      0.920  0 0.928 0.072 0.00
#> GSM918646     2  0.3873      0.667  0 0.772 0.228 0.00
#> GSM918648     2  0.0000      0.959  0 1.000 0.000 0.00
#> GSM918650     2  0.0000      0.959  0 1.000 0.000 0.00
#> GSM918652     3  0.4933      0.428  0 0.432 0.568 0.00
#> GSM918653     2  0.0000      0.959  0 1.000 0.000 0.00
#> GSM918622     3  0.4103      0.741  0 0.256 0.744 0.00
#> GSM918583     2  0.0000      0.959  0 1.000 0.000 0.00
#> GSM918585     2  0.0000      0.959  0 1.000 0.000 0.00
#> GSM918595     3  0.4661      0.609  0 0.348 0.652 0.00
#> GSM918596     3  0.0000      0.847  0 0.000 1.000 0.00
#> GSM918602     3  0.4072      0.745  0 0.252 0.748 0.00
#> GSM918617     3  0.4164      0.733  0 0.264 0.736 0.00
#> GSM918630     2  0.1867      0.908  0 0.928 0.072 0.00
#> GSM918631     2  0.0817      0.948  0 0.976 0.024 0.00
#> GSM918618     3  0.3801      0.700  0 0.000 0.780 0.22
#> GSM918644     3  0.1637      0.805  0 0.000 0.940 0.06

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>           class entropy silhouette p1    p2    p3    p4    p5
#> GSM918603     4  0.0000      0.870  0 0.000 0.000 1.000 0.000
#> GSM918641     4  0.0000      0.870  0 0.000 0.000 1.000 0.000
#> GSM918580     4  0.0000      0.870  0 0.000 0.000 1.000 0.000
#> GSM918593     4  0.0000      0.870  0 0.000 0.000 1.000 0.000
#> GSM918625     4  0.0000      0.870  0 0.000 0.000 1.000 0.000
#> GSM918638     4  0.0000      0.870  0 0.000 0.000 1.000 0.000
#> GSM918642     4  0.0000      0.870  0 0.000 0.000 1.000 0.000
#> GSM918643     4  0.0000      0.870  0 0.000 0.000 1.000 0.000
#> GSM918619     1  0.0000      1.000  1 0.000 0.000 0.000 0.000
#> GSM918621     1  0.0000      1.000  1 0.000 0.000 0.000 0.000
#> GSM918582     1  0.0000      1.000  1 0.000 0.000 0.000 0.000
#> GSM918649     1  0.0000      1.000  1 0.000 0.000 0.000 0.000
#> GSM918651     1  0.0000      1.000  1 0.000 0.000 0.000 0.000
#> GSM918607     1  0.0000      1.000  1 0.000 0.000 0.000 0.000
#> GSM918609     1  0.0000      1.000  1 0.000 0.000 0.000 0.000
#> GSM918608     1  0.0000      1.000  1 0.000 0.000 0.000 0.000
#> GSM918606     1  0.0000      1.000  1 0.000 0.000 0.000 0.000
#> GSM918620     1  0.0000      1.000  1 0.000 0.000 0.000 0.000
#> GSM918628     4  0.6598      0.280  0 0.000 0.232 0.452 0.316
#> GSM918586     3  0.0000      0.894  0 0.000 1.000 0.000 0.000
#> GSM918594     3  0.0000      0.894  0 0.000 1.000 0.000 0.000
#> GSM918600     3  0.0000      0.894  0 0.000 1.000 0.000 0.000
#> GSM918601     3  0.0000      0.894  0 0.000 1.000 0.000 0.000
#> GSM918612     3  0.0000      0.894  0 0.000 1.000 0.000 0.000
#> GSM918614     3  0.0000      0.894  0 0.000 1.000 0.000 0.000
#> GSM918629     5  0.2249      0.844  0 0.008 0.096 0.000 0.896
#> GSM918587     5  0.3534      0.618  0 0.000 0.256 0.000 0.744
#> GSM918588     3  0.0000      0.894  0 0.000 1.000 0.000 0.000
#> GSM918589     3  0.0290      0.890  0 0.000 0.992 0.000 0.008
#> GSM918611     3  0.2561      0.789  0 0.000 0.856 0.000 0.144
#> GSM918624     3  0.0000      0.894  0 0.000 1.000 0.000 0.000
#> GSM918637     3  0.2773      0.754  0 0.000 0.836 0.000 0.164
#> GSM918639     3  0.0000      0.894  0 0.000 1.000 0.000 0.000
#> GSM918640     3  0.0000      0.894  0 0.000 1.000 0.000 0.000
#> GSM918636     3  0.2561      0.790  0 0.000 0.856 0.000 0.144
#> GSM918590     5  0.0404      0.923  0 0.012 0.000 0.000 0.988
#> GSM918610     2  0.0162      0.935  0 0.996 0.000 0.000 0.004
#> GSM918615     2  0.0162      0.935  0 0.996 0.000 0.000 0.004
#> GSM918616     5  0.0404      0.923  0 0.012 0.000 0.000 0.988
#> GSM918632     2  0.0000      0.937  0 1.000 0.000 0.000 0.000
#> GSM918647     2  0.0000      0.937  0 1.000 0.000 0.000 0.000
#> GSM918578     2  0.1341      0.890  0 0.944 0.000 0.000 0.056
#> GSM918579     2  0.0000      0.937  0 1.000 0.000 0.000 0.000
#> GSM918581     2  0.0000      0.937  0 1.000 0.000 0.000 0.000
#> GSM918584     2  0.0000      0.937  0 1.000 0.000 0.000 0.000
#> GSM918591     2  0.0000      0.937  0 1.000 0.000 0.000 0.000
#> GSM918592     2  0.0000      0.937  0 1.000 0.000 0.000 0.000
#> GSM918597     5  0.0404      0.923  0 0.012 0.000 0.000 0.988
#> GSM918598     2  0.3913      0.509  0 0.676 0.000 0.000 0.324
#> GSM918599     5  0.3177      0.734  0 0.208 0.000 0.000 0.792
#> GSM918604     3  0.3913      0.525  0 0.000 0.676 0.000 0.324
#> GSM918605     5  0.3177      0.734  0 0.208 0.000 0.000 0.792
#> GSM918613     5  0.1851      0.868  0 0.088 0.000 0.000 0.912
#> GSM918623     2  0.0000      0.937  0 1.000 0.000 0.000 0.000
#> GSM918626     5  0.0404      0.914  0 0.000 0.012 0.000 0.988
#> GSM918627     5  0.0404      0.923  0 0.012 0.000 0.000 0.988
#> GSM918633     5  0.2020      0.856  0 0.100 0.000 0.000 0.900
#> GSM918634     5  0.0404      0.923  0 0.012 0.000 0.000 0.988
#> GSM918635     2  0.0000      0.937  0 1.000 0.000 0.000 0.000
#> GSM918645     2  0.0000      0.937  0 1.000 0.000 0.000 0.000
#> GSM918646     2  0.4074      0.395  0 0.636 0.000 0.000 0.364
#> GSM918648     2  0.0000      0.937  0 1.000 0.000 0.000 0.000
#> GSM918650     2  0.0162      0.935  0 0.996 0.000 0.000 0.004
#> GSM918652     2  0.4256      0.186  0 0.564 0.000 0.000 0.436
#> GSM918653     2  0.0000      0.937  0 1.000 0.000 0.000 0.000
#> GSM918622     5  0.0404      0.923  0 0.012 0.000 0.000 0.988
#> GSM918583     2  0.0000      0.937  0 1.000 0.000 0.000 0.000
#> GSM918585     2  0.0000      0.937  0 1.000 0.000 0.000 0.000
#> GSM918595     5  0.0671      0.920  0 0.016 0.004 0.000 0.980
#> GSM918596     5  0.0510      0.912  0 0.000 0.016 0.000 0.984
#> GSM918602     5  0.0404      0.923  0 0.012 0.000 0.000 0.988
#> GSM918617     5  0.0404      0.923  0 0.012 0.000 0.000 0.988
#> GSM918630     2  0.0510      0.925  0 0.984 0.000 0.000 0.016
#> GSM918631     2  0.0000      0.937  0 1.000 0.000 0.000 0.000
#> GSM918618     4  0.6598      0.280  0 0.000 0.232 0.452 0.316
#> GSM918644     3  0.6487      0.243  0 0.000 0.476 0.208 0.316

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>           class entropy silhouette p1    p2    p3    p4    p5    p6
#> GSM918603     4  0.0000      1.000  0 0.000 0.000 1.000 0.000 0.000
#> GSM918641     4  0.0000      1.000  0 0.000 0.000 1.000 0.000 0.000
#> GSM918580     4  0.0000      1.000  0 0.000 0.000 1.000 0.000 0.000
#> GSM918593     4  0.0000      1.000  0 0.000 0.000 1.000 0.000 0.000
#> GSM918625     4  0.0000      1.000  0 0.000 0.000 1.000 0.000 0.000
#> GSM918638     4  0.0000      1.000  0 0.000 0.000 1.000 0.000 0.000
#> GSM918642     4  0.0000      1.000  0 0.000 0.000 1.000 0.000 0.000
#> GSM918643     4  0.0000      1.000  0 0.000 0.000 1.000 0.000 0.000
#> GSM918619     1  0.0000      1.000  1 0.000 0.000 0.000 0.000 0.000
#> GSM918621     1  0.0000      1.000  1 0.000 0.000 0.000 0.000 0.000
#> GSM918582     1  0.0000      1.000  1 0.000 0.000 0.000 0.000 0.000
#> GSM918649     1  0.0000      1.000  1 0.000 0.000 0.000 0.000 0.000
#> GSM918651     1  0.0000      1.000  1 0.000 0.000 0.000 0.000 0.000
#> GSM918607     1  0.0000      1.000  1 0.000 0.000 0.000 0.000 0.000
#> GSM918609     1  0.0000      1.000  1 0.000 0.000 0.000 0.000 0.000
#> GSM918608     1  0.0000      1.000  1 0.000 0.000 0.000 0.000 0.000
#> GSM918606     1  0.0000      1.000  1 0.000 0.000 0.000 0.000 0.000
#> GSM918620     1  0.0000      1.000  1 0.000 0.000 0.000 0.000 0.000
#> GSM918628     6  0.2615      0.919  0 0.000 0.004 0.136 0.008 0.852
#> GSM918586     3  0.0146      0.991  0 0.000 0.996 0.000 0.004 0.000
#> GSM918594     3  0.0000      0.991  0 0.000 1.000 0.000 0.000 0.000
#> GSM918600     3  0.0146      0.991  0 0.000 0.996 0.000 0.004 0.000
#> GSM918601     3  0.0260      0.989  0 0.000 0.992 0.000 0.000 0.008
#> GSM918612     3  0.0146      0.991  0 0.000 0.996 0.000 0.004 0.000
#> GSM918614     3  0.0000      0.991  0 0.000 1.000 0.000 0.000 0.000
#> GSM918629     5  0.1528      0.893  0 0.000 0.048 0.000 0.936 0.016
#> GSM918587     5  0.2838      0.719  0 0.000 0.188 0.000 0.808 0.004
#> GSM918588     3  0.0000      0.991  0 0.000 1.000 0.000 0.000 0.000
#> GSM918589     3  0.0260      0.989  0 0.000 0.992 0.000 0.008 0.000
#> GSM918611     3  0.0260      0.989  0 0.000 0.992 0.000 0.008 0.000
#> GSM918624     3  0.0260      0.989  0 0.000 0.992 0.000 0.000 0.008
#> GSM918637     3  0.0508      0.985  0 0.000 0.984 0.000 0.004 0.012
#> GSM918639     3  0.0260      0.989  0 0.000 0.992 0.000 0.000 0.008
#> GSM918640     3  0.0260      0.989  0 0.000 0.992 0.000 0.000 0.008
#> GSM918636     3  0.0260      0.989  0 0.000 0.992 0.000 0.008 0.000
#> GSM918590     5  0.0363      0.919  0 0.000 0.012 0.000 0.988 0.000
#> GSM918610     2  0.0725      0.935  0 0.976 0.000 0.000 0.012 0.012
#> GSM918615     2  0.0725      0.935  0 0.976 0.000 0.000 0.012 0.012
#> GSM918616     5  0.0725      0.920  0 0.000 0.012 0.000 0.976 0.012
#> GSM918632     2  0.0405      0.937  0 0.988 0.000 0.000 0.008 0.004
#> GSM918647     2  0.0146      0.937  0 0.996 0.000 0.000 0.000 0.004
#> GSM918578     2  0.0972      0.930  0 0.964 0.000 0.000 0.028 0.008
#> GSM918579     2  0.1814      0.901  0 0.900 0.000 0.000 0.000 0.100
#> GSM918581     2  0.0547      0.937  0 0.980 0.000 0.000 0.000 0.020
#> GSM918584     2  0.0363      0.936  0 0.988 0.000 0.000 0.000 0.012
#> GSM918591     2  0.0547      0.937  0 0.980 0.000 0.000 0.000 0.020
#> GSM918592     2  0.0547      0.937  0 0.980 0.000 0.000 0.000 0.020
#> GSM918597     5  0.0820      0.919  0 0.000 0.012 0.000 0.972 0.016
#> GSM918598     2  0.1219      0.921  0 0.948 0.000 0.000 0.048 0.004
#> GSM918599     5  0.2454      0.753  0 0.160 0.000 0.000 0.840 0.000
#> GSM918604     3  0.0713      0.967  0 0.000 0.972 0.000 0.028 0.000
#> GSM918605     2  0.3634      0.490  0 0.644 0.000 0.000 0.356 0.000
#> GSM918613     5  0.1714      0.846  0 0.092 0.000 0.000 0.908 0.000
#> GSM918623     2  0.1610      0.910  0 0.916 0.000 0.000 0.000 0.084
#> GSM918626     5  0.0363      0.919  0 0.000 0.012 0.000 0.988 0.000
#> GSM918627     5  0.0547      0.918  0 0.000 0.000 0.000 0.980 0.020
#> GSM918633     5  0.3337      0.599  0 0.260 0.000 0.000 0.736 0.004
#> GSM918634     5  0.0547      0.918  0 0.000 0.000 0.000 0.980 0.020
#> GSM918635     2  0.0363      0.936  0 0.988 0.000 0.000 0.000 0.012
#> GSM918645     2  0.0725      0.935  0 0.976 0.000 0.000 0.012 0.012
#> GSM918646     2  0.2520      0.813  0 0.844 0.000 0.000 0.152 0.004
#> GSM918648     2  0.1814      0.901  0 0.900 0.000 0.000 0.000 0.100
#> GSM918650     2  0.0725      0.935  0 0.976 0.000 0.000 0.012 0.012
#> GSM918652     2  0.1910      0.866  0 0.892 0.000 0.000 0.108 0.000
#> GSM918653     2  0.1814      0.901  0 0.900 0.000 0.000 0.000 0.100
#> GSM918622     5  0.0547      0.918  0 0.000 0.000 0.000 0.980 0.020
#> GSM918583     2  0.0260      0.936  0 0.992 0.000 0.000 0.000 0.008
#> GSM918585     2  0.1814      0.901  0 0.900 0.000 0.000 0.000 0.100
#> GSM918595     5  0.0653      0.919  0 0.004 0.012 0.000 0.980 0.004
#> GSM918596     5  0.0914      0.918  0 0.000 0.016 0.000 0.968 0.016
#> GSM918602     5  0.0547      0.918  0 0.000 0.000 0.000 0.980 0.020
#> GSM918617     5  0.0363      0.914  0 0.012 0.000 0.000 0.988 0.000
#> GSM918630     2  0.0291      0.937  0 0.992 0.000 0.000 0.004 0.004
#> GSM918631     2  0.1387      0.916  0 0.932 0.000 0.000 0.000 0.068
#> GSM918618     6  0.2615      0.919  0 0.000 0.004 0.136 0.008 0.852
#> GSM918644     6  0.3000      0.849  0 0.000 0.096 0.044 0.008 0.852

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) gender(p) other(p) k
#> SD:mclust 76         5.75e-15   0.00217 2.46e-05 2
#> SD:mclust 76         5.75e-15   0.00217 2.46e-05 3
#> SD:mclust 75         8.43e-30   0.00460 2.84e-05 4
#> SD:mclust 71         2.34e-35   0.00508 2.76e-06 5
#> SD:mclust 75         2.27e-45   0.00857 6.83e-13 6

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


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

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

collect_plots(res)

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.816           0.890       0.955         0.4807 0.511   0.511
#> 3 3 0.942           0.894       0.962         0.3835 0.735   0.523
#> 4 4 0.953           0.913       0.967         0.0613 0.924   0.785
#> 5 5 0.846           0.824       0.907         0.0640 0.938   0.801
#> 6 6 0.764           0.508       0.786         0.0618 0.908   0.680

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

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

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

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

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

show/hide code output

cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#>           class entropy silhouette    p1    p2
#> GSM918603     1  0.0000      0.926 1.000 0.000
#> GSM918641     1  0.0000      0.926 1.000 0.000
#> GSM918580     1  0.0000      0.926 1.000 0.000
#> GSM918593     1  0.0000      0.926 1.000 0.000
#> GSM918625     1  0.0000      0.926 1.000 0.000
#> GSM918638     1  0.0000      0.926 1.000 0.000
#> GSM918642     1  0.0000      0.926 1.000 0.000
#> GSM918643     1  0.0000      0.926 1.000 0.000
#> GSM918619     1  0.0000      0.926 1.000 0.000
#> GSM918621     1  0.0000      0.926 1.000 0.000
#> GSM918582     1  0.0000      0.926 1.000 0.000
#> GSM918649     1  0.0000      0.926 1.000 0.000
#> GSM918651     1  0.0000      0.926 1.000 0.000
#> GSM918607     1  0.0000      0.926 1.000 0.000
#> GSM918609     1  0.0000      0.926 1.000 0.000
#> GSM918608     1  0.0000      0.926 1.000 0.000
#> GSM918606     1  0.0000      0.926 1.000 0.000
#> GSM918620     1  0.0000      0.926 1.000 0.000
#> GSM918628     1  0.0000      0.926 1.000 0.000
#> GSM918586     1  0.3274      0.890 0.940 0.060
#> GSM918594     1  0.9881      0.293 0.564 0.436
#> GSM918600     2  0.9427      0.383 0.360 0.640
#> GSM918601     2  0.9909      0.111 0.444 0.556
#> GSM918612     1  0.0000      0.926 1.000 0.000
#> GSM918614     1  0.5946      0.817 0.856 0.144
#> GSM918629     2  0.0000      0.967 0.000 1.000
#> GSM918587     2  0.0672      0.959 0.008 0.992
#> GSM918588     1  0.6247      0.804 0.844 0.156
#> GSM918589     1  0.4690      0.858 0.900 0.100
#> GSM918611     1  0.9815      0.338 0.580 0.420
#> GSM918624     1  0.9522      0.461 0.628 0.372
#> GSM918637     2  0.0000      0.967 0.000 1.000
#> GSM918639     1  0.9460      0.479 0.636 0.364
#> GSM918640     2  0.7299      0.711 0.204 0.796
#> GSM918636     1  0.3114      0.893 0.944 0.056
#> GSM918590     2  0.0000      0.967 0.000 1.000
#> GSM918610     2  0.0000      0.967 0.000 1.000
#> GSM918615     2  0.0000      0.967 0.000 1.000
#> GSM918616     2  0.0000      0.967 0.000 1.000
#> GSM918632     2  0.0000      0.967 0.000 1.000
#> GSM918647     2  0.0000      0.967 0.000 1.000
#> GSM918578     2  0.0000      0.967 0.000 1.000
#> GSM918579     2  0.0000      0.967 0.000 1.000
#> GSM918581     2  0.0000      0.967 0.000 1.000
#> GSM918584     2  0.0000      0.967 0.000 1.000
#> GSM918591     2  0.0000      0.967 0.000 1.000
#> GSM918592     2  0.0000      0.967 0.000 1.000
#> GSM918597     2  0.0000      0.967 0.000 1.000
#> GSM918598     2  0.0000      0.967 0.000 1.000
#> GSM918599     2  0.0000      0.967 0.000 1.000
#> GSM918604     2  0.8555      0.572 0.280 0.720
#> GSM918605     2  0.0000      0.967 0.000 1.000
#> GSM918613     2  0.0000      0.967 0.000 1.000
#> GSM918623     2  0.0000      0.967 0.000 1.000
#> GSM918626     2  0.0000      0.967 0.000 1.000
#> GSM918627     2  0.0000      0.967 0.000 1.000
#> GSM918633     2  0.0000      0.967 0.000 1.000
#> GSM918634     2  0.0000      0.967 0.000 1.000
#> GSM918635     2  0.0000      0.967 0.000 1.000
#> GSM918645     2  0.0000      0.967 0.000 1.000
#> GSM918646     2  0.0000      0.967 0.000 1.000
#> GSM918648     2  0.0000      0.967 0.000 1.000
#> GSM918650     2  0.0000      0.967 0.000 1.000
#> GSM918652     2  0.0000      0.967 0.000 1.000
#> GSM918653     2  0.0000      0.967 0.000 1.000
#> GSM918622     2  0.0000      0.967 0.000 1.000
#> GSM918583     2  0.0000      0.967 0.000 1.000
#> GSM918585     2  0.0000      0.967 0.000 1.000
#> GSM918595     2  0.0000      0.967 0.000 1.000
#> GSM918596     2  0.0000      0.967 0.000 1.000
#> GSM918602     2  0.0000      0.967 0.000 1.000
#> GSM918617     2  0.0000      0.967 0.000 1.000
#> GSM918630     2  0.0000      0.967 0.000 1.000
#> GSM918631     2  0.0000      0.967 0.000 1.000
#> GSM918618     1  0.0000      0.926 1.000 0.000
#> GSM918644     1  0.0000      0.926 1.000 0.000

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>           class entropy silhouette    p1    p2    p3
#> GSM918603     1  0.0000    0.99859 1.000 0.000 0.000
#> GSM918641     1  0.0000    0.99859 1.000 0.000 0.000
#> GSM918580     1  0.0000    0.99859 1.000 0.000 0.000
#> GSM918593     1  0.0000    0.99859 1.000 0.000 0.000
#> GSM918625     1  0.0000    0.99859 1.000 0.000 0.000
#> GSM918638     1  0.0000    0.99859 1.000 0.000 0.000
#> GSM918642     1  0.0000    0.99859 1.000 0.000 0.000
#> GSM918643     1  0.0000    0.99859 1.000 0.000 0.000
#> GSM918619     1  0.0000    0.99859 1.000 0.000 0.000
#> GSM918621     1  0.0000    0.99859 1.000 0.000 0.000
#> GSM918582     1  0.0000    0.99859 1.000 0.000 0.000
#> GSM918649     1  0.0000    0.99859 1.000 0.000 0.000
#> GSM918651     1  0.0000    0.99859 1.000 0.000 0.000
#> GSM918607     1  0.0000    0.99859 1.000 0.000 0.000
#> GSM918609     1  0.0000    0.99859 1.000 0.000 0.000
#> GSM918608     1  0.0000    0.99859 1.000 0.000 0.000
#> GSM918606     1  0.0000    0.99859 1.000 0.000 0.000
#> GSM918620     1  0.0000    0.99859 1.000 0.000 0.000
#> GSM918628     1  0.0000    0.99859 1.000 0.000 0.000
#> GSM918586     3  0.0000    0.95245 0.000 0.000 1.000
#> GSM918594     3  0.0000    0.95245 0.000 0.000 1.000
#> GSM918600     3  0.0000    0.95245 0.000 0.000 1.000
#> GSM918601     3  0.0000    0.95245 0.000 0.000 1.000
#> GSM918612     3  0.0000    0.95245 0.000 0.000 1.000
#> GSM918614     3  0.0000    0.95245 0.000 0.000 1.000
#> GSM918629     3  0.0000    0.95245 0.000 0.000 1.000
#> GSM918587     3  0.0424    0.94718 0.000 0.008 0.992
#> GSM918588     3  0.0000    0.95245 0.000 0.000 1.000
#> GSM918589     3  0.0000    0.95245 0.000 0.000 1.000
#> GSM918611     3  0.0000    0.95245 0.000 0.000 1.000
#> GSM918624     3  0.0000    0.95245 0.000 0.000 1.000
#> GSM918637     3  0.0000    0.95245 0.000 0.000 1.000
#> GSM918639     3  0.0000    0.95245 0.000 0.000 1.000
#> GSM918640     3  0.0000    0.95245 0.000 0.000 1.000
#> GSM918636     3  0.0000    0.95245 0.000 0.000 1.000
#> GSM918590     2  0.0000    0.93353 0.000 1.000 0.000
#> GSM918610     2  0.0000    0.93353 0.000 1.000 0.000
#> GSM918615     2  0.0000    0.93353 0.000 1.000 0.000
#> GSM918616     3  0.0237    0.94988 0.000 0.004 0.996
#> GSM918632     2  0.0000    0.93353 0.000 1.000 0.000
#> GSM918647     2  0.0000    0.93353 0.000 1.000 0.000
#> GSM918578     2  0.0000    0.93353 0.000 1.000 0.000
#> GSM918579     2  0.0000    0.93353 0.000 1.000 0.000
#> GSM918581     2  0.0000    0.93353 0.000 1.000 0.000
#> GSM918584     2  0.0000    0.93353 0.000 1.000 0.000
#> GSM918591     2  0.0000    0.93353 0.000 1.000 0.000
#> GSM918592     2  0.0000    0.93353 0.000 1.000 0.000
#> GSM918597     3  0.4121    0.77271 0.000 0.168 0.832
#> GSM918598     2  0.0000    0.93353 0.000 1.000 0.000
#> GSM918599     2  0.6154    0.30180 0.000 0.592 0.408
#> GSM918604     3  0.0000    0.95245 0.000 0.000 1.000
#> GSM918605     2  0.1163    0.91103 0.000 0.972 0.028
#> GSM918613     2  0.0000    0.93353 0.000 1.000 0.000
#> GSM918623     2  0.0000    0.93353 0.000 1.000 0.000
#> GSM918626     3  0.6280    0.09409 0.000 0.460 0.540
#> GSM918627     2  0.6309    0.00708 0.000 0.504 0.496
#> GSM918633     2  0.0000    0.93353 0.000 1.000 0.000
#> GSM918634     3  0.0747    0.94025 0.000 0.016 0.984
#> GSM918635     2  0.0000    0.93353 0.000 1.000 0.000
#> GSM918645     2  0.0000    0.93353 0.000 1.000 0.000
#> GSM918646     2  0.0000    0.93353 0.000 1.000 0.000
#> GSM918648     2  0.0000    0.93353 0.000 1.000 0.000
#> GSM918650     2  0.0000    0.93353 0.000 1.000 0.000
#> GSM918652     2  0.0000    0.93353 0.000 1.000 0.000
#> GSM918653     2  0.0000    0.93353 0.000 1.000 0.000
#> GSM918622     2  0.6302    0.06578 0.000 0.520 0.480
#> GSM918583     2  0.0000    0.93353 0.000 1.000 0.000
#> GSM918585     2  0.0000    0.93353 0.000 1.000 0.000
#> GSM918595     2  0.1529    0.89968 0.000 0.960 0.040
#> GSM918596     3  0.0000    0.95245 0.000 0.000 1.000
#> GSM918602     3  0.5591    0.54184 0.000 0.304 0.696
#> GSM918617     2  0.6291    0.11509 0.000 0.532 0.468
#> GSM918630     2  0.0000    0.93353 0.000 1.000 0.000
#> GSM918631     2  0.0000    0.93353 0.000 1.000 0.000
#> GSM918618     1  0.1031    0.97560 0.976 0.000 0.024
#> GSM918644     1  0.0237    0.99510 0.996 0.000 0.004

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM918603     4  0.0000      0.969 0.000 0.000 0.000 1.000
#> GSM918641     4  0.0000      0.969 0.000 0.000 0.000 1.000
#> GSM918580     4  0.0000      0.969 0.000 0.000 0.000 1.000
#> GSM918593     4  0.0000      0.969 0.000 0.000 0.000 1.000
#> GSM918625     4  0.0000      0.969 0.000 0.000 0.000 1.000
#> GSM918638     4  0.0000      0.969 0.000 0.000 0.000 1.000
#> GSM918642     4  0.0000      0.969 0.000 0.000 0.000 1.000
#> GSM918643     4  0.0000      0.969 0.000 0.000 0.000 1.000
#> GSM918619     1  0.0000      1.000 1.000 0.000 0.000 0.000
#> GSM918621     1  0.0000      1.000 1.000 0.000 0.000 0.000
#> GSM918582     1  0.0000      1.000 1.000 0.000 0.000 0.000
#> GSM918649     1  0.0188      0.996 0.996 0.000 0.000 0.004
#> GSM918651     1  0.0000      1.000 1.000 0.000 0.000 0.000
#> GSM918607     1  0.0000      1.000 1.000 0.000 0.000 0.000
#> GSM918609     1  0.0000      1.000 1.000 0.000 0.000 0.000
#> GSM918608     1  0.0000      1.000 1.000 0.000 0.000 0.000
#> GSM918606     1  0.0000      1.000 1.000 0.000 0.000 0.000
#> GSM918620     1  0.0000      1.000 1.000 0.000 0.000 0.000
#> GSM918628     4  0.4406      0.571 0.300 0.000 0.000 0.700
#> GSM918586     3  0.0000      0.930 0.000 0.000 1.000 0.000
#> GSM918594     3  0.0000      0.930 0.000 0.000 1.000 0.000
#> GSM918600     3  0.0000      0.930 0.000 0.000 1.000 0.000
#> GSM918601     3  0.0000      0.930 0.000 0.000 1.000 0.000
#> GSM918612     3  0.0000      0.930 0.000 0.000 1.000 0.000
#> GSM918614     3  0.0000      0.930 0.000 0.000 1.000 0.000
#> GSM918629     3  0.0000      0.930 0.000 0.000 1.000 0.000
#> GSM918587     3  0.0707      0.916 0.000 0.020 0.980 0.000
#> GSM918588     3  0.0000      0.930 0.000 0.000 1.000 0.000
#> GSM918589     3  0.0000      0.930 0.000 0.000 1.000 0.000
#> GSM918611     3  0.0000      0.930 0.000 0.000 1.000 0.000
#> GSM918624     3  0.0000      0.930 0.000 0.000 1.000 0.000
#> GSM918637     3  0.0000      0.930 0.000 0.000 1.000 0.000
#> GSM918639     3  0.0000      0.930 0.000 0.000 1.000 0.000
#> GSM918640     3  0.0000      0.930 0.000 0.000 1.000 0.000
#> GSM918636     3  0.0000      0.930 0.000 0.000 1.000 0.000
#> GSM918590     2  0.0000      0.966 0.000 1.000 0.000 0.000
#> GSM918610     2  0.0000      0.966 0.000 1.000 0.000 0.000
#> GSM918615     2  0.0000      0.966 0.000 1.000 0.000 0.000
#> GSM918616     3  0.0000      0.930 0.000 0.000 1.000 0.000
#> GSM918632     2  0.0000      0.966 0.000 1.000 0.000 0.000
#> GSM918647     2  0.0000      0.966 0.000 1.000 0.000 0.000
#> GSM918578     2  0.0000      0.966 0.000 1.000 0.000 0.000
#> GSM918579     2  0.0000      0.966 0.000 1.000 0.000 0.000
#> GSM918581     2  0.0000      0.966 0.000 1.000 0.000 0.000
#> GSM918584     2  0.0000      0.966 0.000 1.000 0.000 0.000
#> GSM918591     2  0.0000      0.966 0.000 1.000 0.000 0.000
#> GSM918592     2  0.0000      0.966 0.000 1.000 0.000 0.000
#> GSM918597     3  0.0779      0.918 0.004 0.016 0.980 0.000
#> GSM918598     2  0.0188      0.963 0.004 0.996 0.000 0.000
#> GSM918599     2  0.4730      0.395 0.000 0.636 0.364 0.000
#> GSM918604     3  0.1389      0.893 0.048 0.000 0.952 0.000
#> GSM918605     2  0.1637      0.908 0.000 0.940 0.060 0.000
#> GSM918613     2  0.0000      0.966 0.000 1.000 0.000 0.000
#> GSM918623     2  0.0000      0.966 0.000 1.000 0.000 0.000
#> GSM918626     3  0.4898      0.292 0.000 0.416 0.584 0.000
#> GSM918627     3  0.4164      0.642 0.000 0.264 0.736 0.000
#> GSM918633     2  0.0000      0.966 0.000 1.000 0.000 0.000
#> GSM918634     3  0.0000      0.930 0.000 0.000 1.000 0.000
#> GSM918635     2  0.0000      0.966 0.000 1.000 0.000 0.000
#> GSM918645     2  0.0000      0.966 0.000 1.000 0.000 0.000
#> GSM918646     2  0.0000      0.966 0.000 1.000 0.000 0.000
#> GSM918648     2  0.0000      0.966 0.000 1.000 0.000 0.000
#> GSM918650     2  0.0000      0.966 0.000 1.000 0.000 0.000
#> GSM918652     2  0.0000      0.966 0.000 1.000 0.000 0.000
#> GSM918653     2  0.0000      0.966 0.000 1.000 0.000 0.000
#> GSM918622     3  0.4985      0.151 0.000 0.468 0.532 0.000
#> GSM918583     2  0.0000      0.966 0.000 1.000 0.000 0.000
#> GSM918585     2  0.0000      0.966 0.000 1.000 0.000 0.000
#> GSM918595     2  0.1733      0.923 0.028 0.948 0.024 0.000
#> GSM918596     3  0.0000      0.930 0.000 0.000 1.000 0.000
#> GSM918602     3  0.2647      0.820 0.000 0.120 0.880 0.000
#> GSM918617     2  0.4761      0.371 0.000 0.628 0.372 0.000
#> GSM918630     2  0.0000      0.966 0.000 1.000 0.000 0.000
#> GSM918631     2  0.0000      0.966 0.000 1.000 0.000 0.000
#> GSM918618     4  0.0000      0.969 0.000 0.000 0.000 1.000
#> GSM918644     4  0.0000      0.969 0.000 0.000 0.000 1.000

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>           class entropy silhouette    p1    p2    p3    p4    p5
#> GSM918603     4  0.0000     0.9976 0.000 0.000 0.000 1.000 0.000
#> GSM918641     4  0.0000     0.9976 0.000 0.000 0.000 1.000 0.000
#> GSM918580     4  0.0000     0.9976 0.000 0.000 0.000 1.000 0.000
#> GSM918593     4  0.0000     0.9976 0.000 0.000 0.000 1.000 0.000
#> GSM918625     4  0.0000     0.9976 0.000 0.000 0.000 1.000 0.000
#> GSM918638     4  0.0000     0.9976 0.000 0.000 0.000 1.000 0.000
#> GSM918642     4  0.0000     0.9976 0.000 0.000 0.000 1.000 0.000
#> GSM918643     4  0.0000     0.9976 0.000 0.000 0.000 1.000 0.000
#> GSM918619     1  0.0000     0.9945 1.000 0.000 0.000 0.000 0.000
#> GSM918621     1  0.0000     0.9945 1.000 0.000 0.000 0.000 0.000
#> GSM918582     1  0.0000     0.9945 1.000 0.000 0.000 0.000 0.000
#> GSM918649     1  0.0162     0.9926 0.996 0.000 0.000 0.000 0.004
#> GSM918651     1  0.0000     0.9945 1.000 0.000 0.000 0.000 0.000
#> GSM918607     1  0.0000     0.9945 1.000 0.000 0.000 0.000 0.000
#> GSM918609     1  0.0000     0.9945 1.000 0.000 0.000 0.000 0.000
#> GSM918608     1  0.0000     0.9945 1.000 0.000 0.000 0.000 0.000
#> GSM918606     1  0.0000     0.9945 1.000 0.000 0.000 0.000 0.000
#> GSM918620     1  0.0162     0.9926 0.996 0.000 0.000 0.000 0.004
#> GSM918628     1  0.1469     0.9514 0.948 0.000 0.000 0.016 0.036
#> GSM918586     3  0.0162     0.9100 0.000 0.000 0.996 0.000 0.004
#> GSM918594     3  0.0000     0.9104 0.000 0.000 1.000 0.000 0.000
#> GSM918600     3  0.0000     0.9104 0.000 0.000 1.000 0.000 0.000
#> GSM918601     3  0.0794     0.9073 0.000 0.000 0.972 0.000 0.028
#> GSM918612     3  0.0000     0.9104 0.000 0.000 1.000 0.000 0.000
#> GSM918614     3  0.0000     0.9104 0.000 0.000 1.000 0.000 0.000
#> GSM918629     3  0.0000     0.9104 0.000 0.000 1.000 0.000 0.000
#> GSM918587     3  0.3247     0.8137 0.000 0.052 0.864 0.072 0.012
#> GSM918588     3  0.0000     0.9104 0.000 0.000 1.000 0.000 0.000
#> GSM918589     3  0.0162     0.9100 0.000 0.000 0.996 0.000 0.004
#> GSM918611     3  0.0000     0.9104 0.000 0.000 1.000 0.000 0.000
#> GSM918624     3  0.0794     0.9073 0.000 0.000 0.972 0.000 0.028
#> GSM918637     3  0.0794     0.9073 0.000 0.000 0.972 0.000 0.028
#> GSM918639     3  0.0794     0.9073 0.000 0.000 0.972 0.000 0.028
#> GSM918640     3  0.0794     0.9073 0.000 0.000 0.972 0.000 0.028
#> GSM918636     3  0.0162     0.9100 0.000 0.000 0.996 0.000 0.004
#> GSM918590     2  0.2966     0.7236 0.000 0.816 0.000 0.000 0.184
#> GSM918610     2  0.3983     0.6132 0.000 0.660 0.000 0.000 0.340
#> GSM918615     2  0.2648     0.7473 0.000 0.848 0.000 0.000 0.152
#> GSM918616     3  0.0880     0.9062 0.000 0.000 0.968 0.000 0.032
#> GSM918632     2  0.3177     0.7348 0.000 0.792 0.000 0.000 0.208
#> GSM918647     2  0.2891     0.7490 0.000 0.824 0.000 0.000 0.176
#> GSM918578     2  0.4210     0.4825 0.000 0.588 0.000 0.000 0.412
#> GSM918579     2  0.0290     0.7832 0.000 0.992 0.000 0.000 0.008
#> GSM918581     2  0.3816     0.6614 0.000 0.696 0.000 0.000 0.304
#> GSM918584     2  0.0510     0.7851 0.000 0.984 0.000 0.000 0.016
#> GSM918591     2  0.3876     0.6465 0.000 0.684 0.000 0.000 0.316
#> GSM918592     2  0.3913     0.6374 0.000 0.676 0.000 0.000 0.324
#> GSM918597     3  0.2193     0.8391 0.000 0.008 0.900 0.000 0.092
#> GSM918598     5  0.2516     0.8681 0.000 0.140 0.000 0.000 0.860
#> GSM918599     2  0.5077     0.0874 0.000 0.568 0.392 0.000 0.040
#> GSM918604     3  0.1012     0.8978 0.020 0.000 0.968 0.000 0.012
#> GSM918605     2  0.1357     0.7730 0.000 0.948 0.004 0.000 0.048
#> GSM918613     2  0.0510     0.7872 0.000 0.984 0.000 0.000 0.016
#> GSM918623     2  0.3177     0.7337 0.000 0.792 0.000 0.000 0.208
#> GSM918626     3  0.3307     0.8067 0.000 0.104 0.844 0.000 0.052
#> GSM918627     3  0.3534     0.5801 0.000 0.256 0.744 0.000 0.000
#> GSM918633     2  0.3366     0.7264 0.000 0.768 0.000 0.000 0.232
#> GSM918634     3  0.1907     0.8890 0.000 0.028 0.928 0.000 0.044
#> GSM918635     2  0.3480     0.7070 0.000 0.752 0.000 0.000 0.248
#> GSM918645     2  0.0404     0.7847 0.000 0.988 0.000 0.000 0.012
#> GSM918646     2  0.0290     0.7832 0.000 0.992 0.000 0.000 0.008
#> GSM918648     2  0.2891     0.7495 0.000 0.824 0.000 0.000 0.176
#> GSM918650     2  0.2648     0.7678 0.000 0.848 0.000 0.000 0.152
#> GSM918652     2  0.0703     0.7730 0.000 0.976 0.000 0.000 0.024
#> GSM918653     2  0.0290     0.7832 0.000 0.992 0.000 0.000 0.008
#> GSM918622     2  0.5368     0.2417 0.000 0.596 0.332 0.000 0.072
#> GSM918583     2  0.0162     0.7841 0.000 0.996 0.000 0.000 0.004
#> GSM918585     2  0.0510     0.7851 0.000 0.984 0.000 0.000 0.016
#> GSM918595     5  0.1638     0.8812 0.004 0.064 0.000 0.000 0.932
#> GSM918596     3  0.2344     0.8640 0.000 0.064 0.904 0.000 0.032
#> GSM918602     3  0.5604     0.0616 0.000 0.072 0.472 0.000 0.456
#> GSM918617     3  0.5010     0.3660 0.000 0.392 0.572 0.000 0.036
#> GSM918630     2  0.0290     0.7829 0.000 0.992 0.000 0.000 0.008
#> GSM918631     2  0.0404     0.7814 0.000 0.988 0.000 0.000 0.012
#> GSM918618     4  0.0609     0.9823 0.000 0.000 0.000 0.980 0.020
#> GSM918644     4  0.0162     0.9951 0.000 0.000 0.000 0.996 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
#> GSM918603     4  0.0000      0.963 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM918641     4  0.0000      0.963 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM918580     4  0.0000      0.963 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM918593     4  0.0000      0.963 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM918625     4  0.0000      0.963 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM918638     4  0.0000      0.963 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM918642     4  0.0000      0.963 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM918643     4  0.0000      0.963 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM918619     1  0.0000      0.964 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM918621     1  0.0000      0.964 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM918582     1  0.0000      0.964 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM918649     1  0.0000      0.964 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM918651     1  0.0000      0.964 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM918607     1  0.0000      0.964 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM918609     1  0.0000      0.964 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM918608     1  0.0000      0.964 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM918606     1  0.0000      0.964 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM918620     1  0.0000      0.964 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM918628     1  0.5153      0.545 0.584 0.028 0.004 0.016 0.012 0.356
#> GSM918586     3  0.0790      0.652 0.000 0.000 0.968 0.000 0.000 0.032
#> GSM918594     3  0.1204      0.636 0.000 0.000 0.944 0.000 0.000 0.056
#> GSM918600     3  0.0260      0.664 0.000 0.000 0.992 0.000 0.000 0.008
#> GSM918601     3  0.3547      0.292 0.000 0.000 0.668 0.000 0.000 0.332
#> GSM918612     3  0.0692      0.661 0.000 0.004 0.976 0.000 0.000 0.020
#> GSM918614     3  0.0363      0.663 0.000 0.000 0.988 0.000 0.000 0.012
#> GSM918629     3  0.0146      0.663 0.000 0.000 0.996 0.000 0.004 0.000
#> GSM918587     3  0.5050      0.108 0.000 0.008 0.636 0.052 0.016 0.288
#> GSM918588     3  0.0260      0.664 0.000 0.000 0.992 0.000 0.000 0.008
#> GSM918589     3  0.1007      0.639 0.000 0.000 0.956 0.000 0.000 0.044
#> GSM918611     3  0.0260      0.663 0.000 0.000 0.992 0.000 0.000 0.008
#> GSM918624     3  0.3578      0.274 0.000 0.000 0.660 0.000 0.000 0.340
#> GSM918637     3  0.3634      0.233 0.000 0.000 0.644 0.000 0.000 0.356
#> GSM918639     3  0.3547      0.292 0.000 0.000 0.668 0.000 0.000 0.332
#> GSM918640     3  0.3499      0.312 0.000 0.000 0.680 0.000 0.000 0.320
#> GSM918636     3  0.0458      0.664 0.000 0.000 0.984 0.000 0.000 0.016
#> GSM918590     5  0.5061      0.305 0.000 0.252 0.000 0.000 0.620 0.128
#> GSM918610     2  0.4150      0.498 0.000 0.592 0.000 0.000 0.392 0.016
#> GSM918615     5  0.2362      0.534 0.000 0.136 0.000 0.000 0.860 0.004
#> GSM918616     3  0.3634      0.233 0.000 0.000 0.644 0.000 0.000 0.356
#> GSM918632     5  0.3862     -0.310 0.000 0.476 0.000 0.000 0.524 0.000
#> GSM918647     5  0.3828     -0.210 0.000 0.440 0.000 0.000 0.560 0.000
#> GSM918578     2  0.3426      0.512 0.000 0.720 0.000 0.000 0.276 0.004
#> GSM918579     5  0.0458      0.618 0.000 0.016 0.000 0.000 0.984 0.000
#> GSM918581     2  0.3810      0.457 0.000 0.572 0.000 0.000 0.428 0.000
#> GSM918584     5  0.0146      0.621 0.000 0.000 0.000 0.000 0.996 0.004
#> GSM918591     2  0.4002      0.491 0.000 0.588 0.000 0.000 0.404 0.008
#> GSM918592     2  0.3756      0.496 0.000 0.600 0.000 0.000 0.400 0.000
#> GSM918597     3  0.1788      0.587 0.000 0.076 0.916 0.000 0.004 0.004
#> GSM918598     2  0.2442      0.441 0.000 0.884 0.000 0.000 0.068 0.048
#> GSM918599     5  0.5592     -0.311 0.000 0.000 0.156 0.000 0.504 0.340
#> GSM918604     3  0.0603      0.660 0.000 0.004 0.980 0.000 0.000 0.016
#> GSM918605     5  0.4074      0.290 0.000 0.016 0.004 0.000 0.656 0.324
#> GSM918613     5  0.0632      0.616 0.000 0.024 0.000 0.000 0.976 0.000
#> GSM918623     5  0.3993     -0.317 0.000 0.476 0.000 0.000 0.520 0.004
#> GSM918626     6  0.5546      0.228 0.000 0.024 0.328 0.000 0.088 0.560
#> GSM918627     3  0.5155     -0.136 0.000 0.000 0.596 0.000 0.280 0.124
#> GSM918633     5  0.4434     -0.216 0.000 0.428 0.028 0.000 0.544 0.000
#> GSM918634     6  0.6039      0.281 0.000 0.000 0.356 0.000 0.252 0.392
#> GSM918635     2  0.3996      0.321 0.000 0.512 0.000 0.000 0.484 0.004
#> GSM918645     5  0.0363      0.619 0.000 0.000 0.000 0.000 0.988 0.012
#> GSM918646     5  0.2178      0.532 0.000 0.132 0.000 0.000 0.868 0.000
#> GSM918648     5  0.3797     -0.154 0.000 0.420 0.000 0.000 0.580 0.000
#> GSM918650     5  0.2996      0.422 0.000 0.228 0.000 0.000 0.772 0.000
#> GSM918652     5  0.2092      0.553 0.000 0.000 0.000 0.000 0.876 0.124
#> GSM918653     5  0.0790      0.612 0.000 0.032 0.000 0.000 0.968 0.000
#> GSM918622     5  0.5965      0.223 0.000 0.088 0.240 0.000 0.592 0.080
#> GSM918583     5  0.0146      0.621 0.000 0.000 0.000 0.000 0.996 0.004
#> GSM918585     5  0.1863      0.560 0.000 0.104 0.000 0.000 0.896 0.000
#> GSM918595     2  0.3778      0.240 0.000 0.708 0.000 0.000 0.020 0.272
#> GSM918596     3  0.6088     -0.602 0.000 0.000 0.368 0.000 0.276 0.356
#> GSM918602     2  0.6569     -0.370 0.000 0.472 0.284 0.000 0.048 0.196
#> GSM918617     5  0.5327     -0.140 0.000 0.000 0.164 0.000 0.588 0.248
#> GSM918630     5  0.0363      0.619 0.000 0.000 0.000 0.000 0.988 0.012
#> GSM918631     5  0.0146      0.621 0.000 0.000 0.000 0.000 0.996 0.004
#> GSM918618     4  0.4274      0.623 0.000 0.024 0.004 0.636 0.000 0.336
#> GSM918644     4  0.0622      0.950 0.000 0.000 0.008 0.980 0.000 0.012

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

consensus_heatmap(res, k = 2)

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

consensus_heatmap(res, k = 3)

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

consensus_heatmap(res, k = 4)

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

consensus_heatmap(res, k = 5)

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

consensus_heatmap(res, k = 6)

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

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

membership_heatmap(res, k = 2)

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

membership_heatmap(res, k = 3)

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

membership_heatmap(res, k = 4)

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

membership_heatmap(res, k = 5)

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

membership_heatmap(res, k = 6)

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

As soon as we have had the classes for columns, we can look for signatures which are significantly different between classes which can be candidate marks for certain classes. Following are the heatmaps for signatures.

Signature heatmaps where rows are scaled:

get_signatures(res, k = 2)

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

get_signatures(res, k = 3)

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

get_signatures(res, k = 4)

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

get_signatures(res, k = 5)

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

get_signatures(res, k = 6)

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

Signature heatmaps where rows are not scaled:

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

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

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

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

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

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

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

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

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

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

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk SD-NMF-signature_compare

get_signature() returns a data frame invisibly. TO get the list of signatures, the function call should be assigned to a variable explicitly. In following code, if plot argument is set to FALSE, no heatmap is plotted while only the differential analysis is performed.

# code only for demonstration
tb = get_signature(res, k = ..., plot = FALSE)

An example of the output of tb is:

#>   which_row         fdr    mean_1    mean_2 scaled_mean_1 scaled_mean_2 km
#> 1        38 0.042760348  8.373488  9.131774    -0.5533452     0.5164555  1
#> 2        40 0.018707592  7.106213  8.469186    -0.6173731     0.5762149  1
#> 3        55 0.019134737 10.221463 11.207825    -0.6159697     0.5749050  1
#> 4        59 0.006059896  5.921854  7.869574    -0.6899429     0.6439467  1
#> 5        60 0.018055526  8.928898 10.211722    -0.6204761     0.5791110  1
#> 6        98 0.009384629 15.714769 14.887706     0.6635654    -0.6193277  2
...

The columns in tb are:

  1. which_row: row indices corresponding to the input matrix.
  2. fdr: FDR for the differential test.
  3. mean_x: The mean value in group x.
  4. scaled_mean_x: The mean value in group x after rows are scaled.
  5. km: Row groups if k-means clustering is applied to rows.

UMAP plot which shows how samples are separated.

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

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

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

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

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

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

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

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

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

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

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk SD-NMF-collect-classes

Test correlation between subgroups and known annotations. If the known annotation is numeric, one-way ANOVA test is applied, and if the known annotation is discrete, chi-squared contingency table test is applied.

test_to_known_factors(res)
#>         n disease.state(p) gender(p) other(p) k
#> SD:NMF 70         1.29e-11   0.03373 1.42e-03 2
#> SD:NMF 71         1.04e-19   0.00195 2.19e-04 3
#> SD:NMF 72         3.59e-31   0.00389 9.05e-07 4
#> SD:NMF 71         5.59e-28   0.00165 2.16e-07 5
#> SD:NMF 46         3.05e-17   0.04213 2.62e-05 6

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


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

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

collect_plots(res)

plot of chunk CV-hclust-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 1.000           0.957       0.978         0.3869 0.607   0.607
#> 3 3 1.000           0.943       0.976         0.1283 0.966   0.945
#> 4 4 0.771           0.901       0.945         0.5181 0.767   0.594
#> 5 5 0.756           0.886       0.948         0.0147 0.993   0.979
#> 6 6 0.737           0.833       0.894         0.0618 0.994   0.981

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
#> GSM918603     1  0.1843     0.9559 0.972 0.028
#> GSM918641     1  0.0938     0.9531 0.988 0.012
#> GSM918580     1  0.0672     0.9507 0.992 0.008
#> GSM918593     1  0.1843     0.9559 0.972 0.028
#> GSM918625     1  0.1843     0.9559 0.972 0.028
#> GSM918638     1  0.1843     0.9559 0.972 0.028
#> GSM918642     1  0.1843     0.9559 0.972 0.028
#> GSM918643     1  0.1843     0.9559 0.972 0.028
#> GSM918619     1  0.2236     0.9645 0.964 0.036
#> GSM918621     1  0.2236     0.9645 0.964 0.036
#> GSM918582     1  0.2236     0.9645 0.964 0.036
#> GSM918649     1  0.2236     0.9645 0.964 0.036
#> GSM918651     1  0.2236     0.9645 0.964 0.036
#> GSM918607     1  0.2236     0.9645 0.964 0.036
#> GSM918609     1  0.2236     0.9645 0.964 0.036
#> GSM918608     1  0.2236     0.9645 0.964 0.036
#> GSM918606     1  0.2236     0.9645 0.964 0.036
#> GSM918620     1  0.2236     0.9645 0.964 0.036
#> GSM918628     1  0.2236     0.9645 0.964 0.036
#> GSM918586     2  0.0672     0.9841 0.008 0.992
#> GSM918594     2  0.0672     0.9841 0.008 0.992
#> GSM918600     2  0.0672     0.9841 0.008 0.992
#> GSM918601     2  0.0672     0.9841 0.008 0.992
#> GSM918612     2  0.0672     0.9841 0.008 0.992
#> GSM918614     2  0.0672     0.9841 0.008 0.992
#> GSM918629     2  0.0376     0.9860 0.004 0.996
#> GSM918587     2  0.0938     0.9782 0.012 0.988
#> GSM918588     2  0.0672     0.9841 0.008 0.992
#> GSM918589     2  0.1414     0.9755 0.020 0.980
#> GSM918611     2  0.1414     0.9755 0.020 0.980
#> GSM918624     2  0.0672     0.9841 0.008 0.992
#> GSM918637     2  0.0672     0.9841 0.008 0.992
#> GSM918639     2  0.0672     0.9841 0.008 0.992
#> GSM918640     2  0.0672     0.9841 0.008 0.992
#> GSM918636     2  0.1184     0.9790 0.016 0.984
#> GSM918590     2  0.0000     0.9876 0.000 1.000
#> GSM918610     2  0.0000     0.9876 0.000 1.000
#> GSM918615     2  0.0000     0.9876 0.000 1.000
#> GSM918616     2  0.0376     0.9860 0.004 0.996
#> GSM918632     2  0.0000     0.9876 0.000 1.000
#> GSM918647     2  0.0000     0.9876 0.000 1.000
#> GSM918578     2  0.0000     0.9876 0.000 1.000
#> GSM918579     2  0.0000     0.9876 0.000 1.000
#> GSM918581     2  0.0000     0.9876 0.000 1.000
#> GSM918584     2  0.0000     0.9876 0.000 1.000
#> GSM918591     2  0.0000     0.9876 0.000 1.000
#> GSM918592     2  0.0000     0.9876 0.000 1.000
#> GSM918597     2  0.0000     0.9876 0.000 1.000
#> GSM918598     2  0.0000     0.9876 0.000 1.000
#> GSM918599     2  0.0000     0.9876 0.000 1.000
#> GSM918604     2  0.0672     0.9841 0.008 0.992
#> GSM918605     2  0.0000     0.9876 0.000 1.000
#> GSM918613     2  0.0000     0.9876 0.000 1.000
#> GSM918623     2  0.0000     0.9876 0.000 1.000
#> GSM918626     2  0.0000     0.9876 0.000 1.000
#> GSM918627     2  0.0000     0.9876 0.000 1.000
#> GSM918633     2  0.0000     0.9876 0.000 1.000
#> GSM918634     2  0.0000     0.9876 0.000 1.000
#> GSM918635     2  0.0000     0.9876 0.000 1.000
#> GSM918645     2  0.0000     0.9876 0.000 1.000
#> GSM918646     2  0.0000     0.9876 0.000 1.000
#> GSM918648     2  0.0000     0.9876 0.000 1.000
#> GSM918650     2  0.0000     0.9876 0.000 1.000
#> GSM918652     2  0.0000     0.9876 0.000 1.000
#> GSM918653     2  0.0000     0.9876 0.000 1.000
#> GSM918622     2  0.0000     0.9876 0.000 1.000
#> GSM918583     2  0.0000     0.9876 0.000 1.000
#> GSM918585     2  0.0000     0.9876 0.000 1.000
#> GSM918595     2  0.0000     0.9876 0.000 1.000
#> GSM918596     2  0.0000     0.9876 0.000 1.000
#> GSM918602     2  0.0376     0.9860 0.004 0.996
#> GSM918617     2  0.0000     0.9876 0.000 1.000
#> GSM918630     2  0.0000     0.9876 0.000 1.000
#> GSM918631     2  0.0000     0.9876 0.000 1.000
#> GSM918618     1  0.9833     0.2965 0.576 0.424
#> GSM918644     2  0.9988    -0.0121 0.480 0.520

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>           class entropy silhouette    p1    p2    p3
#> GSM918603     3  0.0000    0.98381 0.000 0.000 1.000
#> GSM918641     3  0.1411    0.95436 0.036 0.000 0.964
#> GSM918580     3  0.1860    0.93984 0.052 0.000 0.948
#> GSM918593     3  0.0000    0.98381 0.000 0.000 1.000
#> GSM918625     3  0.0000    0.98381 0.000 0.000 1.000
#> GSM918638     3  0.0000    0.98381 0.000 0.000 1.000
#> GSM918642     3  0.0000    0.98381 0.000 0.000 1.000
#> GSM918643     3  0.0000    0.98381 0.000 0.000 1.000
#> GSM918619     1  0.0000    0.92523 1.000 0.000 0.000
#> GSM918621     1  0.0000    0.92523 1.000 0.000 0.000
#> GSM918582     1  0.0000    0.92523 1.000 0.000 0.000
#> GSM918649     1  0.0000    0.92523 1.000 0.000 0.000
#> GSM918651     1  0.0000    0.92523 1.000 0.000 0.000
#> GSM918607     1  0.0000    0.92523 1.000 0.000 0.000
#> GSM918609     1  0.0000    0.92523 1.000 0.000 0.000
#> GSM918608     1  0.0000    0.92523 1.000 0.000 0.000
#> GSM918606     1  0.0000    0.92523 1.000 0.000 0.000
#> GSM918620     1  0.0000    0.92523 1.000 0.000 0.000
#> GSM918628     1  0.0000    0.92523 1.000 0.000 0.000
#> GSM918586     2  0.1411    0.96429 0.000 0.964 0.036
#> GSM918594     2  0.1411    0.96429 0.000 0.964 0.036
#> GSM918600     2  0.1411    0.96429 0.000 0.964 0.036
#> GSM918601     2  0.1411    0.96429 0.000 0.964 0.036
#> GSM918612     2  0.1411    0.96429 0.000 0.964 0.036
#> GSM918614     2  0.1411    0.96429 0.000 0.964 0.036
#> GSM918629     2  0.1289    0.96606 0.000 0.968 0.032
#> GSM918587     2  0.0661    0.97243 0.008 0.988 0.004
#> GSM918588     2  0.1411    0.96429 0.000 0.964 0.036
#> GSM918589     2  0.1878    0.95626 0.004 0.952 0.044
#> GSM918611     2  0.1878    0.95626 0.004 0.952 0.044
#> GSM918624     2  0.1411    0.96429 0.000 0.964 0.036
#> GSM918637     2  0.1411    0.96429 0.000 0.964 0.036
#> GSM918639     2  0.1411    0.96429 0.000 0.964 0.036
#> GSM918640     2  0.1411    0.96429 0.000 0.964 0.036
#> GSM918636     2  0.1643    0.95893 0.000 0.956 0.044
#> GSM918590     2  0.0000    0.97917 0.000 1.000 0.000
#> GSM918610     2  0.0000    0.97917 0.000 1.000 0.000
#> GSM918615     2  0.0000    0.97917 0.000 1.000 0.000
#> GSM918616     2  0.0424    0.97638 0.000 0.992 0.008
#> GSM918632     2  0.0000    0.97917 0.000 1.000 0.000
#> GSM918647     2  0.0000    0.97917 0.000 1.000 0.000
#> GSM918578     2  0.0000    0.97917 0.000 1.000 0.000
#> GSM918579     2  0.0000    0.97917 0.000 1.000 0.000
#> GSM918581     2  0.0000    0.97917 0.000 1.000 0.000
#> GSM918584     2  0.0000    0.97917 0.000 1.000 0.000
#> GSM918591     2  0.0000    0.97917 0.000 1.000 0.000
#> GSM918592     2  0.0000    0.97917 0.000 1.000 0.000
#> GSM918597     2  0.0000    0.97917 0.000 1.000 0.000
#> GSM918598     2  0.0000    0.97917 0.000 1.000 0.000
#> GSM918599     2  0.0000    0.97917 0.000 1.000 0.000
#> GSM918604     2  0.1411    0.96429 0.000 0.964 0.036
#> GSM918605     2  0.0000    0.97917 0.000 1.000 0.000
#> GSM918613     2  0.0000    0.97917 0.000 1.000 0.000
#> GSM918623     2  0.0000    0.97917 0.000 1.000 0.000
#> GSM918626     2  0.0000    0.97917 0.000 1.000 0.000
#> GSM918627     2  0.0000    0.97917 0.000 1.000 0.000
#> GSM918633     2  0.0000    0.97917 0.000 1.000 0.000
#> GSM918634     2  0.0000    0.97917 0.000 1.000 0.000
#> GSM918635     2  0.0000    0.97917 0.000 1.000 0.000
#> GSM918645     2  0.0000    0.97917 0.000 1.000 0.000
#> GSM918646     2  0.0000    0.97917 0.000 1.000 0.000
#> GSM918648     2  0.0000    0.97917 0.000 1.000 0.000
#> GSM918650     2  0.0000    0.97917 0.000 1.000 0.000
#> GSM918652     2  0.0000    0.97917 0.000 1.000 0.000
#> GSM918653     2  0.0000    0.97917 0.000 1.000 0.000
#> GSM918622     2  0.0000    0.97917 0.000 1.000 0.000
#> GSM918583     2  0.0000    0.97917 0.000 1.000 0.000
#> GSM918585     2  0.0000    0.97917 0.000 1.000 0.000
#> GSM918595     2  0.0000    0.97917 0.000 1.000 0.000
#> GSM918596     2  0.0000    0.97917 0.000 1.000 0.000
#> GSM918602     2  0.0424    0.97638 0.000 0.992 0.008
#> GSM918617     2  0.0000    0.97917 0.000 1.000 0.000
#> GSM918630     2  0.0000    0.97917 0.000 1.000 0.000
#> GSM918631     2  0.0000    0.97917 0.000 1.000 0.000
#> GSM918618     1  0.9527    0.11909 0.436 0.372 0.192
#> GSM918644     2  0.9457   -0.00525 0.340 0.468 0.192

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM918603     4  0.0921     0.9873 0.000 0.000 0.028 0.972
#> GSM918641     4  0.0376     0.9636 0.004 0.000 0.004 0.992
#> GSM918580     4  0.0937     0.9549 0.012 0.000 0.012 0.976
#> GSM918593     4  0.0921     0.9873 0.000 0.000 0.028 0.972
#> GSM918625     4  0.0921     0.9873 0.000 0.000 0.028 0.972
#> GSM918638     4  0.0921     0.9873 0.000 0.000 0.028 0.972
#> GSM918642     4  0.0921     0.9873 0.000 0.000 0.028 0.972
#> GSM918643     4  0.0921     0.9873 0.000 0.000 0.028 0.972
#> GSM918619     1  0.0000     0.9417 1.000 0.000 0.000 0.000
#> GSM918621     1  0.0000     0.9417 1.000 0.000 0.000 0.000
#> GSM918582     1  0.0000     0.9417 1.000 0.000 0.000 0.000
#> GSM918649     1  0.0000     0.9417 1.000 0.000 0.000 0.000
#> GSM918651     1  0.0000     0.9417 1.000 0.000 0.000 0.000
#> GSM918607     1  0.0000     0.9417 1.000 0.000 0.000 0.000
#> GSM918609     1  0.0000     0.9417 1.000 0.000 0.000 0.000
#> GSM918608     1  0.0000     0.9417 1.000 0.000 0.000 0.000
#> GSM918606     1  0.0000     0.9417 1.000 0.000 0.000 0.000
#> GSM918620     1  0.0000     0.9417 1.000 0.000 0.000 0.000
#> GSM918628     1  0.1388     0.9145 0.960 0.000 0.012 0.028
#> GSM918586     3  0.0469     0.9438 0.000 0.012 0.988 0.000
#> GSM918594     3  0.0469     0.9438 0.000 0.012 0.988 0.000
#> GSM918600     3  0.0469     0.9438 0.000 0.012 0.988 0.000
#> GSM918601     3  0.0469     0.9438 0.000 0.012 0.988 0.000
#> GSM918612     3  0.0707     0.9383 0.000 0.020 0.980 0.000
#> GSM918614     3  0.0469     0.9438 0.000 0.012 0.988 0.000
#> GSM918629     3  0.3649     0.6792 0.000 0.204 0.796 0.000
#> GSM918587     2  0.3774     0.8514 0.008 0.820 0.168 0.004
#> GSM918588     3  0.0469     0.9438 0.000 0.012 0.988 0.000
#> GSM918589     3  0.1247     0.9288 0.004 0.016 0.968 0.012
#> GSM918611     3  0.1247     0.9288 0.004 0.016 0.968 0.012
#> GSM918624     3  0.0469     0.9438 0.000 0.012 0.988 0.000
#> GSM918637     3  0.0469     0.9438 0.000 0.012 0.988 0.000
#> GSM918639     3  0.0469     0.9438 0.000 0.012 0.988 0.000
#> GSM918640     3  0.0469     0.9438 0.000 0.012 0.988 0.000
#> GSM918636     3  0.0657     0.9333 0.000 0.004 0.984 0.012
#> GSM918590     2  0.2469     0.9075 0.000 0.892 0.108 0.000
#> GSM918610     2  0.0000     0.9322 0.000 1.000 0.000 0.000
#> GSM918615     2  0.0000     0.9322 0.000 1.000 0.000 0.000
#> GSM918616     2  0.4500     0.6398 0.000 0.684 0.316 0.000
#> GSM918632     2  0.0000     0.9322 0.000 1.000 0.000 0.000
#> GSM918647     2  0.0000     0.9322 0.000 1.000 0.000 0.000
#> GSM918578     2  0.0000     0.9322 0.000 1.000 0.000 0.000
#> GSM918579     2  0.0000     0.9322 0.000 1.000 0.000 0.000
#> GSM918581     2  0.0000     0.9322 0.000 1.000 0.000 0.000
#> GSM918584     2  0.0000     0.9322 0.000 1.000 0.000 0.000
#> GSM918591     2  0.0000     0.9322 0.000 1.000 0.000 0.000
#> GSM918592     2  0.0000     0.9322 0.000 1.000 0.000 0.000
#> GSM918597     2  0.2814     0.8911 0.000 0.868 0.132 0.000
#> GSM918598     2  0.0000     0.9322 0.000 1.000 0.000 0.000
#> GSM918599     2  0.2589     0.9037 0.000 0.884 0.116 0.000
#> GSM918604     3  0.0707     0.9383 0.000 0.020 0.980 0.000
#> GSM918605     2  0.2530     0.9058 0.000 0.888 0.112 0.000
#> GSM918613     2  0.0000     0.9322 0.000 1.000 0.000 0.000
#> GSM918623     2  0.0000     0.9322 0.000 1.000 0.000 0.000
#> GSM918626     2  0.2589     0.9037 0.000 0.884 0.116 0.000
#> GSM918627     2  0.2814     0.8911 0.000 0.868 0.132 0.000
#> GSM918633     2  0.0000     0.9322 0.000 1.000 0.000 0.000
#> GSM918634     2  0.2469     0.9075 0.000 0.892 0.108 0.000
#> GSM918635     2  0.0000     0.9322 0.000 1.000 0.000 0.000
#> GSM918645     2  0.2530     0.9058 0.000 0.888 0.112 0.000
#> GSM918646     2  0.2281     0.9113 0.000 0.904 0.096 0.000
#> GSM918648     2  0.0000     0.9322 0.000 1.000 0.000 0.000
#> GSM918650     2  0.0000     0.9322 0.000 1.000 0.000 0.000
#> GSM918652     2  0.2530     0.9058 0.000 0.888 0.112 0.000
#> GSM918653     2  0.0000     0.9322 0.000 1.000 0.000 0.000
#> GSM918622     2  0.2814     0.8911 0.000 0.868 0.132 0.000
#> GSM918583     2  0.0000     0.9322 0.000 1.000 0.000 0.000
#> GSM918585     2  0.0000     0.9322 0.000 1.000 0.000 0.000
#> GSM918595     2  0.0000     0.9322 0.000 1.000 0.000 0.000
#> GSM918596     2  0.2530     0.9058 0.000 0.888 0.112 0.000
#> GSM918602     2  0.4500     0.6398 0.000 0.684 0.316 0.000
#> GSM918617     2  0.2530     0.9058 0.000 0.888 0.112 0.000
#> GSM918630     2  0.2530     0.9058 0.000 0.888 0.112 0.000
#> GSM918631     2  0.0000     0.9322 0.000 1.000 0.000 0.000
#> GSM918618     1  0.7393     0.0618 0.436 0.000 0.400 0.164
#> GSM918644     3  0.7701     0.1510 0.340 0.012 0.484 0.164

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>           class entropy silhouette    p1    p2    p3    p4    p5
#> GSM918603     4  0.0000      0.985 0.000 0.000 0.000 1.000 0.000
#> GSM918641     4  0.0963      0.959 0.000 0.000 0.000 0.964 0.036
#> GSM918580     4  0.1270      0.946 0.000 0.000 0.000 0.948 0.052
#> GSM918593     4  0.0000      0.985 0.000 0.000 0.000 1.000 0.000
#> GSM918625     4  0.0000      0.985 0.000 0.000 0.000 1.000 0.000
#> GSM918638     4  0.0000      0.985 0.000 0.000 0.000 1.000 0.000
#> GSM918642     4  0.0000      0.985 0.000 0.000 0.000 1.000 0.000
#> GSM918643     4  0.0000      0.985 0.000 0.000 0.000 1.000 0.000
#> GSM918619     1  0.0000      1.000 1.000 0.000 0.000 0.000 0.000
#> GSM918621     1  0.0000      1.000 1.000 0.000 0.000 0.000 0.000
#> GSM918582     1  0.0000      1.000 1.000 0.000 0.000 0.000 0.000
#> GSM918649     1  0.0000      1.000 1.000 0.000 0.000 0.000 0.000
#> GSM918651     1  0.0000      1.000 1.000 0.000 0.000 0.000 0.000
#> GSM918607     1  0.0000      1.000 1.000 0.000 0.000 0.000 0.000
#> GSM918609     1  0.0000      1.000 1.000 0.000 0.000 0.000 0.000
#> GSM918608     1  0.0000      1.000 1.000 0.000 0.000 0.000 0.000
#> GSM918606     1  0.0000      1.000 1.000 0.000 0.000 0.000 0.000
#> GSM918620     1  0.0000      1.000 1.000 0.000 0.000 0.000 0.000
#> GSM918628     5  0.0404      0.368 0.012 0.000 0.000 0.000 0.988
#> GSM918586     3  0.0000      0.917 0.000 0.000 1.000 0.000 0.000
#> GSM918594     3  0.0000      0.917 0.000 0.000 1.000 0.000 0.000
#> GSM918600     3  0.0000      0.917 0.000 0.000 1.000 0.000 0.000
#> GSM918601     3  0.0000      0.917 0.000 0.000 1.000 0.000 0.000
#> GSM918612     3  0.0290      0.910 0.000 0.008 0.992 0.000 0.000
#> GSM918614     3  0.0000      0.917 0.000 0.000 1.000 0.000 0.000
#> GSM918629     3  0.3039      0.553 0.000 0.192 0.808 0.000 0.000
#> GSM918587     2  0.3250      0.844 0.000 0.820 0.168 0.004 0.008
#> GSM918588     3  0.0000      0.917 0.000 0.000 1.000 0.000 0.000
#> GSM918589     3  0.1525      0.876 0.004 0.012 0.948 0.036 0.000
#> GSM918611     3  0.1525      0.876 0.004 0.012 0.948 0.036 0.000
#> GSM918624     3  0.0000      0.917 0.000 0.000 1.000 0.000 0.000
#> GSM918637     3  0.0000      0.917 0.000 0.000 1.000 0.000 0.000
#> GSM918639     3  0.0000      0.917 0.000 0.000 1.000 0.000 0.000
#> GSM918640     3  0.0000      0.917 0.000 0.000 1.000 0.000 0.000
#> GSM918636     3  0.0963      0.888 0.000 0.000 0.964 0.036 0.000
#> GSM918590     2  0.2127      0.903 0.000 0.892 0.108 0.000 0.000
#> GSM918610     2  0.0000      0.927 0.000 1.000 0.000 0.000 0.000
#> GSM918615     2  0.0000      0.927 0.000 1.000 0.000 0.000 0.000
#> GSM918616     2  0.3876      0.640 0.000 0.684 0.316 0.000 0.000
#> GSM918632     2  0.0000      0.927 0.000 1.000 0.000 0.000 0.000
#> GSM918647     2  0.0000      0.927 0.000 1.000 0.000 0.000 0.000
#> GSM918578     2  0.0000      0.927 0.000 1.000 0.000 0.000 0.000
#> GSM918579     2  0.0000      0.927 0.000 1.000 0.000 0.000 0.000
#> GSM918581     2  0.0000      0.927 0.000 1.000 0.000 0.000 0.000
#> GSM918584     2  0.0000      0.927 0.000 1.000 0.000 0.000 0.000
#> GSM918591     2  0.0000      0.927 0.000 1.000 0.000 0.000 0.000
#> GSM918592     2  0.0000      0.927 0.000 1.000 0.000 0.000 0.000
#> GSM918597     2  0.2424      0.886 0.000 0.868 0.132 0.000 0.000
#> GSM918598     2  0.0000      0.927 0.000 1.000 0.000 0.000 0.000
#> GSM918599     2  0.2230      0.899 0.000 0.884 0.116 0.000 0.000
#> GSM918604     3  0.0290      0.910 0.000 0.008 0.992 0.000 0.000
#> GSM918605     2  0.2179      0.901 0.000 0.888 0.112 0.000 0.000
#> GSM918613     2  0.0000      0.927 0.000 1.000 0.000 0.000 0.000
#> GSM918623     2  0.0000      0.927 0.000 1.000 0.000 0.000 0.000
#> GSM918626     2  0.2230      0.899 0.000 0.884 0.116 0.000 0.000
#> GSM918627     2  0.2424      0.886 0.000 0.868 0.132 0.000 0.000
#> GSM918633     2  0.0000      0.927 0.000 1.000 0.000 0.000 0.000
#> GSM918634     2  0.2127      0.903 0.000 0.892 0.108 0.000 0.000
#> GSM918635     2  0.0000      0.927 0.000 1.000 0.000 0.000 0.000
#> GSM918645     2  0.2179      0.901 0.000 0.888 0.112 0.000 0.000
#> GSM918646     2  0.1965      0.906 0.000 0.904 0.096 0.000 0.000
#> GSM918648     2  0.0000      0.927 0.000 1.000 0.000 0.000 0.000
#> GSM918650     2  0.0000      0.927 0.000 1.000 0.000 0.000 0.000
#> GSM918652     2  0.2179      0.901 0.000 0.888 0.112 0.000 0.000
#> GSM918653     2  0.0000      0.927 0.000 1.000 0.000 0.000 0.000
#> GSM918622     2  0.2424      0.886 0.000 0.868 0.132 0.000 0.000
#> GSM918583     2  0.0000      0.927 0.000 1.000 0.000 0.000 0.000
#> GSM918585     2  0.0000      0.927 0.000 1.000 0.000 0.000 0.000
#> GSM918595     2  0.0000      0.927 0.000 1.000 0.000 0.000 0.000
#> GSM918596     2  0.2179      0.901 0.000 0.888 0.112 0.000 0.000
#> GSM918602     2  0.3876      0.640 0.000 0.684 0.316 0.000 0.000
#> GSM918617     2  0.2179      0.901 0.000 0.888 0.112 0.000 0.000
#> GSM918630     2  0.2179      0.901 0.000 0.888 0.112 0.000 0.000
#> GSM918631     2  0.0000      0.927 0.000 1.000 0.000 0.000 0.000
#> GSM918618     5  0.6620      0.269 0.004 0.000 0.368 0.188 0.440
#> GSM918644     3  0.6930     -0.399 0.004 0.012 0.452 0.188 0.344

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>           class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM918603     4  0.0000      0.988 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM918641     4  0.0865      0.965 0.000 0.000 0.000 0.964 0.000 0.036
#> GSM918580     4  0.1297      0.953 0.000 0.012 0.000 0.948 0.000 0.040
#> GSM918593     4  0.0000      0.988 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM918625     4  0.0000      0.988 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM918638     4  0.0000      0.988 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM918642     4  0.0000      0.988 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM918643     4  0.0000      0.988 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM918619     1  0.0000      1.000 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM918621     1  0.0000      1.000 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM918582     1  0.0000      1.000 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM918649     1  0.0000      1.000 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM918651     1  0.0000      1.000 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM918607     1  0.0000      1.000 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM918609     1  0.0000      1.000 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM918608     1  0.0000      1.000 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM918606     1  0.0000      1.000 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM918620     1  0.0000      1.000 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM918628     6  0.3710      0.000 0.012 0.292 0.000 0.000 0.000 0.696
#> GSM918586     3  0.0000      0.894 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM918594     3  0.0000      0.894 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM918600     3  0.0000      0.894 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM918601     3  0.0000      0.894 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM918612     3  0.0458      0.885 0.000 0.000 0.984 0.000 0.000 0.016
#> GSM918614     3  0.0000      0.894 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM918629     3  0.3236      0.592 0.000 0.000 0.796 0.000 0.180 0.024
#> GSM918587     5  0.5327      0.767 0.000 0.060 0.100 0.000 0.680 0.160
#> GSM918588     3  0.0000      0.894 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM918589     3  0.4423      0.420 0.000 0.360 0.608 0.000 0.004 0.028
#> GSM918611     3  0.4423      0.420 0.000 0.360 0.608 0.000 0.004 0.028
#> GSM918624     3  0.0000      0.894 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM918637     3  0.0000      0.894 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM918639     3  0.0000      0.894 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM918640     3  0.0000      0.894 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM918636     3  0.3575      0.591 0.000 0.284 0.708 0.000 0.000 0.008
#> GSM918590     5  0.2897      0.824 0.000 0.000 0.088 0.000 0.852 0.060
#> GSM918610     5  0.1814      0.833 0.000 0.000 0.000 0.000 0.900 0.100
#> GSM918615     5  0.1863      0.832 0.000 0.000 0.000 0.000 0.896 0.104
#> GSM918616     5  0.5234      0.536 0.000 0.000 0.300 0.000 0.576 0.124
#> GSM918632     5  0.1007      0.836 0.000 0.000 0.000 0.000 0.956 0.044
#> GSM918647     5  0.1204      0.837 0.000 0.000 0.000 0.000 0.944 0.056
#> GSM918578     5  0.1556      0.834 0.000 0.000 0.000 0.000 0.920 0.080
#> GSM918579     5  0.1910      0.831 0.000 0.000 0.000 0.000 0.892 0.108
#> GSM918581     5  0.1075      0.836 0.000 0.000 0.000 0.000 0.952 0.048
#> GSM918584     5  0.1863      0.832 0.000 0.000 0.000 0.000 0.896 0.104
#> GSM918591     5  0.1556      0.834 0.000 0.000 0.000 0.000 0.920 0.080
#> GSM918592     5  0.1556      0.834 0.000 0.000 0.000 0.000 0.920 0.080
#> GSM918597     5  0.4425      0.792 0.000 0.000 0.112 0.000 0.712 0.176
#> GSM918598     5  0.1556      0.834 0.000 0.000 0.000 0.000 0.920 0.080
#> GSM918599     5  0.3955      0.796 0.000 0.004 0.092 0.000 0.772 0.132
#> GSM918604     3  0.0458      0.885 0.000 0.000 0.984 0.000 0.000 0.016
#> GSM918605     5  0.3775      0.798 0.000 0.000 0.092 0.000 0.780 0.128
#> GSM918613     5  0.1910      0.833 0.000 0.000 0.000 0.000 0.892 0.108
#> GSM918623     5  0.1007      0.836 0.000 0.000 0.000 0.000 0.956 0.044
#> GSM918626     5  0.4280      0.804 0.000 0.004 0.092 0.000 0.736 0.168
#> GSM918627     5  0.4425      0.792 0.000 0.000 0.112 0.000 0.712 0.176
#> GSM918633     5  0.1910      0.833 0.000 0.000 0.000 0.000 0.892 0.108
#> GSM918634     5  0.2897      0.824 0.000 0.000 0.088 0.000 0.852 0.060
#> GSM918635     5  0.1075      0.836 0.000 0.000 0.000 0.000 0.952 0.048
#> GSM918645     5  0.3775      0.798 0.000 0.000 0.092 0.000 0.780 0.128
#> GSM918646     5  0.3912      0.817 0.000 0.000 0.076 0.000 0.760 0.164
#> GSM918648     5  0.1007      0.836 0.000 0.000 0.000 0.000 0.956 0.044
#> GSM918650     5  0.1814      0.833 0.000 0.000 0.000 0.000 0.900 0.100
#> GSM918652     5  0.3775      0.798 0.000 0.000 0.092 0.000 0.780 0.128
#> GSM918653     5  0.1910      0.831 0.000 0.000 0.000 0.000 0.892 0.108
#> GSM918622     5  0.4425      0.792 0.000 0.000 0.112 0.000 0.712 0.176
#> GSM918583     5  0.1863      0.832 0.000 0.000 0.000 0.000 0.896 0.104
#> GSM918585     5  0.1910      0.831 0.000 0.000 0.000 0.000 0.892 0.108
#> GSM918595     5  0.1814      0.828 0.000 0.000 0.000 0.000 0.900 0.100
#> GSM918596     5  0.3775      0.798 0.000 0.000 0.092 0.000 0.780 0.128
#> GSM918602     5  0.5234      0.536 0.000 0.000 0.300 0.000 0.576 0.124
#> GSM918617     5  0.3815      0.798 0.000 0.000 0.092 0.000 0.776 0.132
#> GSM918630     5  0.3815      0.798 0.000 0.000 0.092 0.000 0.776 0.132
#> GSM918631     5  0.1910      0.831 0.000 0.000 0.000 0.000 0.892 0.108
#> GSM918618     2  0.1010      0.650 0.000 0.960 0.004 0.036 0.000 0.000
#> GSM918644     2  0.3075      0.692 0.000 0.864 0.068 0.036 0.004 0.028

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

consensus_heatmap(res, k = 2)

plot of chunk tab-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) gender(p) other(p) k
#> CV:hclust 74         3.24e-15   0.00257 5.71e-05 2
#> CV:hclust 74         5.12e-28   0.00154 3.01e-08 3
#> CV:hclust 74         3.50e-38   0.00227 1.47e-08 4
#> CV:hclust 73         1.30e-39   0.00172 7.96e-08 5
#> CV:hclust 73         7.04e-50   0.00630 7.96e-20 6

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


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 76 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 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-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.447           0.755       0.786         0.4285 0.595   0.595
#> 3 3 0.490           0.723       0.823         0.4115 0.746   0.578
#> 4 4 0.721           0.791       0.830         0.1746 0.833   0.595
#> 5 5 0.689           0.790       0.820         0.0908 0.888   0.647
#> 6 6 0.725           0.666       0.754         0.0514 0.956   0.799

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
#> GSM918603     1  0.0938      0.898 0.988 0.012
#> GSM918641     1  0.0938      0.898 0.988 0.012
#> GSM918580     1  0.0938      0.898 0.988 0.012
#> GSM918593     1  0.0938      0.898 0.988 0.012
#> GSM918625     1  0.0938      0.898 0.988 0.012
#> GSM918638     1  0.0938      0.898 0.988 0.012
#> GSM918642     1  0.0938      0.898 0.988 0.012
#> GSM918643     1  0.0938      0.898 0.988 0.012
#> GSM918619     1  0.5842      0.919 0.860 0.140
#> GSM918621     1  0.5842      0.919 0.860 0.140
#> GSM918582     1  0.5842      0.919 0.860 0.140
#> GSM918649     1  0.5842      0.919 0.860 0.140
#> GSM918651     1  0.5842      0.919 0.860 0.140
#> GSM918607     1  0.5842      0.919 0.860 0.140
#> GSM918609     1  0.5842      0.919 0.860 0.140
#> GSM918608     1  0.5842      0.919 0.860 0.140
#> GSM918606     1  0.5842      0.919 0.860 0.140
#> GSM918620     1  0.5842      0.919 0.860 0.140
#> GSM918628     1  0.5737      0.916 0.864 0.136
#> GSM918586     2  0.9815      0.345 0.420 0.580
#> GSM918594     2  0.9815      0.345 0.420 0.580
#> GSM918600     2  0.9815      0.345 0.420 0.580
#> GSM918601     2  0.9815      0.345 0.420 0.580
#> GSM918612     2  0.9815      0.345 0.420 0.580
#> GSM918614     2  0.9815      0.345 0.420 0.580
#> GSM918629     2  0.2043      0.809 0.032 0.968
#> GSM918587     2  0.2423      0.805 0.040 0.960
#> GSM918588     2  0.9815      0.345 0.420 0.580
#> GSM918589     2  0.9815      0.345 0.420 0.580
#> GSM918611     2  0.9815      0.345 0.420 0.580
#> GSM918624     2  0.9815      0.345 0.420 0.580
#> GSM918637     2  0.5629      0.746 0.132 0.868
#> GSM918639     2  0.9815      0.345 0.420 0.580
#> GSM918640     2  0.9815      0.345 0.420 0.580
#> GSM918636     2  0.9815      0.345 0.420 0.580
#> GSM918590     2  0.3274      0.825 0.060 0.940
#> GSM918610     2  0.3274      0.825 0.060 0.940
#> GSM918615     2  0.3274      0.825 0.060 0.940
#> GSM918616     2  0.2043      0.809 0.032 0.968
#> GSM918632     2  0.3274      0.825 0.060 0.940
#> GSM918647     2  0.3274      0.825 0.060 0.940
#> GSM918578     2  0.3274      0.825 0.060 0.940
#> GSM918579     2  0.3274      0.825 0.060 0.940
#> GSM918581     2  0.3274      0.825 0.060 0.940
#> GSM918584     2  0.3274      0.825 0.060 0.940
#> GSM918591     2  0.3274      0.825 0.060 0.940
#> GSM918592     2  0.3274      0.825 0.060 0.940
#> GSM918597     2  0.2043      0.809 0.032 0.968
#> GSM918598     2  0.3274      0.825 0.060 0.940
#> GSM918599     2  0.2043      0.809 0.032 0.968
#> GSM918604     2  0.9732      0.369 0.404 0.596
#> GSM918605     2  0.0000      0.814 0.000 1.000
#> GSM918613     2  0.3274      0.825 0.060 0.940
#> GSM918623     2  0.3274      0.825 0.060 0.940
#> GSM918626     2  0.2043      0.809 0.032 0.968
#> GSM918627     2  0.2043      0.809 0.032 0.968
#> GSM918633     2  0.3274      0.825 0.060 0.940
#> GSM918634     2  0.2043      0.809 0.032 0.968
#> GSM918635     2  0.3274      0.825 0.060 0.940
#> GSM918645     2  0.3274      0.825 0.060 0.940
#> GSM918646     2  0.2043      0.820 0.032 0.968
#> GSM918648     2  0.3274      0.825 0.060 0.940
#> GSM918650     2  0.3274      0.825 0.060 0.940
#> GSM918652     2  0.0000      0.814 0.000 1.000
#> GSM918653     2  0.3274      0.825 0.060 0.940
#> GSM918622     2  0.2043      0.809 0.032 0.968
#> GSM918583     2  0.3274      0.825 0.060 0.940
#> GSM918585     2  0.3274      0.825 0.060 0.940
#> GSM918595     2  0.3274      0.825 0.060 0.940
#> GSM918596     2  0.2043      0.809 0.032 0.968
#> GSM918602     2  0.2043      0.809 0.032 0.968
#> GSM918617     2  0.2043      0.809 0.032 0.968
#> GSM918630     2  0.3274      0.825 0.060 0.940
#> GSM918631     2  0.3274      0.825 0.060 0.940
#> GSM918618     1  0.5737      0.883 0.864 0.136
#> GSM918644     1  0.5842      0.881 0.860 0.140

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>           class entropy silhouette    p1    p2    p3
#> GSM918603     1  0.3784     0.7595 0.864 0.004 0.132
#> GSM918641     1  0.3784     0.7595 0.864 0.004 0.132
#> GSM918580     1  0.3784     0.7595 0.864 0.004 0.132
#> GSM918593     1  0.3784     0.7595 0.864 0.004 0.132
#> GSM918625     1  0.3784     0.7595 0.864 0.004 0.132
#> GSM918638     1  0.3784     0.7595 0.864 0.004 0.132
#> GSM918642     1  0.3784     0.7595 0.864 0.004 0.132
#> GSM918643     1  0.3784     0.7595 0.864 0.004 0.132
#> GSM918619     1  0.6999     0.8085 0.680 0.052 0.268
#> GSM918621     1  0.6999     0.8085 0.680 0.052 0.268
#> GSM918582     1  0.6999     0.8085 0.680 0.052 0.268
#> GSM918649     1  0.6999     0.8085 0.680 0.052 0.268
#> GSM918651     1  0.6999     0.8085 0.680 0.052 0.268
#> GSM918607     1  0.6999     0.8085 0.680 0.052 0.268
#> GSM918609     1  0.6999     0.8085 0.680 0.052 0.268
#> GSM918608     1  0.6999     0.8085 0.680 0.052 0.268
#> GSM918606     1  0.6999     0.8085 0.680 0.052 0.268
#> GSM918620     1  0.6999     0.8085 0.680 0.052 0.268
#> GSM918628     1  0.7742     0.7603 0.584 0.060 0.356
#> GSM918586     3  0.4723     0.8999 0.016 0.160 0.824
#> GSM918594     3  0.4723     0.8999 0.016 0.160 0.824
#> GSM918600     3  0.4723     0.8999 0.016 0.160 0.824
#> GSM918601     3  0.4723     0.8999 0.016 0.160 0.824
#> GSM918612     3  0.4723     0.8999 0.016 0.160 0.824
#> GSM918614     3  0.4723     0.8999 0.016 0.160 0.824
#> GSM918629     3  0.5591     0.6816 0.000 0.304 0.696
#> GSM918587     3  0.5650     0.6760 0.000 0.312 0.688
#> GSM918588     3  0.4723     0.8999 0.016 0.160 0.824
#> GSM918589     3  0.4723     0.8999 0.016 0.160 0.824
#> GSM918611     3  0.4723     0.8999 0.016 0.160 0.824
#> GSM918624     3  0.4723     0.8999 0.016 0.160 0.824
#> GSM918637     3  0.4002     0.8872 0.000 0.160 0.840
#> GSM918639     3  0.4723     0.8999 0.016 0.160 0.824
#> GSM918640     3  0.4723     0.8999 0.016 0.160 0.824
#> GSM918636     3  0.4723     0.8999 0.016 0.160 0.824
#> GSM918590     2  0.1163     0.8448 0.000 0.972 0.028
#> GSM918610     2  0.0747     0.8506 0.000 0.984 0.016
#> GSM918615     2  0.0747     0.8506 0.000 0.984 0.016
#> GSM918616     3  0.6252     0.3251 0.000 0.444 0.556
#> GSM918632     2  0.0000     0.8493 0.000 1.000 0.000
#> GSM918647     2  0.0000     0.8493 0.000 1.000 0.000
#> GSM918578     2  0.0747     0.8506 0.000 0.984 0.016
#> GSM918579     2  0.0000     0.8493 0.000 1.000 0.000
#> GSM918581     2  0.0000     0.8493 0.000 1.000 0.000
#> GSM918584     2  0.0747     0.8506 0.000 0.984 0.016
#> GSM918591     2  0.0747     0.8506 0.000 0.984 0.016
#> GSM918592     2  0.0747     0.8506 0.000 0.984 0.016
#> GSM918597     2  0.6308    -0.1372 0.000 0.508 0.492
#> GSM918598     2  0.0747     0.8506 0.000 0.984 0.016
#> GSM918599     2  0.5760     0.3573 0.000 0.672 0.328
#> GSM918604     3  0.4002     0.8872 0.000 0.160 0.840
#> GSM918605     2  0.2625     0.7913 0.000 0.916 0.084
#> GSM918613     2  0.0747     0.8506 0.000 0.984 0.016
#> GSM918623     2  0.0000     0.8493 0.000 1.000 0.000
#> GSM918626     2  0.6286    -0.0205 0.000 0.536 0.464
#> GSM918627     2  0.6286    -0.0205 0.000 0.536 0.464
#> GSM918633     2  0.0747     0.8506 0.000 0.984 0.016
#> GSM918634     2  0.6295    -0.0539 0.000 0.528 0.472
#> GSM918635     2  0.0000     0.8493 0.000 1.000 0.000
#> GSM918645     2  0.0747     0.8506 0.000 0.984 0.016
#> GSM918646     2  0.0892     0.8397 0.000 0.980 0.020
#> GSM918648     2  0.0000     0.8493 0.000 1.000 0.000
#> GSM918650     2  0.0747     0.8506 0.000 0.984 0.016
#> GSM918652     2  0.1643     0.8308 0.000 0.956 0.044
#> GSM918653     2  0.0000     0.8493 0.000 1.000 0.000
#> GSM918622     2  0.6286    -0.0205 0.000 0.536 0.464
#> GSM918583     2  0.0000     0.8493 0.000 1.000 0.000
#> GSM918585     2  0.0000     0.8493 0.000 1.000 0.000
#> GSM918595     2  0.1163     0.8448 0.000 0.972 0.028
#> GSM918596     3  0.6079     0.4931 0.000 0.388 0.612
#> GSM918602     2  0.6302    -0.0877 0.000 0.520 0.480
#> GSM918617     2  0.6192     0.1112 0.000 0.580 0.420
#> GSM918630     2  0.0000     0.8493 0.000 1.000 0.000
#> GSM918631     2  0.0000     0.8493 0.000 1.000 0.000
#> GSM918618     1  0.7727     0.5501 0.600 0.064 0.336
#> GSM918644     3  0.8768    -0.0135 0.408 0.112 0.480

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM918603     4  0.4564      1.000 0.328 0.000 0.000 0.672
#> GSM918641     4  0.4564      1.000 0.328 0.000 0.000 0.672
#> GSM918580     4  0.4564      1.000 0.328 0.000 0.000 0.672
#> GSM918593     4  0.4564      1.000 0.328 0.000 0.000 0.672
#> GSM918625     4  0.4564      1.000 0.328 0.000 0.000 0.672
#> GSM918638     4  0.4564      1.000 0.328 0.000 0.000 0.672
#> GSM918642     4  0.4564      1.000 0.328 0.000 0.000 0.672
#> GSM918643     4  0.4564      1.000 0.328 0.000 0.000 0.672
#> GSM918619     1  0.0188      0.993 0.996 0.004 0.000 0.000
#> GSM918621     1  0.0188      0.993 0.996 0.004 0.000 0.000
#> GSM918582     1  0.0188      0.993 0.996 0.004 0.000 0.000
#> GSM918649     1  0.0188      0.993 0.996 0.004 0.000 0.000
#> GSM918651     1  0.0188      0.993 0.996 0.004 0.000 0.000
#> GSM918607     1  0.0188      0.993 0.996 0.004 0.000 0.000
#> GSM918609     1  0.0188      0.993 0.996 0.004 0.000 0.000
#> GSM918608     1  0.0188      0.993 0.996 0.004 0.000 0.000
#> GSM918606     1  0.0188      0.993 0.996 0.004 0.000 0.000
#> GSM918620     1  0.0188      0.993 0.996 0.004 0.000 0.000
#> GSM918628     1  0.1489      0.925 0.952 0.004 0.000 0.044
#> GSM918586     3  0.5161      0.761 0.024 0.000 0.676 0.300
#> GSM918594     3  0.5206      0.761 0.024 0.000 0.668 0.308
#> GSM918600     3  0.5161      0.761 0.024 0.000 0.676 0.300
#> GSM918601     3  0.5300      0.761 0.028 0.000 0.664 0.308
#> GSM918612     3  0.5161      0.761 0.024 0.000 0.676 0.300
#> GSM918614     3  0.5161      0.761 0.024 0.000 0.676 0.300
#> GSM918629     3  0.4910      0.759 0.020 0.000 0.704 0.276
#> GSM918587     3  0.0188      0.655 0.000 0.000 0.996 0.004
#> GSM918588     3  0.5161      0.761 0.024 0.000 0.676 0.300
#> GSM918589     3  0.5161      0.761 0.024 0.000 0.676 0.300
#> GSM918611     3  0.5161      0.761 0.024 0.000 0.676 0.300
#> GSM918624     3  0.5300      0.761 0.028 0.000 0.664 0.308
#> GSM918637     3  0.5206      0.761 0.024 0.000 0.668 0.308
#> GSM918639     3  0.5300      0.761 0.028 0.000 0.664 0.308
#> GSM918640     3  0.5300      0.761 0.028 0.000 0.664 0.308
#> GSM918636     3  0.5161      0.761 0.024 0.000 0.676 0.300
#> GSM918590     2  0.4720      0.758 0.000 0.672 0.324 0.004
#> GSM918610     2  0.3707      0.869 0.000 0.840 0.132 0.028
#> GSM918615     2  0.3402      0.867 0.000 0.832 0.164 0.004
#> GSM918616     3  0.2561      0.615 0.004 0.068 0.912 0.016
#> GSM918632     2  0.1118      0.861 0.000 0.964 0.000 0.036
#> GSM918647     2  0.1118      0.861 0.000 0.964 0.000 0.036
#> GSM918578     2  0.3760      0.868 0.000 0.836 0.136 0.028
#> GSM918579     2  0.1174      0.864 0.000 0.968 0.020 0.012
#> GSM918581     2  0.1022      0.863 0.000 0.968 0.000 0.032
#> GSM918584     2  0.3208      0.871 0.000 0.848 0.148 0.004
#> GSM918591     2  0.3707      0.869 0.000 0.840 0.132 0.028
#> GSM918592     2  0.3707      0.869 0.000 0.840 0.132 0.028
#> GSM918597     3  0.3444      0.466 0.000 0.184 0.816 0.000
#> GSM918598     2  0.3760      0.868 0.000 0.836 0.136 0.028
#> GSM918599     2  0.5454      0.149 0.004 0.520 0.468 0.008
#> GSM918604     3  0.5010      0.759 0.024 0.000 0.700 0.276
#> GSM918605     2  0.4917      0.751 0.004 0.664 0.328 0.004
#> GSM918613     2  0.3668      0.858 0.000 0.808 0.188 0.004
#> GSM918623     2  0.1118      0.861 0.000 0.964 0.000 0.036
#> GSM918626     3  0.3942      0.368 0.000 0.236 0.764 0.000
#> GSM918627     3  0.4040      0.346 0.000 0.248 0.752 0.000
#> GSM918633     2  0.3208      0.870 0.000 0.848 0.148 0.004
#> GSM918634     3  0.4302      0.364 0.004 0.236 0.756 0.004
#> GSM918635     2  0.1022      0.862 0.000 0.968 0.000 0.032
#> GSM918645     2  0.3751      0.854 0.000 0.800 0.196 0.004
#> GSM918646     2  0.3479      0.810 0.000 0.840 0.148 0.012
#> GSM918648     2  0.1118      0.861 0.000 0.964 0.000 0.036
#> GSM918650     2  0.3157      0.871 0.000 0.852 0.144 0.004
#> GSM918652     2  0.4969      0.766 0.004 0.676 0.312 0.008
#> GSM918653     2  0.1174      0.864 0.000 0.968 0.020 0.012
#> GSM918622     3  0.4040      0.346 0.000 0.248 0.752 0.000
#> GSM918583     2  0.0895      0.866 0.000 0.976 0.020 0.004
#> GSM918585     2  0.0657      0.863 0.000 0.984 0.004 0.012
#> GSM918595     2  0.4238      0.856 0.000 0.796 0.176 0.028
#> GSM918596     3  0.0657      0.653 0.004 0.000 0.984 0.012
#> GSM918602     3  0.3710      0.458 0.004 0.192 0.804 0.000
#> GSM918617     3  0.5443      0.014 0.004 0.456 0.532 0.008
#> GSM918630     2  0.2988      0.834 0.000 0.876 0.112 0.012
#> GSM918631     2  0.1174      0.864 0.000 0.968 0.020 0.012
#> GSM918618     3  0.6179      0.388 0.320 0.000 0.608 0.072
#> GSM918644     3  0.5807      0.446 0.312 0.000 0.636 0.052

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>           class entropy silhouette    p1    p2    p3    p4    p5
#> GSM918603     4  0.3205      0.998 0.176 0.000 0.004 0.816 0.004
#> GSM918641     4  0.3205      0.998 0.176 0.000 0.004 0.816 0.004
#> GSM918580     4  0.3205      0.998 0.176 0.000 0.004 0.816 0.004
#> GSM918593     4  0.3048      0.999 0.176 0.000 0.004 0.820 0.000
#> GSM918625     4  0.3048      0.999 0.176 0.000 0.004 0.820 0.000
#> GSM918638     4  0.3048      0.999 0.176 0.000 0.004 0.820 0.000
#> GSM918642     4  0.3048      0.999 0.176 0.000 0.004 0.820 0.000
#> GSM918643     4  0.3048      0.999 0.176 0.000 0.004 0.820 0.000
#> GSM918619     1  0.0671      0.970 0.980 0.000 0.000 0.004 0.016
#> GSM918621     1  0.0671      0.970 0.980 0.000 0.000 0.004 0.016
#> GSM918582     1  0.0000      0.973 1.000 0.000 0.000 0.000 0.000
#> GSM918649     1  0.0000      0.973 1.000 0.000 0.000 0.000 0.000
#> GSM918651     1  0.0000      0.973 1.000 0.000 0.000 0.000 0.000
#> GSM918607     1  0.0162      0.973 0.996 0.000 0.000 0.000 0.004
#> GSM918609     1  0.0771      0.970 0.976 0.000 0.000 0.004 0.020
#> GSM918608     1  0.0162      0.973 0.996 0.000 0.000 0.000 0.004
#> GSM918606     1  0.0771      0.970 0.976 0.000 0.000 0.004 0.020
#> GSM918620     1  0.0162      0.973 0.996 0.000 0.000 0.000 0.004
#> GSM918628     1  0.3843      0.798 0.828 0.004 0.016 0.040 0.112
#> GSM918586     3  0.0000      0.936 0.000 0.000 1.000 0.000 0.000
#> GSM918594     3  0.1195      0.929 0.000 0.000 0.960 0.012 0.028
#> GSM918600     3  0.0000      0.936 0.000 0.000 1.000 0.000 0.000
#> GSM918601     3  0.1568      0.924 0.000 0.000 0.944 0.020 0.036
#> GSM918612     3  0.0000      0.936 0.000 0.000 1.000 0.000 0.000
#> GSM918614     3  0.0000      0.936 0.000 0.000 1.000 0.000 0.000
#> GSM918629     3  0.0290      0.935 0.000 0.000 0.992 0.000 0.008
#> GSM918587     5  0.3452      0.732 0.000 0.000 0.244 0.000 0.756
#> GSM918588     3  0.0000      0.936 0.000 0.000 1.000 0.000 0.000
#> GSM918589     3  0.0000      0.936 0.000 0.000 1.000 0.000 0.000
#> GSM918611     3  0.0963      0.917 0.000 0.000 0.964 0.000 0.036
#> GSM918624     3  0.1568      0.924 0.000 0.000 0.944 0.020 0.036
#> GSM918637     3  0.2208      0.897 0.000 0.000 0.908 0.020 0.072
#> GSM918639     3  0.1568      0.924 0.000 0.000 0.944 0.020 0.036
#> GSM918640     3  0.1568      0.924 0.000 0.000 0.944 0.020 0.036
#> GSM918636     3  0.0000      0.936 0.000 0.000 1.000 0.000 0.000
#> GSM918590     5  0.2930      0.644 0.000 0.164 0.000 0.004 0.832
#> GSM918610     2  0.3300      0.649 0.000 0.792 0.000 0.004 0.204
#> GSM918615     2  0.5331      0.568 0.000 0.568 0.000 0.060 0.372
#> GSM918616     5  0.3899      0.796 0.000 0.020 0.192 0.008 0.780
#> GSM918632     2  0.1851      0.681 0.000 0.912 0.000 0.088 0.000
#> GSM918647     2  0.2020      0.683 0.000 0.900 0.000 0.100 0.000
#> GSM918578     2  0.3300      0.649 0.000 0.792 0.000 0.004 0.204
#> GSM918579     2  0.4845      0.667 0.000 0.724 0.000 0.148 0.128
#> GSM918581     2  0.0451      0.688 0.000 0.988 0.000 0.004 0.008
#> GSM918584     2  0.5203      0.615 0.000 0.608 0.000 0.060 0.332
#> GSM918591     2  0.3300      0.649 0.000 0.792 0.000 0.004 0.204
#> GSM918592     2  0.3300      0.649 0.000 0.792 0.000 0.004 0.204
#> GSM918597     5  0.4221      0.817 0.000 0.044 0.188 0.004 0.764
#> GSM918598     2  0.3300      0.649 0.000 0.792 0.000 0.004 0.204
#> GSM918599     5  0.5430      0.568 0.000 0.296 0.068 0.008 0.628
#> GSM918604     3  0.0963      0.917 0.000 0.000 0.964 0.000 0.036
#> GSM918605     5  0.2848      0.656 0.000 0.156 0.000 0.004 0.840
#> GSM918613     2  0.5401      0.517 0.000 0.536 0.000 0.060 0.404
#> GSM918623     2  0.1851      0.681 0.000 0.912 0.000 0.088 0.000
#> GSM918626     5  0.3893      0.811 0.000 0.052 0.140 0.004 0.804
#> GSM918627     5  0.4214      0.820 0.000 0.064 0.152 0.004 0.780
#> GSM918633     2  0.5172      0.619 0.000 0.616 0.000 0.060 0.324
#> GSM918634     5  0.4189      0.820 0.000 0.060 0.144 0.008 0.788
#> GSM918635     2  0.1908      0.680 0.000 0.908 0.000 0.092 0.000
#> GSM918645     2  0.5454      0.417 0.000 0.488 0.000 0.060 0.452
#> GSM918646     2  0.5553      0.118 0.000 0.484 0.000 0.068 0.448
#> GSM918648     2  0.1851      0.681 0.000 0.912 0.000 0.088 0.000
#> GSM918650     2  0.5139      0.625 0.000 0.624 0.000 0.060 0.316
#> GSM918652     5  0.3616      0.610 0.000 0.164 0.000 0.032 0.804
#> GSM918653     2  0.4845      0.667 0.000 0.724 0.000 0.148 0.128
#> GSM918622     5  0.4214      0.820 0.000 0.064 0.152 0.004 0.780
#> GSM918583     2  0.4454      0.675 0.000 0.760 0.000 0.112 0.128
#> GSM918585     2  0.4309      0.678 0.000 0.768 0.000 0.148 0.084
#> GSM918595     2  0.4166      0.439 0.000 0.648 0.000 0.004 0.348
#> GSM918596     5  0.3582      0.771 0.000 0.000 0.224 0.008 0.768
#> GSM918602     5  0.4439      0.816 0.000 0.056 0.176 0.008 0.760
#> GSM918617     5  0.5117      0.589 0.000 0.276 0.072 0.000 0.652
#> GSM918630     2  0.5827      0.522 0.000 0.596 0.000 0.144 0.260
#> GSM918631     2  0.4845      0.667 0.000 0.724 0.000 0.148 0.128
#> GSM918618     3  0.5965      0.599 0.148 0.000 0.668 0.040 0.144
#> GSM918644     3  0.5202      0.650 0.148 0.000 0.700 0.004 0.148

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>           class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM918603     4  0.2135      0.998 0.128 0.000 0.000 0.872 0.000 0.000
#> GSM918641     4  0.2389      0.994 0.128 0.000 0.000 0.864 0.000 0.008
#> GSM918580     4  0.2389      0.994 0.128 0.000 0.000 0.864 0.000 0.008
#> GSM918593     4  0.2135      0.998 0.128 0.000 0.000 0.872 0.000 0.000
#> GSM918625     4  0.2135      0.998 0.128 0.000 0.000 0.872 0.000 0.000
#> GSM918638     4  0.2135      0.998 0.128 0.000 0.000 0.872 0.000 0.000
#> GSM918642     4  0.2135      0.998 0.128 0.000 0.000 0.872 0.000 0.000
#> GSM918643     4  0.2135      0.998 0.128 0.000 0.000 0.872 0.000 0.000
#> GSM918619     1  0.0935      0.933 0.964 0.000 0.000 0.000 0.004 0.032
#> GSM918621     1  0.1010      0.933 0.960 0.000 0.000 0.000 0.004 0.036
#> GSM918582     1  0.0146      0.938 0.996 0.000 0.000 0.000 0.000 0.004
#> GSM918649     1  0.0363      0.937 0.988 0.000 0.000 0.000 0.000 0.012
#> GSM918651     1  0.0260      0.938 0.992 0.000 0.000 0.000 0.000 0.008
#> GSM918607     1  0.0260      0.938 0.992 0.000 0.000 0.000 0.000 0.008
#> GSM918609     1  0.0935      0.933 0.964 0.000 0.000 0.000 0.004 0.032
#> GSM918608     1  0.0363      0.938 0.988 0.000 0.000 0.000 0.000 0.012
#> GSM918606     1  0.0935      0.934 0.964 0.000 0.000 0.000 0.004 0.032
#> GSM918620     1  0.0458      0.938 0.984 0.000 0.000 0.000 0.000 0.016
#> GSM918628     1  0.7080      0.420 0.532 0.000 0.068 0.044 0.196 0.160
#> GSM918586     3  0.0717      0.836 0.000 0.000 0.976 0.008 0.016 0.000
#> GSM918594     3  0.4243      0.787 0.000 0.000 0.776 0.072 0.040 0.112
#> GSM918600     3  0.0405      0.839 0.000 0.000 0.988 0.000 0.008 0.004
#> GSM918601     3  0.4371      0.784 0.000 0.000 0.768 0.072 0.048 0.112
#> GSM918612     3  0.0260      0.839 0.000 0.000 0.992 0.000 0.008 0.000
#> GSM918614     3  0.0260      0.839 0.000 0.000 0.992 0.000 0.008 0.000
#> GSM918629     3  0.1116      0.835 0.000 0.000 0.960 0.008 0.028 0.004
#> GSM918587     5  0.4376      0.613 0.000 0.000 0.184 0.020 0.736 0.060
#> GSM918588     3  0.0146      0.838 0.000 0.000 0.996 0.000 0.000 0.004
#> GSM918589     3  0.2555      0.810 0.000 0.000 0.888 0.016 0.064 0.032
#> GSM918611     3  0.3372      0.765 0.000 0.000 0.824 0.016 0.124 0.036
#> GSM918624     3  0.4371      0.784 0.000 0.000 0.768 0.072 0.048 0.112
#> GSM918637     3  0.4951      0.753 0.000 0.000 0.724 0.072 0.088 0.116
#> GSM918639     3  0.4371      0.784 0.000 0.000 0.768 0.072 0.048 0.112
#> GSM918640     3  0.4371      0.784 0.000 0.000 0.768 0.072 0.048 0.112
#> GSM918636     3  0.2495      0.812 0.000 0.000 0.892 0.016 0.060 0.032
#> GSM918590     5  0.4919      0.766 0.000 0.132 0.000 0.016 0.692 0.160
#> GSM918610     6  0.4180      0.873 0.000 0.348 0.000 0.000 0.024 0.628
#> GSM918615     2  0.5329     -0.196 0.000 0.524 0.000 0.012 0.076 0.388
#> GSM918616     5  0.4234      0.832 0.000 0.024 0.064 0.004 0.772 0.136
#> GSM918632     2  0.3248      0.273 0.000 0.768 0.000 0.004 0.004 0.224
#> GSM918647     2  0.3301      0.280 0.000 0.772 0.000 0.008 0.004 0.216
#> GSM918578     6  0.4238      0.875 0.000 0.344 0.000 0.000 0.028 0.628
#> GSM918579     2  0.0458      0.447 0.000 0.984 0.000 0.000 0.016 0.000
#> GSM918581     6  0.4111      0.562 0.000 0.456 0.000 0.004 0.004 0.536
#> GSM918584     2  0.4935     -0.199 0.000 0.556 0.000 0.012 0.044 0.388
#> GSM918591     6  0.4180      0.873 0.000 0.348 0.000 0.000 0.024 0.628
#> GSM918592     6  0.4238      0.875 0.000 0.344 0.000 0.000 0.028 0.628
#> GSM918597     5  0.4726      0.823 0.000 0.024 0.092 0.016 0.748 0.120
#> GSM918598     6  0.4344      0.867 0.000 0.336 0.000 0.000 0.036 0.628
#> GSM918599     5  0.4302      0.719 0.000 0.224 0.032 0.008 0.724 0.012
#> GSM918604     3  0.2274      0.806 0.000 0.000 0.892 0.012 0.088 0.008
#> GSM918605     5  0.4731      0.771 0.000 0.132 0.000 0.012 0.708 0.148
#> GSM918613     2  0.5675     -0.153 0.000 0.496 0.000 0.016 0.104 0.384
#> GSM918623     2  0.3248      0.273 0.000 0.768 0.000 0.004 0.004 0.224
#> GSM918626     5  0.3670      0.750 0.000 0.028 0.072 0.024 0.836 0.040
#> GSM918627     5  0.4826      0.836 0.000 0.060 0.052 0.016 0.748 0.124
#> GSM918633     2  0.5080     -0.217 0.000 0.544 0.000 0.016 0.048 0.392
#> GSM918634     5  0.4973      0.828 0.000 0.052 0.052 0.016 0.728 0.152
#> GSM918635     2  0.3276      0.266 0.000 0.764 0.000 0.004 0.004 0.228
#> GSM918645     2  0.5992     -0.138 0.000 0.448 0.000 0.012 0.160 0.380
#> GSM918646     2  0.4640     -0.149 0.000 0.524 0.000 0.016 0.444 0.016
#> GSM918648     2  0.3248      0.273 0.000 0.768 0.000 0.004 0.004 0.224
#> GSM918650     2  0.4810     -0.237 0.000 0.552 0.000 0.008 0.040 0.400
#> GSM918652     5  0.5262      0.679 0.000 0.232 0.000 0.016 0.636 0.116
#> GSM918653     2  0.0603      0.446 0.000 0.980 0.000 0.004 0.016 0.000
#> GSM918622     5  0.4943      0.836 0.000 0.060 0.052 0.016 0.736 0.136
#> GSM918583     2  0.3095      0.300 0.000 0.828 0.000 0.012 0.016 0.144
#> GSM918585     2  0.0146      0.439 0.000 0.996 0.000 0.004 0.000 0.000
#> GSM918595     6  0.5007      0.632 0.000 0.224 0.000 0.004 0.124 0.648
#> GSM918596     5  0.3655      0.820 0.000 0.004 0.088 0.000 0.800 0.108
#> GSM918602     5  0.4597      0.837 0.000 0.044 0.060 0.008 0.756 0.132
#> GSM918617     5  0.4027      0.733 0.000 0.224 0.028 0.008 0.736 0.004
#> GSM918630     2  0.2520      0.393 0.000 0.844 0.000 0.004 0.152 0.000
#> GSM918631     2  0.0458      0.447 0.000 0.984 0.000 0.000 0.016 0.000
#> GSM918618     3  0.6996      0.493 0.044 0.000 0.516 0.048 0.240 0.152
#> GSM918644     3  0.6640      0.519 0.032 0.000 0.532 0.032 0.252 0.152

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

consensus_heatmap(res, k = 2)

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

consensus_heatmap(res, k = 3)

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

consensus_heatmap(res, k = 4)

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

consensus_heatmap(res, k = 5)

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

consensus_heatmap(res, k = 6)

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

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

membership_heatmap(res, k = 2)

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

membership_heatmap(res, k = 3)

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

membership_heatmap(res, k = 4)

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

membership_heatmap(res, k = 5)

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

membership_heatmap(res, k = 6)

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

As soon as we have had the classes for columns, we can look for signatures which are significantly different between classes which can be candidate marks for certain classes. Following are the heatmaps for signatures.

Signature heatmaps where rows are scaled:

get_signatures(res, k = 2)

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

get_signatures(res, k = 3)

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

get_signatures(res, k = 4)

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

get_signatures(res, k = 5)

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

get_signatures(res, k = 6)

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

Signature heatmaps where rows are not scaled:

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

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

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

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

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

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

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

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

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

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

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk CV-kmeans-signature_compare

get_signature() returns a data frame invisibly. TO get the list of signatures, the function call should be assigned to a variable explicitly. In following code, if plot argument is set to FALSE, no heatmap is plotted while only the differential analysis is performed.

# code only for demonstration
tb = get_signature(res, k = ..., plot = FALSE)

An example of the output of tb is:

#>   which_row         fdr    mean_1    mean_2 scaled_mean_1 scaled_mean_2 km
#> 1        38 0.042760348  8.373488  9.131774    -0.5533452     0.5164555  1
#> 2        40 0.018707592  7.106213  8.469186    -0.6173731     0.5762149  1
#> 3        55 0.019134737 10.221463 11.207825    -0.6159697     0.5749050  1
#> 4        59 0.006059896  5.921854  7.869574    -0.6899429     0.6439467  1
#> 5        60 0.018055526  8.928898 10.211722    -0.6204761     0.5791110  1
#> 6        98 0.009384629 15.714769 14.887706     0.6635654    -0.6193277  2
...

The columns in tb are:

  1. which_row: row indices corresponding to the input matrix.
  2. fdr: FDR for the differential test.
  3. mean_x: The mean value in group x.
  4. scaled_mean_x: The mean value in group x after rows are scaled.
  5. km: Row groups if k-means clustering is applied to rows.

UMAP plot which shows how samples are separated.

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

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

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

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

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

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

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

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

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

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

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk CV-kmeans-collect-classes

Test correlation between subgroups and known annotations. If the known annotation is numeric, one-way ANOVA test is applied, and if the known annotation is discrete, chi-squared contingency table test is applied.

test_to_known_factors(res)
#>            n disease.state(p) gender(p) other(p) k
#> CV:kmeans 62         4.69e-12   0.01286 4.35e-04 2
#> CV:kmeans 65         7.55e-22   0.00134 5.91e-04 3
#> CV:kmeans 66         1.51e-32   0.00185 1.66e-07 4
#> CV:kmeans 73         3.40e-33   0.00803 6.19e-07 5
#> CV:kmeans 56         3.41e-25   0.01375 2.96e-04 6

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


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

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

collect_plots(res)

plot of chunk CV-skmeans-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 1.000           0.980       0.993         0.5062 0.494   0.494
#> 3 3 1.000           0.976       0.991         0.3236 0.724   0.498
#> 4 4 0.875           0.905       0.923         0.0689 0.961   0.883
#> 5 5 0.835           0.823       0.884         0.1062 0.888   0.637
#> 6 6 0.825           0.747       0.838         0.0520 0.931   0.687

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
#> GSM918603     1   0.000     0.9852 1.000 0.000
#> GSM918641     1   0.000     0.9852 1.000 0.000
#> GSM918580     1   0.000     0.9852 1.000 0.000
#> GSM918593     1   0.000     0.9852 1.000 0.000
#> GSM918625     1   0.000     0.9852 1.000 0.000
#> GSM918638     1   0.000     0.9852 1.000 0.000
#> GSM918642     1   0.000     0.9852 1.000 0.000
#> GSM918643     1   0.000     0.9852 1.000 0.000
#> GSM918619     1   0.000     0.9852 1.000 0.000
#> GSM918621     1   0.000     0.9852 1.000 0.000
#> GSM918582     1   0.000     0.9852 1.000 0.000
#> GSM918649     1   0.000     0.9852 1.000 0.000
#> GSM918651     1   0.000     0.9852 1.000 0.000
#> GSM918607     1   0.000     0.9852 1.000 0.000
#> GSM918609     1   0.000     0.9852 1.000 0.000
#> GSM918608     1   0.000     0.9852 1.000 0.000
#> GSM918606     1   0.000     0.9852 1.000 0.000
#> GSM918620     1   0.000     0.9852 1.000 0.000
#> GSM918628     1   0.000     0.9852 1.000 0.000
#> GSM918586     1   0.000     0.9852 1.000 0.000
#> GSM918594     1   0.000     0.9852 1.000 0.000
#> GSM918600     1   0.000     0.9852 1.000 0.000
#> GSM918601     1   0.000     0.9852 1.000 0.000
#> GSM918612     1   0.000     0.9852 1.000 0.000
#> GSM918614     1   0.000     0.9852 1.000 0.000
#> GSM918629     2   0.000     1.0000 0.000 1.000
#> GSM918587     1   0.999     0.0653 0.516 0.484
#> GSM918588     1   0.000     0.9852 1.000 0.000
#> GSM918589     1   0.000     0.9852 1.000 0.000
#> GSM918611     1   0.000     0.9852 1.000 0.000
#> GSM918624     1   0.000     0.9852 1.000 0.000
#> GSM918637     1   0.260     0.9423 0.956 0.044
#> GSM918639     1   0.000     0.9852 1.000 0.000
#> GSM918640     1   0.000     0.9852 1.000 0.000
#> GSM918636     1   0.000     0.9852 1.000 0.000
#> GSM918590     2   0.000     1.0000 0.000 1.000
#> GSM918610     2   0.000     1.0000 0.000 1.000
#> GSM918615     2   0.000     1.0000 0.000 1.000
#> GSM918616     2   0.000     1.0000 0.000 1.000
#> GSM918632     2   0.000     1.0000 0.000 1.000
#> GSM918647     2   0.000     1.0000 0.000 1.000
#> GSM918578     2   0.000     1.0000 0.000 1.000
#> GSM918579     2   0.000     1.0000 0.000 1.000
#> GSM918581     2   0.000     1.0000 0.000 1.000
#> GSM918584     2   0.000     1.0000 0.000 1.000
#> GSM918591     2   0.000     1.0000 0.000 1.000
#> GSM918592     2   0.000     1.0000 0.000 1.000
#> GSM918597     2   0.000     1.0000 0.000 1.000
#> GSM918598     2   0.000     1.0000 0.000 1.000
#> GSM918599     2   0.000     1.0000 0.000 1.000
#> GSM918604     1   0.000     0.9852 1.000 0.000
#> GSM918605     2   0.000     1.0000 0.000 1.000
#> GSM918613     2   0.000     1.0000 0.000 1.000
#> GSM918623     2   0.000     1.0000 0.000 1.000
#> GSM918626     2   0.000     1.0000 0.000 1.000
#> GSM918627     2   0.000     1.0000 0.000 1.000
#> GSM918633     2   0.000     1.0000 0.000 1.000
#> GSM918634     2   0.000     1.0000 0.000 1.000
#> GSM918635     2   0.000     1.0000 0.000 1.000
#> GSM918645     2   0.000     1.0000 0.000 1.000
#> GSM918646     2   0.000     1.0000 0.000 1.000
#> GSM918648     2   0.000     1.0000 0.000 1.000
#> GSM918650     2   0.000     1.0000 0.000 1.000
#> GSM918652     2   0.000     1.0000 0.000 1.000
#> GSM918653     2   0.000     1.0000 0.000 1.000
#> GSM918622     2   0.000     1.0000 0.000 1.000
#> GSM918583     2   0.000     1.0000 0.000 1.000
#> GSM918585     2   0.000     1.0000 0.000 1.000
#> GSM918595     2   0.000     1.0000 0.000 1.000
#> GSM918596     2   0.000     1.0000 0.000 1.000
#> GSM918602     2   0.000     1.0000 0.000 1.000
#> GSM918617     2   0.000     1.0000 0.000 1.000
#> GSM918630     2   0.000     1.0000 0.000 1.000
#> GSM918631     2   0.000     1.0000 0.000 1.000
#> GSM918618     1   0.000     0.9852 1.000 0.000
#> GSM918644     1   0.000     0.9852 1.000 0.000

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>           class entropy silhouette p1    p2    p3
#> GSM918603     1  0.0000      1.000  1 0.000 0.000
#> GSM918641     1  0.0000      1.000  1 0.000 0.000
#> GSM918580     1  0.0000      1.000  1 0.000 0.000
#> GSM918593     1  0.0000      1.000  1 0.000 0.000
#> GSM918625     1  0.0000      1.000  1 0.000 0.000
#> GSM918638     1  0.0000      1.000  1 0.000 0.000
#> GSM918642     1  0.0000      1.000  1 0.000 0.000
#> GSM918643     1  0.0000      1.000  1 0.000 0.000
#> GSM918619     1  0.0000      1.000  1 0.000 0.000
#> GSM918621     1  0.0000      1.000  1 0.000 0.000
#> GSM918582     1  0.0000      1.000  1 0.000 0.000
#> GSM918649     1  0.0000      1.000  1 0.000 0.000
#> GSM918651     1  0.0000      1.000  1 0.000 0.000
#> GSM918607     1  0.0000      1.000  1 0.000 0.000
#> GSM918609     1  0.0000      1.000  1 0.000 0.000
#> GSM918608     1  0.0000      1.000  1 0.000 0.000
#> GSM918606     1  0.0000      1.000  1 0.000 0.000
#> GSM918620     1  0.0000      1.000  1 0.000 0.000
#> GSM918628     1  0.0000      1.000  1 0.000 0.000
#> GSM918586     3  0.0000      0.988  0 0.000 1.000
#> GSM918594     3  0.0000      0.988  0 0.000 1.000
#> GSM918600     3  0.0000      0.988  0 0.000 1.000
#> GSM918601     3  0.0000      0.988  0 0.000 1.000
#> GSM918612     3  0.0000      0.988  0 0.000 1.000
#> GSM918614     3  0.0000      0.988  0 0.000 1.000
#> GSM918629     3  0.0000      0.988  0 0.000 1.000
#> GSM918587     3  0.0000      0.988  0 0.000 1.000
#> GSM918588     3  0.0000      0.988  0 0.000 1.000
#> GSM918589     3  0.0000      0.988  0 0.000 1.000
#> GSM918611     3  0.0000      0.988  0 0.000 1.000
#> GSM918624     3  0.0000      0.988  0 0.000 1.000
#> GSM918637     3  0.0000      0.988  0 0.000 1.000
#> GSM918639     3  0.0000      0.988  0 0.000 1.000
#> GSM918640     3  0.0000      0.988  0 0.000 1.000
#> GSM918636     3  0.0000      0.988  0 0.000 1.000
#> GSM918590     2  0.0000      0.985  0 1.000 0.000
#> GSM918610     2  0.0000      0.985  0 1.000 0.000
#> GSM918615     2  0.0000      0.985  0 1.000 0.000
#> GSM918616     3  0.0000      0.988  0 0.000 1.000
#> GSM918632     2  0.0000      0.985  0 1.000 0.000
#> GSM918647     2  0.0000      0.985  0 1.000 0.000
#> GSM918578     2  0.0000      0.985  0 1.000 0.000
#> GSM918579     2  0.0000      0.985  0 1.000 0.000
#> GSM918581     2  0.0000      0.985  0 1.000 0.000
#> GSM918584     2  0.0000      0.985  0 1.000 0.000
#> GSM918591     2  0.0000      0.985  0 1.000 0.000
#> GSM918592     2  0.0000      0.985  0 1.000 0.000
#> GSM918597     3  0.0000      0.988  0 0.000 1.000
#> GSM918598     2  0.0000      0.985  0 1.000 0.000
#> GSM918599     2  0.6126      0.315  0 0.600 0.400
#> GSM918604     3  0.0000      0.988  0 0.000 1.000
#> GSM918605     2  0.0000      0.985  0 1.000 0.000
#> GSM918613     2  0.0000      0.985  0 1.000 0.000
#> GSM918623     2  0.0000      0.985  0 1.000 0.000
#> GSM918626     3  0.0000      0.988  0 0.000 1.000
#> GSM918627     3  0.0000      0.988  0 0.000 1.000
#> GSM918633     2  0.0000      0.985  0 1.000 0.000
#> GSM918634     3  0.0237      0.984  0 0.004 0.996
#> GSM918635     2  0.0000      0.985  0 1.000 0.000
#> GSM918645     2  0.0000      0.985  0 1.000 0.000
#> GSM918646     2  0.0000      0.985  0 1.000 0.000
#> GSM918648     2  0.0000      0.985  0 1.000 0.000
#> GSM918650     2  0.0000      0.985  0 1.000 0.000
#> GSM918652     2  0.0000      0.985  0 1.000 0.000
#> GSM918653     2  0.0000      0.985  0 1.000 0.000
#> GSM918622     3  0.0000      0.988  0 0.000 1.000
#> GSM918583     2  0.0000      0.985  0 1.000 0.000
#> GSM918585     2  0.0000      0.985  0 1.000 0.000
#> GSM918595     2  0.0000      0.985  0 1.000 0.000
#> GSM918596     3  0.0000      0.988  0 0.000 1.000
#> GSM918602     3  0.0000      0.988  0 0.000 1.000
#> GSM918617     3  0.5397      0.600  0 0.280 0.720
#> GSM918630     2  0.0000      0.985  0 1.000 0.000
#> GSM918631     2  0.0000      0.985  0 1.000 0.000
#> GSM918618     1  0.0000      1.000  1 0.000 0.000
#> GSM918644     1  0.0000      1.000  1 0.000 0.000

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM918603     4  0.3219      1.000 0.164 0.000 0.000 0.836
#> GSM918641     4  0.3219      1.000 0.164 0.000 0.000 0.836
#> GSM918580     4  0.3219      1.000 0.164 0.000 0.000 0.836
#> GSM918593     4  0.3219      1.000 0.164 0.000 0.000 0.836
#> GSM918625     4  0.3219      1.000 0.164 0.000 0.000 0.836
#> GSM918638     4  0.3219      1.000 0.164 0.000 0.000 0.836
#> GSM918642     4  0.3219      1.000 0.164 0.000 0.000 0.836
#> GSM918643     4  0.3219      1.000 0.164 0.000 0.000 0.836
#> GSM918619     1  0.0000      0.944 1.000 0.000 0.000 0.000
#> GSM918621     1  0.0000      0.944 1.000 0.000 0.000 0.000
#> GSM918582     1  0.0000      0.944 1.000 0.000 0.000 0.000
#> GSM918649     1  0.0000      0.944 1.000 0.000 0.000 0.000
#> GSM918651     1  0.0000      0.944 1.000 0.000 0.000 0.000
#> GSM918607     1  0.0000      0.944 1.000 0.000 0.000 0.000
#> GSM918609     1  0.0000      0.944 1.000 0.000 0.000 0.000
#> GSM918608     1  0.0000      0.944 1.000 0.000 0.000 0.000
#> GSM918606     1  0.0000      0.944 1.000 0.000 0.000 0.000
#> GSM918620     1  0.0000      0.944 1.000 0.000 0.000 0.000
#> GSM918628     1  0.4977     -0.183 0.540 0.000 0.000 0.460
#> GSM918586     3  0.0000      0.931 0.000 0.000 1.000 0.000
#> GSM918594     3  0.0000      0.931 0.000 0.000 1.000 0.000
#> GSM918600     3  0.0000      0.931 0.000 0.000 1.000 0.000
#> GSM918601     3  0.0000      0.931 0.000 0.000 1.000 0.000
#> GSM918612     3  0.0000      0.931 0.000 0.000 1.000 0.000
#> GSM918614     3  0.0000      0.931 0.000 0.000 1.000 0.000
#> GSM918629     3  0.0000      0.931 0.000 0.000 1.000 0.000
#> GSM918587     3  0.3768      0.837 0.000 0.008 0.808 0.184
#> GSM918588     3  0.0000      0.931 0.000 0.000 1.000 0.000
#> GSM918589     3  0.0000      0.931 0.000 0.000 1.000 0.000
#> GSM918611     3  0.0000      0.931 0.000 0.000 1.000 0.000
#> GSM918624     3  0.0000      0.931 0.000 0.000 1.000 0.000
#> GSM918637     3  0.0000      0.931 0.000 0.000 1.000 0.000
#> GSM918639     3  0.0000      0.931 0.000 0.000 1.000 0.000
#> GSM918640     3  0.0000      0.931 0.000 0.000 1.000 0.000
#> GSM918636     3  0.0000      0.931 0.000 0.000 1.000 0.000
#> GSM918590     2  0.2589      0.884 0.000 0.884 0.000 0.116
#> GSM918610     2  0.0707      0.940 0.000 0.980 0.000 0.020
#> GSM918615     2  0.0707      0.940 0.000 0.980 0.000 0.020
#> GSM918616     3  0.3497      0.883 0.000 0.036 0.860 0.104
#> GSM918632     2  0.1389      0.938 0.000 0.952 0.000 0.048
#> GSM918647     2  0.1389      0.938 0.000 0.952 0.000 0.048
#> GSM918578     2  0.0707      0.940 0.000 0.980 0.000 0.020
#> GSM918579     2  0.1389      0.938 0.000 0.952 0.000 0.048
#> GSM918581     2  0.0469      0.941 0.000 0.988 0.000 0.012
#> GSM918584     2  0.0707      0.940 0.000 0.980 0.000 0.020
#> GSM918591     2  0.0707      0.940 0.000 0.980 0.000 0.020
#> GSM918592     2  0.0707      0.940 0.000 0.980 0.000 0.020
#> GSM918597     3  0.2737      0.895 0.000 0.008 0.888 0.104
#> GSM918598     2  0.0707      0.940 0.000 0.980 0.000 0.020
#> GSM918599     2  0.7122      0.256 0.000 0.516 0.340 0.144
#> GSM918604     3  0.0000      0.931 0.000 0.000 1.000 0.000
#> GSM918605     2  0.2589      0.884 0.000 0.884 0.000 0.116
#> GSM918613     2  0.0707      0.940 0.000 0.980 0.000 0.020
#> GSM918623     2  0.1389      0.938 0.000 0.952 0.000 0.048
#> GSM918626     3  0.4139      0.850 0.000 0.040 0.816 0.144
#> GSM918627     3  0.4318      0.858 0.000 0.068 0.816 0.116
#> GSM918633     2  0.0707      0.940 0.000 0.980 0.000 0.020
#> GSM918634     3  0.4318      0.859 0.000 0.068 0.816 0.116
#> GSM918635     2  0.1389      0.938 0.000 0.952 0.000 0.048
#> GSM918645     2  0.0817      0.939 0.000 0.976 0.000 0.024
#> GSM918646     2  0.2469      0.911 0.000 0.892 0.000 0.108
#> GSM918648     2  0.1389      0.938 0.000 0.952 0.000 0.048
#> GSM918650     2  0.0707      0.940 0.000 0.980 0.000 0.020
#> GSM918652     2  0.2868      0.887 0.000 0.864 0.000 0.136
#> GSM918653     2  0.1389      0.938 0.000 0.952 0.000 0.048
#> GSM918622     3  0.4318      0.858 0.000 0.068 0.816 0.116
#> GSM918583     2  0.1389      0.938 0.000 0.952 0.000 0.048
#> GSM918585     2  0.1389      0.938 0.000 0.952 0.000 0.048
#> GSM918595     2  0.1211      0.933 0.000 0.960 0.000 0.040
#> GSM918596     3  0.2345      0.898 0.000 0.000 0.900 0.100
#> GSM918602     3  0.4245      0.862 0.000 0.064 0.820 0.116
#> GSM918617     3  0.6897      0.478 0.000 0.284 0.572 0.144
#> GSM918630     2  0.1792      0.932 0.000 0.932 0.000 0.068
#> GSM918631     2  0.1389      0.938 0.000 0.952 0.000 0.048
#> GSM918618     4  0.3219      1.000 0.164 0.000 0.000 0.836
#> GSM918644     4  0.3219      1.000 0.164 0.000 0.000 0.836

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>           class entropy silhouette    p1    p2    p3    p4    p5
#> GSM918603     4  0.1121      0.952 0.044 0.000 0.000 0.956 0.000
#> GSM918641     4  0.1121      0.952 0.044 0.000 0.000 0.956 0.000
#> GSM918580     4  0.1121      0.952 0.044 0.000 0.000 0.956 0.000
#> GSM918593     4  0.1121      0.952 0.044 0.000 0.000 0.956 0.000
#> GSM918625     4  0.1121      0.952 0.044 0.000 0.000 0.956 0.000
#> GSM918638     4  0.1121      0.952 0.044 0.000 0.000 0.956 0.000
#> GSM918642     4  0.1121      0.952 0.044 0.000 0.000 0.956 0.000
#> GSM918643     4  0.1121      0.952 0.044 0.000 0.000 0.956 0.000
#> GSM918619     1  0.0000      1.000 1.000 0.000 0.000 0.000 0.000
#> GSM918621     1  0.0000      1.000 1.000 0.000 0.000 0.000 0.000
#> GSM918582     1  0.0000      1.000 1.000 0.000 0.000 0.000 0.000
#> GSM918649     1  0.0000      1.000 1.000 0.000 0.000 0.000 0.000
#> GSM918651     1  0.0000      1.000 1.000 0.000 0.000 0.000 0.000
#> GSM918607     1  0.0000      1.000 1.000 0.000 0.000 0.000 0.000
#> GSM918609     1  0.0000      1.000 1.000 0.000 0.000 0.000 0.000
#> GSM918608     1  0.0000      1.000 1.000 0.000 0.000 0.000 0.000
#> GSM918606     1  0.0000      1.000 1.000 0.000 0.000 0.000 0.000
#> GSM918620     1  0.0000      1.000 1.000 0.000 0.000 0.000 0.000
#> GSM918628     4  0.4304      0.148 0.484 0.000 0.000 0.516 0.000
#> GSM918586     3  0.0000      0.995 0.000 0.000 1.000 0.000 0.000
#> GSM918594     3  0.0162      0.994 0.000 0.000 0.996 0.004 0.000
#> GSM918600     3  0.0000      0.995 0.000 0.000 1.000 0.000 0.000
#> GSM918601     3  0.0324      0.993 0.000 0.000 0.992 0.004 0.004
#> GSM918612     3  0.0000      0.995 0.000 0.000 1.000 0.000 0.000
#> GSM918614     3  0.0162      0.994 0.000 0.000 0.996 0.000 0.004
#> GSM918629     3  0.0000      0.995 0.000 0.000 1.000 0.000 0.000
#> GSM918587     5  0.6112      0.381 0.000 0.000 0.344 0.140 0.516
#> GSM918588     3  0.0000      0.995 0.000 0.000 1.000 0.000 0.000
#> GSM918589     3  0.0162      0.994 0.000 0.000 0.996 0.000 0.004
#> GSM918611     3  0.0162      0.994 0.000 0.000 0.996 0.000 0.004
#> GSM918624     3  0.0324      0.993 0.000 0.000 0.992 0.004 0.004
#> GSM918637     3  0.0566      0.985 0.000 0.000 0.984 0.004 0.012
#> GSM918639     3  0.0324      0.993 0.000 0.000 0.992 0.004 0.004
#> GSM918640     3  0.0324      0.993 0.000 0.000 0.992 0.004 0.004
#> GSM918636     3  0.0162      0.994 0.000 0.000 0.996 0.000 0.004
#> GSM918590     5  0.0865      0.744 0.000 0.024 0.000 0.004 0.972
#> GSM918610     2  0.4132      0.756 0.000 0.720 0.000 0.020 0.260
#> GSM918615     2  0.4823      0.740 0.000 0.644 0.000 0.040 0.316
#> GSM918616     5  0.3491      0.702 0.000 0.000 0.228 0.004 0.768
#> GSM918632     2  0.0000      0.754 0.000 1.000 0.000 0.000 0.000
#> GSM918647     2  0.0000      0.754 0.000 1.000 0.000 0.000 0.000
#> GSM918578     2  0.4132      0.756 0.000 0.720 0.000 0.020 0.260
#> GSM918579     2  0.1648      0.746 0.000 0.940 0.000 0.020 0.040
#> GSM918581     2  0.3236      0.771 0.000 0.828 0.000 0.020 0.152
#> GSM918584     2  0.4786      0.746 0.000 0.652 0.000 0.040 0.308
#> GSM918591     2  0.4132      0.756 0.000 0.720 0.000 0.020 0.260
#> GSM918592     2  0.4132      0.756 0.000 0.720 0.000 0.020 0.260
#> GSM918597     5  0.3196      0.734 0.000 0.000 0.192 0.004 0.804
#> GSM918598     2  0.4132      0.756 0.000 0.720 0.000 0.020 0.260
#> GSM918599     5  0.4111      0.666 0.000 0.280 0.008 0.004 0.708
#> GSM918604     3  0.0000      0.995 0.000 0.000 1.000 0.000 0.000
#> GSM918605     5  0.0290      0.757 0.000 0.008 0.000 0.000 0.992
#> GSM918613     2  0.4770      0.740 0.000 0.644 0.000 0.036 0.320
#> GSM918623     2  0.0000      0.754 0.000 1.000 0.000 0.000 0.000
#> GSM918626     5  0.4040      0.685 0.000 0.260 0.016 0.000 0.724
#> GSM918627     5  0.0290      0.762 0.000 0.000 0.008 0.000 0.992
#> GSM918633     2  0.4404      0.756 0.000 0.704 0.000 0.032 0.264
#> GSM918634     5  0.0865      0.768 0.000 0.000 0.024 0.004 0.972
#> GSM918635     2  0.0162      0.754 0.000 0.996 0.000 0.000 0.004
#> GSM918645     2  0.5077      0.664 0.000 0.568 0.000 0.040 0.392
#> GSM918646     2  0.4561     -0.269 0.000 0.504 0.000 0.008 0.488
#> GSM918648     2  0.0000      0.754 0.000 1.000 0.000 0.000 0.000
#> GSM918650     2  0.4550      0.756 0.000 0.688 0.000 0.036 0.276
#> GSM918652     5  0.3759      0.699 0.000 0.220 0.000 0.016 0.764
#> GSM918653     2  0.1648      0.746 0.000 0.940 0.000 0.020 0.040
#> GSM918622     5  0.0404      0.763 0.000 0.000 0.012 0.000 0.988
#> GSM918583     2  0.2171      0.747 0.000 0.912 0.000 0.024 0.064
#> GSM918585     2  0.1399      0.748 0.000 0.952 0.000 0.020 0.028
#> GSM918595     2  0.4689      0.562 0.000 0.560 0.000 0.016 0.424
#> GSM918596     5  0.3928      0.610 0.000 0.000 0.296 0.004 0.700
#> GSM918602     5  0.2140      0.750 0.000 0.024 0.040 0.012 0.924
#> GSM918617     5  0.4086      0.653 0.000 0.284 0.000 0.012 0.704
#> GSM918630     2  0.3656      0.574 0.000 0.784 0.000 0.020 0.196
#> GSM918631     2  0.1648      0.746 0.000 0.940 0.000 0.020 0.040
#> GSM918618     4  0.1282      0.949 0.044 0.000 0.000 0.952 0.004
#> GSM918644     4  0.1365      0.946 0.040 0.000 0.004 0.952 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
#> GSM918603     4  0.0458    0.99589 0.016 0.000 0.000 0.984 0.000 0.000
#> GSM918641     4  0.0458    0.99589 0.016 0.000 0.000 0.984 0.000 0.000
#> GSM918580     4  0.0458    0.99589 0.016 0.000 0.000 0.984 0.000 0.000
#> GSM918593     4  0.0458    0.99589 0.016 0.000 0.000 0.984 0.000 0.000
#> GSM918625     4  0.0458    0.99589 0.016 0.000 0.000 0.984 0.000 0.000
#> GSM918638     4  0.0458    0.99589 0.016 0.000 0.000 0.984 0.000 0.000
#> GSM918642     4  0.0458    0.99589 0.016 0.000 0.000 0.984 0.000 0.000
#> GSM918643     4  0.0458    0.99589 0.016 0.000 0.000 0.984 0.000 0.000
#> GSM918619     1  0.0000    0.94651 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM918621     1  0.0000    0.94651 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM918582     1  0.0000    0.94651 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM918649     1  0.0000    0.94651 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM918651     1  0.0000    0.94651 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM918607     1  0.0000    0.94651 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM918609     1  0.0000    0.94651 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM918608     1  0.0000    0.94651 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM918606     1  0.0000    0.94651 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM918620     1  0.0000    0.94651 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM918628     1  0.4491    0.00169 0.500 0.008 0.000 0.476 0.016 0.000
#> GSM918586     3  0.0458    0.95151 0.000 0.016 0.984 0.000 0.000 0.000
#> GSM918594     3  0.1857    0.93861 0.000 0.044 0.924 0.004 0.028 0.000
#> GSM918600     3  0.0260    0.95240 0.000 0.008 0.992 0.000 0.000 0.000
#> GSM918601     3  0.2128    0.93350 0.000 0.056 0.908 0.004 0.032 0.000
#> GSM918612     3  0.0260    0.95274 0.000 0.008 0.992 0.000 0.000 0.000
#> GSM918614     3  0.0363    0.95198 0.000 0.012 0.988 0.000 0.000 0.000
#> GSM918629     3  0.0603    0.95230 0.000 0.016 0.980 0.000 0.004 0.000
#> GSM918587     5  0.5867    0.62354 0.000 0.080 0.192 0.068 0.644 0.016
#> GSM918588     3  0.0260    0.95240 0.000 0.008 0.992 0.000 0.000 0.000
#> GSM918589     3  0.0725    0.94866 0.000 0.012 0.976 0.000 0.012 0.000
#> GSM918611     3  0.1434    0.93203 0.000 0.012 0.940 0.000 0.048 0.000
#> GSM918624     3  0.2128    0.93350 0.000 0.056 0.908 0.004 0.032 0.000
#> GSM918637     3  0.2994    0.88721 0.000 0.064 0.852 0.004 0.080 0.000
#> GSM918639     3  0.2128    0.93350 0.000 0.056 0.908 0.004 0.032 0.000
#> GSM918640     3  0.2128    0.93350 0.000 0.056 0.908 0.004 0.032 0.000
#> GSM918636     3  0.0725    0.94866 0.000 0.012 0.976 0.000 0.012 0.000
#> GSM918590     5  0.4633    0.71598 0.000 0.100 0.000 0.008 0.704 0.188
#> GSM918610     6  0.3163    0.69112 0.000 0.232 0.000 0.000 0.004 0.764
#> GSM918615     6  0.1682    0.58880 0.000 0.052 0.000 0.000 0.020 0.928
#> GSM918616     5  0.4549    0.72400 0.000 0.084 0.128 0.016 0.756 0.016
#> GSM918632     2  0.3371    0.51957 0.000 0.708 0.000 0.000 0.000 0.292
#> GSM918647     2  0.3390    0.52613 0.000 0.704 0.000 0.000 0.000 0.296
#> GSM918578     6  0.3101    0.68711 0.000 0.244 0.000 0.000 0.000 0.756
#> GSM918579     2  0.3975    0.57016 0.000 0.544 0.000 0.000 0.004 0.452
#> GSM918581     6  0.3309    0.64708 0.000 0.280 0.000 0.000 0.000 0.720
#> GSM918584     6  0.2006    0.55159 0.000 0.080 0.000 0.000 0.016 0.904
#> GSM918591     6  0.3215    0.68895 0.000 0.240 0.000 0.000 0.004 0.756
#> GSM918592     6  0.3076    0.68708 0.000 0.240 0.000 0.000 0.000 0.760
#> GSM918597     5  0.2812    0.78978 0.000 0.072 0.040 0.000 0.872 0.016
#> GSM918598     6  0.3101    0.68711 0.000 0.244 0.000 0.000 0.000 0.756
#> GSM918599     5  0.4462    0.29176 0.000 0.436 0.000 0.008 0.540 0.016
#> GSM918604     3  0.1151    0.93738 0.000 0.012 0.956 0.000 0.032 0.000
#> GSM918605     5  0.3620    0.76767 0.000 0.060 0.000 0.012 0.808 0.120
#> GSM918613     6  0.1970    0.58024 0.000 0.060 0.000 0.000 0.028 0.912
#> GSM918623     2  0.3371    0.51957 0.000 0.708 0.000 0.000 0.000 0.292
#> GSM918626     5  0.2144    0.77672 0.000 0.092 0.004 0.004 0.896 0.004
#> GSM918627     5  0.2007    0.79513 0.000 0.036 0.004 0.000 0.916 0.044
#> GSM918633     6  0.2278    0.67186 0.000 0.128 0.000 0.000 0.004 0.868
#> GSM918634     5  0.3186    0.79249 0.000 0.088 0.012 0.008 0.852 0.040
#> GSM918635     2  0.3482    0.47487 0.000 0.684 0.000 0.000 0.000 0.316
#> GSM918645     6  0.4081    0.41520 0.000 0.120 0.000 0.008 0.104 0.768
#> GSM918646     2  0.5451    0.31518 0.000 0.564 0.000 0.004 0.296 0.136
#> GSM918648     2  0.3371    0.51957 0.000 0.708 0.000 0.000 0.000 0.292
#> GSM918650     6  0.0291    0.63242 0.000 0.004 0.000 0.000 0.004 0.992
#> GSM918652     5  0.5846    0.38883 0.000 0.256 0.000 0.008 0.532 0.204
#> GSM918653     2  0.3838    0.57267 0.000 0.552 0.000 0.000 0.000 0.448
#> GSM918622     5  0.2078    0.79529 0.000 0.040 0.004 0.000 0.912 0.044
#> GSM918583     6  0.3975   -0.34952 0.000 0.392 0.000 0.000 0.008 0.600
#> GSM918585     2  0.3747    0.57806 0.000 0.604 0.000 0.000 0.000 0.396
#> GSM918595     6  0.4805    0.60074 0.000 0.292 0.000 0.004 0.072 0.632
#> GSM918596     5  0.2331    0.79236 0.000 0.080 0.032 0.000 0.888 0.000
#> GSM918602     5  0.3976    0.74854 0.000 0.040 0.020 0.008 0.788 0.144
#> GSM918617     2  0.5225   -0.11107 0.000 0.496 0.000 0.004 0.420 0.080
#> GSM918630     2  0.4999    0.53005 0.000 0.564 0.000 0.004 0.068 0.364
#> GSM918631     2  0.3975    0.57016 0.000 0.544 0.000 0.000 0.004 0.452
#> GSM918618     4  0.1275    0.97831 0.016 0.012 0.000 0.956 0.016 0.000
#> GSM918644     4  0.0964    0.98626 0.016 0.004 0.000 0.968 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-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) gender(p) other(p) k
#> CV:skmeans 75         3.63e-13   0.32471 1.26e-02 2
#> CV:skmeans 75         8.46e-19   0.00431 1.40e-04 3
#> CV:skmeans 73         2.25e-32   0.00276 2.61e-08 4
#> CV:skmeans 73         2.19e-36   0.00526 1.22e-07 5
#> CV:skmeans 68         3.85e-30   0.00496 7.28e-06 6

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


CV: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 76 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.572           0.790       0.885         0.4135 0.607   0.607
#> 3 3 0.627           0.787       0.864         0.1890 0.943   0.909
#> 4 4 0.940           0.909       0.965         0.3662 0.728   0.543
#> 5 5 0.873           0.821       0.935         0.1768 0.876   0.626
#> 6 6 0.854           0.840       0.914         0.0361 0.916   0.645

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
#> GSM918603     1  0.0000      0.924 1.000 0.000
#> GSM918641     1  0.0000      0.924 1.000 0.000
#> GSM918580     1  0.8207      0.564 0.744 0.256
#> GSM918593     1  0.0000      0.924 1.000 0.000
#> GSM918625     1  0.0376      0.924 0.996 0.004
#> GSM918638     1  0.0000      0.924 1.000 0.000
#> GSM918642     1  0.0000      0.924 1.000 0.000
#> GSM918643     1  0.0000      0.924 1.000 0.000
#> GSM918619     1  0.2236      0.930 0.964 0.036
#> GSM918621     1  0.2236      0.930 0.964 0.036
#> GSM918582     1  0.2236      0.930 0.964 0.036
#> GSM918649     1  0.2603      0.926 0.956 0.044
#> GSM918651     1  0.2236      0.930 0.964 0.036
#> GSM918607     1  0.2236      0.930 0.964 0.036
#> GSM918609     1  0.2236      0.930 0.964 0.036
#> GSM918608     1  0.2236      0.930 0.964 0.036
#> GSM918606     1  0.2236      0.930 0.964 0.036
#> GSM918620     1  0.2236      0.930 0.964 0.036
#> GSM918628     1  1.0000     -0.301 0.504 0.496
#> GSM918586     2  0.9209      0.668 0.336 0.664
#> GSM918594     2  0.9209      0.668 0.336 0.664
#> GSM918600     2  0.9209      0.668 0.336 0.664
#> GSM918601     2  0.9209      0.668 0.336 0.664
#> GSM918612     2  0.9248      0.662 0.340 0.660
#> GSM918614     2  0.9209      0.668 0.336 0.664
#> GSM918629     2  0.9209      0.668 0.336 0.664
#> GSM918587     2  0.9209      0.668 0.336 0.664
#> GSM918588     2  0.9209      0.668 0.336 0.664
#> GSM918589     2  0.9209      0.668 0.336 0.664
#> GSM918611     2  0.9209      0.668 0.336 0.664
#> GSM918624     2  0.9209      0.668 0.336 0.664
#> GSM918637     2  0.9209      0.668 0.336 0.664
#> GSM918639     2  0.9209      0.668 0.336 0.664
#> GSM918640     2  0.9209      0.668 0.336 0.664
#> GSM918636     2  0.9209      0.668 0.336 0.664
#> GSM918590     2  0.1843      0.832 0.028 0.972
#> GSM918610     2  0.0000      0.833 0.000 1.000
#> GSM918615     2  0.1184      0.833 0.016 0.984
#> GSM918616     2  0.2236      0.832 0.036 0.964
#> GSM918632     2  0.0000      0.833 0.000 1.000
#> GSM918647     2  0.1633      0.832 0.024 0.976
#> GSM918578     2  0.0000      0.833 0.000 1.000
#> GSM918579     2  0.0000      0.833 0.000 1.000
#> GSM918581     2  0.0000      0.833 0.000 1.000
#> GSM918584     2  0.0000      0.833 0.000 1.000
#> GSM918591     2  0.0000      0.833 0.000 1.000
#> GSM918592     2  0.0000      0.833 0.000 1.000
#> GSM918597     2  0.9209      0.668 0.336 0.664
#> GSM918598     2  0.0000      0.833 0.000 1.000
#> GSM918599     2  0.0000      0.833 0.000 1.000
#> GSM918604     2  0.9209      0.668 0.336 0.664
#> GSM918605     2  0.1633      0.833 0.024 0.976
#> GSM918613     2  0.2236      0.832 0.036 0.964
#> GSM918623     2  0.0000      0.833 0.000 1.000
#> GSM918626     2  0.9129      0.674 0.328 0.672
#> GSM918627     2  0.2236      0.832 0.036 0.964
#> GSM918633     2  0.7139      0.760 0.196 0.804
#> GSM918634     2  0.2236      0.832 0.036 0.964
#> GSM918635     2  0.0000      0.833 0.000 1.000
#> GSM918645     2  0.0000      0.833 0.000 1.000
#> GSM918646     2  0.0000      0.833 0.000 1.000
#> GSM918648     2  0.0000      0.833 0.000 1.000
#> GSM918650     2  0.0000      0.833 0.000 1.000
#> GSM918652     2  0.0000      0.833 0.000 1.000
#> GSM918653     2  0.0000      0.833 0.000 1.000
#> GSM918622     2  0.2236      0.832 0.036 0.964
#> GSM918583     2  0.0000      0.833 0.000 1.000
#> GSM918585     2  0.0000      0.833 0.000 1.000
#> GSM918595     2  0.3431      0.823 0.064 0.936
#> GSM918596     2  0.3584      0.822 0.068 0.932
#> GSM918602     2  0.7528      0.749 0.216 0.784
#> GSM918617     2  0.0672      0.833 0.008 0.992
#> GSM918630     2  0.0000      0.833 0.000 1.000
#> GSM918631     2  0.0000      0.833 0.000 1.000
#> GSM918618     1  0.0000      0.924 1.000 0.000
#> GSM918644     2  0.9580      0.609 0.380 0.620

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>           class entropy silhouette    p1    p2    p3
#> GSM918603     3  0.6180      0.999 0.416 0.000 0.584
#> GSM918641     3  0.6180      0.999 0.416 0.000 0.584
#> GSM918580     3  0.6180      0.999 0.416 0.000 0.584
#> GSM918593     3  0.6386      0.993 0.412 0.004 0.584
#> GSM918625     3  0.6180      0.999 0.416 0.000 0.584
#> GSM918638     3  0.6180      0.999 0.416 0.000 0.584
#> GSM918642     3  0.6180      0.999 0.416 0.000 0.584
#> GSM918643     3  0.6180      0.999 0.416 0.000 0.584
#> GSM918619     1  0.6608      0.990 0.628 0.356 0.016
#> GSM918621     1  0.6608      0.990 0.628 0.356 0.016
#> GSM918582     1  0.6608      0.990 0.628 0.356 0.016
#> GSM918649     1  0.6717      0.984 0.628 0.352 0.020
#> GSM918651     1  0.6608      0.990 0.628 0.356 0.016
#> GSM918607     1  0.6608      0.990 0.628 0.356 0.016
#> GSM918609     1  0.6608      0.990 0.628 0.356 0.016
#> GSM918608     1  0.6359      0.980 0.628 0.364 0.008
#> GSM918606     1  0.6608      0.990 0.628 0.356 0.016
#> GSM918620     1  0.6608      0.990 0.628 0.356 0.016
#> GSM918628     2  0.5062      0.247 0.184 0.800 0.016
#> GSM918586     2  0.0000      0.605 0.000 1.000 0.000
#> GSM918594     2  0.0000      0.605 0.000 1.000 0.000
#> GSM918600     2  0.0000      0.605 0.000 1.000 0.000
#> GSM918601     2  0.0000      0.605 0.000 1.000 0.000
#> GSM918612     2  0.0000      0.605 0.000 1.000 0.000
#> GSM918614     2  0.0000      0.605 0.000 1.000 0.000
#> GSM918629     2  0.0237      0.607 0.000 0.996 0.004
#> GSM918587     2  0.1163      0.620 0.000 0.972 0.028
#> GSM918588     2  0.0000      0.605 0.000 1.000 0.000
#> GSM918589     2  0.0000      0.605 0.000 1.000 0.000
#> GSM918611     2  0.0000      0.605 0.000 1.000 0.000
#> GSM918624     2  0.0000      0.605 0.000 1.000 0.000
#> GSM918637     2  0.0000      0.605 0.000 1.000 0.000
#> GSM918639     2  0.0000      0.605 0.000 1.000 0.000
#> GSM918640     2  0.0000      0.605 0.000 1.000 0.000
#> GSM918636     2  0.0000      0.605 0.000 1.000 0.000
#> GSM918590     2  0.6079      0.801 0.000 0.612 0.388
#> GSM918610     2  0.6180      0.801 0.000 0.584 0.416
#> GSM918615     2  0.6126      0.802 0.000 0.600 0.400
#> GSM918616     2  0.5968      0.798 0.000 0.636 0.364
#> GSM918632     2  0.6180      0.801 0.000 0.584 0.416
#> GSM918647     2  0.6062      0.799 0.000 0.616 0.384
#> GSM918578     2  0.6180      0.801 0.000 0.584 0.416
#> GSM918579     2  0.6180      0.801 0.000 0.584 0.416
#> GSM918581     2  0.6180      0.801 0.000 0.584 0.416
#> GSM918584     2  0.6180      0.801 0.000 0.584 0.416
#> GSM918591     2  0.6180      0.801 0.000 0.584 0.416
#> GSM918592     2  0.6180      0.801 0.000 0.584 0.416
#> GSM918597     2  0.0000      0.605 0.000 1.000 0.000
#> GSM918598     2  0.6180      0.801 0.000 0.584 0.416
#> GSM918599     2  0.6180      0.801 0.000 0.584 0.416
#> GSM918604     2  0.0000      0.605 0.000 1.000 0.000
#> GSM918605     2  0.6095      0.801 0.000 0.608 0.392
#> GSM918613     2  0.6045      0.800 0.000 0.620 0.380
#> GSM918623     2  0.6180      0.801 0.000 0.584 0.416
#> GSM918626     2  0.1163      0.618 0.000 0.972 0.028
#> GSM918627     2  0.6045      0.800 0.000 0.620 0.380
#> GSM918633     2  0.4796      0.733 0.000 0.780 0.220
#> GSM918634     2  0.5968      0.798 0.000 0.636 0.364
#> GSM918635     2  0.6180      0.801 0.000 0.584 0.416
#> GSM918645     2  0.6168      0.801 0.000 0.588 0.412
#> GSM918646     2  0.6180      0.801 0.000 0.584 0.416
#> GSM918648     2  0.6180      0.801 0.000 0.584 0.416
#> GSM918650     2  0.6180      0.801 0.000 0.584 0.416
#> GSM918652     2  0.6168      0.801 0.000 0.588 0.412
#> GSM918653     2  0.6180      0.801 0.000 0.584 0.416
#> GSM918622     2  0.6008      0.799 0.000 0.628 0.372
#> GSM918583     2  0.6180      0.801 0.000 0.584 0.416
#> GSM918585     2  0.6180      0.801 0.000 0.584 0.416
#> GSM918595     2  0.5905      0.793 0.000 0.648 0.352
#> GSM918596     2  0.5621      0.781 0.000 0.692 0.308
#> GSM918602     2  0.4504      0.721 0.000 0.804 0.196
#> GSM918617     2  0.6140      0.802 0.000 0.596 0.404
#> GSM918630     2  0.6180      0.801 0.000 0.584 0.416
#> GSM918631     2  0.6180      0.801 0.000 0.584 0.416
#> GSM918618     1  0.6701      0.922 0.576 0.412 0.012
#> GSM918644     2  0.0892      0.579 0.000 0.980 0.020

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM918603     4  0.0000      0.951 0.000 0.000 0.000 1.000
#> GSM918641     4  0.0000      0.951 0.000 0.000 0.000 1.000
#> GSM918580     4  0.0000      0.951 0.000 0.000 0.000 1.000
#> GSM918593     4  0.0000      0.951 0.000 0.000 0.000 1.000
#> GSM918625     4  0.0000      0.951 0.000 0.000 0.000 1.000
#> GSM918638     4  0.0000      0.951 0.000 0.000 0.000 1.000
#> GSM918642     4  0.0000      0.951 0.000 0.000 0.000 1.000
#> GSM918643     4  0.0000      0.951 0.000 0.000 0.000 1.000
#> GSM918619     1  0.0000      0.947 1.000 0.000 0.000 0.000
#> GSM918621     1  0.0000      0.947 1.000 0.000 0.000 0.000
#> GSM918582     1  0.0000      0.947 1.000 0.000 0.000 0.000
#> GSM918649     1  0.0000      0.947 1.000 0.000 0.000 0.000
#> GSM918651     1  0.0000      0.947 1.000 0.000 0.000 0.000
#> GSM918607     1  0.0000      0.947 1.000 0.000 0.000 0.000
#> GSM918609     1  0.0000      0.947 1.000 0.000 0.000 0.000
#> GSM918608     1  0.0000      0.947 1.000 0.000 0.000 0.000
#> GSM918606     1  0.0000      0.947 1.000 0.000 0.000 0.000
#> GSM918620     1  0.0000      0.947 1.000 0.000 0.000 0.000
#> GSM918628     1  0.0188      0.942 0.996 0.004 0.000 0.000
#> GSM918586     3  0.0000      0.958 0.000 0.000 1.000 0.000
#> GSM918594     3  0.0000      0.958 0.000 0.000 1.000 0.000
#> GSM918600     3  0.0000      0.958 0.000 0.000 1.000 0.000
#> GSM918601     3  0.0000      0.958 0.000 0.000 1.000 0.000
#> GSM918612     3  0.0000      0.958 0.000 0.000 1.000 0.000
#> GSM918614     3  0.0000      0.958 0.000 0.000 1.000 0.000
#> GSM918629     3  0.4948      0.142 0.000 0.440 0.560 0.000
#> GSM918587     2  0.4250      0.644 0.000 0.724 0.276 0.000
#> GSM918588     3  0.0000      0.958 0.000 0.000 1.000 0.000
#> GSM918589     3  0.0000      0.958 0.000 0.000 1.000 0.000
#> GSM918611     3  0.0000      0.958 0.000 0.000 1.000 0.000
#> GSM918624     3  0.0000      0.958 0.000 0.000 1.000 0.000
#> GSM918637     3  0.0000      0.958 0.000 0.000 1.000 0.000
#> GSM918639     3  0.0000      0.958 0.000 0.000 1.000 0.000
#> GSM918640     3  0.0000      0.958 0.000 0.000 1.000 0.000
#> GSM918636     3  0.0000      0.958 0.000 0.000 1.000 0.000
#> GSM918590     2  0.0817      0.952 0.000 0.976 0.024 0.000
#> GSM918610     2  0.0000      0.959 0.000 1.000 0.000 0.000
#> GSM918615     2  0.0817      0.952 0.000 0.976 0.024 0.000
#> GSM918616     2  0.1118      0.946 0.000 0.964 0.036 0.000
#> GSM918632     2  0.0000      0.959 0.000 1.000 0.000 0.000
#> GSM918647     2  0.0000      0.959 0.000 1.000 0.000 0.000
#> GSM918578     2  0.0000      0.959 0.000 1.000 0.000 0.000
#> GSM918579     2  0.0000      0.959 0.000 1.000 0.000 0.000
#> GSM918581     2  0.0000      0.959 0.000 1.000 0.000 0.000
#> GSM918584     2  0.0000      0.959 0.000 1.000 0.000 0.000
#> GSM918591     2  0.0000      0.959 0.000 1.000 0.000 0.000
#> GSM918592     2  0.0000      0.959 0.000 1.000 0.000 0.000
#> GSM918597     3  0.0000      0.958 0.000 0.000 1.000 0.000
#> GSM918598     2  0.0000      0.959 0.000 1.000 0.000 0.000
#> GSM918599     2  0.0000      0.959 0.000 1.000 0.000 0.000
#> GSM918604     3  0.0000      0.958 0.000 0.000 1.000 0.000
#> GSM918605     2  0.0817      0.952 0.000 0.976 0.024 0.000
#> GSM918613     2  0.0592      0.955 0.000 0.984 0.016 0.000
#> GSM918623     2  0.0000      0.959 0.000 1.000 0.000 0.000
#> GSM918626     2  0.3764      0.737 0.000 0.784 0.216 0.000
#> GSM918627     2  0.1022      0.948 0.000 0.968 0.032 0.000
#> GSM918633     2  0.0000      0.959 0.000 1.000 0.000 0.000
#> GSM918634     2  0.1302      0.940 0.000 0.956 0.044 0.000
#> GSM918635     2  0.0000      0.959 0.000 1.000 0.000 0.000
#> GSM918645     2  0.0817      0.952 0.000 0.976 0.024 0.000
#> GSM918646     2  0.0000      0.959 0.000 1.000 0.000 0.000
#> GSM918648     2  0.0000      0.959 0.000 1.000 0.000 0.000
#> GSM918650     2  0.0000      0.959 0.000 1.000 0.000 0.000
#> GSM918652     2  0.0817      0.952 0.000 0.976 0.024 0.000
#> GSM918653     2  0.0000      0.959 0.000 1.000 0.000 0.000
#> GSM918622     2  0.1022      0.948 0.000 0.968 0.032 0.000
#> GSM918583     2  0.0000      0.959 0.000 1.000 0.000 0.000
#> GSM918585     2  0.0000      0.959 0.000 1.000 0.000 0.000
#> GSM918595     2  0.3074      0.829 0.000 0.848 0.152 0.000
#> GSM918596     2  0.4948      0.239 0.000 0.560 0.440 0.000
#> GSM918602     2  0.1022      0.948 0.000 0.968 0.032 0.000
#> GSM918617     2  0.0817      0.952 0.000 0.976 0.024 0.000
#> GSM918630     2  0.0000      0.959 0.000 1.000 0.000 0.000
#> GSM918631     2  0.0000      0.959 0.000 1.000 0.000 0.000
#> GSM918618     1  0.4985      0.110 0.532 0.000 0.468 0.000
#> GSM918644     4  0.4897      0.496 0.004 0.004 0.324 0.668

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>           class entropy silhouette    p1    p2    p3    p4    p5
#> GSM918603     4  0.0000     0.9557 0.000 0.000 0.000 1.000 0.000
#> GSM918641     4  0.0000     0.9557 0.000 0.000 0.000 1.000 0.000
#> GSM918580     4  0.0000     0.9557 0.000 0.000 0.000 1.000 0.000
#> GSM918593     4  0.0000     0.9557 0.000 0.000 0.000 1.000 0.000
#> GSM918625     4  0.0000     0.9557 0.000 0.000 0.000 1.000 0.000
#> GSM918638     4  0.0000     0.9557 0.000 0.000 0.000 1.000 0.000
#> GSM918642     4  0.0000     0.9557 0.000 0.000 0.000 1.000 0.000
#> GSM918643     4  0.0000     0.9557 0.000 0.000 0.000 1.000 0.000
#> GSM918619     1  0.0000     0.9476 1.000 0.000 0.000 0.000 0.000
#> GSM918621     1  0.0000     0.9476 1.000 0.000 0.000 0.000 0.000
#> GSM918582     1  0.0000     0.9476 1.000 0.000 0.000 0.000 0.000
#> GSM918649     1  0.0000     0.9476 1.000 0.000 0.000 0.000 0.000
#> GSM918651     1  0.0000     0.9476 1.000 0.000 0.000 0.000 0.000
#> GSM918607     1  0.0000     0.9476 1.000 0.000 0.000 0.000 0.000
#> GSM918609     1  0.0000     0.9476 1.000 0.000 0.000 0.000 0.000
#> GSM918608     1  0.0000     0.9476 1.000 0.000 0.000 0.000 0.000
#> GSM918606     1  0.0000     0.9476 1.000 0.000 0.000 0.000 0.000
#> GSM918620     1  0.0000     0.9476 1.000 0.000 0.000 0.000 0.000
#> GSM918628     1  0.0162     0.9439 0.996 0.004 0.000 0.000 0.000
#> GSM918586     3  0.0000     0.9631 0.000 0.000 1.000 0.000 0.000
#> GSM918594     3  0.0000     0.9631 0.000 0.000 1.000 0.000 0.000
#> GSM918600     3  0.0000     0.9631 0.000 0.000 1.000 0.000 0.000
#> GSM918601     3  0.0000     0.9631 0.000 0.000 1.000 0.000 0.000
#> GSM918612     3  0.0000     0.9631 0.000 0.000 1.000 0.000 0.000
#> GSM918614     3  0.0000     0.9631 0.000 0.000 1.000 0.000 0.000
#> GSM918629     3  0.4294     0.0526 0.000 0.000 0.532 0.000 0.468
#> GSM918587     5  0.3452     0.6435 0.000 0.000 0.244 0.000 0.756
#> GSM918588     3  0.0000     0.9631 0.000 0.000 1.000 0.000 0.000
#> GSM918589     3  0.0000     0.9631 0.000 0.000 1.000 0.000 0.000
#> GSM918611     3  0.0000     0.9631 0.000 0.000 1.000 0.000 0.000
#> GSM918624     3  0.0000     0.9631 0.000 0.000 1.000 0.000 0.000
#> GSM918637     3  0.0000     0.9631 0.000 0.000 1.000 0.000 0.000
#> GSM918639     3  0.0000     0.9631 0.000 0.000 1.000 0.000 0.000
#> GSM918640     3  0.0000     0.9631 0.000 0.000 1.000 0.000 0.000
#> GSM918636     3  0.0000     0.9631 0.000 0.000 1.000 0.000 0.000
#> GSM918590     5  0.0000     0.8864 0.000 0.000 0.000 0.000 1.000
#> GSM918610     5  0.3366     0.6423 0.000 0.232 0.000 0.000 0.768
#> GSM918615     5  0.0000     0.8864 0.000 0.000 0.000 0.000 1.000
#> GSM918616     5  0.0000     0.8864 0.000 0.000 0.000 0.000 1.000
#> GSM918632     2  0.0000     0.8626 0.000 1.000 0.000 0.000 0.000
#> GSM918647     2  0.0000     0.8626 0.000 1.000 0.000 0.000 0.000
#> GSM918578     2  0.0000     0.8626 0.000 1.000 0.000 0.000 0.000
#> GSM918579     2  0.3109     0.6894 0.000 0.800 0.000 0.000 0.200
#> GSM918581     2  0.0000     0.8626 0.000 1.000 0.000 0.000 0.000
#> GSM918584     5  0.0000     0.8864 0.000 0.000 0.000 0.000 1.000
#> GSM918591     5  0.3305     0.6536 0.000 0.224 0.000 0.000 0.776
#> GSM918592     2  0.0000     0.8626 0.000 1.000 0.000 0.000 0.000
#> GSM918597     3  0.0000     0.9631 0.000 0.000 1.000 0.000 0.000
#> GSM918598     2  0.0000     0.8626 0.000 1.000 0.000 0.000 0.000
#> GSM918599     5  0.4219     0.1698 0.000 0.416 0.000 0.000 0.584
#> GSM918604     3  0.0000     0.9631 0.000 0.000 1.000 0.000 0.000
#> GSM918605     5  0.0000     0.8864 0.000 0.000 0.000 0.000 1.000
#> GSM918613     5  0.0000     0.8864 0.000 0.000 0.000 0.000 1.000
#> GSM918623     2  0.0000     0.8626 0.000 1.000 0.000 0.000 0.000
#> GSM918626     2  0.3098     0.7190 0.000 0.836 0.148 0.000 0.016
#> GSM918627     5  0.0000     0.8864 0.000 0.000 0.000 0.000 1.000
#> GSM918633     2  0.4307    -0.0478 0.000 0.504 0.000 0.000 0.496
#> GSM918634     5  0.0290     0.8806 0.000 0.000 0.008 0.000 0.992
#> GSM918635     2  0.0000     0.8626 0.000 1.000 0.000 0.000 0.000
#> GSM918645     5  0.0000     0.8864 0.000 0.000 0.000 0.000 1.000
#> GSM918646     5  0.4268     0.0903 0.000 0.444 0.000 0.000 0.556
#> GSM918648     2  0.0000     0.8626 0.000 1.000 0.000 0.000 0.000
#> GSM918650     5  0.0000     0.8864 0.000 0.000 0.000 0.000 1.000
#> GSM918652     5  0.0000     0.8864 0.000 0.000 0.000 0.000 1.000
#> GSM918653     2  0.0162     0.8605 0.000 0.996 0.000 0.000 0.004
#> GSM918622     5  0.0000     0.8864 0.000 0.000 0.000 0.000 1.000
#> GSM918583     5  0.0000     0.8864 0.000 0.000 0.000 0.000 1.000
#> GSM918585     2  0.0000     0.8626 0.000 1.000 0.000 0.000 0.000
#> GSM918595     2  0.5744     0.3170 0.000 0.564 0.104 0.000 0.332
#> GSM918596     5  0.4219     0.2726 0.000 0.000 0.416 0.000 0.584
#> GSM918602     5  0.0000     0.8864 0.000 0.000 0.000 0.000 1.000
#> GSM918617     5  0.0000     0.8864 0.000 0.000 0.000 0.000 1.000
#> GSM918630     5  0.0000     0.8864 0.000 0.000 0.000 0.000 1.000
#> GSM918631     2  0.4138     0.3714 0.000 0.616 0.000 0.000 0.384
#> GSM918618     1  0.4291     0.1152 0.536 0.000 0.464 0.000 0.000
#> GSM918644     4  0.4081     0.5559 0.004 0.000 0.296 0.696 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
#> GSM918603     4  0.0000     1.0000 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM918641     4  0.0000     1.0000 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM918580     4  0.0000     1.0000 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM918593     4  0.0000     1.0000 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM918625     4  0.0000     1.0000 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM918638     4  0.0000     1.0000 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM918642     4  0.0000     1.0000 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM918643     4  0.0000     1.0000 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM918619     1  0.0000     0.9716 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM918621     1  0.0000     0.9716 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM918582     1  0.0000     0.9716 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM918649     1  0.0000     0.9716 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM918651     1  0.0000     0.9716 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM918607     1  0.0000     0.9716 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM918609     1  0.0000     0.9716 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM918608     1  0.0000     0.9716 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM918606     1  0.0000     0.9716 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM918620     1  0.0000     0.9716 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM918628     1  0.3163     0.6734 0.764 0.004 0.232 0.000 0.000 0.000
#> GSM918586     3  0.0000     0.8976 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM918594     6  0.2969     1.0000 0.000 0.000 0.224 0.000 0.000 0.776
#> GSM918600     3  0.0713     0.8871 0.000 0.000 0.972 0.000 0.000 0.028
#> GSM918601     6  0.2969     1.0000 0.000 0.000 0.224 0.000 0.000 0.776
#> GSM918612     3  0.0713     0.8871 0.000 0.000 0.972 0.000 0.000 0.028
#> GSM918614     3  0.0000     0.8976 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM918629     3  0.2795     0.7840 0.000 0.000 0.856 0.000 0.100 0.044
#> GSM918587     3  0.4154     0.6777 0.000 0.000 0.740 0.000 0.164 0.096
#> GSM918588     3  0.0713     0.8871 0.000 0.000 0.972 0.000 0.000 0.028
#> GSM918589     3  0.0000     0.8976 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM918611     3  0.0458     0.8942 0.000 0.000 0.984 0.000 0.000 0.016
#> GSM918624     6  0.2969     1.0000 0.000 0.000 0.224 0.000 0.000 0.776
#> GSM918637     6  0.2969     1.0000 0.000 0.000 0.224 0.000 0.000 0.776
#> GSM918639     6  0.2969     1.0000 0.000 0.000 0.224 0.000 0.000 0.776
#> GSM918640     6  0.2969     1.0000 0.000 0.000 0.224 0.000 0.000 0.776
#> GSM918636     3  0.0000     0.8976 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM918590     5  0.0000     0.8750 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM918610     5  0.3023     0.6852 0.000 0.232 0.000 0.000 0.768 0.000
#> GSM918615     5  0.0000     0.8750 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM918616     5  0.0547     0.8702 0.000 0.000 0.000 0.000 0.980 0.020
#> GSM918632     2  0.0000     0.8659 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM918647     2  0.0000     0.8659 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM918578     2  0.0000     0.8659 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM918579     2  0.2793     0.6980 0.000 0.800 0.000 0.000 0.200 0.000
#> GSM918581     2  0.0000     0.8659 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM918584     5  0.0000     0.8750 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM918591     5  0.2969     0.6938 0.000 0.224 0.000 0.000 0.776 0.000
#> GSM918592     2  0.0000     0.8659 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM918597     3  0.3050     0.7455 0.000 0.000 0.764 0.000 0.000 0.236
#> GSM918598     2  0.0000     0.8659 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM918599     5  0.5091     0.0363 0.000 0.416 0.000 0.000 0.504 0.080
#> GSM918604     3  0.0547     0.8912 0.000 0.000 0.980 0.000 0.000 0.020
#> GSM918605     5  0.0000     0.8750 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM918613     5  0.0458     0.8716 0.000 0.000 0.000 0.000 0.984 0.016
#> GSM918623     2  0.0000     0.8659 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM918626     3  0.2969     0.7340 0.000 0.000 0.776 0.000 0.000 0.224
#> GSM918627     5  0.2969     0.7699 0.000 0.000 0.000 0.000 0.776 0.224
#> GSM918633     5  0.4264     0.0734 0.000 0.488 0.000 0.000 0.496 0.016
#> GSM918634     5  0.0260     0.8726 0.000 0.000 0.008 0.000 0.992 0.000
#> GSM918635     2  0.0000     0.8659 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM918645     5  0.0000     0.8750 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM918646     2  0.5918     0.1009 0.000 0.436 0.000 0.000 0.348 0.216
#> GSM918648     2  0.0000     0.8659 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM918650     5  0.0000     0.8750 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM918652     5  0.0000     0.8750 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM918653     2  0.0146     0.8635 0.000 0.996 0.000 0.000 0.004 0.000
#> GSM918622     5  0.2912     0.7739 0.000 0.000 0.000 0.000 0.784 0.216
#> GSM918583     5  0.0000     0.8750 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM918585     2  0.0000     0.8659 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM918595     2  0.3810     0.1056 0.000 0.572 0.000 0.000 0.428 0.000
#> GSM918596     5  0.3176     0.7205 0.000 0.000 0.156 0.000 0.812 0.032
#> GSM918602     5  0.2912     0.7755 0.000 0.000 0.000 0.000 0.784 0.216
#> GSM918617     5  0.0458     0.8716 0.000 0.000 0.000 0.000 0.984 0.016
#> GSM918630     5  0.0000     0.8750 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM918631     2  0.3717     0.4164 0.000 0.616 0.000 0.000 0.384 0.000
#> GSM918618     3  0.0260     0.8955 0.008 0.000 0.992 0.000 0.000 0.000
#> GSM918644     3  0.2173     0.8518 0.004 0.000 0.904 0.028 0.000 0.064

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

consensus_heatmap(res, k = 2)

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

consensus_heatmap(res, k = 3)

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

consensus_heatmap(res, k = 4)

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

consensus_heatmap(res, k = 5)

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

consensus_heatmap(res, k = 6)

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

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

membership_heatmap(res, k = 2)

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

membership_heatmap(res, k = 3)

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

membership_heatmap(res, k = 4)

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

membership_heatmap(res, k = 5)

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

membership_heatmap(res, k = 6)

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

As soon as we have had the classes for columns, we can look for signatures which are significantly different between classes which can be candidate marks for certain classes. Following are the heatmaps for signatures.

Signature heatmaps where rows are scaled:

get_signatures(res, k = 2)

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

get_signatures(res, k = 3)

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

get_signatures(res, k = 4)

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

get_signatures(res, k = 5)

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

get_signatures(res, k = 6)

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

Signature heatmaps where rows are not scaled:

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

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

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

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

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

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

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

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

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

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

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk CV-pam-signature_compare

get_signature() returns a data frame invisibly. TO get the list of signatures, the function call should be assigned to a variable explicitly. In following code, if plot argument is set to FALSE, no heatmap is plotted while only the differential analysis is performed.

# code only for demonstration
tb = get_signature(res, k = ..., plot = FALSE)

An example of the output of tb is:

#>   which_row         fdr    mean_1    mean_2 scaled_mean_1 scaled_mean_2 km
#> 1        38 0.042760348  8.373488  9.131774    -0.5533452     0.5164555  1
#> 2        40 0.018707592  7.106213  8.469186    -0.6173731     0.5762149  1
#> 3        55 0.019134737 10.221463 11.207825    -0.6159697     0.5749050  1
#> 4        59 0.006059896  5.921854  7.869574    -0.6899429     0.6439467  1
#> 5        60 0.018055526  8.928898 10.211722    -0.6204761     0.5791110  1
#> 6        98 0.009384629 15.714769 14.887706     0.6635654    -0.6193277  2
...

The columns in tb are:

  1. which_row: row indices corresponding to the input matrix.
  2. fdr: FDR for the differential test.
  3. mean_x: The mean value in group x.
  4. scaled_mean_x: The mean value in group x after rows are scaled.
  5. km: Row groups if k-means clustering is applied to rows.

UMAP plot which shows how samples are separated.

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

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

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

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

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

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

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

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

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

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

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk CV-pam-collect-classes

Test correlation between subgroups and known annotations. If the known annotation is numeric, one-way ANOVA test is applied, and if the known annotation is discrete, chi-squared contingency table test is applied.

test_to_known_factors(res)
#>         n disease.state(p) gender(p) other(p) k
#> CV:pam 75         7.22e-15  0.004067 5.80e-04 2
#> CV:pam 75         1.39e-27  0.002523 1.42e-06 3
#> CV:pam 72         9.41e-36  0.001816 8.61e-08 4
#> CV:pam 68         5.87e-29  0.000721 3.99e-06 5
#> CV:pam 71         9.41e-30  0.005057 1.22e-05 6

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


CV:mclust*

The object with results only for a single top-value method and a single partition method can be extracted as:

res = res_list["CV", "mclust"]
# you can also extract it by
# res = res_list["CV:mclust"]

A summary of res and all the functions that can be applied to it:

res
#> A 'ConsensusPartition' object with k = 2, 3, 4, 5, 6.
#>   On a matrix with 51941 rows and 76 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 6.
#> 
#> Following methods can be applied to this 'ConsensusPartition' object:
#>  [1] "cola_report"             "collect_classes"         "collect_plots"          
#>  [4] "collect_stats"           "colnames"                "compare_signatures"     
#>  [7] "consensus_heatmap"       "dimension_reduction"     "functional_enrichment"  
#> [10] "get_anno_col"            "get_anno"                "get_classes"            
#> [13] "get_consensus"           "get_matrix"              "get_membership"         
#> [16] "get_param"               "get_signatures"          "get_stats"              
#> [19] "is_best_k"               "is_stable_k"             "membership_heatmap"     
#> [22] "ncol"                    "nrow"                    "plot_ecdf"              
#> [25] "rownames"                "select_partition_number" "show"                   
#> [28] "suggest_best_k"          "test_to_known_factors"

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

collect_plots(res)

plot of chunk CV-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 1.000           0.981       0.985         0.3892 0.595   0.595
#> 3 3 0.711           0.923       0.918         0.2468 0.961   0.935
#> 4 4 0.791           0.916       0.955         0.4001 0.696   0.485
#> 5 5 0.875           0.855       0.934         0.1504 0.859   0.585
#> 6 6 0.927           0.906       0.948         0.0232 0.928   0.710

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

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

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
#> GSM918603     1   0.416      0.944 0.916 0.084
#> GSM918641     1   0.416      0.944 0.916 0.084
#> GSM918580     1   0.416      0.944 0.916 0.084
#> GSM918593     1   0.416      0.944 0.916 0.084
#> GSM918625     1   0.416      0.944 0.916 0.084
#> GSM918638     1   0.416      0.944 0.916 0.084
#> GSM918642     1   0.416      0.944 0.916 0.084
#> GSM918643     1   0.416      0.944 0.916 0.084
#> GSM918619     1   0.000      0.944 1.000 0.000
#> GSM918621     1   0.000      0.944 1.000 0.000
#> GSM918582     1   0.000      0.944 1.000 0.000
#> GSM918649     1   0.000      0.944 1.000 0.000
#> GSM918651     1   0.000      0.944 1.000 0.000
#> GSM918607     1   0.000      0.944 1.000 0.000
#> GSM918609     1   0.000      0.944 1.000 0.000
#> GSM918608     1   0.000      0.944 1.000 0.000
#> GSM918606     1   0.000      0.944 1.000 0.000
#> GSM918620     1   0.000      0.944 1.000 0.000
#> GSM918628     1   0.416      0.944 0.916 0.084
#> GSM918586     2   0.000      1.000 0.000 1.000
#> GSM918594     2   0.000      1.000 0.000 1.000
#> GSM918600     2   0.000      1.000 0.000 1.000
#> GSM918601     2   0.000      1.000 0.000 1.000
#> GSM918612     2   0.000      1.000 0.000 1.000
#> GSM918614     2   0.000      1.000 0.000 1.000
#> GSM918629     2   0.000      1.000 0.000 1.000
#> GSM918587     2   0.000      1.000 0.000 1.000
#> GSM918588     2   0.000      1.000 0.000 1.000
#> GSM918589     2   0.000      1.000 0.000 1.000
#> GSM918611     2   0.000      1.000 0.000 1.000
#> GSM918624     2   0.000      1.000 0.000 1.000
#> GSM918637     2   0.000      1.000 0.000 1.000
#> GSM918639     2   0.000      1.000 0.000 1.000
#> GSM918640     2   0.000      1.000 0.000 1.000
#> GSM918636     2   0.000      1.000 0.000 1.000
#> GSM918590     2   0.000      1.000 0.000 1.000
#> GSM918610     2   0.000      1.000 0.000 1.000
#> GSM918615     2   0.000      1.000 0.000 1.000
#> GSM918616     2   0.000      1.000 0.000 1.000
#> GSM918632     2   0.000      1.000 0.000 1.000
#> GSM918647     2   0.000      1.000 0.000 1.000
#> GSM918578     2   0.000      1.000 0.000 1.000
#> GSM918579     2   0.000      1.000 0.000 1.000
#> GSM918581     2   0.000      1.000 0.000 1.000
#> GSM918584     2   0.000      1.000 0.000 1.000
#> GSM918591     2   0.000      1.000 0.000 1.000
#> GSM918592     2   0.000      1.000 0.000 1.000
#> GSM918597     2   0.000      1.000 0.000 1.000
#> GSM918598     2   0.000      1.000 0.000 1.000
#> GSM918599     2   0.000      1.000 0.000 1.000
#> GSM918604     2   0.000      1.000 0.000 1.000
#> GSM918605     2   0.000      1.000 0.000 1.000
#> GSM918613     2   0.000      1.000 0.000 1.000
#> GSM918623     2   0.000      1.000 0.000 1.000
#> GSM918626     2   0.000      1.000 0.000 1.000
#> GSM918627     2   0.000      1.000 0.000 1.000
#> GSM918633     2   0.000      1.000 0.000 1.000
#> GSM918634     2   0.000      1.000 0.000 1.000
#> GSM918635     2   0.000      1.000 0.000 1.000
#> GSM918645     2   0.000      1.000 0.000 1.000
#> GSM918646     2   0.000      1.000 0.000 1.000
#> GSM918648     2   0.000      1.000 0.000 1.000
#> GSM918650     2   0.000      1.000 0.000 1.000
#> GSM918652     2   0.000      1.000 0.000 1.000
#> GSM918653     2   0.000      1.000 0.000 1.000
#> GSM918622     2   0.000      1.000 0.000 1.000
#> GSM918583     2   0.000      1.000 0.000 1.000
#> GSM918585     2   0.000      1.000 0.000 1.000
#> GSM918595     2   0.000      1.000 0.000 1.000
#> GSM918596     2   0.000      1.000 0.000 1.000
#> GSM918602     2   0.000      1.000 0.000 1.000
#> GSM918617     2   0.000      1.000 0.000 1.000
#> GSM918630     2   0.000      1.000 0.000 1.000
#> GSM918631     2   0.000      1.000 0.000 1.000
#> GSM918618     1   0.456      0.933 0.904 0.096
#> GSM918644     1   0.821      0.724 0.744 0.256

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>           class entropy silhouette    p1    p2    p3
#> GSM918603     3  0.4399      0.994 0.188 0.000 0.812
#> GSM918641     3  0.4399      0.994 0.188 0.000 0.812
#> GSM918580     3  0.4399      0.994 0.188 0.000 0.812
#> GSM918593     3  0.4399      0.994 0.188 0.000 0.812
#> GSM918625     3  0.4399      0.994 0.188 0.000 0.812
#> GSM918638     3  0.4399      0.994 0.188 0.000 0.812
#> GSM918642     3  0.4399      0.994 0.188 0.000 0.812
#> GSM918643     3  0.4399      0.994 0.188 0.000 0.812
#> GSM918619     1  0.0000      0.971 1.000 0.000 0.000
#> GSM918621     1  0.0000      0.971 1.000 0.000 0.000
#> GSM918582     1  0.0000      0.971 1.000 0.000 0.000
#> GSM918649     1  0.0237      0.967 0.996 0.000 0.004
#> GSM918651     1  0.0000      0.971 1.000 0.000 0.000
#> GSM918607     1  0.0000      0.971 1.000 0.000 0.000
#> GSM918609     1  0.0000      0.971 1.000 0.000 0.000
#> GSM918608     1  0.0000      0.971 1.000 0.000 0.000
#> GSM918606     1  0.0000      0.971 1.000 0.000 0.000
#> GSM918620     1  0.0000      0.971 1.000 0.000 0.000
#> GSM918628     1  0.5360      0.611 0.768 0.012 0.220
#> GSM918586     2  0.0237      0.930 0.000 0.996 0.004
#> GSM918594     2  0.0237      0.930 0.000 0.996 0.004
#> GSM918600     2  0.0424      0.928 0.000 0.992 0.008
#> GSM918601     2  0.0237      0.930 0.000 0.996 0.004
#> GSM918612     2  0.0237      0.930 0.000 0.996 0.004
#> GSM918614     2  0.0237      0.930 0.000 0.996 0.004
#> GSM918629     2  0.0000      0.931 0.000 1.000 0.000
#> GSM918587     2  0.4465      0.754 0.176 0.820 0.004
#> GSM918588     2  0.0237      0.930 0.000 0.996 0.004
#> GSM918589     2  0.0424      0.928 0.000 0.992 0.008
#> GSM918611     2  0.0424      0.928 0.000 0.992 0.008
#> GSM918624     2  0.0237      0.930 0.000 0.996 0.004
#> GSM918637     2  0.0000      0.931 0.000 1.000 0.000
#> GSM918639     2  0.0237      0.930 0.000 0.996 0.004
#> GSM918640     2  0.0237      0.930 0.000 0.996 0.004
#> GSM918636     2  0.0424      0.928 0.000 0.992 0.008
#> GSM918590     2  0.0000      0.931 0.000 1.000 0.000
#> GSM918610     2  0.4399      0.874 0.000 0.812 0.188
#> GSM918615     2  0.4291      0.877 0.000 0.820 0.180
#> GSM918616     2  0.0000      0.931 0.000 1.000 0.000
#> GSM918632     2  0.3879      0.888 0.000 0.848 0.152
#> GSM918647     2  0.4399      0.874 0.000 0.812 0.188
#> GSM918578     2  0.4399      0.874 0.000 0.812 0.188
#> GSM918579     2  0.4399      0.874 0.000 0.812 0.188
#> GSM918581     2  0.4399      0.874 0.000 0.812 0.188
#> GSM918584     2  0.4399      0.874 0.000 0.812 0.188
#> GSM918591     2  0.4399      0.874 0.000 0.812 0.188
#> GSM918592     2  0.4399      0.874 0.000 0.812 0.188
#> GSM918597     2  0.0000      0.931 0.000 1.000 0.000
#> GSM918598     2  0.4399      0.874 0.000 0.812 0.188
#> GSM918599     2  0.0000      0.931 0.000 1.000 0.000
#> GSM918604     2  0.0237      0.930 0.000 0.996 0.004
#> GSM918605     2  0.0000      0.931 0.000 1.000 0.000
#> GSM918613     2  0.0000      0.931 0.000 1.000 0.000
#> GSM918623     2  0.4399      0.874 0.000 0.812 0.188
#> GSM918626     2  0.0000      0.931 0.000 1.000 0.000
#> GSM918627     2  0.0000      0.931 0.000 1.000 0.000
#> GSM918633     2  0.0000      0.931 0.000 1.000 0.000
#> GSM918634     2  0.0000      0.931 0.000 1.000 0.000
#> GSM918635     2  0.4399      0.874 0.000 0.812 0.188
#> GSM918645     2  0.0000      0.931 0.000 1.000 0.000
#> GSM918646     2  0.0237      0.930 0.000 0.996 0.004
#> GSM918648     2  0.4399      0.874 0.000 0.812 0.188
#> GSM918650     2  0.4399      0.874 0.000 0.812 0.188
#> GSM918652     2  0.0000      0.931 0.000 1.000 0.000
#> GSM918653     2  0.4399      0.874 0.000 0.812 0.188
#> GSM918622     2  0.0000      0.931 0.000 1.000 0.000
#> GSM918583     2  0.4399      0.874 0.000 0.812 0.188
#> GSM918585     2  0.4399      0.874 0.000 0.812 0.188
#> GSM918595     2  0.0000      0.931 0.000 1.000 0.000
#> GSM918596     2  0.0000      0.931 0.000 1.000 0.000
#> GSM918602     2  0.0000      0.931 0.000 1.000 0.000
#> GSM918617     2  0.0000      0.931 0.000 1.000 0.000
#> GSM918630     2  0.3619      0.893 0.000 0.864 0.136
#> GSM918631     2  0.3879      0.888 0.000 0.848 0.152
#> GSM918618     3  0.4968      0.976 0.188 0.012 0.800
#> GSM918644     3  0.4968      0.976 0.188 0.012 0.800

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette p1    p2    p3    p4
#> GSM918603     4  0.0000      1.000  0 0.000 0.000 1.000
#> GSM918641     4  0.0000      1.000  0 0.000 0.000 1.000
#> GSM918580     4  0.0000      1.000  0 0.000 0.000 1.000
#> GSM918593     4  0.0000      1.000  0 0.000 0.000 1.000
#> GSM918625     4  0.0000      1.000  0 0.000 0.000 1.000
#> GSM918638     4  0.0000      1.000  0 0.000 0.000 1.000
#> GSM918642     4  0.0000      1.000  0 0.000 0.000 1.000
#> GSM918643     4  0.0000      1.000  0 0.000 0.000 1.000
#> GSM918619     1  0.0000      1.000  1 0.000 0.000 0.000
#> GSM918621     1  0.0000      1.000  1 0.000 0.000 0.000
#> GSM918582     1  0.0000      1.000  1 0.000 0.000 0.000
#> GSM918649     1  0.0000      1.000  1 0.000 0.000 0.000
#> GSM918651     1  0.0000      1.000  1 0.000 0.000 0.000
#> GSM918607     1  0.0000      1.000  1 0.000 0.000 0.000
#> GSM918609     1  0.0000      1.000  1 0.000 0.000 0.000
#> GSM918608     1  0.0000      1.000  1 0.000 0.000 0.000
#> GSM918606     1  0.0000      1.000  1 0.000 0.000 0.000
#> GSM918620     1  0.0000      1.000  1 0.000 0.000 0.000
#> GSM918628     3  0.2216      0.858  0 0.000 0.908 0.092
#> GSM918586     3  0.0000      0.905  0 0.000 1.000 0.000
#> GSM918594     3  0.0000      0.905  0 0.000 1.000 0.000
#> GSM918600     3  0.0000      0.905  0 0.000 1.000 0.000
#> GSM918601     3  0.0000      0.905  0 0.000 1.000 0.000
#> GSM918612     3  0.0000      0.905  0 0.000 1.000 0.000
#> GSM918614     3  0.0000      0.905  0 0.000 1.000 0.000
#> GSM918629     3  0.1211      0.896  0 0.040 0.960 0.000
#> GSM918587     3  0.0000      0.905  0 0.000 1.000 0.000
#> GSM918588     3  0.0000      0.905  0 0.000 1.000 0.000
#> GSM918589     3  0.0000      0.905  0 0.000 1.000 0.000
#> GSM918611     3  0.0000      0.905  0 0.000 1.000 0.000
#> GSM918624     3  0.0000      0.905  0 0.000 1.000 0.000
#> GSM918637     3  0.0000      0.905  0 0.000 1.000 0.000
#> GSM918639     3  0.0000      0.905  0 0.000 1.000 0.000
#> GSM918640     3  0.0000      0.905  0 0.000 1.000 0.000
#> GSM918636     3  0.0000      0.905  0 0.000 1.000 0.000
#> GSM918590     3  0.2589      0.865  0 0.116 0.884 0.000
#> GSM918610     2  0.0000      0.962  0 1.000 0.000 0.000
#> GSM918615     2  0.0188      0.960  0 0.996 0.004 0.000
#> GSM918616     3  0.3444      0.824  0 0.184 0.816 0.000
#> GSM918632     2  0.0336      0.958  0 0.992 0.008 0.000
#> GSM918647     2  0.0000      0.962  0 1.000 0.000 0.000
#> GSM918578     2  0.0188      0.960  0 0.996 0.004 0.000
#> GSM918579     2  0.0000      0.962  0 1.000 0.000 0.000
#> GSM918581     2  0.0000      0.962  0 1.000 0.000 0.000
#> GSM918584     2  0.0000      0.962  0 1.000 0.000 0.000
#> GSM918591     2  0.0000      0.962  0 1.000 0.000 0.000
#> GSM918592     2  0.0000      0.962  0 1.000 0.000 0.000
#> GSM918597     3  0.2345      0.872  0 0.100 0.900 0.000
#> GSM918598     2  0.2345      0.870  0 0.900 0.100 0.000
#> GSM918599     3  0.4431      0.663  0 0.304 0.696 0.000
#> GSM918604     3  0.0000      0.905  0 0.000 1.000 0.000
#> GSM918605     3  0.4382      0.676  0 0.296 0.704 0.000
#> GSM918613     2  0.3219      0.795  0 0.836 0.164 0.000
#> GSM918623     2  0.0000      0.962  0 1.000 0.000 0.000
#> GSM918626     3  0.0921      0.900  0 0.028 0.972 0.000
#> GSM918627     3  0.3486      0.821  0 0.188 0.812 0.000
#> GSM918633     2  0.2530      0.859  0 0.888 0.112 0.000
#> GSM918634     3  0.3486      0.821  0 0.188 0.812 0.000
#> GSM918635     2  0.0000      0.962  0 1.000 0.000 0.000
#> GSM918645     2  0.0592      0.954  0 0.984 0.016 0.000
#> GSM918646     2  0.3726      0.714  0 0.788 0.212 0.000
#> GSM918648     2  0.0000      0.962  0 1.000 0.000 0.000
#> GSM918650     2  0.0000      0.962  0 1.000 0.000 0.000
#> GSM918652     3  0.4746      0.536  0 0.368 0.632 0.000
#> GSM918653     2  0.0000      0.962  0 1.000 0.000 0.000
#> GSM918622     3  0.3486      0.821  0 0.188 0.812 0.000
#> GSM918583     2  0.0000      0.962  0 1.000 0.000 0.000
#> GSM918585     2  0.0000      0.962  0 1.000 0.000 0.000
#> GSM918595     3  0.2973      0.852  0 0.144 0.856 0.000
#> GSM918596     3  0.0000      0.905  0 0.000 1.000 0.000
#> GSM918602     3  0.3486      0.821  0 0.188 0.812 0.000
#> GSM918617     3  0.3486      0.821  0 0.188 0.812 0.000
#> GSM918630     2  0.1211      0.933  0 0.960 0.040 0.000
#> GSM918631     2  0.0592      0.953  0 0.984 0.016 0.000
#> GSM918618     3  0.2216      0.858  0 0.000 0.908 0.092
#> GSM918644     3  0.0469      0.901  0 0.000 0.988 0.012

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>           class entropy silhouette p1    p2    p3    p4    p5
#> GSM918603     4  0.0000      1.000  0 0.000 0.000 1.000 0.000
#> GSM918641     4  0.0000      1.000  0 0.000 0.000 1.000 0.000
#> GSM918580     4  0.0000      1.000  0 0.000 0.000 1.000 0.000
#> GSM918593     4  0.0000      1.000  0 0.000 0.000 1.000 0.000
#> GSM918625     4  0.0000      1.000  0 0.000 0.000 1.000 0.000
#> GSM918638     4  0.0000      1.000  0 0.000 0.000 1.000 0.000
#> GSM918642     4  0.0000      1.000  0 0.000 0.000 1.000 0.000
#> GSM918643     4  0.0000      1.000  0 0.000 0.000 1.000 0.000
#> GSM918619     1  0.0000      1.000  1 0.000 0.000 0.000 0.000
#> GSM918621     1  0.0000      1.000  1 0.000 0.000 0.000 0.000
#> GSM918582     1  0.0000      1.000  1 0.000 0.000 0.000 0.000
#> GSM918649     1  0.0000      1.000  1 0.000 0.000 0.000 0.000
#> GSM918651     1  0.0000      1.000  1 0.000 0.000 0.000 0.000
#> GSM918607     1  0.0000      1.000  1 0.000 0.000 0.000 0.000
#> GSM918609     1  0.0000      1.000  1 0.000 0.000 0.000 0.000
#> GSM918608     1  0.0000      1.000  1 0.000 0.000 0.000 0.000
#> GSM918606     1  0.0000      1.000  1 0.000 0.000 0.000 0.000
#> GSM918620     1  0.0000      1.000  1 0.000 0.000 0.000 0.000
#> GSM918628     5  0.6241      0.387  0 0.000 0.164 0.324 0.512
#> GSM918586     3  0.0510      0.943  0 0.000 0.984 0.000 0.016
#> GSM918594     3  0.0162      0.942  0 0.000 0.996 0.000 0.004
#> GSM918600     3  0.0510      0.943  0 0.000 0.984 0.000 0.016
#> GSM918601     3  0.0000      0.941  0 0.000 1.000 0.000 0.000
#> GSM918612     3  0.0510      0.943  0 0.000 0.984 0.000 0.016
#> GSM918614     3  0.0000      0.941  0 0.000 1.000 0.000 0.000
#> GSM918629     5  0.0880      0.804  0 0.000 0.032 0.000 0.968
#> GSM918587     5  0.3274      0.658  0 0.000 0.220 0.000 0.780
#> GSM918588     3  0.0510      0.943  0 0.000 0.984 0.000 0.016
#> GSM918589     3  0.0510      0.943  0 0.000 0.984 0.000 0.016
#> GSM918611     3  0.1043      0.924  0 0.000 0.960 0.000 0.040
#> GSM918624     3  0.0000      0.941  0 0.000 1.000 0.000 0.000
#> GSM918637     3  0.3336      0.696  0 0.000 0.772 0.000 0.228
#> GSM918639     3  0.0000      0.941  0 0.000 1.000 0.000 0.000
#> GSM918640     3  0.0000      0.941  0 0.000 1.000 0.000 0.000
#> GSM918636     3  0.3684      0.550  0 0.000 0.720 0.000 0.280
#> GSM918590     5  0.0000      0.813  0 0.000 0.000 0.000 1.000
#> GSM918610     2  0.0404      0.965  0 0.988 0.000 0.000 0.012
#> GSM918615     2  0.0404      0.965  0 0.988 0.000 0.000 0.012
#> GSM918616     5  0.0000      0.813  0 0.000 0.000 0.000 1.000
#> GSM918632     2  0.0290      0.962  0 0.992 0.000 0.000 0.008
#> GSM918647     2  0.0404      0.965  0 0.988 0.000 0.000 0.012
#> GSM918578     2  0.1197      0.932  0 0.952 0.000 0.000 0.048
#> GSM918579     2  0.0000      0.965  0 1.000 0.000 0.000 0.000
#> GSM918581     2  0.0290      0.966  0 0.992 0.000 0.000 0.008
#> GSM918584     2  0.0404      0.965  0 0.988 0.000 0.000 0.012
#> GSM918591     2  0.0404      0.965  0 0.988 0.000 0.000 0.012
#> GSM918592     2  0.0404      0.965  0 0.988 0.000 0.000 0.012
#> GSM918597     5  0.0000      0.813  0 0.000 0.000 0.000 1.000
#> GSM918598     5  0.4283      0.180  0 0.456 0.000 0.000 0.544
#> GSM918599     5  0.3003      0.712  0 0.188 0.000 0.000 0.812
#> GSM918604     5  0.4294      0.200  0 0.000 0.468 0.000 0.532
#> GSM918605     5  0.3074      0.707  0 0.196 0.000 0.000 0.804
#> GSM918613     5  0.1965      0.770  0 0.096 0.000 0.000 0.904
#> GSM918623     2  0.0000      0.965  0 1.000 0.000 0.000 0.000
#> GSM918626     5  0.0290      0.811  0 0.000 0.008 0.000 0.992
#> GSM918627     5  0.0000      0.813  0 0.000 0.000 0.000 1.000
#> GSM918633     5  0.2813      0.726  0 0.168 0.000 0.000 0.832
#> GSM918634     5  0.0000      0.813  0 0.000 0.000 0.000 1.000
#> GSM918635     2  0.0000      0.965  0 1.000 0.000 0.000 0.000
#> GSM918645     2  0.0404      0.965  0 0.988 0.000 0.000 0.012
#> GSM918646     2  0.4235      0.132  0 0.576 0.000 0.000 0.424
#> GSM918648     2  0.0000      0.965  0 1.000 0.000 0.000 0.000
#> GSM918650     2  0.0404      0.965  0 0.988 0.000 0.000 0.012
#> GSM918652     5  0.4256      0.294  0 0.436 0.000 0.000 0.564
#> GSM918653     2  0.0000      0.965  0 1.000 0.000 0.000 0.000
#> GSM918622     5  0.0000      0.813  0 0.000 0.000 0.000 1.000
#> GSM918583     2  0.0000      0.965  0 1.000 0.000 0.000 0.000
#> GSM918585     2  0.0000      0.965  0 1.000 0.000 0.000 0.000
#> GSM918595     5  0.0703      0.807  0 0.024 0.000 0.000 0.976
#> GSM918596     5  0.0404      0.809  0 0.000 0.012 0.000 0.988
#> GSM918602     5  0.0000      0.813  0 0.000 0.000 0.000 1.000
#> GSM918617     5  0.0000      0.813  0 0.000 0.000 0.000 1.000
#> GSM918630     2  0.0794      0.944  0 0.972 0.000 0.000 0.028
#> GSM918631     2  0.0000      0.965  0 1.000 0.000 0.000 0.000
#> GSM918618     5  0.6223      0.385  0 0.000 0.160 0.328 0.512
#> GSM918644     5  0.6099      0.335  0 0.000 0.352 0.136 0.512

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>           class entropy silhouette p1    p2    p3    p4    p5    p6
#> GSM918603     4  0.0000      1.000  0 0.000 0.000 1.000 0.000 0.000
#> GSM918641     4  0.0000      1.000  0 0.000 0.000 1.000 0.000 0.000
#> GSM918580     4  0.0000      1.000  0 0.000 0.000 1.000 0.000 0.000
#> GSM918593     4  0.0000      1.000  0 0.000 0.000 1.000 0.000 0.000
#> GSM918625     4  0.0000      1.000  0 0.000 0.000 1.000 0.000 0.000
#> GSM918638     4  0.0000      1.000  0 0.000 0.000 1.000 0.000 0.000
#> GSM918642     4  0.0000      1.000  0 0.000 0.000 1.000 0.000 0.000
#> GSM918643     4  0.0000      1.000  0 0.000 0.000 1.000 0.000 0.000
#> GSM918619     1  0.0000      1.000  1 0.000 0.000 0.000 0.000 0.000
#> GSM918621     1  0.0000      1.000  1 0.000 0.000 0.000 0.000 0.000
#> GSM918582     1  0.0000      1.000  1 0.000 0.000 0.000 0.000 0.000
#> GSM918649     1  0.0000      1.000  1 0.000 0.000 0.000 0.000 0.000
#> GSM918651     1  0.0000      1.000  1 0.000 0.000 0.000 0.000 0.000
#> GSM918607     1  0.0000      1.000  1 0.000 0.000 0.000 0.000 0.000
#> GSM918609     1  0.0000      1.000  1 0.000 0.000 0.000 0.000 0.000
#> GSM918608     1  0.0000      1.000  1 0.000 0.000 0.000 0.000 0.000
#> GSM918606     1  0.0000      1.000  1 0.000 0.000 0.000 0.000 0.000
#> GSM918620     1  0.0000      1.000  1 0.000 0.000 0.000 0.000 0.000
#> GSM918628     6  0.1845      0.996  0 0.000 0.000 0.028 0.052 0.920
#> GSM918586     3  0.0713      0.958  0 0.000 0.972 0.000 0.028 0.000
#> GSM918594     3  0.0713      0.958  0 0.000 0.972 0.000 0.028 0.000
#> GSM918600     3  0.0713      0.958  0 0.000 0.972 0.000 0.028 0.000
#> GSM918601     3  0.0000      0.946  0 0.000 1.000 0.000 0.000 0.000
#> GSM918612     3  0.0713      0.958  0 0.000 0.972 0.000 0.028 0.000
#> GSM918614     3  0.0260      0.950  0 0.000 0.992 0.000 0.008 0.000
#> GSM918629     5  0.1462      0.849  0 0.000 0.008 0.000 0.936 0.056
#> GSM918587     5  0.4328      0.619  0 0.000 0.180 0.000 0.720 0.100
#> GSM918588     3  0.0713      0.958  0 0.000 0.972 0.000 0.028 0.000
#> GSM918589     3  0.0713      0.958  0 0.000 0.972 0.000 0.028 0.000
#> GSM918611     3  0.0713      0.958  0 0.000 0.972 0.000 0.028 0.000
#> GSM918624     3  0.0000      0.946  0 0.000 1.000 0.000 0.000 0.000
#> GSM918637     3  0.2219      0.811  0 0.000 0.864 0.000 0.136 0.000
#> GSM918639     3  0.0000      0.946  0 0.000 1.000 0.000 0.000 0.000
#> GSM918640     3  0.0000      0.946  0 0.000 1.000 0.000 0.000 0.000
#> GSM918636     3  0.1500      0.929  0 0.000 0.936 0.000 0.052 0.012
#> GSM918590     5  0.1753      0.833  0 0.000 0.004 0.000 0.912 0.084
#> GSM918610     2  0.0790      0.928  0 0.968 0.000 0.000 0.000 0.032
#> GSM918615     2  0.0790      0.928  0 0.968 0.000 0.000 0.000 0.032
#> GSM918616     5  0.0146      0.873  0 0.000 0.004 0.000 0.996 0.000
#> GSM918632     2  0.0000      0.929  0 1.000 0.000 0.000 0.000 0.000
#> GSM918647     2  0.0000      0.929  0 1.000 0.000 0.000 0.000 0.000
#> GSM918578     2  0.0858      0.928  0 0.968 0.000 0.000 0.004 0.028
#> GSM918579     2  0.1075      0.921  0 0.952 0.000 0.000 0.000 0.048
#> GSM918581     2  0.0790      0.930  0 0.968 0.000 0.000 0.000 0.032
#> GSM918584     2  0.0790      0.928  0 0.968 0.000 0.000 0.000 0.032
#> GSM918591     2  0.0865      0.928  0 0.964 0.000 0.000 0.000 0.036
#> GSM918592     2  0.0937      0.928  0 0.960 0.000 0.000 0.000 0.040
#> GSM918597     5  0.0146      0.873  0 0.000 0.004 0.000 0.996 0.000
#> GSM918598     2  0.1387      0.893  0 0.932 0.000 0.000 0.068 0.000
#> GSM918599     5  0.2912      0.620  0 0.216 0.000 0.000 0.784 0.000
#> GSM918604     3  0.3327      0.792  0 0.000 0.820 0.000 0.092 0.088
#> GSM918605     2  0.4378      0.410  0 0.600 0.000 0.000 0.368 0.032
#> GSM918613     5  0.4125      0.652  0 0.184 0.000 0.000 0.736 0.080
#> GSM918623     2  0.1007      0.922  0 0.956 0.000 0.000 0.000 0.044
#> GSM918626     5  0.0603      0.869  0 0.000 0.004 0.000 0.980 0.016
#> GSM918627     5  0.0000      0.873  0 0.000 0.000 0.000 1.000 0.000
#> GSM918633     5  0.4703      0.452  0 0.312 0.000 0.000 0.620 0.068
#> GSM918634     5  0.0000      0.873  0 0.000 0.000 0.000 1.000 0.000
#> GSM918635     2  0.0790      0.925  0 0.968 0.000 0.000 0.000 0.032
#> GSM918645     2  0.0858      0.919  0 0.968 0.000 0.000 0.028 0.004
#> GSM918646     2  0.3803      0.691  0 0.760 0.000 0.000 0.184 0.056
#> GSM918648     2  0.1075      0.921  0 0.952 0.000 0.000 0.000 0.048
#> GSM918650     2  0.0790      0.928  0 0.968 0.000 0.000 0.000 0.032
#> GSM918652     2  0.3861      0.709  0 0.756 0.000 0.000 0.184 0.060
#> GSM918653     2  0.1075      0.921  0 0.952 0.000 0.000 0.000 0.048
#> GSM918622     5  0.0000      0.873  0 0.000 0.000 0.000 1.000 0.000
#> GSM918583     2  0.0146      0.929  0 0.996 0.000 0.000 0.000 0.004
#> GSM918585     2  0.1075      0.921  0 0.952 0.000 0.000 0.000 0.048
#> GSM918595     5  0.3089      0.788  0 0.060 0.004 0.000 0.844 0.092
#> GSM918596     5  0.0405      0.872  0 0.000 0.008 0.000 0.988 0.004
#> GSM918602     5  0.0000      0.873  0 0.000 0.000 0.000 1.000 0.000
#> GSM918617     5  0.0603      0.869  0 0.004 0.000 0.000 0.980 0.016
#> GSM918630     2  0.0547      0.924  0 0.980 0.000 0.000 0.000 0.020
#> GSM918631     2  0.1007      0.922  0 0.956 0.000 0.000 0.000 0.044
#> GSM918618     6  0.1845      0.996  0 0.000 0.000 0.028 0.052 0.920
#> GSM918644     6  0.1909      0.993  0 0.000 0.004 0.024 0.052 0.920

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

consensus_heatmap(res, k = 2)

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

consensus_heatmap(res, k = 3)

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

consensus_heatmap(res, k = 4)

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

consensus_heatmap(res, k = 5)

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

consensus_heatmap(res, k = 6)

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

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

membership_heatmap(res, k = 2)

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

membership_heatmap(res, k = 3)

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

membership_heatmap(res, k = 4)

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

membership_heatmap(res, k = 5)

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

membership_heatmap(res, k = 6)

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

As soon as we have had the classes for columns, we can look for signatures which are significantly different between classes which can be candidate marks for certain classes. Following are the heatmaps for signatures.

Signature heatmaps where rows are scaled:

get_signatures(res, k = 2)

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

get_signatures(res, k = 3)

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

get_signatures(res, k = 4)

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

get_signatures(res, k = 5)

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

get_signatures(res, k = 6)

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

Signature heatmaps where rows are not scaled:

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

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

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

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

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

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

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

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

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

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

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk CV-mclust-signature_compare

get_signature() returns a data frame invisibly. TO get the list of signatures, the function call should be assigned to a variable explicitly. In following code, if plot argument is set to FALSE, no heatmap is plotted while only the differential analysis is performed.

# code only for demonstration
tb = get_signature(res, k = ..., plot = FALSE)

An example of the output of tb is:

#>   which_row         fdr    mean_1    mean_2 scaled_mean_1 scaled_mean_2 km
#> 1        38 0.042760348  8.373488  9.131774    -0.5533452     0.5164555  1
#> 2        40 0.018707592  7.106213  8.469186    -0.6173731     0.5762149  1
#> 3        55 0.019134737 10.221463 11.207825    -0.6159697     0.5749050  1
#> 4        59 0.006059896  5.921854  7.869574    -0.6899429     0.6439467  1
#> 5        60 0.018055526  8.928898 10.211722    -0.6204761     0.5791110  1
#> 6        98 0.009384629 15.714769 14.887706     0.6635654    -0.6193277  2
...

The columns in tb are:

  1. which_row: row indices corresponding to the input matrix.
  2. fdr: FDR for the differential test.
  3. mean_x: The mean value in group x.
  4. scaled_mean_x: The mean value in group x after rows are scaled.
  5. km: Row groups if k-means clustering is applied to rows.

UMAP plot which shows how samples are separated.

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

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

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

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

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

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

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

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

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

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

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk CV-mclust-collect-classes

Test correlation between subgroups and known annotations. If the known annotation is numeric, one-way ANOVA test is applied, and if the known annotation is discrete, chi-squared contingency table test is applied.

test_to_known_factors(res)
#>            n disease.state(p) gender(p) other(p) k
#> CV:mclust 76         5.75e-15   0.00217 2.46e-05 2
#> CV:mclust 76         1.44e-27   0.00170 5.39e-10 3
#> CV:mclust 76         5.65e-30   0.00400 2.83e-05 4
#> CV:mclust 69         2.28e-35   0.00750 3.22e-06 5
#> CV:mclust 74         1.30e-44   0.00870 1.14e-12 6

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


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 76 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 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-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.919           0.954       0.978         0.4631 0.536   0.536
#> 3 3 0.960           0.922       0.968         0.4414 0.705   0.492
#> 4 4 0.949           0.910       0.968         0.0590 0.924   0.783
#> 5 5 0.831           0.809       0.896         0.0706 0.936   0.795
#> 6 6 0.775           0.516       0.769         0.0668 0.951   0.822

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

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

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

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

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

show/hide code output

cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#>           class entropy silhouette    p1    p2
#> GSM918603     1  0.0000      0.969 1.000 0.000
#> GSM918641     1  0.0000      0.969 1.000 0.000
#> GSM918580     1  0.0000      0.969 1.000 0.000
#> GSM918593     1  0.0000      0.969 1.000 0.000
#> GSM918625     1  0.0000      0.969 1.000 0.000
#> GSM918638     1  0.0000      0.969 1.000 0.000
#> GSM918642     1  0.0000      0.969 1.000 0.000
#> GSM918643     1  0.0000      0.969 1.000 0.000
#> GSM918619     1  0.0000      0.969 1.000 0.000
#> GSM918621     1  0.0000      0.969 1.000 0.000
#> GSM918582     1  0.0000      0.969 1.000 0.000
#> GSM918649     1  0.0000      0.969 1.000 0.000
#> GSM918651     1  0.0000      0.969 1.000 0.000
#> GSM918607     1  0.0000      0.969 1.000 0.000
#> GSM918609     1  0.0000      0.969 1.000 0.000
#> GSM918608     1  0.0000      0.969 1.000 0.000
#> GSM918606     1  0.0000      0.969 1.000 0.000
#> GSM918620     1  0.0000      0.969 1.000 0.000
#> GSM918628     1  0.0000      0.969 1.000 0.000
#> GSM918586     1  0.8608      0.614 0.716 0.284
#> GSM918594     2  0.5408      0.859 0.124 0.876
#> GSM918600     2  0.3431      0.926 0.064 0.936
#> GSM918601     2  0.1633      0.962 0.024 0.976
#> GSM918612     1  0.0000      0.969 1.000 0.000
#> GSM918614     1  0.6148      0.832 0.848 0.152
#> GSM918629     2  0.0000      0.982 0.000 1.000
#> GSM918587     2  0.0000      0.982 0.000 1.000
#> GSM918588     1  0.5629      0.856 0.868 0.132
#> GSM918589     1  0.6148      0.832 0.848 0.152
#> GSM918611     2  0.8327      0.647 0.264 0.736
#> GSM918624     2  0.7674      0.717 0.224 0.776
#> GSM918637     2  0.0000      0.982 0.000 1.000
#> GSM918639     2  0.4431      0.897 0.092 0.908
#> GSM918640     2  0.0376      0.979 0.004 0.996
#> GSM918636     1  0.3733      0.913 0.928 0.072
#> GSM918590     2  0.0000      0.982 0.000 1.000
#> GSM918610     2  0.0000      0.982 0.000 1.000
#> GSM918615     2  0.0000      0.982 0.000 1.000
#> GSM918616     2  0.0000      0.982 0.000 1.000
#> GSM918632     2  0.0000      0.982 0.000 1.000
#> GSM918647     2  0.0000      0.982 0.000 1.000
#> GSM918578     2  0.0000      0.982 0.000 1.000
#> GSM918579     2  0.0000      0.982 0.000 1.000
#> GSM918581     2  0.0000      0.982 0.000 1.000
#> GSM918584     2  0.0000      0.982 0.000 1.000
#> GSM918591     2  0.0000      0.982 0.000 1.000
#> GSM918592     2  0.0000      0.982 0.000 1.000
#> GSM918597     2  0.0000      0.982 0.000 1.000
#> GSM918598     2  0.0000      0.982 0.000 1.000
#> GSM918599     2  0.0000      0.982 0.000 1.000
#> GSM918604     2  0.2948      0.938 0.052 0.948
#> GSM918605     2  0.0000      0.982 0.000 1.000
#> GSM918613     2  0.0000      0.982 0.000 1.000
#> GSM918623     2  0.0000      0.982 0.000 1.000
#> GSM918626     2  0.0000      0.982 0.000 1.000
#> GSM918627     2  0.0000      0.982 0.000 1.000
#> GSM918633     2  0.0000      0.982 0.000 1.000
#> GSM918634     2  0.0000      0.982 0.000 1.000
#> GSM918635     2  0.0000      0.982 0.000 1.000
#> GSM918645     2  0.0000      0.982 0.000 1.000
#> GSM918646     2  0.0000      0.982 0.000 1.000
#> GSM918648     2  0.0000      0.982 0.000 1.000
#> GSM918650     2  0.0000      0.982 0.000 1.000
#> GSM918652     2  0.0000      0.982 0.000 1.000
#> GSM918653     2  0.0000      0.982 0.000 1.000
#> GSM918622     2  0.0000      0.982 0.000 1.000
#> GSM918583     2  0.0000      0.982 0.000 1.000
#> GSM918585     2  0.0000      0.982 0.000 1.000
#> GSM918595     2  0.0000      0.982 0.000 1.000
#> GSM918596     2  0.0000      0.982 0.000 1.000
#> GSM918602     2  0.0000      0.982 0.000 1.000
#> GSM918617     2  0.0000      0.982 0.000 1.000
#> GSM918630     2  0.0000      0.982 0.000 1.000
#> GSM918631     2  0.0000      0.982 0.000 1.000
#> GSM918618     1  0.0000      0.969 1.000 0.000
#> GSM918644     1  0.0000      0.969 1.000 0.000

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>           class entropy silhouette    p1    p2    p3
#> GSM918603     1  0.0000      0.999 1.000 0.000 0.000
#> GSM918641     1  0.0000      0.999 1.000 0.000 0.000
#> GSM918580     1  0.0000      0.999 1.000 0.000 0.000
#> GSM918593     1  0.0000      0.999 1.000 0.000 0.000
#> GSM918625     1  0.0000      0.999 1.000 0.000 0.000
#> GSM918638     1  0.0000      0.999 1.000 0.000 0.000
#> GSM918642     1  0.0000      0.999 1.000 0.000 0.000
#> GSM918643     1  0.0000      0.999 1.000 0.000 0.000
#> GSM918619     1  0.0000      0.999 1.000 0.000 0.000
#> GSM918621     1  0.0000      0.999 1.000 0.000 0.000
#> GSM918582     1  0.0000      0.999 1.000 0.000 0.000
#> GSM918649     1  0.0000      0.999 1.000 0.000 0.000
#> GSM918651     1  0.0000      0.999 1.000 0.000 0.000
#> GSM918607     1  0.0000      0.999 1.000 0.000 0.000
#> GSM918609     1  0.0000      0.999 1.000 0.000 0.000
#> GSM918608     1  0.0000      0.999 1.000 0.000 0.000
#> GSM918606     1  0.0000      0.999 1.000 0.000 0.000
#> GSM918620     1  0.0000      0.999 1.000 0.000 0.000
#> GSM918628     1  0.0000      0.999 1.000 0.000 0.000
#> GSM918586     3  0.0000      0.910 0.000 0.000 1.000
#> GSM918594     3  0.0000      0.910 0.000 0.000 1.000
#> GSM918600     3  0.0000      0.910 0.000 0.000 1.000
#> GSM918601     3  0.0000      0.910 0.000 0.000 1.000
#> GSM918612     3  0.0000      0.910 0.000 0.000 1.000
#> GSM918614     3  0.0000      0.910 0.000 0.000 1.000
#> GSM918629     3  0.0000      0.910 0.000 0.000 1.000
#> GSM918587     3  0.0000      0.910 0.000 0.000 1.000
#> GSM918588     3  0.0000      0.910 0.000 0.000 1.000
#> GSM918589     3  0.0000      0.910 0.000 0.000 1.000
#> GSM918611     3  0.0000      0.910 0.000 0.000 1.000
#> GSM918624     3  0.0000      0.910 0.000 0.000 1.000
#> GSM918637     3  0.0000      0.910 0.000 0.000 1.000
#> GSM918639     3  0.0000      0.910 0.000 0.000 1.000
#> GSM918640     3  0.0000      0.910 0.000 0.000 1.000
#> GSM918636     3  0.0000      0.910 0.000 0.000 1.000
#> GSM918590     2  0.0000      0.991 0.000 1.000 0.000
#> GSM918610     2  0.0000      0.991 0.000 1.000 0.000
#> GSM918615     2  0.0000      0.991 0.000 1.000 0.000
#> GSM918616     3  0.0000      0.910 0.000 0.000 1.000
#> GSM918632     2  0.0000      0.991 0.000 1.000 0.000
#> GSM918647     2  0.0000      0.991 0.000 1.000 0.000
#> GSM918578     2  0.0000      0.991 0.000 1.000 0.000
#> GSM918579     2  0.0000      0.991 0.000 1.000 0.000
#> GSM918581     2  0.0000      0.991 0.000 1.000 0.000
#> GSM918584     2  0.0000      0.991 0.000 1.000 0.000
#> GSM918591     2  0.0000      0.991 0.000 1.000 0.000
#> GSM918592     2  0.0000      0.991 0.000 1.000 0.000
#> GSM918597     3  0.0747      0.900 0.000 0.016 0.984
#> GSM918598     2  0.0000      0.991 0.000 1.000 0.000
#> GSM918599     3  0.6305      0.182 0.000 0.484 0.516
#> GSM918604     3  0.0000      0.910 0.000 0.000 1.000
#> GSM918605     2  0.2878      0.884 0.000 0.904 0.096
#> GSM918613     2  0.0000      0.991 0.000 1.000 0.000
#> GSM918623     2  0.0000      0.991 0.000 1.000 0.000
#> GSM918626     3  0.6168      0.380 0.000 0.412 0.588
#> GSM918627     3  0.5948      0.488 0.000 0.360 0.640
#> GSM918633     2  0.0000      0.991 0.000 1.000 0.000
#> GSM918634     3  0.0000      0.910 0.000 0.000 1.000
#> GSM918635     2  0.0000      0.991 0.000 1.000 0.000
#> GSM918645     2  0.0000      0.991 0.000 1.000 0.000
#> GSM918646     2  0.0000      0.991 0.000 1.000 0.000
#> GSM918648     2  0.0000      0.991 0.000 1.000 0.000
#> GSM918650     2  0.0000      0.991 0.000 1.000 0.000
#> GSM918652     2  0.0000      0.991 0.000 1.000 0.000
#> GSM918653     2  0.0000      0.991 0.000 1.000 0.000
#> GSM918622     3  0.6154      0.376 0.000 0.408 0.592
#> GSM918583     2  0.0000      0.991 0.000 1.000 0.000
#> GSM918585     2  0.0000      0.991 0.000 1.000 0.000
#> GSM918595     2  0.3412      0.843 0.000 0.876 0.124
#> GSM918596     3  0.0000      0.910 0.000 0.000 1.000
#> GSM918602     3  0.1860      0.875 0.000 0.052 0.948
#> GSM918617     3  0.6280      0.259 0.000 0.460 0.540
#> GSM918630     2  0.0000      0.991 0.000 1.000 0.000
#> GSM918631     2  0.0000      0.991 0.000 1.000 0.000
#> GSM918618     1  0.0592      0.988 0.988 0.000 0.012
#> GSM918644     1  0.0424      0.992 0.992 0.000 0.008

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM918603     4  0.0000     1.0000 0.000 0.000 0.000 1.000
#> GSM918641     4  0.0000     1.0000 0.000 0.000 0.000 1.000
#> GSM918580     4  0.0000     1.0000 0.000 0.000 0.000 1.000
#> GSM918593     4  0.0000     1.0000 0.000 0.000 0.000 1.000
#> GSM918625     4  0.0000     1.0000 0.000 0.000 0.000 1.000
#> GSM918638     4  0.0000     1.0000 0.000 0.000 0.000 1.000
#> GSM918642     4  0.0000     1.0000 0.000 0.000 0.000 1.000
#> GSM918643     4  0.0000     1.0000 0.000 0.000 0.000 1.000
#> GSM918619     1  0.0000     0.9496 1.000 0.000 0.000 0.000
#> GSM918621     1  0.0000     0.9496 1.000 0.000 0.000 0.000
#> GSM918582     1  0.0000     0.9496 1.000 0.000 0.000 0.000
#> GSM918649     1  0.0000     0.9496 1.000 0.000 0.000 0.000
#> GSM918651     1  0.0000     0.9496 1.000 0.000 0.000 0.000
#> GSM918607     1  0.0000     0.9496 1.000 0.000 0.000 0.000
#> GSM918609     1  0.0000     0.9496 1.000 0.000 0.000 0.000
#> GSM918608     1  0.0000     0.9496 1.000 0.000 0.000 0.000
#> GSM918606     1  0.0000     0.9496 1.000 0.000 0.000 0.000
#> GSM918620     1  0.0000     0.9496 1.000 0.000 0.000 0.000
#> GSM918628     1  0.4999     0.0313 0.508 0.000 0.000 0.492
#> GSM918586     3  0.0000     0.9489 0.000 0.000 1.000 0.000
#> GSM918594     3  0.0000     0.9489 0.000 0.000 1.000 0.000
#> GSM918600     3  0.0000     0.9489 0.000 0.000 1.000 0.000
#> GSM918601     3  0.0000     0.9489 0.000 0.000 1.000 0.000
#> GSM918612     3  0.0000     0.9489 0.000 0.000 1.000 0.000
#> GSM918614     3  0.0000     0.9489 0.000 0.000 1.000 0.000
#> GSM918629     3  0.0000     0.9489 0.000 0.000 1.000 0.000
#> GSM918587     3  0.0188     0.9459 0.000 0.004 0.996 0.000
#> GSM918588     3  0.0000     0.9489 0.000 0.000 1.000 0.000
#> GSM918589     3  0.0000     0.9489 0.000 0.000 1.000 0.000
#> GSM918611     3  0.0000     0.9489 0.000 0.000 1.000 0.000
#> GSM918624     3  0.0000     0.9489 0.000 0.000 1.000 0.000
#> GSM918637     3  0.0000     0.9489 0.000 0.000 1.000 0.000
#> GSM918639     3  0.0000     0.9489 0.000 0.000 1.000 0.000
#> GSM918640     3  0.0000     0.9489 0.000 0.000 1.000 0.000
#> GSM918636     3  0.0336     0.9429 0.000 0.000 0.992 0.008
#> GSM918590     2  0.0188     0.9573 0.000 0.996 0.004 0.000
#> GSM918610     2  0.0000     0.9607 0.000 1.000 0.000 0.000
#> GSM918615     2  0.0000     0.9607 0.000 1.000 0.000 0.000
#> GSM918616     3  0.0000     0.9489 0.000 0.000 1.000 0.000
#> GSM918632     2  0.0000     0.9607 0.000 1.000 0.000 0.000
#> GSM918647     2  0.0000     0.9607 0.000 1.000 0.000 0.000
#> GSM918578     2  0.0000     0.9607 0.000 1.000 0.000 0.000
#> GSM918579     2  0.0000     0.9607 0.000 1.000 0.000 0.000
#> GSM918581     2  0.0000     0.9607 0.000 1.000 0.000 0.000
#> GSM918584     2  0.0000     0.9607 0.000 1.000 0.000 0.000
#> GSM918591     2  0.0000     0.9607 0.000 1.000 0.000 0.000
#> GSM918592     2  0.0000     0.9607 0.000 1.000 0.000 0.000
#> GSM918597     3  0.0000     0.9489 0.000 0.000 1.000 0.000
#> GSM918598     2  0.0000     0.9607 0.000 1.000 0.000 0.000
#> GSM918599     2  0.4830     0.3340 0.000 0.608 0.392 0.000
#> GSM918604     3  0.0188     0.9462 0.004 0.000 0.996 0.000
#> GSM918605     2  0.2281     0.8661 0.000 0.904 0.096 0.000
#> GSM918613     2  0.0000     0.9607 0.000 1.000 0.000 0.000
#> GSM918623     2  0.0000     0.9607 0.000 1.000 0.000 0.000
#> GSM918626     3  0.4866     0.3032 0.000 0.404 0.596 0.000
#> GSM918627     3  0.2760     0.8116 0.000 0.128 0.872 0.000
#> GSM918633     2  0.0000     0.9607 0.000 1.000 0.000 0.000
#> GSM918634     3  0.0000     0.9489 0.000 0.000 1.000 0.000
#> GSM918635     2  0.0000     0.9607 0.000 1.000 0.000 0.000
#> GSM918645     2  0.0000     0.9607 0.000 1.000 0.000 0.000
#> GSM918646     2  0.0000     0.9607 0.000 1.000 0.000 0.000
#> GSM918648     2  0.0000     0.9607 0.000 1.000 0.000 0.000
#> GSM918650     2  0.0000     0.9607 0.000 1.000 0.000 0.000
#> GSM918652     2  0.0000     0.9607 0.000 1.000 0.000 0.000
#> GSM918653     2  0.0000     0.9607 0.000 1.000 0.000 0.000
#> GSM918622     3  0.4907     0.2650 0.000 0.420 0.580 0.000
#> GSM918583     2  0.0000     0.9607 0.000 1.000 0.000 0.000
#> GSM918585     2  0.0000     0.9607 0.000 1.000 0.000 0.000
#> GSM918595     2  0.3570     0.8287 0.048 0.860 0.092 0.000
#> GSM918596     3  0.0000     0.9489 0.000 0.000 1.000 0.000
#> GSM918602     3  0.0592     0.9348 0.000 0.016 0.984 0.000
#> GSM918617     2  0.4697     0.4282 0.000 0.644 0.356 0.000
#> GSM918630     2  0.0000     0.9607 0.000 1.000 0.000 0.000
#> GSM918631     2  0.0000     0.9607 0.000 1.000 0.000 0.000
#> GSM918618     4  0.0000     1.0000 0.000 0.000 0.000 1.000
#> GSM918644     4  0.0000     1.0000 0.000 0.000 0.000 1.000

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>           class entropy silhouette    p1    p2    p3    p4    p5
#> GSM918603     4  0.0000      0.998 0.000 0.000 0.000 1.000 0.000
#> GSM918641     4  0.0000      0.998 0.000 0.000 0.000 1.000 0.000
#> GSM918580     4  0.0000      0.998 0.000 0.000 0.000 1.000 0.000
#> GSM918593     4  0.0000      0.998 0.000 0.000 0.000 1.000 0.000
#> GSM918625     4  0.0000      0.998 0.000 0.000 0.000 1.000 0.000
#> GSM918638     4  0.0000      0.998 0.000 0.000 0.000 1.000 0.000
#> GSM918642     4  0.0000      0.998 0.000 0.000 0.000 1.000 0.000
#> GSM918643     4  0.0000      0.998 0.000 0.000 0.000 1.000 0.000
#> GSM918619     1  0.0000      0.994 1.000 0.000 0.000 0.000 0.000
#> GSM918621     1  0.0000      0.994 1.000 0.000 0.000 0.000 0.000
#> GSM918582     1  0.0000      0.994 1.000 0.000 0.000 0.000 0.000
#> GSM918649     1  0.0000      0.994 1.000 0.000 0.000 0.000 0.000
#> GSM918651     1  0.0000      0.994 1.000 0.000 0.000 0.000 0.000
#> GSM918607     1  0.0000      0.994 1.000 0.000 0.000 0.000 0.000
#> GSM918609     1  0.0000      0.994 1.000 0.000 0.000 0.000 0.000
#> GSM918608     1  0.0000      0.994 1.000 0.000 0.000 0.000 0.000
#> GSM918606     1  0.0000      0.994 1.000 0.000 0.000 0.000 0.000
#> GSM918620     1  0.0000      0.994 1.000 0.000 0.000 0.000 0.000
#> GSM918628     1  0.1787      0.941 0.936 0.016 0.004 0.000 0.044
#> GSM918586     3  0.0162      0.913 0.000 0.000 0.996 0.000 0.004
#> GSM918594     3  0.0404      0.914 0.000 0.000 0.988 0.000 0.012
#> GSM918600     3  0.0000      0.914 0.000 0.000 1.000 0.000 0.000
#> GSM918601     3  0.1608      0.902 0.000 0.000 0.928 0.000 0.072
#> GSM918612     3  0.0510      0.914 0.000 0.000 0.984 0.000 0.016
#> GSM918614     3  0.0000      0.914 0.000 0.000 1.000 0.000 0.000
#> GSM918629     3  0.0000      0.914 0.000 0.000 1.000 0.000 0.000
#> GSM918587     3  0.2742      0.840 0.000 0.020 0.892 0.020 0.068
#> GSM918588     3  0.0162      0.913 0.000 0.000 0.996 0.000 0.004
#> GSM918589     3  0.0162      0.914 0.000 0.000 0.996 0.000 0.004
#> GSM918611     3  0.0000      0.914 0.000 0.000 1.000 0.000 0.000
#> GSM918624     3  0.1732      0.899 0.000 0.000 0.920 0.000 0.080
#> GSM918637     3  0.1732      0.899 0.000 0.000 0.920 0.000 0.080
#> GSM918639     3  0.1608      0.902 0.000 0.000 0.928 0.000 0.072
#> GSM918640     3  0.1608      0.902 0.000 0.000 0.928 0.000 0.072
#> GSM918636     3  0.0566      0.911 0.000 0.004 0.984 0.000 0.012
#> GSM918590     2  0.3816      0.617 0.000 0.696 0.000 0.000 0.304
#> GSM918610     2  0.3983      0.637 0.000 0.660 0.000 0.000 0.340
#> GSM918615     2  0.3508      0.677 0.000 0.748 0.000 0.000 0.252
#> GSM918616     3  0.1892      0.897 0.000 0.004 0.916 0.000 0.080
#> GSM918632     2  0.2690      0.760 0.000 0.844 0.000 0.000 0.156
#> GSM918647     2  0.2230      0.769 0.000 0.884 0.000 0.000 0.116
#> GSM918578     2  0.4304      0.375 0.000 0.516 0.000 0.000 0.484
#> GSM918579     2  0.0000      0.777 0.000 1.000 0.000 0.000 0.000
#> GSM918581     2  0.3612      0.708 0.000 0.732 0.000 0.000 0.268
#> GSM918584     2  0.1121      0.779 0.000 0.956 0.000 0.000 0.044
#> GSM918591     2  0.3983      0.637 0.000 0.660 0.000 0.000 0.340
#> GSM918592     2  0.3983      0.639 0.000 0.660 0.000 0.000 0.340
#> GSM918597     3  0.0703      0.909 0.000 0.000 0.976 0.000 0.024
#> GSM918598     5  0.2561      0.617 0.000 0.144 0.000 0.000 0.856
#> GSM918599     2  0.5650     -0.222 0.000 0.464 0.460 0.000 0.076
#> GSM918604     3  0.0404      0.911 0.000 0.000 0.988 0.000 0.012
#> GSM918605     2  0.3359      0.690 0.000 0.816 0.020 0.000 0.164
#> GSM918613     2  0.0880      0.782 0.000 0.968 0.000 0.000 0.032
#> GSM918623     2  0.2605      0.762 0.000 0.852 0.000 0.000 0.148
#> GSM918626     3  0.3955      0.774 0.000 0.116 0.800 0.000 0.084
#> GSM918627     3  0.2997      0.735 0.000 0.148 0.840 0.000 0.012
#> GSM918633     2  0.3305      0.739 0.000 0.776 0.000 0.000 0.224
#> GSM918634     3  0.2338      0.882 0.000 0.004 0.884 0.000 0.112
#> GSM918635     2  0.3274      0.732 0.000 0.780 0.000 0.000 0.220
#> GSM918645     2  0.1043      0.780 0.000 0.960 0.000 0.000 0.040
#> GSM918646     2  0.0000      0.777 0.000 1.000 0.000 0.000 0.000
#> GSM918648     2  0.2179      0.769 0.000 0.888 0.000 0.000 0.112
#> GSM918650     2  0.2732      0.769 0.000 0.840 0.000 0.000 0.160
#> GSM918652     2  0.1121      0.747 0.000 0.956 0.000 0.000 0.044
#> GSM918653     2  0.0000      0.777 0.000 1.000 0.000 0.000 0.000
#> GSM918622     2  0.6686     -0.164 0.000 0.428 0.316 0.000 0.256
#> GSM918583     2  0.0290      0.779 0.000 0.992 0.000 0.000 0.008
#> GSM918585     2  0.0794      0.781 0.000 0.972 0.000 0.000 0.028
#> GSM918595     5  0.2329      0.637 0.000 0.124 0.000 0.000 0.876
#> GSM918596     3  0.3301      0.839 0.000 0.072 0.848 0.000 0.080
#> GSM918602     5  0.4166      0.214 0.000 0.004 0.348 0.000 0.648
#> GSM918617     3  0.5490      0.299 0.000 0.372 0.556 0.000 0.072
#> GSM918630     2  0.0000      0.777 0.000 1.000 0.000 0.000 0.000
#> GSM918631     2  0.0000      0.777 0.000 1.000 0.000 0.000 0.000
#> GSM918618     4  0.0609      0.983 0.000 0.000 0.000 0.980 0.020
#> GSM918644     4  0.0162      0.995 0.000 0.000 0.000 0.996 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
#> GSM918603     4  0.0000     0.9763 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM918641     4  0.0000     0.9763 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM918580     4  0.0000     0.9763 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM918593     4  0.0000     0.9763 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM918625     4  0.0000     0.9763 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM918638     4  0.0000     0.9763 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM918642     4  0.0000     0.9763 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM918643     4  0.0000     0.9763 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM918619     1  0.0000     0.9777 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM918621     1  0.0000     0.9777 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM918582     1  0.0000     0.9777 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM918649     1  0.0000     0.9777 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM918651     1  0.0000     0.9777 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM918607     1  0.0000     0.9777 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM918609     1  0.0000     0.9777 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM918608     1  0.0000     0.9777 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM918606     1  0.0000     0.9777 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM918620     1  0.0000     0.9777 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM918628     1  0.3541     0.7421 0.748 0.000 0.000 0.000 0.232 0.020
#> GSM918586     3  0.0632     0.7012 0.000 0.000 0.976 0.000 0.024 0.000
#> GSM918594     3  0.1556     0.6579 0.000 0.000 0.920 0.000 0.080 0.000
#> GSM918600     3  0.0000     0.7066 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM918601     3  0.3727     0.1716 0.000 0.000 0.612 0.000 0.388 0.000
#> GSM918612     3  0.0632     0.7013 0.000 0.000 0.976 0.000 0.024 0.000
#> GSM918614     3  0.0260     0.7061 0.000 0.000 0.992 0.000 0.008 0.000
#> GSM918629     3  0.0000     0.7066 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM918587     3  0.5233     0.3704 0.000 0.028 0.700 0.016 0.152 0.104
#> GSM918588     3  0.0260     0.7062 0.000 0.000 0.992 0.000 0.008 0.000
#> GSM918589     3  0.0713     0.6991 0.000 0.000 0.972 0.000 0.028 0.000
#> GSM918611     3  0.0000     0.7066 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM918624     3  0.3782     0.1016 0.000 0.000 0.588 0.000 0.412 0.000
#> GSM918637     3  0.3810     0.0450 0.000 0.000 0.572 0.000 0.428 0.000
#> GSM918639     3  0.3737     0.1587 0.000 0.000 0.608 0.000 0.392 0.000
#> GSM918640     3  0.3695     0.1987 0.000 0.000 0.624 0.000 0.376 0.000
#> GSM918636     3  0.0547     0.7031 0.000 0.000 0.980 0.000 0.020 0.000
#> GSM918590     2  0.5499     0.2399 0.000 0.564 0.004 0.000 0.148 0.284
#> GSM918610     2  0.6120     0.0578 0.000 0.352 0.000 0.000 0.304 0.344
#> GSM918615     2  0.2595     0.4945 0.000 0.836 0.000 0.000 0.004 0.160
#> GSM918616     3  0.4437    -0.0904 0.000 0.020 0.540 0.000 0.436 0.004
#> GSM918632     2  0.5949     0.2193 0.000 0.444 0.000 0.000 0.320 0.236
#> GSM918647     2  0.5834     0.2496 0.000 0.468 0.000 0.000 0.328 0.204
#> GSM918578     6  0.5903     0.0251 0.000 0.228 0.000 0.000 0.312 0.460
#> GSM918579     2  0.0363     0.5542 0.000 0.988 0.000 0.000 0.012 0.000
#> GSM918581     2  0.6113     0.1075 0.000 0.372 0.000 0.000 0.316 0.312
#> GSM918584     2  0.0291     0.5519 0.000 0.992 0.000 0.000 0.004 0.004
#> GSM918591     2  0.6119     0.0670 0.000 0.356 0.000 0.000 0.304 0.340
#> GSM918592     2  0.6120     0.0911 0.000 0.364 0.000 0.000 0.316 0.320
#> GSM918597     3  0.1007     0.6827 0.000 0.000 0.956 0.000 0.000 0.044
#> GSM918598     6  0.3770     0.4470 0.000 0.028 0.000 0.000 0.244 0.728
#> GSM918599     2  0.5501    -0.5487 0.000 0.460 0.128 0.000 0.412 0.000
#> GSM918604     3  0.0909     0.6983 0.000 0.000 0.968 0.000 0.020 0.012
#> GSM918605     2  0.4312    -0.1527 0.000 0.584 0.008 0.000 0.396 0.012
#> GSM918613     2  0.1082     0.5550 0.000 0.956 0.000 0.000 0.040 0.004
#> GSM918623     2  0.5903     0.2329 0.000 0.452 0.000 0.000 0.328 0.220
#> GSM918626     5  0.4502     0.2046 0.000 0.032 0.364 0.000 0.600 0.004
#> GSM918627     3  0.5622    -0.2493 0.000 0.212 0.540 0.000 0.248 0.000
#> GSM918633     2  0.6551     0.2373 0.000 0.464 0.052 0.000 0.316 0.168
#> GSM918634     5  0.6693     0.6713 0.000 0.268 0.236 0.000 0.448 0.048
#> GSM918635     2  0.6053     0.1695 0.000 0.408 0.000 0.000 0.320 0.272
#> GSM918645     2  0.0935     0.5417 0.000 0.964 0.000 0.000 0.032 0.004
#> GSM918646     2  0.1411     0.5538 0.000 0.936 0.000 0.000 0.060 0.004
#> GSM918648     2  0.5724     0.2708 0.000 0.492 0.000 0.000 0.324 0.184
#> GSM918650     2  0.4240     0.4691 0.000 0.736 0.000 0.000 0.140 0.124
#> GSM918652     2  0.2730     0.3435 0.000 0.808 0.000 0.000 0.192 0.000
#> GSM918653     2  0.1663     0.5471 0.000 0.912 0.000 0.000 0.088 0.000
#> GSM918622     2  0.6049     0.1388 0.000 0.532 0.176 0.000 0.024 0.268
#> GSM918583     2  0.0000     0.5530 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM918585     2  0.3320     0.4883 0.000 0.772 0.000 0.000 0.212 0.016
#> GSM918595     6  0.0993     0.4614 0.000 0.024 0.000 0.000 0.012 0.964
#> GSM918596     5  0.5992     0.6653 0.000 0.292 0.268 0.000 0.440 0.000
#> GSM918602     6  0.5884    -0.3285 0.000 0.004 0.236 0.000 0.252 0.508
#> GSM918617     2  0.4934    -0.1950 0.000 0.632 0.112 0.000 0.256 0.000
#> GSM918630     2  0.0632     0.5464 0.000 0.976 0.000 0.000 0.024 0.000
#> GSM918631     2  0.0458     0.5491 0.000 0.984 0.000 0.000 0.016 0.000
#> GSM918618     4  0.3393     0.7892 0.000 0.000 0.004 0.784 0.192 0.020
#> GSM918644     4  0.0692     0.9600 0.000 0.000 0.004 0.976 0.020 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-NMF-consensus-heatmap-1

consensus_heatmap(res, k = 3)

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

consensus_heatmap(res, k = 4)

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

consensus_heatmap(res, k = 5)

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

consensus_heatmap(res, k = 6)

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

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

membership_heatmap(res, k = 2)

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

membership_heatmap(res, k = 3)

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

membership_heatmap(res, k = 4)

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

membership_heatmap(res, k = 5)

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

membership_heatmap(res, k = 6)

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

As soon as we have had the classes for columns, we can look for signatures which are significantly different between classes which can be candidate marks for certain classes. Following are the heatmaps for signatures.

Signature heatmaps where rows are scaled:

get_signatures(res, k = 2)

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

get_signatures(res, k = 3)

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

get_signatures(res, k = 4)

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

get_signatures(res, k = 5)

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

get_signatures(res, k = 6)

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

Signature heatmaps where rows are not scaled:

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

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

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

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

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

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

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

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

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

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

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk CV-NMF-signature_compare

get_signature() returns a data frame invisibly. TO get the list of signatures, the function call should be assigned to a variable explicitly. In following code, if plot argument is set to FALSE, no heatmap is plotted while only the differential analysis is performed.

# code only for demonstration
tb = get_signature(res, k = ..., plot = FALSE)

An example of the output of tb is:

#>   which_row         fdr    mean_1    mean_2 scaled_mean_1 scaled_mean_2 km
#> 1        38 0.042760348  8.373488  9.131774    -0.5533452     0.5164555  1
#> 2        40 0.018707592  7.106213  8.469186    -0.6173731     0.5762149  1
#> 3        55 0.019134737 10.221463 11.207825    -0.6159697     0.5749050  1
#> 4        59 0.006059896  5.921854  7.869574    -0.6899429     0.6439467  1
#> 5        60 0.018055526  8.928898 10.211722    -0.6204761     0.5791110  1
#> 6        98 0.009384629 15.714769 14.887706     0.6635654    -0.6193277  2
...

The columns in tb are:

  1. which_row: row indices corresponding to the input matrix.
  2. fdr: FDR for the differential test.
  3. mean_x: The mean value in group x.
  4. scaled_mean_x: The mean value in group x after rows are scaled.
  5. km: Row groups if k-means clustering is applied to rows.

UMAP plot which shows how samples are separated.

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

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

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

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

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

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

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

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

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

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

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk CV-NMF-collect-classes

Test correlation between subgroups and known annotations. If the known annotation is numeric, one-way ANOVA test is applied, and if the known annotation is discrete, chi-squared contingency table test is applied.

test_to_known_factors(res)
#>         n disease.state(p) gender(p) other(p) k
#> CV:NMF 76         1.45e-11   0.01330 7.91e-04 2
#> CV:NMF 71         1.04e-19   0.00195 2.19e-04 3
#> CV:NMF 71         2.09e-32   0.00175 5.83e-08 4
#> CV:NMF 71         5.59e-28   0.00165 2.16e-07 5
#> CV:NMF 44         4.32e-16   0.05564 1.77e-05 6

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


MAD:hclust

The object with results only for a single top-value method and a single partition method can be extracted as:

res = res_list["MAD", "hclust"]
# you can also extract it by
# res = res_list["MAD:hclust"]

A summary of res and all the functions that can be applied to it:

res
#> A 'ConsensusPartition' object with k = 2, 3, 4, 5, 6.
#>   On a matrix with 51941 rows and 76 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 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-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.597           0.761       0.880         0.4507 0.495   0.495
#> 3 3 0.775           0.926       0.920         0.3767 0.871   0.741
#> 4 4 0.784           0.816       0.904         0.0484 0.987   0.965
#> 5 5 0.745           0.836       0.885         0.0737 0.965   0.904
#> 6 6 0.703           0.732       0.835         0.1196 0.867   0.603

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
#> GSM918603     1  0.1184      0.756 0.984 0.016
#> GSM918641     1  0.1184      0.756 0.984 0.016
#> GSM918580     1  0.0672      0.743 0.992 0.008
#> GSM918593     1  0.1184      0.756 0.984 0.016
#> GSM918625     1  0.1184      0.756 0.984 0.016
#> GSM918638     1  0.1184      0.756 0.984 0.016
#> GSM918642     1  0.1184      0.756 0.984 0.016
#> GSM918643     1  0.1184      0.756 0.984 0.016
#> GSM918619     1  0.1184      0.756 0.984 0.016
#> GSM918621     1  0.1184      0.756 0.984 0.016
#> GSM918582     1  0.1184      0.756 0.984 0.016
#> GSM918649     1  0.1184      0.756 0.984 0.016
#> GSM918651     1  0.1184      0.756 0.984 0.016
#> GSM918607     1  0.1184      0.756 0.984 0.016
#> GSM918609     1  0.1184      0.756 0.984 0.016
#> GSM918608     1  0.1184      0.756 0.984 0.016
#> GSM918606     1  0.1184      0.756 0.984 0.016
#> GSM918620     1  0.1184      0.756 0.984 0.016
#> GSM918628     1  0.0672      0.743 0.992 0.008
#> GSM918586     1  0.9996      0.394 0.512 0.488
#> GSM918594     1  0.9996      0.394 0.512 0.488
#> GSM918600     1  0.9996      0.394 0.512 0.488
#> GSM918601     1  0.9996      0.394 0.512 0.488
#> GSM918612     1  0.9983      0.414 0.524 0.476
#> GSM918614     1  0.9996      0.394 0.512 0.488
#> GSM918629     2  0.9922     -0.220 0.448 0.552
#> GSM918587     2  0.8386      0.552 0.268 0.732
#> GSM918588     1  0.9996      0.394 0.512 0.488
#> GSM918589     1  0.9933      0.444 0.548 0.452
#> GSM918611     1  0.9933      0.444 0.548 0.452
#> GSM918624     1  0.9996      0.394 0.512 0.488
#> GSM918637     1  0.9996      0.394 0.512 0.488
#> GSM918639     1  0.9996      0.394 0.512 0.488
#> GSM918640     1  0.9996      0.394 0.512 0.488
#> GSM918636     1  0.9922      0.452 0.552 0.448
#> GSM918590     2  0.1184      0.947 0.016 0.984
#> GSM918610     2  0.0000      0.951 0.000 1.000
#> GSM918615     2  0.0000      0.951 0.000 1.000
#> GSM918616     2  0.5294      0.825 0.120 0.880
#> GSM918632     2  0.0000      0.951 0.000 1.000
#> GSM918647     2  0.0000      0.951 0.000 1.000
#> GSM918578     2  0.0000      0.951 0.000 1.000
#> GSM918579     2  0.0000      0.951 0.000 1.000
#> GSM918581     2  0.0000      0.951 0.000 1.000
#> GSM918584     2  0.0000      0.951 0.000 1.000
#> GSM918591     2  0.0000      0.951 0.000 1.000
#> GSM918592     2  0.0000      0.951 0.000 1.000
#> GSM918597     2  0.2948      0.921 0.052 0.948
#> GSM918598     2  0.0000      0.951 0.000 1.000
#> GSM918599     2  0.2778      0.925 0.048 0.952
#> GSM918604     1  0.9988      0.407 0.520 0.480
#> GSM918605     2  0.1843      0.941 0.028 0.972
#> GSM918613     2  0.0000      0.951 0.000 1.000
#> GSM918623     2  0.0000      0.951 0.000 1.000
#> GSM918626     2  0.3114      0.917 0.056 0.944
#> GSM918627     2  0.2948      0.921 0.052 0.948
#> GSM918633     2  0.0000      0.951 0.000 1.000
#> GSM918634     2  0.1184      0.947 0.016 0.984
#> GSM918635     2  0.0000      0.951 0.000 1.000
#> GSM918645     2  0.1843      0.941 0.028 0.972
#> GSM918646     2  0.1184      0.947 0.016 0.984
#> GSM918648     2  0.0000      0.951 0.000 1.000
#> GSM918650     2  0.0000      0.951 0.000 1.000
#> GSM918652     2  0.1843      0.941 0.028 0.972
#> GSM918653     2  0.0000      0.951 0.000 1.000
#> GSM918622     2  0.2948      0.921 0.052 0.948
#> GSM918583     2  0.0000      0.951 0.000 1.000
#> GSM918585     2  0.0000      0.951 0.000 1.000
#> GSM918595     2  0.0000      0.951 0.000 1.000
#> GSM918596     2  0.1843      0.941 0.028 0.972
#> GSM918602     2  0.5294      0.825 0.120 0.880
#> GSM918617     2  0.1843      0.941 0.028 0.972
#> GSM918630     2  0.1633      0.943 0.024 0.976
#> GSM918631     2  0.0000      0.951 0.000 1.000
#> GSM918618     1  0.1414      0.752 0.980 0.020
#> GSM918644     1  0.6623      0.684 0.828 0.172

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>           class entropy silhouette    p1    p2    p3
#> GSM918603     1  0.3340      0.971 0.880 0.000 0.120
#> GSM918641     1  0.3267      0.972 0.884 0.000 0.116
#> GSM918580     1  0.0000      0.874 1.000 0.000 0.000
#> GSM918593     1  0.3340      0.971 0.880 0.000 0.120
#> GSM918625     1  0.3340      0.971 0.880 0.000 0.120
#> GSM918638     1  0.3340      0.971 0.880 0.000 0.120
#> GSM918642     1  0.3340      0.971 0.880 0.000 0.120
#> GSM918643     1  0.3340      0.971 0.880 0.000 0.120
#> GSM918619     1  0.3267      0.972 0.884 0.000 0.116
#> GSM918621     1  0.3267      0.972 0.884 0.000 0.116
#> GSM918582     1  0.3267      0.972 0.884 0.000 0.116
#> GSM918649     1  0.3267      0.972 0.884 0.000 0.116
#> GSM918651     1  0.3267      0.972 0.884 0.000 0.116
#> GSM918607     1  0.3267      0.972 0.884 0.000 0.116
#> GSM918609     1  0.3267      0.972 0.884 0.000 0.116
#> GSM918608     1  0.3267      0.972 0.884 0.000 0.116
#> GSM918606     1  0.3267      0.972 0.884 0.000 0.116
#> GSM918620     1  0.3267      0.972 0.884 0.000 0.116
#> GSM918628     1  0.0000      0.874 1.000 0.000 0.000
#> GSM918586     3  0.0000      0.968 0.000 0.000 1.000
#> GSM918594     3  0.0000      0.968 0.000 0.000 1.000
#> GSM918600     3  0.0000      0.968 0.000 0.000 1.000
#> GSM918601     3  0.0000      0.968 0.000 0.000 1.000
#> GSM918612     3  0.0592      0.962 0.012 0.000 0.988
#> GSM918614     3  0.0000      0.968 0.000 0.000 1.000
#> GSM918629     3  0.3267      0.846 0.000 0.116 0.884
#> GSM918587     2  0.8016      0.611 0.188 0.656 0.156
#> GSM918588     3  0.0000      0.968 0.000 0.000 1.000
#> GSM918589     3  0.4095      0.885 0.056 0.064 0.880
#> GSM918611     3  0.4095      0.885 0.056 0.064 0.880
#> GSM918624     3  0.0000      0.968 0.000 0.000 1.000
#> GSM918637     3  0.0000      0.968 0.000 0.000 1.000
#> GSM918639     3  0.0000      0.968 0.000 0.000 1.000
#> GSM918640     3  0.0000      0.968 0.000 0.000 1.000
#> GSM918636     3  0.1529      0.939 0.040 0.000 0.960
#> GSM918590     2  0.2165      0.923 0.000 0.936 0.064
#> GSM918610     2  0.0000      0.940 0.000 1.000 0.000
#> GSM918615     2  0.0000      0.940 0.000 1.000 0.000
#> GSM918616     2  0.5465      0.676 0.000 0.712 0.288
#> GSM918632     2  0.0000      0.940 0.000 1.000 0.000
#> GSM918647     2  0.0000      0.940 0.000 1.000 0.000
#> GSM918578     2  0.0000      0.940 0.000 1.000 0.000
#> GSM918579     2  0.0000      0.940 0.000 1.000 0.000
#> GSM918581     2  0.0000      0.940 0.000 1.000 0.000
#> GSM918584     2  0.0000      0.940 0.000 1.000 0.000
#> GSM918591     2  0.0000      0.940 0.000 1.000 0.000
#> GSM918592     2  0.0000      0.940 0.000 1.000 0.000
#> GSM918597     2  0.3879      0.862 0.000 0.848 0.152
#> GSM918598     2  0.0000      0.940 0.000 1.000 0.000
#> GSM918599     2  0.3482      0.883 0.000 0.872 0.128
#> GSM918604     3  0.0829      0.962 0.012 0.004 0.984
#> GSM918605     2  0.2448      0.918 0.000 0.924 0.076
#> GSM918613     2  0.0000      0.940 0.000 1.000 0.000
#> GSM918623     2  0.0000      0.940 0.000 1.000 0.000
#> GSM918626     2  0.3941      0.858 0.000 0.844 0.156
#> GSM918627     2  0.3879      0.862 0.000 0.848 0.152
#> GSM918633     2  0.0000      0.940 0.000 1.000 0.000
#> GSM918634     2  0.2165      0.923 0.000 0.936 0.064
#> GSM918635     2  0.0000      0.940 0.000 1.000 0.000
#> GSM918645     2  0.2448      0.918 0.000 0.924 0.076
#> GSM918646     2  0.1753      0.929 0.000 0.952 0.048
#> GSM918648     2  0.0000      0.940 0.000 1.000 0.000
#> GSM918650     2  0.0000      0.940 0.000 1.000 0.000
#> GSM918652     2  0.2448      0.918 0.000 0.924 0.076
#> GSM918653     2  0.0000      0.940 0.000 1.000 0.000
#> GSM918622     2  0.3879      0.862 0.000 0.848 0.152
#> GSM918583     2  0.0000      0.940 0.000 1.000 0.000
#> GSM918585     2  0.0000      0.940 0.000 1.000 0.000
#> GSM918595     2  0.0000      0.940 0.000 1.000 0.000
#> GSM918596     2  0.2537      0.915 0.000 0.920 0.080
#> GSM918602     2  0.5465      0.676 0.000 0.712 0.288
#> GSM918617     2  0.2537      0.915 0.000 0.920 0.080
#> GSM918630     2  0.1964      0.926 0.000 0.944 0.056
#> GSM918631     2  0.0000      0.940 0.000 1.000 0.000
#> GSM918618     1  0.2625      0.928 0.916 0.000 0.084
#> GSM918644     1  0.6585      0.763 0.736 0.064 0.200

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM918603     1  0.4053     0.6736 0.768 0.000 0.004 0.228
#> GSM918641     1  0.4679     0.4625 0.648 0.000 0.000 0.352
#> GSM918580     4  0.4977    -0.3251 0.460 0.000 0.000 0.540
#> GSM918593     1  0.4053     0.6736 0.768 0.000 0.004 0.228
#> GSM918625     1  0.4053     0.6736 0.768 0.000 0.004 0.228
#> GSM918638     1  0.4053     0.6736 0.768 0.000 0.004 0.228
#> GSM918642     1  0.4053     0.6736 0.768 0.000 0.004 0.228
#> GSM918643     1  0.4053     0.6736 0.768 0.000 0.004 0.228
#> GSM918619     1  0.0000     0.7556 1.000 0.000 0.000 0.000
#> GSM918621     1  0.0000     0.7556 1.000 0.000 0.000 0.000
#> GSM918582     1  0.0000     0.7556 1.000 0.000 0.000 0.000
#> GSM918649     1  0.0000     0.7556 1.000 0.000 0.000 0.000
#> GSM918651     1  0.0000     0.7556 1.000 0.000 0.000 0.000
#> GSM918607     1  0.0000     0.7556 1.000 0.000 0.000 0.000
#> GSM918609     1  0.0000     0.7556 1.000 0.000 0.000 0.000
#> GSM918608     1  0.0000     0.7556 1.000 0.000 0.000 0.000
#> GSM918606     1  0.0000     0.7556 1.000 0.000 0.000 0.000
#> GSM918620     1  0.0000     0.7556 1.000 0.000 0.000 0.000
#> GSM918628     4  0.3873     0.2902 0.228 0.000 0.000 0.772
#> GSM918586     3  0.0000     0.9512 0.000 0.000 1.000 0.000
#> GSM918594     3  0.0000     0.9512 0.000 0.000 1.000 0.000
#> GSM918600     3  0.0000     0.9512 0.000 0.000 1.000 0.000
#> GSM918601     3  0.0000     0.9512 0.000 0.000 1.000 0.000
#> GSM918612     3  0.0469     0.9446 0.012 0.000 0.988 0.000
#> GSM918614     3  0.0000     0.9512 0.000 0.000 1.000 0.000
#> GSM918629     3  0.2589     0.8064 0.000 0.116 0.884 0.000
#> GSM918587     2  0.7288     0.6217 0.076 0.656 0.124 0.144
#> GSM918588     3  0.0000     0.9512 0.000 0.000 1.000 0.000
#> GSM918589     3  0.4130     0.7976 0.108 0.064 0.828 0.000
#> GSM918611     3  0.4130     0.7976 0.108 0.064 0.828 0.000
#> GSM918624     3  0.0000     0.9512 0.000 0.000 1.000 0.000
#> GSM918637     3  0.0000     0.9512 0.000 0.000 1.000 0.000
#> GSM918639     3  0.0000     0.9512 0.000 0.000 1.000 0.000
#> GSM918640     3  0.0000     0.9512 0.000 0.000 1.000 0.000
#> GSM918636     3  0.2011     0.8816 0.080 0.000 0.920 0.000
#> GSM918590     2  0.1716     0.9202 0.000 0.936 0.064 0.000
#> GSM918610     2  0.0000     0.9368 0.000 1.000 0.000 0.000
#> GSM918615     2  0.0000     0.9368 0.000 1.000 0.000 0.000
#> GSM918616     2  0.4331     0.6738 0.000 0.712 0.288 0.000
#> GSM918632     2  0.0000     0.9368 0.000 1.000 0.000 0.000
#> GSM918647     2  0.0000     0.9368 0.000 1.000 0.000 0.000
#> GSM918578     2  0.0000     0.9368 0.000 1.000 0.000 0.000
#> GSM918579     2  0.0000     0.9368 0.000 1.000 0.000 0.000
#> GSM918581     2  0.0000     0.9368 0.000 1.000 0.000 0.000
#> GSM918584     2  0.0000     0.9368 0.000 1.000 0.000 0.000
#> GSM918591     2  0.0000     0.9368 0.000 1.000 0.000 0.000
#> GSM918592     2  0.0000     0.9368 0.000 1.000 0.000 0.000
#> GSM918597     2  0.3074     0.8613 0.000 0.848 0.152 0.000
#> GSM918598     2  0.0000     0.9368 0.000 1.000 0.000 0.000
#> GSM918599     2  0.2760     0.8814 0.000 0.872 0.128 0.000
#> GSM918604     3  0.0657     0.9439 0.012 0.004 0.984 0.000
#> GSM918605     2  0.1940     0.9149 0.000 0.924 0.076 0.000
#> GSM918613     2  0.0000     0.9368 0.000 1.000 0.000 0.000
#> GSM918623     2  0.0000     0.9368 0.000 1.000 0.000 0.000
#> GSM918626     2  0.3123     0.8577 0.000 0.844 0.156 0.000
#> GSM918627     2  0.3074     0.8613 0.000 0.848 0.152 0.000
#> GSM918633     2  0.0000     0.9368 0.000 1.000 0.000 0.000
#> GSM918634     2  0.1716     0.9202 0.000 0.936 0.064 0.000
#> GSM918635     2  0.0000     0.9368 0.000 1.000 0.000 0.000
#> GSM918645     2  0.1940     0.9149 0.000 0.924 0.076 0.000
#> GSM918646     2  0.1389     0.9256 0.000 0.952 0.048 0.000
#> GSM918648     2  0.0000     0.9368 0.000 1.000 0.000 0.000
#> GSM918650     2  0.0000     0.9368 0.000 1.000 0.000 0.000
#> GSM918652     2  0.1940     0.9149 0.000 0.924 0.076 0.000
#> GSM918653     2  0.0000     0.9368 0.000 1.000 0.000 0.000
#> GSM918622     2  0.3074     0.8613 0.000 0.848 0.152 0.000
#> GSM918583     2  0.0000     0.9368 0.000 1.000 0.000 0.000
#> GSM918585     2  0.0000     0.9368 0.000 1.000 0.000 0.000
#> GSM918595     2  0.0000     0.9368 0.000 1.000 0.000 0.000
#> GSM918596     2  0.2011     0.9127 0.000 0.920 0.080 0.000
#> GSM918602     2  0.4331     0.6738 0.000 0.712 0.288 0.000
#> GSM918617     2  0.2011     0.9127 0.000 0.920 0.080 0.000
#> GSM918630     2  0.1557     0.9233 0.000 0.944 0.056 0.000
#> GSM918631     2  0.0000     0.9368 0.000 1.000 0.000 0.000
#> GSM918618     1  0.5858     0.0415 0.500 0.000 0.032 0.468
#> GSM918644     1  0.8395     0.1190 0.500 0.064 0.148 0.288

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>           class entropy silhouette    p1    p2    p3    p4    p5
#> GSM918603     4  0.2561      0.863 0.144 0.000 0.000 0.856 0.000
#> GSM918641     4  0.4761      0.787 0.144 0.000 0.000 0.732 0.124
#> GSM918580     4  0.6016      0.584 0.140 0.000 0.000 0.548 0.312
#> GSM918593     4  0.2561      0.863 0.144 0.000 0.000 0.856 0.000
#> GSM918625     4  0.2561      0.863 0.144 0.000 0.000 0.856 0.000
#> GSM918638     4  0.2561      0.863 0.144 0.000 0.000 0.856 0.000
#> GSM918642     4  0.2561      0.863 0.144 0.000 0.000 0.856 0.000
#> GSM918643     4  0.2561      0.863 0.144 0.000 0.000 0.856 0.000
#> GSM918619     1  0.0000      1.000 1.000 0.000 0.000 0.000 0.000
#> GSM918621     1  0.0000      1.000 1.000 0.000 0.000 0.000 0.000
#> GSM918582     1  0.0000      1.000 1.000 0.000 0.000 0.000 0.000
#> GSM918649     1  0.0000      1.000 1.000 0.000 0.000 0.000 0.000
#> GSM918651     1  0.0000      1.000 1.000 0.000 0.000 0.000 0.000
#> GSM918607     1  0.0000      1.000 1.000 0.000 0.000 0.000 0.000
#> GSM918609     1  0.0000      1.000 1.000 0.000 0.000 0.000 0.000
#> GSM918608     1  0.0000      1.000 1.000 0.000 0.000 0.000 0.000
#> GSM918606     1  0.0000      1.000 1.000 0.000 0.000 0.000 0.000
#> GSM918620     1  0.0000      1.000 1.000 0.000 0.000 0.000 0.000
#> GSM918628     5  0.1851      0.000 0.088 0.000 0.000 0.000 0.912
#> GSM918586     3  0.0000      0.947 0.000 0.000 1.000 0.000 0.000
#> GSM918594     3  0.0000      0.947 0.000 0.000 1.000 0.000 0.000
#> GSM918600     3  0.0000      0.947 0.000 0.000 1.000 0.000 0.000
#> GSM918601     3  0.0000      0.947 0.000 0.000 1.000 0.000 0.000
#> GSM918612     3  0.0404      0.941 0.000 0.000 0.988 0.012 0.000
#> GSM918614     3  0.0000      0.947 0.000 0.000 1.000 0.000 0.000
#> GSM918629     3  0.2497      0.788 0.000 0.112 0.880 0.004 0.004
#> GSM918587     2  0.7423      0.536 0.012 0.548 0.096 0.116 0.228
#> GSM918588     3  0.0000      0.947 0.000 0.000 1.000 0.000 0.000
#> GSM918589     3  0.4167      0.778 0.008 0.064 0.808 0.112 0.008
#> GSM918611     3  0.4167      0.778 0.008 0.064 0.808 0.112 0.008
#> GSM918624     3  0.0000      0.947 0.000 0.000 1.000 0.000 0.000
#> GSM918637     3  0.0000      0.947 0.000 0.000 1.000 0.000 0.000
#> GSM918639     3  0.0000      0.947 0.000 0.000 1.000 0.000 0.000
#> GSM918640     3  0.0000      0.947 0.000 0.000 1.000 0.000 0.000
#> GSM918636     3  0.2077      0.879 0.000 0.000 0.908 0.084 0.008
#> GSM918590     2  0.4077      0.817 0.000 0.824 0.048 0.072 0.056
#> GSM918610     2  0.0324      0.860 0.000 0.992 0.000 0.004 0.004
#> GSM918615     2  0.0324      0.860 0.000 0.992 0.000 0.004 0.004
#> GSM918616     2  0.7163      0.535 0.000 0.532 0.260 0.124 0.084
#> GSM918632     2  0.0324      0.860 0.000 0.992 0.000 0.004 0.004
#> GSM918647     2  0.0324      0.860 0.000 0.992 0.000 0.004 0.004
#> GSM918578     2  0.0609      0.857 0.000 0.980 0.000 0.020 0.000
#> GSM918579     2  0.0324      0.860 0.000 0.992 0.000 0.004 0.004
#> GSM918581     2  0.0609      0.857 0.000 0.980 0.000 0.020 0.000
#> GSM918584     2  0.0324      0.860 0.000 0.992 0.000 0.004 0.004
#> GSM918591     2  0.0609      0.857 0.000 0.980 0.000 0.020 0.000
#> GSM918592     2  0.0609      0.857 0.000 0.980 0.000 0.020 0.000
#> GSM918597     2  0.6183      0.726 0.000 0.668 0.128 0.120 0.084
#> GSM918598     2  0.0609      0.857 0.000 0.980 0.000 0.020 0.000
#> GSM918599     2  0.5915      0.748 0.000 0.692 0.100 0.124 0.084
#> GSM918604     3  0.0566      0.940 0.000 0.004 0.984 0.012 0.000
#> GSM918605     2  0.5196      0.782 0.000 0.744 0.052 0.120 0.084
#> GSM918613     2  0.0324      0.860 0.000 0.992 0.000 0.004 0.004
#> GSM918623     2  0.0451      0.858 0.000 0.988 0.000 0.008 0.004
#> GSM918626     2  0.6225      0.722 0.000 0.664 0.128 0.124 0.084
#> GSM918627     2  0.6183      0.726 0.000 0.668 0.128 0.120 0.084
#> GSM918633     2  0.0324      0.860 0.000 0.992 0.000 0.004 0.004
#> GSM918634     2  0.4077      0.817 0.000 0.824 0.048 0.072 0.056
#> GSM918635     2  0.0609      0.857 0.000 0.980 0.000 0.020 0.000
#> GSM918645     2  0.5196      0.782 0.000 0.744 0.052 0.120 0.084
#> GSM918646     2  0.2351      0.847 0.000 0.916 0.028 0.036 0.020
#> GSM918648     2  0.0324      0.860 0.000 0.992 0.000 0.004 0.004
#> GSM918650     2  0.0324      0.860 0.000 0.992 0.000 0.004 0.004
#> GSM918652     2  0.5196      0.782 0.000 0.744 0.052 0.120 0.084
#> GSM918653     2  0.0324      0.860 0.000 0.992 0.000 0.004 0.004
#> GSM918622     2  0.6183      0.726 0.000 0.668 0.128 0.120 0.084
#> GSM918583     2  0.0324      0.860 0.000 0.992 0.000 0.004 0.004
#> GSM918585     2  0.0324      0.860 0.000 0.992 0.000 0.004 0.004
#> GSM918595     2  0.0880      0.857 0.000 0.968 0.000 0.032 0.000
#> GSM918596     2  0.5261      0.780 0.000 0.740 0.056 0.120 0.084
#> GSM918602     2  0.7163      0.535 0.000 0.532 0.260 0.124 0.084
#> GSM918617     2  0.5261      0.780 0.000 0.740 0.056 0.120 0.084
#> GSM918630     2  0.4780      0.794 0.000 0.768 0.032 0.120 0.080
#> GSM918631     2  0.0324      0.860 0.000 0.992 0.000 0.004 0.004
#> GSM918618     4  0.5789      0.586 0.076 0.000 0.024 0.628 0.272
#> GSM918644     4  0.7162      0.499 0.076 0.064 0.136 0.632 0.092

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>           class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM918603     4  0.0713      0.866 0.028 0.000 0.000 0.972 0.000 0.000
#> GSM918641     4  0.2784      0.791 0.028 0.000 0.000 0.848 0.000 0.124
#> GSM918580     4  0.4118      0.589 0.028 0.000 0.000 0.660 0.000 0.312
#> GSM918593     4  0.0713      0.866 0.028 0.000 0.000 0.972 0.000 0.000
#> GSM918625     4  0.0713      0.866 0.028 0.000 0.000 0.972 0.000 0.000
#> GSM918638     4  0.0713      0.866 0.028 0.000 0.000 0.972 0.000 0.000
#> GSM918642     4  0.0713      0.866 0.028 0.000 0.000 0.972 0.000 0.000
#> GSM918643     4  0.0713      0.866 0.028 0.000 0.000 0.972 0.000 0.000
#> GSM918619     1  0.0000      1.000 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM918621     1  0.0000      1.000 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM918582     1  0.0000      1.000 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM918649     1  0.0000      1.000 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM918651     1  0.0000      1.000 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM918607     1  0.0000      1.000 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM918609     1  0.0000      1.000 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM918608     1  0.0000      1.000 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM918606     1  0.0000      1.000 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM918620     1  0.0000      1.000 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM918628     6  0.1334      0.000 0.032 0.000 0.000 0.020 0.000 0.948
#> GSM918586     3  0.0146      0.940 0.000 0.000 0.996 0.000 0.004 0.000
#> GSM918594     3  0.0000      0.942 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM918600     3  0.0000      0.942 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM918601     3  0.0000      0.942 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM918612     3  0.0622      0.934 0.000 0.000 0.980 0.012 0.008 0.000
#> GSM918614     3  0.0000      0.942 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM918629     3  0.2542      0.810 0.000 0.044 0.876 0.000 0.080 0.000
#> GSM918587     5  0.7010      0.540 0.000 0.172 0.056 0.076 0.560 0.136
#> GSM918588     3  0.0000      0.942 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM918589     3  0.3862      0.745 0.000 0.000 0.772 0.096 0.132 0.000
#> GSM918611     3  0.3862      0.745 0.000 0.000 0.772 0.096 0.132 0.000
#> GSM918624     3  0.0000      0.942 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM918637     3  0.0000      0.942 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM918639     3  0.0000      0.942 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM918640     3  0.0000      0.942 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM918636     3  0.2404      0.859 0.000 0.000 0.884 0.080 0.036 0.000
#> GSM918590     5  0.4824      0.559 0.000 0.324 0.028 0.008 0.624 0.016
#> GSM918610     2  0.2996      0.730 0.000 0.772 0.000 0.000 0.228 0.000
#> GSM918615     2  0.2996      0.730 0.000 0.772 0.000 0.000 0.228 0.000
#> GSM918616     5  0.3460      0.557 0.000 0.020 0.220 0.000 0.760 0.000
#> GSM918632     2  0.0146      0.774 0.000 0.996 0.000 0.000 0.004 0.000
#> GSM918647     2  0.0146      0.774 0.000 0.996 0.000 0.000 0.004 0.000
#> GSM918578     5  0.4315      0.164 0.000 0.328 0.000 0.000 0.636 0.036
#> GSM918579     2  0.0000      0.772 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM918581     2  0.3755      0.675 0.000 0.744 0.000 0.000 0.220 0.036
#> GSM918584     2  0.2996      0.730 0.000 0.772 0.000 0.000 0.228 0.000
#> GSM918591     5  0.4315      0.164 0.000 0.328 0.000 0.000 0.636 0.036
#> GSM918592     5  0.4315      0.164 0.000 0.328 0.000 0.000 0.636 0.036
#> GSM918597     5  0.4368      0.676 0.000 0.204 0.088 0.000 0.708 0.000
#> GSM918598     5  0.4315      0.164 0.000 0.328 0.000 0.000 0.636 0.036
#> GSM918599     5  0.4809      0.602 0.000 0.328 0.072 0.000 0.600 0.000
#> GSM918604     3  0.0725      0.932 0.000 0.000 0.976 0.012 0.012 0.000
#> GSM918605     5  0.3558      0.674 0.000 0.212 0.028 0.000 0.760 0.000
#> GSM918613     2  0.2996      0.730 0.000 0.772 0.000 0.000 0.228 0.000
#> GSM918623     2  0.3053      0.731 0.000 0.812 0.000 0.000 0.168 0.020
#> GSM918626     5  0.4340      0.674 0.000 0.200 0.088 0.000 0.712 0.000
#> GSM918627     5  0.4368      0.676 0.000 0.204 0.088 0.000 0.708 0.000
#> GSM918633     2  0.2996      0.730 0.000 0.772 0.000 0.000 0.228 0.000
#> GSM918634     5  0.4824      0.559 0.000 0.324 0.028 0.008 0.624 0.016
#> GSM918635     2  0.3520      0.699 0.000 0.776 0.000 0.000 0.188 0.036
#> GSM918645     5  0.3558      0.674 0.000 0.212 0.028 0.000 0.760 0.000
#> GSM918646     2  0.3584      0.143 0.000 0.688 0.004 0.000 0.308 0.000
#> GSM918648     2  0.0146      0.774 0.000 0.996 0.000 0.000 0.004 0.000
#> GSM918650     2  0.2996      0.730 0.000 0.772 0.000 0.000 0.228 0.000
#> GSM918652     5  0.3558      0.674 0.000 0.212 0.028 0.000 0.760 0.000
#> GSM918653     2  0.0000      0.772 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM918622     5  0.4368      0.676 0.000 0.204 0.088 0.000 0.708 0.000
#> GSM918583     2  0.2996      0.730 0.000 0.772 0.000 0.000 0.228 0.000
#> GSM918585     2  0.0000      0.772 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM918595     5  0.4666      0.208 0.000 0.296 0.000 0.008 0.644 0.052
#> GSM918596     5  0.3529      0.674 0.000 0.208 0.028 0.000 0.764 0.000
#> GSM918602     5  0.3460      0.557 0.000 0.020 0.220 0.000 0.760 0.000
#> GSM918617     5  0.4264      0.590 0.000 0.352 0.028 0.000 0.620 0.000
#> GSM918630     5  0.3944      0.488 0.000 0.428 0.004 0.000 0.568 0.000
#> GSM918631     2  0.0000      0.772 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM918618     4  0.4439      0.595 0.008 0.000 0.016 0.696 0.024 0.256
#> GSM918644     4  0.5426      0.521 0.008 0.000 0.112 0.696 0.108 0.076

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) gender(p) other(p) k
#> MAD:hclust 60         1.22e-11   0.01852 6.49e-04 2
#> MAD:hclust 76         6.17e-25   0.00168 2.56e-05 3
#> MAD:hclust 71         1.26e-25   0.00110 4.26e-05 4
#> MAD:hclust 74         3.50e-38   0.00425 5.95e-08 5
#> MAD:hclust 68         3.15e-32   0.00412 9.21e-07 6

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


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 76 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.679           0.870       0.858         0.4707 0.495   0.495
#> 3 3 0.520           0.778       0.851         0.3340 0.782   0.588
#> 4 4 0.698           0.631       0.754         0.1568 0.926   0.790
#> 5 5 0.705           0.735       0.736         0.0781 0.871   0.589
#> 6 6 0.750           0.758       0.790         0.0481 0.933   0.696

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
#> GSM918603     1  0.0938      0.823 0.988 0.012
#> GSM918641     1  0.0938      0.823 0.988 0.012
#> GSM918580     1  0.0938      0.823 0.988 0.012
#> GSM918593     1  0.0938      0.823 0.988 0.012
#> GSM918625     1  0.0938      0.823 0.988 0.012
#> GSM918638     1  0.0938      0.823 0.988 0.012
#> GSM918642     1  0.0938      0.823 0.988 0.012
#> GSM918643     1  0.0938      0.823 0.988 0.012
#> GSM918619     1  0.1184      0.823 0.984 0.016
#> GSM918621     1  0.1184      0.823 0.984 0.016
#> GSM918582     1  0.1184      0.823 0.984 0.016
#> GSM918649     1  0.1184      0.823 0.984 0.016
#> GSM918651     1  0.1184      0.823 0.984 0.016
#> GSM918607     1  0.1184      0.823 0.984 0.016
#> GSM918609     1  0.1184      0.823 0.984 0.016
#> GSM918608     1  0.1184      0.823 0.984 0.016
#> GSM918606     1  0.1184      0.823 0.984 0.016
#> GSM918620     1  0.1184      0.823 0.984 0.016
#> GSM918628     1  0.1184      0.823 0.984 0.016
#> GSM918586     1  0.9522      0.664 0.628 0.372
#> GSM918594     1  0.9522      0.664 0.628 0.372
#> GSM918600     1  0.9522      0.664 0.628 0.372
#> GSM918601     1  0.9522      0.664 0.628 0.372
#> GSM918612     1  0.9323      0.679 0.652 0.348
#> GSM918614     1  0.9522      0.664 0.628 0.372
#> GSM918629     2  0.2423      0.932 0.040 0.960
#> GSM918587     2  0.0672      0.961 0.008 0.992
#> GSM918588     1  0.9522      0.664 0.628 0.372
#> GSM918589     1  0.9522      0.664 0.628 0.372
#> GSM918611     1  0.9522      0.664 0.628 0.372
#> GSM918624     1  0.9522      0.664 0.628 0.372
#> GSM918637     1  0.9522      0.664 0.628 0.372
#> GSM918639     1  0.9522      0.664 0.628 0.372
#> GSM918640     1  0.9522      0.664 0.628 0.372
#> GSM918636     1  0.9522      0.664 0.628 0.372
#> GSM918590     2  0.2236      0.981 0.036 0.964
#> GSM918610     2  0.2236      0.981 0.036 0.964
#> GSM918615     2  0.2236      0.981 0.036 0.964
#> GSM918616     2  0.1184      0.952 0.016 0.984
#> GSM918632     2  0.2236      0.981 0.036 0.964
#> GSM918647     2  0.2236      0.981 0.036 0.964
#> GSM918578     2  0.2236      0.981 0.036 0.964
#> GSM918579     2  0.2236      0.981 0.036 0.964
#> GSM918581     2  0.2236      0.981 0.036 0.964
#> GSM918584     2  0.2236      0.981 0.036 0.964
#> GSM918591     2  0.2236      0.981 0.036 0.964
#> GSM918592     2  0.2236      0.981 0.036 0.964
#> GSM918597     2  0.0376      0.963 0.004 0.996
#> GSM918598     2  0.2236      0.981 0.036 0.964
#> GSM918599     2  0.0376      0.963 0.004 0.996
#> GSM918604     1  0.9522      0.664 0.628 0.372
#> GSM918605     2  0.0000      0.964 0.000 1.000
#> GSM918613     2  0.2236      0.981 0.036 0.964
#> GSM918623     2  0.2236      0.981 0.036 0.964
#> GSM918626     2  0.0376      0.963 0.004 0.996
#> GSM918627     2  0.0376      0.963 0.004 0.996
#> GSM918633     2  0.2236      0.981 0.036 0.964
#> GSM918634     2  0.0376      0.963 0.004 0.996
#> GSM918635     2  0.2236      0.981 0.036 0.964
#> GSM918645     2  0.2236      0.981 0.036 0.964
#> GSM918646     2  0.2236      0.981 0.036 0.964
#> GSM918648     2  0.2236      0.981 0.036 0.964
#> GSM918650     2  0.2236      0.981 0.036 0.964
#> GSM918652     2  0.0938      0.970 0.012 0.988
#> GSM918653     2  0.2236      0.981 0.036 0.964
#> GSM918622     2  0.0376      0.963 0.004 0.996
#> GSM918583     2  0.2236      0.981 0.036 0.964
#> GSM918585     2  0.2236      0.981 0.036 0.964
#> GSM918595     2  0.2236      0.981 0.036 0.964
#> GSM918596     2  0.1184      0.952 0.016 0.984
#> GSM918602     2  0.1184      0.952 0.016 0.984
#> GSM918617     2  0.0376      0.963 0.004 0.996
#> GSM918630     2  0.2236      0.981 0.036 0.964
#> GSM918631     2  0.2236      0.981 0.036 0.964
#> GSM918618     1  0.2236      0.804 0.964 0.036
#> GSM918644     1  0.2603      0.807 0.956 0.044

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>           class entropy silhouette    p1    p2    p3
#> GSM918603     1  0.4931     0.8519 0.768 0.000 0.232
#> GSM918641     1  0.4931     0.8519 0.768 0.000 0.232
#> GSM918580     1  0.4931     0.8519 0.768 0.000 0.232
#> GSM918593     1  0.4931     0.8519 0.768 0.000 0.232
#> GSM918625     1  0.4931     0.8519 0.768 0.000 0.232
#> GSM918638     1  0.4931     0.8519 0.768 0.000 0.232
#> GSM918642     1  0.4931     0.8519 0.768 0.000 0.232
#> GSM918643     1  0.4931     0.8519 0.768 0.000 0.232
#> GSM918619     1  0.1964     0.8724 0.944 0.000 0.056
#> GSM918621     1  0.1964     0.8724 0.944 0.000 0.056
#> GSM918582     1  0.1964     0.8724 0.944 0.000 0.056
#> GSM918649     1  0.1964     0.8724 0.944 0.000 0.056
#> GSM918651     1  0.1964     0.8724 0.944 0.000 0.056
#> GSM918607     1  0.1964     0.8724 0.944 0.000 0.056
#> GSM918609     1  0.1964     0.8724 0.944 0.000 0.056
#> GSM918608     1  0.1964     0.8724 0.944 0.000 0.056
#> GSM918606     1  0.1964     0.8724 0.944 0.000 0.056
#> GSM918620     1  0.1964     0.8724 0.944 0.000 0.056
#> GSM918628     1  0.4605     0.8608 0.796 0.000 0.204
#> GSM918586     3  0.4868     0.8728 0.056 0.100 0.844
#> GSM918594     3  0.4868     0.8728 0.056 0.100 0.844
#> GSM918600     3  0.4868     0.8728 0.056 0.100 0.844
#> GSM918601     3  0.4868     0.8728 0.056 0.100 0.844
#> GSM918612     3  0.4868     0.8728 0.056 0.100 0.844
#> GSM918614     3  0.4868     0.8728 0.056 0.100 0.844
#> GSM918629     3  0.3454     0.8467 0.008 0.104 0.888
#> GSM918587     3  0.5254     0.6455 0.000 0.264 0.736
#> GSM918588     3  0.4868     0.8728 0.056 0.100 0.844
#> GSM918589     3  0.4868     0.8728 0.056 0.100 0.844
#> GSM918611     3  0.4449     0.8660 0.040 0.100 0.860
#> GSM918624     3  0.4868     0.8728 0.056 0.100 0.844
#> GSM918637     3  0.4449     0.8660 0.040 0.100 0.860
#> GSM918639     3  0.4868     0.8728 0.056 0.100 0.844
#> GSM918640     3  0.4868     0.8728 0.056 0.100 0.844
#> GSM918636     3  0.4868     0.8728 0.056 0.100 0.844
#> GSM918590     2  0.1964     0.8854 0.000 0.944 0.056
#> GSM918610     2  0.1529     0.8911 0.000 0.960 0.040
#> GSM918615     2  0.1529     0.8911 0.000 0.960 0.040
#> GSM918616     3  0.5254     0.6270 0.000 0.264 0.736
#> GSM918632     2  0.0000     0.8875 0.000 1.000 0.000
#> GSM918647     2  0.0000     0.8875 0.000 1.000 0.000
#> GSM918578     2  0.1529     0.8911 0.000 0.960 0.040
#> GSM918579     2  0.0000     0.8875 0.000 1.000 0.000
#> GSM918581     2  0.0592     0.8889 0.000 0.988 0.012
#> GSM918584     2  0.1529     0.8911 0.000 0.960 0.040
#> GSM918591     2  0.1529     0.8911 0.000 0.960 0.040
#> GSM918592     2  0.1529     0.8911 0.000 0.960 0.040
#> GSM918597     3  0.6308    -0.0239 0.000 0.492 0.508
#> GSM918598     2  0.1529     0.8911 0.000 0.960 0.040
#> GSM918599     2  0.5363     0.5347 0.000 0.724 0.276
#> GSM918604     3  0.4868     0.8728 0.056 0.100 0.844
#> GSM918605     2  0.1964     0.8854 0.000 0.944 0.056
#> GSM918613     2  0.1643     0.8902 0.000 0.956 0.044
#> GSM918623     2  0.0000     0.8875 0.000 1.000 0.000
#> GSM918626     2  0.6291     0.0722 0.000 0.532 0.468
#> GSM918627     2  0.6299     0.0874 0.000 0.524 0.476
#> GSM918633     2  0.1529     0.8911 0.000 0.960 0.040
#> GSM918634     2  0.6305     0.0558 0.000 0.516 0.484
#> GSM918635     2  0.0000     0.8875 0.000 1.000 0.000
#> GSM918645     2  0.1643     0.8902 0.000 0.956 0.044
#> GSM918646     2  0.0747     0.8845 0.000 0.984 0.016
#> GSM918648     2  0.0000     0.8875 0.000 1.000 0.000
#> GSM918650     2  0.1529     0.8911 0.000 0.960 0.040
#> GSM918652     2  0.1643     0.8873 0.000 0.956 0.044
#> GSM918653     2  0.0000     0.8875 0.000 1.000 0.000
#> GSM918622     2  0.6299     0.0874 0.000 0.524 0.476
#> GSM918583     2  0.0000     0.8875 0.000 1.000 0.000
#> GSM918585     2  0.0000     0.8875 0.000 1.000 0.000
#> GSM918595     2  0.1529     0.8911 0.000 0.960 0.040
#> GSM918596     3  0.3551     0.8156 0.000 0.132 0.868
#> GSM918602     3  0.6204     0.2389 0.000 0.424 0.576
#> GSM918617     2  0.5678     0.4481 0.000 0.684 0.316
#> GSM918630     2  0.0747     0.8845 0.000 0.984 0.016
#> GSM918631     2  0.0000     0.8875 0.000 1.000 0.000
#> GSM918618     1  0.5560     0.8140 0.700 0.000 0.300
#> GSM918644     3  0.6308    -0.4673 0.492 0.000 0.508

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM918603     1  0.5657     0.7634 0.540 0.000 0.024 0.436
#> GSM918641     1  0.5657     0.7634 0.540 0.000 0.024 0.436
#> GSM918580     1  0.5657     0.7634 0.540 0.000 0.024 0.436
#> GSM918593     1  0.5657     0.7634 0.540 0.000 0.024 0.436
#> GSM918625     1  0.5657     0.7634 0.540 0.000 0.024 0.436
#> GSM918638     1  0.5657     0.7634 0.540 0.000 0.024 0.436
#> GSM918642     1  0.5657     0.7634 0.540 0.000 0.024 0.436
#> GSM918643     1  0.5657     0.7634 0.540 0.000 0.024 0.436
#> GSM918619     1  0.0336     0.7882 0.992 0.000 0.008 0.000
#> GSM918621     1  0.0336     0.7882 0.992 0.000 0.008 0.000
#> GSM918582     1  0.0336     0.7882 0.992 0.000 0.008 0.000
#> GSM918649     1  0.0336     0.7882 0.992 0.000 0.008 0.000
#> GSM918651     1  0.0336     0.7882 0.992 0.000 0.008 0.000
#> GSM918607     1  0.0336     0.7882 0.992 0.000 0.008 0.000
#> GSM918609     1  0.0336     0.7882 0.992 0.000 0.008 0.000
#> GSM918608     1  0.0336     0.7882 0.992 0.000 0.008 0.000
#> GSM918606     1  0.0336     0.7882 0.992 0.000 0.008 0.000
#> GSM918620     1  0.0336     0.7882 0.992 0.000 0.008 0.000
#> GSM918628     1  0.4420     0.7816 0.748 0.000 0.012 0.240
#> GSM918586     3  0.0000     0.8434 0.000 0.000 1.000 0.000
#> GSM918594     3  0.0469     0.8412 0.000 0.000 0.988 0.012
#> GSM918600     3  0.0000     0.8434 0.000 0.000 1.000 0.000
#> GSM918601     3  0.0469     0.8412 0.000 0.000 0.988 0.012
#> GSM918612     3  0.0000     0.8434 0.000 0.000 1.000 0.000
#> GSM918614     3  0.0000     0.8434 0.000 0.000 1.000 0.000
#> GSM918629     3  0.0592     0.8325 0.000 0.000 0.984 0.016
#> GSM918587     3  0.7613    -0.4974 0.000 0.212 0.448 0.340
#> GSM918588     3  0.0000     0.8434 0.000 0.000 1.000 0.000
#> GSM918589     3  0.0000     0.8434 0.000 0.000 1.000 0.000
#> GSM918611     3  0.0188     0.8421 0.000 0.000 0.996 0.004
#> GSM918624     3  0.0469     0.8412 0.000 0.000 0.988 0.012
#> GSM918637     3  0.0817     0.8343 0.000 0.000 0.976 0.024
#> GSM918639     3  0.0469     0.8412 0.000 0.000 0.988 0.012
#> GSM918640     3  0.0469     0.8412 0.000 0.000 0.988 0.012
#> GSM918636     3  0.0000     0.8434 0.000 0.000 1.000 0.000
#> GSM918590     2  0.4790     0.1223 0.000 0.620 0.000 0.380
#> GSM918610     2  0.0000     0.6958 0.000 1.000 0.000 0.000
#> GSM918615     2  0.2589     0.6615 0.000 0.884 0.000 0.116
#> GSM918616     3  0.6904    -0.0658 0.000 0.132 0.556 0.312
#> GSM918632     2  0.3400     0.6864 0.000 0.820 0.000 0.180
#> GSM918647     2  0.3486     0.6869 0.000 0.812 0.000 0.188
#> GSM918578     2  0.0188     0.6938 0.000 0.996 0.000 0.004
#> GSM918579     2  0.4193     0.6847 0.000 0.732 0.000 0.268
#> GSM918581     2  0.2149     0.7021 0.000 0.912 0.000 0.088
#> GSM918584     2  0.2281     0.6829 0.000 0.904 0.000 0.096
#> GSM918591     2  0.0000     0.6958 0.000 1.000 0.000 0.000
#> GSM918592     2  0.0000     0.6958 0.000 1.000 0.000 0.000
#> GSM918597     4  0.7922     0.7577 0.000 0.320 0.336 0.344
#> GSM918598     2  0.0188     0.6938 0.000 0.996 0.000 0.004
#> GSM918599     4  0.7166     0.5408 0.000 0.280 0.176 0.544
#> GSM918604     3  0.0336     0.8404 0.000 0.000 0.992 0.008
#> GSM918605     2  0.4790     0.1223 0.000 0.620 0.000 0.380
#> GSM918613     2  0.3764     0.5307 0.000 0.784 0.000 0.216
#> GSM918623     2  0.3400     0.6864 0.000 0.820 0.000 0.180
#> GSM918626     4  0.7862     0.7920 0.000 0.296 0.308 0.396
#> GSM918627     4  0.7911     0.7909 0.000 0.348 0.304 0.348
#> GSM918633     2  0.1637     0.6899 0.000 0.940 0.000 0.060
#> GSM918634     4  0.7888     0.7915 0.000 0.344 0.288 0.368
#> GSM918635     2  0.3311     0.6859 0.000 0.828 0.000 0.172
#> GSM918645     2  0.4356     0.3819 0.000 0.708 0.000 0.292
#> GSM918646     2  0.4972     0.4387 0.000 0.544 0.000 0.456
#> GSM918648     2  0.3400     0.6864 0.000 0.820 0.000 0.180
#> GSM918650     2  0.1302     0.6946 0.000 0.956 0.000 0.044
#> GSM918652     2  0.4925     0.1417 0.000 0.572 0.000 0.428
#> GSM918653     2  0.4193     0.6847 0.000 0.732 0.000 0.268
#> GSM918622     2  0.7914    -0.8267 0.000 0.352 0.308 0.340
#> GSM918583     2  0.4134     0.6884 0.000 0.740 0.000 0.260
#> GSM918585     2  0.3907     0.6885 0.000 0.768 0.000 0.232
#> GSM918595     2  0.2281     0.6136 0.000 0.904 0.000 0.096
#> GSM918596     3  0.6881    -0.1504 0.000 0.120 0.540 0.340
#> GSM918602     3  0.7841    -0.6560 0.000 0.272 0.396 0.332
#> GSM918617     4  0.7211     0.5812 0.000 0.264 0.192 0.544
#> GSM918630     2  0.4955     0.4728 0.000 0.556 0.000 0.444
#> GSM918631     2  0.4193     0.6847 0.000 0.732 0.000 0.268
#> GSM918618     1  0.7520     0.6255 0.492 0.000 0.228 0.280
#> GSM918644     1  0.7511     0.4792 0.468 0.000 0.336 0.196

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>           class entropy silhouette    p1    p2    p3    p4    p5
#> GSM918603     4  0.4639    0.86454 0.368 0.000 0.020 0.612 0.000
#> GSM918641     4  0.4789    0.86259 0.368 0.000 0.020 0.608 0.004
#> GSM918580     4  0.4789    0.86259 0.368 0.000 0.020 0.608 0.004
#> GSM918593     4  0.4639    0.86454 0.368 0.000 0.020 0.612 0.000
#> GSM918625     4  0.4639    0.86454 0.368 0.000 0.020 0.612 0.000
#> GSM918638     4  0.4639    0.86454 0.368 0.000 0.020 0.612 0.000
#> GSM918642     4  0.4639    0.86454 0.368 0.000 0.020 0.612 0.000
#> GSM918643     4  0.4639    0.86454 0.368 0.000 0.020 0.612 0.000
#> GSM918619     1  0.0451    0.93154 0.988 0.000 0.004 0.000 0.008
#> GSM918621     1  0.0324    0.93300 0.992 0.000 0.004 0.000 0.004
#> GSM918582     1  0.0162    0.93331 0.996 0.000 0.004 0.000 0.000
#> GSM918649     1  0.0162    0.93331 0.996 0.000 0.004 0.000 0.000
#> GSM918651     1  0.0324    0.93300 0.992 0.000 0.004 0.000 0.004
#> GSM918607     1  0.0162    0.93331 0.996 0.000 0.004 0.000 0.000
#> GSM918609     1  0.0451    0.93154 0.988 0.000 0.004 0.000 0.008
#> GSM918608     1  0.0162    0.93331 0.996 0.000 0.004 0.000 0.000
#> GSM918606     1  0.0451    0.93154 0.988 0.000 0.004 0.000 0.008
#> GSM918620     1  0.0162    0.93331 0.996 0.000 0.004 0.000 0.000
#> GSM918628     1  0.5964   -0.27821 0.588 0.000 0.016 0.304 0.092
#> GSM918586     3  0.0324    0.94707 0.000 0.000 0.992 0.004 0.004
#> GSM918594     3  0.1894    0.93367 0.000 0.000 0.920 0.072 0.008
#> GSM918600     3  0.0162    0.94774 0.000 0.000 0.996 0.000 0.004
#> GSM918601     3  0.2408    0.92483 0.000 0.000 0.892 0.092 0.016
#> GSM918612     3  0.0162    0.94774 0.000 0.000 0.996 0.000 0.004
#> GSM918614     3  0.0000    0.94773 0.000 0.000 1.000 0.000 0.000
#> GSM918629     3  0.0992    0.93862 0.000 0.000 0.968 0.008 0.024
#> GSM918587     5  0.2840    0.74644 0.004 0.004 0.108 0.012 0.872
#> GSM918588     3  0.0000    0.94773 0.000 0.000 1.000 0.000 0.000
#> GSM918589     3  0.0451    0.94620 0.000 0.000 0.988 0.008 0.004
#> GSM918611     3  0.1809    0.91489 0.000 0.000 0.928 0.012 0.060
#> GSM918624     3  0.2408    0.92483 0.000 0.000 0.892 0.092 0.016
#> GSM918637     3  0.2850    0.91739 0.000 0.000 0.872 0.092 0.036
#> GSM918639     3  0.2408    0.92483 0.000 0.000 0.892 0.092 0.016
#> GSM918640     3  0.2408    0.92483 0.000 0.000 0.892 0.092 0.016
#> GSM918636     3  0.0451    0.94620 0.000 0.000 0.988 0.008 0.004
#> GSM918590     5  0.2624    0.75595 0.000 0.116 0.000 0.012 0.872
#> GSM918610     2  0.3231    0.61600 0.000 0.800 0.000 0.004 0.196
#> GSM918615     2  0.5522    0.52831 0.000 0.600 0.000 0.092 0.308
#> GSM918616     5  0.3462    0.70875 0.000 0.000 0.196 0.012 0.792
#> GSM918632     2  0.2773    0.65676 0.000 0.836 0.000 0.164 0.000
#> GSM918647     2  0.3282    0.65747 0.000 0.804 0.000 0.188 0.008
#> GSM918578     2  0.3231    0.61600 0.000 0.800 0.000 0.004 0.196
#> GSM918579     2  0.4972    0.63536 0.000 0.672 0.000 0.260 0.068
#> GSM918581     2  0.1952    0.65234 0.000 0.912 0.000 0.004 0.084
#> GSM918584     2  0.5312    0.58598 0.000 0.648 0.000 0.096 0.256
#> GSM918591     2  0.3231    0.61600 0.000 0.800 0.000 0.004 0.196
#> GSM918592     2  0.3231    0.61600 0.000 0.800 0.000 0.004 0.196
#> GSM918597     5  0.3337    0.80098 0.000 0.064 0.072 0.008 0.856
#> GSM918598     2  0.3266    0.61324 0.000 0.796 0.000 0.004 0.200
#> GSM918599     5  0.5776    0.58745 0.000 0.280 0.036 0.056 0.628
#> GSM918604     3  0.1877    0.91164 0.000 0.000 0.924 0.012 0.064
#> GSM918605     5  0.2624    0.75593 0.000 0.116 0.000 0.012 0.872
#> GSM918613     2  0.5880    0.28835 0.000 0.484 0.000 0.100 0.416
#> GSM918623     2  0.2773    0.65676 0.000 0.836 0.000 0.164 0.000
#> GSM918626     5  0.3576    0.77245 0.004 0.072 0.056 0.016 0.852
#> GSM918627     5  0.3266    0.80056 0.000 0.076 0.056 0.008 0.860
#> GSM918633     2  0.5117    0.59975 0.000 0.672 0.000 0.088 0.240
#> GSM918634     5  0.3308    0.79761 0.000 0.076 0.052 0.012 0.860
#> GSM918635     2  0.2813    0.65578 0.000 0.832 0.000 0.168 0.000
#> GSM918645     5  0.5908    0.00472 0.000 0.380 0.000 0.108 0.512
#> GSM918646     2  0.6498    0.19073 0.000 0.460 0.000 0.200 0.340
#> GSM918648     2  0.2773    0.65676 0.000 0.836 0.000 0.164 0.000
#> GSM918650     2  0.4958    0.60763 0.000 0.692 0.000 0.084 0.224
#> GSM918652     5  0.4421    0.68741 0.000 0.184 0.000 0.068 0.748
#> GSM918653     2  0.4972    0.63536 0.000 0.672 0.000 0.260 0.068
#> GSM918622     5  0.3266    0.80056 0.000 0.076 0.056 0.008 0.860
#> GSM918583     2  0.4847    0.64161 0.000 0.692 0.000 0.240 0.068
#> GSM918585     2  0.4665    0.64377 0.000 0.692 0.000 0.260 0.048
#> GSM918595     2  0.4327    0.35553 0.000 0.632 0.000 0.008 0.360
#> GSM918596     5  0.3430    0.70165 0.000 0.000 0.220 0.004 0.776
#> GSM918602     5  0.3392    0.79590 0.000 0.064 0.084 0.004 0.848
#> GSM918617     5  0.5836    0.58933 0.000 0.280 0.036 0.060 0.624
#> GSM918630     2  0.6568    0.34672 0.000 0.472 0.000 0.276 0.252
#> GSM918631     2  0.5018    0.63077 0.000 0.664 0.000 0.268 0.068
#> GSM918618     4  0.8076    0.50802 0.276 0.000 0.264 0.364 0.096
#> GSM918644     4  0.8074    0.45534 0.244 0.000 0.308 0.352 0.096

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>           class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM918603     4  0.0458      0.820 0.000 0.000 0.016 0.984 0.000 0.000
#> GSM918641     4  0.0820      0.816 0.000 0.012 0.016 0.972 0.000 0.000
#> GSM918580     4  0.0820      0.816 0.000 0.012 0.016 0.972 0.000 0.000
#> GSM918593     4  0.0458      0.820 0.000 0.000 0.016 0.984 0.000 0.000
#> GSM918625     4  0.0458      0.820 0.000 0.000 0.016 0.984 0.000 0.000
#> GSM918638     4  0.0458      0.820 0.000 0.000 0.016 0.984 0.000 0.000
#> GSM918642     4  0.0458      0.820 0.000 0.000 0.016 0.984 0.000 0.000
#> GSM918643     4  0.0458      0.820 0.000 0.000 0.016 0.984 0.000 0.000
#> GSM918619     1  0.3668      0.980 0.744 0.028 0.000 0.228 0.000 0.000
#> GSM918621     1  0.3807      0.980 0.740 0.028 0.000 0.228 0.004 0.000
#> GSM918582     1  0.3136      0.986 0.768 0.004 0.000 0.228 0.000 0.000
#> GSM918649     1  0.2996      0.986 0.772 0.000 0.000 0.228 0.000 0.000
#> GSM918651     1  0.2996      0.986 0.772 0.000 0.000 0.228 0.000 0.000
#> GSM918607     1  0.3276      0.985 0.764 0.004 0.000 0.228 0.004 0.000
#> GSM918609     1  0.3668      0.980 0.744 0.028 0.000 0.228 0.000 0.000
#> GSM918608     1  0.3276      0.985 0.764 0.004 0.000 0.228 0.004 0.000
#> GSM918606     1  0.3593      0.981 0.748 0.024 0.000 0.228 0.000 0.000
#> GSM918620     1  0.2996      0.986 0.772 0.000 0.000 0.228 0.000 0.000
#> GSM918628     4  0.7370      0.118 0.268 0.176 0.016 0.448 0.088 0.004
#> GSM918586     3  0.0717      0.903 0.008 0.000 0.976 0.000 0.016 0.000
#> GSM918594     3  0.3130      0.882 0.080 0.044 0.856 0.000 0.016 0.004
#> GSM918600     3  0.0146      0.906 0.000 0.000 0.996 0.000 0.004 0.000
#> GSM918601     3  0.3517      0.874 0.084 0.060 0.832 0.000 0.020 0.004
#> GSM918612     3  0.0146      0.906 0.000 0.000 0.996 0.000 0.004 0.000
#> GSM918614     3  0.0000      0.906 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM918629     3  0.1410      0.895 0.004 0.008 0.944 0.000 0.044 0.000
#> GSM918587     5  0.1959      0.834 0.024 0.020 0.032 0.000 0.924 0.000
#> GSM918588     3  0.0000      0.906 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM918589     3  0.1262      0.896 0.016 0.008 0.956 0.000 0.020 0.000
#> GSM918611     3  0.2636      0.835 0.016 0.004 0.860 0.000 0.120 0.000
#> GSM918624     3  0.3517      0.874 0.084 0.060 0.832 0.000 0.020 0.004
#> GSM918637     3  0.3821      0.869 0.084 0.060 0.816 0.000 0.036 0.004
#> GSM918639     3  0.3517      0.874 0.084 0.060 0.832 0.000 0.020 0.004
#> GSM918640     3  0.3517      0.874 0.084 0.060 0.832 0.000 0.020 0.004
#> GSM918636     3  0.1262      0.896 0.016 0.008 0.956 0.000 0.020 0.000
#> GSM918590     5  0.3527      0.864 0.052 0.008 0.000 0.000 0.808 0.132
#> GSM918610     6  0.3460      0.657 0.028 0.168 0.000 0.000 0.008 0.796
#> GSM918615     6  0.1668      0.613 0.004 0.008 0.000 0.000 0.060 0.928
#> GSM918616     5  0.3393      0.884 0.012 0.016 0.044 0.000 0.844 0.084
#> GSM918632     2  0.3528      0.685 0.000 0.700 0.000 0.004 0.000 0.296
#> GSM918647     2  0.3668      0.698 0.004 0.668 0.000 0.000 0.000 0.328
#> GSM918578     6  0.4176      0.655 0.052 0.176 0.000 0.008 0.008 0.756
#> GSM918579     2  0.4802      0.691 0.004 0.544 0.000 0.004 0.036 0.412
#> GSM918581     6  0.4322      0.591 0.052 0.216 0.000 0.012 0.000 0.720
#> GSM918584     6  0.1913      0.598 0.016 0.016 0.000 0.000 0.044 0.924
#> GSM918591     6  0.4143      0.655 0.052 0.172 0.000 0.008 0.008 0.760
#> GSM918592     6  0.4143      0.655 0.052 0.172 0.000 0.008 0.008 0.760
#> GSM918597     5  0.3137      0.890 0.020 0.008 0.036 0.000 0.860 0.076
#> GSM918598     6  0.4176      0.655 0.052 0.176 0.000 0.008 0.008 0.756
#> GSM918599     5  0.4056      0.795 0.040 0.144 0.008 0.000 0.784 0.024
#> GSM918604     3  0.2933      0.823 0.016 0.012 0.844 0.000 0.128 0.000
#> GSM918605     5  0.3544      0.856 0.048 0.008 0.000 0.000 0.804 0.140
#> GSM918613     6  0.3268      0.512 0.008 0.020 0.000 0.000 0.164 0.808
#> GSM918623     2  0.3508      0.681 0.000 0.704 0.000 0.004 0.000 0.292
#> GSM918626     5  0.1714      0.845 0.016 0.024 0.024 0.000 0.936 0.000
#> GSM918627     5  0.2830      0.892 0.012 0.004 0.024 0.000 0.868 0.092
#> GSM918633     6  0.1461      0.616 0.000 0.016 0.000 0.000 0.044 0.940
#> GSM918634     5  0.3641      0.885 0.048 0.008 0.020 0.000 0.824 0.100
#> GSM918635     2  0.3547      0.670 0.000 0.696 0.000 0.004 0.000 0.300
#> GSM918645     6  0.4595      0.352 0.040 0.020 0.000 0.000 0.264 0.676
#> GSM918646     2  0.6468      0.254 0.036 0.408 0.000 0.000 0.380 0.176
#> GSM918648     2  0.3528      0.685 0.000 0.700 0.000 0.004 0.000 0.296
#> GSM918650     6  0.1265      0.618 0.000 0.008 0.000 0.000 0.044 0.948
#> GSM918652     5  0.4626      0.807 0.048 0.076 0.000 0.000 0.744 0.132
#> GSM918653     2  0.4802      0.691 0.004 0.544 0.000 0.004 0.036 0.412
#> GSM918622     5  0.2830      0.892 0.012 0.004 0.024 0.000 0.868 0.092
#> GSM918583     6  0.5208     -0.560 0.032 0.404 0.000 0.000 0.036 0.528
#> GSM918585     2  0.4488      0.696 0.004 0.544 0.000 0.004 0.016 0.432
#> GSM918595     6  0.5869      0.572 0.072 0.168 0.000 0.008 0.108 0.644
#> GSM918596     5  0.2781      0.865 0.008 0.004 0.084 0.000 0.872 0.032
#> GSM918602     5  0.2763      0.891 0.000 0.008 0.036 0.000 0.868 0.088
#> GSM918617     5  0.3877      0.804 0.032 0.132 0.008 0.000 0.800 0.028
#> GSM918630     2  0.6332      0.505 0.040 0.476 0.000 0.000 0.152 0.332
#> GSM918631     2  0.4781      0.688 0.004 0.556 0.000 0.004 0.036 0.400
#> GSM918618     4  0.7252      0.468 0.012 0.164 0.244 0.476 0.100 0.004
#> GSM918644     4  0.7598      0.356 0.016 0.164 0.316 0.388 0.112 0.004

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

consensus_heatmap(res, k = 2)

plot of chunk tab-MAD-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) gender(p) other(p) k
#> MAD:kmeans 76         1.08e-12   0.29229 1.07e-02 2
#> MAD:kmeans 68         5.32e-21   0.00234 2.71e-04 3
#> MAD:kmeans 64         7.98e-19   0.00516 1.55e-03 4
#> MAD:kmeans 69         7.51e-33   0.00548 4.55e-06 5
#> MAD:kmeans 70         4.91e-34   0.00445 8.52e-06 6

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


MAD: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 76 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 1.000           0.977       0.991         0.5065 0.495   0.495
#> 3 3 0.945           0.957       0.981         0.3183 0.732   0.510
#> 4 4 0.754           0.816       0.857         0.1158 0.890   0.683
#> 5 5 0.804           0.835       0.880         0.0626 0.948   0.799
#> 6 6 0.829           0.709       0.833         0.0521 0.938   0.718

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
#> GSM918603     1   0.000      1.000 1.000 0.000
#> GSM918641     1   0.000      1.000 1.000 0.000
#> GSM918580     1   0.000      1.000 1.000 0.000
#> GSM918593     1   0.000      1.000 1.000 0.000
#> GSM918625     1   0.000      1.000 1.000 0.000
#> GSM918638     1   0.000      1.000 1.000 0.000
#> GSM918642     1   0.000      1.000 1.000 0.000
#> GSM918643     1   0.000      1.000 1.000 0.000
#> GSM918619     1   0.000      1.000 1.000 0.000
#> GSM918621     1   0.000      1.000 1.000 0.000
#> GSM918582     1   0.000      1.000 1.000 0.000
#> GSM918649     1   0.000      1.000 1.000 0.000
#> GSM918651     1   0.000      1.000 1.000 0.000
#> GSM918607     1   0.000      1.000 1.000 0.000
#> GSM918609     1   0.000      1.000 1.000 0.000
#> GSM918608     1   0.000      1.000 1.000 0.000
#> GSM918606     1   0.000      1.000 1.000 0.000
#> GSM918620     1   0.000      1.000 1.000 0.000
#> GSM918628     1   0.000      1.000 1.000 0.000
#> GSM918586     1   0.000      1.000 1.000 0.000
#> GSM918594     1   0.000      1.000 1.000 0.000
#> GSM918600     1   0.000      1.000 1.000 0.000
#> GSM918601     1   0.000      1.000 1.000 0.000
#> GSM918612     1   0.000      1.000 1.000 0.000
#> GSM918614     1   0.000      1.000 1.000 0.000
#> GSM918629     2   0.952      0.415 0.372 0.628
#> GSM918587     2   0.904      0.535 0.320 0.680
#> GSM918588     1   0.000      1.000 1.000 0.000
#> GSM918589     1   0.000      1.000 1.000 0.000
#> GSM918611     1   0.000      1.000 1.000 0.000
#> GSM918624     1   0.000      1.000 1.000 0.000
#> GSM918637     1   0.000      1.000 1.000 0.000
#> GSM918639     1   0.000      1.000 1.000 0.000
#> GSM918640     1   0.000      1.000 1.000 0.000
#> GSM918636     1   0.000      1.000 1.000 0.000
#> GSM918590     2   0.000      0.982 0.000 1.000
#> GSM918610     2   0.000      0.982 0.000 1.000
#> GSM918615     2   0.000      0.982 0.000 1.000
#> GSM918616     2   0.000      0.982 0.000 1.000
#> GSM918632     2   0.000      0.982 0.000 1.000
#> GSM918647     2   0.000      0.982 0.000 1.000
#> GSM918578     2   0.000      0.982 0.000 1.000
#> GSM918579     2   0.000      0.982 0.000 1.000
#> GSM918581     2   0.000      0.982 0.000 1.000
#> GSM918584     2   0.000      0.982 0.000 1.000
#> GSM918591     2   0.000      0.982 0.000 1.000
#> GSM918592     2   0.000      0.982 0.000 1.000
#> GSM918597     2   0.000      0.982 0.000 1.000
#> GSM918598     2   0.000      0.982 0.000 1.000
#> GSM918599     2   0.000      0.982 0.000 1.000
#> GSM918604     1   0.000      1.000 1.000 0.000
#> GSM918605     2   0.000      0.982 0.000 1.000
#> GSM918613     2   0.000      0.982 0.000 1.000
#> GSM918623     2   0.000      0.982 0.000 1.000
#> GSM918626     2   0.000      0.982 0.000 1.000
#> GSM918627     2   0.000      0.982 0.000 1.000
#> GSM918633     2   0.000      0.982 0.000 1.000
#> GSM918634     2   0.000      0.982 0.000 1.000
#> GSM918635     2   0.000      0.982 0.000 1.000
#> GSM918645     2   0.000      0.982 0.000 1.000
#> GSM918646     2   0.000      0.982 0.000 1.000
#> GSM918648     2   0.000      0.982 0.000 1.000
#> GSM918650     2   0.000      0.982 0.000 1.000
#> GSM918652     2   0.000      0.982 0.000 1.000
#> GSM918653     2   0.000      0.982 0.000 1.000
#> GSM918622     2   0.000      0.982 0.000 1.000
#> GSM918583     2   0.000      0.982 0.000 1.000
#> GSM918585     2   0.000      0.982 0.000 1.000
#> GSM918595     2   0.000      0.982 0.000 1.000
#> GSM918596     2   0.000      0.982 0.000 1.000
#> GSM918602     2   0.000      0.982 0.000 1.000
#> GSM918617     2   0.000      0.982 0.000 1.000
#> GSM918630     2   0.000      0.982 0.000 1.000
#> GSM918631     2   0.000      0.982 0.000 1.000
#> GSM918618     1   0.000      1.000 1.000 0.000
#> GSM918644     1   0.000      1.000 1.000 0.000

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>           class entropy silhouette p1    p2    p3
#> GSM918603     1   0.000      1.000  1 0.000 0.000
#> GSM918641     1   0.000      1.000  1 0.000 0.000
#> GSM918580     1   0.000      1.000  1 0.000 0.000
#> GSM918593     1   0.000      1.000  1 0.000 0.000
#> GSM918625     1   0.000      1.000  1 0.000 0.000
#> GSM918638     1   0.000      1.000  1 0.000 0.000
#> GSM918642     1   0.000      1.000  1 0.000 0.000
#> GSM918643     1   0.000      1.000  1 0.000 0.000
#> GSM918619     1   0.000      1.000  1 0.000 0.000
#> GSM918621     1   0.000      1.000  1 0.000 0.000
#> GSM918582     1   0.000      1.000  1 0.000 0.000
#> GSM918649     1   0.000      1.000  1 0.000 0.000
#> GSM918651     1   0.000      1.000  1 0.000 0.000
#> GSM918607     1   0.000      1.000  1 0.000 0.000
#> GSM918609     1   0.000      1.000  1 0.000 0.000
#> GSM918608     1   0.000      1.000  1 0.000 0.000
#> GSM918606     1   0.000      1.000  1 0.000 0.000
#> GSM918620     1   0.000      1.000  1 0.000 0.000
#> GSM918628     1   0.000      1.000  1 0.000 0.000
#> GSM918586     3   0.000      0.970  0 0.000 1.000
#> GSM918594     3   0.000      0.970  0 0.000 1.000
#> GSM918600     3   0.000      0.970  0 0.000 1.000
#> GSM918601     3   0.000      0.970  0 0.000 1.000
#> GSM918612     3   0.000      0.970  0 0.000 1.000
#> GSM918614     3   0.000      0.970  0 0.000 1.000
#> GSM918629     3   0.000      0.970  0 0.000 1.000
#> GSM918587     3   0.000      0.970  0 0.000 1.000
#> GSM918588     3   0.000      0.970  0 0.000 1.000
#> GSM918589     3   0.000      0.970  0 0.000 1.000
#> GSM918611     3   0.000      0.970  0 0.000 1.000
#> GSM918624     3   0.000      0.970  0 0.000 1.000
#> GSM918637     3   0.000      0.970  0 0.000 1.000
#> GSM918639     3   0.000      0.970  0 0.000 1.000
#> GSM918640     3   0.000      0.970  0 0.000 1.000
#> GSM918636     3   0.000      0.970  0 0.000 1.000
#> GSM918590     2   0.000      0.973  0 1.000 0.000
#> GSM918610     2   0.000      0.973  0 1.000 0.000
#> GSM918615     2   0.000      0.973  0 1.000 0.000
#> GSM918616     3   0.000      0.970  0 0.000 1.000
#> GSM918632     2   0.000      0.973  0 1.000 0.000
#> GSM918647     2   0.000      0.973  0 1.000 0.000
#> GSM918578     2   0.000      0.973  0 1.000 0.000
#> GSM918579     2   0.000      0.973  0 1.000 0.000
#> GSM918581     2   0.000      0.973  0 1.000 0.000
#> GSM918584     2   0.000      0.973  0 1.000 0.000
#> GSM918591     2   0.000      0.973  0 1.000 0.000
#> GSM918592     2   0.000      0.973  0 1.000 0.000
#> GSM918597     3   0.141      0.947  0 0.036 0.964
#> GSM918598     2   0.000      0.973  0 1.000 0.000
#> GSM918599     2   0.601      0.393  0 0.628 0.372
#> GSM918604     3   0.000      0.970  0 0.000 1.000
#> GSM918605     2   0.000      0.973  0 1.000 0.000
#> GSM918613     2   0.000      0.973  0 1.000 0.000
#> GSM918623     2   0.000      0.973  0 1.000 0.000
#> GSM918626     3   0.355      0.863  0 0.132 0.868
#> GSM918627     3   0.375      0.850  0 0.144 0.856
#> GSM918633     2   0.000      0.973  0 1.000 0.000
#> GSM918634     3   0.429      0.793  0 0.180 0.820
#> GSM918635     2   0.000      0.973  0 1.000 0.000
#> GSM918645     2   0.000      0.973  0 1.000 0.000
#> GSM918646     2   0.000      0.973  0 1.000 0.000
#> GSM918648     2   0.000      0.973  0 1.000 0.000
#> GSM918650     2   0.000      0.973  0 1.000 0.000
#> GSM918652     2   0.000      0.973  0 1.000 0.000
#> GSM918653     2   0.000      0.973  0 1.000 0.000
#> GSM918622     3   0.375      0.850  0 0.144 0.856
#> GSM918583     2   0.000      0.973  0 1.000 0.000
#> GSM918585     2   0.000      0.973  0 1.000 0.000
#> GSM918595     2   0.000      0.973  0 1.000 0.000
#> GSM918596     3   0.000      0.970  0 0.000 1.000
#> GSM918602     3   0.153      0.944  0 0.040 0.960
#> GSM918617     2   0.597      0.413  0 0.636 0.364
#> GSM918630     2   0.000      0.973  0 1.000 0.000
#> GSM918631     2   0.000      0.973  0 1.000 0.000
#> GSM918618     1   0.000      1.000  1 0.000 0.000
#> GSM918644     1   0.000      1.000  1 0.000 0.000

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM918603     1   0.000      0.927 1.000 0.000 0.000 0.000
#> GSM918641     1   0.000      0.927 1.000 0.000 0.000 0.000
#> GSM918580     1   0.000      0.927 1.000 0.000 0.000 0.000
#> GSM918593     1   0.000      0.927 1.000 0.000 0.000 0.000
#> GSM918625     1   0.000      0.927 1.000 0.000 0.000 0.000
#> GSM918638     1   0.000      0.927 1.000 0.000 0.000 0.000
#> GSM918642     1   0.000      0.927 1.000 0.000 0.000 0.000
#> GSM918643     1   0.000      0.927 1.000 0.000 0.000 0.000
#> GSM918619     1   0.327      0.925 0.832 0.000 0.000 0.168
#> GSM918621     1   0.327      0.925 0.832 0.000 0.000 0.168
#> GSM918582     1   0.327      0.925 0.832 0.000 0.000 0.168
#> GSM918649     1   0.327      0.925 0.832 0.000 0.000 0.168
#> GSM918651     1   0.327      0.925 0.832 0.000 0.000 0.168
#> GSM918607     1   0.327      0.925 0.832 0.000 0.000 0.168
#> GSM918609     1   0.327      0.925 0.832 0.000 0.000 0.168
#> GSM918608     1   0.327      0.925 0.832 0.000 0.000 0.168
#> GSM918606     1   0.327      0.925 0.832 0.000 0.000 0.168
#> GSM918620     1   0.327      0.925 0.832 0.000 0.000 0.168
#> GSM918628     1   0.172      0.928 0.936 0.000 0.000 0.064
#> GSM918586     3   0.000      1.000 0.000 0.000 1.000 0.000
#> GSM918594     3   0.000      1.000 0.000 0.000 1.000 0.000
#> GSM918600     3   0.000      1.000 0.000 0.000 1.000 0.000
#> GSM918601     3   0.000      1.000 0.000 0.000 1.000 0.000
#> GSM918612     3   0.000      1.000 0.000 0.000 1.000 0.000
#> GSM918614     3   0.000      1.000 0.000 0.000 1.000 0.000
#> GSM918629     3   0.000      1.000 0.000 0.000 1.000 0.000
#> GSM918587     4   0.534      0.603 0.028 0.000 0.316 0.656
#> GSM918588     3   0.000      1.000 0.000 0.000 1.000 0.000
#> GSM918589     3   0.000      1.000 0.000 0.000 1.000 0.000
#> GSM918611     3   0.000      1.000 0.000 0.000 1.000 0.000
#> GSM918624     3   0.000      1.000 0.000 0.000 1.000 0.000
#> GSM918637     3   0.000      1.000 0.000 0.000 1.000 0.000
#> GSM918639     3   0.000      1.000 0.000 0.000 1.000 0.000
#> GSM918640     3   0.000      1.000 0.000 0.000 1.000 0.000
#> GSM918636     3   0.000      1.000 0.000 0.000 1.000 0.000
#> GSM918590     4   0.327      0.571 0.000 0.168 0.000 0.832
#> GSM918610     2   0.430      0.762 0.000 0.716 0.000 0.284
#> GSM918615     2   0.430      0.762 0.000 0.716 0.000 0.284
#> GSM918616     4   0.438      0.647 0.000 0.000 0.296 0.704
#> GSM918632     2   0.000      0.753 0.000 1.000 0.000 0.000
#> GSM918647     2   0.000      0.753 0.000 1.000 0.000 0.000
#> GSM918578     2   0.430      0.762 0.000 0.716 0.000 0.284
#> GSM918579     2   0.000      0.753 0.000 1.000 0.000 0.000
#> GSM918581     2   0.404      0.764 0.000 0.752 0.000 0.248
#> GSM918584     2   0.430      0.762 0.000 0.716 0.000 0.284
#> GSM918591     2   0.430      0.762 0.000 0.716 0.000 0.284
#> GSM918592     2   0.430      0.762 0.000 0.716 0.000 0.284
#> GSM918597     4   0.433      0.699 0.000 0.008 0.244 0.748
#> GSM918598     2   0.430      0.762 0.000 0.716 0.000 0.284
#> GSM918599     4   0.614      0.553 0.000 0.404 0.052 0.544
#> GSM918604     3   0.000      1.000 0.000 0.000 1.000 0.000
#> GSM918605     4   0.327      0.571 0.000 0.168 0.000 0.832
#> GSM918613     2   0.430      0.762 0.000 0.716 0.000 0.284
#> GSM918623     2   0.000      0.753 0.000 1.000 0.000 0.000
#> GSM918626     4   0.696      0.619 0.000 0.316 0.136 0.548
#> GSM918627     4   0.396      0.721 0.000 0.044 0.124 0.832
#> GSM918633     2   0.430      0.762 0.000 0.716 0.000 0.284
#> GSM918634     4   0.371      0.728 0.000 0.020 0.148 0.832
#> GSM918635     2   0.000      0.753 0.000 1.000 0.000 0.000
#> GSM918645     2   0.498      0.503 0.000 0.540 0.000 0.460
#> GSM918646     2   0.394      0.408 0.000 0.764 0.000 0.236
#> GSM918648     2   0.000      0.753 0.000 1.000 0.000 0.000
#> GSM918650     2   0.430      0.762 0.000 0.716 0.000 0.284
#> GSM918652     4   0.497      0.467 0.000 0.456 0.000 0.544
#> GSM918653     2   0.000      0.753 0.000 1.000 0.000 0.000
#> GSM918622     4   0.396      0.721 0.000 0.044 0.124 0.832
#> GSM918583     2   0.000      0.753 0.000 1.000 0.000 0.000
#> GSM918585     2   0.000      0.753 0.000 1.000 0.000 0.000
#> GSM918595     2   0.462      0.700 0.000 0.660 0.000 0.340
#> GSM918596     4   0.497      0.354 0.000 0.000 0.452 0.548
#> GSM918602     4   0.386      0.726 0.000 0.024 0.152 0.824
#> GSM918617     4   0.608      0.548 0.000 0.408 0.048 0.544
#> GSM918630     2   0.336      0.537 0.000 0.824 0.000 0.176
#> GSM918631     2   0.000      0.753 0.000 1.000 0.000 0.000
#> GSM918618     1   0.000      0.927 1.000 0.000 0.000 0.000
#> GSM918644     1   0.000      0.927 1.000 0.000 0.000 0.000

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>           class entropy silhouette    p1    p2    p3    p4    p5
#> GSM918603     4  0.0000      0.964 0.000 0.000 0.000 1.000 0.000
#> GSM918641     4  0.0000      0.964 0.000 0.000 0.000 1.000 0.000
#> GSM918580     4  0.0000      0.964 0.000 0.000 0.000 1.000 0.000
#> GSM918593     4  0.0000      0.964 0.000 0.000 0.000 1.000 0.000
#> GSM918625     4  0.0000      0.964 0.000 0.000 0.000 1.000 0.000
#> GSM918638     4  0.0000      0.964 0.000 0.000 0.000 1.000 0.000
#> GSM918642     4  0.0000      0.964 0.000 0.000 0.000 1.000 0.000
#> GSM918643     4  0.0000      0.964 0.000 0.000 0.000 1.000 0.000
#> GSM918619     1  0.2020      1.000 0.900 0.000 0.000 0.100 0.000
#> GSM918621     1  0.2020      1.000 0.900 0.000 0.000 0.100 0.000
#> GSM918582     1  0.2020      1.000 0.900 0.000 0.000 0.100 0.000
#> GSM918649     1  0.2020      1.000 0.900 0.000 0.000 0.100 0.000
#> GSM918651     1  0.2020      1.000 0.900 0.000 0.000 0.100 0.000
#> GSM918607     1  0.2020      1.000 0.900 0.000 0.000 0.100 0.000
#> GSM918609     1  0.2020      1.000 0.900 0.000 0.000 0.100 0.000
#> GSM918608     1  0.2020      1.000 0.900 0.000 0.000 0.100 0.000
#> GSM918606     1  0.2020      1.000 0.900 0.000 0.000 0.100 0.000
#> GSM918620     1  0.2020      1.000 0.900 0.000 0.000 0.100 0.000
#> GSM918628     4  0.4009      0.467 0.312 0.000 0.000 0.684 0.004
#> GSM918586     3  0.0000      0.997 0.000 0.000 1.000 0.000 0.000
#> GSM918594     3  0.0000      0.997 0.000 0.000 1.000 0.000 0.000
#> GSM918600     3  0.0000      0.997 0.000 0.000 1.000 0.000 0.000
#> GSM918601     3  0.0162      0.996 0.000 0.000 0.996 0.000 0.004
#> GSM918612     3  0.0000      0.997 0.000 0.000 1.000 0.000 0.000
#> GSM918614     3  0.0000      0.997 0.000 0.000 1.000 0.000 0.000
#> GSM918629     3  0.0000      0.997 0.000 0.000 1.000 0.000 0.000
#> GSM918587     5  0.6073      0.638 0.012 0.032 0.128 0.152 0.676
#> GSM918588     3  0.0000      0.997 0.000 0.000 1.000 0.000 0.000
#> GSM918589     3  0.0000      0.997 0.000 0.000 1.000 0.000 0.000
#> GSM918611     3  0.0290      0.992 0.000 0.000 0.992 0.000 0.008
#> GSM918624     3  0.0162      0.996 0.000 0.000 0.996 0.000 0.004
#> GSM918637     3  0.0290      0.993 0.000 0.000 0.992 0.000 0.008
#> GSM918639     3  0.0162      0.996 0.000 0.000 0.996 0.000 0.004
#> GSM918640     3  0.0162      0.996 0.000 0.000 0.996 0.000 0.004
#> GSM918636     3  0.0000      0.997 0.000 0.000 1.000 0.000 0.000
#> GSM918590     5  0.3550      0.762 0.004 0.236 0.000 0.000 0.760
#> GSM918610     2  0.0000      0.781 0.000 1.000 0.000 0.000 0.000
#> GSM918615     2  0.1626      0.769 0.016 0.940 0.000 0.000 0.044
#> GSM918616     5  0.5240      0.694 0.000 0.120 0.204 0.000 0.676
#> GSM918632     2  0.4707      0.760 0.072 0.716 0.000 0.000 0.212
#> GSM918647     2  0.4707      0.760 0.072 0.716 0.000 0.000 0.212
#> GSM918578     2  0.0000      0.781 0.000 1.000 0.000 0.000 0.000
#> GSM918579     2  0.5117      0.751 0.088 0.672 0.000 0.000 0.240
#> GSM918581     2  0.0510      0.786 0.000 0.984 0.000 0.000 0.016
#> GSM918584     2  0.1725      0.773 0.020 0.936 0.000 0.000 0.044
#> GSM918591     2  0.0000      0.781 0.000 1.000 0.000 0.000 0.000
#> GSM918592     2  0.0000      0.781 0.000 1.000 0.000 0.000 0.000
#> GSM918597     5  0.4643      0.771 0.012 0.160 0.072 0.000 0.756
#> GSM918598     2  0.0000      0.781 0.000 1.000 0.000 0.000 0.000
#> GSM918599     5  0.1725      0.686 0.044 0.020 0.000 0.000 0.936
#> GSM918604     3  0.0162      0.995 0.000 0.000 0.996 0.000 0.004
#> GSM918605     5  0.3430      0.768 0.004 0.220 0.000 0.000 0.776
#> GSM918613     2  0.1893      0.767 0.024 0.928 0.000 0.000 0.048
#> GSM918623     2  0.4649      0.761 0.068 0.720 0.000 0.000 0.212
#> GSM918626     5  0.0671      0.715 0.016 0.000 0.004 0.000 0.980
#> GSM918627     5  0.3643      0.771 0.008 0.212 0.004 0.000 0.776
#> GSM918633     2  0.0609      0.781 0.020 0.980 0.000 0.000 0.000
#> GSM918634     5  0.3366      0.772 0.004 0.212 0.000 0.000 0.784
#> GSM918635     2  0.4528      0.763 0.060 0.728 0.000 0.000 0.212
#> GSM918645     2  0.4229      0.408 0.020 0.704 0.000 0.000 0.276
#> GSM918646     5  0.5747     -0.373 0.088 0.408 0.000 0.000 0.504
#> GSM918648     2  0.4707      0.760 0.072 0.716 0.000 0.000 0.212
#> GSM918650     2  0.0693      0.781 0.012 0.980 0.000 0.000 0.008
#> GSM918652     5  0.1753      0.700 0.032 0.032 0.000 0.000 0.936
#> GSM918653     2  0.5117      0.751 0.088 0.672 0.000 0.000 0.240
#> GSM918622     5  0.3643      0.771 0.008 0.212 0.004 0.000 0.776
#> GSM918583     2  0.4930      0.756 0.072 0.684 0.000 0.000 0.244
#> GSM918585     2  0.5117      0.751 0.088 0.672 0.000 0.000 0.240
#> GSM918595     2  0.2179      0.679 0.004 0.896 0.000 0.000 0.100
#> GSM918596     5  0.3756      0.631 0.008 0.000 0.248 0.000 0.744
#> GSM918602     5  0.4907      0.738 0.004 0.264 0.052 0.000 0.680
#> GSM918617     5  0.2193      0.663 0.060 0.028 0.000 0.000 0.912
#> GSM918630     2  0.5773      0.482 0.088 0.476 0.000 0.000 0.436
#> GSM918631     2  0.5167      0.747 0.088 0.664 0.000 0.000 0.248
#> GSM918618     4  0.0162      0.961 0.000 0.000 0.000 0.996 0.004
#> GSM918644     4  0.0162      0.961 0.000 0.000 0.000 0.996 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
#> GSM918603     4  0.0000     0.9455 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM918641     4  0.0000     0.9455 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM918580     4  0.0000     0.9455 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM918593     4  0.0000     0.9455 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM918625     4  0.0000     0.9455 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM918638     4  0.0000     0.9455 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM918642     4  0.0000     0.9455 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM918643     4  0.0000     0.9455 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM918619     1  0.0146     1.0000 0.996 0.000 0.000 0.004 0.000 0.000
#> GSM918621     1  0.0146     1.0000 0.996 0.000 0.000 0.004 0.000 0.000
#> GSM918582     1  0.0146     1.0000 0.996 0.000 0.000 0.004 0.000 0.000
#> GSM918649     1  0.0146     1.0000 0.996 0.000 0.000 0.004 0.000 0.000
#> GSM918651     1  0.0146     1.0000 0.996 0.000 0.000 0.004 0.000 0.000
#> GSM918607     1  0.0146     1.0000 0.996 0.000 0.000 0.004 0.000 0.000
#> GSM918609     1  0.0146     1.0000 0.996 0.000 0.000 0.004 0.000 0.000
#> GSM918608     1  0.0146     1.0000 0.996 0.000 0.000 0.004 0.000 0.000
#> GSM918606     1  0.0146     1.0000 0.996 0.000 0.000 0.004 0.000 0.000
#> GSM918620     1  0.0146     1.0000 0.996 0.000 0.000 0.004 0.000 0.000
#> GSM918628     4  0.4635     0.1542 0.444 0.000 0.000 0.524 0.020 0.012
#> GSM918586     3  0.0717     0.9550 0.000 0.000 0.976 0.000 0.008 0.016
#> GSM918594     3  0.1168     0.9540 0.000 0.000 0.956 0.000 0.028 0.016
#> GSM918600     3  0.0363     0.9573 0.000 0.000 0.988 0.000 0.000 0.012
#> GSM918601     3  0.1572     0.9493 0.000 0.000 0.936 0.000 0.028 0.036
#> GSM918612     3  0.0405     0.9588 0.000 0.000 0.988 0.000 0.004 0.008
#> GSM918614     3  0.0000     0.9581 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM918629     3  0.0820     0.9558 0.000 0.000 0.972 0.000 0.016 0.012
#> GSM918587     5  0.3966     0.7176 0.000 0.000 0.096 0.056 0.800 0.048
#> GSM918588     3  0.0363     0.9573 0.000 0.000 0.988 0.000 0.000 0.012
#> GSM918589     3  0.0622     0.9559 0.000 0.000 0.980 0.000 0.012 0.008
#> GSM918611     3  0.2404     0.8764 0.000 0.000 0.872 0.000 0.112 0.016
#> GSM918624     3  0.1572     0.9493 0.000 0.000 0.936 0.000 0.028 0.036
#> GSM918637     3  0.1863     0.9406 0.000 0.000 0.920 0.000 0.036 0.044
#> GSM918639     3  0.1572     0.9493 0.000 0.000 0.936 0.000 0.028 0.036
#> GSM918640     3  0.1572     0.9493 0.000 0.000 0.936 0.000 0.028 0.036
#> GSM918636     3  0.0717     0.9553 0.000 0.000 0.976 0.000 0.008 0.016
#> GSM918590     5  0.4877     0.6702 0.000 0.192 0.000 0.000 0.660 0.148
#> GSM918610     2  0.0000     0.6316 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM918615     2  0.3717     0.4621 0.000 0.708 0.000 0.000 0.016 0.276
#> GSM918616     5  0.5723     0.6249 0.000 0.048 0.212 0.000 0.620 0.120
#> GSM918632     2  0.3996    -0.0147 0.000 0.512 0.000 0.000 0.004 0.484
#> GSM918647     2  0.3999    -0.0425 0.000 0.500 0.000 0.000 0.004 0.496
#> GSM918578     2  0.0000     0.6316 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM918579     6  0.2941     0.5628 0.000 0.220 0.000 0.000 0.000 0.780
#> GSM918581     2  0.0858     0.6197 0.000 0.968 0.000 0.000 0.004 0.028
#> GSM918584     2  0.3707     0.4217 0.000 0.680 0.000 0.000 0.008 0.312
#> GSM918591     2  0.0000     0.6316 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM918592     2  0.0000     0.6316 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM918597     5  0.1931     0.7990 0.004 0.032 0.016 0.000 0.928 0.020
#> GSM918598     2  0.0146     0.6299 0.000 0.996 0.000 0.000 0.004 0.000
#> GSM918599     6  0.4045     0.1133 0.000 0.008 0.000 0.000 0.428 0.564
#> GSM918604     3  0.2022     0.9203 0.008 0.000 0.916 0.000 0.052 0.024
#> GSM918605     5  0.4427     0.7326 0.000 0.136 0.000 0.000 0.716 0.148
#> GSM918613     2  0.4191     0.4438 0.000 0.676 0.000 0.000 0.040 0.284
#> GSM918623     2  0.3996    -0.0147 0.000 0.512 0.000 0.000 0.004 0.484
#> GSM918626     5  0.2053     0.7571 0.004 0.000 0.000 0.000 0.888 0.108
#> GSM918627     5  0.2144     0.7996 0.004 0.040 0.000 0.000 0.908 0.048
#> GSM918633     2  0.2212     0.5962 0.000 0.880 0.000 0.000 0.008 0.112
#> GSM918634     5  0.3922     0.7609 0.000 0.096 0.004 0.000 0.776 0.124
#> GSM918635     2  0.3982     0.0353 0.000 0.536 0.000 0.000 0.004 0.460
#> GSM918645     2  0.5278     0.2112 0.000 0.512 0.000 0.000 0.104 0.384
#> GSM918646     6  0.3911     0.5722 0.004 0.056 0.000 0.000 0.180 0.760
#> GSM918648     2  0.3999    -0.0466 0.000 0.500 0.000 0.000 0.004 0.496
#> GSM918650     2  0.2838     0.5481 0.000 0.808 0.000 0.000 0.004 0.188
#> GSM918652     6  0.4619     0.0892 0.000 0.044 0.000 0.000 0.392 0.564
#> GSM918653     6  0.2941     0.5628 0.000 0.220 0.000 0.000 0.000 0.780
#> GSM918622     5  0.2279     0.8009 0.004 0.048 0.000 0.000 0.900 0.048
#> GSM918583     6  0.3584     0.4156 0.000 0.308 0.000 0.000 0.004 0.688
#> GSM918585     6  0.3175     0.5165 0.000 0.256 0.000 0.000 0.000 0.744
#> GSM918595     2  0.2094     0.5740 0.000 0.900 0.000 0.000 0.080 0.020
#> GSM918596     5  0.2442     0.7845 0.000 0.000 0.048 0.000 0.884 0.068
#> GSM918602     5  0.5151     0.6520 0.000 0.248 0.028 0.000 0.648 0.076
#> GSM918617     6  0.4184     0.1300 0.004 0.008 0.000 0.000 0.432 0.556
#> GSM918630     6  0.2795     0.5944 0.000 0.100 0.000 0.000 0.044 0.856
#> GSM918631     6  0.2883     0.5673 0.000 0.212 0.000 0.000 0.000 0.788
#> GSM918618     4  0.0820     0.9310 0.000 0.000 0.000 0.972 0.016 0.012
#> GSM918644     4  0.0622     0.9355 0.000 0.000 0.000 0.980 0.012 0.008

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

consensus_heatmap(res, k = 2)

plot of chunk tab-MAD-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) gender(p) other(p) k
#> MAD:skmeans 75         3.63e-13   0.32471 9.47e-03 2
#> MAD:skmeans 74         5.75e-19   0.00253 1.36e-04 3
#> MAD:skmeans 73         3.86e-21   0.00457 5.66e-04 4
#> MAD:skmeans 72         1.31e-34   0.00373 1.93e-07 5
#> MAD:skmeans 62         1.18e-26   0.00762 9.20e-06 6

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


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 76 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 6.
#> 
#> Following methods can be applied to this 'ConsensusPartition' object:
#>  [1] "cola_report"             "collect_classes"         "collect_plots"          
#>  [4] "collect_stats"           "colnames"                "compare_signatures"     
#>  [7] "consensus_heatmap"       "dimension_reduction"     "functional_enrichment"  
#> [10] "get_anno_col"            "get_anno"                "get_classes"            
#> [13] "get_consensus"           "get_matrix"              "get_membership"         
#> [16] "get_param"               "get_signatures"          "get_stats"              
#> [19] "is_best_k"               "is_stable_k"             "membership_heatmap"     
#> [22] "ncol"                    "nrow"                    "plot_ecdf"              
#> [25] "rownames"                "select_partition_number" "show"                   
#> [28] "suggest_best_k"          "test_to_known_factors"

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

collect_plots(res)

plot of chunk 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.491           0.807       0.886          0.433 0.583   0.583
#> 3 3 0.609           0.824       0.901          0.445 0.701   0.519
#> 4 4 0.848           0.889       0.951          0.084 0.953   0.872
#> 5 5 0.890           0.866       0.948          0.161 0.888   0.653
#> 6 6 0.936           0.886       0.950          0.039 0.968   0.851

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

suggest_best_k(res)
#> [1] 6

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

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

show/hide code output

cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#>           class entropy silhouette    p1    p2
#> GSM918603     1  0.0000      0.954 1.000 0.000
#> GSM918641     1  0.0000      0.954 1.000 0.000
#> GSM918580     1  0.0376      0.950 0.996 0.004
#> GSM918593     1  0.0000      0.954 1.000 0.000
#> GSM918625     1  0.0000      0.954 1.000 0.000
#> GSM918638     1  0.0000      0.954 1.000 0.000
#> GSM918642     1  0.0000      0.954 1.000 0.000
#> GSM918643     1  0.0000      0.954 1.000 0.000
#> GSM918619     1  0.0000      0.954 1.000 0.000
#> GSM918621     1  0.0000      0.954 1.000 0.000
#> GSM918582     1  0.0000      0.954 1.000 0.000
#> GSM918649     1  0.0000      0.954 1.000 0.000
#> GSM918651     1  0.0000      0.954 1.000 0.000
#> GSM918607     1  0.0000      0.954 1.000 0.000
#> GSM918609     1  0.0000      0.954 1.000 0.000
#> GSM918608     1  0.0000      0.954 1.000 0.000
#> GSM918606     1  0.0000      0.954 1.000 0.000
#> GSM918620     1  0.0000      0.954 1.000 0.000
#> GSM918628     1  0.9552      0.151 0.624 0.376
#> GSM918586     2  0.9170      0.709 0.332 0.668
#> GSM918594     1  0.9427      0.190 0.640 0.360
#> GSM918600     2  0.9170      0.709 0.332 0.668
#> GSM918601     2  0.9170      0.709 0.332 0.668
#> GSM918612     1  0.0000      0.954 1.000 0.000
#> GSM918614     2  0.9170      0.709 0.332 0.668
#> GSM918629     2  0.9170      0.709 0.332 0.668
#> GSM918587     2  0.8713      0.738 0.292 0.708
#> GSM918588     2  0.9323      0.686 0.348 0.652
#> GSM918589     2  0.9170      0.709 0.332 0.668
#> GSM918611     2  0.9170      0.709 0.332 0.668
#> GSM918624     2  0.9170      0.709 0.332 0.668
#> GSM918637     2  0.9170      0.709 0.332 0.668
#> GSM918639     2  0.9170      0.709 0.332 0.668
#> GSM918640     2  0.9170      0.709 0.332 0.668
#> GSM918636     2  0.9170      0.709 0.332 0.668
#> GSM918590     2  0.0376      0.823 0.004 0.996
#> GSM918610     2  0.0000      0.823 0.000 1.000
#> GSM918615     2  0.0000      0.823 0.000 1.000
#> GSM918616     2  0.7674      0.777 0.224 0.776
#> GSM918632     2  0.0000      0.823 0.000 1.000
#> GSM918647     2  0.0000      0.823 0.000 1.000
#> GSM918578     2  0.0000      0.823 0.000 1.000
#> GSM918579     2  0.0000      0.823 0.000 1.000
#> GSM918581     2  0.0000      0.823 0.000 1.000
#> GSM918584     2  0.0000      0.823 0.000 1.000
#> GSM918591     2  0.0000      0.823 0.000 1.000
#> GSM918592     2  0.0000      0.823 0.000 1.000
#> GSM918597     2  0.9170      0.709 0.332 0.668
#> GSM918598     2  0.0000      0.823 0.000 1.000
#> GSM918599     2  0.4431      0.812 0.092 0.908
#> GSM918604     2  0.9170      0.709 0.332 0.668
#> GSM918605     2  0.0672      0.823 0.008 0.992
#> GSM918613     2  0.4690      0.811 0.100 0.900
#> GSM918623     2  0.0000      0.823 0.000 1.000
#> GSM918626     2  0.9170      0.709 0.332 0.668
#> GSM918627     2  0.7674      0.777 0.224 0.776
#> GSM918633     2  0.2603      0.820 0.044 0.956
#> GSM918634     2  0.7602      0.778 0.220 0.780
#> GSM918635     2  0.0000      0.823 0.000 1.000
#> GSM918645     2  0.0000      0.823 0.000 1.000
#> GSM918646     2  0.0000      0.823 0.000 1.000
#> GSM918648     2  0.0000      0.823 0.000 1.000
#> GSM918650     2  0.0000      0.823 0.000 1.000
#> GSM918652     2  0.0000      0.823 0.000 1.000
#> GSM918653     2  0.0000      0.823 0.000 1.000
#> GSM918622     2  0.7602      0.778 0.220 0.780
#> GSM918583     2  0.0000      0.823 0.000 1.000
#> GSM918585     2  0.0000      0.823 0.000 1.000
#> GSM918595     2  0.6247      0.682 0.156 0.844
#> GSM918596     2  0.8207      0.760 0.256 0.744
#> GSM918602     2  0.6801      0.791 0.180 0.820
#> GSM918617     2  0.7376      0.783 0.208 0.792
#> GSM918630     2  0.0000      0.823 0.000 1.000
#> GSM918631     2  0.0000      0.823 0.000 1.000
#> GSM918618     1  0.0000      0.954 1.000 0.000
#> GSM918644     2  0.9170      0.709 0.332 0.668

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>           class entropy silhouette    p1    p2    p3
#> GSM918603     1  0.1529      0.758 0.960 0.000 0.040
#> GSM918641     1  0.5591      0.473 0.696 0.000 0.304
#> GSM918580     1  0.0829      0.758 0.984 0.004 0.012
#> GSM918593     1  0.6140      0.206 0.596 0.000 0.404
#> GSM918625     3  0.5431      0.611 0.284 0.000 0.716
#> GSM918638     3  0.6111      0.419 0.396 0.000 0.604
#> GSM918642     3  0.5810      0.532 0.336 0.000 0.664
#> GSM918643     1  0.0747      0.758 0.984 0.000 0.016
#> GSM918619     1  0.4291      0.871 0.820 0.000 0.180
#> GSM918621     1  0.4291      0.871 0.820 0.000 0.180
#> GSM918582     1  0.4291      0.871 0.820 0.000 0.180
#> GSM918649     1  0.4291      0.871 0.820 0.000 0.180
#> GSM918651     1  0.4291      0.871 0.820 0.000 0.180
#> GSM918607     1  0.4291      0.871 0.820 0.000 0.180
#> GSM918609     1  0.4291      0.871 0.820 0.000 0.180
#> GSM918608     1  0.4291      0.871 0.820 0.000 0.180
#> GSM918606     1  0.4121      0.867 0.832 0.000 0.168
#> GSM918620     1  0.4178      0.869 0.828 0.000 0.172
#> GSM918628     1  0.6665      0.739 0.688 0.036 0.276
#> GSM918586     3  0.0592      0.891 0.000 0.012 0.988
#> GSM918594     3  0.0592      0.891 0.000 0.012 0.988
#> GSM918600     3  0.0592      0.891 0.000 0.012 0.988
#> GSM918601     3  0.0592      0.891 0.000 0.012 0.988
#> GSM918612     3  0.0592      0.879 0.012 0.000 0.988
#> GSM918614     3  0.0592      0.891 0.000 0.012 0.988
#> GSM918629     3  0.3038      0.830 0.000 0.104 0.896
#> GSM918587     3  0.5621      0.523 0.000 0.308 0.692
#> GSM918588     3  0.0592      0.891 0.000 0.012 0.988
#> GSM918589     3  0.0592      0.891 0.000 0.012 0.988
#> GSM918611     3  0.0592      0.891 0.000 0.012 0.988
#> GSM918624     3  0.0592      0.891 0.000 0.012 0.988
#> GSM918637     3  0.0592      0.891 0.000 0.012 0.988
#> GSM918639     3  0.0592      0.891 0.000 0.012 0.988
#> GSM918640     3  0.0592      0.891 0.000 0.012 0.988
#> GSM918636     3  0.2625      0.849 0.000 0.084 0.916
#> GSM918590     2  0.0592      0.917 0.000 0.988 0.012
#> GSM918610     2  0.0000      0.921 0.000 1.000 0.000
#> GSM918615     2  0.0424      0.919 0.000 0.992 0.008
#> GSM918616     2  0.5905      0.529 0.000 0.648 0.352
#> GSM918632     2  0.0000      0.921 0.000 1.000 0.000
#> GSM918647     2  0.0000      0.921 0.000 1.000 0.000
#> GSM918578     2  0.0000      0.921 0.000 1.000 0.000
#> GSM918579     2  0.0000      0.921 0.000 1.000 0.000
#> GSM918581     2  0.0000      0.921 0.000 1.000 0.000
#> GSM918584     2  0.0000      0.921 0.000 1.000 0.000
#> GSM918591     2  0.0000      0.921 0.000 1.000 0.000
#> GSM918592     2  0.0000      0.921 0.000 1.000 0.000
#> GSM918597     3  0.1163      0.885 0.000 0.028 0.972
#> GSM918598     2  0.0000      0.921 0.000 1.000 0.000
#> GSM918599     2  0.2959      0.854 0.000 0.900 0.100
#> GSM918604     3  0.2537      0.852 0.000 0.080 0.920
#> GSM918605     2  0.0747      0.915 0.000 0.984 0.016
#> GSM918613     2  0.3116      0.845 0.000 0.892 0.108
#> GSM918623     2  0.0000      0.921 0.000 1.000 0.000
#> GSM918626     3  0.3116      0.827 0.000 0.108 0.892
#> GSM918627     2  0.5497      0.631 0.000 0.708 0.292
#> GSM918633     2  0.1753      0.893 0.000 0.952 0.048
#> GSM918634     2  0.5291      0.681 0.000 0.732 0.268
#> GSM918635     2  0.0000      0.921 0.000 1.000 0.000
#> GSM918645     2  0.0424      0.919 0.000 0.992 0.008
#> GSM918646     2  0.0000      0.921 0.000 1.000 0.000
#> GSM918648     2  0.0000      0.921 0.000 1.000 0.000
#> GSM918650     2  0.0000      0.921 0.000 1.000 0.000
#> GSM918652     2  0.0424      0.919 0.000 0.992 0.008
#> GSM918653     2  0.0000      0.921 0.000 1.000 0.000
#> GSM918622     2  0.5138      0.694 0.000 0.748 0.252
#> GSM918583     2  0.0000      0.921 0.000 1.000 0.000
#> GSM918585     2  0.0000      0.921 0.000 1.000 0.000
#> GSM918595     2  0.3213      0.851 0.008 0.900 0.092
#> GSM918596     2  0.6260      0.329 0.000 0.552 0.448
#> GSM918602     2  0.4931      0.714 0.000 0.768 0.232
#> GSM918617     2  0.4974      0.716 0.000 0.764 0.236
#> GSM918630     2  0.0000      0.921 0.000 1.000 0.000
#> GSM918631     2  0.0000      0.921 0.000 1.000 0.000
#> GSM918618     3  0.3619      0.783 0.136 0.000 0.864
#> GSM918644     3  0.3587      0.831 0.020 0.088 0.892

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM918603     4  0.0000      1.000 0.000 0.000 0.000 1.000
#> GSM918641     4  0.0000      1.000 0.000 0.000 0.000 1.000
#> GSM918580     4  0.0000      1.000 0.000 0.000 0.000 1.000
#> GSM918593     4  0.0000      1.000 0.000 0.000 0.000 1.000
#> GSM918625     4  0.0000      1.000 0.000 0.000 0.000 1.000
#> GSM918638     4  0.0000      1.000 0.000 0.000 0.000 1.000
#> GSM918642     4  0.0000      1.000 0.000 0.000 0.000 1.000
#> GSM918643     4  0.0000      1.000 0.000 0.000 0.000 1.000
#> GSM918619     1  0.0000      0.950 1.000 0.000 0.000 0.000
#> GSM918621     1  0.0000      0.950 1.000 0.000 0.000 0.000
#> GSM918582     1  0.0000      0.950 1.000 0.000 0.000 0.000
#> GSM918649     1  0.0000      0.950 1.000 0.000 0.000 0.000
#> GSM918651     1  0.0000      0.950 1.000 0.000 0.000 0.000
#> GSM918607     1  0.0000      0.950 1.000 0.000 0.000 0.000
#> GSM918609     1  0.0000      0.950 1.000 0.000 0.000 0.000
#> GSM918608     1  0.0000      0.950 1.000 0.000 0.000 0.000
#> GSM918606     1  0.0000      0.950 1.000 0.000 0.000 0.000
#> GSM918620     1  0.0000      0.950 1.000 0.000 0.000 0.000
#> GSM918628     1  0.5645      0.353 0.604 0.032 0.364 0.000
#> GSM918586     3  0.0000      0.926 0.000 0.000 1.000 0.000
#> GSM918594     3  0.0000      0.926 0.000 0.000 1.000 0.000
#> GSM918600     3  0.0000      0.926 0.000 0.000 1.000 0.000
#> GSM918601     3  0.0000      0.926 0.000 0.000 1.000 0.000
#> GSM918612     3  0.0000      0.926 0.000 0.000 1.000 0.000
#> GSM918614     3  0.0000      0.926 0.000 0.000 1.000 0.000
#> GSM918629     3  0.1716      0.882 0.000 0.064 0.936 0.000
#> GSM918587     3  0.4761      0.364 0.000 0.372 0.628 0.000
#> GSM918588     3  0.0000      0.926 0.000 0.000 1.000 0.000
#> GSM918589     3  0.0000      0.926 0.000 0.000 1.000 0.000
#> GSM918611     3  0.0000      0.926 0.000 0.000 1.000 0.000
#> GSM918624     3  0.0000      0.926 0.000 0.000 1.000 0.000
#> GSM918637     3  0.0000      0.926 0.000 0.000 1.000 0.000
#> GSM918639     3  0.0000      0.926 0.000 0.000 1.000 0.000
#> GSM918640     3  0.0000      0.926 0.000 0.000 1.000 0.000
#> GSM918636     3  0.1211      0.902 0.000 0.040 0.960 0.000
#> GSM918590     2  0.0592      0.927 0.000 0.984 0.016 0.000
#> GSM918610     2  0.0000      0.933 0.000 1.000 0.000 0.000
#> GSM918615     2  0.0592      0.927 0.000 0.984 0.016 0.000
#> GSM918616     2  0.4643      0.543 0.000 0.656 0.344 0.000
#> GSM918632     2  0.0000      0.933 0.000 1.000 0.000 0.000
#> GSM918647     2  0.0000      0.933 0.000 1.000 0.000 0.000
#> GSM918578     2  0.0000      0.933 0.000 1.000 0.000 0.000
#> GSM918579     2  0.0000      0.933 0.000 1.000 0.000 0.000
#> GSM918581     2  0.0000      0.933 0.000 1.000 0.000 0.000
#> GSM918584     2  0.0000      0.933 0.000 1.000 0.000 0.000
#> GSM918591     2  0.0000      0.933 0.000 1.000 0.000 0.000
#> GSM918592     2  0.0000      0.933 0.000 1.000 0.000 0.000
#> GSM918597     3  0.0707      0.916 0.000 0.020 0.980 0.000
#> GSM918598     2  0.0000      0.933 0.000 1.000 0.000 0.000
#> GSM918599     2  0.3266      0.800 0.000 0.832 0.168 0.000
#> GSM918604     3  0.1302      0.899 0.000 0.044 0.956 0.000
#> GSM918605     2  0.0592      0.927 0.000 0.984 0.016 0.000
#> GSM918613     2  0.0188      0.931 0.000 0.996 0.004 0.000
#> GSM918623     2  0.0000      0.933 0.000 1.000 0.000 0.000
#> GSM918626     3  0.3873      0.691 0.000 0.228 0.772 0.000
#> GSM918627     2  0.3975      0.714 0.000 0.760 0.240 0.000
#> GSM918633     2  0.0000      0.933 0.000 1.000 0.000 0.000
#> GSM918634     2  0.3975      0.722 0.000 0.760 0.240 0.000
#> GSM918635     2  0.0000      0.933 0.000 1.000 0.000 0.000
#> GSM918645     2  0.0592      0.927 0.000 0.984 0.016 0.000
#> GSM918646     2  0.0000      0.933 0.000 1.000 0.000 0.000
#> GSM918648     2  0.0000      0.933 0.000 1.000 0.000 0.000
#> GSM918650     2  0.0000      0.933 0.000 1.000 0.000 0.000
#> GSM918652     2  0.0592      0.927 0.000 0.984 0.016 0.000
#> GSM918653     2  0.0000      0.933 0.000 1.000 0.000 0.000
#> GSM918622     2  0.3764      0.747 0.000 0.784 0.216 0.000
#> GSM918583     2  0.0000      0.933 0.000 1.000 0.000 0.000
#> GSM918585     2  0.0000      0.933 0.000 1.000 0.000 0.000
#> GSM918595     2  0.1940      0.882 0.000 0.924 0.076 0.000
#> GSM918596     2  0.4907      0.387 0.000 0.580 0.420 0.000
#> GSM918602     2  0.2868      0.835 0.000 0.864 0.136 0.000
#> GSM918617     2  0.3610      0.765 0.000 0.800 0.200 0.000
#> GSM918630     2  0.0000      0.933 0.000 1.000 0.000 0.000
#> GSM918631     2  0.0000      0.933 0.000 1.000 0.000 0.000
#> GSM918618     3  0.5080      0.726 0.092 0.000 0.764 0.144
#> GSM918644     3  0.4290      0.723 0.000 0.016 0.772 0.212

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>           class entropy silhouette    p1    p2    p3    p4    p5
#> GSM918603     4  0.0000      1.000 0.000 0.000 0.000 1.000 0.000
#> GSM918641     4  0.0000      1.000 0.000 0.000 0.000 1.000 0.000
#> GSM918580     4  0.0000      1.000 0.000 0.000 0.000 1.000 0.000
#> GSM918593     4  0.0000      1.000 0.000 0.000 0.000 1.000 0.000
#> GSM918625     4  0.0000      1.000 0.000 0.000 0.000 1.000 0.000
#> GSM918638     4  0.0000      1.000 0.000 0.000 0.000 1.000 0.000
#> GSM918642     4  0.0000      1.000 0.000 0.000 0.000 1.000 0.000
#> GSM918643     4  0.0000      1.000 0.000 0.000 0.000 1.000 0.000
#> GSM918619     1  0.0000      0.945 1.000 0.000 0.000 0.000 0.000
#> GSM918621     1  0.0000      0.945 1.000 0.000 0.000 0.000 0.000
#> GSM918582     1  0.0000      0.945 1.000 0.000 0.000 0.000 0.000
#> GSM918649     1  0.0000      0.945 1.000 0.000 0.000 0.000 0.000
#> GSM918651     1  0.0000      0.945 1.000 0.000 0.000 0.000 0.000
#> GSM918607     1  0.0000      0.945 1.000 0.000 0.000 0.000 0.000
#> GSM918609     1  0.0000      0.945 1.000 0.000 0.000 0.000 0.000
#> GSM918608     1  0.0000      0.945 1.000 0.000 0.000 0.000 0.000
#> GSM918606     1  0.0000      0.945 1.000 0.000 0.000 0.000 0.000
#> GSM918620     1  0.0000      0.945 1.000 0.000 0.000 0.000 0.000
#> GSM918628     1  0.4227      0.219 0.580 0.000 0.420 0.000 0.000
#> GSM918586     3  0.0000      0.932 0.000 0.000 1.000 0.000 0.000
#> GSM918594     3  0.0000      0.932 0.000 0.000 1.000 0.000 0.000
#> GSM918600     3  0.0000      0.932 0.000 0.000 1.000 0.000 0.000
#> GSM918601     3  0.0000      0.932 0.000 0.000 1.000 0.000 0.000
#> GSM918612     3  0.0000      0.932 0.000 0.000 1.000 0.000 0.000
#> GSM918614     3  0.0000      0.932 0.000 0.000 1.000 0.000 0.000
#> GSM918629     3  0.1197      0.893 0.000 0.000 0.952 0.000 0.048
#> GSM918587     3  0.4294      0.152 0.000 0.000 0.532 0.000 0.468
#> GSM918588     3  0.0000      0.932 0.000 0.000 1.000 0.000 0.000
#> GSM918589     3  0.0000      0.932 0.000 0.000 1.000 0.000 0.000
#> GSM918611     3  0.0000      0.932 0.000 0.000 1.000 0.000 0.000
#> GSM918624     3  0.0000      0.932 0.000 0.000 1.000 0.000 0.000
#> GSM918637     3  0.0000      0.932 0.000 0.000 1.000 0.000 0.000
#> GSM918639     3  0.0000      0.932 0.000 0.000 1.000 0.000 0.000
#> GSM918640     3  0.0000      0.932 0.000 0.000 1.000 0.000 0.000
#> GSM918636     3  0.0000      0.932 0.000 0.000 1.000 0.000 0.000
#> GSM918590     5  0.0000      0.938 0.000 0.000 0.000 0.000 1.000
#> GSM918610     5  0.3895      0.503 0.000 0.320 0.000 0.000 0.680
#> GSM918615     5  0.0000      0.938 0.000 0.000 0.000 0.000 1.000
#> GSM918616     5  0.0703      0.921 0.000 0.000 0.024 0.000 0.976
#> GSM918632     2  0.0000      0.899 0.000 1.000 0.000 0.000 0.000
#> GSM918647     2  0.0000      0.899 0.000 1.000 0.000 0.000 0.000
#> GSM918578     2  0.0000      0.899 0.000 1.000 0.000 0.000 0.000
#> GSM918579     2  0.0162      0.897 0.000 0.996 0.000 0.000 0.004
#> GSM918581     2  0.0000      0.899 0.000 1.000 0.000 0.000 0.000
#> GSM918584     5  0.0000      0.938 0.000 0.000 0.000 0.000 1.000
#> GSM918591     5  0.3109      0.721 0.000 0.200 0.000 0.000 0.800
#> GSM918592     2  0.0000      0.899 0.000 1.000 0.000 0.000 0.000
#> GSM918597     3  0.0000      0.932 0.000 0.000 1.000 0.000 0.000
#> GSM918598     2  0.0000      0.899 0.000 1.000 0.000 0.000 0.000
#> GSM918599     5  0.3913      0.459 0.000 0.324 0.000 0.000 0.676
#> GSM918604     3  0.0000      0.932 0.000 0.000 1.000 0.000 0.000
#> GSM918605     5  0.0000      0.938 0.000 0.000 0.000 0.000 1.000
#> GSM918613     5  0.0000      0.938 0.000 0.000 0.000 0.000 1.000
#> GSM918623     2  0.0000      0.899 0.000 1.000 0.000 0.000 0.000
#> GSM918626     3  0.3480      0.671 0.000 0.248 0.752 0.000 0.000
#> GSM918627     5  0.0290      0.933 0.000 0.000 0.008 0.000 0.992
#> GSM918633     2  0.4256      0.214 0.000 0.564 0.000 0.000 0.436
#> GSM918634     5  0.0000      0.938 0.000 0.000 0.000 0.000 1.000
#> GSM918635     2  0.0000      0.899 0.000 1.000 0.000 0.000 0.000
#> GSM918645     5  0.0000      0.938 0.000 0.000 0.000 0.000 1.000
#> GSM918646     2  0.2280      0.809 0.000 0.880 0.000 0.000 0.120
#> GSM918648     2  0.0000      0.899 0.000 1.000 0.000 0.000 0.000
#> GSM918650     5  0.0000      0.938 0.000 0.000 0.000 0.000 1.000
#> GSM918652     5  0.0000      0.938 0.000 0.000 0.000 0.000 1.000
#> GSM918653     2  0.0000      0.899 0.000 1.000 0.000 0.000 0.000
#> GSM918622     5  0.0000      0.938 0.000 0.000 0.000 0.000 1.000
#> GSM918583     5  0.0000      0.938 0.000 0.000 0.000 0.000 1.000
#> GSM918585     2  0.0000      0.899 0.000 1.000 0.000 0.000 0.000
#> GSM918595     2  0.4273      0.174 0.000 0.552 0.000 0.000 0.448
#> GSM918596     5  0.2280      0.826 0.000 0.000 0.120 0.000 0.880
#> GSM918602     5  0.0865      0.920 0.000 0.024 0.004 0.000 0.972
#> GSM918617     5  0.0000      0.938 0.000 0.000 0.000 0.000 1.000
#> GSM918630     5  0.0000      0.938 0.000 0.000 0.000 0.000 1.000
#> GSM918631     2  0.3242      0.689 0.000 0.784 0.000 0.000 0.216
#> GSM918618     3  0.4501      0.721 0.116 0.000 0.756 0.128 0.000
#> GSM918644     3  0.3480      0.682 0.000 0.000 0.752 0.248 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
#> GSM918603     4  0.0000      1.000 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM918641     4  0.0000      1.000 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM918580     4  0.0000      1.000 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM918593     4  0.0000      1.000 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM918625     4  0.0000      1.000 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM918638     4  0.0000      1.000 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM918642     4  0.0000      1.000 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM918643     4  0.0000      1.000 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM918619     1  0.0000      0.944 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM918621     1  0.0000      0.944 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM918582     1  0.0000      0.944 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM918649     1  0.0000      0.944 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM918651     1  0.0000      0.944 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM918607     1  0.0000      0.944 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM918609     1  0.0000      0.944 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM918608     1  0.0000      0.944 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM918606     1  0.0000      0.944 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM918620     1  0.0000      0.944 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM918628     1  0.3838      0.168 0.552 0.000 0.448 0.000 0.000 0.000
#> GSM918586     3  0.0790      0.954 0.000 0.000 0.968 0.000 0.000 0.032
#> GSM918594     6  0.1714      0.900 0.000 0.000 0.092 0.000 0.000 0.908
#> GSM918600     3  0.0790      0.954 0.000 0.000 0.968 0.000 0.000 0.032
#> GSM918601     6  0.0363      0.980 0.000 0.000 0.012 0.000 0.000 0.988
#> GSM918612     3  0.0790      0.954 0.000 0.000 0.968 0.000 0.000 0.032
#> GSM918614     3  0.0790      0.954 0.000 0.000 0.968 0.000 0.000 0.032
#> GSM918629     3  0.0405      0.949 0.000 0.000 0.988 0.000 0.004 0.008
#> GSM918587     3  0.3470      0.591 0.000 0.000 0.740 0.000 0.248 0.012
#> GSM918588     3  0.0790      0.954 0.000 0.000 0.968 0.000 0.000 0.032
#> GSM918589     3  0.0790      0.954 0.000 0.000 0.968 0.000 0.000 0.032
#> GSM918611     3  0.0260      0.951 0.000 0.000 0.992 0.000 0.000 0.008
#> GSM918624     6  0.0363      0.980 0.000 0.000 0.012 0.000 0.000 0.988
#> GSM918637     6  0.0363      0.980 0.000 0.000 0.012 0.000 0.000 0.988
#> GSM918639     6  0.0363      0.980 0.000 0.000 0.012 0.000 0.000 0.988
#> GSM918640     6  0.0363      0.980 0.000 0.000 0.012 0.000 0.000 0.988
#> GSM918636     3  0.0790      0.954 0.000 0.000 0.968 0.000 0.000 0.032
#> GSM918590     5  0.0000      0.932 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM918610     5  0.3499      0.510 0.000 0.320 0.000 0.000 0.680 0.000
#> GSM918615     5  0.0000      0.932 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM918616     5  0.1845      0.902 0.000 0.000 0.052 0.000 0.920 0.028
#> GSM918632     2  0.0000      0.893 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM918647     2  0.0000      0.893 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM918578     2  0.0000      0.893 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM918579     2  0.0146      0.891 0.000 0.996 0.000 0.000 0.004 0.000
#> GSM918581     2  0.0000      0.893 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM918584     5  0.0000      0.932 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM918591     5  0.2793      0.729 0.000 0.200 0.000 0.000 0.800 0.000
#> GSM918592     2  0.0000      0.893 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM918597     3  0.0363      0.940 0.000 0.000 0.988 0.000 0.000 0.012
#> GSM918598     2  0.0000      0.893 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM918599     5  0.3789      0.453 0.000 0.324 0.004 0.000 0.668 0.004
#> GSM918604     3  0.0458      0.953 0.000 0.000 0.984 0.000 0.000 0.016
#> GSM918605     5  0.0000      0.932 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM918613     5  0.0692      0.929 0.000 0.000 0.020 0.000 0.976 0.004
#> GSM918623     2  0.0000      0.893 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM918626     3  0.0363      0.940 0.000 0.000 0.988 0.000 0.000 0.012
#> GSM918627     5  0.1297      0.920 0.000 0.000 0.040 0.000 0.948 0.012
#> GSM918633     2  0.4415      0.206 0.000 0.556 0.020 0.000 0.420 0.004
#> GSM918634     5  0.0777      0.928 0.000 0.000 0.024 0.000 0.972 0.004
#> GSM918635     2  0.0000      0.893 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM918645     5  0.0000      0.932 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM918646     2  0.2711      0.784 0.000 0.860 0.012 0.000 0.116 0.012
#> GSM918648     2  0.0000      0.893 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM918650     5  0.0000      0.932 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM918652     5  0.0000      0.932 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM918653     2  0.0000      0.893 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM918622     5  0.1151      0.923 0.000 0.000 0.032 0.000 0.956 0.012
#> GSM918583     5  0.0000      0.932 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM918585     2  0.0000      0.893 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM918595     2  0.4224      0.181 0.000 0.552 0.016 0.000 0.432 0.000
#> GSM918596     5  0.1049      0.925 0.000 0.000 0.032 0.000 0.960 0.008
#> GSM918602     5  0.1585      0.917 0.000 0.012 0.036 0.000 0.940 0.012
#> GSM918617     5  0.0717      0.929 0.000 0.000 0.016 0.000 0.976 0.008
#> GSM918630     5  0.0000      0.932 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM918631     2  0.2912      0.678 0.000 0.784 0.000 0.000 0.216 0.000
#> GSM918618     3  0.1168      0.936 0.016 0.000 0.956 0.028 0.000 0.000
#> GSM918644     3  0.0790      0.938 0.000 0.000 0.968 0.032 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-MAD-pam-consensus-heatmap-1

consensus_heatmap(res, k = 3)

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

consensus_heatmap(res, k = 4)

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

consensus_heatmap(res, k = 5)

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

consensus_heatmap(res, k = 6)

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

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

membership_heatmap(res, k = 2)

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

membership_heatmap(res, k = 3)

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

membership_heatmap(res, k = 4)

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

membership_heatmap(res, k = 5)

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

membership_heatmap(res, k = 6)

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

As soon as we have had the classes for columns, we can look for signatures which are significantly different between classes which can be candidate marks for certain classes. Following are the heatmaps for signatures.

Signature heatmaps where rows are scaled:

get_signatures(res, k = 2)

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

get_signatures(res, k = 3)

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

get_signatures(res, k = 4)

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

get_signatures(res, k = 5)

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

get_signatures(res, k = 6)

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

Signature heatmaps where rows are not scaled:

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

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

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

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

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

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

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

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

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

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

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk MAD-pam-signature_compare

get_signature() returns a data frame invisibly. TO get the list of signatures, the function call should be assigned to a variable explicitly. In following code, if plot argument is set to FALSE, no heatmap is plotted while only the differential analysis is performed.

# code only for demonstration
tb = get_signature(res, k = ..., plot = FALSE)

An example of the output of tb is:

#>   which_row         fdr    mean_1    mean_2 scaled_mean_1 scaled_mean_2 km
#> 1        38 0.042760348  8.373488  9.131774    -0.5533452     0.5164555  1
#> 2        40 0.018707592  7.106213  8.469186    -0.6173731     0.5762149  1
#> 3        55 0.019134737 10.221463 11.207825    -0.6159697     0.5749050  1
#> 4        59 0.006059896  5.921854  7.869574    -0.6899429     0.6439467  1
#> 5        60 0.018055526  8.928898 10.211722    -0.6204761     0.5791110  1
#> 6        98 0.009384629 15.714769 14.887706     0.6635654    -0.6193277  2
...

The columns in tb are:

  1. which_row: row indices corresponding to the input matrix.
  2. fdr: FDR for the differential test.
  3. mean_x: The mean value in group x.
  4. scaled_mean_x: The mean value in group x after rows are scaled.
  5. km: Row groups if k-means clustering is applied to rows.

UMAP plot which shows how samples are separated.

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

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

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

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

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

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

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

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

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

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

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk MAD-pam-collect-classes

Test correlation between subgroups and known annotations. If the known annotation is numeric, one-way ANOVA test is applied, and if the known annotation is discrete, chi-squared contingency table test is applied.

test_to_known_factors(res)
#>          n disease.state(p) gender(p) other(p) k
#> MAD:pam 74         1.11e-13   0.00911 1.53e-03 2
#> MAD:pam 72         5.72e-21   0.07423 8.21e-06 3
#> MAD:pam 73         7.29e-37   0.00221 5.18e-07 4
#> MAD:pam 71         2.76e-33   0.00428 8.65e-06 5
#> MAD:pam 72         7.99e-33   0.00662 2.35e-05 6

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


MAD:mclust*

The object with results only for a single top-value method and a single partition method can be extracted as:

res = res_list["MAD", "mclust"]
# you can also extract it by
# res = res_list["MAD:mclust"]

A summary of res and all the functions that can be applied to it:

res
#> A 'ConsensusPartition' object with k = 2, 3, 4, 5, 6.
#>   On a matrix with 51941 rows and 76 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 5.
#> 
#> Following methods can be applied to this 'ConsensusPartition' object:
#>  [1] "cola_report"             "collect_classes"         "collect_plots"          
#>  [4] "collect_stats"           "colnames"                "compare_signatures"     
#>  [7] "consensus_heatmap"       "dimension_reduction"     "functional_enrichment"  
#> [10] "get_anno_col"            "get_anno"                "get_classes"            
#> [13] "get_consensus"           "get_matrix"              "get_membership"         
#> [16] "get_param"               "get_signatures"          "get_stats"              
#> [19] "is_best_k"               "is_stable_k"             "membership_heatmap"     
#> [22] "ncol"                    "nrow"                    "plot_ecdf"              
#> [25] "rownames"                "select_partition_number" "show"                   
#> [28] "suggest_best_k"          "test_to_known_factors"

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

collect_plots(res)

plot of chunk 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.763           0.971       0.973          0.373 0.595   0.595
#> 3 3 0.728           0.783       0.908          0.455 0.765   0.629
#> 4 4 0.814           0.781       0.912          0.251 0.711   0.443
#> 5 5 0.912           0.903       0.960          0.154 0.862   0.584
#> 6 6 0.890           0.835       0.889          0.039 0.991   0.959

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

suggest_best_k(res)
#> [1] 5

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

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

show/hide code output

cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#>           class entropy silhouette    p1    p2
#> GSM918603     1   0.653      0.902 0.832 0.168
#> GSM918641     1   0.653      0.902 0.832 0.168
#> GSM918580     1   0.653      0.902 0.832 0.168
#> GSM918593     1   0.653      0.902 0.832 0.168
#> GSM918625     1   0.653      0.902 0.832 0.168
#> GSM918638     1   0.653      0.902 0.832 0.168
#> GSM918642     1   0.653      0.902 0.832 0.168
#> GSM918643     1   0.653      0.902 0.832 0.168
#> GSM918619     1   0.000      0.894 1.000 0.000
#> GSM918621     1   0.000      0.894 1.000 0.000
#> GSM918582     1   0.000      0.894 1.000 0.000
#> GSM918649     1   0.529      0.903 0.880 0.120
#> GSM918651     1   0.000      0.894 1.000 0.000
#> GSM918607     1   0.000      0.894 1.000 0.000
#> GSM918609     1   0.000      0.894 1.000 0.000
#> GSM918608     1   0.000      0.894 1.000 0.000
#> GSM918606     1   0.000      0.894 1.000 0.000
#> GSM918620     1   0.000      0.894 1.000 0.000
#> GSM918628     1   0.653      0.902 0.832 0.168
#> GSM918586     2   0.000      1.000 0.000 1.000
#> GSM918594     2   0.000      1.000 0.000 1.000
#> GSM918600     2   0.000      1.000 0.000 1.000
#> GSM918601     2   0.000      1.000 0.000 1.000
#> GSM918612     2   0.000      1.000 0.000 1.000
#> GSM918614     2   0.000      1.000 0.000 1.000
#> GSM918629     2   0.000      1.000 0.000 1.000
#> GSM918587     2   0.000      1.000 0.000 1.000
#> GSM918588     2   0.000      1.000 0.000 1.000
#> GSM918589     2   0.000      1.000 0.000 1.000
#> GSM918611     2   0.000      1.000 0.000 1.000
#> GSM918624     2   0.000      1.000 0.000 1.000
#> GSM918637     2   0.000      1.000 0.000 1.000
#> GSM918639     2   0.000      1.000 0.000 1.000
#> GSM918640     2   0.000      1.000 0.000 1.000
#> GSM918636     2   0.000      1.000 0.000 1.000
#> GSM918590     2   0.000      1.000 0.000 1.000
#> GSM918610     2   0.000      1.000 0.000 1.000
#> GSM918615     2   0.000      1.000 0.000 1.000
#> GSM918616     2   0.000      1.000 0.000 1.000
#> GSM918632     2   0.000      1.000 0.000 1.000
#> GSM918647     2   0.000      1.000 0.000 1.000
#> GSM918578     2   0.000      1.000 0.000 1.000
#> GSM918579     2   0.000      1.000 0.000 1.000
#> GSM918581     2   0.000      1.000 0.000 1.000
#> GSM918584     2   0.000      1.000 0.000 1.000
#> GSM918591     2   0.000      1.000 0.000 1.000
#> GSM918592     2   0.000      1.000 0.000 1.000
#> GSM918597     2   0.000      1.000 0.000 1.000
#> GSM918598     2   0.000      1.000 0.000 1.000
#> GSM918599     2   0.000      1.000 0.000 1.000
#> GSM918604     2   0.000      1.000 0.000 1.000
#> GSM918605     2   0.000      1.000 0.000 1.000
#> GSM918613     2   0.000      1.000 0.000 1.000
#> GSM918623     2   0.000      1.000 0.000 1.000
#> GSM918626     2   0.000      1.000 0.000 1.000
#> GSM918627     2   0.000      1.000 0.000 1.000
#> GSM918633     2   0.000      1.000 0.000 1.000
#> GSM918634     2   0.000      1.000 0.000 1.000
#> GSM918635     2   0.000      1.000 0.000 1.000
#> GSM918645     2   0.000      1.000 0.000 1.000
#> GSM918646     2   0.000      1.000 0.000 1.000
#> GSM918648     2   0.000      1.000 0.000 1.000
#> GSM918650     2   0.000      1.000 0.000 1.000
#> GSM918652     2   0.000      1.000 0.000 1.000
#> GSM918653     2   0.000      1.000 0.000 1.000
#> GSM918622     2   0.000      1.000 0.000 1.000
#> GSM918583     2   0.000      1.000 0.000 1.000
#> GSM918585     2   0.000      1.000 0.000 1.000
#> GSM918595     2   0.000      1.000 0.000 1.000
#> GSM918596     2   0.000      1.000 0.000 1.000
#> GSM918602     2   0.000      1.000 0.000 1.000
#> GSM918617     2   0.000      1.000 0.000 1.000
#> GSM918630     2   0.000      1.000 0.000 1.000
#> GSM918631     2   0.000      1.000 0.000 1.000
#> GSM918618     1   0.714      0.873 0.804 0.196
#> GSM918644     1   0.753      0.848 0.784 0.216

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>           class entropy silhouette    p1    p2    p3
#> GSM918603     3  0.2711      0.671 0.088 0.000 0.912
#> GSM918641     3  0.2711      0.671 0.088 0.000 0.912
#> GSM918580     3  0.2711      0.671 0.088 0.000 0.912
#> GSM918593     3  0.2711      0.671 0.088 0.000 0.912
#> GSM918625     3  0.2711      0.671 0.088 0.000 0.912
#> GSM918638     3  0.2711      0.671 0.088 0.000 0.912
#> GSM918642     3  0.2711      0.671 0.088 0.000 0.912
#> GSM918643     3  0.2711      0.671 0.088 0.000 0.912
#> GSM918619     1  0.0000      0.983 1.000 0.000 0.000
#> GSM918621     1  0.0000      0.983 1.000 0.000 0.000
#> GSM918582     1  0.0000      0.983 1.000 0.000 0.000
#> GSM918649     1  0.3619      0.823 0.864 0.000 0.136
#> GSM918651     1  0.0000      0.983 1.000 0.000 0.000
#> GSM918607     1  0.0000      0.983 1.000 0.000 0.000
#> GSM918609     1  0.0000      0.983 1.000 0.000 0.000
#> GSM918608     1  0.0000      0.983 1.000 0.000 0.000
#> GSM918606     1  0.0000      0.983 1.000 0.000 0.000
#> GSM918620     1  0.0000      0.983 1.000 0.000 0.000
#> GSM918628     3  0.5915      0.691 0.128 0.080 0.792
#> GSM918586     3  0.5216      0.707 0.000 0.260 0.740
#> GSM918594     2  0.6309     -0.215 0.000 0.500 0.500
#> GSM918600     3  0.5216      0.707 0.000 0.260 0.740
#> GSM918601     2  0.6309     -0.215 0.000 0.500 0.500
#> GSM918612     3  0.4974      0.726 0.000 0.236 0.764
#> GSM918614     3  0.6062      0.492 0.000 0.384 0.616
#> GSM918629     2  0.2878      0.846 0.000 0.904 0.096
#> GSM918587     2  0.3038      0.837 0.000 0.896 0.104
#> GSM918588     3  0.5327      0.692 0.000 0.272 0.728
#> GSM918589     3  0.5016      0.724 0.000 0.240 0.760
#> GSM918611     2  0.6308     -0.187 0.000 0.508 0.492
#> GSM918624     3  0.6309      0.157 0.000 0.500 0.500
#> GSM918637     2  0.4178      0.742 0.000 0.828 0.172
#> GSM918639     2  0.6309     -0.215 0.000 0.500 0.500
#> GSM918640     3  0.6309      0.157 0.000 0.500 0.500
#> GSM918636     3  0.4178      0.731 0.000 0.172 0.828
#> GSM918590     2  0.0237      0.924 0.000 0.996 0.004
#> GSM918610     2  0.0000      0.925 0.000 1.000 0.000
#> GSM918615     2  0.0000      0.925 0.000 1.000 0.000
#> GSM918616     2  0.0592      0.921 0.000 0.988 0.012
#> GSM918632     2  0.0000      0.925 0.000 1.000 0.000
#> GSM918647     2  0.0000      0.925 0.000 1.000 0.000
#> GSM918578     2  0.0000      0.925 0.000 1.000 0.000
#> GSM918579     2  0.0000      0.925 0.000 1.000 0.000
#> GSM918581     2  0.0000      0.925 0.000 1.000 0.000
#> GSM918584     2  0.0000      0.925 0.000 1.000 0.000
#> GSM918591     2  0.0000      0.925 0.000 1.000 0.000
#> GSM918592     2  0.0000      0.925 0.000 1.000 0.000
#> GSM918597     2  0.0592      0.921 0.000 0.988 0.012
#> GSM918598     2  0.0000      0.925 0.000 1.000 0.000
#> GSM918599     2  0.0592      0.921 0.000 0.988 0.012
#> GSM918604     3  0.4974      0.726 0.000 0.236 0.764
#> GSM918605     2  0.0592      0.921 0.000 0.988 0.012
#> GSM918613     2  0.0000      0.925 0.000 1.000 0.000
#> GSM918623     2  0.0000      0.925 0.000 1.000 0.000
#> GSM918626     2  0.2625      0.858 0.000 0.916 0.084
#> GSM918627     2  0.0592      0.921 0.000 0.988 0.012
#> GSM918633     2  0.0000      0.925 0.000 1.000 0.000
#> GSM918634     2  0.0592      0.921 0.000 0.988 0.012
#> GSM918635     2  0.0000      0.925 0.000 1.000 0.000
#> GSM918645     2  0.0237      0.924 0.000 0.996 0.004
#> GSM918646     2  0.0000      0.925 0.000 1.000 0.000
#> GSM918648     2  0.0000      0.925 0.000 1.000 0.000
#> GSM918650     2  0.0000      0.925 0.000 1.000 0.000
#> GSM918652     2  0.0592      0.921 0.000 0.988 0.012
#> GSM918653     2  0.0000      0.925 0.000 1.000 0.000
#> GSM918622     2  0.0592      0.921 0.000 0.988 0.012
#> GSM918583     2  0.0000      0.925 0.000 1.000 0.000
#> GSM918585     2  0.0000      0.925 0.000 1.000 0.000
#> GSM918595     2  0.0000      0.925 0.000 1.000 0.000
#> GSM918596     2  0.2878      0.846 0.000 0.904 0.096
#> GSM918602     2  0.0592      0.921 0.000 0.988 0.012
#> GSM918617     2  0.0592      0.921 0.000 0.988 0.012
#> GSM918630     2  0.0000      0.925 0.000 1.000 0.000
#> GSM918631     2  0.0000      0.925 0.000 1.000 0.000
#> GSM918618     3  0.2772      0.724 0.004 0.080 0.916
#> GSM918644     3  0.3030      0.727 0.004 0.092 0.904

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette p1    p2    p3    p4
#> GSM918603     4  0.0000      1.000  0 0.000 0.000 1.000
#> GSM918641     4  0.0000      1.000  0 0.000 0.000 1.000
#> GSM918580     4  0.0000      1.000  0 0.000 0.000 1.000
#> GSM918593     4  0.0000      1.000  0 0.000 0.000 1.000
#> GSM918625     4  0.0000      1.000  0 0.000 0.000 1.000
#> GSM918638     4  0.0000      1.000  0 0.000 0.000 1.000
#> GSM918642     4  0.0000      1.000  0 0.000 0.000 1.000
#> GSM918643     4  0.0000      1.000  0 0.000 0.000 1.000
#> GSM918619     1  0.0000      1.000  1 0.000 0.000 0.000
#> GSM918621     1  0.0000      1.000  1 0.000 0.000 0.000
#> GSM918582     1  0.0000      1.000  1 0.000 0.000 0.000
#> GSM918649     1  0.0000      1.000  1 0.000 0.000 0.000
#> GSM918651     1  0.0000      1.000  1 0.000 0.000 0.000
#> GSM918607     1  0.0000      1.000  1 0.000 0.000 0.000
#> GSM918609     1  0.0000      1.000  1 0.000 0.000 0.000
#> GSM918608     1  0.0000      1.000  1 0.000 0.000 0.000
#> GSM918606     1  0.0000      1.000  1 0.000 0.000 0.000
#> GSM918620     1  0.0000      1.000  1 0.000 0.000 0.000
#> GSM918628     3  0.5147      0.251  0 0.004 0.536 0.460
#> GSM918586     3  0.0000      0.787  0 0.000 1.000 0.000
#> GSM918594     3  0.0000      0.787  0 0.000 1.000 0.000
#> GSM918600     3  0.0000      0.787  0 0.000 1.000 0.000
#> GSM918601     3  0.0000      0.787  0 0.000 1.000 0.000
#> GSM918612     3  0.0000      0.787  0 0.000 1.000 0.000
#> GSM918614     3  0.0000      0.787  0 0.000 1.000 0.000
#> GSM918629     3  0.0000      0.787  0 0.000 1.000 0.000
#> GSM918587     3  0.0336      0.786  0 0.008 0.992 0.000
#> GSM918588     3  0.0000      0.787  0 0.000 1.000 0.000
#> GSM918589     3  0.0000      0.787  0 0.000 1.000 0.000
#> GSM918611     3  0.0000      0.787  0 0.000 1.000 0.000
#> GSM918624     3  0.0000      0.787  0 0.000 1.000 0.000
#> GSM918637     3  0.0000      0.787  0 0.000 1.000 0.000
#> GSM918639     3  0.0000      0.787  0 0.000 1.000 0.000
#> GSM918640     3  0.0000      0.787  0 0.000 1.000 0.000
#> GSM918636     3  0.0188      0.787  0 0.004 0.996 0.000
#> GSM918590     2  0.5000     -0.242  0 0.500 0.500 0.000
#> GSM918610     2  0.0000      0.918  0 1.000 0.000 0.000
#> GSM918615     2  0.0000      0.918  0 1.000 0.000 0.000
#> GSM918616     3  0.4907      0.425  0 0.420 0.580 0.000
#> GSM918632     2  0.0000      0.918  0 1.000 0.000 0.000
#> GSM918647     2  0.0000      0.918  0 1.000 0.000 0.000
#> GSM918578     2  0.0000      0.918  0 1.000 0.000 0.000
#> GSM918579     2  0.0000      0.918  0 1.000 0.000 0.000
#> GSM918581     2  0.0000      0.918  0 1.000 0.000 0.000
#> GSM918584     2  0.0000      0.918  0 1.000 0.000 0.000
#> GSM918591     2  0.0000      0.918  0 1.000 0.000 0.000
#> GSM918592     2  0.0000      0.918  0 1.000 0.000 0.000
#> GSM918597     3  0.4907      0.425  0 0.420 0.580 0.000
#> GSM918598     2  0.0000      0.918  0 1.000 0.000 0.000
#> GSM918599     3  0.4916      0.416  0 0.424 0.576 0.000
#> GSM918604     3  0.0000      0.787  0 0.000 1.000 0.000
#> GSM918605     3  0.4916      0.416  0 0.424 0.576 0.000
#> GSM918613     2  0.0188      0.916  0 0.996 0.004 0.000
#> GSM918623     2  0.0000      0.918  0 1.000 0.000 0.000
#> GSM918626     3  0.4454      0.572  0 0.308 0.692 0.000
#> GSM918627     3  0.4907      0.425  0 0.420 0.580 0.000
#> GSM918633     2  0.0188      0.916  0 0.996 0.004 0.000
#> GSM918634     3  0.4907      0.425  0 0.420 0.580 0.000
#> GSM918635     2  0.0000      0.918  0 1.000 0.000 0.000
#> GSM918645     2  0.1716      0.865  0 0.936 0.064 0.000
#> GSM918646     2  0.2011      0.847  0 0.920 0.080 0.000
#> GSM918648     2  0.0000      0.918  0 1.000 0.000 0.000
#> GSM918650     2  0.0000      0.918  0 1.000 0.000 0.000
#> GSM918652     2  0.4999     -0.213  0 0.508 0.492 0.000
#> GSM918653     2  0.0000      0.918  0 1.000 0.000 0.000
#> GSM918622     3  0.4907      0.425  0 0.420 0.580 0.000
#> GSM918583     2  0.0000      0.918  0 1.000 0.000 0.000
#> GSM918585     2  0.0000      0.918  0 1.000 0.000 0.000
#> GSM918595     2  0.4830      0.139  0 0.608 0.392 0.000
#> GSM918596     3  0.0336      0.786  0 0.008 0.992 0.000
#> GSM918602     3  0.4907      0.425  0 0.420 0.580 0.000
#> GSM918617     3  0.4916      0.416  0 0.424 0.576 0.000
#> GSM918630     2  0.1867      0.856  0 0.928 0.072 0.000
#> GSM918631     2  0.1302      0.883  0 0.956 0.044 0.000
#> GSM918618     3  0.5143      0.262  0 0.004 0.540 0.456
#> GSM918644     3  0.0524      0.784  0 0.004 0.988 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
#> GSM918603     4  0.0000      0.920  0 0.000 0.000 1.000 0.000
#> GSM918641     4  0.0000      0.920  0 0.000 0.000 1.000 0.000
#> GSM918580     4  0.0000      0.920  0 0.000 0.000 1.000 0.000
#> GSM918593     4  0.0000      0.920  0 0.000 0.000 1.000 0.000
#> GSM918625     4  0.0000      0.920  0 0.000 0.000 1.000 0.000
#> GSM918638     4  0.0000      0.920  0 0.000 0.000 1.000 0.000
#> GSM918642     4  0.0000      0.920  0 0.000 0.000 1.000 0.000
#> GSM918643     4  0.0000      0.920  0 0.000 0.000 1.000 0.000
#> GSM918619     1  0.0000      1.000  1 0.000 0.000 0.000 0.000
#> GSM918621     1  0.0000      1.000  1 0.000 0.000 0.000 0.000
#> GSM918582     1  0.0000      1.000  1 0.000 0.000 0.000 0.000
#> GSM918649     1  0.0000      1.000  1 0.000 0.000 0.000 0.000
#> GSM918651     1  0.0000      1.000  1 0.000 0.000 0.000 0.000
#> GSM918607     1  0.0000      1.000  1 0.000 0.000 0.000 0.000
#> GSM918609     1  0.0000      1.000  1 0.000 0.000 0.000 0.000
#> GSM918608     1  0.0000      1.000  1 0.000 0.000 0.000 0.000
#> GSM918606     1  0.0000      1.000  1 0.000 0.000 0.000 0.000
#> GSM918620     1  0.0000      1.000  1 0.000 0.000 0.000 0.000
#> GSM918628     4  0.4275      0.598  0 0.000 0.020 0.696 0.284
#> GSM918586     3  0.0000      0.943  0 0.000 1.000 0.000 0.000
#> GSM918594     3  0.0000      0.943  0 0.000 1.000 0.000 0.000
#> GSM918600     3  0.0000      0.943  0 0.000 1.000 0.000 0.000
#> GSM918601     3  0.0000      0.943  0 0.000 1.000 0.000 0.000
#> GSM918612     3  0.0000      0.943  0 0.000 1.000 0.000 0.000
#> GSM918614     3  0.0000      0.943  0 0.000 1.000 0.000 0.000
#> GSM918629     5  0.0404      0.931  0 0.000 0.012 0.000 0.988
#> GSM918587     5  0.0000      0.941  0 0.000 0.000 0.000 1.000
#> GSM918588     3  0.0000      0.943  0 0.000 1.000 0.000 0.000
#> GSM918589     3  0.0000      0.943  0 0.000 1.000 0.000 0.000
#> GSM918611     3  0.0000      0.943  0 0.000 1.000 0.000 0.000
#> GSM918624     3  0.0000      0.943  0 0.000 1.000 0.000 0.000
#> GSM918637     3  0.0000      0.943  0 0.000 1.000 0.000 0.000
#> GSM918639     3  0.0000      0.943  0 0.000 1.000 0.000 0.000
#> GSM918640     3  0.0000      0.943  0 0.000 1.000 0.000 0.000
#> GSM918636     3  0.1341      0.894  0 0.000 0.944 0.000 0.056
#> GSM918590     5  0.0000      0.941  0 0.000 0.000 0.000 1.000
#> GSM918610     2  0.0162      0.949  0 0.996 0.000 0.000 0.004
#> GSM918615     2  0.0162      0.949  0 0.996 0.000 0.000 0.004
#> GSM918616     5  0.0000      0.941  0 0.000 0.000 0.000 1.000
#> GSM918632     2  0.0162      0.949  0 0.996 0.000 0.000 0.004
#> GSM918647     2  0.0000      0.949  0 1.000 0.000 0.000 0.000
#> GSM918578     2  0.0162      0.949  0 0.996 0.000 0.000 0.004
#> GSM918579     2  0.0000      0.949  0 1.000 0.000 0.000 0.000
#> GSM918581     2  0.0000      0.949  0 1.000 0.000 0.000 0.000
#> GSM918584     2  0.0000      0.949  0 1.000 0.000 0.000 0.000
#> GSM918591     2  0.0000      0.949  0 1.000 0.000 0.000 0.000
#> GSM918592     2  0.0000      0.949  0 1.000 0.000 0.000 0.000
#> GSM918597     5  0.0000      0.941  0 0.000 0.000 0.000 1.000
#> GSM918598     2  0.0703      0.936  0 0.976 0.000 0.000 0.024
#> GSM918599     5  0.0000      0.941  0 0.000 0.000 0.000 1.000
#> GSM918604     3  0.3796      0.572  0 0.000 0.700 0.000 0.300
#> GSM918605     5  0.3039      0.720  0 0.192 0.000 0.000 0.808
#> GSM918613     5  0.3999      0.460  0 0.344 0.000 0.000 0.656
#> GSM918623     2  0.0000      0.949  0 1.000 0.000 0.000 0.000
#> GSM918626     5  0.0000      0.941  0 0.000 0.000 0.000 1.000
#> GSM918627     5  0.0000      0.941  0 0.000 0.000 0.000 1.000
#> GSM918633     2  0.2605      0.810  0 0.852 0.000 0.000 0.148
#> GSM918634     5  0.0000      0.941  0 0.000 0.000 0.000 1.000
#> GSM918635     2  0.0000      0.949  0 1.000 0.000 0.000 0.000
#> GSM918645     2  0.0963      0.927  0 0.964 0.000 0.000 0.036
#> GSM918646     2  0.3039      0.755  0 0.808 0.000 0.000 0.192
#> GSM918648     2  0.0000      0.949  0 1.000 0.000 0.000 0.000
#> GSM918650     2  0.0162      0.949  0 0.996 0.000 0.000 0.004
#> GSM918652     2  0.4182      0.342  0 0.600 0.000 0.000 0.400
#> GSM918653     2  0.0000      0.949  0 1.000 0.000 0.000 0.000
#> GSM918622     5  0.0000      0.941  0 0.000 0.000 0.000 1.000
#> GSM918583     2  0.0000      0.949  0 1.000 0.000 0.000 0.000
#> GSM918585     2  0.0000      0.949  0 1.000 0.000 0.000 0.000
#> GSM918595     5  0.2020      0.841  0 0.100 0.000 0.000 0.900
#> GSM918596     5  0.0162      0.938  0 0.000 0.004 0.000 0.996
#> GSM918602     5  0.0000      0.941  0 0.000 0.000 0.000 1.000
#> GSM918617     5  0.0000      0.941  0 0.000 0.000 0.000 1.000
#> GSM918630     2  0.3039      0.754  0 0.808 0.000 0.000 0.192
#> GSM918631     2  0.0510      0.942  0 0.984 0.000 0.000 0.016
#> GSM918618     4  0.4338      0.603  0 0.000 0.024 0.696 0.280
#> GSM918644     3  0.5551      0.491  0 0.000 0.612 0.104 0.284

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>           class entropy silhouette    p1    p2    p3    p4    p5 p6
#> GSM918603     4  0.3868      0.844 0.000 0.000 0.000 0.504 0.000 NA
#> GSM918641     4  0.3867      0.841 0.000 0.000 0.000 0.512 0.000 NA
#> GSM918580     4  0.3868      0.844 0.000 0.000 0.000 0.504 0.000 NA
#> GSM918593     4  0.3868      0.844 0.000 0.000 0.000 0.504 0.000 NA
#> GSM918625     4  0.3868      0.844 0.000 0.000 0.000 0.504 0.000 NA
#> GSM918638     4  0.3868      0.844 0.000 0.000 0.000 0.504 0.000 NA
#> GSM918642     4  0.3868      0.844 0.000 0.000 0.000 0.504 0.000 NA
#> GSM918643     4  0.3868      0.844 0.000 0.000 0.000 0.504 0.000 NA
#> GSM918619     1  0.0000      0.999 1.000 0.000 0.000 0.000 0.000 NA
#> GSM918621     1  0.0000      0.999 1.000 0.000 0.000 0.000 0.000 NA
#> GSM918582     1  0.0000      0.999 1.000 0.000 0.000 0.000 0.000 NA
#> GSM918649     1  0.0260      0.992 0.992 0.000 0.000 0.008 0.000 NA
#> GSM918651     1  0.0000      0.999 1.000 0.000 0.000 0.000 0.000 NA
#> GSM918607     1  0.0000      0.999 1.000 0.000 0.000 0.000 0.000 NA
#> GSM918609     1  0.0000      0.999 1.000 0.000 0.000 0.000 0.000 NA
#> GSM918608     1  0.0000      0.999 1.000 0.000 0.000 0.000 0.000 NA
#> GSM918606     1  0.0000      0.999 1.000 0.000 0.000 0.000 0.000 NA
#> GSM918620     1  0.0000      0.999 1.000 0.000 0.000 0.000 0.000 NA
#> GSM918628     4  0.0881      0.576 0.000 0.000 0.008 0.972 0.012 NA
#> GSM918586     3  0.0000      0.989 0.000 0.000 1.000 0.000 0.000 NA
#> GSM918594     3  0.0000      0.989 0.000 0.000 1.000 0.000 0.000 NA
#> GSM918600     3  0.0000      0.989 0.000 0.000 1.000 0.000 0.000 NA
#> GSM918601     3  0.0000      0.989 0.000 0.000 1.000 0.000 0.000 NA
#> GSM918612     3  0.0000      0.989 0.000 0.000 1.000 0.000 0.000 NA
#> GSM918614     3  0.0000      0.989 0.000 0.000 1.000 0.000 0.000 NA
#> GSM918629     5  0.2288      0.807 0.000 0.000 0.116 0.004 0.876 NA
#> GSM918587     5  0.0520      0.904 0.000 0.000 0.000 0.008 0.984 NA
#> GSM918588     3  0.0000      0.989 0.000 0.000 1.000 0.000 0.000 NA
#> GSM918589     3  0.0000      0.989 0.000 0.000 1.000 0.000 0.000 NA
#> GSM918611     3  0.0000      0.989 0.000 0.000 1.000 0.000 0.000 NA
#> GSM918624     3  0.0000      0.989 0.000 0.000 1.000 0.000 0.000 NA
#> GSM918637     3  0.0000      0.989 0.000 0.000 1.000 0.000 0.000 NA
#> GSM918639     3  0.0000      0.989 0.000 0.000 1.000 0.000 0.000 NA
#> GSM918640     3  0.0000      0.989 0.000 0.000 1.000 0.000 0.000 NA
#> GSM918636     3  0.0508      0.975 0.000 0.000 0.984 0.000 0.012 NA
#> GSM918590     5  0.0603      0.901 0.000 0.000 0.000 0.004 0.980 NA
#> GSM918610     2  0.3756      0.752 0.000 0.600 0.000 0.000 0.000 NA
#> GSM918615     2  0.3756      0.752 0.000 0.600 0.000 0.000 0.000 NA
#> GSM918616     5  0.0000      0.909 0.000 0.000 0.000 0.000 1.000 NA
#> GSM918632     2  0.0713      0.782 0.000 0.972 0.000 0.000 0.000 NA
#> GSM918647     2  0.0000      0.783 0.000 1.000 0.000 0.000 0.000 NA
#> GSM918578     2  0.3756      0.752 0.000 0.600 0.000 0.000 0.000 NA
#> GSM918579     2  0.1610      0.752 0.000 0.916 0.000 0.000 0.000 NA
#> GSM918581     2  0.3330      0.772 0.000 0.716 0.000 0.000 0.000 NA
#> GSM918584     2  0.3672      0.758 0.000 0.632 0.000 0.000 0.000 NA
#> GSM918591     2  0.3684      0.755 0.000 0.628 0.000 0.000 0.000 NA
#> GSM918592     2  0.3684      0.755 0.000 0.628 0.000 0.000 0.000 NA
#> GSM918597     5  0.0000      0.909 0.000 0.000 0.000 0.000 1.000 NA
#> GSM918598     2  0.3907      0.749 0.000 0.588 0.000 0.000 0.004 NA
#> GSM918599     5  0.1714      0.842 0.000 0.092 0.000 0.000 0.908 NA
#> GSM918604     3  0.2771      0.858 0.000 0.000 0.868 0.060 0.068 NA
#> GSM918605     5  0.3139      0.760 0.000 0.028 0.000 0.000 0.812 NA
#> GSM918613     5  0.4468      0.168 0.000 0.408 0.000 0.000 0.560 NA
#> GSM918623     2  0.0458      0.779 0.000 0.984 0.000 0.000 0.000 NA
#> GSM918626     5  0.0000      0.909 0.000 0.000 0.000 0.000 1.000 NA
#> GSM918627     5  0.0000      0.909 0.000 0.000 0.000 0.000 1.000 NA
#> GSM918633     2  0.5000      0.723 0.000 0.580 0.000 0.000 0.088 NA
#> GSM918634     5  0.0000      0.909 0.000 0.000 0.000 0.000 1.000 NA
#> GSM918635     2  0.0000      0.783 0.000 1.000 0.000 0.000 0.000 NA
#> GSM918645     2  0.3717      0.759 0.000 0.616 0.000 0.000 0.000 NA
#> GSM918646     2  0.2452      0.733 0.000 0.884 0.000 0.004 0.084 NA
#> GSM918648     2  0.1610      0.752 0.000 0.916 0.000 0.000 0.000 NA
#> GSM918650     2  0.3747      0.753 0.000 0.604 0.000 0.000 0.000 NA
#> GSM918652     2  0.4237      0.359 0.000 0.660 0.000 0.004 0.308 NA
#> GSM918653     2  0.1610      0.752 0.000 0.916 0.000 0.000 0.000 NA
#> GSM918622     5  0.0000      0.909 0.000 0.000 0.000 0.000 1.000 NA
#> GSM918583     2  0.0260      0.783 0.000 0.992 0.000 0.000 0.000 NA
#> GSM918585     2  0.1610      0.752 0.000 0.916 0.000 0.000 0.000 NA
#> GSM918595     5  0.4589      0.625 0.000 0.208 0.000 0.052 0.712 NA
#> GSM918596     5  0.0146      0.907 0.000 0.000 0.000 0.000 0.996 NA
#> GSM918602     5  0.0000      0.909 0.000 0.000 0.000 0.000 1.000 NA
#> GSM918617     5  0.0000      0.909 0.000 0.000 0.000 0.000 1.000 NA
#> GSM918630     2  0.0858      0.782 0.000 0.968 0.000 0.000 0.004 NA
#> GSM918631     2  0.0713      0.782 0.000 0.972 0.000 0.000 0.000 NA
#> GSM918618     4  0.0820      0.576 0.000 0.000 0.016 0.972 0.012 NA
#> GSM918644     4  0.4242     -0.185 0.000 0.000 0.412 0.572 0.012 NA

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

consensus_heatmap(res, k = 2)

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

consensus_heatmap(res, k = 3)

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

consensus_heatmap(res, k = 4)

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

consensus_heatmap(res, k = 5)

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

consensus_heatmap(res, k = 6)

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

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

membership_heatmap(res, k = 2)

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

membership_heatmap(res, k = 3)

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

membership_heatmap(res, k = 4)

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

membership_heatmap(res, k = 5)

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

membership_heatmap(res, k = 6)

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

As soon as we have had the classes for columns, we can look for signatures which are significantly different between classes which can be candidate marks for certain classes. Following are the heatmaps for signatures.

Signature heatmaps where rows are scaled:

get_signatures(res, k = 2)

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

get_signatures(res, k = 3)

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

get_signatures(res, k = 4)

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

get_signatures(res, k = 5)

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

get_signatures(res, k = 6)

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

Signature heatmaps where rows are not scaled:

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

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

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

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

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

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

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

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

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

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

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk MAD-mclust-signature_compare

get_signature() returns a data frame invisibly. TO get the list of signatures, the function call should be assigned to a variable explicitly. In following code, if plot argument is set to FALSE, no heatmap is plotted while only the differential analysis is performed.

# code only for demonstration
tb = get_signature(res, k = ..., plot = FALSE)

An example of the output of tb is:

#>   which_row         fdr    mean_1    mean_2 scaled_mean_1 scaled_mean_2 km
#> 1        38 0.042760348  8.373488  9.131774    -0.5533452     0.5164555  1
#> 2        40 0.018707592  7.106213  8.469186    -0.6173731     0.5762149  1
#> 3        55 0.019134737 10.221463 11.207825    -0.6159697     0.5749050  1
#> 4        59 0.006059896  5.921854  7.869574    -0.6899429     0.6439467  1
#> 5        60 0.018055526  8.928898 10.211722    -0.6204761     0.5791110  1
#> 6        98 0.009384629 15.714769 14.887706     0.6635654    -0.6193277  2
...

The columns in tb are:

  1. which_row: row indices corresponding to the input matrix.
  2. fdr: FDR for the differential test.
  3. mean_x: The mean value in group x.
  4. scaled_mean_x: The mean value in group x after rows are scaled.
  5. km: Row groups if k-means clustering is applied to rows.

UMAP plot which shows how samples are separated.

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

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

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

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

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

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

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

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

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

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

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk MAD-mclust-collect-classes

Test correlation between subgroups and known annotations. If the known annotation is numeric, one-way ANOVA test is applied, and if the known annotation is discrete, chi-squared contingency table test is applied.

test_to_known_factors(res)
#>             n disease.state(p) gender(p) other(p) k
#> MAD:mclust 76         5.75e-15   0.00217 2.46e-05 2
#> MAD:mclust 69         2.40e-21   0.09627 1.44e-05 3
#> MAD:mclust 62         3.21e-30   0.00286 2.00e-05 4
#> MAD:mclust 73         5.50e-32   0.01633 3.49e-05 5
#> MAD:mclust 73         5.50e-32   0.01633 3.49e-05 6

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


MAD:NMF*

The object with results only for a single top-value method and a single partition method can be extracted as:

res = res_list["MAD", "NMF"]
# you can also extract it by
# res = res_list["MAD:NMF"]

A summary of res and all the functions that can be applied to it:

res
#> A 'ConsensusPartition' object with k = 2, 3, 4, 5, 6.
#>   On a matrix with 51941 rows and 76 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 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-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 1.000           0.981       0.992         0.5049 0.496   0.496
#> 3 3 0.960           0.900       0.963         0.3180 0.752   0.541
#> 4 4 0.921           0.915       0.961         0.0651 0.942   0.833
#> 5 5 0.835           0.807       0.901         0.0703 0.904   0.703
#> 6 6 0.739           0.664       0.808         0.0639 0.889   0.604

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

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

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

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

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

show/hide code output

cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#>           class entropy silhouette    p1    p2
#> GSM918603     1   0.000      1.000 1.000 0.000
#> GSM918641     1   0.000      1.000 1.000 0.000
#> GSM918580     1   0.000      1.000 1.000 0.000
#> GSM918593     1   0.000      1.000 1.000 0.000
#> GSM918625     1   0.000      1.000 1.000 0.000
#> GSM918638     1   0.000      1.000 1.000 0.000
#> GSM918642     1   0.000      1.000 1.000 0.000
#> GSM918643     1   0.000      1.000 1.000 0.000
#> GSM918619     1   0.000      1.000 1.000 0.000
#> GSM918621     1   0.000      1.000 1.000 0.000
#> GSM918582     1   0.000      1.000 1.000 0.000
#> GSM918649     1   0.000      1.000 1.000 0.000
#> GSM918651     1   0.000      1.000 1.000 0.000
#> GSM918607     1   0.000      1.000 1.000 0.000
#> GSM918609     1   0.000      1.000 1.000 0.000
#> GSM918608     1   0.000      1.000 1.000 0.000
#> GSM918606     1   0.000      1.000 1.000 0.000
#> GSM918620     1   0.000      1.000 1.000 0.000
#> GSM918628     1   0.000      1.000 1.000 0.000
#> GSM918586     1   0.000      1.000 1.000 0.000
#> GSM918594     1   0.000      1.000 1.000 0.000
#> GSM918600     1   0.000      1.000 1.000 0.000
#> GSM918601     1   0.000      1.000 1.000 0.000
#> GSM918612     1   0.000      1.000 1.000 0.000
#> GSM918614     1   0.000      1.000 1.000 0.000
#> GSM918629     2   0.000      0.985 0.000 1.000
#> GSM918587     2   0.653      0.801 0.168 0.832
#> GSM918588     1   0.000      1.000 1.000 0.000
#> GSM918589     1   0.000      1.000 1.000 0.000
#> GSM918611     1   0.000      1.000 1.000 0.000
#> GSM918624     1   0.000      1.000 1.000 0.000
#> GSM918637     2   0.939      0.462 0.356 0.644
#> GSM918639     1   0.000      1.000 1.000 0.000
#> GSM918640     1   0.000      1.000 1.000 0.000
#> GSM918636     1   0.000      1.000 1.000 0.000
#> GSM918590     2   0.000      0.985 0.000 1.000
#> GSM918610     2   0.000      0.985 0.000 1.000
#> GSM918615     2   0.000      0.985 0.000 1.000
#> GSM918616     2   0.000      0.985 0.000 1.000
#> GSM918632     2   0.000      0.985 0.000 1.000
#> GSM918647     2   0.000      0.985 0.000 1.000
#> GSM918578     2   0.000      0.985 0.000 1.000
#> GSM918579     2   0.000      0.985 0.000 1.000
#> GSM918581     2   0.000      0.985 0.000 1.000
#> GSM918584     2   0.000      0.985 0.000 1.000
#> GSM918591     2   0.000      0.985 0.000 1.000
#> GSM918592     2   0.000      0.985 0.000 1.000
#> GSM918597     2   0.000      0.985 0.000 1.000
#> GSM918598     2   0.000      0.985 0.000 1.000
#> GSM918599     2   0.000      0.985 0.000 1.000
#> GSM918604     1   0.000      1.000 1.000 0.000
#> GSM918605     2   0.000      0.985 0.000 1.000
#> GSM918613     2   0.000      0.985 0.000 1.000
#> GSM918623     2   0.000      0.985 0.000 1.000
#> GSM918626     2   0.000      0.985 0.000 1.000
#> GSM918627     2   0.000      0.985 0.000 1.000
#> GSM918633     2   0.000      0.985 0.000 1.000
#> GSM918634     2   0.000      0.985 0.000 1.000
#> GSM918635     2   0.000      0.985 0.000 1.000
#> GSM918645     2   0.000      0.985 0.000 1.000
#> GSM918646     2   0.000      0.985 0.000 1.000
#> GSM918648     2   0.000      0.985 0.000 1.000
#> GSM918650     2   0.000      0.985 0.000 1.000
#> GSM918652     2   0.000      0.985 0.000 1.000
#> GSM918653     2   0.000      0.985 0.000 1.000
#> GSM918622     2   0.000      0.985 0.000 1.000
#> GSM918583     2   0.000      0.985 0.000 1.000
#> GSM918585     2   0.000      0.985 0.000 1.000
#> GSM918595     2   0.000      0.985 0.000 1.000
#> GSM918596     2   0.430      0.898 0.088 0.912
#> GSM918602     2   0.000      0.985 0.000 1.000
#> GSM918617     2   0.000      0.985 0.000 1.000
#> GSM918630     2   0.000      0.985 0.000 1.000
#> GSM918631     2   0.000      0.985 0.000 1.000
#> GSM918618     1   0.000      1.000 1.000 0.000
#> GSM918644     1   0.000      1.000 1.000 0.000

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>           class entropy silhouette    p1    p2    p3
#> GSM918603     1  0.0000     0.9943 1.000 0.000 0.000
#> GSM918641     1  0.0000     0.9943 1.000 0.000 0.000
#> GSM918580     1  0.0000     0.9943 1.000 0.000 0.000
#> GSM918593     1  0.0000     0.9943 1.000 0.000 0.000
#> GSM918625     1  0.0000     0.9943 1.000 0.000 0.000
#> GSM918638     1  0.0000     0.9943 1.000 0.000 0.000
#> GSM918642     1  0.0000     0.9943 1.000 0.000 0.000
#> GSM918643     1  0.0000     0.9943 1.000 0.000 0.000
#> GSM918619     1  0.0000     0.9943 1.000 0.000 0.000
#> GSM918621     1  0.0000     0.9943 1.000 0.000 0.000
#> GSM918582     1  0.0000     0.9943 1.000 0.000 0.000
#> GSM918649     1  0.0000     0.9943 1.000 0.000 0.000
#> GSM918651     1  0.0000     0.9943 1.000 0.000 0.000
#> GSM918607     1  0.0000     0.9943 1.000 0.000 0.000
#> GSM918609     1  0.0000     0.9943 1.000 0.000 0.000
#> GSM918608     1  0.0000     0.9943 1.000 0.000 0.000
#> GSM918606     1  0.0000     0.9943 1.000 0.000 0.000
#> GSM918620     1  0.0000     0.9943 1.000 0.000 0.000
#> GSM918628     1  0.0000     0.9943 1.000 0.000 0.000
#> GSM918586     3  0.0000     0.9618 0.000 0.000 1.000
#> GSM918594     3  0.0000     0.9618 0.000 0.000 1.000
#> GSM918600     3  0.0000     0.9618 0.000 0.000 1.000
#> GSM918601     3  0.0000     0.9618 0.000 0.000 1.000
#> GSM918612     3  0.0000     0.9618 0.000 0.000 1.000
#> GSM918614     3  0.0000     0.9618 0.000 0.000 1.000
#> GSM918629     3  0.0000     0.9618 0.000 0.000 1.000
#> GSM918587     3  0.0592     0.9531 0.000 0.012 0.988
#> GSM918588     3  0.0000     0.9618 0.000 0.000 1.000
#> GSM918589     3  0.0000     0.9618 0.000 0.000 1.000
#> GSM918611     3  0.0000     0.9618 0.000 0.000 1.000
#> GSM918624     3  0.0000     0.9618 0.000 0.000 1.000
#> GSM918637     3  0.0000     0.9618 0.000 0.000 1.000
#> GSM918639     3  0.0000     0.9618 0.000 0.000 1.000
#> GSM918640     3  0.0000     0.9618 0.000 0.000 1.000
#> GSM918636     3  0.0000     0.9618 0.000 0.000 1.000
#> GSM918590     2  0.0000     0.9352 0.000 1.000 0.000
#> GSM918610     2  0.0000     0.9352 0.000 1.000 0.000
#> GSM918615     2  0.0000     0.9352 0.000 1.000 0.000
#> GSM918616     3  0.0000     0.9618 0.000 0.000 1.000
#> GSM918632     2  0.0000     0.9352 0.000 1.000 0.000
#> GSM918647     2  0.0000     0.9352 0.000 1.000 0.000
#> GSM918578     2  0.0000     0.9352 0.000 1.000 0.000
#> GSM918579     2  0.0000     0.9352 0.000 1.000 0.000
#> GSM918581     2  0.0000     0.9352 0.000 1.000 0.000
#> GSM918584     2  0.0000     0.9352 0.000 1.000 0.000
#> GSM918591     2  0.0000     0.9352 0.000 1.000 0.000
#> GSM918592     2  0.0000     0.9352 0.000 1.000 0.000
#> GSM918597     3  0.2878     0.8714 0.000 0.096 0.904
#> GSM918598     2  0.0000     0.9352 0.000 1.000 0.000
#> GSM918599     2  0.6309     0.0580 0.000 0.504 0.496
#> GSM918604     3  0.0000     0.9618 0.000 0.000 1.000
#> GSM918605     2  0.1163     0.9116 0.000 0.972 0.028
#> GSM918613     2  0.0000     0.9352 0.000 1.000 0.000
#> GSM918623     2  0.0000     0.9352 0.000 1.000 0.000
#> GSM918626     2  0.6309     0.0288 0.000 0.500 0.500
#> GSM918627     2  0.6274     0.1541 0.000 0.544 0.456
#> GSM918633     2  0.0000     0.9352 0.000 1.000 0.000
#> GSM918634     3  0.0747     0.9500 0.000 0.016 0.984
#> GSM918635     2  0.0000     0.9352 0.000 1.000 0.000
#> GSM918645     2  0.0000     0.9352 0.000 1.000 0.000
#> GSM918646     2  0.0000     0.9352 0.000 1.000 0.000
#> GSM918648     2  0.0000     0.9352 0.000 1.000 0.000
#> GSM918650     2  0.0000     0.9352 0.000 1.000 0.000
#> GSM918652     2  0.0000     0.9352 0.000 1.000 0.000
#> GSM918653     2  0.0000     0.9352 0.000 1.000 0.000
#> GSM918622     3  0.6260     0.1445 0.000 0.448 0.552
#> GSM918583     2  0.0000     0.9352 0.000 1.000 0.000
#> GSM918585     2  0.0000     0.9352 0.000 1.000 0.000
#> GSM918595     2  0.0237     0.9320 0.000 0.996 0.004
#> GSM918596     3  0.0000     0.9618 0.000 0.000 1.000
#> GSM918602     3  0.4555     0.7331 0.000 0.200 0.800
#> GSM918617     2  0.6192     0.2949 0.000 0.580 0.420
#> GSM918630     2  0.0000     0.9352 0.000 1.000 0.000
#> GSM918631     2  0.0000     0.9352 0.000 1.000 0.000
#> GSM918618     1  0.1031     0.9732 0.976 0.000 0.024
#> GSM918644     1  0.2711     0.9035 0.912 0.000 0.088

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM918603     4  0.0000      0.987 0.000 0.000 0.000 1.000
#> GSM918641     4  0.0000      0.987 0.000 0.000 0.000 1.000
#> GSM918580     4  0.0000      0.987 0.000 0.000 0.000 1.000
#> GSM918593     4  0.0000      0.987 0.000 0.000 0.000 1.000
#> GSM918625     4  0.0000      0.987 0.000 0.000 0.000 1.000
#> GSM918638     4  0.0000      0.987 0.000 0.000 0.000 1.000
#> GSM918642     4  0.0000      0.987 0.000 0.000 0.000 1.000
#> GSM918643     4  0.0000      0.987 0.000 0.000 0.000 1.000
#> GSM918619     1  0.0592      0.977 0.984 0.000 0.000 0.016
#> GSM918621     1  0.0592      0.977 0.984 0.000 0.000 0.016
#> GSM918582     1  0.1022      0.976 0.968 0.000 0.000 0.032
#> GSM918649     1  0.2647      0.891 0.880 0.000 0.000 0.120
#> GSM918651     1  0.1211      0.973 0.960 0.000 0.000 0.040
#> GSM918607     1  0.1022      0.976 0.968 0.000 0.000 0.032
#> GSM918609     1  0.0592      0.977 0.984 0.000 0.000 0.016
#> GSM918608     1  0.0707      0.977 0.980 0.000 0.000 0.020
#> GSM918606     1  0.0592      0.977 0.984 0.000 0.000 0.016
#> GSM918620     1  0.1474      0.964 0.948 0.000 0.000 0.052
#> GSM918628     4  0.2704      0.851 0.124 0.000 0.000 0.876
#> GSM918586     3  0.0000      0.955 0.000 0.000 1.000 0.000
#> GSM918594     3  0.0336      0.953 0.008 0.000 0.992 0.000
#> GSM918600     3  0.0469      0.952 0.012 0.000 0.988 0.000
#> GSM918601     3  0.0000      0.955 0.000 0.000 1.000 0.000
#> GSM918612     3  0.0592      0.950 0.016 0.000 0.984 0.000
#> GSM918614     3  0.0000      0.955 0.000 0.000 1.000 0.000
#> GSM918629     3  0.0000      0.955 0.000 0.000 1.000 0.000
#> GSM918587     3  0.2546      0.870 0.000 0.092 0.900 0.008
#> GSM918588     3  0.0000      0.955 0.000 0.000 1.000 0.000
#> GSM918589     3  0.0000      0.955 0.000 0.000 1.000 0.000
#> GSM918611     3  0.0000      0.955 0.000 0.000 1.000 0.000
#> GSM918624     3  0.0000      0.955 0.000 0.000 1.000 0.000
#> GSM918637     3  0.0000      0.955 0.000 0.000 1.000 0.000
#> GSM918639     3  0.0000      0.955 0.000 0.000 1.000 0.000
#> GSM918640     3  0.0000      0.955 0.000 0.000 1.000 0.000
#> GSM918636     3  0.0592      0.946 0.000 0.000 0.984 0.016
#> GSM918590     2  0.0000      0.942 0.000 1.000 0.000 0.000
#> GSM918610     2  0.0000      0.942 0.000 1.000 0.000 0.000
#> GSM918615     2  0.0000      0.942 0.000 1.000 0.000 0.000
#> GSM918616     3  0.0000      0.955 0.000 0.000 1.000 0.000
#> GSM918632     2  0.0000      0.942 0.000 1.000 0.000 0.000
#> GSM918647     2  0.0000      0.942 0.000 1.000 0.000 0.000
#> GSM918578     2  0.0592      0.931 0.016 0.984 0.000 0.000
#> GSM918579     2  0.0000      0.942 0.000 1.000 0.000 0.000
#> GSM918581     2  0.0000      0.942 0.000 1.000 0.000 0.000
#> GSM918584     2  0.0000      0.942 0.000 1.000 0.000 0.000
#> GSM918591     2  0.0000      0.942 0.000 1.000 0.000 0.000
#> GSM918592     2  0.0000      0.942 0.000 1.000 0.000 0.000
#> GSM918597     3  0.0921      0.945 0.028 0.000 0.972 0.000
#> GSM918598     2  0.2704      0.837 0.124 0.876 0.000 0.000
#> GSM918599     2  0.4888      0.312 0.000 0.588 0.412 0.000
#> GSM918604     3  0.3764      0.747 0.216 0.000 0.784 0.000
#> GSM918605     2  0.1211      0.909 0.000 0.960 0.040 0.000
#> GSM918613     2  0.0000      0.942 0.000 1.000 0.000 0.000
#> GSM918623     2  0.0000      0.942 0.000 1.000 0.000 0.000
#> GSM918626     2  0.4972      0.177 0.000 0.544 0.456 0.000
#> GSM918627     3  0.3610      0.749 0.000 0.200 0.800 0.000
#> GSM918633     2  0.0000      0.942 0.000 1.000 0.000 0.000
#> GSM918634     3  0.0524      0.952 0.008 0.004 0.988 0.000
#> GSM918635     2  0.0000      0.942 0.000 1.000 0.000 0.000
#> GSM918645     2  0.0000      0.942 0.000 1.000 0.000 0.000
#> GSM918646     2  0.0000      0.942 0.000 1.000 0.000 0.000
#> GSM918648     2  0.0000      0.942 0.000 1.000 0.000 0.000
#> GSM918650     2  0.0000      0.942 0.000 1.000 0.000 0.000
#> GSM918652     2  0.0000      0.942 0.000 1.000 0.000 0.000
#> GSM918653     2  0.0000      0.942 0.000 1.000 0.000 0.000
#> GSM918622     3  0.4535      0.684 0.016 0.240 0.744 0.000
#> GSM918583     2  0.0000      0.942 0.000 1.000 0.000 0.000
#> GSM918585     2  0.0000      0.942 0.000 1.000 0.000 0.000
#> GSM918595     2  0.3400      0.771 0.180 0.820 0.000 0.000
#> GSM918596     3  0.0336      0.953 0.008 0.000 0.992 0.000
#> GSM918602     3  0.2142      0.908 0.016 0.056 0.928 0.000
#> GSM918617     2  0.4500      0.542 0.000 0.684 0.316 0.000
#> GSM918630     2  0.0000      0.942 0.000 1.000 0.000 0.000
#> GSM918631     2  0.0000      0.942 0.000 1.000 0.000 0.000
#> GSM918618     4  0.0000      0.987 0.000 0.000 0.000 1.000
#> GSM918644     4  0.0000      0.987 0.000 0.000 0.000 1.000

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>           class entropy silhouette    p1    p2    p3    p4    p5
#> GSM918603     4  0.0000      1.000 0.000 0.000 0.000 1.000 0.000
#> GSM918641     4  0.0000      1.000 0.000 0.000 0.000 1.000 0.000
#> GSM918580     4  0.0000      1.000 0.000 0.000 0.000 1.000 0.000
#> GSM918593     4  0.0000      1.000 0.000 0.000 0.000 1.000 0.000
#> GSM918625     4  0.0000      1.000 0.000 0.000 0.000 1.000 0.000
#> GSM918638     4  0.0000      1.000 0.000 0.000 0.000 1.000 0.000
#> GSM918642     4  0.0000      1.000 0.000 0.000 0.000 1.000 0.000
#> GSM918643     4  0.0000      1.000 0.000 0.000 0.000 1.000 0.000
#> GSM918619     1  0.0000      0.992 1.000 0.000 0.000 0.000 0.000
#> GSM918621     1  0.0000      0.992 1.000 0.000 0.000 0.000 0.000
#> GSM918582     1  0.0162      0.991 0.996 0.000 0.000 0.000 0.004
#> GSM918649     1  0.0162      0.991 0.996 0.000 0.000 0.000 0.004
#> GSM918651     1  0.0162      0.991 0.996 0.000 0.000 0.000 0.004
#> GSM918607     1  0.0000      0.992 1.000 0.000 0.000 0.000 0.000
#> GSM918609     1  0.0000      0.992 1.000 0.000 0.000 0.000 0.000
#> GSM918608     1  0.0000      0.992 1.000 0.000 0.000 0.000 0.000
#> GSM918606     1  0.0000      0.992 1.000 0.000 0.000 0.000 0.000
#> GSM918620     1  0.0162      0.991 0.996 0.000 0.000 0.000 0.004
#> GSM918628     1  0.1934      0.931 0.932 0.040 0.000 0.020 0.008
#> GSM918586     3  0.0404      0.881 0.000 0.000 0.988 0.000 0.012
#> GSM918594     3  0.0290      0.881 0.000 0.000 0.992 0.000 0.008
#> GSM918600     3  0.0404      0.881 0.000 0.000 0.988 0.000 0.012
#> GSM918601     3  0.0404      0.881 0.000 0.000 0.988 0.000 0.012
#> GSM918612     3  0.0404      0.881 0.000 0.000 0.988 0.000 0.012
#> GSM918614     3  0.0162      0.882 0.000 0.000 0.996 0.000 0.004
#> GSM918629     3  0.0162      0.882 0.000 0.000 0.996 0.000 0.004
#> GSM918587     3  0.6996      0.233 0.000 0.044 0.512 0.292 0.152
#> GSM918588     3  0.0290      0.881 0.000 0.000 0.992 0.000 0.008
#> GSM918589     3  0.0290      0.881 0.000 0.000 0.992 0.000 0.008
#> GSM918611     3  0.0000      0.882 0.000 0.000 1.000 0.000 0.000
#> GSM918624     3  0.0404      0.881 0.000 0.000 0.988 0.000 0.012
#> GSM918637     3  0.0404      0.881 0.000 0.000 0.988 0.000 0.012
#> GSM918639     3  0.0404      0.881 0.000 0.000 0.988 0.000 0.012
#> GSM918640     3  0.0404      0.881 0.000 0.000 0.988 0.000 0.012
#> GSM918636     3  0.0162      0.882 0.000 0.000 0.996 0.000 0.004
#> GSM918590     2  0.3876      0.654 0.000 0.684 0.000 0.000 0.316
#> GSM918610     2  0.4088      0.590 0.000 0.632 0.000 0.000 0.368
#> GSM918615     2  0.3395      0.711 0.000 0.764 0.000 0.000 0.236
#> GSM918616     3  0.0510      0.881 0.000 0.000 0.984 0.000 0.016
#> GSM918632     2  0.2732      0.795 0.000 0.840 0.000 0.000 0.160
#> GSM918647     2  0.2471      0.805 0.000 0.864 0.000 0.000 0.136
#> GSM918578     5  0.4256     -0.186 0.000 0.436 0.000 0.000 0.564
#> GSM918579     2  0.0000      0.816 0.000 1.000 0.000 0.000 0.000
#> GSM918581     2  0.3752      0.702 0.000 0.708 0.000 0.000 0.292
#> GSM918584     2  0.1043      0.819 0.000 0.960 0.000 0.000 0.040
#> GSM918591     2  0.4060      0.604 0.000 0.640 0.000 0.000 0.360
#> GSM918592     2  0.4045      0.611 0.000 0.644 0.000 0.000 0.356
#> GSM918597     3  0.0963      0.870 0.000 0.000 0.964 0.000 0.036
#> GSM918598     5  0.1197      0.697 0.000 0.048 0.000 0.000 0.952
#> GSM918599     3  0.4641      0.250 0.000 0.456 0.532 0.000 0.012
#> GSM918604     3  0.2270      0.822 0.076 0.000 0.904 0.000 0.020
#> GSM918605     2  0.3401      0.736 0.000 0.840 0.064 0.000 0.096
#> GSM918613     2  0.1270      0.820 0.000 0.948 0.000 0.000 0.052
#> GSM918623     2  0.2732      0.795 0.000 0.840 0.000 0.000 0.160
#> GSM918626     3  0.3563      0.671 0.000 0.208 0.780 0.000 0.012
#> GSM918627     3  0.2233      0.788 0.000 0.104 0.892 0.000 0.004
#> GSM918633     2  0.3336      0.765 0.000 0.772 0.000 0.000 0.228
#> GSM918634     3  0.1012      0.874 0.000 0.012 0.968 0.000 0.020
#> GSM918635     2  0.2891      0.788 0.000 0.824 0.000 0.000 0.176
#> GSM918645     2  0.0963      0.818 0.000 0.964 0.000 0.000 0.036
#> GSM918646     2  0.0162      0.818 0.000 0.996 0.000 0.000 0.004
#> GSM918648     2  0.2230      0.811 0.000 0.884 0.000 0.000 0.116
#> GSM918650     2  0.3480      0.744 0.000 0.752 0.000 0.000 0.248
#> GSM918652     2  0.0324      0.810 0.000 0.992 0.004 0.000 0.004
#> GSM918653     2  0.0000      0.816 0.000 1.000 0.000 0.000 0.000
#> GSM918622     3  0.6615     -0.210 0.000 0.220 0.424 0.000 0.356
#> GSM918583     2  0.0000      0.816 0.000 1.000 0.000 0.000 0.000
#> GSM918585     2  0.0162      0.818 0.000 0.996 0.000 0.000 0.004
#> GSM918595     5  0.0865      0.694 0.004 0.024 0.000 0.000 0.972
#> GSM918596     3  0.0609      0.880 0.000 0.000 0.980 0.000 0.020
#> GSM918602     5  0.3877      0.560 0.000 0.024 0.212 0.000 0.764
#> GSM918617     3  0.4597      0.326 0.000 0.424 0.564 0.000 0.012
#> GSM918630     2  0.0000      0.816 0.000 1.000 0.000 0.000 0.000
#> GSM918631     2  0.0000      0.816 0.000 1.000 0.000 0.000 0.000
#> GSM918618     4  0.0000      1.000 0.000 0.000 0.000 1.000 0.000
#> GSM918644     4  0.0000      1.000 0.000 0.000 0.000 1.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
#> GSM918603     4  0.0000     0.9790 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM918641     4  0.0000     0.9790 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM918580     4  0.0000     0.9790 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM918593     4  0.0000     0.9790 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM918625     4  0.0000     0.9790 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM918638     4  0.0000     0.9790 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM918642     4  0.0000     0.9790 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM918643     4  0.0000     0.9790 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM918619     1  0.0000     0.9729 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM918621     1  0.0000     0.9729 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM918582     1  0.0000     0.9729 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM918649     1  0.0000     0.9729 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM918651     1  0.0000     0.9729 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM918607     1  0.0000     0.9729 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM918609     1  0.0146     0.9695 0.996 0.000 0.004 0.000 0.000 0.000
#> GSM918608     1  0.0000     0.9729 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM918606     1  0.0000     0.9729 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM918620     1  0.0000     0.9729 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM918628     1  0.5233     0.6792 0.720 0.032 0.004 0.024 0.136 0.084
#> GSM918586     3  0.0767     0.7394 0.000 0.004 0.976 0.000 0.008 0.012
#> GSM918594     3  0.1575     0.7466 0.000 0.000 0.936 0.000 0.032 0.032
#> GSM918600     3  0.0291     0.7465 0.000 0.000 0.992 0.000 0.004 0.004
#> GSM918601     3  0.4462     0.6707 0.000 0.000 0.712 0.000 0.152 0.136
#> GSM918612     3  0.1285     0.7469 0.000 0.000 0.944 0.000 0.004 0.052
#> GSM918614     3  0.0146     0.7478 0.000 0.000 0.996 0.000 0.000 0.004
#> GSM918629     3  0.0146     0.7478 0.000 0.000 0.996 0.000 0.000 0.004
#> GSM918587     3  0.8121    -0.3248 0.000 0.032 0.300 0.292 0.160 0.216
#> GSM918588     3  0.0405     0.7477 0.000 0.000 0.988 0.000 0.008 0.004
#> GSM918589     3  0.0725     0.7430 0.000 0.000 0.976 0.000 0.012 0.012
#> GSM918611     3  0.0777     0.7497 0.000 0.000 0.972 0.000 0.004 0.024
#> GSM918624     3  0.4563     0.6629 0.000 0.000 0.700 0.000 0.164 0.136
#> GSM918637     3  0.4626     0.6570 0.000 0.000 0.692 0.000 0.172 0.136
#> GSM918639     3  0.4462     0.6707 0.000 0.000 0.712 0.000 0.152 0.136
#> GSM918640     3  0.4462     0.6707 0.000 0.000 0.712 0.000 0.152 0.136
#> GSM918636     3  0.0725     0.7490 0.000 0.000 0.976 0.000 0.012 0.012
#> GSM918590     5  0.5184     0.4654 0.000 0.296 0.000 0.000 0.584 0.120
#> GSM918610     2  0.1471     0.6640 0.000 0.932 0.000 0.000 0.004 0.064
#> GSM918615     5  0.4788     0.5154 0.000 0.396 0.000 0.000 0.548 0.056
#> GSM918616     3  0.4728     0.6460 0.000 0.000 0.680 0.000 0.176 0.144
#> GSM918632     2  0.2165     0.7141 0.000 0.884 0.000 0.000 0.108 0.008
#> GSM918647     2  0.2513     0.6906 0.000 0.852 0.000 0.000 0.140 0.008
#> GSM918578     2  0.2597     0.4286 0.000 0.824 0.000 0.000 0.000 0.176
#> GSM918579     5  0.3592     0.6308 0.000 0.344 0.000 0.000 0.656 0.000
#> GSM918581     2  0.0520     0.6988 0.000 0.984 0.000 0.000 0.008 0.008
#> GSM918584     5  0.3446     0.6727 0.000 0.308 0.000 0.000 0.692 0.000
#> GSM918591     2  0.1411     0.6664 0.000 0.936 0.000 0.000 0.004 0.060
#> GSM918592     2  0.0547     0.6845 0.000 0.980 0.000 0.000 0.000 0.020
#> GSM918597     3  0.0436     0.7484 0.000 0.004 0.988 0.000 0.004 0.004
#> GSM918598     2  0.3854    -0.3006 0.000 0.536 0.000 0.000 0.000 0.464
#> GSM918599     5  0.4302     0.4071 0.000 0.020 0.144 0.000 0.756 0.080
#> GSM918604     3  0.1007     0.7332 0.016 0.004 0.968 0.000 0.008 0.004
#> GSM918605     5  0.4490     0.5678 0.000 0.148 0.004 0.000 0.720 0.128
#> GSM918613     5  0.3819     0.5983 0.000 0.372 0.000 0.000 0.624 0.004
#> GSM918623     2  0.2170     0.7179 0.000 0.888 0.000 0.000 0.100 0.012
#> GSM918626     3  0.6788     0.1338 0.000 0.108 0.428 0.000 0.352 0.112
#> GSM918627     3  0.5972     0.3143 0.000 0.112 0.572 0.000 0.264 0.052
#> GSM918633     2  0.2687     0.7135 0.000 0.872 0.024 0.000 0.092 0.012
#> GSM918634     5  0.5413     0.0966 0.000 0.000 0.228 0.000 0.580 0.192
#> GSM918635     2  0.1802     0.7260 0.000 0.916 0.000 0.000 0.072 0.012
#> GSM918645     5  0.3351     0.6796 0.000 0.288 0.000 0.000 0.712 0.000
#> GSM918646     2  0.3996    -0.2681 0.000 0.512 0.000 0.000 0.484 0.004
#> GSM918648     2  0.2768     0.6702 0.000 0.832 0.000 0.000 0.156 0.012
#> GSM918650     2  0.3784     0.3132 0.000 0.680 0.000 0.000 0.308 0.012
#> GSM918652     5  0.2738     0.6571 0.000 0.176 0.000 0.000 0.820 0.004
#> GSM918653     5  0.3756     0.5303 0.000 0.400 0.000 0.000 0.600 0.000
#> GSM918622     6  0.7299     0.4587 0.000 0.228 0.308 0.000 0.108 0.356
#> GSM918583     5  0.3446     0.6727 0.000 0.308 0.000 0.000 0.692 0.000
#> GSM918585     2  0.3915     0.0314 0.000 0.584 0.000 0.000 0.412 0.004
#> GSM918595     6  0.3076     0.5025 0.000 0.240 0.000 0.000 0.000 0.760
#> GSM918596     3  0.5575     0.3320 0.000 0.000 0.460 0.000 0.400 0.140
#> GSM918602     6  0.5814     0.6148 0.000 0.280 0.200 0.000 0.004 0.516
#> GSM918617     5  0.2592     0.5248 0.000 0.016 0.116 0.000 0.864 0.004
#> GSM918630     5  0.3371     0.6790 0.000 0.292 0.000 0.000 0.708 0.000
#> GSM918631     5  0.3428     0.6745 0.000 0.304 0.000 0.000 0.696 0.000
#> GSM918618     4  0.3384     0.7988 0.000 0.000 0.000 0.812 0.120 0.068
#> GSM918644     4  0.0260     0.9733 0.000 0.000 0.000 0.992 0.000 0.008

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

consensus_heatmap(res, k = 2)

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

consensus_heatmap(res, k = 3)

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

consensus_heatmap(res, k = 4)

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

consensus_heatmap(res, k = 5)

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

consensus_heatmap(res, k = 6)

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

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

membership_heatmap(res, k = 2)

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

membership_heatmap(res, k = 3)

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

membership_heatmap(res, k = 4)

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

membership_heatmap(res, k = 5)

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

membership_heatmap(res, k = 6)

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

As soon as we have had the classes for columns, we can look for signatures which are significantly different between classes which can be candidate marks for certain classes. Following are the heatmaps for signatures.

Signature heatmaps where rows are scaled:

get_signatures(res, k = 2)

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

get_signatures(res, k = 3)

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

get_signatures(res, k = 4)

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

get_signatures(res, k = 5)

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

get_signatures(res, k = 6)

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

Signature heatmaps where rows are not scaled:

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

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

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

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

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

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

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

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

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

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

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk MAD-NMF-signature_compare

get_signature() returns a data frame invisibly. TO get the list of signatures, the function call should be assigned to a variable explicitly. In following code, if plot argument is set to FALSE, no heatmap is plotted while only the differential analysis is performed.

# code only for demonstration
tb = get_signature(res, k = ..., plot = FALSE)

An example of the output of tb is:

#>   which_row         fdr    mean_1    mean_2 scaled_mean_1 scaled_mean_2 km
#> 1        38 0.042760348  8.373488  9.131774    -0.5533452     0.5164555  1
#> 2        40 0.018707592  7.106213  8.469186    -0.6173731     0.5762149  1
#> 3        55 0.019134737 10.221463 11.207825    -0.6159697     0.5749050  1
#> 4        59 0.006059896  5.921854  7.869574    -0.6899429     0.6439467  1
#> 5        60 0.018055526  8.928898 10.211722    -0.6204761     0.5791110  1
#> 6        98 0.009384629 15.714769 14.887706     0.6635654    -0.6193277  2
...

The columns in tb are:

  1. which_row: row indices corresponding to the input matrix.
  2. fdr: FDR for the differential test.
  3. mean_x: The mean value in group x.
  4. scaled_mean_x: The mean value in group x after rows are scaled.
  5. km: Row groups if k-means clustering is applied to rows.

UMAP plot which shows how samples are separated.

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

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

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

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

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

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

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

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

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

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

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk MAD-NMF-collect-classes

Test correlation between subgroups and known annotations. If the known annotation is numeric, one-way ANOVA test is applied, and if the known annotation is discrete, chi-squared contingency table test is applied.

test_to_known_factors(res)
#>          n disease.state(p) gender(p) other(p) k
#> MAD:NMF 75         1.71e-12  0.256226 8.49e-03 2
#> MAD:NMF 71         1.04e-19  0.001949 2.19e-04 3
#> MAD:NMF 74         1.07e-31  0.011120 3.15e-07 4
#> MAD:NMF 71         6.99e-28  0.001099 1.46e-07 5
#> MAD:NMF 63         4.98e-24  0.000347 2.92e-06 6

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


ATC:hclust

The object with results only for a single top-value method and a single partition method can be extracted as:

res = res_list["ATC", "hclust"]
# you can also extract it by
# res = res_list["ATC:hclust"]

A summary of res and all the functions that can be applied to it:

res
#> A 'ConsensusPartition' object with k = 2, 3, 4, 5, 6.
#>   On a matrix with 51941 rows and 76 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 2.
#> 
#> Following methods can be applied to this 'ConsensusPartition' object:
#>  [1] "cola_report"             "collect_classes"         "collect_plots"          
#>  [4] "collect_stats"           "colnames"                "compare_signatures"     
#>  [7] "consensus_heatmap"       "dimension_reduction"     "functional_enrichment"  
#> [10] "get_anno_col"            "get_anno"                "get_classes"            
#> [13] "get_consensus"           "get_matrix"              "get_membership"         
#> [16] "get_param"               "get_signatures"          "get_stats"              
#> [19] "is_best_k"               "is_stable_k"             "membership_heatmap"     
#> [22] "ncol"                    "nrow"                    "plot_ecdf"              
#> [25] "rownames"                "select_partition_number" "show"                   
#> [28] "suggest_best_k"          "test_to_known_factors"

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

collect_plots(res)

plot of chunk ATC-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.805           0.947       0.969         0.3878 0.595   0.595
#> 3 3 0.687           0.867       0.918         0.2477 0.962   0.936
#> 4 4 0.611           0.700       0.830         0.4235 0.745   0.543
#> 5 5 0.644           0.694       0.775         0.0971 0.904   0.686
#> 6 6 0.735           0.678       0.824         0.0437 0.962   0.834

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
#> GSM918603     2  0.0000      0.986 0.000 1.000
#> GSM918641     2  0.0000      0.986 0.000 1.000
#> GSM918580     1  0.0000      0.912 1.000 0.000
#> GSM918593     2  0.0000      0.986 0.000 1.000
#> GSM918625     2  0.1633      0.970 0.024 0.976
#> GSM918638     2  0.1633      0.970 0.024 0.976
#> GSM918642     2  0.0000      0.986 0.000 1.000
#> GSM918643     2  0.0000      0.986 0.000 1.000
#> GSM918619     2  0.0376      0.984 0.004 0.996
#> GSM918621     2  0.0000      0.986 0.000 1.000
#> GSM918582     2  0.1633      0.970 0.024 0.976
#> GSM918649     1  0.0000      0.912 1.000 0.000
#> GSM918651     2  0.1633      0.970 0.024 0.976
#> GSM918607     2  0.0000      0.986 0.000 1.000
#> GSM918609     2  0.0000      0.986 0.000 1.000
#> GSM918608     2  0.1633      0.970 0.024 0.976
#> GSM918606     2  0.0000      0.986 0.000 1.000
#> GSM918620     2  0.1633      0.970 0.024 0.976
#> GSM918628     1  0.0000      0.912 1.000 0.000
#> GSM918586     2  0.0000      0.986 0.000 1.000
#> GSM918594     2  0.0000      0.986 0.000 1.000
#> GSM918600     2  0.0000      0.986 0.000 1.000
#> GSM918601     2  0.0000      0.986 0.000 1.000
#> GSM918612     2  0.0000      0.986 0.000 1.000
#> GSM918614     2  0.0000      0.986 0.000 1.000
#> GSM918629     2  0.1414      0.974 0.020 0.980
#> GSM918587     2  0.0000      0.986 0.000 1.000
#> GSM918588     2  0.1414      0.974 0.020 0.980
#> GSM918589     2  0.1414      0.974 0.020 0.980
#> GSM918611     2  0.0000      0.986 0.000 1.000
#> GSM918624     2  0.0000      0.986 0.000 1.000
#> GSM918637     2  0.0000      0.986 0.000 1.000
#> GSM918639     2  0.0000      0.986 0.000 1.000
#> GSM918640     2  0.0000      0.986 0.000 1.000
#> GSM918636     2  0.1414      0.974 0.020 0.980
#> GSM918590     2  0.7376      0.706 0.208 0.792
#> GSM918610     2  0.0000      0.986 0.000 1.000
#> GSM918615     2  0.0000      0.986 0.000 1.000
#> GSM918616     2  0.0000      0.986 0.000 1.000
#> GSM918632     1  0.1184      0.909 0.984 0.016
#> GSM918647     1  0.0000      0.912 1.000 0.000
#> GSM918578     2  0.0000      0.986 0.000 1.000
#> GSM918579     1  0.0000      0.912 1.000 0.000
#> GSM918581     1  0.7602      0.808 0.780 0.220
#> GSM918584     1  0.7602      0.808 0.780 0.220
#> GSM918591     2  0.0000      0.986 0.000 1.000
#> GSM918592     2  0.0000      0.986 0.000 1.000
#> GSM918597     2  0.7219      0.720 0.200 0.800
#> GSM918598     2  0.0000      0.986 0.000 1.000
#> GSM918599     1  0.0000      0.912 1.000 0.000
#> GSM918604     2  0.0000      0.986 0.000 1.000
#> GSM918605     2  0.0000      0.986 0.000 1.000
#> GSM918613     2  0.0000      0.986 0.000 1.000
#> GSM918623     1  0.0000      0.912 1.000 0.000
#> GSM918626     1  0.6531      0.847 0.832 0.168
#> GSM918627     2  0.0000      0.986 0.000 1.000
#> GSM918633     2  0.0000      0.986 0.000 1.000
#> GSM918634     2  0.0000      0.986 0.000 1.000
#> GSM918635     1  0.1184      0.909 0.984 0.016
#> GSM918645     2  0.0000      0.986 0.000 1.000
#> GSM918646     1  0.7299      0.826 0.796 0.204
#> GSM918648     1  0.0000      0.912 1.000 0.000
#> GSM918650     2  0.0000      0.986 0.000 1.000
#> GSM918652     1  0.7299      0.826 0.796 0.204
#> GSM918653     1  0.0000      0.912 1.000 0.000
#> GSM918622     2  0.0000      0.986 0.000 1.000
#> GSM918583     1  0.7602      0.808 0.780 0.220
#> GSM918585     1  0.0000      0.912 1.000 0.000
#> GSM918595     2  0.0000      0.986 0.000 1.000
#> GSM918596     2  0.0000      0.986 0.000 1.000
#> GSM918602     2  0.0000      0.986 0.000 1.000
#> GSM918617     1  0.7299      0.826 0.796 0.204
#> GSM918630     1  0.7299      0.826 0.796 0.204
#> GSM918631     1  0.0000      0.912 1.000 0.000
#> GSM918618     2  0.0000      0.986 0.000 1.000
#> GSM918644     2  0.1414      0.974 0.020 0.980

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>           class entropy silhouette    p1    p2    p3
#> GSM918603     3  0.0000      0.924 0.000 0.000 1.000
#> GSM918641     3  0.0000      0.924 0.000 0.000 1.000
#> GSM918580     1  0.0000      0.925 1.000 0.000 0.000
#> GSM918593     3  0.0000      0.924 0.000 0.000 1.000
#> GSM918625     3  0.1289      0.914 0.000 0.032 0.968
#> GSM918638     3  0.1289      0.914 0.000 0.032 0.968
#> GSM918642     3  0.0000      0.924 0.000 0.000 1.000
#> GSM918643     3  0.0000      0.924 0.000 0.000 1.000
#> GSM918619     3  0.0237      0.923 0.000 0.004 0.996
#> GSM918621     3  0.0000      0.924 0.000 0.000 1.000
#> GSM918582     3  0.1289      0.914 0.000 0.032 0.968
#> GSM918649     1  0.0000      0.925 1.000 0.000 0.000
#> GSM918651     3  0.1163      0.916 0.000 0.028 0.972
#> GSM918607     3  0.0000      0.924 0.000 0.000 1.000
#> GSM918609     3  0.0000      0.924 0.000 0.000 1.000
#> GSM918608     3  0.1163      0.916 0.000 0.028 0.972
#> GSM918606     3  0.0000      0.924 0.000 0.000 1.000
#> GSM918620     3  0.1289      0.914 0.000 0.032 0.968
#> GSM918628     1  0.0237      0.925 0.996 0.004 0.000
#> GSM918586     3  0.0000      0.924 0.000 0.000 1.000
#> GSM918594     3  0.0000      0.924 0.000 0.000 1.000
#> GSM918600     3  0.1289      0.922 0.000 0.032 0.968
#> GSM918601     3  0.0000      0.924 0.000 0.000 1.000
#> GSM918612     3  0.0000      0.924 0.000 0.000 1.000
#> GSM918614     3  0.0000      0.924 0.000 0.000 1.000
#> GSM918629     3  0.1529      0.918 0.000 0.040 0.960
#> GSM918587     3  0.1643      0.921 0.000 0.044 0.956
#> GSM918588     3  0.1163      0.916 0.000 0.028 0.972
#> GSM918589     3  0.1031      0.918 0.000 0.024 0.976
#> GSM918611     3  0.0892      0.924 0.000 0.020 0.980
#> GSM918624     3  0.1529      0.920 0.000 0.040 0.960
#> GSM918637     3  0.1529      0.920 0.000 0.040 0.960
#> GSM918639     3  0.0000      0.924 0.000 0.000 1.000
#> GSM918640     3  0.0000      0.924 0.000 0.000 1.000
#> GSM918636     3  0.1163      0.916 0.000 0.028 0.972
#> GSM918590     3  0.6192      0.480 0.000 0.420 0.580
#> GSM918610     3  0.4062      0.871 0.000 0.164 0.836
#> GSM918615     3  0.4062      0.871 0.000 0.164 0.836
#> GSM918616     3  0.4002      0.873 0.000 0.160 0.840
#> GSM918632     2  0.5882      0.541 0.348 0.652 0.000
#> GSM918647     2  0.6126      0.442 0.400 0.600 0.000
#> GSM918578     3  0.4062      0.871 0.000 0.164 0.836
#> GSM918579     1  0.2356      0.959 0.928 0.072 0.000
#> GSM918581     2  0.0000      0.807 0.000 1.000 0.000
#> GSM918584     2  0.0000      0.807 0.000 1.000 0.000
#> GSM918591     3  0.4062      0.871 0.000 0.164 0.836
#> GSM918592     3  0.4062      0.871 0.000 0.164 0.836
#> GSM918597     3  0.6154      0.507 0.000 0.408 0.592
#> GSM918598     3  0.4062      0.871 0.000 0.164 0.836
#> GSM918599     1  0.2878      0.933 0.904 0.096 0.000
#> GSM918604     3  0.1643      0.921 0.000 0.044 0.956
#> GSM918605     3  0.4062      0.871 0.000 0.164 0.836
#> GSM918613     3  0.4002      0.873 0.000 0.160 0.840
#> GSM918623     2  0.6126      0.442 0.400 0.600 0.000
#> GSM918626     2  0.3941      0.731 0.156 0.844 0.000
#> GSM918627     3  0.4002      0.873 0.000 0.160 0.840
#> GSM918633     3  0.4002      0.873 0.000 0.160 0.840
#> GSM918634     3  0.3482      0.887 0.000 0.128 0.872
#> GSM918635     2  0.5882      0.541 0.348 0.652 0.000
#> GSM918645     3  0.4062      0.871 0.000 0.164 0.836
#> GSM918646     2  0.0747      0.815 0.016 0.984 0.000
#> GSM918648     1  0.2356      0.959 0.928 0.072 0.000
#> GSM918650     3  0.4062      0.871 0.000 0.164 0.836
#> GSM918652     2  0.0747      0.815 0.016 0.984 0.000
#> GSM918653     1  0.2356      0.959 0.928 0.072 0.000
#> GSM918622     3  0.3879      0.877 0.000 0.152 0.848
#> GSM918583     2  0.0000      0.807 0.000 1.000 0.000
#> GSM918585     1  0.2356      0.959 0.928 0.072 0.000
#> GSM918595     3  0.4062      0.871 0.000 0.164 0.836
#> GSM918596     3  0.3340      0.890 0.000 0.120 0.880
#> GSM918602     3  0.1289      0.922 0.000 0.032 0.968
#> GSM918617     2  0.0747      0.815 0.016 0.984 0.000
#> GSM918630     2  0.0747      0.815 0.016 0.984 0.000
#> GSM918631     1  0.2356      0.959 0.928 0.072 0.000
#> GSM918618     3  0.0000      0.924 0.000 0.000 1.000
#> GSM918644     3  0.1031      0.918 0.000 0.024 0.976

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM918603     1  0.1302    0.89753 0.956 0.000 0.044 0.000
#> GSM918641     1  0.1302    0.89753 0.956 0.000 0.044 0.000
#> GSM918580     4  0.0921    0.88897 0.000 0.028 0.000 0.972
#> GSM918593     1  0.4855    0.28518 0.644 0.004 0.352 0.000
#> GSM918625     1  0.0188    0.88288 0.996 0.004 0.000 0.000
#> GSM918638     1  0.0188    0.88288 0.996 0.004 0.000 0.000
#> GSM918642     1  0.1302    0.89753 0.956 0.000 0.044 0.000
#> GSM918643     1  0.1302    0.89753 0.956 0.000 0.044 0.000
#> GSM918619     1  0.1209    0.89546 0.964 0.004 0.032 0.000
#> GSM918621     1  0.1489    0.89750 0.952 0.004 0.044 0.000
#> GSM918582     1  0.0188    0.88288 0.996 0.004 0.000 0.000
#> GSM918649     4  0.0921    0.88897 0.000 0.028 0.000 0.972
#> GSM918651     1  0.0376    0.88501 0.992 0.004 0.004 0.000
#> GSM918607     1  0.1489    0.89750 0.952 0.004 0.044 0.000
#> GSM918609     1  0.1489    0.89750 0.952 0.004 0.044 0.000
#> GSM918608     1  0.0376    0.88501 0.992 0.004 0.004 0.000
#> GSM918606     1  0.1489    0.89750 0.952 0.004 0.044 0.000
#> GSM918620     1  0.0188    0.88288 0.996 0.004 0.000 0.000
#> GSM918628     4  0.1743    0.86863 0.004 0.056 0.000 0.940
#> GSM918586     3  0.5996    0.31923 0.448 0.040 0.512 0.000
#> GSM918594     3  0.5996    0.31923 0.448 0.040 0.512 0.000
#> GSM918600     3  0.5778    0.46122 0.356 0.040 0.604 0.000
#> GSM918601     3  0.5982    0.34753 0.436 0.040 0.524 0.000
#> GSM918612     3  0.5996    0.31923 0.448 0.040 0.512 0.000
#> GSM918614     3  0.5996    0.31923 0.448 0.040 0.512 0.000
#> GSM918629     1  0.5837    0.00589 0.564 0.036 0.400 0.000
#> GSM918587     3  0.5873    0.33769 0.416 0.036 0.548 0.000
#> GSM918588     1  0.4590    0.64362 0.772 0.036 0.192 0.000
#> GSM918589     1  0.2796    0.82852 0.892 0.016 0.092 0.000
#> GSM918611     3  0.5735    0.43687 0.392 0.032 0.576 0.000
#> GSM918624     3  0.5085    0.56673 0.304 0.020 0.676 0.000
#> GSM918637     3  0.5062    0.57174 0.300 0.020 0.680 0.000
#> GSM918639     3  0.5982    0.34753 0.436 0.040 0.524 0.000
#> GSM918640     3  0.5982    0.34753 0.436 0.040 0.524 0.000
#> GSM918636     1  0.2987    0.81109 0.880 0.016 0.104 0.000
#> GSM918590     3  0.4331    0.39865 0.000 0.288 0.712 0.000
#> GSM918610     3  0.0188    0.73005 0.000 0.004 0.996 0.000
#> GSM918615     3  0.0188    0.73005 0.000 0.004 0.996 0.000
#> GSM918616     3  0.0000    0.73025 0.000 0.000 1.000 0.000
#> GSM918632     2  0.4585    0.55612 0.000 0.668 0.000 0.332
#> GSM918647     2  0.4804    0.46623 0.000 0.616 0.000 0.384
#> GSM918578     3  0.0188    0.73005 0.000 0.004 0.996 0.000
#> GSM918579     4  0.2149    0.93849 0.000 0.088 0.000 0.912
#> GSM918581     2  0.2589    0.80945 0.000 0.884 0.116 0.000
#> GSM918584     2  0.2814    0.79943 0.000 0.868 0.132 0.000
#> GSM918591     3  0.0188    0.73005 0.000 0.004 0.996 0.000
#> GSM918592     3  0.0188    0.73005 0.000 0.004 0.996 0.000
#> GSM918597     3  0.4250    0.41969 0.000 0.276 0.724 0.000
#> GSM918598     3  0.0188    0.73005 0.000 0.004 0.996 0.000
#> GSM918599     4  0.2530    0.91291 0.000 0.112 0.000 0.888
#> GSM918604     3  0.5793    0.42075 0.384 0.036 0.580 0.000
#> GSM918605     3  0.0188    0.73005 0.000 0.004 0.996 0.000
#> GSM918613     3  0.0524    0.73050 0.008 0.004 0.988 0.000
#> GSM918623     2  0.4804    0.46623 0.000 0.616 0.000 0.384
#> GSM918626     2  0.5113    0.71875 0.024 0.792 0.072 0.112
#> GSM918627     3  0.0000    0.73025 0.000 0.000 1.000 0.000
#> GSM918633     3  0.0524    0.73050 0.008 0.004 0.988 0.000
#> GSM918634     3  0.2814    0.69998 0.132 0.000 0.868 0.000
#> GSM918635     2  0.4585    0.55612 0.000 0.668 0.000 0.332
#> GSM918645     3  0.0188    0.73005 0.000 0.004 0.996 0.000
#> GSM918646     2  0.2345    0.81555 0.000 0.900 0.100 0.000
#> GSM918648     4  0.2149    0.93849 0.000 0.088 0.000 0.912
#> GSM918650     3  0.0376    0.72962 0.004 0.004 0.992 0.000
#> GSM918652     2  0.2408    0.81507 0.000 0.896 0.104 0.000
#> GSM918653     4  0.2149    0.93849 0.000 0.088 0.000 0.912
#> GSM918622     3  0.0376    0.73019 0.004 0.004 0.992 0.000
#> GSM918583     2  0.2589    0.80945 0.000 0.884 0.116 0.000
#> GSM918585     4  0.2149    0.93849 0.000 0.088 0.000 0.912
#> GSM918595     3  0.0188    0.73005 0.000 0.004 0.996 0.000
#> GSM918596     3  0.2831    0.70542 0.120 0.004 0.876 0.000
#> GSM918602     3  0.5442    0.55046 0.288 0.040 0.672 0.000
#> GSM918617     2  0.2345    0.81555 0.000 0.900 0.100 0.000
#> GSM918630     2  0.2345    0.81555 0.000 0.900 0.100 0.000
#> GSM918631     4  0.2149    0.93849 0.000 0.088 0.000 0.912
#> GSM918618     1  0.1302    0.89753 0.956 0.000 0.044 0.000
#> GSM918644     1  0.2796    0.82852 0.892 0.016 0.092 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
#> GSM918603     4  0.3636      0.723 0.000 0.000 0.272 0.728 0.000
#> GSM918641     4  0.3636      0.723 0.000 0.000 0.272 0.728 0.000
#> GSM918580     1  0.4587      0.780 0.728 0.068 0.204 0.000 0.000
#> GSM918593     3  0.4367      0.107 0.000 0.000 0.620 0.372 0.008
#> GSM918625     4  0.0000      0.720 0.000 0.000 0.000 1.000 0.000
#> GSM918638     4  0.0000      0.720 0.000 0.000 0.000 1.000 0.000
#> GSM918642     4  0.3636      0.723 0.000 0.000 0.272 0.728 0.000
#> GSM918643     4  0.3636      0.723 0.000 0.000 0.272 0.728 0.000
#> GSM918619     4  0.3210      0.742 0.000 0.000 0.212 0.788 0.000
#> GSM918621     4  0.3424      0.737 0.000 0.000 0.240 0.760 0.000
#> GSM918582     4  0.0000      0.720 0.000 0.000 0.000 1.000 0.000
#> GSM918649     1  0.4587      0.780 0.728 0.068 0.204 0.000 0.000
#> GSM918651     4  0.0510      0.726 0.000 0.000 0.016 0.984 0.000
#> GSM918607     4  0.3424      0.737 0.000 0.000 0.240 0.760 0.000
#> GSM918609     4  0.3424      0.737 0.000 0.000 0.240 0.760 0.000
#> GSM918608     4  0.0404      0.725 0.000 0.000 0.012 0.988 0.000
#> GSM918606     4  0.3424      0.737 0.000 0.000 0.240 0.760 0.000
#> GSM918620     4  0.0000      0.720 0.000 0.000 0.000 1.000 0.000
#> GSM918628     1  0.5571      0.711 0.624 0.096 0.276 0.004 0.000
#> GSM918586     3  0.4808      0.793 0.000 0.000 0.724 0.108 0.168
#> GSM918594     3  0.4808      0.793 0.000 0.000 0.724 0.108 0.168
#> GSM918600     3  0.5691      0.592 0.000 0.000 0.516 0.084 0.400
#> GSM918601     3  0.4981      0.797 0.000 0.000 0.704 0.108 0.188
#> GSM918612     3  0.4808      0.793 0.000 0.000 0.724 0.108 0.168
#> GSM918614     3  0.4808      0.793 0.000 0.000 0.724 0.108 0.168
#> GSM918629     4  0.6661     -0.348 0.000 0.000 0.232 0.412 0.356
#> GSM918587     5  0.6442     -0.230 0.000 0.000 0.252 0.244 0.504
#> GSM918588     4  0.5668      0.192 0.000 0.000 0.196 0.632 0.172
#> GSM918589     4  0.4119      0.612 0.000 0.000 0.152 0.780 0.068
#> GSM918611     3  0.6171      0.608 0.000 0.000 0.488 0.140 0.372
#> GSM918624     5  0.5544      0.296 0.000 0.000 0.168 0.184 0.648
#> GSM918637     5  0.5513      0.306 0.000 0.000 0.168 0.180 0.652
#> GSM918639     3  0.4981      0.797 0.000 0.000 0.704 0.108 0.188
#> GSM918640     3  0.4981      0.797 0.000 0.000 0.704 0.108 0.188
#> GSM918636     4  0.4049      0.574 0.000 0.000 0.124 0.792 0.084
#> GSM918590     5  0.3707      0.530 0.000 0.284 0.000 0.000 0.716
#> GSM918610     5  0.0000      0.853 0.000 0.000 0.000 0.000 1.000
#> GSM918615     5  0.0000      0.853 0.000 0.000 0.000 0.000 1.000
#> GSM918616     5  0.0510      0.846 0.000 0.000 0.016 0.000 0.984
#> GSM918632     2  0.3949      0.582 0.332 0.668 0.000 0.000 0.000
#> GSM918647     2  0.4138      0.502 0.384 0.616 0.000 0.000 0.000
#> GSM918578     5  0.0000      0.853 0.000 0.000 0.000 0.000 1.000
#> GSM918579     1  0.0794      0.879 0.972 0.028 0.000 0.000 0.000
#> GSM918581     2  0.2179      0.816 0.000 0.888 0.000 0.000 0.112
#> GSM918584     2  0.2377      0.806 0.000 0.872 0.000 0.000 0.128
#> GSM918591     5  0.0000      0.853 0.000 0.000 0.000 0.000 1.000
#> GSM918592     5  0.0000      0.853 0.000 0.000 0.000 0.000 1.000
#> GSM918597     5  0.3636      0.550 0.000 0.272 0.000 0.000 0.728
#> GSM918598     5  0.0000      0.853 0.000 0.000 0.000 0.000 1.000
#> GSM918599     1  0.1965      0.824 0.904 0.096 0.000 0.000 0.000
#> GSM918604     3  0.6021      0.557 0.000 0.000 0.476 0.116 0.408
#> GSM918605     5  0.0000      0.853 0.000 0.000 0.000 0.000 1.000
#> GSM918613     5  0.0324      0.850 0.000 0.000 0.004 0.004 0.992
#> GSM918623     2  0.4138      0.502 0.384 0.616 0.000 0.000 0.000
#> GSM918626     2  0.4797      0.732 0.040 0.796 0.072 0.024 0.068
#> GSM918627     5  0.0510      0.846 0.000 0.000 0.016 0.000 0.984
#> GSM918633     5  0.0324      0.850 0.000 0.000 0.004 0.004 0.992
#> GSM918634     5  0.2900      0.716 0.000 0.000 0.028 0.108 0.864
#> GSM918635     2  0.3949      0.582 0.332 0.668 0.000 0.000 0.000
#> GSM918645     5  0.0000      0.853 0.000 0.000 0.000 0.000 1.000
#> GSM918646     2  0.1965      0.822 0.000 0.904 0.000 0.000 0.096
#> GSM918648     1  0.0794      0.879 0.972 0.028 0.000 0.000 0.000
#> GSM918650     5  0.0162      0.851 0.000 0.000 0.000 0.004 0.996
#> GSM918652     2  0.2020      0.821 0.000 0.900 0.000 0.000 0.100
#> GSM918653     1  0.0794      0.879 0.972 0.028 0.000 0.000 0.000
#> GSM918622     5  0.0794      0.837 0.000 0.000 0.028 0.000 0.972
#> GSM918583     2  0.2179      0.816 0.000 0.888 0.000 0.000 0.112
#> GSM918585     1  0.0794      0.879 0.972 0.028 0.000 0.000 0.000
#> GSM918595     5  0.0000      0.853 0.000 0.000 0.000 0.000 1.000
#> GSM918596     5  0.4613      0.507 0.000 0.000 0.200 0.072 0.728
#> GSM918602     3  0.4702      0.527 0.000 0.000 0.552 0.016 0.432
#> GSM918617     2  0.1965      0.822 0.000 0.904 0.000 0.000 0.096
#> GSM918630     2  0.1965      0.822 0.000 0.904 0.000 0.000 0.096
#> GSM918631     1  0.0794      0.879 0.972 0.028 0.000 0.000 0.000
#> GSM918618     4  0.3636      0.723 0.000 0.000 0.272 0.728 0.000
#> GSM918644     4  0.4119      0.612 0.000 0.000 0.152 0.780 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
#> GSM918603     4  0.1556      0.670 0.000 0.000 0.080 0.920 0.000 0.000
#> GSM918641     4  0.1556      0.670 0.000 0.000 0.080 0.920 0.000 0.000
#> GSM918580     6  0.1910      0.930 0.108 0.000 0.000 0.000 0.000 0.892
#> GSM918593     4  0.3823     -0.244 0.000 0.000 0.436 0.564 0.000 0.000
#> GSM918625     4  0.3409      0.672 0.000 0.000 0.300 0.700 0.000 0.000
#> GSM918638     4  0.3409      0.672 0.000 0.000 0.300 0.700 0.000 0.000
#> GSM918642     4  0.1556      0.670 0.000 0.000 0.080 0.920 0.000 0.000
#> GSM918643     4  0.1556      0.670 0.000 0.000 0.080 0.920 0.000 0.000
#> GSM918619     4  0.0713      0.715 0.000 0.000 0.028 0.972 0.000 0.000
#> GSM918621     4  0.0000      0.712 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM918582     4  0.3409      0.672 0.000 0.000 0.300 0.700 0.000 0.000
#> GSM918649     6  0.1910      0.930 0.108 0.000 0.000 0.000 0.000 0.892
#> GSM918651     4  0.3330      0.678 0.000 0.000 0.284 0.716 0.000 0.000
#> GSM918607     4  0.0000      0.712 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM918609     4  0.0000      0.712 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM918608     4  0.3351      0.677 0.000 0.000 0.288 0.712 0.000 0.000
#> GSM918606     4  0.0000      0.712 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM918620     4  0.3409      0.672 0.000 0.000 0.300 0.700 0.000 0.000
#> GSM918628     6  0.1003      0.868 0.004 0.028 0.004 0.000 0.000 0.964
#> GSM918586     3  0.3748      0.686 0.000 0.000 0.688 0.300 0.012 0.000
#> GSM918594     3  0.3748      0.686 0.000 0.000 0.688 0.300 0.012 0.000
#> GSM918600     3  0.6875      0.529 0.000 0.052 0.388 0.256 0.304 0.000
#> GSM918601     3  0.4079      0.691 0.000 0.000 0.680 0.288 0.032 0.000
#> GSM918612     3  0.3748      0.686 0.000 0.000 0.688 0.300 0.012 0.000
#> GSM918614     3  0.3748      0.686 0.000 0.000 0.688 0.300 0.012 0.000
#> GSM918629     3  0.5529      0.245 0.000 0.000 0.560 0.228 0.212 0.000
#> GSM918587     5  0.6815     -0.237 0.000 0.052 0.256 0.272 0.420 0.000
#> GSM918588     3  0.4531     -0.258 0.000 0.000 0.556 0.408 0.036 0.000
#> GSM918589     4  0.3965      0.555 0.000 0.000 0.388 0.604 0.008 0.000
#> GSM918611     3  0.6257      0.518 0.000 0.020 0.476 0.216 0.288 0.000
#> GSM918624     5  0.5507      0.209 0.000 0.000 0.308 0.156 0.536 0.000
#> GSM918637     5  0.5480      0.219 0.000 0.000 0.308 0.152 0.540 0.000
#> GSM918639     3  0.4079      0.691 0.000 0.000 0.680 0.288 0.032 0.000
#> GSM918640     3  0.4079      0.691 0.000 0.000 0.680 0.288 0.032 0.000
#> GSM918636     4  0.4141      0.520 0.000 0.000 0.432 0.556 0.012 0.000
#> GSM918590     5  0.3330      0.538 0.000 0.284 0.000 0.000 0.716 0.000
#> GSM918610     5  0.0000      0.852 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM918615     5  0.0000      0.852 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM918616     5  0.0458      0.846 0.000 0.000 0.016 0.000 0.984 0.000
#> GSM918632     2  0.3547      0.590 0.332 0.668 0.000 0.000 0.000 0.000
#> GSM918647     2  0.3717      0.513 0.384 0.616 0.000 0.000 0.000 0.000
#> GSM918578     5  0.0000      0.852 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM918579     1  0.0000      0.975 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM918581     2  0.1765      0.810 0.000 0.904 0.000 0.000 0.096 0.000
#> GSM918584     2  0.1957      0.799 0.000 0.888 0.000 0.000 0.112 0.000
#> GSM918591     5  0.0000      0.852 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM918592     5  0.0000      0.852 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM918597     5  0.3266      0.558 0.000 0.272 0.000 0.000 0.728 0.000
#> GSM918598     5  0.0000      0.852 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM918599     1  0.1610      0.874 0.916 0.084 0.000 0.000 0.000 0.000
#> GSM918604     3  0.6919      0.497 0.000 0.052 0.360 0.272 0.316 0.000
#> GSM918605     5  0.0000      0.852 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM918613     5  0.0508      0.847 0.000 0.000 0.012 0.004 0.984 0.000
#> GSM918623     2  0.3717      0.513 0.384 0.616 0.000 0.000 0.000 0.000
#> GSM918626     2  0.3766      0.706 0.004 0.812 0.024 0.000 0.052 0.108
#> GSM918627     5  0.0458      0.846 0.000 0.000 0.016 0.000 0.984 0.000
#> GSM918633     5  0.0508      0.847 0.000 0.000 0.012 0.004 0.984 0.000
#> GSM918634     5  0.3458      0.704 0.000 0.000 0.112 0.080 0.808 0.000
#> GSM918635     2  0.3547      0.590 0.332 0.668 0.000 0.000 0.000 0.000
#> GSM918645     5  0.0000      0.852 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM918646     2  0.1556      0.815 0.000 0.920 0.000 0.000 0.080 0.000
#> GSM918648     1  0.0000      0.975 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM918650     5  0.0146      0.850 0.000 0.000 0.000 0.004 0.996 0.000
#> GSM918652     2  0.1610      0.815 0.000 0.916 0.000 0.000 0.084 0.000
#> GSM918653     1  0.0000      0.975 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM918622     5  0.0713      0.839 0.000 0.000 0.028 0.000 0.972 0.000
#> GSM918583     2  0.1765      0.810 0.000 0.904 0.000 0.000 0.096 0.000
#> GSM918585     1  0.0000      0.975 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM918595     5  0.0000      0.852 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM918596     5  0.4466      0.527 0.000 0.000 0.260 0.068 0.672 0.000
#> GSM918602     3  0.6669      0.478 0.000 0.052 0.428 0.184 0.336 0.000
#> GSM918617     2  0.1556      0.815 0.000 0.920 0.000 0.000 0.080 0.000
#> GSM918630     2  0.1556      0.815 0.000 0.920 0.000 0.000 0.080 0.000
#> GSM918631     1  0.0000      0.975 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM918618     4  0.1556      0.670 0.000 0.000 0.080 0.920 0.000 0.000
#> GSM918644     4  0.3965      0.555 0.000 0.000 0.388 0.604 0.008 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) gender(p) other(p) k
#> ATC:hclust 76         2.23e-03    1.0000 0.280342 2
#> ATC:hclust 73         7.85e-03    0.9751 0.245776 3
#> ATC:hclust 59         2.44e-06    0.1349 0.139596 4
#> ATC:hclust 70         5.61e-14    0.0229 0.019618 5
#> ATC:hclust 68         6.60e-18    0.0229 0.000865 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 76 columns.
#>   Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'ATC' method.
#>   Subgroups are detected by 'kmeans' method.
#>   Performed in total 1250 partitions by row resampling.
#>   Best k for subgroups seems to be 2.
#> 
#> Following methods can be applied to this 'ConsensusPartition' object:
#>  [1] "cola_report"             "collect_classes"         "collect_plots"          
#>  [4] "collect_stats"           "colnames"                "compare_signatures"     
#>  [7] "consensus_heatmap"       "dimension_reduction"     "functional_enrichment"  
#> [10] "get_anno_col"            "get_anno"                "get_classes"            
#> [13] "get_consensus"           "get_matrix"              "get_membership"         
#> [16] "get_param"               "get_signatures"          "get_stats"              
#> [19] "is_best_k"               "is_stable_k"             "membership_heatmap"     
#> [22] "ncol"                    "nrow"                    "plot_ecdf"              
#> [25] "rownames"                "select_partition_number" "show"                   
#> [28] "suggest_best_k"          "test_to_known_factors"

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

collect_plots(res)

plot of chunk ATC-kmeans-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 1.000           0.995       0.997         0.4041 0.595   0.595
#> 3 3 0.846           0.937       0.957         0.6119 0.708   0.527
#> 4 4 0.694           0.695       0.763         0.1269 0.883   0.674
#> 5 5 0.722           0.630       0.754         0.0634 0.948   0.802
#> 6 6 0.760           0.593       0.744         0.0472 0.924   0.671

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
#> GSM918603     2  0.0000      0.999 0.000 1.000
#> GSM918641     2  0.0000      0.999 0.000 1.000
#> GSM918580     1  0.0000      0.992 1.000 0.000
#> GSM918593     2  0.0000      0.999 0.000 1.000
#> GSM918625     2  0.0000      0.999 0.000 1.000
#> GSM918638     2  0.0000      0.999 0.000 1.000
#> GSM918642     2  0.0000      0.999 0.000 1.000
#> GSM918643     2  0.0000      0.999 0.000 1.000
#> GSM918619     2  0.0000      0.999 0.000 1.000
#> GSM918621     2  0.0000      0.999 0.000 1.000
#> GSM918582     2  0.0000      0.999 0.000 1.000
#> GSM918649     1  0.0000      0.992 1.000 0.000
#> GSM918651     2  0.0000      0.999 0.000 1.000
#> GSM918607     2  0.0000      0.999 0.000 1.000
#> GSM918609     2  0.0000      0.999 0.000 1.000
#> GSM918608     2  0.0000      0.999 0.000 1.000
#> GSM918606     2  0.0000      0.999 0.000 1.000
#> GSM918620     2  0.0000      0.999 0.000 1.000
#> GSM918628     1  0.0000      0.992 1.000 0.000
#> GSM918586     2  0.0000      0.999 0.000 1.000
#> GSM918594     2  0.0000      0.999 0.000 1.000
#> GSM918600     2  0.0000      0.999 0.000 1.000
#> GSM918601     2  0.0000      0.999 0.000 1.000
#> GSM918612     2  0.0000      0.999 0.000 1.000
#> GSM918614     2  0.0000      0.999 0.000 1.000
#> GSM918629     2  0.0000      0.999 0.000 1.000
#> GSM918587     2  0.0000      0.999 0.000 1.000
#> GSM918588     2  0.0000      0.999 0.000 1.000
#> GSM918589     2  0.0000      0.999 0.000 1.000
#> GSM918611     2  0.0000      0.999 0.000 1.000
#> GSM918624     2  0.0000      0.999 0.000 1.000
#> GSM918637     2  0.0000      0.999 0.000 1.000
#> GSM918639     2  0.0000      0.999 0.000 1.000
#> GSM918640     2  0.0000      0.999 0.000 1.000
#> GSM918636     2  0.0000      0.999 0.000 1.000
#> GSM918590     2  0.0376      0.996 0.004 0.996
#> GSM918610     2  0.0376      0.996 0.004 0.996
#> GSM918615     2  0.0376      0.996 0.004 0.996
#> GSM918616     2  0.0000      0.999 0.000 1.000
#> GSM918632     1  0.0000      0.992 1.000 0.000
#> GSM918647     1  0.0000      0.992 1.000 0.000
#> GSM918578     2  0.0000      0.999 0.000 1.000
#> GSM918579     1  0.0000      0.992 1.000 0.000
#> GSM918581     1  0.0000      0.992 1.000 0.000
#> GSM918584     1  0.6343      0.809 0.840 0.160
#> GSM918591     2  0.0376      0.996 0.004 0.996
#> GSM918592     2  0.0376      0.996 0.004 0.996
#> GSM918597     2  0.0000      0.999 0.000 1.000
#> GSM918598     2  0.0000      0.999 0.000 1.000
#> GSM918599     1  0.0000      0.992 1.000 0.000
#> GSM918604     2  0.0000      0.999 0.000 1.000
#> GSM918605     2  0.0376      0.996 0.004 0.996
#> GSM918613     2  0.0000      0.999 0.000 1.000
#> GSM918623     1  0.0000      0.992 1.000 0.000
#> GSM918626     1  0.0000      0.992 1.000 0.000
#> GSM918627     2  0.0000      0.999 0.000 1.000
#> GSM918633     2  0.0000      0.999 0.000 1.000
#> GSM918634     2  0.0000      0.999 0.000 1.000
#> GSM918635     1  0.0000      0.992 1.000 0.000
#> GSM918645     2  0.0376      0.996 0.004 0.996
#> GSM918646     1  0.0000      0.992 1.000 0.000
#> GSM918648     1  0.0000      0.992 1.000 0.000
#> GSM918650     2  0.0376      0.996 0.004 0.996
#> GSM918652     1  0.0000      0.992 1.000 0.000
#> GSM918653     1  0.0000      0.992 1.000 0.000
#> GSM918622     2  0.0000      0.999 0.000 1.000
#> GSM918583     1  0.0000      0.992 1.000 0.000
#> GSM918585     1  0.0000      0.992 1.000 0.000
#> GSM918595     2  0.0000      0.999 0.000 1.000
#> GSM918596     2  0.0000      0.999 0.000 1.000
#> GSM918602     2  0.0000      0.999 0.000 1.000
#> GSM918617     1  0.0000      0.992 1.000 0.000
#> GSM918630     1  0.0000      0.992 1.000 0.000
#> GSM918631     1  0.0000      0.992 1.000 0.000
#> GSM918618     2  0.0000      0.999 0.000 1.000
#> GSM918644     2  0.0000      0.999 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
#> GSM918603     1  0.0747      0.949 0.984 0.000 0.016
#> GSM918641     1  0.0237      0.941 0.996 0.000 0.004
#> GSM918580     2  0.1774      0.962 0.016 0.960 0.024
#> GSM918593     1  0.0747      0.949 0.984 0.000 0.016
#> GSM918625     1  0.1031      0.931 0.976 0.000 0.024
#> GSM918638     1  0.1031      0.931 0.976 0.000 0.024
#> GSM918642     1  0.0747      0.949 0.984 0.000 0.016
#> GSM918643     1  0.0747      0.949 0.984 0.000 0.016
#> GSM918619     1  0.0747      0.949 0.984 0.000 0.016
#> GSM918621     1  0.0747      0.949 0.984 0.000 0.016
#> GSM918582     1  0.1031      0.931 0.976 0.000 0.024
#> GSM918649     2  0.1774      0.962 0.016 0.960 0.024
#> GSM918651     1  0.1031      0.931 0.976 0.000 0.024
#> GSM918607     1  0.0892      0.948 0.980 0.000 0.020
#> GSM918609     1  0.0747      0.949 0.984 0.000 0.016
#> GSM918608     1  0.1031      0.931 0.976 0.000 0.024
#> GSM918606     1  0.0747      0.949 0.984 0.000 0.016
#> GSM918620     1  0.1031      0.931 0.976 0.000 0.024
#> GSM918628     2  0.1774      0.962 0.016 0.960 0.024
#> GSM918586     1  0.0747      0.949 0.984 0.000 0.016
#> GSM918594     1  0.3192      0.886 0.888 0.000 0.112
#> GSM918600     1  0.0747      0.949 0.984 0.000 0.016
#> GSM918601     1  0.4235      0.827 0.824 0.000 0.176
#> GSM918612     1  0.0747      0.949 0.984 0.000 0.016
#> GSM918614     1  0.0747      0.949 0.984 0.000 0.016
#> GSM918629     1  0.4750      0.778 0.784 0.000 0.216
#> GSM918587     1  0.3340      0.871 0.880 0.000 0.120
#> GSM918588     1  0.0000      0.942 1.000 0.000 0.000
#> GSM918589     1  0.0747      0.949 0.984 0.000 0.016
#> GSM918611     1  0.5465      0.665 0.712 0.000 0.288
#> GSM918624     1  0.4235      0.827 0.824 0.000 0.176
#> GSM918637     3  0.1031      0.963 0.024 0.000 0.976
#> GSM918639     1  0.4235      0.827 0.824 0.000 0.176
#> GSM918640     1  0.4235      0.827 0.824 0.000 0.176
#> GSM918636     1  0.0000      0.942 1.000 0.000 0.000
#> GSM918590     3  0.1031      0.960 0.000 0.024 0.976
#> GSM918610     3  0.1031      0.960 0.000 0.024 0.976
#> GSM918615     3  0.1031      0.960 0.000 0.024 0.976
#> GSM918616     3  0.1031      0.963 0.024 0.000 0.976
#> GSM918632     2  0.0000      0.982 0.000 1.000 0.000
#> GSM918647     2  0.0000      0.982 0.000 1.000 0.000
#> GSM918578     3  0.1031      0.963 0.024 0.000 0.976
#> GSM918579     2  0.0000      0.982 0.000 1.000 0.000
#> GSM918581     3  0.3482      0.858 0.000 0.128 0.872
#> GSM918584     3  0.1529      0.946 0.000 0.040 0.960
#> GSM918591     3  0.1031      0.960 0.000 0.024 0.976
#> GSM918592     3  0.1031      0.960 0.000 0.024 0.976
#> GSM918597     3  0.1031      0.963 0.024 0.000 0.976
#> GSM918598     3  0.1031      0.963 0.024 0.000 0.976
#> GSM918599     2  0.0000      0.982 0.000 1.000 0.000
#> GSM918604     1  0.0747      0.949 0.984 0.000 0.016
#> GSM918605     3  0.1031      0.960 0.000 0.024 0.976
#> GSM918613     3  0.1031      0.963 0.024 0.000 0.976
#> GSM918623     2  0.0000      0.982 0.000 1.000 0.000
#> GSM918626     2  0.2998      0.930 0.016 0.916 0.068
#> GSM918627     3  0.1031      0.963 0.024 0.000 0.976
#> GSM918633     3  0.1031      0.963 0.024 0.000 0.976
#> GSM918634     3  0.1031      0.963 0.024 0.000 0.976
#> GSM918635     2  0.0000      0.982 0.000 1.000 0.000
#> GSM918645     3  0.1031      0.960 0.000 0.024 0.976
#> GSM918646     2  0.2066      0.940 0.000 0.940 0.060
#> GSM918648     2  0.0000      0.982 0.000 1.000 0.000
#> GSM918650     3  0.1031      0.960 0.000 0.024 0.976
#> GSM918652     3  0.3752      0.837 0.000 0.144 0.856
#> GSM918653     2  0.0000      0.982 0.000 1.000 0.000
#> GSM918622     3  0.2711      0.908 0.088 0.000 0.912
#> GSM918583     2  0.0237      0.980 0.000 0.996 0.004
#> GSM918585     2  0.0000      0.982 0.000 1.000 0.000
#> GSM918595     3  0.1031      0.963 0.024 0.000 0.976
#> GSM918596     3  0.2711      0.908 0.088 0.000 0.912
#> GSM918602     3  0.2878      0.899 0.096 0.000 0.904
#> GSM918617     2  0.2261      0.933 0.000 0.932 0.068
#> GSM918630     2  0.0000      0.982 0.000 1.000 0.000
#> GSM918631     2  0.0000      0.982 0.000 1.000 0.000
#> GSM918618     1  0.0747      0.949 0.984 0.000 0.016
#> GSM918644     1  0.0747      0.949 0.984 0.000 0.016

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM918603     1  0.2973    0.70846 0.856 0.000 0.144 0.000
#> GSM918641     1  0.0921    0.73723 0.972 0.000 0.028 0.000
#> GSM918580     4  0.4382    0.78391 0.000 0.000 0.296 0.704
#> GSM918593     1  0.3801    0.61021 0.780 0.000 0.220 0.000
#> GSM918625     1  0.3486    0.62476 0.812 0.000 0.188 0.000
#> GSM918638     1  0.2149    0.71234 0.912 0.000 0.088 0.000
#> GSM918642     1  0.2973    0.70846 0.856 0.000 0.144 0.000
#> GSM918643     1  0.2973    0.70846 0.856 0.000 0.144 0.000
#> GSM918619     1  0.0000    0.73419 1.000 0.000 0.000 0.000
#> GSM918621     1  0.2530    0.72412 0.888 0.000 0.112 0.000
#> GSM918582     1  0.2149    0.71234 0.912 0.000 0.088 0.000
#> GSM918649     4  0.4500    0.77160 0.000 0.000 0.316 0.684
#> GSM918651     1  0.2011    0.71637 0.920 0.000 0.080 0.000
#> GSM918607     1  0.1637    0.73774 0.940 0.000 0.060 0.000
#> GSM918609     1  0.2345    0.72866 0.900 0.000 0.100 0.000
#> GSM918608     1  0.2011    0.71637 0.920 0.000 0.080 0.000
#> GSM918606     1  0.2345    0.72866 0.900 0.000 0.100 0.000
#> GSM918620     1  0.2868    0.67492 0.864 0.000 0.136 0.000
#> GSM918628     4  0.4500    0.77160 0.000 0.000 0.316 0.684
#> GSM918586     3  0.4817    0.56567 0.388 0.000 0.612 0.000
#> GSM918594     3  0.6160    0.67963 0.316 0.072 0.612 0.000
#> GSM918600     3  0.4898    0.52805 0.416 0.000 0.584 0.000
#> GSM918601     3  0.6280    0.69136 0.304 0.084 0.612 0.000
#> GSM918612     3  0.4830    0.55807 0.392 0.000 0.608 0.000
#> GSM918614     3  0.4830    0.55807 0.392 0.000 0.608 0.000
#> GSM918629     1  0.7044   -0.41121 0.452 0.120 0.428 0.000
#> GSM918587     1  0.6548    0.09563 0.592 0.104 0.304 0.000
#> GSM918588     1  0.4193    0.48038 0.732 0.000 0.268 0.000
#> GSM918589     1  0.3975    0.53685 0.760 0.000 0.240 0.000
#> GSM918611     3  0.6915    0.63164 0.212 0.196 0.592 0.000
#> GSM918624     3  0.6280    0.69136 0.304 0.084 0.612 0.000
#> GSM918637     2  0.4855    0.18562 0.000 0.600 0.400 0.000
#> GSM918639     3  0.6280    0.69136 0.304 0.084 0.612 0.000
#> GSM918640     3  0.6280    0.69136 0.304 0.084 0.612 0.000
#> GSM918636     1  0.3726    0.58437 0.788 0.000 0.212 0.000
#> GSM918590     2  0.0000    0.89457 0.000 1.000 0.000 0.000
#> GSM918610     2  0.0000    0.89457 0.000 1.000 0.000 0.000
#> GSM918615     2  0.0000    0.89457 0.000 1.000 0.000 0.000
#> GSM918616     2  0.3356    0.71272 0.000 0.824 0.176 0.000
#> GSM918632     4  0.1867    0.88071 0.000 0.000 0.072 0.928
#> GSM918647     4  0.0000    0.89172 0.000 0.000 0.000 1.000
#> GSM918578     2  0.0188    0.89359 0.000 0.996 0.004 0.000
#> GSM918579     4  0.1474    0.89180 0.000 0.000 0.052 0.948
#> GSM918581     2  0.5076    0.66114 0.000 0.756 0.072 0.172
#> GSM918584     2  0.3547    0.78945 0.000 0.864 0.072 0.064
#> GSM918591     2  0.0000    0.89457 0.000 1.000 0.000 0.000
#> GSM918592     2  0.0000    0.89457 0.000 1.000 0.000 0.000
#> GSM918597     2  0.0188    0.89359 0.000 0.996 0.004 0.000
#> GSM918598     2  0.0188    0.89359 0.000 0.996 0.004 0.000
#> GSM918599     4  0.1474    0.89180 0.000 0.000 0.052 0.948
#> GSM918604     1  0.4564    0.25641 0.672 0.000 0.328 0.000
#> GSM918605     2  0.0000    0.89457 0.000 1.000 0.000 0.000
#> GSM918613     2  0.4972    0.00603 0.000 0.544 0.456 0.000
#> GSM918623     4  0.0707    0.89003 0.000 0.000 0.020 0.980
#> GSM918626     4  0.6975    0.75791 0.060 0.080 0.200 0.660
#> GSM918627     2  0.1211    0.86563 0.000 0.960 0.040 0.000
#> GSM918633     2  0.0000    0.89457 0.000 1.000 0.000 0.000
#> GSM918634     2  0.0188    0.89359 0.000 0.996 0.004 0.000
#> GSM918635     4  0.1867    0.88071 0.000 0.000 0.072 0.928
#> GSM918645     2  0.0000    0.89457 0.000 1.000 0.000 0.000
#> GSM918646     4  0.4093    0.82748 0.000 0.096 0.072 0.832
#> GSM918648     4  0.1474    0.89180 0.000 0.000 0.052 0.948
#> GSM918650     2  0.0000    0.89457 0.000 1.000 0.000 0.000
#> GSM918652     2  0.5076    0.66119 0.000 0.756 0.072 0.172
#> GSM918653     4  0.1474    0.89180 0.000 0.000 0.052 0.948
#> GSM918622     3  0.5392    0.21655 0.012 0.460 0.528 0.000
#> GSM918583     4  0.3833    0.84005 0.000 0.080 0.072 0.848
#> GSM918585     4  0.1474    0.89180 0.000 0.000 0.052 0.948
#> GSM918595     2  0.0469    0.88862 0.000 0.988 0.012 0.000
#> GSM918596     3  0.5392    0.21655 0.012 0.460 0.528 0.000
#> GSM918602     3  0.5643    0.30311 0.024 0.428 0.548 0.000
#> GSM918617     4  0.4944    0.75970 0.000 0.160 0.072 0.768
#> GSM918630     4  0.2053    0.87969 0.000 0.004 0.072 0.924
#> GSM918631     4  0.1474    0.89180 0.000 0.000 0.052 0.948
#> GSM918618     1  0.2973    0.70846 0.856 0.000 0.144 0.000
#> GSM918644     1  0.3649    0.57586 0.796 0.000 0.204 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
#> GSM918603     4  0.5562     0.6452 0.000 0.000 0.200 0.644 0.156
#> GSM918641     4  0.3764     0.6935 0.000 0.000 0.044 0.800 0.156
#> GSM918580     1  0.2407     0.4951 0.896 0.000 0.088 0.012 0.004
#> GSM918593     4  0.6117     0.5214 0.000 0.000 0.304 0.540 0.156
#> GSM918625     4  0.3893     0.6634 0.048 0.000 0.036 0.832 0.084
#> GSM918638     4  0.2077     0.6911 0.000 0.000 0.008 0.908 0.084
#> GSM918642     4  0.5562     0.6452 0.000 0.000 0.200 0.644 0.156
#> GSM918643     4  0.5562     0.6452 0.000 0.000 0.200 0.644 0.156
#> GSM918619     4  0.0693     0.6969 0.000 0.000 0.012 0.980 0.008
#> GSM918621     4  0.4504     0.6656 0.000 0.000 0.168 0.748 0.084
#> GSM918582     4  0.0162     0.6949 0.000 0.000 0.000 0.996 0.004
#> GSM918649     1  0.2407     0.4951 0.896 0.000 0.088 0.012 0.004
#> GSM918651     4  0.0162     0.6956 0.000 0.000 0.000 0.996 0.004
#> GSM918607     4  0.3806     0.6916 0.000 0.000 0.104 0.812 0.084
#> GSM918609     4  0.4309     0.6767 0.000 0.000 0.148 0.768 0.084
#> GSM918608     4  0.0162     0.6956 0.000 0.000 0.000 0.996 0.004
#> GSM918606     4  0.4309     0.6767 0.000 0.000 0.148 0.768 0.084
#> GSM918620     4  0.0613     0.6917 0.004 0.000 0.008 0.984 0.004
#> GSM918628     1  0.2407     0.4951 0.896 0.000 0.088 0.012 0.004
#> GSM918586     3  0.2470     0.7327 0.000 0.000 0.884 0.104 0.012
#> GSM918594     3  0.2674     0.7521 0.000 0.020 0.888 0.084 0.008
#> GSM918600     3  0.3413     0.7186 0.000 0.000 0.832 0.124 0.044
#> GSM918601     3  0.2390     0.7536 0.000 0.020 0.896 0.084 0.000
#> GSM918612     3  0.3442     0.6891 0.000 0.000 0.836 0.104 0.060
#> GSM918614     3  0.3164     0.7013 0.000 0.000 0.852 0.104 0.044
#> GSM918629     3  0.6131     0.3148 0.000 0.032 0.540 0.364 0.064
#> GSM918587     4  0.7387    -0.0514 0.000 0.076 0.340 0.452 0.132
#> GSM918588     4  0.5204     0.2363 0.000 0.000 0.368 0.580 0.052
#> GSM918589     4  0.4789     0.2777 0.000 0.000 0.392 0.584 0.024
#> GSM918611     3  0.4228     0.7154 0.000 0.088 0.812 0.040 0.060
#> GSM918624     3  0.2986     0.7514 0.000 0.020 0.876 0.084 0.020
#> GSM918637     3  0.5490     0.4042 0.000 0.372 0.556 0.000 0.072
#> GSM918639     3  0.2390     0.7536 0.000 0.020 0.896 0.084 0.000
#> GSM918640     3  0.2390     0.7536 0.000 0.020 0.896 0.084 0.000
#> GSM918636     4  0.5128     0.3017 0.000 0.000 0.344 0.604 0.052
#> GSM918590     2  0.0000     0.8651 0.000 1.000 0.000 0.000 0.000
#> GSM918610     2  0.0000     0.8651 0.000 1.000 0.000 0.000 0.000
#> GSM918615     2  0.0000     0.8651 0.000 1.000 0.000 0.000 0.000
#> GSM918616     2  0.3551     0.7127 0.000 0.820 0.136 0.000 0.044
#> GSM918632     5  0.3752     0.8170 0.292 0.000 0.000 0.000 0.708
#> GSM918647     1  0.4242     0.3206 0.572 0.000 0.000 0.000 0.428
#> GSM918578     2  0.0451     0.8622 0.000 0.988 0.008 0.000 0.004
#> GSM918579     1  0.3661     0.7060 0.724 0.000 0.000 0.000 0.276
#> GSM918581     2  0.4291     0.1719 0.000 0.536 0.000 0.000 0.464
#> GSM918584     2  0.4150     0.3643 0.000 0.612 0.000 0.000 0.388
#> GSM918591     2  0.0000     0.8651 0.000 1.000 0.000 0.000 0.000
#> GSM918592     2  0.0000     0.8651 0.000 1.000 0.000 0.000 0.000
#> GSM918597     2  0.1041     0.8532 0.000 0.964 0.004 0.000 0.032
#> GSM918598     2  0.0162     0.8643 0.000 0.996 0.004 0.000 0.000
#> GSM918599     1  0.3661     0.7060 0.724 0.000 0.000 0.000 0.276
#> GSM918604     4  0.5896    -0.0494 0.000 0.000 0.448 0.452 0.100
#> GSM918605     2  0.0000     0.8651 0.000 1.000 0.000 0.000 0.000
#> GSM918613     2  0.5779    -0.0893 0.000 0.508 0.400 0.000 0.092
#> GSM918623     1  0.4278     0.2113 0.548 0.000 0.000 0.000 0.452
#> GSM918626     5  0.5557     0.7457 0.264 0.052 0.000 0.032 0.652
#> GSM918627     2  0.2149     0.8190 0.000 0.916 0.048 0.000 0.036
#> GSM918633     2  0.0510     0.8611 0.000 0.984 0.000 0.000 0.016
#> GSM918634     2  0.1661     0.8393 0.000 0.940 0.024 0.000 0.036
#> GSM918635     5  0.3752     0.8170 0.292 0.000 0.000 0.000 0.708
#> GSM918645     2  0.0000     0.8651 0.000 1.000 0.000 0.000 0.000
#> GSM918646     5  0.4780     0.8483 0.248 0.060 0.000 0.000 0.692
#> GSM918648     1  0.3661     0.7060 0.724 0.000 0.000 0.000 0.276
#> GSM918650     2  0.0000     0.8651 0.000 1.000 0.000 0.000 0.000
#> GSM918652     2  0.4294     0.1591 0.000 0.532 0.000 0.000 0.468
#> GSM918653     1  0.3661     0.7060 0.724 0.000 0.000 0.000 0.276
#> GSM918622     3  0.5304     0.3840 0.000 0.384 0.560 0.000 0.056
#> GSM918583     5  0.4871     0.8261 0.212 0.084 0.000 0.000 0.704
#> GSM918585     1  0.3661     0.7060 0.724 0.000 0.000 0.000 0.276
#> GSM918595     2  0.1444     0.8402 0.000 0.948 0.040 0.000 0.012
#> GSM918596     3  0.5284     0.4028 0.000 0.376 0.568 0.000 0.056
#> GSM918602     3  0.5238     0.5781 0.000 0.260 0.652 0.000 0.088
#> GSM918617     5  0.5032     0.8057 0.220 0.092 0.000 0.000 0.688
#> GSM918630     5  0.3980     0.8283 0.284 0.008 0.000 0.000 0.708
#> GSM918631     1  0.3661     0.7060 0.724 0.000 0.000 0.000 0.276
#> GSM918618     4  0.5562     0.6452 0.000 0.000 0.200 0.644 0.156
#> GSM918644     4  0.4733     0.3322 0.000 0.000 0.348 0.624 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
#> GSM918603     4  0.3744    0.81055 0.200 0.000 0.044 0.756 0.000 0.000
#> GSM918641     4  0.3494    0.77080 0.252 0.000 0.012 0.736 0.000 0.000
#> GSM918580     6  0.1863    0.54815 0.000 0.104 0.000 0.000 0.000 0.896
#> GSM918593     4  0.4226    0.70893 0.152 0.000 0.112 0.736 0.000 0.000
#> GSM918625     1  0.4437    0.03033 0.576 0.000 0.000 0.392 0.000 0.032
#> GSM918638     1  0.3950   -0.04280 0.564 0.000 0.004 0.432 0.000 0.000
#> GSM918642     4  0.3744    0.81055 0.200 0.000 0.044 0.756 0.000 0.000
#> GSM918643     4  0.3744    0.81055 0.200 0.000 0.044 0.756 0.000 0.000
#> GSM918619     1  0.3380    0.24089 0.748 0.000 0.004 0.244 0.000 0.004
#> GSM918621     4  0.4544    0.71609 0.416 0.000 0.036 0.548 0.000 0.000
#> GSM918582     1  0.3189    0.25868 0.760 0.000 0.004 0.236 0.000 0.000
#> GSM918649     6  0.2118    0.54482 0.008 0.104 0.000 0.000 0.000 0.888
#> GSM918651     1  0.3189    0.25868 0.760 0.000 0.004 0.236 0.000 0.000
#> GSM918607     4  0.4300    0.70548 0.432 0.000 0.020 0.548 0.000 0.000
#> GSM918609     4  0.4429    0.71750 0.424 0.000 0.028 0.548 0.000 0.000
#> GSM918608     1  0.3189    0.25868 0.760 0.000 0.004 0.236 0.000 0.000
#> GSM918606     4  0.4429    0.71750 0.424 0.000 0.028 0.548 0.000 0.000
#> GSM918620     1  0.3189    0.25754 0.760 0.000 0.000 0.236 0.000 0.004
#> GSM918628     6  0.2218    0.54476 0.012 0.104 0.000 0.000 0.000 0.884
#> GSM918586     3  0.1536    0.76548 0.020 0.000 0.944 0.024 0.000 0.012
#> GSM918594     3  0.1586    0.76563 0.012 0.000 0.940 0.040 0.004 0.004
#> GSM918600     3  0.3254    0.69630 0.136 0.000 0.816 0.000 0.000 0.048
#> GSM918601     3  0.1938    0.76851 0.028 0.000 0.928 0.024 0.004 0.016
#> GSM918612     3  0.3043    0.68033 0.020 0.000 0.832 0.140 0.000 0.008
#> GSM918614     3  0.2937    0.73407 0.036 0.000 0.864 0.080 0.000 0.020
#> GSM918629     3  0.5479    0.22603 0.392 0.000 0.520 0.008 0.012 0.068
#> GSM918587     1  0.6152   -0.06540 0.508 0.000 0.360 0.020 0.032 0.080
#> GSM918588     1  0.4363    0.36914 0.636 0.000 0.324 0.000 0.000 0.040
#> GSM918589     1  0.5282    0.34006 0.544 0.000 0.380 0.032 0.000 0.044
#> GSM918611     3  0.3228    0.72899 0.092 0.000 0.844 0.000 0.044 0.020
#> GSM918624     3  0.2450    0.75416 0.064 0.000 0.896 0.012 0.004 0.024
#> GSM918637     3  0.5838    0.56805 0.116 0.000 0.604 0.004 0.236 0.040
#> GSM918639     3  0.1938    0.76851 0.028 0.000 0.928 0.024 0.004 0.016
#> GSM918640     3  0.1938    0.76851 0.028 0.000 0.928 0.024 0.004 0.016
#> GSM918636     1  0.4452    0.39129 0.644 0.000 0.312 0.004 0.000 0.040
#> GSM918590     5  0.0000    0.90513 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM918610     5  0.0000    0.90513 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM918615     5  0.0000    0.90513 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM918616     5  0.3596    0.72338 0.040 0.000 0.156 0.004 0.796 0.004
#> GSM918632     2  0.0363    0.65304 0.000 0.988 0.012 0.000 0.000 0.000
#> GSM918647     2  0.5650   -0.31220 0.000 0.584 0.012 0.188 0.000 0.216
#> GSM918578     5  0.0665    0.90277 0.008 0.000 0.008 0.004 0.980 0.000
#> GSM918579     6  0.5896    0.73530 0.000 0.376 0.000 0.204 0.000 0.420
#> GSM918581     2  0.4234    0.31314 0.008 0.596 0.004 0.004 0.388 0.000
#> GSM918584     5  0.4538   -0.09139 0.012 0.468 0.004 0.008 0.508 0.000
#> GSM918591     5  0.0146    0.90510 0.000 0.000 0.000 0.004 0.996 0.000
#> GSM918592     5  0.0146    0.90277 0.000 0.004 0.000 0.000 0.996 0.000
#> GSM918597     5  0.1116    0.89336 0.028 0.000 0.008 0.000 0.960 0.004
#> GSM918598     5  0.0436    0.90469 0.004 0.000 0.004 0.004 0.988 0.000
#> GSM918599     6  0.6090    0.71456 0.000 0.388 0.008 0.196 0.000 0.408
#> GSM918604     1  0.5484   -0.00788 0.492 0.000 0.412 0.016 0.000 0.080
#> GSM918605     5  0.0146    0.90510 0.000 0.000 0.000 0.004 0.996 0.000
#> GSM918613     5  0.6216   -0.00671 0.112 0.000 0.356 0.004 0.488 0.040
#> GSM918623     2  0.5454   -0.21662 0.000 0.616 0.012 0.184 0.000 0.188
#> GSM918626     2  0.3664    0.58947 0.112 0.816 0.000 0.008 0.012 0.052
#> GSM918627     5  0.1623    0.88442 0.032 0.000 0.020 0.004 0.940 0.004
#> GSM918633     5  0.0436    0.90379 0.004 0.000 0.000 0.004 0.988 0.004
#> GSM918634     5  0.1623    0.88241 0.032 0.000 0.020 0.004 0.940 0.004
#> GSM918635     2  0.0363    0.65304 0.000 0.988 0.012 0.000 0.000 0.000
#> GSM918645     5  0.0146    0.90510 0.000 0.000 0.000 0.004 0.996 0.000
#> GSM918646     2  0.1036    0.66876 0.008 0.964 0.000 0.004 0.024 0.000
#> GSM918648     6  0.5896    0.73530 0.000 0.376 0.000 0.204 0.000 0.420
#> GSM918650     5  0.0000    0.90513 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM918652     2  0.4388    0.34775 0.012 0.604 0.004 0.008 0.372 0.000
#> GSM918653     6  0.5896    0.73530 0.000 0.376 0.000 0.204 0.000 0.420
#> GSM918622     3  0.5260    0.50799 0.068 0.000 0.620 0.008 0.288 0.016
#> GSM918583     2  0.1621    0.66728 0.008 0.936 0.004 0.004 0.048 0.000
#> GSM918585     6  0.5896    0.73530 0.000 0.376 0.000 0.204 0.000 0.420
#> GSM918595     5  0.0862    0.89956 0.008 0.000 0.016 0.004 0.972 0.000
#> GSM918596     3  0.5083    0.53934 0.068 0.000 0.640 0.004 0.272 0.016
#> GSM918602     3  0.5219    0.65227 0.124 0.000 0.708 0.012 0.116 0.040
#> GSM918617     2  0.1924    0.66492 0.028 0.920 0.000 0.004 0.048 0.000
#> GSM918630     2  0.0436    0.65894 0.004 0.988 0.004 0.000 0.004 0.000
#> GSM918631     6  0.5896    0.73530 0.000 0.376 0.000 0.204 0.000 0.420
#> GSM918618     4  0.3744    0.81055 0.200 0.000 0.044 0.756 0.000 0.000
#> GSM918644     1  0.5372    0.40670 0.584 0.000 0.324 0.048 0.000 0.044

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

consensus_heatmap(res, k = 2)

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

consensus_heatmap(res, k = 3)

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

consensus_heatmap(res, k = 4)

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

consensus_heatmap(res, k = 5)

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

consensus_heatmap(res, k = 6)

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

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

membership_heatmap(res, k = 2)

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

membership_heatmap(res, k = 3)

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

membership_heatmap(res, k = 4)

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

membership_heatmap(res, k = 5)

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

membership_heatmap(res, k = 6)

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

As soon as we have had the classes for columns, we can look for signatures which are significantly different between classes which can be candidate marks for certain classes. Following are the heatmaps for signatures.

Signature heatmaps where rows are scaled:

get_signatures(res, k = 2)

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

get_signatures(res, k = 3)

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

get_signatures(res, k = 4)

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

get_signatures(res, k = 5)

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

get_signatures(res, k = 6)

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

Signature heatmaps where rows are not scaled:

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

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

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

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

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

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

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

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

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

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

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk ATC-kmeans-signature_compare

get_signature() returns a data frame invisibly. TO get the list of signatures, the function call should be assigned to a variable explicitly. In following code, if plot argument is set to FALSE, no heatmap is plotted while only the differential analysis is performed.

# code only for demonstration
tb = get_signature(res, k = ..., plot = FALSE)

An example of the output of tb is:

#>   which_row         fdr    mean_1    mean_2 scaled_mean_1 scaled_mean_2 km
#> 1        38 0.042760348  8.373488  9.131774    -0.5533452     0.5164555  1
#> 2        40 0.018707592  7.106213  8.469186    -0.6173731     0.5762149  1
#> 3        55 0.019134737 10.221463 11.207825    -0.6159697     0.5749050  1
#> 4        59 0.006059896  5.921854  7.869574    -0.6899429     0.6439467  1
#> 5        60 0.018055526  8.928898 10.211722    -0.6204761     0.5791110  1
#> 6        98 0.009384629 15.714769 14.887706     0.6635654    -0.6193277  2
...

The columns in tb are:

  1. which_row: row indices corresponding to the input matrix.
  2. fdr: FDR for the differential test.
  3. mean_x: The mean value in group x.
  4. scaled_mean_x: The mean value in group x after rows are scaled.
  5. km: Row groups if k-means clustering is applied to rows.

UMAP plot which shows how samples are separated.

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

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

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

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

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

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

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

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

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

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

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk ATC-kmeans-collect-classes

Test correlation between subgroups and known annotations. If the known annotation is numeric, one-way ANOVA test is applied, and if the known annotation is discrete, chi-squared contingency table test is applied.

test_to_known_factors(res)
#>             n disease.state(p) gender(p) other(p) k
#> ATC:kmeans 76         2.23e-03  1.000000   0.2803 2
#> ATC:kmeans 76         5.18e-10  0.273344   0.1800 3
#> ATC:kmeans 67         1.07e-16  0.000271   0.0166 4
#> ATC:kmeans 57         1.60e-15  0.007483   0.0433 5
#> ATC:kmeans 56         3.69e-11  0.042212   0.0824 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 76 columns.
#>   Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'ATC' method.
#>   Subgroups are detected by 'skmeans' method.
#>   Performed in total 1250 partitions by row resampling.
#>   Best k for subgroups seems to be 4.
#> 
#> Following methods can be applied to this 'ConsensusPartition' object:
#>  [1] "cola_report"             "collect_classes"         "collect_plots"          
#>  [4] "collect_stats"           "colnames"                "compare_signatures"     
#>  [7] "consensus_heatmap"       "dimension_reduction"     "functional_enrichment"  
#> [10] "get_anno_col"            "get_anno"                "get_classes"            
#> [13] "get_consensus"           "get_matrix"              "get_membership"         
#> [16] "get_param"               "get_signatures"          "get_stats"              
#> [19] "is_best_k"               "is_stable_k"             "membership_heatmap"     
#> [22] "ncol"                    "nrow"                    "plot_ecdf"              
#> [25] "rownames"                "select_partition_number" "show"                   
#> [28] "suggest_best_k"          "test_to_known_factors"

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

collect_plots(res)

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 0.972           0.955       0.981         0.4985 0.499   0.499
#> 3 3 1.000           0.974       0.990         0.3196 0.772   0.575
#> 4 4 0.903           0.939       0.968         0.1496 0.851   0.597
#> 5 5 0.801           0.797       0.875         0.0542 0.958   0.828
#> 6 6 0.786           0.656       0.798         0.0286 0.984   0.922

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

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

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

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

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

show/hide code output

cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#>           class entropy silhouette    p1    p2
#> GSM918603     1  0.0000      0.989 1.000 0.000
#> GSM918641     1  0.0000      0.989 1.000 0.000
#> GSM918580     2  0.0000      0.969 0.000 1.000
#> GSM918593     1  0.0000      0.989 1.000 0.000
#> GSM918625     1  0.0376      0.985 0.996 0.004
#> GSM918638     1  0.0000      0.989 1.000 0.000
#> GSM918642     1  0.0000      0.989 1.000 0.000
#> GSM918643     1  0.0000      0.989 1.000 0.000
#> GSM918619     1  0.0000      0.989 1.000 0.000
#> GSM918621     1  0.0000      0.989 1.000 0.000
#> GSM918582     1  0.0000      0.989 1.000 0.000
#> GSM918649     2  0.0000      0.969 0.000 1.000
#> GSM918651     1  0.0000      0.989 1.000 0.000
#> GSM918607     1  0.0000      0.989 1.000 0.000
#> GSM918609     1  0.0000      0.989 1.000 0.000
#> GSM918608     1  0.0000      0.989 1.000 0.000
#> GSM918606     1  0.0000      0.989 1.000 0.000
#> GSM918620     1  0.0376      0.985 0.996 0.004
#> GSM918628     2  0.0000      0.969 0.000 1.000
#> GSM918586     1  0.0000      0.989 1.000 0.000
#> GSM918594     1  0.0000      0.989 1.000 0.000
#> GSM918600     1  0.0000      0.989 1.000 0.000
#> GSM918601     1  0.0000      0.989 1.000 0.000
#> GSM918612     1  0.0000      0.989 1.000 0.000
#> GSM918614     1  0.0000      0.989 1.000 0.000
#> GSM918629     1  0.0000      0.989 1.000 0.000
#> GSM918587     1  0.0000      0.989 1.000 0.000
#> GSM918588     1  0.0000      0.989 1.000 0.000
#> GSM918589     1  0.0000      0.989 1.000 0.000
#> GSM918611     1  0.0000      0.989 1.000 0.000
#> GSM918624     1  0.0000      0.989 1.000 0.000
#> GSM918637     1  0.0000      0.989 1.000 0.000
#> GSM918639     1  0.0000      0.989 1.000 0.000
#> GSM918640     1  0.0000      0.989 1.000 0.000
#> GSM918636     1  0.0000      0.989 1.000 0.000
#> GSM918590     2  0.0000      0.969 0.000 1.000
#> GSM918610     2  0.0376      0.967 0.004 0.996
#> GSM918615     2  0.0376      0.967 0.004 0.996
#> GSM918616     1  0.0000      0.989 1.000 0.000
#> GSM918632     2  0.0000      0.969 0.000 1.000
#> GSM918647     2  0.0000      0.969 0.000 1.000
#> GSM918578     2  0.7815      0.716 0.232 0.768
#> GSM918579     2  0.0000      0.969 0.000 1.000
#> GSM918581     2  0.0000      0.969 0.000 1.000
#> GSM918584     2  0.0000      0.969 0.000 1.000
#> GSM918591     2  0.0376      0.967 0.004 0.996
#> GSM918592     2  0.0000      0.969 0.000 1.000
#> GSM918597     2  0.8443      0.652 0.272 0.728
#> GSM918598     2  0.6887      0.782 0.184 0.816
#> GSM918599     2  0.0000      0.969 0.000 1.000
#> GSM918604     1  0.0000      0.989 1.000 0.000
#> GSM918605     2  0.0376      0.967 0.004 0.996
#> GSM918613     1  0.0000      0.989 1.000 0.000
#> GSM918623     2  0.0000      0.969 0.000 1.000
#> GSM918626     2  0.0000      0.969 0.000 1.000
#> GSM918627     1  0.2236      0.952 0.964 0.036
#> GSM918633     2  0.0376      0.967 0.004 0.996
#> GSM918634     2  0.8661      0.623 0.288 0.712
#> GSM918635     2  0.0000      0.969 0.000 1.000
#> GSM918645     2  0.0376      0.967 0.004 0.996
#> GSM918646     2  0.0000      0.969 0.000 1.000
#> GSM918648     2  0.0000      0.969 0.000 1.000
#> GSM918650     2  0.0376      0.967 0.004 0.996
#> GSM918652     2  0.0000      0.969 0.000 1.000
#> GSM918653     2  0.0000      0.969 0.000 1.000
#> GSM918622     1  0.0000      0.989 1.000 0.000
#> GSM918583     2  0.0000      0.969 0.000 1.000
#> GSM918585     2  0.0000      0.969 0.000 1.000
#> GSM918595     1  0.9710      0.284 0.600 0.400
#> GSM918596     1  0.0000      0.989 1.000 0.000
#> GSM918602     1  0.0000      0.989 1.000 0.000
#> GSM918617     2  0.0000      0.969 0.000 1.000
#> GSM918630     2  0.0000      0.969 0.000 1.000
#> GSM918631     2  0.0000      0.969 0.000 1.000
#> GSM918618     1  0.0000      0.989 1.000 0.000
#> GSM918644     1  0.0000      0.989 1.000 0.000

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>           class entropy silhouette   p1    p2    p3
#> GSM918603     1   0.000      0.986 1.00 0.000 0.000
#> GSM918641     1   0.000      0.986 1.00 0.000 0.000
#> GSM918580     2   0.000      0.985 0.00 1.000 0.000
#> GSM918593     1   0.000      0.986 1.00 0.000 0.000
#> GSM918625     1   0.000      0.986 1.00 0.000 0.000
#> GSM918638     1   0.000      0.986 1.00 0.000 0.000
#> GSM918642     1   0.000      0.986 1.00 0.000 0.000
#> GSM918643     1   0.000      0.986 1.00 0.000 0.000
#> GSM918619     1   0.000      0.986 1.00 0.000 0.000
#> GSM918621     1   0.000      0.986 1.00 0.000 0.000
#> GSM918582     1   0.000      0.986 1.00 0.000 0.000
#> GSM918649     2   0.000      0.985 0.00 1.000 0.000
#> GSM918651     1   0.000      0.986 1.00 0.000 0.000
#> GSM918607     1   0.000      0.986 1.00 0.000 0.000
#> GSM918609     1   0.000      0.986 1.00 0.000 0.000
#> GSM918608     1   0.000      0.986 1.00 0.000 0.000
#> GSM918606     1   0.000      0.986 1.00 0.000 0.000
#> GSM918620     1   0.000      0.986 1.00 0.000 0.000
#> GSM918628     2   0.000      0.985 0.00 1.000 0.000
#> GSM918586     1   0.000      0.986 1.00 0.000 0.000
#> GSM918594     1   0.000      0.986 1.00 0.000 0.000
#> GSM918600     1   0.000      0.986 1.00 0.000 0.000
#> GSM918601     1   0.000      0.986 1.00 0.000 0.000
#> GSM918612     1   0.000      0.986 1.00 0.000 0.000
#> GSM918614     1   0.000      0.986 1.00 0.000 0.000
#> GSM918629     1   0.000      0.986 1.00 0.000 0.000
#> GSM918587     1   0.000      0.986 1.00 0.000 0.000
#> GSM918588     1   0.000      0.986 1.00 0.000 0.000
#> GSM918589     1   0.000      0.986 1.00 0.000 0.000
#> GSM918611     1   0.624      0.215 0.56 0.000 0.440
#> GSM918624     1   0.000      0.986 1.00 0.000 0.000
#> GSM918637     3   0.000      1.000 0.00 0.000 1.000
#> GSM918639     1   0.000      0.986 1.00 0.000 0.000
#> GSM918640     1   0.000      0.986 1.00 0.000 0.000
#> GSM918636     1   0.000      0.986 1.00 0.000 0.000
#> GSM918590     3   0.000      1.000 0.00 0.000 1.000
#> GSM918610     3   0.000      1.000 0.00 0.000 1.000
#> GSM918615     3   0.000      1.000 0.00 0.000 1.000
#> GSM918616     3   0.000      1.000 0.00 0.000 1.000
#> GSM918632     2   0.000      0.985 0.00 1.000 0.000
#> GSM918647     2   0.000      0.985 0.00 1.000 0.000
#> GSM918578     3   0.000      1.000 0.00 0.000 1.000
#> GSM918579     2   0.000      0.985 0.00 1.000 0.000
#> GSM918581     2   0.000      0.985 0.00 1.000 0.000
#> GSM918584     2   0.559      0.564 0.00 0.696 0.304
#> GSM918591     3   0.000      1.000 0.00 0.000 1.000
#> GSM918592     3   0.000      1.000 0.00 0.000 1.000
#> GSM918597     3   0.000      1.000 0.00 0.000 1.000
#> GSM918598     3   0.000      1.000 0.00 0.000 1.000
#> GSM918599     2   0.000      0.985 0.00 1.000 0.000
#> GSM918604     1   0.000      0.986 1.00 0.000 0.000
#> GSM918605     3   0.000      1.000 0.00 0.000 1.000
#> GSM918613     3   0.000      1.000 0.00 0.000 1.000
#> GSM918623     2   0.000      0.985 0.00 1.000 0.000
#> GSM918626     2   0.000      0.985 0.00 1.000 0.000
#> GSM918627     3   0.000      1.000 0.00 0.000 1.000
#> GSM918633     3   0.000      1.000 0.00 0.000 1.000
#> GSM918634     3   0.000      1.000 0.00 0.000 1.000
#> GSM918635     2   0.000      0.985 0.00 1.000 0.000
#> GSM918645     3   0.000      1.000 0.00 0.000 1.000
#> GSM918646     2   0.000      0.985 0.00 1.000 0.000
#> GSM918648     2   0.000      0.985 0.00 1.000 0.000
#> GSM918650     3   0.000      1.000 0.00 0.000 1.000
#> GSM918652     2   0.000      0.985 0.00 1.000 0.000
#> GSM918653     2   0.000      0.985 0.00 1.000 0.000
#> GSM918622     3   0.000      1.000 0.00 0.000 1.000
#> GSM918583     2   0.000      0.985 0.00 1.000 0.000
#> GSM918585     2   0.000      0.985 0.00 1.000 0.000
#> GSM918595     3   0.000      1.000 0.00 0.000 1.000
#> GSM918596     3   0.000      1.000 0.00 0.000 1.000
#> GSM918602     3   0.000      1.000 0.00 0.000 1.000
#> GSM918617     2   0.000      0.985 0.00 1.000 0.000
#> GSM918630     2   0.000      0.985 0.00 1.000 0.000
#> GSM918631     2   0.000      0.985 0.00 1.000 0.000
#> GSM918618     1   0.000      0.986 1.00 0.000 0.000
#> GSM918644     1   0.000      0.986 1.00 0.000 0.000

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM918603     1  0.0592      0.934 0.984 0.000 0.016 0.000
#> GSM918641     1  0.0188      0.933 0.996 0.000 0.004 0.000
#> GSM918580     2  0.0000      0.988 0.000 1.000 0.000 0.000
#> GSM918593     1  0.4193      0.688 0.732 0.000 0.268 0.000
#> GSM918625     1  0.0000      0.933 1.000 0.000 0.000 0.000
#> GSM918638     1  0.0000      0.933 1.000 0.000 0.000 0.000
#> GSM918642     1  0.0592      0.934 0.984 0.000 0.016 0.000
#> GSM918643     1  0.0592      0.934 0.984 0.000 0.016 0.000
#> GSM918619     1  0.0592      0.934 0.984 0.000 0.016 0.000
#> GSM918621     1  0.2814      0.851 0.868 0.000 0.132 0.000
#> GSM918582     1  0.0000      0.933 1.000 0.000 0.000 0.000
#> GSM918649     2  0.0188      0.985 0.004 0.996 0.000 0.000
#> GSM918651     1  0.0000      0.933 1.000 0.000 0.000 0.000
#> GSM918607     1  0.0592      0.934 0.984 0.000 0.016 0.000
#> GSM918609     1  0.0592      0.934 0.984 0.000 0.016 0.000
#> GSM918608     1  0.0000      0.933 1.000 0.000 0.000 0.000
#> GSM918606     1  0.0592      0.934 0.984 0.000 0.016 0.000
#> GSM918620     1  0.0000      0.933 1.000 0.000 0.000 0.000
#> GSM918628     2  0.0000      0.988 0.000 1.000 0.000 0.000
#> GSM918586     3  0.0000      0.955 0.000 0.000 1.000 0.000
#> GSM918594     3  0.0000      0.955 0.000 0.000 1.000 0.000
#> GSM918600     3  0.0000      0.955 0.000 0.000 1.000 0.000
#> GSM918601     3  0.0000      0.955 0.000 0.000 1.000 0.000
#> GSM918612     3  0.0000      0.955 0.000 0.000 1.000 0.000
#> GSM918614     3  0.0000      0.955 0.000 0.000 1.000 0.000
#> GSM918629     3  0.0592      0.945 0.016 0.000 0.984 0.000
#> GSM918587     1  0.4356      0.648 0.708 0.000 0.292 0.000
#> GSM918588     1  0.2704      0.856 0.876 0.000 0.124 0.000
#> GSM918589     1  0.2704      0.860 0.876 0.000 0.124 0.000
#> GSM918611     3  0.0000      0.955 0.000 0.000 1.000 0.000
#> GSM918624     3  0.0000      0.955 0.000 0.000 1.000 0.000
#> GSM918637     3  0.1302      0.929 0.000 0.000 0.956 0.044
#> GSM918639     3  0.0000      0.955 0.000 0.000 1.000 0.000
#> GSM918640     3  0.0000      0.955 0.000 0.000 1.000 0.000
#> GSM918636     1  0.2281      0.879 0.904 0.000 0.096 0.000
#> GSM918590     4  0.0000      0.991 0.000 0.000 0.000 1.000
#> GSM918610     4  0.0000      0.991 0.000 0.000 0.000 1.000
#> GSM918615     4  0.0000      0.991 0.000 0.000 0.000 1.000
#> GSM918616     4  0.2760      0.841 0.000 0.000 0.128 0.872
#> GSM918632     2  0.0000      0.988 0.000 1.000 0.000 0.000
#> GSM918647     2  0.0000      0.988 0.000 1.000 0.000 0.000
#> GSM918578     4  0.0000      0.991 0.000 0.000 0.000 1.000
#> GSM918579     2  0.0000      0.988 0.000 1.000 0.000 0.000
#> GSM918581     2  0.3764      0.725 0.000 0.784 0.000 0.216
#> GSM918584     4  0.0188      0.987 0.000 0.004 0.000 0.996
#> GSM918591     4  0.0000      0.991 0.000 0.000 0.000 1.000
#> GSM918592     4  0.0000      0.991 0.000 0.000 0.000 1.000
#> GSM918597     4  0.0000      0.991 0.000 0.000 0.000 1.000
#> GSM918598     4  0.0000      0.991 0.000 0.000 0.000 1.000
#> GSM918599     2  0.0000      0.988 0.000 1.000 0.000 0.000
#> GSM918604     1  0.4250      0.675 0.724 0.000 0.276 0.000
#> GSM918605     4  0.0000      0.991 0.000 0.000 0.000 1.000
#> GSM918613     3  0.3837      0.750 0.000 0.000 0.776 0.224
#> GSM918623     2  0.0000      0.988 0.000 1.000 0.000 0.000
#> GSM918626     2  0.0000      0.988 0.000 1.000 0.000 0.000
#> GSM918627     4  0.0000      0.991 0.000 0.000 0.000 1.000
#> GSM918633     4  0.0000      0.991 0.000 0.000 0.000 1.000
#> GSM918634     4  0.0000      0.991 0.000 0.000 0.000 1.000
#> GSM918635     2  0.0000      0.988 0.000 1.000 0.000 0.000
#> GSM918645     4  0.0000      0.991 0.000 0.000 0.000 1.000
#> GSM918646     2  0.0000      0.988 0.000 1.000 0.000 0.000
#> GSM918648     2  0.0000      0.988 0.000 1.000 0.000 0.000
#> GSM918650     4  0.0000      0.991 0.000 0.000 0.000 1.000
#> GSM918652     2  0.0000      0.988 0.000 1.000 0.000 0.000
#> GSM918653     2  0.0000      0.988 0.000 1.000 0.000 0.000
#> GSM918622     3  0.2704      0.874 0.000 0.000 0.876 0.124
#> GSM918583     2  0.0000      0.988 0.000 1.000 0.000 0.000
#> GSM918585     2  0.0000      0.988 0.000 1.000 0.000 0.000
#> GSM918595     4  0.0000      0.991 0.000 0.000 0.000 1.000
#> GSM918596     3  0.2589      0.882 0.000 0.000 0.884 0.116
#> GSM918602     3  0.2589      0.882 0.000 0.000 0.884 0.116
#> GSM918617     2  0.0000      0.988 0.000 1.000 0.000 0.000
#> GSM918630     2  0.0000      0.988 0.000 1.000 0.000 0.000
#> GSM918631     2  0.0000      0.988 0.000 1.000 0.000 0.000
#> GSM918618     1  0.0592      0.934 0.984 0.000 0.016 0.000
#> GSM918644     1  0.0469      0.932 0.988 0.000 0.012 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
#> GSM918603     4  0.0162      0.742 0.004 0.000 0.000 0.996 0.000
#> GSM918641     4  0.0000      0.742 0.000 0.000 0.000 1.000 0.000
#> GSM918580     2  0.3876      0.628 0.316 0.684 0.000 0.000 0.000
#> GSM918593     4  0.1197      0.717 0.000 0.000 0.048 0.952 0.000
#> GSM918625     1  0.4235      0.627 0.576 0.000 0.000 0.424 0.000
#> GSM918638     1  0.4307      0.611 0.500 0.000 0.000 0.500 0.000
#> GSM918642     4  0.0000      0.742 0.000 0.000 0.000 1.000 0.000
#> GSM918643     4  0.0000      0.742 0.000 0.000 0.000 1.000 0.000
#> GSM918619     4  0.3366      0.686 0.232 0.000 0.000 0.768 0.000
#> GSM918621     4  0.3750      0.682 0.232 0.000 0.012 0.756 0.000
#> GSM918582     1  0.3508      0.680 0.748 0.000 0.000 0.252 0.000
#> GSM918649     2  0.4101      0.534 0.372 0.628 0.000 0.000 0.000
#> GSM918651     1  0.4045      0.577 0.644 0.000 0.000 0.356 0.000
#> GSM918607     4  0.3366      0.686 0.232 0.000 0.000 0.768 0.000
#> GSM918609     4  0.3366      0.686 0.232 0.000 0.000 0.768 0.000
#> GSM918608     1  0.4074      0.562 0.636 0.000 0.000 0.364 0.000
#> GSM918606     4  0.3366      0.686 0.232 0.000 0.000 0.768 0.000
#> GSM918620     1  0.3366      0.679 0.768 0.000 0.000 0.232 0.000
#> GSM918628     2  0.3857      0.633 0.312 0.688 0.000 0.000 0.000
#> GSM918586     3  0.2104      0.834 0.024 0.000 0.916 0.060 0.000
#> GSM918594     3  0.0000      0.861 0.000 0.000 1.000 0.000 0.000
#> GSM918600     3  0.3975      0.751 0.064 0.000 0.792 0.144 0.000
#> GSM918601     3  0.0510      0.862 0.016 0.000 0.984 0.000 0.000
#> GSM918612     3  0.3284      0.768 0.024 0.000 0.828 0.148 0.000
#> GSM918614     3  0.3366      0.776 0.032 0.000 0.828 0.140 0.000
#> GSM918629     3  0.3521      0.704 0.232 0.000 0.764 0.004 0.000
#> GSM918587     4  0.4756      0.586 0.288 0.000 0.044 0.668 0.000
#> GSM918588     1  0.5872      0.581 0.600 0.000 0.168 0.232 0.000
#> GSM918589     4  0.4541      0.388 0.084 0.000 0.172 0.744 0.000
#> GSM918611     3  0.1638      0.848 0.064 0.000 0.932 0.004 0.000
#> GSM918624     3  0.0510      0.862 0.016 0.000 0.984 0.000 0.000
#> GSM918637     3  0.0703      0.862 0.024 0.000 0.976 0.000 0.000
#> GSM918639     3  0.0510      0.862 0.016 0.000 0.984 0.000 0.000
#> GSM918640     3  0.0510      0.862 0.016 0.000 0.984 0.000 0.000
#> GSM918636     1  0.5638      0.584 0.492 0.000 0.076 0.432 0.000
#> GSM918590     5  0.0290      0.950 0.008 0.000 0.000 0.000 0.992
#> GSM918610     5  0.0000      0.955 0.000 0.000 0.000 0.000 1.000
#> GSM918615     5  0.0000      0.955 0.000 0.000 0.000 0.000 1.000
#> GSM918616     5  0.4873      0.454 0.044 0.000 0.312 0.000 0.644
#> GSM918632     2  0.0000      0.927 0.000 1.000 0.000 0.000 0.000
#> GSM918647     2  0.0000      0.927 0.000 1.000 0.000 0.000 0.000
#> GSM918578     5  0.0000      0.955 0.000 0.000 0.000 0.000 1.000
#> GSM918579     2  0.0000      0.927 0.000 1.000 0.000 0.000 0.000
#> GSM918581     2  0.3829      0.702 0.028 0.776 0.000 0.000 0.196
#> GSM918584     5  0.3687      0.721 0.028 0.180 0.000 0.000 0.792
#> GSM918591     5  0.0000      0.955 0.000 0.000 0.000 0.000 1.000
#> GSM918592     5  0.0162      0.953 0.004 0.000 0.000 0.000 0.996
#> GSM918597     5  0.0162      0.953 0.004 0.000 0.000 0.000 0.996
#> GSM918598     5  0.0000      0.955 0.000 0.000 0.000 0.000 1.000
#> GSM918599     2  0.0000      0.927 0.000 1.000 0.000 0.000 0.000
#> GSM918604     4  0.4691      0.617 0.276 0.000 0.044 0.680 0.000
#> GSM918605     5  0.0000      0.955 0.000 0.000 0.000 0.000 1.000
#> GSM918613     3  0.4854      0.616 0.060 0.000 0.680 0.000 0.260
#> GSM918623     2  0.0000      0.927 0.000 1.000 0.000 0.000 0.000
#> GSM918626     2  0.1197      0.901 0.048 0.952 0.000 0.000 0.000
#> GSM918627     5  0.0963      0.933 0.036 0.000 0.000 0.000 0.964
#> GSM918633     5  0.0000      0.955 0.000 0.000 0.000 0.000 1.000
#> GSM918634     5  0.1386      0.921 0.016 0.000 0.032 0.000 0.952
#> GSM918635     2  0.0000      0.927 0.000 1.000 0.000 0.000 0.000
#> GSM918645     5  0.0000      0.955 0.000 0.000 0.000 0.000 1.000
#> GSM918646     2  0.0510      0.923 0.016 0.984 0.000 0.000 0.000
#> GSM918648     2  0.0000      0.927 0.000 1.000 0.000 0.000 0.000
#> GSM918650     5  0.0000      0.955 0.000 0.000 0.000 0.000 1.000
#> GSM918652     2  0.0794      0.917 0.028 0.972 0.000 0.000 0.000
#> GSM918653     2  0.0000      0.927 0.000 1.000 0.000 0.000 0.000
#> GSM918622     3  0.3911      0.764 0.060 0.000 0.796 0.000 0.144
#> GSM918583     2  0.0794      0.917 0.028 0.972 0.000 0.000 0.000
#> GSM918585     2  0.0000      0.927 0.000 1.000 0.000 0.000 0.000
#> GSM918595     5  0.0162      0.953 0.004 0.000 0.000 0.000 0.996
#> GSM918596     3  0.3427      0.795 0.056 0.000 0.836 0.000 0.108
#> GSM918602     3  0.4016      0.780 0.092 0.000 0.796 0.000 0.112
#> GSM918617     2  0.0510      0.923 0.016 0.984 0.000 0.000 0.000
#> GSM918630     2  0.0510      0.923 0.016 0.984 0.000 0.000 0.000
#> GSM918631     2  0.0000      0.927 0.000 1.000 0.000 0.000 0.000
#> GSM918618     4  0.0000      0.742 0.000 0.000 0.000 1.000 0.000
#> GSM918644     4  0.1522      0.688 0.044 0.000 0.012 0.944 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
#> GSM918603     4  0.0000      0.618 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM918641     4  0.0000      0.618 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM918580     2  0.5537      0.404 0.328 0.520 0.000 0.000 0.000 0.152
#> GSM918593     4  0.0508      0.604 0.000 0.000 0.012 0.984 0.000 0.004
#> GSM918625     1  0.5206      0.343 0.588 0.000 0.000 0.284 0.000 0.128
#> GSM918638     4  0.3966     -0.319 0.444 0.000 0.000 0.552 0.000 0.004
#> GSM918642     4  0.0000      0.618 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM918643     4  0.0000      0.618 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM918619     4  0.3993      0.481 0.300 0.000 0.000 0.676 0.000 0.024
#> GSM918621     4  0.4111      0.478 0.296 0.000 0.004 0.676 0.000 0.024
#> GSM918582     1  0.2854      0.534 0.792 0.000 0.000 0.208 0.000 0.000
#> GSM918649     2  0.5662      0.280 0.384 0.460 0.000 0.000 0.000 0.156
#> GSM918651     1  0.3984      0.374 0.648 0.000 0.000 0.336 0.000 0.016
#> GSM918607     4  0.3974      0.484 0.296 0.000 0.000 0.680 0.000 0.024
#> GSM918609     4  0.3974      0.484 0.296 0.000 0.000 0.680 0.000 0.024
#> GSM918608     1  0.3998      0.365 0.644 0.000 0.000 0.340 0.000 0.016
#> GSM918606     4  0.3974      0.484 0.296 0.000 0.000 0.680 0.000 0.024
#> GSM918620     1  0.2932      0.533 0.820 0.000 0.000 0.164 0.000 0.016
#> GSM918628     2  0.5537      0.404 0.328 0.520 0.000 0.000 0.000 0.152
#> GSM918586     3  0.3411      0.669 0.008 0.000 0.824 0.068 0.000 0.100
#> GSM918594     3  0.0937      0.728 0.000 0.000 0.960 0.000 0.000 0.040
#> GSM918600     3  0.5606      0.402 0.020 0.000 0.576 0.116 0.000 0.288
#> GSM918601     3  0.0000      0.730 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM918612     3  0.4292      0.604 0.008 0.000 0.748 0.124 0.000 0.120
#> GSM918614     3  0.3635      0.623 0.008 0.000 0.804 0.120 0.000 0.068
#> GSM918629     3  0.4853      0.449 0.108 0.000 0.644 0.000 0.000 0.248
#> GSM918587     6  0.5381      0.859 0.088 0.000 0.012 0.352 0.000 0.548
#> GSM918588     1  0.6702      0.189 0.484 0.000 0.252 0.068 0.000 0.196
#> GSM918589     4  0.5875      0.106 0.100 0.000 0.188 0.624 0.000 0.088
#> GSM918611     3  0.3741      0.602 0.008 0.000 0.672 0.000 0.000 0.320
#> GSM918624     3  0.0000      0.730 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM918637     3  0.1349      0.722 0.004 0.000 0.940 0.000 0.000 0.056
#> GSM918639     3  0.0000      0.730 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM918640     3  0.0000      0.730 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM918636     1  0.6792      0.287 0.408 0.000 0.084 0.368 0.000 0.140
#> GSM918590     5  0.0935      0.899 0.004 0.000 0.000 0.000 0.964 0.032
#> GSM918610     5  0.0000      0.910 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM918615     5  0.0000      0.910 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM918616     5  0.5772      0.330 0.008 0.000 0.260 0.000 0.544 0.188
#> GSM918632     2  0.0000      0.875 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM918647     2  0.0000      0.875 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM918578     5  0.0146      0.909 0.000 0.000 0.000 0.000 0.996 0.004
#> GSM918579     2  0.0000      0.875 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM918581     2  0.4558      0.648 0.016 0.724 0.000 0.000 0.172 0.088
#> GSM918584     5  0.5018      0.487 0.016 0.240 0.000 0.000 0.656 0.088
#> GSM918591     5  0.0000      0.910 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM918592     5  0.0146      0.908 0.000 0.000 0.000 0.000 0.996 0.004
#> GSM918597     5  0.2020      0.864 0.008 0.000 0.000 0.000 0.896 0.096
#> GSM918598     5  0.0146      0.909 0.000 0.000 0.000 0.000 0.996 0.004
#> GSM918599     2  0.0000      0.875 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM918604     6  0.5802      0.849 0.120 0.000 0.016 0.380 0.000 0.484
#> GSM918605     5  0.0146      0.909 0.000 0.000 0.000 0.000 0.996 0.004
#> GSM918613     3  0.6164      0.336 0.008 0.000 0.448 0.000 0.296 0.248
#> GSM918623     2  0.0000      0.875 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM918626     2  0.3782      0.725 0.096 0.780 0.000 0.000 0.000 0.124
#> GSM918627     5  0.3166      0.779 0.008 0.000 0.008 0.000 0.800 0.184
#> GSM918633     5  0.0146      0.909 0.004 0.000 0.000 0.000 0.996 0.000
#> GSM918634     5  0.2790      0.831 0.008 0.000 0.020 0.000 0.856 0.116
#> GSM918635     2  0.0000      0.875 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM918645     5  0.0000      0.910 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM918646     2  0.1461      0.857 0.016 0.940 0.000 0.000 0.000 0.044
#> GSM918648     2  0.0000      0.875 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM918650     5  0.0000      0.910 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM918652     2  0.2006      0.840 0.016 0.904 0.000 0.000 0.000 0.080
#> GSM918653     2  0.0000      0.875 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM918622     3  0.5671      0.489 0.008 0.000 0.564 0.000 0.180 0.248
#> GSM918583     2  0.2006      0.840 0.016 0.904 0.000 0.000 0.000 0.080
#> GSM918585     2  0.0000      0.875 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM918595     5  0.1471      0.884 0.004 0.000 0.000 0.000 0.932 0.064
#> GSM918596     3  0.5068      0.567 0.008 0.000 0.644 0.000 0.112 0.236
#> GSM918602     3  0.4923      0.416 0.016 0.000 0.496 0.000 0.032 0.456
#> GSM918617     2  0.1461      0.857 0.016 0.940 0.000 0.000 0.000 0.044
#> GSM918630     2  0.1461      0.857 0.016 0.940 0.000 0.000 0.000 0.044
#> GSM918631     2  0.0000      0.875 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM918618     4  0.0000      0.618 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM918644     4  0.3063      0.493 0.064 0.000 0.024 0.860 0.000 0.052

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) gender(p) other(p) k
#> ATC:skmeans 75         1.60e-08    0.1187 1.54e-01 2
#> ATC:skmeans 75         1.19e-09    0.3937 1.47e-01 3
#> ATC:skmeans 76         4.89e-13    0.0105 2.33e-02 4
#> ATC:skmeans 74         2.01e-12    0.0173 3.06e-03 5
#> ATC:skmeans 53         6.25e-22    0.1467 9.84e-09 6

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


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 76 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 5.
#> 
#> Following methods can be applied to this 'ConsensusPartition' object:
#>  [1] "cola_report"             "collect_classes"         "collect_plots"          
#>  [4] "collect_stats"           "colnames"                "compare_signatures"     
#>  [7] "consensus_heatmap"       "dimension_reduction"     "functional_enrichment"  
#> [10] "get_anno_col"            "get_anno"                "get_classes"            
#> [13] "get_consensus"           "get_matrix"              "get_membership"         
#> [16] "get_param"               "get_signatures"          "get_stats"              
#> [19] "is_best_k"               "is_stable_k"             "membership_heatmap"     
#> [22] "ncol"                    "nrow"                    "plot_ecdf"              
#> [25] "rownames"                "select_partition_number" "show"                   
#> [28] "suggest_best_k"          "test_to_known_factors"

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

collect_plots(res)

plot of chunk ATC-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 1.000           0.981       0.992         0.4160 0.583   0.583
#> 3 3 0.715           0.804       0.919         0.5680 0.680   0.485
#> 4 4 0.805           0.919       0.939         0.1422 0.811   0.517
#> 5 5 0.917           0.914       0.951         0.0756 0.856   0.519
#> 6 6 0.817           0.841       0.912         0.0246 0.984   0.920

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

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

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

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

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

show/hide code output

cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#>           class entropy silhouette    p1    p2
#> GSM918603     2   0.000      0.995 0.000 1.000
#> GSM918641     2   0.000      0.995 0.000 1.000
#> GSM918580     1   0.000      0.983 1.000 0.000
#> GSM918593     2   0.000      0.995 0.000 1.000
#> GSM918625     1   0.936      0.455 0.648 0.352
#> GSM918638     2   0.000      0.995 0.000 1.000
#> GSM918642     2   0.000      0.995 0.000 1.000
#> GSM918643     2   0.000      0.995 0.000 1.000
#> GSM918619     2   0.000      0.995 0.000 1.000
#> GSM918621     2   0.000      0.995 0.000 1.000
#> GSM918582     2   0.000      0.995 0.000 1.000
#> GSM918649     1   0.000      0.983 1.000 0.000
#> GSM918651     2   0.000      0.995 0.000 1.000
#> GSM918607     2   0.000      0.995 0.000 1.000
#> GSM918609     2   0.000      0.995 0.000 1.000
#> GSM918608     2   0.000      0.995 0.000 1.000
#> GSM918606     2   0.000      0.995 0.000 1.000
#> GSM918620     2   0.482      0.883 0.104 0.896
#> GSM918628     1   0.000      0.983 1.000 0.000
#> GSM918586     2   0.000      0.995 0.000 1.000
#> GSM918594     2   0.000      0.995 0.000 1.000
#> GSM918600     2   0.000      0.995 0.000 1.000
#> GSM918601     2   0.000      0.995 0.000 1.000
#> GSM918612     2   0.000      0.995 0.000 1.000
#> GSM918614     2   0.000      0.995 0.000 1.000
#> GSM918629     2   0.000      0.995 0.000 1.000
#> GSM918587     2   0.000      0.995 0.000 1.000
#> GSM918588     2   0.000      0.995 0.000 1.000
#> GSM918589     2   0.000      0.995 0.000 1.000
#> GSM918611     2   0.000      0.995 0.000 1.000
#> GSM918624     2   0.000      0.995 0.000 1.000
#> GSM918637     2   0.000      0.995 0.000 1.000
#> GSM918639     2   0.000      0.995 0.000 1.000
#> GSM918640     2   0.000      0.995 0.000 1.000
#> GSM918636     2   0.000      0.995 0.000 1.000
#> GSM918590     2   0.000      0.995 0.000 1.000
#> GSM918610     2   0.000      0.995 0.000 1.000
#> GSM918615     2   0.000      0.995 0.000 1.000
#> GSM918616     2   0.000      0.995 0.000 1.000
#> GSM918632     1   0.000      0.983 1.000 0.000
#> GSM918647     1   0.000      0.983 1.000 0.000
#> GSM918578     2   0.000      0.995 0.000 1.000
#> GSM918579     1   0.000      0.983 1.000 0.000
#> GSM918581     1   0.000      0.983 1.000 0.000
#> GSM918584     1   0.000      0.983 1.000 0.000
#> GSM918591     2   0.000      0.995 0.000 1.000
#> GSM918592     2   0.443      0.899 0.092 0.908
#> GSM918597     2   0.000      0.995 0.000 1.000
#> GSM918598     2   0.000      0.995 0.000 1.000
#> GSM918599     1   0.000      0.983 1.000 0.000
#> GSM918604     2   0.000      0.995 0.000 1.000
#> GSM918605     2   0.000      0.995 0.000 1.000
#> GSM918613     2   0.000      0.995 0.000 1.000
#> GSM918623     1   0.000      0.983 1.000 0.000
#> GSM918626     1   0.000      0.983 1.000 0.000
#> GSM918627     2   0.000      0.995 0.000 1.000
#> GSM918633     2   0.000      0.995 0.000 1.000
#> GSM918634     2   0.000      0.995 0.000 1.000
#> GSM918635     1   0.000      0.983 1.000 0.000
#> GSM918645     2   0.000      0.995 0.000 1.000
#> GSM918646     1   0.000      0.983 1.000 0.000
#> GSM918648     1   0.000      0.983 1.000 0.000
#> GSM918650     2   0.278      0.948 0.048 0.952
#> GSM918652     1   0.000      0.983 1.000 0.000
#> GSM918653     1   0.000      0.983 1.000 0.000
#> GSM918622     2   0.000      0.995 0.000 1.000
#> GSM918583     1   0.000      0.983 1.000 0.000
#> GSM918585     1   0.000      0.983 1.000 0.000
#> GSM918595     2   0.000      0.995 0.000 1.000
#> GSM918596     2   0.000      0.995 0.000 1.000
#> GSM918602     2   0.000      0.995 0.000 1.000
#> GSM918617     1   0.000      0.983 1.000 0.000
#> GSM918630     1   0.000      0.983 1.000 0.000
#> GSM918631     1   0.000      0.983 1.000 0.000
#> GSM918618     2   0.000      0.995 0.000 1.000
#> GSM918644     2   0.000      0.995 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
#> GSM918603     1  0.0000     0.9008 1.000 0.000 0.000
#> GSM918641     1  0.0000     0.9008 1.000 0.000 0.000
#> GSM918580     2  0.0424     0.9566 0.008 0.992 0.000
#> GSM918593     1  0.0000     0.9008 1.000 0.000 0.000
#> GSM918625     1  0.0000     0.9008 1.000 0.000 0.000
#> GSM918638     1  0.0000     0.9008 1.000 0.000 0.000
#> GSM918642     1  0.0000     0.9008 1.000 0.000 0.000
#> GSM918643     1  0.0000     0.9008 1.000 0.000 0.000
#> GSM918619     3  0.6126     0.3173 0.400 0.000 0.600
#> GSM918621     1  0.0424     0.8976 0.992 0.000 0.008
#> GSM918582     1  0.0000     0.9008 1.000 0.000 0.000
#> GSM918649     2  0.0424     0.9566 0.008 0.992 0.000
#> GSM918651     1  0.0000     0.9008 1.000 0.000 0.000
#> GSM918607     1  0.0000     0.9008 1.000 0.000 0.000
#> GSM918609     1  0.0000     0.9008 1.000 0.000 0.000
#> GSM918608     1  0.0000     0.9008 1.000 0.000 0.000
#> GSM918606     1  0.0000     0.9008 1.000 0.000 0.000
#> GSM918620     1  0.0000     0.9008 1.000 0.000 0.000
#> GSM918628     2  0.0424     0.9566 0.008 0.992 0.000
#> GSM918586     1  0.5327     0.6548 0.728 0.000 0.272
#> GSM918594     1  0.5254     0.6667 0.736 0.000 0.264
#> GSM918600     3  0.6095     0.3392 0.392 0.000 0.608
#> GSM918601     1  0.5254     0.6667 0.736 0.000 0.264
#> GSM918612     1  0.3482     0.8155 0.872 0.000 0.128
#> GSM918614     1  0.0592     0.8957 0.988 0.000 0.012
#> GSM918629     3  0.4178     0.7178 0.172 0.000 0.828
#> GSM918587     3  0.5254     0.5928 0.264 0.000 0.736
#> GSM918588     3  0.6126     0.3251 0.400 0.000 0.600
#> GSM918589     1  0.0424     0.8976 0.992 0.000 0.008
#> GSM918611     3  0.5988     0.3970 0.368 0.000 0.632
#> GSM918624     3  0.6095     0.3392 0.392 0.000 0.608
#> GSM918637     3  0.0000     0.8684 0.000 0.000 1.000
#> GSM918639     1  0.5835     0.5217 0.660 0.000 0.340
#> GSM918640     1  0.5363     0.6483 0.724 0.000 0.276
#> GSM918636     1  0.3816     0.7974 0.852 0.000 0.148
#> GSM918590     3  0.0000     0.8684 0.000 0.000 1.000
#> GSM918610     3  0.0000     0.8684 0.000 0.000 1.000
#> GSM918615     3  0.0000     0.8684 0.000 0.000 1.000
#> GSM918616     3  0.0000     0.8684 0.000 0.000 1.000
#> GSM918632     2  0.0000     0.9604 0.000 1.000 0.000
#> GSM918647     2  0.0000     0.9604 0.000 1.000 0.000
#> GSM918578     3  0.0000     0.8684 0.000 0.000 1.000
#> GSM918579     2  0.0000     0.9604 0.000 1.000 0.000
#> GSM918581     3  0.5363     0.5156 0.000 0.276 0.724
#> GSM918584     3  0.5254     0.5347 0.000 0.264 0.736
#> GSM918591     3  0.0000     0.8684 0.000 0.000 1.000
#> GSM918592     3  0.0000     0.8684 0.000 0.000 1.000
#> GSM918597     3  0.0000     0.8684 0.000 0.000 1.000
#> GSM918598     3  0.0000     0.8684 0.000 0.000 1.000
#> GSM918599     2  0.0000     0.9604 0.000 1.000 0.000
#> GSM918604     1  0.6307     0.0567 0.512 0.000 0.488
#> GSM918605     3  0.0000     0.8684 0.000 0.000 1.000
#> GSM918613     3  0.0000     0.8684 0.000 0.000 1.000
#> GSM918623     2  0.0000     0.9604 0.000 1.000 0.000
#> GSM918626     2  0.5882     0.4234 0.000 0.652 0.348
#> GSM918627     3  0.0000     0.8684 0.000 0.000 1.000
#> GSM918633     3  0.0000     0.8684 0.000 0.000 1.000
#> GSM918634     3  0.0000     0.8684 0.000 0.000 1.000
#> GSM918635     2  0.0000     0.9604 0.000 1.000 0.000
#> GSM918645     3  0.0000     0.8684 0.000 0.000 1.000
#> GSM918646     2  0.0592     0.9539 0.000 0.988 0.012
#> GSM918648     2  0.0000     0.9604 0.000 1.000 0.000
#> GSM918650     3  0.0000     0.8684 0.000 0.000 1.000
#> GSM918652     3  0.5948     0.3591 0.000 0.360 0.640
#> GSM918653     2  0.0000     0.9604 0.000 1.000 0.000
#> GSM918622     3  0.0424     0.8644 0.008 0.000 0.992
#> GSM918583     2  0.0424     0.9568 0.000 0.992 0.008
#> GSM918585     2  0.0000     0.9604 0.000 1.000 0.000
#> GSM918595     3  0.0000     0.8684 0.000 0.000 1.000
#> GSM918596     3  0.0424     0.8645 0.008 0.000 0.992
#> GSM918602     3  0.0592     0.8620 0.012 0.000 0.988
#> GSM918617     2  0.4605     0.7191 0.000 0.796 0.204
#> GSM918630     2  0.0424     0.9568 0.000 0.992 0.008
#> GSM918631     2  0.0000     0.9604 0.000 1.000 0.000
#> GSM918618     1  0.0000     0.9008 1.000 0.000 0.000
#> GSM918644     1  0.0000     0.9008 1.000 0.000 0.000

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM918603     4  0.0336      0.965 0.000 0.000 0.008 0.992
#> GSM918641     4  0.0336      0.965 0.000 0.000 0.008 0.992
#> GSM918580     1  0.0336      0.981 0.992 0.000 0.000 0.008
#> GSM918593     4  0.0707      0.957 0.000 0.000 0.020 0.980
#> GSM918625     4  0.1211      0.949 0.000 0.000 0.040 0.960
#> GSM918638     4  0.0336      0.965 0.000 0.000 0.008 0.992
#> GSM918642     4  0.0336      0.965 0.000 0.000 0.008 0.992
#> GSM918643     4  0.0336      0.965 0.000 0.000 0.008 0.992
#> GSM918619     3  0.2654      0.883 0.000 0.108 0.888 0.004
#> GSM918621     3  0.2921      0.876 0.000 0.000 0.860 0.140
#> GSM918582     3  0.2704      0.889 0.000 0.000 0.876 0.124
#> GSM918649     1  0.0000      0.982 1.000 0.000 0.000 0.000
#> GSM918651     3  0.2530      0.894 0.000 0.000 0.888 0.112
#> GSM918607     4  0.0336      0.965 0.000 0.000 0.008 0.992
#> GSM918609     3  0.2469      0.895 0.000 0.000 0.892 0.108
#> GSM918608     3  0.2704      0.889 0.000 0.000 0.876 0.124
#> GSM918606     4  0.1940      0.923 0.000 0.000 0.076 0.924
#> GSM918620     4  0.1211      0.949 0.000 0.000 0.040 0.960
#> GSM918628     1  0.0000      0.982 1.000 0.000 0.000 0.000
#> GSM918586     3  0.0000      0.900 0.000 0.000 1.000 0.000
#> GSM918594     3  0.1792      0.881 0.000 0.000 0.932 0.068
#> GSM918600     3  0.0707      0.903 0.000 0.020 0.980 0.000
#> GSM918601     3  0.1389      0.891 0.000 0.000 0.952 0.048
#> GSM918612     3  0.3356      0.856 0.000 0.000 0.824 0.176
#> GSM918614     3  0.4008      0.776 0.000 0.000 0.756 0.244
#> GSM918629     3  0.2469      0.883 0.000 0.108 0.892 0.000
#> GSM918587     3  0.2469      0.883 0.000 0.108 0.892 0.000
#> GSM918588     3  0.2867      0.885 0.000 0.104 0.884 0.012
#> GSM918589     3  0.2530      0.894 0.000 0.000 0.888 0.112
#> GSM918611     3  0.0188      0.899 0.000 0.004 0.996 0.000
#> GSM918624     3  0.2216      0.890 0.000 0.092 0.908 0.000
#> GSM918637     3  0.3528      0.815 0.000 0.192 0.808 0.000
#> GSM918639     3  0.1022      0.895 0.000 0.000 0.968 0.032
#> GSM918640     3  0.1022      0.895 0.000 0.000 0.968 0.032
#> GSM918636     3  0.2530      0.894 0.000 0.000 0.888 0.112
#> GSM918590     2  0.0000      0.946 0.000 1.000 0.000 0.000
#> GSM918610     2  0.0000      0.946 0.000 1.000 0.000 0.000
#> GSM918615     2  0.0000      0.946 0.000 1.000 0.000 0.000
#> GSM918616     2  0.2530      0.886 0.000 0.888 0.112 0.000
#> GSM918632     1  0.0000      0.982 1.000 0.000 0.000 0.000
#> GSM918647     1  0.0000      0.982 1.000 0.000 0.000 0.000
#> GSM918578     2  0.2408      0.889 0.000 0.896 0.104 0.000
#> GSM918579     1  0.0336      0.981 0.992 0.000 0.000 0.008
#> GSM918581     2  0.0469      0.941 0.012 0.988 0.000 0.000
#> GSM918584     2  0.0000      0.946 0.000 1.000 0.000 0.000
#> GSM918591     2  0.0000      0.946 0.000 1.000 0.000 0.000
#> GSM918592     2  0.0000      0.946 0.000 1.000 0.000 0.000
#> GSM918597     2  0.0000      0.946 0.000 1.000 0.000 0.000
#> GSM918598     2  0.0336      0.944 0.000 0.992 0.008 0.000
#> GSM918599     1  0.0336      0.981 0.992 0.000 0.000 0.008
#> GSM918604     3  0.2965      0.902 0.000 0.036 0.892 0.072
#> GSM918605     2  0.0000      0.946 0.000 1.000 0.000 0.000
#> GSM918613     2  0.1867      0.895 0.000 0.928 0.072 0.000
#> GSM918623     1  0.0000      0.982 1.000 0.000 0.000 0.000
#> GSM918626     1  0.2589      0.868 0.884 0.116 0.000 0.000
#> GSM918627     2  0.2530      0.886 0.000 0.888 0.112 0.000
#> GSM918633     2  0.0000      0.946 0.000 1.000 0.000 0.000
#> GSM918634     2  0.0336      0.943 0.000 0.992 0.008 0.000
#> GSM918635     1  0.0000      0.982 1.000 0.000 0.000 0.000
#> GSM918645     2  0.0000      0.946 0.000 1.000 0.000 0.000
#> GSM918646     1  0.0188      0.980 0.996 0.004 0.000 0.000
#> GSM918648     1  0.0336      0.981 0.992 0.000 0.000 0.008
#> GSM918650     2  0.0000      0.946 0.000 1.000 0.000 0.000
#> GSM918652     2  0.4500      0.518 0.316 0.684 0.000 0.000
#> GSM918653     1  0.0336      0.981 0.992 0.000 0.000 0.008
#> GSM918622     2  0.3172      0.851 0.000 0.840 0.160 0.000
#> GSM918583     1  0.0188      0.980 0.996 0.004 0.000 0.000
#> GSM918585     1  0.0336      0.981 0.992 0.000 0.000 0.008
#> GSM918595     2  0.2408      0.889 0.000 0.896 0.104 0.000
#> GSM918596     3  0.0188      0.899 0.000 0.004 0.996 0.000
#> GSM918602     3  0.1118      0.889 0.000 0.036 0.964 0.000
#> GSM918617     1  0.2408      0.880 0.896 0.104 0.000 0.000
#> GSM918630     1  0.0000      0.982 1.000 0.000 0.000 0.000
#> GSM918631     1  0.0336      0.981 0.992 0.000 0.000 0.008
#> GSM918618     4  0.0336      0.965 0.000 0.000 0.008 0.992
#> GSM918644     4  0.3801      0.729 0.000 0.000 0.220 0.780

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>           class entropy silhouette    p1    p2    p3    p4    p5
#> GSM918603     4  0.0404      0.942 0.012 0.000 0.000 0.988 0.000
#> GSM918641     4  0.0404      0.942 0.012 0.000 0.000 0.988 0.000
#> GSM918580     5  0.0566      0.990 0.004 0.000 0.000 0.012 0.984
#> GSM918593     4  0.0451      0.940 0.008 0.000 0.004 0.988 0.000
#> GSM918625     4  0.3242      0.737 0.216 0.000 0.000 0.784 0.000
#> GSM918638     4  0.0963      0.929 0.036 0.000 0.000 0.964 0.000
#> GSM918642     4  0.0404      0.942 0.012 0.000 0.000 0.988 0.000
#> GSM918643     4  0.0404      0.942 0.012 0.000 0.000 0.988 0.000
#> GSM918619     1  0.0693      0.929 0.980 0.012 0.008 0.000 0.000
#> GSM918621     1  0.1830      0.907 0.924 0.000 0.008 0.068 0.000
#> GSM918582     1  0.0162      0.933 0.996 0.000 0.004 0.000 0.000
#> GSM918649     5  0.0000      0.993 0.000 0.000 0.000 0.000 1.000
#> GSM918651     1  0.0162      0.933 0.996 0.000 0.004 0.000 0.000
#> GSM918607     1  0.3730      0.587 0.712 0.000 0.000 0.288 0.000
#> GSM918609     1  0.1830      0.907 0.924 0.000 0.008 0.068 0.000
#> GSM918608     1  0.0162      0.933 0.996 0.000 0.004 0.000 0.000
#> GSM918606     1  0.2179      0.869 0.888 0.000 0.000 0.112 0.000
#> GSM918620     1  0.0162      0.932 0.996 0.000 0.000 0.004 0.000
#> GSM918628     5  0.0000      0.993 0.000 0.000 0.000 0.000 1.000
#> GSM918586     3  0.0000      0.892 0.000 0.000 1.000 0.000 0.000
#> GSM918594     3  0.0162      0.890 0.000 0.000 0.996 0.004 0.000
#> GSM918600     3  0.2605      0.825 0.148 0.000 0.852 0.000 0.000
#> GSM918601     3  0.0000      0.892 0.000 0.000 1.000 0.000 0.000
#> GSM918612     4  0.3132      0.805 0.008 0.000 0.172 0.820 0.000
#> GSM918614     4  0.1956      0.899 0.008 0.000 0.076 0.916 0.000
#> GSM918629     3  0.3183      0.805 0.156 0.016 0.828 0.000 0.000
#> GSM918587     3  0.4435      0.544 0.336 0.016 0.648 0.000 0.000
#> GSM918588     1  0.1597      0.917 0.940 0.012 0.048 0.000 0.000
#> GSM918589     1  0.1831      0.904 0.920 0.000 0.076 0.004 0.000
#> GSM918611     3  0.0794      0.888 0.028 0.000 0.972 0.000 0.000
#> GSM918624     3  0.2677      0.841 0.112 0.016 0.872 0.000 0.000
#> GSM918637     3  0.2690      0.819 0.000 0.156 0.844 0.000 0.000
#> GSM918639     3  0.0000      0.892 0.000 0.000 1.000 0.000 0.000
#> GSM918640     3  0.0000      0.892 0.000 0.000 1.000 0.000 0.000
#> GSM918636     1  0.1197      0.921 0.952 0.000 0.048 0.000 0.000
#> GSM918590     2  0.0000      0.966 0.000 1.000 0.000 0.000 0.000
#> GSM918610     2  0.0000      0.966 0.000 1.000 0.000 0.000 0.000
#> GSM918615     2  0.0000      0.966 0.000 1.000 0.000 0.000 0.000
#> GSM918616     3  0.3074      0.774 0.000 0.196 0.804 0.000 0.000
#> GSM918632     5  0.0000      0.993 0.000 0.000 0.000 0.000 1.000
#> GSM918647     5  0.0000      0.993 0.000 0.000 0.000 0.000 1.000
#> GSM918578     2  0.0510      0.955 0.000 0.984 0.016 0.000 0.000
#> GSM918579     5  0.0566      0.990 0.004 0.000 0.000 0.012 0.984
#> GSM918581     2  0.0510      0.955 0.000 0.984 0.000 0.000 0.016
#> GSM918584     2  0.0000      0.966 0.000 1.000 0.000 0.000 0.000
#> GSM918591     2  0.0000      0.966 0.000 1.000 0.000 0.000 0.000
#> GSM918592     2  0.0000      0.966 0.000 1.000 0.000 0.000 0.000
#> GSM918597     2  0.1410      0.908 0.000 0.940 0.060 0.000 0.000
#> GSM918598     2  0.0000      0.966 0.000 1.000 0.000 0.000 0.000
#> GSM918599     5  0.0566      0.990 0.004 0.000 0.000 0.012 0.984
#> GSM918604     1  0.1484      0.919 0.944 0.008 0.048 0.000 0.000
#> GSM918605     2  0.0000      0.966 0.000 1.000 0.000 0.000 0.000
#> GSM918613     3  0.1851      0.875 0.000 0.088 0.912 0.000 0.000
#> GSM918623     5  0.0000      0.993 0.000 0.000 0.000 0.000 1.000
#> GSM918626     5  0.0671      0.978 0.004 0.016 0.000 0.000 0.980
#> GSM918627     3  0.1671      0.875 0.000 0.076 0.924 0.000 0.000
#> GSM918633     2  0.0000      0.966 0.000 1.000 0.000 0.000 0.000
#> GSM918634     3  0.3366      0.761 0.000 0.232 0.768 0.000 0.000
#> GSM918635     5  0.0000      0.993 0.000 0.000 0.000 0.000 1.000
#> GSM918645     2  0.0000      0.966 0.000 1.000 0.000 0.000 0.000
#> GSM918646     5  0.0000      0.993 0.000 0.000 0.000 0.000 1.000
#> GSM918648     5  0.0566      0.990 0.004 0.000 0.000 0.012 0.984
#> GSM918650     2  0.0000      0.966 0.000 1.000 0.000 0.000 0.000
#> GSM918652     2  0.3913      0.524 0.000 0.676 0.000 0.000 0.324
#> GSM918653     5  0.0566      0.990 0.004 0.000 0.000 0.012 0.984
#> GSM918622     3  0.1608      0.877 0.000 0.072 0.928 0.000 0.000
#> GSM918583     5  0.0162      0.991 0.000 0.004 0.000 0.000 0.996
#> GSM918585     5  0.0566      0.990 0.004 0.000 0.000 0.012 0.984
#> GSM918595     2  0.0510      0.955 0.000 0.984 0.016 0.000 0.000
#> GSM918596     3  0.0703      0.893 0.000 0.024 0.976 0.000 0.000
#> GSM918602     3  0.0794      0.893 0.000 0.028 0.972 0.000 0.000
#> GSM918617     5  0.0162      0.990 0.000 0.004 0.000 0.000 0.996
#> GSM918630     5  0.0000      0.993 0.000 0.000 0.000 0.000 1.000
#> GSM918631     5  0.0566      0.990 0.004 0.000 0.000 0.012 0.984
#> GSM918618     4  0.0404      0.942 0.012 0.000 0.000 0.988 0.000
#> GSM918644     1  0.0451      0.933 0.988 0.000 0.004 0.008 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
#> GSM918603     4  0.0000      0.917 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM918641     4  0.0000      0.917 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM918580     6  0.3482      0.663 0.000 0.316 0.000 0.000 0.000 0.684
#> GSM918593     4  0.0000      0.917 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM918625     4  0.3081      0.679 0.220 0.000 0.000 0.776 0.000 0.004
#> GSM918638     4  0.0632      0.901 0.024 0.000 0.000 0.976 0.000 0.000
#> GSM918642     4  0.0000      0.917 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM918643     4  0.0000      0.917 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM918619     1  0.0291      0.903 0.992 0.000 0.004 0.000 0.000 0.004
#> GSM918621     1  0.1501      0.876 0.924 0.000 0.000 0.076 0.000 0.000
#> GSM918582     1  0.0146      0.904 0.996 0.000 0.000 0.000 0.000 0.004
#> GSM918649     6  0.1556      0.825 0.000 0.080 0.000 0.000 0.000 0.920
#> GSM918651     1  0.0146      0.904 0.996 0.000 0.000 0.000 0.000 0.004
#> GSM918607     1  0.3390      0.564 0.704 0.000 0.000 0.296 0.000 0.000
#> GSM918609     1  0.1501      0.876 0.924 0.000 0.000 0.076 0.000 0.000
#> GSM918608     1  0.0146      0.904 0.996 0.000 0.000 0.000 0.000 0.004
#> GSM918606     1  0.2092      0.837 0.876 0.000 0.000 0.124 0.000 0.000
#> GSM918620     1  0.0146      0.904 0.996 0.000 0.000 0.000 0.000 0.004
#> GSM918628     6  0.1556      0.825 0.000 0.080 0.000 0.000 0.000 0.920
#> GSM918586     3  0.0146      0.838 0.004 0.000 0.996 0.000 0.000 0.000
#> GSM918594     3  0.1556      0.837 0.000 0.000 0.920 0.000 0.000 0.080
#> GSM918600     3  0.2378      0.767 0.152 0.000 0.848 0.000 0.000 0.000
#> GSM918601     3  0.1556      0.837 0.000 0.000 0.920 0.000 0.000 0.080
#> GSM918612     4  0.3052      0.708 0.004 0.000 0.216 0.780 0.000 0.000
#> GSM918614     4  0.2672      0.823 0.000 0.000 0.052 0.868 0.000 0.080
#> GSM918629     3  0.2527      0.747 0.168 0.000 0.832 0.000 0.000 0.000
#> GSM918587     3  0.3607      0.472 0.348 0.000 0.652 0.000 0.000 0.000
#> GSM918588     1  0.1910      0.865 0.892 0.000 0.108 0.000 0.000 0.000
#> GSM918589     1  0.2278      0.851 0.868 0.000 0.128 0.004 0.000 0.000
#> GSM918611     3  0.0632      0.837 0.024 0.000 0.976 0.000 0.000 0.000
#> GSM918624     3  0.3544      0.792 0.120 0.000 0.800 0.000 0.000 0.080
#> GSM918637     3  0.3770      0.773 0.000 0.000 0.776 0.000 0.148 0.076
#> GSM918639     3  0.1556      0.837 0.000 0.000 0.920 0.000 0.000 0.080
#> GSM918640     3  0.1556      0.837 0.000 0.000 0.920 0.000 0.000 0.080
#> GSM918636     1  0.1910      0.865 0.892 0.000 0.108 0.000 0.000 0.000
#> GSM918590     5  0.0000      0.953 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM918610     5  0.0000      0.953 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM918615     5  0.0000      0.953 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM918616     3  0.3076      0.703 0.000 0.000 0.760 0.000 0.240 0.000
#> GSM918632     2  0.3023      0.852 0.000 0.768 0.000 0.000 0.000 0.232
#> GSM918647     2  0.3023      0.852 0.000 0.768 0.000 0.000 0.000 0.232
#> GSM918578     5  0.0000      0.953 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM918579     2  0.0000      0.775 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM918581     5  0.2996      0.669 0.000 0.000 0.000 0.000 0.772 0.228
#> GSM918584     5  0.0000      0.953 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM918591     5  0.0000      0.953 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM918592     5  0.0000      0.953 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM918597     5  0.1267      0.886 0.000 0.000 0.060 0.000 0.940 0.000
#> GSM918598     5  0.0000      0.953 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM918599     2  0.0146      0.777 0.000 0.996 0.000 0.000 0.000 0.004
#> GSM918604     1  0.1910      0.865 0.892 0.000 0.108 0.000 0.000 0.000
#> GSM918605     5  0.0000      0.953 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM918613     3  0.2178      0.813 0.000 0.000 0.868 0.000 0.132 0.000
#> GSM918623     2  0.3023      0.852 0.000 0.768 0.000 0.000 0.000 0.232
#> GSM918626     2  0.3163      0.848 0.000 0.764 0.000 0.000 0.004 0.232
#> GSM918627     3  0.2178      0.813 0.000 0.000 0.868 0.000 0.132 0.000
#> GSM918633     5  0.0000      0.953 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM918634     3  0.3309      0.693 0.000 0.000 0.720 0.000 0.280 0.000
#> GSM918635     2  0.3023      0.852 0.000 0.768 0.000 0.000 0.000 0.232
#> GSM918645     5  0.0000      0.953 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM918646     2  0.3023      0.852 0.000 0.768 0.000 0.000 0.000 0.232
#> GSM918648     2  0.0000      0.775 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM918650     5  0.0000      0.953 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM918652     5  0.3974      0.584 0.000 0.048 0.000 0.000 0.728 0.224
#> GSM918653     2  0.0000      0.775 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM918622     3  0.2178      0.813 0.000 0.000 0.868 0.000 0.132 0.000
#> GSM918583     2  0.3023      0.852 0.000 0.768 0.000 0.000 0.000 0.232
#> GSM918585     2  0.0000      0.775 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM918595     5  0.0000      0.953 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM918596     3  0.0603      0.842 0.004 0.000 0.980 0.000 0.016 0.000
#> GSM918602     3  0.0692      0.842 0.004 0.000 0.976 0.000 0.020 0.000
#> GSM918617     2  0.3023      0.852 0.000 0.768 0.000 0.000 0.000 0.232
#> GSM918630     2  0.3023      0.852 0.000 0.768 0.000 0.000 0.000 0.232
#> GSM918631     2  0.0000      0.775 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM918618     4  0.0000      0.917 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM918644     1  0.0363      0.903 0.988 0.000 0.000 0.012 0.000 0.000

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

consensus_heatmap(res, k = 2)

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

consensus_heatmap(res, k = 3)

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

consensus_heatmap(res, k = 4)

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

consensus_heatmap(res, k = 5)

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

consensus_heatmap(res, k = 6)

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

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

membership_heatmap(res, k = 2)

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

membership_heatmap(res, k = 3)

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

membership_heatmap(res, k = 4)

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

membership_heatmap(res, k = 5)

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

membership_heatmap(res, k = 6)

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

As soon as we have had the classes for columns, we can look for signatures which are significantly different between classes which can be candidate marks for certain classes. Following are the heatmaps for signatures.

Signature heatmaps where rows are scaled:

get_signatures(res, k = 2)

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

get_signatures(res, k = 3)

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

get_signatures(res, k = 4)

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

get_signatures(res, k = 5)

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

get_signatures(res, k = 6)

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

Signature heatmaps where rows are not scaled:

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

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

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

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

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

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

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

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

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

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

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk ATC-pam-signature_compare

get_signature() returns a data frame invisibly. TO get the list of signatures, the function call should be assigned to a variable explicitly. In following code, if plot argument is set to FALSE, no heatmap is plotted while only the differential analysis is performed.

# code only for demonstration
tb = get_signature(res, k = ..., plot = FALSE)

An example of the output of tb is:

#>   which_row         fdr    mean_1    mean_2 scaled_mean_1 scaled_mean_2 km
#> 1        38 0.042760348  8.373488  9.131774    -0.5533452     0.5164555  1
#> 2        40 0.018707592  7.106213  8.469186    -0.6173731     0.5762149  1
#> 3        55 0.019134737 10.221463 11.207825    -0.6159697     0.5749050  1
#> 4        59 0.006059896  5.921854  7.869574    -0.6899429     0.6439467  1
#> 5        60 0.018055526  8.928898 10.211722    -0.6204761     0.5791110  1
#> 6        98 0.009384629 15.714769 14.887706     0.6635654    -0.6193277  2
...

The columns in tb are:

  1. which_row: row indices corresponding to the input matrix.
  2. fdr: FDR for the differential test.
  3. mean_x: The mean value in group x.
  4. scaled_mean_x: The mean value in group x after rows are scaled.
  5. km: Row groups if k-means clustering is applied to rows.

UMAP plot which shows how samples are separated.

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

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

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

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

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

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

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

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

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

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

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk ATC-pam-collect-classes

Test correlation between subgroups and known annotations. If the known annotation is numeric, one-way ANOVA test is applied, and if the known annotation is discrete, chi-squared contingency table test is applied.

test_to_known_factors(res)
#>          n disease.state(p) gender(p) other(p) k
#> ATC:pam 75         2.70e-03  1.000000  0.26385 2
#> ATC:pam 68         3.39e-08  0.067725  0.09835 3
#> ATC:pam 76         6.96e-17  0.000594  0.02465 4
#> ATC:pam 76         4.99e-17  0.030566  0.04665 5
#> ATC:pam 75         4.84e-20  0.066738  0.00143 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 76 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 5.
#> 
#> Following methods can be applied to this 'ConsensusPartition' object:
#>  [1] "cola_report"             "collect_classes"         "collect_plots"          
#>  [4] "collect_stats"           "colnames"                "compare_signatures"     
#>  [7] "consensus_heatmap"       "dimension_reduction"     "functional_enrichment"  
#> [10] "get_anno_col"            "get_anno"                "get_classes"            
#> [13] "get_consensus"           "get_matrix"              "get_membership"         
#> [16] "get_param"               "get_signatures"          "get_stats"              
#> [19] "is_best_k"               "is_stable_k"             "membership_heatmap"     
#> [22] "ncol"                    "nrow"                    "plot_ecdf"              
#> [25] "rownames"                "select_partition_number" "show"                   
#> [28] "suggest_best_k"          "test_to_known_factors"

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

collect_plots(res)

plot of chunk ATC-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.226           0.665       0.782         0.4237 0.595   0.595
#> 3 3 0.702           0.895       0.893         0.5385 0.508   0.312
#> 4 4 0.738           0.833       0.890         0.1272 0.833   0.571
#> 5 5 0.903           0.892       0.941         0.0467 0.928   0.748
#> 6 6 0.739           0.667       0.794         0.0371 0.902   0.638

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

suggest_best_k(res)
#> [1] 5

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

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

show/hide code output

cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#>           class entropy silhouette    p1    p2
#> GSM918603     2  0.0000      0.670 0.000 1.000
#> GSM918641     2  0.0000      0.670 0.000 1.000
#> GSM918580     1  0.9998      0.418 0.508 0.492
#> GSM918593     2  0.0000      0.670 0.000 1.000
#> GSM918625     2  0.6531      0.419 0.168 0.832
#> GSM918638     2  0.0000      0.670 0.000 1.000
#> GSM918642     2  0.0000      0.670 0.000 1.000
#> GSM918643     2  0.0000      0.670 0.000 1.000
#> GSM918619     2  0.0000      0.670 0.000 1.000
#> GSM918621     2  0.0000      0.670 0.000 1.000
#> GSM918582     2  0.0000      0.670 0.000 1.000
#> GSM918649     1  0.9998      0.418 0.508 0.492
#> GSM918651     2  0.0000      0.670 0.000 1.000
#> GSM918607     2  0.0000      0.670 0.000 1.000
#> GSM918609     2  0.0000      0.670 0.000 1.000
#> GSM918608     2  0.0000      0.670 0.000 1.000
#> GSM918606     2  0.0000      0.670 0.000 1.000
#> GSM918620     2  0.0000      0.670 0.000 1.000
#> GSM918628     1  0.9998      0.418 0.508 0.492
#> GSM918586     2  0.7139      0.713 0.196 0.804
#> GSM918594     2  0.7139      0.713 0.196 0.804
#> GSM918600     2  0.7056      0.713 0.192 0.808
#> GSM918601     2  0.7219      0.713 0.200 0.800
#> GSM918612     2  0.5842      0.705 0.140 0.860
#> GSM918614     2  0.7139      0.713 0.196 0.804
#> GSM918629     2  0.7883      0.698 0.236 0.764
#> GSM918587     2  0.2043      0.671 0.032 0.968
#> GSM918588     2  0.7139      0.713 0.196 0.804
#> GSM918589     2  0.7139      0.713 0.196 0.804
#> GSM918611     2  0.8327      0.688 0.264 0.736
#> GSM918624     2  0.7219      0.713 0.200 0.800
#> GSM918637     2  0.9248      0.630 0.340 0.660
#> GSM918639     2  0.7219      0.713 0.200 0.800
#> GSM918640     2  0.7219      0.713 0.200 0.800
#> GSM918636     2  0.7139      0.713 0.196 0.804
#> GSM918590     2  0.9988      0.586 0.480 0.520
#> GSM918610     2  0.9993      0.582 0.484 0.516
#> GSM918615     2  0.9993      0.582 0.484 0.516
#> GSM918616     2  0.9983      0.590 0.476 0.524
#> GSM918632     1  0.4939      0.849 0.892 0.108
#> GSM918647     1  0.4939      0.849 0.892 0.108
#> GSM918578     2  0.9993      0.582 0.484 0.516
#> GSM918579     1  0.4690      0.849 0.900 0.100
#> GSM918581     1  0.0938      0.735 0.988 0.012
#> GSM918584     1  0.9963     -0.512 0.536 0.464
#> GSM918591     2  0.9993      0.582 0.484 0.516
#> GSM918592     2  0.9993      0.582 0.484 0.516
#> GSM918597     2  0.9963      0.601 0.464 0.536
#> GSM918598     2  0.9993      0.582 0.484 0.516
#> GSM918599     1  0.4815      0.850 0.896 0.104
#> GSM918604     2  0.0000      0.670 0.000 1.000
#> GSM918605     2  0.9993      0.582 0.484 0.516
#> GSM918613     2  0.9954      0.605 0.460 0.540
#> GSM918623     1  0.4815      0.850 0.896 0.104
#> GSM918626     1  0.5842      0.817 0.860 0.140
#> GSM918627     2  0.9993      0.582 0.484 0.516
#> GSM918633     2  0.9993      0.582 0.484 0.516
#> GSM918634     2  0.9963      0.601 0.464 0.536
#> GSM918635     1  0.4939      0.849 0.892 0.108
#> GSM918645     2  0.9993      0.582 0.484 0.516
#> GSM918646     1  0.4939      0.849 0.892 0.108
#> GSM918648     1  0.4690      0.849 0.900 0.100
#> GSM918650     2  0.9993      0.582 0.484 0.516
#> GSM918652     1  0.0672      0.736 0.992 0.008
#> GSM918653     1  0.4690      0.849 0.900 0.100
#> GSM918622     2  0.9963      0.601 0.464 0.536
#> GSM918583     1  0.4939      0.849 0.892 0.108
#> GSM918585     1  0.4690      0.849 0.900 0.100
#> GSM918595     2  0.9993      0.582 0.484 0.516
#> GSM918596     2  0.9954      0.605 0.460 0.540
#> GSM918602     2  0.9580      0.655 0.380 0.620
#> GSM918617     1  0.4939      0.849 0.892 0.108
#> GSM918630     1  0.4939      0.849 0.892 0.108
#> GSM918631     1  0.4690      0.849 0.900 0.100
#> GSM918618     2  0.0000      0.670 0.000 1.000
#> GSM918644     2  0.7139      0.713 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
#> GSM918603     1  0.3686      0.912 0.860 0.000 0.140
#> GSM918641     1  0.3752      0.913 0.856 0.000 0.144
#> GSM918580     1  0.0237      0.816 0.996 0.000 0.004
#> GSM918593     1  0.3686      0.912 0.860 0.000 0.140
#> GSM918625     1  0.3267      0.904 0.884 0.000 0.116
#> GSM918638     1  0.3340      0.905 0.880 0.000 0.120
#> GSM918642     1  0.3752      0.913 0.856 0.000 0.144
#> GSM918643     1  0.3816      0.912 0.852 0.000 0.148
#> GSM918619     1  0.5810      0.744 0.664 0.000 0.336
#> GSM918621     1  0.5733      0.759 0.676 0.000 0.324
#> GSM918582     1  0.3340      0.905 0.880 0.000 0.120
#> GSM918649     1  0.0237      0.816 0.996 0.000 0.004
#> GSM918651     1  0.3879      0.910 0.848 0.000 0.152
#> GSM918607     1  0.3816      0.912 0.852 0.000 0.148
#> GSM918609     1  0.5138      0.836 0.748 0.000 0.252
#> GSM918608     1  0.3752      0.913 0.856 0.000 0.144
#> GSM918606     1  0.3752      0.913 0.856 0.000 0.144
#> GSM918620     1  0.3267      0.904 0.884 0.000 0.116
#> GSM918628     1  0.0237      0.816 0.996 0.000 0.004
#> GSM918586     3  0.0000      0.911 0.000 0.000 1.000
#> GSM918594     3  0.1411      0.895 0.036 0.000 0.964
#> GSM918600     3  0.0000      0.911 0.000 0.000 1.000
#> GSM918601     3  0.0000      0.911 0.000 0.000 1.000
#> GSM918612     3  0.4974      0.644 0.236 0.000 0.764
#> GSM918614     3  0.0237      0.909 0.004 0.000 0.996
#> GSM918629     3  0.0000      0.911 0.000 0.000 1.000
#> GSM918587     1  0.5988      0.696 0.632 0.000 0.368
#> GSM918588     3  0.2537      0.861 0.080 0.000 0.920
#> GSM918589     3  0.0000      0.911 0.000 0.000 1.000
#> GSM918611     3  0.0237      0.909 0.000 0.004 0.996
#> GSM918624     3  0.0000      0.911 0.000 0.000 1.000
#> GSM918637     3  0.3267      0.837 0.000 0.116 0.884
#> GSM918639     3  0.0000      0.911 0.000 0.000 1.000
#> GSM918640     3  0.0000      0.911 0.000 0.000 1.000
#> GSM918636     3  0.2356      0.866 0.072 0.000 0.928
#> GSM918590     2  0.0424      0.952 0.000 0.992 0.008
#> GSM918610     2  0.0000      0.954 0.000 1.000 0.000
#> GSM918615     2  0.0000      0.954 0.000 1.000 0.000
#> GSM918616     2  0.0592      0.949 0.000 0.988 0.012
#> GSM918632     2  0.3500      0.925 0.116 0.880 0.004
#> GSM918647     2  0.3425      0.927 0.112 0.884 0.004
#> GSM918578     2  0.0000      0.954 0.000 1.000 0.000
#> GSM918579     2  0.3340      0.925 0.120 0.880 0.000
#> GSM918581     2  0.0475      0.954 0.004 0.992 0.004
#> GSM918584     2  0.0000      0.954 0.000 1.000 0.000
#> GSM918591     2  0.0000      0.954 0.000 1.000 0.000
#> GSM918592     2  0.0000      0.954 0.000 1.000 0.000
#> GSM918597     2  0.1964      0.915 0.000 0.944 0.056
#> GSM918598     2  0.0000      0.954 0.000 1.000 0.000
#> GSM918599     2  0.3340      0.925 0.120 0.880 0.000
#> GSM918604     1  0.6204      0.590 0.576 0.000 0.424
#> GSM918605     2  0.0000      0.954 0.000 1.000 0.000
#> GSM918613     3  0.3340      0.835 0.000 0.120 0.880
#> GSM918623     2  0.3500      0.925 0.116 0.880 0.004
#> GSM918626     2  0.4209      0.910 0.120 0.860 0.020
#> GSM918627     2  0.0000      0.954 0.000 1.000 0.000
#> GSM918633     2  0.0000      0.954 0.000 1.000 0.000
#> GSM918634     2  0.1163      0.940 0.000 0.972 0.028
#> GSM918635     2  0.3500      0.925 0.116 0.880 0.004
#> GSM918645     2  0.0000      0.954 0.000 1.000 0.000
#> GSM918646     2  0.0475      0.954 0.004 0.992 0.004
#> GSM918648     2  0.3340      0.925 0.120 0.880 0.000
#> GSM918650     2  0.0000      0.954 0.000 1.000 0.000
#> GSM918652     2  0.0475      0.954 0.004 0.992 0.004
#> GSM918653     2  0.3340      0.925 0.120 0.880 0.000
#> GSM918622     3  0.5810      0.552 0.000 0.336 0.664
#> GSM918583     2  0.1267      0.952 0.024 0.972 0.004
#> GSM918585     2  0.3340      0.925 0.120 0.880 0.000
#> GSM918595     2  0.0000      0.954 0.000 1.000 0.000
#> GSM918596     3  0.3340      0.835 0.000 0.120 0.880
#> GSM918602     3  0.3340      0.835 0.000 0.120 0.880
#> GSM918617     2  0.1647      0.949 0.036 0.960 0.004
#> GSM918630     2  0.3500      0.925 0.116 0.880 0.004
#> GSM918631     2  0.3340      0.925 0.120 0.880 0.000
#> GSM918618     1  0.3752      0.913 0.856 0.000 0.144
#> GSM918644     3  0.0747      0.904 0.016 0.000 0.984

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM918603     1  0.1302      0.932 0.956 0.000 0.044 0.000
#> GSM918641     1  0.2469      0.916 0.892 0.000 0.108 0.000
#> GSM918580     1  0.3818      0.863 0.844 0.000 0.048 0.108
#> GSM918593     1  0.1474      0.934 0.948 0.000 0.052 0.000
#> GSM918625     1  0.2125      0.924 0.920 0.000 0.076 0.004
#> GSM918638     1  0.1940      0.926 0.924 0.000 0.076 0.000
#> GSM918642     1  0.2216      0.924 0.908 0.000 0.092 0.000
#> GSM918643     1  0.2216      0.924 0.908 0.000 0.092 0.000
#> GSM918619     1  0.1452      0.928 0.956 0.008 0.036 0.000
#> GSM918621     1  0.1211      0.931 0.960 0.000 0.040 0.000
#> GSM918582     1  0.1824      0.931 0.936 0.000 0.060 0.004
#> GSM918649     1  0.3818      0.863 0.844 0.000 0.048 0.108
#> GSM918651     1  0.0921      0.932 0.972 0.000 0.028 0.000
#> GSM918607     1  0.1474      0.928 0.948 0.000 0.052 0.000
#> GSM918609     1  0.1022      0.931 0.968 0.000 0.032 0.000
#> GSM918608     1  0.0817      0.931 0.976 0.000 0.024 0.000
#> GSM918606     1  0.1389      0.930 0.952 0.000 0.048 0.000
#> GSM918620     1  0.2053      0.929 0.924 0.000 0.072 0.004
#> GSM918628     1  0.3818      0.863 0.844 0.000 0.048 0.108
#> GSM918586     3  0.1557      0.857 0.056 0.000 0.944 0.000
#> GSM918594     3  0.1474      0.858 0.052 0.000 0.948 0.000
#> GSM918600     3  0.7023      0.646 0.192 0.232 0.576 0.000
#> GSM918601     3  0.0672      0.854 0.008 0.008 0.984 0.000
#> GSM918612     3  0.4040      0.681 0.248 0.000 0.752 0.000
#> GSM918614     3  0.1474      0.858 0.052 0.000 0.948 0.000
#> GSM918629     3  0.5608      0.684 0.060 0.256 0.684 0.000
#> GSM918587     1  0.3989      0.865 0.852 0.080 0.056 0.012
#> GSM918588     3  0.2589      0.834 0.116 0.000 0.884 0.000
#> GSM918589     3  0.1489      0.860 0.044 0.004 0.952 0.000
#> GSM918611     2  0.6010     -0.197 0.040 0.488 0.472 0.000
#> GSM918624     3  0.0927      0.856 0.016 0.008 0.976 0.000
#> GSM918637     3  0.5138      0.464 0.008 0.392 0.600 0.000
#> GSM918639     3  0.0672      0.854 0.008 0.008 0.984 0.000
#> GSM918640     3  0.0672      0.854 0.008 0.008 0.984 0.000
#> GSM918636     3  0.2647      0.832 0.120 0.000 0.880 0.000
#> GSM918590     2  0.1545      0.856 0.000 0.952 0.008 0.040
#> GSM918610     2  0.1792      0.860 0.000 0.932 0.000 0.068
#> GSM918615     2  0.1792      0.860 0.000 0.932 0.000 0.068
#> GSM918616     2  0.0188      0.843 0.000 0.996 0.000 0.004
#> GSM918632     4  0.1452      0.961 0.000 0.036 0.008 0.956
#> GSM918647     4  0.1545      0.957 0.000 0.040 0.008 0.952
#> GSM918578     2  0.1716      0.861 0.000 0.936 0.000 0.064
#> GSM918579     4  0.0188      0.973 0.000 0.000 0.004 0.996
#> GSM918581     2  0.4769      0.640 0.000 0.684 0.008 0.308
#> GSM918584     2  0.4222      0.687 0.000 0.728 0.000 0.272
#> GSM918591     2  0.1716      0.861 0.000 0.936 0.000 0.064
#> GSM918592     2  0.1940      0.857 0.000 0.924 0.000 0.076
#> GSM918597     2  0.0524      0.841 0.000 0.988 0.008 0.004
#> GSM918598     2  0.1716      0.861 0.000 0.936 0.000 0.064
#> GSM918599     4  0.0376      0.973 0.000 0.004 0.004 0.992
#> GSM918604     1  0.2319      0.910 0.924 0.040 0.036 0.000
#> GSM918605     2  0.1792      0.860 0.000 0.932 0.000 0.068
#> GSM918613     2  0.2593      0.779 0.004 0.892 0.104 0.000
#> GSM918623     4  0.0672      0.972 0.000 0.008 0.008 0.984
#> GSM918626     3  0.6240      0.506 0.004 0.080 0.640 0.276
#> GSM918627     2  0.1302      0.858 0.000 0.956 0.000 0.044
#> GSM918633     2  0.1211      0.857 0.000 0.960 0.000 0.040
#> GSM918634     2  0.0524      0.843 0.000 0.988 0.008 0.004
#> GSM918635     4  0.1256      0.965 0.000 0.028 0.008 0.964
#> GSM918645     2  0.1792      0.860 0.000 0.932 0.000 0.068
#> GSM918646     2  0.5257      0.382 0.000 0.548 0.008 0.444
#> GSM918648     4  0.0188      0.973 0.000 0.000 0.004 0.996
#> GSM918650     2  0.1792      0.860 0.000 0.932 0.000 0.068
#> GSM918652     2  0.4560      0.656 0.000 0.700 0.004 0.296
#> GSM918653     4  0.0188      0.973 0.000 0.000 0.004 0.996
#> GSM918622     2  0.2010      0.812 0.004 0.932 0.060 0.004
#> GSM918583     2  0.4857      0.622 0.000 0.668 0.008 0.324
#> GSM918585     4  0.0188      0.973 0.000 0.000 0.004 0.996
#> GSM918595     2  0.1637      0.860 0.000 0.940 0.000 0.060
#> GSM918596     2  0.2593      0.780 0.004 0.892 0.104 0.000
#> GSM918602     2  0.4094      0.728 0.056 0.828 0.116 0.000
#> GSM918617     2  0.4917      0.600 0.000 0.656 0.008 0.336
#> GSM918630     4  0.2048      0.931 0.000 0.064 0.008 0.928
#> GSM918631     4  0.0188      0.973 0.000 0.000 0.004 0.996
#> GSM918618     1  0.2216      0.923 0.908 0.000 0.092 0.000
#> GSM918644     3  0.2281      0.839 0.096 0.000 0.904 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
#> GSM918603     1  0.0579      0.947 0.984 0.000 0.008 0.008 0.000
#> GSM918641     1  0.0912      0.944 0.972 0.000 0.012 0.016 0.000
#> GSM918580     4  0.1372      0.903 0.024 0.016 0.004 0.956 0.000
#> GSM918593     1  0.0798      0.943 0.976 0.000 0.008 0.016 0.000
#> GSM918625     4  0.3961      0.666 0.248 0.000 0.016 0.736 0.000
#> GSM918638     1  0.1845      0.910 0.928 0.000 0.016 0.056 0.000
#> GSM918642     1  0.0693      0.946 0.980 0.000 0.012 0.008 0.000
#> GSM918643     1  0.0693      0.946 0.980 0.000 0.012 0.008 0.000
#> GSM918619     1  0.0579      0.944 0.984 0.000 0.008 0.008 0.000
#> GSM918621     1  0.0324      0.946 0.992 0.000 0.004 0.004 0.000
#> GSM918582     1  0.1549      0.921 0.944 0.000 0.016 0.040 0.000
#> GSM918649     4  0.1372      0.903 0.024 0.016 0.004 0.956 0.000
#> GSM918651     1  0.0451      0.944 0.988 0.000 0.004 0.008 0.000
#> GSM918607     1  0.0162      0.947 0.996 0.000 0.004 0.000 0.000
#> GSM918609     1  0.0162      0.947 0.996 0.000 0.004 0.000 0.000
#> GSM918608     1  0.0693      0.939 0.980 0.000 0.012 0.008 0.000
#> GSM918606     1  0.0162      0.947 0.996 0.000 0.004 0.000 0.000
#> GSM918620     1  0.1914      0.906 0.924 0.000 0.016 0.060 0.000
#> GSM918628     4  0.1372      0.903 0.024 0.016 0.004 0.956 0.000
#> GSM918586     3  0.0703      0.882 0.024 0.000 0.976 0.000 0.000
#> GSM918594     3  0.0451      0.882 0.008 0.000 0.988 0.004 0.000
#> GSM918600     1  0.4425      0.250 0.600 0.000 0.392 0.008 0.000
#> GSM918601     3  0.0579      0.883 0.008 0.000 0.984 0.000 0.008
#> GSM918612     3  0.4401      0.561 0.328 0.000 0.656 0.016 0.000
#> GSM918614     3  0.1670      0.874 0.052 0.000 0.936 0.012 0.000
#> GSM918629     3  0.1300      0.882 0.028 0.000 0.956 0.000 0.016
#> GSM918587     1  0.1622      0.921 0.948 0.004 0.028 0.016 0.004
#> GSM918588     3  0.3656      0.772 0.168 0.000 0.800 0.032 0.000
#> GSM918589     3  0.2228      0.865 0.076 0.000 0.908 0.012 0.004
#> GSM918611     5  0.4214      0.754 0.028 0.000 0.196 0.012 0.764
#> GSM918624     3  0.0579      0.883 0.008 0.000 0.984 0.000 0.008
#> GSM918637     3  0.1251      0.861 0.000 0.000 0.956 0.008 0.036
#> GSM918639     3  0.0579      0.883 0.008 0.000 0.984 0.000 0.008
#> GSM918640     3  0.0579      0.883 0.008 0.000 0.984 0.000 0.008
#> GSM918636     3  0.3695      0.772 0.164 0.000 0.800 0.036 0.000
#> GSM918590     5  0.0451      0.943 0.000 0.004 0.008 0.000 0.988
#> GSM918610     5  0.0162      0.943 0.000 0.004 0.000 0.000 0.996
#> GSM918615     5  0.0162      0.943 0.000 0.004 0.000 0.000 0.996
#> GSM918616     5  0.0451      0.941 0.004 0.000 0.000 0.008 0.988
#> GSM918632     2  0.0960      0.944 0.000 0.972 0.008 0.004 0.016
#> GSM918647     2  0.0451      0.956 0.000 0.988 0.000 0.008 0.004
#> GSM918578     5  0.0324      0.943 0.000 0.004 0.004 0.000 0.992
#> GSM918579     2  0.0609      0.955 0.000 0.980 0.000 0.020 0.000
#> GSM918581     5  0.1341      0.921 0.000 0.056 0.000 0.000 0.944
#> GSM918584     5  0.1186      0.936 0.000 0.020 0.008 0.008 0.964
#> GSM918591     5  0.0324      0.942 0.000 0.004 0.000 0.004 0.992
#> GSM918592     5  0.0613      0.942 0.000 0.008 0.004 0.004 0.984
#> GSM918597     5  0.1805      0.919 0.004 0.004 0.048 0.008 0.936
#> GSM918598     5  0.0486      0.942 0.000 0.004 0.004 0.004 0.988
#> GSM918599     2  0.0290      0.956 0.000 0.992 0.000 0.008 0.000
#> GSM918604     1  0.0451      0.945 0.988 0.000 0.004 0.008 0.000
#> GSM918605     5  0.0162      0.943 0.000 0.004 0.000 0.000 0.996
#> GSM918613     5  0.2642      0.881 0.008 0.000 0.104 0.008 0.880
#> GSM918623     2  0.0290      0.956 0.000 0.992 0.000 0.008 0.000
#> GSM918626     2  0.4237      0.699 0.004 0.764 0.200 0.016 0.016
#> GSM918627     5  0.0162      0.943 0.000 0.004 0.000 0.000 0.996
#> GSM918633     5  0.0854      0.940 0.000 0.012 0.004 0.008 0.976
#> GSM918634     5  0.0740      0.941 0.000 0.008 0.004 0.008 0.980
#> GSM918635     2  0.0324      0.953 0.000 0.992 0.000 0.004 0.004
#> GSM918645     5  0.0324      0.942 0.000 0.004 0.000 0.004 0.992
#> GSM918646     2  0.1197      0.919 0.000 0.952 0.000 0.000 0.048
#> GSM918648     2  0.0609      0.955 0.000 0.980 0.000 0.020 0.000
#> GSM918650     5  0.0162      0.943 0.000 0.004 0.000 0.000 0.996
#> GSM918652     5  0.1124      0.932 0.000 0.036 0.004 0.000 0.960
#> GSM918653     2  0.0609      0.955 0.000 0.980 0.000 0.020 0.000
#> GSM918622     5  0.2633      0.891 0.012 0.004 0.084 0.008 0.892
#> GSM918583     5  0.3966      0.527 0.000 0.336 0.000 0.000 0.664
#> GSM918585     2  0.0609      0.955 0.000 0.980 0.000 0.020 0.000
#> GSM918595     5  0.0000      0.943 0.000 0.000 0.000 0.000 1.000
#> GSM918596     5  0.2589      0.887 0.012 0.000 0.092 0.008 0.888
#> GSM918602     5  0.3101      0.868 0.024 0.000 0.100 0.012 0.864
#> GSM918617     2  0.2228      0.885 0.000 0.912 0.008 0.012 0.068
#> GSM918630     2  0.0162      0.954 0.000 0.996 0.000 0.000 0.004
#> GSM918631     2  0.0510      0.956 0.000 0.984 0.000 0.016 0.000
#> GSM918618     1  0.0693      0.946 0.980 0.000 0.012 0.008 0.000
#> GSM918644     3  0.3550      0.774 0.184 0.000 0.796 0.020 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
#> GSM918603     1  0.1933      0.819 0.920 0.000 0.032 0.004 0.000 0.044
#> GSM918641     1  0.3219      0.794 0.828 0.000 0.028 0.012 0.000 0.132
#> GSM918580     6  0.0870      1.000 0.004 0.012 0.000 0.012 0.000 0.972
#> GSM918593     1  0.1921      0.807 0.916 0.000 0.052 0.032 0.000 0.000
#> GSM918625     1  0.4116      0.640 0.684 0.000 0.016 0.012 0.000 0.288
#> GSM918638     1  0.2975      0.790 0.840 0.000 0.016 0.012 0.000 0.132
#> GSM918642     1  0.3373      0.794 0.816 0.000 0.032 0.012 0.000 0.140
#> GSM918643     1  0.3373      0.794 0.816 0.000 0.032 0.012 0.000 0.140
#> GSM918619     1  0.1334      0.812 0.948 0.000 0.020 0.032 0.000 0.000
#> GSM918621     1  0.1575      0.811 0.936 0.000 0.032 0.032 0.000 0.000
#> GSM918582     1  0.2252      0.811 0.900 0.000 0.016 0.012 0.000 0.072
#> GSM918649     6  0.0870      1.000 0.004 0.012 0.000 0.012 0.000 0.972
#> GSM918651     1  0.0405      0.817 0.988 0.000 0.008 0.004 0.000 0.000
#> GSM918607     1  0.0806      0.816 0.972 0.000 0.020 0.000 0.000 0.008
#> GSM918609     1  0.1418      0.808 0.944 0.000 0.024 0.032 0.000 0.000
#> GSM918608     1  0.0260      0.818 0.992 0.000 0.008 0.000 0.000 0.000
#> GSM918606     1  0.0951      0.815 0.968 0.000 0.020 0.004 0.000 0.008
#> GSM918620     1  0.2467      0.807 0.884 0.000 0.016 0.012 0.000 0.088
#> GSM918628     6  0.0870      1.000 0.004 0.012 0.000 0.012 0.000 0.972
#> GSM918586     3  0.0976      0.847 0.016 0.008 0.968 0.000 0.000 0.008
#> GSM918594     3  0.0976      0.847 0.016 0.008 0.968 0.000 0.000 0.008
#> GSM918600     1  0.5498      0.293 0.532 0.008 0.384 0.052 0.024 0.000
#> GSM918601     3  0.0291      0.844 0.004 0.004 0.992 0.000 0.000 0.000
#> GSM918612     3  0.4294      0.510 0.276 0.004 0.684 0.032 0.000 0.004
#> GSM918614     3  0.1707      0.821 0.056 0.004 0.928 0.000 0.000 0.012
#> GSM918629     3  0.4146      0.688 0.048 0.008 0.764 0.000 0.168 0.012
#> GSM918587     1  0.3211      0.754 0.836 0.008 0.024 0.124 0.000 0.008
#> GSM918588     1  0.4563      0.138 0.504 0.000 0.468 0.008 0.000 0.020
#> GSM918589     3  0.2593      0.749 0.148 0.000 0.844 0.000 0.000 0.008
#> GSM918611     5  0.3529      0.733 0.020 0.008 0.128 0.024 0.820 0.000
#> GSM918624     3  0.0508      0.847 0.012 0.004 0.984 0.000 0.000 0.000
#> GSM918637     3  0.4077      0.462 0.012 0.008 0.660 0.000 0.320 0.000
#> GSM918639     3  0.0291      0.844 0.004 0.004 0.992 0.000 0.000 0.000
#> GSM918640     3  0.0291      0.844 0.004 0.004 0.992 0.000 0.000 0.000
#> GSM918636     1  0.4647      0.159 0.508 0.000 0.460 0.012 0.000 0.020
#> GSM918590     5  0.0622      0.837 0.000 0.012 0.008 0.000 0.980 0.000
#> GSM918610     5  0.2664      0.825 0.000 0.000 0.000 0.184 0.816 0.000
#> GSM918615     5  0.2527      0.827 0.000 0.000 0.000 0.168 0.832 0.000
#> GSM918616     5  0.0146      0.839 0.000 0.004 0.000 0.000 0.996 0.000
#> GSM918632     2  0.0146      0.421 0.000 0.996 0.000 0.000 0.004 0.000
#> GSM918647     2  0.3857     -0.800 0.000 0.532 0.000 0.468 0.000 0.000
#> GSM918578     5  0.3266      0.800 0.000 0.000 0.000 0.272 0.728 0.000
#> GSM918579     4  0.3810      1.000 0.000 0.428 0.000 0.572 0.000 0.000
#> GSM918581     2  0.5096      0.410 0.000 0.596 0.008 0.080 0.316 0.000
#> GSM918584     2  0.5899      0.180 0.000 0.472 0.000 0.276 0.252 0.000
#> GSM918591     5  0.3288      0.798 0.000 0.000 0.000 0.276 0.724 0.000
#> GSM918592     5  0.3288      0.798 0.000 0.000 0.000 0.276 0.724 0.000
#> GSM918597     5  0.0972      0.831 0.000 0.008 0.028 0.000 0.964 0.000
#> GSM918598     5  0.3288      0.798 0.000 0.000 0.000 0.276 0.724 0.000
#> GSM918599     2  0.3862     -0.816 0.000 0.524 0.000 0.476 0.000 0.000
#> GSM918604     1  0.1151      0.810 0.956 0.000 0.012 0.032 0.000 0.000
#> GSM918605     5  0.3126      0.810 0.000 0.000 0.000 0.248 0.752 0.000
#> GSM918613     5  0.2794      0.775 0.004 0.008 0.104 0.020 0.864 0.000
#> GSM918623     2  0.3847     -0.778 0.000 0.544 0.000 0.456 0.000 0.000
#> GSM918626     2  0.3560      0.365 0.000 0.732 0.256 0.000 0.004 0.008
#> GSM918627     5  0.0146      0.840 0.000 0.000 0.000 0.004 0.996 0.000
#> GSM918633     5  0.0260      0.838 0.000 0.008 0.000 0.000 0.992 0.000
#> GSM918634     5  0.0520      0.838 0.000 0.008 0.008 0.000 0.984 0.000
#> GSM918635     2  0.0000      0.418 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM918645     5  0.3288      0.798 0.000 0.000 0.000 0.276 0.724 0.000
#> GSM918646     2  0.1265      0.453 0.000 0.948 0.000 0.008 0.044 0.000
#> GSM918648     4  0.3810      1.000 0.000 0.428 0.000 0.572 0.000 0.000
#> GSM918650     5  0.0405      0.839 0.000 0.008 0.000 0.004 0.988 0.000
#> GSM918652     2  0.5206      0.389 0.000 0.572 0.000 0.116 0.312 0.000
#> GSM918653     4  0.3810      1.000 0.000 0.428 0.000 0.572 0.000 0.000
#> GSM918622     5  0.2604      0.791 0.008 0.008 0.080 0.020 0.884 0.000
#> GSM918583     2  0.4382      0.462 0.000 0.676 0.000 0.060 0.264 0.000
#> GSM918585     4  0.3810      1.000 0.000 0.428 0.000 0.572 0.000 0.000
#> GSM918595     5  0.3023      0.816 0.000 0.000 0.000 0.232 0.768 0.000
#> GSM918596     5  0.2604      0.791 0.008 0.008 0.080 0.020 0.884 0.000
#> GSM918602     5  0.5028      0.768 0.024 0.008 0.072 0.188 0.704 0.004
#> GSM918617     2  0.1007      0.449 0.000 0.956 0.000 0.000 0.044 0.000
#> GSM918630     2  0.0000      0.418 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM918631     4  0.3810      1.000 0.000 0.428 0.000 0.572 0.000 0.000
#> GSM918618     1  0.3373      0.794 0.816 0.000 0.032 0.012 0.000 0.140
#> GSM918644     1  0.4565      0.140 0.496 0.000 0.476 0.008 0.000 0.020

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

consensus_heatmap(res, k = 2)

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) gender(p) other(p) k
#> ATC:mclust 71         6.53e-04    1.0000 0.196735 2
#> ATC:mclust 76         5.67e-20    0.0301 0.000305 3
#> ATC:mclust 73         6.20e-19    0.0849 0.001495 4
#> ATC:mclust 75         7.27e-21    0.1298 0.002234 5
#> ATC:mclust 58         2.66e-15    0.0328 0.003742 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 76 columns.
#>   Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'ATC' method.
#>   Subgroups are detected by 'NMF' method.
#>   Performed in total 1250 partitions by row resampling.
#>   Best k for subgroups seems to be 2.
#> 
#> Following methods can be applied to this 'ConsensusPartition' object:
#>  [1] "cola_report"             "collect_classes"         "collect_plots"          
#>  [4] "collect_stats"           "colnames"                "compare_signatures"     
#>  [7] "consensus_heatmap"       "dimension_reduction"     "functional_enrichment"  
#> [10] "get_anno_col"            "get_anno"                "get_classes"            
#> [13] "get_consensus"           "get_matrix"              "get_membership"         
#> [16] "get_param"               "get_signatures"          "get_stats"              
#> [19] "is_best_k"               "is_stable_k"             "membership_heatmap"     
#> [22] "ncol"                    "nrow"                    "plot_ecdf"              
#> [25] "rownames"                "select_partition_number" "show"                   
#> [28] "suggest_best_k"          "test_to_known_factors"

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

collect_plots(res)

plot of chunk ATC-NMF-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.921           0.952       0.978         0.4168 0.583   0.583
#> 3 3 0.769           0.883       0.945         0.4794 0.730   0.560
#> 4 4 0.567           0.662       0.808         0.1900 0.759   0.448
#> 5 5 0.561           0.570       0.748         0.0697 0.880   0.587
#> 6 6 0.626           0.608       0.748         0.0391 0.920   0.656

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
#> GSM918603     2  0.0000      0.982 0.000 1.000
#> GSM918641     2  0.0000      0.982 0.000 1.000
#> GSM918580     1  0.0000      0.963 1.000 0.000
#> GSM918593     2  0.0000      0.982 0.000 1.000
#> GSM918625     2  0.0000      0.982 0.000 1.000
#> GSM918638     2  0.0000      0.982 0.000 1.000
#> GSM918642     2  0.0000      0.982 0.000 1.000
#> GSM918643     2  0.0000      0.982 0.000 1.000
#> GSM918619     2  0.0000      0.982 0.000 1.000
#> GSM918621     2  0.0000      0.982 0.000 1.000
#> GSM918582     2  0.0000      0.982 0.000 1.000
#> GSM918649     1  0.0000      0.963 1.000 0.000
#> GSM918651     2  0.0000      0.982 0.000 1.000
#> GSM918607     2  0.0000      0.982 0.000 1.000
#> GSM918609     2  0.0000      0.982 0.000 1.000
#> GSM918608     2  0.0000      0.982 0.000 1.000
#> GSM918606     2  0.0000      0.982 0.000 1.000
#> GSM918620     2  0.0000      0.982 0.000 1.000
#> GSM918628     1  0.0000      0.963 1.000 0.000
#> GSM918586     2  0.0000      0.982 0.000 1.000
#> GSM918594     2  0.0000      0.982 0.000 1.000
#> GSM918600     2  0.0000      0.982 0.000 1.000
#> GSM918601     2  0.0000      0.982 0.000 1.000
#> GSM918612     2  0.0000      0.982 0.000 1.000
#> GSM918614     2  0.0000      0.982 0.000 1.000
#> GSM918629     2  0.0000      0.982 0.000 1.000
#> GSM918587     2  0.0000      0.982 0.000 1.000
#> GSM918588     2  0.0000      0.982 0.000 1.000
#> GSM918589     2  0.0000      0.982 0.000 1.000
#> GSM918611     2  0.0000      0.982 0.000 1.000
#> GSM918624     2  0.0000      0.982 0.000 1.000
#> GSM918637     2  0.0000      0.982 0.000 1.000
#> GSM918639     2  0.0000      0.982 0.000 1.000
#> GSM918640     2  0.0000      0.982 0.000 1.000
#> GSM918636     2  0.0000      0.982 0.000 1.000
#> GSM918590     2  0.2423      0.949 0.040 0.960
#> GSM918610     2  0.5842      0.844 0.140 0.860
#> GSM918615     2  0.6712      0.796 0.176 0.824
#> GSM918616     2  0.0000      0.982 0.000 1.000
#> GSM918632     1  0.0000      0.963 1.000 0.000
#> GSM918647     1  0.0000      0.963 1.000 0.000
#> GSM918578     2  0.0000      0.982 0.000 1.000
#> GSM918579     1  0.0000      0.963 1.000 0.000
#> GSM918581     1  0.0000      0.963 1.000 0.000
#> GSM918584     1  0.3431      0.911 0.936 0.064
#> GSM918591     2  0.5737      0.848 0.136 0.864
#> GSM918592     1  0.9580      0.390 0.620 0.380
#> GSM918597     2  0.0000      0.982 0.000 1.000
#> GSM918598     2  0.0672      0.976 0.008 0.992
#> GSM918599     1  0.0000      0.963 1.000 0.000
#> GSM918604     2  0.0000      0.982 0.000 1.000
#> GSM918605     2  0.4815      0.885 0.104 0.896
#> GSM918613     2  0.0000      0.982 0.000 1.000
#> GSM918623     1  0.0000      0.963 1.000 0.000
#> GSM918626     1  0.8207      0.657 0.744 0.256
#> GSM918627     2  0.0000      0.982 0.000 1.000
#> GSM918633     2  0.0672      0.976 0.008 0.992
#> GSM918634     2  0.0000      0.982 0.000 1.000
#> GSM918635     1  0.0000      0.963 1.000 0.000
#> GSM918645     2  0.7453      0.741 0.212 0.788
#> GSM918646     1  0.0000      0.963 1.000 0.000
#> GSM918648     1  0.0000      0.963 1.000 0.000
#> GSM918650     2  0.4298      0.902 0.088 0.912
#> GSM918652     1  0.0376      0.960 0.996 0.004
#> GSM918653     1  0.0000      0.963 1.000 0.000
#> GSM918622     2  0.0000      0.982 0.000 1.000
#> GSM918583     1  0.0000      0.963 1.000 0.000
#> GSM918585     1  0.0000      0.963 1.000 0.000
#> GSM918595     2  0.0000      0.982 0.000 1.000
#> GSM918596     2  0.0000      0.982 0.000 1.000
#> GSM918602     2  0.0000      0.982 0.000 1.000
#> GSM918617     1  0.2778      0.926 0.952 0.048
#> GSM918630     1  0.0000      0.963 1.000 0.000
#> GSM918631     1  0.0000      0.963 1.000 0.000
#> GSM918618     2  0.0000      0.982 0.000 1.000
#> GSM918644     2  0.0000      0.982 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
#> GSM918603     1  0.3752      0.841 0.856 0.000 0.144
#> GSM918641     1  0.2625      0.877 0.916 0.000 0.084
#> GSM918580     1  0.2261      0.834 0.932 0.068 0.000
#> GSM918593     3  0.5178      0.670 0.256 0.000 0.744
#> GSM918625     1  0.0000      0.885 1.000 0.000 0.000
#> GSM918638     1  0.0000      0.885 1.000 0.000 0.000
#> GSM918642     1  0.3816      0.838 0.852 0.000 0.148
#> GSM918643     1  0.3116      0.865 0.892 0.000 0.108
#> GSM918619     3  0.5327      0.642 0.272 0.000 0.728
#> GSM918621     3  0.5254      0.656 0.264 0.000 0.736
#> GSM918582     1  0.0000      0.885 1.000 0.000 0.000
#> GSM918649     1  0.1163      0.869 0.972 0.028 0.000
#> GSM918651     1  0.0000      0.885 1.000 0.000 0.000
#> GSM918607     1  0.2448      0.880 0.924 0.000 0.076
#> GSM918609     1  0.6079      0.408 0.612 0.000 0.388
#> GSM918608     1  0.0000      0.885 1.000 0.000 0.000
#> GSM918606     1  0.4121      0.820 0.832 0.000 0.168
#> GSM918620     1  0.0000      0.885 1.000 0.000 0.000
#> GSM918628     1  0.1031      0.872 0.976 0.024 0.000
#> GSM918586     3  0.1031      0.934 0.024 0.000 0.976
#> GSM918594     3  0.0592      0.940 0.012 0.000 0.988
#> GSM918600     3  0.1753      0.919 0.048 0.000 0.952
#> GSM918601     3  0.0424      0.942 0.008 0.000 0.992
#> GSM918612     3  0.2261      0.904 0.068 0.000 0.932
#> GSM918614     3  0.2261      0.904 0.068 0.000 0.932
#> GSM918629     3  0.0892      0.937 0.020 0.000 0.980
#> GSM918587     3  0.2066      0.911 0.060 0.000 0.940
#> GSM918588     1  0.2066      0.884 0.940 0.000 0.060
#> GSM918589     3  0.3879      0.820 0.152 0.000 0.848
#> GSM918611     3  0.0424      0.942 0.008 0.000 0.992
#> GSM918624     3  0.0424      0.942 0.008 0.000 0.992
#> GSM918637     3  0.0000      0.944 0.000 0.000 1.000
#> GSM918639     3  0.0424      0.942 0.008 0.000 0.992
#> GSM918640     3  0.0424      0.942 0.008 0.000 0.992
#> GSM918636     1  0.1031      0.887 0.976 0.000 0.024
#> GSM918590     3  0.0000      0.944 0.000 0.000 1.000
#> GSM918610     3  0.0000      0.944 0.000 0.000 1.000
#> GSM918615     3  0.0000      0.944 0.000 0.000 1.000
#> GSM918616     3  0.0000      0.944 0.000 0.000 1.000
#> GSM918632     2  0.0000      0.949 0.000 1.000 0.000
#> GSM918647     2  0.0000      0.949 0.000 1.000 0.000
#> GSM918578     3  0.0000      0.944 0.000 0.000 1.000
#> GSM918579     2  0.0000      0.949 0.000 1.000 0.000
#> GSM918581     2  0.2066      0.910 0.000 0.940 0.060
#> GSM918584     2  0.5431      0.629 0.000 0.716 0.284
#> GSM918591     3  0.0000      0.944 0.000 0.000 1.000
#> GSM918592     3  0.3116      0.843 0.000 0.108 0.892
#> GSM918597     3  0.0000      0.944 0.000 0.000 1.000
#> GSM918598     3  0.0000      0.944 0.000 0.000 1.000
#> GSM918599     2  0.0000      0.949 0.000 1.000 0.000
#> GSM918604     3  0.3941      0.815 0.156 0.000 0.844
#> GSM918605     3  0.0000      0.944 0.000 0.000 1.000
#> GSM918613     3  0.0000      0.944 0.000 0.000 1.000
#> GSM918623     2  0.0000      0.949 0.000 1.000 0.000
#> GSM918626     2  0.4399      0.739 0.000 0.812 0.188
#> GSM918627     3  0.0000      0.944 0.000 0.000 1.000
#> GSM918633     3  0.0000      0.944 0.000 0.000 1.000
#> GSM918634     3  0.0000      0.944 0.000 0.000 1.000
#> GSM918635     2  0.0000      0.949 0.000 1.000 0.000
#> GSM918645     3  0.0000      0.944 0.000 0.000 1.000
#> GSM918646     2  0.0237      0.948 0.000 0.996 0.004
#> GSM918648     2  0.0000      0.949 0.000 1.000 0.000
#> GSM918650     3  0.0000      0.944 0.000 0.000 1.000
#> GSM918652     2  0.3192      0.858 0.000 0.888 0.112
#> GSM918653     2  0.0000      0.949 0.000 1.000 0.000
#> GSM918622     3  0.0000      0.944 0.000 0.000 1.000
#> GSM918583     2  0.0592      0.945 0.000 0.988 0.012
#> GSM918585     2  0.0000      0.949 0.000 1.000 0.000
#> GSM918595     3  0.0000      0.944 0.000 0.000 1.000
#> GSM918596     3  0.0000      0.944 0.000 0.000 1.000
#> GSM918602     3  0.0000      0.944 0.000 0.000 1.000
#> GSM918617     2  0.0892      0.940 0.000 0.980 0.020
#> GSM918630     2  0.0424      0.947 0.000 0.992 0.008
#> GSM918631     2  0.0000      0.949 0.000 1.000 0.000
#> GSM918618     1  0.5529      0.624 0.704 0.000 0.296
#> GSM918644     3  0.5968      0.431 0.364 0.000 0.636

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM918603     1  0.5977    0.29024 0.528 0.040 0.432 0.000
#> GSM918641     1  0.4155    0.60698 0.756 0.004 0.240 0.000
#> GSM918580     1  0.1938    0.77659 0.936 0.000 0.052 0.012
#> GSM918593     3  0.6991    0.34973 0.188 0.232 0.580 0.000
#> GSM918625     1  0.2081    0.78312 0.916 0.000 0.084 0.000
#> GSM918638     1  0.2530    0.76690 0.888 0.000 0.112 0.000
#> GSM918642     3  0.5349    0.30888 0.336 0.024 0.640 0.000
#> GSM918643     3  0.5403    0.28013 0.348 0.024 0.628 0.000
#> GSM918619     2  0.6001    0.55517 0.184 0.688 0.128 0.000
#> GSM918621     2  0.7182    0.34702 0.248 0.552 0.200 0.000
#> GSM918582     1  0.0921    0.79691 0.972 0.000 0.028 0.000
#> GSM918649     1  0.1489    0.78199 0.952 0.000 0.044 0.004
#> GSM918651     1  0.3978    0.75773 0.836 0.056 0.108 0.000
#> GSM918607     1  0.5647    0.67825 0.720 0.116 0.164 0.000
#> GSM918609     2  0.7300    0.22637 0.304 0.516 0.180 0.000
#> GSM918608     1  0.4037    0.75623 0.832 0.056 0.112 0.000
#> GSM918606     1  0.7375    0.27756 0.488 0.336 0.176 0.000
#> GSM918620     1  0.0707    0.79589 0.980 0.000 0.020 0.000
#> GSM918628     1  0.1389    0.78229 0.952 0.000 0.048 0.000
#> GSM918586     3  0.3074    0.70372 0.000 0.152 0.848 0.000
#> GSM918594     3  0.3024    0.69761 0.000 0.148 0.852 0.000
#> GSM918600     3  0.3636    0.65810 0.008 0.172 0.820 0.000
#> GSM918601     3  0.3400    0.69661 0.000 0.180 0.820 0.000
#> GSM918612     3  0.3813    0.66187 0.024 0.148 0.828 0.000
#> GSM918614     3  0.3390    0.71169 0.016 0.132 0.852 0.000
#> GSM918629     3  0.2530    0.70936 0.000 0.112 0.888 0.000
#> GSM918587     2  0.5365    0.55949 0.044 0.692 0.264 0.000
#> GSM918588     3  0.3837    0.56012 0.224 0.000 0.776 0.000
#> GSM918589     3  0.4511    0.69433 0.040 0.176 0.784 0.000
#> GSM918611     2  0.4220    0.61213 0.004 0.748 0.248 0.000
#> GSM918624     3  0.3444    0.69323 0.000 0.184 0.816 0.000
#> GSM918637     3  0.3486    0.69072 0.000 0.188 0.812 0.000
#> GSM918639     3  0.3444    0.69366 0.000 0.184 0.816 0.000
#> GSM918640     3  0.3444    0.69476 0.000 0.184 0.816 0.000
#> GSM918636     3  0.4284    0.56748 0.224 0.012 0.764 0.000
#> GSM918590     2  0.3208    0.71322 0.000 0.848 0.148 0.004
#> GSM918610     2  0.2345    0.73907 0.000 0.900 0.100 0.000
#> GSM918615     2  0.2281    0.74373 0.000 0.904 0.096 0.000
#> GSM918616     2  0.4222    0.61059 0.000 0.728 0.272 0.000
#> GSM918632     4  0.1059    0.95619 0.000 0.012 0.016 0.972
#> GSM918647     4  0.0376    0.96123 0.000 0.004 0.004 0.992
#> GSM918578     2  0.1302    0.75471 0.000 0.956 0.044 0.000
#> GSM918579     4  0.0188    0.96134 0.000 0.000 0.004 0.996
#> GSM918581     2  0.6708    0.00491 0.000 0.464 0.088 0.448
#> GSM918584     2  0.4838    0.59829 0.000 0.724 0.024 0.252
#> GSM918591     2  0.1389    0.75407 0.000 0.952 0.048 0.000
#> GSM918592     2  0.1406    0.75054 0.000 0.960 0.016 0.024
#> GSM918597     2  0.3024    0.71405 0.000 0.852 0.148 0.000
#> GSM918598     2  0.1792    0.74366 0.000 0.932 0.068 0.000
#> GSM918599     4  0.0188    0.96134 0.000 0.000 0.004 0.996
#> GSM918604     3  0.7679    0.09817 0.220 0.356 0.424 0.000
#> GSM918605     2  0.2345    0.73798 0.000 0.900 0.100 0.000
#> GSM918613     3  0.4925    0.23636 0.000 0.428 0.572 0.000
#> GSM918623     4  0.0188    0.96076 0.000 0.000 0.004 0.996
#> GSM918626     3  0.7254    0.16872 0.004 0.128 0.476 0.392
#> GSM918627     2  0.3024    0.70982 0.000 0.852 0.148 0.000
#> GSM918633     2  0.2773    0.74989 0.000 0.880 0.116 0.004
#> GSM918634     3  0.4746    0.45371 0.000 0.368 0.632 0.000
#> GSM918635     4  0.0804    0.95835 0.000 0.008 0.012 0.980
#> GSM918645     2  0.2011    0.74930 0.000 0.920 0.080 0.000
#> GSM918646     4  0.1677    0.94324 0.000 0.040 0.012 0.948
#> GSM918648     4  0.0188    0.96134 0.000 0.000 0.004 0.996
#> GSM918650     2  0.3710    0.66439 0.000 0.804 0.192 0.004
#> GSM918652     4  0.3743    0.82233 0.000 0.160 0.016 0.824
#> GSM918653     4  0.0336    0.96015 0.000 0.000 0.008 0.992
#> GSM918622     2  0.3942    0.67468 0.000 0.764 0.236 0.000
#> GSM918583     4  0.3032    0.86373 0.000 0.124 0.008 0.868
#> GSM918585     4  0.0188    0.96134 0.000 0.000 0.004 0.996
#> GSM918595     2  0.1792    0.75097 0.000 0.932 0.068 0.000
#> GSM918596     3  0.4624    0.46345 0.000 0.340 0.660 0.000
#> GSM918602     2  0.4741    0.47701 0.004 0.668 0.328 0.000
#> GSM918617     4  0.2313    0.92125 0.000 0.044 0.032 0.924
#> GSM918630     4  0.1510    0.95108 0.000 0.028 0.016 0.956
#> GSM918631     4  0.0000    0.96117 0.000 0.000 0.000 1.000
#> GSM918618     3  0.5760    0.02703 0.448 0.028 0.524 0.000
#> GSM918644     3  0.4540    0.61443 0.196 0.032 0.772 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
#> GSM918603     4  0.7135   1.29e-01 0.312 0.000 0.316 0.360 0.012
#> GSM918641     4  0.6012   4.57e-01 0.168 0.000 0.212 0.612 0.008
#> GSM918580     4  0.1544   5.77e-01 0.000 0.068 0.000 0.932 0.000
#> GSM918593     1  0.6860  -1.88e-05 0.448 0.000 0.408 0.076 0.068
#> GSM918625     4  0.4219   5.61e-01 0.116 0.000 0.104 0.780 0.000
#> GSM918638     4  0.5334   4.98e-01 0.148 0.000 0.180 0.672 0.000
#> GSM918642     3  0.6778   1.32e-01 0.252 0.000 0.476 0.264 0.008
#> GSM918643     3  0.6705   9.39e-02 0.244 0.000 0.468 0.284 0.004
#> GSM918619     1  0.6222   4.93e-01 0.604 0.000 0.024 0.128 0.244
#> GSM918621     1  0.6318   5.80e-01 0.644 0.000 0.072 0.104 0.180
#> GSM918582     4  0.4220   5.08e-01 0.224 0.004 0.016 0.748 0.008
#> GSM918649     4  0.2313   5.84e-01 0.040 0.044 0.004 0.912 0.000
#> GSM918651     4  0.4670   3.83e-01 0.328 0.000 0.008 0.648 0.016
#> GSM918607     1  0.5968  -8.29e-02 0.480 0.000 0.060 0.440 0.020
#> GSM918609     1  0.5842   5.81e-01 0.684 0.000 0.052 0.100 0.164
#> GSM918608     4  0.4757   3.78e-01 0.324 0.000 0.012 0.648 0.016
#> GSM918606     1  0.6454   4.35e-01 0.608 0.000 0.064 0.236 0.092
#> GSM918620     4  0.3006   5.61e-01 0.156 0.000 0.004 0.836 0.004
#> GSM918628     4  0.0992   5.96e-01 0.024 0.000 0.008 0.968 0.000
#> GSM918586     3  0.2388   7.52e-01 0.072 0.000 0.900 0.000 0.028
#> GSM918594     3  0.3262   7.21e-01 0.124 0.000 0.840 0.000 0.036
#> GSM918600     3  0.4602   4.59e-01 0.340 0.000 0.640 0.004 0.016
#> GSM918601     3  0.1469   7.58e-01 0.016 0.000 0.948 0.000 0.036
#> GSM918612     3  0.3878   6.22e-01 0.236 0.000 0.748 0.000 0.016
#> GSM918614     3  0.1725   7.58e-01 0.044 0.000 0.936 0.000 0.020
#> GSM918629     3  0.2888   7.52e-01 0.056 0.000 0.880 0.004 0.060
#> GSM918587     1  0.5398   5.44e-01 0.684 0.000 0.124 0.008 0.184
#> GSM918588     3  0.3553   7.21e-01 0.048 0.004 0.840 0.104 0.004
#> GSM918589     3  0.4037   6.98e-01 0.084 0.000 0.820 0.024 0.072
#> GSM918611     1  0.5870   4.79e-01 0.584 0.000 0.140 0.000 0.276
#> GSM918624     3  0.2790   7.25e-01 0.068 0.000 0.880 0.000 0.052
#> GSM918637     3  0.2645   7.35e-01 0.044 0.000 0.888 0.000 0.068
#> GSM918639     3  0.2067   7.50e-01 0.032 0.000 0.920 0.000 0.048
#> GSM918640     3  0.1626   7.56e-01 0.016 0.000 0.940 0.000 0.044
#> GSM918636     3  0.3481   7.20e-01 0.036 0.004 0.840 0.116 0.004
#> GSM918590     5  0.4416   6.58e-01 0.132 0.008 0.084 0.000 0.776
#> GSM918610     5  0.2162   6.98e-01 0.012 0.008 0.064 0.000 0.916
#> GSM918615     5  0.2264   6.99e-01 0.024 0.004 0.060 0.000 0.912
#> GSM918616     5  0.5392   5.87e-01 0.144 0.000 0.192 0.000 0.664
#> GSM918632     2  0.2513   8.49e-01 0.000 0.876 0.008 0.000 0.116
#> GSM918647     2  0.1270   8.58e-01 0.000 0.948 0.000 0.000 0.052
#> GSM918578     5  0.3639   6.33e-01 0.184 0.000 0.024 0.000 0.792
#> GSM918579     2  0.0000   8.54e-01 0.000 1.000 0.000 0.000 0.000
#> GSM918581     5  0.6162   5.38e-01 0.124 0.156 0.060 0.000 0.660
#> GSM918584     5  0.5574   4.98e-01 0.196 0.144 0.004 0.000 0.656
#> GSM918591     5  0.3266   6.21e-01 0.200 0.000 0.004 0.000 0.796
#> GSM918592     5  0.2727   6.59e-01 0.116 0.016 0.000 0.000 0.868
#> GSM918597     5  0.4291   6.71e-01 0.136 0.000 0.092 0.000 0.772
#> GSM918598     5  0.4572   5.16e-01 0.280 0.000 0.036 0.000 0.684
#> GSM918599     2  0.0162   8.56e-01 0.000 0.996 0.000 0.000 0.004
#> GSM918604     1  0.6063   4.63e-01 0.632 0.000 0.244 0.048 0.076
#> GSM918605     5  0.2804   6.99e-01 0.044 0.004 0.068 0.000 0.884
#> GSM918613     5  0.6034   4.67e-02 0.116 0.000 0.428 0.000 0.456
#> GSM918623     2  0.2424   8.38e-01 0.000 0.868 0.000 0.000 0.132
#> GSM918626     5  0.9047  -1.25e-02 0.152 0.244 0.272 0.032 0.300
#> GSM918627     5  0.3169   6.98e-01 0.060 0.000 0.084 0.000 0.856
#> GSM918633     5  0.3632   6.54e-01 0.152 0.016 0.016 0.000 0.816
#> GSM918634     5  0.5816   1.78e-01 0.092 0.000 0.440 0.000 0.468
#> GSM918635     2  0.3039   8.04e-01 0.000 0.808 0.000 0.000 0.192
#> GSM918645     5  0.3243   6.33e-01 0.180 0.004 0.004 0.000 0.812
#> GSM918646     2  0.4254   7.93e-01 0.064 0.776 0.004 0.000 0.156
#> GSM918648     2  0.0162   8.56e-01 0.000 0.996 0.000 0.000 0.004
#> GSM918650     5  0.3689   6.65e-01 0.068 0.012 0.084 0.000 0.836
#> GSM918652     2  0.6009   4.56e-01 0.112 0.540 0.004 0.000 0.344
#> GSM918653     2  0.0000   8.54e-01 0.000 1.000 0.000 0.000 0.000
#> GSM918622     5  0.5505   4.19e-01 0.304 0.000 0.092 0.000 0.604
#> GSM918583     2  0.4307   2.07e-01 0.000 0.504 0.000 0.000 0.496
#> GSM918585     2  0.0510   8.59e-01 0.000 0.984 0.000 0.000 0.016
#> GSM918595     5  0.3966   6.51e-01 0.132 0.000 0.072 0.000 0.796
#> GSM918596     3  0.6300   1.79e-01 0.168 0.000 0.496 0.000 0.336
#> GSM918602     1  0.5815   4.80e-01 0.592 0.000 0.136 0.000 0.272
#> GSM918617     2  0.4375   7.69e-01 0.004 0.776 0.116 0.000 0.104
#> GSM918630     2  0.3435   8.32e-01 0.020 0.820 0.004 0.000 0.156
#> GSM918631     2  0.0510   8.59e-01 0.000 0.984 0.000 0.000 0.016
#> GSM918618     4  0.6941   1.64e-01 0.244 0.000 0.352 0.396 0.008
#> GSM918644     3  0.4244   6.82e-01 0.072 0.000 0.788 0.132 0.008

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>           class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM918603     4  0.5802     0.4366 0.020 0.000 0.184 0.596 0.004 0.196
#> GSM918641     4  0.3319     0.6228 0.012 0.000 0.128 0.828 0.004 0.028
#> GSM918580     4  0.5565     0.0146 0.364 0.088 0.000 0.528 0.000 0.020
#> GSM918593     6  0.6930     0.1500 0.020 0.000 0.208 0.312 0.032 0.428
#> GSM918625     4  0.2633     0.6092 0.032 0.000 0.104 0.864 0.000 0.000
#> GSM918638     4  0.2981     0.6226 0.020 0.000 0.116 0.848 0.000 0.016
#> GSM918642     4  0.5043     0.5372 0.012 0.000 0.228 0.664 0.004 0.092
#> GSM918643     4  0.4928     0.5487 0.012 0.000 0.224 0.676 0.004 0.084
#> GSM918619     1  0.4616     0.5756 0.736 0.000 0.004 0.016 0.124 0.120
#> GSM918621     1  0.6354     0.4535 0.596 0.000 0.036 0.036 0.136 0.196
#> GSM918582     1  0.2402     0.6518 0.868 0.000 0.000 0.120 0.000 0.012
#> GSM918649     1  0.4664     0.3109 0.572 0.032 0.000 0.388 0.000 0.008
#> GSM918651     1  0.3352     0.6550 0.812 0.000 0.000 0.148 0.008 0.032
#> GSM918607     1  0.6537     0.5480 0.552 0.000 0.036 0.236 0.028 0.148
#> GSM918609     1  0.6456     0.4445 0.576 0.000 0.032 0.044 0.120 0.228
#> GSM918608     1  0.2841     0.6736 0.860 0.000 0.004 0.108 0.008 0.020
#> GSM918606     1  0.6188     0.5618 0.644 0.000 0.028 0.104 0.104 0.120
#> GSM918620     1  0.3221     0.5898 0.772 0.004 0.000 0.220 0.000 0.004
#> GSM918628     4  0.3836     0.2971 0.248 0.004 0.004 0.728 0.000 0.016
#> GSM918586     3  0.3321     0.7374 0.020 0.000 0.844 0.032 0.008 0.096
#> GSM918594     3  0.3579     0.7118 0.008 0.000 0.824 0.036 0.020 0.112
#> GSM918600     3  0.6002     0.4073 0.092 0.000 0.568 0.044 0.008 0.288
#> GSM918601     3  0.0436     0.7501 0.000 0.000 0.988 0.004 0.004 0.004
#> GSM918612     3  0.5620     0.5129 0.048 0.000 0.636 0.076 0.008 0.232
#> GSM918614     3  0.2662     0.7389 0.008 0.000 0.884 0.048 0.004 0.056
#> GSM918629     3  0.3510     0.7307 0.028 0.000 0.828 0.032 0.004 0.108
#> GSM918587     6  0.4804     0.6632 0.032 0.000 0.028 0.092 0.092 0.756
#> GSM918588     3  0.4032     0.7091 0.092 0.000 0.792 0.032 0.000 0.084
#> GSM918589     3  0.3746     0.6949 0.028 0.000 0.832 0.048 0.024 0.068
#> GSM918611     6  0.6004     0.5851 0.072 0.000 0.088 0.020 0.180 0.640
#> GSM918624     3  0.0976     0.7419 0.000 0.000 0.968 0.008 0.008 0.016
#> GSM918637     3  0.1434     0.7354 0.000 0.000 0.948 0.020 0.024 0.008
#> GSM918639     3  0.0508     0.7470 0.000 0.000 0.984 0.012 0.004 0.000
#> GSM918640     3  0.0436     0.7498 0.000 0.000 0.988 0.004 0.004 0.004
#> GSM918636     3  0.3485     0.7319 0.024 0.000 0.828 0.052 0.000 0.096
#> GSM918590     5  0.5727     0.6784 0.092 0.008 0.080 0.020 0.696 0.104
#> GSM918610     5  0.1858     0.7789 0.024 0.000 0.024 0.004 0.932 0.016
#> GSM918615     5  0.1854     0.7783 0.028 0.000 0.016 0.004 0.932 0.020
#> GSM918616     5  0.5852     0.5758 0.048 0.000 0.104 0.012 0.632 0.204
#> GSM918632     2  0.2894     0.8193 0.000 0.860 0.012 0.020 0.104 0.004
#> GSM918647     2  0.0922     0.8415 0.004 0.968 0.000 0.000 0.024 0.004
#> GSM918578     5  0.3020     0.7577 0.076 0.000 0.000 0.000 0.844 0.080
#> GSM918579     2  0.0260     0.8408 0.008 0.992 0.000 0.000 0.000 0.000
#> GSM918581     5  0.5885     0.6487 0.040 0.088 0.056 0.032 0.708 0.076
#> GSM918584     5  0.4029     0.7277 0.032 0.052 0.000 0.000 0.784 0.132
#> GSM918591     5  0.2454     0.7608 0.016 0.000 0.000 0.004 0.876 0.104
#> GSM918592     5  0.1988     0.7700 0.016 0.004 0.000 0.016 0.924 0.040
#> GSM918597     5  0.4230     0.7390 0.108 0.000 0.040 0.004 0.784 0.064
#> GSM918598     5  0.4371     0.6837 0.148 0.000 0.000 0.004 0.732 0.116
#> GSM918599     2  0.0260     0.8408 0.008 0.992 0.000 0.000 0.000 0.000
#> GSM918604     6  0.6052     0.6175 0.108 0.000 0.144 0.064 0.032 0.652
#> GSM918605     5  0.2812     0.7658 0.072 0.000 0.016 0.004 0.876 0.032
#> GSM918613     5  0.5877     0.3497 0.000 0.000 0.256 0.028 0.568 0.148
#> GSM918623     2  0.3231     0.7700 0.000 0.800 0.000 0.012 0.180 0.008
#> GSM918626     4  0.8188     0.0353 0.004 0.120 0.140 0.340 0.328 0.068
#> GSM918627     5  0.2569     0.7780 0.036 0.000 0.016 0.008 0.896 0.044
#> GSM918633     5  0.3415     0.7253 0.004 0.024 0.000 0.016 0.820 0.136
#> GSM918634     3  0.5947    -0.1187 0.008 0.000 0.460 0.032 0.424 0.076
#> GSM918635     2  0.4201     0.6634 0.004 0.688 0.000 0.020 0.280 0.008
#> GSM918645     5  0.2848     0.7322 0.004 0.000 0.000 0.008 0.828 0.160
#> GSM918646     2  0.5278     0.6894 0.012 0.672 0.000 0.016 0.112 0.188
#> GSM918648     2  0.0260     0.8408 0.008 0.992 0.000 0.000 0.000 0.000
#> GSM918650     5  0.3274     0.7427 0.004 0.012 0.048 0.036 0.864 0.036
#> GSM918652     2  0.6360     0.3593 0.012 0.464 0.000 0.012 0.328 0.184
#> GSM918653     2  0.0260     0.8408 0.008 0.992 0.000 0.000 0.000 0.000
#> GSM918622     5  0.5750     0.1898 0.016 0.000 0.076 0.012 0.492 0.404
#> GSM918583     5  0.4833     0.2334 0.004 0.356 0.000 0.020 0.596 0.024
#> GSM918585     2  0.0146     0.8413 0.000 0.996 0.000 0.000 0.004 0.000
#> GSM918595     5  0.4232     0.7297 0.116 0.000 0.032 0.008 0.784 0.060
#> GSM918596     3  0.6745    -0.1656 0.028 0.000 0.372 0.004 0.328 0.268
#> GSM918602     6  0.4647     0.6881 0.012 0.000 0.084 0.032 0.116 0.756
#> GSM918617     2  0.5613     0.7255 0.008 0.716 0.092 0.044 0.080 0.060
#> GSM918630     2  0.4422     0.7756 0.004 0.756 0.000 0.028 0.148 0.064
#> GSM918631     2  0.0146     0.8413 0.004 0.996 0.000 0.000 0.000 0.000
#> GSM918618     4  0.4694     0.5811 0.016 0.000 0.184 0.716 0.004 0.080
#> GSM918644     3  0.4449     0.5045 0.028 0.000 0.688 0.260 0.000 0.024

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

consensus_heatmap(res, k = 2)

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

consensus_heatmap(res, k = 3)

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

consensus_heatmap(res, k = 4)

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

consensus_heatmap(res, k = 5)

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

consensus_heatmap(res, k = 6)

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

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

membership_heatmap(res, k = 2)

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

membership_heatmap(res, k = 3)

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

membership_heatmap(res, k = 4)

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

membership_heatmap(res, k = 5)

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

membership_heatmap(res, k = 6)

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

As soon as we have had the classes for columns, we can look for signatures which are significantly different between classes which can be candidate marks for certain classes. Following are the heatmaps for signatures.

Signature heatmaps where rows are scaled:

get_signatures(res, k = 2)

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

get_signatures(res, k = 3)

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

get_signatures(res, k = 4)

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

get_signatures(res, k = 5)

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

get_signatures(res, k = 6)

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

Signature heatmaps where rows are not scaled:

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

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

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

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

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

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

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

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

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

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

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk ATC-NMF-signature_compare

get_signature() returns a data frame invisibly. TO get the list of signatures, the function call should be assigned to a variable explicitly. In following code, if plot argument is set to FALSE, no heatmap is plotted while only the differential analysis is performed.

# code only for demonstration
tb = get_signature(res, k = ..., plot = FALSE)

An example of the output of tb is:

#>   which_row         fdr    mean_1    mean_2 scaled_mean_1 scaled_mean_2 km
#> 1        38 0.042760348  8.373488  9.131774    -0.5533452     0.5164555  1
#> 2        40 0.018707592  7.106213  8.469186    -0.6173731     0.5762149  1
#> 3        55 0.019134737 10.221463 11.207825    -0.6159697     0.5749050  1
#> 4        59 0.006059896  5.921854  7.869574    -0.6899429     0.6439467  1
#> 5        60 0.018055526  8.928898 10.211722    -0.6204761     0.5791110  1
#> 6        98 0.009384629 15.714769 14.887706     0.6635654    -0.6193277  2
...

The columns in tb are:

  1. which_row: row indices corresponding to the input matrix.
  2. fdr: FDR for the differential test.
  3. mean_x: The mean value in group x.
  4. scaled_mean_x: The mean value in group x after rows are scaled.
  5. km: Row groups if k-means clustering is applied to rows.

UMAP plot which shows how samples are separated.

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

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

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

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

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

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

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

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

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

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

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk ATC-NMF-collect-classes

Test correlation between subgroups and known annotations. If the known annotation is numeric, one-way ANOVA test is applied, and if the known annotation is discrete, chi-squared contingency table test is applied.

test_to_known_factors(res)
#>          n disease.state(p) gender(p) other(p) k
#> ATC:NMF 75         1.76e-03   1.00000 2.64e-01 2
#> ATC:NMF 74         6.43e-10   0.00381 1.25e-04 3
#> ATC:NMF 61         7.66e-16   0.02600 4.45e-05 4
#> ATC:NMF 52         1.43e-13   0.16432 4.00e-05 5
#> ATC:NMF 61         7.42e-26   0.02040 2.64e-05 6

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

Session info

sessionInfo()
#> R version 3.6.0 (2019-04-26)
#> Platform: x86_64-pc-linux-gnu (64-bit)
#> Running under: CentOS Linux 7 (Core)
#> 
#> Matrix products: default
#> BLAS:   /usr/lib64/libblas.so.3.4.2
#> LAPACK: /usr/lib64/liblapack.so.3.4.2
#> 
#> locale:
#>  [1] LC_CTYPE=en_GB.UTF-8       LC_NUMERIC=C               LC_TIME=en_GB.UTF-8       
#>  [4] LC_COLLATE=en_GB.UTF-8     LC_MONETARY=en_GB.UTF-8    LC_MESSAGES=en_GB.UTF-8   
#>  [7] LC_PAPER=en_GB.UTF-8       LC_NAME=C                  LC_ADDRESS=C              
#> [10] LC_TELEPHONE=C             LC_MEASUREMENT=en_GB.UTF-8 LC_IDENTIFICATION=C       
#> 
#> attached base packages:
#> [1] grid      stats     graphics  grDevices utils     datasets  methods   base     
#> 
#> other attached packages:
#> [1] genefilter_1.66.0    ComplexHeatmap_2.3.1 markdown_1.1         knitr_1.26          
#> [5] GetoptLong_0.1.7     cola_1.3.2          
#> 
#> loaded via a namespace (and not attached):
#>  [1] circlize_0.4.8       shape_1.4.4          xfun_0.11            slam_0.1-46         
#>  [5] lattice_0.20-38      splines_3.6.0        colorspace_1.4-1     vctrs_0.2.0         
#>  [9] stats4_3.6.0         blob_1.2.0           XML_3.98-1.20        survival_2.44-1.1   
#> [13] rlang_0.4.2          pillar_1.4.2         DBI_1.0.0            BiocGenerics_0.30.0 
#> [17] bit64_0.9-7          RColorBrewer_1.1-2   matrixStats_0.55.0   stringr_1.4.0       
#> [21] GlobalOptions_0.1.1  evaluate_0.14        memoise_1.1.0        Biobase_2.44.0      
#> [25] IRanges_2.18.3       parallel_3.6.0       AnnotationDbi_1.46.1 highr_0.8           
#> [29] Rcpp_1.0.3           xtable_1.8-4         backports_1.1.5      S4Vectors_0.22.1    
#> [33] annotate_1.62.0      skmeans_0.2-11       bit_1.1-14           microbenchmark_1.4-7
#> [37] brew_1.0-6           impute_1.58.0        rjson_0.2.20         png_0.1-7           
#> [41] digest_0.6.23        stringi_1.4.3        polyclip_1.10-0      clue_0.3-57         
#> [45] tools_3.6.0          bitops_1.0-6         magrittr_1.5         eulerr_6.0.0        
#> [49] RCurl_1.95-4.12      RSQLite_2.1.4        tibble_2.1.3         cluster_2.1.0       
#> [53] crayon_1.3.4         pkgconfig_2.0.3      zeallot_0.1.0        Matrix_1.2-17       
#> [57] xml2_1.2.2           httr_1.4.1           R6_2.4.1             mclust_5.4.5        
#> [61] compiler_3.6.0