cola Report for GDS4881

Date: 2019-12-25 21:52:27 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 31632 rows and 73 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] 31632    73

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.989 0.994 **
SD:NMF 2 1.000 0.973 0.989 **
CV:kmeans 2 1.000 0.996 0.998 **
CV:NMF 2 1.000 0.972 0.987 **
MAD:kmeans 2 1.000 0.984 0.993 **
ATC:kmeans 3 1.000 0.991 0.996 ** 2
ATC:skmeans 2 1.000 0.989 0.995 **
ATC:mclust 3 1.000 0.972 0.980 ** 2
ATC:NMF 2 1.000 0.957 0.983 **
MAD:NMF 2 1.000 0.967 0.984 **
SD:skmeans 2 0.968 0.964 0.983 **
CV:skmeans 2 0.968 0.957 0.980 **
ATC:pam 6 0.945 0.891 0.954 * 2,3,5
MAD:pam 3 0.908 0.901 0.956 *
MAD:skmeans 3 0.870 0.909 0.959
SD:mclust 4 0.762 0.803 0.922
SD:pam 3 0.757 0.845 0.930
MAD:mclust 3 0.665 0.859 0.919
CV:mclust 4 0.581 0.727 0.873
ATC:hclust 3 0.575 0.789 0.879
CV:pam 3 0.555 0.788 0.890
SD:hclust 5 0.431 0.536 0.717
MAD:hclust 4 0.353 0.550 0.745
CV:hclust 3 0.330 0.645 0.815

**: 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 1.000           0.973       0.989          0.396 0.597   0.597
#> CV:NMF      2 1.000           0.972       0.987          0.387 0.610   0.610
#> MAD:NMF     2 1.000           0.967       0.984          0.415 0.597   0.597
#> ATC:NMF     2 1.000           0.957       0.983          0.457 0.543   0.543
#> SD:skmeans  2 0.968           0.964       0.983          0.482 0.521   0.521
#> CV:skmeans  2 0.968           0.957       0.980          0.487 0.521   0.521
#> MAD:skmeans 2 0.859           0.894       0.957          0.489 0.521   0.521
#> ATC:skmeans 2 1.000           0.989       0.995          0.487 0.514   0.514
#> SD:mclust   2 0.624           0.877       0.933          0.296 0.740   0.740
#> CV:mclust   2 0.556           0.865       0.912          0.351 0.686   0.686
#> MAD:mclust  2 0.835           0.903       0.949          0.291 0.703   0.703
#> ATC:mclust  2 0.941           0.954       0.977          0.475 0.521   0.521
#> SD:kmeans   2 1.000           0.989       0.994          0.386 0.610   0.610
#> CV:kmeans   2 1.000           0.996       0.998          0.393 0.610   0.610
#> MAD:kmeans  2 1.000           0.984       0.993          0.393 0.610   0.610
#> ATC:kmeans  2 1.000           0.985       0.994          0.442 0.562   0.562
#> SD:pam      2 0.829           0.913       0.948          0.282 0.740   0.740
#> CV:pam      2 0.757           0.833       0.935          0.324 0.703   0.703
#> MAD:pam     2 0.599           0.899       0.923          0.435 0.543   0.543
#> ATC:pam     2 1.000           0.998       0.999          0.298 0.703   0.703
#> SD:hclust   2 0.668           0.815       0.914          0.311 0.703   0.703
#> CV:hclust   2 0.658           0.839       0.917          0.339 0.686   0.686
#> MAD:hclust  2 0.640           0.810       0.908          0.332 0.703   0.703
#> ATC:hclust  2 0.789           0.838       0.927          0.389 0.562   0.562
get_stats(res_list, k = 3)
#>             k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> SD:NMF      3 0.839           0.848       0.934         0.4403 0.789   0.657
#> CV:NMF      3 0.761           0.816       0.919         0.4837 0.780   0.649
#> MAD:NMF     3 0.824           0.851       0.938         0.4364 0.770   0.627
#> ATC:NMF     3 0.732           0.823       0.912         0.2633 0.851   0.735
#> SD:skmeans  3 0.758           0.812       0.898         0.3828 0.718   0.500
#> CV:skmeans  3 0.556           0.678       0.840         0.3106 0.852   0.721
#> MAD:skmeans 3 0.870           0.909       0.959         0.3789 0.719   0.501
#> ATC:skmeans 3 0.872           0.918       0.959         0.2990 0.824   0.664
#> SD:mclust   3 0.440           0.715       0.750         0.7075 0.648   0.556
#> CV:mclust   3 0.305           0.635       0.754         0.3873 0.767   0.696
#> MAD:mclust  3 0.665           0.859       0.919         0.9081 0.653   0.538
#> ATC:mclust  3 1.000           0.972       0.980        -0.0892 0.747   0.624
#> SD:kmeans   3 0.470           0.752       0.867         0.5400 0.614   0.443
#> CV:kmeans   3 0.743           0.851       0.922         0.5642 0.607   0.432
#> MAD:kmeans  3 0.494           0.757       0.859         0.5951 0.675   0.496
#> ATC:kmeans  3 1.000           0.991       0.996         0.4348 0.622   0.421
#> SD:pam      3 0.757           0.845       0.930         1.0398 0.634   0.526
#> CV:pam      3 0.555           0.788       0.890         0.6767 0.635   0.524
#> MAD:pam     3 0.908           0.901       0.956         0.3416 0.866   0.754
#> ATC:pam     3 0.912           0.975       0.989         1.0349 0.663   0.530
#> SD:hclust   3 0.341           0.288       0.691         0.6633 0.858   0.811
#> CV:hclust   3 0.330           0.645       0.815         0.4021 0.897   0.850
#> MAD:hclust  3 0.289           0.259       0.638         0.6212 0.909   0.870
#> ATC:hclust  3 0.575           0.789       0.879         0.4432 0.885   0.800
get_stats(res_list, k = 4)
#>             k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> SD:NMF      4 0.668           0.752       0.873         0.1640 0.873   0.722
#> CV:NMF      4 0.505           0.547       0.756         0.1936 0.860   0.703
#> MAD:NMF     4 0.605           0.748       0.854         0.1573 0.859   0.671
#> ATC:NMF     4 0.645           0.693       0.846         0.1285 0.915   0.805
#> SD:skmeans  4 0.750           0.780       0.894         0.1183 0.828   0.539
#> CV:skmeans  4 0.622           0.697       0.845         0.1413 0.827   0.583
#> MAD:skmeans 4 0.763           0.777       0.893         0.1076 0.874   0.641
#> ATC:skmeans 4 0.897           0.868       0.938         0.0599 0.955   0.878
#> SD:mclust   4 0.762           0.803       0.922         0.2736 0.772   0.577
#> CV:mclust   4 0.581           0.727       0.873         0.3321 0.658   0.467
#> MAD:mclust  4 0.731           0.775       0.913         0.1947 0.782   0.576
#> ATC:mclust  4 0.694           0.849       0.898         0.2224 0.924   0.868
#> SD:kmeans   4 0.646           0.747       0.862         0.1928 0.716   0.411
#> CV:kmeans   4 0.627           0.750       0.857         0.1566 0.849   0.631
#> MAD:kmeans  4 0.667           0.705       0.845         0.1472 0.876   0.679
#> ATC:kmeans  4 0.857           0.917       0.961         0.1313 0.790   0.508
#> SD:pam      4 0.696           0.777       0.897         0.1656 0.876   0.721
#> CV:pam      4 0.549           0.371       0.661         0.1780 0.769   0.520
#> MAD:pam     4 0.760           0.854       0.894         0.1676 0.908   0.777
#> ATC:pam     4 0.710           0.882       0.923         0.1197 0.916   0.790
#> SD:hclust   4 0.422           0.517       0.739         0.1873 0.618   0.446
#> CV:hclust   4 0.343           0.419       0.618         0.3199 0.645   0.426
#> MAD:hclust  4 0.353           0.550       0.745         0.1916 0.628   0.447
#> ATC:hclust  4 0.551           0.693       0.793         0.1992 0.797   0.588
get_stats(res_list, k = 5)
#>             k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> SD:NMF      5 0.590           0.619       0.823         0.1118 0.884   0.689
#> CV:NMF      5 0.617           0.656       0.832         0.0766 0.799   0.515
#> MAD:NMF     5 0.611           0.661       0.820         0.0855 0.937   0.804
#> ATC:NMF     5 0.644           0.645       0.816         0.1485 0.846   0.596
#> SD:skmeans  5 0.707           0.660       0.831         0.0618 0.911   0.672
#> CV:skmeans  5 0.621           0.593       0.789         0.0624 0.941   0.785
#> MAD:skmeans 5 0.728           0.641       0.820         0.0612 0.899   0.634
#> ATC:skmeans 5 0.876           0.852       0.925         0.0682 0.938   0.822
#> SD:mclust   5 0.647           0.790       0.855         0.0987 0.839   0.603
#> CV:mclust   5 0.486           0.611       0.802         0.0645 0.837   0.591
#> MAD:mclust  5 0.653           0.760       0.861         0.0870 0.815   0.557
#> ATC:mclust  5 0.553           0.443       0.703         0.3003 0.759   0.519
#> SD:kmeans   5 0.629           0.535       0.750         0.0866 0.902   0.702
#> CV:kmeans   5 0.563           0.571       0.768         0.0738 0.935   0.788
#> MAD:kmeans  5 0.651           0.526       0.733         0.0786 0.930   0.778
#> ATC:kmeans  5 0.726           0.667       0.804         0.0704 0.839   0.500
#> SD:pam      5 0.621           0.741       0.836         0.1237 0.845   0.565
#> CV:pam      5 0.632           0.753       0.851         0.1641 0.747   0.337
#> MAD:pam     5 0.802           0.863       0.915         0.1296 0.881   0.650
#> ATC:pam     5 0.970           0.933       0.973         0.1283 0.821   0.512
#> SD:hclust   5 0.431           0.536       0.717         0.0805 0.844   0.616
#> CV:hclust   5 0.372           0.519       0.712         0.1225 0.822   0.514
#> MAD:hclust  5 0.481           0.598       0.755         0.1126 0.883   0.691
#> ATC:hclust  5 0.588           0.664       0.803         0.0317 0.995   0.984
get_stats(res_list, k = 6)
#>             k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> SD:NMF      6 0.558           0.522       0.747         0.0755 0.906   0.669
#> CV:NMF      6 0.574           0.537       0.754         0.0833 0.894   0.612
#> MAD:NMF     6 0.572           0.479       0.708         0.0678 0.947   0.806
#> ATC:NMF     6 0.604           0.555       0.761         0.0457 0.953   0.819
#> SD:skmeans  6 0.687           0.508       0.763         0.0362 0.979   0.903
#> CV:skmeans  6 0.616           0.487       0.730         0.0406 0.980   0.914
#> MAD:skmeans 6 0.693           0.482       0.755         0.0367 0.975   0.880
#> ATC:skmeans 6 0.774           0.743       0.873         0.0390 0.993   0.977
#> SD:mclust   6 0.650           0.737       0.818         0.0877 0.937   0.789
#> CV:mclust   6 0.507           0.474       0.718         0.0979 0.904   0.701
#> MAD:mclust  6 0.674           0.569       0.810         0.0661 0.918   0.738
#> ATC:mclust  6 0.535           0.574       0.724         0.0719 0.785   0.410
#> SD:kmeans   6 0.655           0.522       0.722         0.0469 0.944   0.797
#> CV:kmeans   6 0.594           0.484       0.720         0.0516 0.896   0.641
#> MAD:kmeans  6 0.663           0.492       0.707         0.0494 0.868   0.557
#> ATC:kmeans  6 0.700           0.749       0.799         0.0465 0.931   0.701
#> SD:pam      6 0.610           0.580       0.777         0.0450 0.935   0.745
#> CV:pam      6 0.644           0.609       0.798         0.0496 0.949   0.802
#> MAD:pam     6 0.760           0.770       0.871         0.0417 0.968   0.865
#> ATC:pam     6 0.945           0.891       0.954         0.0298 0.974   0.889
#> SD:hclust   6 0.479           0.582       0.745         0.0541 0.930   0.799
#> CV:hclust   6 0.461           0.562       0.747         0.0650 0.929   0.754
#> MAD:hclust  6 0.529           0.626       0.793         0.0454 0.989   0.961
#> ATC:hclust  6 0.648           0.719       0.817         0.0603 0.945   0.828

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) protocol(p) k
#> SD:NMF      72           0.0627     0.05971 2
#> CV:NMF      73           0.0820     0.08278 2
#> MAD:NMF     73           0.0373     0.03254 2
#> ATC:NMF     72           0.0301     0.22647 2
#> SD:skmeans  73           0.0195     0.41301 2
#> CV:skmeans  72           0.0509     0.45775 2
#> MAD:skmeans 68           0.0115     0.44976 2
#> ATC:skmeans 73           0.1251     0.53982 2
#> SD:mclust   72           0.2291     0.08225 2
#> CV:mclust   72           0.2222     0.06909 2
#> MAD:mclust  69           0.1245     0.14294 2
#> ATC:mclust  73           0.2023     0.15705 2
#> SD:kmeans   73           0.2001     0.28085 2
#> CV:kmeans   73           0.2001     0.28085 2
#> MAD:kmeans  73           0.2001     0.28085 2
#> ATC:kmeans  72           0.0539     0.10956 2
#> SD:pam      71           0.1167     0.17607 2
#> CV:pam      66           0.1941     0.12671 2
#> MAD:pam     70           0.4972     0.00524 2
#> ATC:pam     73           0.3086     0.01410 2
#> SD:hclust   67           0.4934     0.08373 2
#> CV:hclust   69           0.2592     0.15694 2
#> MAD:hclust  66           0.1968     0.05298 2
#> ATC:hclust  65           0.0203     0.01259 2
test_to_known_factors(res_list, k = 3)
#>              n disease.state(p) protocol(p) k
#> SD:NMF      68          0.01004    0.020751 3
#> CV:NMF      66          0.01573    0.033820 3
#> MAD:NMF     68          0.01355    0.012173 3
#> ATC:NMF     69          0.05370    0.852822 3
#> SD:skmeans  66          0.26072    0.002246 3
#> CV:skmeans  59          0.13192    0.560464 3
#> MAD:skmeans 70          0.13711    0.003911 3
#> ATC:skmeans 70          0.12743    0.023240 3
#> SD:mclust   68          0.69430    0.000355 3
#> CV:mclust   56          0.43629    0.000475 3
#> MAD:mclust  71          0.56073    0.000356 3
#> ATC:mclust  73          0.00304    0.162811 3
#> SD:kmeans   68          0.03307    0.025074 3
#> CV:kmeans   69          0.16624    0.015692 3
#> MAD:kmeans  68          0.36611    0.000924 3
#> ATC:kmeans  73          0.16649    0.013746 3
#> SD:pam      69          0.52017    0.000720 3
#> CV:pam      68          0.64310    0.001341 3
#> MAD:pam     69          0.59151    0.000486 3
#> ATC:pam     73          0.26327    0.005017 3
#> SD:hclust    8               NA          NA 3
#> CV:hclust   59          0.57916    0.245754 3
#> MAD:hclust  10               NA          NA 3
#> ATC:hclust  69          0.07188    0.088634 3
test_to_known_factors(res_list, k = 4)
#>              n disease.state(p) protocol(p) k
#> SD:NMF      65         0.003498    9.27e-03 4
#> CV:NMF      48         0.089534    1.15e-01 4
#> MAD:NMF     69         0.000541    3.74e-02 4
#> ATC:NMF     62         0.039027    8.39e-01 4
#> SD:skmeans  66         0.205023    4.00e-02 4
#> CV:skmeans  61         0.088656    2.66e-01 4
#> MAD:skmeans 63         0.129816    6.68e-03 4
#> ATC:skmeans 70         0.053090    6.39e-02 4
#> SD:mclust   67         0.018514    8.01e-07 4
#> CV:mclust   61         0.121983    1.00e-03 4
#> MAD:mclust  64         0.075376    5.16e-06 4
#> ATC:mclust  70         0.005686    2.41e-01 4
#> SD:kmeans   64         0.010572    6.67e-05 4
#> CV:kmeans   63         0.195758    2.92e-02 4
#> MAD:kmeans  60         0.045655    9.87e-04 4
#> ATC:kmeans  72         0.309004    1.14e-02 4
#> SD:pam      67         0.009047    3.38e-05 4
#> CV:pam      33         0.251837    5.04e-02 4
#> MAD:pam     70         0.008388    1.91e-05 4
#> ATC:pam     73         0.018556    1.89e-04 4
#> SD:hclust   47         0.363194    1.82e-02 4
#> CV:hclust   34         0.246008    1.87e-01 4
#> MAD:hclust  52         0.407948    1.20e-03 4
#> ATC:hclust  64         0.164468    8.71e-03 4
test_to_known_factors(res_list, k = 5)
#>              n disease.state(p) protocol(p) k
#> SD:NMF      51          0.01064    4.49e-02 5
#> CV:NMF      59          0.05516    3.21e-02 5
#> MAD:NMF     57          0.04567    8.31e-02 5
#> ATC:NMF     56          0.05708    4.38e-01 5
#> SD:skmeans  56          0.02275    4.07e-03 5
#> CV:skmeans  48          0.10676    1.64e-01 5
#> MAD:skmeans 53          0.01050    6.49e-03 5
#> ATC:skmeans 67          0.03753    2.16e-01 5
#> SD:mclust   67          0.00532    3.10e-08 5
#> CV:mclust   57          0.12910    2.16e-07 5
#> MAD:mclust  66          0.00725    3.58e-07 5
#> ATC:mclust  35          0.00941    5.35e-01 5
#> SD:kmeans   42          0.01435    1.13e-03 5
#> CV:kmeans   54          0.12297    4.21e-03 5
#> MAD:kmeans  43          0.00835    4.63e-03 5
#> ATC:kmeans  60          0.24913    1.86e-03 5
#> SD:pam      63          0.00451    4.88e-06 5
#> CV:pam      64          0.01618    5.64e-04 5
#> MAD:pam     70          0.00663    1.96e-05 5
#> ATC:pam     73          0.01145    7.46e-06 5
#> SD:hclust   48          0.22484    2.16e-05 5
#> CV:hclust   50          0.10620    2.35e-02 5
#> MAD:hclust  53          0.27236    7.63e-05 5
#> ATC:hclust  62          0.11200    1.34e-02 5
test_to_known_factors(res_list, k = 6)
#>              n disease.state(p) protocol(p) k
#> SD:NMF      44          0.06290    2.82e-02 6
#> CV:NMF      48          0.02428    1.06e-02 6
#> MAD:NMF     36          0.21603    5.32e-02 6
#> ATC:NMF     44          0.03977    5.07e-01 6
#> SD:skmeans  44          0.01196    4.88e-02 6
#> CV:skmeans  37          0.16028    1.48e-01 6
#> MAD:skmeans 41          0.04098    6.23e-02 6
#> ATC:skmeans 61          0.00625    2.84e-01 6
#> SD:mclust   68          0.00486    2.77e-06 6
#> CV:mclust   37          0.14550    1.15e-04 6
#> MAD:mclust  54          0.00439    2.15e-05 6
#> ATC:mclust  61          0.01540    6.29e-02 6
#> SD:kmeans   45          0.01031    5.89e-03 6
#> CV:kmeans   45          0.10855    2.26e-03 6
#> MAD:kmeans  45          0.03738    1.32e-02 6
#> ATC:kmeans  68          0.01203    7.98e-03 6
#> SD:pam      53          0.29199    8.43e-07 6
#> CV:pam      54          0.04573    8.61e-03 6
#> MAD:pam     66          0.01164    8.04e-06 6
#> ATC:pam     72          0.12091    2.05e-04 6
#> SD:hclust   51          0.14014    3.49e-05 6
#> CV:hclust   52          0.13924    3.51e-03 6
#> MAD:hclust  55          0.07985    1.45e-03 6
#> ATC:hclust  63          0.02188    9.13e-03 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 31632 rows and 73 columns.
#>   Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'SD' method.
#>   Subgroups are detected by 'hclust' method.
#>   Performed in total 1250 partitions by row resampling.
#>   Best k for subgroups seems to be 5.
#> 
#> Following methods can be applied to this 'ConsensusPartition' object:
#>  [1] "cola_report"             "collect_classes"         "collect_plots"          
#>  [4] "collect_stats"           "colnames"                "compare_signatures"     
#>  [7] "consensus_heatmap"       "dimension_reduction"     "functional_enrichment"  
#> [10] "get_anno_col"            "get_anno"                "get_classes"            
#> [13] "get_consensus"           "get_matrix"              "get_membership"         
#> [16] "get_param"               "get_signatures"          "get_stats"              
#> [19] "is_best_k"               "is_stable_k"             "membership_heatmap"     
#> [22] "ncol"                    "nrow"                    "plot_ecdf"              
#> [25] "rownames"                "select_partition_number" "show"                   
#> [28] "suggest_best_k"          "test_to_known_factors"

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

collect_plots(res)

plot of chunk SD-hclust-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.668           0.815       0.914         0.3111 0.703   0.703
#> 3 3 0.341           0.288       0.691         0.6633 0.858   0.811
#> 4 4 0.422           0.517       0.739         0.1873 0.618   0.446
#> 5 5 0.431           0.536       0.717         0.0805 0.844   0.616
#> 6 6 0.479           0.582       0.745         0.0541 0.930   0.799

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
#> GSM1178971     1  0.0938      0.919 0.988 0.012
#> GSM1178979     2  0.9996      0.100 0.488 0.512
#> GSM1179009     1  0.7056      0.767 0.808 0.192
#> GSM1179031     2  0.0376      0.807 0.004 0.996
#> GSM1178970     1  0.8081      0.682 0.752 0.248
#> GSM1178972     2  0.0376      0.807 0.004 0.996
#> GSM1178973     1  0.0376      0.916 0.996 0.004
#> GSM1178974     2  0.0376      0.807 0.004 0.996
#> GSM1178977     1  0.8081      0.682 0.752 0.248
#> GSM1178978     1  0.6801      0.780 0.820 0.180
#> GSM1178998     1  0.0376      0.916 0.996 0.004
#> GSM1179010     1  0.0376      0.916 0.996 0.004
#> GSM1179018     1  0.6247      0.814 0.844 0.156
#> GSM1179024     1  0.0376      0.916 0.996 0.004
#> GSM1178984     1  0.0938      0.918 0.988 0.012
#> GSM1178990     1  0.0672      0.918 0.992 0.008
#> GSM1178991     1  0.1843      0.912 0.972 0.028
#> GSM1178994     1  0.0938      0.918 0.988 0.012
#> GSM1178997     1  0.0376      0.918 0.996 0.004
#> GSM1179000     1  0.0376      0.918 0.996 0.004
#> GSM1179013     1  0.0376      0.916 0.996 0.004
#> GSM1179014     1  0.3584      0.893 0.932 0.068
#> GSM1179019     1  0.0376      0.918 0.996 0.004
#> GSM1179020     1  0.0376      0.916 0.996 0.004
#> GSM1179022     1  0.0376      0.916 0.996 0.004
#> GSM1179028     2  0.0376      0.807 0.004 0.996
#> GSM1179032     1  0.0376      0.916 0.996 0.004
#> GSM1179041     2  0.0376      0.807 0.004 0.996
#> GSM1179042     2  0.0376      0.807 0.004 0.996
#> GSM1178976     1  0.9754      0.277 0.592 0.408
#> GSM1178981     1  0.1633      0.918 0.976 0.024
#> GSM1178982     1  0.2236      0.915 0.964 0.036
#> GSM1178983     1  0.2236      0.915 0.964 0.036
#> GSM1178985     1  0.1843      0.917 0.972 0.028
#> GSM1178992     1  0.1843      0.916 0.972 0.028
#> GSM1179005     1  0.1843      0.916 0.972 0.028
#> GSM1179007     1  0.1633      0.917 0.976 0.024
#> GSM1179012     1  0.0376      0.916 0.996 0.004
#> GSM1179016     1  0.4431      0.874 0.908 0.092
#> GSM1179030     1  0.3274      0.904 0.940 0.060
#> GSM1179038     1  0.1184      0.918 0.984 0.016
#> GSM1178987     1  0.1633      0.918 0.976 0.024
#> GSM1179003     2  0.9815      0.344 0.420 0.580
#> GSM1179004     1  0.2236      0.914 0.964 0.036
#> GSM1179039     2  0.0376      0.807 0.004 0.996
#> GSM1178975     1  0.0376      0.916 0.996 0.004
#> GSM1178980     2  0.9850      0.326 0.428 0.572
#> GSM1178995     1  0.1843      0.916 0.972 0.028
#> GSM1178996     1  0.0938      0.919 0.988 0.012
#> GSM1179001     1  0.0376      0.916 0.996 0.004
#> GSM1179002     1  0.0376      0.916 0.996 0.004
#> GSM1179006     1  0.3114      0.907 0.944 0.056
#> GSM1179008     1  0.0376      0.916 0.996 0.004
#> GSM1179015     1  0.0376      0.916 0.996 0.004
#> GSM1179017     1  0.9754      0.255 0.592 0.408
#> GSM1179026     1  0.2603      0.912 0.956 0.044
#> GSM1179033     1  0.1843      0.916 0.972 0.028
#> GSM1179035     1  0.2778      0.910 0.952 0.048
#> GSM1179036     1  0.1414      0.919 0.980 0.020
#> GSM1178986     1  0.3274      0.902 0.940 0.060
#> GSM1178989     1  0.9732      0.290 0.596 0.404
#> GSM1178993     1  0.7299      0.750 0.796 0.204
#> GSM1178999     2  0.9248      0.522 0.340 0.660
#> GSM1179021     2  0.8763      0.586 0.296 0.704
#> GSM1179025     2  0.0376      0.807 0.004 0.996
#> GSM1179027     1  0.8909      0.557 0.692 0.308
#> GSM1179011     1  0.3274      0.895 0.940 0.060
#> GSM1179023     1  0.0376      0.916 0.996 0.004
#> GSM1179029     1  0.0376      0.916 0.996 0.004
#> GSM1179034     1  0.0376      0.916 0.996 0.004
#> GSM1179040     1  0.8909      0.557 0.692 0.308
#> GSM1178988     1  0.5059      0.862 0.888 0.112
#> GSM1179037     1  0.2778      0.910 0.952 0.048

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>            class entropy silhouette    p1    p2    p3
#> GSM1178971     1  0.4702    0.28275 0.788 0.000 0.212
#> GSM1178979     1  0.9749   -0.05180 0.444 0.260 0.296
#> GSM1179009     1  0.6026    0.12757 0.624 0.000 0.376
#> GSM1179031     2  0.0000    0.87307 0.000 1.000 0.000
#> GSM1178970     1  0.7186    0.14349 0.624 0.040 0.336
#> GSM1178972     2  0.1031    0.86183 0.000 0.976 0.024
#> GSM1178973     3  0.6280    0.45490 0.460 0.000 0.540
#> GSM1178974     2  0.0000    0.87307 0.000 1.000 0.000
#> GSM1178977     1  0.7186    0.14349 0.624 0.040 0.336
#> GSM1178978     1  0.5678    0.18922 0.684 0.000 0.316
#> GSM1178998     1  0.6045    0.01731 0.620 0.000 0.380
#> GSM1179010     1  0.6026    0.02327 0.624 0.000 0.376
#> GSM1179018     1  0.5986    0.20992 0.704 0.012 0.284
#> GSM1179024     1  0.6111    0.00111 0.604 0.000 0.396
#> GSM1178984     1  0.2959    0.40103 0.900 0.000 0.100
#> GSM1178990     1  0.4555    0.28600 0.800 0.000 0.200
#> GSM1178991     3  0.6274    0.44691 0.456 0.000 0.544
#> GSM1178994     1  0.2625    0.41443 0.916 0.000 0.084
#> GSM1178997     1  0.5988    0.04998 0.632 0.000 0.368
#> GSM1179000     1  0.5988    0.04998 0.632 0.000 0.368
#> GSM1179013     1  0.6111    0.00111 0.604 0.000 0.396
#> GSM1179014     1  0.6095    0.04302 0.608 0.000 0.392
#> GSM1179019     1  0.5988    0.04998 0.632 0.000 0.368
#> GSM1179020     1  0.6095    0.00172 0.608 0.000 0.392
#> GSM1179022     1  0.6111    0.00111 0.604 0.000 0.396
#> GSM1179028     2  0.0000    0.87307 0.000 1.000 0.000
#> GSM1179032     1  0.6111    0.00111 0.604 0.000 0.396
#> GSM1179041     2  0.0000    0.87307 0.000 1.000 0.000
#> GSM1179042     2  0.0000    0.87307 0.000 1.000 0.000
#> GSM1178976     1  0.8845    0.08799 0.576 0.240 0.184
#> GSM1178981     1  0.1163    0.45390 0.972 0.000 0.028
#> GSM1178982     1  0.2537    0.43991 0.920 0.000 0.080
#> GSM1178983     1  0.2959    0.43137 0.900 0.000 0.100
#> GSM1178985     1  0.1031    0.45627 0.976 0.000 0.024
#> GSM1178992     1  0.0892    0.45763 0.980 0.000 0.020
#> GSM1179005     1  0.0892    0.45763 0.980 0.000 0.020
#> GSM1179007     1  0.1529    0.45387 0.960 0.000 0.040
#> GSM1179012     1  0.6026    0.02917 0.624 0.000 0.376
#> GSM1179016     1  0.5650    0.22362 0.688 0.000 0.312
#> GSM1179030     1  0.3910    0.42302 0.876 0.020 0.104
#> GSM1179038     1  0.1753    0.44494 0.952 0.000 0.048
#> GSM1178987     1  0.1163    0.45390 0.972 0.000 0.028
#> GSM1179003     1  0.9992   -0.24296 0.352 0.320 0.328
#> GSM1179004     1  0.1163    0.45150 0.972 0.000 0.028
#> GSM1179039     2  0.0000    0.87307 0.000 1.000 0.000
#> GSM1178975     3  0.6280    0.45490 0.460 0.000 0.540
#> GSM1178980     3  0.9817   -0.34602 0.272 0.300 0.428
#> GSM1178995     1  0.0892    0.45763 0.980 0.000 0.020
#> GSM1178996     1  0.4121    0.34343 0.832 0.000 0.168
#> GSM1179001     1  0.6095    0.00172 0.608 0.000 0.392
#> GSM1179002     1  0.6095    0.00172 0.608 0.000 0.392
#> GSM1179006     1  0.2339    0.45065 0.940 0.012 0.048
#> GSM1179008     1  0.6111   -0.00968 0.604 0.000 0.396
#> GSM1179015     1  0.6079    0.01087 0.612 0.000 0.388
#> GSM1179017     1  0.9544   -0.05008 0.420 0.192 0.388
#> GSM1179026     1  0.1411    0.44954 0.964 0.000 0.036
#> GSM1179033     1  0.1163    0.45688 0.972 0.000 0.028
#> GSM1179035     1  0.1411    0.44949 0.964 0.000 0.036
#> GSM1179036     1  0.2537    0.43460 0.920 0.000 0.080
#> GSM1178986     1  0.3896    0.39329 0.864 0.008 0.128
#> GSM1178989     1  0.8813    0.09222 0.580 0.236 0.184
#> GSM1178993     1  0.6079    0.11736 0.612 0.000 0.388
#> GSM1178999     2  0.9805    0.27147 0.240 0.396 0.364
#> GSM1179021     2  0.9684    0.34256 0.220 0.428 0.352
#> GSM1179025     2  0.0000    0.87307 0.000 1.000 0.000
#> GSM1179027     1  0.7784    0.06389 0.556 0.056 0.388
#> GSM1179011     3  0.6079    0.44732 0.388 0.000 0.612
#> GSM1179023     1  0.6111    0.00111 0.604 0.000 0.396
#> GSM1179029     1  0.6079    0.01087 0.612 0.000 0.388
#> GSM1179034     1  0.6111    0.00111 0.604 0.000 0.396
#> GSM1179040     1  0.7784    0.06389 0.556 0.056 0.388
#> GSM1178988     1  0.3850    0.39538 0.884 0.028 0.088
#> GSM1179037     1  0.1411    0.44949 0.964 0.000 0.036

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>            class entropy silhouette    p1    p2    p3    p4
#> GSM1178971     1  0.4477     0.2414 0.688 0.000 0.312 0.000
#> GSM1178979     3  0.7021    -0.3350 0.004 0.116 0.536 0.344
#> GSM1179009     3  0.4259     0.2488 0.056 0.000 0.816 0.128
#> GSM1179031     2  0.0000     0.9931 0.000 1.000 0.000 0.000
#> GSM1178970     3  0.2335     0.2678 0.008 0.020 0.928 0.044
#> GSM1178972     2  0.1411     0.9498 0.000 0.960 0.020 0.020
#> GSM1178973     1  0.5371     0.5703 0.732 0.000 0.188 0.080
#> GSM1178974     2  0.0000     0.9931 0.000 1.000 0.000 0.000
#> GSM1178977     3  0.2335     0.2678 0.008 0.020 0.928 0.044
#> GSM1178978     3  0.2773     0.3715 0.072 0.000 0.900 0.028
#> GSM1178998     1  0.1677     0.7645 0.948 0.000 0.040 0.012
#> GSM1179010     1  0.2670     0.7476 0.904 0.000 0.072 0.024
#> GSM1179018     3  0.5042     0.4012 0.136 0.000 0.768 0.096
#> GSM1179024     1  0.0000     0.7779 1.000 0.000 0.000 0.000
#> GSM1178984     1  0.5399    -0.3925 0.520 0.000 0.468 0.012
#> GSM1178990     1  0.4431     0.2287 0.696 0.000 0.304 0.000
#> GSM1178991     1  0.5496     0.5190 0.704 0.000 0.232 0.064
#> GSM1178994     1  0.5296    -0.4641 0.496 0.000 0.496 0.008
#> GSM1178997     1  0.1637     0.7539 0.940 0.000 0.060 0.000
#> GSM1179000     1  0.1637     0.7539 0.940 0.000 0.060 0.000
#> GSM1179013     1  0.0000     0.7779 1.000 0.000 0.000 0.000
#> GSM1179014     1  0.5882     0.3930 0.608 0.000 0.048 0.344
#> GSM1179019     1  0.1637     0.7539 0.940 0.000 0.060 0.000
#> GSM1179020     1  0.0376     0.7776 0.992 0.000 0.004 0.004
#> GSM1179022     1  0.0000     0.7779 1.000 0.000 0.000 0.000
#> GSM1179028     2  0.0000     0.9931 0.000 1.000 0.000 0.000
#> GSM1179032     1  0.0000     0.7779 1.000 0.000 0.000 0.000
#> GSM1179041     2  0.0000     0.9931 0.000 1.000 0.000 0.000
#> GSM1179042     2  0.0000     0.9931 0.000 1.000 0.000 0.000
#> GSM1178976     3  0.6464     0.1291 0.008 0.120 0.660 0.212
#> GSM1178981     3  0.4877     0.5919 0.408 0.000 0.592 0.000
#> GSM1178982     3  0.4977     0.5076 0.460 0.000 0.540 0.000
#> GSM1178983     3  0.5151     0.4858 0.464 0.000 0.532 0.004
#> GSM1178985     3  0.4916     0.5790 0.424 0.000 0.576 0.000
#> GSM1178992     3  0.4907     0.5846 0.420 0.000 0.580 0.000
#> GSM1179005     3  0.4907     0.5846 0.420 0.000 0.580 0.000
#> GSM1179007     3  0.4948     0.5572 0.440 0.000 0.560 0.000
#> GSM1179012     1  0.2670     0.7527 0.908 0.000 0.040 0.052
#> GSM1179016     4  0.7192    -0.1124 0.368 0.000 0.144 0.488
#> GSM1179030     3  0.5893     0.5006 0.444 0.012 0.528 0.016
#> GSM1179038     3  0.4994     0.4876 0.480 0.000 0.520 0.000
#> GSM1178987     3  0.4877     0.5919 0.408 0.000 0.592 0.000
#> GSM1179003     3  0.7492    -0.5203 0.000 0.180 0.432 0.388
#> GSM1179004     3  0.4817     0.6062 0.388 0.000 0.612 0.000
#> GSM1179039     2  0.0000     0.9931 0.000 1.000 0.000 0.000
#> GSM1178975     1  0.5371     0.5703 0.732 0.000 0.188 0.080
#> GSM1178980     4  0.7978     0.5017 0.012 0.196 0.388 0.404
#> GSM1178995     3  0.4907     0.5846 0.420 0.000 0.580 0.000
#> GSM1178996     1  0.4964    -0.0199 0.616 0.000 0.380 0.004
#> GSM1179001     1  0.0376     0.7776 0.992 0.000 0.004 0.004
#> GSM1179002     1  0.0376     0.7776 0.992 0.000 0.004 0.004
#> GSM1179006     3  0.5441     0.6003 0.396 0.012 0.588 0.004
#> GSM1179008     1  0.0524     0.7767 0.988 0.000 0.008 0.004
#> GSM1179015     1  0.2546     0.7519 0.912 0.000 0.028 0.060
#> GSM1179017     4  0.4452     0.3101 0.000 0.048 0.156 0.796
#> GSM1179026     3  0.5313     0.6107 0.376 0.000 0.608 0.016
#> GSM1179033     3  0.5060     0.5925 0.412 0.000 0.584 0.004
#> GSM1179035     3  0.5204     0.6108 0.376 0.000 0.612 0.012
#> GSM1179036     3  0.5295     0.4478 0.488 0.000 0.504 0.008
#> GSM1178986     3  0.5289     0.5598 0.344 0.000 0.636 0.020
#> GSM1178989     3  0.6415     0.1384 0.008 0.116 0.664 0.212
#> GSM1178993     3  0.4174     0.2129 0.044 0.000 0.816 0.140
#> GSM1178999     4  0.8165     0.4962 0.012 0.256 0.320 0.412
#> GSM1179021     4  0.7888     0.4424 0.000 0.320 0.300 0.380
#> GSM1179025     2  0.0000     0.9931 0.000 1.000 0.000 0.000
#> GSM1179027     3  0.5349    -0.0477 0.024 0.000 0.640 0.336
#> GSM1179011     1  0.6452     0.3649 0.620 0.000 0.268 0.112
#> GSM1179023     1  0.0000     0.7779 1.000 0.000 0.000 0.000
#> GSM1179029     1  0.2546     0.7519 0.912 0.000 0.028 0.060
#> GSM1179034     1  0.0000     0.7779 1.000 0.000 0.000 0.000
#> GSM1179040     3  0.5349    -0.0477 0.024 0.000 0.640 0.336
#> GSM1178988     3  0.6402     0.6100 0.296 0.016 0.628 0.060
#> GSM1179037     3  0.5204     0.6108 0.376 0.000 0.612 0.012

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>            class entropy silhouette    p1    p2    p3    p4    p5
#> GSM1178971     3  0.4264     0.0142 0.376 0.000 0.620 0.004 0.000
#> GSM1178979     4  0.7971     0.5277 0.024 0.052 0.348 0.400 0.176
#> GSM1179009     3  0.6829    -0.1057 0.164 0.000 0.528 0.276 0.032
#> GSM1179031     2  0.0000     0.9923 0.000 1.000 0.000 0.000 0.000
#> GSM1178970     3  0.7070     0.0494 0.132 0.008 0.580 0.208 0.072
#> GSM1178972     2  0.1485     0.9441 0.000 0.948 0.000 0.020 0.032
#> GSM1178973     1  0.5888     0.3280 0.684 0.000 0.140 0.124 0.052
#> GSM1178974     2  0.0000     0.9923 0.000 1.000 0.000 0.000 0.000
#> GSM1178977     3  0.7070     0.0494 0.132 0.008 0.580 0.208 0.072
#> GSM1178978     3  0.6479     0.2021 0.156 0.000 0.616 0.180 0.048
#> GSM1178998     1  0.5305     0.6307 0.624 0.000 0.320 0.016 0.040
#> GSM1179010     1  0.7623     0.1865 0.396 0.000 0.348 0.192 0.064
#> GSM1179018     3  0.6384     0.0838 0.128 0.000 0.572 0.276 0.024
#> GSM1179024     1  0.3774     0.7149 0.704 0.000 0.296 0.000 0.000
#> GSM1178984     3  0.3599     0.6267 0.140 0.000 0.824 0.016 0.020
#> GSM1178990     3  0.3913     0.1632 0.324 0.000 0.676 0.000 0.000
#> GSM1178991     1  0.5783     0.2976 0.692 0.000 0.124 0.136 0.048
#> GSM1178994     3  0.3069     0.6684 0.104 0.000 0.864 0.016 0.016
#> GSM1178997     1  0.4151     0.6693 0.652 0.000 0.344 0.004 0.000
#> GSM1179000     1  0.4151     0.6693 0.652 0.000 0.344 0.004 0.000
#> GSM1179013     1  0.3774     0.7149 0.704 0.000 0.296 0.000 0.000
#> GSM1179014     5  0.6788    -0.1634 0.344 0.000 0.284 0.000 0.372
#> GSM1179019     1  0.4151     0.6693 0.652 0.000 0.344 0.004 0.000
#> GSM1179020     1  0.3928     0.7133 0.700 0.000 0.296 0.000 0.004
#> GSM1179022     1  0.3774     0.7149 0.704 0.000 0.296 0.000 0.000
#> GSM1179028     2  0.0000     0.9923 0.000 1.000 0.000 0.000 0.000
#> GSM1179032     1  0.3774     0.7149 0.704 0.000 0.296 0.000 0.000
#> GSM1179041     2  0.0000     0.9923 0.000 1.000 0.000 0.000 0.000
#> GSM1179042     2  0.0000     0.9923 0.000 1.000 0.000 0.000 0.000
#> GSM1178976     3  0.7166    -0.0257 0.016 0.080 0.576 0.100 0.228
#> GSM1178981     3  0.1205     0.7315 0.040 0.000 0.956 0.004 0.000
#> GSM1178982     3  0.2723     0.6716 0.124 0.000 0.864 0.012 0.000
#> GSM1178983     3  0.3154     0.6447 0.148 0.000 0.836 0.012 0.004
#> GSM1178985     3  0.1043     0.7281 0.040 0.000 0.960 0.000 0.000
#> GSM1178992     3  0.0880     0.7278 0.032 0.000 0.968 0.000 0.000
#> GSM1179005     3  0.0963     0.7283 0.036 0.000 0.964 0.000 0.000
#> GSM1179007     3  0.1478     0.7187 0.064 0.000 0.936 0.000 0.000
#> GSM1179012     1  0.7886     0.2326 0.368 0.000 0.352 0.188 0.092
#> GSM1179016     5  0.5901     0.3458 0.132 0.000 0.300 0.000 0.568
#> GSM1179030     3  0.3759     0.6489 0.148 0.000 0.812 0.012 0.028
#> GSM1179038     3  0.1965     0.6905 0.096 0.000 0.904 0.000 0.000
#> GSM1178987     3  0.1124     0.7316 0.036 0.000 0.960 0.004 0.000
#> GSM1179003     4  0.7518     0.5762 0.008 0.076 0.216 0.524 0.176
#> GSM1179004     3  0.0671     0.7276 0.016 0.000 0.980 0.004 0.000
#> GSM1179039     2  0.0000     0.9923 0.000 1.000 0.000 0.000 0.000
#> GSM1178975     1  0.5888     0.3280 0.684 0.000 0.140 0.124 0.052
#> GSM1178980     4  0.4858     0.5474 0.024 0.108 0.080 0.776 0.012
#> GSM1178995     3  0.0963     0.7283 0.036 0.000 0.964 0.000 0.000
#> GSM1178996     3  0.4102     0.2832 0.300 0.000 0.692 0.004 0.004
#> GSM1179001     1  0.4193     0.7101 0.684 0.000 0.304 0.000 0.012
#> GSM1179002     1  0.4193     0.7101 0.684 0.000 0.304 0.000 0.012
#> GSM1179006     3  0.1989     0.7269 0.032 0.004 0.932 0.028 0.004
#> GSM1179008     1  0.4173     0.7103 0.688 0.000 0.300 0.000 0.012
#> GSM1179015     1  0.7803     0.2471 0.392 0.000 0.336 0.188 0.084
#> GSM1179017     5  0.3389    -0.0851 0.000 0.000 0.048 0.116 0.836
#> GSM1179026     3  0.1074     0.7239 0.012 0.000 0.968 0.004 0.016
#> GSM1179033     3  0.0955     0.7306 0.028 0.000 0.968 0.000 0.004
#> GSM1179035     3  0.0854     0.7224 0.008 0.000 0.976 0.004 0.012
#> GSM1179036     3  0.2911     0.6545 0.136 0.000 0.852 0.004 0.008
#> GSM1178986     3  0.4267     0.6393 0.180 0.000 0.772 0.028 0.020
#> GSM1178989     3  0.7116    -0.0135 0.016 0.076 0.580 0.100 0.228
#> GSM1178993     3  0.6903    -0.1689 0.164 0.000 0.508 0.296 0.032
#> GSM1178999     4  0.6704     0.5269 0.008 0.144 0.068 0.628 0.152
#> GSM1179021     4  0.5393     0.4782 0.004 0.228 0.068 0.684 0.016
#> GSM1179025     2  0.0000     0.9923 0.000 1.000 0.000 0.000 0.000
#> GSM1179027     4  0.5883     0.4096 0.068 0.000 0.420 0.500 0.012
#> GSM1179011     1  0.5603     0.1335 0.688 0.000 0.060 0.200 0.052
#> GSM1179023     1  0.3774     0.7149 0.704 0.000 0.296 0.000 0.000
#> GSM1179029     1  0.7720     0.2837 0.408 0.000 0.332 0.180 0.080
#> GSM1179034     1  0.3774     0.7149 0.704 0.000 0.296 0.000 0.000
#> GSM1179040     4  0.5883     0.4096 0.068 0.000 0.420 0.500 0.012
#> GSM1178988     3  0.2847     0.6612 0.012 0.004 0.892 0.036 0.056
#> GSM1179037     3  0.0854     0.7224 0.008 0.000 0.976 0.004 0.012

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>            class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM1178971     3  0.4301    0.00224 0.400 0.000 0.580 0.000 0.004 0.016
#> GSM1178979     3  0.8008   -0.27210 0.032 0.024 0.344 0.328 0.208 0.064
#> GSM1179009     3  0.7095    0.32376 0.172 0.000 0.512 0.152 0.012 0.152
#> GSM1179031     2  0.0000    0.99114 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1178970     3  0.6921    0.41111 0.096 0.004 0.572 0.112 0.036 0.180
#> GSM1178972     2  0.1518    0.93522 0.000 0.944 0.000 0.024 0.024 0.008
#> GSM1178973     1  0.5161    0.34256 0.728 0.000 0.076 0.052 0.024 0.120
#> GSM1178974     2  0.0000    0.99114 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1178977     3  0.6921    0.41111 0.096 0.004 0.572 0.112 0.036 0.180
#> GSM1178978     3  0.6474    0.46248 0.140 0.000 0.588 0.068 0.020 0.184
#> GSM1178998     1  0.5486    0.41514 0.568 0.000 0.208 0.000 0.000 0.224
#> GSM1179010     6  0.4641    0.67729 0.116 0.000 0.200 0.000 0.000 0.684
#> GSM1179018     3  0.6534    0.34726 0.124 0.000 0.548 0.252 0.016 0.060
#> GSM1179024     1  0.3101    0.76480 0.756 0.000 0.244 0.000 0.000 0.000
#> GSM1178984     3  0.3558    0.57346 0.088 0.000 0.800 0.000 0.000 0.112
#> GSM1178990     3  0.3620    0.19442 0.352 0.000 0.648 0.000 0.000 0.000
#> GSM1178991     1  0.5371    0.31238 0.716 0.000 0.072 0.088 0.024 0.100
#> GSM1178994     3  0.3032    0.61085 0.056 0.000 0.840 0.000 0.000 0.104
#> GSM1178997     1  0.3885    0.70421 0.684 0.000 0.300 0.000 0.004 0.012
#> GSM1179000     1  0.3885    0.70421 0.684 0.000 0.300 0.000 0.004 0.012
#> GSM1179013     1  0.3101    0.76722 0.756 0.000 0.244 0.000 0.000 0.000
#> GSM1179014     5  0.6014   -0.08296 0.368 0.000 0.240 0.000 0.392 0.000
#> GSM1179019     1  0.3867    0.70685 0.688 0.000 0.296 0.000 0.004 0.012
#> GSM1179020     1  0.3584    0.76249 0.740 0.000 0.244 0.000 0.004 0.012
#> GSM1179022     1  0.3101    0.76722 0.756 0.000 0.244 0.000 0.000 0.000
#> GSM1179028     2  0.0000    0.99114 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1179032     1  0.3101    0.76722 0.756 0.000 0.244 0.000 0.000 0.000
#> GSM1179041     2  0.0000    0.99114 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1179042     2  0.0000    0.99114 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1178976     3  0.6645    0.35294 0.016 0.072 0.580 0.044 0.244 0.044
#> GSM1178981     3  0.1442    0.68249 0.040 0.000 0.944 0.004 0.000 0.012
#> GSM1178982     3  0.2790    0.63299 0.132 0.000 0.844 0.000 0.000 0.024
#> GSM1178983     3  0.2988    0.61175 0.152 0.000 0.824 0.000 0.000 0.024
#> GSM1178985     3  0.1152    0.67805 0.044 0.000 0.952 0.000 0.000 0.004
#> GSM1178992     3  0.0935    0.67726 0.032 0.000 0.964 0.000 0.004 0.000
#> GSM1179005     3  0.1010    0.67776 0.036 0.000 0.960 0.000 0.004 0.000
#> GSM1179007     3  0.1615    0.67046 0.064 0.000 0.928 0.000 0.004 0.004
#> GSM1179012     6  0.5931    0.80817 0.168 0.000 0.224 0.000 0.032 0.576
#> GSM1179016     5  0.5163    0.12437 0.140 0.000 0.252 0.000 0.608 0.000
#> GSM1179030     3  0.3594    0.61093 0.152 0.000 0.800 0.000 0.024 0.024
#> GSM1179038     3  0.1958    0.64985 0.100 0.000 0.896 0.000 0.004 0.000
#> GSM1178987     3  0.1370    0.68224 0.036 0.000 0.948 0.004 0.000 0.012
#> GSM1179003     4  0.6254    0.54538 0.004 0.020 0.176 0.572 0.212 0.016
#> GSM1179004     3  0.0964    0.68151 0.016 0.000 0.968 0.004 0.000 0.012
#> GSM1179039     2  0.0000    0.99114 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1178975     1  0.5161    0.34256 0.728 0.000 0.076 0.052 0.024 0.120
#> GSM1178980     4  0.1528    0.71056 0.016 0.000 0.012 0.944 0.000 0.028
#> GSM1178995     3  0.1152    0.67843 0.044 0.000 0.952 0.000 0.004 0.000
#> GSM1178996     3  0.3819    0.27899 0.316 0.000 0.672 0.000 0.000 0.012
#> GSM1179001     1  0.3817    0.75233 0.720 0.000 0.252 0.000 0.000 0.028
#> GSM1179002     1  0.3817    0.75233 0.720 0.000 0.252 0.000 0.000 0.028
#> GSM1179006     3  0.2007    0.67637 0.036 0.000 0.920 0.032 0.000 0.012
#> GSM1179008     1  0.3794    0.75243 0.724 0.000 0.248 0.000 0.000 0.028
#> GSM1179015     6  0.6298    0.80350 0.192 0.000 0.244 0.000 0.040 0.524
#> GSM1179017     5  0.1225   -0.19532 0.000 0.000 0.012 0.036 0.952 0.000
#> GSM1179026     3  0.0725    0.67957 0.012 0.000 0.976 0.000 0.012 0.000
#> GSM1179033     3  0.0865    0.68039 0.036 0.000 0.964 0.000 0.000 0.000
#> GSM1179035     3  0.0767    0.67891 0.008 0.000 0.976 0.000 0.012 0.004
#> GSM1179036     3  0.2794    0.61674 0.144 0.000 0.840 0.000 0.004 0.012
#> GSM1178986     3  0.4113    0.62969 0.180 0.000 0.764 0.020 0.016 0.020
#> GSM1178989     3  0.6598    0.35982 0.016 0.068 0.584 0.044 0.244 0.044
#> GSM1178993     3  0.7171    0.30111 0.168 0.000 0.500 0.172 0.012 0.148
#> GSM1178999     4  0.3329    0.72001 0.000 0.020 0.004 0.792 0.184 0.000
#> GSM1179021     4  0.2306    0.71801 0.000 0.092 0.000 0.888 0.004 0.016
#> GSM1179025     2  0.0000    0.99114 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1179027     3  0.6864    0.06386 0.072 0.000 0.412 0.384 0.012 0.120
#> GSM1179011     1  0.5379    0.20286 0.696 0.000 0.028 0.128 0.024 0.124
#> GSM1179023     1  0.3101    0.76722 0.756 0.000 0.244 0.000 0.000 0.000
#> GSM1179029     6  0.6553    0.72428 0.244 0.000 0.248 0.000 0.040 0.468
#> GSM1179034     1  0.3101    0.76722 0.756 0.000 0.244 0.000 0.000 0.000
#> GSM1179040     3  0.6864    0.06386 0.072 0.000 0.412 0.384 0.012 0.120
#> GSM1178988     3  0.2534    0.65535 0.008 0.000 0.896 0.024 0.056 0.016
#> GSM1179037     3  0.0767    0.67891 0.008 0.000 0.976 0.000 0.012 0.004

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

consensus_heatmap(res, k = 2)

plot of chunk tab-SD-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) protocol(p) k
#> SD:hclust 67            0.493    8.37e-02 2
#> SD:hclust  8               NA          NA 3
#> SD:hclust 47            0.363    1.82e-02 4
#> SD:hclust 48            0.225    2.16e-05 5
#> SD:hclust 51            0.140    3.49e-05 6

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


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 31632 rows and 73 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.989       0.994         0.3860 0.610   0.610
#> 3 3 0.470           0.752       0.867         0.5400 0.614   0.443
#> 4 4 0.646           0.747       0.862         0.1928 0.716   0.411
#> 5 5 0.629           0.535       0.750         0.0866 0.902   0.702
#> 6 6 0.655           0.522       0.722         0.0469 0.944   0.797

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
#> GSM1178971     1   0.000      0.999 1.000 0.000
#> GSM1178979     2   0.000      0.979 0.000 1.000
#> GSM1179009     1   0.000      0.999 1.000 0.000
#> GSM1179031     2   0.000      0.979 0.000 1.000
#> GSM1178970     2   0.000      0.979 0.000 1.000
#> GSM1178972     2   0.000      0.979 0.000 1.000
#> GSM1178973     1   0.000      0.999 1.000 0.000
#> GSM1178974     2   0.000      0.979 0.000 1.000
#> GSM1178977     2   0.000      0.979 0.000 1.000
#> GSM1178978     1   0.000      0.999 1.000 0.000
#> GSM1178998     1   0.000      0.999 1.000 0.000
#> GSM1179010     1   0.000      0.999 1.000 0.000
#> GSM1179018     1   0.000      0.999 1.000 0.000
#> GSM1179024     1   0.000      0.999 1.000 0.000
#> GSM1178984     1   0.000      0.999 1.000 0.000
#> GSM1178990     1   0.000      0.999 1.000 0.000
#> GSM1178991     1   0.000      0.999 1.000 0.000
#> GSM1178994     1   0.000      0.999 1.000 0.000
#> GSM1178997     1   0.000      0.999 1.000 0.000
#> GSM1179000     1   0.000      0.999 1.000 0.000
#> GSM1179013     1   0.000      0.999 1.000 0.000
#> GSM1179014     1   0.000      0.999 1.000 0.000
#> GSM1179019     1   0.000      0.999 1.000 0.000
#> GSM1179020     1   0.000      0.999 1.000 0.000
#> GSM1179022     1   0.000      0.999 1.000 0.000
#> GSM1179028     2   0.000      0.979 0.000 1.000
#> GSM1179032     1   0.000      0.999 1.000 0.000
#> GSM1179041     2   0.000      0.979 0.000 1.000
#> GSM1179042     2   0.000      0.979 0.000 1.000
#> GSM1178976     2   0.000      0.979 0.000 1.000
#> GSM1178981     1   0.000      0.999 1.000 0.000
#> GSM1178982     1   0.000      0.999 1.000 0.000
#> GSM1178983     1   0.000      0.999 1.000 0.000
#> GSM1178985     1   0.000      0.999 1.000 0.000
#> GSM1178992     1   0.000      0.999 1.000 0.000
#> GSM1179005     1   0.000      0.999 1.000 0.000
#> GSM1179007     1   0.000      0.999 1.000 0.000
#> GSM1179012     1   0.000      0.999 1.000 0.000
#> GSM1179016     1   0.000      0.999 1.000 0.000
#> GSM1179030     1   0.000      0.999 1.000 0.000
#> GSM1179038     1   0.000      0.999 1.000 0.000
#> GSM1178987     1   0.000      0.999 1.000 0.000
#> GSM1179003     2   0.000      0.979 0.000 1.000
#> GSM1179004     1   0.000      0.999 1.000 0.000
#> GSM1179039     2   0.000      0.979 0.000 1.000
#> GSM1178975     1   0.000      0.999 1.000 0.000
#> GSM1178980     2   0.443      0.903 0.092 0.908
#> GSM1178995     1   0.000      0.999 1.000 0.000
#> GSM1178996     1   0.000      0.999 1.000 0.000
#> GSM1179001     1   0.000      0.999 1.000 0.000
#> GSM1179002     1   0.000      0.999 1.000 0.000
#> GSM1179006     1   0.000      0.999 1.000 0.000
#> GSM1179008     1   0.000      0.999 1.000 0.000
#> GSM1179015     1   0.000      0.999 1.000 0.000
#> GSM1179017     2   0.745      0.746 0.212 0.788
#> GSM1179026     1   0.000      0.999 1.000 0.000
#> GSM1179033     1   0.000      0.999 1.000 0.000
#> GSM1179035     1   0.000      0.999 1.000 0.000
#> GSM1179036     1   0.000      0.999 1.000 0.000
#> GSM1178986     1   0.000      0.999 1.000 0.000
#> GSM1178989     2   0.242      0.952 0.040 0.960
#> GSM1178993     1   0.000      0.999 1.000 0.000
#> GSM1178999     2   0.242      0.952 0.040 0.960
#> GSM1179021     2   0.000      0.979 0.000 1.000
#> GSM1179025     2   0.000      0.979 0.000 1.000
#> GSM1179027     1   0.204      0.966 0.968 0.032
#> GSM1179011     1   0.000      0.999 1.000 0.000
#> GSM1179023     1   0.000      0.999 1.000 0.000
#> GSM1179029     1   0.000      0.999 1.000 0.000
#> GSM1179034     1   0.000      0.999 1.000 0.000
#> GSM1179040     2   0.000      0.979 0.000 1.000
#> GSM1178988     1   0.000      0.999 1.000 0.000
#> GSM1179037     1   0.000      0.999 1.000 0.000

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>            class entropy silhouette    p1    p2    p3
#> GSM1178971     1  0.5560      0.605 0.700 0.000 0.300
#> GSM1178979     3  0.6045      0.337 0.000 0.380 0.620
#> GSM1179009     3  0.0237      0.791 0.004 0.000 0.996
#> GSM1179031     2  0.0000      0.950 0.000 1.000 0.000
#> GSM1178970     3  0.6140      0.297 0.000 0.404 0.596
#> GSM1178972     2  0.0237      0.949 0.000 0.996 0.004
#> GSM1178973     1  0.3551      0.736 0.868 0.000 0.132
#> GSM1178974     2  0.0237      0.949 0.000 0.996 0.004
#> GSM1178977     3  0.2537      0.746 0.000 0.080 0.920
#> GSM1178978     3  0.0747      0.795 0.016 0.000 0.984
#> GSM1178998     1  0.0424      0.840 0.992 0.000 0.008
#> GSM1179010     1  0.5098      0.689 0.752 0.000 0.248
#> GSM1179018     3  0.0424      0.793 0.008 0.000 0.992
#> GSM1179024     1  0.0000      0.841 1.000 0.000 0.000
#> GSM1178984     1  0.5363      0.655 0.724 0.000 0.276
#> GSM1178990     1  0.0000      0.841 1.000 0.000 0.000
#> GSM1178991     1  0.6302      0.128 0.520 0.000 0.480
#> GSM1178994     1  0.5254      0.673 0.736 0.000 0.264
#> GSM1178997     1  0.5397      0.505 0.720 0.000 0.280
#> GSM1179000     1  0.0000      0.841 1.000 0.000 0.000
#> GSM1179013     1  0.0000      0.841 1.000 0.000 0.000
#> GSM1179014     1  0.0000      0.841 1.000 0.000 0.000
#> GSM1179019     1  0.0000      0.841 1.000 0.000 0.000
#> GSM1179020     1  0.0000      0.841 1.000 0.000 0.000
#> GSM1179022     1  0.0000      0.841 1.000 0.000 0.000
#> GSM1179028     2  0.0000      0.950 0.000 1.000 0.000
#> GSM1179032     1  0.0000      0.841 1.000 0.000 0.000
#> GSM1179041     2  0.0000      0.950 0.000 1.000 0.000
#> GSM1179042     2  0.0000      0.950 0.000 1.000 0.000
#> GSM1178976     3  0.4974      0.663 0.000 0.236 0.764
#> GSM1178981     3  0.5591      0.642 0.304 0.000 0.696
#> GSM1178982     3  0.4178      0.783 0.172 0.000 0.828
#> GSM1178983     3  0.4002      0.787 0.160 0.000 0.840
#> GSM1178985     3  0.4931      0.750 0.232 0.000 0.768
#> GSM1178992     1  0.5216      0.677 0.740 0.000 0.260
#> GSM1179005     1  0.5291      0.668 0.732 0.000 0.268
#> GSM1179007     1  0.5016      0.696 0.760 0.000 0.240
#> GSM1179012     1  0.1860      0.824 0.948 0.000 0.052
#> GSM1179016     1  0.4654      0.728 0.792 0.000 0.208
#> GSM1179030     3  0.1411      0.803 0.036 0.000 0.964
#> GSM1179038     1  0.5291      0.668 0.732 0.000 0.268
#> GSM1178987     3  0.5016      0.743 0.240 0.000 0.760
#> GSM1179003     3  0.4399      0.701 0.000 0.188 0.812
#> GSM1179004     3  0.5016      0.743 0.240 0.000 0.760
#> GSM1179039     2  0.0000      0.950 0.000 1.000 0.000
#> GSM1178975     1  0.6140      0.345 0.596 0.000 0.404
#> GSM1178980     3  0.2448      0.749 0.000 0.076 0.924
#> GSM1178995     1  0.5216      0.677 0.740 0.000 0.260
#> GSM1178996     3  0.5058      0.738 0.244 0.000 0.756
#> GSM1179001     1  0.0000      0.841 1.000 0.000 0.000
#> GSM1179002     1  0.0424      0.840 0.992 0.000 0.008
#> GSM1179006     3  0.4931      0.751 0.232 0.000 0.768
#> GSM1179008     1  0.0000      0.841 1.000 0.000 0.000
#> GSM1179015     1  0.1031      0.835 0.976 0.000 0.024
#> GSM1179017     3  0.5710      0.780 0.080 0.116 0.804
#> GSM1179026     3  0.5016      0.743 0.240 0.000 0.760
#> GSM1179033     3  0.4178      0.788 0.172 0.000 0.828
#> GSM1179035     3  0.5560      0.650 0.300 0.000 0.700
#> GSM1179036     3  0.5138      0.727 0.252 0.000 0.748
#> GSM1178986     3  0.3551      0.802 0.132 0.000 0.868
#> GSM1178989     3  0.4569      0.801 0.072 0.068 0.860
#> GSM1178993     3  0.0237      0.791 0.004 0.000 0.996
#> GSM1178999     3  0.2448      0.749 0.000 0.076 0.924
#> GSM1179021     2  0.6095      0.421 0.000 0.608 0.392
#> GSM1179025     2  0.0237      0.949 0.000 0.996 0.004
#> GSM1179027     3  0.0237      0.788 0.000 0.004 0.996
#> GSM1179011     3  0.2261      0.766 0.068 0.000 0.932
#> GSM1179023     1  0.0000      0.841 1.000 0.000 0.000
#> GSM1179029     1  0.0000      0.841 1.000 0.000 0.000
#> GSM1179034     1  0.0000      0.841 1.000 0.000 0.000
#> GSM1179040     3  0.2537      0.746 0.000 0.080 0.920
#> GSM1178988     3  0.3816      0.797 0.148 0.000 0.852
#> GSM1179037     3  0.5016      0.743 0.240 0.000 0.760

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>            class entropy silhouette    p1    p2    p3    p4
#> GSM1178971     3  0.5440     0.4881 0.384 0.000 0.596 0.020
#> GSM1178979     4  0.4581     0.7048 0.000 0.120 0.080 0.800
#> GSM1179009     3  0.5000    -0.0652 0.000 0.000 0.504 0.496
#> GSM1179031     2  0.0000     1.0000 0.000 1.000 0.000 0.000
#> GSM1178970     4  0.6475     0.6160 0.000 0.172 0.184 0.644
#> GSM1178972     2  0.0000     1.0000 0.000 1.000 0.000 0.000
#> GSM1178973     1  0.3444     0.7685 0.816 0.000 0.000 0.184
#> GSM1178974     2  0.0000     1.0000 0.000 1.000 0.000 0.000
#> GSM1178977     4  0.3047     0.7610 0.000 0.012 0.116 0.872
#> GSM1178978     4  0.5055     0.4606 0.008 0.000 0.368 0.624
#> GSM1178998     1  0.1820     0.9076 0.944 0.000 0.036 0.020
#> GSM1179010     3  0.5649     0.5256 0.344 0.000 0.620 0.036
#> GSM1179018     4  0.4746     0.4731 0.000 0.000 0.368 0.632
#> GSM1179024     1  0.0707     0.9216 0.980 0.000 0.000 0.020
#> GSM1178984     3  0.5085     0.6060 0.304 0.000 0.676 0.020
#> GSM1178990     1  0.0895     0.9238 0.976 0.000 0.004 0.020
#> GSM1178991     4  0.5750     0.1819 0.440 0.000 0.028 0.532
#> GSM1178994     3  0.5085     0.6060 0.304 0.000 0.676 0.020
#> GSM1178997     1  0.5085     0.5748 0.708 0.000 0.260 0.032
#> GSM1179000     1  0.1004     0.9213 0.972 0.000 0.004 0.024
#> GSM1179013     1  0.0657     0.9228 0.984 0.000 0.004 0.012
#> GSM1179014     1  0.1743     0.9114 0.940 0.000 0.004 0.056
#> GSM1179019     1  0.1004     0.9213 0.972 0.000 0.004 0.024
#> GSM1179020     1  0.0657     0.9242 0.984 0.000 0.004 0.012
#> GSM1179022     1  0.0524     0.9253 0.988 0.000 0.004 0.008
#> GSM1179028     2  0.0000     1.0000 0.000 1.000 0.000 0.000
#> GSM1179032     1  0.0524     0.9253 0.988 0.000 0.004 0.008
#> GSM1179041     2  0.0000     1.0000 0.000 1.000 0.000 0.000
#> GSM1179042     2  0.0000     1.0000 0.000 1.000 0.000 0.000
#> GSM1178976     3  0.2483     0.7574 0.000 0.032 0.916 0.052
#> GSM1178981     3  0.1284     0.7962 0.024 0.000 0.964 0.012
#> GSM1178982     3  0.2662     0.7571 0.016 0.000 0.900 0.084
#> GSM1178983     3  0.4214     0.6329 0.016 0.000 0.780 0.204
#> GSM1178985     3  0.1042     0.7962 0.020 0.000 0.972 0.008
#> GSM1178992     3  0.2751     0.7793 0.056 0.000 0.904 0.040
#> GSM1179005     3  0.4882     0.6630 0.272 0.000 0.708 0.020
#> GSM1179007     3  0.5582     0.4467 0.400 0.000 0.576 0.024
#> GSM1179012     1  0.5056     0.6487 0.732 0.000 0.224 0.044
#> GSM1179016     3  0.3858     0.7540 0.100 0.000 0.844 0.056
#> GSM1179030     3  0.3688     0.5971 0.000 0.000 0.792 0.208
#> GSM1179038     3  0.5062     0.6446 0.284 0.000 0.692 0.024
#> GSM1178987     3  0.1042     0.7962 0.020 0.000 0.972 0.008
#> GSM1179003     4  0.5853     0.2848 0.000 0.032 0.460 0.508
#> GSM1179004     3  0.1042     0.7962 0.020 0.000 0.972 0.008
#> GSM1179039     2  0.0000     1.0000 0.000 1.000 0.000 0.000
#> GSM1178975     4  0.4972     0.1000 0.456 0.000 0.000 0.544
#> GSM1178980     4  0.2124     0.7624 0.000 0.008 0.068 0.924
#> GSM1178995     3  0.5428     0.5003 0.380 0.000 0.600 0.020
#> GSM1178996     3  0.2313     0.7943 0.044 0.000 0.924 0.032
#> GSM1179001     1  0.1004     0.9244 0.972 0.000 0.004 0.024
#> GSM1179002     1  0.1284     0.9222 0.964 0.000 0.012 0.024
#> GSM1179006     3  0.1820     0.7910 0.020 0.000 0.944 0.036
#> GSM1179008     1  0.0895     0.9242 0.976 0.000 0.004 0.020
#> GSM1179015     1  0.4417     0.7533 0.796 0.000 0.160 0.044
#> GSM1179017     3  0.5009     0.4646 0.004 0.016 0.700 0.280
#> GSM1179026     3  0.1798     0.7902 0.016 0.000 0.944 0.040
#> GSM1179033     3  0.1820     0.7910 0.020 0.000 0.944 0.036
#> GSM1179035     3  0.0817     0.7968 0.024 0.000 0.976 0.000
#> GSM1179036     3  0.1938     0.7951 0.052 0.000 0.936 0.012
#> GSM1178986     3  0.2222     0.7860 0.016 0.000 0.924 0.060
#> GSM1178989     3  0.1302     0.7782 0.000 0.000 0.956 0.044
#> GSM1178993     4  0.2081     0.7615 0.000 0.000 0.084 0.916
#> GSM1178999     4  0.2976     0.7609 0.000 0.008 0.120 0.872
#> GSM1179021     4  0.3447     0.6787 0.000 0.128 0.020 0.852
#> GSM1179025     2  0.0000     1.0000 0.000 1.000 0.000 0.000
#> GSM1179027     4  0.2081     0.7615 0.000 0.000 0.084 0.916
#> GSM1179011     4  0.2036     0.7357 0.032 0.000 0.032 0.936
#> GSM1179023     1  0.0524     0.9253 0.988 0.000 0.004 0.008
#> GSM1179029     1  0.1305     0.9127 0.960 0.000 0.004 0.036
#> GSM1179034     1  0.0524     0.9253 0.988 0.000 0.004 0.008
#> GSM1179040     4  0.2124     0.7624 0.000 0.008 0.068 0.924
#> GSM1178988     3  0.1305     0.7827 0.004 0.000 0.960 0.036
#> GSM1179037     3  0.0707     0.7960 0.020 0.000 0.980 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
#> GSM1178971     3  0.6368   -0.00303 0.332 0.000 0.488 0.000 0.180
#> GSM1178979     4  0.6314    0.65982 0.000 0.056 0.088 0.616 0.240
#> GSM1179009     4  0.6598   -0.24146 0.000 0.000 0.324 0.448 0.228
#> GSM1179031     2  0.0000    0.99501 0.000 1.000 0.000 0.000 0.000
#> GSM1178970     4  0.7785    0.48012 0.000 0.080 0.244 0.432 0.244
#> GSM1178972     2  0.0963    0.96428 0.000 0.964 0.000 0.000 0.036
#> GSM1178973     1  0.5135    0.57502 0.700 0.000 0.008 0.204 0.088
#> GSM1178974     2  0.0000    0.99501 0.000 1.000 0.000 0.000 0.000
#> GSM1178977     4  0.5264    0.67729 0.000 0.000 0.092 0.652 0.256
#> GSM1178978     5  0.7211   -0.05106 0.020 0.000 0.272 0.304 0.404
#> GSM1178998     5  0.5280    0.13939 0.440 0.000 0.048 0.000 0.512
#> GSM1179010     5  0.6163    0.22020 0.144 0.000 0.352 0.000 0.504
#> GSM1179018     3  0.5919    0.00727 0.000 0.000 0.480 0.416 0.104
#> GSM1179024     1  0.0880    0.75706 0.968 0.000 0.000 0.000 0.032
#> GSM1178984     3  0.5243    0.18668 0.048 0.000 0.540 0.000 0.412
#> GSM1178990     1  0.2583    0.72254 0.864 0.000 0.004 0.000 0.132
#> GSM1178991     1  0.5862    0.39558 0.560 0.000 0.004 0.336 0.100
#> GSM1178994     3  0.5243    0.18665 0.048 0.000 0.540 0.000 0.412
#> GSM1178997     1  0.5417    0.42171 0.648 0.000 0.236 0.000 0.116
#> GSM1179000     1  0.1628    0.74235 0.936 0.000 0.008 0.000 0.056
#> GSM1179013     1  0.1671    0.75357 0.924 0.000 0.000 0.000 0.076
#> GSM1179014     1  0.3320    0.69899 0.828 0.000 0.008 0.012 0.152
#> GSM1179019     1  0.1557    0.74327 0.940 0.000 0.008 0.000 0.052
#> GSM1179020     1  0.0000    0.75601 1.000 0.000 0.000 0.000 0.000
#> GSM1179022     1  0.1671    0.75357 0.924 0.000 0.000 0.000 0.076
#> GSM1179028     2  0.0000    0.99501 0.000 1.000 0.000 0.000 0.000
#> GSM1179032     1  0.1671    0.75357 0.924 0.000 0.000 0.000 0.076
#> GSM1179041     2  0.0000    0.99501 0.000 1.000 0.000 0.000 0.000
#> GSM1179042     2  0.0000    0.99501 0.000 1.000 0.000 0.000 0.000
#> GSM1178976     3  0.4169    0.44357 0.000 0.000 0.732 0.028 0.240
#> GSM1178981     3  0.4015    0.41660 0.000 0.000 0.652 0.000 0.348
#> GSM1178982     3  0.3885    0.49424 0.000 0.000 0.724 0.008 0.268
#> GSM1178983     3  0.4479    0.48603 0.004 0.000 0.704 0.028 0.264
#> GSM1178985     3  0.3586    0.49455 0.000 0.000 0.736 0.000 0.264
#> GSM1178992     3  0.3783    0.51021 0.004 0.000 0.768 0.012 0.216
#> GSM1179005     3  0.5442    0.36329 0.116 0.000 0.644 0.000 0.240
#> GSM1179007     3  0.6642   -0.28676 0.228 0.000 0.420 0.000 0.352
#> GSM1179012     5  0.5870    0.45688 0.276 0.000 0.140 0.000 0.584
#> GSM1179016     3  0.4773    0.41619 0.084 0.000 0.748 0.012 0.156
#> GSM1179030     3  0.3991    0.48486 0.000 0.000 0.780 0.048 0.172
#> GSM1179038     3  0.4819    0.44781 0.112 0.000 0.724 0.000 0.164
#> GSM1178987     3  0.3966    0.43084 0.000 0.000 0.664 0.000 0.336
#> GSM1179003     3  0.6586   -0.15901 0.000 0.000 0.464 0.292 0.244
#> GSM1179004     3  0.3949    0.43304 0.000 0.000 0.668 0.000 0.332
#> GSM1179039     2  0.0000    0.99501 0.000 1.000 0.000 0.000 0.000
#> GSM1178975     1  0.6154    0.43594 0.568 0.000 0.016 0.308 0.108
#> GSM1178980     4  0.0693    0.75265 0.000 0.000 0.012 0.980 0.008
#> GSM1178995     3  0.6309    0.08811 0.236 0.000 0.532 0.000 0.232
#> GSM1178996     3  0.1774    0.57024 0.016 0.000 0.932 0.000 0.052
#> GSM1179001     1  0.3476    0.68064 0.804 0.000 0.020 0.000 0.176
#> GSM1179002     1  0.4254    0.58544 0.740 0.000 0.040 0.000 0.220
#> GSM1179006     3  0.0451    0.58071 0.004 0.000 0.988 0.000 0.008
#> GSM1179008     1  0.3123    0.69931 0.828 0.000 0.012 0.000 0.160
#> GSM1179015     1  0.5697   -0.07187 0.480 0.000 0.068 0.004 0.448
#> GSM1179017     3  0.5996    0.15781 0.000 0.000 0.512 0.120 0.368
#> GSM1179026     3  0.1251    0.58064 0.000 0.000 0.956 0.008 0.036
#> GSM1179033     3  0.0451    0.58236 0.004 0.000 0.988 0.000 0.008
#> GSM1179035     3  0.3913    0.43402 0.000 0.000 0.676 0.000 0.324
#> GSM1179036     3  0.1117    0.57840 0.020 0.000 0.964 0.000 0.016
#> GSM1178986     3  0.1970    0.57205 0.004 0.000 0.924 0.012 0.060
#> GSM1178989     3  0.3789    0.46703 0.000 0.000 0.768 0.020 0.212
#> GSM1178993     4  0.0566    0.74940 0.000 0.000 0.012 0.984 0.004
#> GSM1178999     4  0.4960    0.69718 0.000 0.000 0.112 0.708 0.180
#> GSM1179021     4  0.2635    0.74577 0.000 0.016 0.008 0.888 0.088
#> GSM1179025     2  0.0000    0.99501 0.000 1.000 0.000 0.000 0.000
#> GSM1179027     4  0.0566    0.74940 0.000 0.000 0.012 0.984 0.004
#> GSM1179011     4  0.1965    0.70769 0.024 0.000 0.000 0.924 0.052
#> GSM1179023     1  0.1671    0.75357 0.924 0.000 0.000 0.000 0.076
#> GSM1179029     1  0.4039    0.62801 0.720 0.000 0.004 0.008 0.268
#> GSM1179034     1  0.1671    0.75357 0.924 0.000 0.000 0.000 0.076
#> GSM1179040     4  0.1364    0.75508 0.000 0.000 0.012 0.952 0.036
#> GSM1178988     3  0.2563    0.54096 0.000 0.000 0.872 0.008 0.120
#> GSM1179037     3  0.1965    0.56989 0.000 0.000 0.904 0.000 0.096

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>            class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM1178971     3  0.6383     0.0714 0.208 0.000 0.508 0.000 0.040 0.244
#> GSM1178979     5  0.4265     0.5396 0.000 0.016 0.020 0.284 0.680 0.000
#> GSM1179009     4  0.6225    -0.1613 0.000 0.000 0.236 0.492 0.020 0.252
#> GSM1179031     2  0.0000     0.9659 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1178970     5  0.5624     0.6164 0.000 0.044 0.092 0.132 0.692 0.040
#> GSM1178972     2  0.3344     0.8048 0.000 0.804 0.000 0.000 0.152 0.044
#> GSM1178973     1  0.6765     0.5103 0.552 0.000 0.016 0.196 0.092 0.144
#> GSM1178974     2  0.0993     0.9556 0.000 0.964 0.000 0.000 0.012 0.024
#> GSM1178977     5  0.4295     0.5357 0.000 0.000 0.012 0.264 0.692 0.032
#> GSM1178978     6  0.6934     0.1838 0.004 0.000 0.128 0.120 0.264 0.484
#> GSM1178998     6  0.4847     0.4993 0.280 0.000 0.080 0.000 0.004 0.636
#> GSM1179010     6  0.5271     0.3499 0.080 0.000 0.316 0.000 0.016 0.588
#> GSM1179018     3  0.7257     0.0466 0.000 0.000 0.412 0.276 0.160 0.152
#> GSM1179024     1  0.1492     0.7105 0.940 0.000 0.000 0.000 0.024 0.036
#> GSM1178984     3  0.4871     0.1505 0.020 0.000 0.496 0.000 0.024 0.460
#> GSM1178990     1  0.1779     0.6912 0.920 0.000 0.016 0.000 0.000 0.064
#> GSM1178991     1  0.7421     0.2398 0.392 0.000 0.008 0.308 0.136 0.156
#> GSM1178994     3  0.4871     0.1442 0.024 0.000 0.496 0.000 0.020 0.460
#> GSM1178997     1  0.6741     0.4020 0.508 0.000 0.228 0.000 0.100 0.164
#> GSM1179000     1  0.3538     0.6870 0.832 0.000 0.048 0.000 0.048 0.072
#> GSM1179013     1  0.0632     0.7142 0.976 0.000 0.000 0.000 0.000 0.024
#> GSM1179014     1  0.5374     0.6075 0.672 0.000 0.048 0.000 0.148 0.132
#> GSM1179019     1  0.3474     0.6877 0.836 0.000 0.048 0.000 0.044 0.072
#> GSM1179020     1  0.0291     0.7155 0.992 0.000 0.000 0.000 0.004 0.004
#> GSM1179022     1  0.0632     0.7142 0.976 0.000 0.000 0.000 0.000 0.024
#> GSM1179028     2  0.0146     0.9647 0.000 0.996 0.000 0.000 0.000 0.004
#> GSM1179032     1  0.0632     0.7142 0.976 0.000 0.000 0.000 0.000 0.024
#> GSM1179041     2  0.0000     0.9659 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1179042     2  0.0000     0.9659 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1178976     5  0.4364     0.5907 0.000 0.000 0.308 0.012 0.656 0.024
#> GSM1178981     3  0.4576     0.2964 0.000 0.000 0.560 0.000 0.040 0.400
#> GSM1178982     3  0.4516     0.4655 0.000 0.000 0.668 0.000 0.072 0.260
#> GSM1178983     3  0.5170     0.3977 0.000 0.000 0.592 0.008 0.088 0.312
#> GSM1178985     3  0.4044     0.4765 0.000 0.000 0.704 0.000 0.040 0.256
#> GSM1178992     3  0.4200     0.4516 0.000 0.000 0.740 0.000 0.120 0.140
#> GSM1179005     3  0.3394     0.5049 0.012 0.000 0.788 0.000 0.012 0.188
#> GSM1179007     3  0.5255     0.1775 0.140 0.000 0.588 0.000 0.000 0.272
#> GSM1179012     6  0.5916     0.5630 0.196 0.000 0.180 0.000 0.036 0.588
#> GSM1179016     3  0.5875     0.2524 0.064 0.000 0.616 0.000 0.196 0.124
#> GSM1179030     3  0.4513    -0.1533 0.000 0.000 0.532 0.004 0.440 0.024
#> GSM1179038     3  0.2604     0.5480 0.020 0.000 0.872 0.000 0.008 0.100
#> GSM1178987     3  0.4561     0.3028 0.000 0.000 0.568 0.000 0.040 0.392
#> GSM1179003     5  0.5183     0.6478 0.000 0.000 0.264 0.120 0.612 0.004
#> GSM1179004     3  0.4500     0.3062 0.000 0.000 0.572 0.000 0.036 0.392
#> GSM1179039     2  0.0000     0.9659 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1178975     1  0.7727     0.3683 0.428 0.000 0.044 0.260 0.108 0.160
#> GSM1178980     4  0.0777     0.7699 0.000 0.000 0.000 0.972 0.024 0.004
#> GSM1178995     3  0.4821     0.4035 0.112 0.000 0.700 0.000 0.016 0.172
#> GSM1178996     3  0.2688     0.5325 0.000 0.000 0.868 0.000 0.068 0.064
#> GSM1179001     1  0.5300     0.5145 0.604 0.000 0.048 0.000 0.044 0.304
#> GSM1179002     1  0.5835     0.4131 0.548 0.000 0.088 0.000 0.044 0.320
#> GSM1179006     3  0.1267     0.5633 0.000 0.000 0.940 0.000 0.060 0.000
#> GSM1179008     1  0.5037     0.5557 0.636 0.000 0.036 0.000 0.044 0.284
#> GSM1179015     1  0.6430     0.0439 0.456 0.000 0.076 0.000 0.100 0.368
#> GSM1179017     5  0.5092     0.5652 0.000 0.000 0.272 0.016 0.632 0.080
#> GSM1179026     3  0.1972     0.5656 0.000 0.000 0.916 0.004 0.056 0.024
#> GSM1179033     3  0.1141     0.5658 0.000 0.000 0.948 0.000 0.052 0.000
#> GSM1179035     3  0.3871     0.4392 0.000 0.000 0.676 0.000 0.016 0.308
#> GSM1179036     3  0.1349     0.5639 0.000 0.000 0.940 0.000 0.056 0.004
#> GSM1178986     3  0.3503     0.5204 0.000 0.000 0.816 0.008 0.108 0.068
#> GSM1178989     5  0.4222     0.3695 0.000 0.000 0.472 0.004 0.516 0.008
#> GSM1178993     4  0.0405     0.7715 0.000 0.000 0.004 0.988 0.000 0.008
#> GSM1178999     5  0.4931     0.2540 0.000 0.000 0.044 0.464 0.484 0.008
#> GSM1179021     4  0.3122     0.5943 0.000 0.020 0.000 0.804 0.176 0.000
#> GSM1179025     2  0.0993     0.9556 0.000 0.964 0.000 0.000 0.012 0.024
#> GSM1179027     4  0.0000     0.7736 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM1179011     4  0.2209     0.7230 0.000 0.000 0.004 0.904 0.052 0.040
#> GSM1179023     1  0.0632     0.7142 0.976 0.000 0.000 0.000 0.000 0.024
#> GSM1179029     1  0.5182     0.5288 0.624 0.000 0.004 0.000 0.136 0.236
#> GSM1179034     1  0.0632     0.7142 0.976 0.000 0.000 0.000 0.000 0.024
#> GSM1179040     4  0.1714     0.7229 0.000 0.000 0.000 0.908 0.092 0.000
#> GSM1178988     3  0.3733     0.2557 0.000 0.000 0.700 0.004 0.288 0.008
#> GSM1179037     3  0.2006     0.5654 0.000 0.000 0.904 0.000 0.016 0.080

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

consensus_heatmap(res, k = 2)

plot of chunk tab-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) protocol(p) k
#> SD:kmeans 73           0.2001    2.81e-01 2
#> SD:kmeans 68           0.0331    2.51e-02 3
#> SD:kmeans 64           0.0106    6.67e-05 4
#> SD:kmeans 42           0.0144    1.13e-03 5
#> SD:kmeans 45           0.0103    5.89e-03 6

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


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

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

collect_plots(res)

plot of chunk SD-skmeans-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.968           0.964       0.983         0.4822 0.521   0.521
#> 3 3 0.758           0.812       0.898         0.3828 0.718   0.500
#> 4 4 0.750           0.780       0.894         0.1183 0.828   0.539
#> 5 5 0.707           0.660       0.831         0.0618 0.911   0.672
#> 6 6 0.687           0.508       0.763         0.0362 0.979   0.903

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
#> GSM1178971     1  0.0000      0.981 1.000 0.000
#> GSM1178979     2  0.0000      0.984 0.000 1.000
#> GSM1179009     1  0.4022      0.913 0.920 0.080
#> GSM1179031     2  0.0000      0.984 0.000 1.000
#> GSM1178970     2  0.0000      0.984 0.000 1.000
#> GSM1178972     2  0.0000      0.984 0.000 1.000
#> GSM1178973     1  0.0000      0.981 1.000 0.000
#> GSM1178974     2  0.0000      0.984 0.000 1.000
#> GSM1178977     2  0.0000      0.984 0.000 1.000
#> GSM1178978     2  0.2948      0.937 0.052 0.948
#> GSM1178998     1  0.0000      0.981 1.000 0.000
#> GSM1179010     1  0.0000      0.981 1.000 0.000
#> GSM1179018     2  0.1414      0.967 0.020 0.980
#> GSM1179024     1  0.0000      0.981 1.000 0.000
#> GSM1178984     1  0.0000      0.981 1.000 0.000
#> GSM1178990     1  0.0000      0.981 1.000 0.000
#> GSM1178991     1  0.7219      0.761 0.800 0.200
#> GSM1178994     1  0.0000      0.981 1.000 0.000
#> GSM1178997     2  0.7602      0.723 0.220 0.780
#> GSM1179000     1  0.0000      0.981 1.000 0.000
#> GSM1179013     1  0.0000      0.981 1.000 0.000
#> GSM1179014     1  0.0000      0.981 1.000 0.000
#> GSM1179019     1  0.0000      0.981 1.000 0.000
#> GSM1179020     1  0.0000      0.981 1.000 0.000
#> GSM1179022     1  0.0000      0.981 1.000 0.000
#> GSM1179028     2  0.0000      0.984 0.000 1.000
#> GSM1179032     1  0.0000      0.981 1.000 0.000
#> GSM1179041     2  0.0000      0.984 0.000 1.000
#> GSM1179042     2  0.0000      0.984 0.000 1.000
#> GSM1178976     2  0.0000      0.984 0.000 1.000
#> GSM1178981     1  0.0000      0.981 1.000 0.000
#> GSM1178982     1  0.3584      0.924 0.932 0.068
#> GSM1178983     1  0.1414      0.966 0.980 0.020
#> GSM1178985     1  0.3733      0.919 0.928 0.072
#> GSM1178992     1  0.0000      0.981 1.000 0.000
#> GSM1179005     1  0.0000      0.981 1.000 0.000
#> GSM1179007     1  0.0000      0.981 1.000 0.000
#> GSM1179012     1  0.0000      0.981 1.000 0.000
#> GSM1179016     1  0.0000      0.981 1.000 0.000
#> GSM1179030     2  0.0000      0.984 0.000 1.000
#> GSM1179038     1  0.0000      0.981 1.000 0.000
#> GSM1178987     1  0.0000      0.981 1.000 0.000
#> GSM1179003     2  0.0000      0.984 0.000 1.000
#> GSM1179004     1  0.0000      0.981 1.000 0.000
#> GSM1179039     2  0.0000      0.984 0.000 1.000
#> GSM1178975     1  0.6438      0.807 0.836 0.164
#> GSM1178980     2  0.0000      0.984 0.000 1.000
#> GSM1178995     1  0.0000      0.981 1.000 0.000
#> GSM1178996     1  0.0000      0.981 1.000 0.000
#> GSM1179001     1  0.0000      0.981 1.000 0.000
#> GSM1179002     1  0.0000      0.981 1.000 0.000
#> GSM1179006     1  0.0938      0.972 0.988 0.012
#> GSM1179008     1  0.0000      0.981 1.000 0.000
#> GSM1179015     1  0.0000      0.981 1.000 0.000
#> GSM1179017     2  0.0000      0.984 0.000 1.000
#> GSM1179026     1  0.0000      0.981 1.000 0.000
#> GSM1179033     2  0.5629      0.849 0.132 0.868
#> GSM1179035     1  0.0000      0.981 1.000 0.000
#> GSM1179036     1  0.0000      0.981 1.000 0.000
#> GSM1178986     1  0.7376      0.749 0.792 0.208
#> GSM1178989     2  0.0000      0.984 0.000 1.000
#> GSM1178993     2  0.0000      0.984 0.000 1.000
#> GSM1178999     2  0.0000      0.984 0.000 1.000
#> GSM1179021     2  0.0000      0.984 0.000 1.000
#> GSM1179025     2  0.0000      0.984 0.000 1.000
#> GSM1179027     2  0.0000      0.984 0.000 1.000
#> GSM1179011     2  0.0000      0.984 0.000 1.000
#> GSM1179023     1  0.0000      0.981 1.000 0.000
#> GSM1179029     1  0.0000      0.981 1.000 0.000
#> GSM1179034     1  0.0000      0.981 1.000 0.000
#> GSM1179040     2  0.0000      0.984 0.000 1.000
#> GSM1178988     2  0.0000      0.984 0.000 1.000
#> GSM1179037     1  0.0000      0.981 1.000 0.000

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>            class entropy silhouette    p1    p2    p3
#> GSM1178971     1  0.0000     0.8869 1.000 0.000 0.000
#> GSM1178979     2  0.0000     0.9605 0.000 1.000 0.000
#> GSM1179009     3  0.0237     0.7996 0.004 0.000 0.996
#> GSM1179031     2  0.0000     0.9605 0.000 1.000 0.000
#> GSM1178970     2  0.0000     0.9605 0.000 1.000 0.000
#> GSM1178972     2  0.0000     0.9605 0.000 1.000 0.000
#> GSM1178973     1  0.2537     0.8334 0.920 0.000 0.080
#> GSM1178974     2  0.0000     0.9605 0.000 1.000 0.000
#> GSM1178977     2  0.0000     0.9605 0.000 1.000 0.000
#> GSM1178978     1  0.7958     0.3874 0.544 0.064 0.392
#> GSM1178998     1  0.5678     0.4958 0.684 0.000 0.316
#> GSM1179010     3  0.2625     0.8543 0.084 0.000 0.916
#> GSM1179018     3  0.1860     0.7710 0.000 0.052 0.948
#> GSM1179024     1  0.0000     0.8869 1.000 0.000 0.000
#> GSM1178984     3  0.2625     0.8543 0.084 0.000 0.916
#> GSM1178990     1  0.1529     0.8547 0.960 0.000 0.040
#> GSM1178991     1  0.4137     0.8064 0.872 0.032 0.096
#> GSM1178994     3  0.2625     0.8543 0.084 0.000 0.916
#> GSM1178997     1  0.1315     0.8711 0.972 0.020 0.008
#> GSM1179000     1  0.0000     0.8869 1.000 0.000 0.000
#> GSM1179013     1  0.0000     0.8869 1.000 0.000 0.000
#> GSM1179014     1  0.0000     0.8869 1.000 0.000 0.000
#> GSM1179019     1  0.0000     0.8869 1.000 0.000 0.000
#> GSM1179020     1  0.0000     0.8869 1.000 0.000 0.000
#> GSM1179022     1  0.0000     0.8869 1.000 0.000 0.000
#> GSM1179028     2  0.0000     0.9605 0.000 1.000 0.000
#> GSM1179032     1  0.0000     0.8869 1.000 0.000 0.000
#> GSM1179041     2  0.0000     0.9605 0.000 1.000 0.000
#> GSM1179042     2  0.0000     0.9605 0.000 1.000 0.000
#> GSM1178976     2  0.0000     0.9605 0.000 1.000 0.000
#> GSM1178981     3  0.2625     0.8543 0.084 0.000 0.916
#> GSM1178982     3  0.2537     0.8463 0.080 0.000 0.920
#> GSM1178983     1  0.6062     0.4330 0.616 0.000 0.384
#> GSM1178985     3  0.2537     0.8541 0.080 0.000 0.920
#> GSM1178992     3  0.2878     0.8503 0.096 0.000 0.904
#> GSM1179005     3  0.5785     0.6627 0.332 0.000 0.668
#> GSM1179007     3  0.5678     0.6815 0.316 0.000 0.684
#> GSM1179012     3  0.2625     0.8543 0.084 0.000 0.916
#> GSM1179016     1  0.5859     0.2445 0.656 0.000 0.344
#> GSM1179030     2  0.0000     0.9605 0.000 1.000 0.000
#> GSM1179038     3  0.6286     0.4112 0.464 0.000 0.536
#> GSM1178987     3  0.2537     0.8541 0.080 0.000 0.920
#> GSM1179003     2  0.0000     0.9605 0.000 1.000 0.000
#> GSM1179004     3  0.2537     0.8541 0.080 0.000 0.920
#> GSM1179039     2  0.0000     0.9605 0.000 1.000 0.000
#> GSM1178975     1  0.2537     0.8334 0.920 0.000 0.080
#> GSM1178980     2  0.2537     0.9111 0.000 0.920 0.080
#> GSM1178995     3  0.6309     0.3268 0.496 0.000 0.504
#> GSM1178996     1  0.5360     0.5946 0.768 0.012 0.220
#> GSM1179001     1  0.0000     0.8869 1.000 0.000 0.000
#> GSM1179002     1  0.0000     0.8869 1.000 0.000 0.000
#> GSM1179006     3  0.5835     0.7884 0.164 0.052 0.784
#> GSM1179008     1  0.0000     0.8869 1.000 0.000 0.000
#> GSM1179015     3  0.6062     0.5837 0.384 0.000 0.616
#> GSM1179017     2  0.0000     0.9605 0.000 1.000 0.000
#> GSM1179026     3  0.2682     0.8525 0.076 0.004 0.920
#> GSM1179033     3  0.6143     0.6094 0.024 0.256 0.720
#> GSM1179035     3  0.2537     0.8541 0.080 0.000 0.920
#> GSM1179036     3  0.6026     0.5937 0.376 0.000 0.624
#> GSM1178986     3  0.5627     0.6866 0.188 0.032 0.780
#> GSM1178989     2  0.2261     0.9019 0.000 0.932 0.068
#> GSM1178993     2  0.3551     0.8682 0.000 0.868 0.132
#> GSM1178999     2  0.0000     0.9605 0.000 1.000 0.000
#> GSM1179021     2  0.0000     0.9605 0.000 1.000 0.000
#> GSM1179025     2  0.0000     0.9605 0.000 1.000 0.000
#> GSM1179027     2  0.2711     0.9060 0.000 0.912 0.088
#> GSM1179011     1  0.6625     0.6685 0.744 0.176 0.080
#> GSM1179023     1  0.0000     0.8869 1.000 0.000 0.000
#> GSM1179029     1  0.0237     0.8844 0.996 0.000 0.004
#> GSM1179034     1  0.0000     0.8869 1.000 0.000 0.000
#> GSM1179040     2  0.1411     0.9406 0.000 0.964 0.036
#> GSM1178988     2  0.6280     0.0968 0.000 0.540 0.460
#> GSM1179037     3  0.2537     0.8541 0.080 0.000 0.920

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>            class entropy silhouette    p1    p2    p3    p4
#> GSM1178971     1  0.0000      0.903 1.000 0.000 0.000 0.000
#> GSM1178979     2  0.0000      0.931 0.000 1.000 0.000 0.000
#> GSM1179009     4  0.2469      0.750 0.000 0.000 0.108 0.892
#> GSM1179031     2  0.0000      0.931 0.000 1.000 0.000 0.000
#> GSM1178970     2  0.0000      0.931 0.000 1.000 0.000 0.000
#> GSM1178972     2  0.0000      0.931 0.000 1.000 0.000 0.000
#> GSM1178973     4  0.4985      0.201 0.468 0.000 0.000 0.532
#> GSM1178974     2  0.0000      0.931 0.000 1.000 0.000 0.000
#> GSM1178977     2  0.0188      0.928 0.000 0.996 0.000 0.004
#> GSM1178978     4  0.3102      0.777 0.024 0.016 0.064 0.896
#> GSM1178998     1  0.4375      0.708 0.788 0.000 0.180 0.032
#> GSM1179010     3  0.2623      0.835 0.064 0.000 0.908 0.028
#> GSM1179018     4  0.1022      0.784 0.000 0.000 0.032 0.968
#> GSM1179024     1  0.0000      0.903 1.000 0.000 0.000 0.000
#> GSM1178984     3  0.3144      0.826 0.072 0.000 0.884 0.044
#> GSM1178990     1  0.0336      0.900 0.992 0.000 0.008 0.000
#> GSM1178991     4  0.3837      0.688 0.224 0.000 0.000 0.776
#> GSM1178994     3  0.2816      0.833 0.064 0.000 0.900 0.036
#> GSM1178997     1  0.2466      0.814 0.900 0.096 0.000 0.004
#> GSM1179000     1  0.0000      0.903 1.000 0.000 0.000 0.000
#> GSM1179013     1  0.0000      0.903 1.000 0.000 0.000 0.000
#> GSM1179014     1  0.0188      0.902 0.996 0.000 0.000 0.004
#> GSM1179019     1  0.0000      0.903 1.000 0.000 0.000 0.000
#> GSM1179020     1  0.0000      0.903 1.000 0.000 0.000 0.000
#> GSM1179022     1  0.0000      0.903 1.000 0.000 0.000 0.000
#> GSM1179028     2  0.0000      0.931 0.000 1.000 0.000 0.000
#> GSM1179032     1  0.0000      0.903 1.000 0.000 0.000 0.000
#> GSM1179041     2  0.0000      0.931 0.000 1.000 0.000 0.000
#> GSM1179042     2  0.0000      0.931 0.000 1.000 0.000 0.000
#> GSM1178976     2  0.0000      0.931 0.000 1.000 0.000 0.000
#> GSM1178981     3  0.2174      0.835 0.020 0.000 0.928 0.052
#> GSM1178982     4  0.5158      0.181 0.004 0.000 0.472 0.524
#> GSM1178983     4  0.4881      0.675 0.048 0.000 0.196 0.756
#> GSM1178985     3  0.1118      0.839 0.000 0.000 0.964 0.036
#> GSM1178992     3  0.1406      0.838 0.024 0.000 0.960 0.016
#> GSM1179005     3  0.4837      0.505 0.348 0.000 0.648 0.004
#> GSM1179007     3  0.4920      0.467 0.368 0.000 0.628 0.004
#> GSM1179012     3  0.3598      0.798 0.124 0.000 0.848 0.028
#> GSM1179016     1  0.4290      0.717 0.772 0.000 0.212 0.016
#> GSM1179030     2  0.1635      0.900 0.000 0.948 0.008 0.044
#> GSM1179038     1  0.4123      0.694 0.772 0.000 0.220 0.008
#> GSM1178987     3  0.1118      0.839 0.000 0.000 0.964 0.036
#> GSM1179003     2  0.0000      0.931 0.000 1.000 0.000 0.000
#> GSM1179004     3  0.1118      0.839 0.000 0.000 0.964 0.036
#> GSM1179039     2  0.0000      0.931 0.000 1.000 0.000 0.000
#> GSM1178975     4  0.3649      0.711 0.204 0.000 0.000 0.796
#> GSM1178980     4  0.1474      0.783 0.000 0.052 0.000 0.948
#> GSM1178995     1  0.4877      0.226 0.592 0.000 0.408 0.000
#> GSM1178996     1  0.5830      0.580 0.672 0.036 0.276 0.016
#> GSM1179001     1  0.0000      0.903 1.000 0.000 0.000 0.000
#> GSM1179002     1  0.0000      0.903 1.000 0.000 0.000 0.000
#> GSM1179006     3  0.3167      0.805 0.040 0.048 0.896 0.016
#> GSM1179008     1  0.0000      0.903 1.000 0.000 0.000 0.000
#> GSM1179015     1  0.4769      0.532 0.684 0.000 0.308 0.008
#> GSM1179017     2  0.1610      0.900 0.000 0.952 0.032 0.016
#> GSM1179026     3  0.0592      0.837 0.000 0.000 0.984 0.016
#> GSM1179033     3  0.4774      0.719 0.020 0.116 0.808 0.056
#> GSM1179035     3  0.0592      0.841 0.000 0.000 0.984 0.016
#> GSM1179036     3  0.5220      0.440 0.352 0.000 0.632 0.016
#> GSM1178986     4  0.6356      0.411 0.088 0.000 0.308 0.604
#> GSM1178989     2  0.2179      0.877 0.000 0.924 0.064 0.012
#> GSM1178993     4  0.0707      0.787 0.000 0.020 0.000 0.980
#> GSM1178999     2  0.4500      0.541 0.000 0.684 0.000 0.316
#> GSM1179021     2  0.4134      0.641 0.000 0.740 0.000 0.260
#> GSM1179025     2  0.0000      0.931 0.000 1.000 0.000 0.000
#> GSM1179027     4  0.1302      0.785 0.000 0.044 0.000 0.956
#> GSM1179011     4  0.1488      0.788 0.032 0.012 0.000 0.956
#> GSM1179023     1  0.0000      0.903 1.000 0.000 0.000 0.000
#> GSM1179029     1  0.0524      0.898 0.988 0.000 0.008 0.004
#> GSM1179034     1  0.0000      0.903 1.000 0.000 0.000 0.000
#> GSM1179040     4  0.3873      0.612 0.000 0.228 0.000 0.772
#> GSM1178988     2  0.5298      0.410 0.000 0.612 0.372 0.016
#> GSM1179037     3  0.0469      0.838 0.000 0.000 0.988 0.012

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>            class entropy silhouette    p1    p2    p3    p4    p5
#> GSM1178971     1  0.4459      0.731 0.744 0.000 0.200 0.004 0.052
#> GSM1178979     2  0.0000      0.899 0.000 1.000 0.000 0.000 0.000
#> GSM1179009     4  0.3774      0.536 0.000 0.000 0.000 0.704 0.296
#> GSM1179031     2  0.0000      0.899 0.000 1.000 0.000 0.000 0.000
#> GSM1178970     2  0.0162      0.897 0.000 0.996 0.004 0.000 0.000
#> GSM1178972     2  0.0000      0.899 0.000 1.000 0.000 0.000 0.000
#> GSM1178973     1  0.4874      0.301 0.600 0.000 0.032 0.368 0.000
#> GSM1178974     2  0.0000      0.899 0.000 1.000 0.000 0.000 0.000
#> GSM1178977     2  0.0912      0.887 0.000 0.972 0.012 0.016 0.000
#> GSM1178978     4  0.6571      0.209 0.028 0.032 0.040 0.456 0.444
#> GSM1178998     5  0.5111      0.209 0.408 0.000 0.040 0.000 0.552
#> GSM1179010     5  0.1168      0.712 0.008 0.000 0.032 0.000 0.960
#> GSM1179018     4  0.2782      0.698 0.000 0.000 0.048 0.880 0.072
#> GSM1179024     1  0.0404      0.850 0.988 0.000 0.012 0.000 0.000
#> GSM1178984     5  0.1012      0.711 0.020 0.000 0.012 0.000 0.968
#> GSM1178990     1  0.1965      0.842 0.924 0.000 0.024 0.000 0.052
#> GSM1178991     4  0.4775      0.572 0.256 0.000 0.040 0.696 0.008
#> GSM1178994     5  0.0807      0.714 0.012 0.000 0.012 0.000 0.976
#> GSM1178997     1  0.3216      0.788 0.868 0.048 0.068 0.016 0.000
#> GSM1179000     1  0.0609      0.849 0.980 0.000 0.020 0.000 0.000
#> GSM1179013     1  0.0290      0.855 0.992 0.000 0.000 0.000 0.008
#> GSM1179014     1  0.1608      0.835 0.928 0.000 0.072 0.000 0.000
#> GSM1179019     1  0.0703      0.849 0.976 0.000 0.024 0.000 0.000
#> GSM1179020     1  0.0404      0.855 0.988 0.000 0.000 0.000 0.012
#> GSM1179022     1  0.0404      0.855 0.988 0.000 0.000 0.000 0.012
#> GSM1179028     2  0.0000      0.899 0.000 1.000 0.000 0.000 0.000
#> GSM1179032     1  0.0404      0.855 0.988 0.000 0.000 0.000 0.012
#> GSM1179041     2  0.0000      0.899 0.000 1.000 0.000 0.000 0.000
#> GSM1179042     2  0.0000      0.899 0.000 1.000 0.000 0.000 0.000
#> GSM1178976     2  0.0290      0.896 0.000 0.992 0.008 0.000 0.000
#> GSM1178981     5  0.0798      0.707 0.000 0.000 0.016 0.008 0.976
#> GSM1178982     5  0.4329      0.408 0.000 0.000 0.032 0.252 0.716
#> GSM1178983     4  0.6619      0.310 0.072 0.000 0.056 0.500 0.372
#> GSM1178985     5  0.1792      0.679 0.000 0.000 0.084 0.000 0.916
#> GSM1178992     3  0.5080      0.529 0.056 0.000 0.628 0.000 0.316
#> GSM1179005     5  0.6589      0.113 0.364 0.000 0.212 0.000 0.424
#> GSM1179007     5  0.6188      0.233 0.364 0.000 0.144 0.000 0.492
#> GSM1179012     5  0.2756      0.664 0.092 0.000 0.024 0.004 0.880
#> GSM1179016     3  0.3999      0.555 0.240 0.000 0.740 0.000 0.020
#> GSM1179030     2  0.2875      0.834 0.000 0.884 0.052 0.056 0.008
#> GSM1179038     1  0.6178      0.224 0.484 0.000 0.376 0.000 0.140
#> GSM1178987     5  0.1205      0.701 0.000 0.000 0.040 0.004 0.956
#> GSM1179003     2  0.0880      0.883 0.000 0.968 0.032 0.000 0.000
#> GSM1179004     5  0.1430      0.694 0.000 0.000 0.052 0.004 0.944
#> GSM1179039     2  0.0000      0.899 0.000 1.000 0.000 0.000 0.000
#> GSM1178975     4  0.4594      0.528 0.284 0.000 0.036 0.680 0.000
#> GSM1178980     4  0.0404      0.719 0.000 0.012 0.000 0.988 0.000
#> GSM1178995     1  0.6148      0.399 0.568 0.000 0.160 0.004 0.268
#> GSM1178996     3  0.2786      0.653 0.084 0.012 0.884 0.000 0.020
#> GSM1179001     1  0.3133      0.821 0.864 0.000 0.080 0.004 0.052
#> GSM1179002     1  0.3449      0.809 0.844 0.000 0.088 0.004 0.064
#> GSM1179006     3  0.2911      0.695 0.008 0.000 0.852 0.004 0.136
#> GSM1179008     1  0.2728      0.830 0.888 0.000 0.068 0.004 0.040
#> GSM1179015     1  0.6044      0.424 0.584 0.000 0.152 0.004 0.260
#> GSM1179017     2  0.4211      0.449 0.004 0.636 0.360 0.000 0.000
#> GSM1179026     3  0.3109      0.672 0.000 0.000 0.800 0.000 0.200
#> GSM1179033     3  0.4418      0.646 0.004 0.024 0.756 0.016 0.200
#> GSM1179035     5  0.3366      0.488 0.000 0.000 0.232 0.000 0.768
#> GSM1179036     3  0.2871      0.688 0.040 0.000 0.872 0.000 0.088
#> GSM1178986     4  0.7929      0.174 0.128 0.004 0.316 0.424 0.128
#> GSM1178989     2  0.3586      0.706 0.000 0.792 0.188 0.000 0.020
#> GSM1178993     4  0.0162      0.721 0.000 0.004 0.000 0.996 0.000
#> GSM1178999     2  0.4702      0.282 0.000 0.552 0.016 0.432 0.000
#> GSM1179021     2  0.4182      0.386 0.000 0.600 0.000 0.400 0.000
#> GSM1179025     2  0.0000      0.899 0.000 1.000 0.000 0.000 0.000
#> GSM1179027     4  0.0162      0.721 0.000 0.004 0.000 0.996 0.000
#> GSM1179011     4  0.0579      0.720 0.008 0.000 0.008 0.984 0.000
#> GSM1179023     1  0.0404      0.855 0.988 0.000 0.000 0.000 0.012
#> GSM1179029     1  0.2775      0.815 0.876 0.000 0.100 0.004 0.020
#> GSM1179034     1  0.0404      0.855 0.988 0.000 0.000 0.000 0.012
#> GSM1179040     4  0.2813      0.621 0.000 0.168 0.000 0.832 0.000
#> GSM1178988     3  0.5906      0.166 0.000 0.404 0.492 0.000 0.104
#> GSM1179037     3  0.4306      0.200 0.000 0.000 0.508 0.000 0.492

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>            class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM1178971     1  0.5683    0.44879 0.532 0.000 0.116 0.000 0.336 0.016
#> GSM1178979     2  0.0000    0.86508 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1179009     4  0.3882    0.34126 0.000 0.000 0.012 0.716 0.012 0.260
#> GSM1179031     2  0.0000    0.86508 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1178970     2  0.0713    0.85572 0.000 0.972 0.000 0.000 0.028 0.000
#> GSM1178972     2  0.0260    0.86302 0.000 0.992 0.000 0.000 0.008 0.000
#> GSM1178973     1  0.5466    0.30879 0.596 0.000 0.008 0.240 0.156 0.000
#> GSM1178974     2  0.0000    0.86508 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1178977     2  0.1461    0.84069 0.000 0.940 0.000 0.016 0.044 0.000
#> GSM1178978     6  0.6948    0.01468 0.044 0.008 0.008 0.264 0.204 0.472
#> GSM1178998     6  0.5599    0.26712 0.344 0.000 0.008 0.000 0.124 0.524
#> GSM1179010     6  0.2954    0.60829 0.044 0.000 0.028 0.000 0.060 0.868
#> GSM1179018     4  0.4163    0.49735 0.000 0.000 0.056 0.788 0.068 0.088
#> GSM1179024     1  0.0790    0.71769 0.968 0.000 0.000 0.000 0.032 0.000
#> GSM1178984     6  0.2307    0.62267 0.032 0.000 0.016 0.000 0.048 0.904
#> GSM1178990     1  0.3406    0.66852 0.840 0.000 0.036 0.000 0.068 0.056
#> GSM1178991     4  0.6117   -0.10579 0.288 0.000 0.004 0.472 0.232 0.004
#> GSM1178994     6  0.1232    0.62603 0.024 0.000 0.004 0.000 0.016 0.956
#> GSM1178997     1  0.4496    0.56421 0.700 0.028 0.024 0.004 0.244 0.000
#> GSM1179000     1  0.2092    0.68318 0.876 0.000 0.000 0.000 0.124 0.000
#> GSM1179013     1  0.0508    0.72193 0.984 0.000 0.004 0.000 0.012 0.000
#> GSM1179014     1  0.3736    0.62530 0.776 0.000 0.068 0.000 0.156 0.000
#> GSM1179019     1  0.2234    0.68643 0.872 0.000 0.004 0.000 0.124 0.000
#> GSM1179020     1  0.0458    0.72326 0.984 0.000 0.000 0.000 0.016 0.000
#> GSM1179022     1  0.0000    0.72265 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1179028     2  0.0000    0.86508 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1179032     1  0.0000    0.72265 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1179041     2  0.0000    0.86508 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1179042     2  0.0000    0.86508 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1178976     2  0.0692    0.85634 0.000 0.976 0.020 0.000 0.004 0.000
#> GSM1178981     6  0.1401    0.61666 0.004 0.000 0.020 0.000 0.028 0.948
#> GSM1178982     6  0.5415    0.39772 0.008 0.000 0.040 0.172 0.104 0.676
#> GSM1178983     6  0.7196   -0.07594 0.032 0.000 0.036 0.308 0.216 0.408
#> GSM1178985     6  0.2618    0.57168 0.000 0.000 0.116 0.000 0.024 0.860
#> GSM1178992     3  0.6061    0.31153 0.056 0.000 0.568 0.000 0.120 0.256
#> GSM1179005     6  0.7569    0.00581 0.264 0.000 0.212 0.000 0.180 0.344
#> GSM1179007     6  0.7365    0.09452 0.300 0.000 0.184 0.000 0.144 0.372
#> GSM1179012     6  0.4243    0.56503 0.112 0.000 0.040 0.000 0.072 0.776
#> GSM1179016     3  0.5953   -0.05847 0.196 0.000 0.520 0.000 0.272 0.012
#> GSM1179030     2  0.5058    0.67009 0.000 0.736 0.052 0.052 0.128 0.032
#> GSM1179038     1  0.7235    0.03098 0.400 0.000 0.292 0.000 0.184 0.124
#> GSM1178987     6  0.1794    0.60751 0.000 0.000 0.036 0.000 0.040 0.924
#> GSM1179003     2  0.1257    0.84484 0.000 0.952 0.028 0.000 0.020 0.000
#> GSM1179004     6  0.2112    0.58650 0.000 0.000 0.088 0.000 0.016 0.896
#> GSM1179039     2  0.0000    0.86508 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1178975     4  0.6182   -0.04214 0.312 0.000 0.012 0.456 0.220 0.000
#> GSM1178980     4  0.0458    0.65401 0.000 0.000 0.000 0.984 0.016 0.000
#> GSM1178995     1  0.7211    0.20979 0.448 0.000 0.184 0.000 0.164 0.204
#> GSM1178996     3  0.4703    0.24906 0.028 0.008 0.616 0.000 0.340 0.008
#> GSM1179001     1  0.4898    0.53906 0.612 0.000 0.048 0.000 0.324 0.016
#> GSM1179002     1  0.5381    0.50103 0.568 0.000 0.064 0.000 0.340 0.028
#> GSM1179006     3  0.3123    0.47422 0.004 0.000 0.848 0.008 0.040 0.100
#> GSM1179008     1  0.4536    0.57911 0.652 0.000 0.036 0.000 0.300 0.012
#> GSM1179015     1  0.7054    0.15587 0.464 0.000 0.156 0.000 0.140 0.240
#> GSM1179017     2  0.5309    0.32201 0.000 0.560 0.312 0.000 0.128 0.000
#> GSM1179026     3  0.4106    0.46031 0.000 0.000 0.736 0.000 0.076 0.188
#> GSM1179033     3  0.5145    0.43869 0.000 0.016 0.720 0.048 0.080 0.136
#> GSM1179035     6  0.4050    0.39574 0.000 0.000 0.236 0.000 0.048 0.716
#> GSM1179036     3  0.4723    0.41419 0.036 0.000 0.716 0.000 0.184 0.064
#> GSM1178986     5  0.7891    0.00000 0.064 0.000 0.220 0.228 0.408 0.080
#> GSM1178989     2  0.4012    0.61204 0.000 0.724 0.240 0.000 0.024 0.012
#> GSM1178993     4  0.0146    0.65483 0.000 0.000 0.000 0.996 0.004 0.000
#> GSM1178999     2  0.4876    0.17829 0.000 0.504 0.004 0.444 0.048 0.000
#> GSM1179021     2  0.3868    0.12726 0.000 0.504 0.000 0.496 0.000 0.000
#> GSM1179025     2  0.0000    0.86508 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1179027     4  0.0000    0.65427 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM1179011     4  0.1141    0.63964 0.000 0.000 0.000 0.948 0.052 0.000
#> GSM1179023     1  0.0146    0.72262 0.996 0.000 0.000 0.000 0.004 0.000
#> GSM1179029     1  0.4024    0.60125 0.744 0.000 0.072 0.000 0.184 0.000
#> GSM1179034     1  0.0000    0.72265 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1179040     4  0.1957    0.54821 0.000 0.112 0.000 0.888 0.000 0.000
#> GSM1178988     3  0.6480    0.12529 0.000 0.328 0.484 0.000 0.100 0.088
#> GSM1179037     3  0.4791    0.19602 0.000 0.000 0.512 0.000 0.052 0.436

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) protocol(p) k
#> SD:skmeans 73           0.0195     0.41301 2
#> SD:skmeans 66           0.2607     0.00225 3
#> SD:skmeans 66           0.2050     0.03999 4
#> SD:skmeans 56           0.0228     0.00407 5
#> SD:skmeans 44           0.0120     0.04878 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 31632 rows and 73 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 3.
#> 
#> Following methods can be applied to this 'ConsensusPartition' object:
#>  [1] "cola_report"             "collect_classes"         "collect_plots"          
#>  [4] "collect_stats"           "colnames"                "compare_signatures"     
#>  [7] "consensus_heatmap"       "dimension_reduction"     "functional_enrichment"  
#> [10] "get_anno_col"            "get_anno"                "get_classes"            
#> [13] "get_consensus"           "get_matrix"              "get_membership"         
#> [16] "get_param"               "get_signatures"          "get_stats"              
#> [19] "is_best_k"               "is_stable_k"             "membership_heatmap"     
#> [22] "ncol"                    "nrow"                    "plot_ecdf"              
#> [25] "rownames"                "select_partition_number" "show"                   
#> [28] "suggest_best_k"          "test_to_known_factors"

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

collect_plots(res)

plot of chunk SD-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.829           0.913       0.948          0.282 0.740   0.740
#> 3 3 0.757           0.845       0.930          1.040 0.634   0.526
#> 4 4 0.696           0.777       0.897          0.166 0.876   0.721
#> 5 5 0.621           0.741       0.836          0.124 0.845   0.565
#> 6 6 0.610           0.580       0.777          0.045 0.935   0.745

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
#> GSM1178971     1  0.2043      0.951 0.968 0.032
#> GSM1178979     2  0.8661      0.620 0.288 0.712
#> GSM1179009     1  0.2043      0.951 0.968 0.032
#> GSM1179031     2  0.1184      0.931 0.016 0.984
#> GSM1178970     2  0.8813      0.595 0.300 0.700
#> GSM1178972     2  0.1184      0.931 0.016 0.984
#> GSM1178973     1  0.1184      0.944 0.984 0.016
#> GSM1178974     2  0.1184      0.931 0.016 0.984
#> GSM1178977     1  0.5946      0.859 0.856 0.144
#> GSM1178978     1  0.3733      0.906 0.928 0.072
#> GSM1178998     1  0.1184      0.944 0.984 0.016
#> GSM1179010     1  0.2043      0.951 0.968 0.032
#> GSM1179018     1  0.3431      0.933 0.936 0.064
#> GSM1179024     1  0.1184      0.944 0.984 0.016
#> GSM1178984     1  0.0000      0.947 1.000 0.000
#> GSM1178990     1  0.1184      0.944 0.984 0.016
#> GSM1178991     1  0.1184      0.944 0.984 0.016
#> GSM1178994     1  0.2043      0.951 0.968 0.032
#> GSM1178997     1  0.1184      0.944 0.984 0.016
#> GSM1179000     1  0.1184      0.944 0.984 0.016
#> GSM1179013     1  0.1184      0.944 0.984 0.016
#> GSM1179014     1  0.1184      0.944 0.984 0.016
#> GSM1179019     1  0.1184      0.944 0.984 0.016
#> GSM1179020     1  0.1184      0.944 0.984 0.016
#> GSM1179022     1  0.1184      0.944 0.984 0.016
#> GSM1179028     2  0.1184      0.931 0.016 0.984
#> GSM1179032     1  0.1184      0.944 0.984 0.016
#> GSM1179041     2  0.1184      0.931 0.016 0.984
#> GSM1179042     2  0.1184      0.931 0.016 0.984
#> GSM1178976     1  0.9491      0.450 0.632 0.368
#> GSM1178981     1  0.2043      0.951 0.968 0.032
#> GSM1178982     1  0.2043      0.951 0.968 0.032
#> GSM1178983     1  0.1633      0.950 0.976 0.024
#> GSM1178985     1  0.2043      0.951 0.968 0.032
#> GSM1178992     1  0.2043      0.951 0.968 0.032
#> GSM1179005     1  0.2043      0.951 0.968 0.032
#> GSM1179007     1  0.2043      0.951 0.968 0.032
#> GSM1179012     1  0.1184      0.944 0.984 0.016
#> GSM1179016     1  0.2043      0.951 0.968 0.032
#> GSM1179030     1  0.3879      0.924 0.924 0.076
#> GSM1179038     1  0.2043      0.951 0.968 0.032
#> GSM1178987     1  0.2043      0.951 0.968 0.032
#> GSM1179003     1  0.9491      0.450 0.632 0.368
#> GSM1179004     1  0.2043      0.951 0.968 0.032
#> GSM1179039     2  0.1184      0.931 0.016 0.984
#> GSM1178975     1  0.0000      0.947 1.000 0.000
#> GSM1178980     1  0.5946      0.859 0.856 0.144
#> GSM1178995     1  0.2043      0.951 0.968 0.032
#> GSM1178996     1  0.2043      0.951 0.968 0.032
#> GSM1179001     1  0.1184      0.944 0.984 0.016
#> GSM1179002     1  0.1184      0.944 0.984 0.016
#> GSM1179006     1  0.2043      0.951 0.968 0.032
#> GSM1179008     1  0.1184      0.944 0.984 0.016
#> GSM1179015     1  0.1184      0.944 0.984 0.016
#> GSM1179017     1  0.5946      0.859 0.856 0.144
#> GSM1179026     1  0.2043      0.951 0.968 0.032
#> GSM1179033     1  0.2043      0.951 0.968 0.032
#> GSM1179035     1  0.2043      0.951 0.968 0.032
#> GSM1179036     1  0.2043      0.951 0.968 0.032
#> GSM1178986     1  0.2043      0.951 0.968 0.032
#> GSM1178989     1  0.5842      0.864 0.860 0.140
#> GSM1178993     1  0.3114      0.938 0.944 0.056
#> GSM1178999     1  0.5946      0.859 0.856 0.144
#> GSM1179021     2  0.3733      0.893 0.072 0.928
#> GSM1179025     2  0.1184      0.931 0.016 0.984
#> GSM1179027     1  0.3274      0.936 0.940 0.060
#> GSM1179011     1  0.0376      0.946 0.996 0.004
#> GSM1179023     1  0.1184      0.944 0.984 0.016
#> GSM1179029     1  0.1184      0.944 0.984 0.016
#> GSM1179034     1  0.1184      0.944 0.984 0.016
#> GSM1179040     1  0.5946      0.859 0.856 0.144
#> GSM1178988     1  0.2043      0.951 0.968 0.032
#> GSM1179037     1  0.2043      0.951 0.968 0.032

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>            class entropy silhouette    p1    p2    p3
#> GSM1178971     3  0.2448     0.8722 0.076 0.000 0.924
#> GSM1178979     3  0.0000     0.8918 0.000 0.000 1.000
#> GSM1179009     3  0.0747     0.8926 0.016 0.000 0.984
#> GSM1179031     2  0.0000     0.9243 0.000 1.000 0.000
#> GSM1178970     3  0.0000     0.8918 0.000 0.000 1.000
#> GSM1178972     2  0.0000     0.9243 0.000 1.000 0.000
#> GSM1178973     1  0.0000     0.9516 1.000 0.000 0.000
#> GSM1178974     2  0.0000     0.9243 0.000 1.000 0.000
#> GSM1178977     3  0.0000     0.8918 0.000 0.000 1.000
#> GSM1178978     3  0.5178     0.6497 0.256 0.000 0.744
#> GSM1178998     1  0.1529     0.9155 0.960 0.000 0.040
#> GSM1179010     3  0.6095     0.4737 0.392 0.000 0.608
#> GSM1179018     3  0.0000     0.8918 0.000 0.000 1.000
#> GSM1179024     1  0.0000     0.9516 1.000 0.000 0.000
#> GSM1178984     3  0.6095     0.4363 0.392 0.000 0.608
#> GSM1178990     1  0.0000     0.9516 1.000 0.000 0.000
#> GSM1178991     1  0.2796     0.8692 0.908 0.000 0.092
#> GSM1178994     3  0.5810     0.5866 0.336 0.000 0.664
#> GSM1178997     1  0.5859     0.4262 0.656 0.000 0.344
#> GSM1179000     1  0.0000     0.9516 1.000 0.000 0.000
#> GSM1179013     1  0.0000     0.9516 1.000 0.000 0.000
#> GSM1179014     1  0.0237     0.9494 0.996 0.000 0.004
#> GSM1179019     1  0.0237     0.9494 0.996 0.000 0.004
#> GSM1179020     1  0.0000     0.9516 1.000 0.000 0.000
#> GSM1179022     1  0.0000     0.9516 1.000 0.000 0.000
#> GSM1179028     2  0.0000     0.9243 0.000 1.000 0.000
#> GSM1179032     1  0.0000     0.9516 1.000 0.000 0.000
#> GSM1179041     2  0.0000     0.9243 0.000 1.000 0.000
#> GSM1179042     2  0.0000     0.9243 0.000 1.000 0.000
#> GSM1178976     3  0.0000     0.8918 0.000 0.000 1.000
#> GSM1178981     3  0.1964     0.8816 0.056 0.000 0.944
#> GSM1178982     3  0.1289     0.8895 0.032 0.000 0.968
#> GSM1178983     3  0.0892     0.8884 0.020 0.000 0.980
#> GSM1178985     3  0.0892     0.8921 0.020 0.000 0.980
#> GSM1178992     3  0.4291     0.7982 0.180 0.000 0.820
#> GSM1179005     3  0.2711     0.8662 0.088 0.000 0.912
#> GSM1179007     3  0.5988     0.5342 0.368 0.000 0.632
#> GSM1179012     1  0.1411     0.9249 0.964 0.000 0.036
#> GSM1179016     3  0.5178     0.6775 0.256 0.000 0.744
#> GSM1179030     3  0.0000     0.8918 0.000 0.000 1.000
#> GSM1179038     3  0.5327     0.6901 0.272 0.000 0.728
#> GSM1178987     3  0.2625     0.8601 0.084 0.000 0.916
#> GSM1179003     3  0.0000     0.8918 0.000 0.000 1.000
#> GSM1179004     3  0.0592     0.8924 0.012 0.000 0.988
#> GSM1179039     2  0.0000     0.9243 0.000 1.000 0.000
#> GSM1178975     3  0.5810     0.5628 0.336 0.000 0.664
#> GSM1178980     3  0.0000     0.8918 0.000 0.000 1.000
#> GSM1178995     3  0.4654     0.7756 0.208 0.000 0.792
#> GSM1178996     3  0.1860     0.8812 0.052 0.000 0.948
#> GSM1179001     1  0.0000     0.9516 1.000 0.000 0.000
#> GSM1179002     1  0.4121     0.7376 0.832 0.000 0.168
#> GSM1179006     3  0.0747     0.8924 0.016 0.000 0.984
#> GSM1179008     1  0.0592     0.9431 0.988 0.000 0.012
#> GSM1179015     1  0.0000     0.9516 1.000 0.000 0.000
#> GSM1179017     3  0.0000     0.8918 0.000 0.000 1.000
#> GSM1179026     3  0.0592     0.8924 0.012 0.000 0.988
#> GSM1179033     3  0.1860     0.8812 0.052 0.000 0.948
#> GSM1179035     3  0.0747     0.8924 0.016 0.000 0.984
#> GSM1179036     3  0.1860     0.8812 0.052 0.000 0.948
#> GSM1178986     3  0.0000     0.8918 0.000 0.000 1.000
#> GSM1178989     3  0.0000     0.8918 0.000 0.000 1.000
#> GSM1178993     3  0.0000     0.8918 0.000 0.000 1.000
#> GSM1178999     3  0.0000     0.8918 0.000 0.000 1.000
#> GSM1179021     2  0.6295     0.0301 0.000 0.528 0.472
#> GSM1179025     2  0.0000     0.9243 0.000 1.000 0.000
#> GSM1179027     3  0.0424     0.8923 0.008 0.000 0.992
#> GSM1179011     3  0.5621     0.5574 0.308 0.000 0.692
#> GSM1179023     1  0.0000     0.9516 1.000 0.000 0.000
#> GSM1179029     1  0.0000     0.9516 1.000 0.000 0.000
#> GSM1179034     1  0.0000     0.9516 1.000 0.000 0.000
#> GSM1179040     3  0.0000     0.8918 0.000 0.000 1.000
#> GSM1178988     3  0.0000     0.8918 0.000 0.000 1.000
#> GSM1179037     3  0.1964     0.8810 0.056 0.000 0.944

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>            class entropy silhouette    p1    p2    p3    p4
#> GSM1178971     3  0.2081     0.8375 0.084 0.000 0.916 0.000
#> GSM1178979     3  0.4898     0.1441 0.000 0.000 0.584 0.416
#> GSM1179009     4  0.5000     0.0485 0.000 0.000 0.496 0.504
#> GSM1179031     2  0.0000     1.0000 0.000 1.000 0.000 0.000
#> GSM1178970     3  0.0592     0.8367 0.000 0.000 0.984 0.016
#> GSM1178972     2  0.0000     1.0000 0.000 1.000 0.000 0.000
#> GSM1178973     1  0.0657     0.9326 0.984 0.000 0.004 0.012
#> GSM1178974     2  0.0000     1.0000 0.000 1.000 0.000 0.000
#> GSM1178977     3  0.1867     0.8109 0.000 0.000 0.928 0.072
#> GSM1178978     4  0.7495     0.3047 0.184 0.000 0.368 0.448
#> GSM1178998     1  0.2644     0.8611 0.908 0.000 0.060 0.032
#> GSM1179010     3  0.5645     0.5224 0.364 0.000 0.604 0.032
#> GSM1179018     3  0.1940     0.8043 0.000 0.000 0.924 0.076
#> GSM1179024     1  0.0000     0.9357 1.000 0.000 0.000 0.000
#> GSM1178984     3  0.5492     0.5232 0.328 0.000 0.640 0.032
#> GSM1178990     1  0.0000     0.9357 1.000 0.000 0.000 0.000
#> GSM1178991     4  0.6965     0.0581 0.428 0.000 0.112 0.460
#> GSM1178994     3  0.5344     0.6097 0.300 0.000 0.668 0.032
#> GSM1178997     1  0.4679     0.3947 0.648 0.000 0.352 0.000
#> GSM1179000     1  0.0188     0.9347 0.996 0.000 0.004 0.000
#> GSM1179013     1  0.0000     0.9357 1.000 0.000 0.000 0.000
#> GSM1179014     1  0.0188     0.9351 0.996 0.000 0.004 0.000
#> GSM1179019     1  0.0336     0.9331 0.992 0.000 0.008 0.000
#> GSM1179020     1  0.0592     0.9316 0.984 0.000 0.000 0.016
#> GSM1179022     1  0.0000     0.9357 1.000 0.000 0.000 0.000
#> GSM1179028     2  0.0000     1.0000 0.000 1.000 0.000 0.000
#> GSM1179032     1  0.0000     0.9357 1.000 0.000 0.000 0.000
#> GSM1179041     2  0.0000     1.0000 0.000 1.000 0.000 0.000
#> GSM1179042     2  0.0000     1.0000 0.000 1.000 0.000 0.000
#> GSM1178976     3  0.0000     0.8387 0.000 0.000 1.000 0.000
#> GSM1178981     3  0.2224     0.8386 0.040 0.000 0.928 0.032
#> GSM1178982     3  0.1833     0.8410 0.024 0.000 0.944 0.032
#> GSM1178983     3  0.1510     0.8354 0.016 0.000 0.956 0.028
#> GSM1178985     3  0.1624     0.8421 0.020 0.000 0.952 0.028
#> GSM1178992     3  0.3444     0.7773 0.184 0.000 0.816 0.000
#> GSM1179005     3  0.2530     0.8259 0.112 0.000 0.888 0.000
#> GSM1179007     3  0.5495     0.5657 0.348 0.000 0.624 0.028
#> GSM1179012     1  0.2565     0.8732 0.912 0.000 0.056 0.032
#> GSM1179016     3  0.3907     0.6700 0.232 0.000 0.768 0.000
#> GSM1179030     3  0.0000     0.8387 0.000 0.000 1.000 0.000
#> GSM1179038     3  0.4356     0.6579 0.292 0.000 0.708 0.000
#> GSM1178987     3  0.2483     0.8240 0.052 0.000 0.916 0.032
#> GSM1179003     3  0.2469     0.7836 0.000 0.000 0.892 0.108
#> GSM1179004     3  0.1724     0.8412 0.020 0.000 0.948 0.032
#> GSM1179039     2  0.0000     1.0000 0.000 1.000 0.000 0.000
#> GSM1178975     3  0.4356     0.6138 0.292 0.000 0.708 0.000
#> GSM1178980     4  0.1022     0.6622 0.000 0.000 0.032 0.968
#> GSM1178995     3  0.3751     0.7672 0.196 0.000 0.800 0.004
#> GSM1178996     3  0.2081     0.8375 0.084 0.000 0.916 0.000
#> GSM1179001     1  0.0707     0.9298 0.980 0.000 0.000 0.020
#> GSM1179002     1  0.4867     0.5719 0.736 0.000 0.232 0.032
#> GSM1179006     3  0.0921     0.8464 0.028 0.000 0.972 0.000
#> GSM1179008     1  0.1388     0.9185 0.960 0.000 0.012 0.028
#> GSM1179015     1  0.0000     0.9357 1.000 0.000 0.000 0.000
#> GSM1179017     3  0.0000     0.8387 0.000 0.000 1.000 0.000
#> GSM1179026     3  0.0707     0.8445 0.020 0.000 0.980 0.000
#> GSM1179033     3  0.2081     0.8375 0.084 0.000 0.916 0.000
#> GSM1179035     3  0.1022     0.8468 0.032 0.000 0.968 0.000
#> GSM1179036     3  0.2081     0.8375 0.084 0.000 0.916 0.000
#> GSM1178986     3  0.0000     0.8387 0.000 0.000 1.000 0.000
#> GSM1178989     3  0.0000     0.8387 0.000 0.000 1.000 0.000
#> GSM1178993     4  0.0000     0.6406 0.000 0.000 0.000 1.000
#> GSM1178999     4  0.4998     0.0723 0.000 0.000 0.488 0.512
#> GSM1179021     4  0.2480     0.5928 0.000 0.088 0.008 0.904
#> GSM1179025     2  0.0000     1.0000 0.000 1.000 0.000 0.000
#> GSM1179027     4  0.1022     0.6622 0.000 0.000 0.032 0.968
#> GSM1179011     4  0.1022     0.6622 0.000 0.000 0.032 0.968
#> GSM1179023     1  0.0000     0.9357 1.000 0.000 0.000 0.000
#> GSM1179029     1  0.0592     0.9319 0.984 0.000 0.000 0.016
#> GSM1179034     1  0.0000     0.9357 1.000 0.000 0.000 0.000
#> GSM1179040     4  0.1302     0.6607 0.000 0.000 0.044 0.956
#> GSM1178988     3  0.0000     0.8387 0.000 0.000 1.000 0.000
#> GSM1179037     3  0.1940     0.8402 0.076 0.000 0.924 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
#> GSM1178971     3  0.0000     0.8422 0.000 0.000 1.000 0.000 0.000
#> GSM1178979     4  0.5177     0.5930 0.000 0.000 0.220 0.676 0.104
#> GSM1179009     5  0.5750     0.5757 0.000 0.000 0.156 0.228 0.616
#> GSM1179031     2  0.0000     0.9964 0.000 1.000 0.000 0.000 0.000
#> GSM1178970     3  0.4639     0.7385 0.000 0.000 0.708 0.056 0.236
#> GSM1178972     2  0.0794     0.9742 0.000 0.972 0.000 0.000 0.028
#> GSM1178973     1  0.4183     0.7434 0.780 0.000 0.136 0.000 0.084
#> GSM1178974     2  0.0000     0.9964 0.000 1.000 0.000 0.000 0.000
#> GSM1178977     3  0.4845     0.7294 0.000 0.000 0.724 0.128 0.148
#> GSM1178978     5  0.3277     0.6908 0.072 0.000 0.068 0.004 0.856
#> GSM1178998     5  0.3796     0.4605 0.300 0.000 0.000 0.000 0.700
#> GSM1179010     5  0.4317     0.6329 0.076 0.000 0.160 0.000 0.764
#> GSM1179018     3  0.4021     0.7887 0.000 0.000 0.780 0.052 0.168
#> GSM1179024     1  0.0000     0.8003 1.000 0.000 0.000 0.000 0.000
#> GSM1178984     5  0.4808     0.6802 0.108 0.000 0.168 0.000 0.724
#> GSM1178990     1  0.2424     0.7855 0.868 0.000 0.132 0.000 0.000
#> GSM1178991     1  0.6341     0.4308 0.564 0.000 0.008 0.200 0.228
#> GSM1178994     5  0.4451     0.7139 0.040 0.000 0.248 0.000 0.712
#> GSM1178997     1  0.6080     0.3289 0.528 0.000 0.332 0.000 0.140
#> GSM1179000     1  0.2127     0.7964 0.892 0.000 0.108 0.000 0.000
#> GSM1179013     1  0.0000     0.8003 1.000 0.000 0.000 0.000 0.000
#> GSM1179014     1  0.2329     0.7900 0.876 0.000 0.124 0.000 0.000
#> GSM1179019     1  0.2230     0.7945 0.884 0.000 0.116 0.000 0.000
#> GSM1179020     1  0.3442     0.7546 0.836 0.000 0.060 0.000 0.104
#> GSM1179022     1  0.0000     0.8003 1.000 0.000 0.000 0.000 0.000
#> GSM1179028     2  0.0000     0.9964 0.000 1.000 0.000 0.000 0.000
#> GSM1179032     1  0.0000     0.8003 1.000 0.000 0.000 0.000 0.000
#> GSM1179041     2  0.0000     0.9964 0.000 1.000 0.000 0.000 0.000
#> GSM1179042     2  0.0000     0.9964 0.000 1.000 0.000 0.000 0.000
#> GSM1178976     3  0.2424     0.8375 0.000 0.000 0.868 0.000 0.132
#> GSM1178981     5  0.3508     0.6857 0.000 0.000 0.252 0.000 0.748
#> GSM1178982     5  0.4300     0.1441 0.000 0.000 0.476 0.000 0.524
#> GSM1178983     5  0.3109     0.6683 0.000 0.000 0.200 0.000 0.800
#> GSM1178985     3  0.4227     0.2303 0.000 0.000 0.580 0.000 0.420
#> GSM1178992     3  0.1082     0.8342 0.028 0.000 0.964 0.000 0.008
#> GSM1179005     3  0.0000     0.8422 0.000 0.000 1.000 0.000 0.000
#> GSM1179007     3  0.4581     0.4576 0.072 0.000 0.732 0.000 0.196
#> GSM1179012     5  0.3628     0.5475 0.216 0.000 0.012 0.000 0.772
#> GSM1179016     3  0.4036     0.8128 0.068 0.000 0.788 0.000 0.144
#> GSM1179030     3  0.3074     0.8074 0.000 0.000 0.804 0.000 0.196
#> GSM1179038     3  0.1608     0.7862 0.072 0.000 0.928 0.000 0.000
#> GSM1178987     5  0.3010     0.6893 0.004 0.000 0.172 0.000 0.824
#> GSM1179003     3  0.2962     0.8175 0.000 0.000 0.868 0.084 0.048
#> GSM1179004     5  0.3661     0.6744 0.000 0.000 0.276 0.000 0.724
#> GSM1179039     2  0.0000     0.9964 0.000 1.000 0.000 0.000 0.000
#> GSM1178975     3  0.3365     0.6725 0.120 0.000 0.836 0.000 0.044
#> GSM1178980     4  0.0510     0.8807 0.000 0.000 0.000 0.984 0.016
#> GSM1178995     3  0.1012     0.8289 0.012 0.000 0.968 0.000 0.020
#> GSM1178996     3  0.0000     0.8422 0.000 0.000 1.000 0.000 0.000
#> GSM1179001     5  0.6158     0.0822 0.416 0.000 0.132 0.000 0.452
#> GSM1179002     5  0.6439     0.4599 0.260 0.000 0.236 0.000 0.504
#> GSM1179006     3  0.1608     0.8497 0.000 0.000 0.928 0.000 0.072
#> GSM1179008     1  0.5783     0.4855 0.612 0.000 0.160 0.000 0.228
#> GSM1179015     1  0.4083     0.7421 0.788 0.000 0.080 0.000 0.132
#> GSM1179017     3  0.2561     0.8346 0.000 0.000 0.856 0.000 0.144
#> GSM1179026     3  0.1792     0.8469 0.000 0.000 0.916 0.000 0.084
#> GSM1179033     3  0.0000     0.8422 0.000 0.000 1.000 0.000 0.000
#> GSM1179035     3  0.1608     0.8498 0.000 0.000 0.928 0.000 0.072
#> GSM1179036     3  0.0000     0.8422 0.000 0.000 1.000 0.000 0.000
#> GSM1178986     3  0.2424     0.8388 0.000 0.000 0.868 0.000 0.132
#> GSM1178989     3  0.2561     0.8346 0.000 0.000 0.856 0.000 0.144
#> GSM1178993     4  0.0000     0.8826 0.000 0.000 0.000 1.000 0.000
#> GSM1178999     4  0.4693     0.6614 0.000 0.000 0.196 0.724 0.080
#> GSM1179021     4  0.0955     0.8684 0.000 0.028 0.000 0.968 0.004
#> GSM1179025     2  0.0000     0.9964 0.000 1.000 0.000 0.000 0.000
#> GSM1179027     4  0.0000     0.8826 0.000 0.000 0.000 1.000 0.000
#> GSM1179011     4  0.0510     0.8807 0.000 0.000 0.000 0.984 0.016
#> GSM1179023     1  0.0000     0.8003 1.000 0.000 0.000 0.000 0.000
#> GSM1179029     1  0.5953     0.1302 0.504 0.000 0.112 0.000 0.384
#> GSM1179034     1  0.0000     0.8003 1.000 0.000 0.000 0.000 0.000
#> GSM1179040     4  0.0290     0.8821 0.000 0.000 0.008 0.992 0.000
#> GSM1178988     3  0.2424     0.8375 0.000 0.000 0.868 0.000 0.132
#> GSM1179037     3  0.0162     0.8436 0.000 0.000 0.996 0.000 0.004

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>            class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM1178971     3  0.2300     0.7668 0.000 0.000 0.856 0.000 0.000 0.144
#> GSM1178979     5  0.4591     0.5464 0.000 0.000 0.120 0.112 0.740 0.028
#> GSM1179009     4  0.5673    -0.1579 0.000 0.000 0.156 0.448 0.000 0.396
#> GSM1179031     2  0.0000     0.9459 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1178970     3  0.4897     0.2704 0.000 0.000 0.492 0.000 0.448 0.060
#> GSM1178972     2  0.3684     0.4997 0.000 0.628 0.000 0.000 0.372 0.000
#> GSM1178973     4  0.6828    -0.1475 0.288 0.000 0.048 0.436 0.004 0.224
#> GSM1178974     2  0.0000     0.9459 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1178977     3  0.4811     0.2931 0.000 0.000 0.508 0.008 0.448 0.036
#> GSM1178978     6  0.5947     0.4830 0.036 0.000 0.128 0.000 0.280 0.556
#> GSM1178998     6  0.4284     0.5330 0.256 0.000 0.000 0.000 0.056 0.688
#> GSM1179010     6  0.2796     0.6119 0.016 0.000 0.020 0.000 0.100 0.864
#> GSM1179018     3  0.3453     0.6916 0.000 0.000 0.824 0.064 0.012 0.100
#> GSM1179024     1  0.0000     0.7828 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1178984     6  0.2972     0.6801 0.036 0.000 0.128 0.000 0.000 0.836
#> GSM1178990     1  0.3734     0.7277 0.784 0.000 0.040 0.000 0.012 0.164
#> GSM1178991     4  0.4048     0.2287 0.016 0.000 0.088 0.788 0.004 0.104
#> GSM1178994     6  0.2805     0.6757 0.000 0.000 0.160 0.000 0.012 0.828
#> GSM1178997     1  0.8159     0.1619 0.360 0.000 0.244 0.132 0.052 0.212
#> GSM1179000     1  0.3302     0.7584 0.824 0.000 0.028 0.004 0.008 0.136
#> GSM1179013     1  0.0260     0.7819 0.992 0.000 0.000 0.000 0.008 0.000
#> GSM1179014     1  0.3606     0.7463 0.800 0.000 0.024 0.004 0.016 0.156
#> GSM1179019     1  0.3271     0.7558 0.820 0.000 0.028 0.004 0.004 0.144
#> GSM1179020     1  0.3194     0.7145 0.808 0.000 0.012 0.004 0.004 0.172
#> GSM1179022     1  0.0000     0.7828 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1179028     2  0.0000     0.9459 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1179032     1  0.0000     0.7828 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1179041     2  0.0000     0.9459 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1179042     2  0.0000     0.9459 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1178976     3  0.1444     0.7680 0.000 0.000 0.928 0.000 0.072 0.000
#> GSM1178981     6  0.3175     0.6623 0.000 0.000 0.256 0.000 0.000 0.744
#> GSM1178982     3  0.3854    -0.1170 0.000 0.000 0.536 0.000 0.000 0.464
#> GSM1178983     6  0.4215     0.6255 0.000 0.000 0.244 0.000 0.056 0.700
#> GSM1178985     3  0.3601     0.3630 0.000 0.000 0.684 0.000 0.004 0.312
#> GSM1178992     3  0.2673     0.7702 0.012 0.000 0.852 0.000 0.004 0.132
#> GSM1179005     3  0.2491     0.7544 0.000 0.000 0.836 0.000 0.000 0.164
#> GSM1179007     3  0.4174     0.5109 0.016 0.000 0.628 0.000 0.004 0.352
#> GSM1179012     6  0.4464     0.5608 0.136 0.000 0.020 0.000 0.100 0.744
#> GSM1179016     3  0.2307     0.7594 0.024 0.000 0.900 0.000 0.064 0.012
#> GSM1179030     3  0.2837     0.7159 0.000 0.000 0.856 0.000 0.056 0.088
#> GSM1179038     3  0.3147     0.7466 0.016 0.000 0.816 0.000 0.008 0.160
#> GSM1178987     6  0.3896     0.6517 0.000 0.000 0.196 0.000 0.056 0.748
#> GSM1179003     3  0.3835     0.6497 0.000 0.000 0.756 0.056 0.188 0.000
#> GSM1179004     6  0.3634     0.6035 0.000 0.000 0.356 0.000 0.000 0.644
#> GSM1179039     2  0.0000     0.9459 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1178975     4  0.6371     0.0288 0.012 0.000 0.340 0.440 0.008 0.200
#> GSM1178980     4  0.2003     0.2053 0.000 0.000 0.000 0.884 0.116 0.000
#> GSM1178995     3  0.2915     0.7426 0.008 0.000 0.808 0.000 0.000 0.184
#> GSM1178996     3  0.1957     0.7787 0.000 0.000 0.888 0.000 0.000 0.112
#> GSM1179001     6  0.4605     0.4198 0.272 0.000 0.040 0.004 0.012 0.672
#> GSM1179002     6  0.5018     0.5815 0.104 0.000 0.180 0.004 0.020 0.692
#> GSM1179006     3  0.0547     0.7864 0.000 0.000 0.980 0.000 0.000 0.020
#> GSM1179008     1  0.7433     0.1616 0.368 0.000 0.080 0.192 0.020 0.340
#> GSM1179015     1  0.4873     0.6564 0.676 0.000 0.004 0.004 0.104 0.212
#> GSM1179017     3  0.2883     0.6731 0.000 0.000 0.788 0.000 0.212 0.000
#> GSM1179026     3  0.0146     0.7821 0.000 0.000 0.996 0.000 0.000 0.004
#> GSM1179033     3  0.1957     0.7787 0.000 0.000 0.888 0.000 0.000 0.112
#> GSM1179035     3  0.1007     0.7882 0.000 0.000 0.956 0.000 0.000 0.044
#> GSM1179036     3  0.1957     0.7787 0.000 0.000 0.888 0.000 0.000 0.112
#> GSM1178986     3  0.1196     0.7687 0.000 0.000 0.952 0.000 0.040 0.008
#> GSM1178989     3  0.1152     0.7686 0.000 0.000 0.952 0.000 0.044 0.004
#> GSM1178993     4  0.3828    -0.0995 0.000 0.000 0.000 0.560 0.440 0.000
#> GSM1178999     5  0.5449     0.5261 0.000 0.000 0.204 0.092 0.652 0.052
#> GSM1179021     5  0.4648     0.2631 0.000 0.056 0.000 0.340 0.604 0.000
#> GSM1179025     2  0.0000     0.9459 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1179027     4  0.3828    -0.0995 0.000 0.000 0.000 0.560 0.440 0.000
#> GSM1179011     4  0.0146     0.2520 0.000 0.000 0.000 0.996 0.004 0.000
#> GSM1179023     1  0.0000     0.7828 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1179029     6  0.5562     0.2008 0.332 0.000 0.024 0.004 0.076 0.564
#> GSM1179034     1  0.0000     0.7828 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1179040     4  0.4062    -0.1123 0.000 0.000 0.008 0.552 0.440 0.000
#> GSM1178988     3  0.1010     0.7699 0.000 0.000 0.960 0.000 0.036 0.004
#> GSM1179037     3  0.1910     0.7799 0.000 0.000 0.892 0.000 0.000 0.108

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) protocol(p) k
#> SD:pam 71          0.11669    1.76e-01 2
#> SD:pam 69          0.52017    7.20e-04 3
#> SD:pam 67          0.00905    3.38e-05 4
#> SD:pam 63          0.00451    4.88e-06 5
#> SD:pam 53          0.29199    8.43e-07 6

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


SD: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 31632 rows and 73 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.624           0.877       0.933         0.2963 0.740   0.740
#> 3 3 0.440           0.715       0.750         0.7075 0.648   0.556
#> 4 4 0.762           0.803       0.922         0.2736 0.772   0.577
#> 5 5 0.647           0.790       0.855         0.0987 0.839   0.603
#> 6 6 0.650           0.737       0.818         0.0877 0.937   0.789

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
#> GSM1178971     1  0.0000      0.923 1.000 0.000
#> GSM1178979     2  0.6973      0.766 0.188 0.812
#> GSM1179009     1  0.7453      0.795 0.788 0.212
#> GSM1179031     2  0.0672      0.920 0.008 0.992
#> GSM1178970     2  0.9170      0.477 0.332 0.668
#> GSM1178972     2  0.0672      0.920 0.008 0.992
#> GSM1178973     1  0.7453      0.795 0.788 0.212
#> GSM1178974     2  0.0672      0.920 0.008 0.992
#> GSM1178977     1  0.7453      0.795 0.788 0.212
#> GSM1178978     1  0.7453      0.795 0.788 0.212
#> GSM1178998     1  0.0000      0.923 1.000 0.000
#> GSM1179010     1  0.0672      0.923 0.992 0.008
#> GSM1179018     1  0.7453      0.795 0.788 0.212
#> GSM1179024     1  0.0000      0.923 1.000 0.000
#> GSM1178984     1  0.0000      0.923 1.000 0.000
#> GSM1178990     1  0.0000      0.923 1.000 0.000
#> GSM1178991     1  0.7453      0.795 0.788 0.212
#> GSM1178994     1  0.0000      0.923 1.000 0.000
#> GSM1178997     1  0.0000      0.923 1.000 0.000
#> GSM1179000     1  0.0000      0.923 1.000 0.000
#> GSM1179013     1  0.0376      0.923 0.996 0.004
#> GSM1179014     1  0.0938      0.921 0.988 0.012
#> GSM1179019     1  0.0000      0.923 1.000 0.000
#> GSM1179020     1  0.0000      0.923 1.000 0.000
#> GSM1179022     1  0.0000      0.923 1.000 0.000
#> GSM1179028     2  0.0672      0.920 0.008 0.992
#> GSM1179032     1  0.0000      0.923 1.000 0.000
#> GSM1179041     2  0.0672      0.920 0.008 0.992
#> GSM1179042     2  0.0672      0.920 0.008 0.992
#> GSM1178976     1  0.7453      0.792 0.788 0.212
#> GSM1178981     1  0.0000      0.923 1.000 0.000
#> GSM1178982     1  0.0672      0.922 0.992 0.008
#> GSM1178983     1  0.0938      0.921 0.988 0.012
#> GSM1178985     1  0.0376      0.923 0.996 0.004
#> GSM1178992     1  0.0938      0.922 0.988 0.012
#> GSM1179005     1  0.0000      0.923 1.000 0.000
#> GSM1179007     1  0.0000      0.923 1.000 0.000
#> GSM1179012     1  0.0376      0.923 0.996 0.004
#> GSM1179016     1  0.4022      0.887 0.920 0.080
#> GSM1179030     1  0.3431      0.896 0.936 0.064
#> GSM1179038     1  0.0000      0.923 1.000 0.000
#> GSM1178987     1  0.0376      0.923 0.996 0.004
#> GSM1179003     1  0.9460      0.521 0.636 0.364
#> GSM1179004     1  0.0376      0.923 0.996 0.004
#> GSM1179039     2  0.0672      0.920 0.008 0.992
#> GSM1178975     1  0.7453      0.795 0.788 0.212
#> GSM1178980     1  0.7453      0.795 0.788 0.212
#> GSM1178995     1  0.0000      0.923 1.000 0.000
#> GSM1178996     1  0.0376      0.923 0.996 0.004
#> GSM1179001     1  0.0000      0.923 1.000 0.000
#> GSM1179002     1  0.0000      0.923 1.000 0.000
#> GSM1179006     1  0.0000      0.923 1.000 0.000
#> GSM1179008     1  0.0000      0.923 1.000 0.000
#> GSM1179015     1  0.0938      0.922 0.988 0.012
#> GSM1179017     1  0.6973      0.813 0.812 0.188
#> GSM1179026     1  0.0672      0.923 0.992 0.008
#> GSM1179033     1  0.0938      0.922 0.988 0.012
#> GSM1179035     1  0.0376      0.923 0.996 0.004
#> GSM1179036     1  0.0000      0.923 1.000 0.000
#> GSM1178986     1  0.6531      0.829 0.832 0.168
#> GSM1178989     1  0.6623      0.826 0.828 0.172
#> GSM1178993     1  0.7453      0.795 0.788 0.212
#> GSM1178999     1  0.7299      0.799 0.796 0.204
#> GSM1179021     2  0.6801      0.771 0.180 0.820
#> GSM1179025     2  0.0672      0.920 0.008 0.992
#> GSM1179027     1  0.7453      0.795 0.788 0.212
#> GSM1179011     1  0.7453      0.795 0.788 0.212
#> GSM1179023     1  0.0000      0.923 1.000 0.000
#> GSM1179029     1  0.0000      0.923 1.000 0.000
#> GSM1179034     1  0.0000      0.923 1.000 0.000
#> GSM1179040     1  0.7528      0.791 0.784 0.216
#> GSM1178988     1  0.1414      0.918 0.980 0.020
#> GSM1179037     1  0.0376      0.923 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
#> GSM1178971     3  0.2165     0.7251 0.064 0.000 0.936
#> GSM1178979     3  0.6336     0.6748 0.180 0.064 0.756
#> GSM1179009     3  0.6999     0.6050 0.268 0.052 0.680
#> GSM1179031     2  0.0475     0.9932 0.004 0.992 0.004
#> GSM1178970     3  0.5947     0.6882 0.172 0.052 0.776
#> GSM1178972     2  0.0424     0.9906 0.000 0.992 0.008
#> GSM1178973     1  0.6935     0.6236 0.652 0.036 0.312
#> GSM1178974     2  0.0424     0.9906 0.000 0.992 0.008
#> GSM1178977     3  0.6109     0.6753 0.192 0.048 0.760
#> GSM1178978     3  0.5618     0.6935 0.156 0.048 0.796
#> GSM1178998     1  0.6309     0.7667 0.504 0.000 0.496
#> GSM1179010     3  0.1878     0.7298 0.044 0.004 0.952
#> GSM1179018     3  0.6348     0.6608 0.212 0.048 0.740
#> GSM1179024     1  0.6008     0.8885 0.664 0.004 0.332
#> GSM1178984     3  0.1163     0.7423 0.028 0.000 0.972
#> GSM1178990     1  0.6140     0.9072 0.596 0.000 0.404
#> GSM1178991     3  0.7471     0.0338 0.448 0.036 0.516
#> GSM1178994     3  0.2682     0.6923 0.076 0.004 0.920
#> GSM1178997     3  0.3851     0.6187 0.136 0.004 0.860
#> GSM1179000     1  0.6345     0.9099 0.596 0.004 0.400
#> GSM1179013     1  0.5956     0.8843 0.672 0.004 0.324
#> GSM1179014     1  0.6345     0.9099 0.596 0.004 0.400
#> GSM1179019     1  0.6345     0.9099 0.596 0.004 0.400
#> GSM1179020     1  0.6345     0.9099 0.596 0.004 0.400
#> GSM1179022     1  0.5956     0.8843 0.672 0.004 0.324
#> GSM1179028     2  0.0475     0.9932 0.004 0.992 0.004
#> GSM1179032     1  0.5956     0.8843 0.672 0.004 0.324
#> GSM1179041     2  0.0475     0.9932 0.004 0.992 0.004
#> GSM1179042     2  0.0237     0.9921 0.004 0.996 0.000
#> GSM1178976     3  0.2860     0.7444 0.084 0.004 0.912
#> GSM1178981     3  0.0237     0.7577 0.004 0.000 0.996
#> GSM1178982     3  0.0237     0.7577 0.004 0.000 0.996
#> GSM1178983     3  0.0592     0.7608 0.012 0.000 0.988
#> GSM1178985     3  0.0237     0.7598 0.000 0.004 0.996
#> GSM1178992     3  0.2200     0.7221 0.056 0.004 0.940
#> GSM1179005     3  0.1289     0.7407 0.032 0.000 0.968
#> GSM1179007     3  0.3619     0.5846 0.136 0.000 0.864
#> GSM1179012     3  0.6521    -0.7665 0.496 0.004 0.500
#> GSM1179016     3  0.6451    -0.5386 0.436 0.004 0.560
#> GSM1179030     3  0.2261     0.7504 0.068 0.000 0.932
#> GSM1179038     3  0.2066     0.7135 0.060 0.000 0.940
#> GSM1178987     3  0.0237     0.7598 0.000 0.004 0.996
#> GSM1179003     3  0.4007     0.7377 0.084 0.036 0.880
#> GSM1179004     3  0.0237     0.7598 0.000 0.004 0.996
#> GSM1179039     2  0.0475     0.9932 0.004 0.992 0.004
#> GSM1178975     3  0.6124     0.6457 0.220 0.036 0.744
#> GSM1178980     3  0.7037     0.5769 0.328 0.036 0.636
#> GSM1178995     3  0.2878     0.6859 0.096 0.000 0.904
#> GSM1178996     3  0.0592     0.7556 0.012 0.000 0.988
#> GSM1179001     1  0.6140     0.9072 0.596 0.000 0.404
#> GSM1179002     3  0.5016     0.3385 0.240 0.000 0.760
#> GSM1179006     3  0.0000     0.7592 0.000 0.000 1.000
#> GSM1179008     1  0.6345     0.9099 0.596 0.004 0.400
#> GSM1179015     1  0.6451     0.8675 0.560 0.004 0.436
#> GSM1179017     3  0.3851     0.7206 0.136 0.004 0.860
#> GSM1179026     3  0.0237     0.7598 0.000 0.004 0.996
#> GSM1179033     3  0.0000     0.7592 0.000 0.000 1.000
#> GSM1179035     3  0.0475     0.7583 0.004 0.004 0.992
#> GSM1179036     3  0.0424     0.7568 0.008 0.000 0.992
#> GSM1178986     3  0.2918     0.7489 0.044 0.032 0.924
#> GSM1178989     3  0.2860     0.7444 0.084 0.004 0.912
#> GSM1178993     3  0.7037     0.5769 0.328 0.036 0.636
#> GSM1178999     3  0.5558     0.7005 0.152 0.048 0.800
#> GSM1179021     3  0.9972     0.1012 0.328 0.304 0.368
#> GSM1179025     2  0.0424     0.9906 0.000 0.992 0.008
#> GSM1179027     3  0.7037     0.5769 0.328 0.036 0.636
#> GSM1179011     3  0.7037     0.5769 0.328 0.036 0.636
#> GSM1179023     1  0.5956     0.8843 0.672 0.004 0.324
#> GSM1179029     1  0.6140     0.9072 0.596 0.000 0.404
#> GSM1179034     1  0.5956     0.8843 0.672 0.004 0.324
#> GSM1179040     3  0.7037     0.5769 0.328 0.036 0.636
#> GSM1178988     3  0.0475     0.7603 0.004 0.004 0.992
#> GSM1179037     3  0.0237     0.7598 0.000 0.004 0.996

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>            class entropy silhouette    p1    p2    p3    p4
#> GSM1178971     3  0.4746      0.424 0.368 0.000 0.632 0.000
#> GSM1178979     3  0.4678      0.638 0.000 0.232 0.744 0.024
#> GSM1179009     4  0.4103      0.527 0.000 0.000 0.256 0.744
#> GSM1179031     2  0.0000      0.948 0.000 1.000 0.000 0.000
#> GSM1178970     3  0.0000      0.915 0.000 0.000 1.000 0.000
#> GSM1178972     2  0.2216      0.869 0.000 0.908 0.092 0.000
#> GSM1178973     4  0.7617      0.304 0.332 0.000 0.216 0.452
#> GSM1178974     2  0.0817      0.938 0.000 0.976 0.024 0.000
#> GSM1178977     3  0.3024      0.780 0.000 0.000 0.852 0.148
#> GSM1178978     3  0.1118      0.893 0.000 0.000 0.964 0.036
#> GSM1178998     3  0.1867      0.862 0.072 0.000 0.928 0.000
#> GSM1179010     3  0.0000      0.915 0.000 0.000 1.000 0.000
#> GSM1179018     3  0.1211      0.891 0.000 0.000 0.960 0.040
#> GSM1179024     1  0.0000      0.875 1.000 0.000 0.000 0.000
#> GSM1178984     3  0.0000      0.915 0.000 0.000 1.000 0.000
#> GSM1178990     1  0.2814      0.731 0.868 0.000 0.132 0.000
#> GSM1178991     1  0.7806     -0.258 0.392 0.000 0.252 0.356
#> GSM1178994     3  0.0000      0.915 0.000 0.000 1.000 0.000
#> GSM1178997     1  0.0336      0.869 0.992 0.000 0.008 0.000
#> GSM1179000     1  0.0000      0.875 1.000 0.000 0.000 0.000
#> GSM1179013     1  0.0000      0.875 1.000 0.000 0.000 0.000
#> GSM1179014     1  0.0000      0.875 1.000 0.000 0.000 0.000
#> GSM1179019     1  0.0000      0.875 1.000 0.000 0.000 0.000
#> GSM1179020     1  0.0000      0.875 1.000 0.000 0.000 0.000
#> GSM1179022     1  0.0000      0.875 1.000 0.000 0.000 0.000
#> GSM1179028     2  0.0000      0.948 0.000 1.000 0.000 0.000
#> GSM1179032     1  0.0000      0.875 1.000 0.000 0.000 0.000
#> GSM1179041     2  0.0000      0.948 0.000 1.000 0.000 0.000
#> GSM1179042     2  0.0188      0.948 0.000 0.996 0.004 0.000
#> GSM1178976     3  0.0000      0.915 0.000 0.000 1.000 0.000
#> GSM1178981     3  0.0000      0.915 0.000 0.000 1.000 0.000
#> GSM1178982     3  0.0000      0.915 0.000 0.000 1.000 0.000
#> GSM1178983     3  0.0000      0.915 0.000 0.000 1.000 0.000
#> GSM1178985     3  0.0000      0.915 0.000 0.000 1.000 0.000
#> GSM1178992     3  0.2011      0.856 0.080 0.000 0.920 0.000
#> GSM1179005     3  0.0707      0.905 0.020 0.000 0.980 0.000
#> GSM1179007     3  0.0817      0.902 0.024 0.000 0.976 0.000
#> GSM1179012     3  0.0000      0.915 0.000 0.000 1.000 0.000
#> GSM1179016     1  0.4955      0.136 0.556 0.000 0.444 0.000
#> GSM1179030     3  0.0000      0.915 0.000 0.000 1.000 0.000
#> GSM1179038     3  0.0188      0.913 0.004 0.000 0.996 0.000
#> GSM1178987     3  0.0000      0.915 0.000 0.000 1.000 0.000
#> GSM1179003     3  0.0000      0.915 0.000 0.000 1.000 0.000
#> GSM1179004     3  0.0000      0.915 0.000 0.000 1.000 0.000
#> GSM1179039     2  0.0000      0.948 0.000 1.000 0.000 0.000
#> GSM1178975     4  0.7715      0.289 0.324 0.000 0.240 0.436
#> GSM1178980     4  0.0000      0.785 0.000 0.000 0.000 1.000
#> GSM1178995     3  0.3726      0.713 0.212 0.000 0.788 0.000
#> GSM1178996     3  0.4277      0.613 0.280 0.000 0.720 0.000
#> GSM1179001     1  0.3400      0.669 0.820 0.000 0.180 0.000
#> GSM1179002     3  0.4605      0.513 0.336 0.000 0.664 0.000
#> GSM1179006     3  0.0000      0.915 0.000 0.000 1.000 0.000
#> GSM1179008     1  0.0000      0.875 1.000 0.000 0.000 0.000
#> GSM1179015     3  0.4661      0.486 0.348 0.000 0.652 0.000
#> GSM1179017     3  0.3873      0.689 0.228 0.000 0.772 0.000
#> GSM1179026     3  0.0000      0.915 0.000 0.000 1.000 0.000
#> GSM1179033     3  0.0000      0.915 0.000 0.000 1.000 0.000
#> GSM1179035     3  0.0000      0.915 0.000 0.000 1.000 0.000
#> GSM1179036     3  0.0188      0.913 0.004 0.000 0.996 0.000
#> GSM1178986     3  0.0000      0.915 0.000 0.000 1.000 0.000
#> GSM1178989     3  0.0000      0.915 0.000 0.000 1.000 0.000
#> GSM1178993     4  0.0000      0.785 0.000 0.000 0.000 1.000
#> GSM1178999     3  0.4103      0.617 0.000 0.000 0.744 0.256
#> GSM1179021     4  0.0000      0.785 0.000 0.000 0.000 1.000
#> GSM1179025     2  0.2216      0.869 0.000 0.908 0.092 0.000
#> GSM1179027     4  0.0000      0.785 0.000 0.000 0.000 1.000
#> GSM1179011     4  0.0000      0.785 0.000 0.000 0.000 1.000
#> GSM1179023     1  0.0000      0.875 1.000 0.000 0.000 0.000
#> GSM1179029     1  0.0817      0.855 0.976 0.000 0.024 0.000
#> GSM1179034     1  0.0000      0.875 1.000 0.000 0.000 0.000
#> GSM1179040     4  0.0000      0.785 0.000 0.000 0.000 1.000
#> GSM1178988     3  0.0000      0.915 0.000 0.000 1.000 0.000
#> GSM1179037     3  0.0000      0.915 0.000 0.000 1.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
#> GSM1178971     3  0.4850      0.602 0.232 0.000 0.696 0.000 0.072
#> GSM1178979     5  0.3992      0.903 0.004 0.004 0.280 0.000 0.712
#> GSM1179009     3  0.4464      0.341 0.000 0.000 0.584 0.408 0.008
#> GSM1179031     2  0.0000      0.839 0.000 1.000 0.000 0.000 0.000
#> GSM1178970     5  0.3707      0.906 0.000 0.000 0.284 0.000 0.716
#> GSM1178972     2  0.5389      0.619 0.004 0.680 0.160 0.000 0.156
#> GSM1178973     1  0.5812      0.308 0.540 0.000 0.048 0.388 0.024
#> GSM1178974     2  0.3649      0.729 0.000 0.808 0.152 0.000 0.040
#> GSM1178977     5  0.4440      0.891 0.004 0.000 0.324 0.012 0.660
#> GSM1178978     3  0.1741      0.817 0.000 0.000 0.936 0.024 0.040
#> GSM1178998     3  0.1831      0.820 0.004 0.000 0.920 0.000 0.076
#> GSM1179010     3  0.1671      0.819 0.000 0.000 0.924 0.000 0.076
#> GSM1179018     3  0.1648      0.819 0.000 0.000 0.940 0.020 0.040
#> GSM1179024     1  0.0162      0.868 0.996 0.000 0.004 0.000 0.000
#> GSM1178984     3  0.1124      0.838 0.004 0.000 0.960 0.000 0.036
#> GSM1178990     3  0.6330      0.277 0.364 0.000 0.472 0.000 0.164
#> GSM1178991     1  0.5724      0.479 0.620 0.000 0.064 0.292 0.024
#> GSM1178994     3  0.1544      0.824 0.000 0.000 0.932 0.000 0.068
#> GSM1178997     1  0.0510      0.861 0.984 0.000 0.016 0.000 0.000
#> GSM1179000     1  0.0162      0.868 0.996 0.000 0.004 0.000 0.000
#> GSM1179013     1  0.0000      0.867 1.000 0.000 0.000 0.000 0.000
#> GSM1179014     1  0.0566      0.863 0.984 0.000 0.012 0.000 0.004
#> GSM1179019     1  0.0162      0.868 0.996 0.000 0.004 0.000 0.000
#> GSM1179020     1  0.0162      0.868 0.996 0.000 0.004 0.000 0.000
#> GSM1179022     1  0.0000      0.867 1.000 0.000 0.000 0.000 0.000
#> GSM1179028     2  0.0000      0.839 0.000 1.000 0.000 0.000 0.000
#> GSM1179032     1  0.0000      0.867 1.000 0.000 0.000 0.000 0.000
#> GSM1179041     2  0.0000      0.839 0.000 1.000 0.000 0.000 0.000
#> GSM1179042     2  0.1661      0.834 0.000 0.940 0.024 0.000 0.036
#> GSM1178976     5  0.3895      0.916 0.000 0.000 0.320 0.000 0.680
#> GSM1178981     3  0.0000      0.841 0.000 0.000 1.000 0.000 0.000
#> GSM1178982     3  0.0000      0.841 0.000 0.000 1.000 0.000 0.000
#> GSM1178983     3  0.0771      0.842 0.004 0.000 0.976 0.000 0.020
#> GSM1178985     3  0.0000      0.841 0.000 0.000 1.000 0.000 0.000
#> GSM1178992     3  0.2409      0.808 0.068 0.000 0.900 0.000 0.032
#> GSM1179005     3  0.3875      0.720 0.048 0.000 0.792 0.000 0.160
#> GSM1179007     3  0.3731      0.760 0.040 0.000 0.800 0.000 0.160
#> GSM1179012     3  0.1671      0.819 0.000 0.000 0.924 0.000 0.076
#> GSM1179016     3  0.3745      0.689 0.196 0.000 0.780 0.000 0.024
#> GSM1179030     3  0.0955      0.828 0.004 0.000 0.968 0.000 0.028
#> GSM1179038     3  0.3695      0.727 0.036 0.000 0.800 0.000 0.164
#> GSM1178987     3  0.0000      0.841 0.000 0.000 1.000 0.000 0.000
#> GSM1179003     5  0.4047      0.916 0.004 0.000 0.320 0.000 0.676
#> GSM1179004     3  0.0162      0.841 0.000 0.000 0.996 0.000 0.004
#> GSM1179039     2  0.0000      0.839 0.000 1.000 0.000 0.000 0.000
#> GSM1178975     1  0.5943      0.123 0.472 0.000 0.052 0.452 0.024
#> GSM1178980     4  0.0000      1.000 0.000 0.000 0.000 1.000 0.000
#> GSM1178995     3  0.4916      0.640 0.124 0.000 0.716 0.000 0.160
#> GSM1178996     3  0.2771      0.772 0.128 0.000 0.860 0.000 0.012
#> GSM1179001     1  0.5783      0.458 0.612 0.000 0.228 0.000 0.160
#> GSM1179002     3  0.5476      0.596 0.160 0.000 0.656 0.000 0.184
#> GSM1179006     3  0.0671      0.843 0.004 0.000 0.980 0.000 0.016
#> GSM1179008     1  0.0451      0.865 0.988 0.000 0.004 0.000 0.008
#> GSM1179015     3  0.3476      0.768 0.088 0.000 0.836 0.000 0.076
#> GSM1179017     5  0.4946      0.881 0.052 0.000 0.300 0.000 0.648
#> GSM1179026     3  0.0162      0.840 0.000 0.000 0.996 0.000 0.004
#> GSM1179033     3  0.0324      0.842 0.004 0.000 0.992 0.000 0.004
#> GSM1179035     3  0.0290      0.842 0.000 0.000 0.992 0.000 0.008
#> GSM1179036     3  0.2879      0.786 0.032 0.000 0.868 0.000 0.100
#> GSM1178986     3  0.0798      0.840 0.016 0.000 0.976 0.000 0.008
#> GSM1178989     5  0.3895      0.916 0.000 0.000 0.320 0.000 0.680
#> GSM1178993     4  0.0000      1.000 0.000 0.000 0.000 1.000 0.000
#> GSM1178999     5  0.6808      0.680 0.004 0.000 0.328 0.244 0.424
#> GSM1179021     4  0.0000      1.000 0.000 0.000 0.000 1.000 0.000
#> GSM1179025     2  0.5658      0.584 0.004 0.648 0.160 0.000 0.188
#> GSM1179027     4  0.0000      1.000 0.000 0.000 0.000 1.000 0.000
#> GSM1179011     4  0.0000      1.000 0.000 0.000 0.000 1.000 0.000
#> GSM1179023     1  0.0000      0.867 1.000 0.000 0.000 0.000 0.000
#> GSM1179029     1  0.3449      0.748 0.812 0.000 0.024 0.000 0.164
#> GSM1179034     1  0.0000      0.867 1.000 0.000 0.000 0.000 0.000
#> GSM1179040     4  0.0000      1.000 0.000 0.000 0.000 1.000 0.000
#> GSM1178988     3  0.0404      0.839 0.000 0.000 0.988 0.000 0.012
#> GSM1179037     3  0.0000      0.841 0.000 0.000 1.000 0.000 0.000

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>            class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM1178971     3  0.3263      0.647 0.116 0.000 0.832 0.000 0.012 0.040
#> GSM1178979     5  0.1327      0.841 0.000 0.000 0.064 0.000 0.936 0.000
#> GSM1179009     3  0.4267      0.270 0.000 0.000 0.564 0.420 0.008 0.008
#> GSM1179031     2  0.0000      0.830 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1178970     5  0.2301      0.859 0.000 0.000 0.096 0.000 0.884 0.020
#> GSM1178972     2  0.4220      0.685 0.000 0.664 0.028 0.000 0.304 0.004
#> GSM1178973     1  0.5639      0.435 0.572 0.000 0.024 0.332 0.048 0.024
#> GSM1178974     2  0.3698      0.761 0.000 0.756 0.028 0.000 0.212 0.004
#> GSM1178977     5  0.2237      0.833 0.000 0.000 0.068 0.036 0.896 0.000
#> GSM1178978     3  0.5183      0.668 0.000 0.000 0.688 0.040 0.132 0.140
#> GSM1178998     6  0.3867      0.750 0.000 0.000 0.328 0.000 0.012 0.660
#> GSM1179010     6  0.3428      0.763 0.000 0.000 0.304 0.000 0.000 0.696
#> GSM1179018     3  0.4856      0.674 0.000 0.000 0.700 0.016 0.140 0.144
#> GSM1179024     1  0.0632      0.839 0.976 0.000 0.000 0.000 0.000 0.024
#> GSM1178984     3  0.3394      0.665 0.000 0.000 0.752 0.000 0.012 0.236
#> GSM1178990     1  0.4777      0.614 0.676 0.000 0.244 0.000 0.020 0.060
#> GSM1178991     1  0.6089      0.459 0.552 0.000 0.112 0.292 0.008 0.036
#> GSM1178994     3  0.3175      0.650 0.000 0.000 0.744 0.000 0.000 0.256
#> GSM1178997     1  0.1644      0.811 0.932 0.000 0.040 0.000 0.000 0.028
#> GSM1179000     1  0.0458      0.837 0.984 0.000 0.000 0.000 0.000 0.016
#> GSM1179013     1  0.1387      0.825 0.932 0.000 0.000 0.000 0.000 0.068
#> GSM1179014     1  0.1643      0.819 0.924 0.000 0.008 0.000 0.000 0.068
#> GSM1179019     1  0.0458      0.837 0.984 0.000 0.000 0.000 0.000 0.016
#> GSM1179020     1  0.0000      0.838 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1179022     1  0.0632      0.839 0.976 0.000 0.000 0.000 0.000 0.024
#> GSM1179028     2  0.0000      0.830 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1179032     1  0.0632      0.839 0.976 0.000 0.000 0.000 0.000 0.024
#> GSM1179041     2  0.0000      0.830 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1179042     2  0.2778      0.802 0.000 0.824 0.008 0.000 0.168 0.000
#> GSM1178976     5  0.3023      0.846 0.000 0.000 0.120 0.000 0.836 0.044
#> GSM1178981     3  0.3163      0.669 0.000 0.000 0.764 0.000 0.004 0.232
#> GSM1178982     3  0.3698      0.723 0.000 0.000 0.788 0.000 0.116 0.096
#> GSM1178983     3  0.2573      0.720 0.004 0.000 0.856 0.000 0.132 0.008
#> GSM1178985     3  0.3003      0.709 0.000 0.000 0.812 0.000 0.016 0.172
#> GSM1178992     3  0.4436      0.699 0.016 0.000 0.740 0.000 0.092 0.152
#> GSM1179005     3  0.2375      0.673 0.016 0.000 0.896 0.000 0.020 0.068
#> GSM1179007     3  0.2002      0.722 0.012 0.000 0.920 0.000 0.028 0.040
#> GSM1179012     6  0.3481      0.763 0.032 0.000 0.192 0.000 0.000 0.776
#> GSM1179016     3  0.5521      0.540 0.056 0.000 0.660 0.000 0.132 0.152
#> GSM1179030     3  0.2723      0.720 0.004 0.000 0.856 0.000 0.120 0.020
#> GSM1179038     3  0.2123      0.678 0.008 0.000 0.908 0.000 0.020 0.064
#> GSM1178987     3  0.3288      0.631 0.000 0.000 0.724 0.000 0.000 0.276
#> GSM1179003     5  0.2234      0.856 0.000 0.000 0.124 0.000 0.872 0.004
#> GSM1179004     3  0.3288      0.631 0.000 0.000 0.724 0.000 0.000 0.276
#> GSM1179039     2  0.0000      0.830 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1178975     1  0.6025      0.289 0.500 0.000 0.028 0.388 0.048 0.036
#> GSM1178980     4  0.0000      0.998 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM1178995     3  0.2642      0.659 0.032 0.000 0.884 0.000 0.020 0.064
#> GSM1178996     3  0.4004      0.669 0.084 0.000 0.796 0.000 0.084 0.036
#> GSM1179001     1  0.4896      0.606 0.660 0.000 0.256 0.000 0.020 0.064
#> GSM1179002     3  0.3846      0.581 0.100 0.000 0.800 0.000 0.020 0.080
#> GSM1179006     3  0.1956      0.735 0.004 0.000 0.908 0.000 0.080 0.008
#> GSM1179008     1  0.0622      0.837 0.980 0.000 0.012 0.000 0.000 0.008
#> GSM1179015     6  0.5061      0.601 0.056 0.000 0.204 0.000 0.056 0.684
#> GSM1179017     5  0.3927      0.795 0.004 0.000 0.120 0.000 0.776 0.100
#> GSM1179026     3  0.3210      0.712 0.000 0.000 0.804 0.000 0.028 0.168
#> GSM1179033     3  0.1753      0.736 0.004 0.000 0.912 0.000 0.084 0.000
#> GSM1179035     3  0.3151      0.653 0.000 0.000 0.748 0.000 0.000 0.252
#> GSM1179036     3  0.1577      0.714 0.008 0.000 0.940 0.000 0.036 0.016
#> GSM1178986     3  0.2890      0.728 0.004 0.000 0.852 0.008 0.120 0.016
#> GSM1178989     5  0.3150      0.839 0.000 0.000 0.120 0.000 0.828 0.052
#> GSM1178993     4  0.0000      0.998 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM1178999     5  0.5016      0.491 0.000 0.000 0.092 0.324 0.584 0.000
#> GSM1179021     4  0.0000      0.998 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM1179025     2  0.4286      0.665 0.000 0.648 0.028 0.000 0.320 0.004
#> GSM1179027     4  0.0000      0.998 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM1179011     4  0.0363      0.989 0.000 0.000 0.000 0.988 0.000 0.012
#> GSM1179023     1  0.0632      0.839 0.976 0.000 0.000 0.000 0.000 0.024
#> GSM1179029     1  0.5087      0.638 0.664 0.000 0.216 0.000 0.020 0.100
#> GSM1179034     1  0.0632      0.839 0.976 0.000 0.000 0.000 0.000 0.024
#> GSM1179040     4  0.0000      0.998 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM1178988     3  0.3424      0.724 0.000 0.000 0.812 0.000 0.092 0.096
#> GSM1179037     3  0.3230      0.689 0.000 0.000 0.776 0.000 0.012 0.212

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) protocol(p) k
#> SD:mclust 72          0.22907    8.23e-02 2
#> SD:mclust 68          0.69430    3.55e-04 3
#> SD:mclust 67          0.01851    8.01e-07 4
#> SD:mclust 67          0.00532    3.10e-08 5
#> SD:mclust 68          0.00486    2.77e-06 6

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


SD: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 31632 rows and 73 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 1.000           0.973       0.989         0.3962 0.597   0.597
#> 3 3 0.839           0.848       0.934         0.4403 0.789   0.657
#> 4 4 0.668           0.752       0.873         0.1640 0.873   0.722
#> 5 5 0.590           0.619       0.823         0.1118 0.884   0.689
#> 6 6 0.558           0.522       0.747         0.0755 0.906   0.669

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
#> GSM1178971     1  0.0000      0.998 1.000 0.000
#> GSM1178979     2  0.0000      0.963 0.000 1.000
#> GSM1179009     1  0.2236      0.963 0.964 0.036
#> GSM1179031     2  0.0000      0.963 0.000 1.000
#> GSM1178970     2  0.0000      0.963 0.000 1.000
#> GSM1178972     2  0.0000      0.963 0.000 1.000
#> GSM1178973     1  0.0000      0.998 1.000 0.000
#> GSM1178974     2  0.0000      0.963 0.000 1.000
#> GSM1178977     2  0.0000      0.963 0.000 1.000
#> GSM1178978     1  0.0376      0.994 0.996 0.004
#> GSM1178998     1  0.0000      0.998 1.000 0.000
#> GSM1179010     1  0.0000      0.998 1.000 0.000
#> GSM1179018     1  0.2778      0.950 0.952 0.048
#> GSM1179024     1  0.0000      0.998 1.000 0.000
#> GSM1178984     1  0.0000      0.998 1.000 0.000
#> GSM1178990     1  0.0000      0.998 1.000 0.000
#> GSM1178991     1  0.0000      0.998 1.000 0.000
#> GSM1178994     1  0.0000      0.998 1.000 0.000
#> GSM1178997     1  0.0000      0.998 1.000 0.000
#> GSM1179000     1  0.0000      0.998 1.000 0.000
#> GSM1179013     1  0.0000      0.998 1.000 0.000
#> GSM1179014     1  0.0000      0.998 1.000 0.000
#> GSM1179019     1  0.0000      0.998 1.000 0.000
#> GSM1179020     1  0.0000      0.998 1.000 0.000
#> GSM1179022     1  0.0000      0.998 1.000 0.000
#> GSM1179028     2  0.0000      0.963 0.000 1.000
#> GSM1179032     1  0.0000      0.998 1.000 0.000
#> GSM1179041     2  0.0000      0.963 0.000 1.000
#> GSM1179042     2  0.0000      0.963 0.000 1.000
#> GSM1178976     2  0.0000      0.963 0.000 1.000
#> GSM1178981     1  0.0000      0.998 1.000 0.000
#> GSM1178982     1  0.0000      0.998 1.000 0.000
#> GSM1178983     1  0.0000      0.998 1.000 0.000
#> GSM1178985     1  0.0000      0.998 1.000 0.000
#> GSM1178992     1  0.0000      0.998 1.000 0.000
#> GSM1179005     1  0.0000      0.998 1.000 0.000
#> GSM1179007     1  0.0000      0.998 1.000 0.000
#> GSM1179012     1  0.0000      0.998 1.000 0.000
#> GSM1179016     1  0.0000      0.998 1.000 0.000
#> GSM1179030     1  0.0000      0.998 1.000 0.000
#> GSM1179038     1  0.0000      0.998 1.000 0.000
#> GSM1178987     1  0.0000      0.998 1.000 0.000
#> GSM1179003     2  0.0000      0.963 0.000 1.000
#> GSM1179004     1  0.0000      0.998 1.000 0.000
#> GSM1179039     2  0.0000      0.963 0.000 1.000
#> GSM1178975     1  0.0000      0.998 1.000 0.000
#> GSM1178980     2  0.0000      0.963 0.000 1.000
#> GSM1178995     1  0.0000      0.998 1.000 0.000
#> GSM1178996     1  0.0000      0.998 1.000 0.000
#> GSM1179001     1  0.0000      0.998 1.000 0.000
#> GSM1179002     1  0.0000      0.998 1.000 0.000
#> GSM1179006     1  0.0000      0.998 1.000 0.000
#> GSM1179008     1  0.0000      0.998 1.000 0.000
#> GSM1179015     1  0.0000      0.998 1.000 0.000
#> GSM1179017     1  0.2043      0.967 0.968 0.032
#> GSM1179026     1  0.0000      0.998 1.000 0.000
#> GSM1179033     1  0.0000      0.998 1.000 0.000
#> GSM1179035     1  0.0000      0.998 1.000 0.000
#> GSM1179036     1  0.0000      0.998 1.000 0.000
#> GSM1178986     1  0.0000      0.998 1.000 0.000
#> GSM1178989     2  0.9896      0.238 0.440 0.560
#> GSM1178993     2  0.7815      0.699 0.232 0.768
#> GSM1178999     2  0.1843      0.940 0.028 0.972
#> GSM1179021     2  0.0000      0.963 0.000 1.000
#> GSM1179025     2  0.0000      0.963 0.000 1.000
#> GSM1179027     2  0.0000      0.963 0.000 1.000
#> GSM1179011     1  0.0376      0.994 0.996 0.004
#> GSM1179023     1  0.0000      0.998 1.000 0.000
#> GSM1179029     1  0.0000      0.998 1.000 0.000
#> GSM1179034     1  0.0000      0.998 1.000 0.000
#> GSM1179040     2  0.0000      0.963 0.000 1.000
#> GSM1178988     1  0.0000      0.998 1.000 0.000
#> GSM1179037     1  0.0000      0.998 1.000 0.000

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>            class entropy silhouette    p1    p2    p3
#> GSM1178971     1  0.0000    0.95175 1.000 0.000 0.000
#> GSM1178979     2  0.0424    0.89209 0.000 0.992 0.008
#> GSM1179009     1  0.1860    0.93896 0.948 0.000 0.052
#> GSM1179031     2  0.0000    0.89540 0.000 1.000 0.000
#> GSM1178970     3  0.5650    0.39469 0.000 0.312 0.688
#> GSM1178972     2  0.5016    0.67163 0.000 0.760 0.240
#> GSM1178973     1  0.0237    0.94962 0.996 0.004 0.000
#> GSM1178974     2  0.6062    0.39265 0.000 0.616 0.384
#> GSM1178977     2  0.0000    0.89540 0.000 1.000 0.000
#> GSM1178978     1  0.1643    0.93359 0.956 0.000 0.044
#> GSM1178998     1  0.1163    0.94949 0.972 0.000 0.028
#> GSM1179010     3  0.4931    0.67845 0.232 0.000 0.768
#> GSM1179018     1  0.5760    0.51216 0.672 0.000 0.328
#> GSM1179024     1  0.0000    0.95175 1.000 0.000 0.000
#> GSM1178984     1  0.2261    0.92792 0.932 0.000 0.068
#> GSM1178990     1  0.0424    0.95196 0.992 0.000 0.008
#> GSM1178991     1  0.0000    0.95175 1.000 0.000 0.000
#> GSM1178994     1  0.1964    0.93682 0.944 0.000 0.056
#> GSM1178997     1  0.0000    0.95175 1.000 0.000 0.000
#> GSM1179000     1  0.0000    0.95175 1.000 0.000 0.000
#> GSM1179013     1  0.0000    0.95175 1.000 0.000 0.000
#> GSM1179014     1  0.0000    0.95175 1.000 0.000 0.000
#> GSM1179019     1  0.0000    0.95175 1.000 0.000 0.000
#> GSM1179020     1  0.0000    0.95175 1.000 0.000 0.000
#> GSM1179022     1  0.0000    0.95175 1.000 0.000 0.000
#> GSM1179028     2  0.0000    0.89540 0.000 1.000 0.000
#> GSM1179032     1  0.0000    0.95175 1.000 0.000 0.000
#> GSM1179041     2  0.0000    0.89540 0.000 1.000 0.000
#> GSM1179042     2  0.0000    0.89540 0.000 1.000 0.000
#> GSM1178976     3  0.0000    0.81239 0.000 0.000 1.000
#> GSM1178981     1  0.2625    0.91547 0.916 0.000 0.084
#> GSM1178982     1  0.1163    0.94901 0.972 0.000 0.028
#> GSM1178983     1  0.0000    0.95175 1.000 0.000 0.000
#> GSM1178985     3  0.6309    0.00599 0.496 0.000 0.504
#> GSM1178992     1  0.6180    0.25899 0.584 0.000 0.416
#> GSM1179005     1  0.1289    0.94773 0.968 0.000 0.032
#> GSM1179007     1  0.1529    0.94488 0.960 0.000 0.040
#> GSM1179012     1  0.2261    0.92792 0.932 0.000 0.068
#> GSM1179016     1  0.2066    0.93449 0.940 0.000 0.060
#> GSM1179030     1  0.1647    0.94580 0.960 0.004 0.036
#> GSM1179038     1  0.1031    0.94996 0.976 0.000 0.024
#> GSM1178987     3  0.4974    0.67443 0.236 0.000 0.764
#> GSM1179003     3  0.1860    0.78099 0.000 0.052 0.948
#> GSM1179004     3  0.0000    0.81239 0.000 0.000 1.000
#> GSM1179039     2  0.0000    0.89540 0.000 1.000 0.000
#> GSM1178975     1  0.0424    0.94731 0.992 0.008 0.000
#> GSM1178980     2  0.0237    0.89342 0.004 0.996 0.000
#> GSM1178995     1  0.0424    0.95196 0.992 0.000 0.008
#> GSM1178996     1  0.1643    0.94330 0.956 0.000 0.044
#> GSM1179001     1  0.0000    0.95175 1.000 0.000 0.000
#> GSM1179002     1  0.0592    0.95175 0.988 0.000 0.012
#> GSM1179006     1  0.3340    0.87672 0.880 0.000 0.120
#> GSM1179008     1  0.0000    0.95175 1.000 0.000 0.000
#> GSM1179015     1  0.2066    0.93393 0.940 0.000 0.060
#> GSM1179017     3  0.0000    0.81239 0.000 0.000 1.000
#> GSM1179026     3  0.0237    0.81346 0.004 0.000 0.996
#> GSM1179033     1  0.4291    0.79739 0.820 0.000 0.180
#> GSM1179035     3  0.1411    0.81336 0.036 0.000 0.964
#> GSM1179036     1  0.1753    0.94113 0.952 0.000 0.048
#> GSM1178986     1  0.1163    0.94902 0.972 0.000 0.028
#> GSM1178989     3  0.0000    0.81239 0.000 0.000 1.000
#> GSM1178993     2  0.1289    0.87358 0.032 0.968 0.000
#> GSM1178999     2  0.2229    0.85219 0.044 0.944 0.012
#> GSM1179021     2  0.0000    0.89540 0.000 1.000 0.000
#> GSM1179025     2  0.5016    0.67533 0.000 0.760 0.240
#> GSM1179027     2  0.0000    0.89540 0.000 1.000 0.000
#> GSM1179011     2  0.6204    0.27030 0.424 0.576 0.000
#> GSM1179023     1  0.0000    0.95175 1.000 0.000 0.000
#> GSM1179029     1  0.0424    0.95196 0.992 0.000 0.008
#> GSM1179034     1  0.0000    0.95175 1.000 0.000 0.000
#> GSM1179040     2  0.0000    0.89540 0.000 1.000 0.000
#> GSM1178988     3  0.2448    0.80126 0.076 0.000 0.924
#> GSM1179037     3  0.3038    0.78474 0.104 0.000 0.896

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>            class entropy silhouette    p1    p2    p3    p4
#> GSM1178971     1  0.1109     0.8861 0.968 0.004 0.000 0.028
#> GSM1178979     4  0.4699     0.5382 0.000 0.320 0.004 0.676
#> GSM1179009     4  0.5275     0.6678 0.172 0.016 0.052 0.760
#> GSM1179031     2  0.0592     0.8834 0.000 0.984 0.000 0.016
#> GSM1178970     3  0.5847     0.0856 0.000 0.404 0.560 0.036
#> GSM1178972     2  0.4012     0.7512 0.000 0.800 0.184 0.016
#> GSM1178973     1  0.4948     0.2358 0.560 0.000 0.000 0.440
#> GSM1178974     2  0.2623     0.8552 0.000 0.908 0.064 0.028
#> GSM1178977     2  0.4978     0.2727 0.000 0.612 0.004 0.384
#> GSM1178978     1  0.5256     0.5725 0.692 0.000 0.036 0.272
#> GSM1178998     1  0.1022     0.8813 0.968 0.000 0.000 0.032
#> GSM1179010     3  0.3982     0.6359 0.220 0.000 0.776 0.004
#> GSM1179018     4  0.2973     0.7327 0.020 0.000 0.096 0.884
#> GSM1179024     1  0.0469     0.8854 0.988 0.000 0.000 0.012
#> GSM1178984     1  0.2021     0.8746 0.936 0.000 0.024 0.040
#> GSM1178990     1  0.0000     0.8854 1.000 0.000 0.000 0.000
#> GSM1178991     4  0.3791     0.6652 0.200 0.000 0.004 0.796
#> GSM1178994     1  0.1724     0.8779 0.948 0.000 0.020 0.032
#> GSM1178997     1  0.1059     0.8852 0.972 0.016 0.000 0.012
#> GSM1179000     1  0.0469     0.8854 0.988 0.000 0.000 0.012
#> GSM1179013     1  0.0336     0.8852 0.992 0.000 0.000 0.008
#> GSM1179014     1  0.0921     0.8846 0.972 0.000 0.000 0.028
#> GSM1179019     1  0.0336     0.8858 0.992 0.000 0.000 0.008
#> GSM1179020     1  0.0336     0.8852 0.992 0.000 0.000 0.008
#> GSM1179022     1  0.0188     0.8852 0.996 0.000 0.000 0.004
#> GSM1179028     2  0.0592     0.8834 0.000 0.984 0.000 0.016
#> GSM1179032     1  0.0336     0.8853 0.992 0.000 0.000 0.008
#> GSM1179041     2  0.0188     0.8825 0.000 0.996 0.000 0.004
#> GSM1179042     2  0.0188     0.8826 0.000 0.996 0.000 0.004
#> GSM1178976     3  0.0188     0.8424 0.004 0.000 0.996 0.000
#> GSM1178981     1  0.4037     0.8129 0.832 0.000 0.112 0.056
#> GSM1178982     1  0.4121     0.7536 0.796 0.000 0.020 0.184
#> GSM1178983     1  0.3444     0.7687 0.816 0.000 0.000 0.184
#> GSM1178985     1  0.5163     0.1555 0.516 0.004 0.480 0.000
#> GSM1178992     1  0.5315     0.6613 0.724 0.004 0.224 0.048
#> GSM1179005     1  0.0524     0.8854 0.988 0.000 0.004 0.008
#> GSM1179007     1  0.1256     0.8842 0.964 0.000 0.008 0.028
#> GSM1179012     1  0.0921     0.8850 0.972 0.000 0.028 0.000
#> GSM1179016     1  0.2053     0.8702 0.924 0.000 0.004 0.072
#> GSM1179030     1  0.2673     0.8701 0.916 0.016 0.020 0.048
#> GSM1179038     1  0.1576     0.8815 0.948 0.000 0.004 0.048
#> GSM1178987     3  0.1716     0.8261 0.064 0.000 0.936 0.000
#> GSM1179003     4  0.6187     0.1631 0.004 0.052 0.360 0.584
#> GSM1179004     3  0.0000     0.8402 0.000 0.000 1.000 0.000
#> GSM1179039     2  0.0592     0.8834 0.000 0.984 0.000 0.016
#> GSM1178975     4  0.4790     0.3473 0.380 0.000 0.000 0.620
#> GSM1178980     4  0.2081     0.7615 0.000 0.084 0.000 0.916
#> GSM1178995     1  0.0707     0.8843 0.980 0.000 0.000 0.020
#> GSM1178996     1  0.2876     0.8524 0.892 0.008 0.008 0.092
#> GSM1179001     1  0.1743     0.8749 0.940 0.004 0.000 0.056
#> GSM1179002     1  0.1118     0.8838 0.964 0.000 0.000 0.036
#> GSM1179006     1  0.6783     0.2271 0.512 0.000 0.388 0.100
#> GSM1179008     1  0.1389     0.8815 0.952 0.000 0.000 0.048
#> GSM1179015     1  0.1042     0.8857 0.972 0.000 0.008 0.020
#> GSM1179017     3  0.5640     0.6336 0.052 0.004 0.688 0.256
#> GSM1179026     3  0.2382     0.8159 0.004 0.004 0.912 0.080
#> GSM1179033     1  0.5846     0.1926 0.516 0.000 0.452 0.032
#> GSM1179035     3  0.1610     0.8423 0.032 0.000 0.952 0.016
#> GSM1179036     1  0.2926     0.8602 0.888 0.004 0.012 0.096
#> GSM1178986     1  0.4295     0.6770 0.752 0.000 0.008 0.240
#> GSM1178989     3  0.0188     0.8424 0.004 0.000 0.996 0.000
#> GSM1178993     4  0.2944     0.7588 0.004 0.128 0.000 0.868
#> GSM1178999     4  0.2021     0.7605 0.012 0.056 0.000 0.932
#> GSM1179021     4  0.3649     0.7098 0.000 0.204 0.000 0.796
#> GSM1179025     2  0.2999     0.8096 0.000 0.864 0.132 0.004
#> GSM1179027     4  0.2921     0.7536 0.000 0.140 0.000 0.860
#> GSM1179011     4  0.3732     0.7582 0.056 0.092 0.000 0.852
#> GSM1179023     1  0.0188     0.8852 0.996 0.000 0.000 0.004
#> GSM1179029     1  0.3356     0.7924 0.824 0.000 0.000 0.176
#> GSM1179034     1  0.0336     0.8853 0.992 0.000 0.000 0.008
#> GSM1179040     4  0.3356     0.7334 0.000 0.176 0.000 0.824
#> GSM1178988     3  0.0469     0.8445 0.012 0.000 0.988 0.000
#> GSM1179037     3  0.2011     0.8120 0.080 0.000 0.920 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
#> GSM1178971     1  0.2419     0.7217 0.904 0.004 0.028 0.000 0.064
#> GSM1178979     4  0.1430     0.8673 0.000 0.052 0.004 0.944 0.000
#> GSM1179009     4  0.4350     0.6912 0.132 0.000 0.088 0.776 0.004
#> GSM1179031     2  0.0794     0.8960 0.000 0.972 0.000 0.028 0.000
#> GSM1178970     3  0.4832     0.2368 0.000 0.356 0.616 0.004 0.024
#> GSM1178972     2  0.3887     0.7765 0.000 0.804 0.148 0.008 0.040
#> GSM1178973     1  0.4604     0.1980 0.560 0.000 0.000 0.428 0.012
#> GSM1178974     2  0.2060     0.8751 0.000 0.924 0.016 0.008 0.052
#> GSM1178977     2  0.5588     0.4153 0.000 0.580 0.044 0.356 0.020
#> GSM1178978     1  0.5781     0.4197 0.652 0.000 0.208 0.124 0.016
#> GSM1178998     1  0.2005     0.7278 0.924 0.000 0.056 0.004 0.016
#> GSM1179010     3  0.4311     0.5313 0.264 0.000 0.712 0.004 0.020
#> GSM1179018     4  0.1605     0.8758 0.004 0.000 0.040 0.944 0.012
#> GSM1179024     1  0.2230     0.6979 0.884 0.000 0.000 0.000 0.116
#> GSM1178984     1  0.2818     0.6853 0.856 0.000 0.132 0.000 0.012
#> GSM1178990     1  0.1732     0.7189 0.920 0.000 0.000 0.000 0.080
#> GSM1178991     4  0.3749     0.7545 0.080 0.000 0.000 0.816 0.104
#> GSM1178994     1  0.2660     0.6913 0.864 0.000 0.128 0.000 0.008
#> GSM1178997     1  0.2825     0.6777 0.860 0.124 0.000 0.000 0.016
#> GSM1179000     1  0.1965     0.7117 0.904 0.000 0.000 0.000 0.096
#> GSM1179013     1  0.2813     0.6436 0.832 0.000 0.000 0.000 0.168
#> GSM1179014     1  0.3999     0.3537 0.656 0.000 0.000 0.000 0.344
#> GSM1179019     1  0.0798     0.7386 0.976 0.008 0.000 0.000 0.016
#> GSM1179020     1  0.1410     0.7264 0.940 0.000 0.000 0.000 0.060
#> GSM1179022     1  0.0510     0.7370 0.984 0.000 0.000 0.000 0.016
#> GSM1179028     2  0.0703     0.8962 0.000 0.976 0.000 0.024 0.000
#> GSM1179032     1  0.0000     0.7365 1.000 0.000 0.000 0.000 0.000
#> GSM1179041     2  0.0566     0.8949 0.000 0.984 0.000 0.012 0.004
#> GSM1179042     2  0.0671     0.8909 0.000 0.980 0.000 0.004 0.016
#> GSM1178976     3  0.0671     0.7407 0.000 0.004 0.980 0.000 0.016
#> GSM1178981     1  0.4464     0.2364 0.584 0.000 0.408 0.000 0.008
#> GSM1178982     1  0.4824     0.5949 0.744 0.000 0.124 0.124 0.008
#> GSM1178983     1  0.4171     0.6629 0.808 0.000 0.052 0.112 0.028
#> GSM1178985     3  0.4211     0.4049 0.360 0.000 0.636 0.000 0.004
#> GSM1178992     5  0.5381     0.2465 0.428 0.000 0.056 0.000 0.516
#> GSM1179005     1  0.1197     0.7334 0.952 0.000 0.048 0.000 0.000
#> GSM1179007     1  0.2208     0.7238 0.908 0.000 0.072 0.000 0.020
#> GSM1179012     1  0.2505     0.7184 0.888 0.000 0.092 0.000 0.020
#> GSM1179016     5  0.4331     0.3642 0.400 0.000 0.000 0.004 0.596
#> GSM1179030     1  0.6140     0.5262 0.680 0.008 0.064 0.096 0.152
#> GSM1179038     1  0.4166     0.3465 0.648 0.000 0.000 0.004 0.348
#> GSM1178987     3  0.1251     0.7405 0.036 0.000 0.956 0.000 0.008
#> GSM1179003     5  0.3919     0.3460 0.000 0.000 0.036 0.188 0.776
#> GSM1179004     3  0.0324     0.7402 0.000 0.000 0.992 0.004 0.004
#> GSM1179039     2  0.0880     0.8950 0.000 0.968 0.000 0.032 0.000
#> GSM1178975     4  0.4465     0.4072 0.304 0.000 0.000 0.672 0.024
#> GSM1178980     4  0.0703     0.8893 0.000 0.000 0.000 0.976 0.024
#> GSM1178995     1  0.0771     0.7354 0.976 0.000 0.020 0.000 0.004
#> GSM1178996     5  0.4858     0.2883 0.424 0.012 0.008 0.000 0.556
#> GSM1179001     1  0.5042     0.3674 0.652 0.008 0.020 0.012 0.308
#> GSM1179002     1  0.3631     0.6535 0.820 0.008 0.020 0.004 0.148
#> GSM1179006     5  0.7388     0.3917 0.292 0.000 0.232 0.040 0.436
#> GSM1179008     1  0.3243     0.6514 0.812 0.000 0.004 0.004 0.180
#> GSM1179015     1  0.3730     0.4771 0.712 0.000 0.000 0.000 0.288
#> GSM1179017     5  0.1547     0.4375 0.004 0.000 0.032 0.016 0.948
#> GSM1179026     5  0.4066     0.0827 0.000 0.000 0.324 0.004 0.672
#> GSM1179033     3  0.6368     0.1399 0.376 0.000 0.484 0.008 0.132
#> GSM1179035     3  0.2900     0.6952 0.028 0.000 0.864 0.000 0.108
#> GSM1179036     1  0.4849     0.0850 0.548 0.000 0.004 0.016 0.432
#> GSM1178986     1  0.6660    -0.0856 0.476 0.000 0.008 0.188 0.328
#> GSM1178989     3  0.0963     0.7287 0.000 0.000 0.964 0.000 0.036
#> GSM1178993     4  0.0162     0.8916 0.000 0.004 0.000 0.996 0.000
#> GSM1178999     4  0.1591     0.8753 0.004 0.000 0.004 0.940 0.052
#> GSM1179021     4  0.0510     0.8894 0.000 0.016 0.000 0.984 0.000
#> GSM1179025     2  0.2678     0.8476 0.000 0.880 0.100 0.016 0.004
#> GSM1179027     4  0.0162     0.8919 0.000 0.000 0.000 0.996 0.004
#> GSM1179011     4  0.0671     0.8906 0.004 0.016 0.000 0.980 0.000
#> GSM1179023     1  0.0000     0.7365 1.000 0.000 0.000 0.000 0.000
#> GSM1179029     5  0.4505     0.3815 0.384 0.000 0.000 0.012 0.604
#> GSM1179034     1  0.0880     0.7340 0.968 0.000 0.000 0.000 0.032
#> GSM1179040     4  0.0290     0.8912 0.000 0.008 0.000 0.992 0.000
#> GSM1178988     3  0.1410     0.7202 0.000 0.000 0.940 0.000 0.060
#> GSM1179037     3  0.2522     0.7182 0.052 0.000 0.896 0.000 0.052

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>            class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM1178971     1  0.3830     0.4876 0.744 0.000 0.000 0.000 0.212 0.044
#> GSM1178979     4  0.2441     0.8195 0.000 0.056 0.024 0.900 0.008 0.012
#> GSM1179009     4  0.6163     0.4963 0.152 0.000 0.088 0.648 0.056 0.056
#> GSM1179031     2  0.0260     0.8631 0.000 0.992 0.000 0.008 0.000 0.000
#> GSM1178970     3  0.5306     0.1885 0.000 0.304 0.596 0.000 0.080 0.020
#> GSM1178972     2  0.5356     0.5830 0.000 0.620 0.232 0.000 0.136 0.012
#> GSM1178973     1  0.4662     0.2126 0.560 0.000 0.000 0.404 0.020 0.016
#> GSM1178974     2  0.2623     0.8192 0.000 0.852 0.000 0.000 0.132 0.016
#> GSM1178977     2  0.7161     0.4608 0.004 0.524 0.156 0.204 0.084 0.028
#> GSM1178978     1  0.6656     0.0418 0.484 0.008 0.356 0.024 0.084 0.044
#> GSM1178998     1  0.4330     0.5489 0.756 0.000 0.040 0.000 0.156 0.048
#> GSM1179010     3  0.6218     0.2077 0.360 0.000 0.468 0.000 0.136 0.036
#> GSM1179018     4  0.2554     0.8238 0.004 0.000 0.044 0.896 0.032 0.024
#> GSM1179024     1  0.2854     0.4600 0.792 0.000 0.000 0.000 0.000 0.208
#> GSM1178984     1  0.5358     0.4965 0.680 0.000 0.144 0.000 0.116 0.060
#> GSM1178990     1  0.3023     0.4343 0.768 0.000 0.000 0.000 0.000 0.232
#> GSM1178991     4  0.4725     0.6027 0.084 0.000 0.008 0.708 0.008 0.192
#> GSM1178994     1  0.4139     0.4729 0.700 0.000 0.260 0.000 0.004 0.036
#> GSM1178997     1  0.2999     0.5687 0.840 0.112 0.000 0.000 0.000 0.048
#> GSM1179000     1  0.3240     0.4127 0.752 0.004 0.000 0.000 0.000 0.244
#> GSM1179013     1  0.3547     0.1909 0.668 0.000 0.000 0.000 0.000 0.332
#> GSM1179014     6  0.3774     0.5057 0.408 0.000 0.000 0.000 0.000 0.592
#> GSM1179019     1  0.2320     0.5723 0.864 0.004 0.000 0.000 0.000 0.132
#> GSM1179020     1  0.0820     0.6248 0.972 0.000 0.000 0.000 0.012 0.016
#> GSM1179022     1  0.1814     0.5880 0.900 0.000 0.000 0.000 0.000 0.100
#> GSM1179028     2  0.0291     0.8629 0.000 0.992 0.000 0.004 0.000 0.004
#> GSM1179032     1  0.0790     0.6214 0.968 0.000 0.000 0.000 0.000 0.032
#> GSM1179041     2  0.0291     0.8620 0.000 0.992 0.000 0.000 0.004 0.004
#> GSM1179042     2  0.1970     0.8350 0.000 0.900 0.000 0.000 0.092 0.008
#> GSM1178976     3  0.3663     0.6127 0.000 0.004 0.796 0.000 0.128 0.072
#> GSM1178981     3  0.4871     0.3940 0.324 0.000 0.616 0.000 0.024 0.036
#> GSM1178982     1  0.7012     0.3111 0.516 0.000 0.228 0.152 0.024 0.080
#> GSM1178983     1  0.5173     0.5160 0.716 0.000 0.032 0.108 0.020 0.124
#> GSM1178985     3  0.4970     0.5804 0.168 0.004 0.712 0.000 0.044 0.072
#> GSM1178992     6  0.4075     0.5940 0.240 0.000 0.048 0.000 0.000 0.712
#> GSM1179005     1  0.3054     0.6024 0.848 0.000 0.072 0.000 0.004 0.076
#> GSM1179007     1  0.3841     0.5910 0.812 0.000 0.052 0.000 0.072 0.064
#> GSM1179012     1  0.4916     0.5221 0.696 0.000 0.196 0.000 0.072 0.036
#> GSM1179016     6  0.3652     0.6029 0.264 0.000 0.000 0.000 0.016 0.720
#> GSM1179030     6  0.6468     0.4028 0.312 0.008 0.188 0.004 0.016 0.472
#> GSM1179038     1  0.4509    -0.0510 0.532 0.000 0.000 0.000 0.032 0.436
#> GSM1178987     3  0.2103     0.6249 0.024 0.000 0.916 0.000 0.040 0.020
#> GSM1179003     5  0.5100     0.3577 0.000 0.000 0.000 0.128 0.612 0.260
#> GSM1179004     3  0.0458     0.6323 0.000 0.000 0.984 0.000 0.016 0.000
#> GSM1179039     2  0.0405     0.8629 0.000 0.988 0.000 0.008 0.000 0.004
#> GSM1178975     4  0.4200     0.5119 0.264 0.000 0.000 0.696 0.032 0.008
#> GSM1178980     4  0.0858     0.8588 0.000 0.000 0.000 0.968 0.028 0.004
#> GSM1178995     1  0.2555     0.6168 0.888 0.000 0.016 0.000 0.064 0.032
#> GSM1178996     5  0.5965     0.3492 0.232 0.000 0.004 0.000 0.484 0.280
#> GSM1179001     5  0.3953     0.4408 0.328 0.000 0.000 0.000 0.656 0.016
#> GSM1179002     5  0.4048     0.3985 0.340 0.000 0.004 0.000 0.644 0.012
#> GSM1179006     6  0.6726     0.1250 0.092 0.000 0.216 0.024 0.108 0.560
#> GSM1179008     1  0.4246     0.1258 0.580 0.000 0.000 0.000 0.400 0.020
#> GSM1179015     6  0.4300     0.3927 0.456 0.000 0.004 0.000 0.012 0.528
#> GSM1179017     6  0.4459    -0.3526 0.000 0.000 0.004 0.020 0.460 0.516
#> GSM1179026     5  0.6372     0.0872 0.000 0.000 0.272 0.012 0.376 0.340
#> GSM1179033     3  0.7507     0.2881 0.212 0.000 0.436 0.012 0.156 0.184
#> GSM1179035     3  0.5785     0.5322 0.064 0.000 0.620 0.000 0.212 0.104
#> GSM1179036     1  0.5848    -0.1749 0.452 0.000 0.028 0.000 0.424 0.096
#> GSM1178986     6  0.5193     0.5802 0.296 0.000 0.008 0.096 0.000 0.600
#> GSM1178989     3  0.1908     0.6355 0.000 0.000 0.916 0.000 0.028 0.056
#> GSM1178993     4  0.0260     0.8636 0.000 0.008 0.000 0.992 0.000 0.000
#> GSM1178999     4  0.1327     0.8437 0.000 0.000 0.000 0.936 0.000 0.064
#> GSM1179021     4  0.0363     0.8634 0.000 0.012 0.000 0.988 0.000 0.000
#> GSM1179025     2  0.1628     0.8523 0.000 0.940 0.036 0.008 0.004 0.012
#> GSM1179027     4  0.0291     0.8641 0.000 0.004 0.000 0.992 0.004 0.000
#> GSM1179011     4  0.0665     0.8630 0.008 0.008 0.000 0.980 0.000 0.004
#> GSM1179023     1  0.1141     0.6141 0.948 0.000 0.000 0.000 0.000 0.052
#> GSM1179029     6  0.5391     0.4871 0.356 0.000 0.000 0.004 0.108 0.532
#> GSM1179034     1  0.0713     0.6196 0.972 0.000 0.000 0.000 0.000 0.028
#> GSM1179040     4  0.0000     0.8630 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM1178988     3  0.3073     0.5749 0.016 0.000 0.824 0.000 0.008 0.152
#> GSM1179037     3  0.4750     0.5957 0.036 0.000 0.728 0.000 0.140 0.096

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

consensus_heatmap(res, k = 2)

plot of chunk tab-SD-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) protocol(p) k
#> SD:NMF 72           0.0627     0.05971 2
#> SD:NMF 68           0.0100     0.02075 3
#> SD:NMF 65           0.0035     0.00927 4
#> SD:NMF 51           0.0106     0.04488 5
#> SD:NMF 44           0.0629     0.02820 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 31632 rows and 73 columns.
#>   Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'CV' method.
#>   Subgroups are detected by 'hclust' method.
#>   Performed in total 1250 partitions by row resampling.
#>   Best k for subgroups seems to be 3.
#> 
#> Following methods can be applied to this 'ConsensusPartition' object:
#>  [1] "cola_report"             "collect_classes"         "collect_plots"          
#>  [4] "collect_stats"           "colnames"                "compare_signatures"     
#>  [7] "consensus_heatmap"       "dimension_reduction"     "functional_enrichment"  
#> [10] "get_anno_col"            "get_anno"                "get_classes"            
#> [13] "get_consensus"           "get_matrix"              "get_membership"         
#> [16] "get_param"               "get_signatures"          "get_stats"              
#> [19] "is_best_k"               "is_stable_k"             "membership_heatmap"     
#> [22] "ncol"                    "nrow"                    "plot_ecdf"              
#> [25] "rownames"                "select_partition_number" "show"                   
#> [28] "suggest_best_k"          "test_to_known_factors"

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

collect_plots(res)

plot of chunk CV-hclust-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.658           0.839       0.917          0.339 0.686   0.686
#> 3 3 0.330           0.645       0.815          0.402 0.897   0.850
#> 4 4 0.343           0.419       0.618          0.320 0.645   0.426
#> 5 5 0.372           0.519       0.712          0.123 0.822   0.514
#> 6 6 0.461           0.562       0.747          0.065 0.929   0.754

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
#> GSM1178971     1  0.1843      0.919 0.972 0.028
#> GSM1178979     2  0.8661      0.642 0.288 0.712
#> GSM1179009     1  0.3431      0.899 0.936 0.064
#> GSM1179031     2  0.0000      0.859 0.000 1.000
#> GSM1178970     2  0.8861      0.610 0.304 0.696
#> GSM1178972     2  0.0000      0.859 0.000 1.000
#> GSM1178973     1  0.0000      0.917 1.000 0.000
#> GSM1178974     2  0.0000      0.859 0.000 1.000
#> GSM1178977     1  0.9686      0.333 0.604 0.396
#> GSM1178978     1  0.2423      0.915 0.960 0.040
#> GSM1178998     1  0.0000      0.917 1.000 0.000
#> GSM1179010     1  0.0000      0.917 1.000 0.000
#> GSM1179018     1  0.4562      0.889 0.904 0.096
#> GSM1179024     1  0.0000      0.917 1.000 0.000
#> GSM1178984     1  0.0000      0.917 1.000 0.000
#> GSM1178990     1  0.0000      0.917 1.000 0.000
#> GSM1178991     1  0.3114      0.903 0.944 0.056
#> GSM1178994     1  0.0938      0.919 0.988 0.012
#> GSM1178997     1  0.3114      0.913 0.944 0.056
#> GSM1179000     1  0.2236      0.918 0.964 0.036
#> GSM1179013     1  0.0000      0.917 1.000 0.000
#> GSM1179014     1  0.3584      0.908 0.932 0.068
#> GSM1179019     1  0.1633      0.919 0.976 0.024
#> GSM1179020     1  0.0938      0.919 0.988 0.012
#> GSM1179022     1  0.0000      0.917 1.000 0.000
#> GSM1179028     2  0.0000      0.859 0.000 1.000
#> GSM1179032     1  0.0000      0.917 1.000 0.000
#> GSM1179041     2  0.0000      0.859 0.000 1.000
#> GSM1179042     2  0.0000      0.859 0.000 1.000
#> GSM1178976     1  0.9922      0.194 0.552 0.448
#> GSM1178981     1  0.2236      0.918 0.964 0.036
#> GSM1178982     1  0.1843      0.919 0.972 0.028
#> GSM1178983     1  0.2236      0.918 0.964 0.036
#> GSM1178985     1  0.4939      0.881 0.892 0.108
#> GSM1178992     1  0.3879      0.902 0.924 0.076
#> GSM1179005     1  0.1184      0.919 0.984 0.016
#> GSM1179007     1  0.0000      0.917 1.000 0.000
#> GSM1179012     1  0.0000      0.917 1.000 0.000
#> GSM1179016     1  0.8207      0.701 0.744 0.256
#> GSM1179030     1  0.7883      0.717 0.764 0.236
#> GSM1179038     1  0.0938      0.919 0.988 0.012
#> GSM1178987     1  0.3114      0.911 0.944 0.056
#> GSM1179003     2  0.8955      0.599 0.312 0.688
#> GSM1179004     1  0.3114      0.911 0.944 0.056
#> GSM1179039     2  0.0000      0.859 0.000 1.000
#> GSM1178975     1  0.0000      0.917 1.000 0.000
#> GSM1178980     2  0.9427      0.524 0.360 0.640
#> GSM1178995     1  0.1843      0.919 0.972 0.028
#> GSM1178996     1  0.4022      0.902 0.920 0.080
#> GSM1179001     1  0.0000      0.917 1.000 0.000
#> GSM1179002     1  0.0000      0.917 1.000 0.000
#> GSM1179006     1  0.5408      0.867 0.876 0.124
#> GSM1179008     1  0.0000      0.917 1.000 0.000
#> GSM1179015     1  0.0000      0.917 1.000 0.000
#> GSM1179017     1  0.9710      0.377 0.600 0.400
#> GSM1179026     1  0.4298      0.896 0.912 0.088
#> GSM1179033     1  0.2603      0.917 0.956 0.044
#> GSM1179035     1  0.3879      0.903 0.924 0.076
#> GSM1179036     1  0.3114      0.914 0.944 0.056
#> GSM1178986     1  0.2603      0.916 0.956 0.044
#> GSM1178989     1  0.9710      0.362 0.600 0.400
#> GSM1178993     1  0.3584      0.897 0.932 0.068
#> GSM1178999     2  0.7602      0.730 0.220 0.780
#> GSM1179021     2  0.4815      0.817 0.104 0.896
#> GSM1179025     2  0.0000      0.859 0.000 1.000
#> GSM1179027     1  0.7602      0.720 0.780 0.220
#> GSM1179011     1  0.3431      0.899 0.936 0.064
#> GSM1179023     1  0.0000      0.917 1.000 0.000
#> GSM1179029     1  0.0000      0.917 1.000 0.000
#> GSM1179034     1  0.0000      0.917 1.000 0.000
#> GSM1179040     1  0.8081      0.677 0.752 0.248
#> GSM1178988     1  0.6712      0.810 0.824 0.176
#> GSM1179037     1  0.4022      0.901 0.920 0.080

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>            class entropy silhouette    p1    p2    p3
#> GSM1178971     1  0.2878      0.781 0.904 0.000 0.096
#> GSM1178979     2  0.8842      0.386 0.144 0.548 0.308
#> GSM1179009     1  0.4399      0.639 0.812 0.000 0.188
#> GSM1179031     2  0.0000      0.780 0.000 1.000 0.000
#> GSM1178970     2  0.8953      0.311 0.180 0.560 0.260
#> GSM1178972     2  0.2959      0.752 0.000 0.900 0.100
#> GSM1178973     1  0.2959      0.720 0.900 0.000 0.100
#> GSM1178974     2  0.0000      0.780 0.000 1.000 0.000
#> GSM1178977     1  0.9498     -0.266 0.484 0.300 0.216
#> GSM1178978     1  0.3686      0.706 0.860 0.000 0.140
#> GSM1178998     1  0.0592      0.777 0.988 0.000 0.012
#> GSM1179010     1  0.0592      0.777 0.988 0.000 0.012
#> GSM1179018     1  0.6012      0.634 0.748 0.032 0.220
#> GSM1179024     1  0.0592      0.777 0.988 0.000 0.012
#> GSM1178984     1  0.1529      0.781 0.960 0.000 0.040
#> GSM1178990     1  0.2448      0.780 0.924 0.000 0.076
#> GSM1178991     1  0.3879      0.683 0.848 0.000 0.152
#> GSM1178994     1  0.2959      0.770 0.900 0.000 0.100
#> GSM1178997     1  0.4235      0.738 0.824 0.000 0.176
#> GSM1179000     1  0.3816      0.755 0.852 0.000 0.148
#> GSM1179013     1  0.0592      0.777 0.988 0.000 0.012
#> GSM1179014     3  0.6291      0.264 0.468 0.000 0.532
#> GSM1179019     1  0.2796      0.778 0.908 0.000 0.092
#> GSM1179020     1  0.2448      0.780 0.924 0.000 0.076
#> GSM1179022     1  0.0592      0.777 0.988 0.000 0.012
#> GSM1179028     2  0.0000      0.780 0.000 1.000 0.000
#> GSM1179032     1  0.0592      0.777 0.988 0.000 0.012
#> GSM1179041     2  0.0000      0.780 0.000 1.000 0.000
#> GSM1179042     2  0.0000      0.780 0.000 1.000 0.000
#> GSM1178976     3  0.9909      0.497 0.364 0.268 0.368
#> GSM1178981     1  0.4062      0.747 0.836 0.000 0.164
#> GSM1178982     1  0.4062      0.750 0.836 0.000 0.164
#> GSM1178983     1  0.4235      0.746 0.824 0.000 0.176
#> GSM1178985     1  0.5728      0.601 0.720 0.008 0.272
#> GSM1178992     1  0.5254      0.619 0.736 0.000 0.264
#> GSM1179005     1  0.3192      0.768 0.888 0.000 0.112
#> GSM1179007     1  0.2356      0.780 0.928 0.000 0.072
#> GSM1179012     1  0.0592      0.777 0.988 0.000 0.012
#> GSM1179016     3  0.4974      0.570 0.236 0.000 0.764
#> GSM1179030     1  0.8038      0.268 0.620 0.100 0.280
#> GSM1179038     1  0.3192      0.771 0.888 0.000 0.112
#> GSM1178987     1  0.4346      0.725 0.816 0.000 0.184
#> GSM1179003     2  0.9149      0.287 0.168 0.516 0.316
#> GSM1179004     1  0.4346      0.725 0.816 0.000 0.184
#> GSM1179039     2  0.0000      0.780 0.000 1.000 0.000
#> GSM1178975     1  0.2959      0.720 0.900 0.000 0.100
#> GSM1178980     2  0.9026      0.264 0.248 0.556 0.196
#> GSM1178995     1  0.3482      0.761 0.872 0.000 0.128
#> GSM1178996     1  0.4842      0.689 0.776 0.000 0.224
#> GSM1179001     1  0.0592      0.777 0.988 0.000 0.012
#> GSM1179002     1  0.1289      0.781 0.968 0.000 0.032
#> GSM1179006     1  0.6205      0.479 0.656 0.008 0.336
#> GSM1179008     1  0.0592      0.777 0.988 0.000 0.012
#> GSM1179015     1  0.0892      0.778 0.980 0.000 0.020
#> GSM1179017     3  0.4056      0.340 0.092 0.032 0.876
#> GSM1179026     1  0.5560      0.562 0.700 0.000 0.300
#> GSM1179033     1  0.3752      0.754 0.856 0.000 0.144
#> GSM1179035     1  0.5465      0.579 0.712 0.000 0.288
#> GSM1179036     1  0.4605      0.711 0.796 0.000 0.204
#> GSM1178986     1  0.4235      0.744 0.824 0.000 0.176
#> GSM1178989     3  0.9481      0.492 0.384 0.184 0.432
#> GSM1178993     1  0.4733      0.619 0.800 0.004 0.196
#> GSM1178999     2  0.7919      0.506 0.064 0.556 0.380
#> GSM1179021     2  0.4390      0.723 0.012 0.840 0.148
#> GSM1179025     2  0.0000      0.780 0.000 1.000 0.000
#> GSM1179027     1  0.7960      0.284 0.648 0.120 0.232
#> GSM1179011     1  0.4504      0.626 0.804 0.000 0.196
#> GSM1179023     1  0.0592      0.777 0.988 0.000 0.012
#> GSM1179029     1  0.0747      0.777 0.984 0.000 0.016
#> GSM1179034     1  0.0592      0.777 0.988 0.000 0.012
#> GSM1179040     1  0.8284      0.217 0.628 0.148 0.224
#> GSM1178988     1  0.7295      0.221 0.584 0.036 0.380
#> GSM1179037     1  0.5497      0.574 0.708 0.000 0.292

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>            class entropy silhouette    p1    p2    p3    p4
#> GSM1178971     1  0.5207    0.38650 0.680 0.000 0.292 0.028
#> GSM1178979     2  0.7551    0.46692 0.008 0.456 0.388 0.148
#> GSM1179009     4  0.7410    0.77367 0.184 0.000 0.328 0.488
#> GSM1179031     2  0.0000    0.77651 0.000 1.000 0.000 0.000
#> GSM1178970     2  0.7381    0.42209 0.008 0.472 0.392 0.128
#> GSM1178972     2  0.4100    0.74214 0.000 0.832 0.092 0.076
#> GSM1178973     1  0.7806   -0.33374 0.412 0.000 0.264 0.324
#> GSM1178974     2  0.0000    0.77651 0.000 1.000 0.000 0.000
#> GSM1178977     3  0.9050   -0.47317 0.068 0.228 0.364 0.340
#> GSM1178978     3  0.7863   -0.44565 0.276 0.000 0.380 0.344
#> GSM1178998     1  0.1182    0.64751 0.968 0.000 0.016 0.016
#> GSM1179010     1  0.1411    0.64317 0.960 0.000 0.020 0.020
#> GSM1179018     3  0.8001   -0.00657 0.304 0.016 0.472 0.208
#> GSM1179024     1  0.0000    0.65051 1.000 0.000 0.000 0.000
#> GSM1178984     1  0.3991    0.53869 0.808 0.000 0.172 0.020
#> GSM1178990     1  0.4436    0.51089 0.764 0.000 0.216 0.020
#> GSM1178991     4  0.7728    0.63621 0.236 0.000 0.340 0.424
#> GSM1178994     1  0.6280    0.06036 0.584 0.000 0.344 0.072
#> GSM1178997     1  0.6200   -0.10043 0.504 0.000 0.444 0.052
#> GSM1179000     1  0.6222    0.01364 0.532 0.000 0.412 0.056
#> GSM1179013     1  0.0000    0.65051 1.000 0.000 0.000 0.000
#> GSM1179014     3  0.7811    0.18097 0.336 0.000 0.404 0.260
#> GSM1179019     1  0.5256    0.42277 0.692 0.000 0.272 0.036
#> GSM1179020     1  0.4175    0.53039 0.784 0.000 0.200 0.016
#> GSM1179022     1  0.0000    0.65051 1.000 0.000 0.000 0.000
#> GSM1179028     2  0.0000    0.77651 0.000 1.000 0.000 0.000
#> GSM1179032     1  0.0000    0.65051 1.000 0.000 0.000 0.000
#> GSM1179041     2  0.0000    0.77651 0.000 1.000 0.000 0.000
#> GSM1179042     2  0.0000    0.77651 0.000 1.000 0.000 0.000
#> GSM1178976     3  0.7348   -0.03058 0.072 0.200 0.636 0.092
#> GSM1178981     3  0.6696    0.34776 0.428 0.000 0.484 0.088
#> GSM1178982     3  0.6445    0.30805 0.444 0.000 0.488 0.068
#> GSM1178983     3  0.6599    0.32978 0.432 0.000 0.488 0.080
#> GSM1178985     3  0.5968    0.49057 0.324 0.004 0.624 0.048
#> GSM1178992     3  0.5172    0.40909 0.404 0.000 0.588 0.008
#> GSM1179005     1  0.5835    0.19598 0.588 0.000 0.372 0.040
#> GSM1179007     1  0.5496    0.33992 0.652 0.000 0.312 0.036
#> GSM1179012     1  0.1411    0.64317 0.960 0.000 0.020 0.020
#> GSM1179016     3  0.6669    0.08328 0.104 0.000 0.564 0.332
#> GSM1179030     3  0.8351    0.34026 0.288 0.080 0.512 0.120
#> GSM1179038     1  0.5682    0.24775 0.612 0.000 0.352 0.036
#> GSM1178987     3  0.6627    0.38638 0.412 0.000 0.504 0.084
#> GSM1179003     2  0.7580    0.43687 0.016 0.432 0.428 0.124
#> GSM1179004     3  0.6633    0.38052 0.416 0.000 0.500 0.084
#> GSM1179039     2  0.0000    0.77651 0.000 1.000 0.000 0.000
#> GSM1178975     1  0.7806   -0.33374 0.412 0.000 0.264 0.324
#> GSM1178980     2  0.7838    0.32020 0.004 0.424 0.220 0.352
#> GSM1178995     1  0.5894    0.13628 0.568 0.000 0.392 0.040
#> GSM1178996     3  0.5576    0.27393 0.444 0.000 0.536 0.020
#> GSM1179001     1  0.0804    0.65231 0.980 0.000 0.012 0.008
#> GSM1179002     1  0.1975    0.64318 0.936 0.000 0.048 0.016
#> GSM1179006     3  0.5172    0.50001 0.284 0.008 0.692 0.016
#> GSM1179008     1  0.0937    0.65230 0.976 0.000 0.012 0.012
#> GSM1179015     1  0.1004    0.64559 0.972 0.000 0.024 0.004
#> GSM1179017     3  0.5290   -0.08606 0.000 0.012 0.584 0.404
#> GSM1179026     3  0.5018    0.48172 0.332 0.000 0.656 0.012
#> GSM1179033     1  0.5971    0.00658 0.532 0.000 0.428 0.040
#> GSM1179035     3  0.5143    0.46042 0.360 0.000 0.628 0.012
#> GSM1179036     3  0.5685    0.22209 0.460 0.000 0.516 0.024
#> GSM1178986     3  0.6600    0.39167 0.396 0.000 0.520 0.084
#> GSM1178989     3  0.6627    0.03144 0.076 0.124 0.708 0.092
#> GSM1178993     4  0.7205    0.79560 0.152 0.000 0.344 0.504
#> GSM1178999     2  0.7710    0.53220 0.004 0.456 0.340 0.200
#> GSM1179021     2  0.5585    0.68185 0.000 0.712 0.084 0.204
#> GSM1179025     2  0.0000    0.77651 0.000 1.000 0.000 0.000
#> GSM1179027     4  0.5693    0.70238 0.020 0.008 0.368 0.604
#> GSM1179011     4  0.7239    0.79318 0.156 0.000 0.344 0.500
#> GSM1179023     1  0.0000    0.65051 1.000 0.000 0.000 0.000
#> GSM1179029     1  0.0707    0.65095 0.980 0.000 0.020 0.000
#> GSM1179034     1  0.0000    0.65051 1.000 0.000 0.000 0.000
#> GSM1179040     4  0.6373    0.68839 0.020 0.036 0.368 0.576
#> GSM1178988     3  0.5770    0.40971 0.228 0.024 0.708 0.040
#> GSM1179037     3  0.5127    0.46523 0.356 0.000 0.632 0.012

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>            class entropy silhouette    p1    p2    p3    p4    p5
#> GSM1178971     3  0.4980     0.1711 0.484 0.000 0.488 0.028 0.000
#> GSM1178979     2  0.8472     0.2507 0.000 0.320 0.280 0.184 0.216
#> GSM1179009     4  0.4830     0.6627 0.072 0.000 0.208 0.716 0.004
#> GSM1179031     2  0.0000     0.7031 0.000 1.000 0.000 0.000 0.000
#> GSM1178970     2  0.8196     0.2515 0.000 0.356 0.324 0.164 0.156
#> GSM1178972     2  0.4767     0.6238 0.000 0.776 0.044 0.096 0.084
#> GSM1178973     4  0.6354     0.4832 0.264 0.000 0.216 0.520 0.000
#> GSM1178974     2  0.0000     0.7031 0.000 1.000 0.000 0.000 0.000
#> GSM1178977     4  0.7534     0.3478 0.008 0.152 0.196 0.540 0.104
#> GSM1178978     4  0.5976     0.4604 0.092 0.000 0.368 0.532 0.008
#> GSM1178998     1  0.1904     0.7419 0.936 0.000 0.028 0.020 0.016
#> GSM1179010     1  0.2180     0.7280 0.924 0.000 0.024 0.032 0.020
#> GSM1179018     3  0.6670     0.2516 0.128 0.000 0.556 0.276 0.040
#> GSM1179024     1  0.0963     0.7750 0.964 0.000 0.036 0.000 0.000
#> GSM1178984     1  0.4153     0.5671 0.740 0.000 0.236 0.016 0.008
#> GSM1178990     1  0.4339     0.3696 0.652 0.000 0.336 0.012 0.000
#> GSM1178991     4  0.5576     0.6298 0.100 0.000 0.268 0.628 0.004
#> GSM1178994     1  0.5697    -0.1642 0.480 0.000 0.448 0.068 0.004
#> GSM1178997     3  0.5029     0.5790 0.292 0.000 0.648 0.060 0.000
#> GSM1179000     3  0.5172     0.5317 0.324 0.000 0.616 0.060 0.000
#> GSM1179013     1  0.0963     0.7750 0.964 0.000 0.036 0.000 0.000
#> GSM1179014     3  0.6683    -0.2647 0.180 0.000 0.444 0.008 0.368
#> GSM1179019     1  0.5230    -0.0877 0.504 0.000 0.452 0.044 0.000
#> GSM1179020     1  0.4165     0.4309 0.672 0.000 0.320 0.008 0.000
#> GSM1179022     1  0.0963     0.7750 0.964 0.000 0.036 0.000 0.000
#> GSM1179028     2  0.0000     0.7031 0.000 1.000 0.000 0.000 0.000
#> GSM1179032     1  0.0963     0.7750 0.964 0.000 0.036 0.000 0.000
#> GSM1179041     2  0.0000     0.7031 0.000 1.000 0.000 0.000 0.000
#> GSM1179042     2  0.0000     0.7031 0.000 1.000 0.000 0.000 0.000
#> GSM1178976     3  0.6743    -0.1098 0.000 0.132 0.616 0.108 0.144
#> GSM1178981     3  0.4959     0.6256 0.240 0.000 0.684 0.076 0.000
#> GSM1178982     3  0.4987     0.6498 0.236 0.000 0.684 0.080 0.000
#> GSM1178983     3  0.4914     0.6625 0.204 0.000 0.704 0.092 0.000
#> GSM1178985     3  0.4639     0.6613 0.132 0.000 0.776 0.040 0.052
#> GSM1178992     3  0.4148     0.6592 0.216 0.000 0.752 0.004 0.028
#> GSM1179005     3  0.5024     0.3224 0.440 0.000 0.532 0.024 0.004
#> GSM1179007     1  0.5002     0.0219 0.548 0.000 0.424 0.024 0.004
#> GSM1179012     1  0.2082     0.7319 0.928 0.000 0.024 0.032 0.016
#> GSM1179016     5  0.5236     0.5251 0.052 0.000 0.380 0.000 0.568
#> GSM1179030     3  0.7468     0.5005 0.136 0.056 0.604 0.112 0.092
#> GSM1179038     3  0.4803     0.3149 0.444 0.000 0.536 0.020 0.000
#> GSM1178987     3  0.4747     0.6454 0.196 0.000 0.720 0.084 0.000
#> GSM1179003     2  0.8375     0.1935 0.000 0.316 0.316 0.160 0.208
#> GSM1179004     3  0.4725     0.6446 0.200 0.000 0.720 0.080 0.000
#> GSM1179039     2  0.0000     0.7031 0.000 1.000 0.000 0.000 0.000
#> GSM1178975     4  0.6354     0.4832 0.264 0.000 0.216 0.520 0.000
#> GSM1178980     4  0.7600    -0.1980 0.000 0.292 0.128 0.468 0.112
#> GSM1178995     3  0.5024     0.4339 0.396 0.000 0.572 0.028 0.004
#> GSM1178996     3  0.4684     0.6474 0.244 0.000 0.712 0.024 0.020
#> GSM1179001     1  0.2574     0.7502 0.876 0.000 0.112 0.012 0.000
#> GSM1179002     1  0.3098     0.7192 0.836 0.000 0.148 0.016 0.000
#> GSM1179006     3  0.4605     0.6238 0.112 0.004 0.788 0.032 0.064
#> GSM1179008     1  0.2677     0.7484 0.872 0.000 0.112 0.016 0.000
#> GSM1179015     1  0.2857     0.7338 0.868 0.000 0.112 0.008 0.012
#> GSM1179017     5  0.2389     0.5319 0.000 0.004 0.116 0.000 0.880
#> GSM1179026     3  0.3745     0.6547 0.132 0.000 0.820 0.012 0.036
#> GSM1179033     3  0.4882     0.5455 0.328 0.000 0.636 0.032 0.004
#> GSM1179035     3  0.3730     0.6662 0.152 0.000 0.808 0.004 0.036
#> GSM1179036     3  0.4969     0.6341 0.264 0.000 0.684 0.032 0.020
#> GSM1178986     3  0.4797     0.6680 0.172 0.000 0.724 0.104 0.000
#> GSM1178989     3  0.6168    -0.0868 0.000 0.060 0.644 0.088 0.208
#> GSM1178993     4  0.4302     0.6680 0.048 0.000 0.208 0.744 0.000
#> GSM1178999     2  0.8524     0.2549 0.000 0.308 0.192 0.236 0.264
#> GSM1179021     2  0.6664     0.5104 0.000 0.580 0.068 0.256 0.096
#> GSM1179025     2  0.0000     0.7031 0.000 1.000 0.000 0.000 0.000
#> GSM1179027     4  0.3723     0.5812 0.000 0.000 0.152 0.804 0.044
#> GSM1179011     4  0.4302     0.6681 0.048 0.000 0.208 0.744 0.000
#> GSM1179023     1  0.0963     0.7750 0.964 0.000 0.036 0.000 0.000
#> GSM1179029     1  0.2570     0.7558 0.880 0.000 0.108 0.004 0.008
#> GSM1179034     1  0.0963     0.7750 0.964 0.000 0.036 0.000 0.000
#> GSM1179040     4  0.4478     0.5733 0.000 0.028 0.152 0.776 0.044
#> GSM1178988     3  0.4116     0.4919 0.056 0.000 0.816 0.032 0.096
#> GSM1179037     3  0.3688     0.6646 0.148 0.000 0.812 0.004 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
#> GSM1178971     3  0.4898     0.3253 0.352 0.000 0.588 0.052 0.004 0.004
#> GSM1178979     5  0.5054     0.6259 0.000 0.140 0.160 0.008 0.684 0.008
#> GSM1179009     4  0.2717     0.7152 0.020 0.000 0.068 0.884 0.020 0.008
#> GSM1179031     2  0.0000     0.9454 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1178970     5  0.6213     0.5449 0.004 0.260 0.204 0.012 0.516 0.004
#> GSM1178972     2  0.3448     0.4759 0.004 0.716 0.000 0.000 0.280 0.000
#> GSM1178973     4  0.5378     0.5848 0.180 0.000 0.096 0.680 0.020 0.024
#> GSM1178974     2  0.0146     0.9427 0.004 0.996 0.000 0.000 0.000 0.000
#> GSM1178977     4  0.6348     0.0592 0.000 0.084 0.088 0.492 0.336 0.000
#> GSM1178978     4  0.4780     0.5256 0.028 0.000 0.284 0.656 0.028 0.004
#> GSM1178998     1  0.4086     0.6185 0.812 0.000 0.040 0.024 0.060 0.064
#> GSM1179010     1  0.4708     0.5459 0.764 0.000 0.028 0.032 0.084 0.092
#> GSM1179018     3  0.5590     0.2836 0.020 0.000 0.580 0.284 0.116 0.000
#> GSM1179024     1  0.2588     0.7732 0.860 0.000 0.124 0.012 0.004 0.000
#> GSM1178984     1  0.5852     0.4720 0.596 0.000 0.284 0.040 0.028 0.052
#> GSM1178990     1  0.5072     0.1937 0.524 0.000 0.424 0.028 0.012 0.012
#> GSM1178991     4  0.3731     0.6802 0.044 0.000 0.140 0.800 0.008 0.008
#> GSM1178994     3  0.6198     0.1834 0.356 0.000 0.492 0.112 0.008 0.032
#> GSM1178997     3  0.4424     0.6093 0.156 0.000 0.740 0.088 0.016 0.000
#> GSM1179000     3  0.4747     0.5792 0.184 0.000 0.708 0.092 0.012 0.004
#> GSM1179013     1  0.2588     0.7732 0.860 0.000 0.124 0.012 0.004 0.000
#> GSM1179014     3  0.6116    -0.2734 0.116 0.000 0.448 0.000 0.036 0.400
#> GSM1179019     3  0.5360     0.2579 0.360 0.000 0.552 0.072 0.012 0.004
#> GSM1179020     1  0.4897     0.2622 0.544 0.000 0.408 0.036 0.008 0.004
#> GSM1179022     1  0.2588     0.7732 0.860 0.000 0.124 0.012 0.004 0.000
#> GSM1179028     2  0.0146     0.9419 0.000 0.996 0.000 0.000 0.004 0.000
#> GSM1179032     1  0.2588     0.7732 0.860 0.000 0.124 0.012 0.004 0.000
#> GSM1179041     2  0.0000     0.9454 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1179042     2  0.0000     0.9454 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1178976     3  0.6085    -0.2050 0.004 0.080 0.488 0.008 0.388 0.032
#> GSM1178981     3  0.4281     0.6398 0.084 0.000 0.760 0.140 0.004 0.012
#> GSM1178982     3  0.4076     0.6655 0.088 0.000 0.776 0.124 0.004 0.008
#> GSM1178983     3  0.3728     0.6624 0.068 0.000 0.788 0.140 0.000 0.004
#> GSM1178985     3  0.3767     0.6324 0.020 0.000 0.828 0.072 0.056 0.024
#> GSM1178992     3  0.2736     0.6398 0.072 0.000 0.880 0.004 0.016 0.028
#> GSM1179005     3  0.5278     0.4312 0.300 0.000 0.616 0.052 0.016 0.016
#> GSM1179007     3  0.5538     0.0858 0.428 0.000 0.492 0.044 0.012 0.024
#> GSM1179012     1  0.4506     0.5640 0.780 0.000 0.028 0.032 0.072 0.088
#> GSM1179016     6  0.5374     0.4021 0.028 0.000 0.356 0.000 0.060 0.556
#> GSM1179030     3  0.5475     0.4954 0.036 0.000 0.636 0.108 0.220 0.000
#> GSM1179038     3  0.5000     0.4531 0.296 0.000 0.632 0.052 0.012 0.008
#> GSM1178987     3  0.3621     0.6279 0.044 0.000 0.804 0.140 0.004 0.008
#> GSM1179003     5  0.5636     0.5803 0.000 0.136 0.188 0.008 0.640 0.028
#> GSM1179004     3  0.3744     0.6301 0.048 0.000 0.800 0.136 0.004 0.012
#> GSM1179039     2  0.0000     0.9454 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1178975     4  0.5378     0.5848 0.180 0.000 0.096 0.680 0.020 0.024
#> GSM1178980     5  0.6138     0.3737 0.000 0.084 0.020 0.280 0.572 0.044
#> GSM1178995     3  0.4906     0.5083 0.264 0.000 0.660 0.056 0.012 0.008
#> GSM1178996     3  0.3383     0.6613 0.112 0.000 0.832 0.036 0.016 0.004
#> GSM1179001     1  0.4601     0.7163 0.732 0.000 0.192 0.024 0.024 0.028
#> GSM1179002     1  0.4486     0.6915 0.716 0.000 0.224 0.032 0.016 0.012
#> GSM1179006     3  0.2911     0.5990 0.008 0.000 0.872 0.024 0.076 0.020
#> GSM1179008     1  0.4705     0.7117 0.724 0.000 0.196 0.028 0.024 0.028
#> GSM1179015     1  0.5042     0.6550 0.704 0.000 0.176 0.004 0.068 0.048
#> GSM1179017     6  0.3361     0.3160 0.000 0.000 0.020 0.004 0.188 0.788
#> GSM1179026     3  0.1879     0.6230 0.016 0.000 0.932 0.008 0.016 0.028
#> GSM1179033     3  0.4471     0.5893 0.192 0.000 0.728 0.064 0.008 0.008
#> GSM1179035     3  0.1856     0.6303 0.024 0.000 0.932 0.008 0.008 0.028
#> GSM1179036     3  0.3721     0.6505 0.136 0.000 0.804 0.036 0.020 0.004
#> GSM1178986     3  0.3662     0.6543 0.036 0.000 0.800 0.148 0.012 0.004
#> GSM1178989     3  0.5092    -0.1121 0.004 0.000 0.512 0.008 0.428 0.048
#> GSM1178993     4  0.1829     0.7167 0.004 0.000 0.064 0.920 0.012 0.000
#> GSM1178999     5  0.4042     0.5766 0.000 0.060 0.068 0.044 0.812 0.016
#> GSM1179021     5  0.5369     0.3439 0.000 0.364 0.000 0.040 0.552 0.044
#> GSM1179025     2  0.0000     0.9454 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1179027     4  0.3957     0.6054 0.000 0.000 0.028 0.780 0.152 0.040
#> GSM1179011     4  0.1429     0.7135 0.004 0.000 0.052 0.940 0.004 0.000
#> GSM1179023     1  0.2588     0.7732 0.860 0.000 0.124 0.012 0.004 0.000
#> GSM1179029     1  0.4546     0.7201 0.748 0.000 0.160 0.008 0.036 0.048
#> GSM1179034     1  0.2699     0.7722 0.856 0.000 0.124 0.012 0.008 0.000
#> GSM1179040     4  0.4591     0.5844 0.000 0.024 0.028 0.752 0.156 0.040
#> GSM1178988     3  0.3603     0.4846 0.000 0.000 0.804 0.012 0.136 0.048
#> GSM1179037     3  0.1957     0.6293 0.024 0.000 0.928 0.012 0.008 0.028

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

consensus_heatmap(res, k = 2)

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

consensus_heatmap(res, k = 3)

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

consensus_heatmap(res, k = 4)

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

consensus_heatmap(res, k = 5)

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

consensus_heatmap(res, k = 6)

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

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

membership_heatmap(res, k = 2)

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

membership_heatmap(res, k = 3)

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

membership_heatmap(res, k = 4)

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

membership_heatmap(res, k = 5)

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

membership_heatmap(res, k = 6)

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

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

Signature heatmaps where rows are scaled:

get_signatures(res, k = 2)

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

get_signatures(res, k = 3)

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

get_signatures(res, k = 4)

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

get_signatures(res, k = 5)

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

get_signatures(res, k = 6)

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

Signature heatmaps where rows are not scaled:

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

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

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

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

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

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

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

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

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

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

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk CV-hclust-signature_compare

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

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

An example of the output of tb is:

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

The columns in tb are:

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

UMAP plot which shows how samples are separated.

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

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

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

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

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

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

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

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

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

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

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk CV-hclust-collect-classes

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

test_to_known_factors(res)
#>            n disease.state(p) protocol(p) k
#> CV:hclust 69            0.259     0.15694 2
#> CV:hclust 59            0.579     0.24575 3
#> CV:hclust 34            0.246     0.18731 4
#> CV:hclust 50            0.106     0.02348 5
#> CV:hclust 52            0.139     0.00351 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 31632 rows and 73 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 1.000           0.996       0.998         0.3925 0.610   0.610
#> 3 3 0.743           0.851       0.922         0.5642 0.607   0.432
#> 4 4 0.627           0.750       0.857         0.1566 0.849   0.631
#> 5 5 0.563           0.571       0.768         0.0738 0.935   0.788
#> 6 6 0.594           0.484       0.720         0.0516 0.896   0.641

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
#> GSM1178971     1  0.0000      0.998 1.000 0.000
#> GSM1178979     2  0.0000      1.000 0.000 1.000
#> GSM1179009     1  0.0000      0.998 1.000 0.000
#> GSM1179031     2  0.0000      1.000 0.000 1.000
#> GSM1178970     2  0.0000      1.000 0.000 1.000
#> GSM1178972     2  0.0000      1.000 0.000 1.000
#> GSM1178973     1  0.0000      0.998 1.000 0.000
#> GSM1178974     2  0.0000      1.000 0.000 1.000
#> GSM1178977     2  0.0000      1.000 0.000 1.000
#> GSM1178978     1  0.0000      0.998 1.000 0.000
#> GSM1178998     1  0.0000      0.998 1.000 0.000
#> GSM1179010     1  0.0000      0.998 1.000 0.000
#> GSM1179018     1  0.0000      0.998 1.000 0.000
#> GSM1179024     1  0.0000      0.998 1.000 0.000
#> GSM1178984     1  0.0000      0.998 1.000 0.000
#> GSM1178990     1  0.0000      0.998 1.000 0.000
#> GSM1178991     1  0.0000      0.998 1.000 0.000
#> GSM1178994     1  0.0000      0.998 1.000 0.000
#> GSM1178997     1  0.0000      0.998 1.000 0.000
#> GSM1179000     1  0.0000      0.998 1.000 0.000
#> GSM1179013     1  0.0000      0.998 1.000 0.000
#> GSM1179014     1  0.0000      0.998 1.000 0.000
#> GSM1179019     1  0.0000      0.998 1.000 0.000
#> GSM1179020     1  0.0000      0.998 1.000 0.000
#> GSM1179022     1  0.0000      0.998 1.000 0.000
#> GSM1179028     2  0.0000      1.000 0.000 1.000
#> GSM1179032     1  0.0000      0.998 1.000 0.000
#> GSM1179041     2  0.0000      1.000 0.000 1.000
#> GSM1179042     2  0.0000      1.000 0.000 1.000
#> GSM1178976     2  0.0000      1.000 0.000 1.000
#> GSM1178981     1  0.0000      0.998 1.000 0.000
#> GSM1178982     1  0.0000      0.998 1.000 0.000
#> GSM1178983     1  0.0000      0.998 1.000 0.000
#> GSM1178985     1  0.0000      0.998 1.000 0.000
#> GSM1178992     1  0.0000      0.998 1.000 0.000
#> GSM1179005     1  0.0000      0.998 1.000 0.000
#> GSM1179007     1  0.0000      0.998 1.000 0.000
#> GSM1179012     1  0.0000      0.998 1.000 0.000
#> GSM1179016     1  0.0000      0.998 1.000 0.000
#> GSM1179030     1  0.4431      0.900 0.908 0.092
#> GSM1179038     1  0.0000      0.998 1.000 0.000
#> GSM1178987     1  0.0000      0.998 1.000 0.000
#> GSM1179003     2  0.0000      1.000 0.000 1.000
#> GSM1179004     1  0.0000      0.998 1.000 0.000
#> GSM1179039     2  0.0000      1.000 0.000 1.000
#> GSM1178975     1  0.0000      0.998 1.000 0.000
#> GSM1178980     2  0.0000      1.000 0.000 1.000
#> GSM1178995     1  0.0000      0.998 1.000 0.000
#> GSM1178996     1  0.0000      0.998 1.000 0.000
#> GSM1179001     1  0.0000      0.998 1.000 0.000
#> GSM1179002     1  0.0000      0.998 1.000 0.000
#> GSM1179006     1  0.0000      0.998 1.000 0.000
#> GSM1179008     1  0.0000      0.998 1.000 0.000
#> GSM1179015     1  0.0000      0.998 1.000 0.000
#> GSM1179017     2  0.0672      0.992 0.008 0.992
#> GSM1179026     1  0.0000      0.998 1.000 0.000
#> GSM1179033     1  0.0000      0.998 1.000 0.000
#> GSM1179035     1  0.0000      0.998 1.000 0.000
#> GSM1179036     1  0.0000      0.998 1.000 0.000
#> GSM1178986     1  0.0000      0.998 1.000 0.000
#> GSM1178989     2  0.0000      1.000 0.000 1.000
#> GSM1178993     1  0.0000      0.998 1.000 0.000
#> GSM1178999     2  0.0000      1.000 0.000 1.000
#> GSM1179021     2  0.0000      1.000 0.000 1.000
#> GSM1179025     2  0.0000      1.000 0.000 1.000
#> GSM1179027     1  0.2043      0.967 0.968 0.032
#> GSM1179011     1  0.0000      0.998 1.000 0.000
#> GSM1179023     1  0.0000      0.998 1.000 0.000
#> GSM1179029     1  0.0000      0.998 1.000 0.000
#> GSM1179034     1  0.0000      0.998 1.000 0.000
#> GSM1179040     2  0.0000      1.000 0.000 1.000
#> GSM1178988     1  0.0376      0.994 0.996 0.004
#> GSM1179037     1  0.0000      0.998 1.000 0.000

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>            class entropy silhouette    p1    p2    p3
#> GSM1178971     3  0.5254     0.7019 0.264 0.000 0.736
#> GSM1178979     2  0.4654     0.7180 0.000 0.792 0.208
#> GSM1179009     3  0.3879     0.8015 0.152 0.000 0.848
#> GSM1179031     2  0.0000     0.9286 0.000 1.000 0.000
#> GSM1178970     2  0.6204     0.2273 0.000 0.576 0.424
#> GSM1178972     2  0.0000     0.9286 0.000 1.000 0.000
#> GSM1178973     1  0.2356     0.8981 0.928 0.000 0.072
#> GSM1178974     2  0.0000     0.9286 0.000 1.000 0.000
#> GSM1178977     3  0.0592     0.8745 0.000 0.012 0.988
#> GSM1178978     3  0.1411     0.8910 0.036 0.000 0.964
#> GSM1178998     1  0.0237     0.9424 0.996 0.000 0.004
#> GSM1179010     1  0.0424     0.9408 0.992 0.000 0.008
#> GSM1179018     3  0.0237     0.8802 0.004 0.000 0.996
#> GSM1179024     1  0.0237     0.9424 0.996 0.000 0.004
#> GSM1178984     1  0.2448     0.8964 0.924 0.000 0.076
#> GSM1178990     1  0.0237     0.9424 0.996 0.000 0.004
#> GSM1178991     3  0.4062     0.8023 0.164 0.000 0.836
#> GSM1178994     1  0.2448     0.8981 0.924 0.000 0.076
#> GSM1178997     3  0.2625     0.8953 0.084 0.000 0.916
#> GSM1179000     1  0.0424     0.9409 0.992 0.000 0.008
#> GSM1179013     1  0.0000     0.9401 1.000 0.000 0.000
#> GSM1179014     1  0.4796     0.7054 0.780 0.000 0.220
#> GSM1179019     1  0.0237     0.9424 0.996 0.000 0.004
#> GSM1179020     1  0.0237     0.9424 0.996 0.000 0.004
#> GSM1179022     1  0.0237     0.9424 0.996 0.000 0.004
#> GSM1179028     2  0.0000     0.9286 0.000 1.000 0.000
#> GSM1179032     1  0.0237     0.9424 0.996 0.000 0.004
#> GSM1179041     2  0.0000     0.9286 0.000 1.000 0.000
#> GSM1179042     2  0.0000     0.9286 0.000 1.000 0.000
#> GSM1178976     3  0.3482     0.8135 0.000 0.128 0.872
#> GSM1178981     3  0.5016     0.7487 0.240 0.000 0.760
#> GSM1178982     3  0.1964     0.8960 0.056 0.000 0.944
#> GSM1178983     3  0.1643     0.8937 0.044 0.000 0.956
#> GSM1178985     3  0.2537     0.8954 0.080 0.000 0.920
#> GSM1178992     1  0.6192     0.1952 0.580 0.000 0.420
#> GSM1179005     1  0.2711     0.8874 0.912 0.000 0.088
#> GSM1179007     1  0.0237     0.9424 0.996 0.000 0.004
#> GSM1179012     1  0.0237     0.9391 0.996 0.000 0.004
#> GSM1179016     3  0.5497     0.6573 0.292 0.000 0.708
#> GSM1179030     3  0.1031     0.8894 0.024 0.000 0.976
#> GSM1179038     1  0.4346     0.7752 0.816 0.000 0.184
#> GSM1178987     3  0.2711     0.8931 0.088 0.000 0.912
#> GSM1179003     3  0.6307     0.0125 0.000 0.488 0.512
#> GSM1179004     3  0.2711     0.8931 0.088 0.000 0.912
#> GSM1179039     2  0.0000     0.9286 0.000 1.000 0.000
#> GSM1178975     3  0.1289     0.8875 0.032 0.000 0.968
#> GSM1178980     3  0.0592     0.8745 0.000 0.012 0.988
#> GSM1178995     1  0.2448     0.8964 0.924 0.000 0.076
#> GSM1178996     3  0.2625     0.8944 0.084 0.000 0.916
#> GSM1179001     1  0.0237     0.9424 0.996 0.000 0.004
#> GSM1179002     1  0.0237     0.9424 0.996 0.000 0.004
#> GSM1179006     3  0.2356     0.8963 0.072 0.000 0.928
#> GSM1179008     1  0.0237     0.9424 0.996 0.000 0.004
#> GSM1179015     1  0.0424     0.9364 0.992 0.000 0.008
#> GSM1179017     3  0.4349     0.8140 0.020 0.128 0.852
#> GSM1179026     3  0.2625     0.8944 0.084 0.000 0.916
#> GSM1179033     3  0.2356     0.8963 0.072 0.000 0.928
#> GSM1179035     3  0.2711     0.8931 0.088 0.000 0.912
#> GSM1179036     3  0.2625     0.8944 0.084 0.000 0.916
#> GSM1178986     3  0.2537     0.8954 0.080 0.000 0.920
#> GSM1178989     3  0.2486     0.8700 0.008 0.060 0.932
#> GSM1178993     3  0.0424     0.8803 0.008 0.000 0.992
#> GSM1178999     3  0.3340     0.8073 0.000 0.120 0.880
#> GSM1179021     2  0.1163     0.9155 0.000 0.972 0.028
#> GSM1179025     2  0.0000     0.9286 0.000 1.000 0.000
#> GSM1179027     3  0.0424     0.8803 0.008 0.000 0.992
#> GSM1179011     3  0.0424     0.8803 0.008 0.000 0.992
#> GSM1179023     1  0.0237     0.9424 0.996 0.000 0.004
#> GSM1179029     1  0.0424     0.9364 0.992 0.000 0.008
#> GSM1179034     1  0.0237     0.9424 0.996 0.000 0.004
#> GSM1179040     3  0.5859     0.3874 0.000 0.344 0.656
#> GSM1178988     3  0.2066     0.8947 0.060 0.000 0.940
#> GSM1179037     3  0.2625     0.8944 0.084 0.000 0.916

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>            class entropy silhouette    p1    p2    p3    p4
#> GSM1178971     3  0.3806      0.656 0.156 0.000 0.824 0.020
#> GSM1178979     2  0.6444      0.490 0.000 0.612 0.104 0.284
#> GSM1179009     4  0.5627      0.769 0.068 0.000 0.240 0.692
#> GSM1179031     2  0.0000      0.878 0.000 1.000 0.000 0.000
#> GSM1178970     2  0.7251      0.318 0.000 0.536 0.192 0.272
#> GSM1178972     2  0.0921      0.865 0.000 0.972 0.000 0.028
#> GSM1178973     1  0.5271      0.481 0.640 0.000 0.020 0.340
#> GSM1178974     2  0.0000      0.878 0.000 1.000 0.000 0.000
#> GSM1178977     4  0.4454      0.737 0.000 0.000 0.308 0.692
#> GSM1178978     4  0.4994      0.473 0.000 0.000 0.480 0.520
#> GSM1178998     1  0.1411      0.891 0.960 0.000 0.020 0.020
#> GSM1179010     1  0.3810      0.843 0.848 0.000 0.092 0.060
#> GSM1179018     3  0.4605      0.237 0.000 0.000 0.664 0.336
#> GSM1179024     1  0.0188      0.891 0.996 0.000 0.000 0.004
#> GSM1178984     1  0.4290      0.789 0.800 0.000 0.164 0.036
#> GSM1178990     1  0.0188      0.892 0.996 0.000 0.000 0.004
#> GSM1178991     4  0.6730      0.722 0.132 0.000 0.276 0.592
#> GSM1178994     1  0.5109      0.744 0.744 0.000 0.196 0.060
#> GSM1178997     3  0.1356      0.801 0.008 0.000 0.960 0.032
#> GSM1179000     1  0.2635      0.856 0.904 0.000 0.076 0.020
#> GSM1179013     1  0.0336      0.891 0.992 0.000 0.000 0.008
#> GSM1179014     3  0.6875      0.252 0.388 0.000 0.504 0.108
#> GSM1179019     1  0.2413      0.866 0.916 0.000 0.064 0.020
#> GSM1179020     1  0.0937      0.891 0.976 0.000 0.012 0.012
#> GSM1179022     1  0.0000      0.892 1.000 0.000 0.000 0.000
#> GSM1179028     2  0.0336      0.874 0.000 0.992 0.000 0.008
#> GSM1179032     1  0.0000      0.892 1.000 0.000 0.000 0.000
#> GSM1179041     2  0.0000      0.878 0.000 1.000 0.000 0.000
#> GSM1179042     2  0.0000      0.878 0.000 1.000 0.000 0.000
#> GSM1178976     3  0.4318      0.695 0.000 0.068 0.816 0.116
#> GSM1178981     3  0.3474      0.739 0.068 0.000 0.868 0.064
#> GSM1178982     3  0.1211      0.799 0.000 0.000 0.960 0.040
#> GSM1178983     3  0.1474      0.795 0.000 0.000 0.948 0.052
#> GSM1178985     3  0.1118      0.799 0.000 0.000 0.964 0.036
#> GSM1178992     3  0.4224      0.713 0.044 0.000 0.812 0.144
#> GSM1179005     1  0.5657      0.257 0.540 0.000 0.436 0.024
#> GSM1179007     1  0.2662      0.866 0.900 0.000 0.084 0.016
#> GSM1179012     1  0.2546      0.881 0.912 0.000 0.028 0.060
#> GSM1179016     3  0.2888      0.764 0.004 0.000 0.872 0.124
#> GSM1179030     3  0.1792      0.783 0.000 0.000 0.932 0.068
#> GSM1179038     3  0.5659      0.292 0.368 0.000 0.600 0.032
#> GSM1178987     3  0.1474      0.796 0.000 0.000 0.948 0.052
#> GSM1179003     3  0.7443      0.148 0.000 0.312 0.492 0.196
#> GSM1179004     3  0.1474      0.796 0.000 0.000 0.948 0.052
#> GSM1179039     2  0.0000      0.878 0.000 1.000 0.000 0.000
#> GSM1178975     4  0.4955      0.819 0.024 0.000 0.268 0.708
#> GSM1178980     4  0.3444      0.819 0.000 0.000 0.184 0.816
#> GSM1178995     1  0.4524      0.753 0.768 0.000 0.204 0.028
#> GSM1178996     3  0.0592      0.803 0.000 0.000 0.984 0.016
#> GSM1179001     1  0.2224      0.890 0.928 0.000 0.032 0.040
#> GSM1179002     1  0.2399      0.889 0.920 0.000 0.032 0.048
#> GSM1179006     3  0.1118      0.801 0.000 0.000 0.964 0.036
#> GSM1179008     1  0.1610      0.892 0.952 0.000 0.016 0.032
#> GSM1179015     1  0.2101      0.880 0.928 0.000 0.012 0.060
#> GSM1179017     3  0.4426      0.698 0.000 0.024 0.772 0.204
#> GSM1179026     3  0.2530      0.772 0.000 0.000 0.888 0.112
#> GSM1179033     3  0.0921      0.800 0.000 0.000 0.972 0.028
#> GSM1179035     3  0.1557      0.795 0.000 0.000 0.944 0.056
#> GSM1179036     3  0.0707      0.802 0.000 0.000 0.980 0.020
#> GSM1178986     3  0.0817      0.803 0.000 0.000 0.976 0.024
#> GSM1178989     3  0.2589      0.764 0.000 0.000 0.884 0.116
#> GSM1178993     4  0.3764      0.850 0.000 0.000 0.216 0.784
#> GSM1178999     3  0.5855      0.189 0.000 0.044 0.600 0.356
#> GSM1179021     2  0.4250      0.649 0.000 0.724 0.000 0.276
#> GSM1179025     2  0.0000      0.878 0.000 1.000 0.000 0.000
#> GSM1179027     4  0.3726      0.849 0.000 0.000 0.212 0.788
#> GSM1179011     4  0.3764      0.850 0.000 0.000 0.216 0.784
#> GSM1179023     1  0.0000      0.892 1.000 0.000 0.000 0.000
#> GSM1179029     1  0.1557      0.883 0.944 0.000 0.000 0.056
#> GSM1179034     1  0.0000      0.892 1.000 0.000 0.000 0.000
#> GSM1179040     4  0.4312      0.758 0.000 0.056 0.132 0.812
#> GSM1178988     3  0.1940      0.791 0.000 0.000 0.924 0.076
#> GSM1179037     3  0.1302      0.798 0.000 0.000 0.956 0.044

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>            class entropy silhouette    p1    p2    p3    p4    p5
#> GSM1178971     3  0.5608      0.566 0.120 0.000 0.692 0.028 0.160
#> GSM1178979     2  0.7803     -0.356 0.000 0.380 0.072 0.220 0.328
#> GSM1179009     4  0.4768      0.618 0.028 0.000 0.148 0.760 0.064
#> GSM1179031     2  0.0000      0.838 0.000 1.000 0.000 0.000 0.000
#> GSM1178970     5  0.8360      0.415 0.000 0.312 0.168 0.192 0.328
#> GSM1178972     2  0.3492      0.637 0.000 0.796 0.000 0.016 0.188
#> GSM1178973     1  0.6252      0.142 0.484 0.000 0.012 0.400 0.104
#> GSM1178974     2  0.0000      0.838 0.000 1.000 0.000 0.000 0.000
#> GSM1178977     4  0.6418     -0.321 0.000 0.000 0.184 0.472 0.344
#> GSM1178978     3  0.5972      0.358 0.000 0.000 0.560 0.300 0.140
#> GSM1178998     1  0.2848      0.744 0.840 0.000 0.004 0.000 0.156
#> GSM1179010     1  0.6038      0.586 0.576 0.000 0.184 0.000 0.240
#> GSM1179018     3  0.4681      0.442 0.000 0.000 0.696 0.252 0.052
#> GSM1179024     1  0.0671      0.756 0.980 0.000 0.000 0.004 0.016
#> GSM1178984     1  0.6359      0.489 0.520 0.000 0.260 0.000 0.220
#> GSM1178990     1  0.0290      0.760 0.992 0.000 0.000 0.000 0.008
#> GSM1178991     4  0.7241      0.400 0.208 0.000 0.204 0.524 0.064
#> GSM1178994     1  0.6678      0.261 0.404 0.000 0.360 0.000 0.236
#> GSM1178997     3  0.4208      0.625 0.032 0.000 0.788 0.024 0.156
#> GSM1179000     1  0.5659      0.525 0.652 0.000 0.236 0.016 0.096
#> GSM1179013     1  0.0404      0.757 0.988 0.000 0.000 0.000 0.012
#> GSM1179014     3  0.6924      0.106 0.292 0.000 0.380 0.004 0.324
#> GSM1179019     1  0.5375      0.570 0.684 0.000 0.216 0.016 0.084
#> GSM1179020     1  0.1808      0.753 0.936 0.000 0.020 0.004 0.040
#> GSM1179022     1  0.0290      0.758 0.992 0.000 0.000 0.000 0.008
#> GSM1179028     2  0.0290      0.834 0.000 0.992 0.000 0.000 0.008
#> GSM1179032     1  0.0290      0.758 0.992 0.000 0.000 0.000 0.008
#> GSM1179041     2  0.0000      0.838 0.000 1.000 0.000 0.000 0.000
#> GSM1179042     2  0.0000      0.838 0.000 1.000 0.000 0.000 0.000
#> GSM1178976     3  0.6327     -0.391 0.000 0.040 0.540 0.072 0.348
#> GSM1178981     3  0.4130      0.639 0.020 0.000 0.776 0.020 0.184
#> GSM1178982     3  0.2450      0.684 0.000 0.000 0.896 0.028 0.076
#> GSM1178983     3  0.2676      0.681 0.000 0.000 0.884 0.036 0.080
#> GSM1178985     3  0.1845      0.689 0.000 0.000 0.928 0.016 0.056
#> GSM1178992     3  0.3575      0.649 0.016 0.000 0.800 0.004 0.180
#> GSM1179005     3  0.6484      0.173 0.316 0.000 0.520 0.012 0.152
#> GSM1179007     1  0.5430      0.628 0.660 0.000 0.192 0.000 0.148
#> GSM1179012     1  0.3728      0.710 0.748 0.000 0.008 0.000 0.244
#> GSM1179016     3  0.4270      0.364 0.004 0.000 0.656 0.004 0.336
#> GSM1179030     3  0.3897      0.459 0.000 0.000 0.768 0.028 0.204
#> GSM1179038     3  0.5372      0.527 0.184 0.000 0.692 0.012 0.112
#> GSM1178987     3  0.3022      0.668 0.004 0.000 0.848 0.012 0.136
#> GSM1179003     5  0.8205      0.671 0.000 0.184 0.276 0.152 0.388
#> GSM1179004     3  0.3067      0.666 0.004 0.000 0.844 0.012 0.140
#> GSM1179039     2  0.0000      0.838 0.000 1.000 0.000 0.000 0.000
#> GSM1178975     4  0.5177      0.634 0.044 0.000 0.108 0.744 0.104
#> GSM1178980     4  0.1012      0.722 0.000 0.000 0.012 0.968 0.020
#> GSM1178995     1  0.6773      0.139 0.412 0.000 0.412 0.016 0.160
#> GSM1178996     3  0.1697      0.671 0.000 0.000 0.932 0.008 0.060
#> GSM1179001     1  0.4652      0.727 0.736 0.000 0.048 0.012 0.204
#> GSM1179002     1  0.5055      0.716 0.708 0.000 0.072 0.012 0.208
#> GSM1179006     3  0.1830      0.665 0.000 0.000 0.924 0.008 0.068
#> GSM1179008     1  0.3742      0.740 0.792 0.000 0.012 0.012 0.184
#> GSM1179015     1  0.2813      0.728 0.832 0.000 0.000 0.000 0.168
#> GSM1179017     5  0.5163      0.466 0.000 0.004 0.368 0.040 0.588
#> GSM1179026     3  0.1965      0.669 0.000 0.000 0.904 0.000 0.096
#> GSM1179033     3  0.0671      0.684 0.000 0.000 0.980 0.016 0.004
#> GSM1179035     3  0.3022      0.672 0.004 0.000 0.848 0.012 0.136
#> GSM1179036     3  0.2069      0.681 0.000 0.000 0.912 0.012 0.076
#> GSM1178986     3  0.2773      0.664 0.000 0.000 0.868 0.020 0.112
#> GSM1178989     3  0.5113     -0.225 0.000 0.000 0.576 0.044 0.380
#> GSM1178993     4  0.1121      0.744 0.000 0.000 0.044 0.956 0.000
#> GSM1178999     5  0.7021      0.569 0.000 0.008 0.332 0.284 0.376
#> GSM1179021     2  0.5048      0.372 0.000 0.580 0.000 0.380 0.040
#> GSM1179025     2  0.0000      0.838 0.000 1.000 0.000 0.000 0.000
#> GSM1179027     4  0.1124      0.742 0.000 0.000 0.036 0.960 0.004
#> GSM1179011     4  0.1331      0.743 0.000 0.000 0.040 0.952 0.008
#> GSM1179023     1  0.0290      0.758 0.992 0.000 0.000 0.000 0.008
#> GSM1179029     1  0.3171      0.724 0.816 0.000 0.000 0.008 0.176
#> GSM1179034     1  0.0290      0.758 0.992 0.000 0.000 0.000 0.008
#> GSM1179040     4  0.1243      0.713 0.000 0.004 0.008 0.960 0.028
#> GSM1178988     3  0.3639      0.498 0.000 0.000 0.792 0.024 0.184
#> GSM1179037     3  0.1571      0.690 0.004 0.000 0.936 0.000 0.060

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>            class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM1178971     3  0.4330    0.55221 0.036 0.000 0.680 0.000 0.008 0.276
#> GSM1178979     5  0.6153    0.56997 0.000 0.204 0.044 0.156 0.588 0.008
#> GSM1179009     4  0.3608    0.65094 0.000 0.000 0.128 0.800 0.004 0.068
#> GSM1179031     2  0.0000    0.86988 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1178970     5  0.6459    0.66798 0.000 0.156 0.108 0.120 0.600 0.016
#> GSM1178972     2  0.4076    0.25234 0.000 0.592 0.000 0.000 0.396 0.012
#> GSM1178973     1  0.6802   -0.02502 0.376 0.000 0.020 0.356 0.016 0.232
#> GSM1178974     2  0.0000    0.86988 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1178977     5  0.5486    0.57259 0.000 0.004 0.096 0.292 0.592 0.016
#> GSM1178978     3  0.6041    0.46369 0.000 0.000 0.592 0.188 0.056 0.164
#> GSM1178998     1  0.4482    0.12562 0.628 0.000 0.016 0.000 0.020 0.336
#> GSM1179010     6  0.6302    0.14624 0.364 0.000 0.148 0.000 0.036 0.452
#> GSM1179018     3  0.4822    0.55808 0.000 0.000 0.720 0.148 0.096 0.036
#> GSM1179024     1  0.0260    0.57648 0.992 0.000 0.000 0.000 0.000 0.008
#> GSM1178984     6  0.6439    0.24238 0.284 0.000 0.272 0.000 0.020 0.424
#> GSM1178990     1  0.0891    0.56587 0.968 0.000 0.000 0.000 0.008 0.024
#> GSM1178991     4  0.7782    0.33149 0.176 0.000 0.212 0.428 0.032 0.152
#> GSM1178994     3  0.6349   -0.16876 0.188 0.000 0.396 0.000 0.024 0.392
#> GSM1178997     3  0.5246    0.55857 0.020 0.000 0.640 0.000 0.104 0.236
#> GSM1179000     1  0.5616    0.13770 0.584 0.000 0.164 0.000 0.012 0.240
#> GSM1179013     1  0.0000    0.57877 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1179014     6  0.7805   -0.00706 0.212 0.000 0.180 0.008 0.296 0.304
#> GSM1179019     1  0.5411    0.18024 0.612 0.000 0.140 0.000 0.012 0.236
#> GSM1179020     1  0.2377    0.48917 0.868 0.000 0.004 0.000 0.004 0.124
#> GSM1179022     1  0.0146    0.57898 0.996 0.000 0.000 0.000 0.004 0.000
#> GSM1179028     2  0.0458    0.86206 0.000 0.984 0.000 0.000 0.000 0.016
#> GSM1179032     1  0.0146    0.57898 0.996 0.000 0.000 0.000 0.004 0.000
#> GSM1179041     2  0.0000    0.86988 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1179042     2  0.0000    0.86988 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1178976     5  0.4670    0.57534 0.000 0.008 0.352 0.024 0.608 0.008
#> GSM1178981     3  0.3589    0.62840 0.004 0.000 0.768 0.008 0.012 0.208
#> GSM1178982     3  0.2213    0.67574 0.000 0.000 0.908 0.012 0.032 0.048
#> GSM1178983     3  0.2593    0.67595 0.000 0.000 0.884 0.012 0.036 0.068
#> GSM1178985     3  0.1841    0.67605 0.000 0.000 0.920 0.008 0.008 0.064
#> GSM1178992     3  0.4838    0.61749 0.000 0.000 0.680 0.004 0.148 0.168
#> GSM1179005     3  0.5639    0.19744 0.212 0.000 0.536 0.000 0.000 0.252
#> GSM1179007     1  0.6101   -0.24291 0.488 0.000 0.188 0.000 0.016 0.308
#> GSM1179012     1  0.5170   -0.04492 0.512 0.000 0.028 0.000 0.036 0.424
#> GSM1179016     3  0.6268    0.11869 0.000 0.000 0.376 0.008 0.360 0.256
#> GSM1179030     3  0.3907    0.47698 0.000 0.000 0.704 0.000 0.268 0.028
#> GSM1179038     3  0.5371    0.47157 0.108 0.000 0.620 0.000 0.020 0.252
#> GSM1178987     3  0.3539    0.62645 0.000 0.000 0.768 0.008 0.016 0.208
#> GSM1179003     5  0.5861    0.71143 0.000 0.092 0.156 0.104 0.644 0.004
#> GSM1179004     3  0.3596    0.62051 0.000 0.000 0.760 0.008 0.016 0.216
#> GSM1179039     2  0.0000    0.86988 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1178975     4  0.6846    0.45415 0.104 0.000 0.096 0.536 0.024 0.240
#> GSM1178980     4  0.1938    0.72532 0.000 0.000 0.008 0.920 0.052 0.020
#> GSM1178995     3  0.5908    0.00334 0.248 0.000 0.468 0.000 0.000 0.284
#> GSM1178996     3  0.3372    0.65020 0.000 0.000 0.816 0.000 0.084 0.100
#> GSM1179001     6  0.4825   -0.01146 0.460 0.000 0.028 0.004 0.008 0.500
#> GSM1179002     6  0.5140    0.07469 0.424 0.000 0.052 0.004 0.008 0.512
#> GSM1179006     3  0.2968    0.64162 0.000 0.000 0.852 0.004 0.092 0.052
#> GSM1179008     1  0.4619   -0.12474 0.504 0.000 0.016 0.004 0.008 0.468
#> GSM1179015     1  0.4539    0.25619 0.644 0.000 0.004 0.000 0.048 0.304
#> GSM1179017     5  0.4599    0.47342 0.000 0.004 0.112 0.012 0.732 0.140
#> GSM1179026     3  0.3782    0.63230 0.000 0.000 0.784 0.004 0.140 0.072
#> GSM1179033     3  0.1995    0.66847 0.000 0.000 0.912 0.000 0.052 0.036
#> GSM1179035     3  0.3264    0.64278 0.000 0.000 0.796 0.008 0.012 0.184
#> GSM1179036     3  0.4075    0.63576 0.000 0.000 0.740 0.000 0.076 0.184
#> GSM1178986     3  0.4148    0.61707 0.000 0.000 0.744 0.000 0.108 0.148
#> GSM1178989     5  0.4047    0.46378 0.000 0.000 0.384 0.000 0.604 0.012
#> GSM1178993     4  0.0458    0.75626 0.000 0.000 0.016 0.984 0.000 0.000
#> GSM1178999     5  0.5528    0.67948 0.000 0.004 0.160 0.192 0.628 0.016
#> GSM1179021     2  0.5880    0.17084 0.000 0.476 0.000 0.384 0.120 0.020
#> GSM1179025     2  0.0000    0.86988 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1179027     4  0.0767    0.75446 0.000 0.000 0.012 0.976 0.004 0.008
#> GSM1179011     4  0.1232    0.75469 0.000 0.000 0.024 0.956 0.004 0.016
#> GSM1179023     1  0.0000    0.57877 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1179029     1  0.4705    0.30457 0.640 0.000 0.000 0.004 0.064 0.292
#> GSM1179034     1  0.0146    0.57898 0.996 0.000 0.000 0.000 0.004 0.000
#> GSM1179040     4  0.2492    0.67788 0.000 0.000 0.004 0.876 0.100 0.020
#> GSM1178988     3  0.3867    0.53315 0.000 0.000 0.744 0.004 0.216 0.036
#> GSM1179037     3  0.2604    0.67811 0.000 0.000 0.872 0.008 0.020 0.100

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

consensus_heatmap(res, k = 2)

plot of chunk tab-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) protocol(p) k
#> CV:kmeans 73            0.200     0.28085 2
#> CV:kmeans 69            0.166     0.01569 3
#> CV:kmeans 63            0.196     0.02918 4
#> CV:kmeans 54            0.123     0.00421 5
#> CV:kmeans 45            0.109     0.00226 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 31632 rows and 73 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.968           0.957       0.980         0.4867 0.521   0.521
#> 3 3 0.556           0.678       0.840         0.3106 0.852   0.721
#> 4 4 0.622           0.697       0.845         0.1413 0.827   0.583
#> 5 5 0.621           0.593       0.789         0.0624 0.941   0.785
#> 6 6 0.616           0.487       0.730         0.0406 0.980   0.914

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
#> GSM1178971     1  0.0000      0.969 1.000 0.000
#> GSM1178979     2  0.0000      0.995 0.000 1.000
#> GSM1179009     1  0.1843      0.951 0.972 0.028
#> GSM1179031     2  0.0000      0.995 0.000 1.000
#> GSM1178970     2  0.0000      0.995 0.000 1.000
#> GSM1178972     2  0.0000      0.995 0.000 1.000
#> GSM1178973     1  0.0000      0.969 1.000 0.000
#> GSM1178974     2  0.0000      0.995 0.000 1.000
#> GSM1178977     2  0.0000      0.995 0.000 1.000
#> GSM1178978     1  0.7139      0.775 0.804 0.196
#> GSM1178998     1  0.0000      0.969 1.000 0.000
#> GSM1179010     1  0.0000      0.969 1.000 0.000
#> GSM1179018     2  0.0672      0.989 0.008 0.992
#> GSM1179024     1  0.0000      0.969 1.000 0.000
#> GSM1178984     1  0.0000      0.969 1.000 0.000
#> GSM1178990     1  0.0000      0.969 1.000 0.000
#> GSM1178991     1  0.0000      0.969 1.000 0.000
#> GSM1178994     1  0.0000      0.969 1.000 0.000
#> GSM1178997     2  0.1414      0.978 0.020 0.980
#> GSM1179000     1  0.0000      0.969 1.000 0.000
#> GSM1179013     1  0.0000      0.969 1.000 0.000
#> GSM1179014     1  0.0000      0.969 1.000 0.000
#> GSM1179019     1  0.0000      0.969 1.000 0.000
#> GSM1179020     1  0.0000      0.969 1.000 0.000
#> GSM1179022     1  0.0000      0.969 1.000 0.000
#> GSM1179028     2  0.0000      0.995 0.000 1.000
#> GSM1179032     1  0.0000      0.969 1.000 0.000
#> GSM1179041     2  0.0000      0.995 0.000 1.000
#> GSM1179042     2  0.0000      0.995 0.000 1.000
#> GSM1178976     2  0.0000      0.995 0.000 1.000
#> GSM1178981     1  0.0000      0.969 1.000 0.000
#> GSM1178982     1  0.6531      0.812 0.832 0.168
#> GSM1178983     1  0.3114      0.929 0.944 0.056
#> GSM1178985     1  0.6973      0.782 0.812 0.188
#> GSM1178992     1  0.0000      0.969 1.000 0.000
#> GSM1179005     1  0.0000      0.969 1.000 0.000
#> GSM1179007     1  0.0000      0.969 1.000 0.000
#> GSM1179012     1  0.0000      0.969 1.000 0.000
#> GSM1179016     1  0.6531      0.804 0.832 0.168
#> GSM1179030     2  0.0000      0.995 0.000 1.000
#> GSM1179038     1  0.0000      0.969 1.000 0.000
#> GSM1178987     1  0.0000      0.969 1.000 0.000
#> GSM1179003     2  0.0000      0.995 0.000 1.000
#> GSM1179004     1  0.0000      0.969 1.000 0.000
#> GSM1179039     2  0.0000      0.995 0.000 1.000
#> GSM1178975     1  0.4022      0.907 0.920 0.080
#> GSM1178980     2  0.0000      0.995 0.000 1.000
#> GSM1178995     1  0.0000      0.969 1.000 0.000
#> GSM1178996     1  0.9686      0.360 0.604 0.396
#> GSM1179001     1  0.0000      0.969 1.000 0.000
#> GSM1179002     1  0.0000      0.969 1.000 0.000
#> GSM1179006     2  0.4161      0.907 0.084 0.916
#> GSM1179008     1  0.0000      0.969 1.000 0.000
#> GSM1179015     1  0.0000      0.969 1.000 0.000
#> GSM1179017     2  0.0000      0.995 0.000 1.000
#> GSM1179026     1  0.1633      0.954 0.976 0.024
#> GSM1179033     2  0.1184      0.982 0.016 0.984
#> GSM1179035     1  0.0000      0.969 1.000 0.000
#> GSM1179036     1  0.0672      0.964 0.992 0.008
#> GSM1178986     1  0.1633      0.953 0.976 0.024
#> GSM1178989     2  0.0000      0.995 0.000 1.000
#> GSM1178993     2  0.0000      0.995 0.000 1.000
#> GSM1178999     2  0.0000      0.995 0.000 1.000
#> GSM1179021     2  0.0000      0.995 0.000 1.000
#> GSM1179025     2  0.0000      0.995 0.000 1.000
#> GSM1179027     2  0.0000      0.995 0.000 1.000
#> GSM1179011     2  0.0672      0.989 0.008 0.992
#> GSM1179023     1  0.0000      0.969 1.000 0.000
#> GSM1179029     1  0.0000      0.969 1.000 0.000
#> GSM1179034     1  0.0000      0.969 1.000 0.000
#> GSM1179040     2  0.0000      0.995 0.000 1.000
#> GSM1178988     2  0.0000      0.995 0.000 1.000
#> GSM1179037     1  0.0000      0.969 1.000 0.000

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>            class entropy silhouette    p1    p2    p3
#> GSM1178971     1  0.4842     0.5448 0.776 0.000 0.224
#> GSM1178979     2  0.0000     0.8853 0.000 1.000 0.000
#> GSM1179009     3  0.4749     0.6610 0.172 0.012 0.816
#> GSM1179031     2  0.0000     0.8853 0.000 1.000 0.000
#> GSM1178970     2  0.0000     0.8853 0.000 1.000 0.000
#> GSM1178972     2  0.0000     0.8853 0.000 1.000 0.000
#> GSM1178973     1  0.6192    -0.0961 0.580 0.000 0.420
#> GSM1178974     2  0.0000     0.8853 0.000 1.000 0.000
#> GSM1178977     2  0.0424     0.8800 0.000 0.992 0.008
#> GSM1178978     3  0.6349     0.7087 0.140 0.092 0.768
#> GSM1178998     1  0.0747     0.7959 0.984 0.000 0.016
#> GSM1179010     1  0.4555     0.7186 0.800 0.000 0.200
#> GSM1179018     3  0.4399     0.5902 0.000 0.188 0.812
#> GSM1179024     1  0.0237     0.7947 0.996 0.000 0.004
#> GSM1178984     1  0.4750     0.7034 0.784 0.000 0.216
#> GSM1178990     1  0.0237     0.7947 0.996 0.000 0.004
#> GSM1178991     3  0.6359     0.4793 0.404 0.004 0.592
#> GSM1178994     1  0.4842     0.7043 0.776 0.000 0.224
#> GSM1178997     2  0.7979     0.3607 0.248 0.640 0.112
#> GSM1179000     1  0.0747     0.7894 0.984 0.000 0.016
#> GSM1179013     1  0.0237     0.7947 0.996 0.000 0.004
#> GSM1179014     1  0.0892     0.7928 0.980 0.000 0.020
#> GSM1179019     1  0.0237     0.7947 0.996 0.000 0.004
#> GSM1179020     1  0.0237     0.7947 0.996 0.000 0.004
#> GSM1179022     1  0.0237     0.7947 0.996 0.000 0.004
#> GSM1179028     2  0.0000     0.8853 0.000 1.000 0.000
#> GSM1179032     1  0.0237     0.7947 0.996 0.000 0.004
#> GSM1179041     2  0.0000     0.8853 0.000 1.000 0.000
#> GSM1179042     2  0.0000     0.8853 0.000 1.000 0.000
#> GSM1178976     2  0.0000     0.8853 0.000 1.000 0.000
#> GSM1178981     1  0.6309     0.3068 0.504 0.000 0.496
#> GSM1178982     3  0.5420     0.4505 0.240 0.008 0.752
#> GSM1178983     3  0.4960     0.6956 0.128 0.040 0.832
#> GSM1178985     3  0.8474     0.2599 0.252 0.144 0.604
#> GSM1178992     1  0.5760     0.6281 0.672 0.000 0.328
#> GSM1179005     1  0.3038     0.7725 0.896 0.000 0.104
#> GSM1179007     1  0.3116     0.7701 0.892 0.000 0.108
#> GSM1179012     1  0.3941     0.7448 0.844 0.000 0.156
#> GSM1179016     1  0.8172     0.4759 0.644 0.176 0.180
#> GSM1179030     2  0.0424     0.8811 0.000 0.992 0.008
#> GSM1179038     1  0.1529     0.7939 0.960 0.000 0.040
#> GSM1178987     1  0.6126     0.5538 0.600 0.000 0.400
#> GSM1179003     2  0.0000     0.8853 0.000 1.000 0.000
#> GSM1179004     1  0.6168     0.5376 0.588 0.000 0.412
#> GSM1179039     2  0.0000     0.8853 0.000 1.000 0.000
#> GSM1178975     3  0.6045     0.5166 0.380 0.000 0.620
#> GSM1178980     2  0.6302    -0.1021 0.000 0.520 0.480
#> GSM1178995     1  0.1411     0.7932 0.964 0.000 0.036
#> GSM1178996     1  0.9187     0.2476 0.532 0.272 0.196
#> GSM1179001     1  0.0000     0.7952 1.000 0.000 0.000
#> GSM1179002     1  0.0237     0.7955 0.996 0.000 0.004
#> GSM1179006     2  0.7798     0.4310 0.080 0.624 0.296
#> GSM1179008     1  0.0000     0.7952 1.000 0.000 0.000
#> GSM1179015     1  0.1163     0.7950 0.972 0.000 0.028
#> GSM1179017     2  0.1753     0.8531 0.000 0.952 0.048
#> GSM1179026     1  0.7841     0.5227 0.576 0.064 0.360
#> GSM1179033     2  0.6937     0.3634 0.020 0.576 0.404
#> GSM1179035     1  0.6045     0.5765 0.620 0.000 0.380
#> GSM1179036     1  0.5480     0.6767 0.732 0.004 0.264
#> GSM1178986     1  0.7948     0.2326 0.520 0.060 0.420
#> GSM1178989     2  0.2878     0.8132 0.000 0.904 0.096
#> GSM1178993     3  0.5835     0.4641 0.000 0.340 0.660
#> GSM1178999     2  0.0000     0.8853 0.000 1.000 0.000
#> GSM1179021     2  0.0000     0.8853 0.000 1.000 0.000
#> GSM1179025     2  0.0000     0.8853 0.000 1.000 0.000
#> GSM1179027     3  0.5968     0.4213 0.000 0.364 0.636
#> GSM1179011     3  0.8043     0.6187 0.128 0.228 0.644
#> GSM1179023     1  0.0237     0.7947 0.996 0.000 0.004
#> GSM1179029     1  0.0424     0.7953 0.992 0.000 0.008
#> GSM1179034     1  0.0237     0.7947 0.996 0.000 0.004
#> GSM1179040     2  0.3551     0.7523 0.000 0.868 0.132
#> GSM1178988     2  0.4702     0.6871 0.000 0.788 0.212
#> GSM1179037     1  0.6062     0.5729 0.616 0.000 0.384

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>            class entropy silhouette    p1    p2    p3    p4
#> GSM1178971     1  0.5719     0.5801 0.716 0.000 0.132 0.152
#> GSM1178979     2  0.0000     0.9052 0.000 1.000 0.000 0.000
#> GSM1179009     4  0.1151     0.7458 0.024 0.000 0.008 0.968
#> GSM1179031     2  0.0000     0.9052 0.000 1.000 0.000 0.000
#> GSM1178970     2  0.0000     0.9052 0.000 1.000 0.000 0.000
#> GSM1178972     2  0.0000     0.9052 0.000 1.000 0.000 0.000
#> GSM1178973     4  0.4994     0.1468 0.480 0.000 0.000 0.520
#> GSM1178974     2  0.0000     0.9052 0.000 1.000 0.000 0.000
#> GSM1178977     2  0.1474     0.8750 0.000 0.948 0.000 0.052
#> GSM1178978     4  0.2706     0.7188 0.020 0.000 0.080 0.900
#> GSM1178998     1  0.1474     0.8425 0.948 0.000 0.052 0.000
#> GSM1179010     1  0.5587     0.3354 0.600 0.000 0.372 0.028
#> GSM1179018     4  0.4879     0.6588 0.000 0.092 0.128 0.780
#> GSM1179024     1  0.0188     0.8510 0.996 0.000 0.004 0.000
#> GSM1178984     1  0.5519     0.5401 0.684 0.000 0.264 0.052
#> GSM1178990     1  0.0469     0.8525 0.988 0.000 0.012 0.000
#> GSM1178991     4  0.4664     0.5957 0.248 0.004 0.012 0.736
#> GSM1178994     1  0.5999     0.1882 0.552 0.000 0.404 0.044
#> GSM1178997     2  0.8852     0.0229 0.332 0.436 0.108 0.124
#> GSM1179000     1  0.1767     0.8304 0.944 0.000 0.044 0.012
#> GSM1179013     1  0.0000     0.8520 1.000 0.000 0.000 0.000
#> GSM1179014     1  0.3583     0.7013 0.816 0.000 0.180 0.004
#> GSM1179019     1  0.1452     0.8372 0.956 0.000 0.036 0.008
#> GSM1179020     1  0.0657     0.8490 0.984 0.000 0.012 0.004
#> GSM1179022     1  0.0000     0.8520 1.000 0.000 0.000 0.000
#> GSM1179028     2  0.0000     0.9052 0.000 1.000 0.000 0.000
#> GSM1179032     1  0.0000     0.8520 1.000 0.000 0.000 0.000
#> GSM1179041     2  0.0000     0.9052 0.000 1.000 0.000 0.000
#> GSM1179042     2  0.0000     0.9052 0.000 1.000 0.000 0.000
#> GSM1178976     2  0.0188     0.9035 0.000 0.996 0.000 0.004
#> GSM1178981     3  0.6878     0.4529 0.316 0.000 0.556 0.128
#> GSM1178982     4  0.7381     0.1075 0.180 0.000 0.328 0.492
#> GSM1178983     4  0.4464     0.6847 0.060 0.004 0.124 0.812
#> GSM1178985     3  0.6434     0.6027 0.128 0.028 0.700 0.144
#> GSM1178992     3  0.4647     0.5793 0.288 0.000 0.704 0.008
#> GSM1179005     1  0.4319     0.6627 0.760 0.000 0.228 0.012
#> GSM1179007     1  0.3052     0.7837 0.860 0.000 0.136 0.004
#> GSM1179012     1  0.4290     0.6821 0.772 0.000 0.212 0.016
#> GSM1179016     3  0.6085     0.4300 0.356 0.040 0.596 0.008
#> GSM1179030     2  0.1209     0.8885 0.000 0.964 0.032 0.004
#> GSM1179038     1  0.2973     0.7866 0.856 0.000 0.144 0.000
#> GSM1178987     3  0.3958     0.6654 0.112 0.000 0.836 0.052
#> GSM1179003     2  0.0000     0.9052 0.000 1.000 0.000 0.000
#> GSM1179004     3  0.4227     0.6628 0.120 0.000 0.820 0.060
#> GSM1179039     2  0.0000     0.9052 0.000 1.000 0.000 0.000
#> GSM1178975     4  0.3052     0.7112 0.136 0.000 0.004 0.860
#> GSM1178980     4  0.4304     0.5457 0.000 0.284 0.000 0.716
#> GSM1178995     1  0.2704     0.7978 0.876 0.000 0.124 0.000
#> GSM1178996     3  0.6896     0.5399 0.196 0.116 0.656 0.032
#> GSM1179001     1  0.1151     0.8507 0.968 0.000 0.024 0.008
#> GSM1179002     1  0.1890     0.8459 0.936 0.000 0.056 0.008
#> GSM1179006     3  0.5457     0.4495 0.016 0.292 0.676 0.016
#> GSM1179008     1  0.0927     0.8513 0.976 0.000 0.016 0.008
#> GSM1179015     1  0.3052     0.7980 0.860 0.000 0.136 0.004
#> GSM1179017     2  0.2868     0.8029 0.000 0.864 0.136 0.000
#> GSM1179026     3  0.1767     0.6442 0.044 0.000 0.944 0.012
#> GSM1179033     3  0.6290     0.4656 0.016 0.256 0.660 0.068
#> GSM1179035     3  0.3653     0.6698 0.128 0.000 0.844 0.028
#> GSM1179036     3  0.6038     0.2482 0.424 0.000 0.532 0.044
#> GSM1178986     3  0.9205     0.2609 0.328 0.080 0.356 0.236
#> GSM1178989     2  0.3257     0.7777 0.000 0.844 0.152 0.004
#> GSM1178993     4  0.1302     0.7430 0.000 0.044 0.000 0.956
#> GSM1178999     2  0.1151     0.8928 0.000 0.968 0.008 0.024
#> GSM1179021     2  0.0921     0.8920 0.000 0.972 0.000 0.028
#> GSM1179025     2  0.0000     0.9052 0.000 1.000 0.000 0.000
#> GSM1179027     4  0.1637     0.7384 0.000 0.060 0.000 0.940
#> GSM1179011     4  0.1820     0.7490 0.036 0.020 0.000 0.944
#> GSM1179023     1  0.0000     0.8520 1.000 0.000 0.000 0.000
#> GSM1179029     1  0.1356     0.8490 0.960 0.000 0.032 0.008
#> GSM1179034     1  0.0000     0.8520 1.000 0.000 0.000 0.000
#> GSM1179040     2  0.4454     0.5153 0.000 0.692 0.000 0.308
#> GSM1178988     2  0.5329     0.2816 0.000 0.568 0.420 0.012
#> GSM1179037     3  0.1970     0.6567 0.060 0.000 0.932 0.008

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>            class entropy silhouette    p1    p2    p3    p4    p5
#> GSM1178971     1  0.7446     0.3037 0.520 0.000 0.228 0.116 0.136
#> GSM1178979     2  0.0000     0.8747 0.000 1.000 0.000 0.000 0.000
#> GSM1179009     4  0.1768     0.6858 0.000 0.000 0.004 0.924 0.072
#> GSM1179031     2  0.0000     0.8747 0.000 1.000 0.000 0.000 0.000
#> GSM1178970     2  0.0000     0.8747 0.000 1.000 0.000 0.000 0.000
#> GSM1178972     2  0.0000     0.8747 0.000 1.000 0.000 0.000 0.000
#> GSM1178973     4  0.5180     0.0330 0.476 0.000 0.020 0.492 0.012
#> GSM1178974     2  0.0000     0.8747 0.000 1.000 0.000 0.000 0.000
#> GSM1178977     2  0.1864     0.8322 0.000 0.924 0.004 0.068 0.004
#> GSM1178978     4  0.5185     0.4072 0.004 0.000 0.040 0.580 0.376
#> GSM1178998     1  0.3883     0.7211 0.780 0.000 0.036 0.000 0.184
#> GSM1179010     5  0.5276     0.0862 0.436 0.000 0.048 0.000 0.516
#> GSM1179018     4  0.6455     0.5275 0.000 0.084 0.124 0.640 0.152
#> GSM1179024     1  0.0404     0.8156 0.988 0.000 0.012 0.000 0.000
#> GSM1178984     1  0.5224     0.1788 0.532 0.000 0.036 0.004 0.428
#> GSM1178990     1  0.1357     0.8135 0.948 0.000 0.004 0.000 0.048
#> GSM1178991     4  0.6054     0.4758 0.224 0.000 0.080 0.644 0.052
#> GSM1178994     5  0.4996     0.1814 0.420 0.000 0.032 0.000 0.548
#> GSM1178997     2  0.9094    -0.2983 0.256 0.312 0.252 0.140 0.040
#> GSM1179000     1  0.2420     0.7835 0.896 0.000 0.088 0.008 0.008
#> GSM1179013     1  0.0000     0.8155 1.000 0.000 0.000 0.000 0.000
#> GSM1179014     1  0.4638     0.4445 0.648 0.000 0.324 0.000 0.028
#> GSM1179019     1  0.1768     0.8048 0.924 0.000 0.072 0.000 0.004
#> GSM1179020     1  0.0703     0.8153 0.976 0.000 0.024 0.000 0.000
#> GSM1179022     1  0.0162     0.8158 0.996 0.000 0.004 0.000 0.000
#> GSM1179028     2  0.0000     0.8747 0.000 1.000 0.000 0.000 0.000
#> GSM1179032     1  0.0162     0.8158 0.996 0.000 0.004 0.000 0.000
#> GSM1179041     2  0.0000     0.8747 0.000 1.000 0.000 0.000 0.000
#> GSM1179042     2  0.0000     0.8747 0.000 1.000 0.000 0.000 0.000
#> GSM1178976     2  0.0162     0.8732 0.000 0.996 0.004 0.000 0.000
#> GSM1178981     5  0.3981     0.5130 0.120 0.000 0.032 0.032 0.816
#> GSM1178982     5  0.6987     0.3350 0.120 0.000 0.092 0.216 0.572
#> GSM1178983     4  0.6911     0.4135 0.064 0.008 0.088 0.556 0.284
#> GSM1178985     5  0.4914     0.4287 0.036 0.004 0.144 0.056 0.760
#> GSM1178992     3  0.6642     0.0613 0.232 0.000 0.428 0.000 0.340
#> GSM1179005     1  0.5120     0.6215 0.700 0.000 0.104 0.004 0.192
#> GSM1179007     1  0.3868     0.7423 0.800 0.000 0.060 0.000 0.140
#> GSM1179012     1  0.4527     0.5814 0.692 0.000 0.036 0.000 0.272
#> GSM1179016     3  0.5361     0.4140 0.188 0.016 0.696 0.000 0.100
#> GSM1179030     2  0.3427     0.7751 0.000 0.848 0.104 0.016 0.032
#> GSM1179038     1  0.4949     0.6716 0.728 0.000 0.164 0.008 0.100
#> GSM1178987     5  0.3018     0.5119 0.036 0.000 0.084 0.008 0.872
#> GSM1179003     2  0.0404     0.8701 0.000 0.988 0.012 0.000 0.000
#> GSM1179004     5  0.2632     0.5128 0.032 0.000 0.072 0.004 0.892
#> GSM1179039     2  0.0000     0.8747 0.000 1.000 0.000 0.000 0.000
#> GSM1178975     4  0.4036     0.6238 0.132 0.000 0.052 0.804 0.012
#> GSM1178980     4  0.3353     0.5479 0.000 0.196 0.008 0.796 0.000
#> GSM1178995     1  0.3946     0.7538 0.800 0.000 0.080 0.000 0.120
#> GSM1178996     3  0.5383     0.4316 0.072 0.044 0.728 0.004 0.152
#> GSM1179001     1  0.3476     0.7835 0.836 0.000 0.088 0.000 0.076
#> GSM1179002     1  0.4307     0.7478 0.772 0.000 0.100 0.000 0.128
#> GSM1179006     3  0.5891     0.4187 0.000 0.216 0.616 0.004 0.164
#> GSM1179008     1  0.2376     0.8073 0.904 0.000 0.044 0.000 0.052
#> GSM1179015     1  0.3354     0.7804 0.844 0.000 0.068 0.000 0.088
#> GSM1179017     2  0.4354     0.3900 0.000 0.624 0.368 0.000 0.008
#> GSM1179026     3  0.4536     0.2951 0.016 0.004 0.656 0.000 0.324
#> GSM1179033     3  0.7392     0.2903 0.000 0.192 0.436 0.048 0.324
#> GSM1179035     5  0.4788     0.3756 0.064 0.000 0.240 0.000 0.696
#> GSM1179036     3  0.7407     0.2270 0.264 0.000 0.480 0.060 0.196
#> GSM1178986     3  0.8449     0.1898 0.240 0.012 0.412 0.176 0.160
#> GSM1178989     2  0.3906     0.7003 0.000 0.800 0.132 0.000 0.068
#> GSM1178993     4  0.0162     0.6944 0.000 0.000 0.000 0.996 0.004
#> GSM1178999     2  0.2514     0.8229 0.000 0.896 0.044 0.060 0.000
#> GSM1179021     2  0.1908     0.8202 0.000 0.908 0.000 0.092 0.000
#> GSM1179025     2  0.0000     0.8747 0.000 1.000 0.000 0.000 0.000
#> GSM1179027     4  0.0324     0.6945 0.000 0.004 0.000 0.992 0.004
#> GSM1179011     4  0.0162     0.6939 0.000 0.000 0.004 0.996 0.000
#> GSM1179023     1  0.0290     0.8159 0.992 0.000 0.008 0.000 0.000
#> GSM1179029     1  0.2754     0.7947 0.880 0.000 0.080 0.000 0.040
#> GSM1179034     1  0.0000     0.8155 1.000 0.000 0.000 0.000 0.000
#> GSM1179040     2  0.4182     0.3544 0.000 0.600 0.000 0.400 0.000
#> GSM1178988     3  0.6481     0.1947 0.000 0.408 0.408 0.000 0.184
#> GSM1179037     5  0.4341     0.1256 0.008 0.000 0.364 0.000 0.628

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>            class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM1178971     1  0.7322     0.0631 0.420 0.000 0.104 0.060 0.352 0.064
#> GSM1178979     2  0.0000     0.8527 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1179009     4  0.3252     0.6311 0.020 0.000 0.012 0.856 0.040 0.072
#> GSM1179031     2  0.0000     0.8527 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1178970     2  0.0508     0.8479 0.000 0.984 0.004 0.000 0.012 0.000
#> GSM1178972     2  0.0146     0.8514 0.000 0.996 0.000 0.000 0.004 0.000
#> GSM1178973     1  0.5764     0.1926 0.504 0.000 0.004 0.360 0.124 0.008
#> GSM1178974     2  0.0000     0.8527 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1178977     2  0.2776     0.7533 0.000 0.860 0.004 0.104 0.032 0.000
#> GSM1178978     4  0.6805     0.1992 0.032 0.008 0.012 0.428 0.152 0.368
#> GSM1178998     1  0.4239     0.5998 0.736 0.000 0.012 0.000 0.056 0.196
#> GSM1179010     6  0.5191    -0.0837 0.448 0.000 0.032 0.000 0.032 0.488
#> GSM1179018     4  0.6382     0.4929 0.000 0.052 0.068 0.628 0.096 0.156
#> GSM1179024     1  0.1232     0.6775 0.956 0.000 0.016 0.000 0.024 0.004
#> GSM1178984     1  0.5358     0.1601 0.504 0.000 0.012 0.000 0.076 0.408
#> GSM1178990     1  0.2318     0.6868 0.904 0.000 0.020 0.000 0.048 0.028
#> GSM1178991     4  0.7278     0.1030 0.304 0.000 0.048 0.448 0.148 0.052
#> GSM1178994     6  0.5149     0.1513 0.388 0.000 0.020 0.000 0.048 0.544
#> GSM1178997     5  0.8725     0.0000 0.204 0.244 0.152 0.052 0.324 0.024
#> GSM1179000     1  0.4947     0.4997 0.716 0.000 0.096 0.016 0.156 0.016
#> GSM1179013     1  0.0622     0.6806 0.980 0.000 0.008 0.000 0.012 0.000
#> GSM1179014     1  0.6578    -0.1023 0.444 0.000 0.340 0.012 0.180 0.024
#> GSM1179019     1  0.3434     0.6100 0.820 0.000 0.032 0.004 0.132 0.012
#> GSM1179020     1  0.1682     0.6776 0.928 0.000 0.020 0.000 0.052 0.000
#> GSM1179022     1  0.0146     0.6810 0.996 0.000 0.000 0.000 0.004 0.000
#> GSM1179028     2  0.0000     0.8527 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1179032     1  0.0000     0.6814 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1179041     2  0.0000     0.8527 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1179042     2  0.0000     0.8527 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1178976     2  0.1003     0.8374 0.000 0.964 0.016 0.000 0.020 0.000
#> GSM1178981     6  0.4143     0.4953 0.124 0.000 0.004 0.020 0.072 0.780
#> GSM1178982     6  0.7760     0.2610 0.132 0.004 0.048 0.180 0.160 0.476
#> GSM1178983     4  0.7799     0.2409 0.076 0.004 0.040 0.396 0.216 0.268
#> GSM1178985     6  0.5537     0.3638 0.020 0.008 0.084 0.032 0.168 0.688
#> GSM1178992     3  0.7187     0.1033 0.204 0.000 0.428 0.000 0.120 0.248
#> GSM1179005     1  0.5995     0.4404 0.592 0.000 0.056 0.000 0.136 0.216
#> GSM1179007     1  0.4453     0.6145 0.744 0.000 0.024 0.000 0.080 0.152
#> GSM1179012     1  0.5225     0.4237 0.612 0.000 0.040 0.000 0.048 0.300
#> GSM1179016     3  0.4451     0.2799 0.092 0.000 0.748 0.000 0.136 0.024
#> GSM1179030     2  0.5065     0.5934 0.000 0.732 0.124 0.024 0.080 0.040
#> GSM1179038     1  0.6472     0.4750 0.572 0.000 0.172 0.008 0.172 0.076
#> GSM1178987     6  0.3406     0.4683 0.012 0.000 0.072 0.004 0.076 0.836
#> GSM1179003     2  0.0717     0.8440 0.000 0.976 0.016 0.000 0.008 0.000
#> GSM1179004     6  0.2419     0.4860 0.016 0.000 0.060 0.000 0.028 0.896
#> GSM1179039     2  0.0000     0.8527 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1178975     4  0.4891     0.4726 0.108 0.000 0.012 0.696 0.180 0.004
#> GSM1178980     4  0.3430     0.4413 0.000 0.208 0.004 0.772 0.016 0.000
#> GSM1178995     1  0.5446     0.5622 0.652 0.000 0.020 0.008 0.192 0.128
#> GSM1178996     3  0.5734     0.3048 0.024 0.020 0.596 0.004 0.296 0.060
#> GSM1179001     1  0.5409     0.5351 0.624 0.000 0.040 0.000 0.260 0.076
#> GSM1179002     1  0.6031     0.4804 0.564 0.000 0.044 0.000 0.256 0.136
#> GSM1179006     3  0.6905     0.3191 0.008 0.112 0.560 0.012 0.144 0.164
#> GSM1179008     1  0.4498     0.6276 0.736 0.000 0.012 0.008 0.176 0.068
#> GSM1179015     1  0.5235     0.5993 0.692 0.000 0.120 0.000 0.056 0.132
#> GSM1179017     2  0.4697     0.1268 0.000 0.548 0.404 0.000 0.048 0.000
#> GSM1179026     3  0.4327     0.3818 0.008 0.004 0.732 0.004 0.044 0.208
#> GSM1179033     3  0.8272     0.2274 0.012 0.116 0.336 0.036 0.252 0.248
#> GSM1179035     6  0.5309     0.3295 0.044 0.000 0.268 0.000 0.060 0.628
#> GSM1179036     3  0.7669     0.2279 0.128 0.000 0.428 0.060 0.292 0.092
#> GSM1178986     3  0.8201     0.0217 0.172 0.024 0.440 0.068 0.216 0.080
#> GSM1178989     2  0.4992     0.5142 0.000 0.696 0.184 0.000 0.080 0.040
#> GSM1178993     4  0.0520     0.6499 0.000 0.008 0.000 0.984 0.008 0.000
#> GSM1178999     2  0.3413     0.7336 0.000 0.828 0.052 0.104 0.016 0.000
#> GSM1179021     2  0.2558     0.7224 0.000 0.840 0.000 0.156 0.004 0.000
#> GSM1179025     2  0.0000     0.8527 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1179027     4  0.0622     0.6491 0.000 0.012 0.000 0.980 0.008 0.000
#> GSM1179011     4  0.0363     0.6480 0.000 0.000 0.000 0.988 0.012 0.000
#> GSM1179023     1  0.0260     0.6813 0.992 0.000 0.000 0.000 0.008 0.000
#> GSM1179029     1  0.4914     0.6156 0.716 0.000 0.112 0.000 0.132 0.040
#> GSM1179034     1  0.0146     0.6821 0.996 0.000 0.000 0.000 0.004 0.000
#> GSM1179040     2  0.4161     0.1813 0.000 0.540 0.000 0.448 0.012 0.000
#> GSM1178988     3  0.7072    -0.0264 0.000 0.352 0.380 0.000 0.104 0.164
#> GSM1179037     6  0.5743     0.0505 0.024 0.000 0.372 0.004 0.084 0.516

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) protocol(p) k
#> CV:skmeans 72           0.0509       0.458 2
#> CV:skmeans 59           0.1319       0.560 3
#> CV:skmeans 61           0.0887       0.266 4
#> CV:skmeans 48           0.1068       0.164 5
#> CV:skmeans 37           0.1603       0.148 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 31632 rows and 73 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 3.
#> 
#> Following methods can be applied to this 'ConsensusPartition' object:
#>  [1] "cola_report"             "collect_classes"         "collect_plots"          
#>  [4] "collect_stats"           "colnames"                "compare_signatures"     
#>  [7] "consensus_heatmap"       "dimension_reduction"     "functional_enrichment"  
#> [10] "get_anno_col"            "get_anno"                "get_classes"            
#> [13] "get_consensus"           "get_matrix"              "get_membership"         
#> [16] "get_param"               "get_signatures"          "get_stats"              
#> [19] "is_best_k"               "is_stable_k"             "membership_heatmap"     
#> [22] "ncol"                    "nrow"                    "plot_ecdf"              
#> [25] "rownames"                "select_partition_number" "show"                   
#> [28] "suggest_best_k"          "test_to_known_factors"

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

collect_plots(res)

plot of chunk CV-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.757           0.833       0.935         0.3241 0.703   0.703
#> 3 3 0.555           0.788       0.890         0.6767 0.635   0.524
#> 4 4 0.549           0.371       0.661         0.1780 0.769   0.520
#> 5 5 0.632           0.753       0.851         0.1641 0.747   0.337
#> 6 6 0.644           0.609       0.798         0.0496 0.949   0.802

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
#> GSM1178971     1  0.0000    0.93097 1.000 0.000
#> GSM1178979     2  0.6887    0.74173 0.184 0.816
#> GSM1179009     1  0.0376    0.92836 0.996 0.004
#> GSM1179031     2  0.0000    0.88091 0.000 1.000
#> GSM1178970     2  0.8813    0.57948 0.300 0.700
#> GSM1178972     2  0.0000    0.88091 0.000 1.000
#> GSM1178973     1  0.0000    0.93097 1.000 0.000
#> GSM1178974     2  0.0000    0.88091 0.000 1.000
#> GSM1178977     1  0.9686    0.32600 0.604 0.396
#> GSM1178978     1  0.0376    0.92837 0.996 0.004
#> GSM1178998     1  0.0000    0.93097 1.000 0.000
#> GSM1179010     1  0.0000    0.93097 1.000 0.000
#> GSM1179018     1  0.7674    0.68141 0.776 0.224
#> GSM1179024     1  0.0000    0.93097 1.000 0.000
#> GSM1178984     1  0.0000    0.93097 1.000 0.000
#> GSM1178990     1  0.0000    0.93097 1.000 0.000
#> GSM1178991     1  0.0376    0.92829 0.996 0.004
#> GSM1178994     1  0.0000    0.93097 1.000 0.000
#> GSM1178997     1  0.0000    0.93097 1.000 0.000
#> GSM1179000     1  0.0000    0.93097 1.000 0.000
#> GSM1179013     1  0.0000    0.93097 1.000 0.000
#> GSM1179014     1  0.0000    0.93097 1.000 0.000
#> GSM1179019     1  0.0000    0.93097 1.000 0.000
#> GSM1179020     1  0.0000    0.93097 1.000 0.000
#> GSM1179022     1  0.0000    0.93097 1.000 0.000
#> GSM1179028     2  0.0000    0.88091 0.000 1.000
#> GSM1179032     1  0.0000    0.93097 1.000 0.000
#> GSM1179041     2  0.0000    0.88091 0.000 1.000
#> GSM1179042     2  0.0000    0.88091 0.000 1.000
#> GSM1178976     2  0.9998    0.00802 0.492 0.508
#> GSM1178981     1  0.0000    0.93097 1.000 0.000
#> GSM1178982     1  0.0000    0.93097 1.000 0.000
#> GSM1178983     1  0.0000    0.93097 1.000 0.000
#> GSM1178985     1  0.0000    0.93097 1.000 0.000
#> GSM1178992     1  0.0000    0.93097 1.000 0.000
#> GSM1179005     1  0.0000    0.93097 1.000 0.000
#> GSM1179007     1  0.0000    0.93097 1.000 0.000
#> GSM1179012     1  0.0000    0.93097 1.000 0.000
#> GSM1179016     1  0.3733    0.86984 0.928 0.072
#> GSM1179030     1  0.8499    0.59605 0.724 0.276
#> GSM1179038     1  0.0000    0.93097 1.000 0.000
#> GSM1178987     1  0.0000    0.93097 1.000 0.000
#> GSM1179003     2  0.8499    0.62191 0.276 0.724
#> GSM1179004     1  0.0000    0.93097 1.000 0.000
#> GSM1179039     2  0.0000    0.88091 0.000 1.000
#> GSM1178975     1  0.0000    0.93097 1.000 0.000
#> GSM1178980     1  0.9580    0.36913 0.620 0.380
#> GSM1178995     1  0.0000    0.93097 1.000 0.000
#> GSM1178996     1  0.0000    0.93097 1.000 0.000
#> GSM1179001     1  0.0000    0.93097 1.000 0.000
#> GSM1179002     1  0.0000    0.93097 1.000 0.000
#> GSM1179006     1  0.0376    0.92836 0.996 0.004
#> GSM1179008     1  0.0000    0.93097 1.000 0.000
#> GSM1179015     1  0.0000    0.93097 1.000 0.000
#> GSM1179017     1  0.9815    0.25456 0.580 0.420
#> GSM1179026     1  0.0000    0.93097 1.000 0.000
#> GSM1179033     1  0.0000    0.93097 1.000 0.000
#> GSM1179035     1  0.0000    0.93097 1.000 0.000
#> GSM1179036     1  0.0000    0.93097 1.000 0.000
#> GSM1178986     1  0.0000    0.93097 1.000 0.000
#> GSM1178989     1  0.9552    0.37822 0.624 0.376
#> GSM1178993     1  0.4298    0.85467 0.912 0.088
#> GSM1178999     1  0.9795    0.26718 0.584 0.416
#> GSM1179021     2  0.0000    0.88091 0.000 1.000
#> GSM1179025     2  0.0000    0.88091 0.000 1.000
#> GSM1179027     1  0.4562    0.84649 0.904 0.096
#> GSM1179011     1  0.1184    0.91914 0.984 0.016
#> GSM1179023     1  0.0000    0.93097 1.000 0.000
#> GSM1179029     1  0.0000    0.93097 1.000 0.000
#> GSM1179034     1  0.0000    0.93097 1.000 0.000
#> GSM1179040     1  0.9881    0.20235 0.564 0.436
#> GSM1178988     1  0.8555    0.58791 0.720 0.280
#> GSM1179037     1  0.0000    0.93097 1.000 0.000

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>            class entropy silhouette    p1    p2    p3
#> GSM1178971     3  0.4235      0.814 0.176 0.000 0.824
#> GSM1178979     3  0.5216      0.614 0.000 0.260 0.740
#> GSM1179009     3  0.5810      0.655 0.336 0.000 0.664
#> GSM1179031     2  0.0000      0.999 0.000 1.000 0.000
#> GSM1178970     3  0.0000      0.836 0.000 0.000 1.000
#> GSM1178972     2  0.0237      0.996 0.000 0.996 0.004
#> GSM1178973     1  0.0000      0.863 1.000 0.000 0.000
#> GSM1178974     2  0.0000      0.999 0.000 1.000 0.000
#> GSM1178977     3  0.0000      0.836 0.000 0.000 1.000
#> GSM1178978     3  0.4121      0.799 0.168 0.000 0.832
#> GSM1178998     1  0.0000      0.863 1.000 0.000 0.000
#> GSM1179010     1  0.6274     -0.163 0.544 0.000 0.456
#> GSM1179018     3  0.0000      0.836 0.000 0.000 1.000
#> GSM1179024     1  0.0000      0.863 1.000 0.000 0.000
#> GSM1178984     3  0.5835      0.650 0.340 0.000 0.660
#> GSM1178990     1  0.0000      0.863 1.000 0.000 0.000
#> GSM1178991     1  0.5968      0.390 0.636 0.000 0.364
#> GSM1178994     3  0.5835      0.650 0.340 0.000 0.660
#> GSM1178997     3  0.1964      0.846 0.056 0.000 0.944
#> GSM1179000     1  0.6111      0.173 0.604 0.000 0.396
#> GSM1179013     1  0.0000      0.863 1.000 0.000 0.000
#> GSM1179014     3  0.6235      0.357 0.436 0.000 0.564
#> GSM1179019     1  0.4974      0.604 0.764 0.000 0.236
#> GSM1179020     1  0.0000      0.863 1.000 0.000 0.000
#> GSM1179022     1  0.0000      0.863 1.000 0.000 0.000
#> GSM1179028     2  0.0000      0.999 0.000 1.000 0.000
#> GSM1179032     1  0.0000      0.863 1.000 0.000 0.000
#> GSM1179041     2  0.0000      0.999 0.000 1.000 0.000
#> GSM1179042     2  0.0000      0.999 0.000 1.000 0.000
#> GSM1178976     3  0.0000      0.836 0.000 0.000 1.000
#> GSM1178981     3  0.5810      0.655 0.336 0.000 0.664
#> GSM1178982     3  0.3619      0.833 0.136 0.000 0.864
#> GSM1178983     3  0.0592      0.840 0.012 0.000 0.988
#> GSM1178985     3  0.2165      0.845 0.064 0.000 0.936
#> GSM1178992     3  0.4654      0.790 0.208 0.000 0.792
#> GSM1179005     3  0.5465      0.714 0.288 0.000 0.712
#> GSM1179007     3  0.5835      0.650 0.340 0.000 0.660
#> GSM1179012     1  0.0000      0.863 1.000 0.000 0.000
#> GSM1179016     3  0.0424      0.839 0.008 0.000 0.992
#> GSM1179030     3  0.0424      0.839 0.008 0.000 0.992
#> GSM1179038     3  0.4750      0.784 0.216 0.000 0.784
#> GSM1178987     3  0.5529      0.702 0.296 0.000 0.704
#> GSM1179003     3  0.1529      0.831 0.000 0.040 0.960
#> GSM1179004     3  0.3551      0.833 0.132 0.000 0.868
#> GSM1179039     2  0.0000      0.999 0.000 1.000 0.000
#> GSM1178975     3  0.4062      0.820 0.164 0.000 0.836
#> GSM1178980     3  0.0000      0.836 0.000 0.000 1.000
#> GSM1178995     3  0.5810      0.655 0.336 0.000 0.664
#> GSM1178996     3  0.1411      0.845 0.036 0.000 0.964
#> GSM1179001     1  0.3551      0.758 0.868 0.000 0.132
#> GSM1179002     3  0.5810      0.655 0.336 0.000 0.664
#> GSM1179006     3  0.1529      0.845 0.040 0.000 0.960
#> GSM1179008     3  0.6295      0.349 0.472 0.000 0.528
#> GSM1179015     1  0.0000      0.863 1.000 0.000 0.000
#> GSM1179017     3  0.0424      0.835 0.000 0.008 0.992
#> GSM1179026     3  0.2066      0.846 0.060 0.000 0.940
#> GSM1179033     3  0.2878      0.841 0.096 0.000 0.904
#> GSM1179035     3  0.3412      0.836 0.124 0.000 0.876
#> GSM1179036     3  0.3038      0.839 0.104 0.000 0.896
#> GSM1178986     3  0.0424      0.839 0.008 0.000 0.992
#> GSM1178989     3  0.0237      0.838 0.004 0.000 0.996
#> GSM1178993     3  0.0747      0.842 0.016 0.000 0.984
#> GSM1178999     3  0.0000      0.836 0.000 0.000 1.000
#> GSM1179021     2  0.0424      0.993 0.000 0.992 0.008
#> GSM1179025     2  0.0000      0.999 0.000 1.000 0.000
#> GSM1179027     3  0.2878      0.840 0.096 0.000 0.904
#> GSM1179011     3  0.4399      0.793 0.188 0.000 0.812
#> GSM1179023     1  0.0000      0.863 1.000 0.000 0.000
#> GSM1179029     1  0.0000      0.863 1.000 0.000 0.000
#> GSM1179034     1  0.0000      0.863 1.000 0.000 0.000
#> GSM1179040     3  0.0237      0.836 0.000 0.004 0.996
#> GSM1178988     3  0.0424      0.839 0.008 0.000 0.992
#> GSM1179037     3  0.3941      0.824 0.156 0.000 0.844

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>            class entropy silhouette    p1    p2    p3    p4
#> GSM1178971     3  0.7472    0.49735 0.176 0.000 0.428 0.396
#> GSM1178979     4  0.3123    0.01506 0.000 0.156 0.000 0.844
#> GSM1179009     3  0.4669   -0.05892 0.104 0.000 0.796 0.100
#> GSM1179031     2  0.0000    0.94848 0.000 1.000 0.000 0.000
#> GSM1178970     4  0.4933    0.00943 0.000 0.000 0.432 0.568
#> GSM1178972     2  0.0000    0.94848 0.000 1.000 0.000 0.000
#> GSM1178973     1  0.1118    0.81812 0.964 0.000 0.036 0.000
#> GSM1178974     2  0.0000    0.94848 0.000 1.000 0.000 0.000
#> GSM1178977     4  0.4817   -0.01325 0.000 0.000 0.388 0.612
#> GSM1178978     3  0.5486    0.10289 0.080 0.000 0.720 0.200
#> GSM1178998     1  0.0000    0.82523 1.000 0.000 0.000 0.000
#> GSM1179010     1  0.7165   -0.26296 0.488 0.000 0.372 0.140
#> GSM1179018     4  0.4998    0.02098 0.000 0.000 0.488 0.512
#> GSM1179024     1  0.0469    0.81851 0.988 0.000 0.012 0.000
#> GSM1178984     3  0.7830    0.51974 0.272 0.000 0.404 0.324
#> GSM1178990     1  0.1118    0.81812 0.964 0.000 0.036 0.000
#> GSM1178991     3  0.5138   -0.39234 0.392 0.000 0.600 0.008
#> GSM1178994     3  0.7830    0.51976 0.272 0.000 0.404 0.324
#> GSM1178997     4  0.5780   -0.10252 0.028 0.000 0.476 0.496
#> GSM1179000     1  0.7241    0.01169 0.540 0.000 0.196 0.264
#> GSM1179013     1  0.0000    0.82523 1.000 0.000 0.000 0.000
#> GSM1179014     4  0.7844   -0.34716 0.368 0.000 0.264 0.368
#> GSM1179019     1  0.5646    0.48877 0.708 0.000 0.088 0.204
#> GSM1179020     1  0.1118    0.81812 0.964 0.000 0.036 0.000
#> GSM1179022     1  0.0000    0.82523 1.000 0.000 0.000 0.000
#> GSM1179028     2  0.0000    0.94848 0.000 1.000 0.000 0.000
#> GSM1179032     1  0.0000    0.82523 1.000 0.000 0.000 0.000
#> GSM1179041     2  0.0000    0.94848 0.000 1.000 0.000 0.000
#> GSM1179042     2  0.0000    0.94848 0.000 1.000 0.000 0.000
#> GSM1178976     4  0.4996    0.02842 0.000 0.000 0.484 0.516
#> GSM1178981     3  0.7786    0.52268 0.256 0.000 0.416 0.328
#> GSM1178982     3  0.7113    0.42455 0.128 0.000 0.456 0.416
#> GSM1178983     4  0.4998    0.02706 0.000 0.000 0.488 0.512
#> GSM1178985     3  0.6557    0.25979 0.076 0.000 0.476 0.448
#> GSM1178992     3  0.7646    0.51556 0.208 0.000 0.408 0.384
#> GSM1179005     3  0.7706    0.52767 0.228 0.000 0.424 0.348
#> GSM1179007     3  0.7824    0.52293 0.268 0.000 0.404 0.328
#> GSM1179012     1  0.0188    0.82374 0.996 0.000 0.004 0.000
#> GSM1179016     4  0.4998    0.02706 0.000 0.000 0.488 0.512
#> GSM1179030     4  0.4998    0.02706 0.000 0.000 0.488 0.512
#> GSM1179038     3  0.7663    0.51749 0.212 0.000 0.408 0.380
#> GSM1178987     3  0.7728    0.52162 0.232 0.000 0.416 0.352
#> GSM1179003     4  0.5894   -0.02640 0.000 0.036 0.428 0.536
#> GSM1179004     3  0.7210    0.45027 0.140 0.000 0.456 0.404
#> GSM1179039     2  0.0000    0.94848 0.000 1.000 0.000 0.000
#> GSM1178975     3  0.7297    0.47605 0.152 0.000 0.456 0.392
#> GSM1178980     4  0.4992   -0.19283 0.000 0.000 0.476 0.524
#> GSM1178995     3  0.7824    0.52293 0.268 0.000 0.404 0.328
#> GSM1178996     4  0.6009   -0.13654 0.040 0.000 0.468 0.492
#> GSM1179001     1  0.4055    0.69782 0.832 0.000 0.060 0.108
#> GSM1179002     3  0.7824    0.52293 0.268 0.000 0.404 0.328
#> GSM1179006     3  0.6081    0.11567 0.044 0.000 0.484 0.472
#> GSM1179008     1  0.7806   -0.47670 0.408 0.000 0.332 0.260
#> GSM1179015     1  0.0592    0.82443 0.984 0.000 0.016 0.000
#> GSM1179017     4  0.5288    0.01964 0.000 0.008 0.472 0.520
#> GSM1179026     3  0.6504    0.24138 0.072 0.000 0.476 0.452
#> GSM1179033     3  0.7040    0.39722 0.120 0.000 0.460 0.420
#> GSM1179035     3  0.7107    0.42541 0.128 0.000 0.464 0.408
#> GSM1179036     3  0.7107    0.41775 0.128 0.000 0.464 0.408
#> GSM1178986     4  0.4998    0.02706 0.000 0.000 0.488 0.512
#> GSM1178989     4  0.4998    0.02706 0.000 0.000 0.488 0.512
#> GSM1178993     4  0.4992   -0.19283 0.000 0.000 0.476 0.524
#> GSM1178999     4  0.0336    0.11396 0.000 0.000 0.008 0.992
#> GSM1179021     2  0.5697    0.55393 0.000 0.488 0.024 0.488
#> GSM1179025     2  0.0000    0.94848 0.000 1.000 0.000 0.000
#> GSM1179027     4  0.4992   -0.19283 0.000 0.000 0.476 0.524
#> GSM1179011     3  0.5000   -0.33918 0.000 0.000 0.504 0.496
#> GSM1179023     1  0.0000    0.82523 1.000 0.000 0.000 0.000
#> GSM1179029     1  0.0592    0.82316 0.984 0.000 0.016 0.000
#> GSM1179034     1  0.0000    0.82523 1.000 0.000 0.000 0.000
#> GSM1179040     4  0.4830   -0.12270 0.000 0.000 0.392 0.608
#> GSM1178988     4  0.4998    0.02706 0.000 0.000 0.488 0.512
#> GSM1179037     3  0.7396    0.47919 0.164 0.000 0.432 0.404

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>            class entropy silhouette    p1    p2    p3    p4    p5
#> GSM1178971     3  0.3895     0.6390 0.320 0.000 0.680 0.000 0.000
#> GSM1178979     4  0.6775     0.5969 0.008 0.096 0.248 0.588 0.060
#> GSM1179009     1  0.5268     0.4490 0.588 0.000 0.048 0.360 0.004
#> GSM1179031     2  0.0000     0.9917 0.000 1.000 0.000 0.000 0.000
#> GSM1178970     3  0.2989     0.7979 0.016 0.000 0.880 0.036 0.068
#> GSM1178972     2  0.1341     0.9398 0.000 0.944 0.000 0.000 0.056
#> GSM1178973     1  0.1965     0.6948 0.904 0.000 0.000 0.000 0.096
#> GSM1178974     2  0.0000     0.9917 0.000 1.000 0.000 0.000 0.000
#> GSM1178977     3  0.3745     0.7394 0.008 0.000 0.828 0.096 0.068
#> GSM1178978     1  0.6664     0.3698 0.468 0.000 0.356 0.164 0.012
#> GSM1178998     5  0.2230     0.9461 0.116 0.000 0.000 0.000 0.884
#> GSM1179010     1  0.1444     0.7258 0.948 0.000 0.012 0.000 0.040
#> GSM1179018     3  0.1412     0.8639 0.036 0.000 0.952 0.004 0.008
#> GSM1179024     5  0.2248     0.9400 0.088 0.000 0.012 0.000 0.900
#> GSM1178984     1  0.0963     0.7441 0.964 0.000 0.036 0.000 0.000
#> GSM1178990     1  0.1908     0.6966 0.908 0.000 0.000 0.000 0.092
#> GSM1178991     1  0.6093     0.4048 0.564 0.000 0.080 0.332 0.024
#> GSM1178994     1  0.0963     0.7441 0.964 0.000 0.036 0.000 0.000
#> GSM1178997     3  0.2179     0.8177 0.112 0.000 0.888 0.000 0.000
#> GSM1179000     1  0.3019     0.7387 0.864 0.000 0.088 0.000 0.048
#> GSM1179013     5  0.2074     0.9496 0.104 0.000 0.000 0.000 0.896
#> GSM1179014     1  0.3455     0.6836 0.784 0.000 0.208 0.000 0.008
#> GSM1179019     1  0.1981     0.7307 0.924 0.000 0.028 0.000 0.048
#> GSM1179020     1  0.4287    -0.0913 0.540 0.000 0.000 0.000 0.460
#> GSM1179022     5  0.2020     0.9501 0.100 0.000 0.000 0.000 0.900
#> GSM1179028     2  0.0000     0.9917 0.000 1.000 0.000 0.000 0.000
#> GSM1179032     5  0.2020     0.9501 0.100 0.000 0.000 0.000 0.900
#> GSM1179041     2  0.0000     0.9917 0.000 1.000 0.000 0.000 0.000
#> GSM1179042     2  0.0000     0.9917 0.000 1.000 0.000 0.000 0.000
#> GSM1178976     3  0.1329     0.8640 0.032 0.000 0.956 0.004 0.008
#> GSM1178981     1  0.4067     0.5036 0.692 0.000 0.300 0.000 0.008
#> GSM1178982     3  0.3318     0.8231 0.192 0.000 0.800 0.000 0.008
#> GSM1178983     3  0.0798     0.8562 0.016 0.000 0.976 0.000 0.008
#> GSM1178985     3  0.2674     0.8494 0.140 0.000 0.856 0.000 0.004
#> GSM1178992     3  0.3730     0.7043 0.288 0.000 0.712 0.000 0.000
#> GSM1179005     1  0.3305     0.6648 0.776 0.000 0.224 0.000 0.000
#> GSM1179007     1  0.1671     0.7470 0.924 0.000 0.076 0.000 0.000
#> GSM1179012     5  0.2439     0.9225 0.120 0.000 0.004 0.000 0.876
#> GSM1179016     3  0.0451     0.8497 0.008 0.000 0.988 0.000 0.004
#> GSM1179030     3  0.0404     0.8477 0.012 0.000 0.988 0.000 0.000
#> GSM1179038     1  0.4256     0.1419 0.564 0.000 0.436 0.000 0.000
#> GSM1178987     1  0.4464     0.3506 0.584 0.000 0.408 0.000 0.008
#> GSM1179003     3  0.3949     0.7973 0.016 0.020 0.840 0.064 0.060
#> GSM1179004     3  0.3582     0.7994 0.224 0.000 0.768 0.000 0.008
#> GSM1179039     2  0.0000     0.9917 0.000 1.000 0.000 0.000 0.000
#> GSM1178975     1  0.4299     0.3575 0.608 0.000 0.388 0.000 0.004
#> GSM1178980     4  0.0000     0.7927 0.000 0.000 0.000 1.000 0.000
#> GSM1178995     1  0.1732     0.7465 0.920 0.000 0.080 0.000 0.000
#> GSM1178996     3  0.2377     0.8563 0.128 0.000 0.872 0.000 0.000
#> GSM1179001     1  0.1697     0.7200 0.932 0.000 0.008 0.000 0.060
#> GSM1179002     1  0.1671     0.7472 0.924 0.000 0.076 0.000 0.000
#> GSM1179006     3  0.2411     0.8578 0.108 0.000 0.884 0.000 0.008
#> GSM1179008     1  0.2450     0.7434 0.900 0.000 0.052 0.000 0.048
#> GSM1179015     1  0.4264     0.3011 0.620 0.000 0.004 0.000 0.376
#> GSM1179017     3  0.2150     0.8227 0.008 0.004 0.916 0.004 0.068
#> GSM1179026     3  0.2389     0.8589 0.116 0.000 0.880 0.000 0.004
#> GSM1179033     3  0.2929     0.8266 0.180 0.000 0.820 0.000 0.000
#> GSM1179035     3  0.3039     0.8187 0.192 0.000 0.808 0.000 0.000
#> GSM1179036     3  0.3123     0.8215 0.184 0.000 0.812 0.000 0.004
#> GSM1178986     3  0.0404     0.8573 0.012 0.000 0.988 0.000 0.000
#> GSM1178989     3  0.0609     0.8616 0.020 0.000 0.980 0.000 0.000
#> GSM1178993     4  0.0000     0.7927 0.000 0.000 0.000 1.000 0.000
#> GSM1178999     4  0.5548     0.5167 0.008 0.000 0.356 0.576 0.060
#> GSM1179021     4  0.4135     0.4490 0.000 0.340 0.000 0.656 0.004
#> GSM1179025     2  0.0000     0.9917 0.000 1.000 0.000 0.000 0.000
#> GSM1179027     4  0.0000     0.7927 0.000 0.000 0.000 1.000 0.000
#> GSM1179011     4  0.0000     0.7927 0.000 0.000 0.000 1.000 0.000
#> GSM1179023     5  0.2516     0.9223 0.140 0.000 0.000 0.000 0.860
#> GSM1179029     5  0.3942     0.7108 0.260 0.000 0.012 0.000 0.728
#> GSM1179034     5  0.2020     0.9501 0.100 0.000 0.000 0.000 0.900
#> GSM1179040     4  0.2647     0.7630 0.008 0.000 0.076 0.892 0.024
#> GSM1178988     3  0.1041     0.8637 0.032 0.000 0.964 0.000 0.004
#> GSM1179037     3  0.3424     0.7709 0.240 0.000 0.760 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
#> GSM1178971     3  0.3050     0.6341 0.000 0.000 0.764 0.000 0.000 0.236
#> GSM1178979     5  0.6073     0.3911 0.000 0.040 0.104 0.396 0.460 0.000
#> GSM1179009     6  0.4936     0.0828 0.000 0.000 0.052 0.464 0.004 0.480
#> GSM1179031     2  0.0000     0.9708 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1178970     5  0.4875     0.0817 0.000 0.000 0.476 0.024 0.480 0.020
#> GSM1178972     2  0.2762     0.7722 0.000 0.804 0.000 0.000 0.196 0.000
#> GSM1178973     6  0.2092     0.6925 0.124 0.000 0.000 0.000 0.000 0.876
#> GSM1178974     2  0.0000     0.9708 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1178977     3  0.4948    -0.3498 0.000 0.000 0.472 0.064 0.464 0.000
#> GSM1178978     6  0.7453    -0.1884 0.000 0.000 0.236 0.132 0.300 0.332
#> GSM1178998     1  0.1124     0.8981 0.956 0.000 0.000 0.000 0.008 0.036
#> GSM1179010     6  0.2859     0.6141 0.016 0.000 0.000 0.000 0.156 0.828
#> GSM1179018     3  0.1003     0.7218 0.000 0.000 0.964 0.000 0.020 0.016
#> GSM1179024     1  0.0363     0.9087 0.988 0.000 0.000 0.000 0.000 0.012
#> GSM1178984     6  0.1387     0.7201 0.000 0.000 0.068 0.000 0.000 0.932
#> GSM1178990     6  0.2048     0.6943 0.120 0.000 0.000 0.000 0.000 0.880
#> GSM1178991     4  0.6634    -0.1177 0.004 0.000 0.072 0.408 0.112 0.404
#> GSM1178994     6  0.1779     0.7196 0.000 0.000 0.064 0.000 0.016 0.920
#> GSM1178997     3  0.4570     0.4138 0.000 0.000 0.668 0.000 0.252 0.080
#> GSM1179000     6  0.3410     0.7129 0.076 0.000 0.100 0.000 0.004 0.820
#> GSM1179013     1  0.0458     0.9079 0.984 0.000 0.000 0.000 0.000 0.016
#> GSM1179014     6  0.5154     0.4453 0.008 0.000 0.108 0.000 0.260 0.624
#> GSM1179019     6  0.2436     0.7151 0.088 0.000 0.032 0.000 0.000 0.880
#> GSM1179020     6  0.3851     0.1361 0.460 0.000 0.000 0.000 0.000 0.540
#> GSM1179022     1  0.0363     0.9087 0.988 0.000 0.000 0.000 0.000 0.012
#> GSM1179028     2  0.0000     0.9708 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1179032     1  0.0363     0.9087 0.988 0.000 0.000 0.000 0.000 0.012
#> GSM1179041     2  0.0000     0.9708 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1179042     2  0.0000     0.9708 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1178976     3  0.0692     0.7227 0.000 0.000 0.976 0.004 0.020 0.000
#> GSM1178981     6  0.4224     0.4569 0.000 0.000 0.340 0.000 0.028 0.632
#> GSM1178982     3  0.2868     0.7054 0.000 0.000 0.840 0.000 0.028 0.132
#> GSM1178983     3  0.3320     0.5180 0.000 0.000 0.772 0.000 0.212 0.016
#> GSM1178985     3  0.1462     0.7427 0.000 0.000 0.936 0.000 0.008 0.056
#> GSM1178992     3  0.3230     0.6515 0.000 0.000 0.776 0.000 0.012 0.212
#> GSM1179005     6  0.3575     0.5915 0.000 0.000 0.284 0.000 0.008 0.708
#> GSM1179007     6  0.2048     0.7198 0.000 0.000 0.120 0.000 0.000 0.880
#> GSM1179012     1  0.4023     0.7590 0.756 0.000 0.000 0.000 0.144 0.100
#> GSM1179016     3  0.3221     0.4431 0.000 0.000 0.736 0.000 0.264 0.000
#> GSM1179030     3  0.3541     0.4256 0.000 0.000 0.728 0.000 0.260 0.012
#> GSM1179038     3  0.3868    -0.0278 0.000 0.000 0.504 0.000 0.000 0.496
#> GSM1178987     6  0.5815     0.1822 0.000 0.000 0.264 0.000 0.240 0.496
#> GSM1179003     3  0.4708     0.3187 0.000 0.016 0.672 0.056 0.256 0.000
#> GSM1179004     3  0.2815     0.7089 0.000 0.000 0.848 0.000 0.032 0.120
#> GSM1179039     2  0.0000     0.9708 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1178975     6  0.3986     0.1929 0.000 0.000 0.464 0.000 0.004 0.532
#> GSM1178980     4  0.0000     0.7282 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM1178995     6  0.2092     0.7188 0.000 0.000 0.124 0.000 0.000 0.876
#> GSM1178996     3  0.1745     0.7411 0.000 0.000 0.920 0.000 0.012 0.068
#> GSM1179001     6  0.2020     0.7060 0.096 0.000 0.008 0.000 0.000 0.896
#> GSM1179002     6  0.2146     0.7213 0.000 0.000 0.116 0.000 0.004 0.880
#> GSM1179006     3  0.0972     0.7365 0.000 0.000 0.964 0.000 0.008 0.028
#> GSM1179008     6  0.2794     0.7253 0.060 0.000 0.080 0.000 0.000 0.860
#> GSM1179015     6  0.5777     0.0507 0.332 0.000 0.008 0.000 0.152 0.508
#> GSM1179017     5  0.3078     0.5004 0.012 0.000 0.192 0.000 0.796 0.000
#> GSM1179026     3  0.1141     0.7429 0.000 0.000 0.948 0.000 0.000 0.052
#> GSM1179033     3  0.1863     0.7341 0.000 0.000 0.896 0.000 0.000 0.104
#> GSM1179035     3  0.2191     0.7303 0.000 0.000 0.876 0.000 0.004 0.120
#> GSM1179036     3  0.1863     0.7339 0.000 0.000 0.896 0.000 0.000 0.104
#> GSM1178986     3  0.2948     0.5660 0.000 0.000 0.804 0.000 0.188 0.008
#> GSM1178989     3  0.1814     0.6727 0.000 0.000 0.900 0.000 0.100 0.000
#> GSM1178993     4  0.0000     0.7282 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM1178999     5  0.5859     0.4802 0.000 0.000 0.168 0.384 0.444 0.004
#> GSM1179021     4  0.4938     0.2957 0.000 0.340 0.000 0.580 0.080 0.000
#> GSM1179025     2  0.0000     0.9708 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1179027     4  0.0000     0.7282 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM1179011     4  0.0000     0.7282 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM1179023     1  0.1814     0.8439 0.900 0.000 0.000 0.000 0.000 0.100
#> GSM1179029     1  0.5254     0.5794 0.628 0.000 0.024 0.000 0.084 0.264
#> GSM1179034     1  0.0363     0.9087 0.988 0.000 0.000 0.000 0.000 0.012
#> GSM1179040     4  0.2679     0.5815 0.000 0.000 0.096 0.864 0.040 0.000
#> GSM1178988     3  0.0000     0.7252 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1179037     3  0.2562     0.6972 0.000 0.000 0.828 0.000 0.000 0.172

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) protocol(p) k
#> CV:pam 66           0.1941    0.126710 2
#> CV:pam 68           0.6431    0.001341 3
#> CV:pam 33           0.2518    0.050448 4
#> CV:pam 64           0.0162    0.000564 5
#> CV:pam 54           0.0457    0.008610 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 31632 rows and 73 columns.
#>   Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'CV' method.
#>   Subgroups are detected by 'mclust' method.
#>   Performed in total 1250 partitions by row resampling.
#>   Best k for subgroups seems to be 4.
#> 
#> Following methods can be applied to this 'ConsensusPartition' object:
#>  [1] "cola_report"             "collect_classes"         "collect_plots"          
#>  [4] "collect_stats"           "colnames"                "compare_signatures"     
#>  [7] "consensus_heatmap"       "dimension_reduction"     "functional_enrichment"  
#> [10] "get_anno_col"            "get_anno"                "get_classes"            
#> [13] "get_consensus"           "get_matrix"              "get_membership"         
#> [16] "get_param"               "get_signatures"          "get_stats"              
#> [19] "is_best_k"               "is_stable_k"             "membership_heatmap"     
#> [22] "ncol"                    "nrow"                    "plot_ecdf"              
#> [25] "rownames"                "select_partition_number" "show"                   
#> [28] "suggest_best_k"          "test_to_known_factors"

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

collect_plots(res)

plot of chunk CV-mclust-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.556           0.865       0.912         0.3506 0.686   0.686
#> 3 3 0.305           0.635       0.754         0.3873 0.767   0.696
#> 4 4 0.581           0.727       0.873         0.3321 0.658   0.467
#> 5 5 0.486           0.611       0.802         0.0645 0.837   0.591
#> 6 6 0.507           0.474       0.718         0.0979 0.904   0.701

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
#> GSM1178971     1  0.1414      0.895 0.980 0.020
#> GSM1178979     2  0.2236      0.949 0.036 0.964
#> GSM1179009     1  0.7602      0.820 0.780 0.220
#> GSM1179031     2  0.2236      0.949 0.036 0.964
#> GSM1178970     2  0.2236      0.949 0.036 0.964
#> GSM1178972     2  0.2236      0.949 0.036 0.964
#> GSM1178973     1  0.7602      0.820 0.780 0.220
#> GSM1178974     2  0.2236      0.949 0.036 0.964
#> GSM1178977     1  0.7453      0.822 0.788 0.212
#> GSM1178978     1  0.6973      0.838 0.812 0.188
#> GSM1178998     1  0.0376      0.897 0.996 0.004
#> GSM1179010     1  0.0000      0.897 1.000 0.000
#> GSM1179018     1  0.5946      0.853 0.856 0.144
#> GSM1179024     1  0.0376      0.895 0.996 0.004
#> GSM1178984     1  0.3431      0.886 0.936 0.064
#> GSM1178990     1  0.0376      0.895 0.996 0.004
#> GSM1178991     1  0.7299      0.830 0.796 0.204
#> GSM1178994     1  0.0000      0.897 1.000 0.000
#> GSM1178997     1  0.0000      0.897 1.000 0.000
#> GSM1179000     1  0.0376      0.895 0.996 0.004
#> GSM1179013     1  0.1843      0.894 0.972 0.028
#> GSM1179014     1  0.7528      0.822 0.784 0.216
#> GSM1179019     1  0.0376      0.895 0.996 0.004
#> GSM1179020     1  0.0376      0.895 0.996 0.004
#> GSM1179022     1  0.0376      0.895 0.996 0.004
#> GSM1179028     2  0.2236      0.949 0.036 0.964
#> GSM1179032     1  0.0376      0.895 0.996 0.004
#> GSM1179041     2  0.2236      0.949 0.036 0.964
#> GSM1179042     2  0.2236      0.949 0.036 0.964
#> GSM1178976     2  0.9427      0.379 0.360 0.640
#> GSM1178981     1  0.0000      0.897 1.000 0.000
#> GSM1178982     1  0.0376      0.897 0.996 0.004
#> GSM1178983     1  0.3274      0.887 0.940 0.060
#> GSM1178985     1  0.0000      0.897 1.000 0.000
#> GSM1178992     1  0.7528      0.822 0.784 0.216
#> GSM1179005     1  0.0000      0.897 1.000 0.000
#> GSM1179007     1  0.0376      0.895 0.996 0.004
#> GSM1179012     1  0.0000      0.897 1.000 0.000
#> GSM1179016     1  0.7528      0.822 0.784 0.216
#> GSM1179030     1  0.6973      0.829 0.812 0.188
#> GSM1179038     1  0.0376      0.895 0.996 0.004
#> GSM1178987     1  0.0000      0.897 1.000 0.000
#> GSM1179003     2  0.6048      0.834 0.148 0.852
#> GSM1179004     1  0.0000      0.897 1.000 0.000
#> GSM1179039     2  0.2236      0.949 0.036 0.964
#> GSM1178975     1  0.7602      0.820 0.780 0.220
#> GSM1178980     1  0.8016      0.796 0.756 0.244
#> GSM1178995     1  0.0000      0.897 1.000 0.000
#> GSM1178996     1  0.6531      0.844 0.832 0.168
#> GSM1179001     1  0.0376      0.895 0.996 0.004
#> GSM1179002     1  0.0000      0.897 1.000 0.000
#> GSM1179006     1  0.7528      0.822 0.784 0.216
#> GSM1179008     1  0.1633      0.894 0.976 0.024
#> GSM1179015     1  0.7528      0.822 0.784 0.216
#> GSM1179017     1  0.9661      0.539 0.608 0.392
#> GSM1179026     1  0.7453      0.823 0.788 0.212
#> GSM1179033     1  0.1184      0.896 0.984 0.016
#> GSM1179035     1  0.0000      0.897 1.000 0.000
#> GSM1179036     1  0.0376      0.897 0.996 0.004
#> GSM1178986     1  0.2778      0.889 0.952 0.048
#> GSM1178989     1  0.7602      0.819 0.780 0.220
#> GSM1178993     1  0.7602      0.820 0.780 0.220
#> GSM1178999     1  0.9460      0.556 0.636 0.364
#> GSM1179021     2  0.0376      0.923 0.004 0.996
#> GSM1179025     2  0.2236      0.949 0.036 0.964
#> GSM1179027     1  0.7602      0.820 0.780 0.220
#> GSM1179011     1  0.7602      0.820 0.780 0.220
#> GSM1179023     1  0.0376      0.895 0.996 0.004
#> GSM1179029     1  0.0376      0.895 0.996 0.004
#> GSM1179034     1  0.0376      0.895 0.996 0.004
#> GSM1179040     2  0.3733      0.890 0.072 0.928
#> GSM1178988     1  0.6801      0.835 0.820 0.180
#> GSM1179037     1  0.0672      0.897 0.992 0.008

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>            class entropy silhouette    p1    p2    p3
#> GSM1178971     3  0.4196     0.7047 0.112 0.024 0.864
#> GSM1178979     2  0.4968     0.8732 0.012 0.800 0.188
#> GSM1179009     3  0.5988     0.6450 0.056 0.168 0.776
#> GSM1179031     2  0.3116     0.9496 0.000 0.892 0.108
#> GSM1178970     3  0.3918     0.6852 0.012 0.120 0.868
#> GSM1178972     2  0.3816     0.9315 0.000 0.852 0.148
#> GSM1178973     3  0.9311     0.2407 0.364 0.168 0.468
#> GSM1178974     2  0.3752     0.9337 0.000 0.856 0.144
#> GSM1178977     3  0.2492     0.7270 0.016 0.048 0.936
#> GSM1178978     3  0.1015     0.7417 0.008 0.012 0.980
#> GSM1178998     3  0.6483     0.3499 0.392 0.008 0.600
#> GSM1179010     3  0.5902     0.5260 0.316 0.004 0.680
#> GSM1179018     3  0.1015     0.7417 0.008 0.012 0.980
#> GSM1179024     1  0.4062     0.7983 0.836 0.000 0.164
#> GSM1178984     3  0.5884     0.5605 0.272 0.012 0.716
#> GSM1178990     3  0.6664     0.1671 0.464 0.008 0.528
#> GSM1178991     3  0.5298     0.6872 0.164 0.032 0.804
#> GSM1178994     3  0.5678     0.5257 0.316 0.000 0.684
#> GSM1178997     3  0.1877     0.7426 0.032 0.012 0.956
#> GSM1179000     3  0.6305     0.1341 0.484 0.000 0.516
#> GSM1179013     1  0.4555     0.7685 0.800 0.000 0.200
#> GSM1179014     3  0.6777     0.4311 0.364 0.020 0.616
#> GSM1179019     1  0.6309    -0.2105 0.504 0.000 0.496
#> GSM1179020     3  0.6309     0.0804 0.496 0.000 0.504
#> GSM1179022     1  0.2261     0.7864 0.932 0.000 0.068
#> GSM1179028     2  0.3116     0.9496 0.000 0.892 0.108
#> GSM1179032     1  0.2261     0.7864 0.932 0.000 0.068
#> GSM1179041     2  0.3116     0.9496 0.000 0.892 0.108
#> GSM1179042     2  0.3116     0.9496 0.000 0.892 0.108
#> GSM1178976     3  0.2384     0.7241 0.008 0.056 0.936
#> GSM1178981     3  0.1643     0.7407 0.044 0.000 0.956
#> GSM1178982     3  0.1170     0.7405 0.016 0.008 0.976
#> GSM1178983     3  0.2550     0.7380 0.040 0.024 0.936
#> GSM1178985     3  0.0592     0.7407 0.012 0.000 0.988
#> GSM1178992     3  0.5356     0.6641 0.196 0.020 0.784
#> GSM1179005     3  0.6180     0.4852 0.332 0.008 0.660
#> GSM1179007     3  0.6598     0.2774 0.428 0.008 0.564
#> GSM1179012     3  0.6126     0.3659 0.400 0.000 0.600
#> GSM1179016     3  0.5298     0.6947 0.164 0.032 0.804
#> GSM1179030     3  0.1620     0.7369 0.012 0.024 0.964
#> GSM1179038     3  0.6427     0.4615 0.348 0.012 0.640
#> GSM1178987     3  0.1411     0.7399 0.036 0.000 0.964
#> GSM1179003     3  0.5020     0.6298 0.012 0.192 0.796
#> GSM1179004     3  0.1411     0.7399 0.036 0.000 0.964
#> GSM1179039     2  0.3116     0.9496 0.000 0.892 0.108
#> GSM1178975     3  0.4859     0.7116 0.044 0.116 0.840
#> GSM1178980     3  0.5688     0.6448 0.044 0.168 0.788
#> GSM1178995     3  0.6434     0.4015 0.380 0.008 0.612
#> GSM1178996     3  0.0661     0.7423 0.004 0.008 0.988
#> GSM1179001     3  0.6669     0.1591 0.468 0.008 0.524
#> GSM1179002     3  0.6252     0.4590 0.344 0.008 0.648
#> GSM1179006     3  0.1170     0.7410 0.008 0.016 0.976
#> GSM1179008     3  0.6813     0.1629 0.468 0.012 0.520
#> GSM1179015     3  0.6910     0.3768 0.396 0.020 0.584
#> GSM1179017     3  0.3356     0.7197 0.036 0.056 0.908
#> GSM1179026     3  0.2031     0.7390 0.032 0.016 0.952
#> GSM1179033     3  0.1015     0.7428 0.008 0.012 0.980
#> GSM1179035     3  0.1411     0.7399 0.036 0.000 0.964
#> GSM1179036     3  0.2651     0.7284 0.060 0.012 0.928
#> GSM1178986     3  0.1877     0.7393 0.032 0.012 0.956
#> GSM1178989     3  0.2689     0.7295 0.032 0.036 0.932
#> GSM1178993     3  0.5688     0.6448 0.044 0.168 0.788
#> GSM1178999     3  0.2939     0.7171 0.012 0.072 0.916
#> GSM1179021     2  0.0983     0.8165 0.004 0.980 0.016
#> GSM1179025     2  0.3752     0.9355 0.000 0.856 0.144
#> GSM1179027     3  0.5688     0.6448 0.044 0.168 0.788
#> GSM1179011     3  0.5791     0.6432 0.048 0.168 0.784
#> GSM1179023     1  0.3686     0.8086 0.860 0.000 0.140
#> GSM1179029     3  0.6641     0.2082 0.448 0.008 0.544
#> GSM1179034     1  0.2261     0.7864 0.932 0.000 0.068
#> GSM1179040     3  0.6490     0.5744 0.036 0.256 0.708
#> GSM1178988     3  0.1905     0.7401 0.028 0.016 0.956
#> GSM1179037     3  0.1411     0.7399 0.036 0.000 0.964

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>            class entropy silhouette    p1    p2    p3    p4
#> GSM1178971     3  0.3933     0.6909 0.196 0.004 0.796 0.004
#> GSM1178979     2  0.3161     0.8015 0.000 0.864 0.124 0.012
#> GSM1179009     4  0.0895     0.8411 0.000 0.004 0.020 0.976
#> GSM1179031     2  0.0188     0.8709 0.000 0.996 0.000 0.004
#> GSM1178970     3  0.2255     0.8115 0.000 0.068 0.920 0.012
#> GSM1178972     2  0.3377     0.7861 0.000 0.848 0.140 0.012
#> GSM1178973     4  0.6269     0.2584 0.364 0.004 0.056 0.576
#> GSM1178974     2  0.1890     0.8555 0.000 0.936 0.056 0.008
#> GSM1178977     3  0.1356     0.8356 0.000 0.032 0.960 0.008
#> GSM1178978     3  0.0000     0.8539 0.000 0.000 1.000 0.000
#> GSM1178998     1  0.4872     0.6008 0.640 0.004 0.356 0.000
#> GSM1179010     3  0.4331     0.4907 0.288 0.000 0.712 0.000
#> GSM1179018     3  0.0188     0.8531 0.000 0.000 0.996 0.004
#> GSM1179024     1  0.1792     0.7854 0.932 0.000 0.068 0.000
#> GSM1178984     3  0.4356     0.4840 0.292 0.000 0.708 0.000
#> GSM1178990     1  0.3490     0.7827 0.836 0.004 0.156 0.004
#> GSM1178991     1  0.5463     0.4924 0.580 0.004 0.404 0.012
#> GSM1178994     3  0.4356     0.4817 0.292 0.000 0.708 0.000
#> GSM1178997     3  0.4608     0.5094 0.304 0.004 0.692 0.000
#> GSM1179000     1  0.1867     0.7875 0.928 0.000 0.072 0.000
#> GSM1179013     1  0.1867     0.7877 0.928 0.000 0.072 0.000
#> GSM1179014     1  0.4372     0.6767 0.728 0.004 0.268 0.000
#> GSM1179019     1  0.1867     0.7875 0.928 0.000 0.072 0.000
#> GSM1179020     1  0.1867     0.7875 0.928 0.000 0.072 0.000
#> GSM1179022     1  0.0000     0.7193 1.000 0.000 0.000 0.000
#> GSM1179028     2  0.0188     0.8709 0.000 0.996 0.000 0.004
#> GSM1179032     1  0.0000     0.7193 1.000 0.000 0.000 0.000
#> GSM1179041     2  0.0188     0.8709 0.000 0.996 0.000 0.004
#> GSM1179042     2  0.0188     0.8709 0.000 0.996 0.000 0.004
#> GSM1178976     3  0.1488     0.8303 0.000 0.032 0.956 0.012
#> GSM1178981     3  0.0000     0.8539 0.000 0.000 1.000 0.000
#> GSM1178982     3  0.0376     0.8534 0.004 0.000 0.992 0.004
#> GSM1178983     3  0.1576     0.8354 0.048 0.000 0.948 0.004
#> GSM1178985     3  0.0000     0.8539 0.000 0.000 1.000 0.000
#> GSM1178992     3  0.0188     0.8536 0.004 0.000 0.996 0.000
#> GSM1179005     3  0.4957     0.4439 0.336 0.004 0.656 0.004
#> GSM1179007     1  0.5313     0.2396 0.536 0.004 0.456 0.004
#> GSM1179012     1  0.4941     0.4507 0.564 0.000 0.436 0.000
#> GSM1179016     3  0.3306     0.7423 0.156 0.004 0.840 0.000
#> GSM1179030     3  0.0712     0.8528 0.008 0.004 0.984 0.004
#> GSM1179038     3  0.5139     0.3271 0.380 0.004 0.612 0.004
#> GSM1178987     3  0.0000     0.8539 0.000 0.000 1.000 0.000
#> GSM1179003     3  0.3895     0.7230 0.000 0.184 0.804 0.012
#> GSM1179004     3  0.0000     0.8539 0.000 0.000 1.000 0.000
#> GSM1179039     2  0.0188     0.8709 0.000 0.996 0.000 0.004
#> GSM1178975     4  0.6079     0.6061 0.160 0.004 0.140 0.696
#> GSM1178980     4  0.1452     0.8265 0.000 0.036 0.008 0.956
#> GSM1178995     3  0.5317     0.0511 0.460 0.004 0.532 0.004
#> GSM1178996     3  0.1082     0.8485 0.020 0.004 0.972 0.004
#> GSM1179001     1  0.4268     0.7357 0.760 0.004 0.232 0.004
#> GSM1179002     3  0.5125     0.3081 0.376 0.004 0.616 0.004
#> GSM1179006     3  0.0376     0.8533 0.004 0.004 0.992 0.000
#> GSM1179008     1  0.3236     0.7883 0.856 0.004 0.136 0.004
#> GSM1179015     1  0.4950     0.5646 0.620 0.004 0.376 0.000
#> GSM1179017     3  0.2731     0.8041 0.004 0.092 0.896 0.008
#> GSM1179026     3  0.0000     0.8539 0.000 0.000 1.000 0.000
#> GSM1179033     3  0.0188     0.8531 0.000 0.000 0.996 0.004
#> GSM1179035     3  0.0000     0.8539 0.000 0.000 1.000 0.000
#> GSM1179036     3  0.2156     0.8254 0.060 0.004 0.928 0.008
#> GSM1178986     3  0.2796     0.7980 0.096 0.008 0.892 0.004
#> GSM1178989     3  0.0804     0.8460 0.000 0.012 0.980 0.008
#> GSM1178993     4  0.0657     0.8441 0.000 0.004 0.012 0.984
#> GSM1178999     3  0.2402     0.8129 0.000 0.076 0.912 0.012
#> GSM1179021     2  0.4925     0.2801 0.000 0.572 0.000 0.428
#> GSM1179025     2  0.2610     0.8367 0.000 0.900 0.088 0.012
#> GSM1179027     4  0.0657     0.8441 0.000 0.004 0.012 0.984
#> GSM1179011     4  0.0657     0.8441 0.000 0.004 0.012 0.984
#> GSM1179023     1  0.1474     0.7713 0.948 0.000 0.052 0.000
#> GSM1179029     1  0.3340     0.7868 0.848 0.004 0.144 0.004
#> GSM1179034     1  0.0000     0.7193 1.000 0.000 0.000 0.000
#> GSM1179040     4  0.1489     0.8166 0.000 0.044 0.004 0.952
#> GSM1178988     3  0.0188     0.8531 0.000 0.000 0.996 0.004
#> GSM1179037     3  0.0000     0.8539 0.000 0.000 1.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
#> GSM1178971     3  0.4345      0.651 0.212 0.012 0.748 0.000 0.028
#> GSM1178979     5  0.5731     -0.189 0.000 0.436 0.084 0.000 0.480
#> GSM1179009     4  0.0609      0.808 0.000 0.000 0.020 0.980 0.000
#> GSM1179031     2  0.0000      0.896 0.000 1.000 0.000 0.000 0.000
#> GSM1178970     5  0.5296      0.461 0.000 0.048 0.472 0.000 0.480
#> GSM1178972     2  0.5449      0.483 0.000 0.636 0.108 0.000 0.256
#> GSM1178973     4  0.5232      0.498 0.228 0.000 0.104 0.668 0.000
#> GSM1178974     2  0.2595      0.841 0.000 0.888 0.032 0.000 0.080
#> GSM1178977     3  0.4738     -0.478 0.000 0.016 0.520 0.000 0.464
#> GSM1178978     3  0.1012      0.749 0.020 0.000 0.968 0.000 0.012
#> GSM1178998     3  0.4404      0.580 0.292 0.000 0.684 0.000 0.024
#> GSM1179010     3  0.3794      0.651 0.152 0.000 0.800 0.000 0.048
#> GSM1179018     3  0.1018      0.746 0.016 0.000 0.968 0.000 0.016
#> GSM1179024     1  0.2074      0.788 0.896 0.000 0.104 0.000 0.000
#> GSM1178984     3  0.3152      0.721 0.136 0.000 0.840 0.000 0.024
#> GSM1178990     1  0.5068      0.357 0.592 0.000 0.364 0.000 0.044
#> GSM1178991     1  0.5315      0.385 0.536 0.012 0.428 0.008 0.016
#> GSM1178994     3  0.2761      0.710 0.104 0.000 0.872 0.000 0.024
#> GSM1178997     3  0.5322     -0.112 0.456 0.028 0.504 0.000 0.012
#> GSM1179000     1  0.3424      0.716 0.760 0.000 0.240 0.000 0.000
#> GSM1179013     1  0.2573      0.786 0.880 0.000 0.104 0.000 0.016
#> GSM1179014     5  0.7376     -0.311 0.324 0.028 0.272 0.000 0.376
#> GSM1179019     1  0.3395      0.719 0.764 0.000 0.236 0.000 0.000
#> GSM1179020     1  0.2230      0.790 0.884 0.000 0.116 0.000 0.000
#> GSM1179022     1  0.1043      0.684 0.960 0.000 0.000 0.000 0.040
#> GSM1179028     2  0.0162      0.896 0.000 0.996 0.000 0.000 0.004
#> GSM1179032     1  0.1043      0.684 0.960 0.000 0.000 0.000 0.040
#> GSM1179041     2  0.0000      0.896 0.000 1.000 0.000 0.000 0.000
#> GSM1179042     2  0.0162      0.896 0.000 0.996 0.000 0.000 0.004
#> GSM1178976     3  0.4829     -0.500 0.000 0.020 0.500 0.000 0.480
#> GSM1178981     3  0.1012      0.751 0.020 0.000 0.968 0.000 0.012
#> GSM1178982     3  0.1750      0.750 0.028 0.000 0.936 0.000 0.036
#> GSM1178983     3  0.2903      0.736 0.080 0.000 0.872 0.000 0.048
#> GSM1178985     3  0.0671      0.749 0.016 0.000 0.980 0.000 0.004
#> GSM1178992     3  0.3516      0.654 0.020 0.008 0.820 0.000 0.152
#> GSM1179005     3  0.3904      0.703 0.156 0.000 0.792 0.000 0.052
#> GSM1179007     3  0.5067      0.571 0.288 0.000 0.648 0.000 0.064
#> GSM1179012     3  0.3953      0.631 0.168 0.000 0.784 0.000 0.048
#> GSM1179016     3  0.5606      0.124 0.028 0.028 0.528 0.000 0.416
#> GSM1179030     3  0.2984      0.692 0.020 0.028 0.880 0.000 0.072
#> GSM1179038     3  0.3821      0.709 0.148 0.000 0.800 0.000 0.052
#> GSM1178987     3  0.0963      0.737 0.000 0.000 0.964 0.000 0.036
#> GSM1179003     5  0.6184      0.548 0.000 0.140 0.380 0.000 0.480
#> GSM1179004     3  0.1043      0.737 0.000 0.000 0.960 0.000 0.040
#> GSM1179039     2  0.0000      0.896 0.000 1.000 0.000 0.000 0.000
#> GSM1178975     4  0.5845      0.407 0.108 0.016 0.244 0.632 0.000
#> GSM1178980     4  0.2079      0.792 0.000 0.020 0.000 0.916 0.064
#> GSM1178995     3  0.4238      0.683 0.192 0.000 0.756 0.000 0.052
#> GSM1178996     3  0.1954      0.750 0.028 0.008 0.932 0.000 0.032
#> GSM1179001     3  0.4758      0.586 0.276 0.000 0.676 0.000 0.048
#> GSM1179002     3  0.3507      0.727 0.120 0.000 0.828 0.000 0.052
#> GSM1179006     3  0.2124      0.744 0.020 0.012 0.924 0.000 0.044
#> GSM1179008     1  0.3752      0.764 0.804 0.000 0.148 0.000 0.048
#> GSM1179015     3  0.6531      0.311 0.240 0.012 0.544 0.000 0.204
#> GSM1179017     5  0.3234      0.249 0.000 0.064 0.084 0.000 0.852
#> GSM1179026     3  0.1671      0.713 0.000 0.000 0.924 0.000 0.076
#> GSM1179033     3  0.1211      0.750 0.024 0.000 0.960 0.000 0.016
#> GSM1179035     3  0.0880      0.737 0.000 0.000 0.968 0.000 0.032
#> GSM1179036     3  0.3043      0.735 0.080 0.000 0.864 0.000 0.056
#> GSM1178986     3  0.3367      0.735 0.088 0.016 0.856 0.000 0.040
#> GSM1178989     5  0.4841      0.502 0.000 0.024 0.416 0.000 0.560
#> GSM1178993     4  0.0000      0.812 0.000 0.000 0.000 1.000 0.000
#> GSM1178999     5  0.5736      0.492 0.000 0.084 0.448 0.000 0.468
#> GSM1179021     4  0.4558      0.481 0.000 0.324 0.000 0.652 0.024
#> GSM1179025     2  0.3181      0.803 0.000 0.856 0.072 0.000 0.072
#> GSM1179027     4  0.0000      0.812 0.000 0.000 0.000 1.000 0.000
#> GSM1179011     4  0.0000      0.812 0.000 0.000 0.000 1.000 0.000
#> GSM1179023     1  0.2020      0.788 0.900 0.000 0.100 0.000 0.000
#> GSM1179029     1  0.4644      0.684 0.720 0.004 0.224 0.000 0.052
#> GSM1179034     1  0.1043      0.684 0.960 0.000 0.000 0.000 0.040
#> GSM1179040     4  0.2079      0.792 0.000 0.020 0.000 0.916 0.064
#> GSM1178988     3  0.1121      0.722 0.000 0.000 0.956 0.000 0.044
#> GSM1179037     3  0.0703      0.735 0.000 0.000 0.976 0.000 0.024

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>            class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM1178971     3  0.4671     0.4067 0.228 0.000 0.696 0.000 0.032 0.044
#> GSM1178979     5  0.3485     0.7085 0.000 0.112 0.028 0.000 0.824 0.036
#> GSM1179009     4  0.1082     0.7488 0.004 0.000 0.040 0.956 0.000 0.000
#> GSM1179031     2  0.0000     0.7877 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1178970     5  0.3998     0.7535 0.000 0.012 0.116 0.000 0.780 0.092
#> GSM1178972     5  0.4847     0.3023 0.000 0.344 0.016 0.000 0.600 0.040
#> GSM1178973     4  0.4631     0.3670 0.320 0.000 0.060 0.620 0.000 0.000
#> GSM1178974     2  0.4325     0.1055 0.000 0.504 0.008 0.000 0.480 0.008
#> GSM1178977     5  0.4185     0.7376 0.000 0.000 0.168 0.012 0.752 0.068
#> GSM1178978     3  0.4126     0.5086 0.016 0.000 0.764 0.004 0.048 0.168
#> GSM1178998     6  0.6666     0.5329 0.272 0.000 0.308 0.000 0.032 0.388
#> GSM1179010     6  0.5586     0.7856 0.196 0.000 0.172 0.000 0.020 0.612
#> GSM1179018     3  0.3885     0.4938 0.004 0.000 0.756 0.000 0.048 0.192
#> GSM1179024     1  0.1204     0.5761 0.944 0.000 0.056 0.000 0.000 0.000
#> GSM1178984     3  0.5873     0.3175 0.172 0.000 0.600 0.000 0.040 0.188
#> GSM1178990     1  0.4010     0.2867 0.584 0.000 0.408 0.000 0.000 0.008
#> GSM1178991     1  0.6264    -0.0229 0.444 0.000 0.428 0.032 0.060 0.036
#> GSM1178994     3  0.6058     0.2176 0.192 0.000 0.548 0.000 0.028 0.232
#> GSM1178997     3  0.5951     0.1055 0.428 0.000 0.444 0.000 0.088 0.040
#> GSM1179000     1  0.3133     0.4882 0.780 0.000 0.212 0.000 0.000 0.008
#> GSM1179013     1  0.1643     0.5755 0.924 0.000 0.068 0.000 0.000 0.008
#> GSM1179014     1  0.7030     0.1292 0.428 0.000 0.244 0.000 0.244 0.084
#> GSM1179019     1  0.2915     0.5170 0.808 0.000 0.184 0.000 0.000 0.008
#> GSM1179020     1  0.1588     0.5764 0.924 0.000 0.072 0.000 0.000 0.004
#> GSM1179022     1  0.2871     0.4677 0.804 0.000 0.004 0.000 0.000 0.192
#> GSM1179028     2  0.0692     0.7824 0.000 0.976 0.000 0.004 0.020 0.000
#> GSM1179032     1  0.2871     0.4677 0.804 0.000 0.004 0.000 0.000 0.192
#> GSM1179041     2  0.0000     0.7877 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1179042     2  0.0865     0.7720 0.000 0.964 0.000 0.000 0.036 0.000
#> GSM1178976     5  0.3172     0.7525 0.000 0.000 0.048 0.000 0.824 0.128
#> GSM1178981     3  0.3918     0.4869 0.008 0.000 0.748 0.000 0.036 0.208
#> GSM1178982     3  0.2009     0.5499 0.004 0.000 0.916 0.000 0.040 0.040
#> GSM1178983     3  0.1251     0.5437 0.008 0.000 0.956 0.000 0.024 0.012
#> GSM1178985     3  0.3354     0.5148 0.000 0.000 0.796 0.000 0.036 0.168
#> GSM1178992     3  0.7026     0.2024 0.168 0.000 0.484 0.000 0.184 0.164
#> GSM1179005     3  0.3550     0.4280 0.156 0.000 0.800 0.000 0.020 0.024
#> GSM1179007     3  0.4604     0.0892 0.300 0.000 0.636 0.000 0.000 0.064
#> GSM1179012     6  0.5727     0.7887 0.200 0.000 0.168 0.000 0.028 0.604
#> GSM1179016     3  0.7414     0.0511 0.196 0.000 0.384 0.000 0.264 0.156
#> GSM1179030     3  0.4097     0.5242 0.020 0.000 0.764 0.000 0.164 0.052
#> GSM1179038     3  0.3411     0.4247 0.160 0.000 0.804 0.000 0.012 0.024
#> GSM1178987     3  0.4497     0.3162 0.012 0.000 0.600 0.000 0.020 0.368
#> GSM1179003     5  0.2868     0.7668 0.000 0.032 0.112 0.000 0.852 0.004
#> GSM1179004     3  0.4687     0.3174 0.024 0.000 0.604 0.000 0.020 0.352
#> GSM1179039     2  0.0000     0.7877 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1178975     4  0.5770     0.2149 0.188 0.000 0.196 0.596 0.012 0.008
#> GSM1178980     4  0.1501     0.7422 0.000 0.000 0.000 0.924 0.076 0.000
#> GSM1178995     3  0.3071     0.4067 0.180 0.000 0.804 0.000 0.000 0.016
#> GSM1178996     3  0.4291     0.5240 0.016 0.000 0.752 0.000 0.152 0.080
#> GSM1179001     3  0.4026     0.1398 0.348 0.000 0.636 0.000 0.000 0.016
#> GSM1179002     3  0.3761     0.3746 0.196 0.000 0.764 0.000 0.008 0.032
#> GSM1179006     3  0.3715     0.5179 0.000 0.000 0.764 0.000 0.188 0.048
#> GSM1179008     1  0.3911     0.3707 0.624 0.000 0.368 0.000 0.000 0.008
#> GSM1179015     1  0.7260    -0.3011 0.396 0.000 0.128 0.000 0.184 0.292
#> GSM1179017     5  0.4206     0.6009 0.028 0.000 0.056 0.000 0.764 0.152
#> GSM1179026     3  0.5619     0.3832 0.032 0.000 0.620 0.000 0.136 0.212
#> GSM1179033     3  0.2744     0.5557 0.000 0.000 0.864 0.000 0.072 0.064
#> GSM1179035     3  0.4456     0.3299 0.008 0.000 0.608 0.000 0.024 0.360
#> GSM1179036     3  0.2239     0.5139 0.008 0.000 0.900 0.000 0.020 0.072
#> GSM1178986     3  0.3210     0.5307 0.012 0.000 0.844 0.000 0.072 0.072
#> GSM1178989     5  0.4079     0.7021 0.000 0.000 0.112 0.000 0.752 0.136
#> GSM1178993     4  0.0000     0.7580 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM1178999     5  0.2963     0.7641 0.004 0.000 0.152 0.000 0.828 0.016
#> GSM1179021     4  0.5789     0.2738 0.000 0.216 0.000 0.496 0.288 0.000
#> GSM1179025     2  0.4979     0.0247 0.000 0.500 0.016 0.000 0.448 0.036
#> GSM1179027     4  0.0000     0.7580 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM1179011     4  0.0000     0.7580 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM1179023     1  0.1141     0.5753 0.948 0.000 0.052 0.000 0.000 0.000
#> GSM1179029     1  0.4904     0.3305 0.588 0.000 0.352 0.000 0.048 0.012
#> GSM1179034     1  0.2871     0.4677 0.804 0.000 0.004 0.000 0.000 0.192
#> GSM1179040     4  0.2378     0.6984 0.000 0.000 0.000 0.848 0.152 0.000
#> GSM1178988     3  0.5010     0.4154 0.004 0.000 0.636 0.000 0.108 0.252
#> GSM1179037     3  0.4489     0.3552 0.008 0.000 0.632 0.000 0.032 0.328

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) protocol(p) k
#> CV:mclust 72            0.222    6.91e-02 2
#> CV:mclust 56            0.436    4.75e-04 3
#> CV:mclust 61            0.122    1.00e-03 4
#> CV:mclust 57            0.129    2.16e-07 5
#> CV:mclust 37            0.145    1.15e-04 6

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


CV:NMF**

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

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

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

res
#> A 'ConsensusPartition' object with k = 2, 3, 4, 5, 6.
#>   On a matrix with 31632 rows and 73 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 1.000           0.972       0.987         0.3870 0.610   0.610
#> 3 3 0.761           0.816       0.919         0.4837 0.780   0.649
#> 4 4 0.505           0.547       0.756         0.1936 0.860   0.703
#> 5 5 0.617           0.656       0.832         0.0766 0.799   0.515
#> 6 6 0.574           0.537       0.754         0.0833 0.894   0.612

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
#> GSM1178971     1   0.000      0.993 1.000 0.000
#> GSM1178979     2   0.000      0.966 0.000 1.000
#> GSM1179009     1   0.000      0.993 1.000 0.000
#> GSM1179031     2   0.000      0.966 0.000 1.000
#> GSM1178970     2   0.000      0.966 0.000 1.000
#> GSM1178972     2   0.000      0.966 0.000 1.000
#> GSM1178973     1   0.000      0.993 1.000 0.000
#> GSM1178974     2   0.000      0.966 0.000 1.000
#> GSM1178977     2   0.000      0.966 0.000 1.000
#> GSM1178978     1   0.000      0.993 1.000 0.000
#> GSM1178998     1   0.000      0.993 1.000 0.000
#> GSM1179010     1   0.000      0.993 1.000 0.000
#> GSM1179018     1   0.000      0.993 1.000 0.000
#> GSM1179024     1   0.000      0.993 1.000 0.000
#> GSM1178984     1   0.000      0.993 1.000 0.000
#> GSM1178990     1   0.000      0.993 1.000 0.000
#> GSM1178991     1   0.000      0.993 1.000 0.000
#> GSM1178994     1   0.000      0.993 1.000 0.000
#> GSM1178997     1   0.000      0.993 1.000 0.000
#> GSM1179000     1   0.000      0.993 1.000 0.000
#> GSM1179013     1   0.000      0.993 1.000 0.000
#> GSM1179014     1   0.000      0.993 1.000 0.000
#> GSM1179019     1   0.000      0.993 1.000 0.000
#> GSM1179020     1   0.000      0.993 1.000 0.000
#> GSM1179022     1   0.000      0.993 1.000 0.000
#> GSM1179028     2   0.000      0.966 0.000 1.000
#> GSM1179032     1   0.000      0.993 1.000 0.000
#> GSM1179041     2   0.000      0.966 0.000 1.000
#> GSM1179042     2   0.000      0.966 0.000 1.000
#> GSM1178976     2   0.634      0.820 0.160 0.840
#> GSM1178981     1   0.000      0.993 1.000 0.000
#> GSM1178982     1   0.000      0.993 1.000 0.000
#> GSM1178983     1   0.000      0.993 1.000 0.000
#> GSM1178985     1   0.000      0.993 1.000 0.000
#> GSM1178992     1   0.000      0.993 1.000 0.000
#> GSM1179005     1   0.000      0.993 1.000 0.000
#> GSM1179007     1   0.000      0.993 1.000 0.000
#> GSM1179012     1   0.000      0.993 1.000 0.000
#> GSM1179016     1   0.000      0.993 1.000 0.000
#> GSM1179030     1   0.000      0.993 1.000 0.000
#> GSM1179038     1   0.000      0.993 1.000 0.000
#> GSM1178987     1   0.000      0.993 1.000 0.000
#> GSM1179003     2   0.000      0.966 0.000 1.000
#> GSM1179004     1   0.000      0.993 1.000 0.000
#> GSM1179039     2   0.000      0.966 0.000 1.000
#> GSM1178975     1   0.000      0.993 1.000 0.000
#> GSM1178980     2   0.000      0.966 0.000 1.000
#> GSM1178995     1   0.000      0.993 1.000 0.000
#> GSM1178996     1   0.000      0.993 1.000 0.000
#> GSM1179001     1   0.000      0.993 1.000 0.000
#> GSM1179002     1   0.000      0.993 1.000 0.000
#> GSM1179006     1   0.000      0.993 1.000 0.000
#> GSM1179008     1   0.000      0.993 1.000 0.000
#> GSM1179015     1   0.000      0.993 1.000 0.000
#> GSM1179017     1   0.295      0.940 0.948 0.052
#> GSM1179026     1   0.000      0.993 1.000 0.000
#> GSM1179033     1   0.000      0.993 1.000 0.000
#> GSM1179035     1   0.000      0.993 1.000 0.000
#> GSM1179036     1   0.000      0.993 1.000 0.000
#> GSM1178986     1   0.000      0.993 1.000 0.000
#> GSM1178989     1   0.821      0.637 0.744 0.256
#> GSM1178993     2   0.808      0.691 0.248 0.752
#> GSM1178999     2   0.706      0.780 0.192 0.808
#> GSM1179021     2   0.000      0.966 0.000 1.000
#> GSM1179025     2   0.000      0.966 0.000 1.000
#> GSM1179027     2   0.000      0.966 0.000 1.000
#> GSM1179011     1   0.204      0.962 0.968 0.032
#> GSM1179023     1   0.000      0.993 1.000 0.000
#> GSM1179029     1   0.000      0.993 1.000 0.000
#> GSM1179034     1   0.000      0.993 1.000 0.000
#> GSM1179040     2   0.000      0.966 0.000 1.000
#> GSM1178988     1   0.000      0.993 1.000 0.000
#> GSM1179037     1   0.000      0.993 1.000 0.000

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>            class entropy silhouette    p1    p2    p3
#> GSM1178971     1  0.0000     0.9345 1.000 0.000 0.000
#> GSM1178979     2  0.1643     0.9275 0.000 0.956 0.044
#> GSM1179009     1  0.1585     0.9151 0.964 0.028 0.008
#> GSM1179031     2  0.0424     0.9435 0.000 0.992 0.008
#> GSM1178970     3  0.6302    -0.0633 0.000 0.480 0.520
#> GSM1178972     3  0.6305    -0.1145 0.000 0.484 0.516
#> GSM1178973     1  0.0424     0.9307 0.992 0.008 0.000
#> GSM1178974     2  0.3412     0.8495 0.000 0.876 0.124
#> GSM1178977     2  0.0237     0.9436 0.000 0.996 0.004
#> GSM1178978     1  0.0892     0.9278 0.980 0.000 0.020
#> GSM1178998     1  0.0424     0.9346 0.992 0.000 0.008
#> GSM1179010     1  0.6244     0.1656 0.560 0.000 0.440
#> GSM1179018     3  0.6267     0.1961 0.452 0.000 0.548
#> GSM1179024     1  0.0000     0.9345 1.000 0.000 0.000
#> GSM1178984     1  0.1860     0.9207 0.948 0.000 0.052
#> GSM1178990     1  0.0424     0.9346 0.992 0.000 0.008
#> GSM1178991     1  0.0592     0.9296 0.988 0.000 0.012
#> GSM1178994     1  0.1964     0.9183 0.944 0.000 0.056
#> GSM1178997     1  0.0000     0.9345 1.000 0.000 0.000
#> GSM1179000     1  0.0000     0.9345 1.000 0.000 0.000
#> GSM1179013     1  0.0000     0.9345 1.000 0.000 0.000
#> GSM1179014     1  0.0892     0.9335 0.980 0.000 0.020
#> GSM1179019     1  0.0000     0.9345 1.000 0.000 0.000
#> GSM1179020     1  0.0000     0.9345 1.000 0.000 0.000
#> GSM1179022     1  0.0000     0.9345 1.000 0.000 0.000
#> GSM1179028     2  0.0424     0.9435 0.000 0.992 0.008
#> GSM1179032     1  0.0000     0.9345 1.000 0.000 0.000
#> GSM1179041     2  0.0237     0.9436 0.000 0.996 0.004
#> GSM1179042     2  0.0237     0.9436 0.000 0.996 0.004
#> GSM1178976     3  0.0829     0.7426 0.012 0.004 0.984
#> GSM1178981     1  0.2537     0.9007 0.920 0.000 0.080
#> GSM1178982     1  0.0592     0.9346 0.988 0.000 0.012
#> GSM1178983     1  0.0000     0.9345 1.000 0.000 0.000
#> GSM1178985     1  0.5216     0.6627 0.740 0.000 0.260
#> GSM1178992     3  0.4605     0.7047 0.204 0.000 0.796
#> GSM1179005     1  0.1289     0.9296 0.968 0.000 0.032
#> GSM1179007     1  0.1529     0.9265 0.960 0.000 0.040
#> GSM1179012     1  0.3551     0.8488 0.868 0.000 0.132
#> GSM1179016     3  0.6252     0.2229 0.444 0.000 0.556
#> GSM1179030     1  0.1989     0.9224 0.948 0.004 0.048
#> GSM1179038     1  0.1411     0.9284 0.964 0.000 0.036
#> GSM1178987     3  0.3116     0.7478 0.108 0.000 0.892
#> GSM1179003     3  0.1753     0.7034 0.000 0.048 0.952
#> GSM1179004     3  0.2448     0.7522 0.076 0.000 0.924
#> GSM1179039     2  0.0424     0.9435 0.000 0.992 0.008
#> GSM1178975     1  0.1031     0.9200 0.976 0.024 0.000
#> GSM1178980     2  0.0829     0.9407 0.004 0.984 0.012
#> GSM1178995     1  0.0000     0.9345 1.000 0.000 0.000
#> GSM1178996     1  0.3619     0.8443 0.864 0.000 0.136
#> GSM1179001     1  0.0237     0.9347 0.996 0.000 0.004
#> GSM1179002     1  0.1411     0.9282 0.964 0.000 0.036
#> GSM1179006     1  0.5058     0.6840 0.756 0.000 0.244
#> GSM1179008     1  0.0000     0.9345 1.000 0.000 0.000
#> GSM1179015     1  0.3267     0.8664 0.884 0.000 0.116
#> GSM1179017     3  0.0424     0.7316 0.000 0.008 0.992
#> GSM1179026     3  0.1031     0.7477 0.024 0.000 0.976
#> GSM1179033     1  0.2796     0.8900 0.908 0.000 0.092
#> GSM1179035     3  0.4121     0.7247 0.168 0.000 0.832
#> GSM1179036     1  0.1964     0.9182 0.944 0.000 0.056
#> GSM1178986     1  0.1643     0.9247 0.956 0.000 0.044
#> GSM1178989     3  0.0592     0.7421 0.012 0.000 0.988
#> GSM1178993     2  0.2749     0.8773 0.064 0.924 0.012
#> GSM1178999     2  0.6498     0.3566 0.008 0.596 0.396
#> GSM1179021     2  0.0424     0.9425 0.000 0.992 0.008
#> GSM1179025     2  0.1643     0.9269 0.000 0.956 0.044
#> GSM1179027     2  0.0424     0.9425 0.000 0.992 0.008
#> GSM1179011     1  0.6129     0.4524 0.668 0.324 0.008
#> GSM1179023     1  0.0000     0.9345 1.000 0.000 0.000
#> GSM1179029     1  0.1031     0.9322 0.976 0.000 0.024
#> GSM1179034     1  0.0000     0.9345 1.000 0.000 0.000
#> GSM1179040     2  0.0592     0.9419 0.000 0.988 0.012
#> GSM1178988     3  0.0747     0.7453 0.016 0.000 0.984
#> GSM1179037     3  0.4702     0.6951 0.212 0.000 0.788

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>            class entropy silhouette    p1    p2    p3    p4
#> GSM1178971     1  0.2149    0.71053 0.912 0.000 0.000 0.088
#> GSM1178979     2  0.5309    0.58864 0.000 0.700 0.044 0.256
#> GSM1179009     4  0.6625    0.10485 0.424 0.016 0.048 0.512
#> GSM1179031     2  0.0000    0.74567 0.000 1.000 0.000 0.000
#> GSM1178970     3  0.4163    0.64073 0.000 0.188 0.792 0.020
#> GSM1178972     2  0.5860    0.22216 0.000 0.580 0.380 0.040
#> GSM1178973     1  0.4746    0.35658 0.632 0.000 0.000 0.368
#> GSM1178974     2  0.2965    0.68369 0.000 0.892 0.036 0.072
#> GSM1178977     2  0.2976    0.71362 0.000 0.872 0.008 0.120
#> GSM1178978     1  0.6817    0.00859 0.492 0.000 0.100 0.408
#> GSM1178998     1  0.2714    0.69603 0.884 0.000 0.004 0.112
#> GSM1179010     3  0.4867    0.49999 0.232 0.000 0.736 0.032
#> GSM1179018     4  0.7044    0.08379 0.120 0.000 0.428 0.452
#> GSM1179024     1  0.2868    0.70631 0.864 0.000 0.000 0.136
#> GSM1178984     1  0.5351    0.59631 0.744 0.000 0.104 0.152
#> GSM1178990     1  0.1557    0.72965 0.944 0.000 0.000 0.056
#> GSM1178991     1  0.4535    0.46583 0.704 0.000 0.004 0.292
#> GSM1178994     1  0.5293    0.60341 0.748 0.000 0.100 0.152
#> GSM1178997     1  0.3768    0.67844 0.808 0.008 0.000 0.184
#> GSM1179000     1  0.3172    0.69705 0.840 0.000 0.000 0.160
#> GSM1179013     1  0.3172    0.69643 0.840 0.000 0.000 0.160
#> GSM1179014     1  0.4855    0.47610 0.600 0.000 0.000 0.400
#> GSM1179019     1  0.2760    0.71400 0.872 0.000 0.000 0.128
#> GSM1179020     1  0.2149    0.72394 0.912 0.000 0.000 0.088
#> GSM1179022     1  0.2081    0.72596 0.916 0.000 0.000 0.084
#> GSM1179028     2  0.0188    0.74540 0.000 0.996 0.000 0.004
#> GSM1179032     1  0.1211    0.73198 0.960 0.000 0.000 0.040
#> GSM1179041     2  0.0000    0.74567 0.000 1.000 0.000 0.000
#> GSM1179042     2  0.0336    0.74338 0.000 0.992 0.000 0.008
#> GSM1178976     3  0.1182    0.78503 0.000 0.016 0.968 0.016
#> GSM1178981     1  0.7203    0.28338 0.536 0.000 0.288 0.176
#> GSM1178982     1  0.5993    0.39683 0.628 0.000 0.064 0.308
#> GSM1178983     1  0.5339    0.35035 0.624 0.000 0.020 0.356
#> GSM1178985     3  0.6716    0.19438 0.320 0.000 0.568 0.112
#> GSM1178992     1  0.7814    0.13171 0.416 0.000 0.304 0.280
#> GSM1179005     1  0.2101    0.72055 0.928 0.000 0.012 0.060
#> GSM1179007     1  0.3435    0.69131 0.864 0.000 0.036 0.100
#> GSM1179012     1  0.3051    0.71214 0.884 0.000 0.088 0.028
#> GSM1179016     1  0.6145    0.31960 0.492 0.000 0.048 0.460
#> GSM1179030     1  0.3656    0.72568 0.868 0.012 0.040 0.080
#> GSM1179038     1  0.1022    0.73512 0.968 0.000 0.000 0.032
#> GSM1178987     3  0.0804    0.78950 0.012 0.000 0.980 0.008
#> GSM1179003     3  0.6664    0.41313 0.000 0.216 0.620 0.164
#> GSM1179004     3  0.0937    0.78911 0.012 0.000 0.976 0.012
#> GSM1179039     2  0.0188    0.74540 0.000 0.996 0.000 0.004
#> GSM1178975     1  0.4781    0.41949 0.660 0.004 0.000 0.336
#> GSM1178980     2  0.5662    0.31287 0.016 0.524 0.004 0.456
#> GSM1178995     1  0.2345    0.70304 0.900 0.000 0.000 0.100
#> GSM1178996     1  0.4267    0.68013 0.788 0.000 0.024 0.188
#> GSM1179001     1  0.1389    0.73607 0.952 0.000 0.000 0.048
#> GSM1179002     1  0.1637    0.72776 0.940 0.000 0.000 0.060
#> GSM1179006     1  0.6659    0.22911 0.512 0.000 0.400 0.088
#> GSM1179008     1  0.1211    0.73228 0.960 0.000 0.000 0.040
#> GSM1179015     1  0.4539    0.61739 0.720 0.000 0.008 0.272
#> GSM1179017     4  0.6826   -0.34503 0.084 0.004 0.456 0.456
#> GSM1179026     3  0.1970    0.75637 0.008 0.000 0.932 0.060
#> GSM1179033     1  0.7335    0.15129 0.488 0.000 0.344 0.168
#> GSM1179035     3  0.2670    0.75145 0.072 0.000 0.904 0.024
#> GSM1179036     1  0.2654    0.72637 0.888 0.000 0.004 0.108
#> GSM1178986     1  0.3688    0.66799 0.792 0.000 0.000 0.208
#> GSM1178989     3  0.0592    0.78211 0.000 0.000 0.984 0.016
#> GSM1178993     4  0.7126   -0.03321 0.088 0.376 0.016 0.520
#> GSM1178999     4  0.7714   -0.25308 0.004 0.372 0.192 0.432
#> GSM1179021     2  0.4477    0.56795 0.000 0.688 0.000 0.312
#> GSM1179025     2  0.0376    0.74534 0.000 0.992 0.004 0.004
#> GSM1179027     2  0.5383    0.34430 0.000 0.536 0.012 0.452
#> GSM1179011     4  0.7300    0.34828 0.304 0.180 0.000 0.516
#> GSM1179023     1  0.1302    0.73367 0.956 0.000 0.000 0.044
#> GSM1179029     1  0.4730    0.52580 0.636 0.000 0.000 0.364
#> GSM1179034     1  0.1118    0.73075 0.964 0.000 0.000 0.036
#> GSM1179040     2  0.5172    0.43922 0.000 0.588 0.008 0.404
#> GSM1178988     3  0.0524    0.78494 0.004 0.000 0.988 0.008
#> GSM1179037     3  0.2255    0.76106 0.068 0.000 0.920 0.012

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>            class entropy silhouette    p1    p2    p3    p4    p5
#> GSM1178971     1  0.0994     0.8183 0.972 0.004 0.004 0.016 0.004
#> GSM1178979     4  0.3010     0.6879 0.000 0.172 0.000 0.824 0.004
#> GSM1179009     4  0.3962     0.6819 0.152 0.012 0.036 0.800 0.000
#> GSM1179031     2  0.1197     0.8891 0.000 0.952 0.000 0.048 0.000
#> GSM1178970     3  0.3907     0.5692 0.000 0.204 0.772 0.008 0.016
#> GSM1178972     2  0.3933     0.6990 0.000 0.776 0.196 0.008 0.020
#> GSM1178973     4  0.4437     0.1345 0.464 0.000 0.000 0.532 0.004
#> GSM1178974     2  0.2069     0.8435 0.000 0.924 0.012 0.012 0.052
#> GSM1178977     2  0.4707     0.3288 0.000 0.588 0.000 0.392 0.020
#> GSM1178978     1  0.5762     0.3272 0.588 0.000 0.308 0.100 0.004
#> GSM1178998     1  0.1377     0.8154 0.956 0.000 0.020 0.020 0.004
#> GSM1179010     3  0.2890     0.6546 0.160 0.000 0.836 0.004 0.000
#> GSM1179018     4  0.3387     0.6765 0.004 0.000 0.196 0.796 0.004
#> GSM1179024     1  0.2280     0.7764 0.880 0.000 0.000 0.000 0.120
#> GSM1178984     1  0.3851     0.6345 0.768 0.000 0.212 0.016 0.004
#> GSM1178990     1  0.0794     0.8225 0.972 0.000 0.000 0.000 0.028
#> GSM1178991     4  0.3142     0.7314 0.108 0.000 0.004 0.856 0.032
#> GSM1178994     1  0.4044     0.5861 0.732 0.000 0.252 0.012 0.004
#> GSM1178997     1  0.3003     0.7767 0.864 0.044 0.000 0.000 0.092
#> GSM1179000     1  0.2280     0.7809 0.880 0.000 0.000 0.000 0.120
#> GSM1179013     1  0.2074     0.7894 0.896 0.000 0.000 0.000 0.104
#> GSM1179014     5  0.4219     0.3722 0.416 0.000 0.000 0.000 0.584
#> GSM1179019     1  0.1121     0.8212 0.956 0.000 0.000 0.000 0.044
#> GSM1179020     1  0.1197     0.8166 0.952 0.000 0.000 0.000 0.048
#> GSM1179022     1  0.1410     0.8131 0.940 0.000 0.000 0.000 0.060
#> GSM1179028     2  0.1205     0.8888 0.000 0.956 0.000 0.040 0.004
#> GSM1179032     1  0.0703     0.8221 0.976 0.000 0.000 0.000 0.024
#> GSM1179041     2  0.1282     0.8895 0.000 0.952 0.000 0.044 0.004
#> GSM1179042     2  0.1106     0.8713 0.000 0.964 0.000 0.024 0.012
#> GSM1178976     3  0.0727     0.7097 0.012 0.004 0.980 0.004 0.000
#> GSM1178981     3  0.4774     0.2607 0.444 0.000 0.540 0.012 0.004
#> GSM1178982     1  0.5036     0.5761 0.704 0.000 0.200 0.092 0.004
#> GSM1178983     1  0.4280     0.4519 0.676 0.000 0.008 0.312 0.004
#> GSM1178985     3  0.4010     0.5755 0.240 0.004 0.744 0.008 0.004
#> GSM1178992     5  0.6743     0.1710 0.264 0.000 0.340 0.000 0.396
#> GSM1179005     1  0.0693     0.8214 0.980 0.000 0.012 0.000 0.008
#> GSM1179007     1  0.1644     0.8061 0.940 0.000 0.048 0.008 0.004
#> GSM1179012     1  0.3086     0.6927 0.816 0.000 0.180 0.004 0.000
#> GSM1179016     5  0.1809     0.5303 0.060 0.000 0.012 0.000 0.928
#> GSM1179030     1  0.4547     0.6385 0.744 0.008 0.052 0.000 0.196
#> GSM1179038     1  0.2293     0.8019 0.900 0.000 0.000 0.016 0.084
#> GSM1178987     3  0.0451     0.7085 0.008 0.000 0.988 0.004 0.000
#> GSM1179003     5  0.6107     0.2537 0.000 0.016 0.144 0.228 0.612
#> GSM1179004     3  0.0671     0.7114 0.016 0.000 0.980 0.004 0.000
#> GSM1179039     2  0.1282     0.8895 0.000 0.952 0.000 0.044 0.004
#> GSM1178975     4  0.4959     0.4202 0.308 0.020 0.000 0.652 0.020
#> GSM1178980     4  0.0613     0.7931 0.004 0.008 0.000 0.984 0.004
#> GSM1178995     1  0.0854     0.8186 0.976 0.000 0.008 0.012 0.004
#> GSM1178996     1  0.3658     0.7734 0.840 0.008 0.032 0.012 0.108
#> GSM1179001     1  0.3191     0.7786 0.872 0.040 0.000 0.024 0.064
#> GSM1179002     1  0.2429     0.8077 0.916 0.028 0.004 0.020 0.032
#> GSM1179006     3  0.6452     0.0874 0.428 0.004 0.448 0.012 0.108
#> GSM1179008     1  0.2684     0.7986 0.900 0.024 0.000 0.032 0.044
#> GSM1179015     1  0.3790     0.5390 0.724 0.000 0.004 0.000 0.272
#> GSM1179017     5  0.2331     0.4669 0.000 0.008 0.068 0.016 0.908
#> GSM1179026     3  0.4264     0.2568 0.000 0.004 0.620 0.000 0.376
#> GSM1179033     3  0.5365     0.2968 0.424 0.004 0.532 0.036 0.004
#> GSM1179035     3  0.1412     0.7131 0.036 0.004 0.952 0.008 0.000
#> GSM1179036     1  0.5542     0.5499 0.696 0.024 0.004 0.088 0.188
#> GSM1178986     5  0.4803     0.1043 0.492 0.000 0.004 0.012 0.492
#> GSM1178989     3  0.0290     0.6999 0.000 0.000 0.992 0.000 0.008
#> GSM1178993     4  0.0771     0.7930 0.004 0.020 0.000 0.976 0.000
#> GSM1178999     4  0.3733     0.7037 0.000 0.004 0.032 0.804 0.160
#> GSM1179021     4  0.2074     0.7524 0.000 0.104 0.000 0.896 0.000
#> GSM1179025     2  0.1697     0.8849 0.000 0.932 0.008 0.060 0.000
#> GSM1179027     4  0.0510     0.7925 0.000 0.016 0.000 0.984 0.000
#> GSM1179011     4  0.1568     0.7925 0.036 0.020 0.000 0.944 0.000
#> GSM1179023     1  0.0703     0.8214 0.976 0.000 0.000 0.000 0.024
#> GSM1179029     5  0.5327     0.5332 0.288 0.020 0.004 0.036 0.652
#> GSM1179034     1  0.1041     0.8219 0.964 0.000 0.000 0.004 0.032
#> GSM1179040     4  0.1478     0.7778 0.000 0.064 0.000 0.936 0.000
#> GSM1178988     3  0.1341     0.6716 0.000 0.000 0.944 0.000 0.056
#> GSM1179037     3  0.1605     0.7104 0.040 0.004 0.944 0.012 0.000

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>            class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM1178971     1  0.3943    0.38459 0.724 0.000 0.016 0.008 0.248 0.004
#> GSM1178979     4  0.2512    0.74788 0.000 0.116 0.008 0.868 0.008 0.000
#> GSM1179009     4  0.4222    0.66074 0.140 0.008 0.048 0.776 0.028 0.000
#> GSM1179031     2  0.0146    0.82830 0.000 0.996 0.000 0.000 0.004 0.000
#> GSM1178970     3  0.4183    0.55453 0.000 0.116 0.752 0.004 0.128 0.000
#> GSM1178972     2  0.5122    0.56794 0.000 0.576 0.104 0.000 0.320 0.000
#> GSM1178973     4  0.5212    0.00596 0.440 0.000 0.008 0.484 0.068 0.000
#> GSM1178974     2  0.3695    0.69714 0.000 0.712 0.000 0.000 0.272 0.016
#> GSM1178977     2  0.6945    0.18450 0.000 0.392 0.068 0.328 0.212 0.000
#> GSM1178978     3  0.6680    0.23003 0.368 0.004 0.460 0.088 0.068 0.012
#> GSM1178998     1  0.3366    0.59386 0.824 0.000 0.036 0.008 0.128 0.004
#> GSM1179010     3  0.2401    0.66920 0.060 0.000 0.892 0.000 0.044 0.004
#> GSM1179018     4  0.3577    0.69654 0.000 0.000 0.168 0.792 0.020 0.020
#> GSM1179024     1  0.3780    0.49676 0.728 0.000 0.000 0.004 0.020 0.248
#> GSM1178984     1  0.5098    0.35094 0.632 0.000 0.240 0.004 0.124 0.000
#> GSM1178990     1  0.3404    0.67082 0.824 0.000 0.016 0.008 0.020 0.132
#> GSM1178991     4  0.5196    0.54797 0.060 0.000 0.012 0.692 0.044 0.192
#> GSM1178994     3  0.4854    0.25956 0.432 0.000 0.528 0.008 0.020 0.012
#> GSM1178997     1  0.2830    0.65872 0.864 0.068 0.000 0.000 0.004 0.064
#> GSM1179000     1  0.2994    0.58598 0.788 0.004 0.000 0.000 0.000 0.208
#> GSM1179013     1  0.3541    0.49307 0.728 0.000 0.000 0.000 0.012 0.260
#> GSM1179014     6  0.3126    0.56427 0.248 0.000 0.000 0.000 0.000 0.752
#> GSM1179019     1  0.1584    0.69068 0.928 0.008 0.000 0.000 0.000 0.064
#> GSM1179020     1  0.1549    0.68540 0.936 0.000 0.000 0.000 0.020 0.044
#> GSM1179022     1  0.2420    0.66845 0.864 0.000 0.000 0.004 0.004 0.128
#> GSM1179028     2  0.0603    0.82581 0.000 0.980 0.000 0.004 0.016 0.000
#> GSM1179032     1  0.1049    0.69090 0.960 0.000 0.000 0.000 0.008 0.032
#> GSM1179041     2  0.0000    0.82781 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1179042     2  0.2257    0.79784 0.000 0.876 0.000 0.008 0.116 0.000
#> GSM1178976     3  0.1588    0.66612 0.000 0.004 0.924 0.000 0.072 0.000
#> GSM1178981     3  0.3680    0.58836 0.216 0.000 0.756 0.000 0.020 0.008
#> GSM1178982     3  0.5841    0.17280 0.428 0.000 0.476 0.036 0.032 0.028
#> GSM1178983     1  0.6485    0.26622 0.556 0.000 0.084 0.272 0.036 0.052
#> GSM1178985     3  0.3588    0.63745 0.148 0.000 0.800 0.004 0.044 0.004
#> GSM1178992     6  0.5821    0.21923 0.132 0.000 0.340 0.000 0.016 0.512
#> GSM1179005     1  0.2828    0.65245 0.876 0.000 0.068 0.004 0.036 0.016
#> GSM1179007     1  0.3654    0.59130 0.812 0.000 0.072 0.004 0.104 0.008
#> GSM1179012     1  0.6074    0.13973 0.500 0.000 0.368 0.004 0.064 0.064
#> GSM1179016     6  0.2033    0.48666 0.056 0.000 0.004 0.004 0.020 0.916
#> GSM1179030     6  0.7176    0.27387 0.372 0.028 0.168 0.004 0.040 0.388
#> GSM1179038     1  0.4658    0.59376 0.744 0.000 0.020 0.012 0.084 0.140
#> GSM1178987     3  0.0717    0.66647 0.000 0.000 0.976 0.000 0.016 0.008
#> GSM1179003     5  0.6039    0.07649 0.000 0.016 0.028 0.112 0.576 0.268
#> GSM1179004     3  0.0520    0.66466 0.000 0.000 0.984 0.000 0.008 0.008
#> GSM1179039     2  0.0458    0.82729 0.000 0.984 0.000 0.016 0.000 0.000
#> GSM1178975     4  0.5413    0.45026 0.188 0.008 0.000 0.628 0.172 0.004
#> GSM1178980     4  0.0862    0.80484 0.000 0.008 0.000 0.972 0.016 0.004
#> GSM1178995     1  0.3024    0.60357 0.844 0.000 0.028 0.004 0.120 0.004
#> GSM1178996     5  0.5758    0.37710 0.372 0.004 0.052 0.004 0.528 0.040
#> GSM1179001     5  0.4568    0.58801 0.300 0.000 0.000 0.020 0.652 0.028
#> GSM1179002     5  0.4660    0.43890 0.428 0.000 0.004 0.008 0.540 0.020
#> GSM1179006     3  0.7759    0.12912 0.244 0.000 0.356 0.012 0.148 0.240
#> GSM1179008     1  0.4938   -0.39953 0.488 0.000 0.000 0.020 0.464 0.028
#> GSM1179015     6  0.4883    0.36754 0.400 0.000 0.008 0.004 0.036 0.552
#> GSM1179017     6  0.4058    0.12621 0.000 0.000 0.016 0.004 0.320 0.660
#> GSM1179026     3  0.6009    0.14766 0.000 0.000 0.432 0.000 0.300 0.268
#> GSM1179033     3  0.6042    0.23625 0.388 0.000 0.440 0.008 0.160 0.004
#> GSM1179035     3  0.2357    0.66841 0.012 0.000 0.888 0.004 0.092 0.004
#> GSM1179036     5  0.4403    0.58759 0.280 0.000 0.000 0.024 0.676 0.020
#> GSM1178986     6  0.4967    0.57241 0.240 0.000 0.040 0.020 0.020 0.680
#> GSM1178989     3  0.2065    0.65607 0.000 0.000 0.912 0.004 0.032 0.052
#> GSM1178993     4  0.0458    0.80729 0.000 0.016 0.000 0.984 0.000 0.000
#> GSM1178999     4  0.3113    0.74284 0.000 0.004 0.004 0.828 0.020 0.144
#> GSM1179021     4  0.1219    0.80083 0.000 0.048 0.000 0.948 0.004 0.000
#> GSM1179025     2  0.1138    0.82394 0.000 0.960 0.012 0.024 0.004 0.000
#> GSM1179027     4  0.0891    0.80700 0.000 0.024 0.000 0.968 0.008 0.000
#> GSM1179011     4  0.0870    0.80672 0.012 0.012 0.000 0.972 0.004 0.000
#> GSM1179023     1  0.1265    0.69018 0.948 0.000 0.000 0.000 0.008 0.044
#> GSM1179029     6  0.6034    0.42809 0.224 0.000 0.004 0.020 0.196 0.556
#> GSM1179034     1  0.1485    0.68533 0.944 0.000 0.000 0.004 0.028 0.024
#> GSM1179040     4  0.0935    0.80712 0.000 0.032 0.000 0.964 0.004 0.000
#> GSM1178988     3  0.1556    0.64189 0.000 0.000 0.920 0.000 0.000 0.080
#> GSM1179037     3  0.2763    0.66719 0.016 0.000 0.876 0.008 0.084 0.016

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

consensus_heatmap(res, k = 2)

plot of chunk tab-CV-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) protocol(p) k
#> CV:NMF 73           0.0820      0.0828 2
#> CV:NMF 66           0.0157      0.0338 3
#> CV:NMF 48           0.0895      0.1147 4
#> CV:NMF 59           0.0552      0.0321 5
#> CV:NMF 48           0.0243      0.0106 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 31632 rows and 73 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 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-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.640           0.810       0.908         0.3321 0.703   0.703
#> 3 3 0.289           0.259       0.638         0.6212 0.909   0.870
#> 4 4 0.353           0.550       0.745         0.1916 0.628   0.447
#> 5 5 0.481           0.598       0.755         0.1126 0.883   0.691
#> 6 6 0.529           0.626       0.793         0.0454 0.989   0.961

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
#> GSM1178971     1  0.1843      0.904 0.972 0.028
#> GSM1178979     2  0.9087      0.540 0.324 0.676
#> GSM1179009     1  0.5059      0.852 0.888 0.112
#> GSM1179031     2  0.0000      0.852 0.000 1.000
#> GSM1178970     1  0.9833      0.302 0.576 0.424
#> GSM1178972     2  0.0000      0.852 0.000 1.000
#> GSM1178973     1  0.0000      0.903 1.000 0.000
#> GSM1178974     2  0.0000      0.852 0.000 1.000
#> GSM1178977     1  0.9491      0.465 0.632 0.368
#> GSM1178978     1  0.5408      0.850 0.876 0.124
#> GSM1178998     1  0.0000      0.903 1.000 0.000
#> GSM1179010     1  0.0000      0.903 1.000 0.000
#> GSM1179018     1  0.4022      0.882 0.920 0.080
#> GSM1179024     1  0.0000      0.903 1.000 0.000
#> GSM1178984     1  0.2043      0.904 0.968 0.032
#> GSM1178990     1  0.0938      0.904 0.988 0.012
#> GSM1178991     1  0.0938      0.905 0.988 0.012
#> GSM1178994     1  0.2236      0.903 0.964 0.036
#> GSM1178997     1  0.0938      0.904 0.988 0.012
#> GSM1179000     1  0.0938      0.904 0.988 0.012
#> GSM1179013     1  0.0000      0.903 1.000 0.000
#> GSM1179014     1  0.2948      0.892 0.948 0.052
#> GSM1179019     1  0.0938      0.904 0.988 0.012
#> GSM1179020     1  0.0376      0.903 0.996 0.004
#> GSM1179022     1  0.0000      0.903 1.000 0.000
#> GSM1179028     2  0.0000      0.852 0.000 1.000
#> GSM1179032     1  0.0000      0.903 1.000 0.000
#> GSM1179041     2  0.0000      0.852 0.000 1.000
#> GSM1179042     2  0.0000      0.852 0.000 1.000
#> GSM1178976     1  0.8909      0.610 0.692 0.308
#> GSM1178981     1  0.2603      0.902 0.956 0.044
#> GSM1178982     1  0.3584      0.893 0.932 0.068
#> GSM1178983     1  0.4022      0.887 0.920 0.080
#> GSM1178985     1  0.4562      0.877 0.904 0.096
#> GSM1178992     1  0.1843      0.905 0.972 0.028
#> GSM1179005     1  0.1184      0.905 0.984 0.016
#> GSM1179007     1  0.1184      0.905 0.984 0.016
#> GSM1179012     1  0.0000      0.903 1.000 0.000
#> GSM1179016     1  0.9000      0.576 0.684 0.316
#> GSM1179030     1  0.4431      0.880 0.908 0.092
#> GSM1179038     1  0.1414      0.905 0.980 0.020
#> GSM1178987     1  0.2603      0.902 0.956 0.044
#> GSM1179003     2  0.9491      0.438 0.368 0.632
#> GSM1179004     1  0.1843      0.905 0.972 0.028
#> GSM1179039     2  0.0000      0.852 0.000 1.000
#> GSM1178975     1  0.0000      0.903 1.000 0.000
#> GSM1178980     2  0.9323      0.495 0.348 0.652
#> GSM1178995     1  0.1184      0.905 0.984 0.016
#> GSM1178996     1  0.4022      0.887 0.920 0.080
#> GSM1179001     1  0.0000      0.903 1.000 0.000
#> GSM1179002     1  0.0000      0.903 1.000 0.000
#> GSM1179006     1  0.5408      0.852 0.876 0.124
#> GSM1179008     1  0.0000      0.903 1.000 0.000
#> GSM1179015     1  0.0000      0.903 1.000 0.000
#> GSM1179017     1  0.9963      0.147 0.536 0.464
#> GSM1179026     1  0.2778      0.900 0.952 0.048
#> GSM1179033     1  0.2948      0.899 0.948 0.052
#> GSM1179035     1  0.2778      0.900 0.952 0.048
#> GSM1179036     1  0.3584      0.893 0.932 0.068
#> GSM1178986     1  0.3879      0.890 0.924 0.076
#> GSM1178989     1  0.8861      0.617 0.696 0.304
#> GSM1178993     1  0.8763      0.615 0.704 0.296
#> GSM1178999     2  0.7602      0.712 0.220 0.780
#> GSM1179021     2  0.7453      0.720 0.212 0.788
#> GSM1179025     2  0.0000      0.852 0.000 1.000
#> GSM1179027     1  0.9866      0.272 0.568 0.432
#> GSM1179011     1  0.2236      0.899 0.964 0.036
#> GSM1179023     1  0.0000      0.903 1.000 0.000
#> GSM1179029     1  0.0000      0.903 1.000 0.000
#> GSM1179034     1  0.0000      0.903 1.000 0.000
#> GSM1179040     1  0.9909      0.230 0.556 0.444
#> GSM1178988     1  0.7299      0.758 0.796 0.204
#> GSM1179037     1  0.2778      0.900 0.952 0.048

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>            class entropy silhouette    p1    p2    p3
#> GSM1178971     1  0.5882   1.13e-01 0.652 0.000 0.348
#> GSM1178979     2  0.9573   3.83e-01 0.328 0.460 0.212
#> GSM1179009     1  0.5016   3.78e-01 0.760 0.000 0.240
#> GSM1179031     2  0.0000   8.17e-01 0.000 1.000 0.000
#> GSM1178970     1  0.9086   1.33e-01 0.552 0.220 0.228
#> GSM1178972     2  0.1163   8.10e-01 0.000 0.972 0.028
#> GSM1178973     3  0.6180   3.27e-01 0.416 0.000 0.584
#> GSM1178974     2  0.0237   8.16e-01 0.000 0.996 0.004
#> GSM1178977     1  0.8568   2.03e-01 0.604 0.168 0.228
#> GSM1178978     1  0.5291   3.60e-01 0.732 0.000 0.268
#> GSM1178998     1  0.6111  -1.80e-02 0.604 0.000 0.396
#> GSM1179010     1  0.6045   1.80e-02 0.620 0.000 0.380
#> GSM1179018     1  0.4233   4.33e-01 0.836 0.004 0.160
#> GSM1179024     1  0.6308  -2.08e-01 0.508 0.000 0.492
#> GSM1178984     1  0.4291   3.97e-01 0.820 0.000 0.180
#> GSM1178990     1  0.4974   3.13e-01 0.764 0.000 0.236
#> GSM1178991     1  0.6309  -2.97e-01 0.504 0.000 0.496
#> GSM1178994     1  0.4062   4.11e-01 0.836 0.000 0.164
#> GSM1178997     1  0.6308  -2.24e-01 0.508 0.000 0.492
#> GSM1179000     3  0.6309   3.11e-02 0.500 0.000 0.500
#> GSM1179013     1  0.6308  -2.08e-01 0.508 0.000 0.492
#> GSM1179014     1  0.6204   6.69e-05 0.576 0.000 0.424
#> GSM1179019     1  0.6309  -2.27e-01 0.504 0.000 0.496
#> GSM1179020     1  0.6308  -2.17e-01 0.508 0.000 0.492
#> GSM1179022     1  0.6308  -2.08e-01 0.508 0.000 0.492
#> GSM1179028     2  0.0000   8.17e-01 0.000 1.000 0.000
#> GSM1179032     1  0.6308  -2.08e-01 0.508 0.000 0.492
#> GSM1179041     2  0.0000   8.17e-01 0.000 1.000 0.000
#> GSM1179042     2  0.0000   8.17e-01 0.000 1.000 0.000
#> GSM1178976     1  0.7297   2.88e-01 0.708 0.120 0.172
#> GSM1178981     1  0.2301   4.75e-01 0.936 0.004 0.060
#> GSM1178982     1  0.3845   4.61e-01 0.872 0.012 0.116
#> GSM1178983     1  0.4059   4.52e-01 0.860 0.012 0.128
#> GSM1178985     1  0.3091   4.56e-01 0.912 0.016 0.072
#> GSM1178992     1  0.2400   4.74e-01 0.932 0.004 0.064
#> GSM1179005     1  0.2356   4.65e-01 0.928 0.000 0.072
#> GSM1179007     1  0.2356   4.65e-01 0.928 0.000 0.072
#> GSM1179012     1  0.6079   1.68e-02 0.612 0.000 0.388
#> GSM1179016     1  0.7368   2.11e-01 0.604 0.044 0.352
#> GSM1179030     1  0.4349   4.51e-01 0.852 0.020 0.128
#> GSM1179038     1  0.2959   4.56e-01 0.900 0.000 0.100
#> GSM1178987     1  0.2301   4.75e-01 0.936 0.004 0.060
#> GSM1179003     2  0.9892   3.49e-01 0.340 0.392 0.268
#> GSM1179004     1  0.1989   4.75e-01 0.948 0.004 0.048
#> GSM1179039     2  0.0000   8.17e-01 0.000 1.000 0.000
#> GSM1178975     3  0.6180   3.27e-01 0.416 0.000 0.584
#> GSM1178980     3  0.9811  -5.53e-01 0.240 0.380 0.380
#> GSM1178995     1  0.2537   4.63e-01 0.920 0.000 0.080
#> GSM1178996     1  0.5008   3.91e-01 0.804 0.016 0.180
#> GSM1179001     1  0.6305  -1.93e-01 0.516 0.000 0.484
#> GSM1179002     1  0.6305  -1.93e-01 0.516 0.000 0.484
#> GSM1179006     1  0.3752   4.39e-01 0.884 0.020 0.096
#> GSM1179008     1  0.6305  -1.93e-01 0.516 0.000 0.484
#> GSM1179015     1  0.6126   2.52e-03 0.600 0.000 0.400
#> GSM1179017     1  0.9306  -1.70e-02 0.480 0.172 0.348
#> GSM1179026     1  0.1765   4.74e-01 0.956 0.004 0.040
#> GSM1179033     1  0.1482   4.76e-01 0.968 0.012 0.020
#> GSM1179035     1  0.1411   4.73e-01 0.964 0.000 0.036
#> GSM1179036     1  0.3207   4.64e-01 0.904 0.012 0.084
#> GSM1178986     1  0.2703   4.70e-01 0.928 0.016 0.056
#> GSM1178989     1  0.7165   2.92e-01 0.716 0.112 0.172
#> GSM1178993     1  0.7741   1.47e-01 0.568 0.056 0.376
#> GSM1178999     2  0.9046   5.68e-01 0.152 0.516 0.332
#> GSM1179021     2  0.8938   5.77e-01 0.144 0.528 0.328
#> GSM1179025     2  0.0237   8.16e-01 0.000 0.996 0.004
#> GSM1179027     1  0.9311  -1.12e-01 0.452 0.164 0.384
#> GSM1179011     3  0.6654   1.78e-01 0.456 0.008 0.536
#> GSM1179023     1  0.6308  -2.08e-01 0.508 0.000 0.492
#> GSM1179029     1  0.6204  -5.68e-02 0.576 0.000 0.424
#> GSM1179034     1  0.6308  -2.08e-01 0.508 0.000 0.492
#> GSM1179040     1  0.9417  -1.39e-01 0.440 0.176 0.384
#> GSM1178988     1  0.5393   3.68e-01 0.808 0.044 0.148
#> GSM1179037     1  0.1411   4.73e-01 0.964 0.000 0.036

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>            class entropy silhouette    p1    p2    p3    p4
#> GSM1178971     1  0.4804    0.44329 0.708 0.000 0.276 0.016
#> GSM1178979     3  0.6862   -0.35934 0.000 0.408 0.488 0.104
#> GSM1179009     3  0.7180    0.40878 0.264 0.000 0.548 0.188
#> GSM1179031     2  0.0000    0.83976 0.000 1.000 0.000 0.000
#> GSM1178970     3  0.6167    0.02896 0.000 0.208 0.668 0.124
#> GSM1178972     2  0.1151    0.81599 0.000 0.968 0.024 0.008
#> GSM1178973     1  0.3606    0.74015 0.840 0.000 0.020 0.140
#> GSM1178974     2  0.0188    0.83735 0.000 0.996 0.004 0.000
#> GSM1178977     3  0.6924    0.12262 0.040 0.152 0.668 0.140
#> GSM1178978     3  0.6855    0.41424 0.276 0.000 0.580 0.144
#> GSM1178998     1  0.5062    0.64609 0.752 0.000 0.184 0.064
#> GSM1179010     1  0.5810    0.51401 0.672 0.000 0.256 0.072
#> GSM1179018     3  0.6594    0.56219 0.240 0.000 0.620 0.140
#> GSM1179024     1  0.0000    0.82372 1.000 0.000 0.000 0.000
#> GSM1178984     3  0.5827    0.40728 0.436 0.000 0.532 0.032
#> GSM1178990     1  0.5099    0.03713 0.612 0.000 0.380 0.008
#> GSM1178991     1  0.3443    0.74849 0.848 0.000 0.016 0.136
#> GSM1178994     3  0.5865    0.46090 0.412 0.000 0.552 0.036
#> GSM1178997     1  0.1820    0.80955 0.944 0.000 0.036 0.020
#> GSM1179000     1  0.1388    0.81364 0.960 0.000 0.028 0.012
#> GSM1179013     1  0.0000    0.82372 1.000 0.000 0.000 0.000
#> GSM1179014     1  0.5486    0.60428 0.720 0.000 0.080 0.200
#> GSM1179019     1  0.0921    0.81665 0.972 0.000 0.028 0.000
#> GSM1179020     1  0.0336    0.82211 0.992 0.000 0.008 0.000
#> GSM1179022     1  0.0000    0.82372 1.000 0.000 0.000 0.000
#> GSM1179028     2  0.0000    0.83976 0.000 1.000 0.000 0.000
#> GSM1179032     1  0.0000    0.82372 1.000 0.000 0.000 0.000
#> GSM1179041     2  0.0000    0.83976 0.000 1.000 0.000 0.000
#> GSM1179042     2  0.0000    0.83976 0.000 1.000 0.000 0.000
#> GSM1178976     3  0.4059    0.38047 0.020 0.096 0.848 0.036
#> GSM1178981     3  0.4770    0.65943 0.288 0.000 0.700 0.012
#> GSM1178982     3  0.5364    0.62977 0.320 0.000 0.652 0.028
#> GSM1178983     3  0.5473    0.61751 0.324 0.000 0.644 0.032
#> GSM1178985     3  0.4574    0.66137 0.220 0.000 0.756 0.024
#> GSM1178992     3  0.4844    0.65402 0.300 0.000 0.688 0.012
#> GSM1179005     3  0.4857    0.63307 0.324 0.000 0.668 0.008
#> GSM1179007     3  0.4978    0.63274 0.324 0.000 0.664 0.012
#> GSM1179012     1  0.5910    0.53777 0.676 0.000 0.236 0.088
#> GSM1179016     4  0.7214    0.42760 0.104 0.020 0.312 0.564
#> GSM1179030     3  0.5858    0.63686 0.292 0.008 0.656 0.044
#> GSM1179038     3  0.5189    0.58736 0.372 0.000 0.616 0.012
#> GSM1178987     3  0.4770    0.65943 0.288 0.000 0.700 0.012
#> GSM1179003     3  0.7216   -0.36343 0.000 0.336 0.508 0.156
#> GSM1179004     3  0.4844    0.65440 0.300 0.000 0.688 0.012
#> GSM1179039     2  0.0000    0.83976 0.000 1.000 0.000 0.000
#> GSM1178975     1  0.3606    0.74015 0.840 0.000 0.020 0.140
#> GSM1178980     4  0.8049   -0.15595 0.004 0.336 0.292 0.368
#> GSM1178995     3  0.4917    0.62572 0.336 0.000 0.656 0.008
#> GSM1178996     3  0.6058    0.41453 0.424 0.004 0.536 0.036
#> GSM1179001     1  0.0376    0.82361 0.992 0.000 0.004 0.004
#> GSM1179002     1  0.0376    0.82361 0.992 0.000 0.004 0.004
#> GSM1179006     3  0.4547    0.62980 0.184 0.008 0.784 0.024
#> GSM1179008     1  0.0376    0.82361 0.992 0.000 0.004 0.004
#> GSM1179015     1  0.5727    0.59213 0.704 0.000 0.200 0.096
#> GSM1179017     4  0.6945    0.44188 0.004 0.136 0.276 0.584
#> GSM1179026     3  0.4690    0.67016 0.260 0.000 0.724 0.016
#> GSM1179033     3  0.4718    0.66661 0.280 0.000 0.708 0.012
#> GSM1179035     3  0.4546    0.67085 0.256 0.000 0.732 0.012
#> GSM1179036     3  0.5233    0.62018 0.332 0.000 0.648 0.020
#> GSM1178986     3  0.5358    0.67508 0.252 0.000 0.700 0.048
#> GSM1178989     3  0.4020    0.38354 0.020 0.088 0.852 0.040
#> GSM1178993     3  0.6287   -0.00914 0.020 0.036 0.600 0.344
#> GSM1178999     2  0.7653    0.04201 0.000 0.460 0.240 0.300
#> GSM1179021     2  0.7557    0.08672 0.000 0.484 0.232 0.284
#> GSM1179025     2  0.0188    0.83735 0.000 0.996 0.004 0.000
#> GSM1179027     3  0.6961   -0.25163 0.000 0.120 0.512 0.368
#> GSM1179011     1  0.5910    0.56160 0.672 0.000 0.084 0.244
#> GSM1179023     1  0.0000    0.82372 1.000 0.000 0.000 0.000
#> GSM1179029     1  0.5091    0.64374 0.752 0.000 0.180 0.068
#> GSM1179034     1  0.0000    0.82372 1.000 0.000 0.000 0.000
#> GSM1179040     3  0.7063   -0.26345 0.000 0.132 0.508 0.360
#> GSM1178988     3  0.4417    0.53197 0.108 0.020 0.828 0.044
#> GSM1179037     3  0.4546    0.67085 0.256 0.000 0.732 0.012

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>            class entropy silhouette    p1    p2    p3    p4    p5
#> GSM1178971     1  0.4768    0.19693 0.592 0.000 0.384 0.024 0.000
#> GSM1178979     4  0.7779    0.52665 0.004 0.312 0.312 0.328 0.044
#> GSM1179009     3  0.6989    0.24830 0.116 0.000 0.524 0.296 0.064
#> GSM1179031     2  0.0000    0.98871 0.000 1.000 0.000 0.000 0.000
#> GSM1178970     3  0.7606   -0.21384 0.004 0.184 0.448 0.304 0.060
#> GSM1178972     2  0.1588    0.93724 0.000 0.948 0.008 0.028 0.016
#> GSM1178973     1  0.3663    0.70658 0.820 0.000 0.004 0.132 0.044
#> GSM1178974     2  0.0290    0.98537 0.000 0.992 0.000 0.000 0.008
#> GSM1178977     3  0.7971   -0.16248 0.040 0.128 0.456 0.316 0.060
#> GSM1178978     3  0.7603    0.11082 0.260 0.000 0.428 0.256 0.056
#> GSM1178998     1  0.6680   -0.00318 0.500 0.000 0.240 0.008 0.252
#> GSM1179010     5  0.6803    0.47044 0.156 0.000 0.372 0.020 0.452
#> GSM1179018     3  0.5648    0.51726 0.064 0.000 0.676 0.216 0.044
#> GSM1179024     1  0.0510    0.79779 0.984 0.000 0.016 0.000 0.000
#> GSM1178984     3  0.5976    0.44988 0.208 0.000 0.632 0.016 0.144
#> GSM1178990     3  0.5365    0.19025 0.416 0.000 0.528 0.000 0.056
#> GSM1178991     1  0.3849    0.71324 0.820 0.000 0.012 0.116 0.052
#> GSM1178994     3  0.5722    0.50109 0.184 0.000 0.664 0.016 0.136
#> GSM1178997     1  0.1743    0.78354 0.940 0.000 0.028 0.028 0.004
#> GSM1179000     1  0.1211    0.78929 0.960 0.000 0.016 0.024 0.000
#> GSM1179013     1  0.0510    0.79779 0.984 0.000 0.016 0.000 0.000
#> GSM1179014     1  0.5429    0.55416 0.712 0.000 0.032 0.104 0.152
#> GSM1179019     1  0.0912    0.79229 0.972 0.000 0.016 0.012 0.000
#> GSM1179020     1  0.0451    0.79661 0.988 0.000 0.008 0.004 0.000
#> GSM1179022     1  0.0510    0.79779 0.984 0.000 0.016 0.000 0.000
#> GSM1179028     2  0.0000    0.98871 0.000 1.000 0.000 0.000 0.000
#> GSM1179032     1  0.0510    0.79779 0.984 0.000 0.016 0.000 0.000
#> GSM1179041     2  0.0000    0.98871 0.000 1.000 0.000 0.000 0.000
#> GSM1179042     2  0.0000    0.98871 0.000 1.000 0.000 0.000 0.000
#> GSM1178976     3  0.5303    0.46105 0.000 0.084 0.732 0.136 0.048
#> GSM1178981     3  0.3239    0.70503 0.068 0.000 0.868 0.020 0.044
#> GSM1178982     3  0.4473    0.66475 0.160 0.000 0.772 0.044 0.024
#> GSM1178983     3  0.4660    0.64142 0.180 0.000 0.752 0.044 0.024
#> GSM1178985     3  0.3299    0.70312 0.060 0.000 0.868 0.036 0.036
#> GSM1178992     3  0.2234    0.69418 0.044 0.000 0.916 0.004 0.036
#> GSM1179005     3  0.2726    0.68228 0.052 0.000 0.884 0.000 0.064
#> GSM1179007     3  0.2790    0.68160 0.052 0.000 0.880 0.000 0.068
#> GSM1179012     5  0.6613    0.49814 0.172 0.000 0.352 0.008 0.468
#> GSM1179016     5  0.7683    0.25216 0.072 0.000 0.236 0.248 0.444
#> GSM1179030     3  0.4930    0.65002 0.160 0.004 0.748 0.068 0.020
#> GSM1179038     3  0.3803    0.66063 0.140 0.000 0.804 0.000 0.056
#> GSM1178987     3  0.3239    0.70493 0.068 0.000 0.868 0.020 0.044
#> GSM1179003     4  0.7540    0.55002 0.000 0.240 0.332 0.384 0.044
#> GSM1179004     3  0.2515    0.69926 0.044 0.000 0.904 0.008 0.044
#> GSM1179039     2  0.0000    0.98871 0.000 1.000 0.000 0.000 0.000
#> GSM1178975     1  0.3663    0.70658 0.820 0.000 0.004 0.132 0.044
#> GSM1178980     4  0.5268    0.54882 0.000 0.216 0.076 0.692 0.016
#> GSM1178995     3  0.2927    0.68194 0.068 0.000 0.872 0.000 0.060
#> GSM1178996     3  0.5275    0.46528 0.276 0.004 0.664 0.032 0.024
#> GSM1179001     1  0.2959    0.72463 0.864 0.000 0.100 0.000 0.036
#> GSM1179002     1  0.2959    0.72463 0.864 0.000 0.100 0.000 0.036
#> GSM1179006     3  0.3117    0.67819 0.024 0.008 0.880 0.068 0.020
#> GSM1179008     1  0.2959    0.72463 0.864 0.000 0.100 0.000 0.036
#> GSM1179015     5  0.6736    0.49488 0.196 0.000 0.344 0.008 0.452
#> GSM1179017     5  0.7605    0.10319 0.000 0.096 0.164 0.260 0.480
#> GSM1179026     3  0.1954    0.69904 0.032 0.000 0.932 0.008 0.028
#> GSM1179033     3  0.1809    0.70562 0.060 0.000 0.928 0.000 0.012
#> GSM1179035     3  0.2122    0.69898 0.032 0.000 0.924 0.008 0.036
#> GSM1179036     3  0.3489    0.66533 0.148 0.000 0.824 0.012 0.016
#> GSM1178986     3  0.3771    0.70623 0.088 0.000 0.836 0.052 0.024
#> GSM1178989     3  0.5325    0.46666 0.000 0.076 0.732 0.136 0.056
#> GSM1178993     4  0.5262    0.37517 0.012 0.000 0.376 0.580 0.032
#> GSM1178999     4  0.6162    0.43091 0.000 0.364 0.072 0.536 0.028
#> GSM1179021     4  0.5818    0.42746 0.000 0.364 0.064 0.556 0.016
#> GSM1179025     2  0.0290    0.98537 0.000 0.992 0.000 0.000 0.008
#> GSM1179027     4  0.4130    0.58988 0.000 0.012 0.292 0.696 0.000
#> GSM1179011     1  0.5271    0.53077 0.652 0.000 0.016 0.284 0.048
#> GSM1179023     1  0.0510    0.79779 0.984 0.000 0.016 0.000 0.000
#> GSM1179029     1  0.6798   -0.22443 0.436 0.000 0.252 0.004 0.308
#> GSM1179034     1  0.0510    0.79779 0.984 0.000 0.016 0.000 0.000
#> GSM1179040     4  0.4404    0.59748 0.000 0.024 0.292 0.684 0.000
#> GSM1178988     3  0.4107    0.60079 0.008 0.012 0.812 0.120 0.048
#> GSM1179037     3  0.2122    0.69898 0.032 0.000 0.924 0.008 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
#> GSM1178971     1  0.4636     0.1401 0.568 0.000 0.396 0.000 0.012 0.024
#> GSM1178979     4  0.8279     0.3270 0.000 0.224 0.292 0.300 0.060 0.124
#> GSM1179009     3  0.7032     0.1955 0.056 0.000 0.516 0.212 0.036 0.180
#> GSM1179031     2  0.0000     0.9792 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1178970     3  0.7967    -0.0186 0.000 0.132 0.436 0.224 0.076 0.132
#> GSM1178972     2  0.2386     0.8836 0.000 0.896 0.000 0.064 0.028 0.012
#> GSM1178973     1  0.4347     0.6824 0.784 0.000 0.012 0.064 0.040 0.100
#> GSM1178974     2  0.0508     0.9725 0.000 0.984 0.000 0.000 0.012 0.004
#> GSM1178977     3  0.8291     0.0172 0.032 0.076 0.440 0.232 0.084 0.136
#> GSM1178978     3  0.7851     0.1655 0.236 0.000 0.436 0.136 0.056 0.136
#> GSM1178998     1  0.5503    -0.3411 0.456 0.000 0.128 0.000 0.000 0.416
#> GSM1179010     6  0.3803     0.6383 0.056 0.000 0.184 0.000 0.000 0.760
#> GSM1179018     3  0.5668     0.4942 0.036 0.000 0.660 0.196 0.028 0.080
#> GSM1179024     1  0.0405     0.7923 0.988 0.000 0.004 0.000 0.000 0.008
#> GSM1178984     3  0.5354     0.4022 0.160 0.000 0.580 0.000 0.000 0.260
#> GSM1178990     3  0.5223     0.1939 0.396 0.000 0.508 0.000 0.000 0.096
#> GSM1178991     1  0.4410     0.6739 0.784 0.000 0.012 0.068 0.056 0.080
#> GSM1178994     3  0.5042     0.4992 0.136 0.000 0.648 0.000 0.004 0.212
#> GSM1178997     1  0.1959     0.7749 0.924 0.000 0.032 0.000 0.020 0.024
#> GSM1179000     1  0.1536     0.7825 0.944 0.000 0.020 0.000 0.012 0.024
#> GSM1179013     1  0.0405     0.7923 0.988 0.000 0.004 0.000 0.000 0.008
#> GSM1179014     1  0.3717     0.5276 0.708 0.000 0.016 0.000 0.276 0.000
#> GSM1179019     1  0.1237     0.7855 0.956 0.000 0.020 0.000 0.004 0.020
#> GSM1179020     1  0.0551     0.7913 0.984 0.000 0.008 0.000 0.004 0.004
#> GSM1179022     1  0.0405     0.7923 0.988 0.000 0.004 0.000 0.000 0.008
#> GSM1179028     2  0.0000     0.9792 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1179032     1  0.0405     0.7923 0.988 0.000 0.004 0.000 0.000 0.008
#> GSM1179041     2  0.0000     0.9792 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1179042     2  0.0000     0.9792 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1178976     3  0.5379     0.5368 0.000 0.048 0.716 0.036 0.088 0.112
#> GSM1178981     3  0.2507     0.7335 0.032 0.000 0.888 0.004 0.004 0.072
#> GSM1178982     3  0.3755     0.7011 0.120 0.000 0.808 0.004 0.020 0.048
#> GSM1178983     3  0.3974     0.6830 0.140 0.000 0.788 0.004 0.024 0.044
#> GSM1178985     3  0.2775     0.7276 0.032 0.000 0.880 0.000 0.048 0.040
#> GSM1178992     3  0.2239     0.7287 0.020 0.000 0.900 0.000 0.008 0.072
#> GSM1179005     3  0.2605     0.7125 0.028 0.000 0.864 0.000 0.000 0.108
#> GSM1179007     3  0.2651     0.7113 0.028 0.000 0.860 0.000 0.000 0.112
#> GSM1179012     6  0.5051     0.7307 0.124 0.000 0.176 0.000 0.020 0.680
#> GSM1179016     5  0.3835     0.7094 0.056 0.000 0.188 0.000 0.756 0.000
#> GSM1179030     3  0.4436     0.6849 0.120 0.000 0.776 0.020 0.036 0.048
#> GSM1179038     3  0.3655     0.6952 0.112 0.000 0.792 0.000 0.000 0.096
#> GSM1178987     3  0.2507     0.7332 0.032 0.000 0.888 0.004 0.004 0.072
#> GSM1179003     4  0.7831     0.3965 0.000 0.156 0.280 0.412 0.072 0.080
#> GSM1179004     3  0.1973     0.7298 0.012 0.000 0.916 0.004 0.004 0.064
#> GSM1179039     2  0.0000     0.9792 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1178975     1  0.4347     0.6824 0.784 0.000 0.012 0.064 0.040 0.100
#> GSM1178980     4  0.0146     0.4017 0.000 0.004 0.000 0.996 0.000 0.000
#> GSM1178995     3  0.2842     0.7120 0.044 0.000 0.852 0.000 0.000 0.104
#> GSM1178996     3  0.4777     0.5328 0.244 0.000 0.684 0.004 0.036 0.032
#> GSM1179001     1  0.2697     0.6990 0.864 0.000 0.092 0.000 0.000 0.044
#> GSM1179002     1  0.2697     0.6990 0.864 0.000 0.092 0.000 0.000 0.044
#> GSM1179006     3  0.2883     0.7022 0.012 0.000 0.880 0.024 0.028 0.056
#> GSM1179008     1  0.2839     0.6982 0.860 0.000 0.092 0.000 0.004 0.044
#> GSM1179015     6  0.5705     0.7237 0.156 0.000 0.172 0.000 0.044 0.628
#> GSM1179017     5  0.1957     0.7332 0.000 0.008 0.072 0.008 0.912 0.000
#> GSM1179026     3  0.1448     0.7306 0.012 0.000 0.948 0.000 0.016 0.024
#> GSM1179033     3  0.1657     0.7367 0.040 0.000 0.936 0.000 0.012 0.012
#> GSM1179035     3  0.1448     0.7308 0.012 0.000 0.948 0.000 0.016 0.024
#> GSM1179036     3  0.3238     0.7083 0.120 0.000 0.832 0.000 0.012 0.036
#> GSM1178986     3  0.2897     0.7318 0.048 0.000 0.872 0.000 0.052 0.028
#> GSM1178989     3  0.5300     0.5409 0.000 0.040 0.720 0.036 0.092 0.112
#> GSM1178993     4  0.5820     0.3997 0.008 0.000 0.352 0.536 0.036 0.068
#> GSM1178999     4  0.3129     0.3876 0.000 0.152 0.004 0.820 0.024 0.000
#> GSM1179021     4  0.2482     0.3917 0.000 0.148 0.000 0.848 0.000 0.004
#> GSM1179025     2  0.0508     0.9725 0.000 0.984 0.000 0.000 0.012 0.004
#> GSM1179027     4  0.4657     0.5349 0.000 0.004 0.248 0.684 0.012 0.052
#> GSM1179011     1  0.5835     0.4766 0.620 0.000 0.012 0.228 0.040 0.100
#> GSM1179023     1  0.0405     0.7923 0.988 0.000 0.004 0.000 0.000 0.008
#> GSM1179029     6  0.5983     0.3997 0.416 0.000 0.092 0.000 0.040 0.452
#> GSM1179034     1  0.0405     0.7923 0.988 0.000 0.004 0.000 0.000 0.008
#> GSM1179040     4  0.4944     0.5392 0.000 0.016 0.248 0.672 0.012 0.052
#> GSM1178988     3  0.3984     0.6351 0.000 0.000 0.800 0.044 0.076 0.080
#> GSM1179037     3  0.1448     0.7308 0.012 0.000 0.948 0.000 0.016 0.024

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

consensus_heatmap(res, k = 2)

plot of chunk tab-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) protocol(p) k
#> MAD:hclust 66           0.1968    5.30e-02 2
#> MAD:hclust 10               NA          NA 3
#> MAD:hclust 52           0.4079    1.20e-03 4
#> MAD:hclust 53           0.2724    7.63e-05 5
#> MAD:hclust 55           0.0799    1.45e-03 6

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


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

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

collect_plots(res)

plot of chunk MAD-kmeans-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 1.000           0.984       0.993         0.3928 0.610   0.610
#> 3 3 0.494           0.757       0.859         0.5951 0.675   0.496
#> 4 4 0.667           0.705       0.845         0.1472 0.876   0.679
#> 5 5 0.651           0.526       0.733         0.0786 0.930   0.778
#> 6 6 0.663           0.492       0.707         0.0494 0.868   0.557

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
#> GSM1178971     1   0.000      0.994 1.000 0.000
#> GSM1178979     2   0.000      0.990 0.000 1.000
#> GSM1179009     1   0.000      0.994 1.000 0.000
#> GSM1179031     2   0.000      0.990 0.000 1.000
#> GSM1178970     2   0.000      0.990 0.000 1.000
#> GSM1178972     2   0.000      0.990 0.000 1.000
#> GSM1178973     1   0.000      0.994 1.000 0.000
#> GSM1178974     2   0.000      0.990 0.000 1.000
#> GSM1178977     2   0.000      0.990 0.000 1.000
#> GSM1178978     1   0.000      0.994 1.000 0.000
#> GSM1178998     1   0.000      0.994 1.000 0.000
#> GSM1179010     1   0.000      0.994 1.000 0.000
#> GSM1179018     1   0.000      0.994 1.000 0.000
#> GSM1179024     1   0.000      0.994 1.000 0.000
#> GSM1178984     1   0.000      0.994 1.000 0.000
#> GSM1178990     1   0.000      0.994 1.000 0.000
#> GSM1178991     1   0.000      0.994 1.000 0.000
#> GSM1178994     1   0.000      0.994 1.000 0.000
#> GSM1178997     1   0.000      0.994 1.000 0.000
#> GSM1179000     1   0.000      0.994 1.000 0.000
#> GSM1179013     1   0.000      0.994 1.000 0.000
#> GSM1179014     1   0.000      0.994 1.000 0.000
#> GSM1179019     1   0.000      0.994 1.000 0.000
#> GSM1179020     1   0.000      0.994 1.000 0.000
#> GSM1179022     1   0.000      0.994 1.000 0.000
#> GSM1179028     2   0.000      0.990 0.000 1.000
#> GSM1179032     1   0.000      0.994 1.000 0.000
#> GSM1179041     2   0.000      0.990 0.000 1.000
#> GSM1179042     2   0.000      0.990 0.000 1.000
#> GSM1178976     2   0.000      0.990 0.000 1.000
#> GSM1178981     1   0.000      0.994 1.000 0.000
#> GSM1178982     1   0.000      0.994 1.000 0.000
#> GSM1178983     1   0.000      0.994 1.000 0.000
#> GSM1178985     1   0.000      0.994 1.000 0.000
#> GSM1178992     1   0.000      0.994 1.000 0.000
#> GSM1179005     1   0.000      0.994 1.000 0.000
#> GSM1179007     1   0.000      0.994 1.000 0.000
#> GSM1179012     1   0.000      0.994 1.000 0.000
#> GSM1179016     1   0.000      0.994 1.000 0.000
#> GSM1179030     1   0.722      0.751 0.800 0.200
#> GSM1179038     1   0.000      0.994 1.000 0.000
#> GSM1178987     1   0.000      0.994 1.000 0.000
#> GSM1179003     2   0.000      0.990 0.000 1.000
#> GSM1179004     1   0.000      0.994 1.000 0.000
#> GSM1179039     2   0.000      0.990 0.000 1.000
#> GSM1178975     1   0.000      0.994 1.000 0.000
#> GSM1178980     2   0.000      0.990 0.000 1.000
#> GSM1178995     1   0.000      0.994 1.000 0.000
#> GSM1178996     1   0.000      0.994 1.000 0.000
#> GSM1179001     1   0.000      0.994 1.000 0.000
#> GSM1179002     1   0.000      0.994 1.000 0.000
#> GSM1179006     1   0.000      0.994 1.000 0.000
#> GSM1179008     1   0.000      0.994 1.000 0.000
#> GSM1179015     1   0.000      0.994 1.000 0.000
#> GSM1179017     2   0.671      0.783 0.176 0.824
#> GSM1179026     1   0.000      0.994 1.000 0.000
#> GSM1179033     1   0.000      0.994 1.000 0.000
#> GSM1179035     1   0.000      0.994 1.000 0.000
#> GSM1179036     1   0.000      0.994 1.000 0.000
#> GSM1178986     1   0.000      0.994 1.000 0.000
#> GSM1178989     2   0.000      0.990 0.000 1.000
#> GSM1178993     1   0.000      0.994 1.000 0.000
#> GSM1178999     2   0.000      0.990 0.000 1.000
#> GSM1179021     2   0.000      0.990 0.000 1.000
#> GSM1179025     2   0.000      0.990 0.000 1.000
#> GSM1179027     1   0.574      0.841 0.864 0.136
#> GSM1179011     1   0.000      0.994 1.000 0.000
#> GSM1179023     1   0.000      0.994 1.000 0.000
#> GSM1179029     1   0.000      0.994 1.000 0.000
#> GSM1179034     1   0.000      0.994 1.000 0.000
#> GSM1179040     2   0.000      0.990 0.000 1.000
#> GSM1178988     1   0.000      0.994 1.000 0.000
#> GSM1179037     1   0.000      0.994 1.000 0.000

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>            class entropy silhouette    p1    p2    p3
#> GSM1178971     1  0.4796     0.6325 0.780 0.000 0.220
#> GSM1178979     2  0.2537     0.8414 0.000 0.920 0.080
#> GSM1179009     3  0.0592     0.7753 0.012 0.000 0.988
#> GSM1179031     2  0.0000     0.8525 0.000 1.000 0.000
#> GSM1178970     2  0.3879     0.8079 0.000 0.848 0.152
#> GSM1178972     2  0.0000     0.8525 0.000 1.000 0.000
#> GSM1178973     1  0.2959     0.8118 0.900 0.000 0.100
#> GSM1178974     2  0.0000     0.8525 0.000 1.000 0.000
#> GSM1178977     2  0.6577     0.5953 0.008 0.572 0.420
#> GSM1178978     3  0.5016     0.5330 0.240 0.000 0.760
#> GSM1178998     1  0.2165     0.8621 0.936 0.000 0.064
#> GSM1179010     3  0.5948     0.6247 0.360 0.000 0.640
#> GSM1179018     3  0.0000     0.7652 0.000 0.000 1.000
#> GSM1179024     1  0.0592     0.9060 0.988 0.000 0.012
#> GSM1178984     3  0.5760     0.6715 0.328 0.000 0.672
#> GSM1178990     1  0.1031     0.8987 0.976 0.000 0.024
#> GSM1178991     1  0.5138     0.6822 0.748 0.000 0.252
#> GSM1178994     3  0.5785     0.6660 0.332 0.000 0.668
#> GSM1178997     1  0.2261     0.8660 0.932 0.000 0.068
#> GSM1179000     1  0.0592     0.9060 0.988 0.000 0.012
#> GSM1179013     1  0.0592     0.9060 0.988 0.000 0.012
#> GSM1179014     1  0.0592     0.9060 0.988 0.000 0.012
#> GSM1179019     1  0.0592     0.9060 0.988 0.000 0.012
#> GSM1179020     1  0.0592     0.9060 0.988 0.000 0.012
#> GSM1179022     1  0.0592     0.9060 0.988 0.000 0.012
#> GSM1179028     2  0.0000     0.8525 0.000 1.000 0.000
#> GSM1179032     1  0.0592     0.9060 0.988 0.000 0.012
#> GSM1179041     2  0.0000     0.8525 0.000 1.000 0.000
#> GSM1179042     2  0.0000     0.8525 0.000 1.000 0.000
#> GSM1178976     3  0.5859     0.3068 0.000 0.344 0.656
#> GSM1178981     3  0.3412     0.8320 0.124 0.000 0.876
#> GSM1178982     3  0.1643     0.7985 0.044 0.000 0.956
#> GSM1178983     3  0.1411     0.7930 0.036 0.000 0.964
#> GSM1178985     3  0.3340     0.8331 0.120 0.000 0.880
#> GSM1178992     3  0.5016     0.7573 0.240 0.000 0.760
#> GSM1179005     3  0.5706     0.6802 0.320 0.000 0.680
#> GSM1179007     3  0.5968     0.6174 0.364 0.000 0.636
#> GSM1179012     3  0.6305     0.3301 0.484 0.000 0.516
#> GSM1179016     3  0.5363     0.7250 0.276 0.000 0.724
#> GSM1179030     3  0.1647     0.7591 0.004 0.036 0.960
#> GSM1179038     3  0.5733     0.6751 0.324 0.000 0.676
#> GSM1178987     3  0.3340     0.8331 0.120 0.000 0.880
#> GSM1179003     2  0.5291     0.7175 0.000 0.732 0.268
#> GSM1179004     3  0.3340     0.8331 0.120 0.000 0.880
#> GSM1179039     2  0.0000     0.8525 0.000 1.000 0.000
#> GSM1178975     1  0.3551     0.7976 0.868 0.000 0.132
#> GSM1178980     2  0.6771     0.5685 0.012 0.548 0.440
#> GSM1178995     3  0.6008     0.6047 0.372 0.000 0.628
#> GSM1178996     3  0.3482     0.8303 0.128 0.000 0.872
#> GSM1179001     1  0.0592     0.9060 0.988 0.000 0.012
#> GSM1179002     1  0.1031     0.8987 0.976 0.000 0.024
#> GSM1179006     3  0.3340     0.8331 0.120 0.000 0.880
#> GSM1179008     1  0.0592     0.9060 0.988 0.000 0.012
#> GSM1179015     1  0.6154     0.0169 0.592 0.000 0.408
#> GSM1179017     3  0.7526     0.0261 0.040 0.424 0.536
#> GSM1179026     3  0.3340     0.8331 0.120 0.000 0.880
#> GSM1179033     3  0.3267     0.8325 0.116 0.000 0.884
#> GSM1179035     3  0.3340     0.8331 0.120 0.000 0.880
#> GSM1179036     3  0.3340     0.8331 0.120 0.000 0.880
#> GSM1178986     3  0.2448     0.8177 0.076 0.000 0.924
#> GSM1178989     3  0.3539     0.7561 0.012 0.100 0.888
#> GSM1178993     3  0.0592     0.7536 0.012 0.000 0.988
#> GSM1178999     2  0.6584     0.6389 0.012 0.608 0.380
#> GSM1179021     2  0.3459     0.8371 0.012 0.892 0.096
#> GSM1179025     2  0.0000     0.8525 0.000 1.000 0.000
#> GSM1179027     3  0.0592     0.7536 0.012 0.000 0.988
#> GSM1179011     1  0.6180     0.3882 0.584 0.000 0.416
#> GSM1179023     1  0.0592     0.9060 0.988 0.000 0.012
#> GSM1179029     1  0.0592     0.9060 0.988 0.000 0.012
#> GSM1179034     1  0.0592     0.9060 0.988 0.000 0.012
#> GSM1179040     2  0.6647     0.6298 0.012 0.592 0.396
#> GSM1178988     3  0.3116     0.8302 0.108 0.000 0.892
#> GSM1179037     3  0.3340     0.8331 0.120 0.000 0.880

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>            class entropy silhouette    p1    p2    p3    p4
#> GSM1178971     1  0.5517     0.2044 0.568 0.000 0.412 0.020
#> GSM1178979     4  0.5168     0.1108 0.000 0.496 0.004 0.500
#> GSM1179009     3  0.3942     0.6806 0.000 0.000 0.764 0.236
#> GSM1179031     2  0.0000     0.9206 0.000 1.000 0.000 0.000
#> GSM1178970     2  0.5602    -0.2249 0.000 0.508 0.020 0.472
#> GSM1178972     2  0.0188     0.9171 0.000 0.996 0.004 0.000
#> GSM1178973     1  0.3870     0.7195 0.788 0.000 0.004 0.208
#> GSM1178974     2  0.0000     0.9206 0.000 1.000 0.000 0.000
#> GSM1178977     4  0.3674     0.6962 0.000 0.116 0.036 0.848
#> GSM1178978     4  0.5371     0.6187 0.080 0.000 0.188 0.732
#> GSM1178998     1  0.3903     0.7931 0.844 0.000 0.076 0.080
#> GSM1179010     3  0.4581     0.7581 0.120 0.000 0.800 0.080
#> GSM1179018     4  0.4679     0.3762 0.000 0.000 0.352 0.648
#> GSM1179024     1  0.0921     0.8911 0.972 0.000 0.000 0.028
#> GSM1178984     3  0.3885     0.7870 0.092 0.000 0.844 0.064
#> GSM1178990     1  0.1824     0.8822 0.936 0.000 0.004 0.060
#> GSM1178991     4  0.5288    -0.0609 0.472 0.000 0.008 0.520
#> GSM1178994     3  0.3687     0.7951 0.080 0.000 0.856 0.064
#> GSM1178997     1  0.1929     0.8772 0.940 0.000 0.024 0.036
#> GSM1179000     1  0.1209     0.8886 0.964 0.000 0.004 0.032
#> GSM1179013     1  0.1489     0.8881 0.952 0.000 0.004 0.044
#> GSM1179014     1  0.1978     0.8852 0.928 0.000 0.004 0.068
#> GSM1179019     1  0.1209     0.8886 0.964 0.000 0.004 0.032
#> GSM1179020     1  0.0469     0.8952 0.988 0.000 0.000 0.012
#> GSM1179022     1  0.0895     0.8952 0.976 0.000 0.004 0.020
#> GSM1179028     2  0.0000     0.9206 0.000 1.000 0.000 0.000
#> GSM1179032     1  0.0895     0.8952 0.976 0.000 0.004 0.020
#> GSM1179041     2  0.0000     0.9206 0.000 1.000 0.000 0.000
#> GSM1179042     2  0.0000     0.9206 0.000 1.000 0.000 0.000
#> GSM1178976     3  0.3156     0.7908 0.000 0.048 0.884 0.068
#> GSM1178981     3  0.1767     0.8286 0.012 0.000 0.944 0.044
#> GSM1178982     3  0.3142     0.7850 0.008 0.000 0.860 0.132
#> GSM1178983     3  0.5273     0.1544 0.008 0.000 0.536 0.456
#> GSM1178985     3  0.1004     0.8327 0.004 0.000 0.972 0.024
#> GSM1178992     3  0.1938     0.8249 0.012 0.000 0.936 0.052
#> GSM1179005     3  0.1798     0.8291 0.040 0.000 0.944 0.016
#> GSM1179007     3  0.3842     0.7715 0.128 0.000 0.836 0.036
#> GSM1179012     3  0.6806     0.3741 0.344 0.000 0.544 0.112
#> GSM1179016     3  0.2965     0.8122 0.036 0.000 0.892 0.072
#> GSM1179030     3  0.5161    -0.0595 0.004 0.000 0.520 0.476
#> GSM1179038     3  0.2060     0.8271 0.052 0.000 0.932 0.016
#> GSM1178987     3  0.1489     0.8287 0.004 0.000 0.952 0.044
#> GSM1179003     4  0.7286     0.3574 0.000 0.364 0.156 0.480
#> GSM1179004     3  0.1576     0.8288 0.004 0.000 0.948 0.048
#> GSM1179039     2  0.0000     0.9206 0.000 1.000 0.000 0.000
#> GSM1178975     1  0.5151     0.1727 0.532 0.000 0.004 0.464
#> GSM1178980     4  0.3464     0.6985 0.000 0.108 0.032 0.860
#> GSM1178995     3  0.3501     0.7791 0.132 0.000 0.848 0.020
#> GSM1178996     3  0.1545     0.8293 0.008 0.000 0.952 0.040
#> GSM1179001     1  0.0707     0.8967 0.980 0.000 0.000 0.020
#> GSM1179002     1  0.1174     0.8947 0.968 0.000 0.012 0.020
#> GSM1179006     3  0.1452     0.8291 0.008 0.000 0.956 0.036
#> GSM1179008     1  0.0707     0.8963 0.980 0.000 0.000 0.020
#> GSM1179015     3  0.6609     0.0938 0.448 0.000 0.472 0.080
#> GSM1179017     3  0.6851     0.0159 0.000 0.104 0.496 0.400
#> GSM1179026     3  0.0779     0.8325 0.004 0.000 0.980 0.016
#> GSM1179033     3  0.1452     0.8291 0.008 0.000 0.956 0.036
#> GSM1179035     3  0.0779     0.8328 0.004 0.000 0.980 0.016
#> GSM1179036     3  0.1256     0.8309 0.008 0.000 0.964 0.028
#> GSM1178986     3  0.2266     0.8097 0.004 0.000 0.912 0.084
#> GSM1178989     3  0.1902     0.8161 0.004 0.000 0.932 0.064
#> GSM1178993     4  0.2589     0.6933 0.000 0.000 0.116 0.884
#> GSM1178999     4  0.4465     0.6822 0.000 0.144 0.056 0.800
#> GSM1179021     4  0.4730     0.4140 0.000 0.364 0.000 0.636
#> GSM1179025     2  0.0000     0.9206 0.000 1.000 0.000 0.000
#> GSM1179027     4  0.2589     0.6933 0.000 0.000 0.116 0.884
#> GSM1179011     4  0.2675     0.6543 0.100 0.000 0.008 0.892
#> GSM1179023     1  0.0895     0.8952 0.976 0.000 0.004 0.020
#> GSM1179029     1  0.2053     0.8760 0.924 0.000 0.004 0.072
#> GSM1179034     1  0.0895     0.8952 0.976 0.000 0.004 0.020
#> GSM1179040     4  0.3616     0.6987 0.000 0.112 0.036 0.852
#> GSM1178988     3  0.1743     0.8203 0.004 0.000 0.940 0.056
#> GSM1179037     3  0.0657     0.8321 0.004 0.000 0.984 0.012

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>            class entropy silhouette    p1    p2    p3    p4    p5
#> GSM1178971     1  0.5959     0.2944 0.600 0.000 0.244 0.004 0.152
#> GSM1178979     4  0.7433     0.2925 0.000 0.308 0.052 0.444 0.196
#> GSM1179009     3  0.6581     0.1020 0.000 0.000 0.452 0.224 0.324
#> GSM1179031     2  0.0000     0.9084 0.000 1.000 0.000 0.000 0.000
#> GSM1178970     2  0.8300    -0.1787 0.000 0.360 0.148 0.280 0.212
#> GSM1178972     2  0.0955     0.8889 0.000 0.968 0.000 0.004 0.028
#> GSM1178973     1  0.4558     0.6346 0.728 0.000 0.000 0.208 0.064
#> GSM1178974     2  0.0290     0.9063 0.000 0.992 0.000 0.000 0.008
#> GSM1178977     4  0.5005     0.6562 0.000 0.028 0.044 0.716 0.212
#> GSM1178978     4  0.7585     0.1840 0.084 0.000 0.144 0.408 0.364
#> GSM1178998     5  0.5272     0.3240 0.416 0.000 0.040 0.004 0.540
#> GSM1179010     5  0.4882    -0.0686 0.024 0.000 0.444 0.000 0.532
#> GSM1179018     3  0.5624     0.2329 0.000 0.000 0.532 0.388 0.080
#> GSM1179024     1  0.0609     0.8172 0.980 0.000 0.000 0.000 0.020
#> GSM1178984     3  0.4688     0.1281 0.008 0.000 0.532 0.004 0.456
#> GSM1178990     1  0.3663     0.6655 0.776 0.000 0.016 0.000 0.208
#> GSM1178991     4  0.5895    -0.0825 0.444 0.000 0.000 0.456 0.100
#> GSM1178994     3  0.4684     0.1410 0.008 0.000 0.536 0.004 0.452
#> GSM1178997     1  0.2612     0.7842 0.868 0.000 0.008 0.000 0.124
#> GSM1179000     1  0.1478     0.8104 0.936 0.000 0.000 0.000 0.064
#> GSM1179013     1  0.1410     0.8136 0.940 0.000 0.000 0.000 0.060
#> GSM1179014     1  0.3492     0.7214 0.796 0.000 0.000 0.016 0.188
#> GSM1179019     1  0.1410     0.8111 0.940 0.000 0.000 0.000 0.060
#> GSM1179020     1  0.0000     0.8183 1.000 0.000 0.000 0.000 0.000
#> GSM1179022     1  0.1341     0.8145 0.944 0.000 0.000 0.000 0.056
#> GSM1179028     2  0.0000     0.9084 0.000 1.000 0.000 0.000 0.000
#> GSM1179032     1  0.1341     0.8145 0.944 0.000 0.000 0.000 0.056
#> GSM1179041     2  0.0000     0.9084 0.000 1.000 0.000 0.000 0.000
#> GSM1179042     2  0.0000     0.9084 0.000 1.000 0.000 0.000 0.000
#> GSM1178976     3  0.3474     0.4691 0.000 0.008 0.796 0.004 0.192
#> GSM1178981     3  0.4276     0.3386 0.000 0.000 0.616 0.004 0.380
#> GSM1178982     3  0.4380     0.4344 0.000 0.000 0.676 0.020 0.304
#> GSM1178983     3  0.6018     0.3306 0.000 0.000 0.568 0.160 0.272
#> GSM1178985     3  0.3884     0.4410 0.000 0.000 0.708 0.004 0.288
#> GSM1178992     3  0.4003     0.3958 0.000 0.000 0.704 0.008 0.288
#> GSM1179005     3  0.4225     0.3340 0.004 0.000 0.632 0.000 0.364
#> GSM1179007     3  0.4637     0.1080 0.012 0.000 0.536 0.000 0.452
#> GSM1179012     5  0.5644     0.5173 0.144 0.000 0.228 0.000 0.628
#> GSM1179016     3  0.4804     0.3333 0.044 0.000 0.720 0.016 0.220
#> GSM1179030     3  0.5250     0.3762 0.000 0.000 0.668 0.108 0.224
#> GSM1179038     3  0.3741     0.4354 0.004 0.000 0.732 0.000 0.264
#> GSM1178987     3  0.4166     0.3813 0.000 0.000 0.648 0.004 0.348
#> GSM1179003     3  0.8216    -0.2634 0.000 0.144 0.388 0.264 0.204
#> GSM1179004     3  0.4196     0.3758 0.000 0.000 0.640 0.004 0.356
#> GSM1179039     2  0.0000     0.9084 0.000 1.000 0.000 0.000 0.000
#> GSM1178975     1  0.5847     0.1213 0.480 0.000 0.000 0.424 0.096
#> GSM1178980     4  0.0703     0.7203 0.000 0.024 0.000 0.976 0.000
#> GSM1178995     3  0.4640     0.2273 0.016 0.000 0.584 0.000 0.400
#> GSM1178996     3  0.1704     0.5300 0.000 0.000 0.928 0.004 0.068
#> GSM1179001     1  0.2536     0.7878 0.868 0.000 0.000 0.004 0.128
#> GSM1179002     1  0.3239     0.7539 0.828 0.000 0.012 0.004 0.156
#> GSM1179006     3  0.0162     0.5482 0.000 0.000 0.996 0.000 0.004
#> GSM1179008     1  0.2286     0.7987 0.888 0.000 0.000 0.004 0.108
#> GSM1179015     5  0.6002     0.5681 0.264 0.000 0.132 0.008 0.596
#> GSM1179017     3  0.6595     0.1175 0.000 0.036 0.492 0.096 0.376
#> GSM1179026     3  0.0609     0.5480 0.000 0.000 0.980 0.000 0.020
#> GSM1179033     3  0.0162     0.5494 0.000 0.000 0.996 0.000 0.004
#> GSM1179035     3  0.3983     0.3870 0.000 0.000 0.660 0.000 0.340
#> GSM1179036     3  0.0609     0.5487 0.000 0.000 0.980 0.000 0.020
#> GSM1178986     3  0.1408     0.5408 0.000 0.000 0.948 0.008 0.044
#> GSM1178989     3  0.3123     0.4736 0.000 0.000 0.812 0.004 0.184
#> GSM1178993     4  0.0798     0.7240 0.000 0.000 0.016 0.976 0.008
#> GSM1178999     4  0.5672     0.6347 0.000 0.060 0.112 0.708 0.120
#> GSM1179021     4  0.4465     0.5822 0.000 0.204 0.000 0.736 0.060
#> GSM1179025     2  0.0290     0.9063 0.000 0.992 0.000 0.000 0.008
#> GSM1179027     4  0.0798     0.7240 0.000 0.000 0.016 0.976 0.008
#> GSM1179011     4  0.2054     0.7013 0.028 0.000 0.000 0.920 0.052
#> GSM1179023     1  0.1270     0.8155 0.948 0.000 0.000 0.000 0.052
#> GSM1179029     1  0.4063     0.6287 0.708 0.000 0.000 0.012 0.280
#> GSM1179034     1  0.1341     0.8145 0.944 0.000 0.000 0.000 0.056
#> GSM1179040     4  0.2104     0.7167 0.000 0.024 0.000 0.916 0.060
#> GSM1178988     3  0.2471     0.5039 0.000 0.000 0.864 0.000 0.136
#> GSM1179037     3  0.2329     0.5224 0.000 0.000 0.876 0.000 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
#> GSM1178971     1  0.7287   -0.04994 0.332 0.000 0.244 0.000 0.100 0.324
#> GSM1178979     4  0.7077    0.40347 0.000 0.096 0.000 0.384 0.340 0.180
#> GSM1179009     3  0.3874    0.50351 0.000 0.000 0.760 0.172 0.000 0.068
#> GSM1179031     2  0.0000    0.95928 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1178970     5  0.7949   -0.27757 0.000 0.152 0.048 0.188 0.424 0.188
#> GSM1178972     2  0.3367    0.81556 0.000 0.816 0.000 0.000 0.080 0.104
#> GSM1178973     1  0.5995   -0.40299 0.428 0.000 0.000 0.248 0.000 0.324
#> GSM1178974     2  0.1297    0.94255 0.000 0.948 0.000 0.000 0.012 0.040
#> GSM1178977     4  0.6308    0.40030 0.000 0.000 0.016 0.412 0.356 0.216
#> GSM1178978     6  0.7199    0.20134 0.004 0.000 0.240 0.220 0.100 0.436
#> GSM1178998     3  0.6182    0.10739 0.304 0.000 0.440 0.000 0.008 0.248
#> GSM1179010     3  0.3834    0.52933 0.028 0.000 0.748 0.000 0.008 0.216
#> GSM1179018     3  0.6777   -0.21915 0.000 0.000 0.396 0.208 0.344 0.052
#> GSM1179024     1  0.1007    0.71298 0.956 0.000 0.000 0.000 0.000 0.044
#> GSM1178984     3  0.1714    0.58864 0.000 0.000 0.908 0.000 0.000 0.092
#> GSM1178990     1  0.3808    0.58474 0.784 0.000 0.080 0.000 0.004 0.132
#> GSM1178991     6  0.6650    0.51017 0.284 0.000 0.000 0.336 0.028 0.352
#> GSM1178994     3  0.1610    0.58924 0.000 0.000 0.916 0.000 0.000 0.084
#> GSM1178997     1  0.4219    0.37635 0.592 0.000 0.000 0.000 0.020 0.388
#> GSM1179000     1  0.2964    0.63180 0.792 0.000 0.000 0.000 0.004 0.204
#> GSM1179013     1  0.0146    0.71770 0.996 0.000 0.000 0.000 0.000 0.004
#> GSM1179014     1  0.4414    0.58529 0.704 0.000 0.000 0.000 0.092 0.204
#> GSM1179019     1  0.2738    0.65763 0.820 0.000 0.000 0.000 0.004 0.176
#> GSM1179020     1  0.1267    0.71356 0.940 0.000 0.000 0.000 0.000 0.060
#> GSM1179022     1  0.0000    0.71894 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1179028     2  0.0146    0.95792 0.000 0.996 0.000 0.000 0.000 0.004
#> GSM1179032     1  0.0000    0.71894 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1179041     2  0.0000    0.95928 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1179042     2  0.0000    0.95928 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1178976     5  0.4573    0.50658 0.000 0.000 0.208 0.000 0.688 0.104
#> GSM1178981     3  0.1865    0.58423 0.000 0.000 0.920 0.000 0.040 0.040
#> GSM1178982     3  0.3944    0.44853 0.000 0.000 0.768 0.008 0.164 0.060
#> GSM1178983     3  0.6467    0.15760 0.000 0.000 0.500 0.056 0.160 0.284
#> GSM1178985     3  0.2730    0.50563 0.000 0.000 0.836 0.000 0.152 0.012
#> GSM1178992     3  0.5391   -0.04740 0.000 0.000 0.492 0.000 0.392 0.116
#> GSM1179005     3  0.2937    0.53969 0.000 0.000 0.848 0.000 0.096 0.056
#> GSM1179007     3  0.2950    0.57524 0.000 0.000 0.828 0.000 0.024 0.148
#> GSM1179012     3  0.5944    0.36230 0.140 0.000 0.568 0.000 0.036 0.256
#> GSM1179016     5  0.5479    0.41547 0.012 0.000 0.180 0.000 0.612 0.196
#> GSM1179030     5  0.5248    0.45590 0.000 0.000 0.188 0.040 0.672 0.100
#> GSM1179038     3  0.4284    0.30830 0.000 0.000 0.688 0.000 0.256 0.056
#> GSM1178987     3  0.2542    0.56764 0.000 0.000 0.876 0.000 0.080 0.044
#> GSM1179003     5  0.5021    0.18584 0.000 0.016 0.020 0.172 0.708 0.084
#> GSM1179004     3  0.2237    0.57517 0.000 0.000 0.896 0.000 0.068 0.036
#> GSM1179039     2  0.0000    0.95928 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1178975     6  0.6113    0.43102 0.296 0.000 0.000 0.344 0.000 0.360
#> GSM1178980     4  0.0260    0.62184 0.000 0.000 0.000 0.992 0.008 0.000
#> GSM1178995     3  0.3265    0.55089 0.008 0.000 0.836 0.000 0.088 0.068
#> GSM1178996     5  0.5373    0.45632 0.000 0.000 0.312 0.000 0.552 0.136
#> GSM1179001     1  0.4002    0.60337 0.692 0.000 0.016 0.000 0.008 0.284
#> GSM1179002     1  0.4452    0.57652 0.664 0.000 0.040 0.000 0.008 0.288
#> GSM1179006     5  0.4300    0.41328 0.000 0.000 0.432 0.000 0.548 0.020
#> GSM1179008     1  0.3799    0.61074 0.704 0.000 0.008 0.000 0.008 0.280
#> GSM1179015     3  0.7025    0.07303 0.296 0.000 0.332 0.000 0.060 0.312
#> GSM1179017     5  0.3447    0.30353 0.000 0.004 0.000 0.044 0.804 0.148
#> GSM1179026     5  0.4513    0.38677 0.000 0.000 0.440 0.000 0.528 0.032
#> GSM1179033     5  0.4328    0.37268 0.000 0.000 0.460 0.000 0.520 0.020
#> GSM1179035     3  0.3062    0.50036 0.000 0.000 0.816 0.000 0.160 0.024
#> GSM1179036     5  0.4325    0.37352 0.000 0.000 0.456 0.000 0.524 0.020
#> GSM1178986     5  0.5082    0.39746 0.000 0.000 0.408 0.000 0.512 0.080
#> GSM1178989     5  0.3652    0.54126 0.000 0.000 0.188 0.000 0.768 0.044
#> GSM1178993     4  0.0713    0.59942 0.000 0.000 0.000 0.972 0.000 0.028
#> GSM1178999     4  0.4928    0.55094 0.000 0.004 0.000 0.624 0.288 0.084
#> GSM1179021     4  0.4283    0.60661 0.000 0.104 0.000 0.776 0.072 0.048
#> GSM1179025     2  0.1367    0.94061 0.000 0.944 0.000 0.000 0.012 0.044
#> GSM1179027     4  0.0458    0.60933 0.000 0.000 0.000 0.984 0.000 0.016
#> GSM1179011     4  0.2883    0.31512 0.000 0.000 0.000 0.788 0.000 0.212
#> GSM1179023     1  0.0000    0.71894 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1179029     1  0.5124    0.50024 0.668 0.000 0.036 0.000 0.076 0.220
#> GSM1179034     1  0.0000    0.71894 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1179040     4  0.2448    0.63965 0.000 0.000 0.000 0.884 0.064 0.052
#> GSM1178988     5  0.3126    0.54034 0.000 0.000 0.248 0.000 0.752 0.000
#> GSM1179037     3  0.4333   -0.00223 0.000 0.000 0.596 0.000 0.376 0.028

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

consensus_heatmap(res, k = 2)

plot of chunk tab-MAD-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) protocol(p) k
#> MAD:kmeans 73          0.20011    0.280850 2
#> MAD:kmeans 68          0.36611    0.000924 3
#> MAD:kmeans 60          0.04566    0.000987 4
#> MAD:kmeans 43          0.00835    0.004632 5
#> MAD:kmeans 45          0.03738    0.013151 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 31632 rows and 73 columns.
#>   Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'MAD' method.
#>   Subgroups are detected by 'skmeans' method.
#>   Performed in total 1250 partitions by row resampling.
#>   Best k for subgroups seems to be 3.
#> 
#> Following methods can be applied to this 'ConsensusPartition' object:
#>  [1] "cola_report"             "collect_classes"         "collect_plots"          
#>  [4] "collect_stats"           "colnames"                "compare_signatures"     
#>  [7] "consensus_heatmap"       "dimension_reduction"     "functional_enrichment"  
#> [10] "get_anno_col"            "get_anno"                "get_classes"            
#> [13] "get_consensus"           "get_matrix"              "get_membership"         
#> [16] "get_param"               "get_signatures"          "get_stats"              
#> [19] "is_best_k"               "is_stable_k"             "membership_heatmap"     
#> [22] "ncol"                    "nrow"                    "plot_ecdf"              
#> [25] "rownames"                "select_partition_number" "show"                   
#> [28] "suggest_best_k"          "test_to_known_factors"

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

collect_plots(res)

plot of chunk MAD-skmeans-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.859           0.894       0.957         0.4893 0.521   0.521
#> 3 3 0.870           0.909       0.959         0.3789 0.719   0.501
#> 4 4 0.763           0.777       0.893         0.1076 0.874   0.641
#> 5 5 0.728           0.641       0.820         0.0612 0.899   0.634
#> 6 6 0.693           0.482       0.755         0.0367 0.975   0.880

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
#> GSM1178971     1  0.0000     0.9425 1.000 0.000
#> GSM1178979     2  0.0000     0.9715 0.000 1.000
#> GSM1179009     1  0.1633     0.9244 0.976 0.024
#> GSM1179031     2  0.0000     0.9715 0.000 1.000
#> GSM1178970     2  0.0000     0.9715 0.000 1.000
#> GSM1178972     2  0.0000     0.9715 0.000 1.000
#> GSM1178973     1  0.0000     0.9425 1.000 0.000
#> GSM1178974     2  0.0000     0.9715 0.000 1.000
#> GSM1178977     2  0.0000     0.9715 0.000 1.000
#> GSM1178978     2  0.8813     0.5427 0.300 0.700
#> GSM1178998     1  0.0000     0.9425 1.000 0.000
#> GSM1179010     1  0.0000     0.9425 1.000 0.000
#> GSM1179018     2  0.0672     0.9647 0.008 0.992
#> GSM1179024     1  0.0000     0.9425 1.000 0.000
#> GSM1178984     1  0.0000     0.9425 1.000 0.000
#> GSM1178990     1  0.0000     0.9425 1.000 0.000
#> GSM1178991     1  0.7299     0.7292 0.796 0.204
#> GSM1178994     1  0.0000     0.9425 1.000 0.000
#> GSM1178997     2  0.9491     0.3816 0.368 0.632
#> GSM1179000     1  0.0000     0.9425 1.000 0.000
#> GSM1179013     1  0.0000     0.9425 1.000 0.000
#> GSM1179014     1  0.0000     0.9425 1.000 0.000
#> GSM1179019     1  0.0000     0.9425 1.000 0.000
#> GSM1179020     1  0.0000     0.9425 1.000 0.000
#> GSM1179022     1  0.0000     0.9425 1.000 0.000
#> GSM1179028     2  0.0000     0.9715 0.000 1.000
#> GSM1179032     1  0.0000     0.9425 1.000 0.000
#> GSM1179041     2  0.0000     0.9715 0.000 1.000
#> GSM1179042     2  0.0000     0.9715 0.000 1.000
#> GSM1178976     2  0.0000     0.9715 0.000 1.000
#> GSM1178981     1  0.0000     0.9425 1.000 0.000
#> GSM1178982     1  0.7745     0.6992 0.772 0.228
#> GSM1178983     1  0.8608     0.6144 0.716 0.284
#> GSM1178985     1  0.9460     0.4521 0.636 0.364
#> GSM1178992     1  0.0000     0.9425 1.000 0.000
#> GSM1179005     1  0.0000     0.9425 1.000 0.000
#> GSM1179007     1  0.0000     0.9425 1.000 0.000
#> GSM1179012     1  0.0000     0.9425 1.000 0.000
#> GSM1179016     1  0.0376     0.9398 0.996 0.004
#> GSM1179030     2  0.0000     0.9715 0.000 1.000
#> GSM1179038     1  0.0000     0.9425 1.000 0.000
#> GSM1178987     1  0.0000     0.9425 1.000 0.000
#> GSM1179003     2  0.0000     0.9715 0.000 1.000
#> GSM1179004     1  0.0000     0.9425 1.000 0.000
#> GSM1179039     2  0.0000     0.9715 0.000 1.000
#> GSM1178975     1  0.9552     0.4106 0.624 0.376
#> GSM1178980     2  0.0000     0.9715 0.000 1.000
#> GSM1178995     1  0.0000     0.9425 1.000 0.000
#> GSM1178996     1  0.1633     0.9246 0.976 0.024
#> GSM1179001     1  0.0000     0.9425 1.000 0.000
#> GSM1179002     1  0.0000     0.9425 1.000 0.000
#> GSM1179006     1  1.0000     0.0384 0.500 0.500
#> GSM1179008     1  0.0000     0.9425 1.000 0.000
#> GSM1179015     1  0.0000     0.9425 1.000 0.000
#> GSM1179017     2  0.0000     0.9715 0.000 1.000
#> GSM1179026     1  0.0376     0.9398 0.996 0.004
#> GSM1179033     2  0.2236     0.9377 0.036 0.964
#> GSM1179035     1  0.0000     0.9425 1.000 0.000
#> GSM1179036     1  0.0000     0.9425 1.000 0.000
#> GSM1178986     1  0.9686     0.3680 0.604 0.396
#> GSM1178989     2  0.0000     0.9715 0.000 1.000
#> GSM1178993     2  0.0000     0.9715 0.000 1.000
#> GSM1178999     2  0.0000     0.9715 0.000 1.000
#> GSM1179021     2  0.0000     0.9715 0.000 1.000
#> GSM1179025     2  0.0000     0.9715 0.000 1.000
#> GSM1179027     2  0.0000     0.9715 0.000 1.000
#> GSM1179011     2  0.0000     0.9715 0.000 1.000
#> GSM1179023     1  0.0000     0.9425 1.000 0.000
#> GSM1179029     1  0.0000     0.9425 1.000 0.000
#> GSM1179034     1  0.0000     0.9425 1.000 0.000
#> GSM1179040     2  0.0000     0.9715 0.000 1.000
#> GSM1178988     2  0.0000     0.9715 0.000 1.000
#> GSM1179037     1  0.0000     0.9425 1.000 0.000

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>            class entropy silhouette    p1    p2    p3
#> GSM1178971     1  0.0000      0.954 1.000 0.000 0.000
#> GSM1178979     2  0.0000      0.976 0.000 1.000 0.000
#> GSM1179009     3  0.0237      0.941 0.004 0.000 0.996
#> GSM1179031     2  0.0000      0.976 0.000 1.000 0.000
#> GSM1178970     2  0.0000      0.976 0.000 1.000 0.000
#> GSM1178972     2  0.0000      0.976 0.000 1.000 0.000
#> GSM1178973     1  0.0000      0.954 1.000 0.000 0.000
#> GSM1178974     2  0.0000      0.976 0.000 1.000 0.000
#> GSM1178977     2  0.0000      0.976 0.000 1.000 0.000
#> GSM1178978     1  0.5229      0.830 0.828 0.104 0.068
#> GSM1178998     1  0.4605      0.762 0.796 0.000 0.204
#> GSM1179010     3  0.0237      0.941 0.004 0.000 0.996
#> GSM1179018     3  0.5905      0.459 0.000 0.352 0.648
#> GSM1179024     1  0.0000      0.954 1.000 0.000 0.000
#> GSM1178984     3  0.0237      0.941 0.004 0.000 0.996
#> GSM1178990     1  0.1964      0.913 0.944 0.000 0.056
#> GSM1178991     1  0.0747      0.944 0.984 0.016 0.000
#> GSM1178994     3  0.0237      0.941 0.004 0.000 0.996
#> GSM1178997     1  0.0000      0.954 1.000 0.000 0.000
#> GSM1179000     1  0.0000      0.954 1.000 0.000 0.000
#> GSM1179013     1  0.0000      0.954 1.000 0.000 0.000
#> GSM1179014     1  0.0000      0.954 1.000 0.000 0.000
#> GSM1179019     1  0.0000      0.954 1.000 0.000 0.000
#> GSM1179020     1  0.0000      0.954 1.000 0.000 0.000
#> GSM1179022     1  0.0000      0.954 1.000 0.000 0.000
#> GSM1179028     2  0.0000      0.976 0.000 1.000 0.000
#> GSM1179032     1  0.0000      0.954 1.000 0.000 0.000
#> GSM1179041     2  0.0000      0.976 0.000 1.000 0.000
#> GSM1179042     2  0.0000      0.976 0.000 1.000 0.000
#> GSM1178976     2  0.0000      0.976 0.000 1.000 0.000
#> GSM1178981     3  0.0237      0.941 0.004 0.000 0.996
#> GSM1178982     3  0.1129      0.931 0.020 0.004 0.976
#> GSM1178983     1  0.4994      0.807 0.816 0.024 0.160
#> GSM1178985     3  0.0000      0.940 0.000 0.000 1.000
#> GSM1178992     3  0.0000      0.940 0.000 0.000 1.000
#> GSM1179005     3  0.1031      0.933 0.024 0.000 0.976
#> GSM1179007     3  0.0424      0.940 0.008 0.000 0.992
#> GSM1179012     3  0.0237      0.941 0.004 0.000 0.996
#> GSM1179016     3  0.6280      0.180 0.460 0.000 0.540
#> GSM1179030     2  0.0000      0.976 0.000 1.000 0.000
#> GSM1179038     3  0.3482      0.842 0.128 0.000 0.872
#> GSM1178987     3  0.0000      0.940 0.000 0.000 1.000
#> GSM1179003     2  0.0000      0.976 0.000 1.000 0.000
#> GSM1179004     3  0.0000      0.940 0.000 0.000 1.000
#> GSM1179039     2  0.0000      0.976 0.000 1.000 0.000
#> GSM1178975     1  0.0000      0.954 1.000 0.000 0.000
#> GSM1178980     2  0.0000      0.976 0.000 1.000 0.000
#> GSM1178995     3  0.2448      0.896 0.076 0.000 0.924
#> GSM1178996     1  0.6852      0.518 0.664 0.036 0.300
#> GSM1179001     1  0.0000      0.954 1.000 0.000 0.000
#> GSM1179002     1  0.0000      0.954 1.000 0.000 0.000
#> GSM1179006     3  0.1860      0.909 0.000 0.052 0.948
#> GSM1179008     1  0.0000      0.954 1.000 0.000 0.000
#> GSM1179015     3  0.1163      0.930 0.028 0.000 0.972
#> GSM1179017     2  0.0000      0.976 0.000 1.000 0.000
#> GSM1179026     3  0.0000      0.940 0.000 0.000 1.000
#> GSM1179033     3  0.1163      0.927 0.000 0.028 0.972
#> GSM1179035     3  0.0000      0.940 0.000 0.000 1.000
#> GSM1179036     3  0.0592      0.938 0.012 0.000 0.988
#> GSM1178986     3  0.5884      0.770 0.064 0.148 0.788
#> GSM1178989     2  0.3116      0.863 0.000 0.892 0.108
#> GSM1178993     2  0.0000      0.976 0.000 1.000 0.000
#> GSM1178999     2  0.0000      0.976 0.000 1.000 0.000
#> GSM1179021     2  0.0000      0.976 0.000 1.000 0.000
#> GSM1179025     2  0.0000      0.976 0.000 1.000 0.000
#> GSM1179027     2  0.0000      0.976 0.000 1.000 0.000
#> GSM1179011     1  0.3482      0.846 0.872 0.128 0.000
#> GSM1179023     1  0.0000      0.954 1.000 0.000 0.000
#> GSM1179029     1  0.0000      0.954 1.000 0.000 0.000
#> GSM1179034     1  0.0000      0.954 1.000 0.000 0.000
#> GSM1179040     2  0.0000      0.976 0.000 1.000 0.000
#> GSM1178988     2  0.6062      0.344 0.000 0.616 0.384
#> GSM1179037     3  0.0000      0.940 0.000 0.000 1.000

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>            class entropy silhouette    p1    p2    p3    p4
#> GSM1178971     1  0.0000      0.911 1.000 0.000 0.000 0.000
#> GSM1178979     2  0.0000      0.924 0.000 1.000 0.000 0.000
#> GSM1179009     4  0.4382      0.472 0.000 0.000 0.296 0.704
#> GSM1179031     2  0.0000      0.924 0.000 1.000 0.000 0.000
#> GSM1178970     2  0.0000      0.924 0.000 1.000 0.000 0.000
#> GSM1178972     2  0.0000      0.924 0.000 1.000 0.000 0.000
#> GSM1178973     1  0.4830      0.227 0.608 0.000 0.000 0.392
#> GSM1178974     2  0.0000      0.924 0.000 1.000 0.000 0.000
#> GSM1178977     2  0.0592      0.916 0.000 0.984 0.000 0.016
#> GSM1178978     4  0.3675      0.751 0.104 0.016 0.020 0.860
#> GSM1178998     1  0.5111      0.622 0.740 0.000 0.204 0.056
#> GSM1179010     3  0.2660      0.857 0.036 0.000 0.908 0.056
#> GSM1179018     4  0.1388      0.768 0.000 0.012 0.028 0.960
#> GSM1179024     1  0.0000      0.911 1.000 0.000 0.000 0.000
#> GSM1178984     3  0.2840      0.854 0.044 0.000 0.900 0.056
#> GSM1178990     1  0.2048      0.855 0.928 0.000 0.064 0.008
#> GSM1178991     4  0.5024      0.439 0.360 0.008 0.000 0.632
#> GSM1178994     3  0.2565      0.858 0.032 0.000 0.912 0.056
#> GSM1178997     1  0.1284      0.883 0.964 0.024 0.000 0.012
#> GSM1179000     1  0.0000      0.911 1.000 0.000 0.000 0.000
#> GSM1179013     1  0.0000      0.911 1.000 0.000 0.000 0.000
#> GSM1179014     1  0.0188      0.909 0.996 0.000 0.000 0.004
#> GSM1179019     1  0.0000      0.911 1.000 0.000 0.000 0.000
#> GSM1179020     1  0.0000      0.911 1.000 0.000 0.000 0.000
#> GSM1179022     1  0.0000      0.911 1.000 0.000 0.000 0.000
#> GSM1179028     2  0.0000      0.924 0.000 1.000 0.000 0.000
#> GSM1179032     1  0.0000      0.911 1.000 0.000 0.000 0.000
#> GSM1179041     2  0.0000      0.924 0.000 1.000 0.000 0.000
#> GSM1179042     2  0.0000      0.924 0.000 1.000 0.000 0.000
#> GSM1178976     2  0.0657      0.916 0.000 0.984 0.012 0.004
#> GSM1178981     3  0.2300      0.857 0.016 0.000 0.920 0.064
#> GSM1178982     4  0.4406      0.502 0.000 0.000 0.300 0.700
#> GSM1178983     4  0.3088      0.756 0.052 0.000 0.060 0.888
#> GSM1178985     3  0.1474      0.859 0.000 0.000 0.948 0.052
#> GSM1178992     3  0.1209      0.853 0.004 0.000 0.964 0.032
#> GSM1179005     3  0.2222      0.858 0.060 0.000 0.924 0.016
#> GSM1179007     3  0.2413      0.856 0.064 0.000 0.916 0.020
#> GSM1179012     3  0.3840      0.822 0.104 0.000 0.844 0.052
#> GSM1179016     1  0.5775      0.482 0.644 0.012 0.316 0.028
#> GSM1179030     2  0.1389      0.891 0.000 0.952 0.000 0.048
#> GSM1179038     3  0.5611      0.326 0.412 0.000 0.564 0.024
#> GSM1178987     3  0.1474      0.858 0.000 0.000 0.948 0.052
#> GSM1179003     2  0.0000      0.924 0.000 1.000 0.000 0.000
#> GSM1179004     3  0.1389      0.859 0.000 0.000 0.952 0.048
#> GSM1179039     2  0.0000      0.924 0.000 1.000 0.000 0.000
#> GSM1178975     4  0.4981      0.173 0.464 0.000 0.000 0.536
#> GSM1178980     4  0.2281      0.747 0.000 0.096 0.000 0.904
#> GSM1178995     3  0.3937      0.753 0.188 0.000 0.800 0.012
#> GSM1178996     1  0.7170      0.510 0.620 0.104 0.240 0.036
#> GSM1179001     1  0.0000      0.911 1.000 0.000 0.000 0.000
#> GSM1179002     1  0.0000      0.911 1.000 0.000 0.000 0.000
#> GSM1179006     3  0.3082      0.792 0.000 0.084 0.884 0.032
#> GSM1179008     1  0.0000      0.911 1.000 0.000 0.000 0.000
#> GSM1179015     3  0.4868      0.587 0.304 0.000 0.684 0.012
#> GSM1179017     2  0.1520      0.895 0.000 0.956 0.020 0.024
#> GSM1179026     3  0.1022      0.852 0.000 0.000 0.968 0.032
#> GSM1179033     3  0.2032      0.838 0.000 0.036 0.936 0.028
#> GSM1179035     3  0.0921      0.861 0.000 0.000 0.972 0.028
#> GSM1179036     3  0.2124      0.847 0.028 0.000 0.932 0.040
#> GSM1178986     3  0.7663      0.126 0.072 0.052 0.480 0.396
#> GSM1178989     2  0.2775      0.842 0.000 0.896 0.084 0.020
#> GSM1178993     4  0.1557      0.768 0.000 0.056 0.000 0.944
#> GSM1178999     2  0.4761      0.388 0.000 0.628 0.000 0.372
#> GSM1179021     2  0.4605      0.474 0.000 0.664 0.000 0.336
#> GSM1179025     2  0.0000      0.924 0.000 1.000 0.000 0.000
#> GSM1179027     4  0.1792      0.764 0.000 0.068 0.000 0.932
#> GSM1179011     4  0.2521      0.770 0.064 0.024 0.000 0.912
#> GSM1179023     1  0.0000      0.911 1.000 0.000 0.000 0.000
#> GSM1179029     1  0.0672      0.902 0.984 0.000 0.008 0.008
#> GSM1179034     1  0.0000      0.911 1.000 0.000 0.000 0.000
#> GSM1179040     4  0.4866      0.241 0.000 0.404 0.000 0.596
#> GSM1178988     2  0.4799      0.655 0.000 0.744 0.224 0.032
#> GSM1179037     3  0.0707      0.855 0.000 0.000 0.980 0.020

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>            class entropy silhouette    p1    p2    p3    p4    p5
#> GSM1178971     1  0.2574     0.8714 0.876 0.000 0.112 0.000 0.012
#> GSM1178979     2  0.0000     0.8971 0.000 1.000 0.000 0.000 0.000
#> GSM1179009     5  0.4902     0.1862 0.000 0.000 0.028 0.408 0.564
#> GSM1179031     2  0.0000     0.8971 0.000 1.000 0.000 0.000 0.000
#> GSM1178970     2  0.0324     0.8947 0.000 0.992 0.004 0.000 0.004
#> GSM1178972     2  0.0162     0.8956 0.000 0.996 0.004 0.000 0.000
#> GSM1178973     1  0.5190     0.1007 0.540 0.000 0.028 0.424 0.008
#> GSM1178974     2  0.0000     0.8971 0.000 1.000 0.000 0.000 0.000
#> GSM1178977     2  0.2012     0.8514 0.000 0.920 0.020 0.060 0.000
#> GSM1178978     4  0.6984     0.4028 0.076 0.020 0.052 0.540 0.312
#> GSM1178998     5  0.5405     0.0857 0.460 0.000 0.056 0.000 0.484
#> GSM1179010     5  0.2233     0.6072 0.016 0.000 0.080 0.000 0.904
#> GSM1179018     4  0.3634     0.6755 0.000 0.004 0.076 0.832 0.088
#> GSM1179024     1  0.0451     0.9192 0.988 0.000 0.004 0.000 0.008
#> GSM1178984     5  0.1865     0.6159 0.024 0.000 0.032 0.008 0.936
#> GSM1178990     1  0.3239     0.8175 0.852 0.000 0.080 0.000 0.068
#> GSM1178991     4  0.4907     0.5545 0.264 0.000 0.052 0.680 0.004
#> GSM1178994     5  0.1564     0.6155 0.024 0.000 0.024 0.004 0.948
#> GSM1178997     1  0.2425     0.8880 0.916 0.012 0.040 0.024 0.008
#> GSM1179000     1  0.0898     0.9161 0.972 0.000 0.020 0.000 0.008
#> GSM1179013     1  0.0404     0.9215 0.988 0.000 0.012 0.000 0.000
#> GSM1179014     1  0.1484     0.9050 0.944 0.000 0.048 0.000 0.008
#> GSM1179019     1  0.0693     0.9188 0.980 0.000 0.012 0.000 0.008
#> GSM1179020     1  0.0000     0.9214 1.000 0.000 0.000 0.000 0.000
#> GSM1179022     1  0.0404     0.9211 0.988 0.000 0.012 0.000 0.000
#> GSM1179028     2  0.0000     0.8971 0.000 1.000 0.000 0.000 0.000
#> GSM1179032     1  0.0404     0.9211 0.988 0.000 0.012 0.000 0.000
#> GSM1179041     2  0.0000     0.8971 0.000 1.000 0.000 0.000 0.000
#> GSM1179042     2  0.0000     0.8971 0.000 1.000 0.000 0.000 0.000
#> GSM1178976     2  0.1195     0.8777 0.000 0.960 0.028 0.000 0.012
#> GSM1178981     5  0.1179     0.6073 0.004 0.000 0.016 0.016 0.964
#> GSM1178982     5  0.4908     0.2375 0.000 0.000 0.044 0.320 0.636
#> GSM1178983     4  0.5543     0.5717 0.032 0.000 0.064 0.672 0.232
#> GSM1178985     5  0.2660     0.5668 0.000 0.000 0.128 0.008 0.864
#> GSM1178992     3  0.3932     0.4634 0.000 0.000 0.672 0.000 0.328
#> GSM1179005     5  0.5629     0.2651 0.100 0.000 0.312 0.000 0.588
#> GSM1179007     5  0.5040     0.4142 0.084 0.000 0.236 0.000 0.680
#> GSM1179012     5  0.3301     0.5917 0.080 0.000 0.072 0.000 0.848
#> GSM1179016     3  0.4610     0.4688 0.248 0.004 0.712 0.004 0.032
#> GSM1179030     2  0.2689     0.8458 0.000 0.900 0.040 0.036 0.024
#> GSM1179038     3  0.6967     0.1772 0.340 0.000 0.420 0.012 0.228
#> GSM1178987     5  0.1792     0.5925 0.000 0.000 0.084 0.000 0.916
#> GSM1179003     2  0.0162     0.8958 0.000 0.996 0.004 0.000 0.000
#> GSM1179004     5  0.2329     0.5797 0.000 0.000 0.124 0.000 0.876
#> GSM1179039     2  0.0000     0.8971 0.000 1.000 0.000 0.000 0.000
#> GSM1178975     4  0.5030     0.4334 0.336 0.000 0.032 0.624 0.008
#> GSM1178980     4  0.0955     0.7341 0.000 0.028 0.004 0.968 0.000
#> GSM1178995     5  0.6613     0.1264 0.332 0.000 0.228 0.000 0.440
#> GSM1178996     3  0.4248     0.5060 0.160 0.024 0.784 0.000 0.032
#> GSM1179001     1  0.1894     0.8987 0.920 0.000 0.072 0.000 0.008
#> GSM1179002     1  0.2233     0.8934 0.904 0.000 0.080 0.000 0.016
#> GSM1179006     3  0.3656     0.5839 0.000 0.020 0.784 0.000 0.196
#> GSM1179008     1  0.1764     0.9043 0.928 0.000 0.064 0.000 0.008
#> GSM1179015     5  0.6660     0.0456 0.384 0.000 0.228 0.000 0.388
#> GSM1179017     2  0.4059     0.5840 0.000 0.700 0.292 0.004 0.004
#> GSM1179026     3  0.3305     0.5713 0.000 0.000 0.776 0.000 0.224
#> GSM1179033     3  0.4325     0.5044 0.000 0.012 0.684 0.004 0.300
#> GSM1179035     5  0.3913     0.3306 0.000 0.000 0.324 0.000 0.676
#> GSM1179036     3  0.3093     0.5866 0.008 0.000 0.824 0.000 0.168
#> GSM1178986     3  0.8019     0.3028 0.040 0.040 0.460 0.236 0.224
#> GSM1178989     2  0.4252     0.5685 0.000 0.700 0.280 0.000 0.020
#> GSM1178993     4  0.0162     0.7391 0.000 0.000 0.000 0.996 0.004
#> GSM1178999     2  0.4403     0.3817 0.000 0.608 0.008 0.384 0.000
#> GSM1179021     2  0.4171     0.3624 0.000 0.604 0.000 0.396 0.000
#> GSM1179025     2  0.0000     0.8971 0.000 1.000 0.000 0.000 0.000
#> GSM1179027     4  0.0162     0.7394 0.000 0.004 0.000 0.996 0.000
#> GSM1179011     4  0.0693     0.7390 0.008 0.000 0.012 0.980 0.000
#> GSM1179023     1  0.0162     0.9214 0.996 0.000 0.004 0.000 0.000
#> GSM1179029     1  0.2628     0.8638 0.884 0.000 0.088 0.000 0.028
#> GSM1179034     1  0.0404     0.9211 0.988 0.000 0.012 0.000 0.000
#> GSM1179040     4  0.4074     0.2835 0.000 0.364 0.000 0.636 0.000
#> GSM1178988     3  0.5598     0.2343 0.000 0.376 0.544 0.000 0.080
#> GSM1179037     3  0.4262     0.2611 0.000 0.000 0.560 0.000 0.440

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>            class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM1178971     1  0.5357     0.5218 0.576 0.000 0.096 0.000 0.316 0.012
#> GSM1178979     2  0.0000     0.8496 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1179009     6  0.5616     0.0194 0.000 0.000 0.036 0.444 0.060 0.460
#> GSM1179031     2  0.0000     0.8496 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1178970     2  0.0458     0.8458 0.000 0.984 0.000 0.000 0.016 0.000
#> GSM1178972     2  0.0146     0.8491 0.000 0.996 0.000 0.000 0.004 0.000
#> GSM1178973     1  0.5259     0.1738 0.536 0.000 0.000 0.356 0.108 0.000
#> GSM1178974     2  0.0146     0.8491 0.000 0.996 0.000 0.000 0.004 0.000
#> GSM1178977     2  0.2433     0.7873 0.000 0.884 0.000 0.072 0.044 0.000
#> GSM1178978     6  0.7043    -0.1006 0.032 0.016 0.004 0.332 0.216 0.400
#> GSM1178998     6  0.6197     0.1745 0.368 0.000 0.024 0.000 0.160 0.448
#> GSM1179010     6  0.3765     0.5240 0.016 0.000 0.084 0.000 0.096 0.804
#> GSM1179018     4  0.5239     0.3085 0.000 0.004 0.080 0.708 0.096 0.112
#> GSM1179024     1  0.0865     0.8007 0.964 0.000 0.000 0.000 0.036 0.000
#> GSM1178984     6  0.3091     0.5365 0.012 0.000 0.044 0.004 0.084 0.856
#> GSM1178990     1  0.4925     0.5985 0.724 0.000 0.064 0.000 0.124 0.088
#> GSM1178991     4  0.5660     0.2190 0.300 0.000 0.000 0.516 0.184 0.000
#> GSM1178994     6  0.2386     0.5310 0.024 0.000 0.024 0.000 0.052 0.900
#> GSM1178997     1  0.3799     0.7183 0.780 0.012 0.008 0.024 0.176 0.000
#> GSM1179000     1  0.2053     0.7759 0.888 0.000 0.004 0.000 0.108 0.000
#> GSM1179013     1  0.0146     0.8044 0.996 0.000 0.000 0.000 0.004 0.000
#> GSM1179014     1  0.2623     0.7657 0.852 0.000 0.016 0.000 0.132 0.000
#> GSM1179019     1  0.1524     0.7932 0.932 0.000 0.008 0.000 0.060 0.000
#> GSM1179020     1  0.0260     0.8043 0.992 0.000 0.000 0.000 0.008 0.000
#> GSM1179022     1  0.0000     0.8046 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1179028     2  0.0000     0.8496 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1179032     1  0.0146     0.8046 0.996 0.000 0.000 0.000 0.004 0.000
#> GSM1179041     2  0.0000     0.8496 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1179042     2  0.0000     0.8496 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1178976     2  0.2711     0.7709 0.000 0.872 0.084 0.000 0.036 0.008
#> GSM1178981     6  0.1889     0.5112 0.000 0.000 0.020 0.004 0.056 0.920
#> GSM1178982     6  0.5579     0.2482 0.004 0.000 0.012 0.204 0.168 0.612
#> GSM1178983     4  0.6976     0.0259 0.040 0.000 0.024 0.440 0.176 0.320
#> GSM1178985     6  0.4214     0.4224 0.000 0.000 0.184 0.004 0.076 0.736
#> GSM1178992     3  0.5113     0.1784 0.000 0.000 0.628 0.000 0.168 0.204
#> GSM1179005     6  0.6930     0.1485 0.076 0.000 0.300 0.004 0.172 0.448
#> GSM1179007     6  0.6653     0.2745 0.084 0.000 0.256 0.000 0.156 0.504
#> GSM1179012     6  0.5063     0.4791 0.084 0.000 0.092 0.000 0.108 0.716
#> GSM1179016     3  0.5734    -0.0863 0.148 0.000 0.544 0.000 0.296 0.012
#> GSM1179030     2  0.4661     0.6787 0.000 0.756 0.012 0.052 0.128 0.052
#> GSM1179038     3  0.7762    -0.0452 0.264 0.000 0.288 0.004 0.268 0.176
#> GSM1178987     6  0.2794     0.5008 0.000 0.000 0.060 0.000 0.080 0.860
#> GSM1179003     2  0.1168     0.8313 0.000 0.956 0.028 0.000 0.016 0.000
#> GSM1179004     6  0.2858     0.5010 0.000 0.000 0.124 0.000 0.032 0.844
#> GSM1179039     2  0.0000     0.8496 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1178975     4  0.5487     0.2544 0.320 0.000 0.000 0.532 0.148 0.000
#> GSM1178980     4  0.0717     0.5816 0.000 0.016 0.000 0.976 0.008 0.000
#> GSM1178995     6  0.7575     0.0354 0.256 0.000 0.248 0.000 0.164 0.332
#> GSM1178996     3  0.5069     0.0821 0.064 0.008 0.600 0.000 0.324 0.004
#> GSM1179001     1  0.3341     0.7184 0.776 0.000 0.004 0.000 0.208 0.012
#> GSM1179002     1  0.4330     0.6629 0.708 0.000 0.012 0.000 0.236 0.044
#> GSM1179006     3  0.2263     0.3567 0.000 0.000 0.896 0.000 0.048 0.056
#> GSM1179008     1  0.2631     0.7529 0.840 0.000 0.008 0.000 0.152 0.000
#> GSM1179015     1  0.7569    -0.2293 0.328 0.000 0.192 0.000 0.188 0.292
#> GSM1179017     2  0.5319     0.2920 0.000 0.568 0.296 0.000 0.136 0.000
#> GSM1179026     3  0.2527     0.3446 0.000 0.000 0.876 0.000 0.040 0.084
#> GSM1179033     3  0.5352     0.2936 0.000 0.012 0.680 0.024 0.136 0.148
#> GSM1179035     6  0.4940     0.1596 0.000 0.000 0.400 0.000 0.068 0.532
#> GSM1179036     3  0.3746     0.3595 0.000 0.000 0.780 0.000 0.140 0.080
#> GSM1178986     5  0.8163     0.0000 0.008 0.028 0.308 0.172 0.324 0.160
#> GSM1178989     2  0.5518     0.3143 0.000 0.564 0.332 0.000 0.072 0.032
#> GSM1178993     4  0.0000     0.5842 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM1178999     2  0.4649     0.2945 0.000 0.560 0.004 0.400 0.036 0.000
#> GSM1179021     2  0.3843     0.2313 0.000 0.548 0.000 0.452 0.000 0.000
#> GSM1179025     2  0.0146     0.8491 0.000 0.996 0.000 0.000 0.004 0.000
#> GSM1179027     4  0.0000     0.5842 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM1179011     4  0.1267     0.5727 0.000 0.000 0.000 0.940 0.060 0.000
#> GSM1179023     1  0.0000     0.8046 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1179029     1  0.4718     0.6018 0.708 0.000 0.060 0.000 0.200 0.032
#> GSM1179034     1  0.0000     0.8046 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1179040     4  0.3592     0.2311 0.000 0.344 0.000 0.656 0.000 0.000
#> GSM1178988     3  0.6475    -0.0567 0.000 0.300 0.496 0.000 0.140 0.064
#> GSM1179037     3  0.4408     0.2403 0.000 0.000 0.636 0.000 0.044 0.320

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) protocol(p) k
#> MAD:skmeans 68           0.0115     0.44976 2
#> MAD:skmeans 70           0.1371     0.00391 3
#> MAD:skmeans 63           0.1298     0.00668 4
#> MAD:skmeans 53           0.0105     0.00649 5
#> MAD:skmeans 41           0.0410     0.06231 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 31632 rows and 73 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 0.599           0.899       0.923         0.4352 0.543   0.543
#> 3 3 0.908           0.901       0.956         0.3416 0.866   0.754
#> 4 4 0.760           0.854       0.894         0.1676 0.908   0.777
#> 5 5 0.802           0.863       0.915         0.1296 0.881   0.650
#> 6 6 0.760           0.770       0.871         0.0417 0.968   0.865

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
#> GSM1178971     2  0.5842      0.930 0.140 0.860
#> GSM1178979     2  0.0000      0.902 0.000 1.000
#> GSM1179009     2  0.5629      0.932 0.132 0.868
#> GSM1179031     2  0.0000      0.902 0.000 1.000
#> GSM1178970     2  0.1843      0.916 0.028 0.972
#> GSM1178972     2  0.0000      0.902 0.000 1.000
#> GSM1178973     1  0.0000      0.934 1.000 0.000
#> GSM1178974     2  0.0000      0.902 0.000 1.000
#> GSM1178977     2  0.2603      0.922 0.044 0.956
#> GSM1178978     1  0.9580      0.456 0.620 0.380
#> GSM1178998     1  0.0000      0.934 1.000 0.000
#> GSM1179010     2  0.7139      0.875 0.196 0.804
#> GSM1179018     2  0.4431      0.932 0.092 0.908
#> GSM1179024     1  0.0000      0.934 1.000 0.000
#> GSM1178984     1  0.9286      0.434 0.656 0.344
#> GSM1178990     1  0.0000      0.934 1.000 0.000
#> GSM1178991     1  0.0000      0.934 1.000 0.000
#> GSM1178994     2  0.5842      0.930 0.140 0.860
#> GSM1178997     1  0.1843      0.912 0.972 0.028
#> GSM1179000     1  0.0000      0.934 1.000 0.000
#> GSM1179013     1  0.0000      0.934 1.000 0.000
#> GSM1179014     1  0.0000      0.934 1.000 0.000
#> GSM1179019     1  0.0000      0.934 1.000 0.000
#> GSM1179020     1  0.0000      0.934 1.000 0.000
#> GSM1179022     1  0.0000      0.934 1.000 0.000
#> GSM1179028     2  0.0000      0.902 0.000 1.000
#> GSM1179032     1  0.0000      0.934 1.000 0.000
#> GSM1179041     2  0.0000      0.902 0.000 1.000
#> GSM1179042     2  0.0000      0.902 0.000 1.000
#> GSM1178976     2  0.1843      0.916 0.028 0.972
#> GSM1178981     2  0.5737      0.932 0.136 0.864
#> GSM1178982     2  0.5737      0.932 0.136 0.864
#> GSM1178983     2  0.7528      0.844 0.216 0.784
#> GSM1178985     2  0.5737      0.932 0.136 0.864
#> GSM1178992     2  0.5737      0.932 0.136 0.864
#> GSM1179005     2  0.5737      0.932 0.136 0.864
#> GSM1179007     2  0.5842      0.930 0.140 0.860
#> GSM1179012     1  0.0000      0.934 1.000 0.000
#> GSM1179016     2  0.5737      0.932 0.136 0.864
#> GSM1179030     2  0.3274      0.926 0.060 0.940
#> GSM1179038     2  0.5737      0.932 0.136 0.864
#> GSM1178987     2  0.5737      0.932 0.136 0.864
#> GSM1179003     2  0.0000      0.902 0.000 1.000
#> GSM1179004     2  0.5737      0.932 0.136 0.864
#> GSM1179039     2  0.0000      0.902 0.000 1.000
#> GSM1178975     1  0.8955      0.512 0.688 0.312
#> GSM1178980     2  0.2423      0.921 0.040 0.960
#> GSM1178995     2  0.5842      0.930 0.140 0.860
#> GSM1178996     2  0.5737      0.932 0.136 0.864
#> GSM1179001     1  0.0000      0.934 1.000 0.000
#> GSM1179002     1  0.0938      0.925 0.988 0.012
#> GSM1179006     2  0.5737      0.932 0.136 0.864
#> GSM1179008     1  0.0000      0.934 1.000 0.000
#> GSM1179015     1  0.0000      0.934 1.000 0.000
#> GSM1179017     2  0.0672      0.907 0.008 0.992
#> GSM1179026     2  0.5737      0.932 0.136 0.864
#> GSM1179033     2  0.5737      0.932 0.136 0.864
#> GSM1179035     2  0.5737      0.932 0.136 0.864
#> GSM1179036     2  0.5737      0.932 0.136 0.864
#> GSM1178986     2  0.5737      0.932 0.136 0.864
#> GSM1178989     2  0.3274      0.926 0.060 0.940
#> GSM1178993     2  0.4690      0.933 0.100 0.900
#> GSM1178999     2  0.2423      0.921 0.040 0.960
#> GSM1179021     2  0.0000      0.902 0.000 1.000
#> GSM1179025     2  0.0000      0.902 0.000 1.000
#> GSM1179027     2  0.4431      0.932 0.092 0.908
#> GSM1179011     1  0.9209      0.489 0.664 0.336
#> GSM1179023     1  0.0000      0.934 1.000 0.000
#> GSM1179029     1  0.0000      0.934 1.000 0.000
#> GSM1179034     1  0.0000      0.934 1.000 0.000
#> GSM1179040     2  0.2423      0.921 0.040 0.960
#> GSM1178988     2  0.4939      0.933 0.108 0.892
#> GSM1179037     2  0.5737      0.932 0.136 0.864

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>            class entropy silhouette    p1    p2    p3
#> GSM1178971     3  0.1289      0.961 0.032 0.000 0.968
#> GSM1178979     3  0.5905      0.443 0.000 0.352 0.648
#> GSM1179009     3  0.0747      0.969 0.016 0.000 0.984
#> GSM1179031     2  0.0000      0.968 0.000 1.000 0.000
#> GSM1178970     3  0.0000      0.968 0.000 0.000 1.000
#> GSM1178972     2  0.0000      0.968 0.000 1.000 0.000
#> GSM1178973     1  0.0000      0.898 1.000 0.000 0.000
#> GSM1178974     2  0.0000      0.968 0.000 1.000 0.000
#> GSM1178977     3  0.0000      0.968 0.000 0.000 1.000
#> GSM1178978     1  0.6154      0.421 0.592 0.000 0.408
#> GSM1178998     1  0.0592      0.893 0.988 0.000 0.012
#> GSM1179010     3  0.2878      0.896 0.096 0.000 0.904
#> GSM1179018     3  0.0000      0.968 0.000 0.000 1.000
#> GSM1179024     1  0.0000      0.898 1.000 0.000 0.000
#> GSM1178984     1  0.6192      0.363 0.580 0.000 0.420
#> GSM1178990     1  0.0000      0.898 1.000 0.000 0.000
#> GSM1178991     1  0.1860      0.867 0.948 0.000 0.052
#> GSM1178994     3  0.1031      0.966 0.024 0.000 0.976
#> GSM1178997     1  0.2537      0.843 0.920 0.000 0.080
#> GSM1179000     1  0.0000      0.898 1.000 0.000 0.000
#> GSM1179013     1  0.0000      0.898 1.000 0.000 0.000
#> GSM1179014     1  0.0424      0.892 0.992 0.000 0.008
#> GSM1179019     1  0.0000      0.898 1.000 0.000 0.000
#> GSM1179020     1  0.0000      0.898 1.000 0.000 0.000
#> GSM1179022     1  0.0000      0.898 1.000 0.000 0.000
#> GSM1179028     2  0.0000      0.968 0.000 1.000 0.000
#> GSM1179032     1  0.0000      0.898 1.000 0.000 0.000
#> GSM1179041     2  0.0000      0.968 0.000 1.000 0.000
#> GSM1179042     2  0.0000      0.968 0.000 1.000 0.000
#> GSM1178976     3  0.0000      0.968 0.000 0.000 1.000
#> GSM1178981     3  0.0592      0.969 0.012 0.000 0.988
#> GSM1178982     3  0.0237      0.969 0.004 0.000 0.996
#> GSM1178983     3  0.3038      0.868 0.104 0.000 0.896
#> GSM1178985     3  0.0592      0.969 0.012 0.000 0.988
#> GSM1178992     3  0.0892      0.968 0.020 0.000 0.980
#> GSM1179005     3  0.0892      0.968 0.020 0.000 0.980
#> GSM1179007     3  0.1860      0.945 0.052 0.000 0.948
#> GSM1179012     1  0.1411      0.876 0.964 0.000 0.036
#> GSM1179016     3  0.0237      0.969 0.004 0.000 0.996
#> GSM1179030     3  0.0237      0.969 0.004 0.000 0.996
#> GSM1179038     3  0.0892      0.968 0.020 0.000 0.980
#> GSM1178987     3  0.0237      0.969 0.004 0.000 0.996
#> GSM1179003     3  0.3619      0.838 0.000 0.136 0.864
#> GSM1179004     3  0.0592      0.969 0.012 0.000 0.988
#> GSM1179039     2  0.0000      0.968 0.000 1.000 0.000
#> GSM1178975     1  0.5905      0.502 0.648 0.000 0.352
#> GSM1178980     3  0.0000      0.968 0.000 0.000 1.000
#> GSM1178995     3  0.1964      0.941 0.056 0.000 0.944
#> GSM1178996     3  0.0892      0.968 0.020 0.000 0.980
#> GSM1179001     1  0.0000      0.898 1.000 0.000 0.000
#> GSM1179002     1  0.1031      0.885 0.976 0.000 0.024
#> GSM1179006     3  0.0747      0.969 0.016 0.000 0.984
#> GSM1179008     1  0.0000      0.898 1.000 0.000 0.000
#> GSM1179015     1  0.0000      0.898 1.000 0.000 0.000
#> GSM1179017     3  0.1860      0.932 0.000 0.052 0.948
#> GSM1179026     3  0.0747      0.969 0.016 0.000 0.984
#> GSM1179033     3  0.0892      0.968 0.020 0.000 0.980
#> GSM1179035     3  0.0892      0.968 0.020 0.000 0.980
#> GSM1179036     3  0.0892      0.968 0.020 0.000 0.980
#> GSM1178986     3  0.0237      0.969 0.004 0.000 0.996
#> GSM1178989     3  0.0237      0.969 0.004 0.000 0.996
#> GSM1178993     3  0.0000      0.968 0.000 0.000 1.000
#> GSM1178999     3  0.0000      0.968 0.000 0.000 1.000
#> GSM1179021     2  0.4605      0.737 0.000 0.796 0.204
#> GSM1179025     2  0.0000      0.968 0.000 1.000 0.000
#> GSM1179027     3  0.0424      0.969 0.008 0.000 0.992
#> GSM1179011     1  0.6180      0.411 0.584 0.000 0.416
#> GSM1179023     1  0.0000      0.898 1.000 0.000 0.000
#> GSM1179029     1  0.0237      0.896 0.996 0.000 0.004
#> GSM1179034     1  0.0000      0.898 1.000 0.000 0.000
#> GSM1179040     3  0.0000      0.968 0.000 0.000 1.000
#> GSM1178988     3  0.0237      0.969 0.004 0.000 0.996
#> GSM1179037     3  0.0747      0.969 0.016 0.000 0.984

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>            class entropy silhouette    p1    p2    p3    p4
#> GSM1178971     3  0.0817      0.902 0.024 0.000 0.976 0.000
#> GSM1178979     4  0.5690      0.739 0.000 0.168 0.116 0.716
#> GSM1179009     3  0.4483      0.723 0.004 0.000 0.712 0.284
#> GSM1179031     2  0.0000      1.000 0.000 1.000 0.000 0.000
#> GSM1178970     3  0.1792      0.871 0.000 0.000 0.932 0.068
#> GSM1178972     2  0.0000      1.000 0.000 1.000 0.000 0.000
#> GSM1178973     1  0.0188      0.887 0.996 0.000 0.000 0.004
#> GSM1178974     2  0.0000      1.000 0.000 1.000 0.000 0.000
#> GSM1178977     3  0.2081      0.855 0.000 0.000 0.916 0.084
#> GSM1178978     1  0.7315      0.418 0.516 0.000 0.184 0.300
#> GSM1178998     1  0.3808      0.778 0.812 0.000 0.012 0.176
#> GSM1179010     3  0.4035      0.818 0.020 0.000 0.804 0.176
#> GSM1179018     3  0.0817      0.903 0.000 0.000 0.976 0.024
#> GSM1179024     1  0.0000      0.887 1.000 0.000 0.000 0.000
#> GSM1178984     1  0.7421      0.300 0.484 0.000 0.332 0.184
#> GSM1178990     1  0.0000      0.887 1.000 0.000 0.000 0.000
#> GSM1178991     1  0.4015      0.783 0.832 0.000 0.052 0.116
#> GSM1178994     3  0.3768      0.821 0.008 0.000 0.808 0.184
#> GSM1178997     1  0.2329      0.844 0.916 0.000 0.072 0.012
#> GSM1179000     1  0.0000      0.887 1.000 0.000 0.000 0.000
#> GSM1179013     1  0.0000      0.887 1.000 0.000 0.000 0.000
#> GSM1179014     1  0.0000      0.887 1.000 0.000 0.000 0.000
#> GSM1179019     1  0.0000      0.887 1.000 0.000 0.000 0.000
#> GSM1179020     1  0.0336      0.887 0.992 0.000 0.000 0.008
#> GSM1179022     1  0.0000      0.887 1.000 0.000 0.000 0.000
#> GSM1179028     2  0.0000      1.000 0.000 1.000 0.000 0.000
#> GSM1179032     1  0.0000      0.887 1.000 0.000 0.000 0.000
#> GSM1179041     2  0.0000      1.000 0.000 1.000 0.000 0.000
#> GSM1179042     2  0.0000      1.000 0.000 1.000 0.000 0.000
#> GSM1178976     3  0.0000      0.906 0.000 0.000 1.000 0.000
#> GSM1178981     3  0.3626      0.822 0.004 0.000 0.812 0.184
#> GSM1178982     3  0.3257      0.845 0.004 0.000 0.844 0.152
#> GSM1178983     3  0.5576      0.718 0.096 0.000 0.720 0.184
#> GSM1178985     3  0.2999      0.855 0.004 0.000 0.864 0.132
#> GSM1178992     3  0.0524      0.908 0.008 0.000 0.988 0.004
#> GSM1179005     3  0.0336      0.907 0.008 0.000 0.992 0.000
#> GSM1179007     3  0.4552      0.808 0.044 0.000 0.784 0.172
#> GSM1179012     1  0.4595      0.753 0.780 0.000 0.044 0.176
#> GSM1179016     3  0.0469      0.904 0.000 0.000 0.988 0.012
#> GSM1179030     3  0.0707      0.902 0.000 0.000 0.980 0.020
#> GSM1179038     3  0.0336      0.907 0.008 0.000 0.992 0.000
#> GSM1178987     3  0.3569      0.818 0.000 0.000 0.804 0.196
#> GSM1179003     3  0.3525      0.824 0.000 0.100 0.860 0.040
#> GSM1179004     3  0.3539      0.824 0.004 0.000 0.820 0.176
#> GSM1179039     2  0.0000      1.000 0.000 1.000 0.000 0.000
#> GSM1178975     1  0.5408      0.334 0.576 0.000 0.408 0.016
#> GSM1178980     4  0.3356      0.871 0.000 0.000 0.176 0.824
#> GSM1178995     3  0.2844      0.878 0.048 0.000 0.900 0.052
#> GSM1178996     3  0.0336      0.907 0.008 0.000 0.992 0.000
#> GSM1179001     1  0.0817      0.883 0.976 0.000 0.000 0.024
#> GSM1179002     1  0.1970      0.855 0.932 0.000 0.060 0.008
#> GSM1179006     3  0.0188      0.907 0.004 0.000 0.996 0.000
#> GSM1179008     1  0.1792      0.864 0.932 0.000 0.000 0.068
#> GSM1179015     1  0.1022      0.881 0.968 0.000 0.000 0.032
#> GSM1179017     3  0.1938      0.878 0.000 0.052 0.936 0.012
#> GSM1179026     3  0.0188      0.907 0.004 0.000 0.996 0.000
#> GSM1179033     3  0.0336      0.907 0.008 0.000 0.992 0.000
#> GSM1179035     3  0.0524      0.908 0.008 0.000 0.988 0.004
#> GSM1179036     3  0.0336      0.907 0.008 0.000 0.992 0.000
#> GSM1178986     3  0.0592      0.903 0.000 0.000 0.984 0.016
#> GSM1178989     3  0.0469      0.904 0.000 0.000 0.988 0.012
#> GSM1178993     4  0.1792      0.789 0.000 0.000 0.068 0.932
#> GSM1178999     4  0.4040      0.822 0.000 0.000 0.248 0.752
#> GSM1179021     4  0.3751      0.660 0.000 0.196 0.004 0.800
#> GSM1179025     2  0.0000      1.000 0.000 1.000 0.000 0.000
#> GSM1179027     4  0.3569      0.869 0.000 0.000 0.196 0.804
#> GSM1179011     4  0.3494      0.871 0.004 0.000 0.172 0.824
#> GSM1179023     1  0.0000      0.887 1.000 0.000 0.000 0.000
#> GSM1179029     1  0.1576      0.874 0.948 0.000 0.004 0.048
#> GSM1179034     1  0.0000      0.887 1.000 0.000 0.000 0.000
#> GSM1179040     4  0.3801      0.859 0.000 0.000 0.220 0.780
#> GSM1178988     3  0.0000      0.906 0.000 0.000 1.000 0.000
#> GSM1179037     3  0.0188      0.907 0.004 0.000 0.996 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
#> GSM1178971     3  0.0162      0.887 0.004 0.000 0.996 0.000 0.000
#> GSM1178979     4  0.2069      0.921 0.000 0.000 0.012 0.912 0.076
#> GSM1179009     5  0.3590      0.848 0.000 0.000 0.092 0.080 0.828
#> GSM1179031     2  0.0000      0.999 0.000 1.000 0.000 0.000 0.000
#> GSM1178970     3  0.5844      0.604 0.000 0.000 0.608 0.208 0.184
#> GSM1178972     2  0.0162      0.997 0.000 0.996 0.000 0.000 0.004
#> GSM1178973     1  0.1809      0.890 0.928 0.000 0.060 0.000 0.012
#> GSM1178974     2  0.0000      0.999 0.000 1.000 0.000 0.000 0.000
#> GSM1178977     3  0.5502      0.652 0.000 0.000 0.652 0.192 0.156
#> GSM1178978     5  0.1285      0.847 0.036 0.000 0.004 0.004 0.956
#> GSM1178998     5  0.3231      0.750 0.196 0.000 0.004 0.000 0.800
#> GSM1179010     5  0.3039      0.822 0.000 0.000 0.192 0.000 0.808
#> GSM1179018     3  0.3081      0.819 0.000 0.000 0.832 0.012 0.156
#> GSM1179024     1  0.0000      0.905 1.000 0.000 0.000 0.000 0.000
#> GSM1178984     5  0.2595      0.862 0.032 0.000 0.080 0.000 0.888
#> GSM1178990     1  0.1410      0.891 0.940 0.000 0.060 0.000 0.000
#> GSM1178991     1  0.3565      0.797 0.816 0.000 0.000 0.040 0.144
#> GSM1178994     5  0.2179      0.873 0.000 0.000 0.112 0.000 0.888
#> GSM1178997     1  0.3291      0.841 0.848 0.000 0.064 0.000 0.088
#> GSM1179000     1  0.0290      0.905 0.992 0.000 0.008 0.000 0.000
#> GSM1179013     1  0.0000      0.905 1.000 0.000 0.000 0.000 0.000
#> GSM1179014     1  0.0579      0.905 0.984 0.000 0.008 0.000 0.008
#> GSM1179019     1  0.0510      0.904 0.984 0.000 0.016 0.000 0.000
#> GSM1179020     1  0.0290      0.905 0.992 0.000 0.000 0.000 0.008
#> GSM1179022     1  0.0000      0.905 1.000 0.000 0.000 0.000 0.000
#> GSM1179028     2  0.0000      0.999 0.000 1.000 0.000 0.000 0.000
#> GSM1179032     1  0.0000      0.905 1.000 0.000 0.000 0.000 0.000
#> GSM1179041     2  0.0000      0.999 0.000 1.000 0.000 0.000 0.000
#> GSM1179042     2  0.0000      0.999 0.000 1.000 0.000 0.000 0.000
#> GSM1178976     3  0.1410      0.886 0.000 0.000 0.940 0.000 0.060
#> GSM1178981     5  0.1908      0.875 0.000 0.000 0.092 0.000 0.908
#> GSM1178982     5  0.2690      0.820 0.000 0.000 0.156 0.000 0.844
#> GSM1178983     5  0.1851      0.853 0.000 0.000 0.088 0.000 0.912
#> GSM1178985     3  0.4045      0.440 0.000 0.000 0.644 0.000 0.356
#> GSM1178992     3  0.0162      0.888 0.000 0.000 0.996 0.000 0.004
#> GSM1179005     3  0.0000      0.888 0.000 0.000 1.000 0.000 0.000
#> GSM1179007     3  0.3857      0.465 0.000 0.000 0.688 0.000 0.312
#> GSM1179012     5  0.3723      0.772 0.152 0.000 0.044 0.000 0.804
#> GSM1179016     3  0.1671      0.881 0.000 0.000 0.924 0.000 0.076
#> GSM1179030     3  0.2891      0.813 0.000 0.000 0.824 0.000 0.176
#> GSM1179038     3  0.0000      0.888 0.000 0.000 1.000 0.000 0.000
#> GSM1178987     5  0.1410      0.861 0.000 0.000 0.060 0.000 0.940
#> GSM1179003     3  0.4462      0.780 0.000 0.056 0.788 0.124 0.032
#> GSM1179004     5  0.3074      0.821 0.000 0.000 0.196 0.000 0.804
#> GSM1179039     2  0.0000      0.999 0.000 1.000 0.000 0.000 0.000
#> GSM1178975     1  0.5733      0.216 0.476 0.000 0.440 0.000 0.084
#> GSM1178980     4  0.0404      0.968 0.000 0.000 0.000 0.988 0.012
#> GSM1178995     3  0.1478      0.854 0.000 0.000 0.936 0.000 0.064
#> GSM1178996     3  0.0000      0.888 0.000 0.000 1.000 0.000 0.000
#> GSM1179001     1  0.2843      0.864 0.876 0.000 0.048 0.000 0.076
#> GSM1179002     1  0.3493      0.832 0.832 0.000 0.108 0.000 0.060
#> GSM1179006     3  0.0609      0.891 0.000 0.000 0.980 0.000 0.020
#> GSM1179008     1  0.3336      0.839 0.844 0.000 0.060 0.000 0.096
#> GSM1179015     1  0.2409      0.878 0.900 0.000 0.032 0.000 0.068
#> GSM1179017     3  0.2209      0.875 0.000 0.032 0.912 0.000 0.056
#> GSM1179026     3  0.0880      0.890 0.000 0.000 0.968 0.000 0.032
#> GSM1179033     3  0.0000      0.888 0.000 0.000 1.000 0.000 0.000
#> GSM1179035     3  0.0703      0.891 0.000 0.000 0.976 0.000 0.024
#> GSM1179036     3  0.0000      0.888 0.000 0.000 1.000 0.000 0.000
#> GSM1178986     3  0.1671      0.882 0.000 0.000 0.924 0.000 0.076
#> GSM1178989     3  0.1544      0.884 0.000 0.000 0.932 0.000 0.068
#> GSM1178993     4  0.0000      0.970 0.000 0.000 0.000 1.000 0.000
#> GSM1178999     4  0.1892      0.923 0.000 0.000 0.004 0.916 0.080
#> GSM1179021     4  0.0162      0.970 0.000 0.000 0.000 0.996 0.004
#> GSM1179025     2  0.0162      0.997 0.000 0.996 0.000 0.000 0.004
#> GSM1179027     4  0.0000      0.970 0.000 0.000 0.000 1.000 0.000
#> GSM1179011     4  0.0404      0.968 0.000 0.000 0.000 0.988 0.012
#> GSM1179023     1  0.0000      0.905 1.000 0.000 0.000 0.000 0.000
#> GSM1179029     1  0.4162      0.741 0.768 0.000 0.056 0.000 0.176
#> GSM1179034     1  0.0000      0.905 1.000 0.000 0.000 0.000 0.000
#> GSM1179040     4  0.0162      0.969 0.000 0.000 0.004 0.996 0.000
#> GSM1178988     3  0.1410      0.886 0.000 0.000 0.940 0.000 0.060
#> GSM1179037     3  0.0880      0.890 0.000 0.000 0.968 0.000 0.032

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>            class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM1178971     3  0.1116    0.84922 0.004 0.000 0.960 0.008 0.000 0.028
#> GSM1178979     5  0.3042    0.75929 0.000 0.000 0.004 0.128 0.836 0.032
#> GSM1179009     6  0.4305    0.75290 0.000 0.000 0.076 0.052 0.096 0.776
#> GSM1179031     2  0.0000    0.98079 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1178970     3  0.6966    0.41325 0.000 0.000 0.488 0.152 0.212 0.148
#> GSM1178972     2  0.2001    0.91101 0.000 0.912 0.000 0.040 0.048 0.000
#> GSM1178973     4  0.4419    0.50272 0.304 0.000 0.012 0.656 0.000 0.028
#> GSM1178974     2  0.0000    0.98079 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1178977     3  0.6891    0.43097 0.000 0.000 0.500 0.152 0.208 0.140
#> GSM1178978     6  0.2755    0.78046 0.012 0.000 0.004 0.140 0.000 0.844
#> GSM1178998     6  0.3412    0.76008 0.064 0.000 0.000 0.128 0.000 0.808
#> GSM1179010     6  0.2664    0.77959 0.000 0.000 0.016 0.136 0.000 0.848
#> GSM1179018     3  0.2963    0.76983 0.000 0.000 0.828 0.016 0.004 0.152
#> GSM1179024     1  0.0000    0.88396 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1178984     6  0.1251    0.81974 0.024 0.000 0.012 0.008 0.000 0.956
#> GSM1178990     1  0.1218    0.85651 0.956 0.000 0.012 0.004 0.000 0.028
#> GSM1178991     4  0.4457    0.54706 0.068 0.000 0.004 0.768 0.048 0.112
#> GSM1178994     6  0.0820    0.82666 0.000 0.000 0.016 0.012 0.000 0.972
#> GSM1178997     4  0.4976    0.22462 0.412 0.000 0.012 0.532 0.000 0.044
#> GSM1179000     1  0.0146    0.88306 0.996 0.000 0.000 0.000 0.000 0.004
#> GSM1179013     1  0.0000    0.88396 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1179014     1  0.0146    0.88255 0.996 0.000 0.000 0.004 0.000 0.000
#> GSM1179019     1  0.0146    0.88306 0.996 0.000 0.000 0.000 0.000 0.004
#> GSM1179020     1  0.0260    0.88116 0.992 0.000 0.000 0.000 0.000 0.008
#> GSM1179022     1  0.0000    0.88396 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1179028     2  0.0000    0.98079 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1179032     1  0.0000    0.88396 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1179041     2  0.0000    0.98079 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1179042     2  0.0000    0.98079 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1178976     3  0.0363    0.85742 0.000 0.000 0.988 0.000 0.000 0.012
#> GSM1178981     6  0.1075    0.82669 0.000 0.000 0.048 0.000 0.000 0.952
#> GSM1178982     6  0.2593    0.77207 0.000 0.000 0.148 0.008 0.000 0.844
#> GSM1178983     6  0.3190    0.76827 0.000 0.000 0.044 0.136 0.000 0.820
#> GSM1178985     3  0.3620    0.42304 0.000 0.000 0.648 0.000 0.000 0.352
#> GSM1178992     3  0.0291    0.85729 0.000 0.000 0.992 0.004 0.000 0.004
#> GSM1179005     3  0.0858    0.85095 0.000 0.000 0.968 0.004 0.000 0.028
#> GSM1179007     3  0.3769    0.47813 0.000 0.000 0.640 0.004 0.000 0.356
#> GSM1179012     6  0.3125    0.77187 0.032 0.000 0.004 0.136 0.000 0.828
#> GSM1179016     3  0.2513    0.80905 0.000 0.000 0.852 0.140 0.000 0.008
#> GSM1179030     3  0.4429    0.69497 0.000 0.000 0.716 0.140 0.000 0.144
#> GSM1179038     3  0.0858    0.85095 0.000 0.000 0.968 0.004 0.000 0.028
#> GSM1178987     6  0.2858    0.78638 0.000 0.000 0.032 0.124 0.000 0.844
#> GSM1179003     3  0.3987    0.71578 0.000 0.056 0.760 0.008 0.176 0.000
#> GSM1179004     6  0.2912    0.71049 0.000 0.000 0.216 0.000 0.000 0.784
#> GSM1179039     2  0.0000    0.98079 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1178975     4  0.5617    0.54106 0.092 0.000 0.164 0.656 0.000 0.088
#> GSM1178980     4  0.3868   -0.00654 0.000 0.000 0.000 0.508 0.492 0.000
#> GSM1178995     3  0.1958    0.82182 0.000 0.000 0.896 0.004 0.000 0.100
#> GSM1178996     3  0.0291    0.85653 0.000 0.000 0.992 0.004 0.000 0.004
#> GSM1179001     1  0.3089    0.72485 0.800 0.000 0.004 0.008 0.000 0.188
#> GSM1179002     1  0.4586    0.60966 0.712 0.000 0.104 0.008 0.000 0.176
#> GSM1179006     3  0.0260    0.85748 0.000 0.000 0.992 0.000 0.000 0.008
#> GSM1179008     1  0.4806    0.60005 0.708 0.000 0.020 0.160 0.000 0.112
#> GSM1179015     1  0.4087    0.67874 0.760 0.000 0.004 0.136 0.000 0.100
#> GSM1179017     3  0.3854    0.77152 0.000 0.016 0.788 0.140 0.056 0.000
#> GSM1179026     3  0.0363    0.85742 0.000 0.000 0.988 0.000 0.000 0.012
#> GSM1179033     3  0.0146    0.85658 0.000 0.000 0.996 0.004 0.000 0.000
#> GSM1179035     3  0.0603    0.85852 0.000 0.000 0.980 0.004 0.000 0.016
#> GSM1179036     3  0.0146    0.85658 0.000 0.000 0.996 0.004 0.000 0.000
#> GSM1178986     3  0.2358    0.82452 0.000 0.000 0.876 0.108 0.000 0.016
#> GSM1178989     3  0.2165    0.82670 0.000 0.000 0.884 0.108 0.000 0.008
#> GSM1178993     5  0.1285    0.84916 0.000 0.000 0.000 0.052 0.944 0.004
#> GSM1178999     5  0.2726    0.77858 0.000 0.000 0.000 0.112 0.856 0.032
#> GSM1179021     5  0.0000    0.85366 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM1179025     2  0.1010    0.95414 0.000 0.960 0.000 0.004 0.036 0.000
#> GSM1179027     5  0.1285    0.85055 0.000 0.000 0.004 0.052 0.944 0.000
#> GSM1179011     4  0.3390    0.40815 0.000 0.000 0.000 0.704 0.296 0.000
#> GSM1179023     1  0.0000    0.88396 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1179029     1  0.4570    0.54528 0.664 0.000 0.012 0.044 0.000 0.280
#> GSM1179034     1  0.0000    0.88396 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1179040     5  0.1644    0.83980 0.000 0.000 0.040 0.028 0.932 0.000
#> GSM1178988     3  0.0363    0.85742 0.000 0.000 0.988 0.000 0.000 0.012
#> GSM1179037     3  0.0363    0.85742 0.000 0.000 0.988 0.000 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-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) protocol(p) k
#> MAD:pam 70          0.49724    5.24e-03 2
#> MAD:pam 69          0.59151    4.86e-04 3
#> MAD:pam 70          0.00839    1.91e-05 4
#> MAD:pam 70          0.00663    1.96e-05 5
#> MAD:pam 66          0.01164    8.04e-06 6

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


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

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

collect_plots(res)

plot of chunk MAD-mclust-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.835           0.903       0.949         0.2909 0.703   0.703
#> 3 3 0.665           0.859       0.919         0.9081 0.653   0.538
#> 4 4 0.731           0.775       0.913         0.1947 0.782   0.576
#> 5 5 0.653           0.760       0.861         0.0870 0.815   0.557
#> 6 6 0.674           0.569       0.810         0.0661 0.918   0.738

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
#> GSM1178971     1  0.0000      0.964 1.000 0.000
#> GSM1178979     2  0.6887      0.821 0.184 0.816
#> GSM1179009     1  0.3733      0.912 0.928 0.072
#> GSM1179031     2  0.3431      0.887 0.064 0.936
#> GSM1178970     2  0.7883      0.769 0.236 0.764
#> GSM1178972     2  0.3431      0.887 0.064 0.936
#> GSM1178973     1  0.3733      0.912 0.928 0.072
#> GSM1178974     2  0.3431      0.887 0.064 0.936
#> GSM1178977     1  0.6247      0.800 0.844 0.156
#> GSM1178978     1  0.3733      0.912 0.928 0.072
#> GSM1178998     1  0.0000      0.964 1.000 0.000
#> GSM1179010     1  0.0000      0.964 1.000 0.000
#> GSM1179018     1  0.3584      0.915 0.932 0.068
#> GSM1179024     1  0.0000      0.964 1.000 0.000
#> GSM1178984     1  0.0000      0.964 1.000 0.000
#> GSM1178990     1  0.0000      0.964 1.000 0.000
#> GSM1178991     1  0.3733      0.912 0.928 0.072
#> GSM1178994     1  0.0000      0.964 1.000 0.000
#> GSM1178997     1  0.0000      0.964 1.000 0.000
#> GSM1179000     1  0.0000      0.964 1.000 0.000
#> GSM1179013     1  0.0000      0.964 1.000 0.000
#> GSM1179014     1  0.0000      0.964 1.000 0.000
#> GSM1179019     1  0.0000      0.964 1.000 0.000
#> GSM1179020     1  0.0000      0.964 1.000 0.000
#> GSM1179022     1  0.0000      0.964 1.000 0.000
#> GSM1179028     2  0.3431      0.887 0.064 0.936
#> GSM1179032     1  0.0000      0.964 1.000 0.000
#> GSM1179041     2  0.3431      0.887 0.064 0.936
#> GSM1179042     2  0.3431      0.887 0.064 0.936
#> GSM1178976     1  0.9129      0.403 0.672 0.328
#> GSM1178981     1  0.0000      0.964 1.000 0.000
#> GSM1178982     1  0.0000      0.964 1.000 0.000
#> GSM1178983     1  0.0000      0.964 1.000 0.000
#> GSM1178985     1  0.0000      0.964 1.000 0.000
#> GSM1178992     1  0.0376      0.962 0.996 0.004
#> GSM1179005     1  0.0000      0.964 1.000 0.000
#> GSM1179007     1  0.0000      0.964 1.000 0.000
#> GSM1179012     1  0.0000      0.964 1.000 0.000
#> GSM1179016     1  0.0672      0.959 0.992 0.008
#> GSM1179030     1  0.0672      0.959 0.992 0.008
#> GSM1179038     1  0.0000      0.964 1.000 0.000
#> GSM1178987     1  0.0000      0.964 1.000 0.000
#> GSM1179003     2  0.9881      0.404 0.436 0.564
#> GSM1179004     1  0.0000      0.964 1.000 0.000
#> GSM1179039     2  0.3431      0.887 0.064 0.936
#> GSM1178975     1  0.3733      0.912 0.928 0.072
#> GSM1178980     1  0.6973      0.781 0.812 0.188
#> GSM1178995     1  0.0000      0.964 1.000 0.000
#> GSM1178996     1  0.0000      0.964 1.000 0.000
#> GSM1179001     1  0.0000      0.964 1.000 0.000
#> GSM1179002     1  0.0000      0.964 1.000 0.000
#> GSM1179006     1  0.0000      0.964 1.000 0.000
#> GSM1179008     1  0.0000      0.964 1.000 0.000
#> GSM1179015     1  0.0000      0.964 1.000 0.000
#> GSM1179017     1  0.5842      0.806 0.860 0.140
#> GSM1179026     1  0.0000      0.964 1.000 0.000
#> GSM1179033     1  0.0000      0.964 1.000 0.000
#> GSM1179035     1  0.0000      0.964 1.000 0.000
#> GSM1179036     1  0.0000      0.964 1.000 0.000
#> GSM1178986     1  0.0376      0.962 0.996 0.004
#> GSM1178989     1  0.0672      0.959 0.992 0.008
#> GSM1178993     1  0.3733      0.912 0.928 0.072
#> GSM1178999     1  0.9044      0.426 0.680 0.320
#> GSM1179021     2  0.5294      0.827 0.120 0.880
#> GSM1179025     2  0.3431      0.887 0.064 0.936
#> GSM1179027     1  0.3733      0.912 0.928 0.072
#> GSM1179011     1  0.3733      0.912 0.928 0.072
#> GSM1179023     1  0.0000      0.964 1.000 0.000
#> GSM1179029     1  0.0000      0.964 1.000 0.000
#> GSM1179034     1  0.0000      0.964 1.000 0.000
#> GSM1179040     2  0.9933      0.239 0.452 0.548
#> GSM1178988     1  0.0376      0.962 0.996 0.004
#> GSM1179037     1  0.0000      0.964 1.000 0.000

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>            class entropy silhouette    p1    p2    p3
#> GSM1178971     3  0.1482      0.910 0.020 0.012 0.968
#> GSM1178979     2  0.4002      0.756 0.000 0.840 0.160
#> GSM1179009     3  0.4110      0.845 0.004 0.152 0.844
#> GSM1179031     2  0.0237      0.962 0.004 0.996 0.000
#> GSM1178970     3  0.5497      0.682 0.000 0.292 0.708
#> GSM1178972     2  0.0000      0.963 0.000 1.000 0.000
#> GSM1178973     1  0.6231      0.741 0.772 0.148 0.080
#> GSM1178974     2  0.0000      0.963 0.000 1.000 0.000
#> GSM1178977     3  0.3879      0.847 0.000 0.152 0.848
#> GSM1178978     3  0.3879      0.847 0.000 0.152 0.848
#> GSM1178998     1  0.5016      0.773 0.760 0.000 0.240
#> GSM1179010     3  0.0237      0.913 0.004 0.000 0.996
#> GSM1179018     3  0.3482      0.862 0.000 0.128 0.872
#> GSM1179024     1  0.0747      0.853 0.984 0.000 0.016
#> GSM1178984     3  0.0237      0.913 0.004 0.000 0.996
#> GSM1178990     1  0.4931      0.781 0.768 0.000 0.232
#> GSM1178991     1  0.8847      0.442 0.552 0.148 0.300
#> GSM1178994     3  0.0237      0.913 0.004 0.000 0.996
#> GSM1178997     3  0.6542      0.718 0.204 0.060 0.736
#> GSM1179000     1  0.2625      0.871 0.916 0.000 0.084
#> GSM1179013     1  0.0424      0.848 0.992 0.000 0.008
#> GSM1179014     1  0.2772      0.869 0.916 0.004 0.080
#> GSM1179019     1  0.2625      0.871 0.916 0.000 0.084
#> GSM1179020     1  0.2066      0.871 0.940 0.000 0.060
#> GSM1179022     1  0.0424      0.848 0.992 0.000 0.008
#> GSM1179028     2  0.0237      0.962 0.004 0.996 0.000
#> GSM1179032     1  0.0237      0.845 0.996 0.000 0.004
#> GSM1179041     2  0.0237      0.962 0.004 0.996 0.000
#> GSM1179042     2  0.0000      0.963 0.000 1.000 0.000
#> GSM1178976     3  0.1753      0.904 0.000 0.048 0.952
#> GSM1178981     3  0.0000      0.914 0.000 0.000 1.000
#> GSM1178982     3  0.0000      0.914 0.000 0.000 1.000
#> GSM1178983     3  0.0000      0.914 0.000 0.000 1.000
#> GSM1178985     3  0.0000      0.914 0.000 0.000 1.000
#> GSM1178992     3  0.0000      0.914 0.000 0.000 1.000
#> GSM1179005     3  0.0237      0.913 0.004 0.000 0.996
#> GSM1179007     3  0.0424      0.911 0.008 0.000 0.992
#> GSM1179012     3  0.4121      0.736 0.168 0.000 0.832
#> GSM1179016     3  0.3083      0.895 0.024 0.060 0.916
#> GSM1179030     3  0.2066      0.899 0.000 0.060 0.940
#> GSM1179038     3  0.0237      0.913 0.004 0.000 0.996
#> GSM1178987     3  0.0000      0.914 0.000 0.000 1.000
#> GSM1179003     3  0.6045      0.515 0.000 0.380 0.620
#> GSM1179004     3  0.0000      0.914 0.000 0.000 1.000
#> GSM1179039     2  0.0237      0.962 0.004 0.996 0.000
#> GSM1178975     3  0.8930      0.331 0.316 0.148 0.536
#> GSM1178980     3  0.4110      0.845 0.004 0.152 0.844
#> GSM1178995     3  0.0237      0.913 0.004 0.000 0.996
#> GSM1178996     3  0.0237      0.914 0.000 0.004 0.996
#> GSM1179001     1  0.2537      0.872 0.920 0.000 0.080
#> GSM1179002     3  0.1529      0.893 0.040 0.000 0.960
#> GSM1179006     3  0.0000      0.914 0.000 0.000 1.000
#> GSM1179008     1  0.2066      0.871 0.940 0.000 0.060
#> GSM1179015     1  0.5138      0.759 0.748 0.000 0.252
#> GSM1179017     3  0.2448      0.893 0.000 0.076 0.924
#> GSM1179026     3  0.0000      0.914 0.000 0.000 1.000
#> GSM1179033     3  0.0000      0.914 0.000 0.000 1.000
#> GSM1179035     3  0.0000      0.914 0.000 0.000 1.000
#> GSM1179036     3  0.0000      0.914 0.000 0.000 1.000
#> GSM1178986     3  0.1643      0.906 0.000 0.044 0.956
#> GSM1178989     3  0.0592      0.913 0.000 0.012 0.988
#> GSM1178993     3  0.4110      0.845 0.004 0.152 0.844
#> GSM1178999     3  0.4452      0.811 0.000 0.192 0.808
#> GSM1179021     2  0.1989      0.911 0.004 0.948 0.048
#> GSM1179025     2  0.0000      0.963 0.000 1.000 0.000
#> GSM1179027     3  0.4110      0.845 0.004 0.152 0.844
#> GSM1179011     3  0.4228      0.845 0.008 0.148 0.844
#> GSM1179023     1  0.0424      0.848 0.992 0.000 0.008
#> GSM1179029     1  0.4399      0.814 0.812 0.000 0.188
#> GSM1179034     1  0.0237      0.845 0.996 0.000 0.004
#> GSM1179040     3  0.4629      0.812 0.004 0.188 0.808
#> GSM1178988     3  0.0000      0.914 0.000 0.000 1.000
#> GSM1179037     3  0.0000      0.914 0.000 0.000 1.000

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>            class entropy silhouette    p1    p2    p3    p4
#> GSM1178971     3  0.1716     0.8406 0.064 0.000 0.936 0.000
#> GSM1178979     2  0.5337     0.1795 0.000 0.564 0.424 0.012
#> GSM1179009     4  0.3528     0.6788 0.000 0.000 0.192 0.808
#> GSM1179031     2  0.0000     0.9054 0.000 1.000 0.000 0.000
#> GSM1178970     3  0.2928     0.7882 0.000 0.108 0.880 0.012
#> GSM1178972     2  0.0524     0.9035 0.000 0.988 0.008 0.004
#> GSM1178973     4  0.3790     0.7627 0.164 0.000 0.016 0.820
#> GSM1178974     2  0.0524     0.9035 0.000 0.988 0.008 0.004
#> GSM1178977     3  0.4356     0.5861 0.000 0.000 0.708 0.292
#> GSM1178978     3  0.3726     0.6800 0.000 0.000 0.788 0.212
#> GSM1178998     3  0.3024     0.7610 0.148 0.000 0.852 0.000
#> GSM1179010     3  0.0000     0.8793 0.000 0.000 1.000 0.000
#> GSM1179018     3  0.0817     0.8650 0.000 0.000 0.976 0.024
#> GSM1179024     1  0.0000     0.8853 1.000 0.000 0.000 0.000
#> GSM1178984     3  0.0000     0.8793 0.000 0.000 1.000 0.000
#> GSM1178990     1  0.3688     0.6851 0.792 0.000 0.208 0.000
#> GSM1178991     3  0.7593     0.1318 0.236 0.000 0.476 0.288
#> GSM1178994     3  0.0000     0.8793 0.000 0.000 1.000 0.000
#> GSM1178997     1  0.0188     0.8863 0.996 0.000 0.004 0.000
#> GSM1179000     1  0.0188     0.8863 0.996 0.000 0.004 0.000
#> GSM1179013     1  0.0000     0.8853 1.000 0.000 0.000 0.000
#> GSM1179014     1  0.0188     0.8863 0.996 0.000 0.004 0.000
#> GSM1179019     1  0.0188     0.8863 0.996 0.000 0.004 0.000
#> GSM1179020     1  0.0188     0.8863 0.996 0.000 0.004 0.000
#> GSM1179022     1  0.0000     0.8853 1.000 0.000 0.000 0.000
#> GSM1179028     2  0.0000     0.9054 0.000 1.000 0.000 0.000
#> GSM1179032     1  0.0000     0.8853 1.000 0.000 0.000 0.000
#> GSM1179041     2  0.0000     0.9054 0.000 1.000 0.000 0.000
#> GSM1179042     2  0.0188     0.9048 0.000 0.996 0.000 0.004
#> GSM1178976     3  0.0188     0.8765 0.000 0.000 0.996 0.004
#> GSM1178981     3  0.0000     0.8793 0.000 0.000 1.000 0.000
#> GSM1178982     3  0.0000     0.8793 0.000 0.000 1.000 0.000
#> GSM1178983     3  0.0000     0.8793 0.000 0.000 1.000 0.000
#> GSM1178985     3  0.0000     0.8793 0.000 0.000 1.000 0.000
#> GSM1178992     3  0.4382     0.5190 0.296 0.000 0.704 0.000
#> GSM1179005     3  0.0000     0.8793 0.000 0.000 1.000 0.000
#> GSM1179007     3  0.0000     0.8793 0.000 0.000 1.000 0.000
#> GSM1179012     3  0.0000     0.8793 0.000 0.000 1.000 0.000
#> GSM1179016     1  0.4776     0.4037 0.624 0.000 0.376 0.000
#> GSM1179030     3  0.0000     0.8793 0.000 0.000 1.000 0.000
#> GSM1179038     3  0.0000     0.8793 0.000 0.000 1.000 0.000
#> GSM1178987     3  0.0000     0.8793 0.000 0.000 1.000 0.000
#> GSM1179003     3  0.5137     0.1196 0.000 0.452 0.544 0.004
#> GSM1179004     3  0.0000     0.8793 0.000 0.000 1.000 0.000
#> GSM1179039     2  0.0000     0.9054 0.000 1.000 0.000 0.000
#> GSM1178975     3  0.7792    -0.0608 0.256 0.000 0.412 0.332
#> GSM1178980     4  0.0188     0.9235 0.000 0.000 0.004 0.996
#> GSM1178995     3  0.0000     0.8793 0.000 0.000 1.000 0.000
#> GSM1178996     3  0.4543     0.4589 0.324 0.000 0.676 0.000
#> GSM1179001     1  0.1940     0.8166 0.924 0.000 0.076 0.000
#> GSM1179002     3  0.4730     0.3908 0.364 0.000 0.636 0.000
#> GSM1179006     3  0.0000     0.8793 0.000 0.000 1.000 0.000
#> GSM1179008     1  0.0188     0.8863 0.996 0.000 0.004 0.000
#> GSM1179015     3  0.4972     0.0825 0.456 0.000 0.544 0.000
#> GSM1179017     1  0.7890     0.0483 0.396 0.372 0.228 0.004
#> GSM1179026     3  0.0000     0.8793 0.000 0.000 1.000 0.000
#> GSM1179033     3  0.0000     0.8793 0.000 0.000 1.000 0.000
#> GSM1179035     3  0.0000     0.8793 0.000 0.000 1.000 0.000
#> GSM1179036     3  0.0000     0.8793 0.000 0.000 1.000 0.000
#> GSM1178986     3  0.0000     0.8793 0.000 0.000 1.000 0.000
#> GSM1178989     3  0.0000     0.8793 0.000 0.000 1.000 0.000
#> GSM1178993     4  0.0188     0.9235 0.000 0.000 0.004 0.996
#> GSM1178999     3  0.4590     0.6861 0.000 0.036 0.772 0.192
#> GSM1179021     4  0.0000     0.9201 0.000 0.000 0.000 1.000
#> GSM1179025     2  0.0524     0.9035 0.000 0.988 0.008 0.004
#> GSM1179027     4  0.0188     0.9235 0.000 0.000 0.004 0.996
#> GSM1179011     4  0.0188     0.9235 0.000 0.000 0.004 0.996
#> GSM1179023     1  0.0000     0.8853 1.000 0.000 0.000 0.000
#> GSM1179029     1  0.2704     0.7820 0.876 0.000 0.124 0.000
#> GSM1179034     1  0.0000     0.8853 1.000 0.000 0.000 0.000
#> GSM1179040     4  0.0000     0.9201 0.000 0.000 0.000 1.000
#> GSM1178988     3  0.0000     0.8793 0.000 0.000 1.000 0.000
#> GSM1179037     3  0.0000     0.8793 0.000 0.000 1.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
#> GSM1178971     3  0.3236      0.730 0.152 0.000 0.828 0.000 0.020
#> GSM1178979     5  0.5500      0.612 0.000 0.212 0.140 0.000 0.648
#> GSM1179009     3  0.5550      0.345 0.000 0.000 0.528 0.400 0.072
#> GSM1179031     2  0.0000      0.932 0.000 1.000 0.000 0.000 0.000
#> GSM1178970     5  0.4339      0.788 0.000 0.020 0.296 0.000 0.684
#> GSM1178972     2  0.2654      0.892 0.000 0.884 0.032 0.000 0.084
#> GSM1178973     1  0.6276      0.244 0.508 0.000 0.056 0.392 0.044
#> GSM1178974     2  0.2209      0.911 0.000 0.912 0.032 0.000 0.056
#> GSM1178977     5  0.6598      0.511 0.000 0.000 0.260 0.276 0.464
#> GSM1178978     3  0.4333      0.605 0.000 0.000 0.740 0.212 0.048
#> GSM1178998     3  0.2471      0.801 0.000 0.000 0.864 0.000 0.136
#> GSM1179010     3  0.2424      0.802 0.000 0.000 0.868 0.000 0.132
#> GSM1179018     3  0.2260      0.803 0.000 0.000 0.908 0.028 0.064
#> GSM1179024     1  0.0000      0.895 1.000 0.000 0.000 0.000 0.000
#> GSM1178984     3  0.2424      0.803 0.000 0.000 0.868 0.000 0.132
#> GSM1178990     3  0.5161      0.342 0.432 0.000 0.532 0.004 0.032
#> GSM1178991     1  0.6413      0.477 0.612 0.000 0.128 0.216 0.044
#> GSM1178994     3  0.2471      0.801 0.000 0.000 0.864 0.000 0.136
#> GSM1178997     1  0.0486      0.893 0.988 0.004 0.004 0.000 0.004
#> GSM1179000     1  0.0162      0.895 0.996 0.000 0.004 0.000 0.000
#> GSM1179013     1  0.0000      0.895 1.000 0.000 0.000 0.000 0.000
#> GSM1179014     1  0.2284      0.834 0.896 0.004 0.004 0.000 0.096
#> GSM1179019     1  0.0162      0.895 0.996 0.000 0.004 0.000 0.000
#> GSM1179020     1  0.0162      0.895 0.996 0.000 0.004 0.000 0.000
#> GSM1179022     1  0.0000      0.895 1.000 0.000 0.000 0.000 0.000
#> GSM1179028     2  0.0000      0.932 0.000 1.000 0.000 0.000 0.000
#> GSM1179032     1  0.0000      0.895 1.000 0.000 0.000 0.000 0.000
#> GSM1179041     2  0.0000      0.932 0.000 1.000 0.000 0.000 0.000
#> GSM1179042     2  0.1485      0.926 0.000 0.948 0.020 0.000 0.032
#> GSM1178976     5  0.4015      0.767 0.000 0.000 0.348 0.000 0.652
#> GSM1178981     3  0.1043      0.823 0.000 0.000 0.960 0.000 0.040
#> GSM1178982     3  0.0880      0.821 0.000 0.000 0.968 0.000 0.032
#> GSM1178983     3  0.1341      0.811 0.000 0.000 0.944 0.000 0.056
#> GSM1178985     3  0.0794      0.813 0.000 0.000 0.972 0.000 0.028
#> GSM1178992     3  0.4276      0.669 0.168 0.000 0.764 0.000 0.068
#> GSM1179005     3  0.1732      0.823 0.000 0.000 0.920 0.000 0.080
#> GSM1179007     3  0.2471      0.801 0.000 0.000 0.864 0.000 0.136
#> GSM1179012     3  0.2424      0.802 0.000 0.000 0.868 0.000 0.132
#> GSM1179016     3  0.4962      0.609 0.108 0.004 0.720 0.000 0.168
#> GSM1179030     3  0.2690      0.675 0.000 0.000 0.844 0.000 0.156
#> GSM1179038     3  0.1792      0.821 0.000 0.000 0.916 0.000 0.084
#> GSM1178987     3  0.0290      0.821 0.000 0.000 0.992 0.000 0.008
#> GSM1179003     5  0.5475      0.759 0.000 0.124 0.232 0.000 0.644
#> GSM1179004     3  0.2020      0.815 0.000 0.000 0.900 0.000 0.100
#> GSM1179039     2  0.0000      0.932 0.000 1.000 0.000 0.000 0.000
#> GSM1178975     1  0.6948      0.298 0.516 0.000 0.144 0.296 0.044
#> GSM1178980     4  0.0162      0.862 0.000 0.000 0.004 0.996 0.000
#> GSM1178995     3  0.2694      0.805 0.004 0.000 0.864 0.004 0.128
#> GSM1178996     3  0.3771      0.685 0.164 0.000 0.796 0.000 0.040
#> GSM1179001     1  0.1267      0.880 0.960 0.000 0.012 0.004 0.024
#> GSM1179002     3  0.5163      0.444 0.368 0.000 0.588 0.004 0.040
#> GSM1179006     3  0.0880      0.812 0.000 0.000 0.968 0.000 0.032
#> GSM1179008     1  0.0162      0.895 0.996 0.000 0.004 0.000 0.000
#> GSM1179015     3  0.5335      0.608 0.200 0.000 0.668 0.000 0.132
#> GSM1179017     5  0.5079      0.645 0.092 0.024 0.148 0.000 0.736
#> GSM1179026     3  0.0963      0.812 0.000 0.000 0.964 0.000 0.036
#> GSM1179033     3  0.0794      0.813 0.000 0.000 0.972 0.000 0.028
#> GSM1179035     3  0.1671      0.820 0.000 0.000 0.924 0.000 0.076
#> GSM1179036     3  0.0880      0.816 0.000 0.000 0.968 0.000 0.032
#> GSM1178986     3  0.0510      0.816 0.000 0.000 0.984 0.000 0.016
#> GSM1178989     5  0.3949      0.775 0.000 0.000 0.332 0.000 0.668
#> GSM1178993     4  0.0162      0.862 0.000 0.000 0.004 0.996 0.000
#> GSM1178999     4  0.7143     -0.462 0.000 0.012 0.324 0.348 0.316
#> GSM1179021     4  0.1018      0.844 0.000 0.016 0.000 0.968 0.016
#> GSM1179025     2  0.3409      0.836 0.000 0.824 0.032 0.000 0.144
#> GSM1179027     4  0.0162      0.862 0.000 0.000 0.004 0.996 0.000
#> GSM1179011     4  0.0162      0.862 0.000 0.000 0.004 0.996 0.000
#> GSM1179023     1  0.0000      0.895 1.000 0.000 0.000 0.000 0.000
#> GSM1179029     1  0.2227      0.840 0.916 0.000 0.048 0.004 0.032
#> GSM1179034     1  0.0000      0.895 1.000 0.000 0.000 0.000 0.000
#> GSM1179040     4  0.0404      0.856 0.000 0.000 0.000 0.988 0.012
#> GSM1178988     3  0.0880      0.812 0.000 0.000 0.968 0.000 0.032
#> GSM1179037     3  0.0794      0.813 0.000 0.000 0.972 0.000 0.028

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>            class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM1178971     3  0.5223     0.0826 0.356 0.000 0.540 0.000 0.000 0.104
#> GSM1178979     5  0.4702     0.6016 0.000 0.016 0.024 0.000 0.572 0.388
#> GSM1179009     4  0.4015     0.2196 0.000 0.000 0.372 0.616 0.000 0.012
#> GSM1179031     2  0.0000     0.8281 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1178970     5  0.4950     0.6093 0.000 0.020 0.036 0.000 0.568 0.376
#> GSM1178972     2  0.3543     0.7137 0.000 0.764 0.004 0.000 0.212 0.020
#> GSM1178973     1  0.7452    -0.1055 0.348 0.000 0.220 0.292 0.000 0.140
#> GSM1178974     2  0.2362     0.7940 0.000 0.860 0.004 0.000 0.136 0.000
#> GSM1178977     5  0.7307     0.4720 0.000 0.000 0.116 0.208 0.352 0.324
#> GSM1178978     3  0.4282     0.6012 0.000 0.000 0.720 0.192 0.000 0.088
#> GSM1178998     3  0.3756     0.2223 0.000 0.000 0.600 0.000 0.000 0.400
#> GSM1179010     3  0.3620     0.3351 0.000 0.000 0.648 0.000 0.000 0.352
#> GSM1179018     3  0.2609     0.7363 0.000 0.000 0.868 0.036 0.000 0.096
#> GSM1179024     1  0.0260     0.6971 0.992 0.000 0.000 0.000 0.008 0.000
#> GSM1178984     3  0.1204     0.7573 0.000 0.000 0.944 0.000 0.000 0.056
#> GSM1178990     1  0.3368     0.5044 0.820 0.000 0.060 0.000 0.004 0.116
#> GSM1178991     1  0.7110    -0.0793 0.424 0.000 0.276 0.196 0.000 0.104
#> GSM1178994     3  0.1204     0.7573 0.000 0.000 0.944 0.000 0.000 0.056
#> GSM1178997     1  0.0458     0.6946 0.984 0.000 0.000 0.000 0.016 0.000
#> GSM1179000     1  0.0363     0.6961 0.988 0.000 0.000 0.000 0.012 0.000
#> GSM1179013     1  0.1610     0.6298 0.916 0.000 0.000 0.000 0.084 0.000
#> GSM1179014     1  0.3727     0.1882 0.612 0.000 0.000 0.000 0.388 0.000
#> GSM1179019     1  0.0363     0.6961 0.988 0.000 0.000 0.000 0.012 0.000
#> GSM1179020     1  0.0000     0.6985 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1179022     1  0.0000     0.6985 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1179028     2  0.0000     0.8281 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1179032     1  0.0000     0.6985 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1179041     2  0.0000     0.8281 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1179042     2  0.2191     0.7999 0.000 0.876 0.004 0.000 0.120 0.000
#> GSM1178976     5  0.5364     0.6107 0.000 0.000 0.140 0.000 0.560 0.300
#> GSM1178981     3  0.0790     0.7718 0.000 0.000 0.968 0.000 0.000 0.032
#> GSM1178982     3  0.1531     0.7664 0.000 0.000 0.928 0.000 0.004 0.068
#> GSM1178983     3  0.2979     0.7396 0.000 0.000 0.840 0.000 0.044 0.116
#> GSM1178985     3  0.0405     0.7738 0.000 0.000 0.988 0.000 0.008 0.004
#> GSM1178992     3  0.5376    -0.0680 0.368 0.000 0.536 0.000 0.084 0.012
#> GSM1179005     3  0.2100     0.7583 0.000 0.000 0.884 0.000 0.004 0.112
#> GSM1179007     3  0.1814     0.7280 0.000 0.000 0.900 0.000 0.000 0.100
#> GSM1179012     3  0.4084     0.1929 0.012 0.000 0.588 0.000 0.000 0.400
#> GSM1179016     5  0.4891    -0.0819 0.028 0.000 0.412 0.000 0.540 0.020
#> GSM1179030     3  0.3845     0.6478 0.000 0.000 0.772 0.000 0.140 0.088
#> GSM1179038     3  0.2288     0.7529 0.004 0.000 0.876 0.000 0.004 0.116
#> GSM1178987     3  0.0632     0.7698 0.000 0.000 0.976 0.000 0.000 0.024
#> GSM1179003     5  0.5554     0.6017 0.000 0.044 0.064 0.000 0.576 0.316
#> GSM1179004     3  0.0547     0.7688 0.000 0.000 0.980 0.000 0.000 0.020
#> GSM1179039     2  0.0000     0.8281 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1178975     1  0.7441    -0.1185 0.352 0.000 0.292 0.216 0.000 0.140
#> GSM1178980     4  0.0000     0.8663 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM1178995     3  0.2146     0.7517 0.000 0.000 0.880 0.000 0.004 0.116
#> GSM1178996     3  0.6198    -0.1489 0.396 0.000 0.444 0.000 0.120 0.040
#> GSM1179001     1  0.1714     0.6349 0.908 0.000 0.000 0.000 0.000 0.092
#> GSM1179002     1  0.5445    -0.1732 0.548 0.000 0.324 0.000 0.004 0.124
#> GSM1179006     3  0.2712     0.7387 0.000 0.000 0.864 0.000 0.088 0.048
#> GSM1179008     1  0.0000     0.6985 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1179015     6  0.7156     0.0000 0.328 0.000 0.152 0.000 0.128 0.392
#> GSM1179017     5  0.1176     0.3475 0.024 0.000 0.020 0.000 0.956 0.000
#> GSM1179026     3  0.2258     0.7572 0.000 0.000 0.896 0.000 0.044 0.060
#> GSM1179033     3  0.1418     0.7721 0.000 0.000 0.944 0.000 0.032 0.024
#> GSM1179035     3  0.0806     0.7719 0.000 0.000 0.972 0.000 0.008 0.020
#> GSM1179036     3  0.2218     0.7657 0.000 0.000 0.884 0.000 0.012 0.104
#> GSM1178986     3  0.2571     0.7552 0.000 0.000 0.876 0.000 0.064 0.060
#> GSM1178989     5  0.5482     0.5979 0.000 0.000 0.160 0.000 0.548 0.292
#> GSM1178993     4  0.0000     0.8663 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM1178999     5  0.7381     0.2556 0.000 0.004 0.332 0.192 0.356 0.116
#> GSM1179021     4  0.0865     0.8519 0.000 0.000 0.000 0.964 0.036 0.000
#> GSM1179025     2  0.6141     0.0629 0.000 0.428 0.004 0.000 0.284 0.284
#> GSM1179027     4  0.0000     0.8663 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM1179011     4  0.1141     0.8425 0.000 0.000 0.000 0.948 0.000 0.052
#> GSM1179023     1  0.0000     0.6985 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1179029     1  0.2257     0.6065 0.876 0.000 0.000 0.000 0.008 0.116
#> GSM1179034     1  0.0000     0.6985 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1179040     4  0.0865     0.8519 0.000 0.000 0.000 0.964 0.036 0.000
#> GSM1178988     3  0.4895     0.3757 0.000 0.000 0.632 0.000 0.104 0.264
#> GSM1179037     3  0.1225     0.7724 0.000 0.000 0.952 0.000 0.012 0.036

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

consensus_heatmap(res, k = 2)

plot of chunk tab-MAD-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) protocol(p) k
#> MAD:mclust 69          0.12448    1.43e-01 2
#> MAD:mclust 71          0.56073    3.56e-04 3
#> MAD:mclust 64          0.07538    5.16e-06 4
#> MAD:mclust 66          0.00725    3.58e-07 5
#> MAD:mclust 54          0.00439    2.15e-05 6

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


MAD:NMF**

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

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

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

res
#> A 'ConsensusPartition' object with k = 2, 3, 4, 5, 6.
#>   On a matrix with 31632 rows and 73 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 1.000           0.967       0.984         0.4154 0.597   0.597
#> 3 3 0.824           0.851       0.938         0.4364 0.770   0.627
#> 4 4 0.605           0.748       0.854         0.1573 0.859   0.671
#> 5 5 0.611           0.661       0.820         0.0855 0.937   0.804
#> 6 6 0.572           0.479       0.708         0.0678 0.947   0.806

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
#> GSM1178971     1  0.0000      0.979 1.000 0.000
#> GSM1178979     2  0.0000      0.997 0.000 1.000
#> GSM1179009     1  0.7376      0.757 0.792 0.208
#> GSM1179031     2  0.0000      0.997 0.000 1.000
#> GSM1178970     2  0.0000      0.997 0.000 1.000
#> GSM1178972     2  0.0000      0.997 0.000 1.000
#> GSM1178973     1  0.0000      0.979 1.000 0.000
#> GSM1178974     2  0.0000      0.997 0.000 1.000
#> GSM1178977     2  0.0000      0.997 0.000 1.000
#> GSM1178978     1  0.0000      0.979 1.000 0.000
#> GSM1178998     1  0.0000      0.979 1.000 0.000
#> GSM1179010     1  0.0000      0.979 1.000 0.000
#> GSM1179018     1  0.8499      0.645 0.724 0.276
#> GSM1179024     1  0.0000      0.979 1.000 0.000
#> GSM1178984     1  0.0000      0.979 1.000 0.000
#> GSM1178990     1  0.0000      0.979 1.000 0.000
#> GSM1178991     1  0.0000      0.979 1.000 0.000
#> GSM1178994     1  0.0000      0.979 1.000 0.000
#> GSM1178997     1  0.0000      0.979 1.000 0.000
#> GSM1179000     1  0.0000      0.979 1.000 0.000
#> GSM1179013     1  0.0000      0.979 1.000 0.000
#> GSM1179014     1  0.0000      0.979 1.000 0.000
#> GSM1179019     1  0.0000      0.979 1.000 0.000
#> GSM1179020     1  0.0000      0.979 1.000 0.000
#> GSM1179022     1  0.0000      0.979 1.000 0.000
#> GSM1179028     2  0.0000      0.997 0.000 1.000
#> GSM1179032     1  0.0000      0.979 1.000 0.000
#> GSM1179041     2  0.0000      0.997 0.000 1.000
#> GSM1179042     2  0.0000      0.997 0.000 1.000
#> GSM1178976     2  0.0000      0.997 0.000 1.000
#> GSM1178981     1  0.0000      0.979 1.000 0.000
#> GSM1178982     1  0.0000      0.979 1.000 0.000
#> GSM1178983     1  0.0000      0.979 1.000 0.000
#> GSM1178985     1  0.0938      0.970 0.988 0.012
#> GSM1178992     1  0.0000      0.979 1.000 0.000
#> GSM1179005     1  0.0000      0.979 1.000 0.000
#> GSM1179007     1  0.0000      0.979 1.000 0.000
#> GSM1179012     1  0.0000      0.979 1.000 0.000
#> GSM1179016     1  0.0000      0.979 1.000 0.000
#> GSM1179030     1  0.6438      0.816 0.836 0.164
#> GSM1179038     1  0.0000      0.979 1.000 0.000
#> GSM1178987     1  0.0000      0.979 1.000 0.000
#> GSM1179003     2  0.0000      0.997 0.000 1.000
#> GSM1179004     1  0.3114      0.933 0.944 0.056
#> GSM1179039     2  0.0000      0.997 0.000 1.000
#> GSM1178975     1  0.0000      0.979 1.000 0.000
#> GSM1178980     2  0.0000      0.997 0.000 1.000
#> GSM1178995     1  0.0000      0.979 1.000 0.000
#> GSM1178996     1  0.0000      0.979 1.000 0.000
#> GSM1179001     1  0.0000      0.979 1.000 0.000
#> GSM1179002     1  0.0000      0.979 1.000 0.000
#> GSM1179006     1  0.0000      0.979 1.000 0.000
#> GSM1179008     1  0.0000      0.979 1.000 0.000
#> GSM1179015     1  0.0000      0.979 1.000 0.000
#> GSM1179017     1  0.8555      0.636 0.720 0.280
#> GSM1179026     1  0.0000      0.979 1.000 0.000
#> GSM1179033     1  0.1633      0.961 0.976 0.024
#> GSM1179035     1  0.0000      0.979 1.000 0.000
#> GSM1179036     1  0.0000      0.979 1.000 0.000
#> GSM1178986     1  0.0000      0.979 1.000 0.000
#> GSM1178989     2  0.0938      0.986 0.012 0.988
#> GSM1178993     2  0.2603      0.952 0.044 0.956
#> GSM1178999     2  0.0000      0.997 0.000 1.000
#> GSM1179021     2  0.0000      0.997 0.000 1.000
#> GSM1179025     2  0.0000      0.997 0.000 1.000
#> GSM1179027     2  0.0000      0.997 0.000 1.000
#> GSM1179011     1  0.2778      0.941 0.952 0.048
#> GSM1179023     1  0.0000      0.979 1.000 0.000
#> GSM1179029     1  0.0000      0.979 1.000 0.000
#> GSM1179034     1  0.0000      0.979 1.000 0.000
#> GSM1179040     2  0.0000      0.997 0.000 1.000
#> GSM1178988     1  0.2236      0.952 0.964 0.036
#> GSM1179037     1  0.0000      0.979 1.000 0.000

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>            class entropy silhouette    p1    p2    p3
#> GSM1178971     1  0.0000     0.9528 1.000 0.000 0.000
#> GSM1178979     2  0.0000     0.9172 0.000 1.000 0.000
#> GSM1179009     1  0.4796     0.7295 0.780 0.000 0.220
#> GSM1179031     2  0.0000     0.9172 0.000 1.000 0.000
#> GSM1178970     2  0.6260     0.2556 0.000 0.552 0.448
#> GSM1178972     2  0.1031     0.9017 0.000 0.976 0.024
#> GSM1178973     1  0.0000     0.9528 1.000 0.000 0.000
#> GSM1178974     3  0.6307    -0.1399 0.000 0.488 0.512
#> GSM1178977     2  0.0000     0.9172 0.000 1.000 0.000
#> GSM1178978     1  0.0237     0.9525 0.996 0.000 0.004
#> GSM1178998     1  0.0237     0.9527 0.996 0.000 0.004
#> GSM1179010     3  0.5058     0.6852 0.244 0.000 0.756
#> GSM1179018     1  0.5882     0.4897 0.652 0.000 0.348
#> GSM1179024     1  0.0000     0.9528 1.000 0.000 0.000
#> GSM1178984     1  0.2066     0.9253 0.940 0.000 0.060
#> GSM1178990     1  0.0237     0.9527 0.996 0.000 0.004
#> GSM1178991     1  0.0424     0.9490 0.992 0.008 0.000
#> GSM1178994     1  0.1163     0.9447 0.972 0.000 0.028
#> GSM1178997     1  0.0000     0.9528 1.000 0.000 0.000
#> GSM1179000     1  0.0000     0.9528 1.000 0.000 0.000
#> GSM1179013     1  0.0000     0.9528 1.000 0.000 0.000
#> GSM1179014     1  0.0000     0.9528 1.000 0.000 0.000
#> GSM1179019     1  0.0000     0.9528 1.000 0.000 0.000
#> GSM1179020     1  0.0000     0.9528 1.000 0.000 0.000
#> GSM1179022     1  0.0000     0.9528 1.000 0.000 0.000
#> GSM1179028     2  0.0000     0.9172 0.000 1.000 0.000
#> GSM1179032     1  0.0000     0.9528 1.000 0.000 0.000
#> GSM1179041     2  0.0000     0.9172 0.000 1.000 0.000
#> GSM1179042     2  0.0000     0.9172 0.000 1.000 0.000
#> GSM1178976     3  0.0000     0.8456 0.000 0.000 1.000
#> GSM1178981     1  0.3038     0.8852 0.896 0.000 0.104
#> GSM1178982     1  0.0892     0.9479 0.980 0.000 0.020
#> GSM1178983     1  0.0000     0.9528 1.000 0.000 0.000
#> GSM1178985     3  0.0892     0.8396 0.020 0.000 0.980
#> GSM1178992     3  0.5397     0.6338 0.280 0.000 0.720
#> GSM1179005     1  0.1529     0.9378 0.960 0.000 0.040
#> GSM1179007     1  0.2066     0.9253 0.940 0.000 0.060
#> GSM1179012     1  0.2356     0.9159 0.928 0.000 0.072
#> GSM1179016     1  0.2261     0.9194 0.932 0.000 0.068
#> GSM1179030     1  0.2806     0.9127 0.928 0.032 0.040
#> GSM1179038     1  0.0424     0.9519 0.992 0.000 0.008
#> GSM1178987     3  0.3879     0.7595 0.152 0.000 0.848
#> GSM1179003     2  0.6235     0.2613 0.000 0.564 0.436
#> GSM1179004     3  0.0000     0.8456 0.000 0.000 1.000
#> GSM1179039     2  0.0000     0.9172 0.000 1.000 0.000
#> GSM1178975     1  0.0424     0.9488 0.992 0.008 0.000
#> GSM1178980     2  0.0000     0.9172 0.000 1.000 0.000
#> GSM1178995     1  0.0424     0.9519 0.992 0.000 0.008
#> GSM1178996     1  0.1031     0.9463 0.976 0.000 0.024
#> GSM1179001     1  0.0000     0.9528 1.000 0.000 0.000
#> GSM1179002     1  0.0237     0.9527 0.996 0.000 0.004
#> GSM1179006     1  0.6291     0.0809 0.532 0.000 0.468
#> GSM1179008     1  0.0000     0.9528 1.000 0.000 0.000
#> GSM1179015     1  0.2165     0.9222 0.936 0.000 0.064
#> GSM1179017     3  0.0237     0.8456 0.004 0.000 0.996
#> GSM1179026     3  0.0000     0.8456 0.000 0.000 1.000
#> GSM1179033     3  0.5465     0.6180 0.288 0.000 0.712
#> GSM1179035     3  0.0000     0.8456 0.000 0.000 1.000
#> GSM1179036     1  0.2066     0.9253 0.940 0.000 0.060
#> GSM1178986     1  0.0892     0.9480 0.980 0.000 0.020
#> GSM1178989     3  0.0000     0.8456 0.000 0.000 1.000
#> GSM1178993     2  0.0237     0.9140 0.004 0.996 0.000
#> GSM1178999     2  0.0000     0.9172 0.000 1.000 0.000
#> GSM1179021     2  0.0000     0.9172 0.000 1.000 0.000
#> GSM1179025     2  0.4235     0.7565 0.000 0.824 0.176
#> GSM1179027     2  0.0000     0.9172 0.000 1.000 0.000
#> GSM1179011     2  0.4399     0.6829 0.188 0.812 0.000
#> GSM1179023     1  0.0000     0.9528 1.000 0.000 0.000
#> GSM1179029     1  0.0237     0.9527 0.996 0.000 0.004
#> GSM1179034     1  0.0000     0.9528 1.000 0.000 0.000
#> GSM1179040     2  0.0000     0.9172 0.000 1.000 0.000
#> GSM1178988     3  0.0237     0.8456 0.004 0.000 0.996
#> GSM1179037     3  0.0000     0.8456 0.000 0.000 1.000

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>            class entropy silhouette    p1    p2    p3    p4
#> GSM1178971     1  0.1792     0.8859 0.932 0.000 0.000 0.068
#> GSM1178979     2  0.4898     0.1188 0.000 0.584 0.000 0.416
#> GSM1179009     4  0.5851     0.5550 0.236 0.000 0.084 0.680
#> GSM1179031     2  0.0188     0.8239 0.000 0.996 0.000 0.004
#> GSM1178970     2  0.5736     0.5308 0.000 0.628 0.328 0.044
#> GSM1178972     2  0.2670     0.8026 0.000 0.908 0.052 0.040
#> GSM1178973     4  0.4992     0.0961 0.476 0.000 0.000 0.524
#> GSM1178974     2  0.3751     0.7102 0.000 0.800 0.196 0.004
#> GSM1178977     2  0.4008     0.5823 0.000 0.756 0.000 0.244
#> GSM1178978     1  0.3801     0.7579 0.780 0.000 0.000 0.220
#> GSM1178998     1  0.2466     0.8733 0.900 0.000 0.004 0.096
#> GSM1179010     3  0.5327     0.6204 0.220 0.000 0.720 0.060
#> GSM1179018     4  0.3497     0.6330 0.024 0.000 0.124 0.852
#> GSM1179024     1  0.0817     0.8912 0.976 0.000 0.000 0.024
#> GSM1178984     1  0.3308     0.8643 0.872 0.000 0.036 0.092
#> GSM1178990     1  0.0592     0.8891 0.984 0.000 0.000 0.016
#> GSM1178991     4  0.3610     0.6166 0.200 0.000 0.000 0.800
#> GSM1178994     1  0.2342     0.8778 0.912 0.000 0.008 0.080
#> GSM1178997     1  0.2984     0.8565 0.888 0.028 0.000 0.084
#> GSM1179000     1  0.1716     0.8771 0.936 0.000 0.000 0.064
#> GSM1179013     1  0.1302     0.8836 0.956 0.000 0.000 0.044
#> GSM1179014     1  0.2530     0.8540 0.888 0.000 0.000 0.112
#> GSM1179019     1  0.1661     0.8837 0.944 0.004 0.000 0.052
#> GSM1179020     1  0.0707     0.8886 0.980 0.000 0.000 0.020
#> GSM1179022     1  0.0921     0.8872 0.972 0.000 0.000 0.028
#> GSM1179028     2  0.0000     0.8249 0.000 1.000 0.000 0.000
#> GSM1179032     1  0.1022     0.8899 0.968 0.000 0.000 0.032
#> GSM1179041     2  0.0188     0.8240 0.000 0.996 0.000 0.004
#> GSM1179042     2  0.0000     0.8249 0.000 1.000 0.000 0.000
#> GSM1178976     3  0.0000     0.8262 0.000 0.000 1.000 0.000
#> GSM1178981     1  0.5272     0.7382 0.744 0.000 0.172 0.084
#> GSM1178982     1  0.4567     0.6590 0.716 0.000 0.008 0.276
#> GSM1178983     1  0.4655     0.5806 0.684 0.000 0.004 0.312
#> GSM1178985     3  0.2402     0.8125 0.076 0.000 0.912 0.012
#> GSM1178992     3  0.6145     0.1111 0.460 0.000 0.492 0.048
#> GSM1179005     1  0.1584     0.8918 0.952 0.000 0.012 0.036
#> GSM1179007     1  0.2908     0.8776 0.896 0.000 0.040 0.064
#> GSM1179012     1  0.2214     0.8900 0.928 0.000 0.028 0.044
#> GSM1179016     1  0.3764     0.8066 0.816 0.000 0.012 0.172
#> GSM1179030     1  0.6429     0.6653 0.708 0.156 0.092 0.044
#> GSM1179038     1  0.2255     0.8832 0.920 0.000 0.012 0.068
#> GSM1178987     3  0.2796     0.8031 0.092 0.000 0.892 0.016
#> GSM1179003     4  0.5964     0.4860 0.000 0.108 0.208 0.684
#> GSM1179004     3  0.0336     0.8260 0.000 0.000 0.992 0.008
#> GSM1179039     2  0.0000     0.8249 0.000 1.000 0.000 0.000
#> GSM1178975     4  0.4999     0.5050 0.328 0.012 0.000 0.660
#> GSM1178980     4  0.3400     0.6635 0.000 0.180 0.000 0.820
#> GSM1178995     1  0.1978     0.8859 0.928 0.000 0.004 0.068
#> GSM1178996     1  0.3289     0.8361 0.852 0.004 0.004 0.140
#> GSM1179001     1  0.1716     0.8872 0.936 0.000 0.000 0.064
#> GSM1179002     1  0.1792     0.8859 0.932 0.000 0.000 0.068
#> GSM1179006     3  0.4940     0.7439 0.096 0.000 0.776 0.128
#> GSM1179008     1  0.1389     0.8905 0.952 0.000 0.000 0.048
#> GSM1179015     1  0.1890     0.8805 0.936 0.000 0.008 0.056
#> GSM1179017     3  0.6465     0.5149 0.076 0.004 0.588 0.332
#> GSM1179026     3  0.1109     0.8228 0.004 0.000 0.968 0.028
#> GSM1179033     3  0.2909     0.8022 0.092 0.000 0.888 0.020
#> GSM1179035     3  0.0657     0.8282 0.004 0.000 0.984 0.012
#> GSM1179036     1  0.3810     0.8474 0.848 0.000 0.092 0.060
#> GSM1178986     1  0.4019     0.7675 0.792 0.000 0.012 0.196
#> GSM1178989     3  0.0188     0.8250 0.000 0.000 0.996 0.004
#> GSM1178993     4  0.3973     0.6685 0.004 0.200 0.004 0.792
#> GSM1178999     4  0.3539     0.6562 0.004 0.176 0.000 0.820
#> GSM1179021     4  0.4661     0.5080 0.000 0.348 0.000 0.652
#> GSM1179025     2  0.2654     0.7832 0.000 0.888 0.108 0.004
#> GSM1179027     4  0.4088     0.6487 0.000 0.232 0.004 0.764
#> GSM1179011     4  0.4472     0.6563 0.020 0.220 0.000 0.760
#> GSM1179023     1  0.0817     0.8890 0.976 0.000 0.000 0.024
#> GSM1179029     1  0.3688     0.7694 0.792 0.000 0.000 0.208
#> GSM1179034     1  0.1022     0.8899 0.968 0.000 0.000 0.032
#> GSM1179040     4  0.4456     0.6053 0.000 0.280 0.004 0.716
#> GSM1178988     3  0.0188     0.8250 0.000 0.000 0.996 0.004
#> GSM1179037     3  0.0188     0.8268 0.000 0.000 0.996 0.004

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>            class entropy silhouette    p1    p2    p3    p4    p5
#> GSM1178971     1  0.2462     0.7806 0.912 0.004 0.020 0.016 0.048
#> GSM1178979     4  0.3461     0.6273 0.000 0.224 0.000 0.772 0.004
#> GSM1179009     4  0.5783     0.5912 0.124 0.000 0.136 0.692 0.048
#> GSM1179031     2  0.0794     0.8557 0.000 0.972 0.000 0.028 0.000
#> GSM1178970     2  0.5980     0.4740 0.000 0.584 0.324 0.044 0.048
#> GSM1178972     2  0.3574     0.8110 0.000 0.852 0.068 0.032 0.048
#> GSM1178973     4  0.4723     0.1213 0.448 0.000 0.000 0.536 0.016
#> GSM1178974     2  0.2676     0.8245 0.000 0.884 0.080 0.000 0.036
#> GSM1178977     2  0.5999     0.3644 0.004 0.552 0.044 0.368 0.032
#> GSM1178978     1  0.5422     0.6337 0.744 0.020 0.056 0.132 0.048
#> GSM1178998     1  0.2774     0.7685 0.892 0.000 0.048 0.012 0.048
#> GSM1179010     3  0.4597     0.4673 0.260 0.000 0.696 0.000 0.044
#> GSM1179018     4  0.1978     0.8085 0.000 0.004 0.044 0.928 0.024
#> GSM1179024     1  0.1544     0.7748 0.932 0.000 0.000 0.000 0.068
#> GSM1178984     1  0.4190     0.7022 0.792 0.000 0.140 0.012 0.056
#> GSM1178990     1  0.1608     0.7744 0.928 0.000 0.000 0.000 0.072
#> GSM1178991     4  0.3432     0.7527 0.064 0.004 0.004 0.852 0.076
#> GSM1178994     1  0.2917     0.7642 0.884 0.004 0.076 0.012 0.024
#> GSM1178997     1  0.3838     0.6769 0.804 0.148 0.000 0.004 0.044
#> GSM1179000     1  0.2338     0.7518 0.884 0.004 0.000 0.000 0.112
#> GSM1179013     1  0.2230     0.7470 0.884 0.000 0.000 0.000 0.116
#> GSM1179014     1  0.4415     0.2664 0.604 0.008 0.000 0.000 0.388
#> GSM1179019     1  0.1124     0.7861 0.960 0.004 0.000 0.000 0.036
#> GSM1179020     1  0.1704     0.7745 0.928 0.000 0.000 0.004 0.068
#> GSM1179022     1  0.1121     0.7838 0.956 0.000 0.000 0.000 0.044
#> GSM1179028     2  0.0703     0.8566 0.000 0.976 0.000 0.024 0.000
#> GSM1179032     1  0.0162     0.7857 0.996 0.000 0.000 0.000 0.004
#> GSM1179041     2  0.0898     0.8559 0.000 0.972 0.000 0.020 0.008
#> GSM1179042     2  0.1012     0.8559 0.000 0.968 0.000 0.020 0.012
#> GSM1178976     3  0.0693     0.7688 0.000 0.008 0.980 0.000 0.012
#> GSM1178981     1  0.5705     0.3788 0.600 0.020 0.332 0.008 0.040
#> GSM1178982     1  0.5510     0.6167 0.716 0.004 0.092 0.152 0.036
#> GSM1178983     1  0.4766     0.6137 0.740 0.004 0.028 0.200 0.028
#> GSM1178985     3  0.3292     0.6874 0.120 0.004 0.844 0.000 0.032
#> GSM1178992     5  0.6801     0.2678 0.244 0.004 0.324 0.000 0.428
#> GSM1179005     1  0.1725     0.7880 0.936 0.000 0.044 0.000 0.020
#> GSM1179007     1  0.3186     0.7612 0.864 0.000 0.080 0.008 0.048
#> GSM1179012     1  0.2893     0.7728 0.884 0.004 0.076 0.008 0.028
#> GSM1179016     5  0.3177     0.6268 0.208 0.000 0.000 0.000 0.792
#> GSM1179030     1  0.7956     0.3076 0.540 0.124 0.084 0.056 0.196
#> GSM1179038     1  0.5302     0.2565 0.564 0.000 0.012 0.032 0.392
#> GSM1178987     3  0.4080     0.6923 0.104 0.016 0.820 0.008 0.052
#> GSM1179003     5  0.4846     0.3575 0.000 0.004 0.056 0.244 0.696
#> GSM1179004     3  0.1695     0.7558 0.000 0.008 0.940 0.008 0.044
#> GSM1179039     2  0.0865     0.8565 0.000 0.972 0.000 0.024 0.004
#> GSM1178975     4  0.3596     0.6063 0.212 0.000 0.000 0.776 0.012
#> GSM1178980     4  0.1012     0.8286 0.000 0.012 0.000 0.968 0.020
#> GSM1178995     1  0.2067     0.7820 0.924 0.000 0.028 0.004 0.044
#> GSM1178996     5  0.4438     0.4048 0.384 0.004 0.000 0.004 0.608
#> GSM1179001     1  0.2541     0.7814 0.900 0.000 0.012 0.020 0.068
#> GSM1179002     1  0.2228     0.7824 0.920 0.000 0.020 0.016 0.044
#> GSM1179006     3  0.5643     0.1760 0.024 0.000 0.480 0.032 0.464
#> GSM1179008     1  0.1845     0.7884 0.928 0.000 0.000 0.016 0.056
#> GSM1179015     1  0.3607     0.6132 0.752 0.000 0.004 0.000 0.244
#> GSM1179017     5  0.2585     0.4712 0.000 0.004 0.064 0.036 0.896
#> GSM1179026     3  0.4549     0.2889 0.000 0.000 0.528 0.008 0.464
#> GSM1179033     3  0.3748     0.7106 0.080 0.000 0.824 0.004 0.092
#> GSM1179035     3  0.1502     0.7668 0.000 0.000 0.940 0.004 0.056
#> GSM1179036     1  0.5905     0.4654 0.612 0.000 0.112 0.012 0.264
#> GSM1178986     1  0.6236     0.0622 0.512 0.000 0.008 0.120 0.360
#> GSM1178989     3  0.2395     0.7597 0.000 0.016 0.904 0.008 0.072
#> GSM1178993     4  0.0798     0.8309 0.000 0.016 0.000 0.976 0.008
#> GSM1178999     4  0.1697     0.8131 0.000 0.008 0.000 0.932 0.060
#> GSM1179021     4  0.1168     0.8275 0.000 0.032 0.000 0.960 0.008
#> GSM1179025     2  0.2789     0.8316 0.000 0.880 0.092 0.020 0.008
#> GSM1179027     4  0.1356     0.8311 0.000 0.028 0.004 0.956 0.012
#> GSM1179011     4  0.1393     0.8298 0.012 0.024 0.000 0.956 0.008
#> GSM1179023     1  0.0703     0.7855 0.976 0.000 0.000 0.000 0.024
#> GSM1179029     5  0.4508     0.5382 0.332 0.000 0.000 0.020 0.648
#> GSM1179034     1  0.0771     0.7861 0.976 0.000 0.000 0.004 0.020
#> GSM1179040     4  0.1116     0.8299 0.000 0.028 0.004 0.964 0.004
#> GSM1178988     3  0.2818     0.7385 0.000 0.004 0.860 0.008 0.128
#> GSM1179037     3  0.1410     0.7643 0.000 0.000 0.940 0.000 0.060

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>            class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM1178971     1  0.4914     0.5194 0.664 0.000 0.040 0.008 0.024 0.264
#> GSM1178979     4  0.4343     0.5868 0.000 0.156 0.000 0.724 0.000 0.120
#> GSM1179009     4  0.6977     0.3346 0.132 0.000 0.148 0.536 0.016 0.168
#> GSM1179031     2  0.0622     0.9081 0.000 0.980 0.000 0.008 0.000 0.012
#> GSM1178970     6  0.6128     0.1449 0.000 0.348 0.144 0.020 0.004 0.484
#> GSM1178972     2  0.4740     0.4870 0.000 0.636 0.020 0.012 0.016 0.316
#> GSM1178973     4  0.4957     0.1725 0.424 0.000 0.000 0.520 0.008 0.048
#> GSM1178974     2  0.2186     0.8824 0.000 0.908 0.024 0.000 0.012 0.056
#> GSM1178977     6  0.6161     0.0867 0.004 0.340 0.000 0.216 0.004 0.436
#> GSM1178978     6  0.5304     0.3919 0.296 0.008 0.012 0.076 0.000 0.608
#> GSM1178998     1  0.4326     0.4312 0.608 0.000 0.016 0.000 0.008 0.368
#> GSM1179010     6  0.6165     0.0768 0.324 0.000 0.232 0.000 0.008 0.436
#> GSM1179018     4  0.4028     0.6217 0.000 0.000 0.012 0.752 0.044 0.192
#> GSM1179024     1  0.3707     0.5155 0.784 0.000 0.000 0.000 0.080 0.136
#> GSM1178984     1  0.5186     0.3781 0.572 0.000 0.072 0.000 0.012 0.344
#> GSM1178990     1  0.2984     0.5649 0.848 0.000 0.004 0.000 0.044 0.104
#> GSM1178991     4  0.5978     0.4183 0.124 0.000 0.000 0.616 0.084 0.176
#> GSM1178994     1  0.4316     0.3411 0.648 0.000 0.040 0.000 0.000 0.312
#> GSM1178997     1  0.4105     0.4773 0.720 0.240 0.000 0.000 0.020 0.020
#> GSM1179000     1  0.3138     0.5574 0.840 0.004 0.000 0.000 0.060 0.096
#> GSM1179013     1  0.4148     0.4769 0.744 0.000 0.000 0.000 0.108 0.148
#> GSM1179014     1  0.5573     0.0381 0.524 0.000 0.000 0.000 0.312 0.164
#> GSM1179019     1  0.1493     0.6165 0.936 0.004 0.000 0.000 0.004 0.056
#> GSM1179020     1  0.1845     0.6267 0.920 0.000 0.000 0.000 0.028 0.052
#> GSM1179022     1  0.1500     0.6092 0.936 0.000 0.000 0.000 0.012 0.052
#> GSM1179028     2  0.0551     0.9097 0.000 0.984 0.000 0.004 0.004 0.008
#> GSM1179032     1  0.1152     0.6226 0.952 0.000 0.000 0.000 0.004 0.044
#> GSM1179041     2  0.0363     0.9073 0.000 0.988 0.000 0.000 0.000 0.012
#> GSM1179042     2  0.0458     0.9071 0.000 0.984 0.000 0.000 0.000 0.016
#> GSM1178976     3  0.1155     0.6313 0.000 0.004 0.956 0.000 0.004 0.036
#> GSM1178981     6  0.6131     0.3023 0.284 0.000 0.280 0.004 0.000 0.432
#> GSM1178982     1  0.6728    -0.1857 0.384 0.000 0.048 0.204 0.000 0.364
#> GSM1178983     1  0.5788     0.3406 0.560 0.000 0.008 0.256 0.004 0.172
#> GSM1178985     3  0.4095     0.5089 0.100 0.000 0.748 0.000 0.000 0.152
#> GSM1178992     5  0.7528     0.2909 0.248 0.000 0.300 0.000 0.308 0.144
#> GSM1179005     1  0.3006     0.6106 0.844 0.000 0.092 0.000 0.000 0.064
#> GSM1179007     1  0.4844     0.5575 0.712 0.000 0.124 0.004 0.016 0.144
#> GSM1179012     1  0.4840     0.3628 0.580 0.000 0.056 0.000 0.004 0.360
#> GSM1179016     5  0.5537     0.4754 0.236 0.000 0.004 0.000 0.576 0.184
#> GSM1179030     6  0.6057     0.1917 0.248 0.052 0.020 0.004 0.068 0.608
#> GSM1179038     1  0.6277     0.2625 0.520 0.000 0.020 0.016 0.300 0.144
#> GSM1178987     6  0.4892     0.0434 0.048 0.000 0.384 0.000 0.008 0.560
#> GSM1179003     5  0.5490     0.2399 0.000 0.008 0.044 0.228 0.648 0.072
#> GSM1179004     3  0.3979     0.0988 0.000 0.000 0.540 0.000 0.004 0.456
#> GSM1179039     2  0.0291     0.9102 0.000 0.992 0.000 0.004 0.000 0.004
#> GSM1178975     4  0.3674     0.6067 0.200 0.004 0.000 0.768 0.004 0.024
#> GSM1178980     4  0.0603     0.7721 0.000 0.004 0.000 0.980 0.016 0.000
#> GSM1178995     1  0.4147     0.5818 0.764 0.000 0.044 0.004 0.020 0.168
#> GSM1178996     5  0.5616     0.3556 0.224 0.004 0.024 0.000 0.620 0.128
#> GSM1179001     1  0.6008     0.4675 0.568 0.000 0.040 0.008 0.100 0.284
#> GSM1179002     1  0.6222     0.4393 0.524 0.000 0.036 0.008 0.120 0.312
#> GSM1179006     3  0.5931     0.4158 0.076 0.000 0.632 0.028 0.216 0.048
#> GSM1179008     1  0.4661     0.5612 0.700 0.000 0.008 0.004 0.076 0.212
#> GSM1179015     1  0.5609     0.2281 0.580 0.000 0.008 0.000 0.216 0.196
#> GSM1179017     5  0.1705     0.3985 0.012 0.000 0.016 0.008 0.940 0.024
#> GSM1179026     3  0.4723     0.1762 0.000 0.000 0.484 0.004 0.476 0.036
#> GSM1179033     3  0.4981     0.4969 0.128 0.000 0.716 0.020 0.012 0.124
#> GSM1179035     3  0.3349     0.5799 0.008 0.000 0.804 0.000 0.024 0.164
#> GSM1179036     1  0.7519     0.1727 0.436 0.000 0.252 0.020 0.128 0.164
#> GSM1178986     1  0.6984    -0.2524 0.408 0.000 0.008 0.056 0.332 0.196
#> GSM1178989     3  0.2886     0.5859 0.004 0.000 0.836 0.000 0.016 0.144
#> GSM1178993     4  0.0146     0.7750 0.000 0.004 0.000 0.996 0.000 0.000
#> GSM1178999     4  0.2165     0.7281 0.000 0.000 0.000 0.884 0.108 0.008
#> GSM1179021     4  0.0935     0.7712 0.000 0.032 0.000 0.964 0.000 0.004
#> GSM1179025     2  0.2316     0.8755 0.000 0.900 0.028 0.004 0.004 0.064
#> GSM1179027     4  0.0520     0.7751 0.000 0.008 0.000 0.984 0.000 0.008
#> GSM1179011     4  0.0508     0.7758 0.004 0.012 0.000 0.984 0.000 0.000
#> GSM1179023     1  0.1010     0.6218 0.960 0.000 0.000 0.000 0.004 0.036
#> GSM1179029     5  0.5867     0.3901 0.300 0.000 0.000 0.008 0.512 0.180
#> GSM1179034     1  0.0935     0.6256 0.964 0.000 0.000 0.000 0.004 0.032
#> GSM1179040     4  0.0458     0.7748 0.000 0.016 0.000 0.984 0.000 0.000
#> GSM1178988     3  0.5514     0.3458 0.016 0.000 0.572 0.000 0.108 0.304
#> GSM1179037     3  0.1226     0.6368 0.004 0.000 0.952 0.000 0.004 0.040

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

consensus_heatmap(res, k = 2)

plot of chunk tab-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) protocol(p) k
#> MAD:NMF 73         0.037252      0.0325 2
#> MAD:NMF 68         0.013547      0.0122 3
#> MAD:NMF 69         0.000541      0.0374 4
#> MAD:NMF 57         0.045666      0.0831 5
#> MAD:NMF 36         0.216026      0.0532 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 31632 rows and 73 columns.
#>   Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'ATC' method.
#>   Subgroups are detected by 'hclust' method.
#>   Performed in total 1250 partitions by row resampling.
#>   Best k for subgroups seems to be 3.
#> 
#> Following methods can be applied to this 'ConsensusPartition' object:
#>  [1] "cola_report"             "collect_classes"         "collect_plots"          
#>  [4] "collect_stats"           "colnames"                "compare_signatures"     
#>  [7] "consensus_heatmap"       "dimension_reduction"     "functional_enrichment"  
#> [10] "get_anno_col"            "get_anno"                "get_classes"            
#> [13] "get_consensus"           "get_matrix"              "get_membership"         
#> [16] "get_param"               "get_signatures"          "get_stats"              
#> [19] "is_best_k"               "is_stable_k"             "membership_heatmap"     
#> [22] "ncol"                    "nrow"                    "plot_ecdf"              
#> [25] "rownames"                "select_partition_number" "show"                   
#> [28] "suggest_best_k"          "test_to_known_factors"

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

collect_plots(res)

plot of chunk ATC-hclust-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.789           0.838       0.927         0.3891 0.562   0.562
#> 3 3 0.575           0.789       0.879         0.4432 0.885   0.800
#> 4 4 0.551           0.693       0.793         0.1992 0.797   0.588
#> 5 5 0.588           0.664       0.803         0.0317 0.995   0.984
#> 6 6 0.648           0.719       0.817         0.0603 0.945   0.828

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
#> GSM1178971     1  0.0000      0.971 1.000 0.000
#> GSM1178979     2  0.2778      0.780 0.048 0.952
#> GSM1179009     1  0.0376      0.970 0.996 0.004
#> GSM1179031     2  0.0000      0.789 0.000 1.000
#> GSM1178970     2  0.9970      0.425 0.468 0.532
#> GSM1178972     2  0.0000      0.789 0.000 1.000
#> GSM1178973     1  0.1414      0.953 0.980 0.020
#> GSM1178974     2  0.0000      0.789 0.000 1.000
#> GSM1178977     2  0.9970      0.425 0.468 0.532
#> GSM1178978     1  0.0000      0.971 1.000 0.000
#> GSM1178998     1  0.0000      0.971 1.000 0.000
#> GSM1179010     1  0.0000      0.971 1.000 0.000
#> GSM1179018     1  0.0376      0.970 0.996 0.004
#> GSM1179024     1  0.0000      0.971 1.000 0.000
#> GSM1178984     1  0.0000      0.971 1.000 0.000
#> GSM1178990     1  0.0000      0.971 1.000 0.000
#> GSM1178991     1  0.0000      0.971 1.000 0.000
#> GSM1178994     1  0.0000      0.971 1.000 0.000
#> GSM1178997     1  0.1843      0.943 0.972 0.028
#> GSM1179000     1  0.0000      0.971 1.000 0.000
#> GSM1179013     1  0.0000      0.971 1.000 0.000
#> GSM1179014     1  0.0000      0.971 1.000 0.000
#> GSM1179019     1  0.0000      0.971 1.000 0.000
#> GSM1179020     1  0.0000      0.971 1.000 0.000
#> GSM1179022     1  0.0000      0.971 1.000 0.000
#> GSM1179028     2  0.0000      0.789 0.000 1.000
#> GSM1179032     1  0.0000      0.971 1.000 0.000
#> GSM1179041     2  0.0000      0.789 0.000 1.000
#> GSM1179042     2  0.0000      0.789 0.000 1.000
#> GSM1178976     2  0.9970      0.425 0.468 0.532
#> GSM1178981     1  0.0376      0.970 0.996 0.004
#> GSM1178982     1  0.0376      0.970 0.996 0.004
#> GSM1178983     1  0.1184      0.957 0.984 0.016
#> GSM1178985     1  0.0376      0.970 0.996 0.004
#> GSM1178992     1  0.0000      0.971 1.000 0.000
#> GSM1179005     1  0.0000      0.971 1.000 0.000
#> GSM1179007     1  0.0000      0.971 1.000 0.000
#> GSM1179012     1  0.0000      0.971 1.000 0.000
#> GSM1179016     1  0.0000      0.971 1.000 0.000
#> GSM1179030     2  0.9977      0.415 0.472 0.528
#> GSM1179038     1  0.0376      0.970 0.996 0.004
#> GSM1178987     1  0.0376      0.970 0.996 0.004
#> GSM1179003     2  0.2778      0.780 0.048 0.952
#> GSM1179004     1  0.0376      0.970 0.996 0.004
#> GSM1179039     2  0.0000      0.789 0.000 1.000
#> GSM1178975     1  0.9983     -0.294 0.524 0.476
#> GSM1178980     2  0.7376      0.708 0.208 0.792
#> GSM1178995     1  0.0000      0.971 1.000 0.000
#> GSM1178996     1  0.0376      0.970 0.996 0.004
#> GSM1179001     1  0.0000      0.971 1.000 0.000
#> GSM1179002     1  0.0000      0.971 1.000 0.000
#> GSM1179006     1  0.0376      0.970 0.996 0.004
#> GSM1179008     1  0.0000      0.971 1.000 0.000
#> GSM1179015     1  0.0000      0.971 1.000 0.000
#> GSM1179017     1  0.9988     -0.307 0.520 0.480
#> GSM1179026     1  0.0376      0.970 0.996 0.004
#> GSM1179033     1  0.0376      0.970 0.996 0.004
#> GSM1179035     1  0.0376      0.970 0.996 0.004
#> GSM1179036     1  0.0376      0.970 0.996 0.004
#> GSM1178986     1  0.0000      0.971 1.000 0.000
#> GSM1178989     2  0.9970      0.425 0.468 0.532
#> GSM1178993     2  0.9522      0.578 0.372 0.628
#> GSM1178999     2  0.0000      0.789 0.000 1.000
#> GSM1179021     2  0.0000      0.789 0.000 1.000
#> GSM1179025     2  0.0000      0.789 0.000 1.000
#> GSM1179027     2  0.9522      0.578 0.372 0.628
#> GSM1179011     2  0.9522      0.578 0.372 0.628
#> GSM1179023     1  0.0000      0.971 1.000 0.000
#> GSM1179029     1  0.0000      0.971 1.000 0.000
#> GSM1179034     1  0.0000      0.971 1.000 0.000
#> GSM1179040     2  0.0000      0.789 0.000 1.000
#> GSM1178988     2  0.9977      0.415 0.472 0.528
#> GSM1179037     1  0.0376      0.970 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
#> GSM1178971     1  0.1529      0.858 0.960 0.000 0.040
#> GSM1178979     2  0.6192      0.298 0.000 0.580 0.420
#> GSM1179009     1  0.4346      0.825 0.816 0.000 0.184
#> GSM1179031     2  0.0000      0.919 0.000 1.000 0.000
#> GSM1178970     3  0.1860      0.852 0.000 0.052 0.948
#> GSM1178972     2  0.0000      0.919 0.000 1.000 0.000
#> GSM1178973     3  0.6286     -0.342 0.464 0.000 0.536
#> GSM1178974     2  0.0000      0.919 0.000 1.000 0.000
#> GSM1178977     3  0.1860      0.852 0.000 0.052 0.948
#> GSM1178978     1  0.3116      0.850 0.892 0.000 0.108
#> GSM1178998     1  0.0237      0.853 0.996 0.000 0.004
#> GSM1179010     1  0.0237      0.853 0.996 0.000 0.004
#> GSM1179018     1  0.4750      0.809 0.784 0.000 0.216
#> GSM1179024     1  0.0237      0.853 0.996 0.000 0.004
#> GSM1178984     1  0.1289      0.858 0.968 0.000 0.032
#> GSM1178990     1  0.1289      0.858 0.968 0.000 0.032
#> GSM1178991     1  0.6008      0.639 0.628 0.000 0.372
#> GSM1178994     1  0.3752      0.839 0.856 0.000 0.144
#> GSM1178997     1  0.6252      0.525 0.556 0.000 0.444
#> GSM1179000     1  0.6140      0.601 0.596 0.000 0.404
#> GSM1179013     1  0.0237      0.853 0.996 0.000 0.004
#> GSM1179014     1  0.0000      0.854 1.000 0.000 0.000
#> GSM1179019     1  0.1529      0.858 0.960 0.000 0.040
#> GSM1179020     1  0.0237      0.853 0.996 0.000 0.004
#> GSM1179022     1  0.0237      0.853 0.996 0.000 0.004
#> GSM1179028     2  0.0000      0.919 0.000 1.000 0.000
#> GSM1179032     1  0.0237      0.853 0.996 0.000 0.004
#> GSM1179041     2  0.0000      0.919 0.000 1.000 0.000
#> GSM1179042     2  0.0000      0.919 0.000 1.000 0.000
#> GSM1178976     3  0.1860      0.852 0.000 0.052 0.948
#> GSM1178981     1  0.5948      0.670 0.640 0.000 0.360
#> GSM1178982     1  0.5948      0.670 0.640 0.000 0.360
#> GSM1178983     1  0.6225      0.550 0.568 0.000 0.432
#> GSM1178985     1  0.5948      0.670 0.640 0.000 0.360
#> GSM1178992     1  0.1289      0.858 0.968 0.000 0.032
#> GSM1179005     1  0.2448      0.854 0.924 0.000 0.076
#> GSM1179007     1  0.0747      0.856 0.984 0.000 0.016
#> GSM1179012     1  0.0237      0.853 0.996 0.000 0.004
#> GSM1179016     1  0.0000      0.854 1.000 0.000 0.000
#> GSM1179030     3  0.2096      0.851 0.004 0.052 0.944
#> GSM1179038     1  0.4750      0.809 0.784 0.000 0.216
#> GSM1178987     1  0.4178      0.829 0.828 0.000 0.172
#> GSM1179003     2  0.6192      0.298 0.000 0.580 0.420
#> GSM1179004     1  0.4235      0.828 0.824 0.000 0.176
#> GSM1179039     2  0.0000      0.919 0.000 1.000 0.000
#> GSM1178975     3  0.0424      0.817 0.008 0.000 0.992
#> GSM1178980     3  0.5678      0.491 0.000 0.316 0.684
#> GSM1178995     1  0.3116      0.850 0.892 0.000 0.108
#> GSM1178996     1  0.5529      0.742 0.704 0.000 0.296
#> GSM1179001     1  0.0424      0.854 0.992 0.000 0.008
#> GSM1179002     1  0.0424      0.854 0.992 0.000 0.008
#> GSM1179006     1  0.6079      0.627 0.612 0.000 0.388
#> GSM1179008     1  0.0424      0.854 0.992 0.000 0.008
#> GSM1179015     1  0.0237      0.853 0.996 0.000 0.004
#> GSM1179017     3  0.0237      0.820 0.004 0.000 0.996
#> GSM1179026     1  0.4750      0.809 0.784 0.000 0.216
#> GSM1179033     1  0.4750      0.809 0.784 0.000 0.216
#> GSM1179035     1  0.4750      0.809 0.784 0.000 0.216
#> GSM1179036     1  0.4750      0.809 0.784 0.000 0.216
#> GSM1178986     1  0.4750      0.807 0.784 0.000 0.216
#> GSM1178989     3  0.1860      0.852 0.000 0.052 0.948
#> GSM1178993     3  0.3816      0.785 0.000 0.148 0.852
#> GSM1178999     2  0.0592      0.912 0.000 0.988 0.012
#> GSM1179021     2  0.0000      0.919 0.000 1.000 0.000
#> GSM1179025     2  0.0000      0.919 0.000 1.000 0.000
#> GSM1179027     3  0.3816      0.785 0.000 0.148 0.852
#> GSM1179011     3  0.3816      0.785 0.000 0.148 0.852
#> GSM1179023     1  0.0237      0.853 0.996 0.000 0.004
#> GSM1179029     1  0.0237      0.853 0.996 0.000 0.004
#> GSM1179034     1  0.0237      0.853 0.996 0.000 0.004
#> GSM1179040     2  0.0892      0.906 0.000 0.980 0.020
#> GSM1178988     3  0.2096      0.851 0.004 0.052 0.944
#> GSM1179037     1  0.4750      0.809 0.784 0.000 0.216

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>            class entropy silhouette    p1    p2    p3    p4
#> GSM1178971     3  0.3975      0.534 0.240 0.000 0.760 0.000
#> GSM1178979     4  0.6514      0.152 0.076 0.408 0.000 0.516
#> GSM1179009     3  0.1302      0.727 0.044 0.000 0.956 0.000
#> GSM1179031     2  0.0000      0.945 0.000 1.000 0.000 0.000
#> GSM1178970     4  0.2408      0.836 0.000 0.000 0.104 0.896
#> GSM1178972     2  0.0000      0.945 0.000 1.000 0.000 0.000
#> GSM1178973     3  0.5662      0.471 0.072 0.000 0.692 0.236
#> GSM1178974     2  0.0000      0.945 0.000 1.000 0.000 0.000
#> GSM1178977     4  0.2408      0.836 0.000 0.000 0.104 0.896
#> GSM1178978     3  0.3494      0.646 0.172 0.000 0.824 0.004
#> GSM1178998     1  0.3942      0.902 0.764 0.000 0.236 0.000
#> GSM1179010     1  0.4040      0.893 0.752 0.000 0.248 0.000
#> GSM1179018     3  0.0779      0.733 0.016 0.000 0.980 0.004
#> GSM1179024     1  0.4817      0.715 0.612 0.000 0.388 0.000
#> GSM1178984     3  0.4040      0.526 0.248 0.000 0.752 0.000
#> GSM1178990     3  0.4040      0.526 0.248 0.000 0.752 0.000
#> GSM1178991     3  0.5006      0.651 0.124 0.000 0.772 0.104
#> GSM1178994     3  0.2814      0.676 0.132 0.000 0.868 0.000
#> GSM1178997     3  0.4872      0.609 0.076 0.000 0.776 0.148
#> GSM1179000     3  0.4411      0.641 0.080 0.000 0.812 0.108
#> GSM1179013     1  0.3942      0.902 0.764 0.000 0.236 0.000
#> GSM1179014     3  0.4941     -0.156 0.436 0.000 0.564 0.000
#> GSM1179019     3  0.3975      0.534 0.240 0.000 0.760 0.000
#> GSM1179020     1  0.4817      0.715 0.612 0.000 0.388 0.000
#> GSM1179022     1  0.3942      0.902 0.764 0.000 0.236 0.000
#> GSM1179028     2  0.0000      0.945 0.000 1.000 0.000 0.000
#> GSM1179032     1  0.3942      0.902 0.764 0.000 0.236 0.000
#> GSM1179041     2  0.0000      0.945 0.000 1.000 0.000 0.000
#> GSM1179042     2  0.0000      0.945 0.000 1.000 0.000 0.000
#> GSM1178976     4  0.2408      0.836 0.000 0.000 0.104 0.896
#> GSM1178981     3  0.3439      0.676 0.048 0.000 0.868 0.084
#> GSM1178982     3  0.3439      0.676 0.048 0.000 0.868 0.084
#> GSM1178983     3  0.4673      0.620 0.076 0.000 0.792 0.132
#> GSM1178985     3  0.3439      0.676 0.048 0.000 0.868 0.084
#> GSM1178992     3  0.4040      0.526 0.248 0.000 0.752 0.000
#> GSM1179005     3  0.3356      0.626 0.176 0.000 0.824 0.000
#> GSM1179007     3  0.4585      0.316 0.332 0.000 0.668 0.000
#> GSM1179012     1  0.3942      0.902 0.764 0.000 0.236 0.000
#> GSM1179016     3  0.4941     -0.156 0.436 0.000 0.564 0.000
#> GSM1179030     4  0.2704      0.829 0.000 0.000 0.124 0.876
#> GSM1179038     3  0.0779      0.733 0.016 0.000 0.980 0.004
#> GSM1178987     3  0.1557      0.721 0.056 0.000 0.944 0.000
#> GSM1179003     4  0.6514      0.152 0.076 0.408 0.000 0.516
#> GSM1179004     3  0.1474      0.723 0.052 0.000 0.948 0.000
#> GSM1179039     2  0.0000      0.945 0.000 1.000 0.000 0.000
#> GSM1178975     4  0.5599      0.694 0.072 0.000 0.228 0.700
#> GSM1178980     4  0.4824      0.659 0.076 0.144 0.000 0.780
#> GSM1178995     3  0.2973      0.661 0.144 0.000 0.856 0.000
#> GSM1178996     3  0.3156      0.706 0.068 0.000 0.884 0.048
#> GSM1179001     1  0.5000      0.360 0.500 0.000 0.500 0.000
#> GSM1179002     3  0.4790      0.134 0.380 0.000 0.620 0.000
#> GSM1179006     3  0.3935      0.658 0.060 0.000 0.840 0.100
#> GSM1179008     3  0.4790      0.134 0.380 0.000 0.620 0.000
#> GSM1179015     1  0.3942      0.902 0.764 0.000 0.236 0.000
#> GSM1179017     4  0.4336      0.752 0.128 0.000 0.060 0.812
#> GSM1179026     3  0.0779      0.733 0.016 0.000 0.980 0.004
#> GSM1179033     3  0.0779      0.733 0.016 0.000 0.980 0.004
#> GSM1179035     3  0.0779      0.733 0.016 0.000 0.980 0.004
#> GSM1179036     3  0.0779      0.733 0.016 0.000 0.980 0.004
#> GSM1178986     3  0.2699      0.723 0.068 0.000 0.904 0.028
#> GSM1178989     4  0.2408      0.836 0.000 0.000 0.104 0.896
#> GSM1178993     4  0.3464      0.815 0.056 0.000 0.076 0.868
#> GSM1178999     2  0.4344      0.833 0.076 0.816 0.000 0.108
#> GSM1179021     2  0.4163      0.844 0.076 0.828 0.000 0.096
#> GSM1179025     2  0.0000      0.945 0.000 1.000 0.000 0.000
#> GSM1179027     4  0.3245      0.811 0.056 0.000 0.064 0.880
#> GSM1179011     4  0.3464      0.815 0.056 0.000 0.076 0.868
#> GSM1179023     1  0.3942      0.902 0.764 0.000 0.236 0.000
#> GSM1179029     1  0.4564      0.811 0.672 0.000 0.328 0.000
#> GSM1179034     1  0.3942      0.902 0.764 0.000 0.236 0.000
#> GSM1179040     2  0.4458      0.823 0.076 0.808 0.000 0.116
#> GSM1178988     4  0.2704      0.829 0.000 0.000 0.124 0.876
#> GSM1179037     3  0.0779      0.733 0.016 0.000 0.980 0.004

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>            class entropy silhouette    p1    p2    p3    p4    p5
#> GSM1178971     3   0.399      0.544 0.252 0.000 0.732 0.000 0.016
#> GSM1178979     4   0.678      0.275 0.068 0.272 0.000 0.560 0.100
#> GSM1179009     3   0.120      0.738 0.048 0.000 0.952 0.000 0.000
#> GSM1179031     2   0.000      0.885 0.000 1.000 0.000 0.000 0.000
#> GSM1178970     4   0.185      0.766 0.000 0.000 0.088 0.912 0.000
#> GSM1178972     2   0.000      0.885 0.000 1.000 0.000 0.000 0.000
#> GSM1178973     3   0.520      0.495 0.000 0.000 0.688 0.148 0.164
#> GSM1178974     2   0.000      0.885 0.000 1.000 0.000 0.000 0.000
#> GSM1178977     4   0.185      0.766 0.000 0.000 0.088 0.912 0.000
#> GSM1178978     3   0.353      0.663 0.164 0.000 0.808 0.000 0.028
#> GSM1178998     1   0.297      0.906 0.816 0.000 0.184 0.000 0.000
#> GSM1179010     1   0.314      0.891 0.796 0.000 0.204 0.000 0.000
#> GSM1179018     3   0.051      0.744 0.016 0.000 0.984 0.000 0.000
#> GSM1179024     1   0.412      0.731 0.660 0.000 0.336 0.000 0.004
#> GSM1178984     3   0.399      0.549 0.252 0.000 0.732 0.000 0.016
#> GSM1178990     3   0.399      0.549 0.252 0.000 0.732 0.000 0.016
#> GSM1178991     3   0.399      0.661 0.028 0.000 0.756 0.000 0.216
#> GSM1178994     3   0.283      0.695 0.124 0.000 0.860 0.000 0.016
#> GSM1178997     3   0.392      0.618 0.000 0.000 0.780 0.040 0.180
#> GSM1179000     3   0.297      0.651 0.000 0.000 0.816 0.000 0.184
#> GSM1179013     1   0.297      0.906 0.816 0.000 0.184 0.000 0.000
#> GSM1179014     3   0.474     -0.216 0.476 0.000 0.508 0.000 0.016
#> GSM1179019     3   0.399      0.544 0.252 0.000 0.732 0.000 0.016
#> GSM1179020     1   0.412      0.731 0.660 0.000 0.336 0.000 0.004
#> GSM1179022     1   0.297      0.906 0.816 0.000 0.184 0.000 0.000
#> GSM1179028     2   0.000      0.885 0.000 1.000 0.000 0.000 0.000
#> GSM1179032     1   0.297      0.906 0.816 0.000 0.184 0.000 0.000
#> GSM1179041     2   0.000      0.885 0.000 1.000 0.000 0.000 0.000
#> GSM1179042     2   0.000      0.885 0.000 1.000 0.000 0.000 0.000
#> GSM1178976     4   0.185      0.766 0.000 0.000 0.088 0.912 0.000
#> GSM1178981     3   0.258      0.692 0.004 0.000 0.864 0.000 0.132
#> GSM1178982     3   0.258      0.692 0.004 0.000 0.864 0.000 0.132
#> GSM1178983     3   0.360      0.631 0.000 0.000 0.796 0.024 0.180
#> GSM1178985     3   0.258      0.692 0.004 0.000 0.864 0.000 0.132
#> GSM1178992     3   0.399      0.549 0.252 0.000 0.732 0.000 0.016
#> GSM1179005     3   0.316      0.640 0.188 0.000 0.808 0.000 0.004
#> GSM1179007     3   0.447      0.340 0.344 0.000 0.640 0.000 0.016
#> GSM1179012     1   0.297      0.906 0.816 0.000 0.184 0.000 0.000
#> GSM1179016     3   0.474     -0.216 0.476 0.000 0.508 0.000 0.016
#> GSM1179030     4   0.213      0.756 0.000 0.000 0.108 0.892 0.000
#> GSM1179038     3   0.051      0.744 0.016 0.000 0.984 0.000 0.000
#> GSM1178987     3   0.141      0.734 0.060 0.000 0.940 0.000 0.000
#> GSM1179003     4   0.678      0.275 0.068 0.272 0.000 0.560 0.100
#> GSM1179004     3   0.134      0.735 0.056 0.000 0.944 0.000 0.000
#> GSM1179039     2   0.000      0.885 0.000 1.000 0.000 0.000 0.000
#> GSM1178975     4   0.579      0.401 0.000 0.000 0.224 0.612 0.164
#> GSM1178980     4   0.394      0.587 0.068 0.020 0.000 0.824 0.088
#> GSM1178995     3   0.276      0.678 0.148 0.000 0.848 0.000 0.004
#> GSM1178996     3   0.254      0.720 0.024 0.000 0.888 0.000 0.088
#> GSM1179001     1   0.427      0.414 0.552 0.000 0.448 0.000 0.000
#> GSM1179002     3   0.446      0.129 0.408 0.000 0.584 0.000 0.008
#> GSM1179006     3   0.269      0.675 0.000 0.000 0.844 0.000 0.156
#> GSM1179008     3   0.446      0.129 0.408 0.000 0.584 0.000 0.008
#> GSM1179015     1   0.297      0.906 0.816 0.000 0.184 0.000 0.000
#> GSM1179017     5   0.516      0.000 0.116 0.000 0.004 0.180 0.700
#> GSM1179026     3   0.051      0.744 0.016 0.000 0.984 0.000 0.000
#> GSM1179033     3   0.051      0.744 0.016 0.000 0.984 0.000 0.000
#> GSM1179035     3   0.051      0.744 0.016 0.000 0.984 0.000 0.000
#> GSM1179036     3   0.051      0.744 0.016 0.000 0.984 0.000 0.000
#> GSM1178986     3   0.251      0.735 0.044 0.000 0.896 0.000 0.060
#> GSM1178989     4   0.185      0.766 0.000 0.000 0.088 0.912 0.000
#> GSM1178993     4   0.332      0.754 0.056 0.000 0.072 0.860 0.012
#> GSM1178999     2   0.611      0.647 0.068 0.668 0.000 0.152 0.112
#> GSM1179021     2   0.595      0.662 0.068 0.684 0.000 0.140 0.108
#> GSM1179025     2   0.000      0.885 0.000 1.000 0.000 0.000 0.000
#> GSM1179027     4   0.312      0.750 0.056 0.000 0.060 0.872 0.012
#> GSM1179011     4   0.332      0.754 0.056 0.000 0.072 0.860 0.012
#> GSM1179023     1   0.297      0.906 0.816 0.000 0.184 0.000 0.000
#> GSM1179029     1   0.366      0.823 0.724 0.000 0.276 0.000 0.000
#> GSM1179034     1   0.297      0.906 0.816 0.000 0.184 0.000 0.000
#> GSM1179040     2   0.619      0.636 0.068 0.660 0.000 0.160 0.112
#> GSM1178988     4   0.213      0.756 0.000 0.000 0.108 0.892 0.000
#> GSM1179037     3   0.051      0.744 0.016 0.000 0.984 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
#> GSM1178971     3  0.4755      0.605 0.236 0.000 0.680 0.000 0.068 0.016
#> GSM1178979     5  0.4671      0.381 0.000 0.044 0.000 0.424 0.532 0.000
#> GSM1179009     3  0.2164      0.787 0.056 0.000 0.908 0.028 0.000 0.008
#> GSM1179031     2  0.0000      0.997 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1178970     4  0.0363      0.866 0.000 0.000 0.012 0.988 0.000 0.000
#> GSM1178972     2  0.0547      0.976 0.000 0.980 0.000 0.000 0.020 0.000
#> GSM1178973     3  0.5046      0.501 0.000 0.000 0.632 0.224 0.000 0.144
#> GSM1178974     2  0.0000      0.997 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1178977     4  0.0363      0.866 0.000 0.000 0.012 0.988 0.000 0.000
#> GSM1178978     3  0.4403      0.702 0.152 0.000 0.748 0.000 0.076 0.024
#> GSM1178998     1  0.0458      0.815 0.984 0.000 0.016 0.000 0.000 0.000
#> GSM1179010     1  0.3264      0.685 0.796 0.000 0.184 0.000 0.012 0.008
#> GSM1179018     3  0.1864      0.789 0.040 0.000 0.924 0.032 0.000 0.004
#> GSM1179024     1  0.3130      0.764 0.828 0.000 0.124 0.000 0.048 0.000
#> GSM1178984     3  0.4525      0.614 0.228 0.000 0.696 0.000 0.068 0.008
#> GSM1178990     3  0.4549      0.611 0.232 0.000 0.692 0.000 0.068 0.008
#> GSM1178991     3  0.3874      0.703 0.000 0.000 0.760 0.000 0.068 0.172
#> GSM1178994     3  0.3196      0.739 0.108 0.000 0.828 0.000 0.064 0.000
#> GSM1178997     3  0.4002      0.674 0.000 0.000 0.768 0.072 0.008 0.152
#> GSM1179000     3  0.3488      0.703 0.000 0.000 0.804 0.032 0.012 0.152
#> GSM1179013     1  0.0458      0.815 0.984 0.000 0.016 0.000 0.000 0.000
#> GSM1179014     1  0.4535      0.486 0.644 0.000 0.296 0.000 0.060 0.000
#> GSM1179019     3  0.4755      0.605 0.236 0.000 0.680 0.000 0.068 0.016
#> GSM1179020     1  0.3130      0.764 0.828 0.000 0.124 0.000 0.048 0.000
#> GSM1179022     1  0.0458      0.815 0.984 0.000 0.016 0.000 0.000 0.000
#> GSM1179028     2  0.0000      0.997 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1179032     1  0.0458      0.815 0.984 0.000 0.016 0.000 0.000 0.000
#> GSM1179041     2  0.0000      0.997 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1179042     2  0.0000      0.997 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1178976     4  0.0363      0.866 0.000 0.000 0.012 0.988 0.000 0.000
#> GSM1178981     3  0.2651      0.739 0.000 0.000 0.860 0.028 0.000 0.112
#> GSM1178982     3  0.2651      0.739 0.000 0.000 0.860 0.028 0.000 0.112
#> GSM1178983     3  0.3837      0.684 0.000 0.000 0.780 0.060 0.008 0.152
#> GSM1178985     3  0.2651      0.739 0.000 0.000 0.860 0.028 0.000 0.112
#> GSM1178992     3  0.4549      0.611 0.232 0.000 0.692 0.000 0.068 0.008
#> GSM1179005     3  0.3765      0.699 0.164 0.000 0.780 0.000 0.048 0.008
#> GSM1179007     3  0.4984      0.438 0.324 0.000 0.600 0.000 0.068 0.008
#> GSM1179012     1  0.0458      0.815 0.984 0.000 0.016 0.000 0.000 0.000
#> GSM1179016     1  0.4535      0.486 0.644 0.000 0.296 0.000 0.060 0.000
#> GSM1179030     4  0.0790      0.856 0.000 0.000 0.032 0.968 0.000 0.000
#> GSM1179038     3  0.1864      0.789 0.040 0.000 0.924 0.032 0.000 0.004
#> GSM1178987     3  0.1364      0.785 0.048 0.000 0.944 0.000 0.004 0.004
#> GSM1179003     5  0.4671      0.381 0.000 0.044 0.000 0.424 0.532 0.000
#> GSM1179004     3  0.1219      0.785 0.048 0.000 0.948 0.000 0.000 0.004
#> GSM1179039     2  0.0000      0.997 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1178975     4  0.4666      0.503 0.000 0.000 0.168 0.688 0.000 0.144
#> GSM1178980     4  0.3428      0.415 0.000 0.000 0.000 0.696 0.304 0.000
#> GSM1178995     3  0.3474      0.737 0.140 0.000 0.816 0.008 0.024 0.012
#> GSM1178996     3  0.2872      0.771 0.028 0.000 0.868 0.024 0.000 0.080
#> GSM1179001     1  0.4801      0.396 0.596 0.000 0.348 0.000 0.048 0.008
#> GSM1179002     3  0.5083      0.228 0.404 0.000 0.528 0.000 0.060 0.008
#> GSM1179006     3  0.3164      0.721 0.004 0.000 0.824 0.032 0.000 0.140
#> GSM1179008     3  0.5083      0.228 0.404 0.000 0.528 0.000 0.060 0.008
#> GSM1179015     1  0.0458      0.815 0.984 0.000 0.016 0.000 0.000 0.000
#> GSM1179017     6  0.3190      0.000 0.016 0.000 0.000 0.068 0.068 0.848
#> GSM1179026     3  0.1864      0.789 0.040 0.000 0.924 0.032 0.000 0.004
#> GSM1179033     3  0.1864      0.789 0.040 0.000 0.924 0.032 0.000 0.004
#> GSM1179035     3  0.1864      0.789 0.040 0.000 0.924 0.032 0.000 0.004
#> GSM1179036     3  0.1864      0.789 0.040 0.000 0.924 0.032 0.000 0.004
#> GSM1178986     3  0.3546      0.773 0.048 0.000 0.832 0.000 0.068 0.052
#> GSM1178989     4  0.0363      0.866 0.000 0.000 0.012 0.988 0.000 0.000
#> GSM1178993     4  0.1967      0.825 0.000 0.000 0.012 0.904 0.084 0.000
#> GSM1178999     5  0.2623      0.626 0.000 0.132 0.000 0.016 0.852 0.000
#> GSM1179021     5  0.2692      0.614 0.000 0.148 0.000 0.012 0.840 0.000
#> GSM1179025     2  0.0000      0.997 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1179027     4  0.1610      0.818 0.000 0.000 0.000 0.916 0.084 0.000
#> GSM1179011     4  0.1967      0.825 0.000 0.000 0.012 0.904 0.084 0.000
#> GSM1179023     1  0.0458      0.815 0.984 0.000 0.016 0.000 0.000 0.000
#> GSM1179029     1  0.2318      0.794 0.892 0.000 0.064 0.000 0.044 0.000
#> GSM1179034     1  0.0458      0.815 0.984 0.000 0.016 0.000 0.000 0.000
#> GSM1179040     5  0.2790      0.630 0.000 0.132 0.000 0.024 0.844 0.000
#> GSM1178988     4  0.0790      0.856 0.000 0.000 0.032 0.968 0.000 0.000
#> GSM1179037     3  0.1864      0.789 0.040 0.000 0.924 0.032 0.000 0.004

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

consensus_heatmap(res, k = 2)

plot of chunk tab-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) protocol(p) k
#> ATC:hclust 65           0.0203     0.01259 2
#> ATC:hclust 69           0.0719     0.08863 3
#> ATC:hclust 64           0.1645     0.00871 4
#> ATC:hclust 62           0.1120     0.01345 5
#> ATC:hclust 63           0.0219     0.00913 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 31632 rows and 73 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.985       0.994         0.4418 0.562   0.562
#> 3 3 1.000           0.991       0.996         0.4348 0.622   0.421
#> 4 4 0.857           0.917       0.961         0.1313 0.790   0.508
#> 5 5 0.726           0.667       0.804         0.0704 0.839   0.500
#> 6 6 0.700           0.749       0.799         0.0465 0.931   0.701

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
#> GSM1178971     1  0.0000      0.992 1.000 0.000
#> GSM1178979     2  0.0000      0.999 0.000 1.000
#> GSM1179009     1  0.0000      0.992 1.000 0.000
#> GSM1179031     2  0.0000      0.999 0.000 1.000
#> GSM1178970     2  0.0000      0.999 0.000 1.000
#> GSM1178972     2  0.0000      0.999 0.000 1.000
#> GSM1178973     1  0.0000      0.992 1.000 0.000
#> GSM1178974     2  0.0000      0.999 0.000 1.000
#> GSM1178977     2  0.0000      0.999 0.000 1.000
#> GSM1178978     1  0.0000      0.992 1.000 0.000
#> GSM1178998     1  0.0000      0.992 1.000 0.000
#> GSM1179010     1  0.0000      0.992 1.000 0.000
#> GSM1179018     1  0.0000      0.992 1.000 0.000
#> GSM1179024     1  0.0000      0.992 1.000 0.000
#> GSM1178984     1  0.0000      0.992 1.000 0.000
#> GSM1178990     1  0.0000      0.992 1.000 0.000
#> GSM1178991     1  0.0000      0.992 1.000 0.000
#> GSM1178994     1  0.0000      0.992 1.000 0.000
#> GSM1178997     1  0.0000      0.992 1.000 0.000
#> GSM1179000     1  0.0000      0.992 1.000 0.000
#> GSM1179013     1  0.0000      0.992 1.000 0.000
#> GSM1179014     1  0.0000      0.992 1.000 0.000
#> GSM1179019     1  0.0000      0.992 1.000 0.000
#> GSM1179020     1  0.0000      0.992 1.000 0.000
#> GSM1179022     1  0.0000      0.992 1.000 0.000
#> GSM1179028     2  0.0000      0.999 0.000 1.000
#> GSM1179032     1  0.0000      0.992 1.000 0.000
#> GSM1179041     2  0.0000      0.999 0.000 1.000
#> GSM1179042     2  0.0000      0.999 0.000 1.000
#> GSM1178976     2  0.0000      0.999 0.000 1.000
#> GSM1178981     1  0.0000      0.992 1.000 0.000
#> GSM1178982     1  0.0000      0.992 1.000 0.000
#> GSM1178983     1  0.0000      0.992 1.000 0.000
#> GSM1178985     1  0.0000      0.992 1.000 0.000
#> GSM1178992     1  0.0000      0.992 1.000 0.000
#> GSM1179005     1  0.0000      0.992 1.000 0.000
#> GSM1179007     1  0.0000      0.992 1.000 0.000
#> GSM1179012     1  0.0000      0.992 1.000 0.000
#> GSM1179016     1  0.0000      0.992 1.000 0.000
#> GSM1179030     2  0.0376      0.996 0.004 0.996
#> GSM1179038     1  0.0000      0.992 1.000 0.000
#> GSM1178987     1  0.0000      0.992 1.000 0.000
#> GSM1179003     2  0.0000      0.999 0.000 1.000
#> GSM1179004     1  0.0000      0.992 1.000 0.000
#> GSM1179039     2  0.0000      0.999 0.000 1.000
#> GSM1178975     1  0.9635      0.364 0.612 0.388
#> GSM1178980     2  0.0000      0.999 0.000 1.000
#> GSM1178995     1  0.0000      0.992 1.000 0.000
#> GSM1178996     1  0.0000      0.992 1.000 0.000
#> GSM1179001     1  0.0000      0.992 1.000 0.000
#> GSM1179002     1  0.0000      0.992 1.000 0.000
#> GSM1179006     1  0.0000      0.992 1.000 0.000
#> GSM1179008     1  0.0000      0.992 1.000 0.000
#> GSM1179015     1  0.0000      0.992 1.000 0.000
#> GSM1179017     2  0.0938      0.988 0.012 0.988
#> GSM1179026     1  0.0000      0.992 1.000 0.000
#> GSM1179033     1  0.0000      0.992 1.000 0.000
#> GSM1179035     1  0.0000      0.992 1.000 0.000
#> GSM1179036     1  0.0000      0.992 1.000 0.000
#> GSM1178986     1  0.0000      0.992 1.000 0.000
#> GSM1178989     2  0.0000      0.999 0.000 1.000
#> GSM1178993     2  0.0376      0.996 0.004 0.996
#> GSM1178999     2  0.0000      0.999 0.000 1.000
#> GSM1179021     2  0.0000      0.999 0.000 1.000
#> GSM1179025     2  0.0000      0.999 0.000 1.000
#> GSM1179027     2  0.0000      0.999 0.000 1.000
#> GSM1179011     2  0.0376      0.996 0.004 0.996
#> GSM1179023     1  0.0000      0.992 1.000 0.000
#> GSM1179029     1  0.0000      0.992 1.000 0.000
#> GSM1179034     1  0.0000      0.992 1.000 0.000
#> GSM1179040     2  0.0000      0.999 0.000 1.000
#> GSM1178988     1  0.0000      0.992 1.000 0.000
#> GSM1179037     1  0.0000      0.992 1.000 0.000

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>            class entropy silhouette    p1    p2    p3
#> GSM1178971     1   0.000      1.000 1.000 0.000 0.000
#> GSM1178979     2   0.000      0.997 0.000 1.000 0.000
#> GSM1179009     3   0.000      0.991 0.000 0.000 1.000
#> GSM1179031     2   0.000      0.997 0.000 1.000 0.000
#> GSM1178970     3   0.000      0.991 0.000 0.000 1.000
#> GSM1178972     2   0.000      0.997 0.000 1.000 0.000
#> GSM1178973     3   0.000      0.991 0.000 0.000 1.000
#> GSM1178974     2   0.000      0.997 0.000 1.000 0.000
#> GSM1178977     3   0.000      0.991 0.000 0.000 1.000
#> GSM1178978     1   0.000      1.000 1.000 0.000 0.000
#> GSM1178998     1   0.000      1.000 1.000 0.000 0.000
#> GSM1179010     1   0.000      1.000 1.000 0.000 0.000
#> GSM1179018     3   0.000      0.991 0.000 0.000 1.000
#> GSM1179024     1   0.000      1.000 1.000 0.000 0.000
#> GSM1178984     1   0.000      1.000 1.000 0.000 0.000
#> GSM1178990     1   0.000      1.000 1.000 0.000 0.000
#> GSM1178991     3   0.327      0.862 0.116 0.000 0.884
#> GSM1178994     1   0.000      1.000 1.000 0.000 0.000
#> GSM1178997     3   0.000      0.991 0.000 0.000 1.000
#> GSM1179000     3   0.000      0.991 0.000 0.000 1.000
#> GSM1179013     1   0.000      1.000 1.000 0.000 0.000
#> GSM1179014     1   0.000      1.000 1.000 0.000 0.000
#> GSM1179019     1   0.000      1.000 1.000 0.000 0.000
#> GSM1179020     1   0.000      1.000 1.000 0.000 0.000
#> GSM1179022     1   0.000      1.000 1.000 0.000 0.000
#> GSM1179028     2   0.000      0.997 0.000 1.000 0.000
#> GSM1179032     1   0.000      1.000 1.000 0.000 0.000
#> GSM1179041     2   0.000      0.997 0.000 1.000 0.000
#> GSM1179042     2   0.000      0.997 0.000 1.000 0.000
#> GSM1178976     3   0.000      0.991 0.000 0.000 1.000
#> GSM1178981     3   0.000      0.991 0.000 0.000 1.000
#> GSM1178982     3   0.000      0.991 0.000 0.000 1.000
#> GSM1178983     3   0.000      0.991 0.000 0.000 1.000
#> GSM1178985     3   0.000      0.991 0.000 0.000 1.000
#> GSM1178992     1   0.000      1.000 1.000 0.000 0.000
#> GSM1179005     1   0.000      1.000 1.000 0.000 0.000
#> GSM1179007     1   0.000      1.000 1.000 0.000 0.000
#> GSM1179012     1   0.000      1.000 1.000 0.000 0.000
#> GSM1179016     1   0.000      1.000 1.000 0.000 0.000
#> GSM1179030     3   0.000      0.991 0.000 0.000 1.000
#> GSM1179038     3   0.000      0.991 0.000 0.000 1.000
#> GSM1178987     3   0.000      0.991 0.000 0.000 1.000
#> GSM1179003     2   0.141      0.961 0.000 0.964 0.036
#> GSM1179004     3   0.000      0.991 0.000 0.000 1.000
#> GSM1179039     2   0.000      0.997 0.000 1.000 0.000
#> GSM1178975     3   0.000      0.991 0.000 0.000 1.000
#> GSM1178980     3   0.000      0.991 0.000 0.000 1.000
#> GSM1178995     3   0.000      0.991 0.000 0.000 1.000
#> GSM1178996     3   0.000      0.991 0.000 0.000 1.000
#> GSM1179001     1   0.000      1.000 1.000 0.000 0.000
#> GSM1179002     1   0.000      1.000 1.000 0.000 0.000
#> GSM1179006     3   0.000      0.991 0.000 0.000 1.000
#> GSM1179008     1   0.000      1.000 1.000 0.000 0.000
#> GSM1179015     1   0.000      1.000 1.000 0.000 0.000
#> GSM1179017     3   0.000      0.991 0.000 0.000 1.000
#> GSM1179026     3   0.000      0.991 0.000 0.000 1.000
#> GSM1179033     3   0.000      0.991 0.000 0.000 1.000
#> GSM1179035     3   0.000      0.991 0.000 0.000 1.000
#> GSM1179036     3   0.000      0.991 0.000 0.000 1.000
#> GSM1178986     3   0.355      0.842 0.132 0.000 0.868
#> GSM1178989     3   0.000      0.991 0.000 0.000 1.000
#> GSM1178993     3   0.000      0.991 0.000 0.000 1.000
#> GSM1178999     2   0.000      0.997 0.000 1.000 0.000
#> GSM1179021     2   0.000      0.997 0.000 1.000 0.000
#> GSM1179025     2   0.000      0.997 0.000 1.000 0.000
#> GSM1179027     3   0.000      0.991 0.000 0.000 1.000
#> GSM1179011     3   0.000      0.991 0.000 0.000 1.000
#> GSM1179023     1   0.000      1.000 1.000 0.000 0.000
#> GSM1179029     1   0.000      1.000 1.000 0.000 0.000
#> GSM1179034     1   0.000      1.000 1.000 0.000 0.000
#> GSM1179040     2   0.000      0.997 0.000 1.000 0.000
#> GSM1178988     3   0.000      0.991 0.000 0.000 1.000
#> GSM1179037     3   0.000      0.991 0.000 0.000 1.000

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>            class entropy silhouette    p1    p2    p3    p4
#> GSM1178971     3  0.3123      0.814 0.156 0.000 0.844 0.000
#> GSM1178979     4  0.0336      0.950 0.000 0.008 0.000 0.992
#> GSM1179009     3  0.0000      0.956 0.000 0.000 1.000 0.000
#> GSM1179031     2  0.0000      0.995 0.000 1.000 0.000 0.000
#> GSM1178970     4  0.1637      0.948 0.000 0.000 0.060 0.940
#> GSM1178972     2  0.0000      0.995 0.000 1.000 0.000 0.000
#> GSM1178973     3  0.0000      0.956 0.000 0.000 1.000 0.000
#> GSM1178974     2  0.0000      0.995 0.000 1.000 0.000 0.000
#> GSM1178977     4  0.1637      0.948 0.000 0.000 0.060 0.940
#> GSM1178978     3  0.3123      0.814 0.156 0.000 0.844 0.000
#> GSM1178998     1  0.0000      0.923 1.000 0.000 0.000 0.000
#> GSM1179010     1  0.0188      0.921 0.996 0.000 0.000 0.004
#> GSM1179018     3  0.0000      0.956 0.000 0.000 1.000 0.000
#> GSM1179024     1  0.0188      0.921 0.996 0.000 0.000 0.004
#> GSM1178984     3  0.3123      0.814 0.156 0.000 0.844 0.000
#> GSM1178990     1  0.3219      0.795 0.836 0.000 0.164 0.000
#> GSM1178991     3  0.0188      0.954 0.000 0.000 0.996 0.004
#> GSM1178994     3  0.3873      0.709 0.228 0.000 0.772 0.000
#> GSM1178997     3  0.0000      0.956 0.000 0.000 1.000 0.000
#> GSM1179000     3  0.0188      0.954 0.000 0.000 0.996 0.004
#> GSM1179013     1  0.0000      0.923 1.000 0.000 0.000 0.000
#> GSM1179014     1  0.4155      0.707 0.756 0.000 0.240 0.004
#> GSM1179019     1  0.3486      0.771 0.812 0.000 0.188 0.000
#> GSM1179020     1  0.0000      0.923 1.000 0.000 0.000 0.000
#> GSM1179022     1  0.0000      0.923 1.000 0.000 0.000 0.000
#> GSM1179028     2  0.0000      0.995 0.000 1.000 0.000 0.000
#> GSM1179032     1  0.0000      0.923 1.000 0.000 0.000 0.000
#> GSM1179041     2  0.0000      0.995 0.000 1.000 0.000 0.000
#> GSM1179042     2  0.0000      0.995 0.000 1.000 0.000 0.000
#> GSM1178976     4  0.1792      0.943 0.000 0.000 0.068 0.932
#> GSM1178981     3  0.0000      0.956 0.000 0.000 1.000 0.000
#> GSM1178982     3  0.0000      0.956 0.000 0.000 1.000 0.000
#> GSM1178983     3  0.0000      0.956 0.000 0.000 1.000 0.000
#> GSM1178985     3  0.0000      0.956 0.000 0.000 1.000 0.000
#> GSM1178992     1  0.5088      0.301 0.572 0.000 0.424 0.004
#> GSM1179005     3  0.2408      0.868 0.104 0.000 0.896 0.000
#> GSM1179007     1  0.0000      0.923 1.000 0.000 0.000 0.000
#> GSM1179012     1  0.0000      0.923 1.000 0.000 0.000 0.000
#> GSM1179016     1  0.3448      0.790 0.828 0.000 0.168 0.004
#> GSM1179030     4  0.1637      0.948 0.000 0.000 0.060 0.940
#> GSM1179038     3  0.0000      0.956 0.000 0.000 1.000 0.000
#> GSM1178987     3  0.0000      0.956 0.000 0.000 1.000 0.000
#> GSM1179003     4  0.0336      0.950 0.000 0.008 0.000 0.992
#> GSM1179004     3  0.0000      0.956 0.000 0.000 1.000 0.000
#> GSM1179039     2  0.0000      0.995 0.000 1.000 0.000 0.000
#> GSM1178975     4  0.1389      0.952 0.000 0.000 0.048 0.952
#> GSM1178980     4  0.0336      0.954 0.000 0.000 0.008 0.992
#> GSM1178995     3  0.0000      0.956 0.000 0.000 1.000 0.000
#> GSM1178996     3  0.0000      0.956 0.000 0.000 1.000 0.000
#> GSM1179001     1  0.0000      0.923 1.000 0.000 0.000 0.000
#> GSM1179002     1  0.0000      0.923 1.000 0.000 0.000 0.000
#> GSM1179006     3  0.0000      0.956 0.000 0.000 1.000 0.000
#> GSM1179008     1  0.0000      0.923 1.000 0.000 0.000 0.000
#> GSM1179015     1  0.0000      0.923 1.000 0.000 0.000 0.000
#> GSM1179017     4  0.2469      0.905 0.000 0.000 0.108 0.892
#> GSM1179026     3  0.0000      0.956 0.000 0.000 1.000 0.000
#> GSM1179033     3  0.0000      0.956 0.000 0.000 1.000 0.000
#> GSM1179035     3  0.0000      0.956 0.000 0.000 1.000 0.000
#> GSM1179036     3  0.0000      0.956 0.000 0.000 1.000 0.000
#> GSM1178986     3  0.0188      0.954 0.000 0.000 0.996 0.004
#> GSM1178989     4  0.2647      0.891 0.000 0.000 0.120 0.880
#> GSM1178993     4  0.0469      0.955 0.000 0.000 0.012 0.988
#> GSM1178999     4  0.0336      0.950 0.000 0.008 0.000 0.992
#> GSM1179021     2  0.1389      0.957 0.000 0.952 0.000 0.048
#> GSM1179025     2  0.0000      0.995 0.000 1.000 0.000 0.000
#> GSM1179027     4  0.0336      0.954 0.000 0.000 0.008 0.992
#> GSM1179011     4  0.0469      0.955 0.000 0.000 0.012 0.988
#> GSM1179023     1  0.0000      0.923 1.000 0.000 0.000 0.000
#> GSM1179029     1  0.0188      0.921 0.996 0.000 0.000 0.004
#> GSM1179034     1  0.0000      0.923 1.000 0.000 0.000 0.000
#> GSM1179040     4  0.0336      0.950 0.000 0.008 0.000 0.992
#> GSM1178988     3  0.3610      0.709 0.000 0.000 0.800 0.200
#> GSM1179037     3  0.0000      0.956 0.000 0.000 1.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
#> GSM1178971     1  0.2654      0.599 0.888 0.000 0.048 0.000 0.064
#> GSM1178979     4  0.3613      0.780 0.016 0.012 0.160 0.812 0.000
#> GSM1179009     3  0.4235      0.768 0.424 0.000 0.576 0.000 0.000
#> GSM1179031     2  0.0000      0.966 0.000 1.000 0.000 0.000 0.000
#> GSM1178970     4  0.4262      0.696 0.000 0.000 0.440 0.560 0.000
#> GSM1178972     2  0.2555      0.910 0.016 0.904 0.028 0.052 0.000
#> GSM1178973     3  0.4703      0.812 0.340 0.000 0.632 0.028 0.000
#> GSM1178974     2  0.0162      0.965 0.000 0.996 0.004 0.000 0.000
#> GSM1178977     4  0.4227      0.715 0.000 0.000 0.420 0.580 0.000
#> GSM1178978     1  0.2654      0.599 0.888 0.000 0.048 0.000 0.064
#> GSM1178998     5  0.0000      0.900 0.000 0.000 0.000 0.000 1.000
#> GSM1179010     5  0.4941      0.327 0.328 0.000 0.044 0.000 0.628
#> GSM1179018     3  0.4088      0.814 0.368 0.000 0.632 0.000 0.000
#> GSM1179024     5  0.4300     -0.172 0.476 0.000 0.000 0.000 0.524
#> GSM1178984     1  0.2654      0.599 0.888 0.000 0.048 0.000 0.064
#> GSM1178990     1  0.4126      0.463 0.620 0.000 0.000 0.000 0.380
#> GSM1178991     1  0.1341      0.534 0.944 0.000 0.056 0.000 0.000
#> GSM1178994     1  0.2830      0.611 0.876 0.000 0.044 0.000 0.080
#> GSM1178997     3  0.3480      0.777 0.248 0.000 0.752 0.000 0.000
#> GSM1179000     1  0.2891      0.337 0.824 0.000 0.176 0.000 0.000
#> GSM1179013     5  0.0000      0.900 0.000 0.000 0.000 0.000 1.000
#> GSM1179014     1  0.3837      0.506 0.692 0.000 0.000 0.000 0.308
#> GSM1179019     1  0.4126      0.463 0.620 0.000 0.000 0.000 0.380
#> GSM1179020     1  0.4262      0.341 0.560 0.000 0.000 0.000 0.440
#> GSM1179022     5  0.0000      0.900 0.000 0.000 0.000 0.000 1.000
#> GSM1179028     2  0.0000      0.966 0.000 1.000 0.000 0.000 0.000
#> GSM1179032     5  0.0000      0.900 0.000 0.000 0.000 0.000 1.000
#> GSM1179041     2  0.0000      0.966 0.000 1.000 0.000 0.000 0.000
#> GSM1179042     2  0.0000      0.966 0.000 1.000 0.000 0.000 0.000
#> GSM1178976     4  0.4305      0.628 0.000 0.000 0.488 0.512 0.000
#> GSM1178981     3  0.4235      0.768 0.424 0.000 0.576 0.000 0.000
#> GSM1178982     3  0.3876      0.824 0.316 0.000 0.684 0.000 0.000
#> GSM1178983     3  0.3816      0.821 0.304 0.000 0.696 0.000 0.000
#> GSM1178985     3  0.3932      0.825 0.328 0.000 0.672 0.000 0.000
#> GSM1178992     1  0.3671      0.577 0.756 0.000 0.008 0.000 0.236
#> GSM1179005     1  0.2592      0.583 0.892 0.000 0.056 0.000 0.052
#> GSM1179007     1  0.4302      0.238 0.520 0.000 0.000 0.000 0.480
#> GSM1179012     5  0.0000      0.900 0.000 0.000 0.000 0.000 1.000
#> GSM1179016     1  0.3932      0.480 0.672 0.000 0.000 0.000 0.328
#> GSM1179030     4  0.4273      0.696 0.000 0.000 0.448 0.552 0.000
#> GSM1179038     3  0.4088      0.814 0.368 0.000 0.632 0.000 0.000
#> GSM1178987     3  0.4235      0.768 0.424 0.000 0.576 0.000 0.000
#> GSM1179003     4  0.3492      0.781 0.016 0.000 0.188 0.796 0.000
#> GSM1179004     3  0.4235      0.768 0.424 0.000 0.576 0.000 0.000
#> GSM1179039     2  0.0000      0.966 0.000 1.000 0.000 0.000 0.000
#> GSM1178975     4  0.3093      0.784 0.008 0.000 0.168 0.824 0.000
#> GSM1178980     4  0.0162      0.794 0.000 0.000 0.004 0.996 0.000
#> GSM1178995     1  0.4307     -0.656 0.500 0.000 0.500 0.000 0.000
#> GSM1178996     3  0.4171      0.794 0.396 0.000 0.604 0.000 0.000
#> GSM1179001     5  0.0162      0.897 0.004 0.000 0.000 0.000 0.996
#> GSM1179002     1  0.4273      0.327 0.552 0.000 0.000 0.000 0.448
#> GSM1179006     3  0.3999      0.821 0.344 0.000 0.656 0.000 0.000
#> GSM1179008     1  0.4283      0.313 0.544 0.000 0.000 0.000 0.456
#> GSM1179015     5  0.0000      0.900 0.000 0.000 0.000 0.000 1.000
#> GSM1179017     3  0.5507     -0.665 0.064 0.000 0.480 0.456 0.000
#> GSM1179026     3  0.4182      0.793 0.400 0.000 0.600 0.000 0.000
#> GSM1179033     3  0.3837      0.822 0.308 0.000 0.692 0.000 0.000
#> GSM1179035     3  0.3876      0.824 0.316 0.000 0.684 0.000 0.000
#> GSM1179036     3  0.3816      0.820 0.304 0.000 0.696 0.000 0.000
#> GSM1178986     1  0.1608      0.522 0.928 0.000 0.072 0.000 0.000
#> GSM1178989     3  0.4287     -0.586 0.000 0.000 0.540 0.460 0.000
#> GSM1178993     4  0.1830      0.807 0.008 0.000 0.068 0.924 0.000
#> GSM1178999     4  0.1701      0.779 0.016 0.012 0.028 0.944 0.000
#> GSM1179021     2  0.3926      0.797 0.016 0.792 0.020 0.172 0.000
#> GSM1179025     2  0.0000      0.966 0.000 1.000 0.000 0.000 0.000
#> GSM1179027     4  0.1557      0.805 0.008 0.000 0.052 0.940 0.000
#> GSM1179011     4  0.1830      0.807 0.008 0.000 0.068 0.924 0.000
#> GSM1179023     5  0.0000      0.900 0.000 0.000 0.000 0.000 1.000
#> GSM1179029     5  0.0290      0.893 0.008 0.000 0.000 0.000 0.992
#> GSM1179034     5  0.0000      0.900 0.000 0.000 0.000 0.000 1.000
#> GSM1179040     4  0.1117      0.783 0.016 0.000 0.020 0.964 0.000
#> GSM1178988     3  0.2362      0.563 0.076 0.000 0.900 0.024 0.000
#> GSM1179037     3  0.3857      0.823 0.312 0.000 0.688 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
#> GSM1178971     6  0.3942     0.7155 0.024 0.000 0.204 0.000 0.020 0.752
#> GSM1178979     5  0.5217    -0.0187 0.000 0.008 0.000 0.452 0.472 0.068
#> GSM1179009     3  0.2841     0.7877 0.000 0.000 0.824 0.000 0.012 0.164
#> GSM1179031     2  0.0000     0.9221 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1178970     5  0.5721     0.7230 0.000 0.000 0.176 0.344 0.480 0.000
#> GSM1178972     2  0.4486     0.7042 0.000 0.704 0.000 0.004 0.208 0.084
#> GSM1178973     3  0.2428     0.8575 0.000 0.000 0.896 0.060 0.024 0.020
#> GSM1178974     2  0.0891     0.9087 0.000 0.968 0.000 0.000 0.008 0.024
#> GSM1178977     5  0.5706     0.7204 0.000 0.000 0.172 0.348 0.480 0.000
#> GSM1178978     6  0.4338     0.7178 0.024 0.000 0.200 0.000 0.044 0.732
#> GSM1178998     1  0.0000     0.9712 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1179010     6  0.5020     0.2203 0.436 0.000 0.004 0.000 0.060 0.500
#> GSM1179018     3  0.0405     0.8920 0.000 0.000 0.988 0.000 0.004 0.008
#> GSM1179024     6  0.5320     0.5349 0.352 0.000 0.000 0.000 0.116 0.532
#> GSM1178984     6  0.3888     0.7114 0.024 0.000 0.208 0.000 0.016 0.752
#> GSM1178990     6  0.4848     0.7057 0.196 0.000 0.032 0.000 0.072 0.700
#> GSM1178991     6  0.5520     0.6329 0.000 0.000 0.200 0.000 0.240 0.560
#> GSM1178994     6  0.3748     0.7162 0.028 0.000 0.204 0.000 0.008 0.760
#> GSM1178997     3  0.3032     0.7774 0.000 0.000 0.852 0.040 0.096 0.012
#> GSM1179000     6  0.5608     0.4171 0.000 0.000 0.380 0.000 0.148 0.472
#> GSM1179013     1  0.0146     0.9704 0.996 0.000 0.000 0.000 0.004 0.000
#> GSM1179014     6  0.5841     0.6698 0.128 0.000 0.048 0.000 0.220 0.604
#> GSM1179019     6  0.5087     0.7147 0.184 0.000 0.040 0.000 0.088 0.688
#> GSM1179020     6  0.4727     0.6665 0.240 0.000 0.000 0.000 0.100 0.660
#> GSM1179022     1  0.0000     0.9712 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1179028     2  0.0000     0.9221 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1179032     1  0.0000     0.9712 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1179041     2  0.0000     0.9221 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1179042     2  0.0000     0.9221 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1178976     5  0.5763     0.7218 0.000 0.000 0.188 0.332 0.480 0.000
#> GSM1178981     3  0.2573     0.8442 0.000 0.000 0.864 0.000 0.024 0.112
#> GSM1178982     3  0.1088     0.8870 0.000 0.000 0.960 0.000 0.024 0.016
#> GSM1178983     3  0.1861     0.8708 0.000 0.000 0.928 0.016 0.036 0.020
#> GSM1178985     3  0.1092     0.8897 0.000 0.000 0.960 0.000 0.020 0.020
#> GSM1178992     6  0.4895     0.7398 0.072 0.000 0.120 0.000 0.080 0.728
#> GSM1179005     6  0.3357     0.6940 0.004 0.000 0.224 0.000 0.008 0.764
#> GSM1179007     6  0.3797     0.6206 0.292 0.000 0.000 0.000 0.016 0.692
#> GSM1179012     1  0.0146     0.9704 0.996 0.000 0.000 0.000 0.004 0.000
#> GSM1179016     6  0.5740     0.6646 0.140 0.000 0.036 0.000 0.216 0.608
#> GSM1179030     5  0.5900     0.7204 0.000 0.000 0.184 0.348 0.464 0.004
#> GSM1179038     3  0.0806     0.8896 0.000 0.000 0.972 0.000 0.008 0.020
#> GSM1178987     3  0.2212     0.8432 0.000 0.000 0.880 0.000 0.008 0.112
#> GSM1179003     5  0.5116     0.0265 0.000 0.000 0.004 0.444 0.484 0.068
#> GSM1179004     3  0.2212     0.8433 0.000 0.000 0.880 0.000 0.008 0.112
#> GSM1179039     2  0.0000     0.9221 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1178975     4  0.2612     0.5984 0.000 0.000 0.108 0.868 0.016 0.008
#> GSM1178980     4  0.1686     0.7783 0.000 0.000 0.000 0.924 0.064 0.012
#> GSM1178995     3  0.3043     0.7304 0.000 0.000 0.792 0.000 0.008 0.200
#> GSM1178996     3  0.0937     0.8864 0.000 0.000 0.960 0.000 0.000 0.040
#> GSM1179001     1  0.2623     0.8007 0.852 0.000 0.000 0.000 0.016 0.132
#> GSM1179002     6  0.3875     0.6305 0.280 0.000 0.004 0.000 0.016 0.700
#> GSM1179006     3  0.0363     0.8916 0.000 0.000 0.988 0.000 0.012 0.000
#> GSM1179008     6  0.3778     0.6242 0.288 0.000 0.000 0.000 0.016 0.696
#> GSM1179015     1  0.0146     0.9704 0.996 0.000 0.000 0.000 0.004 0.000
#> GSM1179017     5  0.6185     0.5532 0.000 0.000 0.116 0.248 0.564 0.072
#> GSM1179026     3  0.1196     0.8856 0.000 0.000 0.952 0.000 0.008 0.040
#> GSM1179033     3  0.0837     0.8850 0.000 0.000 0.972 0.004 0.020 0.004
#> GSM1179035     3  0.0436     0.8899 0.000 0.000 0.988 0.004 0.004 0.004
#> GSM1179036     3  0.0653     0.8869 0.000 0.000 0.980 0.004 0.012 0.004
#> GSM1178986     6  0.5591     0.6261 0.000 0.000 0.228 0.000 0.224 0.548
#> GSM1178989     5  0.6014     0.6731 0.000 0.000 0.236 0.292 0.468 0.004
#> GSM1178993     4  0.0363     0.7922 0.000 0.000 0.012 0.988 0.000 0.000
#> GSM1178999     4  0.4331     0.6453 0.000 0.008 0.000 0.728 0.192 0.072
#> GSM1179021     2  0.5733     0.5797 0.000 0.644 0.000 0.140 0.144 0.072
#> GSM1179025     2  0.0000     0.9221 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1179027     4  0.0146     0.7940 0.000 0.000 0.004 0.996 0.000 0.000
#> GSM1179011     4  0.0363     0.7922 0.000 0.000 0.012 0.988 0.000 0.000
#> GSM1179023     1  0.0000     0.9712 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1179029     1  0.1594     0.9125 0.932 0.000 0.000 0.000 0.052 0.016
#> GSM1179034     1  0.0000     0.9712 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1179040     4  0.4024     0.6619 0.000 0.000 0.000 0.744 0.184 0.072
#> GSM1178988     3  0.5306    -0.0797 0.000 0.000 0.532 0.096 0.368 0.004
#> GSM1179037     3  0.0551     0.8886 0.000 0.000 0.984 0.004 0.008 0.004

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

consensus_heatmap(res, k = 2)

plot of chunk tab-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) protocol(p) k
#> ATC:kmeans 72           0.0539     0.10956 2
#> ATC:kmeans 73           0.1665     0.01375 3
#> ATC:kmeans 72           0.3090     0.01144 4
#> ATC:kmeans 60           0.2491     0.00186 5
#> ATC:kmeans 68           0.0120     0.00798 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 31632 rows and 73 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.989       0.995         0.4875 0.514   0.514
#> 3 3 0.872           0.918       0.959         0.2990 0.824   0.664
#> 4 4 0.897           0.868       0.938         0.0599 0.955   0.878
#> 5 5 0.876           0.852       0.925         0.0682 0.938   0.822
#> 6 6 0.774           0.743       0.873         0.0390 0.993   0.977

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
#> GSM1178971     1  0.0000      0.993 1.000 0.000
#> GSM1178979     2  0.0000      0.999 0.000 1.000
#> GSM1179009     1  0.0000      0.993 1.000 0.000
#> GSM1179031     2  0.0000      0.999 0.000 1.000
#> GSM1178970     2  0.0000      0.999 0.000 1.000
#> GSM1178972     2  0.0000      0.999 0.000 1.000
#> GSM1178973     1  0.0000      0.993 1.000 0.000
#> GSM1178974     2  0.0000      0.999 0.000 1.000
#> GSM1178977     2  0.0000      0.999 0.000 1.000
#> GSM1178978     1  0.0000      0.993 1.000 0.000
#> GSM1178998     1  0.0000      0.993 1.000 0.000
#> GSM1179010     1  0.0000      0.993 1.000 0.000
#> GSM1179018     1  0.0000      0.993 1.000 0.000
#> GSM1179024     1  0.0000      0.993 1.000 0.000
#> GSM1178984     1  0.0000      0.993 1.000 0.000
#> GSM1178990     1  0.0000      0.993 1.000 0.000
#> GSM1178991     1  0.0000      0.993 1.000 0.000
#> GSM1178994     1  0.0000      0.993 1.000 0.000
#> GSM1178997     2  0.0000      0.999 0.000 1.000
#> GSM1179000     1  0.0000      0.993 1.000 0.000
#> GSM1179013     1  0.0000      0.993 1.000 0.000
#> GSM1179014     1  0.0000      0.993 1.000 0.000
#> GSM1179019     1  0.0000      0.993 1.000 0.000
#> GSM1179020     1  0.0000      0.993 1.000 0.000
#> GSM1179022     1  0.0000      0.993 1.000 0.000
#> GSM1179028     2  0.0000      0.999 0.000 1.000
#> GSM1179032     1  0.0000      0.993 1.000 0.000
#> GSM1179041     2  0.0000      0.999 0.000 1.000
#> GSM1179042     2  0.0000      0.999 0.000 1.000
#> GSM1178976     2  0.0000      0.999 0.000 1.000
#> GSM1178981     1  0.0000      0.993 1.000 0.000
#> GSM1178982     1  0.8861      0.562 0.696 0.304
#> GSM1178983     2  0.1843      0.971 0.028 0.972
#> GSM1178985     1  0.0000      0.993 1.000 0.000
#> GSM1178992     1  0.0000      0.993 1.000 0.000
#> GSM1179005     1  0.0000      0.993 1.000 0.000
#> GSM1179007     1  0.0000      0.993 1.000 0.000
#> GSM1179012     1  0.0000      0.993 1.000 0.000
#> GSM1179016     1  0.0000      0.993 1.000 0.000
#> GSM1179030     2  0.0000      0.999 0.000 1.000
#> GSM1179038     1  0.0000      0.993 1.000 0.000
#> GSM1178987     1  0.0000      0.993 1.000 0.000
#> GSM1179003     2  0.0000      0.999 0.000 1.000
#> GSM1179004     1  0.0000      0.993 1.000 0.000
#> GSM1179039     2  0.0000      0.999 0.000 1.000
#> GSM1178975     2  0.0000      0.999 0.000 1.000
#> GSM1178980     2  0.0000      0.999 0.000 1.000
#> GSM1178995     1  0.0000      0.993 1.000 0.000
#> GSM1178996     1  0.0000      0.993 1.000 0.000
#> GSM1179001     1  0.0000      0.993 1.000 0.000
#> GSM1179002     1  0.0000      0.993 1.000 0.000
#> GSM1179006     1  0.0000      0.993 1.000 0.000
#> GSM1179008     1  0.0000      0.993 1.000 0.000
#> GSM1179015     1  0.0000      0.993 1.000 0.000
#> GSM1179017     2  0.0000      0.999 0.000 1.000
#> GSM1179026     1  0.0000      0.993 1.000 0.000
#> GSM1179033     2  0.0376      0.995 0.004 0.996
#> GSM1179035     1  0.0000      0.993 1.000 0.000
#> GSM1179036     2  0.0672      0.992 0.008 0.992
#> GSM1178986     1  0.0000      0.993 1.000 0.000
#> GSM1178989     2  0.0000      0.999 0.000 1.000
#> GSM1178993     2  0.0000      0.999 0.000 1.000
#> GSM1178999     2  0.0000      0.999 0.000 1.000
#> GSM1179021     2  0.0000      0.999 0.000 1.000
#> GSM1179025     2  0.0000      0.999 0.000 1.000
#> GSM1179027     2  0.0000      0.999 0.000 1.000
#> GSM1179011     2  0.0000      0.999 0.000 1.000
#> GSM1179023     1  0.0000      0.993 1.000 0.000
#> GSM1179029     1  0.0000      0.993 1.000 0.000
#> GSM1179034     1  0.0000      0.993 1.000 0.000
#> GSM1179040     2  0.0000      0.999 0.000 1.000
#> GSM1178988     2  0.0000      0.999 0.000 1.000
#> GSM1179037     1  0.0376      0.989 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
#> GSM1178971     1  0.0000     0.9777 1.000 0.000 0.000
#> GSM1178979     2  0.0000     0.9821 0.000 1.000 0.000
#> GSM1179009     3  0.4504     0.8197 0.196 0.000 0.804
#> GSM1179031     2  0.0000     0.9821 0.000 1.000 0.000
#> GSM1178970     2  0.0000     0.9821 0.000 1.000 0.000
#> GSM1178972     2  0.0000     0.9821 0.000 1.000 0.000
#> GSM1178973     3  0.3412     0.8546 0.124 0.000 0.876
#> GSM1178974     2  0.0000     0.9821 0.000 1.000 0.000
#> GSM1178977     2  0.0000     0.9821 0.000 1.000 0.000
#> GSM1178978     1  0.0000     0.9777 1.000 0.000 0.000
#> GSM1178998     1  0.0000     0.9777 1.000 0.000 0.000
#> GSM1179010     1  0.0000     0.9777 1.000 0.000 0.000
#> GSM1179018     3  0.1753     0.8520 0.048 0.000 0.952
#> GSM1179024     1  0.0000     0.9777 1.000 0.000 0.000
#> GSM1178984     1  0.0000     0.9777 1.000 0.000 0.000
#> GSM1178990     1  0.0000     0.9777 1.000 0.000 0.000
#> GSM1178991     1  0.0000     0.9777 1.000 0.000 0.000
#> GSM1178994     1  0.0000     0.9777 1.000 0.000 0.000
#> GSM1178997     2  0.0000     0.9821 0.000 1.000 0.000
#> GSM1179000     1  0.0000     0.9777 1.000 0.000 0.000
#> GSM1179013     1  0.0000     0.9777 1.000 0.000 0.000
#> GSM1179014     1  0.0000     0.9777 1.000 0.000 0.000
#> GSM1179019     1  0.0000     0.9777 1.000 0.000 0.000
#> GSM1179020     1  0.0000     0.9777 1.000 0.000 0.000
#> GSM1179022     1  0.0000     0.9777 1.000 0.000 0.000
#> GSM1179028     2  0.0000     0.9821 0.000 1.000 0.000
#> GSM1179032     1  0.0000     0.9777 1.000 0.000 0.000
#> GSM1179041     2  0.0000     0.9821 0.000 1.000 0.000
#> GSM1179042     2  0.0000     0.9821 0.000 1.000 0.000
#> GSM1178976     2  0.0000     0.9821 0.000 1.000 0.000
#> GSM1178981     3  0.5968     0.5986 0.364 0.000 0.636
#> GSM1178982     3  0.3349     0.8568 0.108 0.004 0.888
#> GSM1178983     2  0.6460     0.2156 0.004 0.556 0.440
#> GSM1178985     3  0.4178     0.8355 0.172 0.000 0.828
#> GSM1178992     1  0.0000     0.9777 1.000 0.000 0.000
#> GSM1179005     1  0.0000     0.9777 1.000 0.000 0.000
#> GSM1179007     1  0.0000     0.9777 1.000 0.000 0.000
#> GSM1179012     1  0.0000     0.9777 1.000 0.000 0.000
#> GSM1179016     1  0.0000     0.9777 1.000 0.000 0.000
#> GSM1179030     2  0.0000     0.9821 0.000 1.000 0.000
#> GSM1179038     3  0.3879     0.8248 0.152 0.000 0.848
#> GSM1178987     1  0.6126     0.0945 0.600 0.000 0.400
#> GSM1179003     2  0.0000     0.9821 0.000 1.000 0.000
#> GSM1179004     3  0.6180     0.4848 0.416 0.000 0.584
#> GSM1179039     2  0.0000     0.9821 0.000 1.000 0.000
#> GSM1178975     2  0.0000     0.9821 0.000 1.000 0.000
#> GSM1178980     2  0.0000     0.9821 0.000 1.000 0.000
#> GSM1178995     1  0.1411     0.9384 0.964 0.000 0.036
#> GSM1178996     1  0.3619     0.8123 0.864 0.000 0.136
#> GSM1179001     1  0.0000     0.9777 1.000 0.000 0.000
#> GSM1179002     1  0.0000     0.9777 1.000 0.000 0.000
#> GSM1179006     3  0.4452     0.8233 0.192 0.000 0.808
#> GSM1179008     1  0.0000     0.9777 1.000 0.000 0.000
#> GSM1179015     1  0.0000     0.9777 1.000 0.000 0.000
#> GSM1179017     2  0.0237     0.9787 0.000 0.996 0.004
#> GSM1179026     3  0.4121     0.8117 0.168 0.000 0.832
#> GSM1179033     3  0.1753     0.8163 0.000 0.048 0.952
#> GSM1179035     3  0.0000     0.8367 0.000 0.000 1.000
#> GSM1179036     3  0.0000     0.8367 0.000 0.000 1.000
#> GSM1178986     1  0.0000     0.9777 1.000 0.000 0.000
#> GSM1178989     2  0.0000     0.9821 0.000 1.000 0.000
#> GSM1178993     2  0.0000     0.9821 0.000 1.000 0.000
#> GSM1178999     2  0.0000     0.9821 0.000 1.000 0.000
#> GSM1179021     2  0.0000     0.9821 0.000 1.000 0.000
#> GSM1179025     2  0.0000     0.9821 0.000 1.000 0.000
#> GSM1179027     2  0.0000     0.9821 0.000 1.000 0.000
#> GSM1179011     2  0.0000     0.9821 0.000 1.000 0.000
#> GSM1179023     1  0.0000     0.9777 1.000 0.000 0.000
#> GSM1179029     1  0.0000     0.9777 1.000 0.000 0.000
#> GSM1179034     1  0.0000     0.9777 1.000 0.000 0.000
#> GSM1179040     2  0.0000     0.9821 0.000 1.000 0.000
#> GSM1178988     2  0.0424     0.9752 0.000 0.992 0.008
#> GSM1179037     3  0.0000     0.8367 0.000 0.000 1.000

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>            class entropy silhouette    p1    p2    p3    p4
#> GSM1178971     1  0.0000      0.958 1.000 0.000 0.000 0.000
#> GSM1178979     2  0.0000      0.931 0.000 1.000 0.000 0.000
#> GSM1179009     4  0.6347      0.599 0.276 0.000 0.100 0.624
#> GSM1179031     2  0.0000      0.931 0.000 1.000 0.000 0.000
#> GSM1178970     2  0.0000      0.931 0.000 1.000 0.000 0.000
#> GSM1178972     2  0.0000      0.931 0.000 1.000 0.000 0.000
#> GSM1178973     4  0.0000      0.650 0.000 0.000 0.000 1.000
#> GSM1178974     2  0.0000      0.931 0.000 1.000 0.000 0.000
#> GSM1178977     2  0.0000      0.931 0.000 1.000 0.000 0.000
#> GSM1178978     1  0.0000      0.958 1.000 0.000 0.000 0.000
#> GSM1178998     1  0.0000      0.958 1.000 0.000 0.000 0.000
#> GSM1179010     1  0.0000      0.958 1.000 0.000 0.000 0.000
#> GSM1179018     3  0.4114      0.789 0.060 0.000 0.828 0.112
#> GSM1179024     1  0.0000      0.958 1.000 0.000 0.000 0.000
#> GSM1178984     1  0.0000      0.958 1.000 0.000 0.000 0.000
#> GSM1178990     1  0.0000      0.958 1.000 0.000 0.000 0.000
#> GSM1178991     1  0.0000      0.958 1.000 0.000 0.000 0.000
#> GSM1178994     1  0.0000      0.958 1.000 0.000 0.000 0.000
#> GSM1178997     2  0.0817      0.918 0.000 0.976 0.000 0.024
#> GSM1179000     1  0.0000      0.958 1.000 0.000 0.000 0.000
#> GSM1179013     1  0.0000      0.958 1.000 0.000 0.000 0.000
#> GSM1179014     1  0.0000      0.958 1.000 0.000 0.000 0.000
#> GSM1179019     1  0.0000      0.958 1.000 0.000 0.000 0.000
#> GSM1179020     1  0.0000      0.958 1.000 0.000 0.000 0.000
#> GSM1179022     1  0.0000      0.958 1.000 0.000 0.000 0.000
#> GSM1179028     2  0.0000      0.931 0.000 1.000 0.000 0.000
#> GSM1179032     1  0.0000      0.958 1.000 0.000 0.000 0.000
#> GSM1179041     2  0.0000      0.931 0.000 1.000 0.000 0.000
#> GSM1179042     2  0.0000      0.931 0.000 1.000 0.000 0.000
#> GSM1178976     2  0.0000      0.931 0.000 1.000 0.000 0.000
#> GSM1178981     4  0.5716      0.621 0.272 0.000 0.060 0.668
#> GSM1178982     4  0.1389      0.652 0.000 0.000 0.048 0.952
#> GSM1178983     4  0.0000      0.650 0.000 0.000 0.000 1.000
#> GSM1178985     4  0.6063      0.646 0.196 0.000 0.124 0.680
#> GSM1178992     1  0.0000      0.958 1.000 0.000 0.000 0.000
#> GSM1179005     1  0.0000      0.958 1.000 0.000 0.000 0.000
#> GSM1179007     1  0.0000      0.958 1.000 0.000 0.000 0.000
#> GSM1179012     1  0.0000      0.958 1.000 0.000 0.000 0.000
#> GSM1179016     1  0.0000      0.958 1.000 0.000 0.000 0.000
#> GSM1179030     2  0.0000      0.931 0.000 1.000 0.000 0.000
#> GSM1179038     3  0.1824      0.877 0.060 0.000 0.936 0.004
#> GSM1178987     1  0.4706      0.603 0.732 0.000 0.248 0.020
#> GSM1179003     2  0.0000      0.931 0.000 1.000 0.000 0.000
#> GSM1179004     1  0.5738      0.180 0.540 0.000 0.432 0.028
#> GSM1179039     2  0.0000      0.931 0.000 1.000 0.000 0.000
#> GSM1178975     2  0.4585      0.647 0.000 0.668 0.000 0.332
#> GSM1178980     2  0.4277      0.704 0.000 0.720 0.000 0.280
#> GSM1178995     1  0.1557      0.902 0.944 0.000 0.056 0.000
#> GSM1178996     1  0.4761      0.402 0.628 0.000 0.372 0.000
#> GSM1179001     1  0.0000      0.958 1.000 0.000 0.000 0.000
#> GSM1179002     1  0.0000      0.958 1.000 0.000 0.000 0.000
#> GSM1179006     4  0.5951      0.483 0.064 0.000 0.300 0.636
#> GSM1179008     1  0.0000      0.958 1.000 0.000 0.000 0.000
#> GSM1179015     1  0.0000      0.958 1.000 0.000 0.000 0.000
#> GSM1179017     2  0.1637      0.888 0.000 0.940 0.060 0.000
#> GSM1179026     3  0.0000      0.948 0.000 0.000 1.000 0.000
#> GSM1179033     3  0.0000      0.948 0.000 0.000 1.000 0.000
#> GSM1179035     3  0.0000      0.948 0.000 0.000 1.000 0.000
#> GSM1179036     3  0.0188      0.946 0.000 0.000 0.996 0.004
#> GSM1178986     1  0.0000      0.958 1.000 0.000 0.000 0.000
#> GSM1178989     2  0.0000      0.931 0.000 1.000 0.000 0.000
#> GSM1178993     2  0.4543      0.656 0.000 0.676 0.000 0.324
#> GSM1178999     2  0.0000      0.931 0.000 1.000 0.000 0.000
#> GSM1179021     2  0.0000      0.931 0.000 1.000 0.000 0.000
#> GSM1179025     2  0.0000      0.931 0.000 1.000 0.000 0.000
#> GSM1179027     2  0.4477      0.670 0.000 0.688 0.000 0.312
#> GSM1179011     2  0.4585      0.647 0.000 0.668 0.000 0.332
#> GSM1179023     1  0.0000      0.958 1.000 0.000 0.000 0.000
#> GSM1179029     1  0.0000      0.958 1.000 0.000 0.000 0.000
#> GSM1179034     1  0.0000      0.958 1.000 0.000 0.000 0.000
#> GSM1179040     2  0.0336      0.927 0.000 0.992 0.000 0.008
#> GSM1178988     2  0.1389      0.898 0.000 0.952 0.048 0.000
#> GSM1179037     3  0.0000      0.948 0.000 0.000 1.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
#> GSM1178971     1  0.0898      0.929 0.972 0.000 0.000 0.008 0.020
#> GSM1178979     2  0.0000      0.982 0.000 1.000 0.000 0.000 0.000
#> GSM1179009     5  0.3018      0.706 0.080 0.000 0.020 0.024 0.876
#> GSM1179031     2  0.0000      0.982 0.000 1.000 0.000 0.000 0.000
#> GSM1178970     2  0.0000      0.982 0.000 1.000 0.000 0.000 0.000
#> GSM1178972     2  0.0000      0.982 0.000 1.000 0.000 0.000 0.000
#> GSM1178973     4  0.3949      0.488 0.000 0.000 0.000 0.668 0.332
#> GSM1178974     2  0.0000      0.982 0.000 1.000 0.000 0.000 0.000
#> GSM1178977     2  0.0000      0.982 0.000 1.000 0.000 0.000 0.000
#> GSM1178978     1  0.1557      0.916 0.940 0.000 0.000 0.008 0.052
#> GSM1178998     1  0.0798      0.930 0.976 0.000 0.000 0.008 0.016
#> GSM1179010     1  0.1764      0.907 0.928 0.000 0.000 0.008 0.064
#> GSM1179018     3  0.6540      0.363 0.076 0.000 0.568 0.064 0.292
#> GSM1179024     1  0.0451      0.931 0.988 0.000 0.004 0.000 0.008
#> GSM1178984     1  0.2707      0.843 0.860 0.000 0.000 0.008 0.132
#> GSM1178990     1  0.0162      0.933 0.996 0.000 0.000 0.000 0.004
#> GSM1178991     1  0.2196      0.890 0.916 0.000 0.004 0.056 0.024
#> GSM1178994     1  0.2660      0.846 0.864 0.000 0.000 0.008 0.128
#> GSM1178997     2  0.2536      0.851 0.000 0.868 0.000 0.128 0.004
#> GSM1179000     1  0.1278      0.920 0.960 0.000 0.004 0.020 0.016
#> GSM1179013     1  0.0000      0.934 1.000 0.000 0.000 0.000 0.000
#> GSM1179014     1  0.1653      0.910 0.944 0.000 0.004 0.028 0.024
#> GSM1179019     1  0.0000      0.934 1.000 0.000 0.000 0.000 0.000
#> GSM1179020     1  0.0000      0.934 1.000 0.000 0.000 0.000 0.000
#> GSM1179022     1  0.0000      0.934 1.000 0.000 0.000 0.000 0.000
#> GSM1179028     2  0.0000      0.982 0.000 1.000 0.000 0.000 0.000
#> GSM1179032     1  0.0000      0.934 1.000 0.000 0.000 0.000 0.000
#> GSM1179041     2  0.0000      0.982 0.000 1.000 0.000 0.000 0.000
#> GSM1179042     2  0.0000      0.982 0.000 1.000 0.000 0.000 0.000
#> GSM1178976     2  0.0000      0.982 0.000 1.000 0.000 0.000 0.000
#> GSM1178981     5  0.0794      0.736 0.028 0.000 0.000 0.000 0.972
#> GSM1178982     5  0.1831      0.658 0.000 0.000 0.004 0.076 0.920
#> GSM1178983     4  0.4306      0.192 0.000 0.000 0.000 0.508 0.492
#> GSM1178985     5  0.0794      0.736 0.028 0.000 0.000 0.000 0.972
#> GSM1178992     1  0.0566      0.932 0.984 0.000 0.004 0.000 0.012
#> GSM1179005     1  0.1484      0.917 0.944 0.000 0.000 0.008 0.048
#> GSM1179007     1  0.0992      0.928 0.968 0.000 0.000 0.008 0.024
#> GSM1179012     1  0.0162      0.933 0.996 0.000 0.000 0.000 0.004
#> GSM1179016     1  0.1471      0.915 0.952 0.000 0.004 0.024 0.020
#> GSM1179030     2  0.0000      0.982 0.000 1.000 0.000 0.000 0.000
#> GSM1179038     3  0.2703      0.810 0.060 0.000 0.896 0.024 0.020
#> GSM1178987     1  0.6730      0.124 0.520 0.000 0.124 0.036 0.320
#> GSM1179003     2  0.0000      0.982 0.000 1.000 0.000 0.000 0.000
#> GSM1179004     5  0.7409      0.135 0.344 0.000 0.252 0.032 0.372
#> GSM1179039     2  0.0000      0.982 0.000 1.000 0.000 0.000 0.000
#> GSM1178975     4  0.1965      0.799 0.000 0.096 0.000 0.904 0.000
#> GSM1178980     4  0.3274      0.702 0.000 0.220 0.000 0.780 0.000
#> GSM1178995     1  0.3157      0.863 0.872 0.000 0.052 0.016 0.060
#> GSM1178996     1  0.5637      0.419 0.604 0.000 0.324 0.028 0.044
#> GSM1179001     1  0.0898      0.929 0.972 0.000 0.000 0.008 0.020
#> GSM1179002     1  0.0992      0.928 0.968 0.000 0.000 0.008 0.024
#> GSM1179006     5  0.3968      0.656 0.040 0.000 0.120 0.024 0.816
#> GSM1179008     1  0.0898      0.929 0.972 0.000 0.000 0.008 0.020
#> GSM1179015     1  0.0000      0.934 1.000 0.000 0.000 0.000 0.000
#> GSM1179017     2  0.2228      0.908 0.000 0.916 0.056 0.020 0.008
#> GSM1179026     3  0.0324      0.894 0.000 0.000 0.992 0.004 0.004
#> GSM1179033     3  0.0898      0.888 0.000 0.000 0.972 0.008 0.020
#> GSM1179035     3  0.0404      0.894 0.000 0.000 0.988 0.000 0.012
#> GSM1179036     3  0.0451      0.895 0.000 0.000 0.988 0.008 0.004
#> GSM1178986     1  0.1990      0.902 0.928 0.000 0.004 0.028 0.040
#> GSM1178989     2  0.0000      0.982 0.000 1.000 0.000 0.000 0.000
#> GSM1178993     4  0.2020      0.801 0.000 0.100 0.000 0.900 0.000
#> GSM1178999     2  0.0000      0.982 0.000 1.000 0.000 0.000 0.000
#> GSM1179021     2  0.0000      0.982 0.000 1.000 0.000 0.000 0.000
#> GSM1179025     2  0.0000      0.982 0.000 1.000 0.000 0.000 0.000
#> GSM1179027     4  0.2516      0.783 0.000 0.140 0.000 0.860 0.000
#> GSM1179011     4  0.2020      0.801 0.000 0.100 0.000 0.900 0.000
#> GSM1179023     1  0.0000      0.934 1.000 0.000 0.000 0.000 0.000
#> GSM1179029     1  0.0727      0.928 0.980 0.000 0.004 0.004 0.012
#> GSM1179034     1  0.0000      0.934 1.000 0.000 0.000 0.000 0.000
#> GSM1179040     2  0.1410      0.927 0.000 0.940 0.000 0.060 0.000
#> GSM1178988     2  0.1569      0.936 0.000 0.944 0.044 0.008 0.004
#> GSM1179037     3  0.0324      0.895 0.000 0.000 0.992 0.004 0.004

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>            class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM1178971     1  0.2020     0.8567 0.896 0.000 0.008 0.000 0.096 0.000
#> GSM1178979     2  0.0000     0.9551 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1179009     3  0.6094     0.1578 0.184 0.000 0.576 0.000 0.192 0.048
#> GSM1179031     2  0.0000     0.9551 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1178970     2  0.0405     0.9511 0.000 0.988 0.000 0.004 0.008 0.000
#> GSM1178972     2  0.0000     0.9551 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1178973     4  0.4652     0.4370 0.000 0.000 0.288 0.640 0.072 0.000
#> GSM1178974     2  0.0000     0.9551 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1178977     2  0.0000     0.9551 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1178978     1  0.2711     0.8497 0.872 0.000 0.056 0.004 0.068 0.000
#> GSM1178998     1  0.1866     0.8585 0.908 0.000 0.008 0.000 0.084 0.000
#> GSM1179010     1  0.2651     0.8420 0.860 0.000 0.028 0.000 0.112 0.000
#> GSM1179018     5  0.7438     0.0000 0.060 0.000 0.148 0.048 0.384 0.360
#> GSM1179024     1  0.0790     0.8609 0.968 0.000 0.000 0.000 0.032 0.000
#> GSM1178984     1  0.4003     0.7620 0.760 0.000 0.116 0.000 0.124 0.000
#> GSM1178990     1  0.0713     0.8716 0.972 0.000 0.000 0.000 0.028 0.000
#> GSM1178991     1  0.3724     0.6360 0.716 0.000 0.000 0.012 0.268 0.004
#> GSM1178994     1  0.3469     0.8003 0.808 0.000 0.104 0.000 0.088 0.000
#> GSM1178997     2  0.3942     0.7595 0.000 0.784 0.012 0.084 0.120 0.000
#> GSM1179000     1  0.2278     0.8069 0.868 0.000 0.000 0.004 0.128 0.000
#> GSM1179013     1  0.0000     0.8701 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1179014     1  0.2558     0.7815 0.840 0.000 0.000 0.004 0.156 0.000
#> GSM1179019     1  0.0146     0.8695 0.996 0.000 0.000 0.000 0.004 0.000
#> GSM1179020     1  0.0260     0.8690 0.992 0.000 0.000 0.000 0.008 0.000
#> GSM1179022     1  0.0000     0.8701 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1179028     2  0.0000     0.9551 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1179032     1  0.0000     0.8701 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1179041     2  0.0000     0.9551 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1179042     2  0.0000     0.9551 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1178976     2  0.0405     0.9511 0.000 0.988 0.000 0.004 0.008 0.000
#> GSM1178981     3  0.1155     0.4741 0.004 0.000 0.956 0.000 0.036 0.004
#> GSM1178982     3  0.2322     0.4615 0.000 0.000 0.896 0.036 0.064 0.004
#> GSM1178983     3  0.4841    -0.0902 0.000 0.000 0.508 0.436 0.056 0.000
#> GSM1178985     3  0.0458     0.4803 0.000 0.000 0.984 0.000 0.016 0.000
#> GSM1178992     1  0.0937     0.8715 0.960 0.000 0.000 0.000 0.040 0.000
#> GSM1179005     1  0.2651     0.8421 0.860 0.000 0.028 0.000 0.112 0.000
#> GSM1179007     1  0.2266     0.8495 0.880 0.000 0.012 0.000 0.108 0.000
#> GSM1179012     1  0.0547     0.8709 0.980 0.000 0.000 0.000 0.020 0.000
#> GSM1179016     1  0.2219     0.8007 0.864 0.000 0.000 0.000 0.136 0.000
#> GSM1179030     2  0.1418     0.9295 0.000 0.944 0.000 0.032 0.024 0.000
#> GSM1179038     6  0.4778     0.1988 0.060 0.000 0.012 0.000 0.276 0.652
#> GSM1178987     1  0.7380    -0.1963 0.376 0.000 0.240 0.000 0.256 0.128
#> GSM1179003     2  0.0000     0.9551 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1179004     3  0.7674    -0.1961 0.216 0.000 0.308 0.000 0.260 0.216
#> GSM1179039     2  0.0000     0.9551 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1178975     4  0.0858     0.8605 0.000 0.028 0.000 0.968 0.004 0.000
#> GSM1178980     4  0.2378     0.7247 0.000 0.152 0.000 0.848 0.000 0.000
#> GSM1178995     1  0.4644     0.7325 0.732 0.000 0.048 0.000 0.164 0.056
#> GSM1178996     1  0.6588     0.2581 0.496 0.000 0.044 0.004 0.244 0.212
#> GSM1179001     1  0.2118     0.8525 0.888 0.000 0.008 0.000 0.104 0.000
#> GSM1179002     1  0.2212     0.8501 0.880 0.000 0.008 0.000 0.112 0.000
#> GSM1179006     3  0.5857     0.2576 0.052 0.000 0.608 0.004 0.236 0.100
#> GSM1179008     1  0.2070     0.8538 0.892 0.000 0.008 0.000 0.100 0.000
#> GSM1179015     1  0.0000     0.8701 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1179017     2  0.4324     0.7134 0.000 0.736 0.000 0.032 0.196 0.036
#> GSM1179026     6  0.1910     0.7086 0.000 0.000 0.000 0.000 0.108 0.892
#> GSM1179033     6  0.2822     0.6620 0.000 0.004 0.016 0.004 0.124 0.852
#> GSM1179035     6  0.1814     0.7166 0.000 0.000 0.000 0.000 0.100 0.900
#> GSM1179036     6  0.1838     0.7268 0.000 0.000 0.000 0.016 0.068 0.916
#> GSM1178986     1  0.3577     0.7171 0.772 0.000 0.016 0.012 0.200 0.000
#> GSM1178989     2  0.1124     0.9356 0.000 0.956 0.000 0.008 0.036 0.000
#> GSM1178993     4  0.0713     0.8616 0.000 0.028 0.000 0.972 0.000 0.000
#> GSM1178999     2  0.0632     0.9448 0.000 0.976 0.000 0.024 0.000 0.000
#> GSM1179021     2  0.0363     0.9504 0.000 0.988 0.000 0.012 0.000 0.000
#> GSM1179025     2  0.0000     0.9551 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1179027     4  0.1204     0.8480 0.000 0.056 0.000 0.944 0.000 0.000
#> GSM1179011     4  0.0713     0.8616 0.000 0.028 0.000 0.972 0.000 0.000
#> GSM1179023     1  0.0000     0.8701 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1179029     1  0.0865     0.8593 0.964 0.000 0.000 0.000 0.036 0.000
#> GSM1179034     1  0.0000     0.8701 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1179040     2  0.1957     0.8677 0.000 0.888 0.000 0.112 0.000 0.000
#> GSM1178988     2  0.3601     0.8163 0.000 0.816 0.000 0.016 0.100 0.068
#> GSM1179037     6  0.0547     0.7508 0.000 0.000 0.000 0.000 0.020 0.980

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) protocol(p) k
#> ATC:skmeans 73          0.12514      0.5398 2
#> ATC:skmeans 70          0.12743      0.0232 3
#> ATC:skmeans 70          0.05309      0.0639 4
#> ATC:skmeans 67          0.03753      0.2160 5
#> ATC:skmeans 61          0.00625      0.2839 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 31632 rows and 73 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 6.
#> 
#> Following methods can be applied to this 'ConsensusPartition' object:
#>  [1] "cola_report"             "collect_classes"         "collect_plots"          
#>  [4] "collect_stats"           "colnames"                "compare_signatures"     
#>  [7] "consensus_heatmap"       "dimension_reduction"     "functional_enrichment"  
#> [10] "get_anno_col"            "get_anno"                "get_classes"            
#> [13] "get_consensus"           "get_matrix"              "get_membership"         
#> [16] "get_param"               "get_signatures"          "get_stats"              
#> [19] "is_best_k"               "is_stable_k"             "membership_heatmap"     
#> [22] "ncol"                    "nrow"                    "plot_ecdf"              
#> [25] "rownames"                "select_partition_number" "show"                   
#> [28] "suggest_best_k"          "test_to_known_factors"

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

collect_plots(res)

plot of chunk ATC-pam-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 1.000           0.998       0.999         0.2985 0.703   0.703
#> 3 3 0.912           0.975       0.989         1.0349 0.663   0.530
#> 4 4 0.710           0.882       0.923         0.1197 0.916   0.790
#> 5 5 0.970           0.933       0.973         0.1283 0.821   0.512
#> 6 6 0.945           0.891       0.954         0.0298 0.974   0.889

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

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

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

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

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

show/hide code output

cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#>            class entropy silhouette    p1    p2
#> GSM1178971     1  0.0000      0.999 1.000 0.000
#> GSM1178979     2  0.0000      1.000 0.000 1.000
#> GSM1179009     1  0.0000      0.999 1.000 0.000
#> GSM1179031     2  0.0000      1.000 0.000 1.000
#> GSM1178970     1  0.0672      0.993 0.992 0.008
#> GSM1178972     2  0.0000      1.000 0.000 1.000
#> GSM1178973     1  0.0000      0.999 1.000 0.000
#> GSM1178974     2  0.0000      1.000 0.000 1.000
#> GSM1178977     1  0.0672      0.993 0.992 0.008
#> GSM1178978     1  0.0000      0.999 1.000 0.000
#> GSM1178998     1  0.0000      0.999 1.000 0.000
#> GSM1179010     1  0.0000      0.999 1.000 0.000
#> GSM1179018     1  0.0000      0.999 1.000 0.000
#> GSM1179024     1  0.0000      0.999 1.000 0.000
#> GSM1178984     1  0.0000      0.999 1.000 0.000
#> GSM1178990     1  0.0000      0.999 1.000 0.000
#> GSM1178991     1  0.0000      0.999 1.000 0.000
#> GSM1178994     1  0.0000      0.999 1.000 0.000
#> GSM1178997     1  0.0000      0.999 1.000 0.000
#> GSM1179000     1  0.0000      0.999 1.000 0.000
#> GSM1179013     1  0.0000      0.999 1.000 0.000
#> GSM1179014     1  0.0000      0.999 1.000 0.000
#> GSM1179019     1  0.0000      0.999 1.000 0.000
#> GSM1179020     1  0.0000      0.999 1.000 0.000
#> GSM1179022     1  0.0000      0.999 1.000 0.000
#> GSM1179028     2  0.0000      1.000 0.000 1.000
#> GSM1179032     1  0.0000      0.999 1.000 0.000
#> GSM1179041     2  0.0000      1.000 0.000 1.000
#> GSM1179042     2  0.0000      1.000 0.000 1.000
#> GSM1178976     1  0.0672      0.993 0.992 0.008
#> GSM1178981     1  0.0000      0.999 1.000 0.000
#> GSM1178982     1  0.0000      0.999 1.000 0.000
#> GSM1178983     1  0.0000      0.999 1.000 0.000
#> GSM1178985     1  0.0000      0.999 1.000 0.000
#> GSM1178992     1  0.0000      0.999 1.000 0.000
#> GSM1179005     1  0.0000      0.999 1.000 0.000
#> GSM1179007     1  0.0000      0.999 1.000 0.000
#> GSM1179012     1  0.0000      0.999 1.000 0.000
#> GSM1179016     1  0.0000      0.999 1.000 0.000
#> GSM1179030     1  0.0672      0.993 0.992 0.008
#> GSM1179038     1  0.0000      0.999 1.000 0.000
#> GSM1178987     1  0.0000      0.999 1.000 0.000
#> GSM1179003     2  0.0000      1.000 0.000 1.000
#> GSM1179004     1  0.0000      0.999 1.000 0.000
#> GSM1179039     2  0.0000      1.000 0.000 1.000
#> GSM1178975     1  0.0000      0.999 1.000 0.000
#> GSM1178980     1  0.0672      0.993 0.992 0.008
#> GSM1178995     1  0.0000      0.999 1.000 0.000
#> GSM1178996     1  0.0000      0.999 1.000 0.000
#> GSM1179001     1  0.0000      0.999 1.000 0.000
#> GSM1179002     1  0.0000      0.999 1.000 0.000
#> GSM1179006     1  0.0000      0.999 1.000 0.000
#> GSM1179008     1  0.0000      0.999 1.000 0.000
#> GSM1179015     1  0.0000      0.999 1.000 0.000
#> GSM1179017     1  0.0672      0.993 0.992 0.008
#> GSM1179026     1  0.0000      0.999 1.000 0.000
#> GSM1179033     1  0.0000      0.999 1.000 0.000
#> GSM1179035     1  0.0000      0.999 1.000 0.000
#> GSM1179036     1  0.0000      0.999 1.000 0.000
#> GSM1178986     1  0.0000      0.999 1.000 0.000
#> GSM1178989     1  0.0672      0.993 0.992 0.008
#> GSM1178993     1  0.0672      0.993 0.992 0.008
#> GSM1178999     2  0.0000      1.000 0.000 1.000
#> GSM1179021     2  0.0000      1.000 0.000 1.000
#> GSM1179025     2  0.0000      1.000 0.000 1.000
#> GSM1179027     1  0.0672      0.993 0.992 0.008
#> GSM1179011     1  0.0672      0.993 0.992 0.008
#> GSM1179023     1  0.0000      0.999 1.000 0.000
#> GSM1179029     1  0.0000      0.999 1.000 0.000
#> GSM1179034     1  0.0000      0.999 1.000 0.000
#> GSM1179040     2  0.0000      1.000 0.000 1.000
#> GSM1178988     1  0.0000      0.999 1.000 0.000
#> GSM1179037     1  0.0000      0.999 1.000 0.000

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>            class entropy silhouette    p1 p2    p3
#> GSM1178971     3  0.4002      0.821 0.160  0 0.840
#> GSM1178979     2  0.0000      1.000 0.000  1 0.000
#> GSM1179009     3  0.0000      0.981 0.000  0 1.000
#> GSM1179031     2  0.0000      1.000 0.000  1 0.000
#> GSM1178970     3  0.0000      0.981 0.000  0 1.000
#> GSM1178972     2  0.0000      1.000 0.000  1 0.000
#> GSM1178973     3  0.0000      0.981 0.000  0 1.000
#> GSM1178974     2  0.0000      1.000 0.000  1 0.000
#> GSM1178977     3  0.0000      0.981 0.000  0 1.000
#> GSM1178978     1  0.0000      0.989 1.000  0 0.000
#> GSM1178998     1  0.0000      0.989 1.000  0 0.000
#> GSM1179010     1  0.4121      0.756 0.832  0 0.168
#> GSM1179018     3  0.0000      0.981 0.000  0 1.000
#> GSM1179024     1  0.0000      0.989 1.000  0 0.000
#> GSM1178984     3  0.4002      0.821 0.160  0 0.840
#> GSM1178990     1  0.0000      0.989 1.000  0 0.000
#> GSM1178991     3  0.0000      0.981 0.000  0 1.000
#> GSM1178994     1  0.0000      0.989 1.000  0 0.000
#> GSM1178997     3  0.0000      0.981 0.000  0 1.000
#> GSM1179000     3  0.0000      0.981 0.000  0 1.000
#> GSM1179013     1  0.0000      0.989 1.000  0 0.000
#> GSM1179014     1  0.0237      0.984 0.996  0 0.004
#> GSM1179019     1  0.0000      0.989 1.000  0 0.000
#> GSM1179020     1  0.0000      0.989 1.000  0 0.000
#> GSM1179022     1  0.0000      0.989 1.000  0 0.000
#> GSM1179028     2  0.0000      1.000 0.000  1 0.000
#> GSM1179032     1  0.0000      0.989 1.000  0 0.000
#> GSM1179041     2  0.0000      1.000 0.000  1 0.000
#> GSM1179042     2  0.0000      1.000 0.000  1 0.000
#> GSM1178976     3  0.0000      0.981 0.000  0 1.000
#> GSM1178981     3  0.0000      0.981 0.000  0 1.000
#> GSM1178982     3  0.0000      0.981 0.000  0 1.000
#> GSM1178983     3  0.0000      0.981 0.000  0 1.000
#> GSM1178985     3  0.0000      0.981 0.000  0 1.000
#> GSM1178992     3  0.4002      0.821 0.160  0 0.840
#> GSM1179005     3  0.4002      0.821 0.160  0 0.840
#> GSM1179007     1  0.0000      0.989 1.000  0 0.000
#> GSM1179012     1  0.0000      0.989 1.000  0 0.000
#> GSM1179016     1  0.0000      0.989 1.000  0 0.000
#> GSM1179030     3  0.0000      0.981 0.000  0 1.000
#> GSM1179038     3  0.0000      0.981 0.000  0 1.000
#> GSM1178987     3  0.0000      0.981 0.000  0 1.000
#> GSM1179003     3  0.0000      0.981 0.000  0 1.000
#> GSM1179004     3  0.0000      0.981 0.000  0 1.000
#> GSM1179039     2  0.0000      1.000 0.000  1 0.000
#> GSM1178975     3  0.0000      0.981 0.000  0 1.000
#> GSM1178980     3  0.0000      0.981 0.000  0 1.000
#> GSM1178995     3  0.0000      0.981 0.000  0 1.000
#> GSM1178996     3  0.0000      0.981 0.000  0 1.000
#> GSM1179001     1  0.0000      0.989 1.000  0 0.000
#> GSM1179002     1  0.0000      0.989 1.000  0 0.000
#> GSM1179006     3  0.0000      0.981 0.000  0 1.000
#> GSM1179008     1  0.0000      0.989 1.000  0 0.000
#> GSM1179015     1  0.0000      0.989 1.000  0 0.000
#> GSM1179017     3  0.0000      0.981 0.000  0 1.000
#> GSM1179026     3  0.0000      0.981 0.000  0 1.000
#> GSM1179033     3  0.0000      0.981 0.000  0 1.000
#> GSM1179035     3  0.0000      0.981 0.000  0 1.000
#> GSM1179036     3  0.0000      0.981 0.000  0 1.000
#> GSM1178986     3  0.0000      0.981 0.000  0 1.000
#> GSM1178989     3  0.0000      0.981 0.000  0 1.000
#> GSM1178993     3  0.0000      0.981 0.000  0 1.000
#> GSM1178999     2  0.0000      1.000 0.000  1 0.000
#> GSM1179021     2  0.0000      1.000 0.000  1 0.000
#> GSM1179025     2  0.0000      1.000 0.000  1 0.000
#> GSM1179027     3  0.0000      0.981 0.000  0 1.000
#> GSM1179011     3  0.0000      0.981 0.000  0 1.000
#> GSM1179023     1  0.0000      0.989 1.000  0 0.000
#> GSM1179029     1  0.0000      0.989 1.000  0 0.000
#> GSM1179034     1  0.0000      0.989 1.000  0 0.000
#> GSM1179040     2  0.0000      1.000 0.000  1 0.000
#> GSM1178988     3  0.0000      0.981 0.000  0 1.000
#> GSM1179037     3  0.0000      0.981 0.000  0 1.000

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>            class entropy silhouette    p1    p2    p3    p4
#> GSM1178971     3  0.5948      0.678 0.160 0.000 0.696 0.144
#> GSM1178979     4  0.2973      0.779 0.000 0.144 0.000 0.856
#> GSM1179009     3  0.2868      0.853 0.000 0.000 0.864 0.136
#> GSM1179031     2  0.0000      0.997 0.000 1.000 0.000 0.000
#> GSM1178970     3  0.0000      0.915 0.000 0.000 1.000 0.000
#> GSM1178972     2  0.0707      0.980 0.000 0.980 0.000 0.020
#> GSM1178973     3  0.0000      0.915 0.000 0.000 1.000 0.000
#> GSM1178974     2  0.0000      0.997 0.000 1.000 0.000 0.000
#> GSM1178977     3  0.0000      0.915 0.000 0.000 1.000 0.000
#> GSM1178978     1  0.2973      0.907 0.856 0.000 0.000 0.144
#> GSM1178998     1  0.0000      0.911 1.000 0.000 0.000 0.000
#> GSM1179010     1  0.3591      0.723 0.824 0.000 0.168 0.008
#> GSM1179018     3  0.0000      0.915 0.000 0.000 1.000 0.000
#> GSM1179024     1  0.1118      0.912 0.964 0.000 0.000 0.036
#> GSM1178984     3  0.5948      0.678 0.160 0.000 0.696 0.144
#> GSM1178990     1  0.2973      0.907 0.856 0.000 0.000 0.144
#> GSM1178991     3  0.2973      0.848 0.000 0.000 0.856 0.144
#> GSM1178994     1  0.2973      0.907 0.856 0.000 0.000 0.144
#> GSM1178997     3  0.0000      0.915 0.000 0.000 1.000 0.000
#> GSM1179000     3  0.2973      0.848 0.000 0.000 0.856 0.144
#> GSM1179013     1  0.0000      0.911 1.000 0.000 0.000 0.000
#> GSM1179014     1  0.3157      0.904 0.852 0.000 0.004 0.144
#> GSM1179019     1  0.2973      0.907 0.856 0.000 0.000 0.144
#> GSM1179020     1  0.2973      0.907 0.856 0.000 0.000 0.144
#> GSM1179022     1  0.0000      0.911 1.000 0.000 0.000 0.000
#> GSM1179028     2  0.0000      0.997 0.000 1.000 0.000 0.000
#> GSM1179032     1  0.0000      0.911 1.000 0.000 0.000 0.000
#> GSM1179041     2  0.0000      0.997 0.000 1.000 0.000 0.000
#> GSM1179042     2  0.0000      0.997 0.000 1.000 0.000 0.000
#> GSM1178976     3  0.0000      0.915 0.000 0.000 1.000 0.000
#> GSM1178981     3  0.2973      0.848 0.000 0.000 0.856 0.144
#> GSM1178982     3  0.0000      0.915 0.000 0.000 1.000 0.000
#> GSM1178983     3  0.0000      0.915 0.000 0.000 1.000 0.000
#> GSM1178985     3  0.0000      0.915 0.000 0.000 1.000 0.000
#> GSM1178992     3  0.5948      0.678 0.160 0.000 0.696 0.144
#> GSM1179005     3  0.5948      0.678 0.160 0.000 0.696 0.144
#> GSM1179007     1  0.2973      0.907 0.856 0.000 0.000 0.144
#> GSM1179012     1  0.0000      0.911 1.000 0.000 0.000 0.000
#> GSM1179016     1  0.2973      0.907 0.856 0.000 0.000 0.144
#> GSM1179030     3  0.0000      0.915 0.000 0.000 1.000 0.000
#> GSM1179038     3  0.0000      0.915 0.000 0.000 1.000 0.000
#> GSM1178987     3  0.2973      0.848 0.000 0.000 0.856 0.144
#> GSM1179003     4  0.2973      0.820 0.000 0.000 0.144 0.856
#> GSM1179004     3  0.2868      0.853 0.000 0.000 0.864 0.136
#> GSM1179039     2  0.0000      0.997 0.000 1.000 0.000 0.000
#> GSM1178975     3  0.0000      0.915 0.000 0.000 1.000 0.000
#> GSM1178980     4  0.2973      0.820 0.000 0.000 0.144 0.856
#> GSM1178995     3  0.2216      0.876 0.000 0.000 0.908 0.092
#> GSM1178996     3  0.0000      0.915 0.000 0.000 1.000 0.000
#> GSM1179001     1  0.0000      0.911 1.000 0.000 0.000 0.000
#> GSM1179002     1  0.2973      0.907 0.856 0.000 0.000 0.144
#> GSM1179006     3  0.0469      0.911 0.000 0.000 0.988 0.012
#> GSM1179008     1  0.2973      0.907 0.856 0.000 0.000 0.144
#> GSM1179015     1  0.0000      0.911 1.000 0.000 0.000 0.000
#> GSM1179017     3  0.0000      0.915 0.000 0.000 1.000 0.000
#> GSM1179026     3  0.0000      0.915 0.000 0.000 1.000 0.000
#> GSM1179033     3  0.0000      0.915 0.000 0.000 1.000 0.000
#> GSM1179035     3  0.0000      0.915 0.000 0.000 1.000 0.000
#> GSM1179036     3  0.0000      0.915 0.000 0.000 1.000 0.000
#> GSM1178986     3  0.2973      0.848 0.000 0.000 0.856 0.144
#> GSM1178989     3  0.0000      0.915 0.000 0.000 1.000 0.000
#> GSM1178993     4  0.4103      0.731 0.000 0.000 0.256 0.744
#> GSM1178999     4  0.2973      0.779 0.000 0.144 0.000 0.856
#> GSM1179021     4  0.3024      0.777 0.000 0.148 0.000 0.852
#> GSM1179025     2  0.0000      0.997 0.000 1.000 0.000 0.000
#> GSM1179027     4  0.3123      0.815 0.000 0.000 0.156 0.844
#> GSM1179011     4  0.4543      0.647 0.000 0.000 0.324 0.676
#> GSM1179023     1  0.0000      0.911 1.000 0.000 0.000 0.000
#> GSM1179029     1  0.0000      0.911 1.000 0.000 0.000 0.000
#> GSM1179034     1  0.0000      0.911 1.000 0.000 0.000 0.000
#> GSM1179040     4  0.2973      0.779 0.000 0.144 0.000 0.856
#> GSM1178988     3  0.0000      0.915 0.000 0.000 1.000 0.000
#> GSM1179037     3  0.0000      0.915 0.000 0.000 1.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
#> GSM1178971     1  0.0000      0.961 1.000 0.000 0.000 0.000 0.000
#> GSM1178979     4  0.0000      0.894 0.000 0.000 0.000 1.000 0.000
#> GSM1179009     3  0.3857      0.549 0.312 0.000 0.688 0.000 0.000
#> GSM1179031     2  0.0000      0.995 0.000 1.000 0.000 0.000 0.000
#> GSM1178970     3  0.0000      0.967 0.000 0.000 1.000 0.000 0.000
#> GSM1178972     2  0.1043      0.962 0.000 0.960 0.000 0.040 0.000
#> GSM1178973     3  0.0000      0.967 0.000 0.000 1.000 0.000 0.000
#> GSM1178974     2  0.0000      0.995 0.000 1.000 0.000 0.000 0.000
#> GSM1178977     3  0.0000      0.967 0.000 0.000 1.000 0.000 0.000
#> GSM1178978     1  0.0000      0.961 1.000 0.000 0.000 0.000 0.000
#> GSM1178998     5  0.0000      0.995 0.000 0.000 0.000 0.000 1.000
#> GSM1179010     1  0.3730      0.586 0.712 0.000 0.000 0.000 0.288
#> GSM1179018     3  0.0000      0.967 0.000 0.000 1.000 0.000 0.000
#> GSM1179024     5  0.0963      0.952 0.036 0.000 0.000 0.000 0.964
#> GSM1178984     1  0.0000      0.961 1.000 0.000 0.000 0.000 0.000
#> GSM1178990     1  0.0000      0.961 1.000 0.000 0.000 0.000 0.000
#> GSM1178991     1  0.0404      0.953 0.988 0.000 0.012 0.000 0.000
#> GSM1178994     1  0.0000      0.961 1.000 0.000 0.000 0.000 0.000
#> GSM1178997     3  0.0000      0.967 0.000 0.000 1.000 0.000 0.000
#> GSM1179000     1  0.0703      0.943 0.976 0.000 0.024 0.000 0.000
#> GSM1179013     5  0.0000      0.995 0.000 0.000 0.000 0.000 1.000
#> GSM1179014     1  0.0000      0.961 1.000 0.000 0.000 0.000 0.000
#> GSM1179019     1  0.0510      0.952 0.984 0.000 0.000 0.000 0.016
#> GSM1179020     1  0.0609      0.949 0.980 0.000 0.000 0.000 0.020
#> GSM1179022     5  0.0000      0.995 0.000 0.000 0.000 0.000 1.000
#> GSM1179028     2  0.0000      0.995 0.000 1.000 0.000 0.000 0.000
#> GSM1179032     5  0.0000      0.995 0.000 0.000 0.000 0.000 1.000
#> GSM1179041     2  0.0000      0.995 0.000 1.000 0.000 0.000 0.000
#> GSM1179042     2  0.0000      0.995 0.000 1.000 0.000 0.000 0.000
#> GSM1178976     3  0.0000      0.967 0.000 0.000 1.000 0.000 0.000
#> GSM1178981     1  0.0000      0.961 1.000 0.000 0.000 0.000 0.000
#> GSM1178982     3  0.0000      0.967 0.000 0.000 1.000 0.000 0.000
#> GSM1178983     3  0.0000      0.967 0.000 0.000 1.000 0.000 0.000
#> GSM1178985     3  0.0000      0.967 0.000 0.000 1.000 0.000 0.000
#> GSM1178992     1  0.0000      0.961 1.000 0.000 0.000 0.000 0.000
#> GSM1179005     1  0.0000      0.961 1.000 0.000 0.000 0.000 0.000
#> GSM1179007     1  0.0000      0.961 1.000 0.000 0.000 0.000 0.000
#> GSM1179012     5  0.0000      0.995 0.000 0.000 0.000 0.000 1.000
#> GSM1179016     1  0.0000      0.961 1.000 0.000 0.000 0.000 0.000
#> GSM1179030     3  0.0000      0.967 0.000 0.000 1.000 0.000 0.000
#> GSM1179038     3  0.0000      0.967 0.000 0.000 1.000 0.000 0.000
#> GSM1178987     1  0.0794      0.939 0.972 0.000 0.028 0.000 0.000
#> GSM1179003     4  0.0000      0.894 0.000 0.000 0.000 1.000 0.000
#> GSM1179004     1  0.3661      0.600 0.724 0.000 0.276 0.000 0.000
#> GSM1179039     2  0.0000      0.995 0.000 1.000 0.000 0.000 0.000
#> GSM1178975     3  0.0000      0.967 0.000 0.000 1.000 0.000 0.000
#> GSM1178980     4  0.0000      0.894 0.000 0.000 0.000 1.000 0.000
#> GSM1178995     3  0.3586      0.622 0.264 0.000 0.736 0.000 0.000
#> GSM1178996     3  0.0000      0.967 0.000 0.000 1.000 0.000 0.000
#> GSM1179001     5  0.0000      0.995 0.000 0.000 0.000 0.000 1.000
#> GSM1179002     1  0.0000      0.961 1.000 0.000 0.000 0.000 0.000
#> GSM1179006     3  0.0609      0.946 0.020 0.000 0.980 0.000 0.000
#> GSM1179008     1  0.0000      0.961 1.000 0.000 0.000 0.000 0.000
#> GSM1179015     5  0.0000      0.995 0.000 0.000 0.000 0.000 1.000
#> GSM1179017     3  0.0000      0.967 0.000 0.000 1.000 0.000 0.000
#> GSM1179026     3  0.0000      0.967 0.000 0.000 1.000 0.000 0.000
#> GSM1179033     3  0.0000      0.967 0.000 0.000 1.000 0.000 0.000
#> GSM1179035     3  0.0000      0.967 0.000 0.000 1.000 0.000 0.000
#> GSM1179036     3  0.0000      0.967 0.000 0.000 1.000 0.000 0.000
#> GSM1178986     1  0.0000      0.961 1.000 0.000 0.000 0.000 0.000
#> GSM1178989     3  0.0000      0.967 0.000 0.000 1.000 0.000 0.000
#> GSM1178993     4  0.3534      0.672 0.000 0.000 0.256 0.744 0.000
#> GSM1178999     4  0.0000      0.894 0.000 0.000 0.000 1.000 0.000
#> GSM1179021     4  0.0290      0.890 0.000 0.008 0.000 0.992 0.000
#> GSM1179025     2  0.0000      0.995 0.000 1.000 0.000 0.000 0.000
#> GSM1179027     4  0.0703      0.881 0.000 0.000 0.024 0.976 0.000
#> GSM1179011     4  0.3913      0.583 0.000 0.000 0.324 0.676 0.000
#> GSM1179023     5  0.0000      0.995 0.000 0.000 0.000 0.000 1.000
#> GSM1179029     5  0.0000      0.995 0.000 0.000 0.000 0.000 1.000
#> GSM1179034     5  0.0000      0.995 0.000 0.000 0.000 0.000 1.000
#> GSM1179040     4  0.0000      0.894 0.000 0.000 0.000 1.000 0.000
#> GSM1178988     3  0.0000      0.967 0.000 0.000 1.000 0.000 0.000
#> GSM1179037     3  0.0000      0.967 0.000 0.000 1.000 0.000 0.000

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>            class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM1178971     6  0.0547     0.9356 0.000 0.000 0.000 0.020 0.000 0.980
#> GSM1178979     5  0.0000     0.9142 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM1179009     3  0.3464     0.5425 0.000 0.000 0.688 0.000 0.000 0.312
#> GSM1179031     2  0.0000     0.9259 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1178970     3  0.3076     0.6684 0.000 0.000 0.760 0.000 0.240 0.000
#> GSM1178972     5  0.3151     0.6192 0.000 0.252 0.000 0.000 0.748 0.000
#> GSM1178973     3  0.2912     0.7068 0.000 0.000 0.784 0.216 0.000 0.000
#> GSM1178974     2  0.0000     0.9259 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1178977     3  0.0000     0.9433 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1178978     6  0.0632     0.9348 0.000 0.000 0.000 0.024 0.000 0.976
#> GSM1178998     1  0.0000     0.9895 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1179010     6  0.3351     0.5761 0.288 0.000 0.000 0.000 0.000 0.712
#> GSM1179018     3  0.0000     0.9433 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1179024     1  0.1492     0.9253 0.940 0.000 0.000 0.024 0.000 0.036
#> GSM1178984     6  0.0000     0.9370 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM1178990     6  0.0000     0.9370 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM1178991     6  0.3076     0.7097 0.000 0.000 0.000 0.240 0.000 0.760
#> GSM1178994     6  0.0000     0.9370 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM1178997     3  0.0000     0.9433 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1179000     6  0.1257     0.9217 0.000 0.000 0.028 0.020 0.000 0.952
#> GSM1179013     1  0.0000     0.9895 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1179014     6  0.0632     0.9348 0.000 0.000 0.000 0.024 0.000 0.976
#> GSM1179019     6  0.1088     0.9290 0.016 0.000 0.000 0.024 0.000 0.960
#> GSM1179020     6  0.1176     0.9267 0.020 0.000 0.000 0.024 0.000 0.956
#> GSM1179022     1  0.0000     0.9895 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1179028     2  0.0000     0.9259 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1179032     1  0.0000     0.9895 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1179041     2  0.0000     0.9259 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1179042     2  0.0000     0.9259 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1178976     3  0.0000     0.9433 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1178981     6  0.0632     0.9276 0.000 0.000 0.024 0.000 0.000 0.976
#> GSM1178982     3  0.0000     0.9433 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1178983     3  0.0000     0.9433 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1178985     3  0.0000     0.9433 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1178992     6  0.0000     0.9370 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM1179005     6  0.0000     0.9370 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM1179007     6  0.0000     0.9370 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM1179012     1  0.0000     0.9895 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1179016     6  0.0632     0.9348 0.000 0.000 0.000 0.024 0.000 0.976
#> GSM1179030     3  0.0000     0.9433 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1179038     3  0.0000     0.9433 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1178987     6  0.1141     0.9032 0.000 0.000 0.052 0.000 0.000 0.948
#> GSM1179003     5  0.0000     0.9142 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM1179004     6  0.3390     0.5598 0.000 0.000 0.296 0.000 0.000 0.704
#> GSM1179039     2  0.0000     0.9259 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1178975     4  0.0632     0.8962 0.000 0.000 0.024 0.976 0.000 0.000
#> GSM1178980     4  0.0632     0.9241 0.000 0.000 0.000 0.976 0.024 0.000
#> GSM1178995     3  0.3221     0.6161 0.000 0.000 0.736 0.000 0.000 0.264
#> GSM1178996     3  0.0000     0.9433 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1179001     1  0.0632     0.9698 0.976 0.000 0.000 0.000 0.000 0.024
#> GSM1179002     6  0.0000     0.9370 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM1179006     3  0.0547     0.9258 0.000 0.000 0.980 0.000 0.000 0.020
#> GSM1179008     6  0.0000     0.9370 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM1179015     1  0.0000     0.9895 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1179017     3  0.0146     0.9406 0.000 0.000 0.996 0.000 0.004 0.000
#> GSM1179026     3  0.0000     0.9433 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1179033     3  0.0000     0.9433 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1179035     3  0.0000     0.9433 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1179036     3  0.0000     0.9433 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1178986     6  0.0692     0.9353 0.000 0.000 0.004 0.020 0.000 0.976
#> GSM1178989     3  0.0000     0.9433 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1178993     4  0.0632     0.9241 0.000 0.000 0.000 0.976 0.024 0.000
#> GSM1178999     5  0.0000     0.9142 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM1179021     2  0.3862     0.0751 0.000 0.524 0.000 0.000 0.476 0.000
#> GSM1179025     2  0.0000     0.9259 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1179027     4  0.3076     0.6851 0.000 0.000 0.000 0.760 0.240 0.000
#> GSM1179011     4  0.0632     0.9241 0.000 0.000 0.000 0.976 0.024 0.000
#> GSM1179023     1  0.0000     0.9895 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1179029     1  0.0146     0.9870 0.996 0.000 0.000 0.004 0.000 0.000
#> GSM1179034     1  0.0000     0.9895 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1179040     5  0.0363     0.9063 0.000 0.000 0.000 0.012 0.988 0.000
#> GSM1178988     3  0.0000     0.9433 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1179037     3  0.0000     0.9433 0.000 0.000 1.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) protocol(p) k
#> ATC:pam 73           0.3086    1.41e-02 2
#> ATC:pam 73           0.2633    5.02e-03 3
#> ATC:pam 73           0.0186    1.89e-04 4
#> ATC:pam 73           0.0115    7.46e-06 5
#> ATC:pam 72           0.1209    2.05e-04 6

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


ATC: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 31632 rows and 73 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.941           0.954       0.977         0.4747 0.521   0.521
#> 3 3 1.000           0.972       0.980        -0.0892 0.747   0.624
#> 4 4 0.694           0.849       0.898         0.2224 0.924   0.868
#> 5 5 0.553           0.443       0.703         0.3003 0.759   0.519
#> 6 6 0.535           0.574       0.724         0.0719 0.785   0.410

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
#> GSM1178971     1  0.0000      0.987 1.000 0.000
#> GSM1178979     2  0.0000      0.959 0.000 1.000
#> GSM1179009     2  0.8386      0.671 0.268 0.732
#> GSM1179031     2  0.0000      0.959 0.000 1.000
#> GSM1178970     2  0.0000      0.959 0.000 1.000
#> GSM1178972     2  0.0000      0.959 0.000 1.000
#> GSM1178973     2  0.0000      0.959 0.000 1.000
#> GSM1178974     2  0.0000      0.959 0.000 1.000
#> GSM1178977     1  0.7815      0.710 0.768 0.232
#> GSM1178978     1  0.0000      0.987 1.000 0.000
#> GSM1178998     1  0.0000      0.987 1.000 0.000
#> GSM1179010     1  0.0000      0.987 1.000 0.000
#> GSM1179018     1  0.1414      0.972 0.980 0.020
#> GSM1179024     1  0.3274      0.936 0.940 0.060
#> GSM1178984     1  0.0000      0.987 1.000 0.000
#> GSM1178990     1  0.0000      0.987 1.000 0.000
#> GSM1178991     2  0.5737      0.852 0.136 0.864
#> GSM1178994     1  0.0000      0.987 1.000 0.000
#> GSM1178997     1  0.1414      0.972 0.980 0.020
#> GSM1179000     1  0.0376      0.984 0.996 0.004
#> GSM1179013     1  0.0000      0.987 1.000 0.000
#> GSM1179014     1  0.3584      0.928 0.932 0.068
#> GSM1179019     1  0.0000      0.987 1.000 0.000
#> GSM1179020     1  0.0000      0.987 1.000 0.000
#> GSM1179022     1  0.0000      0.987 1.000 0.000
#> GSM1179028     2  0.0000      0.959 0.000 1.000
#> GSM1179032     1  0.0000      0.987 1.000 0.000
#> GSM1179041     2  0.0000      0.959 0.000 1.000
#> GSM1179042     2  0.0000      0.959 0.000 1.000
#> GSM1178976     2  0.0000      0.959 0.000 1.000
#> GSM1178981     1  0.0000      0.987 1.000 0.000
#> GSM1178982     1  0.0000      0.987 1.000 0.000
#> GSM1178983     2  0.4298      0.896 0.088 0.912
#> GSM1178985     1  0.0000      0.987 1.000 0.000
#> GSM1178992     1  0.0000      0.987 1.000 0.000
#> GSM1179005     1  0.0000      0.987 1.000 0.000
#> GSM1179007     1  0.0000      0.987 1.000 0.000
#> GSM1179012     1  0.0000      0.987 1.000 0.000
#> GSM1179016     2  0.9000      0.581 0.316 0.684
#> GSM1179030     2  0.5519      0.862 0.128 0.872
#> GSM1179038     1  0.3274      0.936 0.940 0.060
#> GSM1178987     1  0.0000      0.987 1.000 0.000
#> GSM1179003     2  0.0000      0.959 0.000 1.000
#> GSM1179004     1  0.0000      0.987 1.000 0.000
#> GSM1179039     2  0.0000      0.959 0.000 1.000
#> GSM1178975     2  0.0000      0.959 0.000 1.000
#> GSM1178980     2  0.0000      0.959 0.000 1.000
#> GSM1178995     1  0.0000      0.987 1.000 0.000
#> GSM1178996     1  0.0000      0.987 1.000 0.000
#> GSM1179001     1  0.0000      0.987 1.000 0.000
#> GSM1179002     1  0.0000      0.987 1.000 0.000
#> GSM1179006     1  0.0000      0.987 1.000 0.000
#> GSM1179008     1  0.0000      0.987 1.000 0.000
#> GSM1179015     1  0.0376      0.984 0.996 0.004
#> GSM1179017     2  0.5842      0.848 0.140 0.860
#> GSM1179026     1  0.0000      0.987 1.000 0.000
#> GSM1179033     1  0.0000      0.987 1.000 0.000
#> GSM1179035     1  0.0000      0.987 1.000 0.000
#> GSM1179036     1  0.0000      0.987 1.000 0.000
#> GSM1178986     1  0.2236      0.959 0.964 0.036
#> GSM1178989     2  0.0000      0.959 0.000 1.000
#> GSM1178993     2  0.0000      0.959 0.000 1.000
#> GSM1178999     2  0.0000      0.959 0.000 1.000
#> GSM1179021     2  0.0000      0.959 0.000 1.000
#> GSM1179025     2  0.0000      0.959 0.000 1.000
#> GSM1179027     2  0.0000      0.959 0.000 1.000
#> GSM1179011     2  0.0000      0.959 0.000 1.000
#> GSM1179023     1  0.0000      0.987 1.000 0.000
#> GSM1179029     1  0.3431      0.932 0.936 0.064
#> GSM1179034     1  0.0376      0.984 0.996 0.004
#> GSM1179040     2  0.0000      0.959 0.000 1.000
#> GSM1178988     1  0.0000      0.987 1.000 0.000
#> GSM1179037     1  0.0000      0.987 1.000 0.000

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>            class entropy silhouette    p1    p2    p3
#> GSM1178971     1  0.0000      0.987 1.000 0.000 0.000
#> GSM1178979     1  0.4035      0.885 0.880 0.080 0.040
#> GSM1179009     1  0.0983      0.983 0.980 0.004 0.016
#> GSM1179031     2  0.0000      0.959 0.000 1.000 0.000
#> GSM1178970     2  0.5173      0.683 0.148 0.816 0.036
#> GSM1178972     2  0.1529      0.927 0.000 0.960 0.040
#> GSM1178973     3  0.1289      0.980 0.000 0.032 0.968
#> GSM1178974     2  0.0000      0.959 0.000 1.000 0.000
#> GSM1178977     1  0.2383      0.947 0.940 0.016 0.044
#> GSM1178978     1  0.0000      0.987 1.000 0.000 0.000
#> GSM1178998     1  0.0237      0.986 0.996 0.000 0.004
#> GSM1179010     1  0.0000      0.987 1.000 0.000 0.000
#> GSM1179018     1  0.0983      0.984 0.980 0.004 0.016
#> GSM1179024     1  0.1031      0.982 0.976 0.000 0.024
#> GSM1178984     1  0.0000      0.987 1.000 0.000 0.000
#> GSM1178990     1  0.0747      0.985 0.984 0.000 0.016
#> GSM1178991     1  0.1643      0.969 0.956 0.000 0.044
#> GSM1178994     1  0.0000      0.987 1.000 0.000 0.000
#> GSM1178997     1  0.0747      0.985 0.984 0.000 0.016
#> GSM1179000     1  0.0747      0.985 0.984 0.000 0.016
#> GSM1179013     1  0.0237      0.986 0.996 0.000 0.004
#> GSM1179014     1  0.1031      0.982 0.976 0.000 0.024
#> GSM1179019     1  0.0237      0.986 0.996 0.000 0.004
#> GSM1179020     1  0.0747      0.985 0.984 0.000 0.016
#> GSM1179022     1  0.0237      0.986 0.996 0.000 0.004
#> GSM1179028     2  0.0000      0.959 0.000 1.000 0.000
#> GSM1179032     1  0.0592      0.986 0.988 0.000 0.012
#> GSM1179041     2  0.0000      0.959 0.000 1.000 0.000
#> GSM1179042     2  0.0000      0.959 0.000 1.000 0.000
#> GSM1178976     2  0.0661      0.951 0.004 0.988 0.008
#> GSM1178981     1  0.0000      0.987 1.000 0.000 0.000
#> GSM1178982     1  0.0592      0.985 0.988 0.000 0.012
#> GSM1178983     1  0.2550      0.944 0.936 0.024 0.040
#> GSM1178985     1  0.0000      0.987 1.000 0.000 0.000
#> GSM1178992     1  0.0000      0.987 1.000 0.000 0.000
#> GSM1179005     1  0.0000      0.987 1.000 0.000 0.000
#> GSM1179007     1  0.0000      0.987 1.000 0.000 0.000
#> GSM1179012     1  0.0237      0.986 0.996 0.000 0.004
#> GSM1179016     1  0.1031      0.982 0.976 0.000 0.024
#> GSM1179030     1  0.1182      0.980 0.976 0.012 0.012
#> GSM1179038     1  0.0983      0.984 0.980 0.004 0.016
#> GSM1178987     1  0.0000      0.987 1.000 0.000 0.000
#> GSM1179003     1  0.2681      0.940 0.932 0.028 0.040
#> GSM1179004     1  0.0000      0.987 1.000 0.000 0.000
#> GSM1179039     2  0.0000      0.959 0.000 1.000 0.000
#> GSM1178975     3  0.1031      0.977 0.000 0.024 0.976
#> GSM1178980     3  0.1031      0.977 0.000 0.024 0.976
#> GSM1178995     1  0.0000      0.987 1.000 0.000 0.000
#> GSM1178996     1  0.0000      0.987 1.000 0.000 0.000
#> GSM1179001     1  0.0237      0.986 0.996 0.000 0.004
#> GSM1179002     1  0.0000      0.987 1.000 0.000 0.000
#> GSM1179006     1  0.0000      0.987 1.000 0.000 0.000
#> GSM1179008     1  0.0237      0.986 0.996 0.000 0.004
#> GSM1179015     1  0.0424      0.986 0.992 0.000 0.008
#> GSM1179017     1  0.1031      0.982 0.976 0.000 0.024
#> GSM1179026     1  0.0000      0.987 1.000 0.000 0.000
#> GSM1179033     1  0.0000      0.987 1.000 0.000 0.000
#> GSM1179035     1  0.0592      0.985 0.988 0.000 0.012
#> GSM1179036     1  0.0592      0.985 0.988 0.000 0.012
#> GSM1178986     1  0.0747      0.985 0.984 0.000 0.016
#> GSM1178989     1  0.3267      0.921 0.912 0.044 0.044
#> GSM1178993     3  0.1289      0.980 0.000 0.032 0.968
#> GSM1178999     3  0.1289      0.976 0.000 0.032 0.968
#> GSM1179021     3  0.2625      0.953 0.000 0.084 0.916
#> GSM1179025     2  0.0000      0.959 0.000 1.000 0.000
#> GSM1179027     3  0.2165      0.966 0.000 0.064 0.936
#> GSM1179011     3  0.1289      0.980 0.000 0.032 0.968
#> GSM1179023     1  0.0237      0.986 0.996 0.000 0.004
#> GSM1179029     1  0.1031      0.982 0.976 0.000 0.024
#> GSM1179034     1  0.1031      0.982 0.976 0.000 0.024
#> GSM1179040     3  0.2165      0.966 0.000 0.064 0.936
#> GSM1178988     1  0.0424      0.986 0.992 0.000 0.008
#> GSM1179037     1  0.0424      0.986 0.992 0.000 0.008

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>            class entropy silhouette    p1    p2    p3    p4
#> GSM1178971     3  0.0000     0.9069 0.000 0.000 1.000 0.000
#> GSM1178979     3  0.2868     0.7908 0.136 0.000 0.864 0.000
#> GSM1179009     3  0.2345     0.8189 0.100 0.000 0.900 0.000
#> GSM1179031     2  0.0000     0.9300 0.000 1.000 0.000 0.000
#> GSM1178970     2  0.5204     0.5994 0.088 0.752 0.160 0.000
#> GSM1178972     2  0.2149     0.8972 0.088 0.912 0.000 0.000
#> GSM1178973     4  0.0000     0.9787 0.000 0.000 0.000 1.000
#> GSM1178974     2  0.2149     0.8972 0.088 0.912 0.000 0.000
#> GSM1178977     3  0.0000     0.9069 0.000 0.000 1.000 0.000
#> GSM1178978     3  0.0336     0.9061 0.008 0.000 0.992 0.000
#> GSM1178998     3  0.0921     0.9016 0.028 0.000 0.972 0.000
#> GSM1179010     3  0.0188     0.9066 0.004 0.000 0.996 0.000
#> GSM1179018     3  0.1022     0.8944 0.032 0.000 0.968 0.000
#> GSM1179024     3  0.3688     0.7618 0.208 0.000 0.792 0.000
#> GSM1178984     3  0.0000     0.9069 0.000 0.000 1.000 0.000
#> GSM1178990     3  0.2921     0.8243 0.140 0.000 0.860 0.000
#> GSM1178991     1  0.5478     0.1958 0.540 0.000 0.444 0.016
#> GSM1178994     3  0.0000     0.9069 0.000 0.000 1.000 0.000
#> GSM1178997     3  0.1211     0.8897 0.040 0.000 0.960 0.000
#> GSM1179000     3  0.1022     0.9011 0.032 0.000 0.968 0.000
#> GSM1179013     3  0.3074     0.8144 0.152 0.000 0.848 0.000
#> GSM1179014     1  0.3837     0.6388 0.776 0.000 0.224 0.000
#> GSM1179019     3  0.0469     0.9053 0.012 0.000 0.988 0.000
#> GSM1179020     3  0.3400     0.7943 0.180 0.000 0.820 0.000
#> GSM1179022     3  0.3074     0.8144 0.152 0.000 0.848 0.000
#> GSM1179028     2  0.0000     0.9300 0.000 1.000 0.000 0.000
#> GSM1179032     3  0.3074     0.8144 0.152 0.000 0.848 0.000
#> GSM1179041     2  0.0000     0.9300 0.000 1.000 0.000 0.000
#> GSM1179042     2  0.0000     0.9300 0.000 1.000 0.000 0.000
#> GSM1178976     2  0.2149     0.8972 0.088 0.912 0.000 0.000
#> GSM1178981     3  0.0000     0.9069 0.000 0.000 1.000 0.000
#> GSM1178982     3  0.0188     0.9061 0.004 0.000 0.996 0.000
#> GSM1178983     3  0.1389     0.8852 0.048 0.000 0.952 0.000
#> GSM1178985     3  0.0000     0.9069 0.000 0.000 1.000 0.000
#> GSM1178992     3  0.2921     0.8243 0.140 0.000 0.860 0.000
#> GSM1179005     3  0.0000     0.9069 0.000 0.000 1.000 0.000
#> GSM1179007     3  0.0000     0.9069 0.000 0.000 1.000 0.000
#> GSM1179012     3  0.3074     0.8144 0.152 0.000 0.848 0.000
#> GSM1179016     1  0.2530     0.5956 0.888 0.000 0.112 0.000
#> GSM1179030     3  0.1389     0.8853 0.048 0.000 0.952 0.000
#> GSM1179038     3  0.3024     0.8302 0.148 0.000 0.852 0.000
#> GSM1178987     3  0.0000     0.9069 0.000 0.000 1.000 0.000
#> GSM1179003     3  0.2868     0.7908 0.136 0.000 0.864 0.000
#> GSM1179004     3  0.0000     0.9069 0.000 0.000 1.000 0.000
#> GSM1179039     2  0.0000     0.9300 0.000 1.000 0.000 0.000
#> GSM1178975     4  0.0000     0.9787 0.000 0.000 0.000 1.000
#> GSM1178980     4  0.0000     0.9787 0.000 0.000 0.000 1.000
#> GSM1178995     3  0.0000     0.9069 0.000 0.000 1.000 0.000
#> GSM1178996     3  0.0000     0.9069 0.000 0.000 1.000 0.000
#> GSM1179001     3  0.2589     0.8463 0.116 0.000 0.884 0.000
#> GSM1179002     3  0.0336     0.9061 0.008 0.000 0.992 0.000
#> GSM1179006     3  0.0000     0.9069 0.000 0.000 1.000 0.000
#> GSM1179008     3  0.0469     0.9056 0.012 0.000 0.988 0.000
#> GSM1179015     3  0.3074     0.8144 0.152 0.000 0.848 0.000
#> GSM1179017     1  0.0469     0.4735 0.988 0.000 0.012 0.000
#> GSM1179026     3  0.0188     0.9069 0.004 0.000 0.996 0.000
#> GSM1179033     3  0.0000     0.9069 0.000 0.000 1.000 0.000
#> GSM1179035     3  0.0000     0.9069 0.000 0.000 1.000 0.000
#> GSM1179036     3  0.0707     0.9001 0.020 0.000 0.980 0.000
#> GSM1178986     3  0.3486     0.7872 0.188 0.000 0.812 0.000
#> GSM1178989     3  0.3149     0.7917 0.088 0.032 0.880 0.000
#> GSM1178993     4  0.0000     0.9787 0.000 0.000 0.000 1.000
#> GSM1178999     4  0.2149     0.9020 0.088 0.000 0.000 0.912
#> GSM1179021     4  0.1637     0.9322 0.060 0.000 0.000 0.940
#> GSM1179025     2  0.0000     0.9300 0.000 1.000 0.000 0.000
#> GSM1179027     4  0.0000     0.9787 0.000 0.000 0.000 1.000
#> GSM1179011     4  0.0000     0.9787 0.000 0.000 0.000 1.000
#> GSM1179023     3  0.3074     0.8144 0.152 0.000 0.848 0.000
#> GSM1179029     3  0.4977    -0.0331 0.460 0.000 0.540 0.000
#> GSM1179034     3  0.3400     0.7943 0.180 0.000 0.820 0.000
#> GSM1179040     4  0.0000     0.9787 0.000 0.000 0.000 1.000
#> GSM1178988     3  0.0000     0.9069 0.000 0.000 1.000 0.000
#> GSM1179037     3  0.0000     0.9069 0.000 0.000 1.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
#> GSM1178971     3  0.4138    0.51031 0.384 0.000 0.616 0.000 0.000
#> GSM1178979     3  0.3877    0.16943 0.024 0.000 0.764 0.000 0.212
#> GSM1179009     3  0.6589    0.36655 0.364 0.000 0.424 0.000 0.212
#> GSM1179031     2  0.0000    0.87055 0.000 1.000 0.000 0.000 0.000
#> GSM1178970     2  0.5537    0.63286 0.036 0.684 0.068 0.000 0.212
#> GSM1178972     2  0.3109    0.78254 0.000 0.800 0.000 0.000 0.200
#> GSM1178973     4  0.0000    0.93500 0.000 0.000 0.000 1.000 0.000
#> GSM1178974     2  0.3210    0.77228 0.000 0.788 0.000 0.000 0.212
#> GSM1178977     1  0.4440   -0.07780 0.528 0.000 0.468 0.000 0.004
#> GSM1178978     3  0.4227    0.46615 0.420 0.000 0.580 0.000 0.000
#> GSM1178998     1  0.4046    0.19873 0.696 0.000 0.296 0.000 0.008
#> GSM1179010     3  0.4210    0.47999 0.412 0.000 0.588 0.000 0.000
#> GSM1179018     3  0.3999    0.22069 0.344 0.000 0.656 0.000 0.000
#> GSM1179024     1  0.3276    0.40901 0.836 0.000 0.132 0.000 0.032
#> GSM1178984     3  0.4101    0.51633 0.372 0.000 0.628 0.000 0.000
#> GSM1178990     1  0.1197    0.50288 0.952 0.000 0.048 0.000 0.000
#> GSM1178991     5  0.6599    0.52107 0.272 0.000 0.264 0.000 0.464
#> GSM1178994     3  0.4341    0.47481 0.404 0.000 0.592 0.000 0.004
#> GSM1178997     3  0.4273    0.11411 0.448 0.000 0.552 0.000 0.000
#> GSM1179000     1  0.4219    0.01974 0.584 0.000 0.416 0.000 0.000
#> GSM1179013     1  0.0451    0.50884 0.988 0.000 0.004 0.000 0.008
#> GSM1179014     5  0.3115    0.65910 0.112 0.000 0.036 0.000 0.852
#> GSM1179019     1  0.4306   -0.34498 0.508 0.000 0.492 0.000 0.000
#> GSM1179020     1  0.1410    0.49181 0.940 0.000 0.060 0.000 0.000
#> GSM1179022     1  0.1484    0.48292 0.944 0.000 0.048 0.000 0.008
#> GSM1179028     2  0.0000    0.87055 0.000 1.000 0.000 0.000 0.000
#> GSM1179032     1  0.0404    0.50876 0.988 0.000 0.012 0.000 0.000
#> GSM1179041     2  0.0000    0.87055 0.000 1.000 0.000 0.000 0.000
#> GSM1179042     2  0.0000    0.87055 0.000 1.000 0.000 0.000 0.000
#> GSM1178976     2  0.3596    0.76413 0.000 0.776 0.012 0.000 0.212
#> GSM1178981     3  0.4497    0.51840 0.352 0.000 0.632 0.000 0.016
#> GSM1178982     1  0.4306   -0.10267 0.508 0.000 0.492 0.000 0.000
#> GSM1178983     3  0.3561    0.24768 0.260 0.000 0.740 0.000 0.000
#> GSM1178985     3  0.4511    0.51706 0.356 0.000 0.628 0.000 0.016
#> GSM1178992     1  0.0703    0.50797 0.976 0.000 0.024 0.000 0.000
#> GSM1179005     3  0.4114    0.51521 0.376 0.000 0.624 0.000 0.000
#> GSM1179007     3  0.4201    0.48560 0.408 0.000 0.592 0.000 0.000
#> GSM1179012     1  0.0579    0.50613 0.984 0.000 0.008 0.000 0.008
#> GSM1179016     5  0.1893    0.64107 0.048 0.000 0.024 0.000 0.928
#> GSM1179030     3  0.3480    0.24360 0.248 0.000 0.752 0.000 0.000
#> GSM1179038     1  0.4219    0.00552 0.584 0.000 0.416 0.000 0.000
#> GSM1178987     1  0.4682   -0.05250 0.564 0.000 0.420 0.000 0.016
#> GSM1179003     3  0.3929    0.17425 0.028 0.000 0.764 0.000 0.208
#> GSM1179004     1  0.4738   -0.17979 0.520 0.000 0.464 0.000 0.016
#> GSM1179039     2  0.0000    0.87055 0.000 1.000 0.000 0.000 0.000
#> GSM1178975     4  0.0000    0.93500 0.000 0.000 0.000 1.000 0.000
#> GSM1178980     4  0.0000    0.93500 0.000 0.000 0.000 1.000 0.000
#> GSM1178995     3  0.4497    0.51840 0.352 0.000 0.632 0.000 0.016
#> GSM1178996     1  0.4235   -0.05010 0.576 0.000 0.424 0.000 0.000
#> GSM1179001     1  0.2077    0.44958 0.908 0.000 0.084 0.000 0.008
#> GSM1179002     3  0.4249    0.44194 0.432 0.000 0.568 0.000 0.000
#> GSM1179006     1  0.4375   -0.03081 0.576 0.000 0.420 0.000 0.004
#> GSM1179008     1  0.2648    0.41516 0.848 0.000 0.152 0.000 0.000
#> GSM1179015     1  0.0771    0.50439 0.976 0.000 0.004 0.000 0.020
#> GSM1179017     5  0.0807    0.61042 0.012 0.000 0.012 0.000 0.976
#> GSM1179026     1  0.4451    0.16257 0.644 0.000 0.340 0.000 0.016
#> GSM1179033     1  0.4689   -0.05579 0.560 0.000 0.424 0.000 0.016
#> GSM1179035     1  0.4256   -0.03692 0.564 0.000 0.436 0.000 0.000
#> GSM1179036     3  0.4210    0.15948 0.412 0.000 0.588 0.000 0.000
#> GSM1178986     1  0.2563    0.44487 0.872 0.000 0.120 0.000 0.008
#> GSM1178989     3  0.8205    0.30864 0.168 0.208 0.412 0.000 0.212
#> GSM1178993     4  0.0000    0.93500 0.000 0.000 0.000 1.000 0.000
#> GSM1178999     4  0.3757    0.70246 0.000 0.000 0.020 0.772 0.208
#> GSM1179021     4  0.3209    0.75412 0.000 0.000 0.008 0.812 0.180
#> GSM1179025     2  0.0000    0.87055 0.000 1.000 0.000 0.000 0.000
#> GSM1179027     4  0.0000    0.93500 0.000 0.000 0.000 1.000 0.000
#> GSM1179011     4  0.0000    0.93500 0.000 0.000 0.000 1.000 0.000
#> GSM1179023     1  0.1764    0.47026 0.928 0.000 0.064 0.000 0.008
#> GSM1179029     5  0.5509    0.23624 0.468 0.000 0.064 0.000 0.468
#> GSM1179034     1  0.1197    0.49763 0.952 0.000 0.048 0.000 0.000
#> GSM1179040     4  0.0162    0.93276 0.000 0.000 0.000 0.996 0.004
#> GSM1178988     1  0.4300   -0.06566 0.524 0.000 0.476 0.000 0.000
#> GSM1179037     1  0.4538   -0.05056 0.540 0.000 0.452 0.000 0.008

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>            class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM1178971     3  0.0363     0.6862 0.000 0.000 0.988 0.000 0.000 0.012
#> GSM1178979     6  0.7792     0.5099 0.300 0.000 0.196 0.008 0.188 0.308
#> GSM1179009     3  0.6580     0.2229 0.072 0.000 0.552 0.008 0.180 0.188
#> GSM1179031     2  0.0000     0.8258 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1178970     2  0.6281     0.5097 0.004 0.596 0.168 0.008 0.172 0.052
#> GSM1178972     2  0.3495     0.6962 0.000 0.792 0.000 0.008 0.172 0.028
#> GSM1178973     4  0.0000     0.9289 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM1178974     2  0.5770     0.5088 0.004 0.564 0.000 0.008 0.172 0.252
#> GSM1178977     3  0.4642     0.5381 0.040 0.000 0.648 0.008 0.004 0.300
#> GSM1178978     3  0.1334     0.6818 0.032 0.000 0.948 0.000 0.000 0.020
#> GSM1178998     3  0.3833    -0.0955 0.444 0.000 0.556 0.000 0.000 0.000
#> GSM1179010     3  0.1003     0.6860 0.020 0.000 0.964 0.000 0.000 0.016
#> GSM1179018     6  0.6095     0.6393 0.292 0.000 0.324 0.000 0.000 0.384
#> GSM1179024     1  0.4426     0.5580 0.748 0.000 0.156 0.000 0.064 0.032
#> GSM1178984     3  0.0858     0.6834 0.004 0.000 0.968 0.000 0.000 0.028
#> GSM1178990     1  0.4436     0.5763 0.636 0.000 0.324 0.000 0.004 0.036
#> GSM1178991     1  0.5289    -0.4363 0.472 0.000 0.004 0.004 0.448 0.072
#> GSM1178994     3  0.0725     0.6889 0.012 0.000 0.976 0.000 0.000 0.012
#> GSM1178997     3  0.4482     0.3709 0.036 0.000 0.580 0.000 0.000 0.384
#> GSM1179000     3  0.5024     0.5731 0.116 0.000 0.640 0.000 0.004 0.240
#> GSM1179013     1  0.3784     0.6185 0.680 0.000 0.308 0.000 0.012 0.000
#> GSM1179014     5  0.1218     0.9233 0.028 0.000 0.012 0.000 0.956 0.004
#> GSM1179019     3  0.2494     0.6027 0.120 0.000 0.864 0.000 0.000 0.016
#> GSM1179020     1  0.3595     0.5787 0.780 0.000 0.180 0.000 0.004 0.036
#> GSM1179022     1  0.3592     0.5959 0.656 0.000 0.344 0.000 0.000 0.000
#> GSM1179028     2  0.0000     0.8258 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1179032     1  0.3619     0.6126 0.680 0.000 0.316 0.000 0.004 0.000
#> GSM1179041     2  0.0000     0.8258 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1179042     2  0.0000     0.8258 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1178976     2  0.5793     0.5925 0.004 0.652 0.116 0.008 0.172 0.048
#> GSM1178981     3  0.1411     0.6798 0.004 0.000 0.936 0.000 0.000 0.060
#> GSM1178982     3  0.4317     0.6031 0.060 0.000 0.688 0.000 0.000 0.252
#> GSM1178983     6  0.6732     0.7822 0.308 0.000 0.236 0.000 0.044 0.412
#> GSM1178985     3  0.1285     0.6832 0.004 0.000 0.944 0.000 0.000 0.052
#> GSM1178992     1  0.5051     0.4281 0.512 0.000 0.432 0.000 0.024 0.032
#> GSM1179005     3  0.0405     0.6877 0.004 0.000 0.988 0.000 0.000 0.008
#> GSM1179007     3  0.0717     0.6885 0.016 0.000 0.976 0.000 0.000 0.008
#> GSM1179012     1  0.3578     0.5985 0.660 0.000 0.340 0.000 0.000 0.000
#> GSM1179016     5  0.1219     0.9211 0.048 0.000 0.004 0.000 0.948 0.000
#> GSM1179030     6  0.6169     0.7722 0.304 0.000 0.244 0.008 0.000 0.444
#> GSM1179038     1  0.4488    -0.3840 0.548 0.000 0.032 0.000 0.000 0.420
#> GSM1178987     3  0.3261     0.6654 0.016 0.000 0.780 0.000 0.000 0.204
#> GSM1179003     1  0.7808    -0.7167 0.304 0.000 0.208 0.008 0.184 0.296
#> GSM1179004     3  0.3078     0.6734 0.012 0.000 0.796 0.000 0.000 0.192
#> GSM1179039     2  0.0000     0.8258 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1178975     4  0.0000     0.9289 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM1178980     4  0.0146     0.9282 0.000 0.000 0.000 0.996 0.000 0.004
#> GSM1178995     3  0.1010     0.6856 0.004 0.000 0.960 0.000 0.000 0.036
#> GSM1178996     3  0.3315     0.6648 0.020 0.000 0.780 0.000 0.000 0.200
#> GSM1179001     1  0.3747     0.5320 0.604 0.000 0.396 0.000 0.000 0.000
#> GSM1179002     3  0.1866     0.6461 0.084 0.000 0.908 0.000 0.000 0.008
#> GSM1179006     3  0.3642     0.6485 0.036 0.000 0.760 0.000 0.000 0.204
#> GSM1179008     3  0.4500     0.0429 0.392 0.000 0.572 0.000 0.000 0.036
#> GSM1179015     1  0.3871     0.6190 0.676 0.000 0.308 0.000 0.016 0.000
#> GSM1179017     5  0.2009     0.8882 0.004 0.000 0.000 0.008 0.904 0.084
#> GSM1179026     3  0.4518     0.6213 0.104 0.000 0.696 0.000 0.000 0.200
#> GSM1179033     3  0.3483     0.6605 0.024 0.000 0.764 0.000 0.000 0.212
#> GSM1179035     3  0.4422     0.5857 0.088 0.000 0.700 0.000 0.000 0.212
#> GSM1179036     3  0.5937    -0.3975 0.220 0.000 0.428 0.000 0.000 0.352
#> GSM1178986     1  0.6226     0.4040 0.532 0.000 0.236 0.000 0.036 0.196
#> GSM1178989     3  0.7099    -0.1623 0.008 0.308 0.444 0.008 0.172 0.060
#> GSM1178993     4  0.0146     0.9280 0.000 0.000 0.000 0.996 0.004 0.000
#> GSM1178999     4  0.3394     0.7164 0.012 0.000 0.000 0.788 0.188 0.012
#> GSM1179021     4  0.3296     0.7202 0.008 0.000 0.000 0.792 0.188 0.012
#> GSM1179025     2  0.0146     0.8241 0.000 0.996 0.000 0.000 0.000 0.004
#> GSM1179027     4  0.0146     0.9280 0.000 0.000 0.000 0.996 0.004 0.000
#> GSM1179011     4  0.0146     0.9280 0.000 0.000 0.000 0.996 0.004 0.000
#> GSM1179023     1  0.3695     0.5601 0.624 0.000 0.376 0.000 0.000 0.000
#> GSM1179029     1  0.5573     0.0577 0.460 0.000 0.120 0.000 0.416 0.004
#> GSM1179034     1  0.3098     0.5216 0.836 0.000 0.120 0.000 0.040 0.004
#> GSM1179040     4  0.0363     0.9251 0.000 0.000 0.000 0.988 0.000 0.012
#> GSM1178988     3  0.4351     0.5551 0.044 0.000 0.676 0.004 0.000 0.276
#> GSM1179037     3  0.3572     0.6521 0.032 0.000 0.764 0.000 0.000 0.204

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) protocol(p) k
#> ATC:mclust 73          0.20234      0.1570 2
#> ATC:mclust 73          0.00304      0.1628 3
#> ATC:mclust 70          0.00569      0.2415 4
#> ATC:mclust 35          0.00941      0.5346 5
#> ATC:mclust 61          0.01540      0.0629 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 31632 rows and 73 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 1.000           0.957       0.983         0.4566 0.543   0.543
#> 3 3 0.732           0.823       0.912         0.2633 0.851   0.735
#> 4 4 0.645           0.693       0.846         0.1285 0.915   0.805
#> 5 5 0.644           0.645       0.816         0.1485 0.846   0.596
#> 6 6 0.604           0.555       0.761         0.0457 0.953   0.819

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
#> GSM1178971     1  0.0000      0.985 1.000 0.000
#> GSM1178979     2  0.0000      0.974 0.000 1.000
#> GSM1179009     1  0.0000      0.985 1.000 0.000
#> GSM1179031     2  0.0000      0.974 0.000 1.000
#> GSM1178970     2  0.0000      0.974 0.000 1.000
#> GSM1178972     2  0.0000      0.974 0.000 1.000
#> GSM1178973     1  0.0000      0.985 1.000 0.000
#> GSM1178974     2  0.0000      0.974 0.000 1.000
#> GSM1178977     2  0.0000      0.974 0.000 1.000
#> GSM1178978     1  0.0000      0.985 1.000 0.000
#> GSM1178998     1  0.0000      0.985 1.000 0.000
#> GSM1179010     1  0.0000      0.985 1.000 0.000
#> GSM1179018     1  0.0000      0.985 1.000 0.000
#> GSM1179024     1  0.0000      0.985 1.000 0.000
#> GSM1178984     1  0.0000      0.985 1.000 0.000
#> GSM1178990     1  0.0000      0.985 1.000 0.000
#> GSM1178991     1  0.0000      0.985 1.000 0.000
#> GSM1178994     1  0.0000      0.985 1.000 0.000
#> GSM1178997     1  0.9896      0.183 0.560 0.440
#> GSM1179000     1  0.0000      0.985 1.000 0.000
#> GSM1179013     1  0.0000      0.985 1.000 0.000
#> GSM1179014     1  0.0000      0.985 1.000 0.000
#> GSM1179019     1  0.0000      0.985 1.000 0.000
#> GSM1179020     1  0.0000      0.985 1.000 0.000
#> GSM1179022     1  0.0000      0.985 1.000 0.000
#> GSM1179028     2  0.0000      0.974 0.000 1.000
#> GSM1179032     1  0.0000      0.985 1.000 0.000
#> GSM1179041     2  0.0000      0.974 0.000 1.000
#> GSM1179042     2  0.0000      0.974 0.000 1.000
#> GSM1178976     2  0.0000      0.974 0.000 1.000
#> GSM1178981     1  0.0000      0.985 1.000 0.000
#> GSM1178982     1  0.1184      0.971 0.984 0.016
#> GSM1178983     1  0.6148      0.812 0.848 0.152
#> GSM1178985     1  0.0000      0.985 1.000 0.000
#> GSM1178992     1  0.0000      0.985 1.000 0.000
#> GSM1179005     1  0.0000      0.985 1.000 0.000
#> GSM1179007     1  0.0000      0.985 1.000 0.000
#> GSM1179012     1  0.0000      0.985 1.000 0.000
#> GSM1179016     1  0.0000      0.985 1.000 0.000
#> GSM1179030     2  0.0376      0.972 0.004 0.996
#> GSM1179038     1  0.0000      0.985 1.000 0.000
#> GSM1178987     1  0.0000      0.985 1.000 0.000
#> GSM1179003     2  0.0000      0.974 0.000 1.000
#> GSM1179004     1  0.0000      0.985 1.000 0.000
#> GSM1179039     2  0.0000      0.974 0.000 1.000
#> GSM1178975     2  0.7883      0.694 0.236 0.764
#> GSM1178980     2  0.0000      0.974 0.000 1.000
#> GSM1178995     1  0.0000      0.985 1.000 0.000
#> GSM1178996     1  0.0000      0.985 1.000 0.000
#> GSM1179001     1  0.0000      0.985 1.000 0.000
#> GSM1179002     1  0.0000      0.985 1.000 0.000
#> GSM1179006     1  0.0000      0.985 1.000 0.000
#> GSM1179008     1  0.0000      0.985 1.000 0.000
#> GSM1179015     1  0.0000      0.985 1.000 0.000
#> GSM1179017     2  0.1843      0.952 0.028 0.972
#> GSM1179026     1  0.0000      0.985 1.000 0.000
#> GSM1179033     1  0.2043      0.956 0.968 0.032
#> GSM1179035     1  0.0000      0.985 1.000 0.000
#> GSM1179036     1  0.1184      0.971 0.984 0.016
#> GSM1178986     1  0.0000      0.985 1.000 0.000
#> GSM1178989     2  0.0000      0.974 0.000 1.000
#> GSM1178993     2  0.0672      0.969 0.008 0.992
#> GSM1178999     2  0.0000      0.974 0.000 1.000
#> GSM1179021     2  0.0000      0.974 0.000 1.000
#> GSM1179025     2  0.0000      0.974 0.000 1.000
#> GSM1179027     2  0.0000      0.974 0.000 1.000
#> GSM1179011     2  0.0938      0.966 0.012 0.988
#> GSM1179023     1  0.0000      0.985 1.000 0.000
#> GSM1179029     1  0.0000      0.985 1.000 0.000
#> GSM1179034     1  0.0000      0.985 1.000 0.000
#> GSM1179040     2  0.0000      0.974 0.000 1.000
#> GSM1178988     2  0.9000      0.545 0.316 0.684
#> GSM1179037     1  0.0000      0.985 1.000 0.000

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>            class entropy silhouette    p1    p2    p3
#> GSM1178971     1  0.1031      0.928 0.976 0.000 0.024
#> GSM1178979     2  0.1163      0.868 0.000 0.972 0.028
#> GSM1179009     3  0.5905      0.525 0.352 0.000 0.648
#> GSM1179031     2  0.0424      0.876 0.000 0.992 0.008
#> GSM1178970     2  0.0747      0.874 0.000 0.984 0.016
#> GSM1178972     2  0.0592      0.872 0.000 0.988 0.012
#> GSM1178973     3  0.4452      0.722 0.192 0.000 0.808
#> GSM1178974     2  0.1289      0.863 0.000 0.968 0.032
#> GSM1178977     2  0.0592      0.876 0.000 0.988 0.012
#> GSM1178978     1  0.1031      0.928 0.976 0.000 0.024
#> GSM1178998     1  0.0237      0.931 0.996 0.000 0.004
#> GSM1179010     1  0.1031      0.928 0.976 0.000 0.024
#> GSM1179018     3  0.5016      0.692 0.240 0.000 0.760
#> GSM1179024     1  0.0747      0.930 0.984 0.000 0.016
#> GSM1178984     1  0.0892      0.931 0.980 0.000 0.020
#> GSM1178990     1  0.1031      0.927 0.976 0.000 0.024
#> GSM1178991     1  0.5905      0.490 0.648 0.000 0.352
#> GSM1178994     1  0.0592      0.930 0.988 0.000 0.012
#> GSM1178997     2  0.6291      0.106 0.468 0.532 0.000
#> GSM1179000     1  0.0424      0.931 0.992 0.000 0.008
#> GSM1179013     1  0.0747      0.931 0.984 0.000 0.016
#> GSM1179014     1  0.3755      0.843 0.872 0.008 0.120
#> GSM1179019     1  0.0747      0.929 0.984 0.000 0.016
#> GSM1179020     1  0.1031      0.927 0.976 0.000 0.024
#> GSM1179022     1  0.0237      0.931 0.996 0.000 0.004
#> GSM1179028     2  0.0237      0.876 0.000 0.996 0.004
#> GSM1179032     1  0.0747      0.930 0.984 0.000 0.016
#> GSM1179041     2  0.0237      0.876 0.000 0.996 0.004
#> GSM1179042     2  0.0424      0.876 0.000 0.992 0.008
#> GSM1178976     2  0.0892      0.869 0.000 0.980 0.020
#> GSM1178981     1  0.0747      0.931 0.984 0.000 0.016
#> GSM1178982     1  0.4708      0.798 0.844 0.036 0.120
#> GSM1178983     3  0.7533      0.535 0.348 0.052 0.600
#> GSM1178985     1  0.1337      0.925 0.972 0.016 0.012
#> GSM1178992     1  0.0892      0.929 0.980 0.000 0.020
#> GSM1179005     1  0.0892      0.929 0.980 0.000 0.020
#> GSM1179007     1  0.0000      0.931 1.000 0.000 0.000
#> GSM1179012     1  0.0592      0.932 0.988 0.000 0.012
#> GSM1179016     1  0.3896      0.835 0.864 0.008 0.128
#> GSM1179030     2  0.4750      0.698 0.000 0.784 0.216
#> GSM1179038     1  0.5678      0.567 0.684 0.000 0.316
#> GSM1178987     1  0.0592      0.930 0.988 0.000 0.012
#> GSM1179003     2  0.2356      0.841 0.000 0.928 0.072
#> GSM1179004     1  0.2165      0.903 0.936 0.000 0.064
#> GSM1179039     2  0.0424      0.876 0.000 0.992 0.008
#> GSM1178975     3  0.2339      0.780 0.012 0.048 0.940
#> GSM1178980     3  0.2878      0.767 0.000 0.096 0.904
#> GSM1178995     1  0.0237      0.931 0.996 0.000 0.004
#> GSM1178996     1  0.1163      0.926 0.972 0.000 0.028
#> GSM1179001     1  0.0592      0.930 0.988 0.000 0.012
#> GSM1179002     1  0.0747      0.930 0.984 0.000 0.016
#> GSM1179006     1  0.0983      0.928 0.980 0.016 0.004
#> GSM1179008     1  0.0237      0.931 0.996 0.000 0.004
#> GSM1179015     1  0.0747      0.929 0.984 0.000 0.016
#> GSM1179017     2  0.5431      0.619 0.000 0.716 0.284
#> GSM1179026     1  0.4235      0.787 0.824 0.000 0.176
#> GSM1179033     1  0.2200      0.900 0.940 0.056 0.004
#> GSM1179035     1  0.5968      0.389 0.636 0.000 0.364
#> GSM1179036     1  0.6742      0.492 0.656 0.028 0.316
#> GSM1178986     1  0.0747      0.930 0.984 0.000 0.016
#> GSM1178989     2  0.0892      0.869 0.000 0.980 0.020
#> GSM1178993     3  0.2550      0.781 0.012 0.056 0.932
#> GSM1178999     3  0.4842      0.631 0.000 0.224 0.776
#> GSM1179021     2  0.5058      0.634 0.000 0.756 0.244
#> GSM1179025     2  0.0424      0.876 0.000 0.992 0.008
#> GSM1179027     3  0.2537      0.776 0.000 0.080 0.920
#> GSM1179011     3  0.2590      0.779 0.004 0.072 0.924
#> GSM1179023     1  0.0237      0.931 0.996 0.000 0.004
#> GSM1179029     1  0.1031      0.931 0.976 0.000 0.024
#> GSM1179034     1  0.1163      0.926 0.972 0.000 0.028
#> GSM1179040     3  0.3941      0.725 0.000 0.156 0.844
#> GSM1178988     2  0.6703      0.512 0.236 0.712 0.052
#> GSM1179037     1  0.3500      0.858 0.880 0.004 0.116

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>            class entropy silhouette    p1    p2    p3    p4
#> GSM1178971     1  0.1389    0.87107 0.952 0.000 0.048 0.000
#> GSM1178979     2  0.1474    0.78116 0.000 0.948 0.052 0.000
#> GSM1179009     4  0.5979    0.53824 0.164 0.004 0.128 0.704
#> GSM1179031     2  0.0707    0.78298 0.000 0.980 0.020 0.000
#> GSM1178970     2  0.3123    0.72060 0.000 0.844 0.156 0.000
#> GSM1178972     2  0.1022    0.78179 0.000 0.968 0.032 0.000
#> GSM1178973     4  0.1256    0.76002 0.028 0.000 0.008 0.964
#> GSM1178974     2  0.2345    0.76140 0.000 0.900 0.100 0.000
#> GSM1178977     2  0.1576    0.77517 0.000 0.948 0.048 0.004
#> GSM1178978     1  0.1940    0.86250 0.924 0.000 0.076 0.000
#> GSM1178998     1  0.1109    0.87368 0.968 0.000 0.028 0.004
#> GSM1179010     1  0.3157    0.82306 0.852 0.000 0.144 0.004
#> GSM1179018     4  0.2489    0.73523 0.068 0.000 0.020 0.912
#> GSM1179024     1  0.1637    0.86250 0.940 0.000 0.060 0.000
#> GSM1178984     1  0.3498    0.80372 0.832 0.000 0.160 0.008
#> GSM1178990     1  0.1576    0.86961 0.948 0.000 0.048 0.004
#> GSM1178991     3  0.6928    0.52788 0.268 0.000 0.576 0.156
#> GSM1178994     1  0.1576    0.87001 0.948 0.000 0.048 0.004
#> GSM1178997     2  0.5285    0.00222 0.468 0.524 0.008 0.000
#> GSM1179000     1  0.1389    0.86840 0.952 0.000 0.048 0.000
#> GSM1179013     1  0.1211    0.87096 0.960 0.000 0.040 0.000
#> GSM1179014     1  0.4343    0.59676 0.732 0.000 0.264 0.004
#> GSM1179019     1  0.1118    0.87220 0.964 0.000 0.036 0.000
#> GSM1179020     1  0.1302    0.86958 0.956 0.000 0.044 0.000
#> GSM1179022     1  0.1022    0.87306 0.968 0.000 0.032 0.000
#> GSM1179028     2  0.0469    0.78356 0.000 0.988 0.012 0.000
#> GSM1179032     1  0.1118    0.87220 0.964 0.000 0.036 0.000
#> GSM1179041     2  0.0336    0.78413 0.000 0.992 0.008 0.000
#> GSM1179042     2  0.0817    0.78188 0.000 0.976 0.024 0.000
#> GSM1178976     2  0.4661    0.59498 0.004 0.708 0.284 0.004
#> GSM1178981     1  0.3725    0.78629 0.812 0.000 0.180 0.008
#> GSM1178982     1  0.4626    0.78986 0.816 0.016 0.108 0.060
#> GSM1178983     4  0.5964    0.42351 0.256 0.044 0.020 0.680
#> GSM1178985     1  0.5057    0.71034 0.748 0.044 0.204 0.004
#> GSM1178992     1  0.2704    0.81857 0.876 0.000 0.124 0.000
#> GSM1179005     1  0.1716    0.86687 0.936 0.000 0.064 0.000
#> GSM1179007     1  0.1716    0.86653 0.936 0.000 0.064 0.000
#> GSM1179012     1  0.0707    0.87488 0.980 0.000 0.020 0.000
#> GSM1179016     1  0.5050    0.19303 0.588 0.000 0.408 0.004
#> GSM1179030     3  0.6885    0.22609 0.004 0.360 0.536 0.100
#> GSM1179038     3  0.7170    0.51789 0.268 0.000 0.548 0.184
#> GSM1178987     1  0.1576    0.87104 0.948 0.000 0.048 0.004
#> GSM1179003     2  0.5688    0.01754 0.000 0.512 0.464 0.024
#> GSM1179004     1  0.3818    0.81513 0.844 0.000 0.108 0.048
#> GSM1179039     2  0.0921    0.78085 0.000 0.972 0.028 0.000
#> GSM1178975     4  0.1209    0.75349 0.000 0.004 0.032 0.964
#> GSM1178980     4  0.2730    0.70614 0.000 0.016 0.088 0.896
#> GSM1178995     1  0.2918    0.83716 0.876 0.000 0.116 0.008
#> GSM1178996     1  0.1191    0.87649 0.968 0.004 0.024 0.004
#> GSM1179001     1  0.0188    0.87581 0.996 0.000 0.004 0.000
#> GSM1179002     1  0.1474    0.87132 0.948 0.000 0.052 0.000
#> GSM1179006     1  0.1489    0.87672 0.952 0.004 0.044 0.000
#> GSM1179008     1  0.0469    0.87577 0.988 0.000 0.012 0.000
#> GSM1179015     1  0.1211    0.87096 0.960 0.000 0.040 0.000
#> GSM1179017     3  0.5915    0.41749 0.024 0.236 0.696 0.044
#> GSM1179026     3  0.6586    0.30723 0.420 0.000 0.500 0.080
#> GSM1179033     1  0.4359    0.78323 0.804 0.016 0.164 0.016
#> GSM1179035     4  0.6915    0.09704 0.416 0.000 0.108 0.476
#> GSM1179036     1  0.6818    0.06185 0.512 0.028 0.044 0.416
#> GSM1178986     1  0.1557    0.86472 0.944 0.000 0.056 0.000
#> GSM1178989     2  0.2714    0.75095 0.004 0.884 0.112 0.000
#> GSM1178993     4  0.0657    0.75945 0.000 0.004 0.012 0.984
#> GSM1178999     3  0.7083    0.08759 0.000 0.124 0.444 0.432
#> GSM1179021     2  0.5661    0.52343 0.000 0.700 0.080 0.220
#> GSM1179025     2  0.1118    0.78016 0.000 0.964 0.036 0.000
#> GSM1179027     4  0.0672    0.76079 0.000 0.008 0.008 0.984
#> GSM1179011     4  0.0524    0.76168 0.000 0.008 0.004 0.988
#> GSM1179023     1  0.1118    0.87220 0.964 0.000 0.036 0.000
#> GSM1179029     1  0.2647    0.81543 0.880 0.000 0.120 0.000
#> GSM1179034     1  0.1211    0.87096 0.960 0.000 0.040 0.000
#> GSM1179040     4  0.2522    0.72326 0.000 0.076 0.016 0.908
#> GSM1178988     2  0.7857   -0.11588 0.352 0.440 0.200 0.008
#> GSM1179037     1  0.5783    0.62118 0.708 0.000 0.172 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
#> GSM1178971     1  0.0566     0.8166 0.984 0.000 0.012 0.004 0.000
#> GSM1178979     2  0.1124     0.8985 0.000 0.960 0.000 0.004 0.036
#> GSM1179009     4  0.4288     0.1867 0.000 0.000 0.384 0.612 0.004
#> GSM1179031     2  0.0162     0.9081 0.000 0.996 0.000 0.000 0.004
#> GSM1178970     2  0.2921     0.8106 0.000 0.856 0.124 0.000 0.020
#> GSM1178972     2  0.1444     0.8947 0.000 0.948 0.012 0.000 0.040
#> GSM1178973     4  0.1872     0.7296 0.020 0.000 0.052 0.928 0.000
#> GSM1178974     2  0.1872     0.8808 0.000 0.928 0.020 0.000 0.052
#> GSM1178977     2  0.0566     0.9060 0.000 0.984 0.000 0.004 0.012
#> GSM1178978     1  0.1074     0.8143 0.968 0.004 0.016 0.012 0.000
#> GSM1178998     1  0.1697     0.8039 0.932 0.000 0.060 0.008 0.000
#> GSM1179010     3  0.3942     0.5545 0.260 0.000 0.728 0.012 0.000
#> GSM1179018     4  0.3675     0.6095 0.000 0.000 0.188 0.788 0.024
#> GSM1179024     1  0.0613     0.8110 0.984 0.000 0.008 0.004 0.004
#> GSM1178984     1  0.5547     0.3129 0.564 0.000 0.356 0.080 0.000
#> GSM1178990     1  0.2221     0.7987 0.912 0.000 0.052 0.000 0.036
#> GSM1178991     5  0.5900     0.5558 0.252 0.000 0.008 0.128 0.612
#> GSM1178994     1  0.2189     0.7949 0.904 0.000 0.084 0.012 0.000
#> GSM1178997     2  0.4299     0.3097 0.388 0.608 0.004 0.000 0.000
#> GSM1179000     1  0.0579     0.8127 0.984 0.000 0.008 0.008 0.000
#> GSM1179013     1  0.0000     0.8157 1.000 0.000 0.000 0.000 0.000
#> GSM1179014     1  0.4422     0.4204 0.664 0.000 0.012 0.004 0.320
#> GSM1179019     1  0.0324     0.8144 0.992 0.000 0.004 0.004 0.000
#> GSM1179020     1  0.0671     0.8129 0.980 0.000 0.004 0.016 0.000
#> GSM1179022     1  0.0566     0.8167 0.984 0.000 0.012 0.004 0.000
#> GSM1179028     2  0.0404     0.9062 0.000 0.988 0.000 0.000 0.012
#> GSM1179032     1  0.0324     0.8163 0.992 0.000 0.004 0.004 0.000
#> GSM1179041     2  0.0000     0.9080 0.000 1.000 0.000 0.000 0.000
#> GSM1179042     2  0.0703     0.9054 0.000 0.976 0.000 0.000 0.024
#> GSM1178976     3  0.3056     0.5620 0.000 0.112 0.860 0.020 0.008
#> GSM1178981     1  0.5884     0.0469 0.480 0.000 0.420 0.100 0.000
#> GSM1178982     1  0.7511    -0.0258 0.444 0.052 0.248 0.256 0.000
#> GSM1178983     4  0.6341     0.3311 0.292 0.116 0.012 0.572 0.008
#> GSM1178985     3  0.5584     0.4375 0.312 0.000 0.592 0.096 0.000
#> GSM1178992     1  0.5304     0.4752 0.628 0.000 0.080 0.000 0.292
#> GSM1179005     1  0.4046     0.5687 0.696 0.000 0.296 0.008 0.000
#> GSM1179007     1  0.3424     0.6544 0.760 0.000 0.240 0.000 0.000
#> GSM1179012     1  0.0794     0.8155 0.972 0.000 0.028 0.000 0.000
#> GSM1179016     5  0.5203     0.5004 0.264 0.000 0.072 0.004 0.660
#> GSM1179030     5  0.3986     0.7196 0.000 0.048 0.044 0.080 0.828
#> GSM1179038     5  0.4138     0.6896 0.016 0.000 0.040 0.152 0.792
#> GSM1178987     3  0.5429     0.6002 0.228 0.000 0.660 0.108 0.004
#> GSM1179003     5  0.2861     0.7214 0.000 0.064 0.024 0.024 0.888
#> GSM1179004     3  0.5928     0.4725 0.124 0.000 0.548 0.328 0.000
#> GSM1179039     2  0.0404     0.9070 0.000 0.988 0.000 0.000 0.012
#> GSM1178975     4  0.3280     0.6514 0.024 0.004 0.004 0.848 0.120
#> GSM1178980     4  0.3997     0.5865 0.000 0.032 0.004 0.776 0.188
#> GSM1178995     1  0.5246     0.2954 0.564 0.000 0.384 0.052 0.000
#> GSM1178996     1  0.4851     0.3138 0.560 0.000 0.420 0.008 0.012
#> GSM1179001     1  0.1638     0.8034 0.932 0.000 0.064 0.004 0.000
#> GSM1179002     1  0.4025     0.5761 0.700 0.000 0.292 0.008 0.000
#> GSM1179006     3  0.3810     0.6231 0.168 0.000 0.792 0.000 0.040
#> GSM1179008     1  0.2358     0.7788 0.888 0.000 0.104 0.008 0.000
#> GSM1179015     1  0.0510     0.8170 0.984 0.000 0.016 0.000 0.000
#> GSM1179017     5  0.1772     0.7274 0.004 0.024 0.012 0.016 0.944
#> GSM1179026     3  0.5850     0.0732 0.036 0.000 0.468 0.032 0.464
#> GSM1179033     3  0.4643     0.6177 0.068 0.004 0.736 0.192 0.000
#> GSM1179035     3  0.4442     0.4945 0.016 0.000 0.676 0.304 0.004
#> GSM1179036     3  0.5488     0.3056 0.008 0.000 0.540 0.404 0.048
#> GSM1178986     1  0.0613     0.8128 0.984 0.000 0.008 0.004 0.004
#> GSM1178989     3  0.2928     0.5677 0.000 0.064 0.872 0.000 0.064
#> GSM1178993     4  0.1153     0.7323 0.004 0.024 0.000 0.964 0.008
#> GSM1178999     5  0.6003     0.3931 0.000 0.124 0.008 0.280 0.588
#> GSM1179021     2  0.2976     0.7830 0.000 0.852 0.004 0.132 0.012
#> GSM1179025     2  0.0000     0.9080 0.000 1.000 0.000 0.000 0.000
#> GSM1179027     4  0.1914     0.7309 0.000 0.016 0.060 0.924 0.000
#> GSM1179011     4  0.1834     0.7290 0.008 0.032 0.004 0.940 0.016
#> GSM1179023     1  0.0451     0.8159 0.988 0.000 0.004 0.008 0.000
#> GSM1179029     1  0.0798     0.8113 0.976 0.000 0.008 0.000 0.016
#> GSM1179034     1  0.0566     0.8146 0.984 0.000 0.004 0.012 0.000
#> GSM1179040     4  0.4616     0.5153 0.000 0.288 0.028 0.680 0.004
#> GSM1178988     3  0.5277     0.2518 0.040 0.008 0.584 0.000 0.368
#> GSM1179037     3  0.4548     0.6186 0.020 0.000 0.780 0.092 0.108

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>            class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM1178971     1  0.1382     0.8184 0.948 0.000 0.008 0.000 0.008 0.036
#> GSM1178979     2  0.3828     0.7367 0.000 0.780 0.000 0.048 0.012 0.160
#> GSM1179009     4  0.5204     0.0175 0.008 0.000 0.428 0.496 0.000 0.068
#> GSM1179031     2  0.0713     0.8471 0.000 0.972 0.000 0.000 0.000 0.028
#> GSM1178970     6  0.5131    -0.1208 0.000 0.404 0.064 0.008 0.000 0.524
#> GSM1178972     2  0.2344     0.8249 0.000 0.892 0.004 0.000 0.028 0.076
#> GSM1178973     4  0.2113     0.6515 0.008 0.000 0.032 0.912 0.000 0.048
#> GSM1178974     2  0.3503     0.7442 0.000 0.788 0.012 0.000 0.020 0.180
#> GSM1178977     2  0.4067     0.7346 0.008 0.788 0.004 0.068 0.008 0.124
#> GSM1178978     1  0.6030     0.1159 0.520 0.000 0.004 0.236 0.008 0.232
#> GSM1178998     1  0.1716     0.8159 0.932 0.000 0.028 0.000 0.004 0.036
#> GSM1179010     3  0.5119     0.2855 0.264 0.000 0.608 0.000 0.000 0.128
#> GSM1179018     4  0.4647     0.5645 0.000 0.000 0.124 0.744 0.048 0.084
#> GSM1179024     1  0.1148     0.8150 0.960 0.000 0.004 0.000 0.016 0.020
#> GSM1178984     1  0.6494     0.0917 0.472 0.000 0.340 0.080 0.000 0.108
#> GSM1178990     1  0.1155     0.8188 0.956 0.000 0.036 0.000 0.004 0.004
#> GSM1178991     5  0.7031     0.3317 0.264 0.000 0.008 0.116 0.480 0.132
#> GSM1178994     1  0.5005     0.5387 0.692 0.000 0.052 0.060 0.000 0.196
#> GSM1178997     2  0.4285     0.1482 0.432 0.552 0.000 0.000 0.008 0.008
#> GSM1179000     1  0.0912     0.8177 0.972 0.000 0.004 0.004 0.008 0.012
#> GSM1179013     1  0.0508     0.8186 0.984 0.000 0.000 0.000 0.004 0.012
#> GSM1179014     1  0.4834     0.3750 0.596 0.000 0.004 0.000 0.340 0.060
#> GSM1179019     1  0.0622     0.8192 0.980 0.000 0.000 0.000 0.008 0.012
#> GSM1179020     1  0.0260     0.8194 0.992 0.000 0.000 0.000 0.008 0.000
#> GSM1179022     1  0.0363     0.8197 0.988 0.000 0.000 0.000 0.000 0.012
#> GSM1179028     2  0.0922     0.8480 0.000 0.968 0.000 0.004 0.004 0.024
#> GSM1179032     1  0.0458     0.8191 0.984 0.000 0.000 0.000 0.000 0.016
#> GSM1179041     2  0.0458     0.8481 0.000 0.984 0.000 0.000 0.000 0.016
#> GSM1179042     2  0.0767     0.8474 0.000 0.976 0.004 0.000 0.008 0.012
#> GSM1178976     3  0.3582     0.4544 0.000 0.036 0.768 0.000 0.000 0.196
#> GSM1178981     6  0.7513     0.3661 0.180 0.000 0.192 0.268 0.000 0.360
#> GSM1178982     4  0.7586    -0.3956 0.156 0.024 0.112 0.368 0.000 0.340
#> GSM1178983     4  0.5899     0.3185 0.100 0.036 0.004 0.648 0.024 0.188
#> GSM1178985     6  0.7439     0.3873 0.140 0.008 0.232 0.192 0.000 0.428
#> GSM1178992     1  0.3170     0.7649 0.840 0.000 0.032 0.000 0.112 0.016
#> GSM1179005     1  0.3481     0.7054 0.776 0.000 0.192 0.000 0.000 0.032
#> GSM1179007     1  0.3296     0.7181 0.796 0.000 0.180 0.004 0.000 0.020
#> GSM1179012     1  0.1578     0.8094 0.936 0.000 0.012 0.000 0.004 0.048
#> GSM1179016     5  0.5570     0.2207 0.280 0.000 0.004 0.000 0.556 0.160
#> GSM1179030     5  0.5856     0.4537 0.004 0.064 0.004 0.092 0.636 0.200
#> GSM1179038     5  0.5757     0.4732 0.016 0.000 0.100 0.148 0.668 0.068
#> GSM1178987     3  0.7168    -0.0511 0.164 0.000 0.424 0.060 0.024 0.328
#> GSM1179003     5  0.3130     0.5569 0.000 0.124 0.008 0.020 0.840 0.008
#> GSM1179004     3  0.6823     0.3099 0.156 0.000 0.532 0.168 0.004 0.140
#> GSM1179039     2  0.0603     0.8476 0.000 0.980 0.004 0.000 0.000 0.016
#> GSM1178975     4  0.3516     0.5896 0.008 0.000 0.004 0.824 0.076 0.088
#> GSM1178980     4  0.4368     0.4974 0.000 0.012 0.004 0.740 0.180 0.064
#> GSM1178995     1  0.4995     0.4585 0.612 0.000 0.320 0.032 0.000 0.036
#> GSM1178996     1  0.4305     0.6220 0.692 0.004 0.256 0.000 0.000 0.048
#> GSM1179001     1  0.1988     0.8092 0.920 0.000 0.048 0.004 0.004 0.024
#> GSM1179002     1  0.4336     0.6464 0.712 0.000 0.228 0.004 0.004 0.052
#> GSM1179006     6  0.7600     0.1969 0.156 0.008 0.240 0.020 0.120 0.456
#> GSM1179008     1  0.3030     0.7904 0.868 0.000 0.052 0.008 0.016 0.056
#> GSM1179015     1  0.1542     0.8078 0.936 0.000 0.008 0.000 0.004 0.052
#> GSM1179017     5  0.1148     0.5682 0.000 0.020 0.004 0.000 0.960 0.016
#> GSM1179026     3  0.5364     0.3138 0.020 0.000 0.612 0.032 0.304 0.032
#> GSM1179033     3  0.4147     0.5040 0.136 0.004 0.780 0.048 0.000 0.032
#> GSM1179035     3  0.4358     0.4913 0.000 0.000 0.732 0.176 0.008 0.084
#> GSM1179036     3  0.5772     0.4160 0.004 0.000 0.624 0.224 0.060 0.088
#> GSM1178986     1  0.6155     0.3944 0.600 0.000 0.004 0.068 0.180 0.148
#> GSM1178989     3  0.3859     0.4366 0.000 0.024 0.756 0.000 0.016 0.204
#> GSM1178993     4  0.0551     0.6582 0.004 0.000 0.004 0.984 0.008 0.000
#> GSM1178999     5  0.7493     0.3158 0.000 0.232 0.052 0.168 0.472 0.076
#> GSM1179021     2  0.3332     0.7721 0.000 0.840 0.008 0.092 0.008 0.052
#> GSM1179025     2  0.0837     0.8466 0.000 0.972 0.004 0.004 0.000 0.020
#> GSM1179027     4  0.3212     0.6333 0.000 0.008 0.104 0.844 0.008 0.036
#> GSM1179011     4  0.1340     0.6527 0.004 0.000 0.000 0.948 0.008 0.040
#> GSM1179023     1  0.0622     0.8192 0.980 0.000 0.000 0.000 0.008 0.012
#> GSM1179029     1  0.1321     0.8163 0.952 0.000 0.004 0.000 0.024 0.020
#> GSM1179034     1  0.0508     0.8189 0.984 0.000 0.004 0.000 0.000 0.012
#> GSM1179040     4  0.5797     0.3278 0.000 0.332 0.060 0.552 0.004 0.052
#> GSM1178988     5  0.6367     0.2411 0.000 0.024 0.248 0.000 0.468 0.260
#> GSM1179037     3  0.3374     0.5412 0.008 0.000 0.848 0.052 0.068 0.024

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

consensus_heatmap(res, k = 2)

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

consensus_heatmap(res, k = 3)

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

consensus_heatmap(res, k = 4)

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

consensus_heatmap(res, k = 5)

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

consensus_heatmap(res, k = 6)

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

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

membership_heatmap(res, k = 2)

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

membership_heatmap(res, k = 3)

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

membership_heatmap(res, k = 4)

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

membership_heatmap(res, k = 5)

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

membership_heatmap(res, k = 6)

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

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

Signature heatmaps where rows are scaled:

get_signatures(res, k = 2)

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

get_signatures(res, k = 3)

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

get_signatures(res, k = 4)

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

get_signatures(res, k = 5)

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

get_signatures(res, k = 6)

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

Signature heatmaps where rows are not scaled:

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

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

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

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

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

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

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

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

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

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

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk ATC-NMF-signature_compare

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

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

An example of the output of tb is:

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

The columns in tb are:

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

UMAP plot which shows how samples are separated.

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

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

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

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

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

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

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

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

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

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

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk ATC-NMF-collect-classes

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

test_to_known_factors(res)
#>          n disease.state(p) protocol(p) k
#> ATC:NMF 72           0.0301       0.226 2
#> ATC:NMF 69           0.0537       0.853 3
#> ATC:NMF 62           0.0390       0.839 4
#> ATC:NMF 56           0.0571       0.438 5
#> ATC:NMF 44           0.0398       0.507 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