cola Report for GDS3085

Date: 2019-12-25 20:39:53 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 17730 rows and 72 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] 17730    72

Density distribution

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

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

plot of chunk density-heatmap

Suggest the best k

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

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

suggest_best_k(res_list)
The best k 1-PAC Mean silhouette Concordance Optional k
SD:kmeans 2 1.000 0.968 0.987 **
SD:skmeans 2 1.000 0.950 0.980 **
MAD:skmeans 2 1.000 0.967 0.987 **
ATC:skmeans 2 1.000 0.985 0.994 **
ATC:pam 2 1.000 0.999 1.000 **
SD:NMF 2 0.998 0.940 0.977 **
ATC:kmeans 3 0.981 0.940 0.976 ** 2
MAD:kmeans 3 0.953 0.949 0.962 ** 2
MAD:NMF 2 0.942 0.931 0.974 *
MAD:pam 3 0.922 0.895 0.959 * 2
MAD:mclust 4 0.912 0.885 0.946 *
SD:pam 5 0.891 0.844 0.938
SD:mclust 4 0.890 0.883 0.946
CV:pam 2 0.864 0.955 0.975
CV:skmeans 2 0.837 0.905 0.962
MAD:hclust 2 0.835 0.870 0.950
CV:kmeans 2 0.792 0.914 0.963
ATC:NMF 2 0.755 0.878 0.947
SD:hclust 2 0.732 0.890 0.937
ATC:mclust 3 0.639 0.787 0.894
CV:NMF 2 0.535 0.810 0.911
CV:mclust 2 0.464 0.818 0.889
ATC:hclust 2 0.454 0.816 0.902
CV:hclust 2 0.443 0.877 0.923

**: 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.998           0.940       0.977          0.500 0.499   0.499
#> CV:NMF      2 0.535           0.810       0.911          0.494 0.499   0.499
#> MAD:NMF     2 0.942           0.931       0.974          0.502 0.496   0.496
#> ATC:NMF     2 0.755           0.878       0.947          0.488 0.499   0.499
#> SD:skmeans  2 1.000           0.950       0.980          0.498 0.499   0.499
#> CV:skmeans  2 0.837           0.905       0.962          0.503 0.499   0.499
#> MAD:skmeans 2 1.000           0.967       0.987          0.501 0.499   0.499
#> ATC:skmeans 2 1.000           0.985       0.994          0.500 0.499   0.499
#> SD:mclust   2 0.761           0.850       0.937          0.495 0.493   0.493
#> CV:mclust   2 0.464           0.818       0.889          0.460 0.493   0.493
#> MAD:mclust  2 0.433           0.859       0.899          0.469 0.525   0.525
#> ATC:mclust  2 0.428           0.613       0.828          0.450 0.493   0.493
#> SD:kmeans   2 1.000           0.968       0.987          0.478 0.525   0.525
#> CV:kmeans   2 0.792           0.914       0.963          0.472 0.532   0.532
#> MAD:kmeans  2 1.000           0.954       0.983          0.478 0.518   0.518
#> ATC:kmeans  2 1.000           0.939       0.978          0.488 0.512   0.512
#> SD:pam      2 0.885           0.914       0.967          0.441 0.549   0.549
#> CV:pam      2 0.864           0.955       0.975          0.432 0.549   0.549
#> MAD:pam     2 1.000           0.952       0.982          0.456 0.540   0.540
#> ATC:pam     2 1.000           0.999       1.000          0.460 0.540   0.540
#> SD:hclust   2 0.732           0.890       0.937          0.475 0.499   0.499
#> CV:hclust   2 0.443           0.877       0.923          0.478 0.499   0.499
#> MAD:hclust  2 0.835           0.870       0.950          0.482 0.512   0.512
#> ATC:hclust  2 0.454           0.816       0.902          0.471 0.496   0.496
get_stats(res_list, k = 3)
#>             k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> SD:NMF      3 0.818           0.850       0.935          0.340 0.732   0.510
#> CV:NMF      3 0.407           0.647       0.799          0.313 0.797   0.614
#> MAD:NMF     3 0.698           0.782       0.904          0.319 0.706   0.477
#> ATC:NMF     3 0.532           0.792       0.851          0.245 0.789   0.603
#> SD:skmeans  3 0.773           0.863       0.914          0.321 0.773   0.570
#> CV:skmeans  3 0.685           0.833       0.896          0.311 0.784   0.589
#> MAD:skmeans 3 0.725           0.731       0.890          0.290 0.801   0.622
#> ATC:skmeans 3 0.895           0.878       0.945          0.237 0.867   0.739
#> SD:mclust   3 0.730           0.828       0.909          0.325 0.725   0.499
#> CV:mclust   3 0.511           0.720       0.843          0.285 0.769   0.588
#> MAD:mclust  3 0.720           0.857       0.926          0.403 0.804   0.627
#> ATC:mclust  3 0.639           0.787       0.894          0.463 0.744   0.525
#> SD:kmeans   3 0.889           0.924       0.950          0.384 0.769   0.577
#> CV:kmeans   3 0.596           0.830       0.874          0.387 0.757   0.561
#> MAD:kmeans  3 0.953           0.949       0.962          0.392 0.755   0.551
#> ATC:kmeans  3 0.981           0.940       0.976          0.377 0.745   0.535
#> SD:pam      3 0.728           0.835       0.926          0.497 0.708   0.502
#> CV:pam      3 0.597           0.750       0.890          0.431 0.831   0.692
#> MAD:pam     3 0.922           0.895       0.959          0.470 0.769   0.578
#> ATC:pam     3 0.894           0.894       0.953          0.392 0.812   0.652
#> SD:hclust   3 0.575           0.785       0.867          0.322 0.883   0.765
#> CV:hclust   3 0.440           0.611       0.788          0.280 0.910   0.819
#> MAD:hclust  3 0.686           0.742       0.892          0.330 0.841   0.690
#> ATC:hclust  3 0.543           0.632       0.772          0.345 0.779   0.578
get_stats(res_list, k = 4)
#>             k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> SD:NMF      4 0.676           0.732       0.848         0.1092 0.887   0.674
#> CV:NMF      4 0.472           0.582       0.751         0.1419 0.770   0.441
#> MAD:NMF     4 0.608           0.632       0.803         0.1197 0.868   0.633
#> ATC:NMF     4 0.460           0.469       0.699         0.1982 0.860   0.651
#> SD:skmeans  4 0.817           0.823       0.880         0.0953 0.933   0.801
#> CV:skmeans  4 0.687           0.697       0.840         0.0858 0.931   0.800
#> MAD:skmeans 4 0.779           0.676       0.820         0.1104 0.856   0.633
#> ATC:skmeans 4 0.776           0.762       0.888         0.1057 0.912   0.774
#> SD:mclust   4 0.890           0.883       0.947         0.0837 0.929   0.793
#> CV:mclust   4 0.491           0.613       0.730         0.1923 0.898   0.763
#> MAD:mclust  4 0.912           0.885       0.946         0.0790 0.913   0.754
#> ATC:mclust  4 0.609           0.683       0.803         0.0938 0.912   0.752
#> SD:kmeans   4 0.679           0.527       0.755         0.1148 0.926   0.786
#> CV:kmeans   4 0.594           0.693       0.762         0.1182 0.907   0.728
#> MAD:kmeans  4 0.684           0.571       0.756         0.1102 0.937   0.813
#> ATC:kmeans  4 0.737           0.853       0.866         0.1064 0.883   0.664
#> SD:pam      4 0.764           0.695       0.828         0.1017 0.880   0.667
#> CV:pam      4 0.649           0.730       0.841         0.1688 0.843   0.613
#> MAD:pam     4 0.844           0.770       0.873         0.0881 0.926   0.779
#> ATC:pam     4 0.783           0.801       0.904         0.1160 0.923   0.789
#> SD:hclust   4 0.586           0.751       0.816         0.1271 0.910   0.763
#> CV:hclust   4 0.439           0.418       0.669         0.1161 0.769   0.498
#> MAD:hclust  4 0.607           0.693       0.790         0.1161 0.841   0.588
#> ATC:hclust  4 0.688           0.706       0.836         0.1568 0.866   0.628
get_stats(res_list, k = 5)
#>             k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> SD:NMF      5 0.671           0.576       0.770         0.0605 0.901   0.659
#> CV:NMF      5 0.504           0.502       0.684         0.0645 0.910   0.662
#> MAD:NMF     5 0.626           0.579       0.769         0.0591 0.876   0.580
#> ATC:NMF     5 0.524           0.397       0.655         0.0697 0.853   0.564
#> SD:skmeans  5 0.890           0.887       0.924         0.0661 0.929   0.757
#> CV:skmeans  5 0.725           0.719       0.839         0.0549 0.936   0.783
#> MAD:skmeans 5 0.883           0.889       0.923         0.0663 0.897   0.668
#> ATC:skmeans 5 0.782           0.753       0.880         0.0621 0.945   0.828
#> SD:mclust   5 0.809           0.789       0.886         0.0594 0.955   0.846
#> CV:mclust   5 0.784           0.778       0.886         0.1164 0.831   0.543
#> MAD:mclust  5 0.830           0.807       0.866         0.0670 0.975   0.914
#> ATC:mclust  5 0.533           0.553       0.707         0.0792 0.878   0.609
#> SD:kmeans   5 0.615           0.469       0.655         0.0648 0.812   0.441
#> CV:kmeans   5 0.632           0.503       0.716         0.0633 0.955   0.834
#> MAD:kmeans  5 0.663           0.518       0.642         0.0661 0.836   0.494
#> ATC:kmeans  5 0.691           0.631       0.798         0.0615 0.977   0.913
#> SD:pam      5 0.891           0.844       0.938         0.0704 0.929   0.744
#> CV:pam      5 0.773           0.756       0.894         0.0697 0.942   0.796
#> MAD:pam     5 0.870           0.792       0.913         0.0658 0.930   0.751
#> ATC:pam     5 0.748           0.761       0.851         0.0790 0.926   0.757
#> SD:hclust   5 0.682           0.755       0.838         0.0917 0.944   0.807
#> CV:hclust   5 0.500           0.487       0.681         0.0575 0.932   0.772
#> MAD:hclust  5 0.651           0.689       0.830         0.0806 0.923   0.718
#> ATC:hclust  5 0.675           0.592       0.768         0.0378 0.950   0.819
get_stats(res_list, k = 6)
#>             k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> SD:NMF      6 0.683           0.579       0.765         0.0405 0.871   0.511
#> CV:NMF      6 0.578           0.446       0.670         0.0463 0.941   0.727
#> MAD:NMF     6 0.688           0.603       0.776         0.0430 0.850   0.448
#> ATC:NMF     6 0.579           0.493       0.666         0.0507 0.855   0.469
#> SD:skmeans  6 0.802           0.798       0.863         0.0398 1.000   1.000
#> CV:skmeans  6 0.674           0.648       0.777         0.0414 1.000   1.000
#> MAD:skmeans 6 0.806           0.767       0.869         0.0387 0.986   0.940
#> ATC:skmeans 6 0.765           0.684       0.833         0.0393 0.982   0.934
#> SD:mclust   6 0.764           0.710       0.833         0.0718 0.900   0.638
#> CV:mclust   6 0.751           0.706       0.825         0.0349 0.946   0.762
#> MAD:mclust  6 0.800           0.791       0.875         0.0591 0.930   0.736
#> ATC:mclust  6 0.651           0.508       0.719         0.0427 0.902   0.602
#> SD:kmeans   6 0.683           0.741       0.791         0.0478 0.910   0.600
#> CV:kmeans   6 0.640           0.438       0.666         0.0468 0.921   0.692
#> MAD:kmeans  6 0.672           0.667       0.755         0.0442 0.912   0.604
#> ATC:kmeans  6 0.737           0.516       0.672         0.0414 0.907   0.651
#> SD:pam      6 0.808           0.741       0.848         0.0478 0.948   0.768
#> CV:pam      6 0.776           0.679       0.850         0.0192 0.948   0.790
#> MAD:pam     6 0.825           0.776       0.872         0.0387 0.979   0.904
#> ATC:pam     6 0.716           0.628       0.788         0.0624 0.919   0.671
#> SD:hclust   6 0.694           0.715       0.804         0.0290 0.998   0.992
#> CV:hclust   6 0.527           0.539       0.704         0.0517 0.869   0.564
#> MAD:hclust  6 0.708           0.657       0.818         0.0346 0.998   0.989
#> ATC:hclust  6 0.678           0.513       0.713         0.0388 0.951   0.815

Following heatmap plots the partition for each combination of methods and the lightness correspond to the silhouette scores for samples in each method. On top the consensus subgroup is inferred from all methods by taking the mean silhouette scores as weight.

collect_stats(res_list, k = 2)

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

collect_stats(res_list, k = 3)

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

collect_stats(res_list, k = 4)

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

collect_stats(res_list, k = 5)

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

collect_stats(res_list, k = 6)

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

Partition from all methods

Collect partitions from all methods:

collect_classes(res_list, k = 2)

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

collect_classes(res_list, k = 3)

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

collect_classes(res_list, k = 4)

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

collect_classes(res_list, k = 5)

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

collect_classes(res_list, k = 6)

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

Top rows overlap

Overlap of top rows from different top-row methods:

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Heatmaps of the top rows:

top_rows_heatmap(res_list, top_n = 1000)

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

top_rows_heatmap(res_list, top_n = 2000)

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

top_rows_heatmap(res_list, top_n = 3000)

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

top_rows_heatmap(res_list, top_n = 4000)

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

top_rows_heatmap(res_list, top_n = 5000)

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

Test to known annotations

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

test_to_known_factors(res_list, k = 2)
#>              n disease.state(p) k
#> SD:NMF      69           0.2010 2
#> CV:NMF      69           0.4289 2
#> MAD:NMF     70           0.2746 2
#> ATC:NMF     69           0.1477 2
#> SD:skmeans  69           0.1864 2
#> CV:skmeans  68           0.3663 2
#> MAD:skmeans 71           0.3335 2
#> ATC:skmeans 71           0.2013 2
#> SD:mclust   63           0.0326 2
#> CV:mclust   68           0.1628 2
#> MAD:mclust  67           0.0302 2
#> ATC:mclust  62           0.0258 2
#> SD:kmeans   71           0.2102 2
#> CV:kmeans   70           0.3931 2
#> MAD:kmeans  70           0.2697 2
#> ATC:kmeans  69           0.1725 2
#> SD:pam      69           0.4434 2
#> CV:pam      71           0.6514 2
#> MAD:pam     70           0.5003 2
#> ATC:pam     72           0.4704 2
#> SD:hclust   71           0.3484 2
#> CV:hclust   72           0.2918 2
#> MAD:hclust  66           0.4340 2
#> ATC:hclust  70           0.2529 2
test_to_known_factors(res_list, k = 3)
#>              n disease.state(p) k
#> SD:NMF      65           0.0553 3
#> CV:NMF      62           0.2711 3
#> MAD:NMF     63           0.2031 3
#> ATC:NMF     63           0.1398 3
#> SD:skmeans  69           0.1233 3
#> CV:skmeans  69           0.4201 3
#> MAD:skmeans 56           0.1247 3
#> ATC:skmeans 69           0.1719 3
#> SD:mclust   69           0.1000 3
#> CV:mclust   62           0.5950 3
#> MAD:mclust  68           0.1211 3
#> ATC:mclust  67           0.0592 3
#> SD:kmeans   71           0.0202 3
#> CV:kmeans   71           0.0561 3
#> MAD:kmeans  72           0.0579 3
#> ATC:kmeans  70           0.0594 3
#> SD:pam      66           0.4011 3
#> CV:pam      65           0.5327 3
#> MAD:pam     67           0.5910 3
#> ATC:pam     69           0.3578 3
#> SD:hclust   67           0.7014 3
#> CV:hclust   53           0.2859 3
#> MAD:hclust  62           0.5509 3
#> ATC:hclust  58           0.1063 3
test_to_known_factors(res_list, k = 4)
#>              n disease.state(p) k
#> SD:NMF      64           0.1127 4
#> CV:NMF      54           0.1392 4
#> MAD:NMF     55           0.2099 4
#> ATC:NMF     46           0.3262 4
#> SD:skmeans  70           0.1417 4
#> CV:skmeans  54           0.1871 4
#> MAD:skmeans 44           0.1746 4
#> ATC:skmeans 59           0.1808 4
#> SD:mclust   67           0.1645 4
#> CV:mclust   60           0.2969 4
#> MAD:mclust  69           0.0496 4
#> ATC:mclust  62           0.0827 4
#> SD:kmeans   40           0.0880 4
#> CV:kmeans   63           0.2140 4
#> MAD:kmeans  48           0.0499 4
#> ATC:kmeans  71           0.1106 4
#> SD:pam      60           0.3332 4
#> CV:pam      63           0.1186 4
#> MAD:pam     63           0.4130 4
#> ATC:pam     64           0.1449 4
#> SD:hclust   68           0.8199 4
#> CV:hclust   48           0.4173 4
#> MAD:hclust  62           0.6853 4
#> ATC:hclust  64           0.3928 4
test_to_known_factors(res_list, k = 5)
#>              n disease.state(p) k
#> SD:NMF      57           0.3054 5
#> CV:NMF      45           0.4115 5
#> MAD:NMF     43           0.3334 5
#> ATC:NMF     34           0.2154 5
#> SD:skmeans  70           0.1165 5
#> CV:skmeans  58           0.0430 5
#> MAD:skmeans 72           0.0637 5
#> ATC:skmeans 57           0.3067 5
#> SD:mclust   66           0.2368 5
#> CV:mclust   67           0.4878 5
#> MAD:mclust  69           0.3056 5
#> ATC:mclust  51           0.3185 5
#> SD:kmeans   49           0.3519 5
#> CV:kmeans   38           0.2713 5
#> MAD:kmeans  37           0.1797 5
#> ATC:kmeans  60           0.2543 5
#> SD:pam      66           0.1068 5
#> CV:pam      62           0.3252 5
#> MAD:pam     59           0.1964 5
#> ATC:pam     64           0.3907 5
#> SD:hclust   67           0.7883 5
#> CV:hclust   49           0.3020 5
#> MAD:hclust  61           0.7389 5
#> ATC:hclust  53           0.2460 5
test_to_known_factors(res_list, k = 6)
#>              n disease.state(p) k
#> SD:NMF      48           0.2181 6
#> CV:NMF      38           0.1334 6
#> MAD:NMF     53           0.3025 6
#> ATC:NMF     41           0.4525 6
#> SD:skmeans  67           0.2418 6
#> CV:skmeans  54           0.0233 6
#> MAD:skmeans 67           0.2245 6
#> ATC:skmeans 50           0.1743 6
#> SD:mclust   64           0.5195 6
#> CV:mclust   59           0.5494 6
#> MAD:mclust  69           0.4235 6
#> ATC:mclust  44           0.1484 6
#> SD:kmeans   66           0.2958 6
#> CV:kmeans   31           0.9935 6
#> MAD:kmeans  62           0.1807 6
#> ATC:kmeans  38           0.2639 6
#> SD:pam      63           0.1979 6
#> CV:pam      56           0.3704 6
#> MAD:pam     66           0.2239 6
#> ATC:pam     59           0.2603 6
#> SD:hclust   65           0.8144 6
#> CV:hclust   51           0.8261 6
#> MAD:hclust  61           0.4480 6
#> ATC:hclust  47           0.1810 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 17730 rows and 72 columns.
#>   Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'SD' method.
#>   Subgroups are detected by 'hclust' method.
#>   Performed in total 1250 partitions by row resampling.
#>   Best k for subgroups seems to be 2.
#> 
#> Following methods can be applied to this 'ConsensusPartition' object:
#>  [1] "cola_report"             "collect_classes"         "collect_plots"          
#>  [4] "collect_stats"           "colnames"                "compare_signatures"     
#>  [7] "consensus_heatmap"       "dimension_reduction"     "functional_enrichment"  
#> [10] "get_anno_col"            "get_anno"                "get_classes"            
#> [13] "get_consensus"           "get_matrix"              "get_membership"         
#> [16] "get_param"               "get_signatures"          "get_stats"              
#> [19] "is_best_k"               "is_stable_k"             "membership_heatmap"     
#> [22] "ncol"                    "nrow"                    "plot_ecdf"              
#> [25] "rownames"                "select_partition_number" "show"                   
#> [28] "suggest_best_k"          "test_to_known_factors"

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

collect_plots(res)

plot of chunk SD-hclust-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.732           0.890       0.937         0.4755 0.499   0.499
#> 3 3 0.575           0.785       0.867         0.3222 0.883   0.765
#> 4 4 0.586           0.751       0.816         0.1271 0.910   0.763
#> 5 5 0.682           0.755       0.838         0.0917 0.944   0.807
#> 6 6 0.694           0.715       0.804         0.0290 0.998   0.992

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
#> GSM151369     1  0.7299      0.789 0.796 0.204
#> GSM151370     2  0.0938      0.972 0.012 0.988
#> GSM151371     1  0.9209      0.617 0.664 0.336
#> GSM151372     2  0.0000      0.973 0.000 1.000
#> GSM151373     2  0.0000      0.973 0.000 1.000
#> GSM151374     2  0.0000      0.973 0.000 1.000
#> GSM151375     2  0.0672      0.972 0.008 0.992
#> GSM151376     2  0.0672      0.972 0.008 0.992
#> GSM151377     2  0.0000      0.973 0.000 1.000
#> GSM151378     2  0.0000      0.973 0.000 1.000
#> GSM151379     2  0.0000      0.973 0.000 1.000
#> GSM151380     1  0.7883      0.756 0.764 0.236
#> GSM151381     2  0.0000      0.973 0.000 1.000
#> GSM151382     2  0.2603      0.947 0.044 0.956
#> GSM151383     2  0.4562      0.899 0.096 0.904
#> GSM151384     1  0.2778      0.877 0.952 0.048
#> GSM151385     1  0.0000      0.878 1.000 0.000
#> GSM151386     1  0.2778      0.877 0.952 0.048
#> GSM151387     2  0.0938      0.972 0.012 0.988
#> GSM151388     2  0.0938      0.972 0.012 0.988
#> GSM151389     2  0.0672      0.973 0.008 0.992
#> GSM151390     2  0.0672      0.972 0.008 0.992
#> GSM151391     2  0.0000      0.973 0.000 1.000
#> GSM151392     1  0.7299      0.789 0.796 0.204
#> GSM151393     2  0.0000      0.973 0.000 1.000
#> GSM151394     1  0.1184      0.881 0.984 0.016
#> GSM151395     2  0.2948      0.943 0.052 0.948
#> GSM151396     2  0.2948      0.943 0.052 0.948
#> GSM151397     1  0.0000      0.878 1.000 0.000
#> GSM151398     1  0.3879      0.869 0.924 0.076
#> GSM151399     2  0.0672      0.973 0.008 0.992
#> GSM151400     2  0.5629      0.850 0.132 0.868
#> GSM151401     2  0.0376      0.973 0.004 0.996
#> GSM151402     2  0.0000      0.973 0.000 1.000
#> GSM151403     2  0.0672      0.973 0.008 0.992
#> GSM151404     1  0.7299      0.789 0.796 0.204
#> GSM151405     2  0.0938      0.972 0.012 0.988
#> GSM151406     2  0.0938      0.972 0.012 0.988
#> GSM151407     2  0.4562      0.899 0.096 0.904
#> GSM151408     2  0.4562      0.899 0.096 0.904
#> GSM151409     1  0.1184      0.881 0.984 0.016
#> GSM151410     1  0.9815      0.441 0.580 0.420
#> GSM151411     1  0.1184      0.881 0.984 0.016
#> GSM151412     2  0.0376      0.973 0.004 0.996
#> GSM151413     1  0.0000      0.878 1.000 0.000
#> GSM151414     1  0.0000      0.878 1.000 0.000
#> GSM151415     1  0.0000      0.878 1.000 0.000
#> GSM151416     1  0.9522      0.554 0.628 0.372
#> GSM151417     1  0.9460      0.570 0.636 0.364
#> GSM151418     2  0.0000      0.973 0.000 1.000
#> GSM151419     1  0.0000      0.878 1.000 0.000
#> GSM151420     1  0.0000      0.878 1.000 0.000
#> GSM151421     1  0.4815      0.856 0.896 0.104
#> GSM151422     1  0.0938      0.880 0.988 0.012
#> GSM151423     2  0.0000      0.973 0.000 1.000
#> GSM151424     2  0.0672      0.973 0.008 0.992
#> GSM151425     2  0.1184      0.970 0.016 0.984
#> GSM151426     2  0.0938      0.972 0.012 0.988
#> GSM151427     2  0.0000      0.973 0.000 1.000
#> GSM151428     1  0.9286      0.605 0.656 0.344
#> GSM151429     1  0.9522      0.554 0.628 0.372
#> GSM151430     2  0.4562      0.899 0.096 0.904
#> GSM151431     2  0.4562      0.899 0.096 0.904
#> GSM151432     1  0.2423      0.879 0.960 0.040
#> GSM151433     1  0.1184      0.881 0.984 0.016
#> GSM151434     1  0.2778      0.877 0.952 0.048
#> GSM151435     1  0.0000      0.878 1.000 0.000
#> GSM151436     2  0.0000      0.973 0.000 1.000
#> GSM151437     1  0.0000      0.878 1.000 0.000
#> GSM151438     1  0.0000      0.878 1.000 0.000
#> GSM151439     1  0.5408      0.846 0.876 0.124
#> GSM151440     2  0.0000      0.973 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
#> GSM151369     1  0.5778      0.775 0.768 0.200 0.032
#> GSM151370     2  0.2200      0.832 0.004 0.940 0.056
#> GSM151371     1  0.6543      0.604 0.640 0.344 0.016
#> GSM151372     2  0.6235      0.332 0.000 0.564 0.436
#> GSM151373     2  0.1860      0.831 0.000 0.948 0.052
#> GSM151374     3  0.2625      0.982 0.000 0.084 0.916
#> GSM151375     2  0.6204      0.322 0.000 0.576 0.424
#> GSM151376     2  0.6204      0.322 0.000 0.576 0.424
#> GSM151377     3  0.2711      0.983 0.000 0.088 0.912
#> GSM151378     3  0.2625      0.982 0.000 0.084 0.916
#> GSM151379     3  0.2625      0.982 0.000 0.084 0.916
#> GSM151380     1  0.5903      0.748 0.744 0.232 0.024
#> GSM151381     2  0.4974      0.701 0.000 0.764 0.236
#> GSM151382     2  0.5845      0.609 0.004 0.688 0.308
#> GSM151383     2  0.3183      0.789 0.016 0.908 0.076
#> GSM151384     1  0.1878      0.863 0.952 0.044 0.004
#> GSM151385     1  0.0747      0.858 0.984 0.000 0.016
#> GSM151386     1  0.1878      0.863 0.952 0.044 0.004
#> GSM151387     2  0.2200      0.832 0.004 0.940 0.056
#> GSM151388     2  0.2200      0.832 0.004 0.940 0.056
#> GSM151389     2  0.3752      0.789 0.000 0.856 0.144
#> GSM151390     2  0.6204      0.322 0.000 0.576 0.424
#> GSM151391     3  0.3752      0.926 0.000 0.144 0.856
#> GSM151392     1  0.5778      0.775 0.768 0.200 0.032
#> GSM151393     3  0.2711      0.983 0.000 0.088 0.912
#> GSM151394     1  0.0892      0.865 0.980 0.020 0.000
#> GSM151395     2  0.1711      0.822 0.032 0.960 0.008
#> GSM151396     2  0.1711      0.822 0.032 0.960 0.008
#> GSM151397     1  0.0747      0.858 0.984 0.000 0.016
#> GSM151398     1  0.2774      0.857 0.920 0.072 0.008
#> GSM151399     2  0.1031      0.832 0.000 0.976 0.024
#> GSM151400     2  0.4087      0.767 0.052 0.880 0.068
#> GSM151401     2  0.1529      0.833 0.000 0.960 0.040
#> GSM151402     3  0.2711      0.983 0.000 0.088 0.912
#> GSM151403     2  0.3752      0.789 0.000 0.856 0.144
#> GSM151404     1  0.5536      0.779 0.776 0.200 0.024
#> GSM151405     2  0.2200      0.832 0.004 0.940 0.056
#> GSM151406     2  0.2200      0.832 0.004 0.940 0.056
#> GSM151407     2  0.3272      0.793 0.016 0.904 0.080
#> GSM151408     2  0.3272      0.793 0.016 0.904 0.080
#> GSM151409     1  0.0892      0.865 0.980 0.020 0.000
#> GSM151410     1  0.7004      0.440 0.552 0.428 0.020
#> GSM151411     1  0.0892      0.865 0.980 0.020 0.000
#> GSM151412     2  0.1529      0.833 0.000 0.960 0.040
#> GSM151413     1  0.0747      0.858 0.984 0.000 0.016
#> GSM151414     1  0.0747      0.858 0.984 0.000 0.016
#> GSM151415     1  0.0747      0.858 0.984 0.000 0.016
#> GSM151416     1  0.6849      0.546 0.600 0.380 0.020
#> GSM151417     1  0.6814      0.560 0.608 0.372 0.020
#> GSM151418     3  0.2711      0.983 0.000 0.088 0.912
#> GSM151419     1  0.0747      0.858 0.984 0.000 0.016
#> GSM151420     1  0.0747      0.858 0.984 0.000 0.016
#> GSM151421     1  0.3425      0.843 0.884 0.112 0.004
#> GSM151422     1  0.1636      0.862 0.964 0.020 0.016
#> GSM151423     3  0.3482      0.943 0.000 0.128 0.872
#> GSM151424     2  0.1031      0.832 0.000 0.976 0.024
#> GSM151425     2  0.1129      0.832 0.004 0.976 0.020
#> GSM151426     2  0.2200      0.832 0.004 0.940 0.056
#> GSM151427     3  0.2625      0.982 0.000 0.084 0.916
#> GSM151428     1  0.6608      0.589 0.628 0.356 0.016
#> GSM151429     1  0.6849      0.546 0.600 0.380 0.020
#> GSM151430     2  0.3091      0.789 0.016 0.912 0.072
#> GSM151431     2  0.3091      0.789 0.016 0.912 0.072
#> GSM151432     1  0.1643      0.865 0.956 0.044 0.000
#> GSM151433     1  0.0892      0.865 0.980 0.020 0.000
#> GSM151434     1  0.1878      0.863 0.952 0.044 0.004
#> GSM151435     1  0.0747      0.858 0.984 0.000 0.016
#> GSM151436     2  0.5905      0.507 0.000 0.648 0.352
#> GSM151437     1  0.0747      0.858 0.984 0.000 0.016
#> GSM151438     1  0.0747      0.858 0.984 0.000 0.016
#> GSM151439     1  0.3784      0.835 0.864 0.132 0.004
#> GSM151440     2  0.5905      0.507 0.000 0.648 0.352

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM151369     1  0.3378      0.709 0.884 0.060 0.012 0.044
#> GSM151370     2  0.2616      0.812 0.028 0.920 0.016 0.036
#> GSM151371     1  0.4872      0.640 0.760 0.204 0.012 0.024
#> GSM151372     2  0.5088      0.384 0.004 0.572 0.424 0.000
#> GSM151373     2  0.1296      0.814 0.004 0.964 0.028 0.004
#> GSM151374     3  0.1474      0.980 0.000 0.052 0.948 0.000
#> GSM151375     2  0.6043      0.347 0.020 0.552 0.412 0.016
#> GSM151376     2  0.6043      0.347 0.020 0.552 0.412 0.016
#> GSM151377     3  0.1890      0.979 0.000 0.056 0.936 0.008
#> GSM151378     3  0.1474      0.980 0.000 0.052 0.948 0.000
#> GSM151379     3  0.1474      0.980 0.000 0.052 0.948 0.000
#> GSM151380     1  0.3464      0.691 0.868 0.076 0.000 0.056
#> GSM151381     2  0.5047      0.712 0.016 0.756 0.200 0.028
#> GSM151382     2  0.5519      0.626 0.024 0.660 0.308 0.008
#> GSM151383     2  0.4406      0.769 0.036 0.840 0.060 0.064
#> GSM151384     1  0.3024      0.680 0.852 0.000 0.000 0.148
#> GSM151385     4  0.3569      0.919 0.196 0.000 0.000 0.804
#> GSM151386     1  0.3024      0.680 0.852 0.000 0.000 0.148
#> GSM151387     2  0.2810      0.811 0.036 0.912 0.016 0.036
#> GSM151388     2  0.2810      0.811 0.036 0.912 0.016 0.036
#> GSM151389     2  0.4287      0.781 0.024 0.836 0.104 0.036
#> GSM151390     2  0.6043      0.347 0.020 0.552 0.412 0.016
#> GSM151391     3  0.2928      0.929 0.012 0.108 0.880 0.000
#> GSM151392     1  0.3378      0.709 0.884 0.060 0.012 0.044
#> GSM151393     3  0.1743      0.980 0.000 0.056 0.940 0.004
#> GSM151394     1  0.3870      0.610 0.788 0.004 0.000 0.208
#> GSM151395     2  0.2053      0.805 0.072 0.924 0.000 0.004
#> GSM151396     2  0.2053      0.805 0.072 0.924 0.000 0.004
#> GSM151397     4  0.4164      0.863 0.264 0.000 0.000 0.736
#> GSM151398     1  0.2593      0.700 0.892 0.004 0.000 0.104
#> GSM151399     2  0.0524      0.815 0.008 0.988 0.000 0.004
#> GSM151400     2  0.7291      0.596 0.172 0.636 0.044 0.148
#> GSM151401     2  0.0967      0.815 0.004 0.976 0.016 0.004
#> GSM151402     3  0.1743      0.980 0.000 0.056 0.940 0.004
#> GSM151403     2  0.4287      0.781 0.024 0.836 0.104 0.036
#> GSM151404     1  0.3004      0.703 0.892 0.048 0.000 0.060
#> GSM151405     2  0.2616      0.812 0.028 0.920 0.016 0.036
#> GSM151406     2  0.2616      0.812 0.028 0.920 0.016 0.036
#> GSM151407     2  0.4482      0.771 0.036 0.836 0.064 0.064
#> GSM151408     2  0.4482      0.771 0.036 0.836 0.064 0.064
#> GSM151409     1  0.3831      0.615 0.792 0.004 0.000 0.204
#> GSM151410     1  0.5432      0.554 0.680 0.288 0.016 0.016
#> GSM151411     1  0.3831      0.615 0.792 0.004 0.000 0.204
#> GSM151412     2  0.0967      0.815 0.004 0.976 0.016 0.004
#> GSM151413     4  0.3569      0.919 0.196 0.000 0.000 0.804
#> GSM151414     4  0.3569      0.919 0.196 0.000 0.000 0.804
#> GSM151415     4  0.4866      0.624 0.404 0.000 0.000 0.596
#> GSM151416     1  0.5027      0.615 0.736 0.232 0.016 0.016
#> GSM151417     1  0.4959      0.622 0.744 0.224 0.016 0.016
#> GSM151418     3  0.1890      0.979 0.000 0.056 0.936 0.008
#> GSM151419     4  0.3569      0.919 0.196 0.000 0.000 0.804
#> GSM151420     4  0.3688      0.917 0.208 0.000 0.000 0.792
#> GSM151421     1  0.3243      0.716 0.876 0.036 0.000 0.088
#> GSM151422     4  0.4955      0.537 0.444 0.000 0.000 0.556
#> GSM151423     3  0.2408      0.937 0.000 0.104 0.896 0.000
#> GSM151424     2  0.0524      0.815 0.008 0.988 0.000 0.004
#> GSM151425     2  0.0895      0.816 0.020 0.976 0.000 0.004
#> GSM151426     2  0.2810      0.811 0.036 0.912 0.016 0.036
#> GSM151427     3  0.1474      0.980 0.000 0.052 0.948 0.000
#> GSM151428     1  0.4700      0.636 0.764 0.208 0.012 0.016
#> GSM151429     1  0.5027      0.615 0.736 0.232 0.016 0.016
#> GSM151430     2  0.4329      0.770 0.036 0.844 0.056 0.064
#> GSM151431     2  0.4329      0.770 0.036 0.844 0.056 0.064
#> GSM151432     1  0.3636      0.653 0.820 0.008 0.000 0.172
#> GSM151433     1  0.3831      0.615 0.792 0.004 0.000 0.204
#> GSM151434     1  0.3024      0.680 0.852 0.000 0.000 0.148
#> GSM151435     4  0.3569      0.919 0.196 0.000 0.000 0.804
#> GSM151436     2  0.4761      0.552 0.004 0.664 0.332 0.000
#> GSM151437     4  0.3688      0.917 0.208 0.000 0.000 0.792
#> GSM151438     4  0.3649      0.918 0.204 0.000 0.000 0.796
#> GSM151439     1  0.3601      0.718 0.860 0.056 0.000 0.084
#> GSM151440     2  0.4761      0.552 0.004 0.664 0.332 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
#> GSM151369     5  0.3119      0.757 0.000 0.072 0.000 0.068 0.860
#> GSM151370     2  0.0963      0.732 0.000 0.964 0.000 0.036 0.000
#> GSM151371     5  0.5386      0.676 0.040 0.036 0.000 0.256 0.668
#> GSM151372     2  0.4504      0.436 0.000 0.564 0.428 0.008 0.000
#> GSM151373     2  0.2848      0.725 0.000 0.868 0.028 0.104 0.000
#> GSM151374     3  0.0162      0.970 0.000 0.000 0.996 0.004 0.000
#> GSM151375     2  0.5433      0.393 0.000 0.540 0.412 0.032 0.016
#> GSM151376     2  0.5433      0.393 0.000 0.540 0.412 0.032 0.016
#> GSM151377     3  0.0609      0.966 0.000 0.000 0.980 0.020 0.000
#> GSM151378     3  0.0324      0.972 0.000 0.004 0.992 0.004 0.000
#> GSM151379     3  0.0324      0.972 0.000 0.004 0.992 0.004 0.000
#> GSM151380     5  0.3749      0.728 0.000 0.104 0.000 0.080 0.816
#> GSM151381     2  0.3805      0.680 0.000 0.784 0.184 0.032 0.000
#> GSM151382     2  0.6706      0.251 0.000 0.428 0.284 0.288 0.000
#> GSM151383     4  0.2848      0.915 0.000 0.156 0.004 0.840 0.000
#> GSM151384     5  0.2377      0.768 0.128 0.000 0.000 0.000 0.872
#> GSM151385     1  0.0880      0.912 0.968 0.000 0.000 0.000 0.032
#> GSM151386     5  0.2377      0.768 0.128 0.000 0.000 0.000 0.872
#> GSM151387     2  0.1121      0.730 0.000 0.956 0.000 0.044 0.000
#> GSM151388     2  0.1121      0.730 0.000 0.956 0.000 0.044 0.000
#> GSM151389     2  0.2959      0.713 0.000 0.864 0.100 0.036 0.000
#> GSM151390     2  0.5433      0.393 0.000 0.540 0.412 0.032 0.016
#> GSM151391     3  0.2141      0.920 0.000 0.064 0.916 0.016 0.004
#> GSM151392     5  0.3119      0.757 0.000 0.072 0.000 0.068 0.860
#> GSM151393     3  0.0451      0.972 0.000 0.004 0.988 0.008 0.000
#> GSM151394     5  0.2813      0.724 0.168 0.000 0.000 0.000 0.832
#> GSM151395     2  0.3932      0.652 0.000 0.796 0.000 0.140 0.064
#> GSM151396     2  0.3932      0.652 0.000 0.796 0.000 0.140 0.064
#> GSM151397     1  0.2561      0.838 0.856 0.000 0.000 0.000 0.144
#> GSM151398     5  0.2396      0.781 0.068 0.004 0.000 0.024 0.904
#> GSM151399     2  0.2338      0.719 0.000 0.884 0.000 0.112 0.004
#> GSM151400     4  0.3779      0.691 0.032 0.040 0.000 0.836 0.092
#> GSM151401     2  0.2573      0.725 0.000 0.880 0.016 0.104 0.000
#> GSM151402     3  0.0451      0.972 0.000 0.004 0.988 0.008 0.000
#> GSM151403     2  0.2959      0.713 0.000 0.864 0.100 0.036 0.000
#> GSM151404     5  0.3237      0.748 0.000 0.104 0.000 0.048 0.848
#> GSM151405     2  0.0963      0.732 0.000 0.964 0.000 0.036 0.000
#> GSM151406     2  0.0963      0.732 0.000 0.964 0.000 0.036 0.000
#> GSM151407     4  0.3203      0.905 0.000 0.168 0.012 0.820 0.000
#> GSM151408     4  0.3203      0.905 0.000 0.168 0.012 0.820 0.000
#> GSM151409     5  0.2732      0.730 0.160 0.000 0.000 0.000 0.840
#> GSM151410     5  0.5635      0.561 0.032 0.036 0.000 0.340 0.592
#> GSM151411     5  0.2732      0.730 0.160 0.000 0.000 0.000 0.840
#> GSM151412     2  0.2573      0.725 0.000 0.880 0.016 0.104 0.000
#> GSM151413     1  0.0880      0.912 0.968 0.000 0.000 0.000 0.032
#> GSM151414     1  0.0880      0.912 0.968 0.000 0.000 0.000 0.032
#> GSM151415     1  0.3857      0.595 0.688 0.000 0.000 0.000 0.312
#> GSM151416     5  0.5416      0.641 0.032 0.036 0.000 0.288 0.644
#> GSM151417     5  0.5375      0.649 0.032 0.036 0.000 0.280 0.652
#> GSM151418     3  0.1399      0.957 0.000 0.028 0.952 0.020 0.000
#> GSM151419     1  0.0880      0.912 0.968 0.000 0.000 0.000 0.032
#> GSM151420     1  0.1197      0.910 0.952 0.000 0.000 0.000 0.048
#> GSM151421     5  0.2710      0.785 0.064 0.008 0.000 0.036 0.892
#> GSM151422     1  0.4135      0.531 0.656 0.000 0.000 0.004 0.340
#> GSM151423     3  0.1764      0.926 0.000 0.064 0.928 0.008 0.000
#> GSM151424     2  0.2286      0.721 0.000 0.888 0.000 0.108 0.004
#> GSM151425     2  0.2625      0.717 0.000 0.876 0.000 0.108 0.016
#> GSM151426     2  0.1121      0.730 0.000 0.956 0.000 0.044 0.000
#> GSM151427     3  0.0324      0.972 0.000 0.004 0.992 0.004 0.000
#> GSM151428     5  0.5264      0.669 0.032 0.036 0.000 0.260 0.672
#> GSM151429     5  0.5416      0.641 0.032 0.036 0.000 0.288 0.644
#> GSM151430     4  0.2605      0.917 0.000 0.148 0.000 0.852 0.000
#> GSM151431     4  0.2605      0.917 0.000 0.148 0.000 0.852 0.000
#> GSM151432     5  0.2911      0.752 0.136 0.004 0.000 0.008 0.852
#> GSM151433     5  0.2732      0.730 0.160 0.000 0.000 0.000 0.840
#> GSM151434     5  0.2377      0.768 0.128 0.000 0.000 0.000 0.872
#> GSM151435     1  0.0880      0.912 0.968 0.000 0.000 0.000 0.032
#> GSM151436     2  0.5434      0.559 0.000 0.588 0.336 0.076 0.000
#> GSM151437     1  0.1197      0.910 0.952 0.000 0.000 0.000 0.048
#> GSM151438     1  0.1043      0.912 0.960 0.000 0.000 0.000 0.040
#> GSM151439     5  0.3126      0.784 0.060 0.024 0.000 0.040 0.876
#> GSM151440     2  0.5434      0.559 0.000 0.588 0.336 0.076 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
#> GSM151369     6  0.3645      0.684 0.000 0.072 0.000 0.020 0.092 0.816
#> GSM151370     2  0.1686      0.759 0.000 0.924 0.000 0.012 0.064 0.000
#> GSM151371     6  0.5929      0.585 0.036 0.012 0.000 0.188 0.144 0.620
#> GSM151372     2  0.4082      0.461 0.000 0.560 0.432 0.004 0.004 0.000
#> GSM151373     2  0.2487      0.760 0.004 0.888 0.028 0.076 0.004 0.000
#> GSM151374     3  0.0146      0.833 0.000 0.000 0.996 0.000 0.004 0.000
#> GSM151375     2  0.5019      0.412 0.000 0.544 0.404 0.012 0.032 0.008
#> GSM151376     2  0.5019      0.412 0.000 0.544 0.404 0.012 0.032 0.008
#> GSM151377     3  0.3428      0.805 0.000 0.000 0.696 0.000 0.304 0.000
#> GSM151378     3  0.0146      0.837 0.000 0.004 0.996 0.000 0.000 0.000
#> GSM151379     3  0.0146      0.837 0.000 0.004 0.996 0.000 0.000 0.000
#> GSM151380     6  0.4052      0.641 0.000 0.076 0.000 0.016 0.132 0.776
#> GSM151381     2  0.3800      0.714 0.000 0.776 0.168 0.008 0.048 0.000
#> GSM151382     2  0.6209      0.242 0.000 0.388 0.288 0.320 0.004 0.000
#> GSM151383     4  0.0837      0.920 0.000 0.020 0.004 0.972 0.004 0.000
#> GSM151384     6  0.3127      0.727 0.100 0.000 0.000 0.004 0.056 0.840
#> GSM151385     1  0.0146      0.891 0.996 0.000 0.000 0.000 0.000 0.004
#> GSM151386     6  0.3079      0.728 0.096 0.000 0.000 0.004 0.056 0.844
#> GSM151387     2  0.1802      0.757 0.000 0.916 0.000 0.012 0.072 0.000
#> GSM151388     2  0.1802      0.757 0.000 0.916 0.000 0.012 0.072 0.000
#> GSM151389     2  0.3237      0.733 0.000 0.836 0.056 0.008 0.100 0.000
#> GSM151390     2  0.5019      0.412 0.000 0.544 0.404 0.012 0.032 0.008
#> GSM151391     3  0.4468      0.797 0.000 0.048 0.660 0.000 0.288 0.004
#> GSM151392     6  0.3645      0.684 0.000 0.072 0.000 0.020 0.092 0.816
#> GSM151393     3  0.2772      0.849 0.000 0.004 0.816 0.000 0.180 0.000
#> GSM151394     6  0.2260      0.702 0.140 0.000 0.000 0.000 0.000 0.860
#> GSM151395     2  0.3661      0.702 0.004 0.816 0.000 0.108 0.016 0.056
#> GSM151396     2  0.3661      0.702 0.004 0.816 0.000 0.108 0.016 0.056
#> GSM151397     1  0.2092      0.815 0.876 0.000 0.000 0.000 0.000 0.124
#> GSM151398     6  0.2046      0.733 0.044 0.000 0.000 0.008 0.032 0.916
#> GSM151399     2  0.2149      0.754 0.004 0.900 0.000 0.080 0.016 0.000
#> GSM151400     5  0.5036      0.000 0.000 0.012 0.000 0.384 0.552 0.052
#> GSM151401     2  0.2238      0.759 0.004 0.900 0.016 0.076 0.004 0.000
#> GSM151402     3  0.2772      0.849 0.000 0.004 0.816 0.000 0.180 0.000
#> GSM151403     2  0.3237      0.733 0.000 0.836 0.056 0.008 0.100 0.000
#> GSM151404     6  0.3566      0.673 0.000 0.076 0.000 0.008 0.104 0.812
#> GSM151405     2  0.1686      0.759 0.000 0.924 0.000 0.012 0.064 0.000
#> GSM151406     2  0.1686      0.759 0.000 0.924 0.000 0.012 0.064 0.000
#> GSM151407     4  0.1594      0.897 0.000 0.052 0.016 0.932 0.000 0.000
#> GSM151408     4  0.1594      0.897 0.000 0.052 0.016 0.932 0.000 0.000
#> GSM151409     6  0.2178      0.707 0.132 0.000 0.000 0.000 0.000 0.868
#> GSM151410     6  0.6237      0.450 0.028 0.012 0.000 0.272 0.144 0.544
#> GSM151411     6  0.2178      0.707 0.132 0.000 0.000 0.000 0.000 0.868
#> GSM151412     2  0.2293      0.758 0.004 0.896 0.016 0.080 0.004 0.000
#> GSM151413     1  0.0405      0.887 0.988 0.000 0.000 0.000 0.008 0.004
#> GSM151414     1  0.0146      0.891 0.996 0.000 0.000 0.000 0.000 0.004
#> GSM151415     1  0.3371      0.603 0.708 0.000 0.000 0.000 0.000 0.292
#> GSM151416     6  0.6002      0.544 0.028 0.012 0.000 0.216 0.148 0.596
#> GSM151417     6  0.5955      0.555 0.028 0.012 0.000 0.208 0.148 0.604
#> GSM151418     3  0.4028      0.797 0.000 0.024 0.668 0.000 0.308 0.000
#> GSM151419     1  0.0146      0.891 0.996 0.000 0.000 0.000 0.000 0.004
#> GSM151420     1  0.0713      0.888 0.972 0.000 0.000 0.000 0.000 0.028
#> GSM151421     6  0.3227      0.729 0.036 0.008 0.000 0.040 0.056 0.860
#> GSM151422     1  0.3905      0.541 0.668 0.000 0.000 0.000 0.016 0.316
#> GSM151423     3  0.3920      0.818 0.000 0.048 0.736 0.000 0.216 0.000
#> GSM151424     2  0.2056      0.755 0.004 0.904 0.000 0.080 0.012 0.000
#> GSM151425     2  0.2405      0.752 0.004 0.892 0.000 0.080 0.016 0.008
#> GSM151426     2  0.1802      0.757 0.000 0.916 0.000 0.012 0.072 0.000
#> GSM151427     3  0.0146      0.837 0.000 0.004 0.996 0.000 0.000 0.000
#> GSM151428     6  0.5823      0.578 0.028 0.012 0.000 0.192 0.144 0.624
#> GSM151429     6  0.6002      0.544 0.028 0.012 0.000 0.216 0.148 0.596
#> GSM151430     4  0.0363      0.915 0.000 0.012 0.000 0.988 0.000 0.000
#> GSM151431     4  0.0363      0.915 0.000 0.012 0.000 0.988 0.000 0.000
#> GSM151432     6  0.2308      0.722 0.108 0.000 0.000 0.004 0.008 0.880
#> GSM151433     6  0.2178      0.707 0.132 0.000 0.000 0.000 0.000 0.868
#> GSM151434     6  0.3079      0.728 0.096 0.000 0.000 0.004 0.056 0.844
#> GSM151435     1  0.0260      0.892 0.992 0.000 0.000 0.000 0.000 0.008
#> GSM151436     2  0.5114      0.578 0.004 0.580 0.340 0.072 0.004 0.000
#> GSM151437     1  0.0790      0.887 0.968 0.000 0.000 0.000 0.000 0.032
#> GSM151438     1  0.0363      0.892 0.988 0.000 0.000 0.000 0.000 0.012
#> GSM151439     6  0.3581      0.722 0.032 0.024 0.000 0.044 0.056 0.844
#> GSM151440     2  0.5114      0.578 0.004 0.580 0.340 0.072 0.004 0.000

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

consensus_heatmap(res, k = 2)

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

consensus_heatmap(res, k = 3)

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

consensus_heatmap(res, k = 4)

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

consensus_heatmap(res, k = 5)

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

consensus_heatmap(res, k = 6)

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

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

membership_heatmap(res, k = 2)

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

membership_heatmap(res, k = 3)

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

membership_heatmap(res, k = 4)

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

membership_heatmap(res, k = 5)

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

membership_heatmap(res, k = 6)

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

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

Signature heatmaps where rows are scaled:

get_signatures(res, k = 2)

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

get_signatures(res, k = 3)

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

get_signatures(res, k = 4)

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

get_signatures(res, k = 5)

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

get_signatures(res, k = 6)

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

Signature heatmaps where rows are not scaled:

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

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

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

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

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

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

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

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

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

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

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk SD-hclust-signature_compare

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

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

An example of the output of tb is:

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

The columns in tb are:

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

UMAP plot which shows how samples are separated.

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

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

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

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

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

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

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

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

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

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

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk SD-hclust-collect-classes

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

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

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

collect_plots(res)

plot of chunk SD-kmeans-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 1.000           0.968       0.987         0.4777 0.525   0.525
#> 3 3 0.889           0.924       0.950         0.3845 0.769   0.577
#> 4 4 0.679           0.527       0.755         0.1148 0.926   0.786
#> 5 5 0.615           0.469       0.655         0.0648 0.812   0.441
#> 6 6 0.683           0.741       0.791         0.0478 0.910   0.600

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
#> GSM151369     1   0.000      0.989 1.000 0.000
#> GSM151370     2   0.000      0.985 0.000 1.000
#> GSM151371     1   0.000      0.989 1.000 0.000
#> GSM151372     2   0.000      0.985 0.000 1.000
#> GSM151373     2   0.000      0.985 0.000 1.000
#> GSM151374     2   0.000      0.985 0.000 1.000
#> GSM151375     2   0.000      0.985 0.000 1.000
#> GSM151376     2   0.000      0.985 0.000 1.000
#> GSM151377     2   0.000      0.985 0.000 1.000
#> GSM151378     2   0.000      0.985 0.000 1.000
#> GSM151379     2   0.000      0.985 0.000 1.000
#> GSM151380     2   0.000      0.985 0.000 1.000
#> GSM151381     2   0.000      0.985 0.000 1.000
#> GSM151382     2   0.000      0.985 0.000 1.000
#> GSM151383     2   0.000      0.985 0.000 1.000
#> GSM151384     1   0.000      0.989 1.000 0.000
#> GSM151385     1   0.000      0.989 1.000 0.000
#> GSM151386     1   0.000      0.989 1.000 0.000
#> GSM151387     2   0.000      0.985 0.000 1.000
#> GSM151388     2   0.000      0.985 0.000 1.000
#> GSM151389     2   0.000      0.985 0.000 1.000
#> GSM151390     2   0.000      0.985 0.000 1.000
#> GSM151391     2   0.000      0.985 0.000 1.000
#> GSM151392     2   0.000      0.985 0.000 1.000
#> GSM151393     2   0.000      0.985 0.000 1.000
#> GSM151394     1   0.000      0.989 1.000 0.000
#> GSM151395     2   0.000      0.985 0.000 1.000
#> GSM151396     2   0.000      0.985 0.000 1.000
#> GSM151397     1   0.000      0.989 1.000 0.000
#> GSM151398     1   0.000      0.989 1.000 0.000
#> GSM151399     2   0.000      0.985 0.000 1.000
#> GSM151400     2   0.373      0.913 0.072 0.928
#> GSM151401     2   0.000      0.985 0.000 1.000
#> GSM151402     2   0.000      0.985 0.000 1.000
#> GSM151403     2   0.000      0.985 0.000 1.000
#> GSM151404     1   0.000      0.989 1.000 0.000
#> GSM151405     2   0.000      0.985 0.000 1.000
#> GSM151406     2   0.000      0.985 0.000 1.000
#> GSM151407     2   0.000      0.985 0.000 1.000
#> GSM151408     2   0.000      0.985 0.000 1.000
#> GSM151409     1   0.000      0.989 1.000 0.000
#> GSM151410     2   0.000      0.985 0.000 1.000
#> GSM151411     1   0.000      0.989 1.000 0.000
#> GSM151412     2   0.000      0.985 0.000 1.000
#> GSM151413     1   0.000      0.989 1.000 0.000
#> GSM151414     1   0.000      0.989 1.000 0.000
#> GSM151415     1   0.000      0.989 1.000 0.000
#> GSM151416     1   0.866      0.582 0.712 0.288
#> GSM151417     1   0.000      0.989 1.000 0.000
#> GSM151418     2   0.000      0.985 0.000 1.000
#> GSM151419     1   0.000      0.989 1.000 0.000
#> GSM151420     1   0.000      0.989 1.000 0.000
#> GSM151421     1   0.000      0.989 1.000 0.000
#> GSM151422     1   0.000      0.989 1.000 0.000
#> GSM151423     2   0.000      0.985 0.000 1.000
#> GSM151424     2   0.000      0.985 0.000 1.000
#> GSM151425     2   0.000      0.985 0.000 1.000
#> GSM151426     2   0.000      0.985 0.000 1.000
#> GSM151427     2   0.000      0.985 0.000 1.000
#> GSM151428     1   0.000      0.989 1.000 0.000
#> GSM151429     2   0.625      0.811 0.156 0.844
#> GSM151430     2   0.000      0.985 0.000 1.000
#> GSM151431     2   0.000      0.985 0.000 1.000
#> GSM151432     1   0.000      0.989 1.000 0.000
#> GSM151433     1   0.000      0.989 1.000 0.000
#> GSM151434     1   0.000      0.989 1.000 0.000
#> GSM151435     1   0.000      0.989 1.000 0.000
#> GSM151436     2   0.000      0.985 0.000 1.000
#> GSM151437     1   0.000      0.989 1.000 0.000
#> GSM151438     1   0.000      0.989 1.000 0.000
#> GSM151439     2   0.975      0.310 0.408 0.592
#> GSM151440     2   0.000      0.985 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
#> GSM151369     1  0.1289      0.972 0.968 0.032 0.000
#> GSM151370     2  0.2959      0.917 0.000 0.900 0.100
#> GSM151371     1  0.1289      0.972 0.968 0.032 0.000
#> GSM151372     3  0.4796      0.726 0.000 0.220 0.780
#> GSM151373     3  0.1529      0.944 0.000 0.040 0.960
#> GSM151374     3  0.0237      0.973 0.000 0.004 0.996
#> GSM151375     3  0.0237      0.973 0.000 0.004 0.996
#> GSM151376     3  0.0237      0.973 0.000 0.004 0.996
#> GSM151377     3  0.0237      0.973 0.000 0.004 0.996
#> GSM151378     3  0.0237      0.973 0.000 0.004 0.996
#> GSM151379     3  0.0237      0.973 0.000 0.004 0.996
#> GSM151380     2  0.2165      0.921 0.000 0.936 0.064
#> GSM151381     3  0.0424      0.970 0.000 0.008 0.992
#> GSM151382     3  0.4291      0.789 0.000 0.180 0.820
#> GSM151383     2  0.0892      0.923 0.000 0.980 0.020
#> GSM151384     1  0.1163      0.974 0.972 0.028 0.000
#> GSM151385     1  0.0000      0.976 1.000 0.000 0.000
#> GSM151386     1  0.1163      0.974 0.972 0.028 0.000
#> GSM151387     2  0.2959      0.917 0.000 0.900 0.100
#> GSM151388     2  0.2537      0.923 0.000 0.920 0.080
#> GSM151389     3  0.0237      0.973 0.000 0.004 0.996
#> GSM151390     3  0.0237      0.973 0.000 0.004 0.996
#> GSM151391     2  0.4062      0.862 0.000 0.836 0.164
#> GSM151392     2  0.2261      0.922 0.000 0.932 0.068
#> GSM151393     3  0.0237      0.973 0.000 0.004 0.996
#> GSM151394     1  0.0592      0.976 0.988 0.012 0.000
#> GSM151395     2  0.1289      0.925 0.000 0.968 0.032
#> GSM151396     2  0.2165      0.927 0.000 0.936 0.064
#> GSM151397     1  0.0000      0.976 1.000 0.000 0.000
#> GSM151398     1  0.1289      0.972 0.968 0.032 0.000
#> GSM151399     2  0.2165      0.927 0.000 0.936 0.064
#> GSM151400     2  0.0424      0.914 0.000 0.992 0.008
#> GSM151401     2  0.5733      0.599 0.000 0.676 0.324
#> GSM151402     3  0.0237      0.973 0.000 0.004 0.996
#> GSM151403     3  0.0237      0.973 0.000 0.004 0.996
#> GSM151404     1  0.1289      0.972 0.968 0.032 0.000
#> GSM151405     2  0.2448      0.923 0.000 0.924 0.076
#> GSM151406     2  0.2959      0.917 0.000 0.900 0.100
#> GSM151407     2  0.1289      0.925 0.000 0.968 0.032
#> GSM151408     2  0.1289      0.925 0.000 0.968 0.032
#> GSM151409     1  0.0237      0.976 0.996 0.004 0.000
#> GSM151410     2  0.0592      0.920 0.000 0.988 0.012
#> GSM151411     1  0.1031      0.975 0.976 0.024 0.000
#> GSM151412     2  0.2537      0.922 0.000 0.920 0.080
#> GSM151413     1  0.0000      0.976 1.000 0.000 0.000
#> GSM151414     1  0.0000      0.976 1.000 0.000 0.000
#> GSM151415     1  0.0000      0.976 1.000 0.000 0.000
#> GSM151416     2  0.0000      0.913 0.000 1.000 0.000
#> GSM151417     1  0.3816      0.857 0.852 0.148 0.000
#> GSM151418     3  0.0237      0.973 0.000 0.004 0.996
#> GSM151419     1  0.0000      0.976 1.000 0.000 0.000
#> GSM151420     1  0.0000      0.976 1.000 0.000 0.000
#> GSM151421     2  0.4796      0.681 0.220 0.780 0.000
#> GSM151422     1  0.0592      0.976 0.988 0.012 0.000
#> GSM151423     3  0.0237      0.973 0.000 0.004 0.996
#> GSM151424     2  0.2165      0.927 0.000 0.936 0.064
#> GSM151425     2  0.2066      0.928 0.000 0.940 0.060
#> GSM151426     2  0.2878      0.918 0.000 0.904 0.096
#> GSM151427     3  0.0237      0.973 0.000 0.004 0.996
#> GSM151428     1  0.4346      0.809 0.816 0.184 0.000
#> GSM151429     2  0.0000      0.913 0.000 1.000 0.000
#> GSM151430     2  0.1289      0.925 0.000 0.968 0.032
#> GSM151431     2  0.0892      0.923 0.000 0.980 0.020
#> GSM151432     1  0.1163      0.974 0.972 0.028 0.000
#> GSM151433     1  0.0592      0.976 0.988 0.012 0.000
#> GSM151434     1  0.1163      0.974 0.972 0.028 0.000
#> GSM151435     1  0.0000      0.976 1.000 0.000 0.000
#> GSM151436     2  0.6280      0.203 0.000 0.540 0.460
#> GSM151437     1  0.0000      0.976 1.000 0.000 0.000
#> GSM151438     1  0.0000      0.976 1.000 0.000 0.000
#> GSM151439     2  0.1491      0.917 0.016 0.968 0.016
#> GSM151440     2  0.2066      0.927 0.000 0.940 0.060

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM151369     1  0.4804    0.74330 0.616 0.000 0.000 0.384
#> GSM151370     2  0.5865    0.19107 0.000 0.612 0.048 0.340
#> GSM151371     1  0.4790    0.74127 0.620 0.000 0.000 0.380
#> GSM151372     2  0.6081   -0.17362 0.000 0.484 0.472 0.044
#> GSM151373     3  0.4955    0.50651 0.000 0.344 0.648 0.008
#> GSM151374     3  0.0657    0.86752 0.000 0.004 0.984 0.012
#> GSM151375     3  0.1635    0.86251 0.000 0.044 0.948 0.008
#> GSM151376     3  0.1635    0.86251 0.000 0.044 0.948 0.008
#> GSM151377     3  0.1398    0.86665 0.000 0.004 0.956 0.040
#> GSM151378     3  0.0672    0.86867 0.000 0.008 0.984 0.008
#> GSM151379     3  0.0672    0.86867 0.000 0.008 0.984 0.008
#> GSM151380     4  0.5744    0.08311 0.000 0.436 0.028 0.536
#> GSM151381     3  0.6461    0.60232 0.000 0.144 0.640 0.216
#> GSM151382     3  0.6407    0.27473 0.000 0.384 0.544 0.072
#> GSM151383     2  0.5093    0.33293 0.000 0.640 0.012 0.348
#> GSM151384     1  0.4304    0.79219 0.716 0.000 0.000 0.284
#> GSM151385     1  0.0000    0.78511 1.000 0.000 0.000 0.000
#> GSM151386     1  0.4522    0.78293 0.680 0.000 0.000 0.320
#> GSM151387     2  0.5865    0.19107 0.000 0.612 0.048 0.340
#> GSM151388     2  0.5815    0.01651 0.000 0.540 0.032 0.428
#> GSM151389     3  0.5156    0.68264 0.000 0.044 0.720 0.236
#> GSM151390     3  0.1635    0.86251 0.000 0.044 0.948 0.008
#> GSM151391     4  0.7629   -0.05140 0.000 0.396 0.204 0.400
#> GSM151392     4  0.5693    0.03905 0.000 0.472 0.024 0.504
#> GSM151393     3  0.1211    0.86596 0.000 0.000 0.960 0.040
#> GSM151394     1  0.4454    0.78547 0.692 0.000 0.000 0.308
#> GSM151395     2  0.2125    0.42505 0.000 0.920 0.004 0.076
#> GSM151396     2  0.1256    0.47941 0.000 0.964 0.028 0.008
#> GSM151397     1  0.0336    0.78380 0.992 0.000 0.000 0.008
#> GSM151398     1  0.4790    0.74338 0.620 0.000 0.000 0.380
#> GSM151399     2  0.0927    0.47789 0.000 0.976 0.016 0.008
#> GSM151400     2  0.4746    0.20733 0.000 0.632 0.000 0.368
#> GSM151401     2  0.3306    0.41609 0.000 0.840 0.156 0.004
#> GSM151402     3  0.1211    0.86596 0.000 0.000 0.960 0.040
#> GSM151403     3  0.4323    0.74748 0.000 0.020 0.776 0.204
#> GSM151404     4  0.5482   -0.50981 0.412 0.012 0.004 0.572
#> GSM151405     2  0.5756    0.07035 0.000 0.568 0.032 0.400
#> GSM151406     2  0.5720    0.22786 0.000 0.652 0.052 0.296
#> GSM151407     2  0.5093    0.33551 0.000 0.640 0.012 0.348
#> GSM151408     2  0.5093    0.33293 0.000 0.640 0.012 0.348
#> GSM151409     1  0.3610    0.79664 0.800 0.000 0.000 0.200
#> GSM151410     2  0.5024    0.32131 0.000 0.632 0.008 0.360
#> GSM151411     1  0.4624    0.77063 0.660 0.000 0.000 0.340
#> GSM151412     2  0.2266    0.45980 0.000 0.912 0.084 0.004
#> GSM151413     1  0.0336    0.78380 0.992 0.000 0.000 0.008
#> GSM151414     1  0.0000    0.78511 1.000 0.000 0.000 0.000
#> GSM151415     1  0.0336    0.78380 0.992 0.000 0.000 0.008
#> GSM151416     4  0.4916    0.01005 0.000 0.424 0.000 0.576
#> GSM151417     1  0.6060    0.62407 0.516 0.044 0.000 0.440
#> GSM151418     3  0.1489    0.86657 0.000 0.004 0.952 0.044
#> GSM151419     1  0.0000    0.78511 1.000 0.000 0.000 0.000
#> GSM151420     1  0.0000    0.78511 1.000 0.000 0.000 0.000
#> GSM151421     2  0.6332   -0.07784 0.064 0.532 0.000 0.404
#> GSM151422     1  0.2589    0.79414 0.884 0.000 0.000 0.116
#> GSM151423     3  0.1302    0.86532 0.000 0.000 0.956 0.044
#> GSM151424     2  0.1452    0.47847 0.000 0.956 0.036 0.008
#> GSM151425     2  0.1388    0.47805 0.000 0.960 0.028 0.012
#> GSM151426     2  0.5839    0.17791 0.000 0.604 0.044 0.352
#> GSM151427     3  0.0672    0.86867 0.000 0.008 0.984 0.008
#> GSM151428     1  0.5827    0.63730 0.532 0.032 0.000 0.436
#> GSM151429     4  0.4713    0.08443 0.000 0.360 0.000 0.640
#> GSM151430     2  0.5110    0.32984 0.000 0.636 0.012 0.352
#> GSM151431     2  0.5110    0.32984 0.000 0.636 0.012 0.352
#> GSM151432     1  0.4697    0.75963 0.644 0.000 0.000 0.356
#> GSM151433     1  0.4356    0.78872 0.708 0.000 0.000 0.292
#> GSM151434     1  0.4564    0.77989 0.672 0.000 0.000 0.328
#> GSM151435     1  0.0000    0.78511 1.000 0.000 0.000 0.000
#> GSM151436     2  0.5403    0.22777 0.000 0.628 0.348 0.024
#> GSM151437     1  0.0000    0.78511 1.000 0.000 0.000 0.000
#> GSM151438     1  0.0336    0.78380 0.992 0.000 0.000 0.008
#> GSM151439     2  0.5016   -0.00634 0.000 0.600 0.004 0.396
#> GSM151440     2  0.2131    0.47713 0.000 0.932 0.036 0.032

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>           class entropy silhouette    p1    p2    p3    p4    p5
#> GSM151369     1  0.2899     0.6149 0.872 0.004 0.000 0.028 0.096
#> GSM151370     5  0.3556     0.6000 0.000 0.132 0.032 0.008 0.828
#> GSM151371     1  0.2196     0.6260 0.916 0.004 0.000 0.024 0.056
#> GSM151372     2  0.4378     0.3941 0.000 0.760 0.188 0.040 0.012
#> GSM151373     2  0.4897     0.3137 0.000 0.712 0.228 0.036 0.024
#> GSM151374     3  0.3309     0.8351 0.000 0.128 0.836 0.036 0.000
#> GSM151375     3  0.5143     0.7713 0.000 0.220 0.704 0.044 0.032
#> GSM151376     3  0.5143     0.7713 0.000 0.220 0.704 0.044 0.032
#> GSM151377     3  0.0451     0.8230 0.000 0.000 0.988 0.008 0.004
#> GSM151378     3  0.3445     0.8343 0.000 0.140 0.824 0.036 0.000
#> GSM151379     3  0.3445     0.8343 0.000 0.140 0.824 0.036 0.000
#> GSM151380     5  0.3113     0.5876 0.100 0.000 0.016 0.020 0.864
#> GSM151381     5  0.5886     0.2820 0.000 0.084 0.368 0.008 0.540
#> GSM151382     2  0.6390     0.2916 0.000 0.604 0.216 0.148 0.032
#> GSM151383     2  0.6931     0.2964 0.004 0.364 0.000 0.344 0.288
#> GSM151384     1  0.1653     0.6050 0.944 0.028 0.000 0.024 0.004
#> GSM151385     4  0.4307     0.7359 0.496 0.000 0.000 0.504 0.000
#> GSM151386     1  0.1202     0.6204 0.960 0.032 0.000 0.004 0.004
#> GSM151387     5  0.3556     0.6000 0.000 0.132 0.032 0.008 0.828
#> GSM151388     5  0.2395     0.6138 0.008 0.072 0.016 0.000 0.904
#> GSM151389     5  0.4557     0.0468 0.000 0.008 0.476 0.000 0.516
#> GSM151390     3  0.5143     0.7713 0.000 0.220 0.704 0.044 0.032
#> GSM151391     5  0.4170     0.5361 0.000 0.012 0.272 0.004 0.712
#> GSM151392     5  0.2977     0.6047 0.060 0.008 0.016 0.028 0.888
#> GSM151393     3  0.0000     0.8242 0.000 0.000 1.000 0.000 0.000
#> GSM151394     1  0.1828     0.6010 0.936 0.004 0.000 0.028 0.032
#> GSM151395     2  0.5542     0.4963 0.016 0.644 0.000 0.072 0.268
#> GSM151396     2  0.5092     0.5298 0.000 0.688 0.008 0.068 0.236
#> GSM151397     4  0.4307     0.7309 0.500 0.000 0.000 0.500 0.000
#> GSM151398     1  0.2464     0.6191 0.888 0.000 0.000 0.016 0.096
#> GSM151399     2  0.5092     0.5298 0.000 0.688 0.008 0.068 0.236
#> GSM151400     5  0.7479    -0.1515 0.048 0.240 0.000 0.272 0.440
#> GSM151401     2  0.3812     0.5277 0.000 0.796 0.032 0.004 0.168
#> GSM151402     3  0.0000     0.8242 0.000 0.000 1.000 0.000 0.000
#> GSM151403     3  0.4630     0.1344 0.000 0.008 0.572 0.004 0.416
#> GSM151404     5  0.4738     0.0533 0.464 0.000 0.000 0.016 0.520
#> GSM151405     5  0.2568     0.6137 0.004 0.092 0.016 0.000 0.888
#> GSM151406     5  0.3890     0.5707 0.000 0.168 0.036 0.004 0.792
#> GSM151407     2  0.7041     0.2921 0.000 0.360 0.008 0.336 0.296
#> GSM151408     2  0.7041     0.2936 0.000 0.360 0.008 0.336 0.296
#> GSM151409     1  0.2763     0.3995 0.848 0.004 0.000 0.148 0.000
#> GSM151410     4  0.6942    -0.5954 0.004 0.344 0.000 0.356 0.296
#> GSM151411     1  0.1365     0.6234 0.952 0.004 0.000 0.004 0.040
#> GSM151412     2  0.3264     0.5360 0.000 0.820 0.016 0.000 0.164
#> GSM151413     1  0.4596    -0.7687 0.496 0.004 0.000 0.496 0.004
#> GSM151414     4  0.4307     0.7359 0.496 0.000 0.000 0.504 0.000
#> GSM151415     1  0.4452    -0.7702 0.500 0.004 0.000 0.496 0.000
#> GSM151416     5  0.8155    -0.0459 0.280 0.100 0.000 0.300 0.320
#> GSM151417     1  0.4135     0.5815 0.820 0.044 0.000 0.064 0.072
#> GSM151418     3  0.0451     0.8230 0.000 0.000 0.988 0.008 0.004
#> GSM151419     4  0.4307     0.7359 0.496 0.000 0.000 0.504 0.000
#> GSM151420     4  0.4452     0.7326 0.496 0.004 0.000 0.500 0.000
#> GSM151421     1  0.7111     0.0622 0.492 0.328 0.000 0.072 0.108
#> GSM151422     1  0.4323    -0.3042 0.656 0.012 0.000 0.332 0.000
#> GSM151423     3  0.0566     0.8216 0.000 0.000 0.984 0.012 0.004
#> GSM151424     2  0.4890     0.5365 0.000 0.708 0.008 0.060 0.224
#> GSM151425     2  0.5144     0.5229 0.000 0.680 0.008 0.068 0.244
#> GSM151426     5  0.3332     0.6019 0.000 0.120 0.028 0.008 0.844
#> GSM151427     3  0.3400     0.8352 0.000 0.136 0.828 0.036 0.000
#> GSM151428     1  0.3247     0.5969 0.864 0.012 0.000 0.052 0.072
#> GSM151429     1  0.8178    -0.1791 0.320 0.104 0.000 0.304 0.272
#> GSM151430     2  0.7046     0.2890 0.000 0.356 0.008 0.336 0.300
#> GSM151431     2  0.7080     0.2872 0.004 0.356 0.004 0.336 0.300
#> GSM151432     1  0.0771     0.6310 0.976 0.004 0.000 0.000 0.020
#> GSM151433     1  0.0771     0.6087 0.976 0.004 0.000 0.020 0.000
#> GSM151434     1  0.1202     0.6204 0.960 0.032 0.000 0.004 0.004
#> GSM151435     4  0.4307     0.7359 0.496 0.000 0.000 0.504 0.000
#> GSM151436     2  0.3570     0.5060 0.000 0.844 0.092 0.016 0.048
#> GSM151437     4  0.4452     0.7326 0.496 0.004 0.000 0.500 0.000
#> GSM151438     4  0.4307     0.7359 0.496 0.000 0.000 0.504 0.000
#> GSM151439     2  0.7338     0.0817 0.400 0.404 0.000 0.072 0.124
#> GSM151440     2  0.4261     0.5550 0.000 0.780 0.012 0.048 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
#> GSM151369     6  0.4411      0.788 0.172 0.000 0.000 0.016 0.076 0.736
#> GSM151370     5  0.4669      0.772 0.000 0.140 0.004 0.140 0.712 0.004
#> GSM151371     6  0.3524      0.845 0.228 0.004 0.000 0.004 0.008 0.756
#> GSM151372     2  0.5009      0.537 0.000 0.684 0.224 0.052 0.008 0.032
#> GSM151373     2  0.3955      0.572 0.000 0.744 0.220 0.008 0.008 0.020
#> GSM151374     3  0.2001      0.822 0.000 0.092 0.900 0.004 0.000 0.004
#> GSM151375     3  0.4879      0.702 0.000 0.212 0.700 0.008 0.044 0.036
#> GSM151376     3  0.4879      0.702 0.000 0.212 0.700 0.008 0.044 0.036
#> GSM151377     3  0.2866      0.803 0.000 0.000 0.860 0.004 0.084 0.052
#> GSM151378     3  0.2356      0.821 0.000 0.100 0.884 0.004 0.008 0.004
#> GSM151379     3  0.2356      0.821 0.000 0.100 0.884 0.004 0.008 0.004
#> GSM151380     5  0.4469      0.710 0.000 0.012 0.000 0.128 0.736 0.124
#> GSM151381     5  0.4155      0.694 0.000 0.084 0.152 0.000 0.756 0.008
#> GSM151382     2  0.6717      0.257 0.000 0.452 0.244 0.264 0.008 0.032
#> GSM151383     4  0.2361      0.829 0.000 0.104 0.000 0.880 0.012 0.004
#> GSM151384     6  0.5546      0.805 0.256 0.012 0.000 0.032 0.072 0.628
#> GSM151385     1  0.0000      0.942 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM151386     6  0.5483      0.814 0.244 0.012 0.000 0.032 0.072 0.640
#> GSM151387     5  0.4669      0.773 0.000 0.140 0.004 0.140 0.712 0.004
#> GSM151388     5  0.4464      0.773 0.000 0.116 0.000 0.136 0.736 0.012
#> GSM151389     5  0.3869      0.614 0.000 0.004 0.240 0.020 0.732 0.004
#> GSM151390     3  0.4879      0.702 0.000 0.212 0.700 0.008 0.044 0.036
#> GSM151391     5  0.4883      0.735 0.000 0.044 0.080 0.088 0.756 0.032
#> GSM151392     5  0.4858      0.726 0.000 0.048 0.000 0.136 0.724 0.092
#> GSM151393     3  0.2750      0.803 0.000 0.000 0.868 0.004 0.080 0.048
#> GSM151394     6  0.3575      0.830 0.284 0.000 0.000 0.000 0.008 0.708
#> GSM151395     2  0.3671      0.706 0.000 0.820 0.000 0.088 0.056 0.036
#> GSM151396     2  0.3026      0.734 0.000 0.864 0.004 0.076 0.036 0.020
#> GSM151397     1  0.0508      0.938 0.984 0.000 0.000 0.000 0.004 0.012
#> GSM151398     6  0.4312      0.802 0.204 0.000 0.000 0.008 0.064 0.724
#> GSM151399     2  0.3163      0.730 0.000 0.856 0.004 0.076 0.044 0.020
#> GSM151400     4  0.7210      0.406 0.000 0.168 0.004 0.464 0.216 0.148
#> GSM151401     2  0.1426      0.737 0.000 0.948 0.028 0.008 0.016 0.000
#> GSM151402     3  0.2685      0.803 0.000 0.000 0.872 0.004 0.080 0.044
#> GSM151403     5  0.3833      0.389 0.000 0.000 0.344 0.000 0.648 0.008
#> GSM151404     5  0.4452      0.287 0.016 0.000 0.000 0.008 0.548 0.428
#> GSM151405     5  0.4464      0.775 0.000 0.116 0.000 0.136 0.736 0.012
#> GSM151406     5  0.4605      0.765 0.000 0.164 0.004 0.112 0.716 0.004
#> GSM151407     4  0.2263      0.834 0.000 0.100 0.000 0.884 0.016 0.000
#> GSM151408     4  0.2263      0.834 0.000 0.100 0.000 0.884 0.016 0.000
#> GSM151409     6  0.3828      0.598 0.440 0.000 0.000 0.000 0.000 0.560
#> GSM151410     4  0.2587      0.829 0.000 0.108 0.000 0.868 0.020 0.004
#> GSM151411     6  0.3398      0.844 0.252 0.000 0.000 0.000 0.008 0.740
#> GSM151412     2  0.1364      0.742 0.000 0.952 0.012 0.020 0.016 0.000
#> GSM151413     1  0.1086      0.928 0.964 0.000 0.000 0.012 0.012 0.012
#> GSM151414     1  0.0291      0.939 0.992 0.000 0.000 0.004 0.004 0.000
#> GSM151415     1  0.0935      0.925 0.964 0.000 0.000 0.000 0.004 0.032
#> GSM151416     4  0.4607      0.644 0.000 0.024 0.000 0.676 0.036 0.264
#> GSM151417     6  0.5821      0.779 0.168 0.020 0.000 0.068 0.084 0.660
#> GSM151418     3  0.3220      0.791 0.000 0.004 0.840 0.004 0.096 0.056
#> GSM151419     1  0.0146      0.942 0.996 0.000 0.000 0.000 0.004 0.000
#> GSM151420     1  0.0000      0.942 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM151421     6  0.5996      0.524 0.012 0.196 0.000 0.076 0.088 0.628
#> GSM151422     1  0.4443      0.242 0.656 0.000 0.000 0.008 0.036 0.300
#> GSM151423     3  0.2928      0.799 0.000 0.000 0.856 0.004 0.084 0.056
#> GSM151424     2  0.3026      0.734 0.000 0.864 0.004 0.076 0.036 0.020
#> GSM151425     2  0.3163      0.730 0.000 0.856 0.004 0.076 0.044 0.020
#> GSM151426     5  0.4705      0.771 0.000 0.144 0.004 0.140 0.708 0.004
#> GSM151427     3  0.2356      0.821 0.000 0.100 0.884 0.004 0.008 0.004
#> GSM151428     6  0.4028      0.836 0.204 0.008 0.000 0.020 0.016 0.752
#> GSM151429     4  0.4792      0.593 0.000 0.044 0.000 0.644 0.020 0.292
#> GSM151430     4  0.2263      0.834 0.000 0.100 0.000 0.884 0.016 0.000
#> GSM151431     4  0.2263      0.834 0.000 0.100 0.000 0.884 0.016 0.000
#> GSM151432     6  0.3314      0.844 0.256 0.000 0.000 0.000 0.004 0.740
#> GSM151433     6  0.3266      0.838 0.272 0.000 0.000 0.000 0.000 0.728
#> GSM151434     6  0.5483      0.814 0.244 0.012 0.000 0.032 0.072 0.640
#> GSM151435     1  0.0000      0.942 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM151436     2  0.3615      0.682 0.000 0.824 0.108 0.036 0.008 0.024
#> GSM151437     1  0.0000      0.942 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM151438     1  0.0508      0.938 0.984 0.000 0.000 0.000 0.004 0.012
#> GSM151439     2  0.6233      0.086 0.000 0.456 0.000 0.076 0.076 0.392
#> GSM151440     2  0.3488      0.723 0.000 0.832 0.008 0.104 0.020 0.036

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

consensus_heatmap(res, k = 2)

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

consensus_heatmap(res, k = 3)

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

consensus_heatmap(res, k = 4)

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

consensus_heatmap(res, k = 5)

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

consensus_heatmap(res, k = 6)

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

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

membership_heatmap(res, k = 2)

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

membership_heatmap(res, k = 3)

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

membership_heatmap(res, k = 4)

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

membership_heatmap(res, k = 5)

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

membership_heatmap(res, k = 6)

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

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

Signature heatmaps where rows are scaled:

get_signatures(res, k = 2)

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

get_signatures(res, k = 3)

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

get_signatures(res, k = 4)

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

get_signatures(res, k = 5)

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

get_signatures(res, k = 6)

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

Signature heatmaps where rows are not scaled:

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

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

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

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

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

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

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

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

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

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

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk SD-kmeans-signature_compare

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

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

An example of the output of tb is:

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

The columns in tb are:

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

UMAP plot which shows how samples are separated.

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

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

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

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

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

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

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

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

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

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

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk SD-kmeans-collect-classes

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

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

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

collect_plots(res)

plot of chunk SD-skmeans-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 1.000           0.950       0.980         0.4980 0.499   0.499
#> 3 3 0.773           0.863       0.914         0.3212 0.773   0.570
#> 4 4 0.817           0.823       0.880         0.0953 0.933   0.801
#> 5 5 0.890           0.887       0.924         0.0661 0.929   0.757
#> 6 6 0.802           0.798       0.863         0.0398 1.000   1.000

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

suggest_best_k(res)
#> [1] 2

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

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

show/hide code output

cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#>           class entropy silhouette    p1    p2
#> GSM151369     1   0.000      0.962 1.000 0.000
#> GSM151370     2   0.000      0.993 0.000 1.000
#> GSM151371     1   0.000      0.962 1.000 0.000
#> GSM151372     2   0.000      0.993 0.000 1.000
#> GSM151373     2   0.000      0.993 0.000 1.000
#> GSM151374     2   0.000      0.993 0.000 1.000
#> GSM151375     2   0.000      0.993 0.000 1.000
#> GSM151376     2   0.000      0.993 0.000 1.000
#> GSM151377     2   0.000      0.993 0.000 1.000
#> GSM151378     2   0.000      0.993 0.000 1.000
#> GSM151379     2   0.000      0.993 0.000 1.000
#> GSM151380     1   0.985      0.257 0.572 0.428
#> GSM151381     2   0.000      0.993 0.000 1.000
#> GSM151382     2   0.000      0.993 0.000 1.000
#> GSM151383     2   0.000      0.993 0.000 1.000
#> GSM151384     1   0.000      0.962 1.000 0.000
#> GSM151385     1   0.000      0.962 1.000 0.000
#> GSM151386     1   0.000      0.962 1.000 0.000
#> GSM151387     2   0.000      0.993 0.000 1.000
#> GSM151388     2   0.000      0.993 0.000 1.000
#> GSM151389     2   0.000      0.993 0.000 1.000
#> GSM151390     2   0.000      0.993 0.000 1.000
#> GSM151391     2   0.000      0.993 0.000 1.000
#> GSM151392     2   0.827      0.630 0.260 0.740
#> GSM151393     2   0.000      0.993 0.000 1.000
#> GSM151394     1   0.000      0.962 1.000 0.000
#> GSM151395     1   0.949      0.440 0.632 0.368
#> GSM151396     2   0.000      0.993 0.000 1.000
#> GSM151397     1   0.000      0.962 1.000 0.000
#> GSM151398     1   0.000      0.962 1.000 0.000
#> GSM151399     2   0.000      0.993 0.000 1.000
#> GSM151400     1   0.936      0.476 0.648 0.352
#> GSM151401     2   0.000      0.993 0.000 1.000
#> GSM151402     2   0.000      0.993 0.000 1.000
#> GSM151403     2   0.000      0.993 0.000 1.000
#> GSM151404     1   0.000      0.962 1.000 0.000
#> GSM151405     2   0.000      0.993 0.000 1.000
#> GSM151406     2   0.000      0.993 0.000 1.000
#> GSM151407     2   0.000      0.993 0.000 1.000
#> GSM151408     2   0.000      0.993 0.000 1.000
#> GSM151409     1   0.000      0.962 1.000 0.000
#> GSM151410     2   0.000      0.993 0.000 1.000
#> GSM151411     1   0.000      0.962 1.000 0.000
#> GSM151412     2   0.000      0.993 0.000 1.000
#> GSM151413     1   0.000      0.962 1.000 0.000
#> GSM151414     1   0.000      0.962 1.000 0.000
#> GSM151415     1   0.000      0.962 1.000 0.000
#> GSM151416     1   0.000      0.962 1.000 0.000
#> GSM151417     1   0.000      0.962 1.000 0.000
#> GSM151418     2   0.000      0.993 0.000 1.000
#> GSM151419     1   0.000      0.962 1.000 0.000
#> GSM151420     1   0.000      0.962 1.000 0.000
#> GSM151421     1   0.000      0.962 1.000 0.000
#> GSM151422     1   0.000      0.962 1.000 0.000
#> GSM151423     2   0.000      0.993 0.000 1.000
#> GSM151424     2   0.000      0.993 0.000 1.000
#> GSM151425     2   0.000      0.993 0.000 1.000
#> GSM151426     2   0.000      0.993 0.000 1.000
#> GSM151427     2   0.000      0.993 0.000 1.000
#> GSM151428     1   0.000      0.962 1.000 0.000
#> GSM151429     1   0.000      0.962 1.000 0.000
#> GSM151430     2   0.000      0.993 0.000 1.000
#> GSM151431     2   0.000      0.993 0.000 1.000
#> GSM151432     1   0.000      0.962 1.000 0.000
#> GSM151433     1   0.000      0.962 1.000 0.000
#> GSM151434     1   0.000      0.962 1.000 0.000
#> GSM151435     1   0.000      0.962 1.000 0.000
#> GSM151436     2   0.000      0.993 0.000 1.000
#> GSM151437     1   0.000      0.962 1.000 0.000
#> GSM151438     1   0.000      0.962 1.000 0.000
#> GSM151439     1   0.000      0.962 1.000 0.000
#> GSM151440     2   0.000      0.993 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
#> GSM151369     1  0.0000      0.977 1.000 0.000 0.000
#> GSM151370     3  0.2878      0.885 0.000 0.096 0.904
#> GSM151371     1  0.0000      0.977 1.000 0.000 0.000
#> GSM151372     2  0.5058      0.766 0.000 0.756 0.244
#> GSM151373     2  0.6008      0.686 0.000 0.628 0.372
#> GSM151374     3  0.0000      0.937 0.000 0.000 1.000
#> GSM151375     3  0.0000      0.937 0.000 0.000 1.000
#> GSM151376     3  0.0000      0.937 0.000 0.000 1.000
#> GSM151377     3  0.0000      0.937 0.000 0.000 1.000
#> GSM151378     3  0.0000      0.937 0.000 0.000 1.000
#> GSM151379     3  0.0000      0.937 0.000 0.000 1.000
#> GSM151380     3  0.6808      0.685 0.084 0.184 0.732
#> GSM151381     3  0.0000      0.937 0.000 0.000 1.000
#> GSM151382     2  0.4931      0.768 0.000 0.768 0.232
#> GSM151383     2  0.0000      0.745 0.000 1.000 0.000
#> GSM151384     1  0.0000      0.977 1.000 0.000 0.000
#> GSM151385     1  0.0000      0.977 1.000 0.000 0.000
#> GSM151386     1  0.0000      0.977 1.000 0.000 0.000
#> GSM151387     3  0.2878      0.884 0.000 0.096 0.904
#> GSM151388     3  0.4291      0.797 0.000 0.180 0.820
#> GSM151389     3  0.0000      0.937 0.000 0.000 1.000
#> GSM151390     3  0.0000      0.937 0.000 0.000 1.000
#> GSM151391     3  0.2878      0.880 0.000 0.096 0.904
#> GSM151392     3  0.3183      0.888 0.016 0.076 0.908
#> GSM151393     3  0.0000      0.937 0.000 0.000 1.000
#> GSM151394     1  0.0000      0.977 1.000 0.000 0.000
#> GSM151395     2  0.7828      0.701 0.160 0.672 0.168
#> GSM151396     2  0.5968      0.695 0.000 0.636 0.364
#> GSM151397     1  0.0000      0.977 1.000 0.000 0.000
#> GSM151398     1  0.0000      0.977 1.000 0.000 0.000
#> GSM151399     2  0.5621      0.740 0.000 0.692 0.308
#> GSM151400     2  0.5465      0.463 0.288 0.712 0.000
#> GSM151401     2  0.6111      0.652 0.000 0.604 0.396
#> GSM151402     3  0.0000      0.937 0.000 0.000 1.000
#> GSM151403     3  0.0000      0.937 0.000 0.000 1.000
#> GSM151404     1  0.0000      0.977 1.000 0.000 0.000
#> GSM151405     3  0.3551      0.853 0.000 0.132 0.868
#> GSM151406     3  0.0237      0.936 0.000 0.004 0.996
#> GSM151407     2  0.0000      0.745 0.000 1.000 0.000
#> GSM151408     2  0.0000      0.745 0.000 1.000 0.000
#> GSM151409     1  0.0000      0.977 1.000 0.000 0.000
#> GSM151410     2  0.0000      0.745 0.000 1.000 0.000
#> GSM151411     1  0.0000      0.977 1.000 0.000 0.000
#> GSM151412     2  0.6008      0.686 0.000 0.628 0.372
#> GSM151413     1  0.0000      0.977 1.000 0.000 0.000
#> GSM151414     1  0.0000      0.977 1.000 0.000 0.000
#> GSM151415     1  0.0000      0.977 1.000 0.000 0.000
#> GSM151416     1  0.6026      0.477 0.624 0.376 0.000
#> GSM151417     1  0.0000      0.977 1.000 0.000 0.000
#> GSM151418     3  0.0000      0.937 0.000 0.000 1.000
#> GSM151419     1  0.0000      0.977 1.000 0.000 0.000
#> GSM151420     1  0.0000      0.977 1.000 0.000 0.000
#> GSM151421     1  0.0000      0.977 1.000 0.000 0.000
#> GSM151422     1  0.0000      0.977 1.000 0.000 0.000
#> GSM151423     3  0.0000      0.937 0.000 0.000 1.000
#> GSM151424     2  0.5733      0.730 0.000 0.676 0.324
#> GSM151425     2  0.6079      0.664 0.000 0.612 0.388
#> GSM151426     3  0.4178      0.811 0.000 0.172 0.828
#> GSM151427     3  0.0000      0.937 0.000 0.000 1.000
#> GSM151428     1  0.0000      0.977 1.000 0.000 0.000
#> GSM151429     2  0.5785      0.371 0.332 0.668 0.000
#> GSM151430     2  0.0000      0.745 0.000 1.000 0.000
#> GSM151431     2  0.0000      0.745 0.000 1.000 0.000
#> GSM151432     1  0.0000      0.977 1.000 0.000 0.000
#> GSM151433     1  0.0000      0.977 1.000 0.000 0.000
#> GSM151434     1  0.0000      0.977 1.000 0.000 0.000
#> GSM151435     1  0.0000      0.977 1.000 0.000 0.000
#> GSM151436     2  0.5291      0.759 0.000 0.732 0.268
#> GSM151437     1  0.0000      0.977 1.000 0.000 0.000
#> GSM151438     1  0.0000      0.977 1.000 0.000 0.000
#> GSM151439     1  0.4931      0.664 0.768 0.232 0.000
#> GSM151440     2  0.4931      0.768 0.000 0.768 0.232

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM151369     1  0.0336      0.981 0.992 0.008 0.000 0.000
#> GSM151370     3  0.6074      0.681 0.000 0.340 0.600 0.060
#> GSM151371     1  0.0188      0.985 0.996 0.004 0.000 0.000
#> GSM151372     2  0.7249      0.667 0.000 0.444 0.412 0.144
#> GSM151373     2  0.5495      0.827 0.000 0.624 0.348 0.028
#> GSM151374     3  0.0188      0.762 0.000 0.004 0.996 0.000
#> GSM151375     3  0.1118      0.730 0.000 0.036 0.964 0.000
#> GSM151376     3  0.1211      0.726 0.000 0.040 0.960 0.000
#> GSM151377     3  0.0000      0.764 0.000 0.000 1.000 0.000
#> GSM151378     3  0.0188      0.762 0.000 0.004 0.996 0.000
#> GSM151379     3  0.0188      0.762 0.000 0.004 0.996 0.000
#> GSM151380     3  0.6640      0.660 0.004 0.348 0.564 0.084
#> GSM151381     3  0.0895      0.766 0.000 0.020 0.976 0.004
#> GSM151382     4  0.7103     -0.136 0.000 0.128 0.404 0.468
#> GSM151383     4  0.0336      0.878 0.000 0.000 0.008 0.992
#> GSM151384     1  0.0000      0.986 1.000 0.000 0.000 0.000
#> GSM151385     1  0.0000      0.986 1.000 0.000 0.000 0.000
#> GSM151386     1  0.0000      0.986 1.000 0.000 0.000 0.000
#> GSM151387     3  0.6187      0.679 0.000 0.336 0.596 0.068
#> GSM151388     3  0.6586      0.646 0.000 0.368 0.544 0.088
#> GSM151389     3  0.4391      0.730 0.000 0.252 0.740 0.008
#> GSM151390     3  0.1302      0.720 0.000 0.044 0.956 0.000
#> GSM151391     3  0.3900      0.751 0.000 0.164 0.816 0.020
#> GSM151392     3  0.5821      0.682 0.000 0.368 0.592 0.040
#> GSM151393     3  0.0000      0.764 0.000 0.000 1.000 0.000
#> GSM151394     1  0.0188      0.985 0.996 0.004 0.000 0.000
#> GSM151395     2  0.6016      0.605 0.072 0.744 0.056 0.128
#> GSM151396     2  0.5672      0.845 0.000 0.668 0.276 0.056
#> GSM151397     1  0.0000      0.986 1.000 0.000 0.000 0.000
#> GSM151398     1  0.0336      0.981 0.992 0.008 0.000 0.000
#> GSM151399     2  0.5889      0.772 0.000 0.696 0.188 0.116
#> GSM151400     4  0.5160      0.690 0.136 0.104 0.000 0.760
#> GSM151401     2  0.5423      0.836 0.000 0.640 0.332 0.028
#> GSM151402     3  0.0000      0.764 0.000 0.000 1.000 0.000
#> GSM151403     3  0.3636      0.751 0.000 0.172 0.820 0.008
#> GSM151404     1  0.3933      0.747 0.792 0.200 0.000 0.008
#> GSM151405     3  0.6648      0.641 0.000 0.372 0.536 0.092
#> GSM151406     3  0.5167      0.699 0.000 0.340 0.644 0.016
#> GSM151407     4  0.0336      0.878 0.000 0.000 0.008 0.992
#> GSM151408     4  0.0336      0.878 0.000 0.000 0.008 0.992
#> GSM151409     1  0.0188      0.985 0.996 0.004 0.000 0.000
#> GSM151410     4  0.0336      0.873 0.000 0.008 0.000 0.992
#> GSM151411     1  0.0188      0.985 0.996 0.004 0.000 0.000
#> GSM151412     2  0.5592      0.847 0.000 0.656 0.300 0.044
#> GSM151413     1  0.0000      0.986 1.000 0.000 0.000 0.000
#> GSM151414     1  0.0000      0.986 1.000 0.000 0.000 0.000
#> GSM151415     1  0.0000      0.986 1.000 0.000 0.000 0.000
#> GSM151416     4  0.1854      0.846 0.048 0.012 0.000 0.940
#> GSM151417     1  0.0000      0.986 1.000 0.000 0.000 0.000
#> GSM151418     3  0.0188      0.764 0.000 0.004 0.996 0.000
#> GSM151419     1  0.0000      0.986 1.000 0.000 0.000 0.000
#> GSM151420     1  0.0000      0.986 1.000 0.000 0.000 0.000
#> GSM151421     1  0.1867      0.915 0.928 0.072 0.000 0.000
#> GSM151422     1  0.0000      0.986 1.000 0.000 0.000 0.000
#> GSM151423     3  0.0000      0.764 0.000 0.000 1.000 0.000
#> GSM151424     2  0.5767      0.846 0.000 0.660 0.280 0.060
#> GSM151425     2  0.5498      0.842 0.000 0.680 0.272 0.048
#> GSM151426     3  0.6830      0.628 0.000 0.368 0.524 0.108
#> GSM151427     3  0.0000      0.764 0.000 0.000 1.000 0.000
#> GSM151428     1  0.0188      0.985 0.996 0.004 0.000 0.000
#> GSM151429     4  0.2198      0.827 0.072 0.008 0.000 0.920
#> GSM151430     4  0.0336      0.878 0.000 0.000 0.008 0.992
#> GSM151431     4  0.0336      0.878 0.000 0.000 0.008 0.992
#> GSM151432     1  0.0188      0.985 0.996 0.004 0.000 0.000
#> GSM151433     1  0.0188      0.985 0.996 0.004 0.000 0.000
#> GSM151434     1  0.0000      0.986 1.000 0.000 0.000 0.000
#> GSM151435     1  0.0000      0.986 1.000 0.000 0.000 0.000
#> GSM151436     2  0.5713      0.832 0.000 0.620 0.340 0.040
#> GSM151437     1  0.0000      0.986 1.000 0.000 0.000 0.000
#> GSM151438     1  0.0000      0.986 1.000 0.000 0.000 0.000
#> GSM151439     2  0.4936      0.358 0.372 0.624 0.000 0.004
#> GSM151440     2  0.6488      0.820 0.000 0.604 0.292 0.104

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>           class entropy silhouette    p1    p2    p3    p4    p5
#> GSM151369     1  0.1430      0.935 0.944 0.000 0.000 0.004 0.052
#> GSM151370     5  0.3124      0.931 0.000 0.008 0.144 0.008 0.840
#> GSM151371     1  0.0451      0.960 0.988 0.004 0.000 0.000 0.008
#> GSM151372     3  0.6026      0.313 0.000 0.320 0.572 0.092 0.016
#> GSM151373     2  0.3575      0.838 0.000 0.800 0.180 0.004 0.016
#> GSM151374     3  0.0404      0.901 0.000 0.012 0.988 0.000 0.000
#> GSM151375     3  0.1568      0.890 0.000 0.036 0.944 0.000 0.020
#> GSM151376     3  0.1568      0.890 0.000 0.036 0.944 0.000 0.020
#> GSM151377     3  0.0290      0.901 0.000 0.000 0.992 0.000 0.008
#> GSM151378     3  0.0898      0.900 0.000 0.020 0.972 0.000 0.008
#> GSM151379     3  0.0898      0.900 0.000 0.020 0.972 0.000 0.008
#> GSM151380     5  0.2492      0.923 0.020 0.000 0.072 0.008 0.900
#> GSM151381     3  0.1851      0.854 0.000 0.000 0.912 0.000 0.088
#> GSM151382     3  0.5418      0.625 0.000 0.092 0.684 0.208 0.016
#> GSM151383     4  0.0162      0.940 0.000 0.004 0.000 0.996 0.000
#> GSM151384     1  0.1356      0.943 0.956 0.012 0.000 0.004 0.028
#> GSM151385     1  0.0000      0.960 1.000 0.000 0.000 0.000 0.000
#> GSM151386     1  0.0932      0.952 0.972 0.004 0.000 0.004 0.020
#> GSM151387     5  0.3342      0.935 0.000 0.020 0.136 0.008 0.836
#> GSM151388     5  0.2589      0.943 0.000 0.012 0.092 0.008 0.888
#> GSM151389     3  0.3196      0.721 0.000 0.004 0.804 0.000 0.192
#> GSM151390     3  0.1469      0.891 0.000 0.036 0.948 0.000 0.016
#> GSM151391     3  0.3446      0.784 0.000 0.008 0.840 0.036 0.116
#> GSM151392     5  0.2331      0.927 0.000 0.020 0.080 0.000 0.900
#> GSM151393     3  0.0404      0.899 0.000 0.000 0.988 0.000 0.012
#> GSM151394     1  0.0451      0.960 0.988 0.004 0.000 0.000 0.008
#> GSM151395     2  0.1883      0.861 0.012 0.932 0.000 0.008 0.048
#> GSM151396     2  0.1281      0.884 0.000 0.956 0.012 0.000 0.032
#> GSM151397     1  0.0324      0.960 0.992 0.000 0.000 0.004 0.004
#> GSM151398     1  0.1121      0.936 0.956 0.000 0.000 0.000 0.044
#> GSM151399     2  0.2277      0.891 0.000 0.920 0.028 0.028 0.024
#> GSM151400     4  0.6961      0.527 0.160 0.156 0.000 0.588 0.096
#> GSM151401     2  0.3484      0.859 0.000 0.820 0.152 0.004 0.024
#> GSM151402     3  0.0162      0.900 0.000 0.000 0.996 0.000 0.004
#> GSM151403     3  0.1608      0.863 0.000 0.000 0.928 0.000 0.072
#> GSM151404     1  0.4375      0.307 0.576 0.000 0.004 0.000 0.420
#> GSM151405     5  0.1857      0.928 0.000 0.004 0.060 0.008 0.928
#> GSM151406     5  0.3132      0.905 0.000 0.008 0.172 0.000 0.820
#> GSM151407     4  0.0162      0.940 0.000 0.004 0.000 0.996 0.000
#> GSM151408     4  0.0162      0.940 0.000 0.004 0.000 0.996 0.000
#> GSM151409     1  0.0451      0.960 0.988 0.004 0.000 0.000 0.008
#> GSM151410     4  0.0162      0.940 0.000 0.004 0.000 0.996 0.000
#> GSM151411     1  0.0451      0.960 0.988 0.004 0.000 0.000 0.008
#> GSM151412     2  0.2492      0.895 0.000 0.900 0.072 0.008 0.020
#> GSM151413     1  0.0162      0.960 0.996 0.000 0.000 0.000 0.004
#> GSM151414     1  0.0000      0.960 1.000 0.000 0.000 0.000 0.000
#> GSM151415     1  0.0324      0.960 0.992 0.000 0.000 0.004 0.004
#> GSM151416     4  0.1216      0.916 0.020 0.000 0.000 0.960 0.020
#> GSM151417     1  0.0798      0.954 0.976 0.008 0.000 0.000 0.016
#> GSM151418     3  0.0703      0.897 0.000 0.000 0.976 0.000 0.024
#> GSM151419     1  0.0000      0.960 1.000 0.000 0.000 0.000 0.000
#> GSM151420     1  0.0162      0.960 0.996 0.004 0.000 0.000 0.000
#> GSM151421     1  0.4585      0.687 0.728 0.216 0.000 0.004 0.052
#> GSM151422     1  0.0451      0.959 0.988 0.000 0.000 0.004 0.008
#> GSM151423     3  0.0290      0.900 0.000 0.000 0.992 0.000 0.008
#> GSM151424     2  0.2173      0.898 0.000 0.920 0.052 0.012 0.016
#> GSM151425     2  0.2032      0.884 0.000 0.924 0.020 0.004 0.052
#> GSM151426     5  0.2844      0.941 0.000 0.020 0.088 0.012 0.880
#> GSM151427     3  0.0807      0.901 0.000 0.012 0.976 0.000 0.012
#> GSM151428     1  0.0451      0.960 0.988 0.004 0.000 0.000 0.008
#> GSM151429     4  0.1393      0.919 0.012 0.024 0.000 0.956 0.008
#> GSM151430     4  0.0162      0.940 0.000 0.004 0.000 0.996 0.000
#> GSM151431     4  0.0162      0.940 0.000 0.004 0.000 0.996 0.000
#> GSM151432     1  0.0613      0.959 0.984 0.004 0.000 0.004 0.008
#> GSM151433     1  0.0451      0.960 0.988 0.004 0.000 0.000 0.008
#> GSM151434     1  0.1267      0.948 0.960 0.012 0.000 0.004 0.024
#> GSM151435     1  0.0000      0.960 1.000 0.000 0.000 0.000 0.000
#> GSM151436     2  0.3817      0.851 0.000 0.808 0.152 0.024 0.016
#> GSM151437     1  0.0162      0.960 0.996 0.004 0.000 0.000 0.000
#> GSM151438     1  0.0162      0.960 0.996 0.000 0.000 0.000 0.004
#> GSM151439     2  0.2804      0.820 0.056 0.888 0.000 0.008 0.048
#> GSM151440     2  0.4194      0.849 0.000 0.800 0.120 0.064 0.016

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>           class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM151369     1  0.4499     0.6275 0.652 0.000 0.000 0.000 0.060 0.288
#> GSM151370     5  0.2174     0.8952 0.000 0.008 0.088 0.000 0.896 0.008
#> GSM151371     1  0.2595     0.8531 0.836 0.004 0.000 0.000 0.000 0.160
#> GSM151372     3  0.7105     0.0512 0.000 0.288 0.412 0.096 0.000 0.204
#> GSM151373     2  0.3985     0.7678 0.000 0.768 0.140 0.004 0.000 0.088
#> GSM151374     3  0.1524     0.8405 0.000 0.008 0.932 0.000 0.000 0.060
#> GSM151375     3  0.3838     0.7886 0.000 0.040 0.784 0.000 0.020 0.156
#> GSM151376     3  0.3838     0.7886 0.000 0.040 0.784 0.000 0.020 0.156
#> GSM151377     3  0.0291     0.8400 0.000 0.000 0.992 0.000 0.004 0.004
#> GSM151378     3  0.2011     0.8367 0.000 0.020 0.912 0.000 0.004 0.064
#> GSM151379     3  0.1769     0.8395 0.000 0.012 0.924 0.000 0.004 0.060
#> GSM151380     5  0.3210     0.8238 0.000 0.000 0.028 0.000 0.804 0.168
#> GSM151381     3  0.2587     0.7813 0.000 0.004 0.868 0.000 0.108 0.020
#> GSM151382     3  0.7310     0.2227 0.000 0.160 0.420 0.236 0.000 0.184
#> GSM151383     4  0.0363     0.9090 0.000 0.000 0.000 0.988 0.000 0.012
#> GSM151384     1  0.2442     0.8414 0.852 0.004 0.000 0.000 0.000 0.144
#> GSM151385     1  0.0146     0.8931 0.996 0.000 0.000 0.000 0.000 0.004
#> GSM151386     1  0.2218     0.8586 0.884 0.012 0.000 0.000 0.000 0.104
#> GSM151387     5  0.2922     0.8891 0.000 0.016 0.092 0.004 0.864 0.024
#> GSM151388     5  0.2334     0.8919 0.000 0.008 0.044 0.004 0.904 0.040
#> GSM151389     3  0.3176     0.7196 0.000 0.000 0.812 0.000 0.156 0.032
#> GSM151390     3  0.3764     0.7925 0.000 0.040 0.792 0.000 0.020 0.148
#> GSM151391     3  0.4377     0.6816 0.000 0.008 0.772 0.028 0.116 0.076
#> GSM151392     5  0.4389     0.7337 0.000 0.008 0.048 0.000 0.692 0.252
#> GSM151393     3  0.0363     0.8386 0.000 0.000 0.988 0.000 0.000 0.012
#> GSM151394     1  0.1910     0.8754 0.892 0.000 0.000 0.000 0.000 0.108
#> GSM151395     2  0.2825     0.7598 0.008 0.844 0.000 0.000 0.012 0.136
#> GSM151396     2  0.1265     0.8207 0.000 0.948 0.008 0.000 0.000 0.044
#> GSM151397     1  0.0363     0.8926 0.988 0.000 0.000 0.000 0.000 0.012
#> GSM151398     1  0.3626     0.7850 0.788 0.000 0.000 0.000 0.068 0.144
#> GSM151399     2  0.0810     0.8254 0.000 0.976 0.004 0.008 0.004 0.008
#> GSM151400     4  0.8144     0.3613 0.132 0.152 0.004 0.440 0.084 0.188
#> GSM151401     2  0.3279     0.8033 0.000 0.828 0.108 0.004 0.000 0.060
#> GSM151402     3  0.0146     0.8391 0.000 0.000 0.996 0.000 0.000 0.004
#> GSM151403     3  0.1713     0.8182 0.000 0.000 0.928 0.000 0.044 0.028
#> GSM151404     1  0.6103     0.1303 0.432 0.000 0.004 0.000 0.320 0.244
#> GSM151405     5  0.1434     0.8817 0.000 0.008 0.020 0.000 0.948 0.024
#> GSM151406     5  0.2699     0.8806 0.000 0.020 0.108 0.000 0.864 0.008
#> GSM151407     4  0.0000     0.9134 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM151408     4  0.0000     0.9134 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM151409     1  0.1501     0.8830 0.924 0.000 0.000 0.000 0.000 0.076
#> GSM151410     4  0.0146     0.9126 0.000 0.000 0.000 0.996 0.000 0.004
#> GSM151411     1  0.1714     0.8826 0.908 0.000 0.000 0.000 0.000 0.092
#> GSM151412     2  0.1865     0.8287 0.000 0.920 0.040 0.000 0.000 0.040
#> GSM151413     1  0.0458     0.8924 0.984 0.000 0.000 0.000 0.000 0.016
#> GSM151414     1  0.0146     0.8931 0.996 0.000 0.000 0.000 0.000 0.004
#> GSM151415     1  0.0458     0.8928 0.984 0.000 0.000 0.000 0.000 0.016
#> GSM151416     4  0.1932     0.8780 0.004 0.004 0.000 0.912 0.004 0.076
#> GSM151417     1  0.1908     0.8718 0.900 0.000 0.000 0.000 0.004 0.096
#> GSM151418     3  0.0993     0.8340 0.000 0.000 0.964 0.000 0.012 0.024
#> GSM151419     1  0.0146     0.8931 0.996 0.000 0.000 0.000 0.000 0.004
#> GSM151420     1  0.0547     0.8925 0.980 0.000 0.000 0.000 0.000 0.020
#> GSM151421     1  0.5212     0.4676 0.532 0.100 0.000 0.000 0.000 0.368
#> GSM151422     1  0.0632     0.8934 0.976 0.000 0.000 0.000 0.000 0.024
#> GSM151423     3  0.0603     0.8377 0.000 0.000 0.980 0.000 0.004 0.016
#> GSM151424     2  0.1699     0.8299 0.000 0.936 0.016 0.016 0.000 0.032
#> GSM151425     2  0.2063     0.8093 0.000 0.912 0.008 0.000 0.020 0.060
#> GSM151426     5  0.2978     0.8911 0.000 0.028 0.068 0.012 0.872 0.020
#> GSM151427     3  0.1606     0.8406 0.000 0.008 0.932 0.000 0.004 0.056
#> GSM151428     1  0.3187     0.8284 0.796 0.004 0.000 0.012 0.000 0.188
#> GSM151429     4  0.2473     0.8437 0.000 0.008 0.000 0.856 0.000 0.136
#> GSM151430     4  0.0000     0.9134 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM151431     4  0.0000     0.9134 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM151432     1  0.1814     0.8796 0.900 0.000 0.000 0.000 0.000 0.100
#> GSM151433     1  0.1814     0.8782 0.900 0.000 0.000 0.000 0.000 0.100
#> GSM151434     1  0.3046     0.8184 0.800 0.012 0.000 0.000 0.000 0.188
#> GSM151435     1  0.0260     0.8928 0.992 0.000 0.000 0.000 0.000 0.008
#> GSM151436     2  0.5102     0.7469 0.000 0.680 0.108 0.028 0.000 0.184
#> GSM151437     1  0.0547     0.8925 0.980 0.000 0.000 0.000 0.000 0.020
#> GSM151438     1  0.0458     0.8924 0.984 0.000 0.000 0.000 0.000 0.016
#> GSM151439     2  0.5379     0.5632 0.068 0.524 0.000 0.012 0.004 0.392
#> GSM151440     2  0.5511     0.7344 0.000 0.656 0.088 0.068 0.000 0.188

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) k
#> SD:skmeans 69            0.186 2
#> SD:skmeans 69            0.123 3
#> SD:skmeans 70            0.142 4
#> SD:skmeans 70            0.116 5
#> SD:skmeans 67            0.242 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 17730 rows and 72 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 5.
#> 
#> Following methods can be applied to this 'ConsensusPartition' object:
#>  [1] "cola_report"             "collect_classes"         "collect_plots"          
#>  [4] "collect_stats"           "colnames"                "compare_signatures"     
#>  [7] "consensus_heatmap"       "dimension_reduction"     "functional_enrichment"  
#> [10] "get_anno_col"            "get_anno"                "get_classes"            
#> [13] "get_consensus"           "get_matrix"              "get_membership"         
#> [16] "get_param"               "get_signatures"          "get_stats"              
#> [19] "is_best_k"               "is_stable_k"             "membership_heatmap"     
#> [22] "ncol"                    "nrow"                    "plot_ecdf"              
#> [25] "rownames"                "select_partition_number" "show"                   
#> [28] "suggest_best_k"          "test_to_known_factors"

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

collect_plots(res)

plot of chunk SD-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.885           0.914       0.967         0.4412 0.549   0.549
#> 3 3 0.728           0.835       0.926         0.4967 0.708   0.502
#> 4 4 0.764           0.695       0.828         0.1017 0.880   0.667
#> 5 5 0.891           0.844       0.938         0.0704 0.929   0.744
#> 6 6 0.808           0.741       0.848         0.0478 0.948   0.768

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
#> GSM151369     1   0.767     0.7122 0.776 0.224
#> GSM151370     2   0.000     0.9809 0.000 1.000
#> GSM151371     1   0.998     0.1540 0.524 0.476
#> GSM151372     2   0.000     0.9809 0.000 1.000
#> GSM151373     2   0.000     0.9809 0.000 1.000
#> GSM151374     2   0.000     0.9809 0.000 1.000
#> GSM151375     2   0.000     0.9809 0.000 1.000
#> GSM151376     2   0.000     0.9809 0.000 1.000
#> GSM151377     2   0.000     0.9809 0.000 1.000
#> GSM151378     2   0.000     0.9809 0.000 1.000
#> GSM151379     2   0.000     0.9809 0.000 1.000
#> GSM151380     2   0.634     0.7862 0.160 0.840
#> GSM151381     2   0.000     0.9809 0.000 1.000
#> GSM151382     2   0.000     0.9809 0.000 1.000
#> GSM151383     2   0.000     0.9809 0.000 1.000
#> GSM151384     1   0.000     0.9284 1.000 0.000
#> GSM151385     1   0.000     0.9284 1.000 0.000
#> GSM151386     1   0.000     0.9284 1.000 0.000
#> GSM151387     2   0.000     0.9809 0.000 1.000
#> GSM151388     2   0.000     0.9809 0.000 1.000
#> GSM151389     2   0.000     0.9809 0.000 1.000
#> GSM151390     2   0.000     0.9809 0.000 1.000
#> GSM151391     2   0.000     0.9809 0.000 1.000
#> GSM151392     2   0.000     0.9809 0.000 1.000
#> GSM151393     2   0.000     0.9809 0.000 1.000
#> GSM151394     1   0.000     0.9284 1.000 0.000
#> GSM151395     2   0.000     0.9809 0.000 1.000
#> GSM151396     2   0.000     0.9809 0.000 1.000
#> GSM151397     1   0.000     0.9284 1.000 0.000
#> GSM151398     1   0.000     0.9284 1.000 0.000
#> GSM151399     2   0.000     0.9809 0.000 1.000
#> GSM151400     2   0.000     0.9809 0.000 1.000
#> GSM151401     2   0.000     0.9809 0.000 1.000
#> GSM151402     2   0.000     0.9809 0.000 1.000
#> GSM151403     2   0.000     0.9809 0.000 1.000
#> GSM151404     1   0.541     0.8272 0.876 0.124
#> GSM151405     2   0.000     0.9809 0.000 1.000
#> GSM151406     2   0.000     0.9809 0.000 1.000
#> GSM151407     2   0.000     0.9809 0.000 1.000
#> GSM151408     2   0.000     0.9809 0.000 1.000
#> GSM151409     1   0.000     0.9284 1.000 0.000
#> GSM151410     2   0.000     0.9809 0.000 1.000
#> GSM151411     1   0.000     0.9284 1.000 0.000
#> GSM151412     2   0.000     0.9809 0.000 1.000
#> GSM151413     1   0.000     0.9284 1.000 0.000
#> GSM151414     1   0.000     0.9284 1.000 0.000
#> GSM151415     1   0.000     0.9284 1.000 0.000
#> GSM151416     2   0.995     0.0361 0.460 0.540
#> GSM151417     2   0.706     0.7361 0.192 0.808
#> GSM151418     2   0.000     0.9809 0.000 1.000
#> GSM151419     1   0.000     0.9284 1.000 0.000
#> GSM151420     1   0.000     0.9284 1.000 0.000
#> GSM151421     2   0.000     0.9809 0.000 1.000
#> GSM151422     1   0.000     0.9284 1.000 0.000
#> GSM151423     2   0.000     0.9809 0.000 1.000
#> GSM151424     2   0.000     0.9809 0.000 1.000
#> GSM151425     2   0.000     0.9809 0.000 1.000
#> GSM151426     2   0.000     0.9809 0.000 1.000
#> GSM151427     2   0.000     0.9809 0.000 1.000
#> GSM151428     1   1.000     0.0827 0.504 0.496
#> GSM151429     2   0.000     0.9809 0.000 1.000
#> GSM151430     2   0.000     0.9809 0.000 1.000
#> GSM151431     2   0.000     0.9809 0.000 1.000
#> GSM151432     1   0.000     0.9284 1.000 0.000
#> GSM151433     1   0.000     0.9284 1.000 0.000
#> GSM151434     1   0.821     0.6646 0.744 0.256
#> GSM151435     1   0.000     0.9284 1.000 0.000
#> GSM151436     2   0.000     0.9809 0.000 1.000
#> GSM151437     1   0.000     0.9284 1.000 0.000
#> GSM151438     1   0.000     0.9284 1.000 0.000
#> GSM151439     2   0.000     0.9809 0.000 1.000
#> GSM151440     2   0.000     0.9809 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
#> GSM151369     3  0.6154     0.2008 0.408 0.000 0.592
#> GSM151370     2  0.3267     0.7980 0.000 0.884 0.116
#> GSM151371     2  0.6267     0.2479 0.452 0.548 0.000
#> GSM151372     2  0.0000     0.9132 0.000 1.000 0.000
#> GSM151373     2  0.0000     0.9132 0.000 1.000 0.000
#> GSM151374     3  0.0000     0.8502 0.000 0.000 1.000
#> GSM151375     3  0.6308    -0.0035 0.000 0.492 0.508
#> GSM151376     3  0.4504     0.7221 0.000 0.196 0.804
#> GSM151377     3  0.0000     0.8502 0.000 0.000 1.000
#> GSM151378     3  0.1860     0.8412 0.000 0.052 0.948
#> GSM151379     3  0.2625     0.8264 0.000 0.084 0.916
#> GSM151380     3  0.3619     0.8292 0.000 0.136 0.864
#> GSM151381     3  0.3619     0.8292 0.000 0.136 0.864
#> GSM151382     2  0.0000     0.9132 0.000 1.000 0.000
#> GSM151383     2  0.0000     0.9132 0.000 1.000 0.000
#> GSM151384     1  0.0000     0.9824 1.000 0.000 0.000
#> GSM151385     1  0.0000     0.9824 1.000 0.000 0.000
#> GSM151386     1  0.0000     0.9824 1.000 0.000 0.000
#> GSM151387     3  0.3619     0.8292 0.000 0.136 0.864
#> GSM151388     3  0.3619     0.8292 0.000 0.136 0.864
#> GSM151389     3  0.0000     0.8502 0.000 0.000 1.000
#> GSM151390     2  0.4654     0.7009 0.000 0.792 0.208
#> GSM151391     3  0.3619     0.8292 0.000 0.136 0.864
#> GSM151392     2  0.5465     0.5782 0.000 0.712 0.288
#> GSM151393     3  0.0000     0.8502 0.000 0.000 1.000
#> GSM151394     1  0.0000     0.9824 1.000 0.000 0.000
#> GSM151395     2  0.0000     0.9132 0.000 1.000 0.000
#> GSM151396     2  0.0000     0.9132 0.000 1.000 0.000
#> GSM151397     1  0.0000     0.9824 1.000 0.000 0.000
#> GSM151398     1  0.0000     0.9824 1.000 0.000 0.000
#> GSM151399     2  0.0000     0.9132 0.000 1.000 0.000
#> GSM151400     2  0.0000     0.9132 0.000 1.000 0.000
#> GSM151401     2  0.0000     0.9132 0.000 1.000 0.000
#> GSM151402     3  0.0000     0.8502 0.000 0.000 1.000
#> GSM151403     3  0.0000     0.8502 0.000 0.000 1.000
#> GSM151404     3  0.4458     0.8303 0.056 0.080 0.864
#> GSM151405     3  0.6302     0.2183 0.000 0.480 0.520
#> GSM151406     3  0.3619     0.8292 0.000 0.136 0.864
#> GSM151407     2  0.0000     0.9132 0.000 1.000 0.000
#> GSM151408     2  0.0000     0.9132 0.000 1.000 0.000
#> GSM151409     1  0.0000     0.9824 1.000 0.000 0.000
#> GSM151410     2  0.0000     0.9132 0.000 1.000 0.000
#> GSM151411     1  0.0000     0.9824 1.000 0.000 0.000
#> GSM151412     2  0.0000     0.9132 0.000 1.000 0.000
#> GSM151413     1  0.0000     0.9824 1.000 0.000 0.000
#> GSM151414     1  0.0000     0.9824 1.000 0.000 0.000
#> GSM151415     1  0.0000     0.9824 1.000 0.000 0.000
#> GSM151416     2  0.6126     0.3877 0.400 0.600 0.000
#> GSM151417     2  0.4452     0.7362 0.192 0.808 0.000
#> GSM151418     3  0.0237     0.8509 0.000 0.004 0.996
#> GSM151419     1  0.0000     0.9824 1.000 0.000 0.000
#> GSM151420     1  0.0000     0.9824 1.000 0.000 0.000
#> GSM151421     2  0.0000     0.9132 0.000 1.000 0.000
#> GSM151422     1  0.0000     0.9824 1.000 0.000 0.000
#> GSM151423     3  0.1529     0.8519 0.000 0.040 0.960
#> GSM151424     2  0.0000     0.9132 0.000 1.000 0.000
#> GSM151425     2  0.0000     0.9132 0.000 1.000 0.000
#> GSM151426     3  0.5178     0.7084 0.000 0.256 0.744
#> GSM151427     3  0.0000     0.8502 0.000 0.000 1.000
#> GSM151428     2  0.6154     0.3684 0.408 0.592 0.000
#> GSM151429     2  0.0000     0.9132 0.000 1.000 0.000
#> GSM151430     2  0.0000     0.9132 0.000 1.000 0.000
#> GSM151431     2  0.0000     0.9132 0.000 1.000 0.000
#> GSM151432     1  0.0000     0.9824 1.000 0.000 0.000
#> GSM151433     1  0.0000     0.9824 1.000 0.000 0.000
#> GSM151434     1  0.5397     0.5556 0.720 0.280 0.000
#> GSM151435     1  0.0000     0.9824 1.000 0.000 0.000
#> GSM151436     2  0.0000     0.9132 0.000 1.000 0.000
#> GSM151437     1  0.0000     0.9824 1.000 0.000 0.000
#> GSM151438     1  0.0000     0.9824 1.000 0.000 0.000
#> GSM151439     2  0.0000     0.9132 0.000 1.000 0.000
#> GSM151440     2  0.0000     0.9132 0.000 1.000 0.000

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM151369     3  0.4877    -0.1182 0.408 0.000 0.592 0.000
#> GSM151370     2  0.2918     0.5597 0.000 0.876 0.116 0.008
#> GSM151371     2  0.4967     0.0816 0.452 0.548 0.000 0.000
#> GSM151372     2  0.0000     0.7389 0.000 1.000 0.000 0.000
#> GSM151373     2  0.0000     0.7389 0.000 1.000 0.000 0.000
#> GSM151374     3  0.0000     0.5929 0.000 0.000 1.000 0.000
#> GSM151375     3  0.3123     0.4376 0.000 0.156 0.844 0.000
#> GSM151376     3  0.0592     0.5820 0.000 0.016 0.984 0.000
#> GSM151377     3  0.4989     0.7612 0.000 0.000 0.528 0.472
#> GSM151378     3  0.0000     0.5929 0.000 0.000 1.000 0.000
#> GSM151379     3  0.0188     0.5905 0.000 0.004 0.996 0.000
#> GSM151380     3  0.4989     0.7612 0.000 0.000 0.528 0.472
#> GSM151381     3  0.4989     0.7612 0.000 0.000 0.528 0.472
#> GSM151382     2  0.4134     0.1454 0.000 0.740 0.000 0.260
#> GSM151383     4  0.4989     0.8396 0.000 0.472 0.000 0.528
#> GSM151384     1  0.0000     0.9821 1.000 0.000 0.000 0.000
#> GSM151385     1  0.0000     0.9821 1.000 0.000 0.000 0.000
#> GSM151386     1  0.0000     0.9821 1.000 0.000 0.000 0.000
#> GSM151387     3  0.4989     0.7612 0.000 0.000 0.528 0.472
#> GSM151388     3  0.4989     0.7612 0.000 0.000 0.528 0.472
#> GSM151389     3  0.4989     0.7612 0.000 0.000 0.528 0.472
#> GSM151390     3  0.4972    -0.1087 0.000 0.456 0.544 0.000
#> GSM151391     3  0.4989     0.7612 0.000 0.000 0.528 0.472
#> GSM151392     3  0.4776     0.0760 0.000 0.376 0.624 0.000
#> GSM151393     3  0.4989     0.7612 0.000 0.000 0.528 0.472
#> GSM151394     1  0.0000     0.9821 1.000 0.000 0.000 0.000
#> GSM151395     2  0.0000     0.7389 0.000 1.000 0.000 0.000
#> GSM151396     2  0.0000     0.7389 0.000 1.000 0.000 0.000
#> GSM151397     1  0.0000     0.9821 1.000 0.000 0.000 0.000
#> GSM151398     1  0.0000     0.9821 1.000 0.000 0.000 0.000
#> GSM151399     2  0.0000     0.7389 0.000 1.000 0.000 0.000
#> GSM151400     2  0.4661    -0.3036 0.000 0.652 0.000 0.348
#> GSM151401     2  0.0000     0.7389 0.000 1.000 0.000 0.000
#> GSM151402     3  0.0592     0.5996 0.000 0.000 0.984 0.016
#> GSM151403     3  0.4989     0.7612 0.000 0.000 0.528 0.472
#> GSM151404     3  0.4989     0.7612 0.000 0.000 0.528 0.472
#> GSM151405     2  0.6149    -0.1032 0.000 0.480 0.472 0.048
#> GSM151406     3  0.4989     0.7612 0.000 0.000 0.528 0.472
#> GSM151407     4  0.4989     0.8396 0.000 0.472 0.000 0.528
#> GSM151408     4  0.4989     0.8396 0.000 0.472 0.000 0.528
#> GSM151409     1  0.0000     0.9821 1.000 0.000 0.000 0.000
#> GSM151410     4  0.4989     0.8396 0.000 0.472 0.000 0.528
#> GSM151411     1  0.0000     0.9821 1.000 0.000 0.000 0.000
#> GSM151412     2  0.0000     0.7389 0.000 1.000 0.000 0.000
#> GSM151413     1  0.0000     0.9821 1.000 0.000 0.000 0.000
#> GSM151414     1  0.0000     0.9821 1.000 0.000 0.000 0.000
#> GSM151415     1  0.0000     0.9821 1.000 0.000 0.000 0.000
#> GSM151416     4  0.4989     0.8396 0.000 0.472 0.000 0.528
#> GSM151417     2  0.3528     0.4524 0.192 0.808 0.000 0.000
#> GSM151418     3  0.4989     0.7612 0.000 0.000 0.528 0.472
#> GSM151419     1  0.0000     0.9821 1.000 0.000 0.000 0.000
#> GSM151420     1  0.0000     0.9821 1.000 0.000 0.000 0.000
#> GSM151421     2  0.0000     0.7389 0.000 1.000 0.000 0.000
#> GSM151422     1  0.0000     0.9821 1.000 0.000 0.000 0.000
#> GSM151423     3  0.4989     0.7612 0.000 0.000 0.528 0.472
#> GSM151424     2  0.0000     0.7389 0.000 1.000 0.000 0.000
#> GSM151425     2  0.0000     0.7389 0.000 1.000 0.000 0.000
#> GSM151426     4  0.6977     0.0491 0.000 0.204 0.212 0.584
#> GSM151427     3  0.4989     0.7612 0.000 0.000 0.528 0.472
#> GSM151428     2  0.4877     0.1227 0.408 0.592 0.000 0.000
#> GSM151429     2  0.3311     0.4512 0.000 0.828 0.000 0.172
#> GSM151430     4  0.4989     0.8396 0.000 0.472 0.000 0.528
#> GSM151431     4  0.4989     0.8396 0.000 0.472 0.000 0.528
#> GSM151432     1  0.0000     0.9821 1.000 0.000 0.000 0.000
#> GSM151433     1  0.0000     0.9821 1.000 0.000 0.000 0.000
#> GSM151434     1  0.4277     0.5264 0.720 0.280 0.000 0.000
#> GSM151435     1  0.0000     0.9821 1.000 0.000 0.000 0.000
#> GSM151436     2  0.0000     0.7389 0.000 1.000 0.000 0.000
#> GSM151437     1  0.0000     0.9821 1.000 0.000 0.000 0.000
#> GSM151438     1  0.0000     0.9821 1.000 0.000 0.000 0.000
#> GSM151439     2  0.0000     0.7389 0.000 1.000 0.000 0.000
#> GSM151440     2  0.0000     0.7389 0.000 1.000 0.000 0.000

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>           class entropy silhouette    p1    p2    p3    p4    p5
#> GSM151369     3  0.4201    0.27656 0.408 0.000 0.592 0.000 0.000
#> GSM151370     2  0.2796    0.78327 0.000 0.868 0.008 0.008 0.116
#> GSM151371     2  0.4425    0.24933 0.452 0.544 0.004 0.000 0.000
#> GSM151372     2  0.0000    0.87439 0.000 1.000 0.000 0.000 0.000
#> GSM151373     2  0.0609    0.86398 0.000 0.980 0.020 0.000 0.000
#> GSM151374     3  0.1544    0.82487 0.000 0.000 0.932 0.000 0.068
#> GSM151375     3  0.0912    0.85806 0.000 0.012 0.972 0.000 0.016
#> GSM151376     3  0.0992    0.85699 0.000 0.008 0.968 0.000 0.024
#> GSM151377     5  0.0290    0.91298 0.000 0.000 0.008 0.000 0.992
#> GSM151378     3  0.0162    0.85657 0.000 0.000 0.996 0.000 0.004
#> GSM151379     3  0.0162    0.85657 0.000 0.000 0.996 0.000 0.004
#> GSM151380     5  0.0000    0.91447 0.000 0.000 0.000 0.000 1.000
#> GSM151381     5  0.0000    0.91447 0.000 0.000 0.000 0.000 1.000
#> GSM151382     2  0.3636    0.63385 0.000 0.728 0.000 0.272 0.000
#> GSM151383     4  0.0000    0.97025 0.000 0.000 0.000 1.000 0.000
#> GSM151384     1  0.0162    0.97891 0.996 0.000 0.004 0.000 0.000
#> GSM151385     1  0.0000    0.97950 1.000 0.000 0.000 0.000 0.000
#> GSM151386     1  0.0162    0.97891 0.996 0.000 0.004 0.000 0.000
#> GSM151387     5  0.0000    0.91447 0.000 0.000 0.000 0.000 1.000
#> GSM151388     5  0.0000    0.91447 0.000 0.000 0.000 0.000 1.000
#> GSM151389     5  0.0000    0.91447 0.000 0.000 0.000 0.000 1.000
#> GSM151390     3  0.0880    0.84917 0.000 0.032 0.968 0.000 0.000
#> GSM151391     5  0.0162    0.91415 0.000 0.000 0.004 0.000 0.996
#> GSM151392     3  0.0992    0.85233 0.000 0.024 0.968 0.000 0.008
#> GSM151393     5  0.0794    0.90042 0.000 0.000 0.028 0.000 0.972
#> GSM151394     1  0.0000    0.97950 1.000 0.000 0.000 0.000 0.000
#> GSM151395     2  0.0000    0.87439 0.000 1.000 0.000 0.000 0.000
#> GSM151396     2  0.0000    0.87439 0.000 1.000 0.000 0.000 0.000
#> GSM151397     1  0.0000    0.97950 1.000 0.000 0.000 0.000 0.000
#> GSM151398     1  0.0162    0.97891 0.996 0.000 0.004 0.000 0.000
#> GSM151399     2  0.0000    0.87439 0.000 1.000 0.000 0.000 0.000
#> GSM151400     2  0.4276    0.42961 0.000 0.616 0.000 0.380 0.004
#> GSM151401     2  0.0000    0.87439 0.000 1.000 0.000 0.000 0.000
#> GSM151402     3  0.3730    0.56291 0.000 0.000 0.712 0.000 0.288
#> GSM151403     5  0.0162    0.91415 0.000 0.000 0.004 0.000 0.996
#> GSM151404     5  0.0162    0.91261 0.004 0.000 0.000 0.000 0.996
#> GSM151405     5  0.4302   -0.00348 0.000 0.480 0.000 0.000 0.520
#> GSM151406     5  0.0000    0.91447 0.000 0.000 0.000 0.000 1.000
#> GSM151407     4  0.0000    0.97025 0.000 0.000 0.000 1.000 0.000
#> GSM151408     4  0.0000    0.97025 0.000 0.000 0.000 1.000 0.000
#> GSM151409     1  0.0162    0.97891 0.996 0.000 0.004 0.000 0.000
#> GSM151410     4  0.0000    0.97025 0.000 0.000 0.000 1.000 0.000
#> GSM151411     1  0.0162    0.97891 0.996 0.000 0.004 0.000 0.000
#> GSM151412     2  0.0000    0.87439 0.000 1.000 0.000 0.000 0.000
#> GSM151413     1  0.0000    0.97950 1.000 0.000 0.000 0.000 0.000
#> GSM151414     1  0.0000    0.97950 1.000 0.000 0.000 0.000 0.000
#> GSM151415     1  0.0000    0.97950 1.000 0.000 0.000 0.000 0.000
#> GSM151416     4  0.2488    0.81700 0.000 0.124 0.004 0.872 0.000
#> GSM151417     2  0.3317    0.71603 0.188 0.804 0.004 0.000 0.004
#> GSM151418     5  0.0290    0.91298 0.000 0.000 0.008 0.000 0.992
#> GSM151419     1  0.0000    0.97950 1.000 0.000 0.000 0.000 0.000
#> GSM151420     1  0.0000    0.97950 1.000 0.000 0.000 0.000 0.000
#> GSM151421     2  0.0000    0.87439 0.000 1.000 0.000 0.000 0.000
#> GSM151422     1  0.0162    0.97891 0.996 0.000 0.004 0.000 0.000
#> GSM151423     5  0.0290    0.91298 0.000 0.000 0.008 0.000 0.992
#> GSM151424     2  0.0000    0.87439 0.000 1.000 0.000 0.000 0.000
#> GSM151425     2  0.0290    0.87071 0.000 0.992 0.000 0.000 0.008
#> GSM151426     5  0.6464    0.11472 0.000 0.200 0.000 0.324 0.476
#> GSM151427     5  0.0703    0.90174 0.000 0.000 0.024 0.000 0.976
#> GSM151428     2  0.4350    0.36744 0.408 0.588 0.004 0.000 0.000
#> GSM151429     2  0.2852    0.75257 0.000 0.828 0.000 0.172 0.000
#> GSM151430     4  0.0000    0.97025 0.000 0.000 0.000 1.000 0.000
#> GSM151431     4  0.0000    0.97025 0.000 0.000 0.000 1.000 0.000
#> GSM151432     1  0.0162    0.97891 0.996 0.000 0.004 0.000 0.000
#> GSM151433     1  0.0162    0.97891 0.996 0.000 0.004 0.000 0.000
#> GSM151434     1  0.3814    0.55195 0.720 0.276 0.004 0.000 0.000
#> GSM151435     1  0.0000    0.97950 1.000 0.000 0.000 0.000 0.000
#> GSM151436     2  0.0000    0.87439 0.000 1.000 0.000 0.000 0.000
#> GSM151437     1  0.0000    0.97950 1.000 0.000 0.000 0.000 0.000
#> GSM151438     1  0.0000    0.97950 1.000 0.000 0.000 0.000 0.000
#> GSM151439     2  0.0000    0.87439 0.000 1.000 0.000 0.000 0.000
#> GSM151440     2  0.0000    0.87439 0.000 1.000 0.000 0.000 0.000

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>           class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM151369     3  0.5600     0.2349 0.172 0.000 0.524 0.000 0.000 0.304
#> GSM151370     2  0.2793     0.7966 0.000 0.856 0.028 0.004 0.112 0.000
#> GSM151371     6  0.4977     0.7146 0.188 0.164 0.000 0.000 0.000 0.648
#> GSM151372     2  0.0000     0.8871 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM151373     2  0.2416     0.7809 0.000 0.844 0.156 0.000 0.000 0.000
#> GSM151374     3  0.1075     0.7790 0.000 0.000 0.952 0.000 0.048 0.000
#> GSM151375     3  0.3023     0.8145 0.000 0.004 0.784 0.000 0.000 0.212
#> GSM151376     3  0.3023     0.8145 0.000 0.004 0.784 0.000 0.000 0.212
#> GSM151377     5  0.0790     0.8771 0.000 0.000 0.032 0.000 0.968 0.000
#> GSM151378     3  0.0000     0.7991 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM151379     3  0.0000     0.7991 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM151380     5  0.0000     0.8807 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM151381     5  0.0000     0.8807 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM151382     2  0.3266     0.6390 0.000 0.728 0.000 0.272 0.000 0.000
#> GSM151383     4  0.0000     0.9129 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM151384     6  0.3797     0.7196 0.420 0.000 0.000 0.000 0.000 0.580
#> GSM151385     1  0.0000     0.8572 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM151386     1  0.3864    -0.5138 0.520 0.000 0.000 0.000 0.000 0.480
#> GSM151387     5  0.0458     0.8775 0.000 0.000 0.016 0.000 0.984 0.000
#> GSM151388     5  0.0000     0.8807 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM151389     5  0.0146     0.8805 0.000 0.000 0.000 0.000 0.996 0.004
#> GSM151390     3  0.3023     0.8145 0.000 0.004 0.784 0.000 0.000 0.212
#> GSM151391     5  0.0632     0.8788 0.000 0.000 0.024 0.000 0.976 0.000
#> GSM151392     3  0.3023     0.8137 0.000 0.000 0.784 0.000 0.004 0.212
#> GSM151393     5  0.2823     0.7486 0.000 0.000 0.204 0.000 0.796 0.000
#> GSM151394     1  0.0260     0.8512 0.992 0.000 0.000 0.000 0.000 0.008
#> GSM151395     2  0.0000     0.8871 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM151396     2  0.0000     0.8871 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM151397     1  0.0632     0.8336 0.976 0.000 0.000 0.000 0.000 0.024
#> GSM151398     6  0.3774     0.7474 0.408 0.000 0.000 0.000 0.000 0.592
#> GSM151399     2  0.0000     0.8871 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM151400     2  0.5991     0.0850 0.000 0.440 0.000 0.376 0.008 0.176
#> GSM151401     2  0.0000     0.8871 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM151402     3  0.2697     0.6468 0.000 0.000 0.812 0.000 0.188 0.000
#> GSM151403     5  0.0777     0.8758 0.000 0.000 0.004 0.000 0.972 0.024
#> GSM151404     5  0.1480     0.8438 0.020 0.000 0.000 0.000 0.940 0.040
#> GSM151405     5  0.3864    -0.0138 0.000 0.480 0.000 0.000 0.520 0.000
#> GSM151406     5  0.0000     0.8807 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM151407     4  0.0000     0.9129 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM151408     4  0.0000     0.9129 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM151409     1  0.3351     0.2998 0.712 0.000 0.000 0.000 0.000 0.288
#> GSM151410     4  0.0000     0.9129 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM151411     6  0.3684     0.7931 0.372 0.000 0.000 0.000 0.000 0.628
#> GSM151412     2  0.0000     0.8871 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM151413     1  0.0146     0.8549 0.996 0.000 0.000 0.000 0.000 0.004
#> GSM151414     1  0.0000     0.8572 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM151415     1  0.0000     0.8572 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM151416     4  0.5264     0.2608 0.000 0.104 0.000 0.520 0.000 0.376
#> GSM151417     2  0.5033     0.2777 0.064 0.572 0.000 0.000 0.008 0.356
#> GSM151418     5  0.0790     0.8771 0.000 0.000 0.032 0.000 0.968 0.000
#> GSM151419     1  0.0000     0.8572 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM151420     1  0.0000     0.8572 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM151421     2  0.0458     0.8806 0.000 0.984 0.000 0.000 0.000 0.016
#> GSM151422     1  0.3695    -0.1416 0.624 0.000 0.000 0.000 0.000 0.376
#> GSM151423     5  0.0790     0.8771 0.000 0.000 0.032 0.000 0.968 0.000
#> GSM151424     2  0.0000     0.8871 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM151425     2  0.0713     0.8742 0.000 0.972 0.000 0.000 0.028 0.000
#> GSM151426     5  0.6232     0.1866 0.000 0.184 0.024 0.312 0.480 0.000
#> GSM151427     5  0.2730     0.7468 0.000 0.000 0.192 0.000 0.808 0.000
#> GSM151428     6  0.4977     0.7146 0.188 0.164 0.000 0.000 0.000 0.648
#> GSM151429     2  0.4229     0.6533 0.000 0.712 0.000 0.068 0.000 0.220
#> GSM151430     4  0.0000     0.9129 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM151431     4  0.0000     0.9129 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM151432     6  0.3620     0.7983 0.352 0.000 0.000 0.000 0.000 0.648
#> GSM151433     6  0.3684     0.7931 0.372 0.000 0.000 0.000 0.000 0.628
#> GSM151434     6  0.4793     0.7693 0.252 0.100 0.000 0.000 0.000 0.648
#> GSM151435     1  0.0000     0.8572 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM151436     2  0.0000     0.8871 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM151437     1  0.0000     0.8572 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM151438     1  0.0000     0.8572 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM151439     2  0.0000     0.8871 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM151440     2  0.0000     0.8871 0.000 1.000 0.000 0.000 0.000 0.000

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

consensus_heatmap(res, k = 2)

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

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

collect_plots(res)

plot of chunk SD-mclust-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.761           0.850       0.937         0.4947 0.493   0.493
#> 3 3 0.730           0.828       0.909         0.3247 0.725   0.499
#> 4 4 0.890           0.883       0.947         0.0837 0.929   0.793
#> 5 5 0.809           0.789       0.886         0.0594 0.955   0.846
#> 6 6 0.764           0.710       0.833         0.0718 0.900   0.638

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
#> GSM151369     2  0.0000      0.894 0.000 1.000
#> GSM151370     2  0.0000      0.894 0.000 1.000
#> GSM151371     1  0.0672      0.962 0.992 0.008
#> GSM151372     1  0.0376      0.962 0.996 0.004
#> GSM151373     1  0.0376      0.962 0.996 0.004
#> GSM151374     2  0.0000      0.894 0.000 1.000
#> GSM151375     2  0.0000      0.894 0.000 1.000
#> GSM151376     2  0.0000      0.894 0.000 1.000
#> GSM151377     2  0.0000      0.894 0.000 1.000
#> GSM151378     2  0.0000      0.894 0.000 1.000
#> GSM151379     2  0.0000      0.894 0.000 1.000
#> GSM151380     2  0.0000      0.894 0.000 1.000
#> GSM151381     2  0.0000      0.894 0.000 1.000
#> GSM151382     1  0.6343      0.782 0.840 0.160
#> GSM151383     2  0.9732      0.407 0.404 0.596
#> GSM151384     1  0.0672      0.962 0.992 0.008
#> GSM151385     1  0.0376      0.962 0.996 0.004
#> GSM151386     1  0.0672      0.962 0.992 0.008
#> GSM151387     2  0.0000      0.894 0.000 1.000
#> GSM151388     2  0.0000      0.894 0.000 1.000
#> GSM151389     2  0.0000      0.894 0.000 1.000
#> GSM151390     2  0.0000      0.894 0.000 1.000
#> GSM151391     2  0.0000      0.894 0.000 1.000
#> GSM151392     2  0.0000      0.894 0.000 1.000
#> GSM151393     2  0.0000      0.894 0.000 1.000
#> GSM151394     2  0.9983      0.170 0.476 0.524
#> GSM151395     1  0.0376      0.962 0.996 0.004
#> GSM151396     1  0.0376      0.962 0.996 0.004
#> GSM151397     1  0.0376      0.962 0.996 0.004
#> GSM151398     2  0.0000      0.894 0.000 1.000
#> GSM151399     1  0.0376      0.962 0.996 0.004
#> GSM151400     1  0.9580      0.316 0.620 0.380
#> GSM151401     1  0.8763      0.520 0.704 0.296
#> GSM151402     2  0.0000      0.894 0.000 1.000
#> GSM151403     2  0.0000      0.894 0.000 1.000
#> GSM151404     2  0.0000      0.894 0.000 1.000
#> GSM151405     2  0.0000      0.894 0.000 1.000
#> GSM151406     2  0.0000      0.894 0.000 1.000
#> GSM151407     2  0.9686      0.426 0.396 0.604
#> GSM151408     2  0.9686      0.426 0.396 0.604
#> GSM151409     1  0.0376      0.962 0.996 0.004
#> GSM151410     2  0.9710      0.417 0.400 0.600
#> GSM151411     1  0.8267      0.606 0.740 0.260
#> GSM151412     1  0.0376      0.962 0.996 0.004
#> GSM151413     1  0.0938      0.957 0.988 0.012
#> GSM151414     1  0.0376      0.962 0.996 0.004
#> GSM151415     1  0.0376      0.962 0.996 0.004
#> GSM151416     2  0.9710      0.417 0.400 0.600
#> GSM151417     1  0.0672      0.962 0.992 0.008
#> GSM151418     2  0.0000      0.894 0.000 1.000
#> GSM151419     1  0.0376      0.962 0.996 0.004
#> GSM151420     1  0.0376      0.962 0.996 0.004
#> GSM151421     1  0.0376      0.962 0.996 0.004
#> GSM151422     1  0.0376      0.962 0.996 0.004
#> GSM151423     2  0.0000      0.894 0.000 1.000
#> GSM151424     1  0.0376      0.962 0.996 0.004
#> GSM151425     1  0.0376      0.962 0.996 0.004
#> GSM151426     2  0.0000      0.894 0.000 1.000
#> GSM151427     2  0.0000      0.894 0.000 1.000
#> GSM151428     1  0.0672      0.962 0.992 0.008
#> GSM151429     1  0.0672      0.962 0.992 0.008
#> GSM151430     2  0.9686      0.426 0.396 0.604
#> GSM151431     2  0.9686      0.426 0.396 0.604
#> GSM151432     1  0.0672      0.962 0.992 0.008
#> GSM151433     1  0.0376      0.962 0.996 0.004
#> GSM151434     1  0.0672      0.962 0.992 0.008
#> GSM151435     1  0.0376      0.962 0.996 0.004
#> GSM151436     1  0.0376      0.962 0.996 0.004
#> GSM151437     1  0.0376      0.962 0.996 0.004
#> GSM151438     1  0.0376      0.962 0.996 0.004
#> GSM151439     1  0.0376      0.962 0.996 0.004
#> GSM151440     1  0.0376      0.962 0.996 0.004

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>           class entropy silhouette    p1    p2    p3
#> GSM151369     3  0.0000      0.998 0.000 0.000 1.000
#> GSM151370     3  0.0000      0.998 0.000 0.000 1.000
#> GSM151371     1  0.2448      0.843 0.924 0.076 0.000
#> GSM151372     2  0.1129      0.776 0.020 0.976 0.004
#> GSM151373     2  0.1315      0.777 0.020 0.972 0.008
#> GSM151374     3  0.0000      0.998 0.000 0.000 1.000
#> GSM151375     3  0.0000      0.998 0.000 0.000 1.000
#> GSM151376     3  0.0000      0.998 0.000 0.000 1.000
#> GSM151377     3  0.0000      0.998 0.000 0.000 1.000
#> GSM151378     3  0.0000      0.998 0.000 0.000 1.000
#> GSM151379     3  0.0000      0.998 0.000 0.000 1.000
#> GSM151380     3  0.0000      0.998 0.000 0.000 1.000
#> GSM151381     3  0.0000      0.998 0.000 0.000 1.000
#> GSM151382     2  0.6062      0.726 0.016 0.708 0.276
#> GSM151383     2  0.6335      0.735 0.036 0.724 0.240
#> GSM151384     1  0.6154      0.459 0.592 0.408 0.000
#> GSM151385     1  0.0237      0.874 0.996 0.004 0.000
#> GSM151386     1  0.5621      0.628 0.692 0.308 0.000
#> GSM151387     3  0.0000      0.998 0.000 0.000 1.000
#> GSM151388     3  0.0000      0.998 0.000 0.000 1.000
#> GSM151389     3  0.0000      0.998 0.000 0.000 1.000
#> GSM151390     3  0.0000      0.998 0.000 0.000 1.000
#> GSM151391     3  0.0000      0.998 0.000 0.000 1.000
#> GSM151392     3  0.0000      0.998 0.000 0.000 1.000
#> GSM151393     3  0.0000      0.998 0.000 0.000 1.000
#> GSM151394     1  0.5247      0.653 0.768 0.008 0.224
#> GSM151395     2  0.2301      0.766 0.060 0.936 0.004
#> GSM151396     2  0.1129      0.776 0.020 0.976 0.004
#> GSM151397     1  0.0000      0.874 1.000 0.000 0.000
#> GSM151398     3  0.0424      0.989 0.008 0.000 0.992
#> GSM151399     2  0.4768      0.758 0.100 0.848 0.052
#> GSM151400     2  0.7757      0.703 0.112 0.664 0.224
#> GSM151401     2  0.3234      0.778 0.020 0.908 0.072
#> GSM151402     3  0.0000      0.998 0.000 0.000 1.000
#> GSM151403     3  0.0000      0.998 0.000 0.000 1.000
#> GSM151404     3  0.0000      0.998 0.000 0.000 1.000
#> GSM151405     3  0.0000      0.998 0.000 0.000 1.000
#> GSM151406     3  0.0000      0.998 0.000 0.000 1.000
#> GSM151407     2  0.5363      0.722 0.000 0.724 0.276
#> GSM151408     2  0.5363      0.722 0.000 0.724 0.276
#> GSM151409     1  0.0000      0.874 1.000 0.000 0.000
#> GSM151410     2  0.5363      0.722 0.000 0.724 0.276
#> GSM151411     1  0.1964      0.852 0.944 0.056 0.000
#> GSM151412     2  0.1129      0.776 0.020 0.976 0.004
#> GSM151413     1  0.3031      0.816 0.912 0.012 0.076
#> GSM151414     1  0.0592      0.872 0.988 0.012 0.000
#> GSM151415     1  0.5138      0.681 0.748 0.252 0.000
#> GSM151416     2  0.6630      0.694 0.028 0.672 0.300
#> GSM151417     1  0.5988      0.516 0.688 0.304 0.008
#> GSM151418     3  0.0000      0.998 0.000 0.000 1.000
#> GSM151419     1  0.0000      0.874 1.000 0.000 0.000
#> GSM151420     1  0.0000      0.874 1.000 0.000 0.000
#> GSM151421     2  0.5201      0.530 0.236 0.760 0.004
#> GSM151422     1  0.1031      0.871 0.976 0.024 0.000
#> GSM151423     3  0.0000      0.998 0.000 0.000 1.000
#> GSM151424     2  0.1129      0.776 0.020 0.976 0.004
#> GSM151425     2  0.1129      0.776 0.020 0.976 0.004
#> GSM151426     3  0.1031      0.970 0.000 0.024 0.976
#> GSM151427     3  0.0000      0.998 0.000 0.000 1.000
#> GSM151428     1  0.6451      0.149 0.560 0.436 0.004
#> GSM151429     2  0.6090      0.609 0.264 0.716 0.020
#> GSM151430     2  0.5363      0.722 0.000 0.724 0.276
#> GSM151431     2  0.5363      0.722 0.000 0.724 0.276
#> GSM151432     1  0.0892      0.871 0.980 0.020 0.000
#> GSM151433     1  0.0237      0.874 0.996 0.004 0.000
#> GSM151434     2  0.6267     -0.123 0.452 0.548 0.000
#> GSM151435     1  0.0424      0.873 0.992 0.008 0.000
#> GSM151436     2  0.0829      0.775 0.012 0.984 0.004
#> GSM151437     1  0.0000      0.874 1.000 0.000 0.000
#> GSM151438     1  0.0000      0.874 1.000 0.000 0.000
#> GSM151439     2  0.4733      0.596 0.196 0.800 0.004
#> GSM151440     2  0.0983      0.776 0.016 0.980 0.004

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM151369     3  0.0000      1.000 0.000 0.000 1.000 0.000
#> GSM151370     3  0.0000      1.000 0.000 0.000 1.000 0.000
#> GSM151371     1  0.2011      0.827 0.920 0.080 0.000 0.000
#> GSM151372     2  0.0000      0.930 0.000 1.000 0.000 0.000
#> GSM151373     2  0.0188      0.929 0.000 0.996 0.000 0.004
#> GSM151374     3  0.0000      1.000 0.000 0.000 1.000 0.000
#> GSM151375     3  0.0000      1.000 0.000 0.000 1.000 0.000
#> GSM151376     3  0.0000      1.000 0.000 0.000 1.000 0.000
#> GSM151377     3  0.0000      1.000 0.000 0.000 1.000 0.000
#> GSM151378     3  0.0000      1.000 0.000 0.000 1.000 0.000
#> GSM151379     3  0.0000      1.000 0.000 0.000 1.000 0.000
#> GSM151380     3  0.0000      1.000 0.000 0.000 1.000 0.000
#> GSM151381     3  0.0000      1.000 0.000 0.000 1.000 0.000
#> GSM151382     2  0.2799      0.840 0.000 0.884 0.008 0.108
#> GSM151383     4  0.4313      0.645 0.004 0.260 0.000 0.736
#> GSM151384     1  0.4730      0.456 0.636 0.364 0.000 0.000
#> GSM151385     1  0.0000      0.858 1.000 0.000 0.000 0.000
#> GSM151386     1  0.3528      0.721 0.808 0.192 0.000 0.000
#> GSM151387     3  0.0000      1.000 0.000 0.000 1.000 0.000
#> GSM151388     3  0.0000      1.000 0.000 0.000 1.000 0.000
#> GSM151389     3  0.0000      1.000 0.000 0.000 1.000 0.000
#> GSM151390     3  0.0000      1.000 0.000 0.000 1.000 0.000
#> GSM151391     3  0.0000      1.000 0.000 0.000 1.000 0.000
#> GSM151392     3  0.0000      1.000 0.000 0.000 1.000 0.000
#> GSM151393     3  0.0000      1.000 0.000 0.000 1.000 0.000
#> GSM151394     1  0.4877      0.328 0.592 0.000 0.408 0.000
#> GSM151395     2  0.0336      0.927 0.008 0.992 0.000 0.000
#> GSM151396     2  0.0000      0.930 0.000 1.000 0.000 0.000
#> GSM151397     1  0.0188      0.858 0.996 0.004 0.000 0.000
#> GSM151398     3  0.0000      1.000 0.000 0.000 1.000 0.000
#> GSM151399     2  0.0336      0.927 0.000 0.992 0.000 0.008
#> GSM151400     1  0.8496      0.398 0.528 0.204 0.080 0.188
#> GSM151401     2  0.0188      0.928 0.000 0.996 0.004 0.000
#> GSM151402     3  0.0000      1.000 0.000 0.000 1.000 0.000
#> GSM151403     3  0.0000      1.000 0.000 0.000 1.000 0.000
#> GSM151404     3  0.0000      1.000 0.000 0.000 1.000 0.000
#> GSM151405     3  0.0000      1.000 0.000 0.000 1.000 0.000
#> GSM151406     3  0.0000      1.000 0.000 0.000 1.000 0.000
#> GSM151407     4  0.0000      0.930 0.000 0.000 0.000 1.000
#> GSM151408     4  0.0000      0.930 0.000 0.000 0.000 1.000
#> GSM151409     1  0.0000      0.858 1.000 0.000 0.000 0.000
#> GSM151410     4  0.1716      0.892 0.000 0.064 0.000 0.936
#> GSM151411     1  0.0000      0.858 1.000 0.000 0.000 0.000
#> GSM151412     2  0.0000      0.930 0.000 1.000 0.000 0.000
#> GSM151413     1  0.0707      0.856 0.980 0.020 0.000 0.000
#> GSM151414     1  0.0707      0.856 0.980 0.020 0.000 0.000
#> GSM151415     1  0.0000      0.858 1.000 0.000 0.000 0.000
#> GSM151416     1  0.7457      0.441 0.564 0.216 0.012 0.208
#> GSM151417     1  0.4790      0.449 0.620 0.380 0.000 0.000
#> GSM151418     3  0.0000      1.000 0.000 0.000 1.000 0.000
#> GSM151419     1  0.0000      0.858 1.000 0.000 0.000 0.000
#> GSM151420     1  0.0000      0.858 1.000 0.000 0.000 0.000
#> GSM151421     2  0.2408      0.855 0.104 0.896 0.000 0.000
#> GSM151422     1  0.1792      0.834 0.932 0.068 0.000 0.000
#> GSM151423     3  0.0000      1.000 0.000 0.000 1.000 0.000
#> GSM151424     2  0.0000      0.930 0.000 1.000 0.000 0.000
#> GSM151425     2  0.0000      0.930 0.000 1.000 0.000 0.000
#> GSM151426     3  0.0000      1.000 0.000 0.000 1.000 0.000
#> GSM151427     3  0.0000      1.000 0.000 0.000 1.000 0.000
#> GSM151428     1  0.4008      0.675 0.756 0.244 0.000 0.000
#> GSM151429     2  0.4181      0.796 0.128 0.820 0.000 0.052
#> GSM151430     4  0.0000      0.930 0.000 0.000 0.000 1.000
#> GSM151431     4  0.0000      0.930 0.000 0.000 0.000 1.000
#> GSM151432     1  0.0000      0.858 1.000 0.000 0.000 0.000
#> GSM151433     1  0.0000      0.858 1.000 0.000 0.000 0.000
#> GSM151434     2  0.4331      0.580 0.288 0.712 0.000 0.000
#> GSM151435     1  0.0707      0.856 0.980 0.020 0.000 0.000
#> GSM151436     2  0.0000      0.930 0.000 1.000 0.000 0.000
#> GSM151437     1  0.0188      0.858 0.996 0.004 0.000 0.000
#> GSM151438     1  0.0000      0.858 1.000 0.000 0.000 0.000
#> GSM151439     2  0.2345      0.859 0.100 0.900 0.000 0.000
#> GSM151440     2  0.0000      0.930 0.000 1.000 0.000 0.000

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>           class entropy silhouette    p1    p2    p3    p4    p5
#> GSM151369     3  0.2471     0.9014 0.000 0.000 0.864 0.000 0.136
#> GSM151370     3  0.0162     0.9241 0.000 0.000 0.996 0.000 0.004
#> GSM151371     1  0.3452     0.7252 0.756 0.000 0.000 0.000 0.244
#> GSM151372     2  0.0000     0.8736 0.000 1.000 0.000 0.000 0.000
#> GSM151373     2  0.0000     0.8736 0.000 1.000 0.000 0.000 0.000
#> GSM151374     3  0.1410     0.9208 0.000 0.000 0.940 0.000 0.060
#> GSM151375     3  0.0162     0.9249 0.000 0.000 0.996 0.000 0.004
#> GSM151376     3  0.0162     0.9249 0.000 0.000 0.996 0.000 0.004
#> GSM151377     3  0.3143     0.8779 0.000 0.000 0.796 0.000 0.204
#> GSM151378     3  0.0162     0.9249 0.000 0.000 0.996 0.000 0.004
#> GSM151379     3  0.0000     0.9249 0.000 0.000 1.000 0.000 0.000
#> GSM151380     3  0.3039     0.8816 0.000 0.000 0.808 0.000 0.192
#> GSM151381     3  0.1197     0.9228 0.000 0.000 0.952 0.000 0.048
#> GSM151382     2  0.3039     0.6445 0.000 0.808 0.000 0.192 0.000
#> GSM151383     4  0.2879     0.6367 0.000 0.100 0.000 0.868 0.032
#> GSM151384     5  0.5258     0.6941 0.180 0.140 0.000 0.000 0.680
#> GSM151385     1  0.0000     0.8332 1.000 0.000 0.000 0.000 0.000
#> GSM151386     1  0.5368     0.4835 0.596 0.072 0.000 0.000 0.332
#> GSM151387     3  0.0162     0.9241 0.000 0.000 0.996 0.000 0.004
#> GSM151388     3  0.0162     0.9241 0.000 0.000 0.996 0.000 0.004
#> GSM151389     3  0.3109     0.8786 0.000 0.000 0.800 0.000 0.200
#> GSM151390     3  0.0162     0.9249 0.000 0.000 0.996 0.000 0.004
#> GSM151391     3  0.1043     0.9236 0.000 0.000 0.960 0.000 0.040
#> GSM151392     3  0.0000     0.9249 0.000 0.000 1.000 0.000 0.000
#> GSM151393     3  0.3109     0.8786 0.000 0.000 0.800 0.000 0.200
#> GSM151394     1  0.4958     0.2645 0.568 0.000 0.400 0.000 0.032
#> GSM151395     2  0.3452     0.4607 0.000 0.756 0.000 0.000 0.244
#> GSM151396     2  0.0000     0.8736 0.000 1.000 0.000 0.000 0.000
#> GSM151397     1  0.0404     0.8341 0.988 0.000 0.000 0.000 0.012
#> GSM151398     3  0.0880     0.9244 0.000 0.000 0.968 0.000 0.032
#> GSM151399     2  0.0162     0.8709 0.000 0.996 0.000 0.000 0.004
#> GSM151400     4  0.8058     0.0942 0.360 0.048 0.036 0.392 0.164
#> GSM151401     2  0.0000     0.8736 0.000 1.000 0.000 0.000 0.000
#> GSM151402     3  0.3143     0.8779 0.000 0.000 0.796 0.000 0.204
#> GSM151403     3  0.3109     0.8786 0.000 0.000 0.800 0.000 0.200
#> GSM151404     3  0.3109     0.8786 0.000 0.000 0.800 0.000 0.200
#> GSM151405     3  0.0162     0.9241 0.000 0.000 0.996 0.000 0.004
#> GSM151406     3  0.0000     0.9249 0.000 0.000 1.000 0.000 0.000
#> GSM151407     4  0.0000     0.7474 0.000 0.000 0.000 1.000 0.000
#> GSM151408     4  0.0000     0.7474 0.000 0.000 0.000 1.000 0.000
#> GSM151409     1  0.0290     0.8342 0.992 0.000 0.000 0.000 0.008
#> GSM151410     4  0.0703     0.7372 0.000 0.000 0.000 0.976 0.024
#> GSM151411     1  0.2329     0.8062 0.876 0.000 0.000 0.000 0.124
#> GSM151412     2  0.0000     0.8736 0.000 1.000 0.000 0.000 0.000
#> GSM151413     1  0.0290     0.8297 0.992 0.000 0.000 0.008 0.000
#> GSM151414     1  0.0000     0.8332 1.000 0.000 0.000 0.000 0.000
#> GSM151415     1  0.2605     0.7976 0.852 0.000 0.000 0.000 0.148
#> GSM151416     4  0.6629     0.0408 0.408 0.004 0.004 0.424 0.160
#> GSM151417     1  0.5216     0.5955 0.660 0.092 0.000 0.000 0.248
#> GSM151418     3  0.3143     0.8779 0.000 0.000 0.796 0.000 0.204
#> GSM151419     1  0.0000     0.8332 1.000 0.000 0.000 0.000 0.000
#> GSM151420     1  0.0000     0.8332 1.000 0.000 0.000 0.000 0.000
#> GSM151421     5  0.3242     0.8839 0.000 0.216 0.000 0.000 0.784
#> GSM151422     1  0.4708     0.6742 0.712 0.068 0.000 0.000 0.220
#> GSM151423     3  0.3143     0.8779 0.000 0.000 0.796 0.000 0.204
#> GSM151424     2  0.0000     0.8736 0.000 1.000 0.000 0.000 0.000
#> GSM151425     2  0.0794     0.8494 0.000 0.972 0.000 0.000 0.028
#> GSM151426     3  0.0162     0.9241 0.000 0.000 0.996 0.000 0.004
#> GSM151427     3  0.0000     0.9249 0.000 0.000 1.000 0.000 0.000
#> GSM151428     1  0.4744     0.6528 0.692 0.056 0.000 0.000 0.252
#> GSM151429     2  0.8186    -0.2986 0.224 0.404 0.000 0.144 0.228
#> GSM151430     4  0.0000     0.7474 0.000 0.000 0.000 1.000 0.000
#> GSM151431     4  0.0000     0.7474 0.000 0.000 0.000 1.000 0.000
#> GSM151432     1  0.3177     0.7559 0.792 0.000 0.000 0.000 0.208
#> GSM151433     1  0.2329     0.8062 0.876 0.000 0.000 0.000 0.124
#> GSM151434     5  0.3300     0.8835 0.004 0.204 0.000 0.000 0.792
#> GSM151435     1  0.0000     0.8332 1.000 0.000 0.000 0.000 0.000
#> GSM151436     2  0.0000     0.8736 0.000 1.000 0.000 0.000 0.000
#> GSM151437     1  0.0290     0.8342 0.992 0.000 0.000 0.000 0.008
#> GSM151438     1  0.0000     0.8332 1.000 0.000 0.000 0.000 0.000
#> GSM151439     5  0.3242     0.8839 0.000 0.216 0.000 0.000 0.784
#> GSM151440     2  0.0000     0.8736 0.000 1.000 0.000 0.000 0.000

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>           class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM151369     3  0.4095     0.2358 0.000 0.000 0.512 0.000 0.480 0.008
#> GSM151370     5  0.0000     0.6982 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM151371     1  0.3629     0.7013 0.724 0.000 0.016 0.000 0.000 0.260
#> GSM151372     2  0.0000     0.9083 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM151373     2  0.0000     0.9083 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM151374     5  0.3868     0.2613 0.000 0.000 0.492 0.000 0.508 0.000
#> GSM151375     5  0.3330     0.6685 0.000 0.000 0.284 0.000 0.716 0.000
#> GSM151376     5  0.3351     0.6662 0.000 0.000 0.288 0.000 0.712 0.000
#> GSM151377     3  0.0713     0.7847 0.000 0.000 0.972 0.000 0.028 0.000
#> GSM151378     5  0.3515     0.6345 0.000 0.000 0.324 0.000 0.676 0.000
#> GSM151379     5  0.3464     0.6441 0.000 0.000 0.312 0.000 0.688 0.000
#> GSM151380     3  0.3789     0.6339 0.000 0.000 0.660 0.000 0.332 0.008
#> GSM151381     5  0.3482     0.6142 0.000 0.000 0.316 0.000 0.684 0.000
#> GSM151382     2  0.1524     0.8446 0.000 0.932 0.008 0.060 0.000 0.000
#> GSM151383     4  0.2814     0.7358 0.000 0.172 0.008 0.820 0.000 0.000
#> GSM151384     6  0.3445     0.4827 0.244 0.012 0.000 0.000 0.000 0.744
#> GSM151385     1  0.2135     0.7301 0.872 0.000 0.000 0.000 0.000 0.128
#> GSM151386     1  0.3672     0.5814 0.632 0.000 0.000 0.000 0.000 0.368
#> GSM151387     5  0.0000     0.6982 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM151388     5  0.0363     0.7020 0.000 0.000 0.012 0.000 0.988 0.000
#> GSM151389     3  0.2762     0.7620 0.000 0.000 0.804 0.000 0.196 0.000
#> GSM151390     5  0.3126     0.6853 0.000 0.000 0.248 0.000 0.752 0.000
#> GSM151391     5  0.3565     0.4579 0.000 0.000 0.304 0.000 0.692 0.004
#> GSM151392     5  0.1501     0.7092 0.000 0.000 0.076 0.000 0.924 0.000
#> GSM151393     3  0.1863     0.8040 0.000 0.000 0.896 0.000 0.104 0.000
#> GSM151394     5  0.6429    -0.0621 0.340 0.000 0.020 0.000 0.404 0.236
#> GSM151395     2  0.2772     0.6423 0.004 0.816 0.000 0.000 0.000 0.180
#> GSM151396     2  0.0000     0.9083 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM151397     1  0.0790     0.7597 0.968 0.000 0.000 0.000 0.000 0.032
#> GSM151398     5  0.3398     0.5230 0.000 0.000 0.252 0.000 0.740 0.008
#> GSM151399     2  0.0000     0.9083 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM151400     1  0.6600     0.4653 0.572 0.008 0.024 0.236 0.052 0.108
#> GSM151401     2  0.0146     0.9052 0.004 0.996 0.000 0.000 0.000 0.000
#> GSM151402     3  0.0713     0.7847 0.000 0.000 0.972 0.000 0.028 0.000
#> GSM151403     3  0.1910     0.8019 0.000 0.000 0.892 0.000 0.108 0.000
#> GSM151404     3  0.3672     0.6618 0.000 0.000 0.688 0.000 0.304 0.008
#> GSM151405     5  0.0000     0.6982 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM151406     5  0.1663     0.7085 0.000 0.000 0.088 0.000 0.912 0.000
#> GSM151407     4  0.0000     0.9467 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM151408     4  0.0000     0.9467 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM151409     1  0.2527     0.7446 0.832 0.000 0.000 0.000 0.000 0.168
#> GSM151410     4  0.0717     0.9347 0.000 0.016 0.008 0.976 0.000 0.000
#> GSM151411     1  0.4047     0.7133 0.676 0.000 0.000 0.000 0.028 0.296
#> GSM151412     2  0.0000     0.9083 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM151413     1  0.1663     0.7463 0.912 0.000 0.000 0.000 0.000 0.088
#> GSM151414     1  0.1957     0.7378 0.888 0.000 0.000 0.000 0.000 0.112
#> GSM151415     1  0.2996     0.7298 0.772 0.000 0.000 0.000 0.000 0.228
#> GSM151416     1  0.5751     0.4686 0.568 0.000 0.024 0.280 0.000 0.128
#> GSM151417     1  0.3957     0.6981 0.712 0.008 0.020 0.000 0.000 0.260
#> GSM151418     3  0.0713     0.7847 0.000 0.000 0.972 0.000 0.028 0.000
#> GSM151419     1  0.2135     0.7301 0.872 0.000 0.000 0.000 0.000 0.128
#> GSM151420     1  0.2003     0.7357 0.884 0.000 0.000 0.000 0.000 0.116
#> GSM151421     6  0.2902     0.8159 0.004 0.196 0.000 0.000 0.000 0.800
#> GSM151422     1  0.3163     0.7272 0.764 0.000 0.004 0.000 0.000 0.232
#> GSM151423     3  0.2092     0.7933 0.000 0.000 0.876 0.000 0.124 0.000
#> GSM151424     2  0.0000     0.9083 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM151425     2  0.0508     0.8970 0.004 0.984 0.000 0.000 0.000 0.012
#> GSM151426     5  0.0146     0.6953 0.000 0.000 0.004 0.000 0.996 0.000
#> GSM151427     5  0.3464     0.6441 0.000 0.000 0.312 0.000 0.688 0.000
#> GSM151428     1  0.4290     0.6823 0.696 0.016 0.028 0.000 0.000 0.260
#> GSM151429     2  0.7039    -0.1553 0.204 0.472 0.024 0.048 0.000 0.252
#> GSM151430     4  0.0000     0.9467 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM151431     4  0.0000     0.9467 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM151432     1  0.3163     0.7245 0.764 0.000 0.004 0.000 0.000 0.232
#> GSM151433     1  0.2823     0.7363 0.796 0.000 0.000 0.000 0.000 0.204
#> GSM151434     6  0.2706     0.8187 0.008 0.160 0.000 0.000 0.000 0.832
#> GSM151435     1  0.0713     0.7596 0.972 0.000 0.000 0.000 0.000 0.028
#> GSM151436     2  0.0000     0.9083 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM151437     1  0.0937     0.7586 0.960 0.000 0.000 0.000 0.000 0.040
#> GSM151438     1  0.2135     0.7301 0.872 0.000 0.000 0.000 0.000 0.128
#> GSM151439     6  0.3023     0.7745 0.000 0.232 0.000 0.000 0.000 0.768
#> GSM151440     2  0.0000     0.9083 0.000 1.000 0.000 0.000 0.000 0.000

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

consensus_heatmap(res, k = 2)

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

consensus_heatmap(res, k = 3)

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

consensus_heatmap(res, k = 4)

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

consensus_heatmap(res, k = 5)

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

consensus_heatmap(res, k = 6)

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

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

membership_heatmap(res, k = 2)

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

membership_heatmap(res, k = 3)

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

membership_heatmap(res, k = 4)

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

membership_heatmap(res, k = 5)

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

membership_heatmap(res, k = 6)

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

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

Signature heatmaps where rows are scaled:

get_signatures(res, k = 2)

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

get_signatures(res, k = 3)

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

get_signatures(res, k = 4)

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

get_signatures(res, k = 5)

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

get_signatures(res, k = 6)

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

Signature heatmaps where rows are not scaled:

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

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

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

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

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

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

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

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

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

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

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk SD-mclust-signature_compare

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

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

An example of the output of tb is:

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

The columns in tb are:

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

UMAP plot which shows how samples are separated.

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

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

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

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

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

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

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

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

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

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

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk SD-mclust-collect-classes

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

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

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

collect_plots(res)

plot of chunk SD-NMF-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.998           0.940       0.977         0.4996 0.499   0.499
#> 3 3 0.818           0.850       0.935         0.3396 0.732   0.510
#> 4 4 0.676           0.732       0.848         0.1092 0.887   0.674
#> 5 5 0.671           0.576       0.770         0.0605 0.901   0.659
#> 6 6 0.683           0.579       0.765         0.0405 0.871   0.511

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
#> GSM151369     1  0.0000      0.969 1.000 0.000
#> GSM151370     2  0.0000      0.980 0.000 1.000
#> GSM151371     1  0.0000      0.969 1.000 0.000
#> GSM151372     2  0.0000      0.980 0.000 1.000
#> GSM151373     2  0.0000      0.980 0.000 1.000
#> GSM151374     2  0.0000      0.980 0.000 1.000
#> GSM151375     2  0.0000      0.980 0.000 1.000
#> GSM151376     2  0.0000      0.980 0.000 1.000
#> GSM151377     2  0.0000      0.980 0.000 1.000
#> GSM151378     2  0.0000      0.980 0.000 1.000
#> GSM151379     2  0.0000      0.980 0.000 1.000
#> GSM151380     1  0.9896      0.205 0.560 0.440
#> GSM151381     2  0.0000      0.980 0.000 1.000
#> GSM151382     2  0.0000      0.980 0.000 1.000
#> GSM151383     2  0.1184      0.966 0.016 0.984
#> GSM151384     1  0.0000      0.969 1.000 0.000
#> GSM151385     1  0.0000      0.969 1.000 0.000
#> GSM151386     1  0.0000      0.969 1.000 0.000
#> GSM151387     2  0.0000      0.980 0.000 1.000
#> GSM151388     2  0.3114      0.926 0.056 0.944
#> GSM151389     2  0.0000      0.980 0.000 1.000
#> GSM151390     2  0.0000      0.980 0.000 1.000
#> GSM151391     2  0.0000      0.980 0.000 1.000
#> GSM151392     2  0.8861      0.555 0.304 0.696
#> GSM151393     2  0.0000      0.980 0.000 1.000
#> GSM151394     1  0.0000      0.969 1.000 0.000
#> GSM151395     1  0.4562      0.872 0.904 0.096
#> GSM151396     2  0.0000      0.980 0.000 1.000
#> GSM151397     1  0.0000      0.969 1.000 0.000
#> GSM151398     1  0.0000      0.969 1.000 0.000
#> GSM151399     2  0.0000      0.980 0.000 1.000
#> GSM151400     1  0.9635      0.363 0.612 0.388
#> GSM151401     2  0.0000      0.980 0.000 1.000
#> GSM151402     2  0.0000      0.980 0.000 1.000
#> GSM151403     2  0.0000      0.980 0.000 1.000
#> GSM151404     1  0.0000      0.969 1.000 0.000
#> GSM151405     2  0.0376      0.977 0.004 0.996
#> GSM151406     2  0.0000      0.980 0.000 1.000
#> GSM151407     2  0.0000      0.980 0.000 1.000
#> GSM151408     2  0.0000      0.980 0.000 1.000
#> GSM151409     1  0.0000      0.969 1.000 0.000
#> GSM151410     2  0.9460      0.414 0.364 0.636
#> GSM151411     1  0.0000      0.969 1.000 0.000
#> GSM151412     2  0.0000      0.980 0.000 1.000
#> GSM151413     1  0.0000      0.969 1.000 0.000
#> GSM151414     1  0.0000      0.969 1.000 0.000
#> GSM151415     1  0.0000      0.969 1.000 0.000
#> GSM151416     1  0.0000      0.969 1.000 0.000
#> GSM151417     1  0.0000      0.969 1.000 0.000
#> GSM151418     2  0.0000      0.980 0.000 1.000
#> GSM151419     1  0.0000      0.969 1.000 0.000
#> GSM151420     1  0.0000      0.969 1.000 0.000
#> GSM151421     1  0.0000      0.969 1.000 0.000
#> GSM151422     1  0.0000      0.969 1.000 0.000
#> GSM151423     2  0.0000      0.980 0.000 1.000
#> GSM151424     2  0.0000      0.980 0.000 1.000
#> GSM151425     2  0.0000      0.980 0.000 1.000
#> GSM151426     2  0.0000      0.980 0.000 1.000
#> GSM151427     2  0.0000      0.980 0.000 1.000
#> GSM151428     1  0.0000      0.969 1.000 0.000
#> GSM151429     1  0.0000      0.969 1.000 0.000
#> GSM151430     2  0.0000      0.980 0.000 1.000
#> GSM151431     2  0.0672      0.973 0.008 0.992
#> GSM151432     1  0.0000      0.969 1.000 0.000
#> GSM151433     1  0.0000      0.969 1.000 0.000
#> GSM151434     1  0.0000      0.969 1.000 0.000
#> GSM151435     1  0.0000      0.969 1.000 0.000
#> GSM151436     2  0.0000      0.980 0.000 1.000
#> GSM151437     1  0.0000      0.969 1.000 0.000
#> GSM151438     1  0.0000      0.969 1.000 0.000
#> GSM151439     1  0.0000      0.969 1.000 0.000
#> GSM151440     2  0.0000      0.980 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
#> GSM151369     1  0.5988     0.3778 0.632 0.000 0.368
#> GSM151370     2  0.6267     0.1813 0.000 0.548 0.452
#> GSM151371     1  0.0000     0.9648 1.000 0.000 0.000
#> GSM151372     2  0.2878     0.8596 0.000 0.904 0.096
#> GSM151373     2  0.2261     0.8816 0.000 0.932 0.068
#> GSM151374     3  0.0000     0.8956 0.000 0.000 1.000
#> GSM151375     3  0.0000     0.8956 0.000 0.000 1.000
#> GSM151376     3  0.0000     0.8956 0.000 0.000 1.000
#> GSM151377     3  0.0000     0.8956 0.000 0.000 1.000
#> GSM151378     3  0.4062     0.7500 0.000 0.164 0.836
#> GSM151379     3  0.5785     0.4600 0.000 0.332 0.668
#> GSM151380     3  0.2066     0.8599 0.060 0.000 0.940
#> GSM151381     3  0.0000     0.8956 0.000 0.000 1.000
#> GSM151382     2  0.0747     0.9067 0.000 0.984 0.016
#> GSM151383     2  0.0000     0.9082 0.000 1.000 0.000
#> GSM151384     1  0.0237     0.9628 0.996 0.004 0.000
#> GSM151385     1  0.0000     0.9648 1.000 0.000 0.000
#> GSM151386     1  0.0000     0.9648 1.000 0.000 0.000
#> GSM151387     2  0.4654     0.7276 0.000 0.792 0.208
#> GSM151388     3  0.4931     0.6905 0.232 0.000 0.768
#> GSM151389     3  0.0000     0.8956 0.000 0.000 1.000
#> GSM151390     3  0.2537     0.8398 0.000 0.080 0.920
#> GSM151391     3  0.0000     0.8956 0.000 0.000 1.000
#> GSM151392     3  0.4178     0.7659 0.172 0.000 0.828
#> GSM151393     3  0.0000     0.8956 0.000 0.000 1.000
#> GSM151394     1  0.0000     0.9648 1.000 0.000 0.000
#> GSM151395     2  0.2356     0.8637 0.072 0.928 0.000
#> GSM151396     2  0.0000     0.9082 0.000 1.000 0.000
#> GSM151397     1  0.0000     0.9648 1.000 0.000 0.000
#> GSM151398     1  0.0000     0.9648 1.000 0.000 0.000
#> GSM151399     2  0.0000     0.9082 0.000 1.000 0.000
#> GSM151400     2  0.1399     0.8967 0.028 0.968 0.004
#> GSM151401     2  0.1860     0.8915 0.000 0.948 0.052
#> GSM151402     3  0.0000     0.8956 0.000 0.000 1.000
#> GSM151403     3  0.0000     0.8956 0.000 0.000 1.000
#> GSM151404     3  0.5810     0.4831 0.336 0.000 0.664
#> GSM151405     2  0.8835     0.4582 0.180 0.576 0.244
#> GSM151406     3  0.0000     0.8956 0.000 0.000 1.000
#> GSM151407     2  0.0000     0.9082 0.000 1.000 0.000
#> GSM151408     2  0.0000     0.9082 0.000 1.000 0.000
#> GSM151409     1  0.0000     0.9648 1.000 0.000 0.000
#> GSM151410     2  0.0000     0.9082 0.000 1.000 0.000
#> GSM151411     1  0.0000     0.9648 1.000 0.000 0.000
#> GSM151412     2  0.0424     0.9081 0.000 0.992 0.008
#> GSM151413     1  0.0237     0.9628 0.996 0.004 0.000
#> GSM151414     1  0.0000     0.9648 1.000 0.000 0.000
#> GSM151415     1  0.0000     0.9648 1.000 0.000 0.000
#> GSM151416     2  0.5926     0.4450 0.356 0.644 0.000
#> GSM151417     1  0.1411     0.9393 0.964 0.036 0.000
#> GSM151418     3  0.0000     0.8956 0.000 0.000 1.000
#> GSM151419     1  0.0000     0.9648 1.000 0.000 0.000
#> GSM151420     1  0.0000     0.9648 1.000 0.000 0.000
#> GSM151421     1  0.2066     0.9175 0.940 0.060 0.000
#> GSM151422     1  0.0237     0.9628 0.996 0.004 0.000
#> GSM151423     3  0.0000     0.8956 0.000 0.000 1.000
#> GSM151424     2  0.0424     0.9082 0.000 0.992 0.008
#> GSM151425     2  0.1643     0.8956 0.000 0.956 0.044
#> GSM151426     2  0.2448     0.8755 0.000 0.924 0.076
#> GSM151427     3  0.6291     0.0533 0.000 0.468 0.532
#> GSM151428     1  0.2066     0.9192 0.940 0.060 0.000
#> GSM151429     2  0.2959     0.8371 0.100 0.900 0.000
#> GSM151430     2  0.0000     0.9082 0.000 1.000 0.000
#> GSM151431     2  0.0000     0.9082 0.000 1.000 0.000
#> GSM151432     1  0.0000     0.9648 1.000 0.000 0.000
#> GSM151433     1  0.0000     0.9648 1.000 0.000 0.000
#> GSM151434     1  0.0000     0.9648 1.000 0.000 0.000
#> GSM151435     1  0.0000     0.9648 1.000 0.000 0.000
#> GSM151436     2  0.0747     0.9066 0.000 0.984 0.016
#> GSM151437     1  0.0000     0.9648 1.000 0.000 0.000
#> GSM151438     1  0.0000     0.9648 1.000 0.000 0.000
#> GSM151439     1  0.5465     0.5949 0.712 0.288 0.000
#> GSM151440     2  0.0237     0.9082 0.000 0.996 0.004

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM151369     1  0.5773     0.1804 0.536 0.016 0.440 0.008
#> GSM151370     3  0.6009     0.4170 0.004 0.036 0.560 0.400
#> GSM151371     1  0.1004     0.8994 0.972 0.024 0.000 0.004
#> GSM151372     2  0.4669     0.7175 0.000 0.780 0.052 0.168
#> GSM151373     2  0.4932     0.6298 0.000 0.728 0.032 0.240
#> GSM151374     3  0.0779     0.8556 0.000 0.016 0.980 0.004
#> GSM151375     3  0.1109     0.8529 0.000 0.028 0.968 0.004
#> GSM151376     3  0.1004     0.8536 0.000 0.024 0.972 0.004
#> GSM151377     3  0.1151     0.8523 0.000 0.024 0.968 0.008
#> GSM151378     3  0.3323     0.8148 0.000 0.064 0.876 0.060
#> GSM151379     3  0.5426     0.6243 0.000 0.060 0.708 0.232
#> GSM151380     3  0.5201     0.7506 0.084 0.012 0.776 0.128
#> GSM151381     3  0.1182     0.8557 0.000 0.016 0.968 0.016
#> GSM151382     4  0.5512     0.0229 0.000 0.492 0.016 0.492
#> GSM151383     4  0.3726     0.6778 0.000 0.212 0.000 0.788
#> GSM151384     1  0.4304     0.6871 0.716 0.284 0.000 0.000
#> GSM151385     1  0.1022     0.8892 0.968 0.000 0.000 0.032
#> GSM151386     1  0.3649     0.7861 0.796 0.204 0.000 0.000
#> GSM151387     4  0.5850     0.4745 0.000 0.080 0.244 0.676
#> GSM151388     3  0.6969     0.5633 0.128 0.012 0.608 0.252
#> GSM151389     3  0.1854     0.8490 0.000 0.012 0.940 0.048
#> GSM151390     2  0.5288     0.0792 0.000 0.520 0.472 0.008
#> GSM151391     3  0.2222     0.8467 0.000 0.016 0.924 0.060
#> GSM151392     3  0.3217     0.7773 0.128 0.012 0.860 0.000
#> GSM151393     3  0.1151     0.8560 0.000 0.008 0.968 0.024
#> GSM151394     1  0.2412     0.8520 0.908 0.000 0.008 0.084
#> GSM151395     2  0.2644     0.7319 0.060 0.908 0.000 0.032
#> GSM151396     2  0.1762     0.7803 0.004 0.944 0.004 0.048
#> GSM151397     1  0.1716     0.8879 0.936 0.064 0.000 0.000
#> GSM151398     1  0.2546     0.8469 0.900 0.000 0.008 0.092
#> GSM151399     2  0.2973     0.7673 0.000 0.856 0.000 0.144
#> GSM151400     4  0.6974     0.4360 0.152 0.284 0.000 0.564
#> GSM151401     2  0.4225     0.7272 0.000 0.792 0.024 0.184
#> GSM151402     3  0.0672     0.8559 0.000 0.008 0.984 0.008
#> GSM151403     3  0.0921     0.8546 0.000 0.000 0.972 0.028
#> GSM151404     3  0.5759     0.6116 0.232 0.000 0.688 0.080
#> GSM151405     4  0.9870     0.1460 0.240 0.220 0.208 0.332
#> GSM151406     3  0.3168     0.8308 0.000 0.060 0.884 0.056
#> GSM151407     4  0.3052     0.7294 0.000 0.136 0.004 0.860
#> GSM151408     4  0.2868     0.7288 0.000 0.136 0.000 0.864
#> GSM151409     1  0.1118     0.8876 0.964 0.000 0.000 0.036
#> GSM151410     4  0.2469     0.7338 0.000 0.108 0.000 0.892
#> GSM151411     1  0.0469     0.8953 0.988 0.000 0.000 0.012
#> GSM151412     2  0.3249     0.7676 0.000 0.852 0.008 0.140
#> GSM151413     1  0.1174     0.8990 0.968 0.020 0.000 0.012
#> GSM151414     1  0.1940     0.8654 0.924 0.000 0.000 0.076
#> GSM151415     1  0.1940     0.8827 0.924 0.076 0.000 0.000
#> GSM151416     4  0.3583     0.5687 0.180 0.000 0.004 0.816
#> GSM151417     1  0.3015     0.8676 0.884 0.092 0.000 0.024
#> GSM151418     3  0.0804     0.8554 0.000 0.012 0.980 0.008
#> GSM151419     1  0.1042     0.8989 0.972 0.020 0.000 0.008
#> GSM151420     1  0.0592     0.8941 0.984 0.000 0.000 0.016
#> GSM151421     2  0.3257     0.6227 0.152 0.844 0.000 0.004
#> GSM151422     1  0.1637     0.8904 0.940 0.060 0.000 0.000
#> GSM151423     3  0.0672     0.8559 0.000 0.008 0.984 0.008
#> GSM151424     2  0.2197     0.7830 0.000 0.916 0.004 0.080
#> GSM151425     2  0.2762     0.7692 0.028 0.912 0.012 0.048
#> GSM151426     4  0.2907     0.6950 0.004 0.064 0.032 0.900
#> GSM151427     3  0.6158     0.3183 0.000 0.056 0.560 0.384
#> GSM151428     1  0.3751     0.7554 0.800 0.004 0.000 0.196
#> GSM151429     4  0.5142     0.6732 0.064 0.192 0.000 0.744
#> GSM151430     4  0.2714     0.7338 0.000 0.112 0.004 0.884
#> GSM151431     4  0.2197     0.7302 0.004 0.080 0.000 0.916
#> GSM151432     1  0.1302     0.8953 0.956 0.044 0.000 0.000
#> GSM151433     1  0.1211     0.8963 0.960 0.040 0.000 0.000
#> GSM151434     1  0.4585     0.6129 0.668 0.332 0.000 0.000
#> GSM151435     1  0.0336     0.8966 0.992 0.000 0.000 0.008
#> GSM151436     2  0.2867     0.7811 0.000 0.884 0.012 0.104
#> GSM151437     1  0.0592     0.8987 0.984 0.016 0.000 0.000
#> GSM151438     1  0.1118     0.8964 0.964 0.036 0.000 0.000
#> GSM151439     2  0.2773     0.6662 0.116 0.880 0.000 0.004
#> GSM151440     2  0.3448     0.7516 0.000 0.828 0.004 0.168

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>           class entropy silhouette    p1    p2    p3    p4    p5
#> GSM151369     3  0.4178     0.5386 0.220 0.000 0.748 0.004 0.028
#> GSM151370     5  0.6605     0.6396 0.000 0.400 0.072 0.052 0.476
#> GSM151371     1  0.3170     0.8423 0.848 0.004 0.000 0.024 0.124
#> GSM151372     4  0.7970     0.1124 0.000 0.292 0.084 0.372 0.252
#> GSM151373     2  0.3090     0.5461 0.000 0.860 0.000 0.088 0.052
#> GSM151374     3  0.0740     0.7846 0.000 0.008 0.980 0.008 0.004
#> GSM151375     3  0.1408     0.7724 0.000 0.044 0.948 0.000 0.008
#> GSM151376     3  0.1195     0.7794 0.000 0.028 0.960 0.000 0.012
#> GSM151377     3  0.0865     0.7738 0.000 0.000 0.972 0.004 0.024
#> GSM151378     3  0.7001    -0.0412 0.000 0.376 0.460 0.056 0.108
#> GSM151379     3  0.6283     0.1626 0.000 0.024 0.500 0.392 0.084
#> GSM151380     5  0.7148     0.1804 0.144 0.016 0.328 0.024 0.488
#> GSM151381     3  0.4298     0.5872 0.000 0.060 0.756 0.000 0.184
#> GSM151382     4  0.5107     0.5756 0.000 0.164 0.004 0.708 0.124
#> GSM151383     4  0.3310     0.6940 0.004 0.024 0.000 0.836 0.136
#> GSM151384     1  0.4810     0.6968 0.712 0.084 0.000 0.000 0.204
#> GSM151385     1  0.1197     0.8640 0.952 0.000 0.000 0.000 0.048
#> GSM151386     1  0.4031     0.7607 0.772 0.044 0.000 0.000 0.184
#> GSM151387     5  0.6631     0.6554 0.000 0.384 0.052 0.076 0.488
#> GSM151388     5  0.7748     0.6150 0.084 0.228 0.072 0.068 0.548
#> GSM151389     3  0.4753     0.5980 0.000 0.056 0.752 0.024 0.168
#> GSM151390     2  0.3159     0.4626 0.000 0.856 0.088 0.000 0.056
#> GSM151391     3  0.2554     0.7465 0.000 0.000 0.892 0.036 0.072
#> GSM151392     2  0.8423    -0.4615 0.156 0.320 0.248 0.000 0.276
#> GSM151393     3  0.0807     0.7837 0.000 0.000 0.976 0.012 0.012
#> GSM151394     1  0.4109     0.6287 0.700 0.012 0.000 0.000 0.288
#> GSM151395     2  0.2236     0.5385 0.024 0.908 0.000 0.000 0.068
#> GSM151396     2  0.1331     0.5829 0.000 0.952 0.000 0.008 0.040
#> GSM151397     1  0.1484     0.8640 0.944 0.008 0.000 0.000 0.048
#> GSM151398     1  0.4196     0.5202 0.640 0.004 0.000 0.000 0.356
#> GSM151399     2  0.1399     0.5647 0.000 0.952 0.000 0.020 0.028
#> GSM151400     4  0.8088     0.1350 0.240 0.232 0.000 0.408 0.120
#> GSM151401     2  0.2362     0.5200 0.000 0.900 0.000 0.024 0.076
#> GSM151402     3  0.0000     0.7842 0.000 0.000 1.000 0.000 0.000
#> GSM151403     3  0.0955     0.7790 0.000 0.004 0.968 0.000 0.028
#> GSM151404     3  0.6937    -0.1238 0.304 0.004 0.372 0.000 0.320
#> GSM151405     2  0.6175    -0.5982 0.012 0.476 0.044 0.024 0.444
#> GSM151406     2  0.6264    -0.5850 0.000 0.460 0.128 0.004 0.408
#> GSM151407     4  0.0955     0.7154 0.000 0.004 0.000 0.968 0.028
#> GSM151408     4  0.0740     0.7179 0.004 0.008 0.000 0.980 0.008
#> GSM151409     1  0.1628     0.8652 0.936 0.000 0.000 0.008 0.056
#> GSM151410     4  0.2445     0.6972 0.004 0.004 0.000 0.884 0.108
#> GSM151411     1  0.1792     0.8547 0.916 0.000 0.000 0.000 0.084
#> GSM151412     2  0.1310     0.5834 0.000 0.956 0.000 0.024 0.020
#> GSM151413     1  0.0671     0.8711 0.980 0.004 0.000 0.000 0.016
#> GSM151414     1  0.1732     0.8518 0.920 0.000 0.000 0.000 0.080
#> GSM151415     1  0.2124     0.8486 0.900 0.004 0.000 0.000 0.096
#> GSM151416     4  0.4845     0.5749 0.128 0.000 0.000 0.724 0.148
#> GSM151417     1  0.2679     0.8462 0.892 0.004 0.000 0.056 0.048
#> GSM151418     3  0.0162     0.7843 0.000 0.004 0.996 0.000 0.000
#> GSM151419     1  0.0162     0.8707 0.996 0.000 0.000 0.000 0.004
#> GSM151420     1  0.1121     0.8678 0.956 0.000 0.000 0.000 0.044
#> GSM151421     2  0.6850     0.2665 0.236 0.476 0.000 0.012 0.276
#> GSM151422     1  0.1205     0.8665 0.956 0.004 0.000 0.000 0.040
#> GSM151423     3  0.0000     0.7842 0.000 0.000 1.000 0.000 0.000
#> GSM151424     2  0.1741     0.5840 0.000 0.936 0.000 0.024 0.040
#> GSM151425     2  0.0771     0.5666 0.000 0.976 0.004 0.000 0.020
#> GSM151426     5  0.6419     0.6105 0.000 0.408 0.028 0.088 0.476
#> GSM151427     4  0.7155     0.1213 0.000 0.048 0.340 0.464 0.148
#> GSM151428     1  0.5583     0.6205 0.640 0.000 0.000 0.152 0.208
#> GSM151429     4  0.4630     0.6727 0.072 0.028 0.000 0.776 0.124
#> GSM151430     4  0.1892     0.7080 0.000 0.004 0.000 0.916 0.080
#> GSM151431     4  0.2470     0.7015 0.012 0.000 0.000 0.884 0.104
#> GSM151432     1  0.2951     0.8445 0.860 0.000 0.000 0.028 0.112
#> GSM151433     1  0.2880     0.8471 0.868 0.004 0.000 0.020 0.108
#> GSM151434     1  0.5759     0.5623 0.596 0.128 0.000 0.000 0.276
#> GSM151435     1  0.0609     0.8698 0.980 0.000 0.000 0.000 0.020
#> GSM151436     2  0.6254     0.2524 0.000 0.536 0.000 0.268 0.196
#> GSM151437     1  0.0703     0.8717 0.976 0.000 0.000 0.000 0.024
#> GSM151438     1  0.0162     0.8707 0.996 0.000 0.000 0.000 0.004
#> GSM151439     2  0.5809     0.4261 0.088 0.616 0.000 0.016 0.280
#> GSM151440     2  0.6454     0.1661 0.000 0.488 0.000 0.304 0.208

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>           class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM151369     3  0.5169    0.41442 0.316 0.000 0.604 0.000 0.040 0.040
#> GSM151370     5  0.5063    0.39918 0.000 0.340 0.024 0.016 0.600 0.020
#> GSM151371     6  0.6665    0.23150 0.256 0.000 0.000 0.040 0.272 0.432
#> GSM151372     6  0.4731    0.49583 0.000 0.068 0.016 0.116 0.044 0.756
#> GSM151373     2  0.2787    0.71744 0.000 0.872 0.000 0.012 0.044 0.072
#> GSM151374     3  0.2224    0.80125 0.000 0.012 0.912 0.004 0.036 0.036
#> GSM151375     3  0.3942    0.75714 0.000 0.084 0.804 0.000 0.056 0.056
#> GSM151376     3  0.4075    0.75001 0.000 0.100 0.792 0.000 0.052 0.056
#> GSM151377     3  0.1151    0.80118 0.000 0.000 0.956 0.000 0.012 0.032
#> GSM151378     2  0.6535   -0.00859 0.000 0.408 0.400 0.004 0.144 0.044
#> GSM151379     3  0.5998    0.67243 0.000 0.064 0.672 0.112 0.096 0.056
#> GSM151380     5  0.4375    0.54031 0.040 0.000 0.152 0.032 0.764 0.012
#> GSM151381     3  0.5472    0.19515 0.000 0.092 0.520 0.000 0.376 0.012
#> GSM151382     6  0.5625    0.29806 0.000 0.044 0.004 0.328 0.056 0.568
#> GSM151383     6  0.4514    0.30927 0.000 0.012 0.000 0.328 0.028 0.632
#> GSM151384     1  0.2688    0.79196 0.884 0.048 0.000 0.000 0.024 0.044
#> GSM151385     1  0.1674    0.82548 0.924 0.000 0.000 0.004 0.068 0.004
#> GSM151386     1  0.2342    0.80589 0.904 0.032 0.000 0.000 0.024 0.040
#> GSM151387     5  0.6153    0.30740 0.000 0.356 0.020 0.056 0.516 0.052
#> GSM151388     5  0.5663    0.55725 0.028 0.136 0.028 0.076 0.704 0.028
#> GSM151389     3  0.4858    0.71214 0.000 0.048 0.752 0.032 0.120 0.048
#> GSM151390     2  0.3928    0.66827 0.000 0.808 0.064 0.004 0.088 0.036
#> GSM151391     3  0.2095    0.80119 0.000 0.000 0.916 0.040 0.028 0.016
#> GSM151392     2  0.8111   -0.09943 0.184 0.352 0.148 0.000 0.272 0.044
#> GSM151393     3  0.1275    0.80894 0.000 0.000 0.956 0.016 0.016 0.012
#> GSM151394     5  0.4568    0.40737 0.236 0.004 0.000 0.000 0.684 0.076
#> GSM151395     2  0.1616    0.72637 0.028 0.940 0.000 0.000 0.020 0.012
#> GSM151396     2  0.0603    0.73805 0.000 0.980 0.000 0.000 0.004 0.016
#> GSM151397     1  0.0291    0.83473 0.992 0.000 0.000 0.000 0.004 0.004
#> GSM151398     5  0.4089    0.22562 0.372 0.000 0.004 0.004 0.616 0.004
#> GSM151399     2  0.0935    0.73909 0.000 0.964 0.000 0.000 0.032 0.004
#> GSM151400     4  0.7457    0.17050 0.304 0.176 0.004 0.424 0.040 0.052
#> GSM151401     2  0.2176    0.71282 0.000 0.896 0.000 0.000 0.080 0.024
#> GSM151402     3  0.0436    0.80719 0.000 0.004 0.988 0.000 0.004 0.004
#> GSM151403     3  0.1461    0.80541 0.000 0.000 0.940 0.000 0.044 0.016
#> GSM151404     5  0.5250    0.49236 0.112 0.000 0.180 0.004 0.676 0.028
#> GSM151405     5  0.4212    0.46519 0.004 0.312 0.004 0.004 0.664 0.012
#> GSM151406     5  0.4638    0.44155 0.000 0.320 0.016 0.000 0.632 0.032
#> GSM151407     4  0.2558    0.64311 0.000 0.000 0.000 0.840 0.004 0.156
#> GSM151408     4  0.3426    0.50499 0.000 0.000 0.000 0.720 0.004 0.276
#> GSM151409     1  0.3760    0.72075 0.768 0.000 0.000 0.004 0.184 0.044
#> GSM151410     4  0.3279    0.65188 0.000 0.008 0.000 0.816 0.028 0.148
#> GSM151411     1  0.3855    0.62407 0.704 0.000 0.000 0.000 0.272 0.024
#> GSM151412     2  0.2249    0.71757 0.000 0.900 0.000 0.004 0.032 0.064
#> GSM151413     1  0.0767    0.83549 0.976 0.000 0.000 0.008 0.012 0.004
#> GSM151414     1  0.1769    0.82807 0.924 0.000 0.000 0.012 0.060 0.004
#> GSM151415     1  0.1078    0.83371 0.964 0.008 0.000 0.000 0.012 0.016
#> GSM151416     4  0.4893    0.55188 0.052 0.000 0.000 0.724 0.100 0.124
#> GSM151417     1  0.2357    0.79173 0.888 0.004 0.000 0.092 0.012 0.004
#> GSM151418     3  0.0922    0.80478 0.000 0.004 0.968 0.000 0.004 0.024
#> GSM151419     1  0.0547    0.83595 0.980 0.000 0.000 0.000 0.020 0.000
#> GSM151420     1  0.2358    0.80249 0.876 0.000 0.000 0.000 0.108 0.016
#> GSM151421     1  0.6668   -0.10208 0.388 0.304 0.000 0.000 0.032 0.276
#> GSM151422     1  0.0767    0.83215 0.976 0.000 0.000 0.004 0.012 0.008
#> GSM151423     3  0.1053    0.80831 0.000 0.004 0.964 0.000 0.020 0.012
#> GSM151424     2  0.1116    0.73476 0.004 0.960 0.000 0.000 0.008 0.028
#> GSM151425     2  0.1053    0.74175 0.000 0.964 0.004 0.000 0.012 0.020
#> GSM151426     2  0.6636   -0.15037 0.000 0.436 0.016 0.096 0.392 0.060
#> GSM151427     3  0.7441    0.17954 0.000 0.060 0.396 0.364 0.108 0.072
#> GSM151428     6  0.7236    0.26628 0.180 0.000 0.000 0.132 0.276 0.412
#> GSM151429     6  0.4791    0.37796 0.036 0.008 0.000 0.284 0.016 0.656
#> GSM151430     4  0.0790    0.68406 0.000 0.000 0.000 0.968 0.000 0.032
#> GSM151431     4  0.0858    0.68630 0.000 0.000 0.000 0.968 0.004 0.028
#> GSM151432     1  0.5295    0.49681 0.604 0.000 0.000 0.016 0.092 0.288
#> GSM151433     1  0.4871    0.57459 0.644 0.000 0.000 0.000 0.112 0.244
#> GSM151434     1  0.5318    0.57249 0.664 0.104 0.000 0.000 0.040 0.192
#> GSM151435     1  0.0713    0.83561 0.972 0.000 0.000 0.000 0.028 0.000
#> GSM151436     6  0.5476    0.41310 0.000 0.308 0.000 0.060 0.044 0.588
#> GSM151437     1  0.2179    0.82311 0.900 0.000 0.000 0.000 0.064 0.036
#> GSM151438     1  0.0146    0.83517 0.996 0.000 0.000 0.000 0.000 0.004
#> GSM151439     6  0.5971    0.30753 0.108 0.344 0.000 0.000 0.036 0.512
#> GSM151440     6  0.4826    0.50589 0.004 0.152 0.000 0.100 0.024 0.720

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

consensus_heatmap(res, k = 2)

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

consensus_heatmap(res, k = 3)

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

consensus_heatmap(res, k = 4)

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

consensus_heatmap(res, k = 5)

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

consensus_heatmap(res, k = 6)

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

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

membership_heatmap(res, k = 2)

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

membership_heatmap(res, k = 3)

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

membership_heatmap(res, k = 4)

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

membership_heatmap(res, k = 5)

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

membership_heatmap(res, k = 6)

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

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

Signature heatmaps where rows are scaled:

get_signatures(res, k = 2)

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

get_signatures(res, k = 3)

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

get_signatures(res, k = 4)

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

get_signatures(res, k = 5)

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

get_signatures(res, k = 6)

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

Signature heatmaps where rows are not scaled:

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

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

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

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

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

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

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

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

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

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

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk SD-NMF-signature_compare

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

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

An example of the output of tb is:

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

The columns in tb are:

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

UMAP plot which shows how samples are separated.

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

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

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

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

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

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

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

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

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

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

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk SD-NMF-collect-classes

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

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

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

collect_plots(res)

plot of chunk CV-hclust-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.443           0.877       0.923         0.4778 0.499   0.499
#> 3 3 0.440           0.611       0.788         0.2802 0.910   0.819
#> 4 4 0.439           0.418       0.669         0.1161 0.769   0.498
#> 5 5 0.500           0.487       0.681         0.0575 0.932   0.772
#> 6 6 0.527           0.539       0.704         0.0517 0.869   0.564

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
#> GSM151369     1  0.6887      0.822 0.816 0.184
#> GSM151370     2  0.6438      0.849 0.164 0.836
#> GSM151371     1  0.5737      0.854 0.864 0.136
#> GSM151372     2  0.0376      0.928 0.004 0.996
#> GSM151373     2  0.0000      0.927 0.000 1.000
#> GSM151374     2  0.0000      0.927 0.000 1.000
#> GSM151375     2  0.0000      0.927 0.000 1.000
#> GSM151376     2  0.0000      0.927 0.000 1.000
#> GSM151377     2  0.0672      0.929 0.008 0.992
#> GSM151378     2  0.0000      0.927 0.000 1.000
#> GSM151379     2  0.0000      0.927 0.000 1.000
#> GSM151380     1  0.8443      0.707 0.728 0.272
#> GSM151381     2  0.0376      0.928 0.004 0.996
#> GSM151382     2  0.0376      0.928 0.004 0.996
#> GSM151383     2  0.8267      0.716 0.260 0.740
#> GSM151384     1  0.1414      0.898 0.980 0.020
#> GSM151385     1  0.0000      0.895 1.000 0.000
#> GSM151386     1  0.2423      0.896 0.960 0.040
#> GSM151387     2  0.6438      0.849 0.164 0.836
#> GSM151388     2  0.7602      0.772 0.220 0.780
#> GSM151389     2  0.6438      0.849 0.164 0.836
#> GSM151390     2  0.0000      0.927 0.000 1.000
#> GSM151391     2  0.3584      0.915 0.068 0.932
#> GSM151392     1  0.6887      0.822 0.816 0.184
#> GSM151393     2  0.0672      0.929 0.008 0.992
#> GSM151394     1  0.0000      0.895 1.000 0.000
#> GSM151395     2  0.2236      0.927 0.036 0.964
#> GSM151396     2  0.2236      0.927 0.036 0.964
#> GSM151397     1  0.0672      0.898 0.992 0.008
#> GSM151398     1  0.5408      0.860 0.876 0.124
#> GSM151399     2  0.1843      0.928 0.028 0.972
#> GSM151400     2  0.5408      0.879 0.124 0.876
#> GSM151401     2  0.2236      0.924 0.036 0.964
#> GSM151402     2  0.0672      0.929 0.008 0.992
#> GSM151403     2  0.6438      0.849 0.164 0.836
#> GSM151404     1  0.7299      0.803 0.796 0.204
#> GSM151405     2  0.5842      0.871 0.140 0.860
#> GSM151406     2  0.6438      0.849 0.164 0.836
#> GSM151407     2  0.5178      0.885 0.116 0.884
#> GSM151408     2  0.5178      0.885 0.116 0.884
#> GSM151409     1  0.0938      0.899 0.988 0.012
#> GSM151410     1  0.8661      0.657 0.712 0.288
#> GSM151411     1  0.0376      0.897 0.996 0.004
#> GSM151412     2  0.0938      0.930 0.012 0.988
#> GSM151413     1  0.7299      0.791 0.796 0.204
#> GSM151414     1  0.0000      0.895 1.000 0.000
#> GSM151415     1  0.0376      0.897 0.996 0.004
#> GSM151416     1  0.8661      0.657 0.712 0.288
#> GSM151417     1  0.6623      0.833 0.828 0.172
#> GSM151418     2  0.0672      0.929 0.008 0.992
#> GSM151419     1  0.0376      0.897 0.996 0.004
#> GSM151420     1  0.0000      0.895 1.000 0.000
#> GSM151421     1  0.6438      0.843 0.836 0.164
#> GSM151422     1  0.1184      0.899 0.984 0.016
#> GSM151423     2  0.0672      0.929 0.008 0.992
#> GSM151424     2  0.1414      0.929 0.020 0.980
#> GSM151425     2  0.2043      0.928 0.032 0.968
#> GSM151426     2  0.6531      0.844 0.168 0.832
#> GSM151427     2  0.0000      0.927 0.000 1.000
#> GSM151428     1  0.5946      0.848 0.856 0.144
#> GSM151429     1  0.8555      0.672 0.720 0.280
#> GSM151430     2  0.5178      0.885 0.116 0.884
#> GSM151431     2  0.5178      0.885 0.116 0.884
#> GSM151432     1  0.0938      0.899 0.988 0.012
#> GSM151433     1  0.0938      0.899 0.988 0.012
#> GSM151434     1  0.2778      0.893 0.952 0.048
#> GSM151435     1  0.0000      0.895 1.000 0.000
#> GSM151436     2  0.0376      0.928 0.004 0.996
#> GSM151437     1  0.0000      0.895 1.000 0.000
#> GSM151438     1  0.0938      0.899 0.988 0.012
#> GSM151439     1  0.6048      0.845 0.852 0.148
#> GSM151440     2  0.1633      0.927 0.024 0.976

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>           class entropy silhouette    p1    p2    p3
#> GSM151369     1  0.5335      0.788 0.760 0.232 0.008
#> GSM151370     2  0.3802      0.583 0.080 0.888 0.032
#> GSM151371     1  0.4692      0.827 0.820 0.168 0.012
#> GSM151372     3  0.6215      0.714 0.000 0.428 0.572
#> GSM151373     2  0.6280     -0.280 0.000 0.540 0.460
#> GSM151374     3  0.5254      0.880 0.000 0.264 0.736
#> GSM151375     2  0.6079     -0.031 0.000 0.612 0.388
#> GSM151376     2  0.6079     -0.031 0.000 0.612 0.388
#> GSM151377     3  0.5621      0.895 0.000 0.308 0.692
#> GSM151378     2  0.6299     -0.287 0.000 0.524 0.476
#> GSM151379     2  0.6299     -0.287 0.000 0.524 0.476
#> GSM151380     1  0.6935      0.673 0.652 0.312 0.036
#> GSM151381     2  0.4887      0.414 0.000 0.772 0.228
#> GSM151382     2  0.6180     -0.206 0.000 0.584 0.416
#> GSM151383     2  0.7815      0.461 0.148 0.672 0.180
#> GSM151384     1  0.1411      0.882 0.964 0.036 0.000
#> GSM151385     1  0.0237      0.877 0.996 0.000 0.004
#> GSM151386     1  0.1964      0.880 0.944 0.056 0.000
#> GSM151387     2  0.2772      0.591 0.080 0.916 0.004
#> GSM151388     2  0.4261      0.542 0.140 0.848 0.012
#> GSM151389     2  0.2772      0.591 0.080 0.916 0.004
#> GSM151390     2  0.6079     -0.031 0.000 0.612 0.388
#> GSM151391     2  0.5315      0.473 0.012 0.772 0.216
#> GSM151392     1  0.5335      0.788 0.760 0.232 0.008
#> GSM151393     3  0.5785      0.892 0.000 0.332 0.668
#> GSM151394     1  0.0237      0.877 0.996 0.000 0.004
#> GSM151395     2  0.3293      0.573 0.012 0.900 0.088
#> GSM151396     2  0.3293      0.573 0.012 0.900 0.088
#> GSM151397     1  0.0424      0.881 0.992 0.008 0.000
#> GSM151398     1  0.4228      0.841 0.844 0.148 0.008
#> GSM151399     2  0.2945      0.572 0.004 0.908 0.088
#> GSM151400     2  0.6143      0.473 0.012 0.684 0.304
#> GSM151401     2  0.5939      0.441 0.028 0.748 0.224
#> GSM151402     3  0.5785      0.892 0.000 0.332 0.668
#> GSM151403     2  0.2772      0.591 0.080 0.916 0.004
#> GSM151404     1  0.5502      0.773 0.744 0.248 0.008
#> GSM151405     2  0.3253      0.594 0.052 0.912 0.036
#> GSM151406     2  0.2860      0.591 0.084 0.912 0.004
#> GSM151407     2  0.5815      0.478 0.004 0.692 0.304
#> GSM151408     2  0.5815      0.478 0.004 0.692 0.304
#> GSM151409     1  0.0747      0.882 0.984 0.016 0.000
#> GSM151410     1  0.6750      0.617 0.640 0.336 0.024
#> GSM151411     1  0.0661      0.880 0.988 0.008 0.004
#> GSM151412     2  0.4233      0.510 0.004 0.836 0.160
#> GSM151413     1  0.7298      0.716 0.700 0.100 0.200
#> GSM151414     1  0.0237      0.877 0.996 0.000 0.004
#> GSM151415     1  0.0424      0.881 0.992 0.008 0.000
#> GSM151416     1  0.6750      0.617 0.640 0.336 0.024
#> GSM151417     1  0.5384      0.815 0.788 0.188 0.024
#> GSM151418     3  0.5621      0.895 0.000 0.308 0.692
#> GSM151419     1  0.0424      0.881 0.992 0.008 0.000
#> GSM151420     1  0.0237      0.877 0.996 0.000 0.004
#> GSM151421     1  0.4645      0.826 0.816 0.176 0.008
#> GSM151422     1  0.1163      0.883 0.972 0.028 0.000
#> GSM151423     3  0.5591      0.898 0.000 0.304 0.696
#> GSM151424     2  0.3412      0.564 0.000 0.876 0.124
#> GSM151425     2  0.3129      0.570 0.008 0.904 0.088
#> GSM151426     2  0.2945      0.588 0.088 0.908 0.004
#> GSM151427     2  0.6299     -0.287 0.000 0.524 0.476
#> GSM151428     1  0.4805      0.822 0.812 0.176 0.012
#> GSM151429     1  0.6702      0.630 0.648 0.328 0.024
#> GSM151430     2  0.5815      0.478 0.004 0.692 0.304
#> GSM151431     2  0.5815      0.478 0.004 0.692 0.304
#> GSM151432     1  0.0747      0.882 0.984 0.016 0.000
#> GSM151433     1  0.0747      0.882 0.984 0.016 0.000
#> GSM151434     1  0.2261      0.875 0.932 0.068 0.000
#> GSM151435     1  0.0237      0.877 0.996 0.000 0.004
#> GSM151436     2  0.5058      0.382 0.000 0.756 0.244
#> GSM151437     1  0.0237      0.877 0.996 0.000 0.004
#> GSM151438     1  0.0747      0.882 0.984 0.016 0.000
#> GSM151439     1  0.4121      0.828 0.832 0.168 0.000
#> GSM151440     2  0.5858      0.411 0.020 0.740 0.240

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM151369     1  0.4386     0.5599 0.820 0.108 0.068 0.004
#> GSM151370     2  0.7001     0.6240 0.116 0.464 0.420 0.000
#> GSM151371     1  0.4277     0.5543 0.824 0.116 0.004 0.056
#> GSM151372     3  0.4469     0.5623 0.012 0.128 0.816 0.044
#> GSM151373     3  0.0657     0.6047 0.000 0.012 0.984 0.004
#> GSM151374     3  0.5650     0.5042 0.000 0.180 0.716 0.104
#> GSM151375     3  0.1867     0.5865 0.000 0.072 0.928 0.000
#> GSM151376     3  0.1867     0.5865 0.000 0.072 0.928 0.000
#> GSM151377     3  0.5610     0.5071 0.000 0.176 0.720 0.104
#> GSM151378     3  0.1109     0.6028 0.000 0.028 0.968 0.004
#> GSM151379     3  0.1109     0.6028 0.000 0.028 0.968 0.004
#> GSM151380     1  0.5643     0.5112 0.712 0.212 0.072 0.004
#> GSM151381     3  0.4635     0.3993 0.028 0.216 0.756 0.000
#> GSM151382     3  0.1284     0.5991 0.012 0.024 0.964 0.000
#> GSM151383     2  0.7418     0.5822 0.120 0.596 0.248 0.036
#> GSM151384     1  0.1118     0.5103 0.964 0.000 0.000 0.036
#> GSM151385     4  0.4761     0.8298 0.372 0.000 0.000 0.628
#> GSM151386     1  0.1786     0.5263 0.948 0.008 0.008 0.036
#> GSM151387     2  0.7044     0.6076 0.120 0.452 0.428 0.000
#> GSM151388     2  0.7463     0.5937 0.180 0.456 0.364 0.000
#> GSM151389     2  0.7044     0.6076 0.120 0.452 0.428 0.000
#> GSM151390     3  0.1867     0.5865 0.000 0.072 0.928 0.000
#> GSM151391     3  0.5686     0.0821 0.028 0.352 0.616 0.004
#> GSM151392     1  0.4386     0.5599 0.820 0.108 0.068 0.004
#> GSM151393     3  0.5339     0.5295 0.000 0.156 0.744 0.100
#> GSM151394     4  0.4843     0.8256 0.396 0.000 0.000 0.604
#> GSM151395     3  0.6097    -0.1182 0.056 0.364 0.580 0.000
#> GSM151396     3  0.6097    -0.1182 0.056 0.364 0.580 0.000
#> GSM151397     1  0.4998    -0.6027 0.512 0.000 0.000 0.488
#> GSM151398     1  0.6987     0.3477 0.652 0.068 0.064 0.216
#> GSM151399     3  0.5699    -0.1171 0.032 0.380 0.588 0.000
#> GSM151400     2  0.4873     0.5448 0.020 0.788 0.156 0.036
#> GSM151401     3  0.4951     0.3640 0.044 0.212 0.744 0.000
#> GSM151402     3  0.5339     0.5295 0.000 0.156 0.744 0.100
#> GSM151403     2  0.7044     0.6076 0.120 0.452 0.428 0.000
#> GSM151404     1  0.4752     0.5587 0.800 0.124 0.068 0.008
#> GSM151405     2  0.6709     0.5788 0.088 0.460 0.452 0.000
#> GSM151406     2  0.7083     0.6047 0.124 0.444 0.432 0.000
#> GSM151407     2  0.4283     0.5988 0.000 0.740 0.256 0.004
#> GSM151408     2  0.4283     0.5988 0.000 0.740 0.256 0.004
#> GSM151409     1  0.4776    -0.2209 0.624 0.000 0.000 0.376
#> GSM151410     1  0.5962     0.4784 0.676 0.264 0.032 0.028
#> GSM151411     1  0.4898    -0.3608 0.584 0.000 0.000 0.416
#> GSM151412     3  0.5010     0.2330 0.024 0.276 0.700 0.000
#> GSM151413     4  0.6434     0.3255 0.116 0.200 0.012 0.672
#> GSM151414     4  0.4585     0.7927 0.332 0.000 0.000 0.668
#> GSM151415     1  0.4898    -0.3948 0.584 0.000 0.000 0.416
#> GSM151416     1  0.5962     0.4784 0.676 0.264 0.032 0.028
#> GSM151417     1  0.3687     0.5613 0.856 0.080 0.064 0.000
#> GSM151418     3  0.5610     0.5071 0.000 0.176 0.720 0.104
#> GSM151419     4  0.4925     0.7616 0.428 0.000 0.000 0.572
#> GSM151420     4  0.4843     0.8256 0.396 0.000 0.000 0.604
#> GSM151421     1  0.3144     0.5517 0.884 0.044 0.072 0.000
#> GSM151422     1  0.4072     0.1596 0.748 0.000 0.000 0.252
#> GSM151423     3  0.5473     0.5166 0.000 0.192 0.724 0.084
#> GSM151424     3  0.5707    -0.0561 0.020 0.372 0.600 0.008
#> GSM151425     3  0.5943    -0.1028 0.048 0.360 0.592 0.000
#> GSM151426     2  0.7115     0.6101 0.128 0.452 0.420 0.000
#> GSM151427     3  0.1109     0.6028 0.000 0.028 0.968 0.004
#> GSM151428     1  0.4145     0.5575 0.828 0.124 0.004 0.044
#> GSM151429     1  0.5907     0.4826 0.684 0.256 0.032 0.028
#> GSM151430     2  0.4283     0.5988 0.000 0.740 0.256 0.004
#> GSM151431     2  0.4283     0.5988 0.000 0.740 0.256 0.004
#> GSM151432     1  0.4776    -0.2209 0.624 0.000 0.000 0.376
#> GSM151433     1  0.4776    -0.2209 0.624 0.000 0.000 0.376
#> GSM151434     1  0.1209     0.5205 0.964 0.004 0.000 0.032
#> GSM151435     4  0.4730     0.8267 0.364 0.000 0.000 0.636
#> GSM151436     3  0.4019     0.4392 0.012 0.196 0.792 0.000
#> GSM151437     4  0.4843     0.8256 0.396 0.000 0.000 0.604
#> GSM151438     1  0.4985    -0.5566 0.532 0.000 0.000 0.468
#> GSM151439     1  0.3809     0.5479 0.864 0.080 0.024 0.032
#> GSM151440     3  0.4579     0.4089 0.032 0.200 0.768 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
#> GSM151369     5   0.350     0.7477 0.000 0.004 0.040 0.124 0.832
#> GSM151370     4   0.599     0.5764 0.000 0.000 0.384 0.500 0.116
#> GSM151371     5   0.412     0.7085 0.104 0.000 0.000 0.108 0.788
#> GSM151372     3   0.411     0.5440 0.000 0.044 0.792 0.152 0.012
#> GSM151373     3   0.147     0.5758 0.000 0.016 0.948 0.036 0.000
#> GSM151374     3   0.531     0.4556 0.000 0.136 0.672 0.192 0.000
#> GSM151375     3   0.205     0.5556 0.000 0.004 0.912 0.080 0.004
#> GSM151376     3   0.205     0.5556 0.000 0.004 0.912 0.080 0.004
#> GSM151377     3   0.542     0.4879 0.000 0.112 0.664 0.220 0.004
#> GSM151378     3   0.191     0.5677 0.000 0.044 0.928 0.028 0.000
#> GSM151379     3   0.191     0.5677 0.000 0.044 0.928 0.028 0.000
#> GSM151380     5   0.454     0.6959 0.000 0.004 0.044 0.228 0.724
#> GSM151381     3   0.427     0.3653 0.000 0.000 0.732 0.232 0.036
#> GSM151382     3   0.161     0.5691 0.000 0.004 0.944 0.040 0.012
#> GSM151383     4   0.682     0.5242 0.048 0.020 0.216 0.608 0.108
#> GSM151384     5   0.157     0.6801 0.060 0.004 0.000 0.000 0.936
#> GSM151385     1   0.152     0.6036 0.944 0.012 0.000 0.000 0.044
#> GSM151386     5   0.186     0.6988 0.044 0.008 0.004 0.008 0.936
#> GSM151387     4   0.616     0.5650 0.000 0.000 0.388 0.476 0.136
#> GSM151388     4   0.642     0.5533 0.000 0.000 0.324 0.484 0.192
#> GSM151389     4   0.616     0.5650 0.000 0.000 0.388 0.476 0.136
#> GSM151390     3   0.205     0.5556 0.000 0.004 0.912 0.080 0.004
#> GSM151391     3   0.622     0.0158 0.000 0.060 0.532 0.368 0.040
#> GSM151392     5   0.350     0.7477 0.000 0.004 0.040 0.124 0.832
#> GSM151393     3   0.527     0.5025 0.000 0.132 0.676 0.192 0.000
#> GSM151394     1   0.161     0.6423 0.928 0.000 0.000 0.000 0.072
#> GSM151395     3   0.559    -0.1769 0.000 0.004 0.500 0.436 0.060
#> GSM151396     3   0.559    -0.1769 0.000 0.004 0.500 0.436 0.060
#> GSM151397     1   0.355     0.6240 0.760 0.004 0.000 0.000 0.236
#> GSM151398     5   0.652     0.2356 0.328 0.004 0.032 0.092 0.544
#> GSM151399     3   0.525    -0.1739 0.000 0.004 0.508 0.452 0.036
#> GSM151400     4   0.554     0.2039 0.000 0.284 0.040 0.640 0.036
#> GSM151401     3   0.472     0.3208 0.000 0.004 0.704 0.244 0.048
#> GSM151402     3   0.527     0.5025 0.000 0.132 0.676 0.192 0.000
#> GSM151403     4   0.616     0.5650 0.000 0.000 0.388 0.476 0.136
#> GSM151404     5   0.384     0.7491 0.004 0.008 0.036 0.136 0.816
#> GSM151405     4   0.580     0.5378 0.000 0.000 0.416 0.492 0.092
#> GSM151406     4   0.614     0.5612 0.000 0.000 0.392 0.476 0.132
#> GSM151407     4   0.477     0.5429 0.000 0.072 0.220 0.708 0.000
#> GSM151408     4   0.477     0.5429 0.000 0.072 0.220 0.708 0.000
#> GSM151409     1   0.430     0.4531 0.520 0.000 0.000 0.000 0.480
#> GSM151410     5   0.537     0.6594 0.048 0.000 0.028 0.256 0.668
#> GSM151411     1   0.426     0.5130 0.564 0.000 0.000 0.000 0.436
#> GSM151412     3   0.466     0.1765 0.000 0.004 0.644 0.332 0.020
#> GSM151413     2   0.535     0.0000 0.280 0.632 0.000 0.088 0.000
#> GSM151414     1   0.127     0.4461 0.948 0.052 0.000 0.000 0.000
#> GSM151415     1   0.416     0.5705 0.608 0.000 0.000 0.000 0.392
#> GSM151416     5   0.537     0.6594 0.048 0.000 0.028 0.256 0.668
#> GSM151417     5   0.358     0.7468 0.016 0.000 0.032 0.116 0.836
#> GSM151418     3   0.542     0.4872 0.000 0.112 0.664 0.220 0.004
#> GSM151419     1   0.272     0.6421 0.864 0.012 0.000 0.000 0.124
#> GSM151420     1   0.161     0.6423 0.928 0.000 0.000 0.000 0.072
#> GSM151421     5   0.312     0.7331 0.012 0.004 0.040 0.068 0.876
#> GSM151422     5   0.429     0.0811 0.384 0.004 0.000 0.000 0.612
#> GSM151423     3   0.542     0.4788 0.000 0.124 0.652 0.224 0.000
#> GSM151424     3   0.545    -0.0971 0.000 0.024 0.540 0.412 0.024
#> GSM151425     3   0.549    -0.1457 0.000 0.004 0.536 0.404 0.056
#> GSM151426     4   0.618     0.5677 0.000 0.000 0.380 0.480 0.140
#> GSM151427     3   0.191     0.5677 0.000 0.044 0.928 0.028 0.000
#> GSM151428     5   0.390     0.7244 0.080 0.000 0.000 0.116 0.804
#> GSM151429     5   0.532     0.6640 0.048 0.000 0.028 0.248 0.676
#> GSM151430     4   0.477     0.5429 0.000 0.072 0.220 0.708 0.000
#> GSM151431     4   0.477     0.5429 0.000 0.072 0.220 0.708 0.000
#> GSM151432     1   0.430     0.4531 0.520 0.000 0.000 0.000 0.480
#> GSM151433     1   0.430     0.4531 0.520 0.000 0.000 0.000 0.480
#> GSM151434     5   0.164     0.6904 0.064 0.000 0.000 0.004 0.932
#> GSM151435     1   0.147     0.5920 0.948 0.016 0.000 0.000 0.036
#> GSM151436     3   0.399     0.3910 0.000 0.004 0.740 0.244 0.012
#> GSM151437     1   0.161     0.6423 0.928 0.000 0.000 0.000 0.072
#> GSM151438     1   0.348     0.6314 0.752 0.000 0.000 0.000 0.248
#> GSM151439     5   0.384     0.7205 0.064 0.000 0.016 0.092 0.828
#> GSM151440     3   0.442     0.3657 0.000 0.004 0.728 0.232 0.036

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>           class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM151369     5  0.3398     0.7372 0.000 0.152 0.004 0.020 0.812 0.012
#> GSM151370     2  0.4017     0.5283 0.000 0.796 0.008 0.092 0.088 0.016
#> GSM151371     5  0.4046     0.7158 0.112 0.088 0.000 0.012 0.784 0.004
#> GSM151372     3  0.3819     0.5576 0.000 0.316 0.672 0.012 0.000 0.000
#> GSM151373     2  0.5112    -0.3055 0.000 0.480 0.460 0.048 0.004 0.008
#> GSM151374     3  0.3167     0.6214 0.000 0.080 0.856 0.032 0.004 0.028
#> GSM151375     2  0.5014    -0.0513 0.000 0.536 0.404 0.052 0.004 0.004
#> GSM151376     2  0.5014    -0.0513 0.000 0.536 0.404 0.052 0.004 0.004
#> GSM151377     3  0.2494     0.5861 0.000 0.120 0.864 0.000 0.000 0.016
#> GSM151378     3  0.5552     0.3524 0.000 0.408 0.504 0.056 0.004 0.028
#> GSM151379     3  0.5552     0.3524 0.000 0.408 0.504 0.056 0.004 0.028
#> GSM151380     5  0.4871     0.6862 0.000 0.184 0.004 0.088 0.704 0.020
#> GSM151381     2  0.4288     0.4489 0.000 0.716 0.236 0.016 0.028 0.004
#> GSM151382     2  0.4504    -0.1771 0.000 0.536 0.432 0.032 0.000 0.000
#> GSM151383     4  0.5945     0.6790 0.048 0.252 0.000 0.596 0.096 0.008
#> GSM151384     5  0.2661     0.6618 0.096 0.004 0.004 0.008 0.876 0.012
#> GSM151385     1  0.1155     0.7037 0.956 0.000 0.000 0.004 0.004 0.036
#> GSM151386     5  0.3585     0.6661 0.096 0.016 0.004 0.008 0.832 0.044
#> GSM151387     2  0.3443     0.5787 0.000 0.828 0.012 0.028 0.120 0.012
#> GSM151388     2  0.4507     0.4593 0.000 0.736 0.004 0.064 0.176 0.020
#> GSM151389     2  0.3443     0.5787 0.000 0.828 0.012 0.028 0.120 0.012
#> GSM151390     2  0.5014    -0.0513 0.000 0.536 0.404 0.052 0.004 0.004
#> GSM151391     2  0.6221     0.3434 0.000 0.552 0.304 0.072 0.048 0.024
#> GSM151392     5  0.3398     0.7372 0.000 0.152 0.004 0.020 0.812 0.012
#> GSM151393     3  0.3479     0.6633 0.000 0.212 0.768 0.012 0.000 0.008
#> GSM151394     1  0.0405     0.7221 0.988 0.000 0.000 0.000 0.008 0.004
#> GSM151395     2  0.3741     0.5853 0.000 0.828 0.052 0.064 0.048 0.008
#> GSM151396     2  0.3741     0.5853 0.000 0.828 0.052 0.064 0.048 0.008
#> GSM151397     1  0.3003     0.7009 0.812 0.000 0.000 0.000 0.172 0.016
#> GSM151398     5  0.6123     0.1924 0.364 0.116 0.008 0.012 0.492 0.008
#> GSM151399     2  0.3317     0.5898 0.000 0.852 0.052 0.064 0.024 0.008
#> GSM151400     4  0.4169     0.2237 0.000 0.136 0.008 0.780 0.024 0.052
#> GSM151401     2  0.4326     0.4697 0.000 0.724 0.216 0.032 0.028 0.000
#> GSM151402     3  0.3479     0.6633 0.000 0.212 0.768 0.012 0.000 0.008
#> GSM151403     2  0.3443     0.5787 0.000 0.828 0.012 0.028 0.120 0.012
#> GSM151404     5  0.3776     0.7403 0.004 0.156 0.008 0.020 0.796 0.016
#> GSM151405     2  0.3609     0.5535 0.000 0.824 0.012 0.092 0.064 0.008
#> GSM151406     2  0.3422     0.5779 0.000 0.832 0.008 0.032 0.112 0.016
#> GSM151407     4  0.3290     0.8418 0.000 0.252 0.004 0.744 0.000 0.000
#> GSM151408     4  0.3290     0.8418 0.000 0.252 0.004 0.744 0.000 0.000
#> GSM151409     1  0.3930     0.4882 0.576 0.004 0.000 0.000 0.420 0.000
#> GSM151410     5  0.5381     0.6689 0.052 0.216 0.000 0.060 0.664 0.008
#> GSM151411     1  0.3965     0.5418 0.616 0.004 0.000 0.000 0.376 0.004
#> GSM151412     2  0.3334     0.5352 0.000 0.820 0.132 0.040 0.000 0.008
#> GSM151413     6  0.2809     0.0000 0.020 0.004 0.000 0.128 0.000 0.848
#> GSM151414     1  0.2362     0.5997 0.860 0.000 0.000 0.004 0.000 0.136
#> GSM151415     1  0.3668     0.6082 0.668 0.000 0.004 0.000 0.328 0.000
#> GSM151416     5  0.5381     0.6689 0.052 0.216 0.000 0.060 0.664 0.008
#> GSM151417     5  0.3862     0.7420 0.020 0.116 0.004 0.036 0.812 0.012
#> GSM151418     3  0.2623     0.5899 0.000 0.132 0.852 0.000 0.000 0.016
#> GSM151419     1  0.2579     0.7274 0.876 0.000 0.000 0.004 0.088 0.032
#> GSM151420     1  0.0405     0.7221 0.988 0.000 0.000 0.000 0.008 0.004
#> GSM151421     5  0.3185     0.7255 0.020 0.116 0.004 0.008 0.844 0.008
#> GSM151422     5  0.4360     0.1122 0.404 0.004 0.000 0.004 0.576 0.012
#> GSM151423     3  0.3095     0.6644 0.000 0.144 0.828 0.012 0.000 0.016
#> GSM151424     2  0.4893     0.5373 0.000 0.748 0.088 0.104 0.032 0.028
#> GSM151425     2  0.2840     0.5952 0.000 0.880 0.056 0.012 0.040 0.012
#> GSM151426     2  0.3479     0.5702 0.000 0.824 0.008 0.028 0.124 0.016
#> GSM151427     3  0.5552     0.3524 0.000 0.408 0.504 0.056 0.004 0.028
#> GSM151428     5  0.3815     0.7315 0.084 0.096 0.000 0.012 0.804 0.004
#> GSM151429     5  0.5329     0.6735 0.052 0.208 0.000 0.060 0.672 0.008
#> GSM151430     4  0.3290     0.8418 0.000 0.252 0.004 0.744 0.000 0.000
#> GSM151431     4  0.3290     0.8418 0.000 0.252 0.004 0.744 0.000 0.000
#> GSM151432     1  0.3930     0.4882 0.576 0.004 0.000 0.000 0.420 0.000
#> GSM151433     1  0.3930     0.4882 0.576 0.004 0.000 0.000 0.420 0.000
#> GSM151434     5  0.2132     0.6964 0.072 0.004 0.004 0.004 0.908 0.008
#> GSM151435     1  0.1364     0.6977 0.944 0.000 0.000 0.004 0.004 0.048
#> GSM151436     2  0.4013     0.4118 0.000 0.728 0.228 0.040 0.000 0.004
#> GSM151437     1  0.0405     0.7221 0.988 0.000 0.000 0.000 0.008 0.004
#> GSM151438     1  0.2979     0.7112 0.804 0.004 0.000 0.000 0.188 0.004
#> GSM151439     5  0.3646     0.7202 0.068 0.096 0.004 0.008 0.820 0.004
#> GSM151440     2  0.4321     0.4391 0.000 0.716 0.228 0.036 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-hclust-consensus-heatmap-1

consensus_heatmap(res, k = 3)

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

consensus_heatmap(res, k = 4)

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

consensus_heatmap(res, k = 5)

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

consensus_heatmap(res, k = 6)

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

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

membership_heatmap(res, k = 2)

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

membership_heatmap(res, k = 3)

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

membership_heatmap(res, k = 4)

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

membership_heatmap(res, k = 5)

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

membership_heatmap(res, k = 6)

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

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

Signature heatmaps where rows are scaled:

get_signatures(res, k = 2)

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

get_signatures(res, k = 3)

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

get_signatures(res, k = 4)

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

get_signatures(res, k = 5)

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

get_signatures(res, k = 6)

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

Signature heatmaps where rows are not scaled:

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

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

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

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

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

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

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

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

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

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

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk CV-hclust-signature_compare

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

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

An example of the output of tb is:

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

The columns in tb are:

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

UMAP plot which shows how samples are separated.

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

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

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

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

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

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

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

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

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

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

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk CV-hclust-collect-classes

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

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

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

collect_plots(res)

plot of chunk CV-kmeans-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.792           0.914       0.963         0.4725 0.532   0.532
#> 3 3 0.596           0.830       0.874         0.3870 0.757   0.561
#> 4 4 0.594           0.693       0.762         0.1182 0.907   0.728
#> 5 5 0.632           0.503       0.716         0.0633 0.955   0.834
#> 6 6 0.640           0.438       0.666         0.0468 0.921   0.692

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
#> GSM151369     1  0.6438      0.797 0.836 0.164
#> GSM151370     2  0.0000      0.959 0.000 1.000
#> GSM151371     1  0.0000      0.957 1.000 0.000
#> GSM151372     2  0.0000      0.959 0.000 1.000
#> GSM151373     2  0.0000      0.959 0.000 1.000
#> GSM151374     2  0.0000      0.959 0.000 1.000
#> GSM151375     2  0.0000      0.959 0.000 1.000
#> GSM151376     2  0.0000      0.959 0.000 1.000
#> GSM151377     2  0.0000      0.959 0.000 1.000
#> GSM151378     2  0.0000      0.959 0.000 1.000
#> GSM151379     2  0.0000      0.959 0.000 1.000
#> GSM151380     2  0.1184      0.947 0.016 0.984
#> GSM151381     2  0.0000      0.959 0.000 1.000
#> GSM151382     2  0.0000      0.959 0.000 1.000
#> GSM151383     2  0.7219      0.764 0.200 0.800
#> GSM151384     1  0.0000      0.957 1.000 0.000
#> GSM151385     1  0.0000      0.957 1.000 0.000
#> GSM151386     1  0.0000      0.957 1.000 0.000
#> GSM151387     2  0.0000      0.959 0.000 1.000
#> GSM151388     2  0.7219      0.764 0.200 0.800
#> GSM151389     2  0.0000      0.959 0.000 1.000
#> GSM151390     2  0.0000      0.959 0.000 1.000
#> GSM151391     2  0.0000      0.959 0.000 1.000
#> GSM151392     2  0.0000      0.959 0.000 1.000
#> GSM151393     2  0.0000      0.959 0.000 1.000
#> GSM151394     1  0.0000      0.957 1.000 0.000
#> GSM151395     2  0.0000      0.959 0.000 1.000
#> GSM151396     2  0.0000      0.959 0.000 1.000
#> GSM151397     1  0.0000      0.957 1.000 0.000
#> GSM151398     1  0.0000      0.957 1.000 0.000
#> GSM151399     2  0.0000      0.959 0.000 1.000
#> GSM151400     2  0.0672      0.953 0.008 0.992
#> GSM151401     2  0.0000      0.959 0.000 1.000
#> GSM151402     2  0.0000      0.959 0.000 1.000
#> GSM151403     2  0.0000      0.959 0.000 1.000
#> GSM151404     1  0.0000      0.957 1.000 0.000
#> GSM151405     2  0.0000      0.959 0.000 1.000
#> GSM151406     2  0.7219      0.764 0.200 0.800
#> GSM151407     2  0.0000      0.959 0.000 1.000
#> GSM151408     2  0.0000      0.959 0.000 1.000
#> GSM151409     1  0.0000      0.957 1.000 0.000
#> GSM151410     2  0.7219      0.764 0.200 0.800
#> GSM151411     1  0.0000      0.957 1.000 0.000
#> GSM151412     2  0.0000      0.959 0.000 1.000
#> GSM151413     1  0.7219      0.752 0.800 0.200
#> GSM151414     1  0.0000      0.957 1.000 0.000
#> GSM151415     1  0.0000      0.957 1.000 0.000
#> GSM151416     2  0.8144      0.692 0.252 0.748
#> GSM151417     1  0.7219      0.752 0.800 0.200
#> GSM151418     2  0.0000      0.959 0.000 1.000
#> GSM151419     1  0.0000      0.957 1.000 0.000
#> GSM151420     1  0.0000      0.957 1.000 0.000
#> GSM151421     2  0.9866      0.290 0.432 0.568
#> GSM151422     1  0.0000      0.957 1.000 0.000
#> GSM151423     2  0.0000      0.959 0.000 1.000
#> GSM151424     2  0.0000      0.959 0.000 1.000
#> GSM151425     2  0.0000      0.959 0.000 1.000
#> GSM151426     2  0.0000      0.959 0.000 1.000
#> GSM151427     2  0.0000      0.959 0.000 1.000
#> GSM151428     1  0.0000      0.957 1.000 0.000
#> GSM151429     2  0.7299      0.760 0.204 0.796
#> GSM151430     2  0.0000      0.959 0.000 1.000
#> GSM151431     2  0.0000      0.959 0.000 1.000
#> GSM151432     1  0.0000      0.957 1.000 0.000
#> GSM151433     1  0.0000      0.957 1.000 0.000
#> GSM151434     1  0.0000      0.957 1.000 0.000
#> GSM151435     1  0.0000      0.957 1.000 0.000
#> GSM151436     2  0.0000      0.959 0.000 1.000
#> GSM151437     1  0.0000      0.957 1.000 0.000
#> GSM151438     1  0.0000      0.957 1.000 0.000
#> GSM151439     1  0.9795      0.217 0.584 0.416
#> GSM151440     2  0.0000      0.959 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
#> GSM151369     1  0.6796      0.715 0.632 0.344 0.024
#> GSM151370     2  0.4842      0.804 0.000 0.776 0.224
#> GSM151371     1  0.4121      0.865 0.832 0.168 0.000
#> GSM151372     3  0.1031      0.954 0.000 0.024 0.976
#> GSM151373     3  0.0424      0.956 0.000 0.008 0.992
#> GSM151374     3  0.0000      0.958 0.000 0.000 1.000
#> GSM151375     3  0.0237      0.958 0.000 0.004 0.996
#> GSM151376     3  0.0237      0.958 0.000 0.004 0.996
#> GSM151377     3  0.1860      0.937 0.000 0.052 0.948
#> GSM151378     3  0.0000      0.958 0.000 0.000 1.000
#> GSM151379     3  0.0000      0.958 0.000 0.000 1.000
#> GSM151380     2  0.2200      0.787 0.004 0.940 0.056
#> GSM151381     3  0.1860      0.937 0.000 0.052 0.948
#> GSM151382     3  0.0424      0.956 0.000 0.008 0.992
#> GSM151383     2  0.5407      0.806 0.040 0.804 0.156
#> GSM151384     1  0.5254      0.822 0.736 0.264 0.000
#> GSM151385     1  0.0000      0.886 1.000 0.000 0.000
#> GSM151386     1  0.5138      0.830 0.748 0.252 0.000
#> GSM151387     2  0.5560      0.760 0.000 0.700 0.300
#> GSM151388     2  0.1919      0.772 0.024 0.956 0.020
#> GSM151389     2  0.5529      0.764 0.000 0.704 0.296
#> GSM151390     3  0.0237      0.958 0.000 0.004 0.996
#> GSM151391     2  0.5327      0.780 0.000 0.728 0.272
#> GSM151392     2  0.1643      0.782 0.000 0.956 0.044
#> GSM151393     3  0.0000      0.958 0.000 0.000 1.000
#> GSM151394     1  0.0000      0.886 1.000 0.000 0.000
#> GSM151395     2  0.1411      0.783 0.000 0.964 0.036
#> GSM151396     2  0.4931      0.799 0.000 0.768 0.232
#> GSM151397     1  0.1163      0.886 0.972 0.028 0.000
#> GSM151398     1  0.5254      0.822 0.736 0.264 0.000
#> GSM151399     2  0.4654      0.808 0.000 0.792 0.208
#> GSM151400     2  0.3686      0.792 0.000 0.860 0.140
#> GSM151401     3  0.4062      0.810 0.000 0.164 0.836
#> GSM151402     3  0.0000      0.958 0.000 0.000 1.000
#> GSM151403     3  0.3267      0.868 0.000 0.116 0.884
#> GSM151404     1  0.5859      0.737 0.656 0.344 0.000
#> GSM151405     2  0.4002      0.805 0.000 0.840 0.160
#> GSM151406     2  0.5384      0.810 0.024 0.788 0.188
#> GSM151407     2  0.5810      0.718 0.000 0.664 0.336
#> GSM151408     2  0.5621      0.751 0.000 0.692 0.308
#> GSM151409     1  0.0000      0.886 1.000 0.000 0.000
#> GSM151410     2  0.2187      0.777 0.024 0.948 0.028
#> GSM151411     1  0.4346      0.862 0.816 0.184 0.000
#> GSM151412     3  0.3619      0.837 0.000 0.136 0.864
#> GSM151413     1  0.5138      0.778 0.748 0.252 0.000
#> GSM151414     1  0.0000      0.886 1.000 0.000 0.000
#> GSM151415     1  0.0000      0.886 1.000 0.000 0.000
#> GSM151416     2  0.2383      0.759 0.044 0.940 0.016
#> GSM151417     2  0.6111     -0.164 0.396 0.604 0.000
#> GSM151418     3  0.1860      0.937 0.000 0.052 0.948
#> GSM151419     1  0.0000      0.886 1.000 0.000 0.000
#> GSM151420     1  0.0000      0.886 1.000 0.000 0.000
#> GSM151421     2  0.1711      0.762 0.032 0.960 0.008
#> GSM151422     1  0.3482      0.874 0.872 0.128 0.000
#> GSM151423     3  0.1289      0.948 0.000 0.032 0.968
#> GSM151424     2  0.6026      0.659 0.000 0.624 0.376
#> GSM151425     2  0.4931      0.799 0.000 0.768 0.232
#> GSM151426     2  0.4750      0.805 0.000 0.784 0.216
#> GSM151427     3  0.0000      0.958 0.000 0.000 1.000
#> GSM151428     1  0.4121      0.865 0.832 0.168 0.000
#> GSM151429     2  0.2846      0.752 0.056 0.924 0.020
#> GSM151430     2  0.5621      0.751 0.000 0.692 0.308
#> GSM151431     2  0.5621      0.751 0.000 0.692 0.308
#> GSM151432     1  0.4346      0.862 0.816 0.184 0.000
#> GSM151433     1  0.1163      0.888 0.972 0.028 0.000
#> GSM151434     1  0.5016      0.837 0.760 0.240 0.000
#> GSM151435     1  0.0000      0.886 1.000 0.000 0.000
#> GSM151436     3  0.1031      0.954 0.000 0.024 0.976
#> GSM151437     1  0.0000      0.886 1.000 0.000 0.000
#> GSM151438     1  0.1411      0.885 0.964 0.036 0.000
#> GSM151439     2  0.4733      0.569 0.196 0.800 0.004
#> GSM151440     2  0.4654      0.807 0.000 0.792 0.208

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM151369     4  0.6733      0.613 0.344 0.092 0.004 0.560
#> GSM151370     2  0.2256      0.841 0.000 0.924 0.020 0.056
#> GSM151371     1  0.4985     -0.376 0.532 0.000 0.000 0.468
#> GSM151372     3  0.2256      0.886 0.000 0.056 0.924 0.020
#> GSM151373     3  0.1284      0.889 0.000 0.024 0.964 0.012
#> GSM151374     3  0.1978      0.886 0.000 0.004 0.928 0.068
#> GSM151375     3  0.1610      0.895 0.000 0.016 0.952 0.032
#> GSM151376     3  0.1610      0.895 0.000 0.016 0.952 0.032
#> GSM151377     3  0.4181      0.863 0.000 0.052 0.820 0.128
#> GSM151378     3  0.0937      0.891 0.000 0.012 0.976 0.012
#> GSM151379     3  0.1059      0.891 0.000 0.012 0.972 0.016
#> GSM151380     2  0.3447      0.819 0.000 0.852 0.020 0.128
#> GSM151381     3  0.5361      0.813 0.000 0.108 0.744 0.148
#> GSM151382     3  0.1820      0.884 0.000 0.036 0.944 0.020
#> GSM151383     2  0.4919      0.793 0.028 0.752 0.008 0.212
#> GSM151384     4  0.6090      0.626 0.384 0.052 0.000 0.564
#> GSM151385     1  0.0000      0.714 1.000 0.000 0.000 0.000
#> GSM151386     4  0.5691      0.601 0.408 0.028 0.000 0.564
#> GSM151387     2  0.3081      0.838 0.000 0.888 0.064 0.048
#> GSM151388     2  0.2654      0.823 0.004 0.888 0.000 0.108
#> GSM151389     2  0.3245      0.836 0.000 0.880 0.064 0.056
#> GSM151390     3  0.1854      0.894 0.000 0.012 0.940 0.048
#> GSM151391     2  0.2739      0.843 0.000 0.904 0.036 0.060
#> GSM151392     2  0.3494      0.805 0.000 0.824 0.004 0.172
#> GSM151393     3  0.2760      0.876 0.000 0.000 0.872 0.128
#> GSM151394     1  0.3311      0.554 0.828 0.000 0.000 0.172
#> GSM151395     2  0.3074      0.820 0.000 0.848 0.000 0.152
#> GSM151396     2  0.4440      0.800 0.000 0.804 0.060 0.136
#> GSM151397     1  0.3681      0.545 0.816 0.008 0.000 0.176
#> GSM151398     4  0.6464      0.618 0.384 0.076 0.000 0.540
#> GSM151399     2  0.3088      0.827 0.000 0.864 0.008 0.128
#> GSM151400     2  0.4916      0.814 0.000 0.760 0.056 0.184
#> GSM151401     3  0.5716      0.695 0.000 0.252 0.680 0.068
#> GSM151402     3  0.2704      0.877 0.000 0.000 0.876 0.124
#> GSM151403     3  0.6167      0.713 0.000 0.220 0.664 0.116
#> GSM151404     4  0.6704      0.608 0.336 0.092 0.004 0.568
#> GSM151405     2  0.2722      0.840 0.000 0.904 0.032 0.064
#> GSM151406     2  0.4144      0.823 0.004 0.816 0.028 0.152
#> GSM151407     2  0.6011      0.724 0.000 0.688 0.180 0.132
#> GSM151408     2  0.5119      0.791 0.000 0.764 0.112 0.124
#> GSM151409     1  0.3311      0.554 0.828 0.000 0.000 0.172
#> GSM151410     2  0.4011      0.803 0.008 0.784 0.000 0.208
#> GSM151411     4  0.4992      0.474 0.476 0.000 0.000 0.524
#> GSM151412     3  0.5923      0.660 0.000 0.216 0.684 0.100
#> GSM151413     1  0.6341      0.328 0.652 0.136 0.000 0.212
#> GSM151414     1  0.0000      0.714 1.000 0.000 0.000 0.000
#> GSM151415     1  0.0592      0.709 0.984 0.000 0.000 0.016
#> GSM151416     2  0.3448      0.792 0.004 0.828 0.000 0.168
#> GSM151417     4  0.7016      0.497 0.176 0.252 0.000 0.572
#> GSM151418     3  0.4832      0.844 0.000 0.056 0.768 0.176
#> GSM151419     1  0.0000      0.714 1.000 0.000 0.000 0.000
#> GSM151420     1  0.0000      0.714 1.000 0.000 0.000 0.000
#> GSM151421     4  0.4957      0.282 0.004 0.336 0.004 0.656
#> GSM151422     4  0.5688      0.501 0.464 0.024 0.000 0.512
#> GSM151423     3  0.3787      0.868 0.000 0.036 0.840 0.124
#> GSM151424     2  0.6184      0.683 0.000 0.664 0.216 0.120
#> GSM151425     2  0.4410      0.797 0.000 0.808 0.064 0.128
#> GSM151426     2  0.1151      0.844 0.000 0.968 0.008 0.024
#> GSM151427     3  0.1059      0.891 0.000 0.012 0.972 0.016
#> GSM151428     1  0.4989     -0.387 0.528 0.000 0.000 0.472
#> GSM151429     2  0.4364      0.774 0.016 0.764 0.000 0.220
#> GSM151430     2  0.5119      0.791 0.000 0.764 0.112 0.124
#> GSM151431     2  0.5119      0.791 0.000 0.764 0.112 0.124
#> GSM151432     4  0.4992      0.472 0.476 0.000 0.000 0.524
#> GSM151433     1  0.4977     -0.351 0.540 0.000 0.000 0.460
#> GSM151434     4  0.5649      0.610 0.392 0.028 0.000 0.580
#> GSM151435     1  0.0000      0.714 1.000 0.000 0.000 0.000
#> GSM151436     3  0.2363      0.884 0.000 0.056 0.920 0.024
#> GSM151437     1  0.0000      0.714 1.000 0.000 0.000 0.000
#> GSM151438     1  0.2345      0.637 0.900 0.000 0.000 0.100
#> GSM151439     4  0.6087      0.422 0.084 0.244 0.004 0.668
#> GSM151440     2  0.5653      0.755 0.000 0.712 0.096 0.192

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>           class entropy silhouette    p1    p2    p3    p4    p5
#> GSM151369     2  0.6782      0.577 0.164 0.592 0.000 0.064 0.180
#> GSM151370     4  0.4654      0.398 0.000 0.008 0.012 0.632 0.348
#> GSM151371     2  0.4251      0.581 0.372 0.624 0.000 0.004 0.000
#> GSM151372     3  0.3149      0.711 0.000 0.020 0.872 0.072 0.036
#> GSM151373     3  0.1710      0.731 0.000 0.004 0.940 0.040 0.016
#> GSM151374     3  0.3115      0.723 0.000 0.036 0.852 0.000 0.112
#> GSM151375     3  0.2179      0.743 0.000 0.000 0.888 0.000 0.112
#> GSM151376     3  0.2179      0.743 0.000 0.000 0.888 0.000 0.112
#> GSM151377     3  0.5319      0.657 0.000 0.060 0.652 0.012 0.276
#> GSM151378     3  0.0000      0.746 0.000 0.000 1.000 0.000 0.000
#> GSM151379     3  0.0162      0.745 0.000 0.004 0.996 0.000 0.000
#> GSM151380     4  0.5849      0.310 0.000 0.080 0.008 0.540 0.372
#> GSM151381     3  0.5304      0.325 0.000 0.008 0.548 0.036 0.408
#> GSM151382     3  0.1830      0.722 0.000 0.004 0.932 0.052 0.012
#> GSM151383     4  0.3122      0.463 0.000 0.120 0.004 0.852 0.024
#> GSM151384     2  0.4832      0.656 0.216 0.716 0.000 0.008 0.060
#> GSM151385     1  0.0000      0.784 1.000 0.000 0.000 0.000 0.000
#> GSM151386     2  0.4951      0.654 0.224 0.704 0.000 0.008 0.064
#> GSM151387     4  0.4691      0.405 0.000 0.004 0.020 0.636 0.340
#> GSM151388     4  0.5213      0.414 0.004 0.056 0.000 0.628 0.312
#> GSM151389     4  0.4804      0.380 0.000 0.008 0.016 0.612 0.364
#> GSM151390     3  0.2561      0.738 0.000 0.000 0.856 0.000 0.144
#> GSM151391     4  0.4623      0.420 0.000 0.012 0.008 0.640 0.340
#> GSM151392     4  0.5890      0.296 0.000 0.092 0.004 0.524 0.380
#> GSM151393     3  0.4461      0.684 0.000 0.052 0.728 0.000 0.220
#> GSM151394     1  0.3895      0.282 0.680 0.320 0.000 0.000 0.000
#> GSM151395     4  0.6134      0.299 0.000 0.132 0.004 0.540 0.324
#> GSM151396     4  0.6686      0.260 0.000 0.124 0.032 0.516 0.328
#> GSM151397     1  0.4268      0.549 0.728 0.244 0.000 0.004 0.024
#> GSM151398     2  0.6442      0.608 0.196 0.620 0.000 0.052 0.132
#> GSM151399     4  0.5929      0.320 0.000 0.116 0.004 0.572 0.308
#> GSM151400     4  0.4976      0.440 0.000 0.088 0.012 0.728 0.172
#> GSM151401     3  0.7141      0.216 0.000 0.068 0.528 0.144 0.260
#> GSM151402     3  0.4490      0.684 0.000 0.052 0.724 0.000 0.224
#> GSM151403     5  0.6168     -0.264 0.000 0.008 0.412 0.104 0.476
#> GSM151404     2  0.6685      0.569 0.152 0.600 0.000 0.060 0.188
#> GSM151405     4  0.4683      0.393 0.000 0.008 0.012 0.624 0.356
#> GSM151406     5  0.5752     -0.505 0.000 0.056 0.012 0.452 0.480
#> GSM151407     4  0.3053      0.415 0.000 0.012 0.128 0.852 0.008
#> GSM151408     4  0.2354      0.460 0.000 0.012 0.076 0.904 0.008
#> GSM151409     1  0.3932      0.277 0.672 0.328 0.000 0.000 0.000
#> GSM151410     4  0.2536      0.471 0.004 0.128 0.000 0.868 0.000
#> GSM151411     2  0.4030      0.603 0.352 0.648 0.000 0.000 0.000
#> GSM151412     3  0.7519      0.129 0.000 0.072 0.480 0.204 0.244
#> GSM151413     1  0.7315      0.366 0.548 0.188 0.000 0.144 0.120
#> GSM151414     1  0.0000      0.784 1.000 0.000 0.000 0.000 0.000
#> GSM151415     1  0.2605      0.696 0.852 0.148 0.000 0.000 0.000
#> GSM151416     4  0.5487      0.451 0.004 0.132 0.000 0.664 0.200
#> GSM151417     2  0.6425      0.545 0.084 0.644 0.000 0.136 0.136
#> GSM151418     3  0.5850      0.561 0.000 0.072 0.544 0.012 0.372
#> GSM151419     1  0.0000      0.784 1.000 0.000 0.000 0.000 0.000
#> GSM151420     1  0.0404      0.782 0.988 0.012 0.000 0.000 0.000
#> GSM151421     2  0.5455      0.339 0.000 0.624 0.004 0.080 0.292
#> GSM151422     2  0.5236      0.608 0.280 0.652 0.000 0.008 0.060
#> GSM151423     3  0.5275      0.659 0.000 0.060 0.660 0.012 0.268
#> GSM151424     4  0.7475      0.184 0.000 0.096 0.120 0.456 0.328
#> GSM151425     4  0.6746      0.227 0.000 0.120 0.032 0.476 0.372
#> GSM151426     4  0.4521      0.417 0.000 0.012 0.008 0.664 0.316
#> GSM151427     3  0.0451      0.744 0.000 0.004 0.988 0.008 0.000
#> GSM151428     2  0.4341      0.589 0.364 0.628 0.000 0.008 0.000
#> GSM151429     4  0.6034      0.420 0.012 0.244 0.000 0.608 0.136
#> GSM151430     4  0.2354      0.460 0.000 0.012 0.076 0.904 0.008
#> GSM151431     4  0.2354      0.460 0.000 0.012 0.076 0.904 0.008
#> GSM151432     2  0.4015      0.606 0.348 0.652 0.000 0.000 0.000
#> GSM151433     2  0.4150      0.561 0.388 0.612 0.000 0.000 0.000
#> GSM151434     2  0.4769      0.654 0.200 0.728 0.000 0.008 0.064
#> GSM151435     1  0.0000      0.784 1.000 0.000 0.000 0.000 0.000
#> GSM151436     3  0.4148      0.669 0.000 0.032 0.816 0.072 0.080
#> GSM151437     1  0.0404      0.782 0.988 0.012 0.000 0.000 0.000
#> GSM151438     1  0.3606      0.659 0.808 0.164 0.000 0.004 0.024
#> GSM151439     2  0.5714      0.424 0.032 0.644 0.000 0.064 0.260
#> GSM151440     4  0.7646      0.193 0.000 0.192 0.068 0.412 0.328

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>           class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM151369     6  0.6715     0.5318 0.080 0.088 0.000 0.052 0.196 0.584
#> GSM151370     5  0.0405     0.4588 0.000 0.000 0.008 0.004 0.988 0.000
#> GSM151371     6  0.3997     0.5551 0.292 0.004 0.000 0.008 0.008 0.688
#> GSM151372     3  0.3769     0.4178 0.000 0.080 0.820 0.060 0.004 0.036
#> GSM151373     3  0.1370     0.4741 0.000 0.012 0.948 0.036 0.000 0.004
#> GSM151374     3  0.2996    -0.0831 0.000 0.228 0.772 0.000 0.000 0.000
#> GSM151375     3  0.2781     0.3905 0.000 0.108 0.860 0.008 0.024 0.000
#> GSM151376     3  0.2781     0.3905 0.000 0.108 0.860 0.008 0.024 0.000
#> GSM151377     2  0.4114     0.8812 0.000 0.532 0.460 0.000 0.004 0.004
#> GSM151378     3  0.0767     0.4597 0.000 0.004 0.976 0.012 0.008 0.000
#> GSM151379     3  0.1116     0.4611 0.000 0.004 0.960 0.028 0.008 0.000
#> GSM151380     5  0.3748     0.3883 0.000 0.068 0.004 0.048 0.824 0.056
#> GSM151381     3  0.6810    -0.2494 0.000 0.316 0.356 0.024 0.296 0.008
#> GSM151382     3  0.1851     0.4697 0.000 0.012 0.924 0.056 0.004 0.004
#> GSM151383     4  0.4993     0.7889 0.004 0.000 0.000 0.600 0.316 0.080
#> GSM151384     6  0.4361     0.6189 0.120 0.080 0.000 0.028 0.004 0.768
#> GSM151385     1  0.0291     0.7760 0.992 0.004 0.000 0.004 0.000 0.000
#> GSM151386     6  0.4375     0.6167 0.128 0.080 0.000 0.032 0.000 0.760
#> GSM151387     5  0.0862     0.4518 0.000 0.004 0.008 0.016 0.972 0.000
#> GSM151388     5  0.1268     0.4460 0.000 0.004 0.000 0.008 0.952 0.036
#> GSM151389     5  0.0653     0.4580 0.000 0.004 0.012 0.004 0.980 0.000
#> GSM151390     3  0.3183     0.2673 0.000 0.164 0.812 0.008 0.016 0.000
#> GSM151391     5  0.3204     0.3188 0.000 0.112 0.004 0.052 0.832 0.000
#> GSM151392     5  0.3479     0.4019 0.000 0.072 0.004 0.048 0.840 0.036
#> GSM151393     3  0.3950    -0.7185 0.000 0.432 0.564 0.004 0.000 0.000
#> GSM151394     1  0.3684     0.3396 0.664 0.004 0.000 0.000 0.000 0.332
#> GSM151395     5  0.7592     0.2803 0.000 0.216 0.008 0.264 0.376 0.136
#> GSM151396     5  0.8208     0.2776 0.000 0.232 0.052 0.256 0.332 0.128
#> GSM151397     1  0.4158     0.5494 0.688 0.012 0.000 0.020 0.000 0.280
#> GSM151398     6  0.6332     0.5520 0.116 0.060 0.000 0.044 0.152 0.628
#> GSM151399     5  0.7658     0.2857 0.000 0.216 0.016 0.256 0.388 0.124
#> GSM151400     4  0.6424     0.3463 0.000 0.100 0.008 0.432 0.408 0.052
#> GSM151401     3  0.7798     0.1806 0.000 0.168 0.480 0.148 0.120 0.084
#> GSM151402     3  0.3854    -0.7764 0.000 0.464 0.536 0.000 0.000 0.000
#> GSM151403     5  0.6015    -0.0949 0.000 0.240 0.256 0.008 0.496 0.000
#> GSM151404     6  0.6301     0.5199 0.064 0.064 0.000 0.044 0.224 0.604
#> GSM151405     5  0.0976     0.4701 0.000 0.016 0.008 0.008 0.968 0.000
#> GSM151406     5  0.3716     0.4636 0.000 0.052 0.016 0.068 0.832 0.032
#> GSM151407     4  0.4971     0.7986 0.000 0.000 0.096 0.604 0.300 0.000
#> GSM151408     4  0.4621     0.8379 0.000 0.000 0.056 0.612 0.332 0.000
#> GSM151409     1  0.3747     0.2214 0.604 0.000 0.000 0.000 0.000 0.396
#> GSM151410     4  0.5355     0.7437 0.004 0.000 0.000 0.536 0.356 0.104
#> GSM151411     6  0.3330     0.5615 0.284 0.000 0.000 0.000 0.000 0.716
#> GSM151412     3  0.8152     0.1171 0.000 0.240 0.376 0.212 0.092 0.080
#> GSM151413     1  0.6808     0.3494 0.488 0.104 0.000 0.296 0.008 0.104
#> GSM151414     1  0.0551     0.7753 0.984 0.008 0.000 0.004 0.004 0.000
#> GSM151415     1  0.2743     0.6862 0.828 0.008 0.000 0.000 0.000 0.164
#> GSM151416     5  0.5111     0.1021 0.004 0.024 0.000 0.152 0.692 0.128
#> GSM151417     6  0.6474     0.5405 0.036 0.128 0.004 0.148 0.064 0.620
#> GSM151418     2  0.4417     0.7846 0.000 0.588 0.384 0.000 0.024 0.004
#> GSM151419     1  0.0405     0.7769 0.988 0.000 0.000 0.008 0.000 0.004
#> GSM151420     1  0.0692     0.7740 0.976 0.004 0.000 0.000 0.000 0.020
#> GSM151421     6  0.6469     0.2252 0.000 0.244 0.004 0.156 0.060 0.536
#> GSM151422     6  0.5210     0.5529 0.220 0.068 0.000 0.048 0.000 0.664
#> GSM151423     2  0.3982     0.8806 0.000 0.536 0.460 0.000 0.004 0.000
#> GSM151424     5  0.8562     0.2313 0.000 0.236 0.108 0.260 0.284 0.112
#> GSM151425     5  0.8016     0.3111 0.000 0.220 0.044 0.224 0.384 0.128
#> GSM151426     5  0.0692     0.4490 0.000 0.000 0.004 0.020 0.976 0.000
#> GSM151427     3  0.1116     0.4611 0.000 0.004 0.960 0.028 0.008 0.000
#> GSM151428     6  0.3997     0.5551 0.292 0.004 0.000 0.008 0.008 0.688
#> GSM151429     5  0.7264    -0.0668 0.008 0.104 0.000 0.172 0.420 0.296
#> GSM151430     4  0.4660     0.8371 0.000 0.000 0.060 0.612 0.328 0.000
#> GSM151431     4  0.4567     0.8379 0.000 0.000 0.052 0.616 0.332 0.000
#> GSM151432     6  0.3448     0.5651 0.280 0.000 0.000 0.004 0.000 0.716
#> GSM151433     6  0.3482     0.5275 0.316 0.000 0.000 0.000 0.000 0.684
#> GSM151434     6  0.3971     0.6170 0.100 0.072 0.000 0.032 0.000 0.796
#> GSM151435     1  0.0436     0.7767 0.988 0.000 0.000 0.004 0.004 0.004
#> GSM151436     3  0.4674     0.3768 0.000 0.116 0.744 0.088 0.000 0.052
#> GSM151437     1  0.0692     0.7740 0.976 0.004 0.000 0.000 0.000 0.020
#> GSM151438     1  0.3806     0.6565 0.780 0.020 0.000 0.032 0.000 0.168
#> GSM151439     6  0.5936     0.3348 0.008 0.220 0.000 0.140 0.032 0.600
#> GSM151440     5  0.8810     0.1873 0.000 0.232 0.132 0.228 0.256 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) k
#> CV:kmeans 70           0.3931 2
#> CV:kmeans 71           0.0561 3
#> CV:kmeans 63           0.2140 4
#> CV:kmeans 38           0.2713 5
#> CV:kmeans 31           0.9935 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 17730 rows and 72 columns.
#>   Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'CV' method.
#>   Subgroups are detected by 'skmeans' method.
#>   Performed in total 1250 partitions by row resampling.
#>   Best k for subgroups seems to be 2.
#> 
#> Following methods can be applied to this 'ConsensusPartition' object:
#>  [1] "cola_report"             "collect_classes"         "collect_plots"          
#>  [4] "collect_stats"           "colnames"                "compare_signatures"     
#>  [7] "consensus_heatmap"       "dimension_reduction"     "functional_enrichment"  
#> [10] "get_anno_col"            "get_anno"                "get_classes"            
#> [13] "get_consensus"           "get_matrix"              "get_membership"         
#> [16] "get_param"               "get_signatures"          "get_stats"              
#> [19] "is_best_k"               "is_stable_k"             "membership_heatmap"     
#> [22] "ncol"                    "nrow"                    "plot_ecdf"              
#> [25] "rownames"                "select_partition_number" "show"                   
#> [28] "suggest_best_k"          "test_to_known_factors"

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

collect_plots(res)

plot of chunk CV-skmeans-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.837           0.905       0.962         0.5034 0.499   0.499
#> 3 3 0.685           0.833       0.896         0.3106 0.784   0.589
#> 4 4 0.687           0.697       0.840         0.0858 0.931   0.800
#> 5 5 0.725           0.719       0.839         0.0549 0.936   0.783
#> 6 6 0.674           0.648       0.777         0.0414 1.000   1.000

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

suggest_best_k(res)
#> [1] 2

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

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

show/hide code output

cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#>           class entropy silhouette    p1    p2
#> GSM151369     1   0.000      0.965 1.000 0.000
#> GSM151370     2   0.000      0.951 0.000 1.000
#> GSM151371     1   0.000      0.965 1.000 0.000
#> GSM151372     2   0.000      0.951 0.000 1.000
#> GSM151373     2   0.000      0.951 0.000 1.000
#> GSM151374     2   0.000      0.951 0.000 1.000
#> GSM151375     2   0.000      0.951 0.000 1.000
#> GSM151376     2   0.000      0.951 0.000 1.000
#> GSM151377     2   0.000      0.951 0.000 1.000
#> GSM151378     2   0.000      0.951 0.000 1.000
#> GSM151379     2   0.000      0.951 0.000 1.000
#> GSM151380     1   0.722      0.746 0.800 0.200
#> GSM151381     2   0.000      0.951 0.000 1.000
#> GSM151382     2   0.000      0.951 0.000 1.000
#> GSM151383     2   0.722      0.744 0.200 0.800
#> GSM151384     1   0.000      0.965 1.000 0.000
#> GSM151385     1   0.000      0.965 1.000 0.000
#> GSM151386     1   0.000      0.965 1.000 0.000
#> GSM151387     2   0.000      0.951 0.000 1.000
#> GSM151388     1   0.939      0.401 0.644 0.356
#> GSM151389     2   0.000      0.951 0.000 1.000
#> GSM151390     2   0.000      0.951 0.000 1.000
#> GSM151391     2   0.000      0.951 0.000 1.000
#> GSM151392     1   0.767      0.711 0.776 0.224
#> GSM151393     2   0.000      0.951 0.000 1.000
#> GSM151394     1   0.000      0.965 1.000 0.000
#> GSM151395     2   0.973      0.302 0.404 0.596
#> GSM151396     2   0.000      0.951 0.000 1.000
#> GSM151397     1   0.000      0.965 1.000 0.000
#> GSM151398     1   0.000      0.965 1.000 0.000
#> GSM151399     2   0.000      0.951 0.000 1.000
#> GSM151400     2   0.971      0.313 0.400 0.600
#> GSM151401     2   0.000      0.951 0.000 1.000
#> GSM151402     2   0.000      0.951 0.000 1.000
#> GSM151403     2   0.000      0.951 0.000 1.000
#> GSM151404     1   0.000      0.965 1.000 0.000
#> GSM151405     2   0.000      0.951 0.000 1.000
#> GSM151406     2   0.722      0.744 0.200 0.800
#> GSM151407     2   0.000      0.951 0.000 1.000
#> GSM151408     2   0.000      0.951 0.000 1.000
#> GSM151409     1   0.000      0.965 1.000 0.000
#> GSM151410     2   0.971      0.362 0.400 0.600
#> GSM151411     1   0.000      0.965 1.000 0.000
#> GSM151412     2   0.000      0.951 0.000 1.000
#> GSM151413     1   0.662      0.784 0.828 0.172
#> GSM151414     1   0.000      0.965 1.000 0.000
#> GSM151415     1   0.000      0.965 1.000 0.000
#> GSM151416     1   0.000      0.965 1.000 0.000
#> GSM151417     1   0.204      0.938 0.968 0.032
#> GSM151418     2   0.000      0.951 0.000 1.000
#> GSM151419     1   0.000      0.965 1.000 0.000
#> GSM151420     1   0.000      0.965 1.000 0.000
#> GSM151421     1   0.000      0.965 1.000 0.000
#> GSM151422     1   0.000      0.965 1.000 0.000
#> GSM151423     2   0.000      0.951 0.000 1.000
#> GSM151424     2   0.000      0.951 0.000 1.000
#> GSM151425     2   0.000      0.951 0.000 1.000
#> GSM151426     2   0.000      0.951 0.000 1.000
#> GSM151427     2   0.000      0.951 0.000 1.000
#> GSM151428     1   0.000      0.965 1.000 0.000
#> GSM151429     1   0.000      0.965 1.000 0.000
#> GSM151430     2   0.000      0.951 0.000 1.000
#> GSM151431     2   0.000      0.951 0.000 1.000
#> GSM151432     1   0.000      0.965 1.000 0.000
#> GSM151433     1   0.000      0.965 1.000 0.000
#> GSM151434     1   0.000      0.965 1.000 0.000
#> GSM151435     1   0.000      0.965 1.000 0.000
#> GSM151436     2   0.000      0.951 0.000 1.000
#> GSM151437     1   0.000      0.965 1.000 0.000
#> GSM151438     1   0.000      0.965 1.000 0.000
#> GSM151439     1   0.000      0.965 1.000 0.000
#> GSM151440     2   0.689      0.764 0.184 0.816

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>           class entropy silhouette    p1    p2    p3
#> GSM151369     1  0.4802      0.754 0.824 0.020 0.156
#> GSM151370     2  0.5098      0.708 0.000 0.752 0.248
#> GSM151371     1  0.0000      0.970 1.000 0.000 0.000
#> GSM151372     3  0.2959      0.863 0.000 0.100 0.900
#> GSM151373     3  0.3551      0.851 0.000 0.132 0.868
#> GSM151374     3  0.0237      0.883 0.000 0.004 0.996
#> GSM151375     3  0.0237      0.883 0.000 0.004 0.996
#> GSM151376     3  0.0237      0.883 0.000 0.004 0.996
#> GSM151377     3  0.0000      0.883 0.000 0.000 1.000
#> GSM151378     3  0.0237      0.883 0.000 0.004 0.996
#> GSM151379     3  0.0237      0.883 0.000 0.004 0.996
#> GSM151380     2  0.9050      0.537 0.296 0.536 0.168
#> GSM151381     3  0.0237      0.883 0.000 0.004 0.996
#> GSM151382     3  0.3267      0.860 0.000 0.116 0.884
#> GSM151383     2  0.4453      0.780 0.152 0.836 0.012
#> GSM151384     1  0.0000      0.970 1.000 0.000 0.000
#> GSM151385     1  0.0000      0.970 1.000 0.000 0.000
#> GSM151386     1  0.0000      0.970 1.000 0.000 0.000
#> GSM151387     2  0.4555      0.740 0.000 0.800 0.200
#> GSM151388     2  0.4291      0.759 0.180 0.820 0.000
#> GSM151389     3  0.5785      0.361 0.000 0.332 0.668
#> GSM151390     3  0.0237      0.883 0.000 0.004 0.996
#> GSM151391     2  0.5560      0.647 0.000 0.700 0.300
#> GSM151392     2  0.9541      0.327 0.384 0.424 0.192
#> GSM151393     3  0.0424      0.883 0.000 0.008 0.992
#> GSM151394     1  0.0000      0.970 1.000 0.000 0.000
#> GSM151395     3  0.9916      0.110 0.316 0.288 0.396
#> GSM151396     3  0.4504      0.804 0.000 0.196 0.804
#> GSM151397     1  0.0000      0.970 1.000 0.000 0.000
#> GSM151398     1  0.0000      0.970 1.000 0.000 0.000
#> GSM151399     2  0.4931      0.571 0.000 0.768 0.232
#> GSM151400     2  0.2564      0.783 0.036 0.936 0.028
#> GSM151401     3  0.3551      0.851 0.000 0.132 0.868
#> GSM151402     3  0.0237      0.883 0.000 0.004 0.996
#> GSM151403     3  0.1163      0.867 0.000 0.028 0.972
#> GSM151404     1  0.1482      0.943 0.968 0.020 0.012
#> GSM151405     2  0.5178      0.704 0.000 0.744 0.256
#> GSM151406     3  0.5147      0.711 0.180 0.020 0.800
#> GSM151407     2  0.0892      0.781 0.000 0.980 0.020
#> GSM151408     2  0.0892      0.781 0.000 0.980 0.020
#> GSM151409     1  0.0000      0.970 1.000 0.000 0.000
#> GSM151410     2  0.4178      0.767 0.172 0.828 0.000
#> GSM151411     1  0.0000      0.970 1.000 0.000 0.000
#> GSM151412     3  0.4178      0.822 0.000 0.172 0.828
#> GSM151413     1  0.4645      0.761 0.816 0.176 0.008
#> GSM151414     1  0.0000      0.970 1.000 0.000 0.000
#> GSM151415     1  0.0000      0.970 1.000 0.000 0.000
#> GSM151416     2  0.4750      0.735 0.216 0.784 0.000
#> GSM151417     1  0.4692      0.767 0.820 0.168 0.012
#> GSM151418     3  0.0000      0.883 0.000 0.000 1.000
#> GSM151419     1  0.0000      0.970 1.000 0.000 0.000
#> GSM151420     1  0.0000      0.970 1.000 0.000 0.000
#> GSM151421     1  0.2636      0.904 0.932 0.020 0.048
#> GSM151422     1  0.0000      0.970 1.000 0.000 0.000
#> GSM151423     3  0.0237      0.883 0.000 0.004 0.996
#> GSM151424     3  0.3482      0.853 0.000 0.128 0.872
#> GSM151425     3  0.4062      0.834 0.000 0.164 0.836
#> GSM151426     2  0.3038      0.777 0.000 0.896 0.104
#> GSM151427     3  0.1031      0.881 0.000 0.024 0.976
#> GSM151428     1  0.0000      0.970 1.000 0.000 0.000
#> GSM151429     2  0.5785      0.590 0.332 0.668 0.000
#> GSM151430     2  0.0892      0.781 0.000 0.980 0.020
#> GSM151431     2  0.0892      0.781 0.000 0.980 0.020
#> GSM151432     1  0.0000      0.970 1.000 0.000 0.000
#> GSM151433     1  0.0000      0.970 1.000 0.000 0.000
#> GSM151434     1  0.0000      0.970 1.000 0.000 0.000
#> GSM151435     1  0.0000      0.970 1.000 0.000 0.000
#> GSM151436     3  0.3482      0.852 0.000 0.128 0.872
#> GSM151437     1  0.0000      0.970 1.000 0.000 0.000
#> GSM151438     1  0.0000      0.970 1.000 0.000 0.000
#> GSM151439     1  0.0000      0.970 1.000 0.000 0.000
#> GSM151440     3  0.4934      0.822 0.024 0.156 0.820

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM151369     1  0.4323     0.7054 0.776 0.204 0.020 0.000
#> GSM151370     2  0.7474     0.4098 0.000 0.496 0.212 0.292
#> GSM151371     1  0.0336     0.9204 0.992 0.008 0.000 0.000
#> GSM151372     3  0.0895     0.8737 0.000 0.020 0.976 0.004
#> GSM151373     3  0.2021     0.8573 0.000 0.040 0.936 0.024
#> GSM151374     3  0.0376     0.8736 0.000 0.004 0.992 0.004
#> GSM151375     3  0.0657     0.8733 0.000 0.012 0.984 0.004
#> GSM151376     3  0.0657     0.8733 0.000 0.012 0.984 0.004
#> GSM151377     3  0.0524     0.8721 0.000 0.008 0.988 0.004
#> GSM151378     3  0.0779     0.8735 0.000 0.016 0.980 0.004
#> GSM151379     3  0.1059     0.8733 0.000 0.016 0.972 0.012
#> GSM151380     2  0.7953     0.2464 0.284 0.508 0.024 0.184
#> GSM151381     3  0.0188     0.8728 0.000 0.004 0.996 0.000
#> GSM151382     3  0.1520     0.8698 0.000 0.020 0.956 0.024
#> GSM151383     4  0.3908     0.6855 0.116 0.032 0.008 0.844
#> GSM151384     1  0.0592     0.9173 0.984 0.016 0.000 0.000
#> GSM151385     1  0.0000     0.9240 1.000 0.000 0.000 0.000
#> GSM151386     1  0.0000     0.9240 1.000 0.000 0.000 0.000
#> GSM151387     2  0.7453     0.3920 0.000 0.484 0.192 0.324
#> GSM151388     2  0.6157     0.1324 0.040 0.516 0.004 0.440
#> GSM151389     2  0.7188     0.2680 0.000 0.436 0.428 0.136
#> GSM151390     3  0.0524     0.8741 0.000 0.008 0.988 0.004
#> GSM151391     4  0.6426     0.1785 0.000 0.108 0.272 0.620
#> GSM151392     2  0.7682     0.3458 0.204 0.604 0.060 0.132
#> GSM151393     3  0.0469     0.8720 0.000 0.000 0.988 0.012
#> GSM151394     1  0.0000     0.9240 1.000 0.000 0.000 0.000
#> GSM151395     2  0.7826     0.1871 0.080 0.600 0.120 0.200
#> GSM151396     2  0.7235     0.0161 0.000 0.492 0.356 0.152
#> GSM151397     1  0.0000     0.9240 1.000 0.000 0.000 0.000
#> GSM151398     1  0.0921     0.9081 0.972 0.028 0.000 0.000
#> GSM151399     2  0.7197     0.0810 0.000 0.468 0.140 0.392
#> GSM151400     4  0.4712     0.6246 0.060 0.132 0.008 0.800
#> GSM151401     3  0.3796     0.7992 0.000 0.096 0.848 0.056
#> GSM151402     3  0.0188     0.8723 0.000 0.000 0.996 0.004
#> GSM151403     3  0.3400     0.6951 0.000 0.180 0.820 0.000
#> GSM151404     1  0.4011     0.7150 0.784 0.208 0.008 0.000
#> GSM151405     2  0.6908     0.4246 0.000 0.592 0.188 0.220
#> GSM151406     3  0.6658    -0.0516 0.044 0.428 0.508 0.020
#> GSM151407     4  0.0524     0.7303 0.000 0.004 0.008 0.988
#> GSM151408     4  0.0336     0.7325 0.000 0.000 0.008 0.992
#> GSM151409     1  0.0000     0.9240 1.000 0.000 0.000 0.000
#> GSM151410     4  0.2011     0.7188 0.080 0.000 0.000 0.920
#> GSM151411     1  0.0000     0.9240 1.000 0.000 0.000 0.000
#> GSM151412     3  0.5118     0.7014 0.000 0.176 0.752 0.072
#> GSM151413     1  0.4284     0.7191 0.780 0.020 0.000 0.200
#> GSM151414     1  0.0000     0.9240 1.000 0.000 0.000 0.000
#> GSM151415     1  0.0000     0.9240 1.000 0.000 0.000 0.000
#> GSM151416     4  0.4951     0.5625 0.212 0.044 0.000 0.744
#> GSM151417     1  0.5099     0.6872 0.748 0.048 0.004 0.200
#> GSM151418     3  0.0469     0.8731 0.000 0.012 0.988 0.000
#> GSM151419     1  0.0000     0.9240 1.000 0.000 0.000 0.000
#> GSM151420     1  0.0000     0.9240 1.000 0.000 0.000 0.000
#> GSM151421     1  0.6262     0.3537 0.560 0.392 0.032 0.016
#> GSM151422     1  0.0188     0.9222 0.996 0.004 0.000 0.000
#> GSM151423     3  0.1042     0.8658 0.000 0.008 0.972 0.020
#> GSM151424     3  0.5855     0.4356 0.000 0.356 0.600 0.044
#> GSM151425     3  0.6337     0.3539 0.000 0.380 0.552 0.068
#> GSM151426     2  0.5408     0.1356 0.000 0.500 0.012 0.488
#> GSM151427     3  0.1174     0.8725 0.000 0.012 0.968 0.020
#> GSM151428     1  0.0336     0.9204 0.992 0.008 0.000 0.000
#> GSM151429     4  0.6834     0.4409 0.240 0.164 0.000 0.596
#> GSM151430     4  0.0336     0.7325 0.000 0.000 0.008 0.992
#> GSM151431     4  0.0336     0.7325 0.000 0.000 0.008 0.992
#> GSM151432     1  0.0000     0.9240 1.000 0.000 0.000 0.000
#> GSM151433     1  0.0000     0.9240 1.000 0.000 0.000 0.000
#> GSM151434     1  0.0817     0.9109 0.976 0.024 0.000 0.000
#> GSM151435     1  0.0000     0.9240 1.000 0.000 0.000 0.000
#> GSM151436     3  0.3149     0.8226 0.000 0.088 0.880 0.032
#> GSM151437     1  0.0000     0.9240 1.000 0.000 0.000 0.000
#> GSM151438     1  0.0000     0.9240 1.000 0.000 0.000 0.000
#> GSM151439     1  0.4817     0.4444 0.612 0.388 0.000 0.000
#> GSM151440     3  0.5390     0.7221 0.024 0.144 0.768 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
#> GSM151369     1  0.4888     0.5545 0.644 0.028 0.008 0.000 0.320
#> GSM151370     5  0.6066     0.6261 0.000 0.044 0.160 0.136 0.660
#> GSM151371     1  0.0833     0.9195 0.976 0.004 0.000 0.004 0.016
#> GSM151372     3  0.2585     0.8459 0.000 0.048 0.904 0.024 0.024
#> GSM151373     3  0.3100     0.8162 0.000 0.092 0.868 0.020 0.020
#> GSM151374     3  0.0693     0.8704 0.000 0.008 0.980 0.000 0.012
#> GSM151375     3  0.0613     0.8714 0.000 0.004 0.984 0.004 0.008
#> GSM151376     3  0.0613     0.8714 0.000 0.004 0.984 0.004 0.008
#> GSM151377     3  0.1913     0.8575 0.000 0.044 0.932 0.008 0.016
#> GSM151378     3  0.0727     0.8704 0.000 0.004 0.980 0.012 0.004
#> GSM151379     3  0.1116     0.8684 0.000 0.004 0.964 0.028 0.004
#> GSM151380     5  0.3882     0.5183 0.124 0.020 0.008 0.024 0.824
#> GSM151381     3  0.1710     0.8647 0.000 0.040 0.940 0.004 0.016
#> GSM151382     3  0.2184     0.8546 0.000 0.028 0.924 0.028 0.020
#> GSM151383     4  0.3197     0.7349 0.080 0.024 0.000 0.868 0.028
#> GSM151384     1  0.2077     0.8750 0.908 0.084 0.000 0.000 0.008
#> GSM151385     1  0.0000     0.9241 1.000 0.000 0.000 0.000 0.000
#> GSM151386     1  0.1644     0.9004 0.940 0.048 0.000 0.004 0.008
#> GSM151387     5  0.6915     0.5683 0.000 0.040 0.200 0.216 0.544
#> GSM151388     5  0.5286     0.4744 0.036 0.040 0.000 0.240 0.684
#> GSM151389     5  0.5774     0.3975 0.000 0.024 0.400 0.044 0.532
#> GSM151390     3  0.0740     0.8718 0.000 0.008 0.980 0.004 0.008
#> GSM151391     4  0.7233     0.1931 0.000 0.084 0.268 0.520 0.128
#> GSM151392     5  0.4084     0.5749 0.056 0.032 0.036 0.036 0.840
#> GSM151393     3  0.2053     0.8569 0.000 0.040 0.928 0.016 0.016
#> GSM151394     1  0.0451     0.9240 0.988 0.008 0.000 0.000 0.004
#> GSM151395     2  0.3594     0.4890 0.028 0.860 0.012 0.064 0.036
#> GSM151396     2  0.3664     0.5085 0.000 0.840 0.096 0.040 0.024
#> GSM151397     1  0.0324     0.9243 0.992 0.004 0.000 0.000 0.004
#> GSM151398     1  0.1894     0.8792 0.920 0.008 0.000 0.000 0.072
#> GSM151399     2  0.6448     0.3789 0.000 0.616 0.080 0.224 0.080
#> GSM151400     4  0.5111     0.6654 0.044 0.064 0.016 0.768 0.108
#> GSM151401     3  0.4801     0.6156 0.000 0.264 0.692 0.028 0.016
#> GSM151402     3  0.1469     0.8614 0.000 0.036 0.948 0.000 0.016
#> GSM151403     3  0.3876     0.6835 0.000 0.032 0.776 0.000 0.192
#> GSM151404     1  0.4788     0.5783 0.660 0.024 0.004 0.004 0.308
#> GSM151405     5  0.6491     0.5666 0.000 0.140 0.124 0.096 0.640
#> GSM151406     5  0.7298     0.3174 0.048 0.104 0.384 0.016 0.448
#> GSM151407     4  0.1012     0.7600 0.000 0.000 0.020 0.968 0.012
#> GSM151408     4  0.0693     0.7647 0.000 0.000 0.008 0.980 0.012
#> GSM151409     1  0.0324     0.9239 0.992 0.004 0.000 0.000 0.004
#> GSM151410     4  0.2409     0.7507 0.060 0.020 0.000 0.908 0.012
#> GSM151411     1  0.0807     0.9224 0.976 0.012 0.000 0.000 0.012
#> GSM151412     3  0.5476     0.4486 0.000 0.320 0.616 0.040 0.024
#> GSM151413     1  0.4155     0.7254 0.776 0.012 0.000 0.180 0.032
#> GSM151414     1  0.0162     0.9242 0.996 0.000 0.000 0.000 0.004
#> GSM151415     1  0.0000     0.9241 1.000 0.000 0.000 0.000 0.000
#> GSM151416     4  0.6182     0.5487 0.164 0.036 0.000 0.640 0.160
#> GSM151417     1  0.5778     0.6061 0.684 0.068 0.000 0.184 0.064
#> GSM151418     3  0.2367     0.8458 0.000 0.072 0.904 0.004 0.020
#> GSM151419     1  0.0162     0.9242 0.996 0.000 0.000 0.000 0.004
#> GSM151420     1  0.0162     0.9240 0.996 0.000 0.000 0.000 0.004
#> GSM151421     2  0.5403     0.3960 0.284 0.648 0.008 0.008 0.052
#> GSM151422     1  0.0992     0.9168 0.968 0.024 0.000 0.000 0.008
#> GSM151423     3  0.1787     0.8581 0.000 0.044 0.936 0.004 0.016
#> GSM151424     2  0.5552    -0.0153 0.000 0.480 0.468 0.036 0.016
#> GSM151425     2  0.6440     0.3746 0.000 0.600 0.252 0.060 0.088
#> GSM151426     5  0.5496     0.4257 0.000 0.060 0.008 0.340 0.592
#> GSM151427     3  0.1569     0.8639 0.000 0.004 0.944 0.044 0.008
#> GSM151428     1  0.0671     0.9202 0.980 0.000 0.000 0.004 0.016
#> GSM151429     4  0.6940     0.4628 0.204 0.144 0.000 0.576 0.076
#> GSM151430     4  0.0693     0.7647 0.000 0.000 0.008 0.980 0.012
#> GSM151431     4  0.0693     0.7647 0.000 0.000 0.008 0.980 0.012
#> GSM151432     1  0.0324     0.9239 0.992 0.004 0.000 0.000 0.004
#> GSM151433     1  0.0451     0.9236 0.988 0.004 0.000 0.000 0.008
#> GSM151434     1  0.2144     0.8773 0.912 0.068 0.000 0.000 0.020
#> GSM151435     1  0.0162     0.9244 0.996 0.004 0.000 0.000 0.000
#> GSM151436     3  0.3993     0.7470 0.000 0.160 0.796 0.020 0.024
#> GSM151437     1  0.0162     0.9244 0.996 0.004 0.000 0.000 0.000
#> GSM151438     1  0.0451     0.9233 0.988 0.008 0.000 0.000 0.004
#> GSM151439     2  0.5274     0.3290 0.372 0.572 0.000 0.000 0.056
#> GSM151440     3  0.5967     0.4770 0.008 0.292 0.616 0.052 0.032

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>           class entropy silhouette    p1    p2    p3    p4    p5 p6
#> GSM151369     1  0.5865     0.2959 0.476 0.000 0.004 0.000 0.340 NA
#> GSM151370     5  0.6627     0.5995 0.000 0.052 0.148 0.108 0.608 NA
#> GSM151371     1  0.2002     0.8452 0.908 0.004 0.000 0.000 0.012 NA
#> GSM151372     3  0.4106     0.7373 0.000 0.064 0.788 0.028 0.004 NA
#> GSM151373     3  0.4243     0.6953 0.000 0.124 0.780 0.028 0.008 NA
#> GSM151374     3  0.1615     0.7780 0.000 0.004 0.928 0.000 0.004 NA
#> GSM151375     3  0.1679     0.7841 0.000 0.008 0.936 0.000 0.028 NA
#> GSM151376     3  0.1933     0.7828 0.000 0.004 0.920 0.000 0.032 NA
#> GSM151377     3  0.2346     0.7638 0.000 0.008 0.868 0.000 0.000 NA
#> GSM151378     3  0.1691     0.7796 0.000 0.008 0.940 0.012 0.012 NA
#> GSM151379     3  0.2337     0.7746 0.000 0.008 0.908 0.036 0.012 NA
#> GSM151380     5  0.4108     0.5300 0.048 0.000 0.004 0.032 0.784 NA
#> GSM151381     3  0.3269     0.7552 0.000 0.008 0.832 0.000 0.052 NA
#> GSM151382     3  0.3693     0.7430 0.000 0.040 0.824 0.044 0.004 NA
#> GSM151383     4  0.3532     0.6887 0.060 0.016 0.000 0.828 0.004 NA
#> GSM151384     1  0.3896     0.7762 0.784 0.068 0.000 0.000 0.012 NA
#> GSM151385     1  0.0692     0.8723 0.976 0.000 0.000 0.000 0.004 NA
#> GSM151386     1  0.3219     0.8090 0.828 0.028 0.000 0.000 0.012 NA
#> GSM151387     5  0.6722     0.5821 0.000 0.028 0.176 0.192 0.552 NA
#> GSM151388     5  0.5946     0.5034 0.032 0.032 0.004 0.132 0.656 NA
#> GSM151389     5  0.5641     0.4804 0.000 0.000 0.324 0.052 0.564 NA
#> GSM151390     3  0.1913     0.7857 0.000 0.016 0.924 0.000 0.016 NA
#> GSM151391     4  0.7795     0.0514 0.000 0.036 0.248 0.412 0.120 NA
#> GSM151392     5  0.3419     0.5358 0.028 0.000 0.004 0.008 0.812 NA
#> GSM151393     3  0.2630     0.7675 0.000 0.008 0.876 0.012 0.008 NA
#> GSM151394     1  0.0806     0.8713 0.972 0.000 0.000 0.000 0.008 NA
#> GSM151395     2  0.3782     0.4847 0.008 0.832 0.020 0.032 0.024 NA
#> GSM151396     2  0.2275     0.5198 0.000 0.888 0.096 0.008 0.000 NA
#> GSM151397     1  0.1398     0.8679 0.940 0.000 0.000 0.000 0.008 NA
#> GSM151398     1  0.2740     0.8296 0.864 0.000 0.000 0.000 0.076 NA
#> GSM151399     2  0.6759     0.4021 0.000 0.596 0.120 0.148 0.064 NA
#> GSM151400     4  0.6536     0.5192 0.032 0.084 0.016 0.632 0.088 NA
#> GSM151401     3  0.5336     0.4442 0.000 0.324 0.592 0.016 0.012 NA
#> GSM151402     3  0.1958     0.7678 0.000 0.004 0.896 0.000 0.000 NA
#> GSM151403     3  0.4812     0.5357 0.000 0.004 0.668 0.000 0.224 NA
#> GSM151404     1  0.5781     0.2922 0.488 0.000 0.004 0.000 0.344 NA
#> GSM151405     5  0.6681     0.5644 0.000 0.092 0.132 0.076 0.612 NA
#> GSM151406     5  0.6973     0.4237 0.024 0.072 0.312 0.008 0.492 NA
#> GSM151407     4  0.1092     0.7068 0.000 0.000 0.020 0.960 0.000 NA
#> GSM151408     4  0.0291     0.7182 0.000 0.000 0.004 0.992 0.000 NA
#> GSM151409     1  0.0405     0.8726 0.988 0.000 0.000 0.000 0.008 NA
#> GSM151410     4  0.3321     0.6949 0.032 0.020 0.000 0.844 0.008 NA
#> GSM151411     1  0.0603     0.8725 0.980 0.000 0.000 0.000 0.004 NA
#> GSM151412     3  0.6007     0.1101 0.000 0.408 0.476 0.024 0.020 NA
#> GSM151413     1  0.5716     0.6352 0.664 0.020 0.000 0.152 0.040 NA
#> GSM151414     1  0.0922     0.8725 0.968 0.004 0.000 0.000 0.004 NA
#> GSM151415     1  0.0363     0.8732 0.988 0.000 0.000 0.000 0.000 NA
#> GSM151416     4  0.7020     0.4651 0.132 0.024 0.000 0.536 0.116 NA
#> GSM151417     1  0.7153     0.4795 0.556 0.092 0.000 0.116 0.072 NA
#> GSM151418     3  0.3306     0.7433 0.000 0.036 0.820 0.000 0.008 NA
#> GSM151419     1  0.1049     0.8712 0.960 0.000 0.000 0.000 0.008 NA
#> GSM151420     1  0.0000     0.8725 1.000 0.000 0.000 0.000 0.000 NA
#> GSM151421     2  0.6050     0.3545 0.196 0.504 0.000 0.004 0.008 NA
#> GSM151422     1  0.2502     0.8480 0.884 0.012 0.000 0.000 0.020 NA
#> GSM151423     3  0.3100     0.7539 0.000 0.012 0.844 0.016 0.008 NA
#> GSM151424     2  0.6053     0.1966 0.000 0.488 0.376 0.036 0.004 NA
#> GSM151425     2  0.6382     0.3735 0.000 0.564 0.244 0.012 0.060 NA
#> GSM151426     5  0.6290     0.4510 0.000 0.068 0.012 0.292 0.548 NA
#> GSM151427     3  0.2627     0.7720 0.000 0.008 0.892 0.052 0.016 NA
#> GSM151428     1  0.2252     0.8469 0.900 0.012 0.000 0.000 0.016 NA
#> GSM151429     4  0.7415     0.3257 0.212 0.092 0.000 0.440 0.020 NA
#> GSM151430     4  0.0146     0.7186 0.000 0.000 0.004 0.996 0.000 NA
#> GSM151431     4  0.0291     0.7189 0.000 0.000 0.004 0.992 0.000 NA
#> GSM151432     1  0.0806     0.8705 0.972 0.000 0.000 0.000 0.008 NA
#> GSM151433     1  0.0622     0.8714 0.980 0.000 0.000 0.000 0.008 NA
#> GSM151434     1  0.3689     0.7624 0.792 0.068 0.000 0.000 0.004 NA
#> GSM151435     1  0.0858     0.8719 0.968 0.000 0.000 0.000 0.004 NA
#> GSM151436     3  0.5329     0.5545 0.000 0.208 0.648 0.016 0.004 NA
#> GSM151437     1  0.0146     0.8728 0.996 0.000 0.000 0.000 0.000 NA
#> GSM151438     1  0.1769     0.8647 0.924 0.004 0.000 0.000 0.012 NA
#> GSM151439     2  0.5881     0.3356 0.276 0.504 0.000 0.000 0.004 NA
#> GSM151440     3  0.6647     0.2614 0.012 0.292 0.488 0.040 0.000 NA

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

consensus_heatmap(res, k = 2)

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

consensus_heatmap(res, k = 3)

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

consensus_heatmap(res, k = 4)

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

consensus_heatmap(res, k = 5)

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

consensus_heatmap(res, k = 6)

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

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

membership_heatmap(res, k = 2)

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

membership_heatmap(res, k = 3)

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

membership_heatmap(res, k = 4)

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

membership_heatmap(res, k = 5)

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

membership_heatmap(res, k = 6)

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

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

Signature heatmaps where rows are scaled:

get_signatures(res, k = 2)

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

get_signatures(res, k = 3)

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

get_signatures(res, k = 4)

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

get_signatures(res, k = 5)

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

get_signatures(res, k = 6)

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

Signature heatmaps where rows are not scaled:

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

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

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

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

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

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

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

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

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

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

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk CV-skmeans-signature_compare

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

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

An example of the output of tb is:

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

The columns in tb are:

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

UMAP plot which shows how samples are separated.

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

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

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

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

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

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

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

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

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

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

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk CV-skmeans-collect-classes

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

test_to_known_factors(res)
#>             n disease.state(p) k
#> CV:skmeans 68           0.3663 2
#> CV:skmeans 69           0.4201 3
#> CV:skmeans 54           0.1871 4
#> CV:skmeans 58           0.0430 5
#> CV:skmeans 54           0.0233 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 17730 rows and 72 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 2.
#> 
#> Following methods can be applied to this 'ConsensusPartition' object:
#>  [1] "cola_report"             "collect_classes"         "collect_plots"          
#>  [4] "collect_stats"           "colnames"                "compare_signatures"     
#>  [7] "consensus_heatmap"       "dimension_reduction"     "functional_enrichment"  
#> [10] "get_anno_col"            "get_anno"                "get_classes"            
#> [13] "get_consensus"           "get_matrix"              "get_membership"         
#> [16] "get_param"               "get_signatures"          "get_stats"              
#> [19] "is_best_k"               "is_stable_k"             "membership_heatmap"     
#> [22] "ncol"                    "nrow"                    "plot_ecdf"              
#> [25] "rownames"                "select_partition_number" "show"                   
#> [28] "suggest_best_k"          "test_to_known_factors"

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

collect_plots(res)

plot of chunk CV-pam-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.864           0.955       0.975         0.4318 0.549   0.549
#> 3 3 0.597           0.750       0.890         0.4306 0.831   0.692
#> 4 4 0.649           0.730       0.841         0.1688 0.843   0.613
#> 5 5 0.773           0.756       0.894         0.0697 0.942   0.796
#> 6 6 0.776           0.679       0.850         0.0192 0.948   0.790

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
#> GSM151369     1  0.7219      0.804 0.800 0.200
#> GSM151370     2  0.0000      0.999 0.000 1.000
#> GSM151371     1  0.0000      0.925 1.000 0.000
#> GSM151372     2  0.0000      0.999 0.000 1.000
#> GSM151373     2  0.0000      0.999 0.000 1.000
#> GSM151374     2  0.0000      0.999 0.000 1.000
#> GSM151375     2  0.0000      0.999 0.000 1.000
#> GSM151376     2  0.0000      0.999 0.000 1.000
#> GSM151377     2  0.0000      0.999 0.000 1.000
#> GSM151378     2  0.0000      0.999 0.000 1.000
#> GSM151379     2  0.0000      0.999 0.000 1.000
#> GSM151380     2  0.0000      0.999 0.000 1.000
#> GSM151381     2  0.0000      0.999 0.000 1.000
#> GSM151382     2  0.0000      0.999 0.000 1.000
#> GSM151383     2  0.0000      0.999 0.000 1.000
#> GSM151384     1  0.8661      0.681 0.712 0.288
#> GSM151385     1  0.0000      0.925 1.000 0.000
#> GSM151386     1  0.7219      0.804 0.800 0.200
#> GSM151387     2  0.0000      0.999 0.000 1.000
#> GSM151388     2  0.0000      0.999 0.000 1.000
#> GSM151389     2  0.0000      0.999 0.000 1.000
#> GSM151390     2  0.0000      0.999 0.000 1.000
#> GSM151391     2  0.0000      0.999 0.000 1.000
#> GSM151392     2  0.0000      0.999 0.000 1.000
#> GSM151393     2  0.0000      0.999 0.000 1.000
#> GSM151394     1  0.0000      0.925 1.000 0.000
#> GSM151395     2  0.0000      0.999 0.000 1.000
#> GSM151396     2  0.0000      0.999 0.000 1.000
#> GSM151397     1  0.4161      0.890 0.916 0.084
#> GSM151398     1  0.0376      0.924 0.996 0.004
#> GSM151399     2  0.0000      0.999 0.000 1.000
#> GSM151400     2  0.0000      0.999 0.000 1.000
#> GSM151401     2  0.0000      0.999 0.000 1.000
#> GSM151402     2  0.0000      0.999 0.000 1.000
#> GSM151403     2  0.0000      0.999 0.000 1.000
#> GSM151404     1  0.4690      0.880 0.900 0.100
#> GSM151405     2  0.0000      0.999 0.000 1.000
#> GSM151406     2  0.0000      0.999 0.000 1.000
#> GSM151407     2  0.0000      0.999 0.000 1.000
#> GSM151408     2  0.0000      0.999 0.000 1.000
#> GSM151409     1  0.0000      0.925 1.000 0.000
#> GSM151410     2  0.0000      0.999 0.000 1.000
#> GSM151411     1  0.0000      0.925 1.000 0.000
#> GSM151412     2  0.0000      0.999 0.000 1.000
#> GSM151413     1  0.7219      0.804 0.800 0.200
#> GSM151414     1  0.0000      0.925 1.000 0.000
#> GSM151415     1  0.0000      0.925 1.000 0.000
#> GSM151416     2  0.3274      0.931 0.060 0.940
#> GSM151417     2  0.0000      0.999 0.000 1.000
#> GSM151418     2  0.0000      0.999 0.000 1.000
#> GSM151419     1  0.0000      0.925 1.000 0.000
#> GSM151420     1  0.0000      0.925 1.000 0.000
#> GSM151421     2  0.0000      0.999 0.000 1.000
#> GSM151422     1  0.7219      0.804 0.800 0.200
#> GSM151423     2  0.0000      0.999 0.000 1.000
#> GSM151424     2  0.0000      0.999 0.000 1.000
#> GSM151425     2  0.0000      0.999 0.000 1.000
#> GSM151426     2  0.0000      0.999 0.000 1.000
#> GSM151427     2  0.0000      0.999 0.000 1.000
#> GSM151428     1  0.0000      0.925 1.000 0.000
#> GSM151429     2  0.0000      0.999 0.000 1.000
#> GSM151430     2  0.0000      0.999 0.000 1.000
#> GSM151431     2  0.0000      0.999 0.000 1.000
#> GSM151432     1  0.0000      0.925 1.000 0.000
#> GSM151433     1  0.0000      0.925 1.000 0.000
#> GSM151434     1  0.9710      0.453 0.600 0.400
#> GSM151435     1  0.0000      0.925 1.000 0.000
#> GSM151436     2  0.0000      0.999 0.000 1.000
#> GSM151437     1  0.0000      0.925 1.000 0.000
#> GSM151438     1  0.2423      0.911 0.960 0.040
#> GSM151439     2  0.0000      0.999 0.000 1.000
#> GSM151440     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
#> GSM151369     1  0.5466     0.7643 0.800 0.160 0.040
#> GSM151370     2  0.0000     0.8560 0.000 1.000 0.000
#> GSM151371     1  0.0000     0.8995 1.000 0.000 0.000
#> GSM151372     2  0.0000     0.8560 0.000 1.000 0.000
#> GSM151373     3  0.5178     0.6935 0.000 0.256 0.744
#> GSM151374     3  0.4504     0.7075 0.000 0.196 0.804
#> GSM151375     2  0.6008     0.2861 0.000 0.628 0.372
#> GSM151376     2  0.6008     0.2861 0.000 0.628 0.372
#> GSM151377     2  0.5363     0.5117 0.000 0.724 0.276
#> GSM151378     3  0.4504     0.7075 0.000 0.196 0.804
#> GSM151379     3  0.0000     0.7159 0.000 0.000 1.000
#> GSM151380     2  0.3941     0.7327 0.000 0.844 0.156
#> GSM151381     2  0.1753     0.8286 0.000 0.952 0.048
#> GSM151382     3  0.6140     0.3602 0.000 0.404 0.596
#> GSM151383     2  0.4504     0.6796 0.000 0.804 0.196
#> GSM151384     1  0.5465     0.6299 0.712 0.288 0.000
#> GSM151385     1  0.0000     0.8995 1.000 0.000 0.000
#> GSM151386     1  0.4555     0.7494 0.800 0.200 0.000
#> GSM151387     3  0.5706     0.5415 0.000 0.320 0.680
#> GSM151388     2  0.0000     0.8560 0.000 1.000 0.000
#> GSM151389     3  0.5497     0.5600 0.000 0.292 0.708
#> GSM151390     2  0.6008     0.2861 0.000 0.628 0.372
#> GSM151391     2  0.0000     0.8560 0.000 1.000 0.000
#> GSM151392     2  0.2625     0.7968 0.000 0.916 0.084
#> GSM151393     3  0.3752     0.7353 0.000 0.144 0.856
#> GSM151394     1  0.0000     0.8995 1.000 0.000 0.000
#> GSM151395     2  0.0000     0.8560 0.000 1.000 0.000
#> GSM151396     2  0.0000     0.8560 0.000 1.000 0.000
#> GSM151397     1  0.2625     0.8545 0.916 0.084 0.000
#> GSM151398     1  0.0237     0.8981 0.996 0.004 0.000
#> GSM151399     2  0.0000     0.8560 0.000 1.000 0.000
#> GSM151400     2  0.4605     0.6772 0.000 0.796 0.204
#> GSM151401     2  0.0000     0.8560 0.000 1.000 0.000
#> GSM151402     3  0.4504     0.7075 0.000 0.196 0.804
#> GSM151403     2  0.1860     0.8255 0.000 0.948 0.052
#> GSM151404     1  0.3295     0.8416 0.896 0.096 0.008
#> GSM151405     2  0.0424     0.8521 0.000 0.992 0.008
#> GSM151406     2  0.0424     0.8521 0.000 0.992 0.008
#> GSM151407     3  0.3192     0.7118 0.000 0.112 0.888
#> GSM151408     2  0.4504     0.6796 0.000 0.804 0.196
#> GSM151409     1  0.0000     0.8995 1.000 0.000 0.000
#> GSM151410     2  0.4504     0.6796 0.000 0.804 0.196
#> GSM151411     1  0.0000     0.8995 1.000 0.000 0.000
#> GSM151412     2  0.0000     0.8560 0.000 1.000 0.000
#> GSM151413     1  0.7153     0.6548 0.708 0.200 0.092
#> GSM151414     1  0.0000     0.8995 1.000 0.000 0.000
#> GSM151415     1  0.0000     0.8995 1.000 0.000 0.000
#> GSM151416     2  0.6258     0.6291 0.052 0.752 0.196
#> GSM151417     2  0.0000     0.8560 0.000 1.000 0.000
#> GSM151418     2  0.2066     0.8202 0.000 0.940 0.060
#> GSM151419     1  0.0000     0.8995 1.000 0.000 0.000
#> GSM151420     1  0.0000     0.8995 1.000 0.000 0.000
#> GSM151421     2  0.0000     0.8560 0.000 1.000 0.000
#> GSM151422     1  0.4555     0.7494 0.800 0.200 0.000
#> GSM151423     2  0.1860     0.8250 0.000 0.948 0.052
#> GSM151424     2  0.0000     0.8560 0.000 1.000 0.000
#> GSM151425     2  0.0000     0.8560 0.000 1.000 0.000
#> GSM151426     2  0.6295    -0.0418 0.000 0.528 0.472
#> GSM151427     3  0.0000     0.7159 0.000 0.000 1.000
#> GSM151428     1  0.0000     0.8995 1.000 0.000 0.000
#> GSM151429     2  0.0000     0.8560 0.000 1.000 0.000
#> GSM151430     3  0.6045     0.4387 0.000 0.380 0.620
#> GSM151431     2  0.5138     0.5998 0.000 0.748 0.252
#> GSM151432     1  0.0000     0.8995 1.000 0.000 0.000
#> GSM151433     1  0.0000     0.8995 1.000 0.000 0.000
#> GSM151434     1  0.6126     0.4232 0.600 0.400 0.000
#> GSM151435     1  0.0000     0.8995 1.000 0.000 0.000
#> GSM151436     2  0.0000     0.8560 0.000 1.000 0.000
#> GSM151437     1  0.0000     0.8995 1.000 0.000 0.000
#> GSM151438     1  0.1529     0.8816 0.960 0.040 0.000
#> GSM151439     2  0.0000     0.8560 0.000 1.000 0.000
#> GSM151440     2  0.0000     0.8560 0.000 1.000 0.000

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM151369     1  0.4730      0.541 0.636 0.000 0.000 0.364
#> GSM151370     2  0.0000      0.831 0.000 1.000 0.000 0.000
#> GSM151371     1  0.0000      0.892 1.000 0.000 0.000 0.000
#> GSM151372     2  0.0000      0.831 0.000 1.000 0.000 0.000
#> GSM151373     3  0.3873      0.647 0.000 0.228 0.772 0.000
#> GSM151374     3  0.0000      0.792 0.000 0.000 1.000 0.000
#> GSM151375     3  0.5990      0.721 0.000 0.144 0.692 0.164
#> GSM151376     3  0.5944      0.723 0.000 0.140 0.696 0.164
#> GSM151377     3  0.5807      0.593 0.000 0.040 0.596 0.364
#> GSM151378     3  0.0000      0.792 0.000 0.000 1.000 0.000
#> GSM151379     3  0.0000      0.792 0.000 0.000 1.000 0.000
#> GSM151380     2  0.4941      0.229 0.000 0.564 0.000 0.436
#> GSM151381     2  0.6334      0.458 0.000 0.592 0.080 0.328
#> GSM151382     4  0.6993      0.698 0.000 0.336 0.132 0.532
#> GSM151383     4  0.4730      0.740 0.000 0.364 0.000 0.636
#> GSM151384     1  0.4331      0.627 0.712 0.288 0.000 0.000
#> GSM151385     1  0.0000      0.892 1.000 0.000 0.000 0.000
#> GSM151386     1  0.3610      0.732 0.800 0.200 0.000 0.000
#> GSM151387     4  0.3219      0.502 0.000 0.000 0.164 0.836
#> GSM151388     2  0.0469      0.823 0.000 0.988 0.000 0.012
#> GSM151389     4  0.2216      0.347 0.000 0.000 0.092 0.908
#> GSM151390     3  0.6245      0.698 0.000 0.168 0.668 0.164
#> GSM151391     2  0.0000      0.831 0.000 1.000 0.000 0.000
#> GSM151392     2  0.6626      0.379 0.000 0.544 0.092 0.364
#> GSM151393     3  0.3356      0.697 0.000 0.000 0.824 0.176
#> GSM151394     1  0.0000      0.892 1.000 0.000 0.000 0.000
#> GSM151395     2  0.0000      0.831 0.000 1.000 0.000 0.000
#> GSM151396     2  0.0000      0.831 0.000 1.000 0.000 0.000
#> GSM151397     1  0.2081      0.841 0.916 0.084 0.000 0.000
#> GSM151398     1  0.0188      0.891 0.996 0.004 0.000 0.000
#> GSM151399     2  0.0000      0.831 0.000 1.000 0.000 0.000
#> GSM151400     4  0.4746      0.714 0.000 0.368 0.000 0.632
#> GSM151401     2  0.0000      0.831 0.000 1.000 0.000 0.000
#> GSM151402     3  0.0000      0.792 0.000 0.000 1.000 0.000
#> GSM151403     2  0.6626      0.379 0.000 0.544 0.092 0.364
#> GSM151404     1  0.3610      0.744 0.800 0.000 0.000 0.200
#> GSM151405     2  0.3610      0.660 0.000 0.800 0.000 0.200
#> GSM151406     2  0.3569      0.664 0.000 0.804 0.000 0.196
#> GSM151407     4  0.4730      0.378 0.000 0.000 0.364 0.636
#> GSM151408     4  0.4730      0.740 0.000 0.364 0.000 0.636
#> GSM151409     1  0.0000      0.892 1.000 0.000 0.000 0.000
#> GSM151410     4  0.4730      0.740 0.000 0.364 0.000 0.636
#> GSM151411     1  0.0000      0.892 1.000 0.000 0.000 0.000
#> GSM151412     2  0.0000      0.831 0.000 1.000 0.000 0.000
#> GSM151413     1  0.6823      0.457 0.604 0.200 0.000 0.196
#> GSM151414     1  0.0000      0.892 1.000 0.000 0.000 0.000
#> GSM151415     1  0.0000      0.892 1.000 0.000 0.000 0.000
#> GSM151416     4  0.5827      0.739 0.052 0.316 0.000 0.632
#> GSM151417     2  0.0000      0.831 0.000 1.000 0.000 0.000
#> GSM151418     2  0.7740      0.105 0.000 0.404 0.232 0.364
#> GSM151419     1  0.0000      0.892 1.000 0.000 0.000 0.000
#> GSM151420     1  0.0000      0.892 1.000 0.000 0.000 0.000
#> GSM151421     2  0.0000      0.831 0.000 1.000 0.000 0.000
#> GSM151422     1  0.3610      0.732 0.800 0.200 0.000 0.000
#> GSM151423     2  0.4228      0.579 0.000 0.760 0.232 0.008
#> GSM151424     2  0.0000      0.831 0.000 1.000 0.000 0.000
#> GSM151425     2  0.0000      0.831 0.000 1.000 0.000 0.000
#> GSM151426     4  0.4010      0.613 0.000 0.100 0.064 0.836
#> GSM151427     3  0.1557      0.749 0.000 0.000 0.944 0.056
#> GSM151428     1  0.0000      0.892 1.000 0.000 0.000 0.000
#> GSM151429     2  0.0000      0.831 0.000 1.000 0.000 0.000
#> GSM151430     4  0.6537      0.684 0.000 0.200 0.164 0.636
#> GSM151431     4  0.4730      0.740 0.000 0.364 0.000 0.636
#> GSM151432     1  0.0000      0.892 1.000 0.000 0.000 0.000
#> GSM151433     1  0.0000      0.892 1.000 0.000 0.000 0.000
#> GSM151434     1  0.4855      0.443 0.600 0.400 0.000 0.000
#> GSM151435     1  0.0000      0.892 1.000 0.000 0.000 0.000
#> GSM151436     2  0.0000      0.831 0.000 1.000 0.000 0.000
#> GSM151437     1  0.0000      0.892 1.000 0.000 0.000 0.000
#> GSM151438     1  0.1211      0.872 0.960 0.040 0.000 0.000
#> GSM151439     2  0.0000      0.831 0.000 1.000 0.000 0.000
#> GSM151440     2  0.0000      0.831 0.000 1.000 0.000 0.000

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>           class entropy silhouette    p1    p2    p3    p4    p5
#> GSM151369     1  0.4242     0.3237 0.572 0.000 0.428 0.000 0.000
#> GSM151370     2  0.0000     0.9110 0.000 1.000 0.000 0.000 0.000
#> GSM151371     1  0.0000     0.8829 1.000 0.000 0.000 0.000 0.000
#> GSM151372     2  0.0000     0.9110 0.000 1.000 0.000 0.000 0.000
#> GSM151373     5  0.1502     0.8516 0.000 0.056 0.004 0.000 0.940
#> GSM151374     5  0.0000     0.9123 0.000 0.000 0.000 0.000 1.000
#> GSM151375     3  0.4182     0.3192 0.000 0.000 0.600 0.000 0.400
#> GSM151376     3  0.4161     0.3332 0.000 0.000 0.608 0.000 0.392
#> GSM151377     3  0.1410     0.6699 0.000 0.000 0.940 0.000 0.060
#> GSM151378     5  0.0162     0.9122 0.000 0.000 0.004 0.000 0.996
#> GSM151379     5  0.0880     0.8945 0.000 0.000 0.032 0.000 0.968
#> GSM151380     2  0.6153     0.0771 0.000 0.460 0.408 0.132 0.000
#> GSM151381     3  0.3210     0.5864 0.000 0.212 0.788 0.000 0.000
#> GSM151382     4  0.2879     0.7666 0.000 0.032 0.000 0.868 0.100
#> GSM151383     4  0.0000     0.8309 0.000 0.000 0.000 1.000 0.000
#> GSM151384     1  0.3730     0.6489 0.712 0.288 0.000 0.000 0.000
#> GSM151385     1  0.0000     0.8829 1.000 0.000 0.000 0.000 0.000
#> GSM151386     1  0.3109     0.7442 0.800 0.200 0.000 0.000 0.000
#> GSM151387     4  0.6460     0.1051 0.000 0.000 0.408 0.412 0.180
#> GSM151388     2  0.2329     0.8091 0.000 0.876 0.124 0.000 0.000
#> GSM151389     3  0.0000     0.6842 0.000 0.000 1.000 0.000 0.000
#> GSM151390     3  0.4341     0.3063 0.000 0.004 0.592 0.000 0.404
#> GSM151391     2  0.1124     0.8826 0.000 0.960 0.004 0.036 0.000
#> GSM151392     3  0.0000     0.6842 0.000 0.000 1.000 0.000 0.000
#> GSM151393     5  0.3395     0.5494 0.000 0.000 0.236 0.000 0.764
#> GSM151394     1  0.0000     0.8829 1.000 0.000 0.000 0.000 0.000
#> GSM151395     2  0.0000     0.9110 0.000 1.000 0.000 0.000 0.000
#> GSM151396     2  0.0000     0.9110 0.000 1.000 0.000 0.000 0.000
#> GSM151397     1  0.1792     0.8355 0.916 0.084 0.000 0.000 0.000
#> GSM151398     1  0.0162     0.8813 0.996 0.004 0.000 0.000 0.000
#> GSM151399     2  0.0000     0.9110 0.000 1.000 0.000 0.000 0.000
#> GSM151400     4  0.2966     0.6950 0.000 0.184 0.000 0.816 0.000
#> GSM151401     2  0.0000     0.9110 0.000 1.000 0.000 0.000 0.000
#> GSM151402     5  0.0290     0.9096 0.000 0.000 0.008 0.000 0.992
#> GSM151403     3  0.1732     0.6751 0.000 0.080 0.920 0.000 0.000
#> GSM151404     1  0.4201     0.3903 0.592 0.000 0.408 0.000 0.000
#> GSM151405     2  0.3876     0.5116 0.000 0.684 0.316 0.000 0.000
#> GSM151406     2  0.4192     0.3431 0.000 0.596 0.404 0.000 0.000
#> GSM151407     4  0.0000     0.8309 0.000 0.000 0.000 1.000 0.000
#> GSM151408     4  0.0000     0.8309 0.000 0.000 0.000 1.000 0.000
#> GSM151409     1  0.0000     0.8829 1.000 0.000 0.000 0.000 0.000
#> GSM151410     4  0.2329     0.7706 0.000 0.124 0.000 0.876 0.000
#> GSM151411     1  0.0000     0.8829 1.000 0.000 0.000 0.000 0.000
#> GSM151412     2  0.0000     0.9110 0.000 1.000 0.000 0.000 0.000
#> GSM151413     1  0.4977     0.4632 0.604 0.040 0.000 0.356 0.000
#> GSM151414     1  0.0000     0.8829 1.000 0.000 0.000 0.000 0.000
#> GSM151415     1  0.0000     0.8829 1.000 0.000 0.000 0.000 0.000
#> GSM151416     4  0.3863     0.7223 0.052 0.152 0.000 0.796 0.000
#> GSM151417     2  0.0000     0.9110 0.000 1.000 0.000 0.000 0.000
#> GSM151418     3  0.4497     0.5627 0.000 0.208 0.732 0.000 0.060
#> GSM151419     1  0.0000     0.8829 1.000 0.000 0.000 0.000 0.000
#> GSM151420     1  0.0000     0.8829 1.000 0.000 0.000 0.000 0.000
#> GSM151421     2  0.0000     0.9110 0.000 1.000 0.000 0.000 0.000
#> GSM151422     1  0.3109     0.7442 0.800 0.200 0.000 0.000 0.000
#> GSM151423     2  0.3169     0.7982 0.000 0.856 0.084 0.000 0.060
#> GSM151424     2  0.0000     0.9110 0.000 1.000 0.000 0.000 0.000
#> GSM151425     2  0.0000     0.9110 0.000 1.000 0.000 0.000 0.000
#> GSM151426     4  0.3395     0.6407 0.000 0.000 0.236 0.764 0.000
#> GSM151427     5  0.0000     0.9123 0.000 0.000 0.000 0.000 1.000
#> GSM151428     1  0.0000     0.8829 1.000 0.000 0.000 0.000 0.000
#> GSM151429     2  0.0000     0.9110 0.000 1.000 0.000 0.000 0.000
#> GSM151430     4  0.0000     0.8309 0.000 0.000 0.000 1.000 0.000
#> GSM151431     4  0.0000     0.8309 0.000 0.000 0.000 1.000 0.000
#> GSM151432     1  0.0000     0.8829 1.000 0.000 0.000 0.000 0.000
#> GSM151433     1  0.0000     0.8829 1.000 0.000 0.000 0.000 0.000
#> GSM151434     1  0.4182     0.4604 0.600 0.400 0.000 0.000 0.000
#> GSM151435     1  0.0000     0.8829 1.000 0.000 0.000 0.000 0.000
#> GSM151436     2  0.0000     0.9110 0.000 1.000 0.000 0.000 0.000
#> GSM151437     1  0.0000     0.8829 1.000 0.000 0.000 0.000 0.000
#> GSM151438     1  0.1043     0.8634 0.960 0.040 0.000 0.000 0.000
#> GSM151439     2  0.0000     0.9110 0.000 1.000 0.000 0.000 0.000
#> GSM151440     2  0.0000     0.9110 0.000 1.000 0.000 0.000 0.000

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>           class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM151369     1  0.5336   -0.13953 0.572 0.000 0.000 0.000 0.144 0.284
#> GSM151370     2  0.0000    0.92384 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM151371     1  0.0000    0.83754 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM151372     2  0.0000    0.92384 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM151373     3  0.0146    0.89404 0.000 0.004 0.996 0.000 0.000 0.000
#> GSM151374     3  0.1910    0.86378 0.000 0.000 0.892 0.000 0.000 0.108
#> GSM151375     5  0.5917    0.15327 0.000 0.000 0.208 0.000 0.400 0.392
#> GSM151376     5  0.5887    0.16500 0.000 0.000 0.200 0.000 0.408 0.392
#> GSM151377     5  0.2053    0.49658 0.000 0.000 0.004 0.000 0.888 0.108
#> GSM151378     3  0.0146    0.89541 0.000 0.000 0.996 0.000 0.004 0.000
#> GSM151379     3  0.0146    0.89541 0.000 0.000 0.996 0.000 0.004 0.000
#> GSM151380     5  0.5156    0.40430 0.000 0.272 0.000 0.128 0.600 0.000
#> GSM151381     5  0.3746    0.51622 0.000 0.192 0.000 0.000 0.760 0.048
#> GSM151382     4  0.2633    0.78277 0.000 0.032 0.104 0.864 0.000 0.000
#> GSM151383     4  0.0000    0.86291 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM151384     1  0.3351    0.29390 0.712 0.288 0.000 0.000 0.000 0.000
#> GSM151385     1  0.0000    0.83754 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM151386     1  0.2793    0.51196 0.800 0.200 0.000 0.000 0.000 0.000
#> GSM151387     5  0.5956   -0.04247 0.000 0.004 0.188 0.380 0.428 0.000
#> GSM151388     2  0.3464    0.52404 0.000 0.688 0.000 0.000 0.312 0.000
#> GSM151389     5  0.0000    0.51700 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM151390     5  0.5917    0.15327 0.000 0.000 0.208 0.000 0.400 0.392
#> GSM151391     2  0.2763    0.82026 0.000 0.876 0.000 0.028 0.072 0.024
#> GSM151392     5  0.3634    0.39752 0.000 0.000 0.000 0.000 0.644 0.356
#> GSM151393     3  0.4949    0.58507 0.000 0.000 0.648 0.000 0.208 0.144
#> GSM151394     1  0.0000    0.83754 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM151395     2  0.0000    0.92384 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM151396     2  0.0000    0.92384 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM151397     1  0.1610    0.72527 0.916 0.084 0.000 0.000 0.000 0.000
#> GSM151398     1  0.0146    0.83367 0.996 0.004 0.000 0.000 0.000 0.000
#> GSM151399     2  0.0000    0.92384 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM151400     4  0.3727    0.71248 0.000 0.128 0.000 0.784 0.000 0.088
#> GSM151401     2  0.0146    0.92118 0.000 0.996 0.004 0.000 0.000 0.000
#> GSM151402     3  0.2703    0.83204 0.000 0.000 0.824 0.000 0.004 0.172
#> GSM151403     5  0.1556    0.53866 0.000 0.080 0.000 0.000 0.920 0.000
#> GSM151404     5  0.3756   -0.14632 0.400 0.000 0.000 0.000 0.600 0.000
#> GSM151405     2  0.3482    0.44096 0.000 0.684 0.000 0.000 0.316 0.000
#> GSM151406     5  0.3765    0.19463 0.000 0.404 0.000 0.000 0.596 0.000
#> GSM151407     4  0.0000    0.86291 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM151408     4  0.0000    0.86291 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM151409     1  0.0000    0.83754 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM151410     4  0.2092    0.77670 0.000 0.124 0.000 0.876 0.000 0.000
#> GSM151411     1  0.0000    0.83754 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM151412     2  0.0146    0.92118 0.000 0.996 0.004 0.000 0.000 0.000
#> GSM151413     6  0.6389    0.00000 0.384 0.036 0.000 0.160 0.000 0.420
#> GSM151414     1  0.0000    0.83754 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM151415     1  0.0000    0.83754 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM151416     4  0.3470    0.70104 0.052 0.152 0.000 0.796 0.000 0.000
#> GSM151417     2  0.0000    0.92384 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM151418     5  0.4641    0.48444 0.000 0.192 0.004 0.000 0.696 0.108
#> GSM151419     1  0.0000    0.83754 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM151420     1  0.0000    0.83754 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM151421     2  0.0000    0.92384 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM151422     1  0.2793    0.51196 0.800 0.200 0.000 0.000 0.000 0.000
#> GSM151423     2  0.5420    0.34937 0.000 0.580 0.004 0.000 0.272 0.144
#> GSM151424     2  0.0000    0.92384 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM151425     2  0.0000    0.92384 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM151426     4  0.3050    0.64614 0.000 0.000 0.000 0.764 0.236 0.000
#> GSM151427     3  0.0000    0.89562 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM151428     1  0.0000    0.83754 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM151429     2  0.0000    0.92384 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM151430     4  0.0000    0.86291 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM151431     4  0.0000    0.86291 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM151432     1  0.0000    0.83754 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM151433     1  0.0000    0.83754 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM151434     1  0.3756    0.00277 0.600 0.400 0.000 0.000 0.000 0.000
#> GSM151435     1  0.0000    0.83754 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM151436     2  0.0000    0.92384 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM151437     1  0.0000    0.83754 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM151438     1  0.0937    0.79093 0.960 0.040 0.000 0.000 0.000 0.000
#> GSM151439     2  0.0000    0.92384 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM151440     2  0.0000    0.92384 0.000 1.000 0.000 0.000 0.000 0.000

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

consensus_heatmap(res, k = 2)

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

consensus_heatmap(res, k = 3)

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

consensus_heatmap(res, k = 4)

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

consensus_heatmap(res, k = 5)

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

consensus_heatmap(res, k = 6)

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

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

membership_heatmap(res, k = 2)

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

membership_heatmap(res, k = 3)

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

membership_heatmap(res, k = 4)

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

membership_heatmap(res, k = 5)

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

membership_heatmap(res, k = 6)

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

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

Signature heatmaps where rows are scaled:

get_signatures(res, k = 2)

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

get_signatures(res, k = 3)

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

get_signatures(res, k = 4)

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

get_signatures(res, k = 5)

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

get_signatures(res, k = 6)

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

Signature heatmaps where rows are not scaled:

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

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

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

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

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

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

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

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

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

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

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk CV-pam-signature_compare

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

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

An example of the output of tb is:

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

The columns in tb are:

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

UMAP plot which shows how samples are separated.

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

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

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

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

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

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

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

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

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

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

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk CV-pam-collect-classes

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

test_to_known_factors(res)
#>         n disease.state(p) k
#> CV:pam 71            0.651 2
#> CV:pam 65            0.533 3
#> CV:pam 63            0.119 4
#> CV:pam 62            0.325 5
#> CV:pam 56            0.370 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 17730 rows and 72 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 2.
#> 
#> Following methods can be applied to this 'ConsensusPartition' object:
#>  [1] "cola_report"             "collect_classes"         "collect_plots"          
#>  [4] "collect_stats"           "colnames"                "compare_signatures"     
#>  [7] "consensus_heatmap"       "dimension_reduction"     "functional_enrichment"  
#> [10] "get_anno_col"            "get_anno"                "get_classes"            
#> [13] "get_consensus"           "get_matrix"              "get_membership"         
#> [16] "get_param"               "get_signatures"          "get_stats"              
#> [19] "is_best_k"               "is_stable_k"             "membership_heatmap"     
#> [22] "ncol"                    "nrow"                    "plot_ecdf"              
#> [25] "rownames"                "select_partition_number" "show"                   
#> [28] "suggest_best_k"          "test_to_known_factors"

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

collect_plots(res)

plot of chunk CV-mclust-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.464           0.818       0.889         0.4597 0.493   0.493
#> 3 3 0.511           0.720       0.843         0.2851 0.769   0.588
#> 4 4 0.491           0.613       0.730         0.1923 0.898   0.763
#> 5 5 0.784           0.778       0.886         0.1164 0.831   0.543
#> 6 6 0.751           0.706       0.825         0.0349 0.946   0.762

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
#> GSM151369     2  0.1414      0.875 0.020 0.980
#> GSM151370     2  0.0938      0.876 0.012 0.988
#> GSM151371     1  0.3114      0.896 0.944 0.056
#> GSM151372     1  0.6048      0.870 0.852 0.148
#> GSM151373     1  0.8016      0.824 0.756 0.244
#> GSM151374     2  0.0376      0.876 0.004 0.996
#> GSM151375     2  0.0000      0.874 0.000 1.000
#> GSM151376     2  0.0000      0.874 0.000 1.000
#> GSM151377     2  0.0376      0.876 0.004 0.996
#> GSM151378     2  0.0376      0.876 0.004 0.996
#> GSM151379     2  0.0376      0.876 0.004 0.996
#> GSM151380     2  0.1414      0.875 0.020 0.980
#> GSM151381     2  0.0376      0.876 0.004 0.996
#> GSM151382     2  0.9996     -0.095 0.488 0.512
#> GSM151383     1  0.7139      0.874 0.804 0.196
#> GSM151384     1  0.4815      0.896 0.896 0.104
#> GSM151385     1  0.3114      0.896 0.944 0.056
#> GSM151386     1  0.3733      0.897 0.928 0.072
#> GSM151387     2  0.0376      0.876 0.004 0.996
#> GSM151388     2  0.1633      0.873 0.024 0.976
#> GSM151389     2  0.0938      0.876 0.012 0.988
#> GSM151390     2  0.0376      0.876 0.004 0.996
#> GSM151391     2  0.1414      0.875 0.020 0.980
#> GSM151392     2  0.1414      0.875 0.020 0.980
#> GSM151393     2  0.0938      0.876 0.012 0.988
#> GSM151394     1  0.3114      0.896 0.944 0.056
#> GSM151395     1  0.7139      0.874 0.804 0.196
#> GSM151396     1  0.5842      0.874 0.860 0.140
#> GSM151397     1  0.3114      0.896 0.944 0.056
#> GSM151398     2  0.8207      0.597 0.256 0.744
#> GSM151399     1  0.7299      0.870 0.796 0.204
#> GSM151400     2  0.6887      0.724 0.184 0.816
#> GSM151401     1  0.6048      0.870 0.852 0.148
#> GSM151402     2  0.0000      0.874 0.000 1.000
#> GSM151403     2  0.0000      0.874 0.000 1.000
#> GSM151404     2  0.1414      0.875 0.020 0.980
#> GSM151405     2  0.1633      0.874 0.024 0.976
#> GSM151406     2  0.9775      0.172 0.412 0.588
#> GSM151407     2  0.8443      0.591 0.272 0.728
#> GSM151408     2  0.8443      0.591 0.272 0.728
#> GSM151409     1  0.3114      0.896 0.944 0.056
#> GSM151410     1  0.7376      0.867 0.792 0.208
#> GSM151411     1  0.3114      0.896 0.944 0.056
#> GSM151412     1  0.6438      0.875 0.836 0.164
#> GSM151413     2  0.9754      0.259 0.408 0.592
#> GSM151414     1  0.3114      0.896 0.944 0.056
#> GSM151415     1  0.3114      0.896 0.944 0.056
#> GSM151416     2  0.9552      0.362 0.376 0.624
#> GSM151417     1  0.7745      0.842 0.772 0.228
#> GSM151418     2  0.0376      0.876 0.004 0.996
#> GSM151419     1  0.3114      0.896 0.944 0.056
#> GSM151420     1  0.3114      0.896 0.944 0.056
#> GSM151421     1  0.6623      0.879 0.828 0.172
#> GSM151422     1  0.3114      0.896 0.944 0.056
#> GSM151423     2  0.0000      0.874 0.000 1.000
#> GSM151424     1  0.5946      0.872 0.856 0.144
#> GSM151425     1  0.6148      0.878 0.848 0.152
#> GSM151426     2  0.2236      0.863 0.036 0.964
#> GSM151427     2  0.0376      0.876 0.004 0.996
#> GSM151428     1  0.7056      0.877 0.808 0.192
#> GSM151429     1  0.7139      0.874 0.804 0.196
#> GSM151430     2  0.8443      0.591 0.272 0.728
#> GSM151431     2  0.8443      0.591 0.272 0.728
#> GSM151432     1  0.3114      0.896 0.944 0.056
#> GSM151433     1  0.3114      0.896 0.944 0.056
#> GSM151434     1  0.7139      0.874 0.804 0.196
#> GSM151435     1  0.3114      0.896 0.944 0.056
#> GSM151436     1  0.6048      0.870 0.852 0.148
#> GSM151437     1  0.3114      0.896 0.944 0.056
#> GSM151438     1  0.3114      0.896 0.944 0.056
#> GSM151439     1  0.7139      0.874 0.804 0.196
#> GSM151440     1  0.5842      0.874 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
#> GSM151369     3  0.1411      0.847 0.036 0.000 0.964
#> GSM151370     3  0.1163      0.854 0.000 0.028 0.972
#> GSM151371     1  0.0592      0.724 0.988 0.012 0.000
#> GSM151372     2  0.4146      0.810 0.080 0.876 0.044
#> GSM151373     2  0.6806      0.626 0.060 0.712 0.228
#> GSM151374     3  0.0592      0.857 0.000 0.012 0.988
#> GSM151375     3  0.0592      0.857 0.000 0.012 0.988
#> GSM151376     3  0.0592      0.857 0.000 0.012 0.988
#> GSM151377     3  0.0592      0.857 0.000 0.012 0.988
#> GSM151378     3  0.0592      0.857 0.000 0.012 0.988
#> GSM151379     3  0.0592      0.857 0.000 0.012 0.988
#> GSM151380     3  0.1267      0.854 0.004 0.024 0.972
#> GSM151381     3  0.0592      0.857 0.000 0.012 0.988
#> GSM151382     3  0.7671      0.390 0.052 0.380 0.568
#> GSM151383     2  0.7421      0.729 0.240 0.676 0.084
#> GSM151384     1  0.1453      0.713 0.968 0.024 0.008
#> GSM151385     1  0.6111      0.408 0.604 0.000 0.396
#> GSM151386     1  0.1781      0.718 0.960 0.020 0.020
#> GSM151387     3  0.1163      0.854 0.000 0.028 0.972
#> GSM151388     3  0.1765      0.852 0.004 0.040 0.956
#> GSM151389     3  0.1031      0.854 0.000 0.024 0.976
#> GSM151390     3  0.0592      0.857 0.000 0.012 0.988
#> GSM151391     3  0.1031      0.854 0.000 0.024 0.976
#> GSM151392     3  0.1031      0.854 0.000 0.024 0.976
#> GSM151393     3  0.0592      0.857 0.000 0.012 0.988
#> GSM151394     1  0.0000      0.729 1.000 0.000 0.000
#> GSM151395     2  0.5571      0.808 0.140 0.804 0.056
#> GSM151396     2  0.4755      0.801 0.184 0.808 0.008
#> GSM151397     1  0.3784      0.690 0.864 0.004 0.132
#> GSM151398     3  0.2301      0.831 0.060 0.004 0.936
#> GSM151399     2  0.5426      0.789 0.088 0.820 0.092
#> GSM151400     3  0.3554      0.830 0.036 0.064 0.900
#> GSM151401     2  0.4709      0.807 0.092 0.852 0.056
#> GSM151402     3  0.0592      0.857 0.000 0.012 0.988
#> GSM151403     3  0.0592      0.857 0.000 0.012 0.988
#> GSM151404     3  0.1411      0.847 0.036 0.000 0.964
#> GSM151405     3  0.1163      0.854 0.000 0.028 0.972
#> GSM151406     3  0.6025      0.711 0.028 0.232 0.740
#> GSM151407     3  0.5919      0.719 0.016 0.260 0.724
#> GSM151408     3  0.5956      0.715 0.016 0.264 0.720
#> GSM151409     1  0.5591      0.583 0.696 0.000 0.304
#> GSM151410     3  0.8961      0.311 0.136 0.360 0.504
#> GSM151411     1  0.5220      0.643 0.780 0.012 0.208
#> GSM151412     2  0.4371      0.820 0.108 0.860 0.032
#> GSM151413     3  0.7333      0.665 0.156 0.136 0.708
#> GSM151414     3  0.6786      0.087 0.448 0.012 0.540
#> GSM151415     1  0.0237      0.727 0.996 0.004 0.000
#> GSM151416     3  0.6588      0.723 0.060 0.208 0.732
#> GSM151417     3  0.7828      0.623 0.168 0.160 0.672
#> GSM151418     3  0.0592      0.857 0.000 0.012 0.988
#> GSM151419     3  0.6451      0.144 0.436 0.004 0.560
#> GSM151420     1  0.0000      0.729 1.000 0.000 0.000
#> GSM151421     2  0.6879      0.623 0.360 0.616 0.024
#> GSM151422     1  0.6264      0.454 0.616 0.004 0.380
#> GSM151423     3  0.0592      0.857 0.000 0.012 0.988
#> GSM151424     2  0.3272      0.810 0.080 0.904 0.016
#> GSM151425     2  0.4121      0.825 0.108 0.868 0.024
#> GSM151426     3  0.3500      0.822 0.004 0.116 0.880
#> GSM151427     3  0.0424      0.857 0.000 0.008 0.992
#> GSM151428     1  0.9225      0.325 0.532 0.212 0.256
#> GSM151429     2  0.6232      0.782 0.220 0.740 0.040
#> GSM151430     3  0.5919      0.719 0.016 0.260 0.724
#> GSM151431     3  0.5919      0.719 0.016 0.260 0.724
#> GSM151432     1  0.0237      0.727 0.996 0.004 0.000
#> GSM151433     1  0.0000      0.729 1.000 0.000 0.000
#> GSM151434     2  0.8128      0.420 0.440 0.492 0.068
#> GSM151435     1  0.6228      0.471 0.624 0.004 0.372
#> GSM151436     2  0.5058      0.817 0.148 0.820 0.032
#> GSM151437     1  0.0000      0.729 1.000 0.000 0.000
#> GSM151438     3  0.6247      0.348 0.376 0.004 0.620
#> GSM151439     2  0.7410      0.569 0.384 0.576 0.040
#> GSM151440     2  0.4172      0.817 0.156 0.840 0.004

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3 p4
#> GSM151369     3  0.4877     0.6080 0.000 0.000 0.592 NA
#> GSM151370     3  0.0188     0.6395 0.000 0.000 0.996 NA
#> GSM151371     1  0.0817     0.7665 0.976 0.024 0.000 NA
#> GSM151372     2  0.2814     0.7854 0.000 0.868 0.132 NA
#> GSM151373     2  0.4331     0.6783 0.000 0.712 0.288 NA
#> GSM151374     3  0.4985     0.6171 0.000 0.000 0.532 NA
#> GSM151375     3  0.4998     0.6081 0.000 0.000 0.512 NA
#> GSM151376     3  0.4998     0.6081 0.000 0.000 0.512 NA
#> GSM151377     3  0.4331     0.6676 0.000 0.000 0.712 NA
#> GSM151378     3  0.4454     0.6639 0.000 0.000 0.692 NA
#> GSM151379     3  0.4008     0.6684 0.000 0.000 0.756 NA
#> GSM151380     3  0.4877     0.6080 0.000 0.000 0.592 NA
#> GSM151381     3  0.4998     0.6081 0.000 0.000 0.512 NA
#> GSM151382     2  0.5383     0.3805 0.000 0.536 0.452 NA
#> GSM151383     2  0.3581     0.7788 0.032 0.852 0.116 NA
#> GSM151384     1  0.3311     0.6410 0.828 0.172 0.000 NA
#> GSM151385     1  0.4500     0.6296 0.684 0.000 0.316 NA
#> GSM151386     1  0.3311     0.6410 0.828 0.172 0.000 NA
#> GSM151387     3  0.0817     0.6370 0.000 0.000 0.976 NA
#> GSM151388     3  0.0000     0.6380 0.000 0.000 1.000 NA
#> GSM151389     3  0.3801     0.6672 0.000 0.000 0.780 NA
#> GSM151390     3  0.4967     0.6222 0.000 0.000 0.548 NA
#> GSM151391     3  0.3266     0.6692 0.000 0.000 0.832 NA
#> GSM151392     3  0.4877     0.6080 0.000 0.000 0.592 NA
#> GSM151393     3  0.4164     0.6674 0.000 0.000 0.736 NA
#> GSM151394     1  0.0000     0.7713 1.000 0.000 0.000 NA
#> GSM151395     2  0.1389     0.8170 0.000 0.952 0.048 NA
#> GSM151396     2  0.0336     0.8159 0.008 0.992 0.000 NA
#> GSM151397     1  0.3842     0.7605 0.836 0.036 0.128 NA
#> GSM151398     3  0.4163     0.5378 0.020 0.000 0.792 NA
#> GSM151399     2  0.2530     0.7897 0.000 0.888 0.112 NA
#> GSM151400     3  0.1474     0.6175 0.000 0.000 0.948 NA
#> GSM151401     2  0.2197     0.8067 0.000 0.916 0.080 NA
#> GSM151402     3  0.4998     0.6081 0.000 0.000 0.512 NA
#> GSM151403     3  0.4998     0.6081 0.000 0.000 0.512 NA
#> GSM151404     3  0.4877     0.6080 0.000 0.000 0.592 NA
#> GSM151405     3  0.0336     0.6353 0.000 0.000 0.992 NA
#> GSM151406     3  0.5904     0.4747 0.004 0.236 0.684 NA
#> GSM151407     3  0.7386     0.0890 0.000 0.184 0.496 NA
#> GSM151408     3  0.7374     0.0797 0.000 0.188 0.504 NA
#> GSM151409     1  0.2868     0.7591 0.864 0.000 0.136 NA
#> GSM151410     2  0.7996     0.2544 0.052 0.460 0.388 NA
#> GSM151411     1  0.2048     0.7753 0.928 0.008 0.064 NA
#> GSM151412     2  0.0336     0.8190 0.000 0.992 0.008 NA
#> GSM151413     3  0.7802     0.2788 0.060 0.084 0.524 NA
#> GSM151414     1  0.4522     0.6246 0.680 0.000 0.320 NA
#> GSM151415     1  0.0469     0.7683 0.988 0.012 0.000 NA
#> GSM151416     3  0.5522     0.4140 0.152 0.020 0.756 NA
#> GSM151417     3  0.7570    -0.1319 0.308 0.192 0.496 NA
#> GSM151418     3  0.4998     0.6081 0.000 0.000 0.512 NA
#> GSM151419     1  0.5193     0.6056 0.656 0.000 0.324 NA
#> GSM151420     1  0.0000     0.7713 1.000 0.000 0.000 NA
#> GSM151421     2  0.2868     0.7508 0.136 0.864 0.000 NA
#> GSM151422     1  0.6813     0.5842 0.576 0.132 0.292 NA
#> GSM151423     3  0.4998     0.6081 0.000 0.000 0.512 NA
#> GSM151424     2  0.0000     0.8171 0.000 1.000 0.000 NA
#> GSM151425     2  0.0000     0.8171 0.000 1.000 0.000 NA
#> GSM151426     3  0.0707     0.6313 0.000 0.000 0.980 NA
#> GSM151427     3  0.4008     0.6684 0.000 0.000 0.756 NA
#> GSM151428     1  0.6754     0.5457 0.612 0.204 0.184 NA
#> GSM151429     2  0.4713     0.7032 0.156 0.788 0.052 NA
#> GSM151430     3  0.6976     0.1964 0.000 0.136 0.544 NA
#> GSM151431     3  0.7386     0.0890 0.000 0.184 0.496 NA
#> GSM151432     1  0.0000     0.7713 1.000 0.000 0.000 NA
#> GSM151433     1  0.0000     0.7713 1.000 0.000 0.000 NA
#> GSM151434     2  0.6079     0.3157 0.380 0.568 0.052 NA
#> GSM151435     1  0.5228     0.6290 0.664 0.024 0.312 NA
#> GSM151436     2  0.0000     0.8171 0.000 1.000 0.000 NA
#> GSM151437     1  0.0000     0.7713 1.000 0.000 0.000 NA
#> GSM151438     1  0.7414     0.4421 0.508 0.004 0.324 NA
#> GSM151439     2  0.4100     0.7386 0.148 0.816 0.036 NA
#> GSM151440     2  0.0000     0.8171 0.000 1.000 0.000 NA

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>           class entropy silhouette    p1    p2    p3    p4    p5
#> GSM151369     5  0.0703     0.8493 0.000 0.000 0.024 0.000 0.976
#> GSM151370     4  0.6195     0.6687 0.000 0.000 0.240 0.552 0.208
#> GSM151371     1  0.0404     0.9024 0.988 0.000 0.000 0.000 0.012
#> GSM151372     2  0.0510     0.9341 0.000 0.984 0.000 0.016 0.000
#> GSM151373     2  0.0510     0.9341 0.000 0.984 0.000 0.016 0.000
#> GSM151374     3  0.0000     0.8372 0.000 0.000 1.000 0.000 0.000
#> GSM151375     3  0.0000     0.8372 0.000 0.000 1.000 0.000 0.000
#> GSM151376     3  0.0000     0.8372 0.000 0.000 1.000 0.000 0.000
#> GSM151377     3  0.0162     0.8358 0.000 0.000 0.996 0.000 0.004
#> GSM151378     3  0.0000     0.8372 0.000 0.000 1.000 0.000 0.000
#> GSM151379     3  0.2719     0.7129 0.000 0.000 0.852 0.144 0.004
#> GSM151380     5  0.0703     0.8493 0.000 0.000 0.024 0.000 0.976
#> GSM151381     3  0.0000     0.8372 0.000 0.000 1.000 0.000 0.000
#> GSM151382     2  0.1043     0.9189 0.000 0.960 0.000 0.040 0.000
#> GSM151383     2  0.2966     0.7977 0.136 0.848 0.000 0.016 0.000
#> GSM151384     1  0.3690     0.6998 0.780 0.200 0.000 0.000 0.020
#> GSM151385     1  0.0290     0.9029 0.992 0.000 0.000 0.000 0.008
#> GSM151386     1  0.3690     0.6998 0.780 0.200 0.000 0.000 0.020
#> GSM151387     4  0.6059     0.6912 0.000 0.000 0.220 0.576 0.204
#> GSM151388     4  0.6573     0.6931 0.020 0.000 0.200 0.560 0.220
#> GSM151389     3  0.4015     0.5363 0.000 0.000 0.652 0.000 0.348
#> GSM151390     3  0.0000     0.8372 0.000 0.000 1.000 0.000 0.000
#> GSM151391     3  0.6615    -0.0158 0.000 0.000 0.444 0.232 0.324
#> GSM151392     5  0.0703     0.8493 0.000 0.000 0.024 0.000 0.976
#> GSM151393     3  0.2127     0.7846 0.000 0.000 0.892 0.000 0.108
#> GSM151394     1  0.0000     0.9047 1.000 0.000 0.000 0.000 0.000
#> GSM151395     2  0.0000     0.9381 0.000 1.000 0.000 0.000 0.000
#> GSM151396     2  0.0000     0.9381 0.000 1.000 0.000 0.000 0.000
#> GSM151397     1  0.0000     0.9047 1.000 0.000 0.000 0.000 0.000
#> GSM151398     5  0.0703     0.8282 0.000 0.000 0.000 0.024 0.976
#> GSM151399     2  0.0000     0.9381 0.000 1.000 0.000 0.000 0.000
#> GSM151400     4  0.5635     0.7146 0.000 0.000 0.196 0.636 0.168
#> GSM151401     2  0.0510     0.9341 0.000 0.984 0.000 0.016 0.000
#> GSM151402     3  0.0000     0.8372 0.000 0.000 1.000 0.000 0.000
#> GSM151403     3  0.3109     0.6909 0.000 0.000 0.800 0.000 0.200
#> GSM151404     5  0.0703     0.8493 0.000 0.000 0.024 0.000 0.976
#> GSM151405     4  0.6236     0.6585 0.000 0.000 0.248 0.544 0.208
#> GSM151406     3  0.7815     0.1580 0.008 0.320 0.420 0.064 0.188
#> GSM151407     4  0.0000     0.6412 0.000 0.000 0.000 1.000 0.000
#> GSM151408     4  0.0510     0.6316 0.000 0.016 0.000 0.984 0.000
#> GSM151409     1  0.0162     0.9043 0.996 0.000 0.000 0.000 0.004
#> GSM151410     2  0.5826     0.3713 0.112 0.556 0.000 0.332 0.000
#> GSM151411     1  0.0162     0.9043 0.996 0.000 0.000 0.000 0.004
#> GSM151412     2  0.0000     0.9381 0.000 1.000 0.000 0.000 0.000
#> GSM151413     5  0.3596     0.6693 0.012 0.000 0.000 0.212 0.776
#> GSM151414     1  0.3586     0.6099 0.736 0.000 0.000 0.000 0.264
#> GSM151415     1  0.0771     0.8985 0.976 0.004 0.000 0.000 0.020
#> GSM151416     4  0.5546     0.5382 0.244 0.000 0.076 0.660 0.020
#> GSM151417     1  0.6288     0.5860 0.680 0.064 0.108 0.132 0.016
#> GSM151418     3  0.0000     0.8372 0.000 0.000 1.000 0.000 0.000
#> GSM151419     1  0.3999     0.4501 0.656 0.000 0.000 0.000 0.344
#> GSM151420     1  0.0609     0.9000 0.980 0.000 0.000 0.000 0.020
#> GSM151421     2  0.0771     0.9311 0.004 0.976 0.000 0.000 0.020
#> GSM151422     1  0.0324     0.9040 0.992 0.004 0.000 0.000 0.004
#> GSM151423     3  0.2020     0.7895 0.000 0.000 0.900 0.000 0.100
#> GSM151424     2  0.0000     0.9381 0.000 1.000 0.000 0.000 0.000
#> GSM151425     2  0.0000     0.9381 0.000 1.000 0.000 0.000 0.000
#> GSM151426     4  0.5848     0.7120 0.000 0.000 0.192 0.608 0.200
#> GSM151427     3  0.2612     0.7368 0.000 0.000 0.868 0.124 0.008
#> GSM151428     1  0.0771     0.8966 0.976 0.020 0.000 0.000 0.004
#> GSM151429     2  0.3109     0.7263 0.200 0.800 0.000 0.000 0.000
#> GSM151430     4  0.0000     0.6412 0.000 0.000 0.000 1.000 0.000
#> GSM151431     4  0.0000     0.6412 0.000 0.000 0.000 1.000 0.000
#> GSM151432     1  0.0162     0.9043 0.996 0.000 0.000 0.000 0.004
#> GSM151433     1  0.0000     0.9047 1.000 0.000 0.000 0.000 0.000
#> GSM151434     2  0.1310     0.9176 0.024 0.956 0.000 0.000 0.020
#> GSM151435     1  0.0162     0.9043 0.996 0.000 0.000 0.000 0.004
#> GSM151436     2  0.0000     0.9381 0.000 1.000 0.000 0.000 0.000
#> GSM151437     1  0.0609     0.9000 0.980 0.000 0.000 0.000 0.020
#> GSM151438     5  0.4060     0.3614 0.360 0.000 0.000 0.000 0.640
#> GSM151439     2  0.0771     0.9311 0.004 0.976 0.000 0.000 0.020
#> GSM151440     2  0.0000     0.9381 0.000 1.000 0.000 0.000 0.000

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>           class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM151369     6  0.4681    0.69365 0.000 0.000 0.100 0.000 0.232 0.668
#> GSM151370     5  0.0603    0.64792 0.000 0.000 0.016 0.000 0.980 0.004
#> GSM151371     1  0.0717    0.84243 0.976 0.008 0.000 0.000 0.000 0.016
#> GSM151372     2  0.0820    0.91366 0.000 0.972 0.012 0.000 0.000 0.016
#> GSM151373     2  0.0993    0.91208 0.000 0.964 0.012 0.000 0.000 0.024
#> GSM151374     3  0.0000    0.85761 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM151375     3  0.0000    0.85761 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM151376     3  0.0000    0.85761 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM151377     3  0.0146    0.85574 0.000 0.000 0.996 0.000 0.004 0.000
#> GSM151378     3  0.1387    0.81127 0.000 0.000 0.932 0.000 0.068 0.000
#> GSM151379     3  0.3868   -0.07366 0.000 0.000 0.508 0.000 0.492 0.000
#> GSM151380     6  0.4704    0.69081 0.000 0.000 0.100 0.000 0.236 0.664
#> GSM151381     3  0.0000    0.85761 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM151382     2  0.1138    0.91151 0.000 0.960 0.012 0.000 0.004 0.024
#> GSM151383     2  0.3641    0.81139 0.064 0.816 0.000 0.004 0.012 0.104
#> GSM151384     1  0.3735    0.70877 0.784 0.124 0.000 0.000 0.000 0.092
#> GSM151385     1  0.5039    0.60384 0.640 0.000 0.000 0.236 0.004 0.120
#> GSM151386     1  0.3735    0.70877 0.784 0.124 0.000 0.000 0.000 0.092
#> GSM151387     5  0.0508    0.64485 0.000 0.000 0.012 0.000 0.984 0.004
#> GSM151388     5  0.1563    0.63615 0.000 0.000 0.056 0.000 0.932 0.012
#> GSM151389     5  0.5117    0.21646 0.000 0.000 0.116 0.000 0.596 0.288
#> GSM151390     3  0.0000    0.85761 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM151391     5  0.4482    0.42487 0.000 0.000 0.124 0.000 0.708 0.168
#> GSM151392     6  0.4704    0.68960 0.000 0.000 0.100 0.000 0.236 0.664
#> GSM151393     3  0.4895   -0.00383 0.000 0.000 0.496 0.000 0.444 0.060
#> GSM151394     1  0.0000    0.84287 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM151395     2  0.0725    0.91133 0.000 0.976 0.000 0.000 0.012 0.012
#> GSM151396     2  0.0713    0.91018 0.000 0.972 0.000 0.000 0.000 0.028
#> GSM151397     1  0.2170    0.82650 0.888 0.000 0.000 0.012 0.000 0.100
#> GSM151398     6  0.5990    0.61326 0.000 0.000 0.024 0.192 0.232 0.552
#> GSM151399     2  0.0508    0.91225 0.000 0.984 0.000 0.000 0.012 0.004
#> GSM151400     5  0.1196    0.61461 0.000 0.000 0.008 0.040 0.952 0.000
#> GSM151401     2  0.0508    0.91392 0.000 0.984 0.012 0.000 0.000 0.004
#> GSM151402     3  0.0000    0.85761 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM151403     3  0.2902    0.64311 0.000 0.000 0.800 0.000 0.196 0.004
#> GSM151404     6  0.4681    0.69365 0.000 0.000 0.100 0.000 0.232 0.668
#> GSM151405     5  0.0603    0.64792 0.000 0.000 0.016 0.000 0.980 0.004
#> GSM151406     5  0.6738    0.11009 0.008 0.316 0.292 0.008 0.368 0.008
#> GSM151407     4  0.3050    0.99491 0.000 0.000 0.000 0.764 0.236 0.000
#> GSM151408     4  0.3245    0.98474 0.000 0.008 0.000 0.764 0.228 0.000
#> GSM151409     1  0.1625    0.82874 0.928 0.000 0.000 0.012 0.000 0.060
#> GSM151410     2  0.7552    0.13181 0.100 0.468 0.000 0.192 0.200 0.040
#> GSM151411     1  0.1007    0.84304 0.956 0.000 0.000 0.000 0.000 0.044
#> GSM151412     2  0.1225    0.91327 0.000 0.952 0.012 0.000 0.000 0.036
#> GSM151413     6  0.5437    0.45052 0.012 0.000 0.024 0.364 0.044 0.556
#> GSM151414     1  0.5587    0.49186 0.568 0.000 0.000 0.236 0.004 0.192
#> GSM151415     1  0.1152    0.83790 0.952 0.004 0.000 0.000 0.000 0.044
#> GSM151416     5  0.3628    0.44768 0.100 0.000 0.004 0.060 0.820 0.016
#> GSM151417     5  0.7040   -0.03059 0.380 0.072 0.000 0.016 0.396 0.136
#> GSM151418     3  0.0000    0.85761 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM151419     1  0.6244    0.27506 0.468 0.000 0.000 0.236 0.016 0.280
#> GSM151420     1  0.0146    0.84287 0.996 0.000 0.000 0.000 0.000 0.004
#> GSM151421     2  0.1858    0.88889 0.000 0.912 0.000 0.000 0.012 0.076
#> GSM151422     1  0.3940    0.78059 0.772 0.020 0.000 0.012 0.016 0.180
#> GSM151423     3  0.1806    0.78644 0.000 0.000 0.908 0.000 0.088 0.004
#> GSM151424     2  0.0458    0.91377 0.000 0.984 0.000 0.000 0.000 0.016
#> GSM151425     2  0.0790    0.91386 0.000 0.968 0.000 0.000 0.000 0.032
#> GSM151426     5  0.0767    0.63074 0.000 0.000 0.004 0.012 0.976 0.008
#> GSM151427     5  0.3868   -0.04763 0.000 0.000 0.496 0.000 0.504 0.000
#> GSM151428     1  0.2446    0.76999 0.864 0.124 0.000 0.000 0.012 0.000
#> GSM151429     2  0.3729    0.75901 0.156 0.788 0.000 0.000 0.012 0.044
#> GSM151430     4  0.3050    0.99491 0.000 0.000 0.000 0.764 0.236 0.000
#> GSM151431     4  0.3050    0.99491 0.000 0.000 0.000 0.764 0.236 0.000
#> GSM151432     1  0.0458    0.84251 0.984 0.000 0.000 0.000 0.000 0.016
#> GSM151433     1  0.0458    0.84251 0.984 0.000 0.000 0.000 0.000 0.016
#> GSM151434     2  0.3575    0.80714 0.092 0.816 0.000 0.000 0.012 0.080
#> GSM151435     1  0.4343    0.72431 0.724 0.000 0.000 0.120 0.000 0.156
#> GSM151436     2  0.1225    0.91327 0.000 0.952 0.012 0.000 0.000 0.036
#> GSM151437     1  0.0146    0.84287 0.996 0.000 0.000 0.000 0.000 0.004
#> GSM151438     6  0.5934    0.35196 0.212 0.000 0.000 0.228 0.016 0.544
#> GSM151439     2  0.1858    0.88889 0.000 0.912 0.000 0.000 0.012 0.076
#> GSM151440     2  0.0000    0.91386 0.000 1.000 0.000 0.000 0.000 0.000

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

consensus_heatmap(res, k = 2)

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

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

collect_plots(res)

plot of chunk CV-NMF-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.535           0.810       0.911         0.4940 0.499   0.499
#> 3 3 0.407           0.647       0.799         0.3133 0.797   0.614
#> 4 4 0.472           0.582       0.751         0.1419 0.770   0.441
#> 5 5 0.504           0.502       0.684         0.0645 0.910   0.662
#> 6 6 0.578           0.446       0.670         0.0463 0.941   0.727

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
#> GSM151369     1  0.7219      0.775 0.800 0.200
#> GSM151370     2  0.0000      0.914 0.000 1.000
#> GSM151371     1  0.0000      0.870 1.000 0.000
#> GSM151372     2  0.0000      0.914 0.000 1.000
#> GSM151373     2  0.0000      0.914 0.000 1.000
#> GSM151374     2  0.0000      0.914 0.000 1.000
#> GSM151375     2  0.0000      0.914 0.000 1.000
#> GSM151376     2  0.0000      0.914 0.000 1.000
#> GSM151377     2  0.0000      0.914 0.000 1.000
#> GSM151378     2  0.0000      0.914 0.000 1.000
#> GSM151379     2  0.0000      0.914 0.000 1.000
#> GSM151380     1  0.9580      0.551 0.620 0.380
#> GSM151381     2  0.0000      0.914 0.000 1.000
#> GSM151382     2  0.0376      0.912 0.004 0.996
#> GSM151383     2  0.7674      0.732 0.224 0.776
#> GSM151384     1  0.7139      0.777 0.804 0.196
#> GSM151385     1  0.0000      0.870 1.000 0.000
#> GSM151386     1  0.7219      0.775 0.800 0.200
#> GSM151387     2  0.0000      0.914 0.000 1.000
#> GSM151388     1  0.8713      0.566 0.708 0.292
#> GSM151389     2  0.0000      0.914 0.000 1.000
#> GSM151390     2  0.0000      0.914 0.000 1.000
#> GSM151391     2  0.1843      0.899 0.028 0.972
#> GSM151392     2  0.9996     -0.234 0.488 0.512
#> GSM151393     2  0.0000      0.914 0.000 1.000
#> GSM151394     1  0.5059      0.831 0.888 0.112
#> GSM151395     1  0.9552      0.404 0.624 0.376
#> GSM151396     2  0.5946      0.809 0.144 0.856
#> GSM151397     1  0.0000      0.870 1.000 0.000
#> GSM151398     1  0.7219      0.775 0.800 0.200
#> GSM151399     2  0.7219      0.756 0.200 0.800
#> GSM151400     2  0.9323      0.532 0.348 0.652
#> GSM151401     2  0.0000      0.914 0.000 1.000
#> GSM151402     2  0.0000      0.914 0.000 1.000
#> GSM151403     2  0.0000      0.914 0.000 1.000
#> GSM151404     1  0.7219      0.775 0.800 0.200
#> GSM151405     2  0.5059      0.805 0.112 0.888
#> GSM151406     2  0.0000      0.914 0.000 1.000
#> GSM151407     2  0.7219      0.756 0.200 0.800
#> GSM151408     2  0.7219      0.756 0.200 0.800
#> GSM151409     1  0.0000      0.870 1.000 0.000
#> GSM151410     2  0.9922      0.265 0.448 0.552
#> GSM151411     1  0.1414      0.868 0.980 0.020
#> GSM151412     2  0.1184      0.906 0.016 0.984
#> GSM151413     1  0.0000      0.870 1.000 0.000
#> GSM151414     1  0.0000      0.870 1.000 0.000
#> GSM151415     1  0.2948      0.858 0.948 0.052
#> GSM151416     1  0.3879      0.832 0.924 0.076
#> GSM151417     1  0.0672      0.868 0.992 0.008
#> GSM151418     2  0.0000      0.914 0.000 1.000
#> GSM151419     1  0.0000      0.870 1.000 0.000
#> GSM151420     1  0.0000      0.870 1.000 0.000
#> GSM151421     1  0.9580      0.536 0.620 0.380
#> GSM151422     1  0.0000      0.870 1.000 0.000
#> GSM151423     2  0.0000      0.914 0.000 1.000
#> GSM151424     2  0.0000      0.914 0.000 1.000
#> GSM151425     2  0.0000      0.914 0.000 1.000
#> GSM151426     2  0.2043      0.897 0.032 0.968
#> GSM151427     2  0.0000      0.914 0.000 1.000
#> GSM151428     1  0.0000      0.870 1.000 0.000
#> GSM151429     1  0.8386      0.606 0.732 0.268
#> GSM151430     2  0.7219      0.756 0.200 0.800
#> GSM151431     2  0.7219      0.756 0.200 0.800
#> GSM151432     1  0.1184      0.868 0.984 0.016
#> GSM151433     1  0.0000      0.870 1.000 0.000
#> GSM151434     1  0.7056      0.780 0.808 0.192
#> GSM151435     1  0.0000      0.870 1.000 0.000
#> GSM151436     2  0.0000      0.914 0.000 1.000
#> GSM151437     1  0.0000      0.870 1.000 0.000
#> GSM151438     1  0.0376      0.870 0.996 0.004
#> GSM151439     1  0.9686      0.519 0.604 0.396
#> GSM151440     2  0.0672      0.910 0.008 0.992

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>           class entropy silhouette    p1    p2    p3
#> GSM151369     3  0.7785    -0.0805 0.420 0.052 0.528
#> GSM151370     2  0.3983     0.6859 0.004 0.852 0.144
#> GSM151371     1  0.1163     0.8297 0.972 0.028 0.000
#> GSM151372     3  0.4539     0.6388 0.016 0.148 0.836
#> GSM151373     2  0.4979     0.6805 0.020 0.812 0.168
#> GSM151374     3  0.1411     0.7751 0.000 0.036 0.964
#> GSM151375     3  0.1289     0.7820 0.000 0.032 0.968
#> GSM151376     3  0.1163     0.7822 0.000 0.028 0.972
#> GSM151377     3  0.0424     0.7757 0.000 0.008 0.992
#> GSM151378     3  0.6280    -0.1532 0.000 0.460 0.540
#> GSM151379     2  0.5431     0.6213 0.000 0.716 0.284
#> GSM151380     1  0.6621     0.7144 0.752 0.100 0.148
#> GSM151381     3  0.0892     0.7813 0.000 0.020 0.980
#> GSM151382     2  0.4802     0.6892 0.020 0.824 0.156
#> GSM151383     2  0.3192     0.7022 0.112 0.888 0.000
#> GSM151384     1  0.5237     0.8031 0.824 0.120 0.056
#> GSM151385     1  0.0747     0.8201 0.984 0.016 0.000
#> GSM151386     1  0.6462     0.7733 0.764 0.120 0.116
#> GSM151387     2  0.3816     0.6842 0.000 0.852 0.148
#> GSM151388     1  0.7517     0.2699 0.540 0.420 0.040
#> GSM151389     2  0.5902     0.5613 0.004 0.680 0.316
#> GSM151390     3  0.3619     0.7075 0.000 0.136 0.864
#> GSM151391     2  0.7731     0.5849 0.108 0.664 0.228
#> GSM151392     1  0.7945     0.4077 0.548 0.064 0.388
#> GSM151393     3  0.6154     0.0708 0.000 0.408 0.592
#> GSM151394     1  0.4660     0.7757 0.856 0.072 0.072
#> GSM151395     1  0.8079     0.6167 0.624 0.268 0.108
#> GSM151396     2  0.5987     0.6274 0.036 0.756 0.208
#> GSM151397     1  0.3116     0.8272 0.892 0.108 0.000
#> GSM151398     1  0.5696     0.7382 0.800 0.064 0.136
#> GSM151399     2  0.3183     0.7106 0.076 0.908 0.016
#> GSM151400     2  0.5812     0.5876 0.264 0.724 0.012
#> GSM151401     2  0.4326     0.6986 0.012 0.844 0.144
#> GSM151402     3  0.1031     0.7829 0.000 0.024 0.976
#> GSM151403     3  0.2165     0.7509 0.000 0.064 0.936
#> GSM151404     1  0.6062     0.7264 0.776 0.064 0.160
#> GSM151405     2  0.4921     0.6854 0.020 0.816 0.164
#> GSM151406     2  0.5958     0.5893 0.008 0.692 0.300
#> GSM151407     2  0.3340     0.7100 0.120 0.880 0.000
#> GSM151408     2  0.3619     0.7086 0.136 0.864 0.000
#> GSM151409     1  0.1989     0.8169 0.948 0.048 0.004
#> GSM151410     2  0.4654     0.6822 0.208 0.792 0.000
#> GSM151411     1  0.1832     0.8296 0.956 0.036 0.008
#> GSM151412     2  0.5521     0.6663 0.032 0.788 0.180
#> GSM151413     1  0.2165     0.8315 0.936 0.064 0.000
#> GSM151414     1  0.1163     0.8141 0.972 0.028 0.000
#> GSM151415     1  0.5036     0.8064 0.832 0.120 0.048
#> GSM151416     2  0.6180     0.2354 0.416 0.584 0.000
#> GSM151417     1  0.3682     0.8231 0.876 0.116 0.008
#> GSM151418     3  0.0000     0.7782 0.000 0.000 1.000
#> GSM151419     1  0.2959     0.8288 0.900 0.100 0.000
#> GSM151420     1  0.0747     0.8168 0.984 0.016 0.000
#> GSM151421     1  0.8430     0.5616 0.588 0.120 0.292
#> GSM151422     1  0.3116     0.8273 0.892 0.108 0.000
#> GSM151423     3  0.1411     0.7723 0.000 0.036 0.964
#> GSM151424     2  0.6617     0.3091 0.012 0.600 0.388
#> GSM151425     2  0.6955    -0.0441 0.016 0.492 0.492
#> GSM151426     2  0.4063     0.6921 0.020 0.868 0.112
#> GSM151427     2  0.5098     0.6430 0.000 0.752 0.248
#> GSM151428     1  0.2261     0.8008 0.932 0.068 0.000
#> GSM151429     1  0.6309     0.1006 0.504 0.496 0.000
#> GSM151430     2  0.4291     0.6938 0.180 0.820 0.000
#> GSM151431     2  0.4291     0.6964 0.180 0.820 0.000
#> GSM151432     1  0.2703     0.8349 0.928 0.056 0.016
#> GSM151433     1  0.2860     0.8308 0.912 0.084 0.004
#> GSM151434     1  0.7923     0.6555 0.652 0.120 0.228
#> GSM151435     1  0.1411     0.8309 0.964 0.036 0.000
#> GSM151436     3  0.7036     0.1005 0.020 0.444 0.536
#> GSM151437     1  0.0892     0.8190 0.980 0.020 0.000
#> GSM151438     1  0.3425     0.8259 0.884 0.112 0.004
#> GSM151439     1  0.8233     0.6062 0.616 0.120 0.264
#> GSM151440     2  0.5939     0.6233 0.028 0.748 0.224

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM151369     3   0.567    0.62212 0.168 0.012 0.736 0.084
#> GSM151370     4   0.541    0.60253 0.008 0.068 0.180 0.744
#> GSM151371     1   0.369    0.85856 0.860 0.088 0.004 0.048
#> GSM151372     2   0.580    0.50238 0.004 0.688 0.240 0.068
#> GSM151373     2   0.576    0.19931 0.000 0.568 0.032 0.400
#> GSM151374     3   0.227    0.70622 0.000 0.076 0.916 0.008
#> GSM151375     3   0.273    0.71498 0.008 0.032 0.912 0.048
#> GSM151376     3   0.265    0.71465 0.008 0.036 0.916 0.040
#> GSM151377     3   0.332    0.69038 0.012 0.112 0.868 0.008
#> GSM151378     3   0.761   -0.09562 0.000 0.240 0.472 0.288
#> GSM151379     4   0.754    0.39995 0.000 0.296 0.220 0.484
#> GSM151380     3   0.805    0.16793 0.368 0.008 0.384 0.240
#> GSM151381     3   0.307    0.70833 0.004 0.084 0.888 0.024
#> GSM151382     2   0.594    0.03803 0.004 0.504 0.028 0.464
#> GSM151383     4   0.646    0.21510 0.064 0.384 0.004 0.548
#> GSM151384     2   0.537   -0.00391 0.412 0.576 0.008 0.004
#> GSM151385     1   0.106    0.85770 0.972 0.012 0.000 0.016
#> GSM151386     1   0.566    0.38186 0.544 0.436 0.012 0.008
#> GSM151387     4   0.574    0.62388 0.008 0.116 0.144 0.732
#> GSM151388     4   0.677    0.17696 0.364 0.008 0.080 0.548
#> GSM151389     3   0.593    0.30665 0.028 0.008 0.580 0.384
#> GSM151390     3   0.641    0.32706 0.000 0.288 0.612 0.100
#> GSM151391     4   0.758    0.06518 0.124 0.016 0.416 0.444
#> GSM151392     3   0.673    0.51869 0.252 0.012 0.628 0.108
#> GSM151393     3   0.299    0.67441 0.000 0.016 0.880 0.104
#> GSM151394     1   0.471    0.78574 0.816 0.020 0.092 0.072
#> GSM151395     2   0.345    0.65394 0.112 0.864 0.012 0.012
#> GSM151396     2   0.269    0.67039 0.032 0.916 0.012 0.040
#> GSM151397     1   0.429    0.82775 0.812 0.136 0.000 0.052
#> GSM151398     1   0.611    0.59680 0.688 0.008 0.208 0.096
#> GSM151399     2   0.552    0.50683 0.060 0.696 0.000 0.244
#> GSM151400     4   0.651    0.58377 0.120 0.152 0.032 0.696
#> GSM151401     2   0.538    0.38905 0.000 0.648 0.028 0.324
#> GSM151402     3   0.112    0.71400 0.000 0.036 0.964 0.000
#> GSM151403     3   0.273    0.69686 0.004 0.008 0.896 0.092
#> GSM151404     3   0.713    0.15527 0.428 0.008 0.464 0.100
#> GSM151405     4   0.748    0.50024 0.036 0.128 0.244 0.592
#> GSM151406     4   0.812    0.34384 0.020 0.208 0.312 0.460
#> GSM151407     4   0.484    0.59441 0.056 0.148 0.008 0.788
#> GSM151408     4   0.461    0.58968 0.064 0.144 0.000 0.792
#> GSM151409     1   0.307    0.83985 0.896 0.020 0.016 0.068
#> GSM151410     4   0.440    0.61262 0.112 0.076 0.000 0.812
#> GSM151411     1   0.298    0.85020 0.900 0.024 0.012 0.064
#> GSM151412     2   0.438    0.60838 0.000 0.796 0.040 0.164
#> GSM151413     1   0.284    0.85602 0.900 0.044 0.000 0.056
#> GSM151414     1   0.228    0.81517 0.904 0.000 0.000 0.096
#> GSM151415     1   0.482    0.62391 0.652 0.344 0.000 0.004
#> GSM151416     4   0.510    0.25048 0.368 0.004 0.004 0.624
#> GSM151417     1   0.441    0.82921 0.812 0.108 0.000 0.080
#> GSM151418     3   0.222    0.71160 0.016 0.060 0.924 0.000
#> GSM151419     1   0.248    0.85845 0.904 0.088 0.000 0.008
#> GSM151420     1   0.182    0.86083 0.944 0.036 0.000 0.020
#> GSM151421     2   0.334    0.63132 0.128 0.856 0.016 0.000
#> GSM151422     1   0.300    0.84446 0.864 0.132 0.000 0.004
#> GSM151423     3   0.203    0.70828 0.000 0.036 0.936 0.028
#> GSM151424     2   0.361    0.65463 0.012 0.868 0.032 0.088
#> GSM151425     2   0.243    0.66440 0.020 0.928 0.024 0.028
#> GSM151426     4   0.390    0.64467 0.000 0.072 0.084 0.844
#> GSM151427     4   0.685    0.53792 0.000 0.212 0.188 0.600
#> GSM151428     1   0.388    0.82840 0.840 0.048 0.000 0.112
#> GSM151429     2   0.782    0.21173 0.280 0.412 0.000 0.308
#> GSM151430     4   0.347    0.61853 0.068 0.064 0.000 0.868
#> GSM151431     4   0.347    0.61125 0.064 0.068 0.000 0.868
#> GSM151432     1   0.404    0.85625 0.848 0.088 0.012 0.052
#> GSM151433     1   0.293    0.85444 0.880 0.108 0.000 0.012
#> GSM151434     2   0.445    0.43726 0.260 0.732 0.008 0.000
#> GSM151435     1   0.161    0.86230 0.952 0.032 0.000 0.016
#> GSM151436     2   0.343    0.64654 0.004 0.868 0.028 0.100
#> GSM151437     1   0.200    0.85919 0.936 0.044 0.000 0.020
#> GSM151438     1   0.350    0.83794 0.844 0.140 0.000 0.016
#> GSM151439     2   0.338    0.62372 0.140 0.848 0.012 0.000
#> GSM151440     2   0.316    0.64927 0.004 0.868 0.008 0.120

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>           class entropy silhouette    p1    p2    p3    p4    p5
#> GSM151369     3  0.6223     0.3170 0.196 0.016 0.604 0.000 0.184
#> GSM151370     5  0.5534     0.5430 0.000 0.028 0.088 0.196 0.688
#> GSM151371     1  0.5492     0.7092 0.692 0.112 0.000 0.020 0.176
#> GSM151372     2  0.7681     0.2936 0.008 0.476 0.256 0.064 0.196
#> GSM151373     2  0.6724     0.3515 0.000 0.568 0.036 0.200 0.196
#> GSM151374     3  0.3209     0.6235 0.000 0.068 0.864 0.008 0.060
#> GSM151375     3  0.4883     0.4709 0.000 0.048 0.652 0.000 0.300
#> GSM151376     3  0.4508     0.5336 0.004 0.032 0.708 0.000 0.256
#> GSM151377     3  0.2554     0.6440 0.000 0.072 0.892 0.000 0.036
#> GSM151378     3  0.8453    -0.0298 0.000 0.296 0.312 0.176 0.216
#> GSM151379     4  0.8183     0.3002 0.000 0.196 0.136 0.380 0.288
#> GSM151380     5  0.7004     0.4670 0.156 0.000 0.224 0.064 0.556
#> GSM151381     3  0.5597    -0.0449 0.000 0.072 0.488 0.000 0.440
#> GSM151382     4  0.7038     0.0342 0.008 0.392 0.016 0.420 0.164
#> GSM151383     4  0.7202     0.3193 0.032 0.252 0.016 0.532 0.168
#> GSM151384     2  0.5520    -0.1224 0.420 0.532 0.016 0.004 0.028
#> GSM151385     1  0.1758     0.7999 0.944 0.004 0.008 0.024 0.020
#> GSM151386     1  0.6002     0.4504 0.540 0.376 0.036 0.000 0.048
#> GSM151387     5  0.6059     0.3088 0.000 0.044 0.048 0.348 0.560
#> GSM151388     5  0.6991     0.3302 0.144 0.000 0.040 0.332 0.484
#> GSM151389     5  0.6285     0.3940 0.004 0.000 0.272 0.176 0.548
#> GSM151390     5  0.6500     0.2049 0.000 0.132 0.348 0.016 0.504
#> GSM151391     4  0.6852     0.0853 0.044 0.000 0.364 0.480 0.112
#> GSM151392     5  0.6609     0.2018 0.132 0.008 0.368 0.008 0.484
#> GSM151393     3  0.4343     0.5008 0.000 0.012 0.768 0.176 0.044
#> GSM151394     1  0.5923     0.5855 0.656 0.028 0.068 0.012 0.236
#> GSM151395     2  0.4945     0.5907 0.084 0.764 0.004 0.032 0.116
#> GSM151396     2  0.3570     0.6287 0.020 0.856 0.008 0.040 0.076
#> GSM151397     1  0.4961     0.7655 0.764 0.112 0.008 0.092 0.024
#> GSM151398     5  0.6773     0.2281 0.376 0.008 0.128 0.016 0.472
#> GSM151399     2  0.5774     0.5294 0.024 0.668 0.000 0.184 0.124
#> GSM151400     4  0.6934     0.4916 0.144 0.116 0.008 0.616 0.116
#> GSM151401     2  0.6362     0.3979 0.000 0.616 0.036 0.196 0.152
#> GSM151402     3  0.0880     0.6532 0.000 0.032 0.968 0.000 0.000
#> GSM151403     3  0.4003     0.5174 0.000 0.008 0.740 0.008 0.244
#> GSM151404     5  0.6797     0.3947 0.200 0.004 0.272 0.012 0.512
#> GSM151405     5  0.5461     0.5579 0.008 0.052 0.080 0.124 0.736
#> GSM151406     5  0.5431     0.5298 0.008 0.060 0.120 0.072 0.740
#> GSM151407     4  0.3248     0.5987 0.004 0.104 0.000 0.852 0.040
#> GSM151408     4  0.4081     0.5750 0.008 0.096 0.004 0.812 0.080
#> GSM151409     1  0.3448     0.7957 0.852 0.020 0.016 0.008 0.104
#> GSM151410     4  0.3380     0.5720 0.052 0.052 0.000 0.864 0.032
#> GSM151411     1  0.3117     0.7998 0.860 0.036 0.004 0.000 0.100
#> GSM151412     2  0.5698     0.5567 0.004 0.696 0.028 0.136 0.136
#> GSM151413     1  0.2992     0.8024 0.884 0.020 0.008 0.072 0.016
#> GSM151414     1  0.3247     0.7605 0.868 0.004 0.012 0.076 0.040
#> GSM151415     1  0.5362     0.5973 0.616 0.332 0.004 0.016 0.032
#> GSM151416     4  0.5474     0.3026 0.224 0.000 0.008 0.664 0.104
#> GSM151417     1  0.6767     0.5642 0.576 0.132 0.008 0.248 0.036
#> GSM151418     3  0.1701     0.6531 0.000 0.048 0.936 0.000 0.016
#> GSM151419     1  0.2862     0.8145 0.892 0.060 0.004 0.024 0.020
#> GSM151420     1  0.2346     0.8091 0.920 0.024 0.008 0.012 0.036
#> GSM151421     2  0.4139     0.5679 0.148 0.800 0.016 0.008 0.028
#> GSM151422     1  0.5518     0.6908 0.696 0.212 0.012 0.052 0.028
#> GSM151423     3  0.1413     0.6489 0.000 0.020 0.956 0.012 0.012
#> GSM151424     2  0.4451     0.6082 0.004 0.796 0.024 0.108 0.068
#> GSM151425     2  0.4315     0.6176 0.012 0.816 0.048 0.032 0.092
#> GSM151426     4  0.5812     0.1847 0.000 0.044 0.036 0.588 0.332
#> GSM151427     4  0.6978     0.4264 0.000 0.120 0.108 0.584 0.188
#> GSM151428     1  0.5174     0.7565 0.744 0.052 0.000 0.128 0.076
#> GSM151429     4  0.8448    -0.1355 0.232 0.308 0.004 0.320 0.136
#> GSM151430     4  0.1461     0.5771 0.004 0.016 0.000 0.952 0.028
#> GSM151431     4  0.0727     0.5826 0.004 0.012 0.000 0.980 0.004
#> GSM151432     1  0.4370     0.8005 0.796 0.096 0.008 0.008 0.092
#> GSM151433     1  0.3496     0.8102 0.848 0.096 0.000 0.020 0.036
#> GSM151434     2  0.6179     0.1280 0.336 0.564 0.004 0.028 0.068
#> GSM151435     1  0.1059     0.8065 0.968 0.004 0.000 0.020 0.008
#> GSM151436     2  0.5242     0.5551 0.000 0.720 0.020 0.116 0.144
#> GSM151437     1  0.2889     0.8072 0.888 0.056 0.008 0.004 0.044
#> GSM151438     1  0.4639     0.7830 0.784 0.128 0.012 0.020 0.056
#> GSM151439     2  0.4527     0.5877 0.124 0.792 0.020 0.012 0.052
#> GSM151440     2  0.5184     0.5471 0.004 0.732 0.016 0.124 0.124

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>           class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM151369     3  0.7410  -7.16e-02 0.224 0.024 0.352 0.000 0.340 0.060
#> GSM151370     5  0.4015   6.16e-01 0.004 0.036 0.020 0.100 0.812 0.028
#> GSM151371     1  0.6024   4.56e-01 0.536 0.040 0.000 0.000 0.120 0.304
#> GSM151372     6  0.7091   4.20e-01 0.004 0.148 0.216 0.056 0.044 0.532
#> GSM151373     2  0.7087   9.40e-02 0.000 0.512 0.032 0.088 0.124 0.244
#> GSM151374     3  0.4705   5.14e-01 0.000 0.040 0.720 0.008 0.036 0.196
#> GSM151375     5  0.5986   9.89e-02 0.000 0.048 0.384 0.000 0.484 0.084
#> GSM151376     5  0.5819  -2.95e-03 0.000 0.048 0.440 0.000 0.448 0.064
#> GSM151377     3  0.2763   6.05e-01 0.000 0.052 0.880 0.000 0.028 0.040
#> GSM151378     3  0.8591  -9.34e-02 0.000 0.248 0.272 0.080 0.236 0.164
#> GSM151379     6  0.8408   2.83e-01 0.000 0.156 0.084 0.208 0.188 0.364
#> GSM151380     5  0.4271   6.01e-01 0.112 0.000 0.040 0.044 0.788 0.016
#> GSM151381     5  0.5714   2.11e-01 0.000 0.060 0.376 0.000 0.516 0.048
#> GSM151382     6  0.6855   4.43e-01 0.000 0.156 0.032 0.288 0.036 0.488
#> GSM151383     6  0.5279   4.17e-01 0.020 0.044 0.016 0.256 0.008 0.656
#> GSM151384     2  0.5292  -6.86e-02 0.392 0.524 0.000 0.000 0.012 0.072
#> GSM151385     1  0.1938   7.20e-01 0.932 0.008 0.012 0.004 0.024 0.020
#> GSM151386     1  0.6763   2.94e-01 0.464 0.360 0.048 0.004 0.024 0.100
#> GSM151387     5  0.3990   6.01e-01 0.000 0.028 0.012 0.120 0.800 0.040
#> GSM151388     5  0.6870   2.26e-01 0.104 0.004 0.020 0.312 0.492 0.068
#> GSM151389     5  0.4608   5.89e-01 0.004 0.008 0.076 0.160 0.740 0.012
#> GSM151390     5  0.6030   4.14e-01 0.000 0.140 0.212 0.004 0.596 0.048
#> GSM151391     3  0.6479  -8.54e-05 0.044 0.000 0.444 0.412 0.060 0.040
#> GSM151392     5  0.5279   5.55e-01 0.116 0.024 0.084 0.008 0.728 0.040
#> GSM151393     3  0.3951   5.19e-01 0.000 0.016 0.736 0.232 0.008 0.008
#> GSM151394     1  0.6588   4.40e-01 0.540 0.012 0.032 0.008 0.228 0.180
#> GSM151395     2  0.3511   5.28e-01 0.040 0.844 0.000 0.072 0.020 0.024
#> GSM151396     2  0.2932   5.43e-01 0.008 0.884 0.008 0.028 0.032 0.040
#> GSM151397     1  0.5874   6.26e-01 0.664 0.140 0.008 0.044 0.016 0.128
#> GSM151398     5  0.6701   3.71e-01 0.288 0.004 0.124 0.016 0.516 0.052
#> GSM151399     2  0.5152   4.59e-01 0.008 0.716 0.000 0.132 0.064 0.080
#> GSM151400     4  0.5983   5.37e-01 0.092 0.084 0.012 0.692 0.052 0.068
#> GSM151401     2  0.5745   3.89e-01 0.000 0.676 0.016 0.112 0.112 0.084
#> GSM151402     3  0.1829   6.12e-01 0.000 0.028 0.928 0.000 0.036 0.008
#> GSM151403     3  0.3850   2.65e-01 0.000 0.000 0.652 0.004 0.340 0.004
#> GSM151404     5  0.5213   5.41e-01 0.160 0.000 0.096 0.016 0.700 0.028
#> GSM151405     5  0.3950   6.24e-01 0.012 0.044 0.016 0.080 0.824 0.024
#> GSM151406     5  0.3484   6.21e-01 0.012 0.052 0.016 0.024 0.856 0.040
#> GSM151407     4  0.3266   5.91e-01 0.000 0.036 0.000 0.824 0.008 0.132
#> GSM151408     4  0.3921   3.46e-01 0.000 0.012 0.000 0.676 0.004 0.308
#> GSM151409     1  0.4104   7.16e-01 0.812 0.036 0.008 0.020 0.092 0.032
#> GSM151410     4  0.2802   6.45e-01 0.004 0.020 0.008 0.884 0.020 0.064
#> GSM151411     1  0.3534   7.07e-01 0.820 0.004 0.008 0.004 0.124 0.040
#> GSM151412     2  0.5208   3.73e-01 0.000 0.676 0.008 0.056 0.044 0.216
#> GSM151413     1  0.3281   7.11e-01 0.848 0.004 0.000 0.048 0.020 0.080
#> GSM151414     1  0.3902   6.95e-01 0.824 0.004 0.012 0.064 0.036 0.060
#> GSM151415     1  0.5536   5.51e-01 0.616 0.288 0.012 0.024 0.008 0.052
#> GSM151416     4  0.4422   5.82e-01 0.084 0.000 0.008 0.780 0.064 0.064
#> GSM151417     1  0.7040   2.72e-01 0.420 0.160 0.012 0.348 0.004 0.056
#> GSM151418     3  0.2628   6.08e-01 0.000 0.068 0.884 0.000 0.024 0.024
#> GSM151419     1  0.3128   7.18e-01 0.872 0.048 0.008 0.016 0.012 0.044
#> GSM151420     1  0.3109   7.15e-01 0.868 0.016 0.012 0.004 0.032 0.068
#> GSM151421     2  0.4083   4.70e-01 0.116 0.768 0.000 0.000 0.008 0.108
#> GSM151422     1  0.6276   5.19e-01 0.588 0.256 0.012 0.076 0.012 0.056
#> GSM151423     3  0.2521   6.13e-01 0.000 0.016 0.900 0.012 0.028 0.044
#> GSM151424     2  0.4510   4.59e-01 0.004 0.744 0.020 0.032 0.016 0.184
#> GSM151425     2  0.3470   5.25e-01 0.000 0.852 0.036 0.028 0.036 0.048
#> GSM151426     4  0.5918   2.04e-01 0.008 0.088 0.000 0.520 0.356 0.028
#> GSM151427     4  0.7544   2.49e-01 0.000 0.088 0.072 0.500 0.160 0.180
#> GSM151428     1  0.7432   3.71e-01 0.460 0.048 0.000 0.136 0.080 0.276
#> GSM151429     6  0.6899   3.25e-01 0.108 0.124 0.000 0.240 0.012 0.516
#> GSM151430     4  0.0972   6.57e-01 0.000 0.000 0.000 0.964 0.008 0.028
#> GSM151431     4  0.2425   6.36e-01 0.012 0.000 0.000 0.880 0.008 0.100
#> GSM151432     1  0.5927   6.57e-01 0.652 0.060 0.008 0.012 0.088 0.180
#> GSM151433     1  0.4477   7.12e-01 0.780 0.060 0.016 0.008 0.024 0.112
#> GSM151434     2  0.6684  -3.13e-02 0.328 0.448 0.028 0.004 0.008 0.184
#> GSM151435     1  0.1885   7.22e-01 0.932 0.012 0.008 0.004 0.008 0.036
#> GSM151436     2  0.5931  -1.50e-01 0.000 0.456 0.024 0.052 0.028 0.440
#> GSM151437     1  0.3831   7.02e-01 0.824 0.032 0.012 0.008 0.028 0.096
#> GSM151438     1  0.5302   6.39e-01 0.700 0.188 0.016 0.028 0.016 0.052
#> GSM151439     2  0.5026   4.27e-01 0.060 0.688 0.016 0.004 0.012 0.220
#> GSM151440     6  0.5328   1.81e-01 0.004 0.368 0.008 0.064 0.004 0.552

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

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

collect_plots(res)

plot of chunk MAD-hclust-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.835           0.870       0.950         0.4816 0.512   0.512
#> 3 3 0.686           0.742       0.892         0.3301 0.841   0.690
#> 4 4 0.607           0.693       0.790         0.1161 0.841   0.588
#> 5 5 0.651           0.689       0.830         0.0806 0.923   0.718
#> 6 6 0.708           0.657       0.818         0.0346 0.998   0.989

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
#> GSM151369     1  0.5059     0.8555 0.888 0.112
#> GSM151370     2  0.0672     0.9533 0.008 0.992
#> GSM151371     1  0.9795     0.2966 0.584 0.416
#> GSM151372     2  0.0000     0.9533 0.000 1.000
#> GSM151373     2  0.0000     0.9533 0.000 1.000
#> GSM151374     2  0.0000     0.9533 0.000 1.000
#> GSM151375     2  0.0000     0.9533 0.000 1.000
#> GSM151376     2  0.0000     0.9533 0.000 1.000
#> GSM151377     2  0.0000     0.9533 0.000 1.000
#> GSM151378     2  0.0000     0.9533 0.000 1.000
#> GSM151379     2  0.0000     0.9533 0.000 1.000
#> GSM151380     1  0.5178     0.8518 0.884 0.116
#> GSM151381     2  0.0376     0.9535 0.004 0.996
#> GSM151382     2  0.0938     0.9518 0.012 0.988
#> GSM151383     2  0.0938     0.9518 0.012 0.988
#> GSM151384     1  0.0376     0.9296 0.996 0.004
#> GSM151385     1  0.0000     0.9303 1.000 0.000
#> GSM151386     1  0.0376     0.9296 0.996 0.004
#> GSM151387     2  0.0672     0.9533 0.008 0.992
#> GSM151388     2  0.0672     0.9533 0.008 0.992
#> GSM151389     2  0.0672     0.9533 0.008 0.992
#> GSM151390     2  0.0000     0.9533 0.000 1.000
#> GSM151391     2  0.0000     0.9533 0.000 1.000
#> GSM151392     1  0.5059     0.8555 0.888 0.112
#> GSM151393     2  0.0000     0.9533 0.000 1.000
#> GSM151394     1  0.0000     0.9303 1.000 0.000
#> GSM151395     2  0.2043     0.9359 0.032 0.968
#> GSM151396     2  0.2043     0.9359 0.032 0.968
#> GSM151397     1  0.0000     0.9303 1.000 0.000
#> GSM151398     1  0.0000     0.9303 1.000 0.000
#> GSM151399     2  0.0938     0.9516 0.012 0.988
#> GSM151400     2  0.4690     0.8598 0.100 0.900
#> GSM151401     2  0.0000     0.9533 0.000 1.000
#> GSM151402     2  0.0000     0.9533 0.000 1.000
#> GSM151403     2  0.0672     0.9533 0.008 0.992
#> GSM151404     1  0.4562     0.8692 0.904 0.096
#> GSM151405     2  0.0672     0.9533 0.008 0.992
#> GSM151406     2  0.0672     0.9533 0.008 0.992
#> GSM151407     2  0.0938     0.9518 0.012 0.988
#> GSM151408     2  0.0938     0.9518 0.012 0.988
#> GSM151409     1  0.0000     0.9303 1.000 0.000
#> GSM151410     2  0.9933     0.1260 0.452 0.548
#> GSM151411     1  0.0000     0.9303 1.000 0.000
#> GSM151412     2  0.0376     0.9535 0.004 0.996
#> GSM151413     1  0.0000     0.9303 1.000 0.000
#> GSM151414     1  0.0000     0.9303 1.000 0.000
#> GSM151415     1  0.0000     0.9303 1.000 0.000
#> GSM151416     2  0.9996    -0.0106 0.488 0.512
#> GSM151417     1  0.9866     0.2520 0.568 0.432
#> GSM151418     2  0.0000     0.9533 0.000 1.000
#> GSM151419     1  0.0000     0.9303 1.000 0.000
#> GSM151420     1  0.0000     0.9303 1.000 0.000
#> GSM151421     1  0.1414     0.9227 0.980 0.020
#> GSM151422     1  0.0938     0.9266 0.988 0.012
#> GSM151423     2  0.0000     0.9533 0.000 1.000
#> GSM151424     2  0.0672     0.9533 0.008 0.992
#> GSM151425     2  0.2043     0.9359 0.032 0.968
#> GSM151426     2  0.0672     0.9533 0.008 0.992
#> GSM151427     2  0.0000     0.9533 0.000 1.000
#> GSM151428     1  0.9933     0.1872 0.548 0.452
#> GSM151429     2  1.0000    -0.0410 0.496 0.504
#> GSM151430     2  0.0938     0.9518 0.012 0.988
#> GSM151431     2  0.0938     0.9518 0.012 0.988
#> GSM151432     1  0.1184     0.9249 0.984 0.016
#> GSM151433     1  0.0000     0.9303 1.000 0.000
#> GSM151434     1  0.0376     0.9296 0.996 0.004
#> GSM151435     1  0.0000     0.9303 1.000 0.000
#> GSM151436     2  0.0000     0.9533 0.000 1.000
#> GSM151437     1  0.0000     0.9303 1.000 0.000
#> GSM151438     1  0.0000     0.9303 1.000 0.000
#> GSM151439     1  0.1414     0.9227 0.980 0.020
#> GSM151440     2  0.0000     0.9533 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
#> GSM151369     1  0.3610    0.85657 0.888 0.096 0.016
#> GSM151370     2  0.1031    0.80959 0.000 0.976 0.024
#> GSM151371     1  0.6398    0.27329 0.580 0.416 0.004
#> GSM151372     3  0.5098    0.69817 0.000 0.248 0.752
#> GSM151373     2  0.3482    0.75996 0.000 0.872 0.128
#> GSM151374     3  0.0237    0.86963 0.000 0.004 0.996
#> GSM151375     2  0.6308   -0.03968 0.000 0.508 0.492
#> GSM151376     2  0.6308   -0.03968 0.000 0.508 0.492
#> GSM151377     3  0.0237    0.86963 0.000 0.004 0.996
#> GSM151378     3  0.0237    0.86963 0.000 0.004 0.996
#> GSM151379     3  0.0237    0.86963 0.000 0.004 0.996
#> GSM151380     1  0.3425    0.84874 0.884 0.112 0.004
#> GSM151381     2  0.5216    0.57310 0.000 0.740 0.260
#> GSM151382     3  0.6154    0.36578 0.000 0.408 0.592
#> GSM151383     2  0.0000    0.80408 0.000 1.000 0.000
#> GSM151384     1  0.0237    0.92701 0.996 0.004 0.000
#> GSM151385     1  0.0000    0.92776 1.000 0.000 0.000
#> GSM151386     1  0.0237    0.92701 0.996 0.004 0.000
#> GSM151387     2  0.1163    0.80979 0.000 0.972 0.028
#> GSM151388     2  0.1163    0.80979 0.000 0.972 0.028
#> GSM151389     2  0.4399    0.70126 0.000 0.812 0.188
#> GSM151390     2  0.6308   -0.03968 0.000 0.508 0.492
#> GSM151391     3  0.3267    0.82540 0.000 0.116 0.884
#> GSM151392     1  0.3610    0.85657 0.888 0.096 0.016
#> GSM151393     3  0.0237    0.86963 0.000 0.004 0.996
#> GSM151394     1  0.0000    0.92776 1.000 0.000 0.000
#> GSM151395     2  0.2663    0.80345 0.024 0.932 0.044
#> GSM151396     2  0.2663    0.80345 0.024 0.932 0.044
#> GSM151397     1  0.0000    0.92776 1.000 0.000 0.000
#> GSM151398     1  0.0000    0.92776 1.000 0.000 0.000
#> GSM151399     2  0.1765    0.80823 0.004 0.956 0.040
#> GSM151400     2  0.2711    0.74517 0.088 0.912 0.000
#> GSM151401     2  0.3482    0.75996 0.000 0.872 0.128
#> GSM151402     3  0.0237    0.86963 0.000 0.004 0.996
#> GSM151403     2  0.4399    0.70126 0.000 0.812 0.188
#> GSM151404     1  0.3030    0.86725 0.904 0.092 0.004
#> GSM151405     2  0.1031    0.80959 0.000 0.976 0.024
#> GSM151406     2  0.1163    0.80979 0.000 0.972 0.028
#> GSM151407     2  0.0237    0.80546 0.000 0.996 0.004
#> GSM151408     2  0.0237    0.80546 0.000 0.996 0.004
#> GSM151409     1  0.0000    0.92776 1.000 0.000 0.000
#> GSM151410     2  0.6260    0.12458 0.448 0.552 0.000
#> GSM151411     1  0.0000    0.92776 1.000 0.000 0.000
#> GSM151412     2  0.3116    0.77327 0.000 0.892 0.108
#> GSM151413     1  0.0000    0.92776 1.000 0.000 0.000
#> GSM151414     1  0.0000    0.92776 1.000 0.000 0.000
#> GSM151415     1  0.0000    0.92776 1.000 0.000 0.000
#> GSM151416     2  0.6518   -0.00757 0.484 0.512 0.004
#> GSM151417     1  0.6442    0.21030 0.564 0.432 0.004
#> GSM151418     3  0.0237    0.86963 0.000 0.004 0.996
#> GSM151419     1  0.0000    0.92776 1.000 0.000 0.000
#> GSM151420     1  0.0000    0.92776 1.000 0.000 0.000
#> GSM151421     1  0.0983    0.92082 0.980 0.016 0.004
#> GSM151422     1  0.0592    0.92404 0.988 0.012 0.000
#> GSM151423     3  0.3267    0.82540 0.000 0.116 0.884
#> GSM151424     2  0.1643    0.80821 0.000 0.956 0.044
#> GSM151425     2  0.2663    0.80438 0.024 0.932 0.044
#> GSM151426     2  0.1163    0.80979 0.000 0.972 0.028
#> GSM151427     3  0.0237    0.86963 0.000 0.004 0.996
#> GSM151428     1  0.6483    0.16435 0.544 0.452 0.004
#> GSM151429     2  0.6521   -0.03508 0.492 0.504 0.004
#> GSM151430     2  0.0000    0.80408 0.000 1.000 0.000
#> GSM151431     2  0.0000    0.80408 0.000 1.000 0.000
#> GSM151432     1  0.0829    0.92276 0.984 0.012 0.004
#> GSM151433     1  0.0000    0.92776 1.000 0.000 0.000
#> GSM151434     1  0.0237    0.92701 0.996 0.004 0.000
#> GSM151435     1  0.0000    0.92776 1.000 0.000 0.000
#> GSM151436     3  0.5178    0.68727 0.000 0.256 0.744
#> GSM151437     1  0.0000    0.92776 1.000 0.000 0.000
#> GSM151438     1  0.0000    0.92776 1.000 0.000 0.000
#> GSM151439     1  0.0983    0.92082 0.980 0.016 0.004
#> GSM151440     3  0.5178    0.68727 0.000 0.256 0.744

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM151369     1  0.4360      0.590 0.744 0.008 0.000 0.248
#> GSM151370     2  0.1557      0.856 0.056 0.944 0.000 0.000
#> GSM151371     1  0.6993      0.449 0.556 0.296 0.000 0.148
#> GSM151372     3  0.4155      0.703 0.004 0.240 0.756 0.000
#> GSM151373     2  0.2973      0.815 0.020 0.884 0.096 0.000
#> GSM151374     3  0.0000      0.816 0.000 0.000 1.000 0.000
#> GSM151375     2  0.6277     -0.217 0.056 0.472 0.472 0.000
#> GSM151376     3  0.6277      0.128 0.056 0.472 0.472 0.000
#> GSM151377     3  0.0469      0.813 0.012 0.000 0.988 0.000
#> GSM151378     3  0.0000      0.816 0.000 0.000 1.000 0.000
#> GSM151379     3  0.0000      0.816 0.000 0.000 1.000 0.000
#> GSM151380     1  0.5143      0.595 0.708 0.036 0.000 0.256
#> GSM151381     2  0.4872      0.597 0.028 0.728 0.244 0.000
#> GSM151382     3  0.5600      0.465 0.028 0.376 0.596 0.000
#> GSM151383     2  0.1867      0.843 0.072 0.928 0.000 0.000
#> GSM151384     1  0.4830      0.603 0.608 0.000 0.000 0.392
#> GSM151385     4  0.0000      0.947 0.000 0.000 0.000 1.000
#> GSM151386     1  0.4830      0.603 0.608 0.000 0.000 0.392
#> GSM151387     2  0.1743      0.856 0.056 0.940 0.004 0.000
#> GSM151388     2  0.1743      0.856 0.056 0.940 0.004 0.000
#> GSM151389     2  0.4839      0.714 0.052 0.764 0.184 0.000
#> GSM151390     3  0.6277      0.128 0.056 0.472 0.472 0.000
#> GSM151391     3  0.2589      0.791 0.000 0.116 0.884 0.000
#> GSM151392     1  0.4360      0.590 0.744 0.008 0.000 0.248
#> GSM151393     3  0.0000      0.816 0.000 0.000 1.000 0.000
#> GSM151394     1  0.4972      0.547 0.544 0.000 0.000 0.456
#> GSM151395     2  0.1807      0.853 0.052 0.940 0.008 0.000
#> GSM151396     2  0.1807      0.853 0.052 0.940 0.008 0.000
#> GSM151397     4  0.0592      0.940 0.016 0.000 0.000 0.984
#> GSM151398     1  0.4967      0.551 0.548 0.000 0.000 0.452
#> GSM151399     2  0.1256      0.855 0.028 0.964 0.008 0.000
#> GSM151400     2  0.4697      0.626 0.356 0.644 0.000 0.000
#> GSM151401     2  0.2973      0.815 0.020 0.884 0.096 0.000
#> GSM151402     3  0.0000      0.816 0.000 0.000 1.000 0.000
#> GSM151403     2  0.4839      0.714 0.052 0.764 0.184 0.000
#> GSM151404     1  0.4826      0.600 0.716 0.020 0.000 0.264
#> GSM151405     2  0.1557      0.856 0.056 0.944 0.000 0.000
#> GSM151406     2  0.1743      0.856 0.056 0.940 0.004 0.000
#> GSM151407     2  0.2944      0.816 0.128 0.868 0.004 0.000
#> GSM151408     2  0.2944      0.816 0.128 0.868 0.004 0.000
#> GSM151409     1  0.4985      0.527 0.532 0.000 0.000 0.468
#> GSM151410     1  0.7081      0.155 0.452 0.424 0.000 0.124
#> GSM151411     1  0.4972      0.547 0.544 0.000 0.000 0.456
#> GSM151412     2  0.2635      0.828 0.020 0.904 0.076 0.000
#> GSM151413     4  0.0000      0.947 0.000 0.000 0.000 1.000
#> GSM151414     4  0.0000      0.947 0.000 0.000 0.000 1.000
#> GSM151415     4  0.1867      0.870 0.072 0.000 0.000 0.928
#> GSM151416     1  0.7036      0.268 0.492 0.384 0.000 0.124
#> GSM151417     1  0.7232      0.427 0.516 0.320 0.000 0.164
#> GSM151418     3  0.0657      0.814 0.012 0.004 0.984 0.000
#> GSM151419     4  0.0000      0.947 0.000 0.000 0.000 1.000
#> GSM151420     4  0.0469      0.944 0.012 0.000 0.000 0.988
#> GSM151421     1  0.4746      0.611 0.632 0.000 0.000 0.368
#> GSM151422     4  0.3837      0.543 0.224 0.000 0.000 0.776
#> GSM151423     3  0.2589      0.791 0.000 0.116 0.884 0.000
#> GSM151424     2  0.1256      0.856 0.028 0.964 0.008 0.000
#> GSM151425     2  0.1767      0.854 0.044 0.944 0.012 0.000
#> GSM151426     2  0.1743      0.856 0.056 0.940 0.004 0.000
#> GSM151427     3  0.0000      0.816 0.000 0.000 1.000 0.000
#> GSM151428     1  0.7020      0.393 0.532 0.332 0.000 0.136
#> GSM151429     1  0.7060      0.288 0.496 0.376 0.000 0.128
#> GSM151430     2  0.2760      0.815 0.128 0.872 0.000 0.000
#> GSM151431     2  0.2760      0.815 0.128 0.872 0.000 0.000
#> GSM151432     1  0.5105      0.570 0.564 0.004 0.000 0.432
#> GSM151433     1  0.4985      0.527 0.532 0.000 0.000 0.468
#> GSM151434     1  0.4830      0.603 0.608 0.000 0.000 0.392
#> GSM151435     4  0.0000      0.947 0.000 0.000 0.000 1.000
#> GSM151436     3  0.4252      0.695 0.004 0.252 0.744 0.000
#> GSM151437     4  0.0592      0.941 0.016 0.000 0.000 0.984
#> GSM151438     4  0.0188      0.947 0.004 0.000 0.000 0.996
#> GSM151439     1  0.4746      0.611 0.632 0.000 0.000 0.368
#> GSM151440     3  0.4252      0.695 0.004 0.252 0.744 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
#> GSM151369     5  0.1661     0.7186 0.000 0.024 0.000 0.036 0.940
#> GSM151370     2  0.2426     0.7536 0.000 0.900 0.000 0.064 0.036
#> GSM151371     5  0.6740     0.3038 0.052 0.096 0.000 0.332 0.520
#> GSM151372     3  0.3750     0.6957 0.000 0.232 0.756 0.012 0.000
#> GSM151373     2  0.2628     0.7423 0.000 0.884 0.088 0.028 0.000
#> GSM151374     3  0.0000     0.8650 0.000 0.000 1.000 0.000 0.000
#> GSM151375     2  0.5491     0.0462 0.000 0.480 0.468 0.008 0.044
#> GSM151376     2  0.5491     0.0462 0.000 0.480 0.468 0.008 0.044
#> GSM151377     3  0.0566     0.8612 0.000 0.004 0.984 0.000 0.012
#> GSM151378     3  0.0000     0.8650 0.000 0.000 1.000 0.000 0.000
#> GSM151379     3  0.0000     0.8650 0.000 0.000 1.000 0.000 0.000
#> GSM151380     5  0.1830     0.7155 0.000 0.008 0.000 0.068 0.924
#> GSM151381     2  0.4061     0.6208 0.000 0.740 0.240 0.004 0.016
#> GSM151382     3  0.5849     0.4632 0.000 0.280 0.596 0.120 0.004
#> GSM151383     4  0.4225     0.5889 0.000 0.364 0.000 0.632 0.004
#> GSM151384     5  0.2074     0.7730 0.104 0.000 0.000 0.000 0.896
#> GSM151385     1  0.0162     0.9330 0.996 0.000 0.000 0.000 0.004
#> GSM151386     5  0.2074     0.7730 0.104 0.000 0.000 0.000 0.896
#> GSM151387     2  0.2149     0.7580 0.000 0.916 0.000 0.048 0.036
#> GSM151388     2  0.2149     0.7580 0.000 0.916 0.000 0.048 0.036
#> GSM151389     2  0.4900     0.6762 0.000 0.740 0.180 0.044 0.036
#> GSM151390     2  0.5491     0.0462 0.000 0.480 0.468 0.008 0.044
#> GSM151391     3  0.2329     0.8180 0.000 0.124 0.876 0.000 0.000
#> GSM151392     5  0.1661     0.7186 0.000 0.024 0.000 0.036 0.940
#> GSM151393     3  0.0162     0.8650 0.000 0.004 0.996 0.000 0.000
#> GSM151394     5  0.3109     0.7366 0.200 0.000 0.000 0.000 0.800
#> GSM151395     2  0.1668     0.7444 0.000 0.940 0.000 0.028 0.032
#> GSM151396     2  0.1668     0.7444 0.000 0.940 0.000 0.028 0.032
#> GSM151397     1  0.0794     0.9290 0.972 0.000 0.000 0.000 0.028
#> GSM151398     5  0.3074     0.7390 0.196 0.000 0.000 0.000 0.804
#> GSM151399     2  0.1124     0.7524 0.000 0.960 0.000 0.036 0.004
#> GSM151400     4  0.2813     0.5649 0.000 0.040 0.000 0.876 0.084
#> GSM151401     2  0.2628     0.7423 0.000 0.884 0.088 0.028 0.000
#> GSM151402     3  0.0162     0.8650 0.000 0.004 0.996 0.000 0.000
#> GSM151403     2  0.4900     0.6762 0.000 0.740 0.180 0.044 0.036
#> GSM151404     5  0.1484     0.7252 0.000 0.008 0.000 0.048 0.944
#> GSM151405     2  0.2426     0.7536 0.000 0.900 0.000 0.064 0.036
#> GSM151406     2  0.2149     0.7580 0.000 0.916 0.000 0.048 0.036
#> GSM151407     4  0.3817     0.7796 0.000 0.252 0.004 0.740 0.004
#> GSM151408     4  0.3817     0.7796 0.000 0.252 0.004 0.740 0.004
#> GSM151409     5  0.3210     0.7274 0.212 0.000 0.000 0.000 0.788
#> GSM151410     4  0.6798    -0.0961 0.040 0.108 0.000 0.456 0.396
#> GSM151411     5  0.3109     0.7366 0.200 0.000 0.000 0.000 0.800
#> GSM151412     2  0.2325     0.7492 0.000 0.904 0.068 0.028 0.000
#> GSM151413     1  0.0794     0.9127 0.972 0.000 0.000 0.028 0.000
#> GSM151414     1  0.0794     0.9127 0.972 0.000 0.000 0.028 0.000
#> GSM151415     1  0.2377     0.8347 0.872 0.000 0.000 0.000 0.128
#> GSM151416     5  0.6809     0.0462 0.040 0.108 0.000 0.416 0.436
#> GSM151417     5  0.6663     0.2817 0.044 0.100 0.000 0.332 0.524
#> GSM151418     3  0.0807     0.8614 0.000 0.012 0.976 0.000 0.012
#> GSM151419     1  0.0162     0.9330 0.996 0.000 0.000 0.000 0.004
#> GSM151420     1  0.0703     0.9318 0.976 0.000 0.000 0.000 0.024
#> GSM151421     5  0.1732     0.7700 0.080 0.000 0.000 0.000 0.920
#> GSM151422     1  0.3895     0.4818 0.680 0.000 0.000 0.000 0.320
#> GSM151423     3  0.2280     0.8191 0.000 0.120 0.880 0.000 0.000
#> GSM151424     2  0.1082     0.7553 0.000 0.964 0.000 0.028 0.008
#> GSM151425     2  0.1310     0.7461 0.000 0.956 0.000 0.020 0.024
#> GSM151426     2  0.2149     0.7580 0.000 0.916 0.000 0.048 0.036
#> GSM151427     3  0.0000     0.8650 0.000 0.000 1.000 0.000 0.000
#> GSM151428     5  0.6739     0.2233 0.040 0.108 0.000 0.356 0.496
#> GSM151429     5  0.6796     0.0751 0.044 0.100 0.000 0.416 0.440
#> GSM151430     4  0.3662     0.7793 0.000 0.252 0.000 0.744 0.004
#> GSM151431     4  0.3662     0.7793 0.000 0.252 0.000 0.744 0.004
#> GSM151432     5  0.3243     0.7481 0.180 0.004 0.000 0.004 0.812
#> GSM151433     5  0.3210     0.7274 0.212 0.000 0.000 0.000 0.788
#> GSM151434     5  0.2074     0.7730 0.104 0.000 0.000 0.000 0.896
#> GSM151435     1  0.0162     0.9330 0.996 0.000 0.000 0.000 0.004
#> GSM151436     3  0.3934     0.6804 0.000 0.244 0.740 0.016 0.000
#> GSM151437     1  0.0794     0.9301 0.972 0.000 0.000 0.000 0.028
#> GSM151438     1  0.0510     0.9330 0.984 0.000 0.000 0.000 0.016
#> GSM151439     5  0.1732     0.7700 0.080 0.000 0.000 0.000 0.920
#> GSM151440     3  0.3934     0.6804 0.000 0.244 0.740 0.016 0.000

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>           class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM151369     5  0.3418     0.5762 0.000 0.032 0.000 0.000 0.784 0.184
#> GSM151370     2  0.2271     0.7812 0.000 0.908 0.000 0.032 0.024 0.036
#> GSM151371     5  0.6926     0.2746 0.040 0.020 0.000 0.228 0.472 0.240
#> GSM151372     3  0.3888     0.7095 0.000 0.200 0.756 0.032 0.000 0.012
#> GSM151373     2  0.2979     0.7667 0.000 0.852 0.088 0.056 0.000 0.004
#> GSM151374     3  0.0000     0.8456 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM151375     2  0.5525     0.0343 0.000 0.464 0.460 0.028 0.032 0.016
#> GSM151376     2  0.5525     0.0343 0.000 0.464 0.460 0.028 0.032 0.016
#> GSM151377     3  0.1858     0.8237 0.000 0.000 0.912 0.000 0.012 0.076
#> GSM151378     3  0.0000     0.8456 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM151379     3  0.0000     0.8456 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM151380     5  0.3607     0.5742 0.000 0.016 0.000 0.012 0.768 0.204
#> GSM151381     2  0.4022     0.6173 0.000 0.732 0.232 0.004 0.012 0.020
#> GSM151382     3  0.5479     0.5575 0.000 0.136 0.596 0.256 0.000 0.012
#> GSM151383     4  0.2266     0.4399 0.000 0.108 0.000 0.880 0.000 0.012
#> GSM151384     5  0.2776     0.7038 0.088 0.000 0.000 0.000 0.860 0.052
#> GSM151385     1  0.0260     0.9194 0.992 0.000 0.000 0.000 0.008 0.000
#> GSM151386     5  0.2776     0.7038 0.088 0.000 0.000 0.000 0.860 0.052
#> GSM151387     2  0.1944     0.7834 0.000 0.924 0.000 0.016 0.024 0.036
#> GSM151388     2  0.1944     0.7834 0.000 0.924 0.000 0.016 0.024 0.036
#> GSM151389     2  0.4545     0.7116 0.000 0.748 0.160 0.012 0.024 0.056
#> GSM151390     2  0.5525     0.0343 0.000 0.464 0.460 0.028 0.032 0.016
#> GSM151391     3  0.3413     0.8127 0.000 0.108 0.812 0.000 0.000 0.080
#> GSM151392     5  0.3418     0.5762 0.000 0.032 0.000 0.000 0.784 0.184
#> GSM151393     3  0.0713     0.8404 0.000 0.000 0.972 0.000 0.000 0.028
#> GSM151394     5  0.2805     0.7019 0.184 0.000 0.000 0.000 0.812 0.004
#> GSM151395     2  0.1777     0.7783 0.000 0.932 0.000 0.032 0.024 0.012
#> GSM151396     2  0.1777     0.7783 0.000 0.932 0.000 0.032 0.024 0.012
#> GSM151397     1  0.0790     0.9162 0.968 0.000 0.000 0.000 0.032 0.000
#> GSM151398     5  0.2882     0.7029 0.180 0.000 0.000 0.000 0.812 0.008
#> GSM151399     2  0.1668     0.7808 0.000 0.928 0.000 0.060 0.004 0.008
#> GSM151400     6  0.4414     0.0000 0.000 0.016 0.000 0.284 0.028 0.672
#> GSM151401     2  0.2979     0.7667 0.000 0.852 0.088 0.056 0.000 0.004
#> GSM151402     3  0.0713     0.8404 0.000 0.000 0.972 0.000 0.000 0.028
#> GSM151403     2  0.4545     0.7116 0.000 0.748 0.160 0.012 0.024 0.056
#> GSM151404     5  0.3452     0.5888 0.000 0.016 0.000 0.012 0.788 0.184
#> GSM151405     2  0.2271     0.7812 0.000 0.908 0.000 0.032 0.024 0.036
#> GSM151406     2  0.1944     0.7834 0.000 0.924 0.000 0.016 0.024 0.036
#> GSM151407     4  0.0146     0.6426 0.000 0.000 0.004 0.996 0.000 0.000
#> GSM151408     4  0.0146     0.6426 0.000 0.000 0.004 0.996 0.000 0.000
#> GSM151409     5  0.2762     0.6965 0.196 0.000 0.000 0.000 0.804 0.000
#> GSM151410     4  0.7057    -0.2370 0.032 0.020 0.000 0.360 0.352 0.236
#> GSM151411     5  0.2805     0.7019 0.184 0.000 0.000 0.000 0.812 0.004
#> GSM151412     2  0.2711     0.7745 0.000 0.872 0.068 0.056 0.000 0.004
#> GSM151413     1  0.1075     0.8775 0.952 0.000 0.000 0.000 0.000 0.048
#> GSM151414     1  0.0937     0.8837 0.960 0.000 0.000 0.000 0.000 0.040
#> GSM151415     1  0.2494     0.8249 0.864 0.000 0.000 0.000 0.120 0.016
#> GSM151416     5  0.7059     0.0897 0.032 0.020 0.000 0.320 0.384 0.244
#> GSM151417     5  0.6705     0.2742 0.032 0.020 0.000 0.276 0.492 0.180
#> GSM151418     3  0.2114     0.8249 0.000 0.008 0.904 0.000 0.012 0.076
#> GSM151419     1  0.0260     0.9194 0.992 0.000 0.000 0.000 0.008 0.000
#> GSM151420     1  0.0713     0.9184 0.972 0.000 0.000 0.000 0.028 0.000
#> GSM151421     5  0.2653     0.6996 0.064 0.004 0.000 0.000 0.876 0.056
#> GSM151422     1  0.3905     0.5056 0.668 0.000 0.000 0.000 0.316 0.016
#> GSM151423     3  0.3078     0.8145 0.000 0.108 0.836 0.000 0.000 0.056
#> GSM151424     2  0.1462     0.7825 0.000 0.936 0.000 0.056 0.000 0.008
#> GSM151425     2  0.1620     0.7790 0.000 0.940 0.000 0.024 0.024 0.012
#> GSM151426     2  0.1944     0.7834 0.000 0.924 0.000 0.016 0.024 0.036
#> GSM151427     3  0.0000     0.8456 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM151428     5  0.6951     0.2092 0.032 0.020 0.000 0.264 0.440 0.244
#> GSM151429     5  0.7049     0.1085 0.032 0.020 0.000 0.312 0.392 0.244
#> GSM151430     4  0.0000     0.6425 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM151431     4  0.0000     0.6425 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM151432     5  0.3274     0.7037 0.168 0.004 0.000 0.000 0.804 0.024
#> GSM151433     5  0.2762     0.6965 0.196 0.000 0.000 0.000 0.804 0.000
#> GSM151434     5  0.2776     0.7038 0.088 0.000 0.000 0.000 0.860 0.052
#> GSM151435     1  0.0260     0.9194 0.992 0.000 0.000 0.000 0.008 0.000
#> GSM151436     3  0.4043     0.6948 0.000 0.212 0.740 0.036 0.000 0.012
#> GSM151437     1  0.0865     0.9143 0.964 0.000 0.000 0.000 0.036 0.000
#> GSM151438     1  0.0547     0.9196 0.980 0.000 0.000 0.000 0.020 0.000
#> GSM151439     5  0.2653     0.6996 0.064 0.004 0.000 0.000 0.876 0.056
#> GSM151440     3  0.4043     0.6948 0.000 0.212 0.740 0.036 0.000 0.012

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

consensus_heatmap(res, k = 2)

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

consensus_heatmap(res, k = 3)

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

consensus_heatmap(res, k = 4)

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

consensus_heatmap(res, k = 5)

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

consensus_heatmap(res, k = 6)

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

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

membership_heatmap(res, k = 2)

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

membership_heatmap(res, k = 3)

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

membership_heatmap(res, k = 4)

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

membership_heatmap(res, k = 5)

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

membership_heatmap(res, k = 6)

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

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

Signature heatmaps where rows are scaled:

get_signatures(res, k = 2)

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

get_signatures(res, k = 3)

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

get_signatures(res, k = 4)

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

get_signatures(res, k = 5)

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

get_signatures(res, k = 6)

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

Signature heatmaps where rows are not scaled:

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

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

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

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

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

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

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

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

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

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

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk MAD-hclust-signature_compare

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

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

An example of the output of tb is:

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

The columns in tb are:

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

UMAP plot which shows how samples are separated.

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

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

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

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

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

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

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

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

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

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

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk MAD-hclust-collect-classes

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

test_to_known_factors(res)
#>             n disease.state(p) k
#> MAD:hclust 66            0.434 2
#> MAD:hclust 62            0.551 3
#> MAD:hclust 62            0.685 4
#> MAD:hclust 61            0.739 5
#> MAD:hclust 61            0.448 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 17730 rows and 72 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 3.
#> 
#> Following methods can be applied to this 'ConsensusPartition' object:
#>  [1] "cola_report"             "collect_classes"         "collect_plots"          
#>  [4] "collect_stats"           "colnames"                "compare_signatures"     
#>  [7] "consensus_heatmap"       "dimension_reduction"     "functional_enrichment"  
#> [10] "get_anno_col"            "get_anno"                "get_classes"            
#> [13] "get_consensus"           "get_matrix"              "get_membership"         
#> [16] "get_param"               "get_signatures"          "get_stats"              
#> [19] "is_best_k"               "is_stable_k"             "membership_heatmap"     
#> [22] "ncol"                    "nrow"                    "plot_ecdf"              
#> [25] "rownames"                "select_partition_number" "show"                   
#> [28] "suggest_best_k"          "test_to_known_factors"

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

collect_plots(res)

plot of chunk MAD-kmeans-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 1.000           0.954       0.983         0.4784 0.518   0.518
#> 3 3 0.953           0.949       0.962         0.3916 0.755   0.551
#> 4 4 0.684           0.571       0.756         0.1102 0.937   0.813
#> 5 5 0.663           0.518       0.642         0.0661 0.836   0.494
#> 6 6 0.672           0.667       0.755         0.0442 0.912   0.604

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
#> GSM151369     1  0.0000     0.9668 1.000 0.000
#> GSM151370     2  0.0000     0.9916 0.000 1.000
#> GSM151371     1  0.0000     0.9668 1.000 0.000
#> GSM151372     2  0.0000     0.9916 0.000 1.000
#> GSM151373     2  0.0000     0.9916 0.000 1.000
#> GSM151374     2  0.0000     0.9916 0.000 1.000
#> GSM151375     2  0.0000     0.9916 0.000 1.000
#> GSM151376     2  0.0000     0.9916 0.000 1.000
#> GSM151377     2  0.0000     0.9916 0.000 1.000
#> GSM151378     2  0.0000     0.9916 0.000 1.000
#> GSM151379     2  0.0000     0.9916 0.000 1.000
#> GSM151380     2  0.0376     0.9878 0.004 0.996
#> GSM151381     2  0.0000     0.9916 0.000 1.000
#> GSM151382     2  0.0000     0.9916 0.000 1.000
#> GSM151383     2  0.0000     0.9916 0.000 1.000
#> GSM151384     1  0.0000     0.9668 1.000 0.000
#> GSM151385     1  0.0000     0.9668 1.000 0.000
#> GSM151386     1  0.0000     0.9668 1.000 0.000
#> GSM151387     2  0.0000     0.9916 0.000 1.000
#> GSM151388     2  0.0000     0.9916 0.000 1.000
#> GSM151389     2  0.0000     0.9916 0.000 1.000
#> GSM151390     2  0.0000     0.9916 0.000 1.000
#> GSM151391     2  0.0000     0.9916 0.000 1.000
#> GSM151392     2  0.0000     0.9916 0.000 1.000
#> GSM151393     2  0.0000     0.9916 0.000 1.000
#> GSM151394     1  0.0000     0.9668 1.000 0.000
#> GSM151395     2  0.0000     0.9916 0.000 1.000
#> GSM151396     2  0.0000     0.9916 0.000 1.000
#> GSM151397     1  0.0000     0.9668 1.000 0.000
#> GSM151398     1  0.0000     0.9668 1.000 0.000
#> GSM151399     2  0.0000     0.9916 0.000 1.000
#> GSM151400     2  0.3114     0.9331 0.056 0.944
#> GSM151401     2  0.0000     0.9916 0.000 1.000
#> GSM151402     2  0.0000     0.9916 0.000 1.000
#> GSM151403     2  0.0000     0.9916 0.000 1.000
#> GSM151404     1  0.0000     0.9668 1.000 0.000
#> GSM151405     2  0.0000     0.9916 0.000 1.000
#> GSM151406     2  0.0000     0.9916 0.000 1.000
#> GSM151407     2  0.0000     0.9916 0.000 1.000
#> GSM151408     2  0.0000     0.9916 0.000 1.000
#> GSM151409     1  0.0000     0.9668 1.000 0.000
#> GSM151410     2  0.0000     0.9916 0.000 1.000
#> GSM151411     1  0.0000     0.9668 1.000 0.000
#> GSM151412     2  0.0000     0.9916 0.000 1.000
#> GSM151413     1  0.0000     0.9668 1.000 0.000
#> GSM151414     1  0.0000     0.9668 1.000 0.000
#> GSM151415     1  0.0000     0.9668 1.000 0.000
#> GSM151416     1  0.9608     0.3783 0.616 0.384
#> GSM151417     1  0.0000     0.9668 1.000 0.000
#> GSM151418     2  0.0000     0.9916 0.000 1.000
#> GSM151419     1  0.0000     0.9668 1.000 0.000
#> GSM151420     1  0.0000     0.9668 1.000 0.000
#> GSM151421     1  0.0000     0.9668 1.000 0.000
#> GSM151422     1  0.0000     0.9668 1.000 0.000
#> GSM151423     2  0.0000     0.9916 0.000 1.000
#> GSM151424     2  0.0000     0.9916 0.000 1.000
#> GSM151425     2  0.0000     0.9916 0.000 1.000
#> GSM151426     2  0.0000     0.9916 0.000 1.000
#> GSM151427     2  0.0000     0.9916 0.000 1.000
#> GSM151428     1  0.0000     0.9668 1.000 0.000
#> GSM151429     2  0.8608     0.5839 0.284 0.716
#> GSM151430     2  0.0000     0.9916 0.000 1.000
#> GSM151431     2  0.0000     0.9916 0.000 1.000
#> GSM151432     1  0.0000     0.9668 1.000 0.000
#> GSM151433     1  0.0000     0.9668 1.000 0.000
#> GSM151434     1  0.0000     0.9668 1.000 0.000
#> GSM151435     1  0.0000     0.9668 1.000 0.000
#> GSM151436     2  0.0000     0.9916 0.000 1.000
#> GSM151437     1  0.0000     0.9668 1.000 0.000
#> GSM151438     1  0.0000     0.9668 1.000 0.000
#> GSM151439     1  0.9998     0.0373 0.508 0.492
#> GSM151440     2  0.0000     0.9916 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
#> GSM151369     1  0.1289      0.968 0.968 0.032 0.000
#> GSM151370     2  0.2878      0.945 0.000 0.904 0.096
#> GSM151371     1  0.1643      0.961 0.956 0.044 0.000
#> GSM151372     3  0.2356      0.929 0.000 0.072 0.928
#> GSM151373     3  0.1163      0.957 0.000 0.028 0.972
#> GSM151374     3  0.0237      0.969 0.000 0.004 0.996
#> GSM151375     3  0.0424      0.969 0.000 0.008 0.992
#> GSM151376     3  0.0424      0.969 0.000 0.008 0.992
#> GSM151377     3  0.0424      0.969 0.000 0.008 0.992
#> GSM151378     3  0.0237      0.969 0.000 0.004 0.996
#> GSM151379     3  0.0237      0.969 0.000 0.004 0.996
#> GSM151380     2  0.1753      0.948 0.000 0.952 0.048
#> GSM151381     3  0.0592      0.968 0.000 0.012 0.988
#> GSM151382     3  0.2165      0.933 0.000 0.064 0.936
#> GSM151383     2  0.0747      0.947 0.000 0.984 0.016
#> GSM151384     1  0.0237      0.981 0.996 0.004 0.000
#> GSM151385     1  0.0000      0.982 1.000 0.000 0.000
#> GSM151386     1  0.0424      0.980 0.992 0.008 0.000
#> GSM151387     2  0.2878      0.945 0.000 0.904 0.096
#> GSM151388     2  0.1860      0.949 0.000 0.948 0.052
#> GSM151389     3  0.0424      0.968 0.000 0.008 0.992
#> GSM151390     3  0.0424      0.969 0.000 0.008 0.992
#> GSM151391     2  0.2878      0.945 0.000 0.904 0.096
#> GSM151392     2  0.1753      0.949 0.000 0.952 0.048
#> GSM151393     3  0.0237      0.969 0.000 0.004 0.996
#> GSM151394     1  0.0000      0.982 1.000 0.000 0.000
#> GSM151395     2  0.1163      0.950 0.000 0.972 0.028
#> GSM151396     2  0.2356      0.951 0.000 0.928 0.072
#> GSM151397     1  0.0000      0.982 1.000 0.000 0.000
#> GSM151398     1  0.1643      0.961 0.956 0.044 0.000
#> GSM151399     2  0.2356      0.951 0.000 0.928 0.072
#> GSM151400     2  0.0237      0.938 0.000 0.996 0.004
#> GSM151401     3  0.5706      0.534 0.000 0.320 0.680
#> GSM151402     3  0.0237      0.969 0.000 0.004 0.996
#> GSM151403     3  0.0237      0.969 0.000 0.004 0.996
#> GSM151404     1  0.1643      0.961 0.956 0.044 0.000
#> GSM151405     2  0.1753      0.949 0.000 0.952 0.048
#> GSM151406     2  0.2796      0.945 0.000 0.908 0.092
#> GSM151407     2  0.1964      0.950 0.000 0.944 0.056
#> GSM151408     2  0.1860      0.951 0.000 0.948 0.052
#> GSM151409     1  0.0000      0.982 1.000 0.000 0.000
#> GSM151410     2  0.0592      0.945 0.000 0.988 0.012
#> GSM151411     1  0.0424      0.980 0.992 0.008 0.000
#> GSM151412     2  0.3038      0.927 0.000 0.896 0.104
#> GSM151413     1  0.0000      0.982 1.000 0.000 0.000
#> GSM151414     1  0.0000      0.982 1.000 0.000 0.000
#> GSM151415     1  0.0000      0.982 1.000 0.000 0.000
#> GSM151416     2  0.0475      0.940 0.004 0.992 0.004
#> GSM151417     1  0.2625      0.926 0.916 0.084 0.000
#> GSM151418     3  0.0424      0.969 0.000 0.008 0.992
#> GSM151419     1  0.0000      0.982 1.000 0.000 0.000
#> GSM151420     1  0.0000      0.982 1.000 0.000 0.000
#> GSM151421     2  0.4702      0.709 0.212 0.788 0.000
#> GSM151422     1  0.0000      0.982 1.000 0.000 0.000
#> GSM151423     3  0.0237      0.969 0.000 0.004 0.996
#> GSM151424     2  0.2356      0.951 0.000 0.928 0.072
#> GSM151425     2  0.2356      0.951 0.000 0.928 0.072
#> GSM151426     2  0.2878      0.945 0.000 0.904 0.096
#> GSM151427     3  0.0237      0.969 0.000 0.004 0.996
#> GSM151428     1  0.4291      0.809 0.820 0.180 0.000
#> GSM151429     2  0.0237      0.940 0.004 0.996 0.000
#> GSM151430     2  0.1860      0.951 0.000 0.948 0.052
#> GSM151431     2  0.0747      0.947 0.000 0.984 0.016
#> GSM151432     1  0.0424      0.980 0.992 0.008 0.000
#> GSM151433     1  0.0000      0.982 1.000 0.000 0.000
#> GSM151434     1  0.0424      0.980 0.992 0.008 0.000
#> GSM151435     1  0.0000      0.982 1.000 0.000 0.000
#> GSM151436     3  0.2711      0.914 0.000 0.088 0.912
#> GSM151437     1  0.0000      0.982 1.000 0.000 0.000
#> GSM151438     1  0.0000      0.982 1.000 0.000 0.000
#> GSM151439     2  0.1170      0.941 0.016 0.976 0.008
#> GSM151440     2  0.2261      0.951 0.000 0.932 0.068

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM151369     1  0.4933     0.6730 0.568 0.000 0.000 0.432
#> GSM151370     2  0.5367     0.4187 0.000 0.664 0.032 0.304
#> GSM151371     1  0.4907     0.6790 0.580 0.000 0.000 0.420
#> GSM151372     3  0.4446     0.7380 0.000 0.196 0.776 0.028
#> GSM151373     3  0.4019     0.7580 0.000 0.196 0.792 0.012
#> GSM151374     3  0.0336     0.8726 0.000 0.000 0.992 0.008
#> GSM151375     3  0.1109     0.8720 0.000 0.028 0.968 0.004
#> GSM151376     3  0.1109     0.8720 0.000 0.028 0.968 0.004
#> GSM151377     3  0.1854     0.8680 0.000 0.012 0.940 0.048
#> GSM151378     3  0.0336     0.8726 0.000 0.000 0.992 0.008
#> GSM151379     3  0.0336     0.8726 0.000 0.000 0.992 0.008
#> GSM151380     4  0.5372    -0.0333 0.000 0.444 0.012 0.544
#> GSM151381     3  0.6656     0.5915 0.000 0.160 0.620 0.220
#> GSM151382     3  0.4467     0.7511 0.000 0.172 0.788 0.040
#> GSM151383     2  0.4868     0.4350 0.000 0.684 0.012 0.304
#> GSM151384     1  0.4697     0.7328 0.644 0.000 0.000 0.356
#> GSM151385     1  0.0000     0.7624 1.000 0.000 0.000 0.000
#> GSM151386     1  0.4730     0.7291 0.636 0.000 0.000 0.364
#> GSM151387     2  0.5367     0.4187 0.000 0.664 0.032 0.304
#> GSM151388     2  0.5231     0.3069 0.000 0.604 0.012 0.384
#> GSM151389     3  0.5970     0.6329 0.000 0.088 0.668 0.244
#> GSM151390     3  0.1109     0.8720 0.000 0.028 0.968 0.004
#> GSM151391     2  0.6743     0.2650 0.000 0.512 0.096 0.392
#> GSM151392     4  0.5404    -0.0782 0.000 0.476 0.012 0.512
#> GSM151393     3  0.1474     0.8677 0.000 0.000 0.948 0.052
#> GSM151394     1  0.4250     0.7534 0.724 0.000 0.000 0.276
#> GSM151395     2  0.2081     0.4715 0.000 0.916 0.000 0.084
#> GSM151396     2  0.1042     0.5356 0.000 0.972 0.020 0.008
#> GSM151397     1  0.0188     0.7618 0.996 0.000 0.000 0.004
#> GSM151398     1  0.4933     0.6692 0.568 0.000 0.000 0.432
#> GSM151399     2  0.0895     0.5357 0.000 0.976 0.020 0.004
#> GSM151400     2  0.4500     0.3419 0.000 0.684 0.000 0.316
#> GSM151401     2  0.4697     0.2916 0.000 0.696 0.296 0.008
#> GSM151402     3  0.1474     0.8677 0.000 0.000 0.948 0.052
#> GSM151403     3  0.4327     0.7500 0.000 0.016 0.768 0.216
#> GSM151404     4  0.4991    -0.4741 0.388 0.004 0.000 0.608
#> GSM151405     2  0.5400     0.3264 0.000 0.608 0.020 0.372
#> GSM151406     2  0.5475     0.3934 0.000 0.656 0.036 0.308
#> GSM151407     2  0.5085     0.4362 0.000 0.676 0.020 0.304
#> GSM151408     2  0.4980     0.4358 0.000 0.680 0.016 0.304
#> GSM151409     1  0.2973     0.7670 0.856 0.000 0.000 0.144
#> GSM151410     2  0.4454     0.4332 0.000 0.692 0.000 0.308
#> GSM151411     1  0.4730     0.7274 0.636 0.000 0.000 0.364
#> GSM151412     2  0.2342     0.5028 0.000 0.912 0.080 0.008
#> GSM151413     1  0.0188     0.7618 0.996 0.000 0.000 0.004
#> GSM151414     1  0.0000     0.7624 1.000 0.000 0.000 0.000
#> GSM151415     1  0.0336     0.7637 0.992 0.000 0.000 0.008
#> GSM151416     4  0.4992    -0.1160 0.000 0.476 0.000 0.524
#> GSM151417     1  0.5996     0.5943 0.512 0.040 0.000 0.448
#> GSM151418     3  0.2197     0.8655 0.000 0.024 0.928 0.048
#> GSM151419     1  0.0000     0.7624 1.000 0.000 0.000 0.000
#> GSM151420     1  0.0000     0.7624 1.000 0.000 0.000 0.000
#> GSM151421     2  0.6384    -0.2253 0.064 0.496 0.000 0.440
#> GSM151422     1  0.2408     0.7656 0.896 0.000 0.000 0.104
#> GSM151423     3  0.1722     0.8675 0.000 0.008 0.944 0.048
#> GSM151424     2  0.1042     0.5356 0.000 0.972 0.020 0.008
#> GSM151425     2  0.1042     0.5360 0.000 0.972 0.020 0.008
#> GSM151426     2  0.5367     0.4187 0.000 0.664 0.032 0.304
#> GSM151427     3  0.0336     0.8726 0.000 0.000 0.992 0.008
#> GSM151428     1  0.6011     0.5437 0.484 0.040 0.000 0.476
#> GSM151429     4  0.4522     0.1547 0.000 0.320 0.000 0.680
#> GSM151430     2  0.4980     0.4358 0.000 0.680 0.016 0.304
#> GSM151431     2  0.4868     0.4350 0.000 0.684 0.012 0.304
#> GSM151432     1  0.4730     0.7274 0.636 0.000 0.000 0.364
#> GSM151433     1  0.4382     0.7498 0.704 0.000 0.000 0.296
#> GSM151434     1  0.4746     0.7268 0.632 0.000 0.000 0.368
#> GSM151435     1  0.0000     0.7624 1.000 0.000 0.000 0.000
#> GSM151436     3  0.5587     0.4866 0.000 0.372 0.600 0.028
#> GSM151437     1  0.0000     0.7624 1.000 0.000 0.000 0.000
#> GSM151438     1  0.0188     0.7618 0.996 0.000 0.000 0.004
#> GSM151439     2  0.4941    -0.1700 0.000 0.564 0.000 0.436
#> GSM151440     2  0.2032     0.5275 0.000 0.936 0.028 0.036

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>           class entropy silhouette    p1    p2    p3    p4    p5
#> GSM151369     5  0.5156     0.5193 0.328 0.048 0.000 0.004 0.620
#> GSM151370     4  0.7078     0.3446 0.000 0.284 0.016 0.432 0.268
#> GSM151371     5  0.4126     0.5165 0.380 0.000 0.000 0.000 0.620
#> GSM151372     3  0.5689     0.4931 0.000 0.276 0.628 0.080 0.016
#> GSM151373     3  0.4919     0.4003 0.000 0.368 0.604 0.016 0.012
#> GSM151374     3  0.0854     0.7669 0.000 0.012 0.976 0.004 0.008
#> GSM151375     3  0.2773     0.7411 0.000 0.112 0.868 0.000 0.020
#> GSM151376     3  0.2773     0.7411 0.000 0.112 0.868 0.000 0.020
#> GSM151377     3  0.2153     0.7599 0.000 0.044 0.916 0.000 0.040
#> GSM151378     3  0.1329     0.7670 0.000 0.032 0.956 0.004 0.008
#> GSM151379     3  0.1329     0.7670 0.000 0.032 0.956 0.004 0.008
#> GSM151380     5  0.6925    -0.4520 0.000 0.224 0.012 0.324 0.440
#> GSM151381     3  0.8241     0.0556 0.000 0.252 0.344 0.120 0.284
#> GSM151382     3  0.5833     0.5254 0.000 0.228 0.640 0.116 0.016
#> GSM151383     4  0.2377     0.3774 0.000 0.128 0.000 0.872 0.000
#> GSM151384     5  0.5322     0.4923 0.392 0.056 0.000 0.000 0.552
#> GSM151385     1  0.0000     0.8773 1.000 0.000 0.000 0.000 0.000
#> GSM151386     5  0.5264     0.4955 0.392 0.052 0.000 0.000 0.556
#> GSM151387     4  0.7078     0.3446 0.000 0.284 0.016 0.432 0.268
#> GSM151388     4  0.7003     0.3563 0.000 0.256 0.012 0.428 0.304
#> GSM151389     3  0.8186     0.0914 0.000 0.148 0.376 0.176 0.300
#> GSM151390     3  0.2773     0.7411 0.000 0.112 0.868 0.000 0.020
#> GSM151391     4  0.7832     0.3283 0.000 0.200 0.084 0.400 0.316
#> GSM151392     5  0.6920    -0.4843 0.000 0.244 0.008 0.332 0.416
#> GSM151393     3  0.1907     0.7607 0.000 0.044 0.928 0.000 0.028
#> GSM151394     1  0.4546    -0.2650 0.532 0.008 0.000 0.000 0.460
#> GSM151395     2  0.4901     0.6849 0.000 0.700 0.000 0.216 0.084
#> GSM151396     2  0.4158     0.8025 0.000 0.748 0.020 0.224 0.008
#> GSM151397     1  0.0324     0.8747 0.992 0.004 0.000 0.000 0.004
#> GSM151398     5  0.5192     0.5078 0.356 0.044 0.000 0.004 0.596
#> GSM151399     2  0.4095     0.7987 0.000 0.748 0.016 0.228 0.008
#> GSM151400     4  0.6224     0.0562 0.000 0.352 0.000 0.496 0.152
#> GSM151401     2  0.4774     0.7151 0.000 0.748 0.132 0.112 0.008
#> GSM151402     3  0.1907     0.7607 0.000 0.044 0.928 0.000 0.028
#> GSM151403     3  0.6953     0.4165 0.000 0.072 0.540 0.108 0.280
#> GSM151404     5  0.5238     0.2833 0.088 0.060 0.000 0.108 0.744
#> GSM151405     4  0.7063     0.3474 0.000 0.284 0.012 0.408 0.296
#> GSM151406     4  0.7256     0.2669 0.000 0.336 0.020 0.368 0.276
#> GSM151407     4  0.2377     0.3774 0.000 0.128 0.000 0.872 0.000
#> GSM151408     4  0.2377     0.3774 0.000 0.128 0.000 0.872 0.000
#> GSM151409     1  0.3684     0.4068 0.720 0.000 0.000 0.000 0.280
#> GSM151410     4  0.2424     0.3765 0.000 0.132 0.000 0.868 0.000
#> GSM151411     5  0.4446     0.4956 0.400 0.008 0.000 0.000 0.592
#> GSM151412     2  0.4205     0.7787 0.000 0.776 0.056 0.164 0.004
#> GSM151413     1  0.0566     0.8717 0.984 0.012 0.000 0.000 0.004
#> GSM151414     1  0.0000     0.8773 1.000 0.000 0.000 0.000 0.000
#> GSM151415     1  0.0609     0.8661 0.980 0.000 0.000 0.000 0.020
#> GSM151416     4  0.4397     0.3101 0.000 0.028 0.000 0.696 0.276
#> GSM151417     5  0.5979     0.5277 0.312 0.060 0.000 0.036 0.592
#> GSM151418     3  0.2654     0.7499 0.000 0.064 0.888 0.000 0.048
#> GSM151419     1  0.0000     0.8773 1.000 0.000 0.000 0.000 0.000
#> GSM151420     1  0.0000     0.8773 1.000 0.000 0.000 0.000 0.000
#> GSM151421     5  0.5684     0.2738 0.016 0.356 0.000 0.056 0.572
#> GSM151422     1  0.3419     0.6346 0.804 0.016 0.000 0.000 0.180
#> GSM151423     3  0.2149     0.7593 0.000 0.048 0.916 0.000 0.036
#> GSM151424     2  0.4037     0.8032 0.000 0.752 0.020 0.224 0.004
#> GSM151425     2  0.4235     0.7924 0.000 0.748 0.020 0.220 0.012
#> GSM151426     4  0.7078     0.3446 0.000 0.284 0.016 0.432 0.268
#> GSM151427     3  0.1329     0.7670 0.000 0.032 0.956 0.004 0.008
#> GSM151428     5  0.5001     0.5319 0.340 0.004 0.000 0.036 0.620
#> GSM151429     4  0.5048     0.1651 0.000 0.040 0.000 0.580 0.380
#> GSM151430     4  0.2377     0.3774 0.000 0.128 0.000 0.872 0.000
#> GSM151431     4  0.2377     0.3774 0.000 0.128 0.000 0.872 0.000
#> GSM151432     5  0.4192     0.4926 0.404 0.000 0.000 0.000 0.596
#> GSM151433     5  0.4306     0.2993 0.492 0.000 0.000 0.000 0.508
#> GSM151434     5  0.5264     0.4955 0.392 0.052 0.000 0.000 0.556
#> GSM151435     1  0.0000     0.8773 1.000 0.000 0.000 0.000 0.000
#> GSM151436     2  0.5803     0.3760 0.000 0.604 0.300 0.080 0.016
#> GSM151437     1  0.0000     0.8773 1.000 0.000 0.000 0.000 0.000
#> GSM151438     1  0.0451     0.8736 0.988 0.008 0.000 0.000 0.004
#> GSM151439     5  0.5385     0.1145 0.000 0.432 0.000 0.056 0.512
#> GSM151440     2  0.4768     0.7434 0.000 0.680 0.032 0.280 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
#> GSM151369     6  0.4672     0.7123 0.128 0.008 0.000 0.032 0.084 0.748
#> GSM151370     5  0.4593     0.7456 0.000 0.232 0.004 0.080 0.684 0.000
#> GSM151371     6  0.3686     0.7651 0.196 0.004 0.000 0.012 0.016 0.772
#> GSM151372     3  0.5446     0.2609 0.000 0.416 0.492 0.076 0.000 0.016
#> GSM151373     2  0.3989    -0.1686 0.000 0.528 0.468 0.000 0.000 0.004
#> GSM151374     3  0.1124     0.7564 0.000 0.036 0.956 0.000 0.000 0.008
#> GSM151375     3  0.4346     0.6883 0.000 0.200 0.740 0.016 0.024 0.020
#> GSM151376     3  0.4346     0.6883 0.000 0.200 0.740 0.016 0.024 0.020
#> GSM151377     3  0.3787     0.7176 0.000 0.000 0.796 0.012 0.120 0.072
#> GSM151378     3  0.1806     0.7565 0.000 0.088 0.908 0.000 0.000 0.004
#> GSM151379     3  0.1806     0.7565 0.000 0.088 0.908 0.000 0.000 0.004
#> GSM151380     5  0.4626     0.6379 0.000 0.044 0.000 0.064 0.736 0.156
#> GSM151381     5  0.5111     0.6351 0.000 0.128 0.152 0.004 0.692 0.024
#> GSM151382     3  0.5576     0.3563 0.000 0.348 0.524 0.120 0.000 0.008
#> GSM151383     4  0.3072     0.7785 0.000 0.124 0.004 0.836 0.036 0.000
#> GSM151384     6  0.5521     0.7378 0.212 0.012 0.000 0.040 0.080 0.656
#> GSM151385     1  0.0260     0.9053 0.992 0.000 0.000 0.008 0.000 0.000
#> GSM151386     6  0.5432     0.7413 0.208 0.012 0.000 0.036 0.080 0.664
#> GSM151387     5  0.4593     0.7456 0.000 0.232 0.004 0.080 0.684 0.000
#> GSM151388     5  0.4663     0.7532 0.000 0.192 0.000 0.084 0.708 0.016
#> GSM151389     5  0.3650     0.5964 0.000 0.024 0.216 0.004 0.756 0.000
#> GSM151390     3  0.4346     0.6883 0.000 0.200 0.740 0.016 0.024 0.020
#> GSM151391     5  0.4398     0.7161 0.000 0.088 0.056 0.060 0.784 0.012
#> GSM151392     5  0.5224     0.6605 0.000 0.092 0.000 0.084 0.700 0.124
#> GSM151393     3  0.3330     0.7250 0.000 0.000 0.828 0.008 0.108 0.056
#> GSM151394     6  0.4273     0.6262 0.324 0.000 0.000 0.012 0.016 0.648
#> GSM151395     2  0.4960     0.6469 0.000 0.720 0.000 0.080 0.132 0.068
#> GSM151396     2  0.3873     0.7394 0.000 0.812 0.004 0.048 0.092 0.044
#> GSM151397     1  0.0291     0.9035 0.992 0.000 0.000 0.004 0.000 0.004
#> GSM151398     6  0.4647     0.7185 0.144 0.008 0.000 0.020 0.088 0.740
#> GSM151399     2  0.4103     0.7271 0.000 0.792 0.004 0.048 0.112 0.044
#> GSM151400     4  0.7487     0.1090 0.000 0.292 0.000 0.352 0.176 0.180
#> GSM151401     2  0.2376     0.7151 0.000 0.888 0.068 0.000 0.044 0.000
#> GSM151402     3  0.3330     0.7250 0.000 0.000 0.828 0.008 0.108 0.056
#> GSM151403     5  0.4598     0.1791 0.000 0.008 0.392 0.004 0.576 0.020
#> GSM151404     6  0.4677     0.0932 0.004 0.008 0.000 0.020 0.444 0.524
#> GSM151405     5  0.4544     0.7535 0.000 0.196 0.000 0.072 0.716 0.016
#> GSM151406     5  0.4176     0.7320 0.000 0.244 0.004 0.044 0.708 0.000
#> GSM151407     4  0.3155     0.7777 0.000 0.132 0.004 0.828 0.036 0.000
#> GSM151408     4  0.3183     0.7798 0.000 0.128 0.004 0.828 0.040 0.000
#> GSM151409     1  0.4076    -0.1503 0.540 0.000 0.000 0.008 0.000 0.452
#> GSM151410     4  0.3108     0.7798 0.000 0.128 0.000 0.828 0.044 0.000
#> GSM151411     6  0.3539     0.7540 0.208 0.000 0.000 0.008 0.016 0.768
#> GSM151412     2  0.2359     0.7377 0.000 0.904 0.024 0.016 0.052 0.004
#> GSM151413     1  0.1109     0.8909 0.964 0.004 0.000 0.012 0.016 0.004
#> GSM151414     1  0.0260     0.9053 0.992 0.000 0.000 0.008 0.000 0.000
#> GSM151415     1  0.1219     0.8733 0.948 0.000 0.000 0.004 0.000 0.048
#> GSM151416     4  0.5456     0.5024 0.000 0.032 0.000 0.592 0.076 0.300
#> GSM151417     6  0.5615     0.7346 0.124 0.032 0.000 0.068 0.080 0.696
#> GSM151418     3  0.4347     0.6822 0.000 0.008 0.756 0.012 0.152 0.072
#> GSM151419     1  0.0000     0.9052 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM151420     1  0.0363     0.9049 0.988 0.000 0.000 0.012 0.000 0.000
#> GSM151421     6  0.5816     0.5195 0.004 0.212 0.000 0.056 0.104 0.624
#> GSM151422     1  0.3849     0.5941 0.752 0.000 0.000 0.008 0.032 0.208
#> GSM151423     3  0.3873     0.7178 0.000 0.004 0.796 0.012 0.120 0.068
#> GSM151424     2  0.3809     0.7407 0.000 0.816 0.004 0.044 0.092 0.044
#> GSM151425     2  0.4161     0.7013 0.000 0.776 0.004 0.032 0.144 0.044
#> GSM151426     5  0.4616     0.7442 0.000 0.228 0.004 0.084 0.684 0.000
#> GSM151427     3  0.1806     0.7565 0.000 0.088 0.908 0.000 0.000 0.004
#> GSM151428     6  0.4006     0.7657 0.164 0.008 0.000 0.036 0.016 0.776
#> GSM151429     4  0.4909     0.3871 0.000 0.032 0.000 0.588 0.024 0.356
#> GSM151430     4  0.3249     0.7801 0.000 0.128 0.004 0.824 0.044 0.000
#> GSM151431     4  0.3207     0.7812 0.000 0.124 0.004 0.828 0.044 0.000
#> GSM151432     6  0.2912     0.7560 0.216 0.000 0.000 0.000 0.000 0.784
#> GSM151433     6  0.3383     0.7146 0.268 0.000 0.000 0.004 0.000 0.728
#> GSM151434     6  0.5432     0.7413 0.208 0.012 0.000 0.036 0.080 0.664
#> GSM151435     1  0.0146     0.9054 0.996 0.000 0.000 0.004 0.000 0.000
#> GSM151436     2  0.4574     0.4220 0.000 0.688 0.236 0.068 0.000 0.008
#> GSM151437     1  0.0363     0.9049 0.988 0.000 0.000 0.012 0.000 0.000
#> GSM151438     1  0.0291     0.9035 0.992 0.000 0.000 0.004 0.000 0.004
#> GSM151439     6  0.6074     0.3947 0.000 0.296 0.000 0.056 0.104 0.544
#> GSM151440     2  0.3320     0.6716 0.000 0.832 0.020 0.124 0.016 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-kmeans-consensus-heatmap-1

consensus_heatmap(res, k = 3)

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

consensus_heatmap(res, k = 4)

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

consensus_heatmap(res, k = 5)

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

consensus_heatmap(res, k = 6)

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

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

membership_heatmap(res, k = 2)

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

membership_heatmap(res, k = 3)

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

membership_heatmap(res, k = 4)

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

membership_heatmap(res, k = 5)

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

membership_heatmap(res, k = 6)

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

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

Signature heatmaps where rows are scaled:

get_signatures(res, k = 2)

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

get_signatures(res, k = 3)

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

get_signatures(res, k = 4)

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

get_signatures(res, k = 5)

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

get_signatures(res, k = 6)

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

Signature heatmaps where rows are not scaled:

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

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

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

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

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

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

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

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

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

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

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk MAD-kmeans-signature_compare

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

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

An example of the output of tb is:

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

The columns in tb are:

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

UMAP plot which shows how samples are separated.

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

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

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

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

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

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

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

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

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

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

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk MAD-kmeans-collect-classes

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

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

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

collect_plots(res)

plot of chunk MAD-skmeans-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 1.000           0.967       0.987         0.5010 0.499   0.499
#> 3 3 0.725           0.731       0.890         0.2903 0.801   0.622
#> 4 4 0.779           0.676       0.820         0.1104 0.856   0.633
#> 5 5 0.883           0.889       0.923         0.0663 0.897   0.668
#> 6 6 0.806           0.767       0.869         0.0387 0.986   0.940

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
#> GSM151369     1  0.0000      0.984 1.000 0.000
#> GSM151370     2  0.0000      0.988 0.000 1.000
#> GSM151371     1  0.0000      0.984 1.000 0.000
#> GSM151372     2  0.0000      0.988 0.000 1.000
#> GSM151373     2  0.0000      0.988 0.000 1.000
#> GSM151374     2  0.0000      0.988 0.000 1.000
#> GSM151375     2  0.0000      0.988 0.000 1.000
#> GSM151376     2  0.0000      0.988 0.000 1.000
#> GSM151377     2  0.0000      0.988 0.000 1.000
#> GSM151378     2  0.0000      0.988 0.000 1.000
#> GSM151379     2  0.0000      0.988 0.000 1.000
#> GSM151380     1  0.0938      0.973 0.988 0.012
#> GSM151381     2  0.0000      0.988 0.000 1.000
#> GSM151382     2  0.0000      0.988 0.000 1.000
#> GSM151383     2  0.0000      0.988 0.000 1.000
#> GSM151384     1  0.0000      0.984 1.000 0.000
#> GSM151385     1  0.0000      0.984 1.000 0.000
#> GSM151386     1  0.0000      0.984 1.000 0.000
#> GSM151387     2  0.0000      0.988 0.000 1.000
#> GSM151388     2  0.0000      0.988 0.000 1.000
#> GSM151389     2  0.0000      0.988 0.000 1.000
#> GSM151390     2  0.0000      0.988 0.000 1.000
#> GSM151391     2  0.0000      0.988 0.000 1.000
#> GSM151392     2  0.9922      0.176 0.448 0.552
#> GSM151393     2  0.0000      0.988 0.000 1.000
#> GSM151394     1  0.0000      0.984 1.000 0.000
#> GSM151395     1  0.8267      0.654 0.740 0.260
#> GSM151396     2  0.0000      0.988 0.000 1.000
#> GSM151397     1  0.0000      0.984 1.000 0.000
#> GSM151398     1  0.0000      0.984 1.000 0.000
#> GSM151399     2  0.0000      0.988 0.000 1.000
#> GSM151400     1  0.7602      0.721 0.780 0.220
#> GSM151401     2  0.0000      0.988 0.000 1.000
#> GSM151402     2  0.0000      0.988 0.000 1.000
#> GSM151403     2  0.0000      0.988 0.000 1.000
#> GSM151404     1  0.0000      0.984 1.000 0.000
#> GSM151405     2  0.0000      0.988 0.000 1.000
#> GSM151406     2  0.0000      0.988 0.000 1.000
#> GSM151407     2  0.0000      0.988 0.000 1.000
#> GSM151408     2  0.0000      0.988 0.000 1.000
#> GSM151409     1  0.0000      0.984 1.000 0.000
#> GSM151410     2  0.0000      0.988 0.000 1.000
#> GSM151411     1  0.0000      0.984 1.000 0.000
#> GSM151412     2  0.0000      0.988 0.000 1.000
#> GSM151413     1  0.0000      0.984 1.000 0.000
#> GSM151414     1  0.0000      0.984 1.000 0.000
#> GSM151415     1  0.0000      0.984 1.000 0.000
#> GSM151416     1  0.0000      0.984 1.000 0.000
#> GSM151417     1  0.0000      0.984 1.000 0.000
#> GSM151418     2  0.0000      0.988 0.000 1.000
#> GSM151419     1  0.0000      0.984 1.000 0.000
#> GSM151420     1  0.0000      0.984 1.000 0.000
#> GSM151421     1  0.0000      0.984 1.000 0.000
#> GSM151422     1  0.0000      0.984 1.000 0.000
#> GSM151423     2  0.0000      0.988 0.000 1.000
#> GSM151424     2  0.0000      0.988 0.000 1.000
#> GSM151425     2  0.0000      0.988 0.000 1.000
#> GSM151426     2  0.0000      0.988 0.000 1.000
#> GSM151427     2  0.0000      0.988 0.000 1.000
#> GSM151428     1  0.0000      0.984 1.000 0.000
#> GSM151429     1  0.0000      0.984 1.000 0.000
#> GSM151430     2  0.0000      0.988 0.000 1.000
#> GSM151431     2  0.0000      0.988 0.000 1.000
#> GSM151432     1  0.0000      0.984 1.000 0.000
#> GSM151433     1  0.0000      0.984 1.000 0.000
#> GSM151434     1  0.0000      0.984 1.000 0.000
#> GSM151435     1  0.0000      0.984 1.000 0.000
#> GSM151436     2  0.0000      0.988 0.000 1.000
#> GSM151437     1  0.0000      0.984 1.000 0.000
#> GSM151438     1  0.0000      0.984 1.000 0.000
#> GSM151439     1  0.0000      0.984 1.000 0.000
#> GSM151440     2  0.0000      0.988 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
#> GSM151369     1  0.0000     0.9959 1.000 0.000 0.000
#> GSM151370     3  0.3192     0.7360 0.000 0.112 0.888
#> GSM151371     1  0.0000     0.9959 1.000 0.000 0.000
#> GSM151372     2  0.6045     0.3444 0.000 0.620 0.380
#> GSM151373     3  0.6225     0.2013 0.000 0.432 0.568
#> GSM151374     3  0.0000     0.7995 0.000 0.000 1.000
#> GSM151375     3  0.0000     0.7995 0.000 0.000 1.000
#> GSM151376     3  0.0000     0.7995 0.000 0.000 1.000
#> GSM151377     3  0.0000     0.7995 0.000 0.000 1.000
#> GSM151378     3  0.0000     0.7995 0.000 0.000 1.000
#> GSM151379     3  0.0000     0.7995 0.000 0.000 1.000
#> GSM151380     3  0.8896     0.2648 0.264 0.172 0.564
#> GSM151381     3  0.0000     0.7995 0.000 0.000 1.000
#> GSM151382     2  0.6008     0.3573 0.000 0.628 0.372
#> GSM151383     2  0.0424     0.6811 0.000 0.992 0.008
#> GSM151384     1  0.0000     0.9959 1.000 0.000 0.000
#> GSM151385     1  0.0000     0.9959 1.000 0.000 0.000
#> GSM151386     1  0.0000     0.9959 1.000 0.000 0.000
#> GSM151387     3  0.2625     0.7564 0.000 0.084 0.916
#> GSM151388     3  0.4504     0.6510 0.000 0.196 0.804
#> GSM151389     3  0.0237     0.7980 0.000 0.004 0.996
#> GSM151390     3  0.0000     0.7995 0.000 0.000 1.000
#> GSM151391     3  0.2537     0.7566 0.000 0.080 0.920
#> GSM151392     3  0.5804     0.6308 0.112 0.088 0.800
#> GSM151393     3  0.0000     0.7995 0.000 0.000 1.000
#> GSM151394     1  0.0000     0.9959 1.000 0.000 0.000
#> GSM151395     2  0.9523     0.3870 0.276 0.488 0.236
#> GSM151396     3  0.6252     0.1782 0.000 0.444 0.556
#> GSM151397     1  0.0000     0.9959 1.000 0.000 0.000
#> GSM151398     1  0.0000     0.9959 1.000 0.000 0.000
#> GSM151399     3  0.6280     0.1301 0.000 0.460 0.540
#> GSM151400     2  0.6209     0.3589 0.368 0.628 0.004
#> GSM151401     3  0.6204     0.2273 0.000 0.424 0.576
#> GSM151402     3  0.0000     0.7995 0.000 0.000 1.000
#> GSM151403     3  0.0000     0.7995 0.000 0.000 1.000
#> GSM151404     1  0.0000     0.9959 1.000 0.000 0.000
#> GSM151405     3  0.3619     0.7231 0.000 0.136 0.864
#> GSM151406     3  0.0592     0.7957 0.000 0.012 0.988
#> GSM151407     2  0.0424     0.6811 0.000 0.992 0.008
#> GSM151408     2  0.0424     0.6811 0.000 0.992 0.008
#> GSM151409     1  0.0000     0.9959 1.000 0.000 0.000
#> GSM151410     2  0.0000     0.6785 0.000 1.000 0.000
#> GSM151411     1  0.0000     0.9959 1.000 0.000 0.000
#> GSM151412     3  0.6252     0.1782 0.000 0.444 0.556
#> GSM151413     1  0.0000     0.9959 1.000 0.000 0.000
#> GSM151414     1  0.0000     0.9959 1.000 0.000 0.000
#> GSM151415     1  0.0000     0.9959 1.000 0.000 0.000
#> GSM151416     2  0.6274     0.0711 0.456 0.544 0.000
#> GSM151417     1  0.0000     0.9959 1.000 0.000 0.000
#> GSM151418     3  0.0000     0.7995 0.000 0.000 1.000
#> GSM151419     1  0.0000     0.9959 1.000 0.000 0.000
#> GSM151420     1  0.0000     0.9959 1.000 0.000 0.000
#> GSM151421     1  0.0000     0.9959 1.000 0.000 0.000
#> GSM151422     1  0.0000     0.9959 1.000 0.000 0.000
#> GSM151423     3  0.0000     0.7995 0.000 0.000 1.000
#> GSM151424     3  0.6286     0.1174 0.000 0.464 0.536
#> GSM151425     3  0.6225     0.2089 0.000 0.432 0.568
#> GSM151426     3  0.4346     0.6762 0.000 0.184 0.816
#> GSM151427     3  0.0000     0.7995 0.000 0.000 1.000
#> GSM151428     1  0.0000     0.9959 1.000 0.000 0.000
#> GSM151429     2  0.5926     0.3757 0.356 0.644 0.000
#> GSM151430     2  0.0424     0.6811 0.000 0.992 0.008
#> GSM151431     2  0.0424     0.6811 0.000 0.992 0.008
#> GSM151432     1  0.0000     0.9959 1.000 0.000 0.000
#> GSM151433     1  0.0000     0.9959 1.000 0.000 0.000
#> GSM151434     1  0.0000     0.9959 1.000 0.000 0.000
#> GSM151435     1  0.0000     0.9959 1.000 0.000 0.000
#> GSM151436     2  0.6140     0.2701 0.000 0.596 0.404
#> GSM151437     1  0.0000     0.9959 1.000 0.000 0.000
#> GSM151438     1  0.0000     0.9959 1.000 0.000 0.000
#> GSM151439     1  0.2711     0.8823 0.912 0.088 0.000
#> GSM151440     2  0.6008     0.3491 0.000 0.628 0.372

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM151369     1  0.0000      0.969 1.000 0.000 0.000 0.000
#> GSM151370     3  0.1837      0.720 0.000 0.028 0.944 0.028
#> GSM151371     1  0.0000      0.969 1.000 0.000 0.000 0.000
#> GSM151372     2  0.5257      0.435 0.000 0.752 0.104 0.144
#> GSM151373     2  0.2224      0.468 0.000 0.928 0.040 0.032
#> GSM151374     2  0.4985      0.333 0.000 0.532 0.468 0.000
#> GSM151375     2  0.4977      0.339 0.000 0.540 0.460 0.000
#> GSM151376     2  0.4977      0.339 0.000 0.540 0.460 0.000
#> GSM151377     2  0.4985      0.333 0.000 0.532 0.468 0.000
#> GSM151378     2  0.4985      0.333 0.000 0.532 0.468 0.000
#> GSM151379     2  0.4985      0.333 0.000 0.532 0.468 0.000
#> GSM151380     3  0.4669      0.549 0.168 0.000 0.780 0.052
#> GSM151381     3  0.4996     -0.279 0.000 0.484 0.516 0.000
#> GSM151382     2  0.6627      0.321 0.000 0.556 0.096 0.348
#> GSM151383     4  0.0188      0.956 0.000 0.004 0.000 0.996
#> GSM151384     1  0.0000      0.969 1.000 0.000 0.000 0.000
#> GSM151385     1  0.0000      0.969 1.000 0.000 0.000 0.000
#> GSM151386     1  0.0188      0.967 0.996 0.004 0.000 0.000
#> GSM151387     3  0.1488      0.719 0.000 0.032 0.956 0.012
#> GSM151388     3  0.2494      0.705 0.000 0.036 0.916 0.048
#> GSM151389     3  0.3649      0.527 0.000 0.204 0.796 0.000
#> GSM151390     2  0.4977      0.339 0.000 0.540 0.460 0.000
#> GSM151391     3  0.5108      0.327 0.000 0.308 0.672 0.020
#> GSM151392     3  0.2188      0.698 0.032 0.020 0.936 0.012
#> GSM151393     2  0.4989      0.324 0.000 0.528 0.472 0.000
#> GSM151394     1  0.0000      0.969 1.000 0.000 0.000 0.000
#> GSM151395     2  0.8218      0.102 0.172 0.536 0.236 0.056
#> GSM151396     2  0.3999      0.407 0.000 0.824 0.140 0.036
#> GSM151397     1  0.0000      0.969 1.000 0.000 0.000 0.000
#> GSM151398     1  0.0188      0.967 0.996 0.000 0.000 0.004
#> GSM151399     2  0.5288      0.330 0.000 0.732 0.200 0.068
#> GSM151400     4  0.5079      0.767 0.148 0.056 0.016 0.780
#> GSM151401     2  0.3694      0.443 0.000 0.844 0.124 0.032
#> GSM151402     2  0.4985      0.333 0.000 0.532 0.468 0.000
#> GSM151403     3  0.4543      0.299 0.000 0.324 0.676 0.000
#> GSM151404     1  0.3908      0.726 0.784 0.000 0.212 0.004
#> GSM151405     3  0.2363      0.704 0.000 0.056 0.920 0.024
#> GSM151406     3  0.1489      0.715 0.000 0.044 0.952 0.004
#> GSM151407     4  0.0188      0.956 0.000 0.004 0.000 0.996
#> GSM151408     4  0.0188      0.956 0.000 0.004 0.000 0.996
#> GSM151409     1  0.0000      0.969 1.000 0.000 0.000 0.000
#> GSM151410     4  0.0188      0.956 0.000 0.004 0.000 0.996
#> GSM151411     1  0.0000      0.969 1.000 0.000 0.000 0.000
#> GSM151412     2  0.4037      0.423 0.000 0.824 0.136 0.040
#> GSM151413     1  0.0000      0.969 1.000 0.000 0.000 0.000
#> GSM151414     1  0.0000      0.969 1.000 0.000 0.000 0.000
#> GSM151415     1  0.0000      0.969 1.000 0.000 0.000 0.000
#> GSM151416     4  0.1389      0.925 0.048 0.000 0.000 0.952
#> GSM151417     1  0.0188      0.967 0.996 0.004 0.000 0.000
#> GSM151418     2  0.4989      0.324 0.000 0.528 0.472 0.000
#> GSM151419     1  0.0000      0.969 1.000 0.000 0.000 0.000
#> GSM151420     1  0.0000      0.969 1.000 0.000 0.000 0.000
#> GSM151421     1  0.1792      0.909 0.932 0.068 0.000 0.000
#> GSM151422     1  0.0000      0.969 1.000 0.000 0.000 0.000
#> GSM151423     2  0.4989      0.324 0.000 0.528 0.472 0.000
#> GSM151424     2  0.3333      0.446 0.000 0.872 0.088 0.040
#> GSM151425     2  0.4238      0.375 0.000 0.796 0.176 0.028
#> GSM151426     3  0.2408      0.707 0.000 0.044 0.920 0.036
#> GSM151427     2  0.4985      0.333 0.000 0.532 0.468 0.000
#> GSM151428     1  0.0188      0.967 0.996 0.000 0.000 0.004
#> GSM151429     4  0.1211      0.933 0.040 0.000 0.000 0.960
#> GSM151430     4  0.0188      0.956 0.000 0.004 0.000 0.996
#> GSM151431     4  0.0188      0.956 0.000 0.004 0.000 0.996
#> GSM151432     1  0.0000      0.969 1.000 0.000 0.000 0.000
#> GSM151433     1  0.0000      0.969 1.000 0.000 0.000 0.000
#> GSM151434     1  0.0336      0.964 0.992 0.008 0.000 0.000
#> GSM151435     1  0.0000      0.969 1.000 0.000 0.000 0.000
#> GSM151436     2  0.2222      0.469 0.000 0.924 0.016 0.060
#> GSM151437     1  0.0000      0.969 1.000 0.000 0.000 0.000
#> GSM151438     1  0.0000      0.969 1.000 0.000 0.000 0.000
#> GSM151439     1  0.5466      0.357 0.548 0.436 0.000 0.016
#> GSM151440     2  0.3166      0.456 0.000 0.868 0.016 0.116

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>           class entropy silhouette    p1    p2    p3    p4    p5
#> GSM151369     1  0.1357      0.940 0.948 0.004 0.000 0.000 0.048
#> GSM151370     5  0.2962      0.929 0.000 0.048 0.084 0.000 0.868
#> GSM151371     1  0.0579      0.962 0.984 0.008 0.000 0.000 0.008
#> GSM151372     3  0.4216      0.744 0.000 0.120 0.796 0.072 0.012
#> GSM151373     2  0.4571      0.695 0.000 0.664 0.312 0.004 0.020
#> GSM151374     3  0.0324      0.927 0.000 0.004 0.992 0.000 0.004
#> GSM151375     3  0.0510      0.924 0.000 0.016 0.984 0.000 0.000
#> GSM151376     3  0.0510      0.924 0.000 0.016 0.984 0.000 0.000
#> GSM151377     3  0.0404      0.927 0.000 0.000 0.988 0.000 0.012
#> GSM151378     3  0.0579      0.927 0.000 0.008 0.984 0.000 0.008
#> GSM151379     3  0.0579      0.927 0.000 0.008 0.984 0.000 0.008
#> GSM151380     5  0.2197      0.888 0.036 0.004 0.028 0.008 0.924
#> GSM151381     3  0.1671      0.900 0.000 0.000 0.924 0.000 0.076
#> GSM151382     3  0.3940      0.767 0.000 0.044 0.808 0.136 0.012
#> GSM151383     4  0.0324      0.940 0.000 0.004 0.000 0.992 0.004
#> GSM151384     1  0.0798      0.959 0.976 0.016 0.000 0.000 0.008
#> GSM151385     1  0.0000      0.966 1.000 0.000 0.000 0.000 0.000
#> GSM151386     1  0.0898      0.957 0.972 0.020 0.000 0.000 0.008
#> GSM151387     5  0.3090      0.924 0.000 0.052 0.088 0.000 0.860
#> GSM151388     5  0.1893      0.922 0.000 0.048 0.024 0.000 0.928
#> GSM151389     3  0.3305      0.715 0.000 0.000 0.776 0.000 0.224
#> GSM151390     3  0.0510      0.924 0.000 0.016 0.984 0.000 0.000
#> GSM151391     3  0.3759      0.760 0.000 0.004 0.792 0.024 0.180
#> GSM151392     5  0.2678      0.887 0.004 0.016 0.100 0.000 0.880
#> GSM151393     3  0.0609      0.926 0.000 0.000 0.980 0.000 0.020
#> GSM151394     1  0.0324      0.965 0.992 0.004 0.000 0.000 0.004
#> GSM151395     2  0.1717      0.775 0.008 0.936 0.004 0.000 0.052
#> GSM151396     2  0.1828      0.812 0.000 0.936 0.032 0.004 0.028
#> GSM151397     1  0.0162      0.966 0.996 0.004 0.000 0.000 0.000
#> GSM151398     1  0.0963      0.947 0.964 0.000 0.000 0.000 0.036
#> GSM151399     2  0.2721      0.809 0.000 0.896 0.036 0.016 0.052
#> GSM151400     4  0.7021      0.531 0.116 0.188 0.000 0.580 0.116
#> GSM151401     2  0.4267      0.777 0.000 0.736 0.232 0.004 0.028
#> GSM151402     3  0.0404      0.927 0.000 0.000 0.988 0.000 0.012
#> GSM151403     3  0.1792      0.887 0.000 0.000 0.916 0.000 0.084
#> GSM151404     1  0.4183      0.541 0.668 0.008 0.000 0.000 0.324
#> GSM151405     5  0.2139      0.923 0.000 0.052 0.032 0.000 0.916
#> GSM151406     5  0.3569      0.902 0.000 0.068 0.104 0.000 0.828
#> GSM151407     4  0.0162      0.942 0.000 0.000 0.000 0.996 0.004
#> GSM151408     4  0.0162      0.942 0.000 0.000 0.000 0.996 0.004
#> GSM151409     1  0.0162      0.965 0.996 0.004 0.000 0.000 0.000
#> GSM151410     4  0.0162      0.942 0.000 0.000 0.000 0.996 0.004
#> GSM151411     1  0.0324      0.965 0.992 0.004 0.000 0.000 0.004
#> GSM151412     2  0.2899      0.832 0.000 0.872 0.096 0.004 0.028
#> GSM151413     1  0.0162      0.966 0.996 0.004 0.000 0.000 0.000
#> GSM151414     1  0.0000      0.966 1.000 0.000 0.000 0.000 0.000
#> GSM151415     1  0.0000      0.966 1.000 0.000 0.000 0.000 0.000
#> GSM151416     4  0.1153      0.916 0.024 0.004 0.000 0.964 0.008
#> GSM151417     1  0.0671      0.961 0.980 0.016 0.000 0.004 0.000
#> GSM151418     3  0.0609      0.926 0.000 0.000 0.980 0.000 0.020
#> GSM151419     1  0.0162      0.966 0.996 0.004 0.000 0.000 0.000
#> GSM151420     1  0.0000      0.966 1.000 0.000 0.000 0.000 0.000
#> GSM151421     1  0.4468      0.667 0.716 0.240 0.000 0.000 0.044
#> GSM151422     1  0.0162      0.966 0.996 0.004 0.000 0.000 0.000
#> GSM151423     3  0.0609      0.926 0.000 0.000 0.980 0.000 0.020
#> GSM151424     2  0.2756      0.833 0.000 0.880 0.096 0.012 0.012
#> GSM151425     2  0.2278      0.826 0.000 0.908 0.060 0.000 0.032
#> GSM151426     5  0.3062      0.920 0.000 0.080 0.048 0.004 0.868
#> GSM151427     3  0.0451      0.928 0.000 0.004 0.988 0.000 0.008
#> GSM151428     1  0.0740      0.960 0.980 0.004 0.000 0.008 0.008
#> GSM151429     4  0.1168      0.923 0.000 0.032 0.000 0.960 0.008
#> GSM151430     4  0.0162      0.942 0.000 0.000 0.000 0.996 0.004
#> GSM151431     4  0.0162      0.942 0.000 0.000 0.000 0.996 0.004
#> GSM151432     1  0.0324      0.965 0.992 0.004 0.000 0.000 0.004
#> GSM151433     1  0.0324      0.965 0.992 0.004 0.000 0.000 0.004
#> GSM151434     1  0.1399      0.943 0.952 0.028 0.000 0.000 0.020
#> GSM151435     1  0.0162      0.966 0.996 0.004 0.000 0.000 0.000
#> GSM151436     2  0.5021      0.731 0.000 0.676 0.268 0.044 0.012
#> GSM151437     1  0.0000      0.966 1.000 0.000 0.000 0.000 0.000
#> GSM151438     1  0.0162      0.966 0.996 0.004 0.000 0.000 0.000
#> GSM151439     2  0.3425      0.684 0.112 0.840 0.000 0.004 0.044
#> GSM151440     2  0.5482      0.746 0.000 0.672 0.224 0.088 0.016

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>           class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM151369     1  0.4039      0.566 0.724 0.000 0.000 0.004 0.040 0.232
#> GSM151370     5  0.2399      0.884 0.000 0.024 0.044 0.004 0.904 0.024
#> GSM151371     1  0.2442      0.805 0.852 0.000 0.000 0.000 0.004 0.144
#> GSM151372     3  0.6563      0.436 0.000 0.184 0.556 0.092 0.004 0.164
#> GSM151373     2  0.4489      0.642 0.000 0.724 0.196 0.004 0.012 0.064
#> GSM151374     3  0.1624      0.864 0.000 0.012 0.936 0.000 0.008 0.044
#> GSM151375     3  0.3364      0.834 0.000 0.036 0.840 0.004 0.024 0.096
#> GSM151376     3  0.3364      0.834 0.000 0.036 0.840 0.004 0.024 0.096
#> GSM151377     3  0.0547      0.865 0.000 0.000 0.980 0.000 0.000 0.020
#> GSM151378     3  0.1718      0.863 0.000 0.016 0.932 0.000 0.008 0.044
#> GSM151379     3  0.1718      0.863 0.000 0.016 0.932 0.000 0.008 0.044
#> GSM151380     5  0.3592      0.800 0.012 0.000 0.016 0.004 0.784 0.184
#> GSM151381     3  0.2863      0.801 0.000 0.008 0.860 0.000 0.096 0.036
#> GSM151382     3  0.6403      0.518 0.000 0.124 0.588 0.148 0.004 0.136
#> GSM151383     4  0.0603      0.886 0.000 0.004 0.000 0.980 0.000 0.016
#> GSM151384     1  0.2664      0.734 0.816 0.000 0.000 0.000 0.000 0.184
#> GSM151385     1  0.0260      0.892 0.992 0.000 0.000 0.000 0.000 0.008
#> GSM151386     1  0.1863      0.832 0.896 0.000 0.000 0.000 0.000 0.104
#> GSM151387     5  0.1914      0.880 0.000 0.016 0.056 0.008 0.920 0.000
#> GSM151388     5  0.1854      0.878 0.000 0.020 0.016 0.004 0.932 0.028
#> GSM151389     3  0.3645      0.628 0.000 0.000 0.740 0.000 0.236 0.024
#> GSM151390     3  0.3364      0.834 0.000 0.036 0.840 0.004 0.024 0.096
#> GSM151391     3  0.3823      0.707 0.000 0.004 0.780 0.004 0.160 0.052
#> GSM151392     5  0.4762      0.677 0.004 0.012 0.040 0.004 0.664 0.276
#> GSM151393     3  0.0260      0.864 0.000 0.000 0.992 0.000 0.000 0.008
#> GSM151394     1  0.1204      0.880 0.944 0.000 0.000 0.000 0.000 0.056
#> GSM151395     2  0.2573      0.637 0.000 0.856 0.000 0.004 0.008 0.132
#> GSM151396     2  0.2062      0.690 0.000 0.900 0.004 0.000 0.008 0.088
#> GSM151397     1  0.0547      0.890 0.980 0.000 0.000 0.000 0.000 0.020
#> GSM151398     1  0.2218      0.825 0.884 0.000 0.000 0.000 0.012 0.104
#> GSM151399     2  0.1914      0.736 0.000 0.928 0.012 0.008 0.040 0.012
#> GSM151400     4  0.8015      0.148 0.124 0.148 0.000 0.420 0.072 0.236
#> GSM151401     2  0.4233      0.687 0.000 0.764 0.160 0.004 0.028 0.044
#> GSM151402     3  0.0000      0.865 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM151403     3  0.1408      0.849 0.000 0.000 0.944 0.000 0.036 0.020
#> GSM151404     1  0.5539      0.198 0.556 0.000 0.000 0.000 0.200 0.244
#> GSM151405     5  0.2767      0.876 0.000 0.028 0.020 0.004 0.880 0.068
#> GSM151406     5  0.3113      0.840 0.000 0.048 0.100 0.000 0.844 0.008
#> GSM151407     4  0.0146      0.891 0.000 0.004 0.000 0.996 0.000 0.000
#> GSM151408     4  0.0146      0.891 0.000 0.004 0.000 0.996 0.000 0.000
#> GSM151409     1  0.0865      0.884 0.964 0.000 0.000 0.000 0.000 0.036
#> GSM151410     4  0.0508      0.889 0.000 0.004 0.000 0.984 0.000 0.012
#> GSM151411     1  0.1141      0.882 0.948 0.000 0.000 0.000 0.000 0.052
#> GSM151412     2  0.1899      0.745 0.000 0.928 0.028 0.004 0.032 0.008
#> GSM151413     1  0.0458      0.891 0.984 0.000 0.000 0.000 0.000 0.016
#> GSM151414     1  0.0146      0.892 0.996 0.000 0.000 0.000 0.000 0.004
#> GSM151415     1  0.0458      0.891 0.984 0.000 0.000 0.000 0.000 0.016
#> GSM151416     4  0.3179      0.811 0.032 0.000 0.000 0.848 0.028 0.092
#> GSM151417     1  0.2070      0.837 0.892 0.008 0.000 0.000 0.000 0.100
#> GSM151418     3  0.0632      0.864 0.000 0.000 0.976 0.000 0.000 0.024
#> GSM151419     1  0.0363      0.891 0.988 0.000 0.000 0.000 0.000 0.012
#> GSM151420     1  0.0260      0.891 0.992 0.000 0.000 0.000 0.000 0.008
#> GSM151421     6  0.5181      0.135 0.428 0.088 0.000 0.000 0.000 0.484
#> GSM151422     1  0.0713      0.888 0.972 0.000 0.000 0.000 0.000 0.028
#> GSM151423     3  0.0363      0.864 0.000 0.000 0.988 0.000 0.000 0.012
#> GSM151424     2  0.2002      0.740 0.000 0.920 0.028 0.012 0.000 0.040
#> GSM151425     2  0.2995      0.724 0.000 0.868 0.020 0.004 0.044 0.064
#> GSM151426     5  0.2006      0.879 0.000 0.036 0.024 0.008 0.924 0.008
#> GSM151427     3  0.1750      0.865 0.000 0.016 0.932 0.000 0.012 0.040
#> GSM151428     1  0.2700      0.782 0.836 0.000 0.000 0.004 0.004 0.156
#> GSM151429     4  0.3096      0.787 0.004 0.004 0.000 0.812 0.008 0.172
#> GSM151430     4  0.0146      0.891 0.000 0.004 0.000 0.996 0.000 0.000
#> GSM151431     4  0.0146      0.891 0.000 0.004 0.000 0.996 0.000 0.000
#> GSM151432     1  0.1204      0.881 0.944 0.000 0.000 0.000 0.000 0.056
#> GSM151433     1  0.1141      0.883 0.948 0.000 0.000 0.000 0.000 0.052
#> GSM151434     1  0.2482      0.777 0.848 0.004 0.000 0.000 0.000 0.148
#> GSM151435     1  0.0146      0.892 0.996 0.000 0.000 0.000 0.000 0.004
#> GSM151436     2  0.5685      0.583 0.000 0.636 0.152 0.028 0.008 0.176
#> GSM151437     1  0.0363      0.890 0.988 0.000 0.000 0.000 0.000 0.012
#> GSM151438     1  0.0458      0.891 0.984 0.000 0.000 0.000 0.000 0.016
#> GSM151439     6  0.5142     -0.191 0.064 0.412 0.000 0.008 0.000 0.516
#> GSM151440     2  0.6275      0.542 0.000 0.596 0.128 0.096 0.004 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-MAD-skmeans-consensus-heatmap-1

consensus_heatmap(res, k = 3)

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

consensus_heatmap(res, k = 4)

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

consensus_heatmap(res, k = 5)

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

consensus_heatmap(res, k = 6)

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

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

membership_heatmap(res, k = 2)

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

membership_heatmap(res, k = 3)

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

membership_heatmap(res, k = 4)

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

membership_heatmap(res, k = 5)

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

membership_heatmap(res, k = 6)

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

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

Signature heatmaps where rows are scaled:

get_signatures(res, k = 2)

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

get_signatures(res, k = 3)

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

get_signatures(res, k = 4)

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

get_signatures(res, k = 5)

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

get_signatures(res, k = 6)

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

Signature heatmaps where rows are not scaled:

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

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

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

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

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

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

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

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

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

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

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk MAD-skmeans-signature_compare

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

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

An example of the output of tb is:

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

The columns in tb are:

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

UMAP plot which shows how samples are separated.

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

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

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

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

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

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

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

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

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

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

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk MAD-skmeans-collect-classes

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

test_to_known_factors(res)
#>              n disease.state(p) k
#> MAD:skmeans 71           0.3335 2
#> MAD:skmeans 56           0.1247 3
#> MAD:skmeans 44           0.1746 4
#> MAD:skmeans 72           0.0637 5
#> MAD:skmeans 67           0.2245 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 17730 rows and 72 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 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-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 1.000           0.952       0.982         0.4563 0.540   0.540
#> 3 3 0.922           0.895       0.959         0.4703 0.769   0.578
#> 4 4 0.844           0.770       0.873         0.0881 0.926   0.779
#> 5 5 0.870           0.792       0.913         0.0658 0.930   0.751
#> 6 6 0.825           0.776       0.872         0.0387 0.979   0.904

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

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

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

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

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

show/hide code output

cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#>           class entropy silhouette    p1    p2
#> GSM151369     1  0.3584     0.9099 0.932 0.068
#> GSM151370     2  0.0000     0.9885 0.000 1.000
#> GSM151371     1  0.6343     0.8124 0.840 0.160
#> GSM151372     2  0.0000     0.9885 0.000 1.000
#> GSM151373     2  0.0000     0.9885 0.000 1.000
#> GSM151374     2  0.0000     0.9885 0.000 1.000
#> GSM151375     2  0.0000     0.9885 0.000 1.000
#> GSM151376     2  0.0000     0.9885 0.000 1.000
#> GSM151377     2  0.0000     0.9885 0.000 1.000
#> GSM151378     2  0.0000     0.9885 0.000 1.000
#> GSM151379     2  0.0000     0.9885 0.000 1.000
#> GSM151380     2  0.1633     0.9639 0.024 0.976
#> GSM151381     2  0.0000     0.9885 0.000 1.000
#> GSM151382     2  0.0000     0.9885 0.000 1.000
#> GSM151383     2  0.0000     0.9885 0.000 1.000
#> GSM151384     1  0.0000     0.9646 1.000 0.000
#> GSM151385     1  0.0000     0.9646 1.000 0.000
#> GSM151386     1  0.0000     0.9646 1.000 0.000
#> GSM151387     2  0.0000     0.9885 0.000 1.000
#> GSM151388     2  0.0000     0.9885 0.000 1.000
#> GSM151389     2  0.0000     0.9885 0.000 1.000
#> GSM151390     2  0.0000     0.9885 0.000 1.000
#> GSM151391     2  0.0000     0.9885 0.000 1.000
#> GSM151392     2  0.0000     0.9885 0.000 1.000
#> GSM151393     2  0.0000     0.9885 0.000 1.000
#> GSM151394     1  0.0000     0.9646 1.000 0.000
#> GSM151395     2  0.0000     0.9885 0.000 1.000
#> GSM151396     2  0.0000     0.9885 0.000 1.000
#> GSM151397     1  0.0000     0.9646 1.000 0.000
#> GSM151398     1  0.0000     0.9646 1.000 0.000
#> GSM151399     2  0.0000     0.9885 0.000 1.000
#> GSM151400     2  0.0000     0.9885 0.000 1.000
#> GSM151401     2  0.0000     0.9885 0.000 1.000
#> GSM151402     2  0.0000     0.9885 0.000 1.000
#> GSM151403     2  0.0000     0.9885 0.000 1.000
#> GSM151404     1  0.0376     0.9621 0.996 0.004
#> GSM151405     2  0.0000     0.9885 0.000 1.000
#> GSM151406     2  0.0000     0.9885 0.000 1.000
#> GSM151407     2  0.0000     0.9885 0.000 1.000
#> GSM151408     2  0.0000     0.9885 0.000 1.000
#> GSM151409     1  0.0000     0.9646 1.000 0.000
#> GSM151410     2  0.0000     0.9885 0.000 1.000
#> GSM151411     1  0.0000     0.9646 1.000 0.000
#> GSM151412     2  0.0000     0.9885 0.000 1.000
#> GSM151413     1  0.0000     0.9646 1.000 0.000
#> GSM151414     1  0.0000     0.9646 1.000 0.000
#> GSM151415     1  0.0000     0.9646 1.000 0.000
#> GSM151416     1  0.9850     0.2766 0.572 0.428
#> GSM151417     2  0.9983     0.0145 0.476 0.524
#> GSM151418     2  0.0000     0.9885 0.000 1.000
#> GSM151419     1  0.0000     0.9646 1.000 0.000
#> GSM151420     1  0.0000     0.9646 1.000 0.000
#> GSM151421     2  0.0000     0.9885 0.000 1.000
#> GSM151422     1  0.0000     0.9646 1.000 0.000
#> GSM151423     2  0.0000     0.9885 0.000 1.000
#> GSM151424     2  0.0000     0.9885 0.000 1.000
#> GSM151425     2  0.0000     0.9885 0.000 1.000
#> GSM151426     2  0.0000     0.9885 0.000 1.000
#> GSM151427     2  0.0000     0.9885 0.000 1.000
#> GSM151428     1  0.6438     0.8074 0.836 0.164
#> GSM151429     2  0.0000     0.9885 0.000 1.000
#> GSM151430     2  0.0000     0.9885 0.000 1.000
#> GSM151431     2  0.0000     0.9885 0.000 1.000
#> GSM151432     1  0.0000     0.9646 1.000 0.000
#> GSM151433     1  0.0000     0.9646 1.000 0.000
#> GSM151434     1  0.0672     0.9594 0.992 0.008
#> GSM151435     1  0.0000     0.9646 1.000 0.000
#> GSM151436     2  0.0000     0.9885 0.000 1.000
#> GSM151437     1  0.0000     0.9646 1.000 0.000
#> GSM151438     1  0.0000     0.9646 1.000 0.000
#> GSM151439     2  0.0000     0.9885 0.000 1.000
#> GSM151440     2  0.0000     0.9885 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
#> GSM151369     1  0.6026     0.4173 0.624 0.000 0.376
#> GSM151370     2  0.0000     0.9680 0.000 1.000 0.000
#> GSM151371     1  0.5497     0.5824 0.708 0.292 0.000
#> GSM151372     2  0.0000     0.9680 0.000 1.000 0.000
#> GSM151373     2  0.0000     0.9680 0.000 1.000 0.000
#> GSM151374     3  0.0000     0.9647 0.000 0.000 1.000
#> GSM151375     3  0.6095     0.3464 0.000 0.392 0.608
#> GSM151376     3  0.4235     0.7743 0.000 0.176 0.824
#> GSM151377     3  0.0000     0.9647 0.000 0.000 1.000
#> GSM151378     3  0.0237     0.9626 0.000 0.004 0.996
#> GSM151379     3  0.0424     0.9599 0.000 0.008 0.992
#> GSM151380     3  0.0000     0.9647 0.000 0.000 1.000
#> GSM151381     3  0.0000     0.9647 0.000 0.000 1.000
#> GSM151382     2  0.0000     0.9680 0.000 1.000 0.000
#> GSM151383     2  0.0000     0.9680 0.000 1.000 0.000
#> GSM151384     1  0.0000     0.9300 1.000 0.000 0.000
#> GSM151385     1  0.0000     0.9300 1.000 0.000 0.000
#> GSM151386     1  0.0000     0.9300 1.000 0.000 0.000
#> GSM151387     3  0.0000     0.9647 0.000 0.000 1.000
#> GSM151388     3  0.0000     0.9647 0.000 0.000 1.000
#> GSM151389     3  0.0000     0.9647 0.000 0.000 1.000
#> GSM151390     2  0.1163     0.9426 0.000 0.972 0.028
#> GSM151391     3  0.0000     0.9647 0.000 0.000 1.000
#> GSM151392     2  0.5138     0.6421 0.000 0.748 0.252
#> GSM151393     3  0.0000     0.9647 0.000 0.000 1.000
#> GSM151394     1  0.0000     0.9300 1.000 0.000 0.000
#> GSM151395     2  0.0000     0.9680 0.000 1.000 0.000
#> GSM151396     2  0.0000     0.9680 0.000 1.000 0.000
#> GSM151397     1  0.0000     0.9300 1.000 0.000 0.000
#> GSM151398     1  0.0000     0.9300 1.000 0.000 0.000
#> GSM151399     2  0.0000     0.9680 0.000 1.000 0.000
#> GSM151400     2  0.0000     0.9680 0.000 1.000 0.000
#> GSM151401     2  0.0000     0.9680 0.000 1.000 0.000
#> GSM151402     3  0.0000     0.9647 0.000 0.000 1.000
#> GSM151403     3  0.0000     0.9647 0.000 0.000 1.000
#> GSM151404     3  0.0424     0.9587 0.008 0.000 0.992
#> GSM151405     3  0.2261     0.9084 0.000 0.068 0.932
#> GSM151406     3  0.0000     0.9647 0.000 0.000 1.000
#> GSM151407     2  0.0000     0.9680 0.000 1.000 0.000
#> GSM151408     2  0.0000     0.9680 0.000 1.000 0.000
#> GSM151409     1  0.0000     0.9300 1.000 0.000 0.000
#> GSM151410     2  0.0000     0.9680 0.000 1.000 0.000
#> GSM151411     1  0.0000     0.9300 1.000 0.000 0.000
#> GSM151412     2  0.0000     0.9680 0.000 1.000 0.000
#> GSM151413     1  0.0000     0.9300 1.000 0.000 0.000
#> GSM151414     1  0.0000     0.9300 1.000 0.000 0.000
#> GSM151415     1  0.0000     0.9300 1.000 0.000 0.000
#> GSM151416     1  0.6280     0.1802 0.540 0.460 0.000
#> GSM151417     2  0.6280     0.0488 0.460 0.540 0.000
#> GSM151418     3  0.0000     0.9647 0.000 0.000 1.000
#> GSM151419     1  0.0000     0.9300 1.000 0.000 0.000
#> GSM151420     1  0.0000     0.9300 1.000 0.000 0.000
#> GSM151421     2  0.0000     0.9680 0.000 1.000 0.000
#> GSM151422     1  0.0000     0.9300 1.000 0.000 0.000
#> GSM151423     3  0.0000     0.9647 0.000 0.000 1.000
#> GSM151424     2  0.0000     0.9680 0.000 1.000 0.000
#> GSM151425     2  0.0000     0.9680 0.000 1.000 0.000
#> GSM151426     3  0.0747     0.9542 0.000 0.016 0.984
#> GSM151427     3  0.0000     0.9647 0.000 0.000 1.000
#> GSM151428     1  0.6026     0.4149 0.624 0.376 0.000
#> GSM151429     2  0.0000     0.9680 0.000 1.000 0.000
#> GSM151430     2  0.0000     0.9680 0.000 1.000 0.000
#> GSM151431     2  0.0000     0.9680 0.000 1.000 0.000
#> GSM151432     1  0.0000     0.9300 1.000 0.000 0.000
#> GSM151433     1  0.0000     0.9300 1.000 0.000 0.000
#> GSM151434     1  0.0592     0.9212 0.988 0.012 0.000
#> GSM151435     1  0.0000     0.9300 1.000 0.000 0.000
#> GSM151436     2  0.0000     0.9680 0.000 1.000 0.000
#> GSM151437     1  0.0000     0.9300 1.000 0.000 0.000
#> GSM151438     1  0.0000     0.9300 1.000 0.000 0.000
#> GSM151439     2  0.0000     0.9680 0.000 1.000 0.000
#> GSM151440     2  0.0000     0.9680 0.000 1.000 0.000

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM151369     1  0.4941    0.47861 0.564 0.000 0.436 0.000
#> GSM151370     2  0.0188    0.79454 0.000 0.996 0.000 0.004
#> GSM151371     1  0.4564    0.41842 0.672 0.328 0.000 0.000
#> GSM151372     2  0.0000    0.79875 0.000 1.000 0.000 0.000
#> GSM151373     2  0.0188    0.79449 0.000 0.996 0.004 0.000
#> GSM151374     3  0.0188    0.66957 0.000 0.000 0.996 0.004
#> GSM151375     3  0.1743    0.61628 0.000 0.056 0.940 0.004
#> GSM151376     3  0.0188    0.66512 0.000 0.004 0.996 0.000
#> GSM151377     3  0.4866    0.86934 0.000 0.000 0.596 0.404
#> GSM151378     3  0.0000    0.66677 0.000 0.000 1.000 0.000
#> GSM151379     3  0.0336    0.66115 0.000 0.000 0.992 0.008
#> GSM151380     3  0.4877    0.86917 0.000 0.000 0.592 0.408
#> GSM151381     3  0.4877    0.86917 0.000 0.000 0.592 0.408
#> GSM151382     2  0.4790   -0.40818 0.000 0.620 0.000 0.380
#> GSM151383     4  0.4877    0.98765 0.000 0.408 0.000 0.592
#> GSM151384     1  0.0000    0.93957 1.000 0.000 0.000 0.000
#> GSM151385     1  0.0000    0.93957 1.000 0.000 0.000 0.000
#> GSM151386     1  0.0000    0.93957 1.000 0.000 0.000 0.000
#> GSM151387     3  0.4877    0.86917 0.000 0.000 0.592 0.408
#> GSM151388     3  0.4877    0.86917 0.000 0.000 0.592 0.408
#> GSM151389     3  0.4877    0.86917 0.000 0.000 0.592 0.408
#> GSM151390     2  0.4925    0.23651 0.000 0.572 0.428 0.000
#> GSM151391     3  0.4866    0.86934 0.000 0.000 0.596 0.404
#> GSM151392     3  0.4950   -0.02195 0.000 0.376 0.620 0.004
#> GSM151393     3  0.4855    0.86883 0.000 0.000 0.600 0.400
#> GSM151394     1  0.0000    0.93957 1.000 0.000 0.000 0.000
#> GSM151395     2  0.0000    0.79875 0.000 1.000 0.000 0.000
#> GSM151396     2  0.0000    0.79875 0.000 1.000 0.000 0.000
#> GSM151397     1  0.0000    0.93957 1.000 0.000 0.000 0.000
#> GSM151398     1  0.0000    0.93957 1.000 0.000 0.000 0.000
#> GSM151399     2  0.0000    0.79875 0.000 1.000 0.000 0.000
#> GSM151400     2  0.4972   -0.66219 0.000 0.544 0.000 0.456
#> GSM151401     2  0.0000    0.79875 0.000 1.000 0.000 0.000
#> GSM151402     3  0.3975    0.80339 0.000 0.000 0.760 0.240
#> GSM151403     3  0.4866    0.86934 0.000 0.000 0.596 0.404
#> GSM151404     3  0.5290    0.86355 0.012 0.000 0.584 0.404
#> GSM151405     3  0.6234    0.82204 0.000 0.068 0.584 0.348
#> GSM151406     3  0.4877    0.86917 0.000 0.000 0.592 0.408
#> GSM151407     4  0.4877    0.98765 0.000 0.408 0.000 0.592
#> GSM151408     4  0.4877    0.98765 0.000 0.408 0.000 0.592
#> GSM151409     1  0.0000    0.93957 1.000 0.000 0.000 0.000
#> GSM151410     4  0.4877    0.98765 0.000 0.408 0.000 0.592
#> GSM151411     1  0.0000    0.93957 1.000 0.000 0.000 0.000
#> GSM151412     2  0.0000    0.79875 0.000 1.000 0.000 0.000
#> GSM151413     1  0.0000    0.93957 1.000 0.000 0.000 0.000
#> GSM151414     1  0.0000    0.93957 1.000 0.000 0.000 0.000
#> GSM151415     1  0.0000    0.93957 1.000 0.000 0.000 0.000
#> GSM151416     4  0.5440    0.94634 0.020 0.384 0.000 0.596
#> GSM151417     2  0.4972    0.00519 0.456 0.544 0.000 0.000
#> GSM151418     3  0.4866    0.86934 0.000 0.000 0.596 0.404
#> GSM151419     1  0.0000    0.93957 1.000 0.000 0.000 0.000
#> GSM151420     1  0.0000    0.93957 1.000 0.000 0.000 0.000
#> GSM151421     2  0.0000    0.79875 0.000 1.000 0.000 0.000
#> GSM151422     1  0.0000    0.93957 1.000 0.000 0.000 0.000
#> GSM151423     3  0.4866    0.86934 0.000 0.000 0.596 0.404
#> GSM151424     2  0.0000    0.79875 0.000 1.000 0.000 0.000
#> GSM151425     2  0.0188    0.79454 0.000 0.996 0.000 0.004
#> GSM151426     3  0.5161    0.82127 0.000 0.004 0.520 0.476
#> GSM151427     3  0.4855    0.86883 0.000 0.000 0.600 0.400
#> GSM151428     1  0.4898    0.19940 0.584 0.416 0.000 0.000
#> GSM151429     2  0.3266    0.48469 0.000 0.832 0.000 0.168
#> GSM151430     4  0.4866    0.98527 0.000 0.404 0.000 0.596
#> GSM151431     4  0.4866    0.98527 0.000 0.404 0.000 0.596
#> GSM151432     1  0.0000    0.93957 1.000 0.000 0.000 0.000
#> GSM151433     1  0.0000    0.93957 1.000 0.000 0.000 0.000
#> GSM151434     1  0.0469    0.92832 0.988 0.012 0.000 0.000
#> GSM151435     1  0.0000    0.93957 1.000 0.000 0.000 0.000
#> GSM151436     2  0.0000    0.79875 0.000 1.000 0.000 0.000
#> GSM151437     1  0.0000    0.93957 1.000 0.000 0.000 0.000
#> GSM151438     1  0.0000    0.93957 1.000 0.000 0.000 0.000
#> GSM151439     2  0.0000    0.79875 0.000 1.000 0.000 0.000
#> GSM151440     2  0.0000    0.79875 0.000 1.000 0.000 0.000

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>           class entropy silhouette    p1    p2    p3    p4    p5
#> GSM151369     1  0.4966      0.317 0.564 0.000 0.404 0.000 0.032
#> GSM151370     2  0.0162      0.880 0.000 0.996 0.000 0.000 0.004
#> GSM151371     1  0.3932      0.480 0.672 0.328 0.000 0.000 0.000
#> GSM151372     2  0.0000      0.883 0.000 1.000 0.000 0.000 0.000
#> GSM151373     3  0.4210      0.120 0.000 0.412 0.588 0.000 0.000
#> GSM151374     3  0.0290      0.580 0.000 0.000 0.992 0.000 0.008
#> GSM151375     3  0.4616      0.483 0.000 0.036 0.676 0.000 0.288
#> GSM151376     3  0.4305      0.112 0.000 0.000 0.512 0.000 0.488
#> GSM151377     5  0.0162      0.978 0.000 0.000 0.004 0.000 0.996
#> GSM151378     3  0.0000      0.578 0.000 0.000 1.000 0.000 0.000
#> GSM151379     3  0.0000      0.578 0.000 0.000 1.000 0.000 0.000
#> GSM151380     5  0.0000      0.980 0.000 0.000 0.000 0.000 1.000
#> GSM151381     5  0.0000      0.980 0.000 0.000 0.000 0.000 1.000
#> GSM151382     2  0.4138      0.414 0.000 0.616 0.000 0.384 0.000
#> GSM151383     4  0.0000      0.969 0.000 0.000 0.000 1.000 0.000
#> GSM151384     1  0.0000      0.938 1.000 0.000 0.000 0.000 0.000
#> GSM151385     1  0.0000      0.938 1.000 0.000 0.000 0.000 0.000
#> GSM151386     1  0.0000      0.938 1.000 0.000 0.000 0.000 0.000
#> GSM151387     5  0.0000      0.980 0.000 0.000 0.000 0.000 1.000
#> GSM151388     5  0.0000      0.980 0.000 0.000 0.000 0.000 1.000
#> GSM151389     5  0.0000      0.980 0.000 0.000 0.000 0.000 1.000
#> GSM151390     3  0.4066      0.393 0.000 0.324 0.672 0.000 0.004
#> GSM151391     5  0.0000      0.980 0.000 0.000 0.000 0.000 1.000
#> GSM151392     3  0.6638      0.280 0.000 0.364 0.412 0.000 0.224
#> GSM151393     3  0.4305      0.147 0.000 0.000 0.512 0.000 0.488
#> GSM151394     1  0.0000      0.938 1.000 0.000 0.000 0.000 0.000
#> GSM151395     2  0.0000      0.883 0.000 1.000 0.000 0.000 0.000
#> GSM151396     2  0.0000      0.883 0.000 1.000 0.000 0.000 0.000
#> GSM151397     1  0.0000      0.938 1.000 0.000 0.000 0.000 0.000
#> GSM151398     1  0.0000      0.938 1.000 0.000 0.000 0.000 0.000
#> GSM151399     2  0.0000      0.883 0.000 1.000 0.000 0.000 0.000
#> GSM151400     2  0.4287      0.218 0.000 0.540 0.000 0.460 0.000
#> GSM151401     2  0.0000      0.883 0.000 1.000 0.000 0.000 0.000
#> GSM151402     3  0.3480      0.529 0.000 0.000 0.752 0.000 0.248
#> GSM151403     5  0.0000      0.980 0.000 0.000 0.000 0.000 1.000
#> GSM151404     5  0.0404      0.966 0.012 0.000 0.000 0.000 0.988
#> GSM151405     5  0.1544      0.882 0.000 0.068 0.000 0.000 0.932
#> GSM151406     5  0.0000      0.980 0.000 0.000 0.000 0.000 1.000
#> GSM151407     4  0.0000      0.969 0.000 0.000 0.000 1.000 0.000
#> GSM151408     4  0.0000      0.969 0.000 0.000 0.000 1.000 0.000
#> GSM151409     1  0.0000      0.938 1.000 0.000 0.000 0.000 0.000
#> GSM151410     4  0.0000      0.969 0.000 0.000 0.000 1.000 0.000
#> GSM151411     1  0.0000      0.938 1.000 0.000 0.000 0.000 0.000
#> GSM151412     2  0.0000      0.883 0.000 1.000 0.000 0.000 0.000
#> GSM151413     1  0.0000      0.938 1.000 0.000 0.000 0.000 0.000
#> GSM151414     1  0.0000      0.938 1.000 0.000 0.000 0.000 0.000
#> GSM151415     1  0.0000      0.938 1.000 0.000 0.000 0.000 0.000
#> GSM151416     4  0.2377      0.806 0.000 0.128 0.000 0.872 0.000
#> GSM151417     2  0.4283      0.112 0.456 0.544 0.000 0.000 0.000
#> GSM151418     5  0.0162      0.978 0.000 0.004 0.000 0.000 0.996
#> GSM151419     1  0.0000      0.938 1.000 0.000 0.000 0.000 0.000
#> GSM151420     1  0.0000      0.938 1.000 0.000 0.000 0.000 0.000
#> GSM151421     2  0.0000      0.883 0.000 1.000 0.000 0.000 0.000
#> GSM151422     1  0.0000      0.938 1.000 0.000 0.000 0.000 0.000
#> GSM151423     5  0.0162      0.978 0.000 0.000 0.004 0.000 0.996
#> GSM151424     2  0.0000      0.883 0.000 1.000 0.000 0.000 0.000
#> GSM151425     2  0.0162      0.880 0.000 0.996 0.000 0.000 0.004
#> GSM151426     5  0.1928      0.890 0.000 0.004 0.004 0.072 0.920
#> GSM151427     3  0.4210      0.309 0.000 0.000 0.588 0.000 0.412
#> GSM151428     1  0.4219      0.259 0.584 0.416 0.000 0.000 0.000
#> GSM151429     2  0.2852      0.737 0.000 0.828 0.000 0.172 0.000
#> GSM151430     4  0.0000      0.969 0.000 0.000 0.000 1.000 0.000
#> GSM151431     4  0.0000      0.969 0.000 0.000 0.000 1.000 0.000
#> GSM151432     1  0.0000      0.938 1.000 0.000 0.000 0.000 0.000
#> GSM151433     1  0.0000      0.938 1.000 0.000 0.000 0.000 0.000
#> GSM151434     1  0.0404      0.927 0.988 0.012 0.000 0.000 0.000
#> GSM151435     1  0.0000      0.938 1.000 0.000 0.000 0.000 0.000
#> GSM151436     2  0.0000      0.883 0.000 1.000 0.000 0.000 0.000
#> GSM151437     1  0.0000      0.938 1.000 0.000 0.000 0.000 0.000
#> GSM151438     1  0.0000      0.938 1.000 0.000 0.000 0.000 0.000
#> GSM151439     2  0.0000      0.883 0.000 1.000 0.000 0.000 0.000
#> GSM151440     2  0.0000      0.883 0.000 1.000 0.000 0.000 0.000

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>           class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM151369     6  0.3747     0.0218 0.396 0.000 0.000 0.000 0.000 0.604
#> GSM151370     2  0.2164     0.8149 0.000 0.900 0.000 0.000 0.032 0.068
#> GSM151371     1  0.6380     0.6127 0.540 0.132 0.252 0.000 0.000 0.076
#> GSM151372     2  0.0000     0.8698 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM151373     3  0.3288     0.4625 0.000 0.276 0.724 0.000 0.000 0.000
#> GSM151374     3  0.3265     0.6508 0.000 0.000 0.748 0.000 0.004 0.248
#> GSM151375     6  0.3097     0.6488 0.000 0.012 0.072 0.000 0.064 0.852
#> GSM151376     6  0.2706     0.6303 0.000 0.000 0.024 0.000 0.124 0.852
#> GSM151377     5  0.1088     0.9271 0.000 0.000 0.024 0.000 0.960 0.016
#> GSM151378     3  0.3151     0.6474 0.000 0.000 0.748 0.000 0.000 0.252
#> GSM151379     3  0.3151     0.6474 0.000 0.000 0.748 0.000 0.000 0.252
#> GSM151380     5  0.0146     0.9336 0.000 0.000 0.000 0.000 0.996 0.004
#> GSM151381     5  0.0146     0.9343 0.000 0.000 0.000 0.000 0.996 0.004
#> GSM151382     2  0.3717     0.4292 0.000 0.616 0.000 0.384 0.000 0.000
#> GSM151383     4  0.0000     0.9619 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM151384     1  0.4305     0.7789 0.708 0.000 0.216 0.000 0.000 0.076
#> GSM151385     1  0.0000     0.8279 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM151386     1  0.3877     0.7976 0.764 0.000 0.160 0.000 0.000 0.076
#> GSM151387     5  0.2308     0.8912 0.000 0.000 0.040 0.000 0.892 0.068
#> GSM151388     5  0.1444     0.9109 0.000 0.000 0.000 0.000 0.928 0.072
#> GSM151389     5  0.0632     0.9322 0.000 0.000 0.000 0.000 0.976 0.024
#> GSM151390     6  0.2860     0.6406 0.000 0.100 0.048 0.000 0.000 0.852
#> GSM151391     5  0.0551     0.9345 0.000 0.000 0.008 0.004 0.984 0.004
#> GSM151392     6  0.1643     0.6543 0.000 0.068 0.000 0.000 0.008 0.924
#> GSM151393     3  0.3727     0.4322 0.000 0.000 0.612 0.000 0.388 0.000
#> GSM151394     1  0.0000     0.8279 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM151395     2  0.0622     0.8613 0.000 0.980 0.000 0.000 0.012 0.008
#> GSM151396     2  0.0000     0.8698 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM151397     1  0.0000     0.8279 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM151398     1  0.4428     0.7679 0.684 0.000 0.244 0.000 0.000 0.072
#> GSM151399     2  0.0146     0.8683 0.000 0.996 0.000 0.000 0.004 0.000
#> GSM151400     2  0.5163     0.3000 0.000 0.536 0.000 0.396 0.020 0.048
#> GSM151401     2  0.0000     0.8698 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM151402     3  0.4209     0.6722 0.000 0.000 0.736 0.000 0.160 0.104
#> GSM151403     5  0.0790     0.9292 0.000 0.000 0.000 0.000 0.968 0.032
#> GSM151404     5  0.1151     0.9103 0.032 0.000 0.000 0.000 0.956 0.012
#> GSM151405     5  0.2744     0.8520 0.000 0.064 0.000 0.000 0.864 0.072
#> GSM151406     5  0.1444     0.9109 0.000 0.000 0.000 0.000 0.928 0.072
#> GSM151407     4  0.0000     0.9619 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM151408     4  0.0000     0.9619 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM151409     1  0.3054     0.8128 0.828 0.000 0.136 0.000 0.000 0.036
#> GSM151410     4  0.0000     0.9619 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM151411     1  0.4522     0.7621 0.672 0.000 0.252 0.000 0.000 0.076
#> GSM151412     2  0.0000     0.8698 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM151413     1  0.0405     0.8278 0.988 0.000 0.004 0.000 0.000 0.008
#> GSM151414     1  0.0000     0.8279 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM151415     1  0.0000     0.8279 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM151416     4  0.4169     0.7503 0.000 0.072 0.116 0.784 0.008 0.020
#> GSM151417     2  0.5315    -0.0361 0.432 0.496 0.016 0.000 0.004 0.052
#> GSM151418     5  0.1088     0.9271 0.000 0.000 0.024 0.000 0.960 0.016
#> GSM151419     1  0.0000     0.8279 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM151420     1  0.0000     0.8279 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM151421     2  0.0000     0.8698 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM151422     1  0.3261     0.8123 0.824 0.000 0.104 0.000 0.000 0.072
#> GSM151423     5  0.0935     0.9267 0.000 0.004 0.032 0.000 0.964 0.000
#> GSM151424     2  0.0000     0.8698 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM151425     2  0.2365     0.8073 0.000 0.888 0.000 0.000 0.040 0.072
#> GSM151426     5  0.3865     0.8259 0.000 0.004 0.056 0.052 0.816 0.072
#> GSM151427     3  0.3151     0.6301 0.000 0.000 0.748 0.000 0.252 0.000
#> GSM151428     1  0.6555     0.5759 0.516 0.156 0.252 0.000 0.000 0.076
#> GSM151429     2  0.4055     0.6963 0.000 0.760 0.068 0.164 0.000 0.008
#> GSM151430     4  0.0000     0.9619 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM151431     4  0.0000     0.9619 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM151432     1  0.4522     0.7621 0.672 0.000 0.252 0.000 0.000 0.076
#> GSM151433     1  0.4522     0.7621 0.672 0.000 0.252 0.000 0.000 0.076
#> GSM151434     1  0.4522     0.7621 0.672 0.000 0.252 0.000 0.000 0.076
#> GSM151435     1  0.0000     0.8279 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM151436     2  0.0000     0.8698 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM151437     1  0.0000     0.8279 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM151438     1  0.0000     0.8279 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM151439     2  0.0000     0.8698 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM151440     2  0.0000     0.8698 0.000 1.000 0.000 0.000 0.000 0.000

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

consensus_heatmap(res, k = 2)

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

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

collect_plots(res)

plot of chunk MAD-mclust-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.433           0.859       0.899         0.4688 0.525   0.525
#> 3 3 0.720           0.857       0.926         0.4029 0.804   0.627
#> 4 4 0.912           0.885       0.946         0.0790 0.913   0.754
#> 5 5 0.830           0.807       0.866         0.0670 0.975   0.914
#> 6 6 0.800           0.791       0.875         0.0591 0.930   0.736

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
#> GSM151369     2  0.0000      0.989 0.000 1.000
#> GSM151370     2  0.0000      0.989 0.000 1.000
#> GSM151371     1  0.5519      0.869 0.872 0.128
#> GSM151372     1  0.5294      0.871 0.880 0.120
#> GSM151373     1  0.5294      0.871 0.880 0.120
#> GSM151374     2  0.0000      0.989 0.000 1.000
#> GSM151375     2  0.0000      0.989 0.000 1.000
#> GSM151376     2  0.0000      0.989 0.000 1.000
#> GSM151377     2  0.0000      0.989 0.000 1.000
#> GSM151378     2  0.0000      0.989 0.000 1.000
#> GSM151379     2  0.0000      0.989 0.000 1.000
#> GSM151380     2  0.1414      0.983 0.020 0.980
#> GSM151381     2  0.0000      0.989 0.000 1.000
#> GSM151382     1  0.7528      0.815 0.784 0.216
#> GSM151383     1  0.9710      0.591 0.600 0.400
#> GSM151384     1  0.5519      0.869 0.872 0.128
#> GSM151385     1  0.0672      0.838 0.992 0.008
#> GSM151386     1  0.5519      0.869 0.872 0.128
#> GSM151387     2  0.0000      0.989 0.000 1.000
#> GSM151388     2  0.1414      0.983 0.020 0.980
#> GSM151389     2  0.1414      0.983 0.020 0.980
#> GSM151390     2  0.1184      0.985 0.016 0.984
#> GSM151391     2  0.1414      0.983 0.020 0.980
#> GSM151392     2  0.1414      0.983 0.020 0.980
#> GSM151393     2  0.1414      0.983 0.020 0.980
#> GSM151394     1  0.9866      0.228 0.568 0.432
#> GSM151395     1  0.5294      0.871 0.880 0.120
#> GSM151396     1  0.5294      0.871 0.880 0.120
#> GSM151397     1  0.0672      0.838 0.992 0.008
#> GSM151398     2  0.1414      0.983 0.020 0.980
#> GSM151399     1  0.5294      0.871 0.880 0.120
#> GSM151400     1  0.8499      0.761 0.724 0.276
#> GSM151401     1  0.7299      0.817 0.796 0.204
#> GSM151402     2  0.0000      0.989 0.000 1.000
#> GSM151403     2  0.0000      0.989 0.000 1.000
#> GSM151404     2  0.1414      0.983 0.020 0.980
#> GSM151405     2  0.1414      0.983 0.020 0.980
#> GSM151406     2  0.1414      0.983 0.020 0.980
#> GSM151407     1  0.9933      0.494 0.548 0.452
#> GSM151408     1  0.9933      0.494 0.548 0.452
#> GSM151409     1  0.0672      0.838 0.992 0.008
#> GSM151410     1  0.9866      0.535 0.568 0.432
#> GSM151411     1  0.8267      0.675 0.740 0.260
#> GSM151412     1  0.5294      0.871 0.880 0.120
#> GSM151413     1  0.4161      0.861 0.916 0.084
#> GSM151414     1  0.0672      0.838 0.992 0.008
#> GSM151415     1  0.0672      0.838 0.992 0.008
#> GSM151416     1  0.9896      0.519 0.560 0.440
#> GSM151417     1  0.5519      0.869 0.872 0.128
#> GSM151418     2  0.0000      0.989 0.000 1.000
#> GSM151419     1  0.0672      0.838 0.992 0.008
#> GSM151420     1  0.0672      0.838 0.992 0.008
#> GSM151421     1  0.5294      0.871 0.880 0.120
#> GSM151422     1  0.0672      0.838 0.992 0.008
#> GSM151423     2  0.0000      0.989 0.000 1.000
#> GSM151424     1  0.5294      0.871 0.880 0.120
#> GSM151425     1  0.5294      0.871 0.880 0.120
#> GSM151426     2  0.0000      0.989 0.000 1.000
#> GSM151427     2  0.0000      0.989 0.000 1.000
#> GSM151428     1  0.5519      0.869 0.872 0.128
#> GSM151429     1  0.5519      0.869 0.872 0.128
#> GSM151430     1  0.9933      0.494 0.548 0.452
#> GSM151431     1  0.9933      0.494 0.548 0.452
#> GSM151432     1  0.2423      0.849 0.960 0.040
#> GSM151433     1  0.0672      0.838 0.992 0.008
#> GSM151434     1  0.5408      0.870 0.876 0.124
#> GSM151435     1  0.0672      0.838 0.992 0.008
#> GSM151436     1  0.5294      0.871 0.880 0.120
#> GSM151437     1  0.0672      0.838 0.992 0.008
#> GSM151438     1  0.0672      0.838 0.992 0.008
#> GSM151439     1  0.5294      0.871 0.880 0.120
#> GSM151440     1  0.5294      0.871 0.880 0.120

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>           class entropy silhouette    p1    p2    p3
#> GSM151369     3  0.0237     0.9940 0.000 0.004 0.996
#> GSM151370     3  0.0000     0.9977 0.000 0.000 1.000
#> GSM151371     1  0.4473     0.7552 0.828 0.164 0.008
#> GSM151372     2  0.0661     0.8477 0.008 0.988 0.004
#> GSM151373     2  0.1015     0.8489 0.008 0.980 0.012
#> GSM151374     3  0.0000     0.9977 0.000 0.000 1.000
#> GSM151375     3  0.0000     0.9977 0.000 0.000 1.000
#> GSM151376     3  0.0000     0.9977 0.000 0.000 1.000
#> GSM151377     3  0.0000     0.9977 0.000 0.000 1.000
#> GSM151378     3  0.0000     0.9977 0.000 0.000 1.000
#> GSM151379     3  0.0000     0.9977 0.000 0.000 1.000
#> GSM151380     3  0.0237     0.9943 0.004 0.000 0.996
#> GSM151381     3  0.0000     0.9977 0.000 0.000 1.000
#> GSM151382     2  0.4802     0.8233 0.020 0.824 0.156
#> GSM151383     2  0.4741     0.8241 0.020 0.828 0.152
#> GSM151384     1  0.6527     0.4137 0.588 0.404 0.008
#> GSM151385     1  0.0000     0.8824 1.000 0.000 0.000
#> GSM151386     1  0.5692     0.6734 0.724 0.268 0.008
#> GSM151387     3  0.0000     0.9977 0.000 0.000 1.000
#> GSM151388     3  0.0000     0.9977 0.000 0.000 1.000
#> GSM151389     3  0.0000     0.9977 0.000 0.000 1.000
#> GSM151390     3  0.0000     0.9977 0.000 0.000 1.000
#> GSM151391     3  0.0000     0.9977 0.000 0.000 1.000
#> GSM151392     3  0.0000     0.9977 0.000 0.000 1.000
#> GSM151393     3  0.0000     0.9977 0.000 0.000 1.000
#> GSM151394     1  0.5860     0.6695 0.748 0.024 0.228
#> GSM151395     2  0.1482     0.8490 0.020 0.968 0.012
#> GSM151396     2  0.0661     0.8477 0.008 0.988 0.004
#> GSM151397     1  0.0000     0.8824 1.000 0.000 0.000
#> GSM151398     3  0.1129     0.9726 0.020 0.004 0.976
#> GSM151399     2  0.2116     0.8456 0.040 0.948 0.012
#> GSM151400     2  0.5442     0.8228 0.056 0.812 0.132
#> GSM151401     2  0.0661     0.8477 0.008 0.988 0.004
#> GSM151402     3  0.0000     0.9977 0.000 0.000 1.000
#> GSM151403     3  0.0000     0.9977 0.000 0.000 1.000
#> GSM151404     3  0.0475     0.9905 0.004 0.004 0.992
#> GSM151405     3  0.0237     0.9942 0.000 0.004 0.996
#> GSM151406     3  0.0000     0.9977 0.000 0.000 1.000
#> GSM151407     2  0.4934     0.8215 0.024 0.820 0.156
#> GSM151408     2  0.4934     0.8215 0.024 0.820 0.156
#> GSM151409     1  0.0000     0.8824 1.000 0.000 0.000
#> GSM151410     2  0.4934     0.8215 0.024 0.820 0.156
#> GSM151411     1  0.5012     0.7093 0.788 0.204 0.008
#> GSM151412     2  0.0661     0.8477 0.008 0.988 0.004
#> GSM151413     1  0.2860     0.8166 0.912 0.004 0.084
#> GSM151414     1  0.0000     0.8824 1.000 0.000 0.000
#> GSM151415     1  0.3267     0.8151 0.884 0.116 0.000
#> GSM151416     2  0.5295     0.8198 0.036 0.808 0.156
#> GSM151417     1  0.6654     0.0526 0.536 0.456 0.008
#> GSM151418     3  0.0000     0.9977 0.000 0.000 1.000
#> GSM151419     1  0.0000     0.8824 1.000 0.000 0.000
#> GSM151420     1  0.0000     0.8824 1.000 0.000 0.000
#> GSM151421     2  0.5156     0.6244 0.216 0.776 0.008
#> GSM151422     1  0.0237     0.8815 0.996 0.004 0.000
#> GSM151423     3  0.0000     0.9977 0.000 0.000 1.000
#> GSM151424     2  0.0661     0.8477 0.008 0.988 0.004
#> GSM151425     2  0.0848     0.8485 0.008 0.984 0.008
#> GSM151426     3  0.0424     0.9901 0.000 0.008 0.992
#> GSM151427     3  0.0000     0.9977 0.000 0.000 1.000
#> GSM151428     2  0.6865     0.4140 0.384 0.596 0.020
#> GSM151429     2  0.5267     0.7960 0.140 0.816 0.044
#> GSM151430     2  0.4934     0.8215 0.024 0.820 0.156
#> GSM151431     2  0.4934     0.8215 0.024 0.820 0.156
#> GSM151432     1  0.0237     0.8815 0.996 0.004 0.000
#> GSM151433     1  0.0237     0.8815 0.996 0.004 0.000
#> GSM151434     2  0.6553     0.1244 0.412 0.580 0.008
#> GSM151435     1  0.0000     0.8824 1.000 0.000 0.000
#> GSM151436     2  0.0237     0.8454 0.000 0.996 0.004
#> GSM151437     1  0.0000     0.8824 1.000 0.000 0.000
#> GSM151438     1  0.0000     0.8824 1.000 0.000 0.000
#> GSM151439     2  0.5072     0.6623 0.196 0.792 0.012
#> GSM151440     2  0.0661     0.8477 0.008 0.988 0.004

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM151369     3  0.0000      0.982 0.000 0.000 1.000 0.000
#> GSM151370     3  0.1022      0.981 0.000 0.000 0.968 0.032
#> GSM151371     1  0.0779      0.879 0.980 0.016 0.004 0.000
#> GSM151372     2  0.0000      0.932 0.000 1.000 0.000 0.000
#> GSM151373     2  0.0188      0.932 0.000 0.996 0.004 0.000
#> GSM151374     3  0.0188      0.982 0.000 0.000 0.996 0.004
#> GSM151375     3  0.1118      0.981 0.000 0.000 0.964 0.036
#> GSM151376     3  0.1118      0.981 0.000 0.000 0.964 0.036
#> GSM151377     3  0.1118      0.981 0.000 0.000 0.964 0.036
#> GSM151378     3  0.0188      0.982 0.000 0.000 0.996 0.004
#> GSM151379     3  0.0188      0.982 0.000 0.000 0.996 0.004
#> GSM151380     3  0.0000      0.982 0.000 0.000 1.000 0.000
#> GSM151381     3  0.1118      0.981 0.000 0.000 0.964 0.036
#> GSM151382     2  0.2480      0.851 0.000 0.904 0.008 0.088
#> GSM151383     4  0.5773      0.372 0.028 0.376 0.004 0.592
#> GSM151384     1  0.5097      0.245 0.568 0.428 0.004 0.000
#> GSM151385     1  0.0000      0.887 1.000 0.000 0.000 0.000
#> GSM151386     1  0.2053      0.847 0.924 0.072 0.004 0.000
#> GSM151387     3  0.1022      0.981 0.000 0.000 0.968 0.032
#> GSM151388     3  0.1022      0.981 0.000 0.000 0.968 0.032
#> GSM151389     3  0.0000      0.982 0.000 0.000 1.000 0.000
#> GSM151390     3  0.1118      0.981 0.000 0.000 0.964 0.036
#> GSM151391     3  0.0000      0.982 0.000 0.000 1.000 0.000
#> GSM151392     3  0.1022      0.981 0.000 0.000 0.968 0.032
#> GSM151393     3  0.0188      0.982 0.000 0.000 0.996 0.004
#> GSM151394     1  0.4790      0.374 0.620 0.000 0.380 0.000
#> GSM151395     2  0.0779      0.924 0.016 0.980 0.004 0.000
#> GSM151396     2  0.0000      0.932 0.000 1.000 0.000 0.000
#> GSM151397     1  0.0000      0.887 1.000 0.000 0.000 0.000
#> GSM151398     3  0.0707      0.968 0.020 0.000 0.980 0.000
#> GSM151399     2  0.0188      0.932 0.000 0.996 0.004 0.000
#> GSM151400     1  0.6458      0.618 0.680 0.196 0.020 0.104
#> GSM151401     2  0.0000      0.932 0.000 1.000 0.000 0.000
#> GSM151402     3  0.0188      0.982 0.000 0.000 0.996 0.004
#> GSM151403     3  0.0188      0.982 0.000 0.000 0.996 0.004
#> GSM151404     3  0.0000      0.982 0.000 0.000 1.000 0.000
#> GSM151405     3  0.1022      0.981 0.000 0.000 0.968 0.032
#> GSM151406     3  0.1151      0.979 0.000 0.008 0.968 0.024
#> GSM151407     4  0.0188      0.894 0.004 0.000 0.000 0.996
#> GSM151408     4  0.0188      0.894 0.004 0.000 0.000 0.996
#> GSM151409     1  0.0000      0.887 1.000 0.000 0.000 0.000
#> GSM151410     4  0.3333      0.827 0.032 0.088 0.004 0.876
#> GSM151411     1  0.1489      0.855 0.952 0.004 0.044 0.000
#> GSM151412     2  0.0000      0.932 0.000 1.000 0.000 0.000
#> GSM151413     1  0.0188      0.885 0.996 0.000 0.004 0.000
#> GSM151414     1  0.0000      0.887 1.000 0.000 0.000 0.000
#> GSM151415     1  0.1022      0.870 0.968 0.032 0.000 0.000
#> GSM151416     1  0.6688      0.543 0.636 0.184 0.004 0.176
#> GSM151417     1  0.4053      0.702 0.768 0.228 0.004 0.000
#> GSM151418     3  0.1118      0.981 0.000 0.000 0.964 0.036
#> GSM151419     1  0.0000      0.887 1.000 0.000 0.000 0.000
#> GSM151420     1  0.0000      0.887 1.000 0.000 0.000 0.000
#> GSM151421     2  0.2466      0.860 0.096 0.900 0.004 0.000
#> GSM151422     1  0.0000      0.887 1.000 0.000 0.000 0.000
#> GSM151423     3  0.0188      0.982 0.000 0.000 0.996 0.004
#> GSM151424     2  0.0188      0.932 0.000 0.996 0.004 0.000
#> GSM151425     2  0.0188      0.932 0.000 0.996 0.004 0.000
#> GSM151426     3  0.1022      0.981 0.000 0.000 0.968 0.032
#> GSM151427     3  0.0000      0.982 0.000 0.000 1.000 0.000
#> GSM151428     1  0.3751      0.732 0.800 0.196 0.004 0.000
#> GSM151429     2  0.3680      0.783 0.160 0.828 0.004 0.008
#> GSM151430     4  0.0188      0.894 0.004 0.000 0.000 0.996
#> GSM151431     4  0.0188      0.894 0.004 0.000 0.000 0.996
#> GSM151432     1  0.0000      0.887 1.000 0.000 0.000 0.000
#> GSM151433     1  0.0000      0.887 1.000 0.000 0.000 0.000
#> GSM151434     2  0.4188      0.663 0.244 0.752 0.004 0.000
#> GSM151435     1  0.0000      0.887 1.000 0.000 0.000 0.000
#> GSM151436     2  0.0000      0.932 0.000 1.000 0.000 0.000
#> GSM151437     1  0.0000      0.887 1.000 0.000 0.000 0.000
#> GSM151438     1  0.0000      0.887 1.000 0.000 0.000 0.000
#> GSM151439     2  0.2466      0.860 0.096 0.900 0.004 0.000
#> GSM151440     2  0.0000      0.932 0.000 1.000 0.000 0.000

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>           class entropy silhouette    p1    p2    p3    p4    p5
#> GSM151369     3  0.4138     0.7584 0.000 0.000 0.616 0.000 0.384
#> GSM151370     3  0.0671     0.8114 0.000 0.000 0.980 0.004 0.016
#> GSM151371     1  0.1121     0.8799 0.956 0.000 0.000 0.000 0.044
#> GSM151372     2  0.0000     0.8985 0.000 1.000 0.000 0.000 0.000
#> GSM151373     2  0.0162     0.8944 0.000 0.996 0.000 0.004 0.000
#> GSM151374     3  0.3949     0.7790 0.000 0.000 0.668 0.000 0.332
#> GSM151375     3  0.1121     0.8192 0.000 0.000 0.956 0.000 0.044
#> GSM151376     3  0.1341     0.8206 0.000 0.000 0.944 0.000 0.056
#> GSM151377     3  0.4235     0.7469 0.000 0.000 0.576 0.000 0.424
#> GSM151378     3  0.1043     0.8187 0.000 0.000 0.960 0.000 0.040
#> GSM151379     3  0.0290     0.8197 0.000 0.000 0.992 0.000 0.008
#> GSM151380     3  0.4088     0.7626 0.000 0.000 0.632 0.000 0.368
#> GSM151381     3  0.3242     0.8027 0.000 0.000 0.784 0.000 0.216
#> GSM151382     2  0.2920     0.6345 0.000 0.852 0.016 0.132 0.000
#> GSM151383     4  0.3551     0.6140 0.000 0.220 0.000 0.772 0.008
#> GSM151384     5  0.6210     0.6879 0.148 0.360 0.000 0.000 0.492
#> GSM151385     1  0.0000     0.8944 1.000 0.000 0.000 0.000 0.000
#> GSM151386     1  0.2367     0.8517 0.904 0.020 0.004 0.000 0.072
#> GSM151387     3  0.0510     0.8134 0.000 0.000 0.984 0.000 0.016
#> GSM151388     3  0.0404     0.8147 0.000 0.000 0.988 0.000 0.012
#> GSM151389     3  0.4126     0.7586 0.000 0.000 0.620 0.000 0.380
#> GSM151390     3  0.0794     0.8187 0.000 0.000 0.972 0.000 0.028
#> GSM151391     3  0.1270     0.8250 0.000 0.000 0.948 0.000 0.052
#> GSM151392     3  0.0000     0.8178 0.000 0.000 1.000 0.000 0.000
#> GSM151393     3  0.4161     0.7557 0.000 0.000 0.608 0.000 0.392
#> GSM151394     1  0.4359     0.3459 0.584 0.000 0.412 0.000 0.004
#> GSM151395     2  0.1043     0.8336 0.000 0.960 0.000 0.000 0.040
#> GSM151396     2  0.0000     0.8985 0.000 1.000 0.000 0.000 0.000
#> GSM151397     1  0.0000     0.8944 1.000 0.000 0.000 0.000 0.000
#> GSM151398     3  0.0880     0.8246 0.000 0.000 0.968 0.000 0.032
#> GSM151399     2  0.0000     0.8985 0.000 1.000 0.000 0.000 0.000
#> GSM151400     1  0.6917     0.4653 0.580 0.100 0.024 0.256 0.040
#> GSM151401     2  0.0000     0.8985 0.000 1.000 0.000 0.000 0.000
#> GSM151402     3  0.4235     0.7469 0.000 0.000 0.576 0.000 0.424
#> GSM151403     3  0.4235     0.7469 0.000 0.000 0.576 0.000 0.424
#> GSM151404     3  0.4138     0.7567 0.000 0.000 0.616 0.000 0.384
#> GSM151405     3  0.0566     0.8131 0.000 0.000 0.984 0.004 0.012
#> GSM151406     3  0.1357     0.8243 0.000 0.000 0.948 0.004 0.048
#> GSM151407     4  0.0000     0.9360 0.000 0.000 0.000 1.000 0.000
#> GSM151408     4  0.0000     0.9360 0.000 0.000 0.000 1.000 0.000
#> GSM151409     1  0.0000     0.8944 1.000 0.000 0.000 0.000 0.000
#> GSM151410     4  0.0404     0.9280 0.000 0.012 0.000 0.988 0.000
#> GSM151411     1  0.2505     0.8254 0.888 0.000 0.092 0.000 0.020
#> GSM151412     2  0.0000     0.8985 0.000 1.000 0.000 0.000 0.000
#> GSM151413     1  0.1251     0.8750 0.956 0.000 0.008 0.036 0.000
#> GSM151414     1  0.0000     0.8944 1.000 0.000 0.000 0.000 0.000
#> GSM151415     1  0.0290     0.8929 0.992 0.000 0.000 0.000 0.008
#> GSM151416     1  0.5754     0.5214 0.632 0.032 0.008 0.288 0.040
#> GSM151417     1  0.3928     0.7225 0.800 0.152 0.008 0.000 0.040
#> GSM151418     3  0.4235     0.7469 0.000 0.000 0.576 0.000 0.424
#> GSM151419     1  0.0000     0.8944 1.000 0.000 0.000 0.000 0.000
#> GSM151420     1  0.0000     0.8944 1.000 0.000 0.000 0.000 0.000
#> GSM151421     5  0.4415     0.8699 0.004 0.444 0.000 0.000 0.552
#> GSM151422     1  0.0963     0.8838 0.964 0.000 0.000 0.000 0.036
#> GSM151423     3  0.4227     0.7491 0.000 0.000 0.580 0.000 0.420
#> GSM151424     2  0.0000     0.8985 0.000 1.000 0.000 0.000 0.000
#> GSM151425     2  0.0162     0.8942 0.000 0.996 0.000 0.000 0.004
#> GSM151426     3  0.0912     0.8068 0.000 0.000 0.972 0.012 0.016
#> GSM151427     3  0.0290     0.8197 0.000 0.000 0.992 0.000 0.008
#> GSM151428     1  0.4793     0.6264 0.740 0.196 0.012 0.008 0.044
#> GSM151429     2  0.6497    -0.0601 0.252 0.608 0.012 0.088 0.040
#> GSM151430     4  0.0000     0.9360 0.000 0.000 0.000 1.000 0.000
#> GSM151431     4  0.0000     0.9360 0.000 0.000 0.000 1.000 0.000
#> GSM151432     1  0.0703     0.8884 0.976 0.000 0.000 0.000 0.024
#> GSM151433     1  0.0162     0.8937 0.996 0.000 0.000 0.000 0.004
#> GSM151434     5  0.4610     0.8701 0.012 0.432 0.000 0.000 0.556
#> GSM151435     1  0.0000     0.8944 1.000 0.000 0.000 0.000 0.000
#> GSM151436     2  0.0000     0.8985 0.000 1.000 0.000 0.000 0.000
#> GSM151437     1  0.0000     0.8944 1.000 0.000 0.000 0.000 0.000
#> GSM151438     1  0.0000     0.8944 1.000 0.000 0.000 0.000 0.000
#> GSM151439     5  0.4415     0.8699 0.004 0.444 0.000 0.000 0.552
#> GSM151440     2  0.0000     0.8985 0.000 1.000 0.000 0.000 0.000

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>           class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM151369     3  0.3528     0.5662 0.000 0.000 0.700 0.000 0.296 0.004
#> GSM151370     5  0.0790     0.7311 0.000 0.000 0.032 0.000 0.968 0.000
#> GSM151371     1  0.2234     0.8565 0.872 0.000 0.000 0.000 0.004 0.124
#> GSM151372     2  0.0000     0.9264 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM151373     2  0.0000     0.9264 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM151374     3  0.1908     0.7651 0.000 0.000 0.900 0.000 0.096 0.004
#> GSM151375     5  0.3881     0.6610 0.000 0.000 0.396 0.000 0.600 0.004
#> GSM151376     5  0.3899     0.6515 0.000 0.000 0.404 0.000 0.592 0.004
#> GSM151377     3  0.0717     0.8221 0.000 0.000 0.976 0.000 0.008 0.016
#> GSM151378     5  0.3915     0.6396 0.000 0.000 0.412 0.000 0.584 0.004
#> GSM151379     5  0.3695     0.6773 0.000 0.000 0.376 0.000 0.624 0.000
#> GSM151380     3  0.3342     0.6771 0.000 0.000 0.760 0.000 0.228 0.012
#> GSM151381     3  0.3872    -0.0202 0.000 0.000 0.604 0.000 0.392 0.004
#> GSM151382     2  0.1832     0.8692 0.000 0.928 0.008 0.032 0.032 0.000
#> GSM151383     4  0.3488     0.7243 0.000 0.160 0.000 0.800 0.028 0.012
#> GSM151384     6  0.3183     0.8028 0.112 0.060 0.000 0.000 0.000 0.828
#> GSM151385     1  0.0547     0.8767 0.980 0.000 0.000 0.000 0.000 0.020
#> GSM151386     1  0.3078     0.8009 0.796 0.012 0.000 0.000 0.000 0.192
#> GSM151387     5  0.0790     0.7311 0.000 0.000 0.032 0.000 0.968 0.000
#> GSM151388     5  0.1007     0.7368 0.000 0.000 0.044 0.000 0.956 0.000
#> GSM151389     3  0.1863     0.8021 0.000 0.000 0.896 0.000 0.104 0.000
#> GSM151390     5  0.3652     0.7184 0.000 0.000 0.324 0.000 0.672 0.004
#> GSM151391     5  0.3126     0.7266 0.000 0.000 0.248 0.000 0.752 0.000
#> GSM151392     5  0.2491     0.7589 0.000 0.000 0.164 0.000 0.836 0.000
#> GSM151393     3  0.1141     0.8217 0.000 0.000 0.948 0.000 0.052 0.000
#> GSM151394     1  0.5636     0.2497 0.528 0.000 0.040 0.000 0.368 0.064
#> GSM151395     2  0.1814     0.8207 0.000 0.900 0.000 0.000 0.000 0.100
#> GSM151396     2  0.0000     0.9264 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM151397     1  0.0260     0.8793 0.992 0.000 0.000 0.000 0.000 0.008
#> GSM151398     5  0.3337     0.7146 0.000 0.000 0.260 0.000 0.736 0.004
#> GSM151399     2  0.0146     0.9239 0.000 0.996 0.000 0.004 0.000 0.000
#> GSM151400     1  0.5704     0.6384 0.660 0.004 0.004 0.176 0.076 0.080
#> GSM151401     2  0.0000     0.9264 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM151402     3  0.0405     0.8229 0.000 0.000 0.988 0.000 0.008 0.004
#> GSM151403     3  0.0806     0.8256 0.000 0.000 0.972 0.000 0.020 0.008
#> GSM151404     3  0.3052     0.6892 0.000 0.000 0.780 0.000 0.216 0.004
#> GSM151405     5  0.0865     0.7335 0.000 0.000 0.036 0.000 0.964 0.000
#> GSM151406     5  0.3023     0.7519 0.000 0.000 0.212 0.000 0.784 0.004
#> GSM151407     4  0.0000     0.9419 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM151408     4  0.0000     0.9419 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM151409     1  0.0937     0.8799 0.960 0.000 0.000 0.000 0.000 0.040
#> GSM151410     4  0.0972     0.9222 0.000 0.008 0.000 0.964 0.028 0.000
#> GSM151411     1  0.3103     0.8370 0.836 0.000 0.000 0.000 0.064 0.100
#> GSM151412     2  0.0000     0.9264 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM151413     1  0.1003     0.8778 0.964 0.000 0.000 0.000 0.016 0.020
#> GSM151414     1  0.0547     0.8767 0.980 0.000 0.000 0.000 0.000 0.020
#> GSM151415     1  0.1908     0.8704 0.900 0.004 0.000 0.000 0.000 0.096
#> GSM151416     1  0.5291     0.6182 0.656 0.004 0.000 0.228 0.032 0.080
#> GSM151417     1  0.2748     0.8507 0.856 0.008 0.000 0.000 0.016 0.120
#> GSM151418     3  0.0717     0.8225 0.000 0.000 0.976 0.000 0.008 0.016
#> GSM151419     1  0.0632     0.8760 0.976 0.000 0.000 0.000 0.000 0.024
#> GSM151420     1  0.0363     0.8777 0.988 0.000 0.000 0.000 0.000 0.012
#> GSM151421     6  0.1910     0.9182 0.000 0.108 0.000 0.000 0.000 0.892
#> GSM151422     1  0.1806     0.8721 0.908 0.000 0.000 0.000 0.004 0.088
#> GSM151423     3  0.0777     0.8232 0.000 0.000 0.972 0.000 0.024 0.004
#> GSM151424     2  0.0000     0.9264 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM151425     2  0.0547     0.9122 0.000 0.980 0.000 0.000 0.000 0.020
#> GSM151426     5  0.0692     0.7167 0.000 0.000 0.020 0.004 0.976 0.000
#> GSM151427     5  0.3706     0.6727 0.000 0.000 0.380 0.000 0.620 0.000
#> GSM151428     1  0.4193     0.7869 0.776 0.064 0.000 0.000 0.036 0.124
#> GSM151429     2  0.7176     0.1439 0.252 0.508 0.004 0.072 0.036 0.128
#> GSM151430     4  0.0000     0.9419 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM151431     4  0.0000     0.9419 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM151432     1  0.1958     0.8663 0.896 0.000 0.000 0.000 0.004 0.100
#> GSM151433     1  0.1806     0.8708 0.908 0.000 0.000 0.000 0.004 0.088
#> GSM151434     6  0.1610     0.9135 0.000 0.084 0.000 0.000 0.000 0.916
#> GSM151435     1  0.0260     0.8793 0.992 0.000 0.000 0.000 0.000 0.008
#> GSM151436     2  0.0260     0.9216 0.000 0.992 0.000 0.000 0.000 0.008
#> GSM151437     1  0.0547     0.8791 0.980 0.000 0.000 0.000 0.000 0.020
#> GSM151438     1  0.0632     0.8760 0.976 0.000 0.000 0.000 0.000 0.024
#> GSM151439     6  0.1910     0.9182 0.000 0.108 0.000 0.000 0.000 0.892
#> GSM151440     2  0.0000     0.9264 0.000 1.000 0.000 0.000 0.000 0.000

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

consensus_heatmap(res, k = 2)

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

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

collect_plots(res)

plot of chunk MAD-NMF-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.942           0.931       0.974         0.5023 0.496   0.496
#> 3 3 0.698           0.782       0.904         0.3189 0.706   0.477
#> 4 4 0.608           0.632       0.803         0.1197 0.868   0.633
#> 5 5 0.626           0.579       0.769         0.0591 0.876   0.580
#> 6 6 0.688           0.603       0.776         0.0430 0.850   0.448

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
#> GSM151369     1   0.000    0.96768 1.000 0.000
#> GSM151370     2   0.000    0.97498 0.000 1.000
#> GSM151371     1   0.000    0.96768 1.000 0.000
#> GSM151372     2   0.000    0.97498 0.000 1.000
#> GSM151373     2   0.000    0.97498 0.000 1.000
#> GSM151374     2   0.000    0.97498 0.000 1.000
#> GSM151375     2   0.000    0.97498 0.000 1.000
#> GSM151376     2   0.000    0.97498 0.000 1.000
#> GSM151377     2   0.000    0.97498 0.000 1.000
#> GSM151378     2   0.000    0.97498 0.000 1.000
#> GSM151379     2   0.000    0.97498 0.000 1.000
#> GSM151380     1   0.615    0.80537 0.848 0.152
#> GSM151381     2   0.000    0.97498 0.000 1.000
#> GSM151382     2   0.000    0.97498 0.000 1.000
#> GSM151383     2   0.469    0.87573 0.100 0.900
#> GSM151384     1   0.000    0.96768 1.000 0.000
#> GSM151385     1   0.000    0.96768 1.000 0.000
#> GSM151386     1   0.000    0.96768 1.000 0.000
#> GSM151387     2   0.000    0.97498 0.000 1.000
#> GSM151388     2   0.881    0.56458 0.300 0.700
#> GSM151389     2   0.000    0.97498 0.000 1.000
#> GSM151390     2   0.000    0.97498 0.000 1.000
#> GSM151391     2   0.000    0.97498 0.000 1.000
#> GSM151392     1   1.000   -0.00724 0.504 0.496
#> GSM151393     2   0.000    0.97498 0.000 1.000
#> GSM151394     1   0.000    0.96768 1.000 0.000
#> GSM151395     1   0.224    0.93555 0.964 0.036
#> GSM151396     2   0.000    0.97498 0.000 1.000
#> GSM151397     1   0.000    0.96768 1.000 0.000
#> GSM151398     1   0.000    0.96768 1.000 0.000
#> GSM151399     2   0.000    0.97498 0.000 1.000
#> GSM151400     1   0.891    0.54648 0.692 0.308
#> GSM151401     2   0.000    0.97498 0.000 1.000
#> GSM151402     2   0.000    0.97498 0.000 1.000
#> GSM151403     2   0.000    0.97498 0.000 1.000
#> GSM151404     1   0.000    0.96768 1.000 0.000
#> GSM151405     2   0.311    0.92420 0.056 0.944
#> GSM151406     2   0.000    0.97498 0.000 1.000
#> GSM151407     2   0.000    0.97498 0.000 1.000
#> GSM151408     2   0.000    0.97498 0.000 1.000
#> GSM151409     1   0.000    0.96768 1.000 0.000
#> GSM151410     2   0.981    0.26041 0.420 0.580
#> GSM151411     1   0.000    0.96768 1.000 0.000
#> GSM151412     2   0.000    0.97498 0.000 1.000
#> GSM151413     1   0.000    0.96768 1.000 0.000
#> GSM151414     1   0.000    0.96768 1.000 0.000
#> GSM151415     1   0.000    0.96768 1.000 0.000
#> GSM151416     1   0.000    0.96768 1.000 0.000
#> GSM151417     1   0.000    0.96768 1.000 0.000
#> GSM151418     2   0.000    0.97498 0.000 1.000
#> GSM151419     1   0.000    0.96768 1.000 0.000
#> GSM151420     1   0.000    0.96768 1.000 0.000
#> GSM151421     1   0.000    0.96768 1.000 0.000
#> GSM151422     1   0.000    0.96768 1.000 0.000
#> GSM151423     2   0.000    0.97498 0.000 1.000
#> GSM151424     2   0.000    0.97498 0.000 1.000
#> GSM151425     2   0.000    0.97498 0.000 1.000
#> GSM151426     2   0.000    0.97498 0.000 1.000
#> GSM151427     2   0.000    0.97498 0.000 1.000
#> GSM151428     1   0.000    0.96768 1.000 0.000
#> GSM151429     1   0.000    0.96768 1.000 0.000
#> GSM151430     2   0.000    0.97498 0.000 1.000
#> GSM151431     2   0.204    0.94725 0.032 0.968
#> GSM151432     1   0.000    0.96768 1.000 0.000
#> GSM151433     1   0.000    0.96768 1.000 0.000
#> GSM151434     1   0.000    0.96768 1.000 0.000
#> GSM151435     1   0.000    0.96768 1.000 0.000
#> GSM151436     2   0.000    0.97498 0.000 1.000
#> GSM151437     1   0.000    0.96768 1.000 0.000
#> GSM151438     1   0.000    0.96768 1.000 0.000
#> GSM151439     1   0.000    0.96768 1.000 0.000
#> GSM151440     2   0.000    0.97498 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
#> GSM151369     1  0.4750     0.7024 0.784 0.000 0.216
#> GSM151370     2  0.5760     0.5571 0.000 0.672 0.328
#> GSM151371     1  0.0424     0.9190 0.992 0.008 0.000
#> GSM151372     2  0.4504     0.7529 0.000 0.804 0.196
#> GSM151373     2  0.4291     0.7718 0.000 0.820 0.180
#> GSM151374     3  0.0000     0.8823 0.000 0.000 1.000
#> GSM151375     3  0.0237     0.8812 0.000 0.004 0.996
#> GSM151376     3  0.0237     0.8812 0.000 0.004 0.996
#> GSM151377     3  0.0237     0.8812 0.000 0.004 0.996
#> GSM151378     3  0.3038     0.8003 0.000 0.104 0.896
#> GSM151379     3  0.5678     0.4522 0.000 0.316 0.684
#> GSM151380     3  0.6126     0.3980 0.352 0.004 0.644
#> GSM151381     3  0.0000     0.8823 0.000 0.000 1.000
#> GSM151382     2  0.2356     0.8401 0.000 0.928 0.072
#> GSM151383     2  0.0237     0.8445 0.004 0.996 0.000
#> GSM151384     1  0.0424     0.9183 0.992 0.008 0.000
#> GSM151385     1  0.0237     0.9204 0.996 0.004 0.000
#> GSM151386     1  0.0237     0.9196 0.996 0.004 0.000
#> GSM151387     2  0.5497     0.6244 0.000 0.708 0.292
#> GSM151388     1  0.5905     0.4561 0.648 0.000 0.352
#> GSM151389     3  0.0000     0.8823 0.000 0.000 1.000
#> GSM151390     3  0.3412     0.7765 0.000 0.124 0.876
#> GSM151391     3  0.0000     0.8823 0.000 0.000 1.000
#> GSM151392     3  0.5905     0.4131 0.352 0.000 0.648
#> GSM151393     3  0.0000     0.8823 0.000 0.000 1.000
#> GSM151394     1  0.0000     0.9211 1.000 0.000 0.000
#> GSM151395     2  0.6215     0.1963 0.428 0.572 0.000
#> GSM151396     2  0.1289     0.8488 0.000 0.968 0.032
#> GSM151397     1  0.0000     0.9211 1.000 0.000 0.000
#> GSM151398     1  0.0000     0.9211 1.000 0.000 0.000
#> GSM151399     2  0.0592     0.8480 0.000 0.988 0.012
#> GSM151400     2  0.4749     0.7190 0.172 0.816 0.012
#> GSM151401     2  0.3686     0.8038 0.000 0.860 0.140
#> GSM151402     3  0.0000     0.8823 0.000 0.000 1.000
#> GSM151403     3  0.0000     0.8823 0.000 0.000 1.000
#> GSM151404     1  0.6026     0.4009 0.624 0.000 0.376
#> GSM151405     1  0.9961    -0.1203 0.372 0.296 0.332
#> GSM151406     3  0.1031     0.8682 0.000 0.024 0.976
#> GSM151407     2  0.0592     0.8478 0.000 0.988 0.012
#> GSM151408     2  0.0424     0.8468 0.000 0.992 0.008
#> GSM151409     1  0.0000     0.9211 1.000 0.000 0.000
#> GSM151410     2  0.0237     0.8445 0.004 0.996 0.000
#> GSM151411     1  0.0000     0.9211 1.000 0.000 0.000
#> GSM151412     2  0.1964     0.8444 0.000 0.944 0.056
#> GSM151413     1  0.0592     0.9171 0.988 0.012 0.000
#> GSM151414     1  0.0237     0.9204 0.996 0.004 0.000
#> GSM151415     1  0.0000     0.9211 1.000 0.000 0.000
#> GSM151416     2  0.6215     0.2123 0.428 0.572 0.000
#> GSM151417     1  0.2448     0.8744 0.924 0.076 0.000
#> GSM151418     3  0.0237     0.8812 0.000 0.004 0.996
#> GSM151419     1  0.0000     0.9211 1.000 0.000 0.000
#> GSM151420     1  0.0000     0.9211 1.000 0.000 0.000
#> GSM151421     1  0.2711     0.8631 0.912 0.088 0.000
#> GSM151422     1  0.0237     0.9204 0.996 0.004 0.000
#> GSM151423     3  0.0000     0.8823 0.000 0.000 1.000
#> GSM151424     2  0.1643     0.8479 0.000 0.956 0.044
#> GSM151425     2  0.3941     0.7899 0.000 0.844 0.156
#> GSM151426     2  0.4178     0.7783 0.000 0.828 0.172
#> GSM151427     3  0.6274     0.0246 0.000 0.456 0.544
#> GSM151428     1  0.3879     0.8021 0.848 0.152 0.000
#> GSM151429     2  0.4654     0.6793 0.208 0.792 0.000
#> GSM151430     2  0.0424     0.8468 0.000 0.992 0.008
#> GSM151431     2  0.0424     0.8468 0.000 0.992 0.008
#> GSM151432     1  0.0000     0.9211 1.000 0.000 0.000
#> GSM151433     1  0.0000     0.9211 1.000 0.000 0.000
#> GSM151434     1  0.0424     0.9183 0.992 0.008 0.000
#> GSM151435     1  0.0237     0.9204 0.996 0.004 0.000
#> GSM151436     2  0.1643     0.8479 0.000 0.956 0.044
#> GSM151437     1  0.0000     0.9211 1.000 0.000 0.000
#> GSM151438     1  0.0000     0.9211 1.000 0.000 0.000
#> GSM151439     1  0.4346     0.7636 0.816 0.184 0.000
#> GSM151440     2  0.0592     0.8481 0.000 0.988 0.012

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM151369     1  0.5751     0.1454 0.528 0.020 0.448 0.004
#> GSM151370     4  0.6316     0.4158 0.000 0.156 0.184 0.660
#> GSM151371     1  0.1520     0.8694 0.956 0.024 0.000 0.020
#> GSM151372     2  0.4553     0.6313 0.000 0.780 0.040 0.180
#> GSM151373     2  0.4797     0.5548 0.000 0.720 0.020 0.260
#> GSM151374     3  0.0817     0.8036 0.000 0.024 0.976 0.000
#> GSM151375     3  0.1211     0.7997 0.000 0.040 0.960 0.000
#> GSM151376     3  0.1118     0.8006 0.000 0.036 0.964 0.000
#> GSM151377     3  0.0817     0.8029 0.000 0.024 0.976 0.000
#> GSM151378     3  0.3935     0.7169 0.000 0.100 0.840 0.060
#> GSM151379     3  0.6794     0.2716 0.000 0.136 0.584 0.280
#> GSM151380     3  0.7350     0.4263 0.168 0.016 0.584 0.232
#> GSM151381     3  0.1042     0.7989 0.000 0.008 0.972 0.020
#> GSM151382     4  0.5408     0.0276 0.000 0.488 0.012 0.500
#> GSM151383     4  0.4277     0.4843 0.000 0.280 0.000 0.720
#> GSM151384     1  0.4313     0.6785 0.736 0.260 0.000 0.004
#> GSM151385     1  0.1867     0.8495 0.928 0.000 0.000 0.072
#> GSM151386     1  0.4018     0.7241 0.772 0.224 0.000 0.004
#> GSM151387     4  0.5496     0.4840 0.000 0.160 0.108 0.732
#> GSM151388     4  0.8342    -0.0730 0.276 0.016 0.344 0.364
#> GSM151389     3  0.1854     0.7901 0.000 0.012 0.940 0.048
#> GSM151390     3  0.5716     0.2736 0.000 0.420 0.552 0.028
#> GSM151391     3  0.2021     0.7874 0.000 0.012 0.932 0.056
#> GSM151392     3  0.4864     0.5673 0.256 0.008 0.724 0.012
#> GSM151393     3  0.0469     0.8016 0.000 0.000 0.988 0.012
#> GSM151394     1  0.3142     0.8015 0.860 0.008 0.000 0.132
#> GSM151395     2  0.4197     0.5798 0.156 0.808 0.000 0.036
#> GSM151396     2  0.1356     0.7089 0.008 0.960 0.000 0.032
#> GSM151397     1  0.1576     0.8584 0.948 0.048 0.000 0.004
#> GSM151398     1  0.3402     0.7749 0.832 0.004 0.000 0.164
#> GSM151399     2  0.3486     0.6887 0.000 0.812 0.000 0.188
#> GSM151400     4  0.7923     0.0928 0.328 0.328 0.000 0.344
#> GSM151401     2  0.4420     0.6069 0.000 0.748 0.012 0.240
#> GSM151402     3  0.0707     0.8034 0.000 0.020 0.980 0.000
#> GSM151403     3  0.0469     0.8008 0.000 0.000 0.988 0.012
#> GSM151404     3  0.7513     0.2079 0.364 0.008 0.480 0.148
#> GSM151405     4  0.9765     0.1882 0.240 0.192 0.208 0.360
#> GSM151406     3  0.4656     0.6815 0.000 0.160 0.784 0.056
#> GSM151407     4  0.4661     0.5138 0.000 0.256 0.016 0.728
#> GSM151408     4  0.4220     0.5226 0.000 0.248 0.004 0.748
#> GSM151409     1  0.1576     0.8597 0.948 0.004 0.000 0.048
#> GSM151410     4  0.3172     0.5622 0.000 0.160 0.000 0.840
#> GSM151411     1  0.1824     0.8543 0.936 0.004 0.000 0.060
#> GSM151412     2  0.3583     0.6848 0.000 0.816 0.004 0.180
#> GSM151413     1  0.0921     0.8668 0.972 0.000 0.000 0.028
#> GSM151414     1  0.2973     0.8001 0.856 0.000 0.000 0.144
#> GSM151415     1  0.2888     0.8164 0.872 0.124 0.000 0.004
#> GSM151416     4  0.4514     0.4297 0.228 0.008 0.008 0.756
#> GSM151417     1  0.2730     0.8357 0.896 0.088 0.000 0.016
#> GSM151418     3  0.0817     0.8029 0.000 0.024 0.976 0.000
#> GSM151419     1  0.0336     0.8695 0.992 0.000 0.000 0.008
#> GSM151420     1  0.1118     0.8645 0.964 0.000 0.000 0.036
#> GSM151421     2  0.4820     0.4194 0.296 0.692 0.000 0.012
#> GSM151422     1  0.1637     0.8559 0.940 0.060 0.000 0.000
#> GSM151423     3  0.0469     0.8036 0.000 0.012 0.988 0.000
#> GSM151424     2  0.2234     0.7187 0.008 0.924 0.004 0.064
#> GSM151425     2  0.3471     0.7003 0.036 0.880 0.016 0.068
#> GSM151426     4  0.4025     0.5258 0.004 0.128 0.036 0.832
#> GSM151427     3  0.6941     0.0907 0.000 0.120 0.520 0.360
#> GSM151428     1  0.4643     0.5364 0.656 0.000 0.000 0.344
#> GSM151429     4  0.6912     0.3854 0.152 0.272 0.000 0.576
#> GSM151430     4  0.3751     0.5496 0.000 0.196 0.004 0.800
#> GSM151431     4  0.2530     0.5676 0.000 0.112 0.000 0.888
#> GSM151432     1  0.1151     0.8673 0.968 0.024 0.000 0.008
#> GSM151433     1  0.1109     0.8655 0.968 0.028 0.000 0.004
#> GSM151434     1  0.4509     0.6367 0.708 0.288 0.000 0.004
#> GSM151435     1  0.0817     0.8676 0.976 0.000 0.000 0.024
#> GSM151436     2  0.2831     0.7157 0.000 0.876 0.004 0.120
#> GSM151437     1  0.1182     0.8697 0.968 0.016 0.000 0.016
#> GSM151438     1  0.0524     0.8700 0.988 0.008 0.000 0.004
#> GSM151439     2  0.4295     0.4883 0.240 0.752 0.000 0.008
#> GSM151440     2  0.3486     0.6886 0.000 0.812 0.000 0.188

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>           class entropy silhouette    p1    p2    p3    p4    p5
#> GSM151369     3  0.3714     0.6778 0.160 0.016 0.808 0.000 0.016
#> GSM151370     5  0.2228     0.5036 0.000 0.000 0.048 0.040 0.912
#> GSM151371     1  0.4032     0.7901 0.820 0.068 0.000 0.088 0.024
#> GSM151372     2  0.6897    -0.0101 0.000 0.472 0.168 0.336 0.024
#> GSM151373     2  0.5380     0.3321 0.000 0.488 0.004 0.044 0.464
#> GSM151374     3  0.0740     0.8789 0.000 0.008 0.980 0.004 0.008
#> GSM151375     3  0.1943     0.8534 0.000 0.056 0.924 0.000 0.020
#> GSM151376     3  0.1648     0.8638 0.000 0.040 0.940 0.000 0.020
#> GSM151377     3  0.0693     0.8699 0.000 0.012 0.980 0.000 0.008
#> GSM151378     5  0.7212     0.2721 0.000 0.120 0.308 0.076 0.496
#> GSM151379     4  0.7273     0.1768 0.000 0.032 0.328 0.424 0.216
#> GSM151380     5  0.8327     0.2003 0.272 0.056 0.216 0.040 0.416
#> GSM151381     3  0.4211     0.4596 0.000 0.004 0.636 0.000 0.360
#> GSM151382     4  0.3940     0.6242 0.000 0.208 0.016 0.768 0.008
#> GSM151383     4  0.2068     0.7331 0.000 0.092 0.000 0.904 0.004
#> GSM151384     1  0.4299     0.5441 0.608 0.388 0.000 0.000 0.004
#> GSM151385     1  0.0854     0.8379 0.976 0.012 0.000 0.008 0.004
#> GSM151386     1  0.4059     0.6769 0.700 0.292 0.004 0.000 0.004
#> GSM151387     5  0.2728     0.4975 0.000 0.004 0.040 0.068 0.888
#> GSM151388     5  0.5808     0.4493 0.144 0.048 0.052 0.036 0.720
#> GSM151389     3  0.4522     0.5379 0.000 0.000 0.660 0.024 0.316
#> GSM151390     5  0.5598    -0.2414 0.000 0.400 0.076 0.000 0.524
#> GSM151391     3  0.2905     0.8217 0.000 0.000 0.868 0.036 0.096
#> GSM151392     5  0.7015     0.3243 0.280 0.020 0.232 0.000 0.468
#> GSM151393     3  0.1300     0.8752 0.000 0.000 0.956 0.016 0.028
#> GSM151394     1  0.3730     0.7163 0.808 0.036 0.000 0.004 0.152
#> GSM151395     2  0.5495     0.3837 0.064 0.500 0.000 0.000 0.436
#> GSM151396     2  0.4321     0.4756 0.004 0.600 0.000 0.000 0.396
#> GSM151397     1  0.1043     0.8377 0.960 0.040 0.000 0.000 0.000
#> GSM151398     1  0.4782     0.5780 0.700 0.052 0.000 0.004 0.244
#> GSM151399     2  0.4706     0.3511 0.008 0.500 0.000 0.004 0.488
#> GSM151400     5  0.7482     0.0983 0.392 0.100 0.000 0.108 0.400
#> GSM151401     5  0.4888    -0.3961 0.000 0.472 0.004 0.016 0.508
#> GSM151402     3  0.0486     0.8783 0.000 0.004 0.988 0.004 0.004
#> GSM151403     3  0.1270     0.8701 0.000 0.000 0.948 0.000 0.052
#> GSM151404     1  0.7195     0.2839 0.524 0.044 0.216 0.004 0.212
#> GSM151405     5  0.2680     0.4978 0.040 0.012 0.036 0.008 0.904
#> GSM151406     5  0.3218     0.4876 0.004 0.024 0.128 0.000 0.844
#> GSM151407     4  0.2473     0.7622 0.000 0.032 0.000 0.896 0.072
#> GSM151408     4  0.1836     0.7629 0.000 0.036 0.000 0.932 0.032
#> GSM151409     1  0.1200     0.8377 0.964 0.008 0.000 0.016 0.012
#> GSM151410     4  0.1662     0.7664 0.004 0.004 0.000 0.936 0.056
#> GSM151411     1  0.1179     0.8330 0.964 0.016 0.000 0.004 0.016
#> GSM151412     2  0.4675     0.4124 0.000 0.544 0.004 0.008 0.444
#> GSM151413     1  0.0671     0.8399 0.980 0.016 0.000 0.004 0.000
#> GSM151414     1  0.2374     0.8122 0.912 0.052 0.000 0.016 0.020
#> GSM151415     1  0.2605     0.7967 0.852 0.148 0.000 0.000 0.000
#> GSM151416     4  0.4161     0.6494 0.136 0.036 0.000 0.800 0.028
#> GSM151417     1  0.3317     0.8135 0.852 0.088 0.000 0.056 0.004
#> GSM151418     3  0.0162     0.8773 0.000 0.000 0.996 0.000 0.004
#> GSM151419     1  0.0290     0.8402 0.992 0.008 0.000 0.000 0.000
#> GSM151420     1  0.0451     0.8407 0.988 0.008 0.000 0.004 0.000
#> GSM151421     2  0.3461     0.3887 0.168 0.812 0.004 0.000 0.016
#> GSM151422     1  0.1638     0.8332 0.932 0.064 0.000 0.004 0.000
#> GSM151423     3  0.0451     0.8785 0.000 0.000 0.988 0.004 0.008
#> GSM151424     2  0.4196     0.4958 0.004 0.640 0.000 0.000 0.356
#> GSM151425     5  0.4704    -0.4084 0.008 0.480 0.004 0.000 0.508
#> GSM151426     5  0.2554     0.4853 0.000 0.008 0.020 0.076 0.896
#> GSM151427     4  0.7056     0.1460 0.000 0.016 0.232 0.420 0.332
#> GSM151428     1  0.5803     0.4019 0.572 0.060 0.000 0.348 0.020
#> GSM151429     4  0.5070     0.5896 0.156 0.092 0.000 0.732 0.020
#> GSM151430     4  0.2069     0.7637 0.000 0.012 0.000 0.912 0.076
#> GSM151431     4  0.1502     0.7663 0.000 0.004 0.000 0.940 0.056
#> GSM151432     1  0.3966     0.8005 0.824 0.096 0.000 0.052 0.028
#> GSM151433     1  0.3609     0.8106 0.844 0.092 0.000 0.040 0.024
#> GSM151434     1  0.4860     0.4463 0.540 0.440 0.004 0.000 0.016
#> GSM151435     1  0.0693     0.8409 0.980 0.012 0.000 0.008 0.000
#> GSM151436     2  0.5067     0.4808 0.000 0.700 0.004 0.204 0.092
#> GSM151437     1  0.0290     0.8406 0.992 0.008 0.000 0.000 0.000
#> GSM151438     1  0.0510     0.8403 0.984 0.016 0.000 0.000 0.000
#> GSM151439     2  0.2464     0.4516 0.096 0.888 0.000 0.000 0.016
#> GSM151440     2  0.4456     0.4026 0.000 0.716 0.004 0.248 0.032

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>           class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM151369     3  0.4601     0.5721 0.228 0.000 0.700 0.000 0.044 0.028
#> GSM151370     5  0.4789     0.4926 0.000 0.220 0.032 0.020 0.704 0.024
#> GSM151371     6  0.6728     0.3617 0.236 0.008 0.000 0.056 0.196 0.504
#> GSM151372     6  0.4394     0.5506 0.000 0.060 0.020 0.136 0.016 0.768
#> GSM151373     2  0.3125     0.7774 0.000 0.856 0.008 0.008 0.076 0.052
#> GSM151374     3  0.2078     0.8353 0.000 0.012 0.916 0.000 0.032 0.040
#> GSM151375     3  0.3590     0.8029 0.000 0.040 0.828 0.000 0.060 0.072
#> GSM151376     3  0.3674     0.8008 0.000 0.056 0.824 0.000 0.056 0.064
#> GSM151377     3  0.0914     0.8375 0.000 0.000 0.968 0.000 0.016 0.016
#> GSM151378     2  0.6872     0.4121 0.000 0.524 0.212 0.008 0.140 0.116
#> GSM151379     3  0.8112     0.1724 0.000 0.092 0.400 0.260 0.116 0.132
#> GSM151380     5  0.4025     0.6161 0.080 0.008 0.056 0.028 0.816 0.012
#> GSM151381     5  0.5269     0.0225 0.000 0.052 0.448 0.000 0.480 0.020
#> GSM151382     6  0.5241     0.3188 0.000 0.036 0.004 0.356 0.032 0.572
#> GSM151383     6  0.4056     0.2767 0.000 0.004 0.000 0.416 0.004 0.576
#> GSM151384     1  0.3847     0.7219 0.808 0.092 0.000 0.000 0.040 0.060
#> GSM151385     1  0.1296     0.7963 0.948 0.000 0.000 0.004 0.044 0.004
#> GSM151386     1  0.3083     0.7624 0.860 0.060 0.000 0.000 0.028 0.052
#> GSM151387     5  0.5683     0.3076 0.000 0.308 0.028 0.024 0.588 0.052
#> GSM151388     5  0.5060     0.6021 0.044 0.132 0.012 0.040 0.744 0.028
#> GSM151389     3  0.5151     0.6139 0.000 0.028 0.684 0.020 0.216 0.052
#> GSM151390     2  0.5204     0.6384 0.000 0.688 0.076 0.004 0.184 0.048
#> GSM151391     3  0.3504     0.7785 0.004 0.000 0.828 0.108 0.036 0.024
#> GSM151392     1  0.8298    -0.2808 0.296 0.240 0.132 0.000 0.276 0.056
#> GSM151393     3  0.1490     0.8412 0.000 0.004 0.948 0.016 0.008 0.024
#> GSM151394     5  0.4602     0.4061 0.320 0.000 0.000 0.004 0.628 0.048
#> GSM151395     2  0.1552     0.7749 0.036 0.940 0.000 0.000 0.020 0.004
#> GSM151396     2  0.0767     0.7884 0.004 0.976 0.000 0.000 0.008 0.012
#> GSM151397     1  0.0622     0.8025 0.980 0.008 0.000 0.000 0.012 0.000
#> GSM151398     5  0.4124     0.4023 0.332 0.000 0.000 0.000 0.644 0.024
#> GSM151399     2  0.1010     0.8019 0.000 0.960 0.000 0.000 0.036 0.004
#> GSM151400     1  0.7538     0.2739 0.504 0.156 0.004 0.136 0.160 0.040
#> GSM151401     2  0.2121     0.7793 0.000 0.892 0.000 0.000 0.096 0.012
#> GSM151402     3  0.0458     0.8426 0.000 0.000 0.984 0.000 0.000 0.016
#> GSM151403     3  0.1124     0.8391 0.000 0.000 0.956 0.000 0.036 0.008
#> GSM151404     5  0.4934     0.5513 0.188 0.000 0.068 0.000 0.700 0.044
#> GSM151405     5  0.4131     0.5657 0.012 0.184 0.012 0.008 0.764 0.020
#> GSM151406     5  0.4368     0.5187 0.000 0.248 0.024 0.004 0.704 0.020
#> GSM151407     4  0.1908     0.7268 0.000 0.004 0.000 0.900 0.000 0.096
#> GSM151408     4  0.2730     0.6326 0.000 0.000 0.000 0.808 0.000 0.192
#> GSM151409     1  0.2356     0.7646 0.884 0.000 0.000 0.004 0.096 0.016
#> GSM151410     4  0.2051     0.7228 0.004 0.004 0.000 0.896 0.000 0.096
#> GSM151411     1  0.3885     0.5109 0.684 0.000 0.000 0.004 0.300 0.012
#> GSM151412     2  0.1720     0.7965 0.000 0.928 0.000 0.000 0.032 0.040
#> GSM151413     1  0.0748     0.8028 0.976 0.004 0.000 0.004 0.016 0.000
#> GSM151414     1  0.1767     0.7958 0.932 0.000 0.000 0.020 0.036 0.012
#> GSM151415     1  0.0806     0.8012 0.972 0.008 0.000 0.000 0.000 0.020
#> GSM151416     4  0.3269     0.6607 0.028 0.000 0.000 0.832 0.020 0.120
#> GSM151417     1  0.2844     0.7707 0.880 0.028 0.000 0.060 0.008 0.024
#> GSM151418     3  0.0881     0.8387 0.000 0.008 0.972 0.000 0.008 0.012
#> GSM151419     1  0.0603     0.8015 0.980 0.000 0.000 0.000 0.016 0.004
#> GSM151420     1  0.1707     0.7905 0.928 0.000 0.000 0.004 0.056 0.012
#> GSM151421     1  0.6546     0.0158 0.396 0.368 0.000 0.004 0.024 0.208
#> GSM151422     1  0.1337     0.7970 0.956 0.016 0.000 0.008 0.012 0.008
#> GSM151423     3  0.0363     0.8411 0.000 0.000 0.988 0.000 0.000 0.012
#> GSM151424     2  0.2257     0.7659 0.008 0.904 0.000 0.000 0.048 0.040
#> GSM151425     2  0.1409     0.8020 0.000 0.948 0.008 0.000 0.032 0.012
#> GSM151426     2  0.6437    -0.0873 0.000 0.428 0.024 0.056 0.428 0.064
#> GSM151427     4  0.8030     0.0185 0.000 0.100 0.280 0.396 0.136 0.088
#> GSM151428     6  0.7198     0.3723 0.160 0.000 0.000 0.216 0.176 0.448
#> GSM151429     6  0.4760     0.4761 0.036 0.012 0.000 0.296 0.008 0.648
#> GSM151430     4  0.0632     0.7400 0.000 0.000 0.000 0.976 0.000 0.024
#> GSM151431     4  0.0547     0.7432 0.000 0.000 0.000 0.980 0.000 0.020
#> GSM151432     1  0.5271     0.5052 0.636 0.004 0.000 0.028 0.068 0.264
#> GSM151433     1  0.4308     0.6478 0.728 0.000 0.000 0.008 0.068 0.196
#> GSM151434     1  0.4882     0.6099 0.696 0.128 0.000 0.000 0.016 0.160
#> GSM151435     1  0.0777     0.8018 0.972 0.000 0.000 0.004 0.024 0.000
#> GSM151436     6  0.5285     0.4453 0.000 0.320 0.000 0.080 0.016 0.584
#> GSM151437     1  0.1321     0.7997 0.952 0.000 0.000 0.004 0.024 0.020
#> GSM151438     1  0.0603     0.8028 0.980 0.004 0.000 0.000 0.016 0.000
#> GSM151439     6  0.6103     0.3594 0.132 0.316 0.000 0.004 0.028 0.520
#> GSM151440     6  0.4394     0.5592 0.000 0.148 0.000 0.108 0.008 0.736

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) k
#> MAD:NMF 70            0.275 2
#> MAD:NMF 63            0.203 3
#> MAD:NMF 55            0.210 4
#> MAD:NMF 43            0.333 5
#> MAD:NMF 53            0.302 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 17730 rows and 72 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.454           0.816       0.902         0.4708 0.496   0.496
#> 3 3 0.543           0.632       0.772         0.3452 0.779   0.578
#> 4 4 0.688           0.706       0.836         0.1568 0.866   0.628
#> 5 5 0.675           0.592       0.768         0.0378 0.950   0.819
#> 6 6 0.678           0.513       0.713         0.0388 0.951   0.815

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
#> GSM151369     1  0.7299      0.767 0.796 0.204
#> GSM151370     2  0.7950      0.759 0.240 0.760
#> GSM151371     1  0.7376      0.762 0.792 0.208
#> GSM151372     2  0.0000      0.861 0.000 1.000
#> GSM151373     2  0.0000      0.861 0.000 1.000
#> GSM151374     2  0.0000      0.861 0.000 1.000
#> GSM151375     2  0.0000      0.861 0.000 1.000
#> GSM151376     2  0.0000      0.861 0.000 1.000
#> GSM151377     2  0.0000      0.861 0.000 1.000
#> GSM151378     2  0.0000      0.861 0.000 1.000
#> GSM151379     2  0.0000      0.861 0.000 1.000
#> GSM151380     1  0.7815      0.729 0.768 0.232
#> GSM151381     2  0.1843      0.855 0.028 0.972
#> GSM151382     2  0.0000      0.861 0.000 1.000
#> GSM151383     2  0.8555      0.712 0.280 0.720
#> GSM151384     1  0.0000      0.891 1.000 0.000
#> GSM151385     1  0.0000      0.891 1.000 0.000
#> GSM151386     1  0.0000      0.891 1.000 0.000
#> GSM151387     2  0.7883      0.763 0.236 0.764
#> GSM151388     2  0.7883      0.763 0.236 0.764
#> GSM151389     2  0.0376      0.861 0.004 0.996
#> GSM151390     2  0.0000      0.861 0.000 1.000
#> GSM151391     2  0.6247      0.807 0.156 0.844
#> GSM151392     1  0.7299      0.767 0.796 0.204
#> GSM151393     2  0.0000      0.861 0.000 1.000
#> GSM151394     1  0.0000      0.891 1.000 0.000
#> GSM151395     2  0.9044      0.643 0.320 0.680
#> GSM151396     2  0.9044      0.643 0.320 0.680
#> GSM151397     1  0.0000      0.891 1.000 0.000
#> GSM151398     1  0.0000      0.891 1.000 0.000
#> GSM151399     2  0.8144      0.747 0.252 0.748
#> GSM151400     1  0.7376      0.763 0.792 0.208
#> GSM151401     2  0.0000      0.861 0.000 1.000
#> GSM151402     2  0.0000      0.861 0.000 1.000
#> GSM151403     2  0.0376      0.861 0.004 0.996
#> GSM151404     1  0.7376      0.762 0.792 0.208
#> GSM151405     2  0.7950      0.759 0.240 0.760
#> GSM151406     2  0.5059      0.826 0.112 0.888
#> GSM151407     2  0.8555      0.712 0.280 0.720
#> GSM151408     2  0.8555      0.712 0.280 0.720
#> GSM151409     1  0.0000      0.891 1.000 0.000
#> GSM151410     1  0.9286      0.494 0.656 0.344
#> GSM151411     1  0.0000      0.891 1.000 0.000
#> GSM151412     2  0.0000      0.861 0.000 1.000
#> GSM151413     1  0.0000      0.891 1.000 0.000
#> GSM151414     1  0.0000      0.891 1.000 0.000
#> GSM151415     1  0.0000      0.891 1.000 0.000
#> GSM151416     1  0.7528      0.752 0.784 0.216
#> GSM151417     1  0.0376      0.890 0.996 0.004
#> GSM151418     2  0.0000      0.861 0.000 1.000
#> GSM151419     1  0.0000      0.891 1.000 0.000
#> GSM151420     1  0.0000      0.891 1.000 0.000
#> GSM151421     1  0.6148      0.807 0.848 0.152
#> GSM151422     1  0.0000      0.891 1.000 0.000
#> GSM151423     2  0.0000      0.861 0.000 1.000
#> GSM151424     2  0.8016      0.755 0.244 0.756
#> GSM151425     2  0.7883      0.763 0.236 0.764
#> GSM151426     2  0.7883      0.763 0.236 0.764
#> GSM151427     2  0.0000      0.861 0.000 1.000
#> GSM151428     1  0.7453      0.757 0.788 0.212
#> GSM151429     1  0.7528      0.752 0.784 0.216
#> GSM151430     2  0.8555      0.712 0.280 0.720
#> GSM151431     2  0.8555      0.712 0.280 0.720
#> GSM151432     1  0.0376      0.890 0.996 0.004
#> GSM151433     1  0.0000      0.891 1.000 0.000
#> GSM151434     1  0.0376      0.890 0.996 0.004
#> GSM151435     1  0.0000      0.891 1.000 0.000
#> GSM151436     2  0.0000      0.861 0.000 1.000
#> GSM151437     1  0.0000      0.891 1.000 0.000
#> GSM151438     1  0.0000      0.891 1.000 0.000
#> GSM151439     1  0.9522      0.408 0.628 0.372
#> GSM151440     2  0.0000      0.861 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
#> GSM151369     1  0.6307     0.3917 0.512 0.488 0.000
#> GSM151370     2  0.1643     0.7670 0.000 0.956 0.044
#> GSM151371     1  0.6308     0.3832 0.508 0.492 0.000
#> GSM151372     3  0.5465     0.7354 0.000 0.288 0.712
#> GSM151373     3  0.5760     0.7187 0.000 0.328 0.672
#> GSM151374     3  0.0000     0.7408 0.000 0.000 1.000
#> GSM151375     3  0.6168     0.6461 0.000 0.412 0.588
#> GSM151376     3  0.6168     0.6461 0.000 0.412 0.588
#> GSM151377     3  0.0000     0.7408 0.000 0.000 1.000
#> GSM151378     3  0.0000     0.7408 0.000 0.000 1.000
#> GSM151379     3  0.0000     0.7408 0.000 0.000 1.000
#> GSM151380     2  0.6305    -0.3705 0.484 0.516 0.000
#> GSM151381     2  0.6192    -0.2604 0.000 0.580 0.420
#> GSM151382     3  0.5465     0.7354 0.000 0.288 0.712
#> GSM151383     2  0.0237     0.7745 0.000 0.996 0.004
#> GSM151384     1  0.3192     0.7796 0.888 0.112 0.000
#> GSM151385     1  0.0000     0.7675 1.000 0.000 0.000
#> GSM151386     1  0.3192     0.7796 0.888 0.112 0.000
#> GSM151387     2  0.1753     0.7643 0.000 0.952 0.048
#> GSM151388     2  0.1753     0.7643 0.000 0.952 0.048
#> GSM151389     3  0.6180     0.6389 0.000 0.416 0.584
#> GSM151390     3  0.6168     0.6461 0.000 0.412 0.588
#> GSM151391     2  0.5591     0.3419 0.000 0.696 0.304
#> GSM151392     1  0.6307     0.3917 0.512 0.488 0.000
#> GSM151393     3  0.0000     0.7408 0.000 0.000 1.000
#> GSM151394     1  0.4235     0.7679 0.824 0.176 0.000
#> GSM151395     2  0.1411     0.7540 0.036 0.964 0.000
#> GSM151396     2  0.1411     0.7540 0.036 0.964 0.000
#> GSM151397     1  0.0000     0.7675 1.000 0.000 0.000
#> GSM151398     1  0.4887     0.7390 0.772 0.228 0.000
#> GSM151399     2  0.1289     0.7713 0.000 0.968 0.032
#> GSM151400     1  0.6308     0.3826 0.508 0.492 0.000
#> GSM151401     3  0.6062     0.6787 0.000 0.384 0.616
#> GSM151402     3  0.0000     0.7408 0.000 0.000 1.000
#> GSM151403     3  0.6180     0.6389 0.000 0.416 0.584
#> GSM151404     1  0.6308     0.3821 0.508 0.492 0.000
#> GSM151405     2  0.1643     0.7670 0.000 0.956 0.044
#> GSM151406     2  0.5016     0.3974 0.000 0.760 0.240
#> GSM151407     2  0.0237     0.7745 0.000 0.996 0.004
#> GSM151408     2  0.0237     0.7745 0.000 0.996 0.004
#> GSM151409     1  0.3619     0.7779 0.864 0.136 0.000
#> GSM151410     2  0.6247     0.0209 0.376 0.620 0.004
#> GSM151411     1  0.4235     0.7679 0.824 0.176 0.000
#> GSM151412     3  0.6062     0.6787 0.000 0.384 0.616
#> GSM151413     1  0.0000     0.7675 1.000 0.000 0.000
#> GSM151414     1  0.0000     0.7675 1.000 0.000 0.000
#> GSM151415     1  0.0000     0.7675 1.000 0.000 0.000
#> GSM151416     2  0.6309    -0.4117 0.500 0.500 0.000
#> GSM151417     1  0.4654     0.7469 0.792 0.208 0.000
#> GSM151418     3  0.0237     0.7408 0.000 0.004 0.996
#> GSM151419     1  0.0000     0.7675 1.000 0.000 0.000
#> GSM151420     1  0.0000     0.7675 1.000 0.000 0.000
#> GSM151421     1  0.6140     0.5209 0.596 0.404 0.000
#> GSM151422     1  0.1860     0.7757 0.948 0.052 0.000
#> GSM151423     3  0.0237     0.7412 0.000 0.004 0.996
#> GSM151424     2  0.1529     0.7685 0.000 0.960 0.040
#> GSM151425     2  0.1753     0.7643 0.000 0.952 0.048
#> GSM151426     2  0.1753     0.7643 0.000 0.952 0.048
#> GSM151427     3  0.0000     0.7408 0.000 0.000 1.000
#> GSM151428     1  0.6309     0.3728 0.504 0.496 0.000
#> GSM151429     1  0.6309     0.3619 0.500 0.500 0.000
#> GSM151430     2  0.0237     0.7745 0.000 0.996 0.004
#> GSM151431     2  0.0237     0.7745 0.000 0.996 0.004
#> GSM151432     1  0.4399     0.7629 0.812 0.188 0.000
#> GSM151433     1  0.3752     0.7765 0.856 0.144 0.000
#> GSM151434     1  0.4555     0.7510 0.800 0.200 0.000
#> GSM151435     1  0.0000     0.7675 1.000 0.000 0.000
#> GSM151436     3  0.5560     0.7310 0.000 0.300 0.700
#> GSM151437     1  0.0000     0.7675 1.000 0.000 0.000
#> GSM151438     1  0.0000     0.7675 1.000 0.000 0.000
#> GSM151439     2  0.5882     0.1223 0.348 0.652 0.000
#> GSM151440     3  0.5560     0.7310 0.000 0.300 0.700

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM151369     1  0.0707     0.7111 0.980 0.020 0.000 0.000
#> GSM151370     2  0.0000     0.8768 0.000 1.000 0.000 0.000
#> GSM151371     1  0.1798     0.7115 0.944 0.040 0.000 0.016
#> GSM151372     3  0.4406     0.6836 0.000 0.300 0.700 0.000
#> GSM151373     3  0.4761     0.6439 0.000 0.372 0.628 0.000
#> GSM151374     3  0.0000     0.7092 0.000 0.000 1.000 0.000
#> GSM151375     3  0.4972     0.5523 0.000 0.456 0.544 0.000
#> GSM151376     3  0.4972     0.5523 0.000 0.456 0.544 0.000
#> GSM151377     3  0.0000     0.7092 0.000 0.000 1.000 0.000
#> GSM151378     3  0.0000     0.7092 0.000 0.000 1.000 0.000
#> GSM151379     3  0.0000     0.7092 0.000 0.000 1.000 0.000
#> GSM151380     1  0.2281     0.6879 0.904 0.096 0.000 0.000
#> GSM151381     2  0.4776    -0.0422 0.000 0.624 0.376 0.000
#> GSM151382     3  0.4406     0.6836 0.000 0.300 0.700 0.000
#> GSM151383     2  0.1389     0.8739 0.048 0.952 0.000 0.000
#> GSM151384     1  0.5000     0.3521 0.500 0.000 0.000 0.500
#> GSM151385     4  0.0000     0.9671 0.000 0.000 0.000 1.000
#> GSM151386     1  0.5000     0.3603 0.504 0.000 0.000 0.496
#> GSM151387     2  0.0188     0.8758 0.000 0.996 0.004 0.000
#> GSM151388     2  0.0188     0.8758 0.000 0.996 0.004 0.000
#> GSM151389     3  0.4977     0.5448 0.000 0.460 0.540 0.000
#> GSM151390     3  0.4972     0.5523 0.000 0.456 0.544 0.000
#> GSM151391     2  0.4331     0.4348 0.000 0.712 0.288 0.000
#> GSM151392     1  0.0707     0.7111 0.980 0.020 0.000 0.000
#> GSM151393     3  0.0000     0.7092 0.000 0.000 1.000 0.000
#> GSM151394     1  0.4817     0.5448 0.612 0.000 0.000 0.388
#> GSM151395     2  0.3074     0.7713 0.152 0.848 0.000 0.000
#> GSM151396     2  0.3074     0.7713 0.152 0.848 0.000 0.000
#> GSM151397     4  0.0000     0.9671 0.000 0.000 0.000 1.000
#> GSM151398     1  0.4477     0.6071 0.688 0.000 0.000 0.312
#> GSM151399     2  0.0817     0.8793 0.024 0.976 0.000 0.000
#> GSM151400     1  0.0921     0.7102 0.972 0.028 0.000 0.000
#> GSM151401     3  0.4925     0.5912 0.000 0.428 0.572 0.000
#> GSM151402     3  0.0000     0.7092 0.000 0.000 1.000 0.000
#> GSM151403     3  0.4977     0.5448 0.000 0.460 0.540 0.000
#> GSM151404     1  0.0817     0.7110 0.976 0.024 0.000 0.000
#> GSM151405     2  0.0000     0.8768 0.000 1.000 0.000 0.000
#> GSM151406     2  0.3569     0.5799 0.000 0.804 0.196 0.000
#> GSM151407     2  0.1302     0.8751 0.044 0.956 0.000 0.000
#> GSM151408     2  0.1302     0.8751 0.044 0.956 0.000 0.000
#> GSM151409     1  0.4961     0.4554 0.552 0.000 0.000 0.448
#> GSM151410     1  0.5174     0.3618 0.620 0.368 0.000 0.012
#> GSM151411     1  0.4817     0.5448 0.612 0.000 0.000 0.388
#> GSM151412     3  0.4925     0.5912 0.000 0.428 0.572 0.000
#> GSM151413     4  0.0000     0.9671 0.000 0.000 0.000 1.000
#> GSM151414     4  0.0000     0.9671 0.000 0.000 0.000 1.000
#> GSM151415     4  0.0707     0.9575 0.020 0.000 0.000 0.980
#> GSM151416     1  0.1767     0.7101 0.944 0.044 0.000 0.012
#> GSM151417     1  0.4761     0.5552 0.628 0.000 0.000 0.372
#> GSM151418     3  0.0188     0.7092 0.000 0.004 0.996 0.000
#> GSM151419     4  0.0000     0.9671 0.000 0.000 0.000 1.000
#> GSM151420     4  0.0817     0.9547 0.024 0.000 0.000 0.976
#> GSM151421     1  0.2011     0.6992 0.920 0.000 0.000 0.080
#> GSM151422     4  0.3266     0.7138 0.168 0.000 0.000 0.832
#> GSM151423     3  0.0336     0.7097 0.000 0.008 0.992 0.000
#> GSM151424     2  0.0592     0.8786 0.016 0.984 0.000 0.000
#> GSM151425     2  0.0657     0.8772 0.012 0.984 0.004 0.000
#> GSM151426     2  0.0188     0.8758 0.000 0.996 0.004 0.000
#> GSM151427     3  0.0000     0.7092 0.000 0.000 1.000 0.000
#> GSM151428     1  0.1677     0.7104 0.948 0.040 0.000 0.012
#> GSM151429     1  0.1767     0.7104 0.944 0.044 0.000 0.012
#> GSM151430     2  0.1302     0.8751 0.044 0.956 0.000 0.000
#> GSM151431     2  0.1389     0.8739 0.048 0.952 0.000 0.000
#> GSM151432     1  0.4761     0.5611 0.628 0.000 0.000 0.372
#> GSM151433     1  0.4925     0.4899 0.572 0.000 0.000 0.428
#> GSM151434     1  0.4804     0.5407 0.616 0.000 0.000 0.384
#> GSM151435     4  0.0000     0.9671 0.000 0.000 0.000 1.000
#> GSM151436     3  0.4477     0.6786 0.000 0.312 0.688 0.000
#> GSM151437     4  0.0817     0.9547 0.024 0.000 0.000 0.976
#> GSM151438     4  0.0000     0.9671 0.000 0.000 0.000 1.000
#> GSM151439     1  0.4511     0.4800 0.724 0.268 0.000 0.008
#> GSM151440     3  0.4477     0.6786 0.000 0.312 0.688 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
#> GSM151369     5  0.3242     0.3358 0.000 0.076 0.000 0.072 0.852
#> GSM151370     2  0.3878     0.8582 0.000 0.748 0.236 0.016 0.000
#> GSM151371     5  0.3994     0.2954 0.008 0.132 0.000 0.056 0.804
#> GSM151372     3  0.1484     0.6877 0.000 0.008 0.944 0.048 0.000
#> GSM151373     3  0.1943     0.6643 0.000 0.056 0.924 0.020 0.000
#> GSM151374     3  0.3999     0.6192 0.000 0.000 0.656 0.344 0.000
#> GSM151375     3  0.2230     0.6138 0.000 0.116 0.884 0.000 0.000
#> GSM151376     3  0.2230     0.6138 0.000 0.116 0.884 0.000 0.000
#> GSM151377     3  0.4045     0.6127 0.000 0.000 0.644 0.356 0.000
#> GSM151378     3  0.3999     0.6192 0.000 0.000 0.656 0.344 0.000
#> GSM151379     3  0.3999     0.6192 0.000 0.000 0.656 0.344 0.000
#> GSM151380     5  0.4294     0.2703 0.000 0.148 0.004 0.072 0.776
#> GSM151381     3  0.4090     0.2548 0.000 0.268 0.716 0.016 0.000
#> GSM151382     3  0.1484     0.6877 0.000 0.008 0.944 0.048 0.000
#> GSM151383     2  0.3995     0.8471 0.000 0.776 0.180 0.044 0.000
#> GSM151384     5  0.4580     0.3342 0.460 0.004 0.000 0.004 0.532
#> GSM151385     1  0.0000     0.9504 1.000 0.000 0.000 0.000 0.000
#> GSM151386     5  0.4576     0.3421 0.456 0.004 0.000 0.004 0.536
#> GSM151387     2  0.5862     0.7466 0.000 0.544 0.344 0.112 0.000
#> GSM151388     2  0.5862     0.7466 0.000 0.544 0.344 0.112 0.000
#> GSM151389     3  0.2280     0.6090 0.000 0.120 0.880 0.000 0.000
#> GSM151390     3  0.2230     0.6138 0.000 0.116 0.884 0.000 0.000
#> GSM151391     3  0.5923    -0.1317 0.000 0.288 0.572 0.140 0.000
#> GSM151392     5  0.3242     0.3358 0.000 0.076 0.000 0.072 0.852
#> GSM151393     3  0.3999     0.6192 0.000 0.000 0.656 0.344 0.000
#> GSM151394     5  0.4015     0.5104 0.348 0.000 0.000 0.000 0.652
#> GSM151395     2  0.3830     0.7568 0.000 0.824 0.116 0.020 0.040
#> GSM151396     2  0.3830     0.7568 0.000 0.824 0.116 0.020 0.040
#> GSM151397     1  0.0609     0.9460 0.980 0.000 0.000 0.000 0.020
#> GSM151398     5  0.3790     0.5521 0.272 0.004 0.000 0.000 0.724
#> GSM151399     2  0.4495     0.8542 0.000 0.724 0.236 0.032 0.008
#> GSM151400     4  0.6506     0.0000 0.000 0.216 0.000 0.476 0.308
#> GSM151401     3  0.1908     0.6361 0.000 0.092 0.908 0.000 0.000
#> GSM151402     3  0.3999     0.6192 0.000 0.000 0.656 0.344 0.000
#> GSM151403     3  0.2280     0.6090 0.000 0.120 0.880 0.000 0.000
#> GSM151404     5  0.3274     0.3386 0.000 0.076 0.004 0.064 0.856
#> GSM151405     2  0.3849     0.8587 0.000 0.752 0.232 0.016 0.000
#> GSM151406     3  0.4803    -0.4172 0.000 0.444 0.536 0.020 0.000
#> GSM151407     2  0.3922     0.8487 0.000 0.780 0.180 0.040 0.000
#> GSM151408     2  0.3922     0.8487 0.000 0.780 0.180 0.040 0.000
#> GSM151409     5  0.4201     0.4266 0.408 0.000 0.000 0.000 0.592
#> GSM151410     5  0.6609    -0.0947 0.004 0.372 0.064 0.052 0.508
#> GSM151411     5  0.4015     0.5104 0.348 0.000 0.000 0.000 0.652
#> GSM151412     3  0.1908     0.6361 0.000 0.092 0.908 0.000 0.000
#> GSM151413     1  0.0000     0.9504 1.000 0.000 0.000 0.000 0.000
#> GSM151414     1  0.0000     0.9504 1.000 0.000 0.000 0.000 0.000
#> GSM151415     1  0.1270     0.9317 0.948 0.000 0.000 0.000 0.052
#> GSM151416     5  0.3916     0.2875 0.004 0.136 0.000 0.056 0.804
#> GSM151417     5  0.4898     0.5178 0.332 0.004 0.000 0.032 0.632
#> GSM151418     3  0.4030     0.6144 0.000 0.000 0.648 0.352 0.000
#> GSM151419     1  0.0000     0.9504 1.000 0.000 0.000 0.000 0.000
#> GSM151420     1  0.1341     0.9292 0.944 0.000 0.000 0.000 0.056
#> GSM151421     5  0.2597     0.3947 0.040 0.036 0.000 0.020 0.904
#> GSM151422     1  0.3109     0.7003 0.800 0.000 0.000 0.000 0.200
#> GSM151423     3  0.3966     0.6226 0.000 0.000 0.664 0.336 0.000
#> GSM151424     2  0.4158     0.8592 0.000 0.748 0.224 0.020 0.008
#> GSM151425     2  0.6098     0.7494 0.000 0.544 0.336 0.112 0.008
#> GSM151426     2  0.5862     0.7466 0.000 0.544 0.344 0.112 0.000
#> GSM151427     3  0.3999     0.6192 0.000 0.000 0.656 0.344 0.000
#> GSM151428     5  0.3871     0.2904 0.004 0.132 0.000 0.056 0.808
#> GSM151429     5  0.3916     0.2894 0.004 0.136 0.000 0.056 0.804
#> GSM151430     2  0.3922     0.8487 0.000 0.780 0.180 0.040 0.000
#> GSM151431     2  0.3995     0.8471 0.000 0.776 0.180 0.044 0.000
#> GSM151432     5  0.3949     0.5263 0.332 0.000 0.000 0.000 0.668
#> GSM151433     5  0.4150     0.4575 0.388 0.000 0.000 0.000 0.612
#> GSM151434     5  0.4419     0.5077 0.344 0.004 0.000 0.008 0.644
#> GSM151435     1  0.0000     0.9504 1.000 0.000 0.000 0.000 0.000
#> GSM151436     3  0.1251     0.6866 0.000 0.008 0.956 0.036 0.000
#> GSM151437     1  0.1410     0.9258 0.940 0.000 0.000 0.000 0.060
#> GSM151438     1  0.0000     0.9504 1.000 0.000 0.000 0.000 0.000
#> GSM151439     5  0.5642    -0.1549 0.004 0.324 0.040 0.024 0.608
#> GSM151440     3  0.1251     0.6866 0.000 0.008 0.956 0.036 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
#> GSM151369     5  0.6186      0.309 0.080 0.004 0.000 0.072 0.540 0.304
#> GSM151370     2  0.1457      0.700 0.016 0.948 0.028 0.004 0.000 0.004
#> GSM151371     5  0.5720      0.233 0.000 0.044 0.000 0.060 0.468 0.428
#> GSM151372     3  0.1967      0.702 0.000 0.084 0.904 0.012 0.000 0.000
#> GSM151373     3  0.3098      0.681 0.000 0.164 0.812 0.024 0.000 0.000
#> GSM151374     3  0.3221      0.622 0.000 0.000 0.736 0.264 0.000 0.000
#> GSM151375     3  0.3109      0.631 0.000 0.224 0.772 0.000 0.000 0.004
#> GSM151376     3  0.3109      0.631 0.000 0.224 0.772 0.000 0.000 0.004
#> GSM151377     3  0.3446      0.591 0.000 0.000 0.692 0.308 0.000 0.000
#> GSM151378     3  0.3221      0.622 0.000 0.000 0.736 0.264 0.000 0.000
#> GSM151379     3  0.3221      0.622 0.000 0.000 0.736 0.264 0.000 0.000
#> GSM151380     5  0.7231      0.237 0.080 0.076 0.000 0.076 0.496 0.272
#> GSM151381     3  0.4671      0.313 0.024 0.356 0.604 0.012 0.000 0.004
#> GSM151382     3  0.1967      0.702 0.000 0.084 0.904 0.012 0.000 0.000
#> GSM151383     2  0.1895      0.668 0.016 0.912 0.000 0.072 0.000 0.000
#> GSM151384     5  0.5025     -0.258 0.072 0.000 0.000 0.000 0.492 0.436
#> GSM151385     1  0.3446      0.933 0.692 0.000 0.000 0.000 0.308 0.000
#> GSM151386     5  0.4981     -0.258 0.068 0.000 0.000 0.000 0.496 0.436
#> GSM151387     2  0.6647      0.545 0.140 0.548 0.228 0.068 0.000 0.016
#> GSM151388     2  0.6647      0.545 0.140 0.548 0.228 0.068 0.000 0.016
#> GSM151389     3  0.3248      0.628 0.000 0.224 0.768 0.004 0.000 0.004
#> GSM151390     3  0.3109      0.631 0.000 0.224 0.772 0.000 0.000 0.004
#> GSM151391     3  0.6845      0.085 0.140 0.264 0.508 0.072 0.000 0.016
#> GSM151392     5  0.6186      0.309 0.080 0.004 0.000 0.072 0.540 0.304
#> GSM151393     3  0.3221      0.622 0.000 0.000 0.736 0.264 0.000 0.000
#> GSM151394     5  0.0260      0.392 0.008 0.000 0.000 0.000 0.992 0.000
#> GSM151395     2  0.4220      0.642 0.020 0.784 0.028 0.036 0.000 0.132
#> GSM151396     2  0.4220      0.642 0.020 0.784 0.028 0.036 0.000 0.132
#> GSM151397     1  0.3940      0.927 0.640 0.000 0.000 0.000 0.348 0.012
#> GSM151398     5  0.1644      0.389 0.004 0.000 0.000 0.000 0.920 0.076
#> GSM151399     2  0.3511      0.692 0.040 0.844 0.072 0.024 0.000 0.020
#> GSM151400     4  0.5112      0.000 0.064 0.008 0.000 0.536 0.000 0.392
#> GSM151401     3  0.2793      0.652 0.000 0.200 0.800 0.000 0.000 0.000
#> GSM151402     3  0.3221      0.622 0.000 0.000 0.736 0.264 0.000 0.000
#> GSM151403     3  0.3248      0.628 0.000 0.224 0.768 0.004 0.000 0.004
#> GSM151404     5  0.6070      0.312 0.080 0.004 0.000 0.060 0.544 0.312
#> GSM151405     2  0.1377      0.699 0.016 0.952 0.024 0.004 0.000 0.004
#> GSM151406     2  0.4883      0.251 0.028 0.532 0.424 0.012 0.000 0.004
#> GSM151407     2  0.1838      0.670 0.016 0.916 0.000 0.068 0.000 0.000
#> GSM151408     2  0.1838      0.670 0.016 0.916 0.000 0.068 0.000 0.000
#> GSM151409     5  0.1387      0.354 0.068 0.000 0.000 0.000 0.932 0.000
#> GSM151410     2  0.7023     -0.326 0.000 0.368 0.000 0.068 0.324 0.240
#> GSM151411     5  0.0260      0.392 0.008 0.000 0.000 0.000 0.992 0.000
#> GSM151412     3  0.2793      0.652 0.000 0.200 0.800 0.000 0.000 0.000
#> GSM151413     1  0.3446      0.933 0.692 0.000 0.000 0.000 0.308 0.000
#> GSM151414     1  0.3446      0.933 0.692 0.000 0.000 0.000 0.308 0.000
#> GSM151415     1  0.4110      0.911 0.608 0.000 0.000 0.000 0.376 0.016
#> GSM151416     5  0.5773      0.226 0.000 0.048 0.000 0.060 0.460 0.432
#> GSM151417     5  0.5217     -0.305 0.044 0.000 0.000 0.024 0.508 0.424
#> GSM151418     3  0.3409      0.596 0.000 0.000 0.700 0.300 0.000 0.000
#> GSM151419     1  0.3446      0.933 0.692 0.000 0.000 0.000 0.308 0.000
#> GSM151420     1  0.3934      0.913 0.616 0.000 0.000 0.000 0.376 0.008
#> GSM151421     6  0.2805      0.135 0.000 0.004 0.000 0.000 0.184 0.812
#> GSM151422     1  0.5535      0.690 0.436 0.000 0.000 0.000 0.432 0.132
#> GSM151423     3  0.3175      0.625 0.000 0.000 0.744 0.256 0.000 0.000
#> GSM151424     2  0.2544      0.700 0.028 0.896 0.048 0.004 0.000 0.024
#> GSM151425     2  0.6805      0.549 0.144 0.540 0.224 0.068 0.000 0.024
#> GSM151426     2  0.6647      0.545 0.140 0.548 0.228 0.068 0.000 0.016
#> GSM151427     3  0.3221      0.622 0.000 0.000 0.736 0.264 0.000 0.000
#> GSM151428     5  0.5721      0.229 0.000 0.044 0.000 0.060 0.464 0.432
#> GSM151429     5  0.5771      0.229 0.000 0.048 0.000 0.060 0.464 0.428
#> GSM151430     2  0.1838      0.670 0.016 0.916 0.000 0.068 0.000 0.000
#> GSM151431     2  0.1895      0.668 0.016 0.912 0.000 0.072 0.000 0.000
#> GSM151432     5  0.0717      0.393 0.008 0.000 0.000 0.000 0.976 0.016
#> GSM151433     5  0.1075      0.366 0.048 0.000 0.000 0.000 0.952 0.000
#> GSM151434     6  0.4689      0.070 0.044 0.000 0.000 0.000 0.440 0.516
#> GSM151435     1  0.3446      0.933 0.692 0.000 0.000 0.000 0.308 0.000
#> GSM151436     3  0.1610      0.701 0.000 0.084 0.916 0.000 0.000 0.000
#> GSM151437     1  0.3945      0.910 0.612 0.000 0.000 0.000 0.380 0.008
#> GSM151438     1  0.3835      0.932 0.668 0.000 0.000 0.000 0.320 0.012
#> GSM151439     6  0.5528     -0.142 0.008 0.248 0.000 0.028 0.088 0.628
#> GSM151440     3  0.1610      0.701 0.000 0.084 0.916 0.000 0.000 0.000

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

consensus_heatmap(res, k = 2)

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

consensus_heatmap(res, k = 3)

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

consensus_heatmap(res, k = 4)

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

consensus_heatmap(res, k = 5)

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

consensus_heatmap(res, k = 6)

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

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

membership_heatmap(res, k = 2)

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

membership_heatmap(res, k = 3)

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

membership_heatmap(res, k = 4)

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

membership_heatmap(res, k = 5)

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

membership_heatmap(res, k = 6)

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

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

Signature heatmaps where rows are scaled:

get_signatures(res, k = 2)

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

get_signatures(res, k = 3)

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

get_signatures(res, k = 4)

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

get_signatures(res, k = 5)

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

get_signatures(res, k = 6)

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

Signature heatmaps where rows are not scaled:

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

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

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

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

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

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

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

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

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

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

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk ATC-hclust-signature_compare

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

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

An example of the output of tb is:

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

The columns in tb are:

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

UMAP plot which shows how samples are separated.

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

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

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

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

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

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

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

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

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

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

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk ATC-hclust-collect-classes

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

test_to_known_factors(res)
#>             n disease.state(p) k
#> ATC:hclust 70            0.253 2
#> ATC:hclust 58            0.106 3
#> ATC:hclust 64            0.393 4
#> ATC:hclust 53            0.246 5
#> ATC:hclust 47            0.181 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 17730 rows and 72 columns.
#>   Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'ATC' method.
#>   Subgroups are detected by 'kmeans' method.
#>   Performed in total 1250 partitions by row resampling.
#>   Best k for subgroups seems to be 3.
#> 
#> Following methods can be applied to this 'ConsensusPartition' object:
#>  [1] "cola_report"             "collect_classes"         "collect_plots"          
#>  [4] "collect_stats"           "colnames"                "compare_signatures"     
#>  [7] "consensus_heatmap"       "dimension_reduction"     "functional_enrichment"  
#> [10] "get_anno_col"            "get_anno"                "get_classes"            
#> [13] "get_consensus"           "get_matrix"              "get_membership"         
#> [16] "get_param"               "get_signatures"          "get_stats"              
#> [19] "is_best_k"               "is_stable_k"             "membership_heatmap"     
#> [22] "ncol"                    "nrow"                    "plot_ecdf"              
#> [25] "rownames"                "select_partition_number" "show"                   
#> [28] "suggest_best_k"          "test_to_known_factors"

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

collect_plots(res)

plot of chunk ATC-kmeans-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 1.000           0.939       0.978         0.4879 0.512   0.512
#> 3 3 0.981           0.940       0.976         0.3772 0.745   0.535
#> 4 4 0.737           0.853       0.866         0.1064 0.883   0.664
#> 5 5 0.691           0.631       0.798         0.0615 0.977   0.913
#> 6 6 0.737           0.516       0.672         0.0414 0.907   0.651

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
#> GSM151369     1  0.0000    0.97289 1.000 0.000
#> GSM151370     2  0.0000    0.97887 0.000 1.000
#> GSM151371     1  0.0000    0.97289 1.000 0.000
#> GSM151372     2  0.0000    0.97887 0.000 1.000
#> GSM151373     2  0.0000    0.97887 0.000 1.000
#> GSM151374     2  0.0000    0.97887 0.000 1.000
#> GSM151375     2  0.0000    0.97887 0.000 1.000
#> GSM151376     2  0.0000    0.97887 0.000 1.000
#> GSM151377     2  0.0000    0.97887 0.000 1.000
#> GSM151378     2  0.0000    0.97887 0.000 1.000
#> GSM151379     2  0.0000    0.97887 0.000 1.000
#> GSM151380     2  0.1843    0.95150 0.028 0.972
#> GSM151381     2  0.0000    0.97887 0.000 1.000
#> GSM151382     2  0.0000    0.97887 0.000 1.000
#> GSM151383     2  0.0000    0.97887 0.000 1.000
#> GSM151384     1  0.0000    0.97289 1.000 0.000
#> GSM151385     1  0.0000    0.97289 1.000 0.000
#> GSM151386     1  0.0000    0.97289 1.000 0.000
#> GSM151387     2  0.0000    0.97887 0.000 1.000
#> GSM151388     2  0.0000    0.97887 0.000 1.000
#> GSM151389     2  0.0000    0.97887 0.000 1.000
#> GSM151390     2  0.0000    0.97887 0.000 1.000
#> GSM151391     2  0.0000    0.97887 0.000 1.000
#> GSM151392     2  0.0000    0.97887 0.000 1.000
#> GSM151393     2  0.0000    0.97887 0.000 1.000
#> GSM151394     1  0.0000    0.97289 1.000 0.000
#> GSM151395     2  0.9129    0.49293 0.328 0.672
#> GSM151396     2  0.0000    0.97887 0.000 1.000
#> GSM151397     1  0.0000    0.97289 1.000 0.000
#> GSM151398     1  0.0000    0.97289 1.000 0.000
#> GSM151399     2  0.0000    0.97887 0.000 1.000
#> GSM151400     1  0.0376    0.96932 0.996 0.004
#> GSM151401     2  0.0000    0.97887 0.000 1.000
#> GSM151402     2  0.0000    0.97887 0.000 1.000
#> GSM151403     2  0.0000    0.97887 0.000 1.000
#> GSM151404     1  0.0000    0.97289 1.000 0.000
#> GSM151405     2  0.0000    0.97887 0.000 1.000
#> GSM151406     2  0.0000    0.97887 0.000 1.000
#> GSM151407     2  0.0000    0.97887 0.000 1.000
#> GSM151408     2  0.0000    0.97887 0.000 1.000
#> GSM151409     1  0.0000    0.97289 1.000 0.000
#> GSM151410     2  0.0000    0.97887 0.000 1.000
#> GSM151411     1  0.0000    0.97289 1.000 0.000
#> GSM151412     2  0.0000    0.97887 0.000 1.000
#> GSM151413     1  0.0000    0.97289 1.000 0.000
#> GSM151414     1  0.0000    0.97289 1.000 0.000
#> GSM151415     1  0.0000    0.97289 1.000 0.000
#> GSM151416     2  0.9998   -0.00432 0.492 0.508
#> GSM151417     1  0.0000    0.97289 1.000 0.000
#> GSM151418     2  0.0000    0.97887 0.000 1.000
#> GSM151419     1  0.0000    0.97289 1.000 0.000
#> GSM151420     1  0.0000    0.97289 1.000 0.000
#> GSM151421     1  0.0000    0.97289 1.000 0.000
#> GSM151422     1  0.0000    0.97289 1.000 0.000
#> GSM151423     2  0.0000    0.97887 0.000 1.000
#> GSM151424     2  0.0000    0.97887 0.000 1.000
#> GSM151425     2  0.0000    0.97887 0.000 1.000
#> GSM151426     2  0.0000    0.97887 0.000 1.000
#> GSM151427     2  0.0000    0.97887 0.000 1.000
#> GSM151428     1  0.0000    0.97289 1.000 0.000
#> GSM151429     1  0.9954    0.13160 0.540 0.460
#> GSM151430     2  0.0000    0.97887 0.000 1.000
#> GSM151431     2  0.0000    0.97887 0.000 1.000
#> GSM151432     1  0.0000    0.97289 1.000 0.000
#> GSM151433     1  0.0000    0.97289 1.000 0.000
#> GSM151434     1  0.0000    0.97289 1.000 0.000
#> GSM151435     1  0.0000    0.97289 1.000 0.000
#> GSM151436     2  0.0000    0.97887 0.000 1.000
#> GSM151437     1  0.0000    0.97289 1.000 0.000
#> GSM151438     1  0.0000    0.97289 1.000 0.000
#> GSM151439     1  0.8327    0.62792 0.736 0.264
#> GSM151440     2  0.0000    0.97887 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
#> GSM151369     1  0.0424      0.969 0.992 0.008 0.000
#> GSM151370     2  0.0424      0.956 0.000 0.992 0.008
#> GSM151371     1  0.1753      0.936 0.952 0.048 0.000
#> GSM151372     3  0.0000      0.999 0.000 0.000 1.000
#> GSM151373     3  0.0000      0.999 0.000 0.000 1.000
#> GSM151374     3  0.0000      0.999 0.000 0.000 1.000
#> GSM151375     3  0.0000      0.999 0.000 0.000 1.000
#> GSM151376     3  0.0000      0.999 0.000 0.000 1.000
#> GSM151377     3  0.0000      0.999 0.000 0.000 1.000
#> GSM151378     3  0.0000      0.999 0.000 0.000 1.000
#> GSM151379     3  0.0000      0.999 0.000 0.000 1.000
#> GSM151380     2  0.0000      0.956 0.000 1.000 0.000
#> GSM151381     3  0.0237      0.996 0.000 0.004 0.996
#> GSM151382     3  0.0000      0.999 0.000 0.000 1.000
#> GSM151383     2  0.0000      0.956 0.000 1.000 0.000
#> GSM151384     1  0.0000      0.972 1.000 0.000 0.000
#> GSM151385     1  0.0000      0.972 1.000 0.000 0.000
#> GSM151386     1  0.0000      0.972 1.000 0.000 0.000
#> GSM151387     2  0.0424      0.956 0.000 0.992 0.008
#> GSM151388     2  0.0000      0.956 0.000 1.000 0.000
#> GSM151389     3  0.0000      0.999 0.000 0.000 1.000
#> GSM151390     3  0.0000      0.999 0.000 0.000 1.000
#> GSM151391     2  0.0424      0.956 0.000 0.992 0.008
#> GSM151392     2  0.0000      0.956 0.000 1.000 0.000
#> GSM151393     3  0.0000      0.999 0.000 0.000 1.000
#> GSM151394     1  0.0000      0.972 1.000 0.000 0.000
#> GSM151395     2  0.0000      0.956 0.000 1.000 0.000
#> GSM151396     2  0.0000      0.956 0.000 1.000 0.000
#> GSM151397     1  0.0000      0.972 1.000 0.000 0.000
#> GSM151398     1  0.0424      0.969 0.992 0.008 0.000
#> GSM151399     2  0.0424      0.956 0.000 0.992 0.008
#> GSM151400     2  0.0000      0.956 0.000 1.000 0.000
#> GSM151401     3  0.0424      0.992 0.000 0.008 0.992
#> GSM151402     3  0.0000      0.999 0.000 0.000 1.000
#> GSM151403     3  0.0000      0.999 0.000 0.000 1.000
#> GSM151404     1  0.5216      0.657 0.740 0.260 0.000
#> GSM151405     2  0.0000      0.956 0.000 1.000 0.000
#> GSM151406     2  0.3752      0.814 0.000 0.856 0.144
#> GSM151407     2  0.0424      0.956 0.000 0.992 0.008
#> GSM151408     2  0.0424      0.956 0.000 0.992 0.008
#> GSM151409     1  0.0000      0.972 1.000 0.000 0.000
#> GSM151410     2  0.0000      0.956 0.000 1.000 0.000
#> GSM151411     1  0.0424      0.969 0.992 0.008 0.000
#> GSM151412     2  0.6204      0.274 0.000 0.576 0.424
#> GSM151413     1  0.0000      0.972 1.000 0.000 0.000
#> GSM151414     1  0.0000      0.972 1.000 0.000 0.000
#> GSM151415     1  0.0000      0.972 1.000 0.000 0.000
#> GSM151416     2  0.0000      0.956 0.000 1.000 0.000
#> GSM151417     1  0.0424      0.969 0.992 0.008 0.000
#> GSM151418     3  0.0000      0.999 0.000 0.000 1.000
#> GSM151419     1  0.0000      0.972 1.000 0.000 0.000
#> GSM151420     1  0.0000      0.972 1.000 0.000 0.000
#> GSM151421     2  0.6225      0.181 0.432 0.568 0.000
#> GSM151422     1  0.0000      0.972 1.000 0.000 0.000
#> GSM151423     3  0.0000      0.999 0.000 0.000 1.000
#> GSM151424     2  0.0424      0.956 0.000 0.992 0.008
#> GSM151425     2  0.0424      0.956 0.000 0.992 0.008
#> GSM151426     2  0.0424      0.956 0.000 0.992 0.008
#> GSM151427     3  0.0000      0.999 0.000 0.000 1.000
#> GSM151428     1  0.5560      0.584 0.700 0.300 0.000
#> GSM151429     2  0.0000      0.956 0.000 1.000 0.000
#> GSM151430     2  0.0424      0.956 0.000 0.992 0.008
#> GSM151431     2  0.0000      0.956 0.000 1.000 0.000
#> GSM151432     1  0.0424      0.969 0.992 0.008 0.000
#> GSM151433     1  0.0000      0.972 1.000 0.000 0.000
#> GSM151434     1  0.0424      0.969 0.992 0.008 0.000
#> GSM151435     1  0.0000      0.972 1.000 0.000 0.000
#> GSM151436     3  0.0424      0.992 0.000 0.008 0.992
#> GSM151437     1  0.0000      0.972 1.000 0.000 0.000
#> GSM151438     1  0.0000      0.972 1.000 0.000 0.000
#> GSM151439     2  0.0000      0.956 0.000 1.000 0.000
#> GSM151440     2  0.0424      0.956 0.000 0.992 0.008

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM151369     1  0.4795      0.790 0.696 0.012 0.000 0.292
#> GSM151370     2  0.4015      0.842 0.052 0.832 0.116 0.000
#> GSM151371     1  0.5661      0.775 0.700 0.080 0.000 0.220
#> GSM151372     3  0.1042      0.917 0.008 0.020 0.972 0.000
#> GSM151373     3  0.2281      0.915 0.096 0.000 0.904 0.000
#> GSM151374     3  0.2760      0.907 0.128 0.000 0.872 0.000
#> GSM151375     3  0.0188      0.921 0.000 0.004 0.996 0.000
#> GSM151376     3  0.0188      0.921 0.000 0.004 0.996 0.000
#> GSM151377     3  0.2760      0.907 0.128 0.000 0.872 0.000
#> GSM151378     3  0.2408      0.914 0.104 0.000 0.896 0.000
#> GSM151379     3  0.2408      0.914 0.104 0.000 0.896 0.000
#> GSM151380     2  0.2530      0.862 0.112 0.888 0.000 0.000
#> GSM151381     3  0.5213      0.625 0.052 0.224 0.724 0.000
#> GSM151382     3  0.1042      0.917 0.008 0.020 0.972 0.000
#> GSM151383     2  0.1867      0.883 0.072 0.928 0.000 0.000
#> GSM151384     1  0.4730      0.734 0.636 0.000 0.000 0.364
#> GSM151385     4  0.0000      0.987 0.000 0.000 0.000 1.000
#> GSM151386     1  0.4679      0.750 0.648 0.000 0.000 0.352
#> GSM151387     2  0.3818      0.849 0.048 0.844 0.108 0.000
#> GSM151388     2  0.1661      0.883 0.052 0.944 0.004 0.000
#> GSM151389     3  0.3081      0.861 0.048 0.064 0.888 0.000
#> GSM151390     3  0.0188      0.921 0.000 0.004 0.996 0.000
#> GSM151391     2  0.3156      0.870 0.048 0.884 0.068 0.000
#> GSM151392     2  0.2593      0.867 0.104 0.892 0.004 0.000
#> GSM151393     3  0.2760      0.907 0.128 0.000 0.872 0.000
#> GSM151394     1  0.4605      0.767 0.664 0.000 0.000 0.336
#> GSM151395     2  0.3400      0.807 0.180 0.820 0.000 0.000
#> GSM151396     2  0.2125      0.881 0.076 0.920 0.004 0.000
#> GSM151397     4  0.0000      0.987 0.000 0.000 0.000 1.000
#> GSM151398     1  0.4431      0.790 0.696 0.000 0.000 0.304
#> GSM151399     2  0.1824      0.885 0.060 0.936 0.004 0.000
#> GSM151400     1  0.3837      0.633 0.776 0.224 0.000 0.000
#> GSM151401     3  0.1807      0.902 0.008 0.052 0.940 0.000
#> GSM151402     3  0.2760      0.907 0.128 0.000 0.872 0.000
#> GSM151403     3  0.2494      0.885 0.048 0.036 0.916 0.000
#> GSM151404     1  0.5073      0.685 0.744 0.200 0.000 0.056
#> GSM151405     2  0.1824      0.884 0.060 0.936 0.004 0.000
#> GSM151406     2  0.4387      0.821 0.052 0.804 0.144 0.000
#> GSM151407     2  0.3761      0.873 0.068 0.852 0.080 0.000
#> GSM151408     2  0.1792      0.884 0.068 0.932 0.000 0.000
#> GSM151409     4  0.1302      0.938 0.044 0.000 0.000 0.956
#> GSM151410     2  0.1867      0.883 0.072 0.928 0.000 0.000
#> GSM151411     1  0.4477      0.787 0.688 0.000 0.000 0.312
#> GSM151412     2  0.5773      0.560 0.048 0.632 0.320 0.000
#> GSM151413     4  0.0000      0.987 0.000 0.000 0.000 1.000
#> GSM151414     4  0.0000      0.987 0.000 0.000 0.000 1.000
#> GSM151415     4  0.0000      0.987 0.000 0.000 0.000 1.000
#> GSM151416     2  0.2921      0.843 0.140 0.860 0.000 0.000
#> GSM151417     1  0.4431      0.790 0.696 0.000 0.000 0.304
#> GSM151418     3  0.1305      0.921 0.036 0.004 0.960 0.000
#> GSM151419     4  0.0000      0.987 0.000 0.000 0.000 1.000
#> GSM151420     4  0.0000      0.987 0.000 0.000 0.000 1.000
#> GSM151421     1  0.4875      0.703 0.772 0.160 0.000 0.068
#> GSM151422     4  0.1637      0.916 0.060 0.000 0.000 0.940
#> GSM151423     3  0.1474      0.922 0.052 0.000 0.948 0.000
#> GSM151424     2  0.2271      0.882 0.076 0.916 0.008 0.000
#> GSM151425     2  0.2675      0.885 0.048 0.908 0.044 0.000
#> GSM151426     2  0.2675      0.879 0.048 0.908 0.044 0.000
#> GSM151427     3  0.2408      0.914 0.104 0.000 0.896 0.000
#> GSM151428     1  0.5495      0.759 0.728 0.096 0.000 0.176
#> GSM151429     1  0.4855      0.252 0.600 0.400 0.000 0.000
#> GSM151430     2  0.1792      0.884 0.068 0.932 0.000 0.000
#> GSM151431     2  0.1940      0.882 0.076 0.924 0.000 0.000
#> GSM151432     1  0.4477      0.787 0.688 0.000 0.000 0.312
#> GSM151433     1  0.4730      0.734 0.636 0.000 0.000 0.364
#> GSM151434     1  0.4477      0.787 0.688 0.000 0.000 0.312
#> GSM151435     4  0.0000      0.987 0.000 0.000 0.000 1.000
#> GSM151436     3  0.2214      0.897 0.028 0.044 0.928 0.000
#> GSM151437     4  0.0000      0.987 0.000 0.000 0.000 1.000
#> GSM151438     4  0.0000      0.987 0.000 0.000 0.000 1.000
#> GSM151439     1  0.3975      0.633 0.760 0.240 0.000 0.000
#> GSM151440     2  0.4104      0.868 0.080 0.832 0.088 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
#> GSM151369     5  0.4022    0.72689 0.104 0.000 0.000 0.100 0.796
#> GSM151370     2  0.1831    0.62128 0.000 0.920 0.076 0.004 0.000
#> GSM151371     5  0.4665    0.64142 0.084 0.008 0.000 0.156 0.752
#> GSM151372     3  0.2688    0.80529 0.000 0.036 0.896 0.056 0.012
#> GSM151373     3  0.3132    0.82819 0.000 0.000 0.820 0.172 0.008
#> GSM151374     3  0.4161    0.80871 0.000 0.000 0.752 0.208 0.040
#> GSM151375     3  0.0693    0.83087 0.000 0.008 0.980 0.000 0.012
#> GSM151376     3  0.0693    0.83087 0.000 0.008 0.980 0.000 0.012
#> GSM151377     3  0.4337    0.80660 0.000 0.000 0.744 0.204 0.052
#> GSM151378     3  0.3171    0.82572 0.000 0.000 0.816 0.176 0.008
#> GSM151379     3  0.3171    0.82572 0.000 0.000 0.816 0.176 0.008
#> GSM151380     2  0.3942    0.44921 0.000 0.748 0.000 0.232 0.020
#> GSM151381     2  0.5042    0.00737 0.000 0.512 0.460 0.024 0.004
#> GSM151382     3  0.2464    0.81064 0.000 0.032 0.908 0.048 0.012
#> GSM151383     2  0.4118    0.54156 0.000 0.660 0.000 0.336 0.004
#> GSM151384     5  0.3714    0.74003 0.132 0.000 0.000 0.056 0.812
#> GSM151385     1  0.0000    0.92848 1.000 0.000 0.000 0.000 0.000
#> GSM151386     5  0.3669    0.74264 0.128 0.000 0.000 0.056 0.816
#> GSM151387     2  0.0510    0.64376 0.000 0.984 0.016 0.000 0.000
#> GSM151388     2  0.0865    0.64069 0.000 0.972 0.000 0.024 0.004
#> GSM151389     3  0.4302    0.46488 0.000 0.344 0.648 0.004 0.004
#> GSM151390     3  0.1267    0.82743 0.000 0.024 0.960 0.004 0.012
#> GSM151391     2  0.0960    0.64166 0.000 0.972 0.008 0.016 0.004
#> GSM151392     2  0.3696    0.49019 0.000 0.772 0.000 0.212 0.016
#> GSM151393     3  0.4161    0.80871 0.000 0.000 0.752 0.208 0.040
#> GSM151394     5  0.3317    0.74412 0.116 0.000 0.000 0.044 0.840
#> GSM151395     2  0.6299   -0.18924 0.000 0.432 0.000 0.416 0.152
#> GSM151396     2  0.4843    0.53888 0.000 0.660 0.000 0.292 0.048
#> GSM151397     1  0.0000    0.92848 1.000 0.000 0.000 0.000 0.000
#> GSM151398     5  0.4361    0.72137 0.108 0.000 0.000 0.124 0.768
#> GSM151399     2  0.3875    0.62157 0.000 0.792 0.000 0.160 0.048
#> GSM151400     5  0.5483   -0.33646 0.000 0.064 0.000 0.424 0.512
#> GSM151401     3  0.4432    0.71841 0.000 0.112 0.788 0.080 0.020
#> GSM151402     3  0.4161    0.80871 0.000 0.000 0.752 0.208 0.040
#> GSM151403     3  0.3596    0.71454 0.000 0.192 0.792 0.008 0.008
#> GSM151404     5  0.4757    0.51949 0.000 0.120 0.000 0.148 0.732
#> GSM151405     2  0.2233    0.61394 0.000 0.892 0.000 0.104 0.004
#> GSM151406     2  0.3419    0.53927 0.000 0.804 0.180 0.016 0.000
#> GSM151407     2  0.4156    0.57548 0.000 0.700 0.008 0.288 0.004
#> GSM151408     2  0.3990    0.56292 0.000 0.688 0.000 0.308 0.004
#> GSM151409     1  0.4150    0.37358 0.612 0.000 0.000 0.000 0.388
#> GSM151410     2  0.4118    0.54156 0.000 0.660 0.000 0.336 0.004
#> GSM151411     5  0.3216    0.74569 0.108 0.000 0.000 0.044 0.848
#> GSM151412     2  0.6897    0.35991 0.000 0.504 0.320 0.136 0.040
#> GSM151413     1  0.0162    0.92672 0.996 0.000 0.000 0.004 0.000
#> GSM151414     1  0.0000    0.92848 1.000 0.000 0.000 0.000 0.000
#> GSM151415     1  0.0880    0.90802 0.968 0.000 0.000 0.000 0.032
#> GSM151416     2  0.6366   -0.28301 0.000 0.440 0.000 0.396 0.164
#> GSM151417     5  0.3477    0.74876 0.112 0.000 0.000 0.056 0.832
#> GSM151418     3  0.3124    0.82912 0.000 0.012 0.872 0.060 0.056
#> GSM151419     1  0.0000    0.92848 1.000 0.000 0.000 0.000 0.000
#> GSM151420     1  0.0000    0.92848 1.000 0.000 0.000 0.000 0.000
#> GSM151421     5  0.4916    0.19664 0.016 0.016 0.000 0.340 0.628
#> GSM151422     1  0.3838    0.59936 0.716 0.000 0.000 0.004 0.280
#> GSM151423     3  0.2726    0.83068 0.000 0.000 0.884 0.064 0.052
#> GSM151424     2  0.4843    0.53888 0.000 0.660 0.000 0.292 0.048
#> GSM151425     2  0.3446    0.63207 0.000 0.840 0.004 0.108 0.048
#> GSM151426     2  0.0451    0.64449 0.000 0.988 0.008 0.004 0.000
#> GSM151427     3  0.3171    0.82572 0.000 0.000 0.816 0.176 0.008
#> GSM151428     5  0.4755    0.60965 0.072 0.012 0.000 0.172 0.744
#> GSM151429     4  0.6539    0.00000 0.000 0.200 0.000 0.432 0.368
#> GSM151430     2  0.3990    0.56292 0.000 0.688 0.000 0.308 0.004
#> GSM151431     2  0.4264    0.50017 0.000 0.620 0.000 0.376 0.004
#> GSM151432     5  0.2179    0.75228 0.112 0.000 0.000 0.000 0.888
#> GSM151433     5  0.2377    0.74787 0.128 0.000 0.000 0.000 0.872
#> GSM151434     5  0.3477    0.74876 0.112 0.000 0.000 0.056 0.832
#> GSM151435     1  0.0000    0.92848 1.000 0.000 0.000 0.000 0.000
#> GSM151436     3  0.4193    0.74479 0.000 0.068 0.808 0.100 0.024
#> GSM151437     1  0.0162    0.92673 0.996 0.000 0.000 0.000 0.004
#> GSM151438     1  0.0000    0.92848 1.000 0.000 0.000 0.000 0.000
#> GSM151439     5  0.5037   -0.11115 0.000 0.040 0.000 0.376 0.584
#> GSM151440     2  0.6294    0.54280 0.000 0.628 0.140 0.192 0.040

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>           class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM151369     6  0.4259    0.67796 0.032 0.112 0.000 0.084 0.000 0.772
#> GSM151370     5  0.1970    0.54665 0.000 0.092 0.000 0.008 0.900 0.000
#> GSM151371     6  0.3345    0.58024 0.028 0.000 0.000 0.184 0.000 0.788
#> GSM151372     2  0.4263    0.00589 0.000 0.504 0.480 0.016 0.000 0.000
#> GSM151373     3  0.2597    0.58333 0.000 0.176 0.824 0.000 0.000 0.000
#> GSM151374     3  0.0260    0.64923 0.000 0.000 0.992 0.008 0.000 0.000
#> GSM151375     3  0.4429    0.27336 0.000 0.372 0.600 0.016 0.012 0.000
#> GSM151376     3  0.4429    0.27336 0.000 0.372 0.600 0.016 0.012 0.000
#> GSM151377     3  0.1116    0.63905 0.000 0.008 0.960 0.028 0.000 0.004
#> GSM151378     3  0.1556    0.65829 0.000 0.080 0.920 0.000 0.000 0.000
#> GSM151379     3  0.1556    0.65829 0.000 0.080 0.920 0.000 0.000 0.000
#> GSM151380     5  0.4977    0.40007 0.000 0.132 0.000 0.148 0.696 0.024
#> GSM151381     5  0.5659   -0.20647 0.000 0.340 0.112 0.016 0.532 0.000
#> GSM151382     3  0.4262   -0.12628 0.000 0.476 0.508 0.016 0.000 0.000
#> GSM151383     5  0.5082    0.42520 0.000 0.080 0.000 0.408 0.512 0.000
#> GSM151384     6  0.3858    0.71421 0.048 0.052 0.000 0.092 0.000 0.808
#> GSM151385     1  0.0000    0.95000 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM151386     6  0.3858    0.71421 0.048 0.052 0.000 0.092 0.000 0.808
#> GSM151387     5  0.0547    0.57459 0.000 0.020 0.000 0.000 0.980 0.000
#> GSM151388     5  0.0767    0.57195 0.000 0.012 0.000 0.008 0.976 0.004
#> GSM151389     5  0.6266   -0.38397 0.000 0.332 0.196 0.020 0.452 0.000
#> GSM151390     3  0.4611    0.22065 0.000 0.380 0.584 0.016 0.020 0.000
#> GSM151391     5  0.1010    0.57148 0.000 0.036 0.000 0.004 0.960 0.000
#> GSM151392     5  0.5021    0.38624 0.000 0.124 0.000 0.172 0.684 0.020
#> GSM151393     3  0.0260    0.64923 0.000 0.000 0.992 0.008 0.000 0.000
#> GSM151394     6  0.2351    0.74757 0.036 0.028 0.000 0.032 0.000 0.904
#> GSM151395     4  0.6829    0.29935 0.000 0.180 0.000 0.484 0.244 0.092
#> GSM151396     5  0.6425    0.20288 0.000 0.260 0.000 0.292 0.428 0.020
#> GSM151397     1  0.0260    0.94987 0.992 0.008 0.000 0.000 0.000 0.000
#> GSM151398     6  0.3476    0.71425 0.032 0.048 0.000 0.088 0.000 0.832
#> GSM151399     5  0.4802    0.49634 0.000 0.200 0.000 0.084 0.696 0.020
#> GSM151400     4  0.5746    0.46000 0.000 0.156 0.000 0.488 0.004 0.352
#> GSM151401     2  0.5115    0.42148 0.000 0.572 0.340 0.004 0.084 0.000
#> GSM151402     3  0.0260    0.64923 0.000 0.000 0.992 0.008 0.000 0.000
#> GSM151403     2  0.6555    0.25392 0.000 0.336 0.324 0.020 0.320 0.000
#> GSM151404     6  0.5496    0.47903 0.000 0.120 0.000 0.132 0.076 0.672
#> GSM151405     5  0.2839    0.52800 0.000 0.044 0.000 0.092 0.860 0.004
#> GSM151406     5  0.3758    0.24945 0.000 0.284 0.000 0.016 0.700 0.000
#> GSM151407     5  0.5052    0.43737 0.000 0.080 0.000 0.388 0.532 0.000
#> GSM151408     5  0.5077    0.42865 0.000 0.080 0.000 0.404 0.516 0.000
#> GSM151409     6  0.4141    0.18111 0.432 0.012 0.000 0.000 0.000 0.556
#> GSM151410     5  0.5045    0.42361 0.000 0.076 0.000 0.412 0.512 0.000
#> GSM151411     6  0.2351    0.74757 0.036 0.028 0.000 0.032 0.000 0.904
#> GSM151412     2  0.5318    0.14030 0.000 0.572 0.044 0.040 0.344 0.000
#> GSM151413     1  0.0632    0.94139 0.976 0.024 0.000 0.000 0.000 0.000
#> GSM151414     1  0.0146    0.94934 0.996 0.004 0.000 0.000 0.000 0.000
#> GSM151415     1  0.1225    0.92298 0.952 0.012 0.000 0.000 0.000 0.036
#> GSM151416     4  0.5885    0.24406 0.000 0.012 0.000 0.532 0.272 0.184
#> GSM151417     6  0.3807    0.71408 0.040 0.048 0.000 0.104 0.000 0.808
#> GSM151418     3  0.4320    0.40718 0.000 0.256 0.696 0.040 0.004 0.004
#> GSM151419     1  0.0146    0.94987 0.996 0.004 0.000 0.000 0.000 0.000
#> GSM151420     1  0.0405    0.94762 0.988 0.008 0.000 0.000 0.000 0.004
#> GSM151421     4  0.5355    0.31216 0.000 0.092 0.000 0.456 0.004 0.448
#> GSM151422     1  0.4420    0.43371 0.640 0.036 0.000 0.004 0.000 0.320
#> GSM151423     3  0.4113    0.43403 0.000 0.244 0.712 0.040 0.000 0.004
#> GSM151424     5  0.6395    0.22636 0.000 0.256 0.000 0.284 0.440 0.020
#> GSM151425     5  0.4350    0.51270 0.000 0.188 0.000 0.056 0.736 0.020
#> GSM151426     5  0.0363    0.57393 0.000 0.012 0.000 0.000 0.988 0.000
#> GSM151427     3  0.1556    0.65829 0.000 0.080 0.920 0.000 0.000 0.000
#> GSM151428     6  0.3377    0.57240 0.028 0.000 0.000 0.188 0.000 0.784
#> GSM151429     4  0.5788    0.54755 0.000 0.056 0.000 0.572 0.076 0.296
#> GSM151430     5  0.5071    0.43163 0.000 0.080 0.000 0.400 0.520 0.000
#> GSM151431     5  0.5110    0.39257 0.000 0.080 0.000 0.440 0.480 0.000
#> GSM151432     6  0.1370    0.74965 0.036 0.004 0.000 0.012 0.000 0.948
#> GSM151433     6  0.1462    0.74997 0.056 0.008 0.000 0.000 0.000 0.936
#> GSM151434     6  0.3761    0.71472 0.040 0.048 0.000 0.100 0.000 0.812
#> GSM151435     1  0.0000    0.95000 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM151436     2  0.4698    0.33791 0.000 0.576 0.384 0.020 0.020 0.000
#> GSM151437     1  0.0520    0.94589 0.984 0.008 0.000 0.000 0.000 0.008
#> GSM151438     1  0.0146    0.94987 0.996 0.004 0.000 0.000 0.000 0.000
#> GSM151439     4  0.5741    0.47396 0.000 0.148 0.000 0.464 0.004 0.384
#> GSM151440     5  0.5752    0.28380 0.000 0.408 0.000 0.132 0.452 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-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) k
#> ATC:kmeans 69           0.1725 2
#> ATC:kmeans 70           0.0594 3
#> ATC:kmeans 71           0.1106 4
#> ATC:kmeans 60           0.2543 5
#> ATC:kmeans 38           0.2639 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 17730 rows and 72 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 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-skmeans-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 1.000           0.985       0.994         0.5003 0.499   0.499
#> 3 3 0.895           0.878       0.945         0.2368 0.867   0.739
#> 4 4 0.776           0.762       0.888         0.1057 0.912   0.774
#> 5 5 0.782           0.753       0.880         0.0621 0.945   0.828
#> 6 6 0.765           0.684       0.833         0.0393 0.982   0.934

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
#> GSM151369     1   0.000      0.988 1.000 0.000
#> GSM151370     2   0.000      0.998 0.000 1.000
#> GSM151371     1   0.000      0.988 1.000 0.000
#> GSM151372     2   0.000      0.998 0.000 1.000
#> GSM151373     2   0.000      0.998 0.000 1.000
#> GSM151374     2   0.000      0.998 0.000 1.000
#> GSM151375     2   0.000      0.998 0.000 1.000
#> GSM151376     2   0.000      0.998 0.000 1.000
#> GSM151377     2   0.000      0.998 0.000 1.000
#> GSM151378     2   0.000      0.998 0.000 1.000
#> GSM151379     2   0.000      0.998 0.000 1.000
#> GSM151380     1   0.939      0.443 0.644 0.356
#> GSM151381     2   0.000      0.998 0.000 1.000
#> GSM151382     2   0.000      0.998 0.000 1.000
#> GSM151383     2   0.000      0.998 0.000 1.000
#> GSM151384     1   0.000      0.988 1.000 0.000
#> GSM151385     1   0.000      0.988 1.000 0.000
#> GSM151386     1   0.000      0.988 1.000 0.000
#> GSM151387     2   0.000      0.998 0.000 1.000
#> GSM151388     2   0.000      0.998 0.000 1.000
#> GSM151389     2   0.000      0.998 0.000 1.000
#> GSM151390     2   0.000      0.998 0.000 1.000
#> GSM151391     2   0.000      0.998 0.000 1.000
#> GSM151392     2   0.358      0.927 0.068 0.932
#> GSM151393     2   0.000      0.998 0.000 1.000
#> GSM151394     1   0.000      0.988 1.000 0.000
#> GSM151395     1   0.000      0.988 1.000 0.000
#> GSM151396     2   0.000      0.998 0.000 1.000
#> GSM151397     1   0.000      0.988 1.000 0.000
#> GSM151398     1   0.000      0.988 1.000 0.000
#> GSM151399     2   0.000      0.998 0.000 1.000
#> GSM151400     1   0.000      0.988 1.000 0.000
#> GSM151401     2   0.000      0.998 0.000 1.000
#> GSM151402     2   0.000      0.998 0.000 1.000
#> GSM151403     2   0.000      0.998 0.000 1.000
#> GSM151404     1   0.000      0.988 1.000 0.000
#> GSM151405     2   0.000      0.998 0.000 1.000
#> GSM151406     2   0.000      0.998 0.000 1.000
#> GSM151407     2   0.000      0.998 0.000 1.000
#> GSM151408     2   0.000      0.998 0.000 1.000
#> GSM151409     1   0.000      0.988 1.000 0.000
#> GSM151410     2   0.000      0.998 0.000 1.000
#> GSM151411     1   0.000      0.988 1.000 0.000
#> GSM151412     2   0.000      0.998 0.000 1.000
#> GSM151413     1   0.000      0.988 1.000 0.000
#> GSM151414     1   0.000      0.988 1.000 0.000
#> GSM151415     1   0.000      0.988 1.000 0.000
#> GSM151416     1   0.000      0.988 1.000 0.000
#> GSM151417     1   0.000      0.988 1.000 0.000
#> GSM151418     2   0.000      0.998 0.000 1.000
#> GSM151419     1   0.000      0.988 1.000 0.000
#> GSM151420     1   0.000      0.988 1.000 0.000
#> GSM151421     1   0.000      0.988 1.000 0.000
#> GSM151422     1   0.000      0.988 1.000 0.000
#> GSM151423     2   0.000      0.998 0.000 1.000
#> GSM151424     2   0.000      0.998 0.000 1.000
#> GSM151425     2   0.000      0.998 0.000 1.000
#> GSM151426     2   0.000      0.998 0.000 1.000
#> GSM151427     2   0.000      0.998 0.000 1.000
#> GSM151428     1   0.000      0.988 1.000 0.000
#> GSM151429     1   0.000      0.988 1.000 0.000
#> GSM151430     2   0.000      0.998 0.000 1.000
#> GSM151431     2   0.163      0.975 0.024 0.976
#> GSM151432     1   0.000      0.988 1.000 0.000
#> GSM151433     1   0.000      0.988 1.000 0.000
#> GSM151434     1   0.000      0.988 1.000 0.000
#> GSM151435     1   0.000      0.988 1.000 0.000
#> GSM151436     2   0.000      0.998 0.000 1.000
#> GSM151437     1   0.000      0.988 1.000 0.000
#> GSM151438     1   0.000      0.988 1.000 0.000
#> GSM151439     1   0.000      0.988 1.000 0.000
#> GSM151440     2   0.000      0.998 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
#> GSM151369     1  0.0000     0.9985 1.000 0.000 0.000
#> GSM151370     3  0.5291     0.6645 0.000 0.268 0.732
#> GSM151371     1  0.0000     0.9985 1.000 0.000 0.000
#> GSM151372     3  0.0424     0.9248 0.000 0.008 0.992
#> GSM151373     3  0.0424     0.9249 0.000 0.008 0.992
#> GSM151374     3  0.0000     0.9269 0.000 0.000 1.000
#> GSM151375     3  0.0000     0.9269 0.000 0.000 1.000
#> GSM151376     3  0.0000     0.9269 0.000 0.000 1.000
#> GSM151377     3  0.0000     0.9269 0.000 0.000 1.000
#> GSM151378     3  0.0000     0.9269 0.000 0.000 1.000
#> GSM151379     3  0.0000     0.9269 0.000 0.000 1.000
#> GSM151380     2  0.9402     0.2745 0.408 0.420 0.172
#> GSM151381     3  0.0000     0.9269 0.000 0.000 1.000
#> GSM151382     3  0.0592     0.9237 0.000 0.012 0.988
#> GSM151383     2  0.0000     0.7874 0.000 1.000 0.000
#> GSM151384     1  0.0000     0.9985 1.000 0.000 0.000
#> GSM151385     1  0.0000     0.9985 1.000 0.000 0.000
#> GSM151386     1  0.0000     0.9985 1.000 0.000 0.000
#> GSM151387     3  0.5497     0.6288 0.000 0.292 0.708
#> GSM151388     3  0.5810     0.5489 0.000 0.336 0.664
#> GSM151389     3  0.0000     0.9269 0.000 0.000 1.000
#> GSM151390     3  0.0000     0.9269 0.000 0.000 1.000
#> GSM151391     3  0.0424     0.9244 0.000 0.008 0.992
#> GSM151392     3  0.5610     0.7268 0.028 0.196 0.776
#> GSM151393     3  0.0000     0.9269 0.000 0.000 1.000
#> GSM151394     1  0.0000     0.9985 1.000 0.000 0.000
#> GSM151395     1  0.1411     0.9569 0.964 0.036 0.000
#> GSM151396     3  0.2796     0.8719 0.000 0.092 0.908
#> GSM151397     1  0.0000     0.9985 1.000 0.000 0.000
#> GSM151398     1  0.0000     0.9985 1.000 0.000 0.000
#> GSM151399     3  0.5291     0.6885 0.000 0.268 0.732
#> GSM151400     1  0.0000     0.9985 1.000 0.000 0.000
#> GSM151401     3  0.0424     0.9249 0.000 0.008 0.992
#> GSM151402     3  0.0000     0.9269 0.000 0.000 1.000
#> GSM151403     3  0.0000     0.9269 0.000 0.000 1.000
#> GSM151404     1  0.0000     0.9985 1.000 0.000 0.000
#> GSM151405     2  0.6286    -0.0988 0.000 0.536 0.464
#> GSM151406     3  0.0000     0.9269 0.000 0.000 1.000
#> GSM151407     2  0.0000     0.7874 0.000 1.000 0.000
#> GSM151408     2  0.0000     0.7874 0.000 1.000 0.000
#> GSM151409     1  0.0000     0.9985 1.000 0.000 0.000
#> GSM151410     2  0.0000     0.7874 0.000 1.000 0.000
#> GSM151411     1  0.0000     0.9985 1.000 0.000 0.000
#> GSM151412     3  0.1031     0.9184 0.000 0.024 0.976
#> GSM151413     1  0.0000     0.9985 1.000 0.000 0.000
#> GSM151414     1  0.0000     0.9985 1.000 0.000 0.000
#> GSM151415     1  0.0000     0.9985 1.000 0.000 0.000
#> GSM151416     2  0.5678     0.5120 0.316 0.684 0.000
#> GSM151417     1  0.0000     0.9985 1.000 0.000 0.000
#> GSM151418     3  0.0000     0.9269 0.000 0.000 1.000
#> GSM151419     1  0.0000     0.9985 1.000 0.000 0.000
#> GSM151420     1  0.0000     0.9985 1.000 0.000 0.000
#> GSM151421     1  0.0000     0.9985 1.000 0.000 0.000
#> GSM151422     1  0.0000     0.9985 1.000 0.000 0.000
#> GSM151423     3  0.0000     0.9269 0.000 0.000 1.000
#> GSM151424     3  0.2796     0.8713 0.000 0.092 0.908
#> GSM151425     3  0.1411     0.9136 0.000 0.036 0.964
#> GSM151426     3  0.5835     0.5456 0.000 0.340 0.660
#> GSM151427     3  0.0000     0.9269 0.000 0.000 1.000
#> GSM151428     1  0.0000     0.9985 1.000 0.000 0.000
#> GSM151429     2  0.6204     0.2750 0.424 0.576 0.000
#> GSM151430     2  0.0000     0.7874 0.000 1.000 0.000
#> GSM151431     2  0.0000     0.7874 0.000 1.000 0.000
#> GSM151432     1  0.0000     0.9985 1.000 0.000 0.000
#> GSM151433     1  0.0000     0.9985 1.000 0.000 0.000
#> GSM151434     1  0.0000     0.9985 1.000 0.000 0.000
#> GSM151435     1  0.0000     0.9985 1.000 0.000 0.000
#> GSM151436     3  0.1031     0.9176 0.000 0.024 0.976
#> GSM151437     1  0.0000     0.9985 1.000 0.000 0.000
#> GSM151438     1  0.0000     0.9985 1.000 0.000 0.000
#> GSM151439     1  0.0000     0.9985 1.000 0.000 0.000
#> GSM151440     3  0.3192     0.8446 0.000 0.112 0.888

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM151369     1  0.0469     0.9528 0.988 0.012 0.000 0.000
#> GSM151370     3  0.5855     0.0865 0.000 0.356 0.600 0.044
#> GSM151371     1  0.0000     0.9620 1.000 0.000 0.000 0.000
#> GSM151372     3  0.0895     0.8585 0.000 0.020 0.976 0.004
#> GSM151373     3  0.1211     0.8467 0.000 0.040 0.960 0.000
#> GSM151374     3  0.0000     0.8718 0.000 0.000 1.000 0.000
#> GSM151375     3  0.0000     0.8718 0.000 0.000 1.000 0.000
#> GSM151376     3  0.0000     0.8718 0.000 0.000 1.000 0.000
#> GSM151377     3  0.0000     0.8718 0.000 0.000 1.000 0.000
#> GSM151378     3  0.0000     0.8718 0.000 0.000 1.000 0.000
#> GSM151379     3  0.0000     0.8718 0.000 0.000 1.000 0.000
#> GSM151380     2  0.8937     0.1833 0.316 0.436 0.100 0.148
#> GSM151381     3  0.0188     0.8696 0.000 0.004 0.996 0.000
#> GSM151382     3  0.0895     0.8585 0.000 0.020 0.976 0.004
#> GSM151383     4  0.0000     0.8908 0.000 0.000 0.000 1.000
#> GSM151384     1  0.0000     0.9620 1.000 0.000 0.000 0.000
#> GSM151385     1  0.0000     0.9620 1.000 0.000 0.000 0.000
#> GSM151386     1  0.0000     0.9620 1.000 0.000 0.000 0.000
#> GSM151387     3  0.6468    -0.0337 0.000 0.348 0.568 0.084
#> GSM151388     2  0.7246     0.3624 0.000 0.448 0.408 0.144
#> GSM151389     3  0.1022     0.8478 0.000 0.032 0.968 0.000
#> GSM151390     3  0.0000     0.8718 0.000 0.000 1.000 0.000
#> GSM151391     3  0.3037     0.7479 0.000 0.100 0.880 0.020
#> GSM151392     2  0.6687     0.3342 0.036 0.508 0.428 0.028
#> GSM151393     3  0.0000     0.8718 0.000 0.000 1.000 0.000
#> GSM151394     1  0.0000     0.9620 1.000 0.000 0.000 0.000
#> GSM151395     2  0.5453     0.0963 0.320 0.648 0.000 0.032
#> GSM151396     2  0.5557     0.3908 0.000 0.652 0.308 0.040
#> GSM151397     1  0.0000     0.9620 1.000 0.000 0.000 0.000
#> GSM151398     1  0.0188     0.9591 0.996 0.004 0.000 0.000
#> GSM151399     2  0.7101     0.3878 0.000 0.504 0.360 0.136
#> GSM151400     1  0.4327     0.7256 0.768 0.216 0.000 0.016
#> GSM151401     3  0.1557     0.8343 0.000 0.056 0.944 0.000
#> GSM151402     3  0.0000     0.8718 0.000 0.000 1.000 0.000
#> GSM151403     3  0.0188     0.8696 0.000 0.004 0.996 0.000
#> GSM151404     1  0.1716     0.9039 0.936 0.064 0.000 0.000
#> GSM151405     2  0.6034     0.3687 0.000 0.688 0.148 0.164
#> GSM151406     3  0.3945     0.5722 0.000 0.216 0.780 0.004
#> GSM151407     4  0.0188     0.8863 0.000 0.000 0.004 0.996
#> GSM151408     4  0.0000     0.8908 0.000 0.000 0.000 1.000
#> GSM151409     1  0.0000     0.9620 1.000 0.000 0.000 0.000
#> GSM151410     4  0.0000     0.8908 0.000 0.000 0.000 1.000
#> GSM151411     1  0.0000     0.9620 1.000 0.000 0.000 0.000
#> GSM151412     3  0.3870     0.6262 0.000 0.208 0.788 0.004
#> GSM151413     1  0.0000     0.9620 1.000 0.000 0.000 0.000
#> GSM151414     1  0.0000     0.9620 1.000 0.000 0.000 0.000
#> GSM151415     1  0.0000     0.9620 1.000 0.000 0.000 0.000
#> GSM151416     4  0.4399     0.6344 0.212 0.020 0.000 0.768
#> GSM151417     1  0.0000     0.9620 1.000 0.000 0.000 0.000
#> GSM151418     3  0.0000     0.8718 0.000 0.000 1.000 0.000
#> GSM151419     1  0.0000     0.9620 1.000 0.000 0.000 0.000
#> GSM151420     1  0.0000     0.9620 1.000 0.000 0.000 0.000
#> GSM151421     1  0.4164     0.6752 0.736 0.264 0.000 0.000
#> GSM151422     1  0.0000     0.9620 1.000 0.000 0.000 0.000
#> GSM151423     3  0.0000     0.8718 0.000 0.000 1.000 0.000
#> GSM151424     2  0.6214     0.1504 0.000 0.476 0.472 0.052
#> GSM151425     3  0.6031    -0.0514 0.000 0.420 0.536 0.044
#> GSM151426     2  0.7210     0.3690 0.000 0.456 0.404 0.140
#> GSM151427     3  0.0000     0.8718 0.000 0.000 1.000 0.000
#> GSM151428     1  0.0000     0.9620 1.000 0.000 0.000 0.000
#> GSM151429     4  0.6429     0.5813 0.144 0.212 0.000 0.644
#> GSM151430     4  0.0000     0.8908 0.000 0.000 0.000 1.000
#> GSM151431     4  0.0000     0.8908 0.000 0.000 0.000 1.000
#> GSM151432     1  0.0000     0.9620 1.000 0.000 0.000 0.000
#> GSM151433     1  0.0000     0.9620 1.000 0.000 0.000 0.000
#> GSM151434     1  0.0000     0.9620 1.000 0.000 0.000 0.000
#> GSM151435     1  0.0000     0.9620 1.000 0.000 0.000 0.000
#> GSM151436     3  0.2266     0.7980 0.000 0.084 0.912 0.004
#> GSM151437     1  0.0000     0.9620 1.000 0.000 0.000 0.000
#> GSM151438     1  0.0000     0.9620 1.000 0.000 0.000 0.000
#> GSM151439     1  0.4907     0.4009 0.580 0.420 0.000 0.000
#> GSM151440     3  0.4344     0.6810 0.000 0.108 0.816 0.076

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>           class entropy silhouette    p1    p2    p3    p4    p5
#> GSM151369     1  0.2848     0.8248 0.868 0.028 0.000 0.000 0.104
#> GSM151370     5  0.5852     0.3479 0.000 0.052 0.428 0.020 0.500
#> GSM151371     1  0.0579     0.9363 0.984 0.008 0.000 0.000 0.008
#> GSM151372     3  0.1668     0.8819 0.000 0.028 0.940 0.000 0.032
#> GSM151373     3  0.2650     0.8485 0.000 0.068 0.892 0.004 0.036
#> GSM151374     3  0.0000     0.9043 0.000 0.000 1.000 0.000 0.000
#> GSM151375     3  0.0162     0.9044 0.000 0.000 0.996 0.000 0.004
#> GSM151376     3  0.0162     0.9044 0.000 0.000 0.996 0.000 0.004
#> GSM151377     3  0.0324     0.9041 0.000 0.004 0.992 0.000 0.004
#> GSM151378     3  0.0451     0.9030 0.000 0.004 0.988 0.000 0.008
#> GSM151379     3  0.0451     0.9030 0.000 0.004 0.988 0.000 0.008
#> GSM151380     5  0.4753     0.3869 0.108 0.036 0.032 0.032 0.792
#> GSM151381     3  0.1282     0.8817 0.000 0.004 0.952 0.000 0.044
#> GSM151382     3  0.1854     0.8804 0.000 0.020 0.936 0.008 0.036
#> GSM151383     4  0.0000     0.8525 0.000 0.000 0.000 1.000 0.000
#> GSM151384     1  0.0000     0.9465 1.000 0.000 0.000 0.000 0.000
#> GSM151385     1  0.0000     0.9465 1.000 0.000 0.000 0.000 0.000
#> GSM151386     1  0.0000     0.9465 1.000 0.000 0.000 0.000 0.000
#> GSM151387     5  0.6243     0.3808 0.000 0.044 0.408 0.052 0.496
#> GSM151388     5  0.5103     0.5459 0.000 0.036 0.160 0.068 0.736
#> GSM151389     3  0.0671     0.8979 0.000 0.004 0.980 0.000 0.016
#> GSM151390     3  0.0162     0.9048 0.000 0.000 0.996 0.000 0.004
#> GSM151391     3  0.4314     0.5984 0.000 0.016 0.760 0.028 0.196
#> GSM151392     5  0.4449     0.4870 0.012 0.068 0.132 0.004 0.784
#> GSM151393     3  0.0162     0.9039 0.000 0.004 0.996 0.000 0.000
#> GSM151394     1  0.0000     0.9465 1.000 0.000 0.000 0.000 0.000
#> GSM151395     2  0.2735     0.4027 0.084 0.880 0.000 0.000 0.036
#> GSM151396     2  0.4062     0.4191 0.000 0.820 0.068 0.028 0.084
#> GSM151397     1  0.0000     0.9465 1.000 0.000 0.000 0.000 0.000
#> GSM151398     1  0.0510     0.9354 0.984 0.000 0.000 0.000 0.016
#> GSM151399     2  0.7566     0.0689 0.000 0.388 0.160 0.072 0.380
#> GSM151400     1  0.5473     0.4523 0.628 0.300 0.000 0.016 0.056
#> GSM151401     3  0.3248     0.8133 0.000 0.104 0.852 0.004 0.040
#> GSM151402     3  0.0162     0.9039 0.000 0.004 0.996 0.000 0.000
#> GSM151403     3  0.0162     0.9039 0.000 0.004 0.996 0.000 0.000
#> GSM151404     1  0.4354     0.6161 0.712 0.032 0.000 0.000 0.256
#> GSM151405     5  0.4813     0.4095 0.000 0.136 0.040 0.060 0.764
#> GSM151406     3  0.3861     0.5309 0.000 0.008 0.728 0.000 0.264
#> GSM151407     4  0.0000     0.8525 0.000 0.000 0.000 1.000 0.000
#> GSM151408     4  0.0000     0.8525 0.000 0.000 0.000 1.000 0.000
#> GSM151409     1  0.0000     0.9465 1.000 0.000 0.000 0.000 0.000
#> GSM151410     4  0.0000     0.8525 0.000 0.000 0.000 1.000 0.000
#> GSM151411     1  0.0000     0.9465 1.000 0.000 0.000 0.000 0.000
#> GSM151412     3  0.5432     0.5149 0.000 0.256 0.656 0.012 0.076
#> GSM151413     1  0.0000     0.9465 1.000 0.000 0.000 0.000 0.000
#> GSM151414     1  0.0000     0.9465 1.000 0.000 0.000 0.000 0.000
#> GSM151415     1  0.0000     0.9465 1.000 0.000 0.000 0.000 0.000
#> GSM151416     4  0.6223     0.4353 0.260 0.056 0.000 0.612 0.072
#> GSM151417     1  0.0000     0.9465 1.000 0.000 0.000 0.000 0.000
#> GSM151418     3  0.0162     0.9039 0.000 0.004 0.996 0.000 0.000
#> GSM151419     1  0.0000     0.9465 1.000 0.000 0.000 0.000 0.000
#> GSM151420     1  0.0000     0.9465 1.000 0.000 0.000 0.000 0.000
#> GSM151421     1  0.4650     0.1390 0.520 0.468 0.000 0.000 0.012
#> GSM151422     1  0.0000     0.9465 1.000 0.000 0.000 0.000 0.000
#> GSM151423     3  0.0162     0.9039 0.000 0.004 0.996 0.000 0.000
#> GSM151424     2  0.6689     0.2680 0.000 0.556 0.288 0.056 0.100
#> GSM151425     2  0.7626     0.0258 0.000 0.376 0.232 0.052 0.340
#> GSM151426     5  0.6304     0.5105 0.000 0.056 0.180 0.124 0.640
#> GSM151427     3  0.0290     0.9037 0.000 0.000 0.992 0.000 0.008
#> GSM151428     1  0.0579     0.9361 0.984 0.008 0.000 0.000 0.008
#> GSM151429     4  0.6471     0.3750 0.144 0.304 0.000 0.536 0.016
#> GSM151430     4  0.0000     0.8525 0.000 0.000 0.000 1.000 0.000
#> GSM151431     4  0.0000     0.8525 0.000 0.000 0.000 1.000 0.000
#> GSM151432     1  0.0000     0.9465 1.000 0.000 0.000 0.000 0.000
#> GSM151433     1  0.0000     0.9465 1.000 0.000 0.000 0.000 0.000
#> GSM151434     1  0.0000     0.9465 1.000 0.000 0.000 0.000 0.000
#> GSM151435     1  0.0000     0.9465 1.000 0.000 0.000 0.000 0.000
#> GSM151436     3  0.3478     0.8113 0.000 0.096 0.848 0.016 0.040
#> GSM151437     1  0.0000     0.9465 1.000 0.000 0.000 0.000 0.000
#> GSM151438     1  0.0000     0.9465 1.000 0.000 0.000 0.000 0.000
#> GSM151439     2  0.4380     0.2683 0.304 0.676 0.000 0.000 0.020
#> GSM151440     3  0.5586     0.6200 0.000 0.148 0.704 0.108 0.040

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>           class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM151369     1  0.4765     0.4982 0.672 0.012 0.000 0.000 0.244 0.072
#> GSM151370     5  0.6475     0.1765 0.000 0.184 0.352 0.016 0.436 0.012
#> GSM151371     1  0.2784     0.7954 0.848 0.008 0.000 0.000 0.012 0.132
#> GSM151372     3  0.2581     0.8008 0.000 0.120 0.860 0.000 0.000 0.020
#> GSM151373     3  0.2859     0.7732 0.000 0.156 0.828 0.000 0.000 0.016
#> GSM151374     3  0.0000     0.8581 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM151375     3  0.0820     0.8577 0.000 0.016 0.972 0.000 0.000 0.012
#> GSM151376     3  0.0820     0.8577 0.000 0.016 0.972 0.000 0.000 0.012
#> GSM151377     3  0.0622     0.8559 0.000 0.008 0.980 0.000 0.000 0.012
#> GSM151378     3  0.0603     0.8584 0.000 0.016 0.980 0.000 0.000 0.004
#> GSM151379     3  0.0603     0.8584 0.000 0.016 0.980 0.000 0.000 0.004
#> GSM151380     5  0.4186     0.3565 0.064 0.036 0.000 0.024 0.804 0.072
#> GSM151381     3  0.2007     0.8356 0.000 0.032 0.920 0.000 0.036 0.012
#> GSM151382     3  0.2311     0.8126 0.000 0.104 0.880 0.000 0.000 0.016
#> GSM151383     4  0.0405     0.8852 0.000 0.008 0.000 0.988 0.000 0.004
#> GSM151384     1  0.0547     0.9040 0.980 0.000 0.000 0.000 0.000 0.020
#> GSM151385     1  0.0000     0.9093 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM151386     1  0.0547     0.9046 0.980 0.000 0.000 0.000 0.000 0.020
#> GSM151387     5  0.6997     0.2685 0.000 0.240 0.288 0.032 0.420 0.020
#> GSM151388     5  0.6247     0.4379 0.000 0.288 0.072 0.036 0.564 0.040
#> GSM151389     3  0.2068     0.8205 0.000 0.020 0.916 0.000 0.048 0.016
#> GSM151390     3  0.1297     0.8551 0.000 0.040 0.948 0.000 0.000 0.012
#> GSM151391     3  0.5779     0.3980 0.000 0.176 0.644 0.024 0.132 0.024
#> GSM151392     5  0.3637     0.3995 0.004 0.056 0.056 0.000 0.832 0.052
#> GSM151393     3  0.0405     0.8576 0.000 0.004 0.988 0.000 0.000 0.008
#> GSM151394     1  0.1542     0.8837 0.936 0.004 0.000 0.000 0.008 0.052
#> GSM151395     6  0.4367    -0.0791 0.032 0.364 0.000 0.000 0.000 0.604
#> GSM151396     2  0.5082     0.2341 0.000 0.536 0.032 0.004 0.020 0.408
#> GSM151397     1  0.0146     0.9088 0.996 0.000 0.000 0.000 0.000 0.004
#> GSM151398     1  0.1549     0.8810 0.936 0.000 0.000 0.000 0.020 0.044
#> GSM151399     2  0.6472     0.4264 0.000 0.612 0.156 0.060 0.128 0.044
#> GSM151400     1  0.6748    -0.1039 0.504 0.096 0.000 0.028 0.064 0.308
#> GSM151401     3  0.3311     0.7264 0.000 0.204 0.780 0.000 0.004 0.012
#> GSM151402     3  0.0146     0.8581 0.000 0.000 0.996 0.000 0.000 0.004
#> GSM151403     3  0.0881     0.8545 0.000 0.008 0.972 0.000 0.008 0.012
#> GSM151404     1  0.5465     0.2740 0.564 0.016 0.000 0.000 0.324 0.096
#> GSM151405     5  0.5700     0.3707 0.000 0.228 0.036 0.024 0.640 0.072
#> GSM151406     3  0.5211     0.4391 0.000 0.100 0.652 0.000 0.224 0.024
#> GSM151407     4  0.0260     0.8856 0.000 0.008 0.000 0.992 0.000 0.000
#> GSM151408     4  0.0146     0.8871 0.000 0.004 0.000 0.996 0.000 0.000
#> GSM151409     1  0.0363     0.9070 0.988 0.000 0.000 0.000 0.000 0.012
#> GSM151410     4  0.0405     0.8826 0.000 0.008 0.000 0.988 0.000 0.004
#> GSM151411     1  0.1340     0.8910 0.948 0.004 0.000 0.000 0.008 0.040
#> GSM151412     3  0.4208     0.1841 0.000 0.452 0.536 0.000 0.008 0.004
#> GSM151413     1  0.0000     0.9093 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM151414     1  0.0000     0.9093 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM151415     1  0.0000     0.9093 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM151416     4  0.7792    -0.0202 0.204 0.064 0.000 0.440 0.084 0.208
#> GSM151417     1  0.1010     0.8930 0.960 0.004 0.000 0.000 0.000 0.036
#> GSM151418     3  0.0820     0.8562 0.000 0.012 0.972 0.000 0.000 0.016
#> GSM151419     1  0.0000     0.9093 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM151420     1  0.0146     0.9089 0.996 0.000 0.000 0.000 0.000 0.004
#> GSM151421     6  0.3944     0.2907 0.428 0.004 0.000 0.000 0.000 0.568
#> GSM151422     1  0.0146     0.9088 0.996 0.000 0.000 0.000 0.000 0.004
#> GSM151423     3  0.0363     0.8573 0.000 0.000 0.988 0.000 0.000 0.012
#> GSM151424     2  0.6556     0.5215 0.000 0.556 0.192 0.052 0.016 0.184
#> GSM151425     2  0.5779     0.3180 0.000 0.656 0.172 0.020 0.108 0.044
#> GSM151426     5  0.6808     0.3856 0.000 0.332 0.112 0.064 0.472 0.020
#> GSM151427     3  0.0603     0.8584 0.000 0.016 0.980 0.000 0.000 0.004
#> GSM151428     1  0.2726     0.7926 0.848 0.008 0.000 0.000 0.008 0.136
#> GSM151429     6  0.6325     0.1003 0.112 0.032 0.000 0.336 0.016 0.504
#> GSM151430     4  0.0146     0.8871 0.000 0.004 0.000 0.996 0.000 0.000
#> GSM151431     4  0.0146     0.8847 0.000 0.004 0.000 0.996 0.000 0.000
#> GSM151432     1  0.0632     0.9044 0.976 0.000 0.000 0.000 0.000 0.024
#> GSM151433     1  0.0632     0.9041 0.976 0.000 0.000 0.000 0.000 0.024
#> GSM151434     1  0.1141     0.8855 0.948 0.000 0.000 0.000 0.000 0.052
#> GSM151435     1  0.0000     0.9093 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM151436     3  0.3454     0.7135 0.000 0.208 0.768 0.000 0.000 0.024
#> GSM151437     1  0.0146     0.9089 0.996 0.000 0.000 0.000 0.000 0.004
#> GSM151438     1  0.0000     0.9093 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM151439     6  0.4253     0.3859 0.160 0.108 0.000 0.000 0.000 0.732
#> GSM151440     3  0.5466     0.4878 0.000 0.240 0.628 0.096 0.000 0.036

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

consensus_heatmap(res, k = 2)

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

consensus_heatmap(res, k = 3)

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

consensus_heatmap(res, k = 4)

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

consensus_heatmap(res, k = 5)

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

consensus_heatmap(res, k = 6)

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

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

membership_heatmap(res, k = 2)

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

membership_heatmap(res, k = 3)

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

membership_heatmap(res, k = 4)

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

membership_heatmap(res, k = 5)

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

membership_heatmap(res, k = 6)

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

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

Signature heatmaps where rows are scaled:

get_signatures(res, k = 2)

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

get_signatures(res, k = 3)

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

get_signatures(res, k = 4)

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

get_signatures(res, k = 5)

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

get_signatures(res, k = 6)

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

Signature heatmaps where rows are not scaled:

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

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

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

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

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

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

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

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

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

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

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk ATC-skmeans-signature_compare

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

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

An example of the output of tb is:

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

The columns in tb are:

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

UMAP plot which shows how samples are separated.

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

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

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

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

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

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

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

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

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

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

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk ATC-skmeans-collect-classes

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

test_to_known_factors(res)
#>              n disease.state(p) k
#> ATC:skmeans 71            0.201 2
#> ATC:skmeans 69            0.172 3
#> ATC:skmeans 59            0.181 4
#> ATC:skmeans 57            0.307 5
#> ATC:skmeans 50            0.174 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 17730 rows and 72 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 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-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.999       1.000         0.4604 0.540   0.540
#> 3 3 0.894           0.894       0.953         0.3915 0.812   0.652
#> 4 4 0.783           0.801       0.904         0.1160 0.923   0.789
#> 5 5 0.748           0.761       0.851         0.0790 0.926   0.757
#> 6 6 0.716           0.628       0.788         0.0624 0.919   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
#> GSM151369     1   0.000      1.000 1.000 0.000
#> GSM151370     2   0.000      0.999 0.000 1.000
#> GSM151371     1   0.000      1.000 1.000 0.000
#> GSM151372     2   0.000      0.999 0.000 1.000
#> GSM151373     2   0.000      0.999 0.000 1.000
#> GSM151374     2   0.000      0.999 0.000 1.000
#> GSM151375     2   0.000      0.999 0.000 1.000
#> GSM151376     2   0.000      0.999 0.000 1.000
#> GSM151377     2   0.000      0.999 0.000 1.000
#> GSM151378     2   0.000      0.999 0.000 1.000
#> GSM151379     2   0.000      0.999 0.000 1.000
#> GSM151380     2   0.000      0.999 0.000 1.000
#> GSM151381     2   0.000      0.999 0.000 1.000
#> GSM151382     2   0.000      0.999 0.000 1.000
#> GSM151383     2   0.000      0.999 0.000 1.000
#> GSM151384     1   0.000      1.000 1.000 0.000
#> GSM151385     1   0.000      1.000 1.000 0.000
#> GSM151386     1   0.000      1.000 1.000 0.000
#> GSM151387     2   0.000      0.999 0.000 1.000
#> GSM151388     2   0.000      0.999 0.000 1.000
#> GSM151389     2   0.000      0.999 0.000 1.000
#> GSM151390     2   0.000      0.999 0.000 1.000
#> GSM151391     2   0.000      0.999 0.000 1.000
#> GSM151392     2   0.000      0.999 0.000 1.000
#> GSM151393     2   0.000      0.999 0.000 1.000
#> GSM151394     1   0.000      1.000 1.000 0.000
#> GSM151395     2   0.000      0.999 0.000 1.000
#> GSM151396     2   0.000      0.999 0.000 1.000
#> GSM151397     1   0.000      1.000 1.000 0.000
#> GSM151398     1   0.000      1.000 1.000 0.000
#> GSM151399     2   0.000      0.999 0.000 1.000
#> GSM151400     2   0.000      0.999 0.000 1.000
#> GSM151401     2   0.000      0.999 0.000 1.000
#> GSM151402     2   0.000      0.999 0.000 1.000
#> GSM151403     2   0.000      0.999 0.000 1.000
#> GSM151404     1   0.000      1.000 1.000 0.000
#> GSM151405     2   0.000      0.999 0.000 1.000
#> GSM151406     2   0.000      0.999 0.000 1.000
#> GSM151407     2   0.000      0.999 0.000 1.000
#> GSM151408     2   0.000      0.999 0.000 1.000
#> GSM151409     1   0.000      1.000 1.000 0.000
#> GSM151410     2   0.000      0.999 0.000 1.000
#> GSM151411     1   0.000      1.000 1.000 0.000
#> GSM151412     2   0.000      0.999 0.000 1.000
#> GSM151413     1   0.000      1.000 1.000 0.000
#> GSM151414     1   0.000      1.000 1.000 0.000
#> GSM151415     1   0.000      1.000 1.000 0.000
#> GSM151416     2   0.000      0.999 0.000 1.000
#> GSM151417     1   0.000      1.000 1.000 0.000
#> GSM151418     2   0.000      0.999 0.000 1.000
#> GSM151419     1   0.000      1.000 1.000 0.000
#> GSM151420     1   0.000      1.000 1.000 0.000
#> GSM151421     2   0.163      0.975 0.024 0.976
#> GSM151422     1   0.000      1.000 1.000 0.000
#> GSM151423     2   0.000      0.999 0.000 1.000
#> GSM151424     2   0.000      0.999 0.000 1.000
#> GSM151425     2   0.000      0.999 0.000 1.000
#> GSM151426     2   0.000      0.999 0.000 1.000
#> GSM151427     2   0.000      0.999 0.000 1.000
#> GSM151428     1   0.000      1.000 1.000 0.000
#> GSM151429     2   0.000      0.999 0.000 1.000
#> GSM151430     2   0.000      0.999 0.000 1.000
#> GSM151431     2   0.000      0.999 0.000 1.000
#> GSM151432     1   0.000      1.000 1.000 0.000
#> GSM151433     1   0.000      1.000 1.000 0.000
#> GSM151434     1   0.000      1.000 1.000 0.000
#> GSM151435     1   0.000      1.000 1.000 0.000
#> GSM151436     2   0.000      0.999 0.000 1.000
#> GSM151437     1   0.000      1.000 1.000 0.000
#> GSM151438     1   0.000      1.000 1.000 0.000
#> GSM151439     2   0.000      0.999 0.000 1.000
#> GSM151440     2   0.000      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
#> GSM151369     1  0.0747      0.982 0.984 0.000 0.016
#> GSM151370     2  0.0237      0.944 0.000 0.996 0.004
#> GSM151371     1  0.0000      0.997 1.000 0.000 0.000
#> GSM151372     2  0.4702      0.704 0.000 0.788 0.212
#> GSM151373     3  0.2356      0.827 0.000 0.072 0.928
#> GSM151374     3  0.0000      0.849 0.000 0.000 1.000
#> GSM151375     3  0.2625      0.822 0.000 0.084 0.916
#> GSM151376     3  0.6168      0.369 0.000 0.412 0.588
#> GSM151377     3  0.0000      0.849 0.000 0.000 1.000
#> GSM151378     3  0.0000      0.849 0.000 0.000 1.000
#> GSM151379     3  0.0000      0.849 0.000 0.000 1.000
#> GSM151380     2  0.0000      0.946 0.000 1.000 0.000
#> GSM151381     2  0.2537      0.883 0.000 0.920 0.080
#> GSM151382     2  0.5733      0.469 0.000 0.676 0.324
#> GSM151383     2  0.0000      0.946 0.000 1.000 0.000
#> GSM151384     1  0.0000      0.997 1.000 0.000 0.000
#> GSM151385     1  0.0000      0.997 1.000 0.000 0.000
#> GSM151386     1  0.0000      0.997 1.000 0.000 0.000
#> GSM151387     3  0.6302      0.230 0.000 0.480 0.520
#> GSM151388     2  0.0000      0.946 0.000 1.000 0.000
#> GSM151389     3  0.5058      0.687 0.000 0.244 0.756
#> GSM151390     2  0.5291      0.605 0.000 0.732 0.268
#> GSM151391     2  0.0000      0.946 0.000 1.000 0.000
#> GSM151392     2  0.0747      0.936 0.000 0.984 0.016
#> GSM151393     3  0.0000      0.849 0.000 0.000 1.000
#> GSM151394     1  0.0000      0.997 1.000 0.000 0.000
#> GSM151395     2  0.0000      0.946 0.000 1.000 0.000
#> GSM151396     2  0.0000      0.946 0.000 1.000 0.000
#> GSM151397     1  0.0000      0.997 1.000 0.000 0.000
#> GSM151398     1  0.0000      0.997 1.000 0.000 0.000
#> GSM151399     2  0.0000      0.946 0.000 1.000 0.000
#> GSM151400     2  0.0000      0.946 0.000 1.000 0.000
#> GSM151401     2  0.5016      0.657 0.000 0.760 0.240
#> GSM151402     3  0.0000      0.849 0.000 0.000 1.000
#> GSM151403     3  0.5760      0.571 0.000 0.328 0.672
#> GSM151404     1  0.0000      0.997 1.000 0.000 0.000
#> GSM151405     2  0.0000      0.946 0.000 1.000 0.000
#> GSM151406     2  0.0424      0.942 0.000 0.992 0.008
#> GSM151407     2  0.0000      0.946 0.000 1.000 0.000
#> GSM151408     2  0.0000      0.946 0.000 1.000 0.000
#> GSM151409     1  0.0000      0.997 1.000 0.000 0.000
#> GSM151410     2  0.0000      0.946 0.000 1.000 0.000
#> GSM151411     1  0.0000      0.997 1.000 0.000 0.000
#> GSM151412     2  0.1289      0.925 0.000 0.968 0.032
#> GSM151413     1  0.0000      0.997 1.000 0.000 0.000
#> GSM151414     1  0.0000      0.997 1.000 0.000 0.000
#> GSM151415     1  0.0000      0.997 1.000 0.000 0.000
#> GSM151416     2  0.0000      0.946 0.000 1.000 0.000
#> GSM151417     1  0.0000      0.997 1.000 0.000 0.000
#> GSM151418     3  0.5706      0.547 0.000 0.320 0.680
#> GSM151419     1  0.0000      0.997 1.000 0.000 0.000
#> GSM151420     1  0.0000      0.997 1.000 0.000 0.000
#> GSM151421     2  0.1643      0.905 0.044 0.956 0.000
#> GSM151422     1  0.0000      0.997 1.000 0.000 0.000
#> GSM151423     3  0.0000      0.849 0.000 0.000 1.000
#> GSM151424     2  0.0000      0.946 0.000 1.000 0.000
#> GSM151425     2  0.0000      0.946 0.000 1.000 0.000
#> GSM151426     2  0.3267      0.825 0.000 0.884 0.116
#> GSM151427     3  0.0000      0.849 0.000 0.000 1.000
#> GSM151428     1  0.1529      0.952 0.960 0.040 0.000
#> GSM151429     2  0.0000      0.946 0.000 1.000 0.000
#> GSM151430     2  0.0000      0.946 0.000 1.000 0.000
#> GSM151431     2  0.0000      0.946 0.000 1.000 0.000
#> GSM151432     1  0.0000      0.997 1.000 0.000 0.000
#> GSM151433     1  0.0000      0.997 1.000 0.000 0.000
#> GSM151434     1  0.0000      0.997 1.000 0.000 0.000
#> GSM151435     1  0.0000      0.997 1.000 0.000 0.000
#> GSM151436     2  0.1289      0.925 0.000 0.968 0.032
#> GSM151437     1  0.0000      0.997 1.000 0.000 0.000
#> GSM151438     1  0.0000      0.997 1.000 0.000 0.000
#> GSM151439     2  0.0000      0.946 0.000 1.000 0.000
#> GSM151440     2  0.0000      0.946 0.000 1.000 0.000

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM151369     1  0.2216      0.891 0.908 0.000 0.092 0.000
#> GSM151370     2  0.2921      0.812 0.000 0.860 0.140 0.000
#> GSM151371     1  0.0000      0.977 1.000 0.000 0.000 0.000
#> GSM151372     2  0.4888      0.440 0.000 0.588 0.412 0.000
#> GSM151373     4  0.0188      0.924 0.000 0.000 0.004 0.996
#> GSM151374     4  0.0000      0.927 0.000 0.000 0.000 1.000
#> GSM151375     3  0.2647      0.712 0.000 0.000 0.880 0.120
#> GSM151376     3  0.1637      0.749 0.000 0.000 0.940 0.060
#> GSM151377     3  0.3486      0.662 0.000 0.000 0.812 0.188
#> GSM151378     4  0.0000      0.927 0.000 0.000 0.000 1.000
#> GSM151379     4  0.0000      0.927 0.000 0.000 0.000 1.000
#> GSM151380     2  0.4331      0.507 0.000 0.712 0.288 0.000
#> GSM151381     3  0.0592      0.745 0.000 0.016 0.984 0.000
#> GSM151382     2  0.7033      0.361 0.000 0.508 0.128 0.364
#> GSM151383     2  0.0188      0.824 0.000 0.996 0.004 0.000
#> GSM151384     1  0.0000      0.977 1.000 0.000 0.000 0.000
#> GSM151385     1  0.0000      0.977 1.000 0.000 0.000 0.000
#> GSM151386     1  0.0000      0.977 1.000 0.000 0.000 0.000
#> GSM151387     4  0.5478      0.437 0.000 0.344 0.028 0.628
#> GSM151388     2  0.4406      0.517 0.000 0.700 0.300 0.000
#> GSM151389     3  0.1389      0.751 0.000 0.000 0.952 0.048
#> GSM151390     3  0.4193      0.462 0.000 0.268 0.732 0.000
#> GSM151391     2  0.4761      0.497 0.000 0.628 0.372 0.000
#> GSM151392     3  0.4830      0.210 0.000 0.392 0.608 0.000
#> GSM151393     4  0.0000      0.927 0.000 0.000 0.000 1.000
#> GSM151394     1  0.0000      0.977 1.000 0.000 0.000 0.000
#> GSM151395     2  0.2469      0.824 0.000 0.892 0.108 0.000
#> GSM151396     2  0.2589      0.823 0.000 0.884 0.116 0.000
#> GSM151397     1  0.0000      0.977 1.000 0.000 0.000 0.000
#> GSM151398     1  0.0000      0.977 1.000 0.000 0.000 0.000
#> GSM151399     2  0.2589      0.823 0.000 0.884 0.116 0.000
#> GSM151400     2  0.0469      0.827 0.000 0.988 0.012 0.000
#> GSM151401     2  0.6924      0.525 0.000 0.588 0.180 0.232
#> GSM151402     4  0.0000      0.927 0.000 0.000 0.000 1.000
#> GSM151403     3  0.0336      0.750 0.000 0.000 0.992 0.008
#> GSM151404     1  0.4401      0.613 0.724 0.004 0.272 0.000
#> GSM151405     2  0.0921      0.828 0.000 0.972 0.028 0.000
#> GSM151406     3  0.4522      0.277 0.000 0.320 0.680 0.000
#> GSM151407     2  0.0188      0.824 0.000 0.996 0.004 0.000
#> GSM151408     2  0.0188      0.824 0.000 0.996 0.004 0.000
#> GSM151409     1  0.0000      0.977 1.000 0.000 0.000 0.000
#> GSM151410     2  0.0188      0.824 0.000 0.996 0.004 0.000
#> GSM151411     1  0.0000      0.977 1.000 0.000 0.000 0.000
#> GSM151412     2  0.4222      0.686 0.000 0.728 0.272 0.000
#> GSM151413     1  0.0000      0.977 1.000 0.000 0.000 0.000
#> GSM151414     1  0.0000      0.977 1.000 0.000 0.000 0.000
#> GSM151415     1  0.0000      0.977 1.000 0.000 0.000 0.000
#> GSM151416     2  0.0188      0.824 0.000 0.996 0.004 0.000
#> GSM151417     1  0.0000      0.977 1.000 0.000 0.000 0.000
#> GSM151418     3  0.2466      0.731 0.000 0.004 0.900 0.096
#> GSM151419     1  0.0000      0.977 1.000 0.000 0.000 0.000
#> GSM151420     1  0.0000      0.977 1.000 0.000 0.000 0.000
#> GSM151421     2  0.3647      0.805 0.040 0.852 0.108 0.000
#> GSM151422     1  0.0000      0.977 1.000 0.000 0.000 0.000
#> GSM151423     3  0.4585      0.481 0.000 0.000 0.668 0.332
#> GSM151424     2  0.2589      0.823 0.000 0.884 0.116 0.000
#> GSM151425     2  0.2469      0.824 0.000 0.892 0.108 0.000
#> GSM151426     2  0.3196      0.716 0.000 0.856 0.008 0.136
#> GSM151427     4  0.0000      0.927 0.000 0.000 0.000 1.000
#> GSM151428     1  0.2868      0.817 0.864 0.136 0.000 0.000
#> GSM151429     2  0.0188      0.826 0.000 0.996 0.004 0.000
#> GSM151430     2  0.0188      0.824 0.000 0.996 0.004 0.000
#> GSM151431     2  0.0188      0.824 0.000 0.996 0.004 0.000
#> GSM151432     1  0.0000      0.977 1.000 0.000 0.000 0.000
#> GSM151433     1  0.0000      0.977 1.000 0.000 0.000 0.000
#> GSM151434     1  0.0000      0.977 1.000 0.000 0.000 0.000
#> GSM151435     1  0.0000      0.977 1.000 0.000 0.000 0.000
#> GSM151436     2  0.4730      0.541 0.000 0.636 0.364 0.000
#> GSM151437     1  0.0000      0.977 1.000 0.000 0.000 0.000
#> GSM151438     1  0.0000      0.977 1.000 0.000 0.000 0.000
#> GSM151439     2  0.2589      0.823 0.000 0.884 0.116 0.000
#> GSM151440     2  0.2589      0.823 0.000 0.884 0.116 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
#> GSM151369     1  0.3297      0.843 0.848 0.000 0.084 0.068 0.000
#> GSM151370     2  0.0000      0.735 0.000 1.000 0.000 0.000 0.000
#> GSM151371     1  0.1965      0.885 0.904 0.000 0.000 0.096 0.000
#> GSM151372     2  0.3109      0.641 0.000 0.800 0.200 0.000 0.000
#> GSM151373     5  0.0290      0.906 0.000 0.000 0.008 0.000 0.992
#> GSM151374     5  0.0000      0.912 0.000 0.000 0.000 0.000 1.000
#> GSM151375     3  0.0000      0.847 0.000 0.000 1.000 0.000 0.000
#> GSM151376     3  0.0000      0.847 0.000 0.000 1.000 0.000 0.000
#> GSM151377     3  0.1608      0.812 0.000 0.000 0.928 0.000 0.072
#> GSM151378     5  0.0000      0.912 0.000 0.000 0.000 0.000 1.000
#> GSM151379     5  0.0000      0.912 0.000 0.000 0.000 0.000 1.000
#> GSM151380     2  0.6261      0.226 0.000 0.536 0.264 0.200 0.000
#> GSM151381     3  0.2891      0.708 0.000 0.176 0.824 0.000 0.000
#> GSM151382     2  0.5103      0.209 0.000 0.512 0.036 0.000 0.452
#> GSM151383     4  0.3274      0.936 0.000 0.220 0.000 0.780 0.000
#> GSM151384     1  0.1270      0.900 0.948 0.000 0.000 0.052 0.000
#> GSM151385     1  0.2329      0.893 0.876 0.000 0.000 0.124 0.000
#> GSM151386     1  0.1410      0.905 0.940 0.000 0.000 0.060 0.000
#> GSM151387     5  0.6940     -0.141 0.000 0.216 0.020 0.280 0.484
#> GSM151388     2  0.5993      0.316 0.000 0.576 0.260 0.164 0.000
#> GSM151389     3  0.0609      0.842 0.000 0.000 0.980 0.000 0.020
#> GSM151390     3  0.3534      0.564 0.000 0.256 0.744 0.000 0.000
#> GSM151391     2  0.4754      0.482 0.000 0.684 0.264 0.052 0.000
#> GSM151392     3  0.4015      0.459 0.000 0.348 0.652 0.000 0.000
#> GSM151393     5  0.0000      0.912 0.000 0.000 0.000 0.000 1.000
#> GSM151394     1  0.1270      0.900 0.948 0.000 0.000 0.052 0.000
#> GSM151395     2  0.1892      0.727 0.004 0.916 0.000 0.080 0.000
#> GSM151396     2  0.0000      0.735 0.000 1.000 0.000 0.000 0.000
#> GSM151397     1  0.2329      0.893 0.876 0.000 0.000 0.124 0.000
#> GSM151398     1  0.1732      0.894 0.920 0.000 0.000 0.080 0.000
#> GSM151399     2  0.0000      0.735 0.000 1.000 0.000 0.000 0.000
#> GSM151400     2  0.4902      0.521 0.048 0.648 0.000 0.304 0.000
#> GSM151401     2  0.3888      0.662 0.000 0.800 0.064 0.000 0.136
#> GSM151402     5  0.0000      0.912 0.000 0.000 0.000 0.000 1.000
#> GSM151403     3  0.0000      0.847 0.000 0.000 1.000 0.000 0.000
#> GSM151404     1  0.5051      0.557 0.664 0.000 0.264 0.072 0.000
#> GSM151405     2  0.2929      0.549 0.000 0.820 0.000 0.180 0.000
#> GSM151406     2  0.4287      0.219 0.000 0.540 0.460 0.000 0.000
#> GSM151407     4  0.3274      0.936 0.000 0.220 0.000 0.780 0.000
#> GSM151408     4  0.3274      0.936 0.000 0.220 0.000 0.780 0.000
#> GSM151409     1  0.1792      0.902 0.916 0.000 0.000 0.084 0.000
#> GSM151410     4  0.3274      0.936 0.000 0.220 0.000 0.780 0.000
#> GSM151411     1  0.1732      0.892 0.920 0.000 0.000 0.080 0.000
#> GSM151412     2  0.1478      0.731 0.000 0.936 0.064 0.000 0.000
#> GSM151413     1  0.2329      0.893 0.876 0.000 0.000 0.124 0.000
#> GSM151414     1  0.2329      0.893 0.876 0.000 0.000 0.124 0.000
#> GSM151415     1  0.1792      0.902 0.916 0.000 0.000 0.084 0.000
#> GSM151416     4  0.4300      0.354 0.000 0.476 0.000 0.524 0.000
#> GSM151417     1  0.1732      0.892 0.920 0.000 0.000 0.080 0.000
#> GSM151418     3  0.0290      0.846 0.000 0.000 0.992 0.000 0.008
#> GSM151419     1  0.2329      0.893 0.876 0.000 0.000 0.124 0.000
#> GSM151420     1  0.1792      0.902 0.916 0.000 0.000 0.084 0.000
#> GSM151421     2  0.4121      0.649 0.100 0.788 0.000 0.112 0.000
#> GSM151422     1  0.0290      0.904 0.992 0.000 0.000 0.008 0.000
#> GSM151423     3  0.3395      0.648 0.000 0.000 0.764 0.000 0.236
#> GSM151424     2  0.0000      0.735 0.000 1.000 0.000 0.000 0.000
#> GSM151425     2  0.0609      0.726 0.000 0.980 0.000 0.020 0.000
#> GSM151426     4  0.3750      0.918 0.000 0.232 0.000 0.756 0.012
#> GSM151427     5  0.0000      0.912 0.000 0.000 0.000 0.000 1.000
#> GSM151428     1  0.2964      0.855 0.856 0.024 0.000 0.120 0.000
#> GSM151429     2  0.3752      0.538 0.000 0.708 0.000 0.292 0.000
#> GSM151430     4  0.3274      0.936 0.000 0.220 0.000 0.780 0.000
#> GSM151431     4  0.3274      0.936 0.000 0.220 0.000 0.780 0.000
#> GSM151432     1  0.1732      0.892 0.920 0.000 0.000 0.080 0.000
#> GSM151433     1  0.0963      0.902 0.964 0.000 0.000 0.036 0.000
#> GSM151434     1  0.1732      0.892 0.920 0.000 0.000 0.080 0.000
#> GSM151435     1  0.2329      0.893 0.876 0.000 0.000 0.124 0.000
#> GSM151436     2  0.2648      0.692 0.000 0.848 0.152 0.000 0.000
#> GSM151437     1  0.1792      0.902 0.916 0.000 0.000 0.084 0.000
#> GSM151438     1  0.2329      0.893 0.876 0.000 0.000 0.124 0.000
#> GSM151439     2  0.1768      0.726 0.004 0.924 0.000 0.072 0.000
#> GSM151440     2  0.0000      0.735 0.000 1.000 0.000 0.000 0.000

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>           class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM151369     6  0.4532     0.4269 0.032 0.000 0.340 0.008 0.000 0.620
#> GSM151370     2  0.0146     0.7107 0.000 0.996 0.000 0.000 0.000 0.004
#> GSM151371     6  0.5397     0.6290 0.216 0.000 0.000 0.200 0.000 0.584
#> GSM151372     2  0.2793     0.6440 0.000 0.800 0.200 0.000 0.000 0.000
#> GSM151373     5  0.0363     0.8990 0.000 0.000 0.012 0.000 0.988 0.000
#> GSM151374     5  0.0000     0.9092 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM151375     3  0.0000     0.7913 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM151376     3  0.0000     0.7913 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM151377     3  0.3842     0.7970 0.000 0.000 0.768 0.000 0.076 0.156
#> GSM151378     5  0.0000     0.9092 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM151379     5  0.0000     0.9092 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM151380     2  0.6089     0.2451 0.000 0.552 0.032 0.200 0.000 0.216
#> GSM151381     3  0.5219     0.6488 0.000 0.176 0.612 0.000 0.000 0.212
#> GSM151382     2  0.4584     0.1910 0.000 0.512 0.036 0.000 0.452 0.000
#> GSM151383     4  0.2793     0.8332 0.000 0.200 0.000 0.800 0.000 0.000
#> GSM151384     1  0.4093     0.2964 0.516 0.000 0.000 0.008 0.000 0.476
#> GSM151385     1  0.0000     0.6948 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM151386     1  0.3774     0.5164 0.592 0.000 0.000 0.000 0.000 0.408
#> GSM151387     5  0.6060    -0.1153 0.000 0.216 0.004 0.292 0.484 0.004
#> GSM151388     2  0.5831     0.3335 0.000 0.592 0.032 0.160 0.000 0.216
#> GSM151389     3  0.3023     0.8148 0.000 0.000 0.784 0.000 0.004 0.212
#> GSM151390     3  0.0790     0.7732 0.000 0.032 0.968 0.000 0.000 0.000
#> GSM151391     2  0.4655     0.5019 0.000 0.704 0.032 0.048 0.000 0.216
#> GSM151392     3  0.2697     0.6226 0.000 0.188 0.812 0.000 0.000 0.000
#> GSM151393     5  0.0000     0.9092 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM151394     1  0.3847     0.3946 0.544 0.000 0.000 0.000 0.000 0.456
#> GSM151395     2  0.2703     0.6637 0.000 0.824 0.000 0.172 0.000 0.004
#> GSM151396     2  0.0000     0.7116 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM151397     1  0.1007     0.6943 0.956 0.000 0.000 0.000 0.000 0.044
#> GSM151398     6  0.4732     0.6539 0.220 0.000 0.000 0.112 0.000 0.668
#> GSM151399     2  0.0000     0.7116 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM151400     6  0.5918     0.1903 0.000 0.232 0.000 0.312 0.000 0.456
#> GSM151401     2  0.3493     0.6565 0.000 0.800 0.064 0.000 0.136 0.000
#> GSM151402     5  0.0000     0.9092 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM151403     3  0.2883     0.8147 0.000 0.000 0.788 0.000 0.000 0.212
#> GSM151404     6  0.2904     0.5188 0.008 0.000 0.028 0.112 0.000 0.852
#> GSM151405     2  0.2772     0.5040 0.000 0.816 0.000 0.180 0.000 0.004
#> GSM151406     2  0.5570     0.3362 0.000 0.552 0.232 0.000 0.000 0.216
#> GSM151407     4  0.2793     0.8332 0.000 0.200 0.000 0.800 0.000 0.000
#> GSM151408     4  0.2793     0.8332 0.000 0.200 0.000 0.800 0.000 0.000
#> GSM151409     1  0.3531     0.6450 0.672 0.000 0.000 0.000 0.000 0.328
#> GSM151410     4  0.2793     0.8332 0.000 0.200 0.000 0.800 0.000 0.000
#> GSM151411     6  0.2941     0.6284 0.220 0.000 0.000 0.000 0.000 0.780
#> GSM151412     2  0.1267     0.7123 0.000 0.940 0.060 0.000 0.000 0.000
#> GSM151413     1  0.0000     0.6948 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM151414     1  0.0000     0.6948 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM151415     1  0.3499     0.6518 0.680 0.000 0.000 0.000 0.000 0.320
#> GSM151416     4  0.5606     0.3437 0.000 0.324 0.000 0.512 0.000 0.164
#> GSM151417     6  0.2941     0.6284 0.220 0.000 0.000 0.000 0.000 0.780
#> GSM151418     3  0.3230     0.8129 0.000 0.000 0.776 0.000 0.012 0.212
#> GSM151419     1  0.0000     0.6948 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM151420     1  0.3499     0.6518 0.680 0.000 0.000 0.000 0.000 0.320
#> GSM151421     2  0.5942     0.0444 0.000 0.424 0.000 0.220 0.000 0.356
#> GSM151422     1  0.3578     0.6305 0.660 0.000 0.000 0.000 0.000 0.340
#> GSM151423     3  0.5717     0.5715 0.000 0.000 0.516 0.000 0.272 0.212
#> GSM151424     2  0.0000     0.7116 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM151425     2  0.0692     0.7001 0.000 0.976 0.000 0.020 0.000 0.004
#> GSM151426     4  0.3370     0.8162 0.000 0.212 0.000 0.772 0.012 0.004
#> GSM151427     5  0.0000     0.9092 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM151428     6  0.5509     0.6180 0.216 0.000 0.000 0.220 0.000 0.564
#> GSM151429     4  0.6101    -0.0769 0.000 0.340 0.000 0.372 0.000 0.288
#> GSM151430     4  0.2793     0.8332 0.000 0.200 0.000 0.800 0.000 0.000
#> GSM151431     4  0.2793     0.8332 0.000 0.200 0.000 0.800 0.000 0.000
#> GSM151432     6  0.3947     0.6497 0.220 0.000 0.000 0.048 0.000 0.732
#> GSM151433     6  0.3727     0.1492 0.388 0.000 0.000 0.000 0.000 0.612
#> GSM151434     6  0.2941     0.6284 0.220 0.000 0.000 0.000 0.000 0.780
#> GSM151435     1  0.0000     0.6948 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM151436     2  0.2378     0.6833 0.000 0.848 0.152 0.000 0.000 0.000
#> GSM151437     1  0.3499     0.6518 0.680 0.000 0.000 0.000 0.000 0.320
#> GSM151438     1  0.0000     0.6948 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM151439     2  0.2793     0.6432 0.000 0.800 0.000 0.200 0.000 0.000
#> GSM151440     2  0.0000     0.7116 0.000 1.000 0.000 0.000 0.000 0.000

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

consensus_heatmap(res, k = 2)

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

consensus_heatmap(res, k = 3)

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

consensus_heatmap(res, k = 4)

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

consensus_heatmap(res, k = 5)

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

consensus_heatmap(res, k = 6)

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

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

membership_heatmap(res, k = 2)

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

membership_heatmap(res, k = 3)

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

membership_heatmap(res, k = 4)

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

membership_heatmap(res, k = 5)

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

membership_heatmap(res, k = 6)

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

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

Signature heatmaps where rows are scaled:

get_signatures(res, k = 2)

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

get_signatures(res, k = 3)

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

get_signatures(res, k = 4)

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

get_signatures(res, k = 5)

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

get_signatures(res, k = 6)

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

Signature heatmaps where rows are not scaled:

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

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

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

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

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

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

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

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

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

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

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk ATC-pam-signature_compare

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

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

An example of the output of tb is:

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

The columns in tb are:

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

UMAP plot which shows how samples are separated.

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

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

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

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

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

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

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

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

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

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

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk ATC-pam-collect-classes

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

test_to_known_factors(res)
#>          n disease.state(p) k
#> ATC:pam 72            0.470 2
#> ATC:pam 69            0.358 3
#> ATC:pam 64            0.145 4
#> ATC:pam 64            0.391 5
#> ATC:pam 59            0.260 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 17730 rows and 72 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 3.
#> 
#> Following methods can be applied to this 'ConsensusPartition' object:
#>  [1] "cola_report"             "collect_classes"         "collect_plots"          
#>  [4] "collect_stats"           "colnames"                "compare_signatures"     
#>  [7] "consensus_heatmap"       "dimension_reduction"     "functional_enrichment"  
#> [10] "get_anno_col"            "get_anno"                "get_classes"            
#> [13] "get_consensus"           "get_matrix"              "get_membership"         
#> [16] "get_param"               "get_signatures"          "get_stats"              
#> [19] "is_best_k"               "is_stable_k"             "membership_heatmap"     
#> [22] "ncol"                    "nrow"                    "plot_ecdf"              
#> [25] "rownames"                "select_partition_number" "show"                   
#> [28] "suggest_best_k"          "test_to_known_factors"

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

collect_plots(res)

plot of chunk ATC-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.428           0.613       0.828         0.4496 0.493   0.493
#> 3 3 0.639           0.787       0.894         0.4631 0.744   0.525
#> 4 4 0.609           0.683       0.803         0.0938 0.912   0.752
#> 5 5 0.533           0.553       0.707         0.0792 0.878   0.609
#> 6 6 0.651           0.508       0.719         0.0427 0.902   0.602

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
#> GSM151369     2   0.000     0.8313 0.000 1.000
#> GSM151370     2   0.000     0.8313 0.000 1.000
#> GSM151371     1   0.963     0.6160 0.612 0.388
#> GSM151372     1   0.978     0.5982 0.588 0.412
#> GSM151373     1   0.981     0.5836 0.580 0.420
#> GSM151374     2   0.000     0.8313 0.000 1.000
#> GSM151375     2   0.000     0.8313 0.000 1.000
#> GSM151376     2   0.000     0.8313 0.000 1.000
#> GSM151377     2   0.000     0.8313 0.000 1.000
#> GSM151378     2   0.000     0.8313 0.000 1.000
#> GSM151379     2   0.000     0.8313 0.000 1.000
#> GSM151380     2   0.000     0.8313 0.000 1.000
#> GSM151381     2   0.000     0.8313 0.000 1.000
#> GSM151382     1   0.981     0.5836 0.580 0.420
#> GSM151383     2   0.988    -0.1704 0.436 0.564
#> GSM151384     1   0.563     0.6770 0.868 0.132
#> GSM151385     1   0.000     0.6736 1.000 0.000
#> GSM151386     1   0.311     0.6788 0.944 0.056
#> GSM151387     2   0.000     0.8313 0.000 1.000
#> GSM151388     2   0.000     0.8313 0.000 1.000
#> GSM151389     2   0.000     0.8313 0.000 1.000
#> GSM151390     2   0.000     0.8313 0.000 1.000
#> GSM151391     2   0.000     0.8313 0.000 1.000
#> GSM151392     2   0.000     0.8313 0.000 1.000
#> GSM151393     2   0.000     0.8313 0.000 1.000
#> GSM151394     2   0.992     0.2174 0.448 0.552
#> GSM151395     1   0.975     0.6043 0.592 0.408
#> GSM151396     1   0.975     0.6043 0.592 0.408
#> GSM151397     1   0.000     0.6736 1.000 0.000
#> GSM151398     2   0.929     0.3667 0.344 0.656
#> GSM151399     1   0.975     0.6043 0.592 0.408
#> GSM151400     1   0.975     0.6043 0.592 0.408
#> GSM151401     1   0.983     0.5753 0.576 0.424
#> GSM151402     2   0.000     0.8313 0.000 1.000
#> GSM151403     2   0.000     0.8313 0.000 1.000
#> GSM151404     2   0.000     0.8313 0.000 1.000
#> GSM151405     2   0.000     0.8313 0.000 1.000
#> GSM151406     2   0.000     0.8313 0.000 1.000
#> GSM151407     2   0.985    -0.1416 0.428 0.572
#> GSM151408     2   0.987    -0.1559 0.432 0.568
#> GSM151409     1   0.000     0.6736 1.000 0.000
#> GSM151410     2   0.988    -0.1704 0.436 0.564
#> GSM151411     1   0.961     0.1470 0.616 0.384
#> GSM151412     1   0.980     0.5910 0.584 0.416
#> GSM151413     1   0.184     0.6775 0.972 0.028
#> GSM151414     1   0.000     0.6736 1.000 0.000
#> GSM151415     1   0.000     0.6736 1.000 0.000
#> GSM151416     2   0.995    -0.2609 0.460 0.540
#> GSM151417     1   0.529     0.6784 0.880 0.120
#> GSM151418     2   0.000     0.8313 0.000 1.000
#> GSM151419     1   0.000     0.6736 1.000 0.000
#> GSM151420     1   0.000     0.6736 1.000 0.000
#> GSM151421     1   0.963     0.6160 0.612 0.388
#> GSM151422     1   0.000     0.6736 1.000 0.000
#> GSM151423     2   0.000     0.8313 0.000 1.000
#> GSM151424     1   0.975     0.6043 0.592 0.408
#> GSM151425     1   0.978     0.5982 0.588 0.412
#> GSM151426     2   0.000     0.8313 0.000 1.000
#> GSM151427     2   0.000     0.8313 0.000 1.000
#> GSM151428     1   0.975     0.6043 0.592 0.408
#> GSM151429     1   0.975     0.6043 0.592 0.408
#> GSM151430     2   0.980    -0.0995 0.416 0.584
#> GSM151431     2   0.981    -0.1133 0.420 0.580
#> GSM151432     1   0.506     0.6795 0.888 0.112
#> GSM151433     1   0.000     0.6736 1.000 0.000
#> GSM151434     1   0.952     0.6216 0.628 0.372
#> GSM151435     1   0.000     0.6736 1.000 0.000
#> GSM151436     1   0.975     0.6043 0.592 0.408
#> GSM151437     1   0.000     0.6736 1.000 0.000
#> GSM151438     1   0.000     0.6736 1.000 0.000
#> GSM151439     1   0.963     0.6160 0.612 0.388
#> GSM151440     1   0.975     0.6043 0.592 0.408

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>           class entropy silhouette    p1    p2    p3
#> GSM151369     3  0.0000     0.9195 0.000 0.000 1.000
#> GSM151370     3  0.4399     0.7472 0.000 0.188 0.812
#> GSM151371     1  0.6505    -0.0897 0.528 0.468 0.004
#> GSM151372     2  0.4645     0.7482 0.008 0.816 0.176
#> GSM151373     2  0.2796     0.8006 0.000 0.908 0.092
#> GSM151374     3  0.0000     0.9195 0.000 0.000 1.000
#> GSM151375     3  0.0000     0.9195 0.000 0.000 1.000
#> GSM151376     3  0.0000     0.9195 0.000 0.000 1.000
#> GSM151377     3  0.0000     0.9195 0.000 0.000 1.000
#> GSM151378     3  0.0000     0.9195 0.000 0.000 1.000
#> GSM151379     3  0.0000     0.9195 0.000 0.000 1.000
#> GSM151380     3  0.0000     0.9195 0.000 0.000 1.000
#> GSM151381     3  0.0000     0.9195 0.000 0.000 1.000
#> GSM151382     2  0.2796     0.8006 0.000 0.908 0.092
#> GSM151383     2  0.0424     0.7981 0.000 0.992 0.008
#> GSM151384     1  0.3192     0.8217 0.888 0.112 0.000
#> GSM151385     1  0.0000     0.9107 1.000 0.000 0.000
#> GSM151386     1  0.1753     0.8878 0.952 0.048 0.000
#> GSM151387     3  0.4002     0.7809 0.000 0.160 0.840
#> GSM151388     3  0.0000     0.9195 0.000 0.000 1.000
#> GSM151389     3  0.0000     0.9195 0.000 0.000 1.000
#> GSM151390     3  0.3941     0.7898 0.000 0.156 0.844
#> GSM151391     3  0.0000     0.9195 0.000 0.000 1.000
#> GSM151392     3  0.0000     0.9195 0.000 0.000 1.000
#> GSM151393     3  0.0000     0.9195 0.000 0.000 1.000
#> GSM151394     3  0.6299     0.1648 0.476 0.000 0.524
#> GSM151395     2  0.5285     0.6786 0.244 0.752 0.004
#> GSM151396     2  0.4291     0.7351 0.180 0.820 0.000
#> GSM151397     1  0.1289     0.8993 0.968 0.032 0.000
#> GSM151398     3  0.6180     0.3352 0.416 0.000 0.584
#> GSM151399     2  0.3028     0.8118 0.032 0.920 0.048
#> GSM151400     2  0.6081     0.5381 0.344 0.652 0.004
#> GSM151401     2  0.2796     0.8006 0.000 0.908 0.092
#> GSM151402     3  0.0000     0.9195 0.000 0.000 1.000
#> GSM151403     3  0.0000     0.9195 0.000 0.000 1.000
#> GSM151404     3  0.0424     0.9141 0.008 0.000 0.992
#> GSM151405     3  0.5327     0.6432 0.000 0.272 0.728
#> GSM151406     3  0.2448     0.8636 0.000 0.076 0.924
#> GSM151407     2  0.1643     0.8047 0.000 0.956 0.044
#> GSM151408     2  0.0424     0.7981 0.000 0.992 0.008
#> GSM151409     1  0.0000     0.9107 1.000 0.000 0.000
#> GSM151410     2  0.0424     0.7981 0.000 0.992 0.008
#> GSM151411     1  0.7692     0.5245 0.668 0.108 0.224
#> GSM151412     2  0.1964     0.8070 0.000 0.944 0.056
#> GSM151413     1  0.0475     0.9098 0.992 0.004 0.004
#> GSM151414     1  0.0000     0.9107 1.000 0.000 0.000
#> GSM151415     1  0.1031     0.9038 0.976 0.024 0.000
#> GSM151416     2  0.9450     0.5185 0.212 0.492 0.296
#> GSM151417     1  0.2496     0.8681 0.928 0.068 0.004
#> GSM151418     3  0.0000     0.9195 0.000 0.000 1.000
#> GSM151419     1  0.0000     0.9107 1.000 0.000 0.000
#> GSM151420     1  0.0000     0.9107 1.000 0.000 0.000
#> GSM151421     2  0.6280     0.2490 0.460 0.540 0.000
#> GSM151422     1  0.0592     0.9092 0.988 0.012 0.000
#> GSM151423     3  0.0000     0.9195 0.000 0.000 1.000
#> GSM151424     2  0.4228     0.7597 0.148 0.844 0.008
#> GSM151425     2  0.6653     0.7685 0.112 0.752 0.136
#> GSM151426     3  0.4002     0.7809 0.000 0.160 0.840
#> GSM151427     3  0.0000     0.9195 0.000 0.000 1.000
#> GSM151428     2  0.6057     0.5450 0.340 0.656 0.004
#> GSM151429     2  0.4931     0.6893 0.232 0.768 0.000
#> GSM151430     2  0.3686     0.7584 0.000 0.860 0.140
#> GSM151431     2  0.3192     0.7825 0.000 0.888 0.112
#> GSM151432     1  0.0424     0.9102 0.992 0.008 0.000
#> GSM151433     1  0.0000     0.9107 1.000 0.000 0.000
#> GSM151434     1  0.5216     0.5611 0.740 0.260 0.000
#> GSM151435     1  0.0237     0.9107 0.996 0.004 0.000
#> GSM151436     2  0.4652     0.8054 0.064 0.856 0.080
#> GSM151437     1  0.0000     0.9107 1.000 0.000 0.000
#> GSM151438     1  0.0000     0.9107 1.000 0.000 0.000
#> GSM151439     2  0.6274     0.2620 0.456 0.544 0.000
#> GSM151440     2  0.3856     0.8104 0.040 0.888 0.072

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM151369     3  0.2733      0.796 0.032 0.032 0.916 0.020
#> GSM151370     3  0.6070      0.521 0.000 0.048 0.548 0.404
#> GSM151371     2  0.5550      0.126 0.428 0.552 0.000 0.020
#> GSM151372     2  0.6104      0.481 0.000 0.680 0.140 0.180
#> GSM151373     2  0.5279      0.573 0.000 0.736 0.072 0.192
#> GSM151374     3  0.0804      0.810 0.000 0.008 0.980 0.012
#> GSM151375     3  0.2799      0.804 0.000 0.008 0.884 0.108
#> GSM151376     3  0.2611      0.805 0.000 0.008 0.896 0.096
#> GSM151377     3  0.2480      0.808 0.000 0.008 0.904 0.088
#> GSM151378     3  0.0707      0.814 0.000 0.000 0.980 0.020
#> GSM151379     3  0.0592      0.814 0.000 0.000 0.984 0.016
#> GSM151380     3  0.3653      0.780 0.000 0.028 0.844 0.128
#> GSM151381     3  0.3606      0.793 0.000 0.024 0.844 0.132
#> GSM151382     2  0.5250      0.573 0.000 0.736 0.068 0.196
#> GSM151383     4  0.4564      0.755 0.000 0.328 0.000 0.672
#> GSM151384     1  0.5159      0.478 0.624 0.364 0.000 0.012
#> GSM151385     1  0.1022      0.861 0.968 0.000 0.000 0.032
#> GSM151386     1  0.4277      0.656 0.720 0.280 0.000 0.000
#> GSM151387     3  0.5723      0.579 0.000 0.032 0.580 0.388
#> GSM151388     3  0.3707      0.781 0.000 0.028 0.840 0.132
#> GSM151389     3  0.0592      0.810 0.000 0.000 0.984 0.016
#> GSM151390     3  0.5334      0.680 0.000 0.088 0.740 0.172
#> GSM151391     3  0.2300      0.803 0.000 0.028 0.924 0.048
#> GSM151392     3  0.2124      0.803 0.000 0.028 0.932 0.040
#> GSM151393     3  0.0336      0.810 0.000 0.000 0.992 0.008
#> GSM151394     3  0.7362      0.328 0.396 0.032 0.496 0.076
#> GSM151395     2  0.3128      0.636 0.076 0.884 0.000 0.040
#> GSM151396     2  0.1389      0.631 0.000 0.952 0.000 0.048
#> GSM151397     1  0.4323      0.762 0.788 0.184 0.000 0.028
#> GSM151398     3  0.7412      0.389 0.368 0.032 0.516 0.084
#> GSM151399     2  0.3610      0.585 0.000 0.800 0.000 0.200
#> GSM151400     2  0.4888      0.629 0.124 0.780 0.000 0.096
#> GSM151401     2  0.5132      0.583 0.000 0.748 0.068 0.184
#> GSM151402     3  0.0804      0.810 0.000 0.008 0.980 0.012
#> GSM151403     3  0.1389      0.815 0.000 0.000 0.952 0.048
#> GSM151404     3  0.4473      0.768 0.044 0.032 0.832 0.092
#> GSM151405     3  0.6907      0.451 0.000 0.120 0.532 0.348
#> GSM151406     3  0.4868      0.740 0.000 0.040 0.748 0.212
#> GSM151407     4  0.3837      0.854 0.000 0.224 0.000 0.776
#> GSM151408     4  0.3172      0.870 0.000 0.160 0.000 0.840
#> GSM151409     1  0.2546      0.820 0.912 0.028 0.000 0.060
#> GSM151410     4  0.4356      0.810 0.000 0.292 0.000 0.708
#> GSM151411     3  0.7347      0.229 0.432 0.032 0.464 0.072
#> GSM151412     2  0.3810      0.594 0.000 0.804 0.008 0.188
#> GSM151413     1  0.2722      0.855 0.904 0.064 0.000 0.032
#> GSM151414     1  0.1022      0.861 0.968 0.000 0.000 0.032
#> GSM151415     1  0.2469      0.838 0.892 0.108 0.000 0.000
#> GSM151416     2  0.9010      0.256 0.152 0.428 0.104 0.316
#> GSM151417     1  0.4661      0.526 0.652 0.348 0.000 0.000
#> GSM151418     3  0.2737      0.804 0.000 0.008 0.888 0.104
#> GSM151419     1  0.0921      0.862 0.972 0.000 0.000 0.028
#> GSM151420     1  0.0921      0.862 0.972 0.000 0.000 0.028
#> GSM151421     2  0.4399      0.555 0.212 0.768 0.000 0.020
#> GSM151422     1  0.3172      0.804 0.840 0.160 0.000 0.000
#> GSM151423     3  0.2675      0.804 0.000 0.008 0.892 0.100
#> GSM151424     2  0.2149      0.631 0.000 0.912 0.000 0.088
#> GSM151425     2  0.5130      0.442 0.000 0.668 0.020 0.312
#> GSM151426     3  0.5775      0.547 0.000 0.032 0.560 0.408
#> GSM151427     3  0.0592      0.814 0.000 0.000 0.984 0.016
#> GSM151428     2  0.4253      0.568 0.208 0.776 0.000 0.016
#> GSM151429     2  0.3301      0.634 0.076 0.876 0.000 0.048
#> GSM151430     4  0.3300      0.864 0.000 0.144 0.008 0.848
#> GSM151431     4  0.3377      0.860 0.000 0.140 0.012 0.848
#> GSM151432     1  0.1867      0.854 0.928 0.072 0.000 0.000
#> GSM151433     1  0.1022      0.856 0.968 0.032 0.000 0.000
#> GSM151434     2  0.5396     -0.106 0.464 0.524 0.000 0.012
#> GSM151435     1  0.1724      0.864 0.948 0.020 0.000 0.032
#> GSM151436     2  0.4663      0.606 0.000 0.788 0.064 0.148
#> GSM151437     1  0.0000      0.863 1.000 0.000 0.000 0.000
#> GSM151438     1  0.0921      0.862 0.972 0.000 0.000 0.028
#> GSM151439     2  0.4798      0.584 0.180 0.768 0.000 0.052
#> GSM151440     2  0.3539      0.599 0.000 0.820 0.004 0.176

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>           class entropy silhouette    p1    p2    p3    p4    p5
#> GSM151369     3  0.5175     0.4896 0.004 0.084 0.724 0.172 0.016
#> GSM151370     5  0.4294     0.5914 0.000 0.112 0.084 0.012 0.792
#> GSM151371     1  0.7054     0.3646 0.468 0.348 0.000 0.140 0.044
#> GSM151372     2  0.5683     0.6073 0.004 0.660 0.164 0.004 0.168
#> GSM151373     2  0.5729     0.5882 0.000 0.636 0.248 0.012 0.104
#> GSM151374     3  0.0771     0.6391 0.000 0.000 0.976 0.004 0.020
#> GSM151375     3  0.4383     0.3344 0.000 0.000 0.572 0.004 0.424
#> GSM151376     3  0.4299     0.4055 0.000 0.000 0.608 0.004 0.388
#> GSM151377     3  0.1701     0.6231 0.000 0.000 0.936 0.048 0.016
#> GSM151378     3  0.4383    -0.0308 0.000 0.000 0.572 0.004 0.424
#> GSM151379     3  0.4443    -0.1567 0.000 0.000 0.524 0.004 0.472
#> GSM151380     3  0.6347    -0.2257 0.000 0.124 0.448 0.008 0.420
#> GSM151381     5  0.4397    -0.0258 0.000 0.000 0.432 0.004 0.564
#> GSM151382     2  0.5769     0.6131 0.000 0.644 0.124 0.012 0.220
#> GSM151383     4  0.5733     0.8419 0.000 0.256 0.000 0.608 0.136
#> GSM151384     2  0.7593     0.0976 0.300 0.428 0.000 0.212 0.060
#> GSM151385     1  0.1717     0.7697 0.936 0.008 0.000 0.052 0.004
#> GSM151386     1  0.7269     0.4558 0.512 0.232 0.000 0.196 0.060
#> GSM151387     5  0.4233     0.5925 0.000 0.116 0.084 0.008 0.792
#> GSM151388     5  0.5657     0.5714 0.000 0.116 0.216 0.012 0.656
#> GSM151389     3  0.3949     0.5284 0.000 0.000 0.696 0.004 0.300
#> GSM151390     5  0.4909     0.1027 0.004 0.024 0.336 0.004 0.632
#> GSM151391     5  0.5593     0.5593 0.000 0.116 0.240 0.004 0.640
#> GSM151392     5  0.5883     0.5446 0.000 0.124 0.256 0.008 0.612
#> GSM151393     3  0.0955     0.6371 0.000 0.000 0.968 0.004 0.028
#> GSM151394     5  0.7739     0.3642 0.204 0.020 0.060 0.212 0.504
#> GSM151395     2  0.1502     0.6660 0.004 0.940 0.000 0.000 0.056
#> GSM151396     2  0.1965     0.6392 0.000 0.904 0.000 0.000 0.096
#> GSM151397     1  0.4684     0.6703 0.764 0.148 0.000 0.024 0.064
#> GSM151398     5  0.8075     0.4027 0.136 0.076 0.084 0.160 0.544
#> GSM151399     2  0.2997     0.6050 0.000 0.840 0.000 0.012 0.148
#> GSM151400     2  0.3795     0.6441 0.060 0.840 0.000 0.036 0.064
#> GSM151401     2  0.5657     0.6211 0.000 0.656 0.116 0.012 0.216
#> GSM151402     3  0.0451     0.6376 0.000 0.000 0.988 0.004 0.008
#> GSM151403     3  0.2719     0.6337 0.000 0.000 0.852 0.004 0.144
#> GSM151404     3  0.7317     0.3429 0.032 0.084 0.600 0.128 0.156
#> GSM151405     5  0.4512     0.5644 0.000 0.140 0.064 0.020 0.776
#> GSM151406     5  0.3300     0.4662 0.000 0.000 0.204 0.004 0.792
#> GSM151407     4  0.5500     0.9400 0.000 0.124 0.000 0.640 0.236
#> GSM151408     4  0.5555     0.9413 0.000 0.132 0.000 0.636 0.232
#> GSM151409     1  0.2674     0.7688 0.868 0.000 0.000 0.120 0.012
#> GSM151410     4  0.5732     0.9116 0.000 0.192 0.000 0.624 0.184
#> GSM151411     5  0.8706     0.2042 0.304 0.068 0.072 0.168 0.388
#> GSM151412     2  0.4643     0.6593 0.000 0.732 0.052 0.008 0.208
#> GSM151413     1  0.2381     0.7711 0.908 0.036 0.000 0.052 0.004
#> GSM151414     1  0.1830     0.7713 0.932 0.012 0.000 0.052 0.004
#> GSM151415     1  0.4569     0.7491 0.788 0.056 0.000 0.108 0.048
#> GSM151416     1  0.8162     0.1129 0.436 0.256 0.076 0.020 0.212
#> GSM151417     1  0.7434     0.1467 0.396 0.388 0.000 0.152 0.064
#> GSM151418     3  0.2674     0.6276 0.000 0.000 0.856 0.004 0.140
#> GSM151419     1  0.1430     0.7703 0.944 0.000 0.000 0.052 0.004
#> GSM151420     1  0.0794     0.7774 0.972 0.000 0.000 0.028 0.000
#> GSM151421     2  0.5789     0.5499 0.104 0.696 0.000 0.140 0.060
#> GSM151422     1  0.5235     0.7233 0.728 0.072 0.000 0.160 0.040
#> GSM151423     3  0.2806     0.6314 0.000 0.000 0.844 0.004 0.152
#> GSM151424     2  0.2020     0.6378 0.000 0.900 0.000 0.000 0.100
#> GSM151425     2  0.4072     0.5648 0.000 0.772 0.028 0.008 0.192
#> GSM151426     5  0.4176     0.5881 0.000 0.116 0.080 0.008 0.796
#> GSM151427     5  0.4446     0.1690 0.000 0.000 0.476 0.004 0.520
#> GSM151428     2  0.6239     0.3962 0.212 0.628 0.000 0.120 0.040
#> GSM151429     2  0.1830     0.6639 0.008 0.924 0.000 0.000 0.068
#> GSM151430     4  0.5699     0.9370 0.000 0.124 0.004 0.628 0.244
#> GSM151431     4  0.5676     0.9386 0.000 0.124 0.004 0.632 0.240
#> GSM151432     1  0.5343     0.7009 0.720 0.072 0.000 0.164 0.044
#> GSM151433     1  0.3935     0.7298 0.772 0.024 0.000 0.200 0.004
#> GSM151434     2  0.6633     0.4542 0.164 0.608 0.000 0.168 0.060
#> GSM151435     1  0.2067     0.7741 0.924 0.028 0.000 0.044 0.004
#> GSM151436     2  0.4724     0.6484 0.000 0.732 0.104 0.000 0.164
#> GSM151437     1  0.1704     0.7762 0.928 0.004 0.000 0.068 0.000
#> GSM151438     1  0.1430     0.7703 0.944 0.000 0.000 0.052 0.004
#> GSM151439     2  0.5767     0.5876 0.104 0.704 0.000 0.116 0.076
#> GSM151440     2  0.2848     0.6447 0.000 0.840 0.000 0.004 0.156

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>           class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM151369     5  0.4517   -0.25270 0.000 0.004 0.464 0.004 0.512 0.016
#> GSM151370     5  0.4775    0.50152 0.000 0.284 0.000 0.084 0.632 0.000
#> GSM151371     1  0.7485    0.20916 0.492 0.056 0.000 0.192 0.084 0.176
#> GSM151372     2  0.3977    0.66843 0.000 0.692 0.284 0.000 0.020 0.004
#> GSM151373     2  0.4656    0.55560 0.000 0.664 0.008 0.028 0.016 0.284
#> GSM151374     3  0.5621    0.55438 0.000 0.000 0.528 0.000 0.184 0.288
#> GSM151375     3  0.3838    0.18341 0.000 0.000 0.552 0.000 0.448 0.000
#> GSM151376     3  0.3737    0.32426 0.000 0.000 0.608 0.000 0.392 0.000
#> GSM151377     3  0.3555    0.48968 0.000 0.000 0.712 0.000 0.008 0.280
#> GSM151378     5  0.5257    0.19138 0.000 0.000 0.136 0.000 0.584 0.280
#> GSM151379     5  0.5172    0.20783 0.000 0.000 0.124 0.000 0.592 0.284
#> GSM151380     5  0.5757    0.35878 0.000 0.276 0.192 0.004 0.528 0.000
#> GSM151381     5  0.4093    0.00436 0.000 0.004 0.440 0.004 0.552 0.000
#> GSM151382     2  0.4384    0.67251 0.000 0.680 0.280 0.024 0.008 0.008
#> GSM151383     4  0.3833    0.79143 0.000 0.444 0.000 0.556 0.000 0.000
#> GSM151384     6  0.5259    0.60997 0.048 0.048 0.000 0.000 0.280 0.624
#> GSM151385     1  0.0000    0.76357 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM151386     6  0.6004    0.27102 0.284 0.000 0.000 0.000 0.280 0.436
#> GSM151387     5  0.4775    0.50152 0.000 0.284 0.000 0.084 0.632 0.000
#> GSM151388     5  0.3874    0.53387 0.000 0.276 0.008 0.012 0.704 0.000
#> GSM151389     3  0.4480    0.42498 0.000 0.020 0.620 0.008 0.348 0.004
#> GSM151390     5  0.4495    0.09817 0.000 0.020 0.392 0.004 0.580 0.004
#> GSM151391     5  0.4263    0.52736 0.000 0.276 0.032 0.008 0.684 0.000
#> GSM151392     5  0.4394    0.52562 0.000 0.276 0.040 0.008 0.676 0.000
#> GSM151393     3  0.5676    0.54681 0.000 0.000 0.520 0.000 0.196 0.284
#> GSM151394     5  0.2624    0.36346 0.124 0.000 0.000 0.000 0.856 0.020
#> GSM151395     2  0.4370    0.58840 0.000 0.684 0.000 0.252 0.000 0.064
#> GSM151396     2  0.0713    0.58972 0.000 0.972 0.000 0.028 0.000 0.000
#> GSM151397     1  0.4076    0.39466 0.620 0.000 0.000 0.016 0.000 0.364
#> GSM151398     5  0.2001    0.38776 0.092 0.000 0.000 0.004 0.900 0.004
#> GSM151399     2  0.0405    0.56177 0.000 0.988 0.000 0.008 0.000 0.004
#> GSM151400     2  0.5298    0.54708 0.008 0.628 0.000 0.264 0.012 0.088
#> GSM151401     2  0.3925    0.67765 0.000 0.700 0.280 0.012 0.004 0.004
#> GSM151402     3  0.5468    0.55907 0.000 0.000 0.552 0.000 0.160 0.288
#> GSM151403     3  0.2913    0.59644 0.000 0.000 0.812 0.004 0.180 0.004
#> GSM151404     5  0.4308   -0.23253 0.004 0.004 0.408 0.004 0.576 0.004
#> GSM151405     5  0.4806    0.49417 0.000 0.304 0.000 0.068 0.624 0.004
#> GSM151406     5  0.4190    0.25121 0.000 0.020 0.300 0.004 0.672 0.004
#> GSM151407     4  0.3309    0.92041 0.000 0.280 0.000 0.720 0.000 0.000
#> GSM151408     4  0.3309    0.92041 0.000 0.280 0.000 0.720 0.000 0.000
#> GSM151409     1  0.3626    0.64428 0.780 0.000 0.000 0.016 0.184 0.020
#> GSM151410     4  0.3774    0.83565 0.000 0.408 0.000 0.592 0.000 0.000
#> GSM151411     5  0.3187    0.32053 0.188 0.000 0.000 0.004 0.796 0.012
#> GSM151412     2  0.3405    0.68212 0.000 0.724 0.272 0.004 0.000 0.000
#> GSM151413     1  0.0146    0.76310 0.996 0.000 0.000 0.000 0.000 0.004
#> GSM151414     1  0.0000    0.76357 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM151415     1  0.3476    0.68950 0.792 0.000 0.000 0.016 0.016 0.176
#> GSM151416     2  0.6070   -0.05836 0.080 0.584 0.000 0.080 0.252 0.004
#> GSM151417     6  0.6541    0.22420 0.304 0.016 0.000 0.004 0.276 0.400
#> GSM151418     3  0.0937    0.55780 0.000 0.000 0.960 0.000 0.040 0.000
#> GSM151419     1  0.0000    0.76357 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM151420     1  0.1245    0.75905 0.952 0.000 0.000 0.016 0.000 0.032
#> GSM151421     6  0.5628    0.49094 0.000 0.128 0.000 0.252 0.024 0.596
#> GSM151422     1  0.5437    0.43856 0.576 0.000 0.000 0.004 0.276 0.144
#> GSM151423     3  0.2454    0.60012 0.000 0.000 0.840 0.000 0.160 0.000
#> GSM151424     2  0.0000    0.56677 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM151425     2  0.1410    0.52399 0.000 0.944 0.004 0.044 0.008 0.000
#> GSM151426     5  0.4775    0.50152 0.000 0.284 0.000 0.084 0.632 0.000
#> GSM151427     5  0.5137    0.21386 0.000 0.000 0.120 0.000 0.596 0.284
#> GSM151428     2  0.6747    0.43767 0.068 0.560 0.000 0.232 0.044 0.096
#> GSM151429     2  0.4317    0.59199 0.000 0.688 0.000 0.252 0.000 0.060
#> GSM151430     4  0.3266    0.91535 0.000 0.272 0.000 0.728 0.000 0.000
#> GSM151431     4  0.3309    0.91893 0.000 0.280 0.000 0.720 0.000 0.000
#> GSM151432     1  0.5609    0.38732 0.552 0.000 0.000 0.004 0.276 0.168
#> GSM151433     1  0.5224    0.45035 0.588 0.000 0.000 0.000 0.280 0.132
#> GSM151434     6  0.5102    0.62234 0.016 0.068 0.000 0.004 0.276 0.636
#> GSM151435     1  0.0260    0.76351 0.992 0.000 0.000 0.000 0.000 0.008
#> GSM151436     2  0.3586    0.67715 0.000 0.712 0.280 0.004 0.000 0.004
#> GSM151437     1  0.2405    0.73877 0.880 0.000 0.000 0.016 0.004 0.100
#> GSM151438     1  0.0000    0.76357 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM151439     6  0.5492    0.47418 0.000 0.140 0.000 0.252 0.012 0.596
#> GSM151440     2  0.2664    0.68127 0.000 0.816 0.184 0.000 0.000 0.000

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

consensus_heatmap(res, k = 2)

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

consensus_heatmap(res, k = 3)

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

consensus_heatmap(res, k = 4)

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

consensus_heatmap(res, k = 5)

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

consensus_heatmap(res, k = 6)

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

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

membership_heatmap(res, k = 2)

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

membership_heatmap(res, k = 3)

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

membership_heatmap(res, k = 4)

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

membership_heatmap(res, k = 5)

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

membership_heatmap(res, k = 6)

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

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

Signature heatmaps where rows are scaled:

get_signatures(res, k = 2)

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

get_signatures(res, k = 3)

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

get_signatures(res, k = 4)

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

get_signatures(res, k = 5)

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

get_signatures(res, k = 6)

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

Signature heatmaps where rows are not scaled:

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

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

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

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

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

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

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

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

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

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

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk ATC-mclust-signature_compare

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

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

An example of the output of tb is:

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

The columns in tb are:

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

UMAP plot which shows how samples are separated.

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

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

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

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

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

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

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

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

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

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

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk ATC-mclust-collect-classes

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

test_to_known_factors(res)
#>             n disease.state(p) k
#> ATC:mclust 62           0.0258 2
#> ATC:mclust 67           0.0592 3
#> ATC:mclust 62           0.0827 4
#> ATC:mclust 51           0.3185 5
#> ATC:mclust 44           0.1484 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 17730 rows and 72 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.755           0.878       0.947         0.4883 0.499   0.499
#> 3 3 0.532           0.792       0.851         0.2447 0.789   0.603
#> 4 4 0.460           0.469       0.699         0.1982 0.860   0.651
#> 5 5 0.524           0.397       0.655         0.0697 0.853   0.564
#> 6 6 0.579           0.493       0.666         0.0507 0.855   0.469

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
#> GSM151369     1  0.0000      0.964 1.000 0.000
#> GSM151370     2  0.2043      0.892 0.032 0.968
#> GSM151371     1  0.0000      0.964 1.000 0.000
#> GSM151372     2  0.0000      0.910 0.000 1.000
#> GSM151373     2  0.0000      0.910 0.000 1.000
#> GSM151374     2  0.0000      0.910 0.000 1.000
#> GSM151375     2  0.0000      0.910 0.000 1.000
#> GSM151376     2  0.0000      0.910 0.000 1.000
#> GSM151377     2  0.0000      0.910 0.000 1.000
#> GSM151378     2  0.0000      0.910 0.000 1.000
#> GSM151379     2  0.0000      0.910 0.000 1.000
#> GSM151380     1  0.1414      0.947 0.980 0.020
#> GSM151381     2  0.0000      0.910 0.000 1.000
#> GSM151382     2  0.0000      0.910 0.000 1.000
#> GSM151383     1  0.1184      0.951 0.984 0.016
#> GSM151384     1  0.0000      0.964 1.000 0.000
#> GSM151385     1  0.0000      0.964 1.000 0.000
#> GSM151386     1  0.0000      0.964 1.000 0.000
#> GSM151387     2  0.0672      0.906 0.008 0.992
#> GSM151388     1  0.5178      0.844 0.884 0.116
#> GSM151389     2  0.0000      0.910 0.000 1.000
#> GSM151390     2  0.0000      0.910 0.000 1.000
#> GSM151391     2  0.8608      0.640 0.284 0.716
#> GSM151392     1  0.6343      0.786 0.840 0.160
#> GSM151393     2  0.0000      0.910 0.000 1.000
#> GSM151394     1  0.0000      0.964 1.000 0.000
#> GSM151395     1  0.0000      0.964 1.000 0.000
#> GSM151396     1  0.8861      0.530 0.696 0.304
#> GSM151397     1  0.0000      0.964 1.000 0.000
#> GSM151398     1  0.0000      0.964 1.000 0.000
#> GSM151399     1  0.8861      0.530 0.696 0.304
#> GSM151400     1  0.0000      0.964 1.000 0.000
#> GSM151401     2  0.0000      0.910 0.000 1.000
#> GSM151402     2  0.0000      0.910 0.000 1.000
#> GSM151403     2  0.0376      0.909 0.004 0.996
#> GSM151404     1  0.0000      0.964 1.000 0.000
#> GSM151405     1  0.8909      0.520 0.692 0.308
#> GSM151406     2  0.6048      0.800 0.148 0.852
#> GSM151407     2  0.0000      0.910 0.000 1.000
#> GSM151408     2  0.9795      0.370 0.416 0.584
#> GSM151409     1  0.0000      0.964 1.000 0.000
#> GSM151410     1  0.0000      0.964 1.000 0.000
#> GSM151411     1  0.0000      0.964 1.000 0.000
#> GSM151412     2  0.0000      0.910 0.000 1.000
#> GSM151413     1  0.0000      0.964 1.000 0.000
#> GSM151414     1  0.0000      0.964 1.000 0.000
#> GSM151415     1  0.0000      0.964 1.000 0.000
#> GSM151416     1  0.0000      0.964 1.000 0.000
#> GSM151417     1  0.0000      0.964 1.000 0.000
#> GSM151418     2  0.0000      0.910 0.000 1.000
#> GSM151419     1  0.0000      0.964 1.000 0.000
#> GSM151420     1  0.0000      0.964 1.000 0.000
#> GSM151421     1  0.0000      0.964 1.000 0.000
#> GSM151422     1  0.0000      0.964 1.000 0.000
#> GSM151423     2  0.0000      0.910 0.000 1.000
#> GSM151424     2  0.9775      0.381 0.412 0.588
#> GSM151425     2  0.9896      0.301 0.440 0.560
#> GSM151426     2  0.8207      0.681 0.256 0.744
#> GSM151427     2  0.0000      0.910 0.000 1.000
#> GSM151428     1  0.0000      0.964 1.000 0.000
#> GSM151429     1  0.0000      0.964 1.000 0.000
#> GSM151430     2  0.8016      0.697 0.244 0.756
#> GSM151431     1  0.0376      0.961 0.996 0.004
#> GSM151432     1  0.0000      0.964 1.000 0.000
#> GSM151433     1  0.0000      0.964 1.000 0.000
#> GSM151434     1  0.0000      0.964 1.000 0.000
#> GSM151435     1  0.0000      0.964 1.000 0.000
#> GSM151436     2  0.0000      0.910 0.000 1.000
#> GSM151437     1  0.0000      0.964 1.000 0.000
#> GSM151438     1  0.0000      0.964 1.000 0.000
#> GSM151439     1  0.0000      0.964 1.000 0.000
#> GSM151440     2  0.9000      0.587 0.316 0.684

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>           class entropy silhouette    p1    p2    p3
#> GSM151369     1  0.8196      0.546 0.624 0.252 0.124
#> GSM151370     2  0.7413      0.816 0.204 0.692 0.104
#> GSM151371     1  0.1529      0.912 0.960 0.040 0.000
#> GSM151372     3  0.1031      0.833 0.000 0.024 0.976
#> GSM151373     2  0.6008      0.361 0.000 0.628 0.372
#> GSM151374     3  0.0237      0.840 0.000 0.004 0.996
#> GSM151375     3  0.0237      0.840 0.000 0.004 0.996
#> GSM151376     3  0.0237      0.840 0.000 0.004 0.996
#> GSM151377     3  0.2165      0.809 0.000 0.064 0.936
#> GSM151378     3  0.5905      0.447 0.000 0.352 0.648
#> GSM151379     3  0.6204      0.270 0.000 0.424 0.576
#> GSM151380     1  0.2663      0.900 0.932 0.024 0.044
#> GSM151381     3  0.2584      0.809 0.008 0.064 0.928
#> GSM151382     2  0.5835      0.434 0.000 0.660 0.340
#> GSM151383     2  0.5254      0.832 0.264 0.736 0.000
#> GSM151384     1  0.0592      0.917 0.988 0.012 0.000
#> GSM151385     1  0.0747      0.918 0.984 0.016 0.000
#> GSM151386     1  0.2356      0.884 0.928 0.072 0.000
#> GSM151387     2  0.7344      0.818 0.204 0.696 0.100
#> GSM151388     1  0.3550      0.867 0.896 0.024 0.080
#> GSM151389     3  0.0237      0.840 0.000 0.004 0.996
#> GSM151390     3  0.4974      0.650 0.000 0.236 0.764
#> GSM151391     3  0.5506      0.561 0.220 0.016 0.764
#> GSM151392     1  0.8836      0.276 0.520 0.128 0.352
#> GSM151393     3  0.0237      0.840 0.000 0.004 0.996
#> GSM151394     1  0.2711      0.871 0.912 0.088 0.000
#> GSM151395     1  0.3116      0.862 0.892 0.108 0.000
#> GSM151396     2  0.5541      0.842 0.252 0.740 0.008
#> GSM151397     1  0.0747      0.918 0.984 0.016 0.000
#> GSM151398     1  0.1411      0.918 0.964 0.036 0.000
#> GSM151399     2  0.5178      0.839 0.256 0.744 0.000
#> GSM151400     1  0.3879      0.809 0.848 0.152 0.000
#> GSM151401     2  0.5733      0.466 0.000 0.676 0.324
#> GSM151402     3  0.0237      0.840 0.000 0.004 0.996
#> GSM151403     3  0.0424      0.836 0.000 0.008 0.992
#> GSM151404     1  0.4269      0.838 0.872 0.052 0.076
#> GSM151405     2  0.5803      0.844 0.248 0.736 0.016
#> GSM151406     3  0.7970      0.452 0.156 0.184 0.660
#> GSM151407     2  0.6632      0.837 0.204 0.732 0.064
#> GSM151408     2  0.5178      0.839 0.256 0.744 0.000
#> GSM151409     1  0.2165      0.890 0.936 0.064 0.000
#> GSM151410     2  0.5254      0.832 0.264 0.736 0.000
#> GSM151411     1  0.0592      0.918 0.988 0.012 0.000
#> GSM151412     2  0.7323      0.696 0.104 0.700 0.196
#> GSM151413     1  0.1753      0.908 0.952 0.048 0.000
#> GSM151414     1  0.1289      0.915 0.968 0.032 0.000
#> GSM151415     1  0.1643      0.902 0.956 0.044 0.000
#> GSM151416     1  0.3482      0.840 0.872 0.128 0.000
#> GSM151417     1  0.1529      0.913 0.960 0.040 0.000
#> GSM151418     3  0.1765      0.815 0.004 0.040 0.956
#> GSM151419     1  0.1163      0.910 0.972 0.028 0.000
#> GSM151420     1  0.0892      0.913 0.980 0.020 0.000
#> GSM151421     1  0.0747      0.918 0.984 0.016 0.000
#> GSM151422     1  0.1163      0.916 0.972 0.028 0.000
#> GSM151423     3  0.0000      0.838 0.000 0.000 1.000
#> GSM151424     2  0.6148      0.845 0.244 0.728 0.028
#> GSM151425     2  0.7263      0.829 0.224 0.692 0.084
#> GSM151426     2  0.6678      0.840 0.216 0.724 0.060
#> GSM151427     3  0.6225      0.244 0.000 0.432 0.568
#> GSM151428     1  0.2448      0.890 0.924 0.076 0.000
#> GSM151429     1  0.4235      0.773 0.824 0.176 0.000
#> GSM151430     2  0.5138      0.841 0.252 0.748 0.000
#> GSM151431     2  0.5178      0.839 0.256 0.744 0.000
#> GSM151432     1  0.0424      0.918 0.992 0.008 0.000
#> GSM151433     1  0.1031      0.912 0.976 0.024 0.000
#> GSM151434     1  0.0892      0.913 0.980 0.020 0.000
#> GSM151435     1  0.1411      0.914 0.964 0.036 0.000
#> GSM151436     2  0.5733      0.465 0.000 0.676 0.324
#> GSM151437     1  0.0747      0.918 0.984 0.016 0.000
#> GSM151438     1  0.1031      0.912 0.976 0.024 0.000
#> GSM151439     1  0.1529      0.912 0.960 0.040 0.000
#> GSM151440     2  0.6337      0.844 0.220 0.736 0.044

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM151369     4  0.7793    0.00248 0.356 0.000 0.248 0.396
#> GSM151370     2  0.7901    0.45314 0.044 0.544 0.136 0.276
#> GSM151371     1  0.6296    0.26109 0.652 0.124 0.000 0.224
#> GSM151372     3  0.6917    0.31064 0.000 0.288 0.568 0.144
#> GSM151373     2  0.5123    0.50420 0.000 0.724 0.232 0.044
#> GSM151374     3  0.0376    0.75554 0.000 0.004 0.992 0.004
#> GSM151375     3  0.1488    0.74541 0.000 0.032 0.956 0.012
#> GSM151376     3  0.0657    0.75262 0.000 0.004 0.984 0.012
#> GSM151377     3  0.2647    0.70338 0.000 0.000 0.880 0.120
#> GSM151378     3  0.5971    0.11870 0.000 0.428 0.532 0.040
#> GSM151379     2  0.6147   -0.01860 0.000 0.488 0.464 0.048
#> GSM151380     1  0.5535    0.45340 0.672 0.004 0.036 0.288
#> GSM151381     3  0.5212    0.66334 0.004 0.080 0.760 0.156
#> GSM151382     2  0.4764    0.53699 0.000 0.748 0.220 0.032
#> GSM151383     2  0.5531    0.60545 0.140 0.732 0.000 0.128
#> GSM151384     1  0.7343   -0.39860 0.428 0.156 0.000 0.416
#> GSM151385     1  0.1743    0.66160 0.940 0.004 0.000 0.056
#> GSM151386     1  0.5821    0.02055 0.536 0.032 0.000 0.432
#> GSM151387     2  0.8285    0.52806 0.128 0.572 0.128 0.172
#> GSM151388     1  0.5796    0.41142 0.640 0.028 0.012 0.320
#> GSM151389     3  0.3711    0.72436 0.008 0.024 0.852 0.116
#> GSM151390     2  0.7169    0.20296 0.000 0.516 0.332 0.152
#> GSM151391     3  0.7235    0.40225 0.288 0.028 0.584 0.100
#> GSM151392     3  0.7270    0.32542 0.192 0.004 0.560 0.244
#> GSM151393     3  0.0779    0.75561 0.000 0.004 0.980 0.016
#> GSM151394     1  0.5137    0.53827 0.680 0.024 0.000 0.296
#> GSM151395     2  0.7551   -0.41593 0.196 0.448 0.000 0.356
#> GSM151396     2  0.4894    0.41430 0.024 0.748 0.008 0.220
#> GSM151397     1  0.3853    0.60586 0.820 0.020 0.000 0.160
#> GSM151398     1  0.5227    0.54470 0.704 0.040 0.000 0.256
#> GSM151399     2  0.2188    0.60182 0.020 0.936 0.012 0.032
#> GSM151400     2  0.7188   -0.21412 0.244 0.552 0.000 0.204
#> GSM151401     2  0.3464    0.60957 0.000 0.860 0.108 0.032
#> GSM151402     3  0.0000    0.75452 0.000 0.000 1.000 0.000
#> GSM151403     3  0.1474    0.75228 0.000 0.000 0.948 0.052
#> GSM151404     1  0.6477    0.47663 0.640 0.032 0.048 0.280
#> GSM151405     2  0.7600    0.35004 0.144 0.512 0.016 0.328
#> GSM151406     3  0.8315    0.28164 0.028 0.280 0.460 0.232
#> GSM151407     2  0.5919    0.62110 0.100 0.756 0.072 0.072
#> GSM151408     2  0.4955    0.61639 0.144 0.772 0.000 0.084
#> GSM151409     1  0.2125    0.66489 0.920 0.004 0.000 0.076
#> GSM151410     2  0.6123    0.57960 0.192 0.676 0.000 0.132
#> GSM151411     1  0.2944    0.62763 0.868 0.004 0.000 0.128
#> GSM151412     2  0.2594    0.59782 0.004 0.916 0.036 0.044
#> GSM151413     1  0.2546    0.65973 0.912 0.028 0.000 0.060
#> GSM151414     1  0.2329    0.65473 0.916 0.012 0.000 0.072
#> GSM151415     1  0.4018    0.55463 0.772 0.004 0.000 0.224
#> GSM151416     1  0.5484    0.49447 0.732 0.104 0.000 0.164
#> GSM151417     1  0.5458    0.44776 0.720 0.076 0.000 0.204
#> GSM151418     3  0.2816    0.71695 0.000 0.064 0.900 0.036
#> GSM151419     1  0.1118    0.67162 0.964 0.000 0.000 0.036
#> GSM151420     1  0.1305    0.67370 0.960 0.004 0.000 0.036
#> GSM151421     4  0.8036    0.56547 0.280 0.280 0.008 0.432
#> GSM151422     1  0.2335    0.66050 0.920 0.020 0.000 0.060
#> GSM151423     3  0.0188    0.75427 0.000 0.000 0.996 0.004
#> GSM151424     2  0.4612    0.46205 0.020 0.780 0.012 0.188
#> GSM151425     2  0.5283    0.62361 0.112 0.788 0.052 0.048
#> GSM151426     2  0.8259    0.52927 0.208 0.540 0.060 0.192
#> GSM151427     3  0.6130    0.07813 0.000 0.440 0.512 0.048
#> GSM151428     1  0.4542    0.60663 0.804 0.088 0.000 0.108
#> GSM151429     2  0.7449   -0.35118 0.332 0.480 0.000 0.188
#> GSM151430     2  0.5913    0.59194 0.180 0.696 0.000 0.124
#> GSM151431     2  0.6240    0.57150 0.200 0.664 0.000 0.136
#> GSM151432     1  0.5325    0.49175 0.728 0.068 0.000 0.204
#> GSM151433     1  0.4636    0.56152 0.772 0.040 0.000 0.188
#> GSM151434     1  0.7451   -0.43533 0.416 0.172 0.000 0.412
#> GSM151435     1  0.1042    0.67233 0.972 0.008 0.000 0.020
#> GSM151436     2  0.4401    0.55002 0.000 0.812 0.076 0.112
#> GSM151437     1  0.2300    0.66496 0.920 0.016 0.000 0.064
#> GSM151438     1  0.2408    0.64987 0.896 0.000 0.000 0.104
#> GSM151439     4  0.8284    0.56545 0.276 0.300 0.016 0.408
#> GSM151440     2  0.2926    0.56554 0.004 0.888 0.012 0.096

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>           class entropy silhouette    p1    p2    p3    p4    p5
#> GSM151369     3  0.7849     0.2623 0.200 0.208 0.480 0.004 0.108
#> GSM151370     5  0.6001     0.4995 0.052 0.036 0.112 0.084 0.716
#> GSM151371     1  0.6454     0.4488 0.556 0.192 0.000 0.012 0.240
#> GSM151372     3  0.7364    -0.0102 0.004 0.236 0.436 0.296 0.028
#> GSM151373     4  0.8112     0.1110 0.000 0.224 0.112 0.380 0.284
#> GSM151374     3  0.0727     0.6493 0.000 0.004 0.980 0.004 0.012
#> GSM151375     3  0.2236     0.6418 0.000 0.024 0.908 0.000 0.068
#> GSM151376     3  0.1386     0.6444 0.000 0.016 0.952 0.000 0.032
#> GSM151377     3  0.3909     0.5772 0.000 0.124 0.808 0.004 0.064
#> GSM151378     3  0.7922     0.0697 0.000 0.096 0.416 0.216 0.272
#> GSM151379     3  0.7525     0.1403 0.000 0.052 0.436 0.280 0.232
#> GSM151380     1  0.6696    -0.1192 0.472 0.028 0.060 0.024 0.416
#> GSM151381     3  0.4949     0.2061 0.004 0.000 0.532 0.020 0.444
#> GSM151382     4  0.3823     0.5228 0.000 0.084 0.064 0.832 0.020
#> GSM151383     4  0.1377     0.5586 0.020 0.020 0.000 0.956 0.004
#> GSM151384     2  0.6340     0.0229 0.372 0.508 0.000 0.020 0.100
#> GSM151385     1  0.1830     0.7198 0.932 0.040 0.000 0.000 0.028
#> GSM151386     1  0.5406     0.4126 0.572 0.360 0.000 0.000 0.068
#> GSM151387     5  0.8303     0.3378 0.144 0.036 0.092 0.284 0.444
#> GSM151388     5  0.6487     0.1378 0.420 0.024 0.040 0.032 0.484
#> GSM151389     3  0.4162     0.5326 0.004 0.004 0.752 0.020 0.220
#> GSM151390     5  0.7474     0.2063 0.020 0.240 0.144 0.060 0.536
#> GSM151391     3  0.6887     0.2361 0.308 0.016 0.536 0.028 0.112
#> GSM151392     3  0.7629     0.0997 0.240 0.076 0.464 0.000 0.220
#> GSM151393     3  0.1731     0.6383 0.000 0.004 0.932 0.004 0.060
#> GSM151394     1  0.5703     0.2178 0.508 0.084 0.000 0.000 0.408
#> GSM151395     2  0.6561     0.4137 0.088 0.596 0.000 0.072 0.244
#> GSM151396     2  0.6537     0.2734 0.012 0.564 0.004 0.228 0.192
#> GSM151397     1  0.3068     0.7283 0.872 0.084 0.000 0.016 0.028
#> GSM151398     1  0.5857     0.1123 0.460 0.096 0.000 0.000 0.444
#> GSM151399     4  0.7175    -0.0586 0.012 0.360 0.004 0.380 0.244
#> GSM151400     4  0.7144    -0.2393 0.312 0.336 0.000 0.340 0.012
#> GSM151401     4  0.7333     0.0261 0.000 0.328 0.028 0.392 0.252
#> GSM151402     3  0.0290     0.6488 0.000 0.000 0.992 0.000 0.008
#> GSM151403     3  0.1153     0.6467 0.004 0.008 0.964 0.000 0.024
#> GSM151404     5  0.6020    -0.1450 0.412 0.100 0.004 0.000 0.484
#> GSM151405     5  0.5281     0.4100 0.108 0.120 0.016 0.016 0.740
#> GSM151406     5  0.5273     0.4494 0.052 0.036 0.164 0.012 0.736
#> GSM151407     4  0.2207     0.5553 0.004 0.012 0.020 0.924 0.040
#> GSM151408     4  0.0771     0.5627 0.004 0.000 0.000 0.976 0.020
#> GSM151409     1  0.1750     0.7364 0.936 0.028 0.000 0.000 0.036
#> GSM151410     4  0.1989     0.5509 0.032 0.020 0.000 0.932 0.016
#> GSM151411     1  0.3380     0.6734 0.840 0.028 0.000 0.008 0.124
#> GSM151412     2  0.7107    -0.1027 0.004 0.368 0.008 0.368 0.252
#> GSM151413     1  0.3021     0.7082 0.884 0.040 0.000 0.036 0.040
#> GSM151414     1  0.2827     0.7031 0.892 0.044 0.000 0.020 0.044
#> GSM151415     1  0.3684     0.7154 0.824 0.116 0.000 0.004 0.056
#> GSM151416     1  0.6322     0.1568 0.468 0.048 0.000 0.432 0.052
#> GSM151417     1  0.6095     0.5123 0.656 0.168 0.000 0.132 0.044
#> GSM151418     3  0.3735     0.5806 0.008 0.064 0.828 0.000 0.100
#> GSM151419     1  0.1403     0.7276 0.952 0.024 0.000 0.000 0.024
#> GSM151420     1  0.1725     0.7355 0.936 0.020 0.000 0.000 0.044
#> GSM151421     2  0.6536     0.3914 0.176 0.616 0.000 0.152 0.056
#> GSM151422     1  0.2825     0.7270 0.892 0.048 0.000 0.020 0.040
#> GSM151423     3  0.0609     0.6490 0.000 0.000 0.980 0.000 0.020
#> GSM151424     2  0.6579     0.1391 0.012 0.520 0.004 0.320 0.144
#> GSM151425     2  0.8900     0.0136 0.112 0.340 0.040 0.220 0.288
#> GSM151426     5  0.8118     0.3464 0.164 0.040 0.060 0.276 0.460
#> GSM151427     3  0.6931     0.1957 0.000 0.016 0.464 0.304 0.216
#> GSM151428     1  0.5268     0.6582 0.736 0.056 0.000 0.136 0.072
#> GSM151429     4  0.5933     0.1895 0.228 0.160 0.000 0.608 0.004
#> GSM151430     4  0.2788     0.5339 0.040 0.008 0.000 0.888 0.064
#> GSM151431     4  0.2087     0.5444 0.032 0.020 0.000 0.928 0.020
#> GSM151432     1  0.5147     0.6456 0.708 0.200 0.000 0.016 0.076
#> GSM151433     1  0.4229     0.6824 0.788 0.104 0.000 0.004 0.104
#> GSM151434     2  0.5922     0.1926 0.328 0.584 0.000 0.036 0.052
#> GSM151435     1  0.1597     0.7366 0.948 0.024 0.000 0.008 0.020
#> GSM151436     4  0.5551     0.1147 0.004 0.448 0.016 0.504 0.028
#> GSM151437     1  0.3151     0.7171 0.864 0.064 0.000 0.004 0.068
#> GSM151438     1  0.1012     0.7375 0.968 0.020 0.000 0.000 0.012
#> GSM151439     2  0.6385     0.4205 0.112 0.652 0.000 0.128 0.108
#> GSM151440     4  0.5211     0.1284 0.008 0.448 0.004 0.520 0.020

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>           class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM151369     3  0.8096    0.20722 0.188 0.220 0.408 0.000 0.080 0.104
#> GSM151370     5  0.5425    0.42926 0.012 0.272 0.048 0.020 0.636 0.012
#> GSM151371     5  0.4764    0.52283 0.088 0.004 0.000 0.032 0.732 0.144
#> GSM151372     4  0.7577    0.21534 0.000 0.124 0.204 0.388 0.012 0.272
#> GSM151373     2  0.6751    0.42153 0.000 0.528 0.160 0.148 0.000 0.164
#> GSM151374     3  0.1285    0.67497 0.000 0.052 0.944 0.000 0.000 0.004
#> GSM151375     3  0.2373    0.67405 0.000 0.040 0.908 0.012 0.024 0.016
#> GSM151376     3  0.2165    0.67419 0.000 0.052 0.912 0.004 0.008 0.024
#> GSM151377     3  0.4525    0.57279 0.000 0.180 0.724 0.000 0.016 0.080
#> GSM151378     2  0.4906   -0.07515 0.000 0.492 0.460 0.040 0.004 0.004
#> GSM151379     3  0.5225    0.19972 0.000 0.388 0.524 0.084 0.004 0.000
#> GSM151380     5  0.6962    0.59428 0.188 0.076 0.044 0.048 0.596 0.048
#> GSM151381     3  0.5849    0.25850 0.000 0.280 0.560 0.008 0.140 0.012
#> GSM151382     4  0.3845    0.63923 0.000 0.048 0.028 0.812 0.008 0.104
#> GSM151383     4  0.2211    0.68561 0.004 0.008 0.000 0.900 0.008 0.080
#> GSM151384     1  0.6207    0.43911 0.476 0.016 0.000 0.000 0.224 0.284
#> GSM151385     1  0.3385    0.72231 0.840 0.016 0.000 0.004 0.064 0.076
#> GSM151386     1  0.5140    0.64823 0.672 0.056 0.000 0.000 0.056 0.216
#> GSM151387     2  0.7622    0.31260 0.056 0.492 0.148 0.148 0.156 0.000
#> GSM151388     5  0.7360    0.47583 0.248 0.224 0.016 0.048 0.448 0.016
#> GSM151389     3  0.5042    0.53231 0.004 0.196 0.700 0.040 0.056 0.004
#> GSM151390     2  0.7495    0.25395 0.000 0.396 0.188 0.016 0.296 0.104
#> GSM151391     3  0.6883    0.36983 0.232 0.184 0.520 0.028 0.012 0.024
#> GSM151392     3  0.7547    0.00798 0.092 0.128 0.404 0.000 0.332 0.044
#> GSM151393     3  0.1863    0.67488 0.000 0.044 0.920 0.036 0.000 0.000
#> GSM151394     5  0.3840    0.58855 0.228 0.024 0.000 0.000 0.740 0.008
#> GSM151395     6  0.6873    0.25777 0.084 0.296 0.000 0.012 0.124 0.484
#> GSM151396     6  0.6538    0.26248 0.020 0.312 0.000 0.060 0.092 0.516
#> GSM151397     1  0.2432    0.74830 0.888 0.008 0.000 0.000 0.024 0.080
#> GSM151398     5  0.4061    0.51471 0.248 0.012 0.000 0.000 0.716 0.024
#> GSM151399     2  0.6488    0.16556 0.020 0.496 0.004 0.124 0.024 0.332
#> GSM151400     1  0.6922    0.23012 0.484 0.076 0.000 0.176 0.008 0.256
#> GSM151401     2  0.6486    0.27854 0.000 0.512 0.052 0.116 0.012 0.308
#> GSM151402     3  0.0508    0.67842 0.000 0.012 0.984 0.004 0.000 0.000
#> GSM151403     3  0.2015    0.66943 0.000 0.056 0.916 0.000 0.012 0.016
#> GSM151404     5  0.2774    0.66327 0.108 0.012 0.008 0.000 0.864 0.008
#> GSM151405     5  0.4456    0.53913 0.016 0.184 0.004 0.004 0.740 0.052
#> GSM151406     5  0.6090    0.44081 0.024 0.220 0.120 0.004 0.608 0.024
#> GSM151407     4  0.1563    0.68612 0.000 0.056 0.000 0.932 0.000 0.012
#> GSM151408     4  0.1321    0.69787 0.004 0.024 0.000 0.952 0.000 0.020
#> GSM151409     1  0.3616    0.70220 0.780 0.024 0.000 0.000 0.184 0.012
#> GSM151410     4  0.1476    0.69808 0.004 0.028 0.000 0.948 0.012 0.008
#> GSM151411     1  0.4487    0.51678 0.688 0.036 0.000 0.000 0.256 0.020
#> GSM151412     2  0.6339    0.06683 0.000 0.452 0.004 0.132 0.036 0.376
#> GSM151413     1  0.3188    0.73074 0.860 0.016 0.000 0.016 0.036 0.072
#> GSM151414     1  0.3829    0.70142 0.820 0.024 0.000 0.016 0.052 0.088
#> GSM151415     1  0.3266    0.74240 0.848 0.048 0.000 0.000 0.032 0.072
#> GSM151416     4  0.5100    0.55604 0.160 0.016 0.000 0.716 0.056 0.052
#> GSM151417     1  0.3912    0.71921 0.808 0.048 0.000 0.024 0.012 0.108
#> GSM151418     3  0.4872    0.57151 0.000 0.100 0.732 0.000 0.096 0.072
#> GSM151419     1  0.1577    0.74427 0.940 0.008 0.000 0.000 0.016 0.036
#> GSM151420     1  0.2748    0.73185 0.856 0.016 0.000 0.000 0.120 0.008
#> GSM151421     6  0.5419    0.47678 0.136 0.008 0.000 0.100 0.064 0.692
#> GSM151422     1  0.1578    0.75217 0.936 0.004 0.000 0.000 0.012 0.048
#> GSM151423     3  0.1686    0.67528 0.008 0.052 0.932 0.004 0.004 0.000
#> GSM151424     6  0.6257    0.33073 0.016 0.280 0.004 0.116 0.028 0.556
#> GSM151425     2  0.6898    0.27719 0.108 0.544 0.056 0.024 0.016 0.252
#> GSM151426     2  0.7295    0.38420 0.076 0.576 0.072 0.136 0.120 0.020
#> GSM151427     3  0.5254    0.30313 0.000 0.332 0.564 0.100 0.004 0.000
#> GSM151428     4  0.7341    0.28063 0.176 0.004 0.000 0.440 0.220 0.160
#> GSM151429     4  0.5062    0.49070 0.028 0.024 0.000 0.632 0.016 0.300
#> GSM151430     4  0.3604    0.64394 0.032 0.072 0.000 0.840 0.024 0.032
#> GSM151431     4  0.2233    0.69221 0.020 0.032 0.000 0.916 0.012 0.020
#> GSM151432     1  0.5847    0.62762 0.644 0.076 0.000 0.004 0.144 0.132
#> GSM151433     1  0.5135    0.58710 0.640 0.028 0.000 0.000 0.264 0.068
#> GSM151434     1  0.5549    0.31928 0.488 0.060 0.000 0.004 0.024 0.424
#> GSM151435     1  0.3247    0.73821 0.848 0.008 0.000 0.008 0.060 0.076
#> GSM151436     6  0.5518   -0.17587 0.000 0.060 0.016 0.448 0.008 0.468
#> GSM151437     1  0.3564    0.70446 0.776 0.004 0.000 0.004 0.196 0.020
#> GSM151438     1  0.2401    0.75078 0.892 0.008 0.000 0.000 0.072 0.028
#> GSM151439     6  0.5391    0.46751 0.084 0.004 0.000 0.068 0.160 0.684
#> GSM151440     4  0.4972    0.11436 0.000 0.048 0.000 0.504 0.008 0.440

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) k
#> ATC:NMF 69            0.148 2
#> ATC:NMF 63            0.140 3
#> ATC:NMF 46            0.326 4
#> ATC:NMF 34            0.215 5
#> ATC:NMF 41            0.453 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